Moved event handlers to mChat object
This commit is contained in:
@@ -224,7 +224,8 @@ jQuery(function($) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
edit: function(id) {
|
edit: function() {
|
||||||
|
var id = $(this).closest('.mChatHover').data("id");
|
||||||
var message = $("#mess" + id).data("edit");
|
var message = $("#mess" + id).data("edit");
|
||||||
apprise(mChat.editInfo, {
|
apprise(mChat.editInfo, {
|
||||||
"textarea": message,
|
"textarea": message,
|
||||||
@@ -281,7 +282,8 @@ jQuery(function($) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
del: function(id) {
|
del: function() {
|
||||||
|
var id = $(this).closest('.mChatHover').data("id");
|
||||||
apprise(mChat.delConfirm, {
|
apprise(mChat.delConfirm, {
|
||||||
"position": 200,
|
"position": 200,
|
||||||
"animate": true,
|
"animate": true,
|
||||||
@@ -434,6 +436,30 @@ jQuery(function($) {
|
|||||||
$("#mChatRefreshText").html(mChat.refreshNo).addClass("mchat-alert");
|
$("#mChatRefreshText").html(mChat.refreshNo).addClass("mchat-alert");
|
||||||
$("#mChatSessMess").html(mChat.sessOut).addClass("mchat-alert");
|
$("#mChatSessMess").html(mChat.sessOut).addClass("mchat-alert");
|
||||||
},
|
},
|
||||||
|
insertMention: function() {
|
||||||
|
var $msg = $(this).closest('.mChatHover');
|
||||||
|
var username = mChat.entityDecode($msg.data("username"));
|
||||||
|
var usercolor = $msg.data("usercolor");
|
||||||
|
if (usercolor) {
|
||||||
|
username = "[b][color=" + usercolor + "]" + username + "[/color][/b]";
|
||||||
|
} else if (mChat.allowBBCodes) {
|
||||||
|
username = "[b]" + username + "[/b]";
|
||||||
|
}
|
||||||
|
insert_text("@ " + username + ", ");
|
||||||
|
},
|
||||||
|
insertQuote: function() {
|
||||||
|
var $msg = $(this).closest('.mChatHover');
|
||||||
|
var username = mChat.entityDecode($msg.data("username"));
|
||||||
|
var id = $msg.data("id");
|
||||||
|
var quote = mChat.entityDecode($("#mess" + id).data("edit"));
|
||||||
|
insert_text('[quote="' + username + '"]' + quote + '[/quote]');
|
||||||
|
},
|
||||||
|
insertLike: function() {
|
||||||
|
var $msg = $(this).closest('.mChatHover');
|
||||||
|
var username = mChat.entityDecode($msg.data("username"));
|
||||||
|
var quote = mChat.entityDecode($msg.data("edit"));
|
||||||
|
insert_text(mChat.likes + '[quote="' + username + '"]' + quote + "[/quote]");
|
||||||
|
},
|
||||||
entityDecode: function(text) {
|
entityDecode: function(text) {
|
||||||
var s = decodeURIComponent(text.replace(/\+/g, " "));
|
var s = decodeURIComponent(text.replace(/\+/g, " "));
|
||||||
s = s.replace(/</g, "<");
|
s = s.replace(/</g, "<");
|
||||||
@@ -475,42 +501,12 @@ jQuery(function($) {
|
|||||||
$.cookie("mChatNoSound", $(this).is(":checked") ? null : "yes");
|
$.cookie("mChatNoSound", $(this).is(":checked") ? null : "yes");
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#mChatmain").on("click", "span.mChatInsertMention", function() {
|
$("#mChatData")
|
||||||
var $msg = $(this).closest('.mChatHover');
|
.on("click", "span.mChatInsertMention", mChat.insertMention)
|
||||||
var username = mChat.entityDecode($msg.data("username"));
|
.on("click", "img.mChatInsertQuote", mChat.insertQuote)
|
||||||
var usercolor = $msg.data("usercolor");
|
.on("click", "img.mChatInsertLike", mChat.insertLike)
|
||||||
if (usercolor) {
|
.on("click", "img.mChatEdit", mChat.edit)
|
||||||
username = "[b][color=" + usercolor + "]" + username + "[/color][/b]";
|
.on("click", "img.mChatDelete", mChat.del);
|
||||||
} else if (mChat.allowBBCodes) {
|
|
||||||
username = "[b]" + username + "[/b]";
|
|
||||||
}
|
|
||||||
insert_text("@ " + username + ", ");
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#mChatData").on("click", "img.mChatInsertQuote", function() {
|
|
||||||
var $msg = $(this).closest('.mChatHover');
|
|
||||||
var username = mChat.entityDecode($msg.data("username"));
|
|
||||||
var id = $msg.data("id");
|
|
||||||
var quote = mChat.entityDecode($("#mess" + id).data("edit"));
|
|
||||||
insert_text('[quote="' + username + '"]' + quote + '[/quote]');
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#mChatData").on("click", "img.mChatInsertLike", function() {
|
|
||||||
var $msg = $(this).closest('.mChatHover');
|
|
||||||
var username = mChat.entityDecode($msg.data("username"));
|
|
||||||
var quote = mChat.entityDecode($msg.data("edit"));
|
|
||||||
insert_text(mChat.likes + '[quote="' + username + '"]' + quote + "[/quote]");
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#mChatData").on("click", "img.mChatEdit", function() {
|
|
||||||
var $msg = $(this).closest('.mChatHover');
|
|
||||||
mChat.edit($msg.data("id"));
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#mChatData").on("click", "img.mChatDelete", function() {
|
|
||||||
var $msg = $(this).closest('.mChatHover');
|
|
||||||
mChat.del($msg.data("id"));
|
|
||||||
});
|
|
||||||
|
|
||||||
// Apprise 1.5 by Daniel Raftery
|
// Apprise 1.5 by Daniel Raftery
|
||||||
// http://thrivingkings.com/apprise
|
// http://thrivingkings.com/apprise
|
||||||
|
|||||||
2
styles/prosilver/template/mchat.min.js
vendored
2
styles/prosilver/template/mchat.min.js
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user