Merge pull request #31 from kasimi/js-cleanup
JavaScript & jQuery cleanup
This commit is contained in:
commit
94010723ed
6 files changed
+668
-742
No files matched your search
@@ -47,8 +47,7 @@ function initInsertions()
|
|||||||
if (is_ie && typeof(baseHeight) != 'number')
|
if (is_ie && typeof(baseHeight) != 'number')
|
||||||
{
|
{
|
||||||
/* === mChat focus fix Start === */
|
/* === mChat focus fix Start === */
|
||||||
var mChatFocus = window.mChatFocusFix || false;
|
if(!mChat.focusFix)
|
||||||
if(!mChatFocus)
|
|
||||||
{
|
{
|
||||||
textarea.focus();
|
textarea.focus();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,606 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* @package mChat JavaScript Code mini
|
||||||
|
* @version 1.4.4 of 2013-11-03
|
||||||
|
* @copyright (c) 2009 By Shapoval Andrey Vladimirovich (AllCity) ~ http://allcity.net.ru/
|
||||||
|
* @copyright (c) 2013 By Rich McGirr (RMcGirr83) http://rmcgirr83.org
|
||||||
|
* @copyright (c) 2015 By dmzx - http://www.dmzx-web.net
|
||||||
|
* @copyright (c) 2015 By kasimi
|
||||||
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||||
|
*
|
||||||
|
Code uses the titlealert jQuery plugin, options are below
|
||||||
|
interva 500 The flashing interval in milliseconds.
|
||||||
|
originalTitleInterval null Time in milliseconds that the original title is diplayed for. If null the time is the same as interval.
|
||||||
|
duration 0 The total lenght of the flashing before it is automatically stopped. Zero means infinite.
|
||||||
|
stopOnFocus true If true, the flashing will stop when the window gets focus.
|
||||||
|
stopOnMouseMove false If true, the flashing will stop when the document recieves a mousemove event (i.e. when the user moves the mouse over the document area, regardless of what window is active).
|
||||||
|
To use find titlealert in the code and make as so
|
||||||
|
$.titleAlert(mChatNewMessageAlert, {
|
||||||
|
requireBlur:false,
|
||||||
|
stopOnFocus:false,
|
||||||
|
duration:4000,
|
||||||
|
interval:700
|
||||||
|
});
|
||||||
|
**/
|
||||||
|
jQuery(function($) {
|
||||||
|
var hasFocus = true;
|
||||||
|
if (!mChat.archiveMode) {
|
||||||
|
if (!mChat.messageTop) {
|
||||||
|
$("#mChatmain").animate({
|
||||||
|
scrollTop: $("#mChatmain")[0].scrollHeight
|
||||||
|
}, 1000, "swing");
|
||||||
|
}
|
||||||
|
if (mChat.pause) {
|
||||||
|
$("#mChatMessage").bind("keypress", function() {
|
||||||
|
clearInterval(mChat.interval);
|
||||||
|
$("#mChatLoadIMG,#mChatOkIMG,#mChatErrorIMG").hide();
|
||||||
|
$("#mChatRefreshText").html(mChat.refreshNo).addClass("mchat-alert");
|
||||||
|
$("#mChatPauseIMG").show();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
$([window, document]).blur(function() {
|
||||||
|
hasFocus = false;
|
||||||
|
}).focus(function() {
|
||||||
|
hasFocus = true;
|
||||||
|
});
|
||||||
|
$.fn.preventDoubleSubmit = function() {
|
||||||
|
var alreadySubmitted = false;
|
||||||
|
return $(this).submit(function() {
|
||||||
|
if (alreadySubmitted) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
alreadySubmitted = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
$.fn.autoGrowInput = function(o) {
|
||||||
|
var width = $(".mChatPanel").width();
|
||||||
|
o = $.extend({
|
||||||
|
maxWidth: width - 20,
|
||||||
|
minWidth: 0,
|
||||||
|
comfortZone: 20
|
||||||
|
}, o);
|
||||||
|
this.filter("input:text").each(function() {
|
||||||
|
var minWidth = o.minWidth || $(this).width(),
|
||||||
|
val = "",
|
||||||
|
input = $(this),
|
||||||
|
testSubject = $("<div/>").css({
|
||||||
|
position: "absolute",
|
||||||
|
top: -9999,
|
||||||
|
left: -9999,
|
||||||
|
width: "auto",
|
||||||
|
fontSize: input.css("fontSize"),
|
||||||
|
fontFamily: input.css("fontFamily"),
|
||||||
|
fontWeight: input.css("fontWeight"),
|
||||||
|
letterSpacing: input.css("letterSpacing"),
|
||||||
|
whiteSpace: "nowrap"
|
||||||
|
}),
|
||||||
|
check = function() {
|
||||||
|
if (val === (val = input.val())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var escaped = val.replace(/&/g, "&").replace(/\s/g, " ").replace(/</g, "<").replace(/>/g, ">");
|
||||||
|
testSubject.html(escaped);
|
||||||
|
var testerWidth = testSubject.width(),
|
||||||
|
newWidth = (testerWidth + o.comfortZone) >= minWidth ? testerWidth + o.comfortZone : minWidth,
|
||||||
|
currentWidth = input.width(),
|
||||||
|
isValidWidthChange = (newWidth < currentWidth && newWidth >= minWidth) || (newWidth > minWidth && newWidth < o.maxWidth);
|
||||||
|
if (isValidWidthChange) {
|
||||||
|
input.width(newWidth);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
testSubject.insertAfter(input);
|
||||||
|
$(this).bind("keypress blur change submit focus", check);
|
||||||
|
});
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
$("input.mChatText").autoGrowInput();
|
||||||
|
$("#postform").preventDoubleSubmit();
|
||||||
|
if (mChat.playSound && $.cookie("mChatNoSound") != "yes") {
|
||||||
|
$.cookie("mChatNoSound", null);
|
||||||
|
$("#mChatUseSound").attr("checked", "checked");
|
||||||
|
} else {
|
||||||
|
$.cookie("mChatNoSound", "yes");
|
||||||
|
$("#mChatUseSound").removeAttr("checked");
|
||||||
|
}
|
||||||
|
if ($("#mChatUserList").length && ($.cookie("mChatShowUserList") == "yes" || mChat.customPage)) {
|
||||||
|
$("#mChatUserList").show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$.extend(mChat, {
|
||||||
|
countDown: function() {
|
||||||
|
$("#mChatSessMess").removeClass("mchat-alert");
|
||||||
|
mChat.sessionTime = mChat.sessionTime - 1;
|
||||||
|
var sec = Math.floor(mChat.sessionTime);
|
||||||
|
var min = Math.floor(sec / 60);
|
||||||
|
var hrs = Math.floor(min / 60);
|
||||||
|
sec = (sec % 60);
|
||||||
|
if (sec <= 9) {
|
||||||
|
sec = "0" + sec;
|
||||||
|
}
|
||||||
|
min = (min % 60);
|
||||||
|
if (min <= 9) {
|
||||||
|
min = "0" + min;
|
||||||
|
}
|
||||||
|
hrs = (hrs % 60);
|
||||||
|
if (hrs <= 9) {
|
||||||
|
hrs = "0" + hrs;
|
||||||
|
}
|
||||||
|
var time_left = hrs + ":" + min + ":" + sec;
|
||||||
|
$("#mChatSessMess").html(mChat.sessEnds + " " + time_left);
|
||||||
|
if (mChat.sessionTime <= 0) {
|
||||||
|
clearInterval(mChat.counter);
|
||||||
|
$("#mChatSessMess").html(mChat.sessOut).addClass("mchat-alert");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
clear: function() {
|
||||||
|
if ($("#mChatMessage").val() === "") {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
var answer = confirm(mChat.reset);
|
||||||
|
if (answer) {
|
||||||
|
$("#mChatRefreshText").removeClass("mchat-alert");
|
||||||
|
if (mChat.pause) {
|
||||||
|
mChat.interval = setInterval(mChat.refresh, mChat.refreshTime);
|
||||||
|
}
|
||||||
|
$("#mChatOkIMG").show();
|
||||||
|
$("#mChatLoadIMG, #mChatErrorIMG, #mChatPauseIMG").hide();
|
||||||
|
$("#mChatRefreshText").html(mChat.refreshYes);
|
||||||
|
$("#mChatMessage").val("").focus();
|
||||||
|
} else {
|
||||||
|
$("#mChatMessage").focus();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
sound: function(file) {
|
||||||
|
if ($.cookie("mChatNoSound") == "yes") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (navigator.userAgent.match(/MSIE ([0-9]+)\./) || navigator.userAgent.match(/Trident\/7.0; rv 11.0/)) {
|
||||||
|
$("#mChatSound").html('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" height="0" width="0" type="application/x-shockwave-flash"><param name="movie" value="' + file + '"></object>');
|
||||||
|
} else {
|
||||||
|
$("#mChatSound").html('<embed src="' + file + '" width="0" height="0" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
notice: function() {
|
||||||
|
if (!hasFocus || !document.hasFocus()) {
|
||||||
|
$.titleAlert(mChat.newMessageAlert, {interval: 1000});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
toggle: function(id) {
|
||||||
|
$("#mChat" + id).slideToggle("normal", function() {
|
||||||
|
if ($("#mChat" + id).is(":visible")) {
|
||||||
|
$.cookie("mChatShow" + id, "yes");
|
||||||
|
} else if ($("#mChat" + id).is(":hidden")) {
|
||||||
|
$.cookie("mChatShow" + id, null);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
add: function() {
|
||||||
|
if ($("#mChatMessage").val() === "") {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
var messChars = $("#mChatMessage").val().replace(/ /g, "");
|
||||||
|
if (messChars.length > mChat.mssgLngth && mChat.mssgLngth) {
|
||||||
|
alert(mChat.mssgLngthLong);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$.ajax({
|
||||||
|
url: mChat.file,
|
||||||
|
timeout: 10000,
|
||||||
|
type: "POST",
|
||||||
|
data: $("#postform").serialize(),
|
||||||
|
dataType: "text",
|
||||||
|
beforeSend: function() {
|
||||||
|
$("#submit_button").attr("disabled", "disabled");
|
||||||
|
if (mChat.userTimeout) {
|
||||||
|
clearInterval(mChat.activeInterval);
|
||||||
|
clearInterval(mChat.counter);
|
||||||
|
}
|
||||||
|
clearInterval(mChat.interval);
|
||||||
|
},
|
||||||
|
success: function() {
|
||||||
|
mChat.refresh();
|
||||||
|
},
|
||||||
|
error: function(e) {
|
||||||
|
if (e.status == 400) {
|
||||||
|
alert(mChat.flood);
|
||||||
|
} else if (e.status == 403) {
|
||||||
|
alert(mChat.noAccess);
|
||||||
|
} else if (e.status == 501) {
|
||||||
|
alert(mChat.noMessageInput);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
complete: function() {
|
||||||
|
$("#mChatNoMessage").remove();
|
||||||
|
$("#submit_button").removeAttr("disabled");
|
||||||
|
mChat.interval = setInterval(mChat.refresh, mChat.refreshTime);
|
||||||
|
if (mChat.userTimeout) {
|
||||||
|
mChat.sessionTime = mChat.userTimeout ? mChat.userTimeout / 1000 : false;
|
||||||
|
mChat.counter = setInterval(mChat.countDown, 1000);
|
||||||
|
mChat.activeInterval = setInterval(mChat.active, mChat.userTimeout);
|
||||||
|
}
|
||||||
|
$("#mChatMessage").val("").focus();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
edit: function(id) {
|
||||||
|
var message = $("#edit" + id).val();
|
||||||
|
apprise(mChat.editInfo, {
|
||||||
|
"textarea": message,
|
||||||
|
"animate": true,
|
||||||
|
"position": 200,
|
||||||
|
"confirm": true
|
||||||
|
}, function(r) {
|
||||||
|
if (r) {
|
||||||
|
$.ajax({
|
||||||
|
url: mChat.file,
|
||||||
|
timeout: 10000,
|
||||||
|
type: "POST",
|
||||||
|
data: {
|
||||||
|
mode: "edit",
|
||||||
|
message_id: id,
|
||||||
|
message: r
|
||||||
|
},
|
||||||
|
dataType: "text",
|
||||||
|
beforeSend: function() {
|
||||||
|
clearInterval(mChat.interval);
|
||||||
|
if (mChat.userTimeout) {
|
||||||
|
clearInterval(mChat.activeInterval);
|
||||||
|
clearInterval(mChat.counter);
|
||||||
|
$("#mChatSessTimer").html(mChat.refreshing);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
success: function(html) {
|
||||||
|
$("#mess" + id).fadeOut("slow", function() {
|
||||||
|
$(this).replaceWith(html);
|
||||||
|
$("#mess" + id).css("display", "none").fadeIn("slow");
|
||||||
|
});
|
||||||
|
},
|
||||||
|
error: function(resp) {
|
||||||
|
if (resp.status == 403) {
|
||||||
|
alert(mChat.noAccess);
|
||||||
|
} else if (resp.status == 501) {
|
||||||
|
alert(mChat.noMessageInput);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
complete: function() {
|
||||||
|
mChat.interval = setInterval(mChat.refresh, mChat.refreshTime);
|
||||||
|
if (mChat.userTimeout) {
|
||||||
|
mChat.sessionTime = mChat.userTimeout ? mChat.userTimeout / 1000 : false;
|
||||||
|
mChat.counter = setInterval(mChat.countDown, 1000);
|
||||||
|
mChat.activeInterval = setInterval(mChat.active, mChat.userTimeout);
|
||||||
|
}
|
||||||
|
if (!mChat.archiveMode && !mChat.messageTop) {
|
||||||
|
setTimeout(function() {
|
||||||
|
$("#mChatmain").animate({scrollTop: $("#mChatmain")[0].scrollHeight}, 1000, "swing");
|
||||||
|
}, 1500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
del: function(id) {
|
||||||
|
apprise(mChat.delConfirm, {
|
||||||
|
"position": 200,
|
||||||
|
"animate": true,
|
||||||
|
"confirm": true
|
||||||
|
}, function(del) {
|
||||||
|
if (del) {
|
||||||
|
$.ajax({
|
||||||
|
url: mChat.file,
|
||||||
|
timeout: 10000,
|
||||||
|
type: "POST",
|
||||||
|
data: {
|
||||||
|
mode: "delete",
|
||||||
|
message_id: id
|
||||||
|
},
|
||||||
|
beforeSend: function() {
|
||||||
|
clearInterval(mChat.interval);
|
||||||
|
if (mChat.userTimeout) {
|
||||||
|
clearInterval(mChat.activeInterval);
|
||||||
|
clearInterval(mChat.counter);
|
||||||
|
$("#mChatSessTimer").html(mChat.refreshing);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
success: function() {
|
||||||
|
$("#mess" + id).fadeOut("slow", function() {
|
||||||
|
$(this).remove();
|
||||||
|
});
|
||||||
|
mChat.sound(mChat.forumRoot + "ext/dmzx/mchat/sounds/del.swf");
|
||||||
|
},
|
||||||
|
error: function() {
|
||||||
|
alert(mChat.noAccess);
|
||||||
|
},
|
||||||
|
complete: function() {
|
||||||
|
mChat.interval = setInterval(mChat.refresh, mChat.refreshTime);
|
||||||
|
if (mChat.userTimeout) {
|
||||||
|
mChat.sessionTime = mChat.userTimeout ? mChat.userTimeout / 1000 : false;
|
||||||
|
mChat.counter = setInterval(mChat.countDown, 1000);
|
||||||
|
mChat.activeInterval = setInterval(mChat.active, mChat.userTimeout);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
refresh: function() {
|
||||||
|
if (mChat.archiveMode) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var firstLastSelector = mChat.messageTop ? ":first" : ":last";
|
||||||
|
var messId = 0;
|
||||||
|
if ($("#mChatData").children().not("#mChatNoMessage").length) {
|
||||||
|
$("#mChatNoMessage").remove();
|
||||||
|
var attr = $("#mChatData").children(firstLastSelector).not("#mChatNoMessage").attr("id");
|
||||||
|
if (attr) {
|
||||||
|
messId = attr.replace("mess", "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$.ajax({
|
||||||
|
url: mChat.file,
|
||||||
|
timeout: 10000,
|
||||||
|
type: "POST",
|
||||||
|
data: {
|
||||||
|
mode: "read",
|
||||||
|
message_last_id: messId
|
||||||
|
},
|
||||||
|
dataType: "html",
|
||||||
|
beforeSend: function() {
|
||||||
|
$("#mChatOkIMG, #mChatErrorIMG, #mChatPauseIMG").hide();
|
||||||
|
$("#mChatLoadIMG").show();
|
||||||
|
},
|
||||||
|
success: function(html) {
|
||||||
|
var $html = $($.trim(html));
|
||||||
|
if ($html.length) {
|
||||||
|
$("#mChatRefreshText").removeClass("mchat-alert");
|
||||||
|
$html.hide();
|
||||||
|
if (mChat.messageTop) {
|
||||||
|
$("#mChatData").prepend($html);
|
||||||
|
} else {
|
||||||
|
$("#mChatData").append($html);
|
||||||
|
}
|
||||||
|
$html.fadeIn("slow");
|
||||||
|
$("#mChatmain").stop().animate({scrollTop: mChat.messageTop ? 0 : $("#mChatmain")[0].scrollHeight}, 2000);
|
||||||
|
mChat.sound(mChat.forumRoot + "ext/dmzx/mchat/sounds/add.swf");
|
||||||
|
mChat.notice();
|
||||||
|
}
|
||||||
|
setTimeout(function() {
|
||||||
|
$("#mChatLoadIMG, #mChatErrorIMG, #mChatPauseIMG").hide();
|
||||||
|
$("#mChatOkIMG").show();
|
||||||
|
$("#mChatRefreshText").html(mChat.refreshYes);
|
||||||
|
}, 500);
|
||||||
|
},
|
||||||
|
error: function() {
|
||||||
|
$("#mChatLoadIMG, #mChatOkIMG, #mChatPauseIMG, #mChatRefreshTextNo, #mChatPauseIMG,").hide();
|
||||||
|
$("#mChatErrorIMG").show();
|
||||||
|
mChat.sound(mChat.forumRoot + "ext/dmzx/mchat/sounds/error.swf");
|
||||||
|
},
|
||||||
|
complete: function() {
|
||||||
|
if (!$("#mChatData").children(firstLastSelector).length) {
|
||||||
|
$("#mChatData").append('<div id="mChatNoMessage">' + mChat.noMessages + "</div>").show("slow");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
stats: function() {
|
||||||
|
if (!mChat.whois) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$.ajax({
|
||||||
|
url: mChat.file,
|
||||||
|
timeout: 10000,
|
||||||
|
type: "POST",
|
||||||
|
data: {
|
||||||
|
mode: "stats"
|
||||||
|
},
|
||||||
|
dataType: "html",
|
||||||
|
beforeSend: function() {
|
||||||
|
if (mChat.customPage) {
|
||||||
|
$("#mChatRefreshN").show();
|
||||||
|
$("#mChatRefresh").hide();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
success: function(data) {
|
||||||
|
var json = $.parseJSON(data);
|
||||||
|
$("#mChatStats").replaceWith(json.message);
|
||||||
|
if (mChat.customPage) {
|
||||||
|
setTimeout(function() {
|
||||||
|
$("#mChatRefreshN").hide();
|
||||||
|
$("#mChatRefresh").show();
|
||||||
|
}, 500);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function() {
|
||||||
|
mChat.sound(mChat.forumRoot + "ext/dmzx/mchat/sounds/error.swf");
|
||||||
|
},
|
||||||
|
complete: function() {
|
||||||
|
if ($("#mChatUserList").length && ($.cookie("mChatShowUserList") == "yes" || mChat.customPage)) {
|
||||||
|
$("#mChatUserList").css("display", "block");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
active: function() {
|
||||||
|
if (mChat.archiveMode || !mChat.userTimeout) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
clearInterval(mChat.interval);
|
||||||
|
$("#mChatLoadIMG,#mChatOkIMG,#mChatErrorIMG").hide();
|
||||||
|
$("#mChatPauseIMG").show();
|
||||||
|
$("#mChatRefreshText").html(mChat.refreshNo).addClass("mchat-alert");
|
||||||
|
$("#mChatSessMess").html(mChat.sessOut).addClass("mchat-alert");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
mChat.interval = setInterval(mChat.refresh, mChat.refreshTime);
|
||||||
|
mChat.statsInterval = setInterval(mChat.stats, mChat.whoisRefresh);
|
||||||
|
mChat.activeInterval = setInterval(mChat.active, mChat.userTimeout);
|
||||||
|
mChat.sessionTime = mChat.userTimeout ? mChat.userTimeout / 1000 : false;
|
||||||
|
|
||||||
|
if (mChat.userTimeout) {
|
||||||
|
mChat.counter = setInterval(mChat.countDown, 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($.cookie("mChatShowSmiles") == "yes" && $("#mChatSmiles").css("display", "none")) {
|
||||||
|
$("#mChatSmiles").slideToggle("slow");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($.cookie("mChatShowBBCodes") == "yes" && $("#mChatBBCodes").css("display", "none")) {
|
||||||
|
$("#mChatBBCodes").slideToggle("slow");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($.cookie("mChatShowUserList") == "yes" && $("#mChatUserList").length) {
|
||||||
|
$("#mChatUserList").slideToggle("slow");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($.cookie("mChatShowColour") == "yes" && $("#mChatColour").css("display", "none")) {
|
||||||
|
$("#mChatColour").slideToggle("slow");
|
||||||
|
}
|
||||||
|
|
||||||
|
$("#mChatUseSound").change(function() {
|
||||||
|
$.cookie("mChatNoSound", $(this).is(":checked") ? null : "yes");
|
||||||
|
});
|
||||||
|
|
||||||
|
// Apprise 1.5 by Daniel Raftery
|
||||||
|
// http://thrivingkings.com/apprise
|
||||||
|
//
|
||||||
|
// Button text added by Adam Bezulski
|
||||||
|
//
|
||||||
|
// Cached jQuery variables, position center added by Josiah Ruddell
|
||||||
|
function apprise(a, b, c) {
|
||||||
|
a = '<span style="font-weight:bold; font-size:1.2em;">' + a + "</span>";
|
||||||
|
var d = {
|
||||||
|
confirm: false,
|
||||||
|
verify: false,
|
||||||
|
input: false,
|
||||||
|
textarea: false,
|
||||||
|
animate: false,
|
||||||
|
textOk: "Ok",
|
||||||
|
textCancel: "Cancel",
|
||||||
|
textYes: "Yes",
|
||||||
|
textNo: "No",
|
||||||
|
position: "center"
|
||||||
|
};
|
||||||
|
if (b) {
|
||||||
|
for (var e in d) {
|
||||||
|
if (typeof b[e] == "undefined") b[e] = d[e];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var f = $(document).height(),
|
||||||
|
g = $(document).width(),
|
||||||
|
h = $('<div class="appriseOuter"></div>'),
|
||||||
|
i = $('<div class="appriseOverlay" id="aOverlay"></div>'),
|
||||||
|
j = $('<div class="appriseInner"></div>'),
|
||||||
|
k = $('<div class="aButtons"></div>'),
|
||||||
|
l = 300;
|
||||||
|
i.css({
|
||||||
|
height: f,
|
||||||
|
width: g
|
||||||
|
}).appendTo("body").fadeIn(100, function() {
|
||||||
|
$(this).css("filter", "alpha(opacity=70)");
|
||||||
|
});
|
||||||
|
h.prependTo("body");
|
||||||
|
j.append(a).appendTo(h);
|
||||||
|
if (b) {
|
||||||
|
if (b.input) {
|
||||||
|
if (typeof b.input == "string") {
|
||||||
|
j.append('<div class="aInput"><input type="text" class="aTextbox" t="aTextbox" value="' + b.input + '" /></div>');
|
||||||
|
} else {
|
||||||
|
j.append('<div class="aInput"><input type="text" class="aTextbox" t="aTextbox" /></div>');
|
||||||
|
}
|
||||||
|
$(".aTextbox").focus();
|
||||||
|
}
|
||||||
|
if (typeof b.textarea == "string") {
|
||||||
|
j.append('<div class="aInput"><textarea name="message" class="aEdit" style="height: 9em;" rows="5" cols="180">' + b.textarea + "</textarea></div>");
|
||||||
|
$(".aEdit").focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
j.append(k);
|
||||||
|
if (b) {
|
||||||
|
if (b.confirm || b.input) {
|
||||||
|
k.append('<button value="ok">' + b.textOk + "</button>");
|
||||||
|
k.append('<button value="cancel">' + b.textCancel + "</button>");
|
||||||
|
} else if (b.verify) {
|
||||||
|
k.append('<button value="ok">' + b.textYes + "</button>");
|
||||||
|
k.append('<button value="cancel">' + b.textNo + "</button>");
|
||||||
|
} else {
|
||||||
|
k.append('<button value="ok">' + b.textOk + "</button>");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
k.append('<button value="ok">Ok</button>');
|
||||||
|
}
|
||||||
|
h.css("left", ($(window).width() - $(".appriseOuter").width()) / 2 + $(window).scrollLeft() + "px");
|
||||||
|
if (b) {
|
||||||
|
if (b.position && b.position === "center") {
|
||||||
|
l = (f - h.height()) / 2;
|
||||||
|
}
|
||||||
|
if (b.animate) {
|
||||||
|
var m = b.animate;
|
||||||
|
if (isNaN(m)) {
|
||||||
|
m = 400;
|
||||||
|
}
|
||||||
|
h.css("top", "-200px").show().animate({
|
||||||
|
top: l
|
||||||
|
}, m);
|
||||||
|
} else {
|
||||||
|
h.css("top", l).fadeIn(200);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
h.css("top", l).fadeIn(200);
|
||||||
|
}
|
||||||
|
$(document).keydown(function(a) {
|
||||||
|
if (i.is(":visible")) {
|
||||||
|
if (a.shiftKey && a.keyCode == 13) {
|
||||||
|
$(".aEdit").append("<br />");
|
||||||
|
} else if (a.keyCode == 13) {
|
||||||
|
$('.aButtons > button[value="ok"]').click();
|
||||||
|
} else if (a.keyCode == 27) {
|
||||||
|
$('.aButtons > button[value="cancel"]').click();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
var n = $(".aTextbox").val();
|
||||||
|
if (!n) {
|
||||||
|
n = false;
|
||||||
|
}
|
||||||
|
$(".aTextbox").bind("keydown blur", function() {
|
||||||
|
n = $(this).val();
|
||||||
|
});
|
||||||
|
var o = $(".aEdit").val();
|
||||||
|
if (!o) {
|
||||||
|
o = false;
|
||||||
|
}
|
||||||
|
$(".aEdit").bind("keydown blur", function() {
|
||||||
|
o = $(this).val();
|
||||||
|
});
|
||||||
|
$(".aButtons > button").click(function() {
|
||||||
|
i.remove();
|
||||||
|
h.remove();
|
||||||
|
if (c) {
|
||||||
|
$(this).text("");
|
||||||
|
var a = $(this).attr("value");
|
||||||
|
if (a == "ok") {
|
||||||
|
if (b) {
|
||||||
|
if (b.input) {
|
||||||
|
c(n);
|
||||||
|
} else if (b.textarea) {
|
||||||
|
c(o);
|
||||||
|
} else {
|
||||||
|
c(true);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
c(true);
|
||||||
|
}
|
||||||
|
$("#mChatMessage").focus();
|
||||||
|
} else if (a == "cancel") {
|
||||||
|
c(false);
|
||||||
|
$("#mChatMessage").focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
+25
@@ -0,0 +1,25 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* @package mChat JavaScript Code mini
|
||||||
|
* @version 1.4.4 of 2013-11-03
|
||||||
|
* @copyright (c) 2009 By Shapoval Andrey Vladimirovich (AllCity) ~ http://allcity.net.ru/
|
||||||
|
* @copyright (c) 2013 By Rich McGirr (RMcGirr83) http://rmcgirr83.org
|
||||||
|
* @copyright (c) 2015 By dmzx - http://www.dmzx-web.net
|
||||||
|
* @copyright (c) 2015 By kasimi
|
||||||
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||||
|
*
|
||||||
|
Code uses the titlealert jQuery plugin, options are below
|
||||||
|
interva 500 The flashing interval in milliseconds.
|
||||||
|
originalTitleInterval null Time in milliseconds that the original title is diplayed for. If null the time is the same as interval.
|
||||||
|
duration 0 The total lenght of the flashing before it is automatically stopped. Zero means infinite.
|
||||||
|
stopOnFocus true If true, the flashing will stop when the window gets focus.
|
||||||
|
stopOnMouseMove false If true, the flashing will stop when the document recieves a mousemove event (i.e. when the user moves the mouse over the document area, regardless of what window is active).
|
||||||
|
To use find titlealert in the code and make as so
|
||||||
|
$.titleAlert(mChatNewMessageAlert, {
|
||||||
|
requireBlur:false,
|
||||||
|
stopOnFocus:false,
|
||||||
|
duration:4000,
|
||||||
|
interval:700
|
||||||
|
});
|
||||||
|
**/
|
||||||
|
jQuery(function(t){function e(e,a,s){e='<span style="font-weight:bold; font-size:1.2em;">'+e+"</span>";var o={confirm:!1,verify:!1,input:!1,textarea:!1,animate:!1,textOk:"Ok",textCancel:"Cancel",textYes:"Yes",textNo:"No",position:"center"};if(a)for(var m in o)"undefined"==typeof a[m]&&(a[m]=o[m]);var n=t(document).height(),h=t(document).width(),i=t('<div class="appriseOuter"></div>'),r=t('<div class="appriseOverlay" id="aOverlay"></div>'),l=t('<div class="appriseInner"></div>'),u=t('<div class="aButtons"></div>'),c=300;if(r.css({height:n,width:h}).appendTo("body").fadeIn(100,function(){t(this).css("filter","alpha(opacity=70)")}),i.prependTo("body"),l.append(e).appendTo(i),a&&(a.input&&("string"==typeof a.input?l.append('<div class="aInput"><input type="text" class="aTextbox" t="aTextbox" value="'+a.input+'" /></div>'):l.append('<div class="aInput"><input type="text" class="aTextbox" t="aTextbox" /></div>'),t(".aTextbox").focus()),"string"==typeof a.textarea&&(l.append('<div class="aInput"><textarea name="message" class="aEdit" style="height: 9em;" rows="5" cols="180">'+a.textarea+"</textarea></div>"),t(".aEdit").focus())),l.append(u),a?a.confirm||a.input?(u.append('<button value="ok">'+a.textOk+"</button>"),u.append('<button value="cancel">'+a.textCancel+"</button>")):a.verify?(u.append('<button value="ok">'+a.textYes+"</button>"),u.append('<button value="cancel">'+a.textNo+"</button>")):u.append('<button value="ok">'+a.textOk+"</button>"):u.append('<button value="ok">Ok</button>'),i.css("left",(t(window).width()-t(".appriseOuter").width())/2+t(window).scrollLeft()+"px"),a)if(a.position&&"center"===a.position&&(c=(n-i.height())/2),a.animate){var C=a.animate;isNaN(C)&&(C=400),i.css("top","-200px").show().animate({top:c},C)}else i.css("top",c).fadeIn(200);else i.css("top",c).fadeIn(200);t(document).keydown(function(e){r.is(":visible")&&(e.shiftKey&&13==e.keyCode?t(".aEdit").append("<br />"):13==e.keyCode?t('.aButtons > button[value="ok"]').click():27==e.keyCode&&t('.aButtons > button[value="cancel"]').click())});var d=t(".aTextbox").val();d||(d=!1),t(".aTextbox").bind("keydown blur",function(){d=t(this).val()});var f=t(".aEdit").val();f||(f=!1),t(".aEdit").bind("keydown blur",function(){f=t(this).val()}),t(".aButtons > button").click(function(){if(r.remove(),i.remove(),s){t(this).text("");var e=t(this).attr("value");"ok"==e?(s(a?a.input?d:a.textarea?f:!0:!0),t("#mChatMessage").focus()):"cancel"==e&&(s(!1),t("#mChatMessage").focus())}})}var a=!0;mChat.archiveMode||(mChat.messageTop||t("#mChatmain").animate({scrollTop:t("#mChatmain")[0].scrollHeight},1e3,"swing"),mChat.pause&&t("#mChatMessage").bind("keypress",function(){clearInterval(mChat.interval),t("#mChatLoadIMG,#mChatOkIMG,#mChatErrorIMG").hide(),t("#mChatRefreshText").html(mChat.refreshNo).addClass("mchat-alert"),t("#mChatPauseIMG").show()}),t([window,document]).blur(function(){a=!1}).focus(function(){a=!0}),t.fn.preventDoubleSubmit=function(){var e=!1;return t(this).submit(function(){return e?!1:void(e=!0)})},t.fn.autoGrowInput=function(e){var a=t(".mChatPanel").width();return e=t.extend({maxWidth:a-20,minWidth:0,comfortZone:20},e),this.filter("input:text").each(function(){var a=e.minWidth||t(this).width(),s="",o=t(this),m=t("<div/>").css({position:"absolute",top:-9999,left:-9999,width:"auto",fontSize:o.css("fontSize"),fontFamily:o.css("fontFamily"),fontWeight:o.css("fontWeight"),letterSpacing:o.css("letterSpacing"),whiteSpace:"nowrap"}),n=function(){if(s!==(s=o.val())){var t=s.replace(/&/g,"&").replace(/\s/g," ").replace(/</g,"<").replace(/>/g,">");m.html(t);var n=m.width(),h=n+e.comfortZone>=a?n+e.comfortZone:a,i=o.width(),r=i>h&&h>=a||h>a&&h<e.maxWidth;r&&o.width(h)}};m.insertAfter(o),t(this).bind("keypress blur change submit focus",n)}),this},t("input.mChatText").autoGrowInput(),t("#postform").preventDoubleSubmit(),mChat.playSound&&"yes"!=t.cookie("mChatNoSound")?(t.cookie("mChatNoSound",null),t("#mChatUseSound").attr("checked","checked")):(t.cookie("mChatNoSound","yes"),t("#mChatUseSound").removeAttr("checked")),t("#mChatUserList").length&&("yes"==t.cookie("mChatShowUserList")||mChat.customPage)&&t("#mChatUserList").show()),t.extend(mChat,{countDown:function(){t("#mChatSessMess").removeClass("mchat-alert"),mChat.sessionTime=mChat.sessionTime-1;var e=Math.floor(mChat.sessionTime),a=Math.floor(e/60),s=Math.floor(a/60);e%=60,9>=e&&(e="0"+e),a%=60,9>=a&&(a="0"+a),s%=60,9>=s&&(s="0"+s);var o=s+":"+a+":"+e;t("#mChatSessMess").html(mChat.sessEnds+" "+o),mChat.sessionTime<=0&&(clearInterval(mChat.counter),t("#mChatSessMess").html(mChat.sessOut).addClass("mchat-alert"))},clear:function(){if(""===t("#mChatMessage").val())return!1;var e=confirm(mChat.reset);e?(t("#mChatRefreshText").removeClass("mchat-alert"),mChat.pause&&(mChat.interval=setInterval(mChat.refresh,mChat.refreshTime)),t("#mChatOkIMG").show(),t("#mChatLoadIMG, #mChatErrorIMG, #mChatPauseIMG").hide(),t("#mChatRefreshText").html(mChat.refreshYes),t("#mChatMessage").val("").focus()):t("#Line truncated
|
||||||
@@ -1,640 +0,0 @@
|
|||||||
/**
|
|
||||||
*
|
|
||||||
* @package mChat JavaScript Code mini
|
|
||||||
* @version 1.4.4 of 2013-11-03
|
|
||||||
* @copyright (c) 2013 By Rich McGirr (RMcGirr83) http://rmcgirr83.org
|
|
||||||
* @copyright (c) 2015 By dmzx - http://www.dmzx-web.net
|
|
||||||
* @copyright (c) 2009 By Shapoval Andrey Vladimirovich (AllCity) ~ http://allcity.net.ru/
|
|
||||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
var $jQ=jQuery;
|
|
||||||
var hasFocus = true;
|
|
||||||
$jQ(function(){
|
|
||||||
if(!mChatArchiveMode){
|
|
||||||
var scrH=$jQ('#mChatmain')[0].scrollHeight;
|
|
||||||
$jQ('#mChatmain').animate({
|
|
||||||
scrollTop:scrH
|
|
||||||
},1000,'swing');
|
|
||||||
if(mChatPause){
|
|
||||||
$jQ('#mChatMessage').bind('keypress',function(){
|
|
||||||
clearInterval(interval);
|
|
||||||
$jQ('#mChatLoadIMG,#mChatOkIMG,#mChatErrorIMG').hide();
|
|
||||||
$jQ('#mChatRefreshText').html(mChatRefreshNo).addClass('mchat-alert');
|
|
||||||
$jQ('#mChatPauseIMG').show()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
$jQ([window,document]).blur(function(){
|
|
||||||
hasFocus = false
|
|
||||||
}).focus(function(){
|
|
||||||
hasFocus = true
|
|
||||||
});
|
|
||||||
$jQ.fn.preventDoubleSubmit=function(){
|
|
||||||
var alreadySubmitted=false;
|
|
||||||
return $jQ(this).submit(function(){
|
|
||||||
if(alreadySubmitted){
|
|
||||||
return false
|
|
||||||
}else{
|
|
||||||
alreadySubmitted=true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
};
|
|
||||||
$jQ.fn.autoGrowInput=function(o){
|
|
||||||
var width=$jQ('.mChatPanel').width();
|
|
||||||
o=$jQ.extend({
|
|
||||||
maxWidth:width-20,
|
|
||||||
minWidth:0,
|
|
||||||
comfortZone:20
|
|
||||||
},o);
|
|
||||||
this.filter('input:text').each(function(){
|
|
||||||
var minWidth=o.minWidth||$jQ(this).width(),
|
|
||||||
val='',
|
|
||||||
input=$jQ(this),
|
|
||||||
testSubject=$jQ('<div/>').css({
|
|
||||||
position:'absolute',
|
|
||||||
top:-9999,
|
|
||||||
left:-9999,
|
|
||||||
width:'auto',
|
|
||||||
fontSize:input.css('fontSize'),
|
|
||||||
fontFamily:input.css('fontFamily'),
|
|
||||||
fontWeight:input.css('fontWeight'),
|
|
||||||
letterSpacing:input.css('letterSpacing'),
|
|
||||||
whiteSpace:'nowrap'
|
|
||||||
}),
|
|
||||||
check=function(){
|
|
||||||
if(val===(val=input.val())){
|
|
||||||
return
|
|
||||||
}
|
|
||||||
var escaped=val.replace(/&/g,'&').replace(/\s/g,' ').replace(/</g,'<').replace(/>/g,'>');
|
|
||||||
testSubject.html(escaped);
|
|
||||||
var testerWidth=testSubject.width(),
|
|
||||||
newWidth=(testerWidth+o.comfortZone)>=minWidth?testerWidth+o.comfortZone:minWidth,
|
|
||||||
currentWidth=input.width(),
|
|
||||||
isValidWidthChange=(newWidth<currentWidth&&newWidth>=minWidth)||(newWidth>minWidth&&newWidth<o.maxWidth);
|
|
||||||
if(isValidWidthChange){
|
|
||||||
input.width(newWidth)
|
|
||||||
}
|
|
||||||
};
|
|
||||||
testSubject.insertAfter(input);
|
|
||||||
$jQ(this).bind('keypress blur change submit focus',check)
|
|
||||||
});
|
|
||||||
return this
|
|
||||||
};
|
|
||||||
$jQ('input.mChatText').autoGrowInput();
|
|
||||||
$jQ('#postform').preventDoubleSubmit();
|
|
||||||
if(mChatSound&&$jQ.cookie('mChatNoSound')!='yes'){
|
|
||||||
$jQ.cookie('mChatNoSound',null);$jQ('#mChatUseSound').attr('checked','checked')
|
|
||||||
} else {
|
|
||||||
$jQ.cookie('mChatNoSound','yes');
|
|
||||||
$jQ('#mChatUseSound').removeAttr('checked')
|
|
||||||
}
|
|
||||||
if($jQ('#mChatUserList').length&&($jQ.cookie('mChatShowUserList')=='yes'||mChatCustomPage)){
|
|
||||||
$jQ('#mChatUserList').show()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$jQ.browser = {msie: navigator.userAgent.match(/MSIE ([0-9]+)\./) || navigator.userAgent.match(/Trident\/7.0; rv 11.0/)};
|
|
||||||
});
|
|
||||||
var mChat={
|
|
||||||
key:function(e){
|
|
||||||
if(e.shiftKey&&e.keyCode==13){
|
|
||||||
$jQ('#mChatMessage').append("<br />");
|
|
||||||
} else if(e.keyCode==13){
|
|
||||||
mChat.add();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
countDown:function(){
|
|
||||||
if($jQ('#mChatSessMess').hasClass('mchat-alert')){
|
|
||||||
$jQ('#mChatSessMess').removeClass('mchat-alert')
|
|
||||||
}
|
|
||||||
session_time=session_time-1;
|
|
||||||
var sec=Math.floor(session_time);
|
|
||||||
var min=Math.floor(sec/60);
|
|
||||||
var hrs=Math.floor(min/60);
|
|
||||||
sec=(sec%60);
|
|
||||||
if(sec<=9){
|
|
||||||
sec="0"+sec
|
|
||||||
}
|
|
||||||
min=(min%60);
|
|
||||||
if(min<=9){
|
|
||||||
min="0"+min
|
|
||||||
}
|
|
||||||
hrs=(hrs%60);
|
|
||||||
if(hrs<=9){
|
|
||||||
hrs="0"+hrs
|
|
||||||
}
|
|
||||||
var time_left=hrs+":"+min+":"+sec;
|
|
||||||
$jQ('#mChatSessMess').html(mChatSessEnds+' '+time_left);
|
|
||||||
if(session_time<=0){
|
|
||||||
clearInterval(counter);
|
|
||||||
$jQ('#mChatSessMess').html(mChatSessOut).addClass('mchat-alert')
|
|
||||||
}
|
|
||||||
},
|
|
||||||
clear:function(){
|
|
||||||
if($jQ('#mChatMessage').val()==''){
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
var answer=confirm(mChatReset);
|
|
||||||
if(answer){
|
|
||||||
if($jQ('#mChatRefreshText').hasClass('mchat-alert')){
|
|
||||||
$jQ('#mChatRefreshText').removeClass('mchat-alert')
|
|
||||||
}
|
|
||||||
if(mChatPause){
|
|
||||||
interval=setInterval(function(){
|
|
||||||
mChat.refresh()
|
|
||||||
},mChatRefresh)
|
|
||||||
}
|
|
||||||
$jQ('#mChatOkIMG').show();
|
|
||||||
$jQ('#mChatLoadIMG, #mChatErrorIMG, #mChatPauseIMG').hide();
|
|
||||||
$jQ('#mChatRefreshText').html(mChatRefreshYes);
|
|
||||||
$jQ('#mChatMessage').val('').focus()
|
|
||||||
} else {
|
|
||||||
$jQ('#mChatMessage').focus()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
sound: function (file) {
|
|
||||||
if ($jQ.cookie('mChatNoSound') == 'yes') {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if ($jQ.browser.msie) {
|
|
||||||
$('#mChatSound').html('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" height="0" width="0" type="application/x-shockwave-flash"><param name="movie" value="' + file + '"></object>');
|
|
||||||
} else {
|
|
||||||
$('#mChatSound').html('<embed src="' + file + '" width="0" height="0" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
alert:function(){
|
|
||||||
if(!hasFocus||!document.hasFocus()){
|
|
||||||
$jQ.titleAlert(mChatNewMessageAlert)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
toggle:function(id){
|
|
||||||
$jQ('#mChat'+id).slideToggle('normal',function(){
|
|
||||||
if($jQ('#mChat'+id).is(':visible')){
|
|
||||||
$jQ.cookie('mChatShow'+id,'yes')
|
|
||||||
}
|
|
||||||
if($jQ('#mChat'+id).is(':hidden')){
|
|
||||||
$jQ.cookie('mChatShow'+id,null)}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
},
|
|
||||||
add:function(){
|
|
||||||
if($jQ('#mChatMessage').val()==''){
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
var mChatMessChars=$jQ('#mChatMessage').val().replace(/ /g,'');
|
|
||||||
if(mChatMessChars.length>mChatMssgLngth&&mChatMssgLngth){
|
|
||||||
alert(mChatMssgLngthLong);
|
|
||||||
return
|
|
||||||
}
|
|
||||||
$jQ.ajax({
|
|
||||||
url:mChatFile,
|
|
||||||
timeout:10000,
|
|
||||||
async:false,
|
|
||||||
type:'POST',
|
|
||||||
data:$jQ('#postform').serialize(),
|
|
||||||
dataType:'text',
|
|
||||||
beforeSend:function(){
|
|
||||||
$jQ('#submit_button').attr('disabled','disabled');
|
|
||||||
if(mChatUserTimeout){
|
|
||||||
clearInterval(activeinterval);
|
|
||||||
clearInterval(counter)
|
|
||||||
}
|
|
||||||
clearInterval(interval)
|
|
||||||
},
|
|
||||||
success:function(){
|
|
||||||
mChat.refresh()
|
|
||||||
},
|
|
||||||
error:function(XMLHttpRequest){
|
|
||||||
if(XMLHttpRequest.status==400){
|
|
||||||
alert(mChatFlood)
|
|
||||||
}else if(XMLHttpRequest.status==403){
|
|
||||||
alert(mChatNoAccess)
|
|
||||||
}else if(XMLHttpRequest.status==501){
|
|
||||||
alert(mChatNoMessageInput)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
complete:function(){
|
|
||||||
if($jQ('#mChatData').children('#mChatNoMessage :last')){
|
|
||||||
$jQ('#mChatNoMessage').remove()
|
|
||||||
}
|
|
||||||
$jQ('#submit_button').removeAttr('disabled');
|
|
||||||
interval=setInterval(function(){
|
|
||||||
mChat.refresh()
|
|
||||||
},
|
|
||||||
mChatRefresh);
|
|
||||||
if(mChatUserTimeout){
|
|
||||||
session_time=mChatUserTimeout?mChatUserTimeout/1000:false;
|
|
||||||
counter=setInterval(function(){
|
|
||||||
mChat.countDown()
|
|
||||||
},1000);
|
|
||||||
activeinterval=setInterval(function(){
|
|
||||||
mChat.active()
|
|
||||||
},mChatUserTimeout)
|
|
||||||
}
|
|
||||||
$jQ('#mChatMessage').val('').focus()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
edit:function(id){
|
|
||||||
var message=$jQ('#edit'+id).val();
|
|
||||||
apprise(mChatEditInfo,{
|
|
||||||
'textarea':message,
|
|
||||||
'animate':true,
|
|
||||||
'position':200,
|
|
||||||
'confirm':true
|
|
||||||
}, function(r){
|
|
||||||
if(r){
|
|
||||||
$jQ.ajax({
|
|
||||||
url:mChatFile,
|
|
||||||
timeout:10000,
|
|
||||||
type:'POST',
|
|
||||||
data:{
|
|
||||||
mode:'edit',
|
|
||||||
message_id:id,
|
|
||||||
message:r
|
|
||||||
},
|
|
||||||
dataType:'text',
|
|
||||||
beforeSend:function(){
|
|
||||||
clearInterval(interval);
|
|
||||||
if(mChatUserTimeout){
|
|
||||||
clearInterval(activeinterval);
|
|
||||||
clearInterval(counter);
|
|
||||||
$jQ('#mChatSessTimer').html(mChatRefreshing)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
success:function(html){
|
|
||||||
$jQ('#mess'+id).fadeOut('slow',function(){
|
|
||||||
$jQ(this).replaceWith(html);
|
|
||||||
$jQ('#mess'+id).css('display','none').fadeIn('slow')
|
|
||||||
})
|
|
||||||
},
|
|
||||||
error:function(XMLHttpRequest){
|
|
||||||
if(XMLHttpRequest.status==403){
|
|
||||||
alert(mChatNoAccess)
|
|
||||||
}else if(XMLHttpRequest.status==501){
|
|
||||||
alert(mChatNoMessageInput)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
complete:function(){
|
|
||||||
interval=setInterval(function(){
|
|
||||||
mChat.refresh()
|
|
||||||
},mChatRefresh);
|
|
||||||
if(mChatUserTimeout){
|
|
||||||
session_time=mChatUserTimeout?mChatUserTimeout/1000:false;
|
|
||||||
counter=setInterval(function(){
|
|
||||||
mChat.countDown()
|
|
||||||
},1000);
|
|
||||||
activeinterval=setInterval(function(){
|
|
||||||
mChat.active()
|
|
||||||
},mChatUserTimeout)
|
|
||||||
}
|
|
||||||
if(!mChatArchiveMode){
|
|
||||||
scrH=$jQ('#mChatmain')[0].scrollHeight;
|
|
||||||
window.setTimeout(function(){
|
|
||||||
$jQ('#mChatmain').animate({
|
|
||||||
scrollTop:scrH},1000,'swing')
|
|
||||||
},1500)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}})
|
|
||||||
},
|
|
||||||
del:function(id){
|
|
||||||
apprise(mChatDelConfirm,{
|
|
||||||
'position':200,
|
|
||||||
'animate':true,
|
|
||||||
'confirm':true
|
|
||||||
},function(del){
|
|
||||||
if(del){
|
|
||||||
$jQ.ajax({
|
|
||||||
url:mChatFile,
|
|
||||||
timeout:10000,
|
|
||||||
type:'POST',
|
|
||||||
data:{
|
|
||||||
mode:'delete',
|
|
||||||
message_id:id
|
|
||||||
},
|
|
||||||
beforeSend:function(){
|
|
||||||
clearInterval(interval);
|
|
||||||
if(mChatUserTimeout){
|
|
||||||
clearInterval(activeinterval);
|
|
||||||
clearInterval(counter);
|
|
||||||
$jQ('#mChatSessTimer').html(mChatRefreshing)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
success:function(){
|
|
||||||
$jQ('#mess'+id).fadeOut('slow',function(){
|
|
||||||
$jQ(this).remove()
|
|
||||||
});
|
|
||||||
mChat.sound(mChatForumRoot+'ext/dmzx/mchat/sounds/del.swf')
|
|
||||||
},
|
|
||||||
error:function(){
|
|
||||||
alert(mChatNoAccess)
|
|
||||||
},
|
|
||||||
complete:function(){
|
|
||||||
interval=setInterval(function(){
|
|
||||||
mChat.refresh()
|
|
||||||
},mChatRefresh);
|
|
||||||
if(mChatUserTimeout){
|
|
||||||
session_time=mChatUserTimeout?mChatUserTimeout/1000:false;
|
|
||||||
counter=setInterval(function(){
|
|
||||||
mChat.countDown()
|
|
||||||
},1000);
|
|
||||||
activeinterval=setInterval(function(){
|
|
||||||
mChat.active()
|
|
||||||
},mChatUserTimeout)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
refresh:function(){
|
|
||||||
if(mChatArchiveMode){
|
|
||||||
return
|
|
||||||
}
|
|
||||||
var mess_id=0;
|
|
||||||
if($jQ('#mChatData').children().not('#mChatNoMessage').length){
|
|
||||||
if($jQ('#mChatNoMessage')){
|
|
||||||
$jQ('#mChatNoMessage').remove()
|
|
||||||
}
|
|
||||||
mess_id=$jQ('#mChatData').children(':last-child').attr('id').replace('mess','')
|
|
||||||
}
|
|
||||||
var oldScrH=$jQ('#mChatmain')[0].scrollHeight;
|
|
||||||
$jQ.ajax({
|
|
||||||
url:mChatFile,
|
|
||||||
timeout:10000,
|
|
||||||
type:'POST',
|
|
||||||
async:true,
|
|
||||||
data:{
|
|
||||||
mode:'read',
|
|
||||||
message_last_id:mess_id
|
|
||||||
},
|
|
||||||
dataType:'html',
|
|
||||||
beforeSend:function(){
|
|
||||||
$jQ('#mChatOkIMG,#mChatErrorIMG,#mChatPauseIMG').hide();
|
|
||||||
$jQ('#mChatLoadIMG').show()
|
|
||||||
},
|
|
||||||
success:function(html){
|
|
||||||
if(html!=''&&html!=0){
|
|
||||||
if($jQ('#mChatRefreshText').hasClass('mchat-alert')){
|
|
||||||
$jQ('#mChatRefreshText').removeClass('mchat-alert')
|
|
||||||
}
|
|
||||||
$jQ('#mChatData').append(html).children(':last').not('#mChatNoMessage');
|
|
||||||
var newInner=$jQ('#mChatData').children().not('#mChatNoMessage').innerHeight();
|
|
||||||
var newH=oldScrH+newInner;
|
|
||||||
$jQ('#mChatmain').animate({
|
|
||||||
scrollTop:newH
|
|
||||||
},'slow');
|
|
||||||
mChat.sound(mChatForumRoot+'ext/dmzx/mchat/sounds/add.swf');
|
|
||||||
mChat.alert()
|
|
||||||
}
|
|
||||||
setTimeout(function(){
|
|
||||||
$jQ('#mChatLoadIMG,#mChatErrorIMG,#mChatPauseIMG').hide();
|
|
||||||
$jQ('#mChatOkIMG').show();
|
|
||||||
$jQ('#mChatRefreshText').html(mChatRefreshYes)
|
|
||||||
},500)
|
|
||||||
},
|
|
||||||
error:function(){
|
|
||||||
$jQ('#mChatLoadIMG,#mChatOkIMG,#mChatPauseIMG,#mChatRefreshTextNo,#mChatPauseIMG,').hide();
|
|
||||||
$jQ('#mChatErrorIMG').show();
|
|
||||||
mChat.sound(mChatForumRoot+'ext/dmzx/mchat/sounds/error.swf')
|
|
||||||
},
|
|
||||||
complete:function(){
|
|
||||||
if(!$jQ('#mChatData').children(':last').length){
|
|
||||||
$jQ('#mChatData').append('<div id="mChatNoMessage">'+mChatNoMessage+'</div>').show('slow')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
stats:function(){
|
|
||||||
if(!mChatWhois){
|
|
||||||
return
|
|
||||||
}
|
|
||||||
$jQ.ajax({
|
|
||||||
url:mChatFile,
|
|
||||||
timeout:10000,
|
|
||||||
type:'POST',
|
|
||||||
data:{
|
|
||||||
mode:'stats'
|
|
||||||
},
|
|
||||||
dataType:'html',
|
|
||||||
beforeSend:function(){
|
|
||||||
if(mChatCustomPage){
|
|
||||||
$jQ('#mChatRefreshN').show();
|
|
||||||
$jQ('#mChatRefresh').hide()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
success: function (data) {
|
|
||||||
var json = $.parseJSON(data);
|
|
||||||
$('#mChatStats').replaceWith(json.message);
|
|
||||||
if(mChatCustomPage){
|
|
||||||
setTimeout(function(){
|
|
||||||
$jQ('#mChatRefreshN').hide();
|
|
||||||
$jQ('#mChatRefresh').show()
|
|
||||||
},500)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error:function(){
|
|
||||||
mChat.sound(mChatForumRoot+'ext/dmzx/mchat/sounds/error.swf')
|
|
||||||
},
|
|
||||||
complete:function(){
|
|
||||||
if($jQ('#mChatUserList').length&&($jQ.cookie('mChatShowUserList')=='yes'||mChatCustomPage)){
|
|
||||||
$jQ('#mChatUserList').css('display','block')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
active:function(){
|
|
||||||
if(mChatArchiveMode||!mChatUserTimeout){
|
|
||||||
return
|
|
||||||
}
|
|
||||||
clearInterval(interval);
|
|
||||||
$jQ('#mChatLoadIMG,#mChatOkIMG,#mChatErrorIMG').hide();
|
|
||||||
$jQ('#mChatPauseIMG').show();
|
|
||||||
$jQ('#mChatRefreshText').html(mChatRefreshNo).addClass('mchat-alert');
|
|
||||||
$jQ('#mChatSessMess').html(mChatSessOut).addClass('mchat-alert')
|
|
||||||
}
|
|
||||||
};
|
|
||||||
var interval=setInterval(function(){
|
|
||||||
mChat.refresh()
|
|
||||||
},mChatRefresh);
|
|
||||||
var statsinterval=setInterval(function(){
|
|
||||||
mChat.stats()},mChatWhoisRefresh);
|
|
||||||
var activeinterval=setInterval(function(){
|
|
||||||
mChat.active()},mChatUserTimeout);
|
|
||||||
var session_time=mChatUserTimeout?mChatUserTimeout/1000:false;
|
|
||||||
if(mChatUserTimeout){
|
|
||||||
var counter=setInterval(function(){
|
|
||||||
mChat.countDown()
|
|
||||||
},1000)
|
|
||||||
}
|
|
||||||
if($jQ.cookie('mChatShowSmiles')=='yes'&&$jQ('#mChatSmiles').css('display','none')){
|
|
||||||
$jQ('#mChatSmiles').slideToggle('slow')
|
|
||||||
}
|
|
||||||
if($jQ.cookie('mChatShowBBCodes')=='yes'&&$jQ('#mChatBBCodes').css('display','none')){
|
|
||||||
$jQ('#mChatBBCodes').slideToggle('slow')
|
|
||||||
}
|
|
||||||
if($jQ.cookie('mChatShowUserList')=='yes'&&$jQ('#mChatUserList').length){
|
|
||||||
$jQ('#mChatUserList').slideToggle('slow')
|
|
||||||
}
|
|
||||||
if($jQ.cookie('mChatShowColour')=='yes'&&$jQ('#mChatColour').css('display','none')){
|
|
||||||
$jQ('#mChatColour').slideToggle('slow')
|
|
||||||
}
|
|
||||||
$jQ('#mChatUseSound').change(function(){
|
|
||||||
if($jQ(this).is(':checked')){
|
|
||||||
$jQ.cookie('mChatNoSound',null)
|
|
||||||
}else{
|
|
||||||
$jQ.cookie('mChatNoSound','yes')
|
|
||||||
}
|
|
||||||
});
|
|
||||||
function mChatTimeShow(id){
|
|
||||||
var tid = parseInt(id);
|
|
||||||
$(".mchatrow" + id).show();
|
|
||||||
}
|
|
||||||
function mChatTimeHide(id){
|
|
||||||
var tid = parseInt(id);
|
|
||||||
$(".mchatrow" + id).hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Apprise 1.5 by Daniel Raftery
|
|
||||||
// http://thrivingkings.com/apprise
|
|
||||||
//
|
|
||||||
// Button text added by Adam Bezulski
|
|
||||||
//
|
|
||||||
// Cached jQuery variables, position center added by Josiah Ruddell
|
|
||||||
|
|
||||||
function apprise(a, b, c) {
|
|
||||||
a = '<span style="font-weight:bold; font-size:1.2em;">' + a + "</span>";
|
|
||||||
var d = {
|
|
||||||
confirm: false,
|
|
||||||
verify: false,
|
|
||||||
input: false,
|
|
||||||
textarea: false,
|
|
||||||
animate: false,
|
|
||||||
textOk: "Ok",
|
|
||||||
textCancel: "Cancel",
|
|
||||||
textYes: "Yes",
|
|
||||||
textNo: "No",
|
|
||||||
position: "center"
|
|
||||||
};
|
|
||||||
if (b) {
|
|
||||||
for (var e in d) {
|
|
||||||
if (typeof b[e] == "undefined") b[e] = d[e]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var f = $jQ(document).height(),
|
|
||||||
g = $jQ(document).width(),
|
|
||||||
h = $jQ('<div class="appriseOuter"></div>'),
|
|
||||||
i = $jQ('<div class="appriseOverlay" id="aOverlay"></div>'),
|
|
||||||
j = $jQ('<div class="appriseInner"></div>'),
|
|
||||||
k = $jQ('<div class="aButtons"></div>'),
|
|
||||||
l = 300;
|
|
||||||
i.css({
|
|
||||||
height: f,
|
|
||||||
width: g
|
|
||||||
}).appendTo("body").fadeIn(100, function () {
|
|
||||||
$jQ(this).css("filter", "alpha(opacity=70)");
|
|
||||||
});
|
|
||||||
h.prependTo("body");
|
|
||||||
j.append(a).appendTo(h);
|
|
||||||
if (b) {
|
|
||||||
if (b["input"]) {
|
|
||||||
if (typeof b["input"] == "string") {
|
|
||||||
j.append('<div class="aInput"><input type="text" class="aTextbox" t="aTextbox" value="' + b["input"] + '" /></div>');
|
|
||||||
} else {
|
|
||||||
j.append('<div class="aInput"><input type="text" class="aTextbox" t="aTextbox" /></div>');
|
|
||||||
}
|
|
||||||
$jQ(".aTextbox").focus();
|
|
||||||
}
|
|
||||||
if (typeof b["textarea"] == "string") {
|
|
||||||
j.append('<div class="aInput"><textarea name="message" class="aEdit" style="height: 9em;" rows="5" cols="180">' + b["textarea"] + "</textarea></div>");
|
|
||||||
$jQ(".aEdit").focus();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
j.append(k);
|
|
||||||
if (b) {
|
|
||||||
if (b["confirm"] || b["input"]) {
|
|
||||||
k.append('<button value="ok">' + b["textOk"] + "</button>");
|
|
||||||
k.append('<button value="cancel">' + b["textCancel"] + "</button>");
|
|
||||||
} else if (b["verify"]) {
|
|
||||||
k.append('<button value="ok">' + b["textYes"] + "</button>");
|
|
||||||
k.append('<button value="cancel">' + b["textNo"] + "</button>");
|
|
||||||
} else {
|
|
||||||
k.append('<button value="ok">' + b["textOk"] + "</button>");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
k.append('<button value="ok">Ok</button>');
|
|
||||||
}
|
|
||||||
h.css("left", ($jQ(window).width() - $jQ(".appriseOuter").width()) / 2 + $jQ(window).scrollLeft() + "px");
|
|
||||||
if (b) {
|
|
||||||
if (b["position"] && b["position"] === "center") {
|
|
||||||
l = (f - h.height()) / 2
|
|
||||||
}
|
|
||||||
if (b["animate"]) {
|
|
||||||
var m = b["animate"];
|
|
||||||
if (isNaN(m)) {
|
|
||||||
m = 400
|
|
||||||
}
|
|
||||||
h.css("top", "-200px").show().animate({
|
|
||||||
top: l
|
|
||||||
}, m);
|
|
||||||
} else {
|
|
||||||
h.css("top", l).fadeIn(200);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
h.css("top", l).fadeIn(200);
|
|
||||||
}
|
|
||||||
$jQ(document).keydown(function (a) {
|
|
||||||
if (i.is(":visible")) {
|
|
||||||
if (a.shiftKey && a.keyCode == 13) {
|
|
||||||
$jQ(".aEdit").append("<br />");
|
|
||||||
} else if (a.keyCode == 13) {
|
|
||||||
$jQ('.aButtons > button[value="ok"]').click();
|
|
||||||
} else if (a.keyCode == 27) {
|
|
||||||
$jQ('.aButtons > button[value="cancel"]').click();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
var n = $jQ(".aTextbox").val();
|
|
||||||
if (!n) {
|
|
||||||
n = false
|
|
||||||
}
|
|
||||||
$jQ(".aTextbox").bind('keydown blur', function () {
|
|
||||||
n = $jQ(this).val();
|
|
||||||
});
|
|
||||||
var o = $jQ(".aEdit").val();
|
|
||||||
if (!o) {
|
|
||||||
o = false
|
|
||||||
}
|
|
||||||
$jQ(".aEdit").bind('keydown blur', function () {
|
|
||||||
o = $jQ(this).val();
|
|
||||||
});
|
|
||||||
$jQ(".aButtons > button").click(function () {
|
|
||||||
i.remove();
|
|
||||||
h.remove();
|
|
||||||
if (c) {
|
|
||||||
$jQ(this).text("");
|
|
||||||
var a = $jQ(this).attr("value");
|
|
||||||
if (a == "ok") {
|
|
||||||
if (b) {
|
|
||||||
if (b["input"]) {
|
|
||||||
c(n);
|
|
||||||
} else if (b["textarea"]) {
|
|
||||||
c(o);
|
|
||||||
} else {
|
|
||||||
c(true);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
c(true);
|
|
||||||
};
|
|
||||||
$jQ('#mChatMessage').focus();
|
|
||||||
} else if (a == "cancel") {
|
|
||||||
c(false);
|
|
||||||
$jQ('#mChatMessage').focus();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
/**
|
|
||||||
*
|
|
||||||
* @package mChat JavaScript Code mini
|
|
||||||
* @version 1.4.4 of 2013-11-03
|
|
||||||
* @copyright (c) 2013 By Rich McGirr (RMcGirr83) http://rmcgirr83.org
|
|
||||||
* @copyright (c) 2009 By Shapoval Andrey Vladimirovich (AllCity) ~ http://allcity.net.ru/
|
|
||||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
|
||||||
*
|
|
||||||
Code uses the titlealert jQuery plugin, options are below
|
|
||||||
interva 500 The flashing interval in milliseconds.
|
|
||||||
originalTitleInterval null Time in milliseconds that the original title is diplayed for. If null the time is the same as interval.
|
|
||||||
duration 0 The total lenght of the flashing before it is automatically stopped. Zero means infinite.
|
|
||||||
stopOnFocus true If true, the flashing will stop when the window gets focus.
|
|
||||||
stopOnMouseMove false If true, the flashing will stop when the document recieves a mousemove event (i.e. when the user moves the mouse over the document area, regardless of what window is active).
|
|
||||||
To use find titlealert in the code and make as so
|
|
||||||
$jQ.titleAlert(mChatNewMessageAlert, {
|
|
||||||
requireBlur:false,
|
|
||||||
stopOnFocus:false,
|
|
||||||
duration:4000,
|
|
||||||
interval:700
|
|
||||||
});
|
|
||||||
**/
|
|
||||||
var $jQ=jQuery;var hasFocus=true;$jQ(function(){if(!mChatArchiveMode){if(mChatPause){$jQ("#mChatMessage").bind("keypress",function(){clearInterval(interval);$jQ("#mChatLoadIMG,#mChatOkIMG,#mChatErrorIMG").hide();$jQ("#mChatRefreshText").html(mChatRefreshNo).addClass("mchat-alert");$jQ("#mChatPauseIMG").show()})}$jQ([window,document]).blur(function(){hasFocus=false}).focus(function(){hasFocus=true});$jQ.fn.autoGrowInput=function(e){var t=$jQ(".mChatPanel").width();e=$jQ.extend({maxWidth:t-20,minWidth:0,comfortZone:20},e);this.filter("input:text").each(function(){var t=e.minWidth||$jQ(this).width(),n="",r=$jQ(this),i=$jQ("<div/>").css({position:"absolute",top:-9999,left:-9999,width:"auto",fontSize:r.css("fontSize"),fontFamily:r.css("fontFamily"),fontWeight:r.css("fontWeight"),letterSpacing:r.css("letterSpacing"),whiteSpace:"nowrap"}),s=function(){if(n===(n=r.val())){return}var s=n.replace(/&/g,"&").replace(/\s/g," ").replace(/</g,"<").replace(/>/g,">");i.html(s);var u=i.width(),a=u+e.comfortZone>=t?u+e.comfortZone:t,f=r.width(),l=a<f&&a>=t||a>t&&a<e.maxWidth;if(l){r.width(a)}};i.insertAfter(r);$jQ(this).bind("keypress blur change submit focus",s)});return this};$jQ("input.mChatText").autoGrowInput();if(mChatSound&&$jQ.cookie("mChatNoSound")!="yes"){$jQ.cookie("mChatNoSound",null);$jQ("#mChatUseSound").attr("checked","checked")}else{$jQ.cookie("mChatNoSound","yes");$jQ("#mChatUseSound").removeAttr("checked")}if($jQ("#mChatUserList").length&&($jQ.cookie("mChatShowUserList")=="yes"||mChatCustomPage)){$jQ("#mChatUserList").show()}}$jQ.browser={};$jQ.browser.msie=false;if(navigator.userAgent.match(/MSIE ([0-9]+)\./)||navigator.userAgent.match(/Trident\/7.0; rv 11.0/)){$jQ.browser.msie=true}});var mChat={countDown:function(){if($jQ("#mChatSessMess").hasClass("mchat-alert")){$jQ("#mChatSessMess").removeClass("mchat-alert")}session_time=session_time-1;var e=Math.floor(session_time);var t=Math.floor(e/60);var n=Math.floor(t/60);e=e%60;if(e<=9){e="0"+e}t=t%60;if(t<=9){t="0"+t}n=n%60;if(n<=9){n="0"+n}var r=n+":"+t+":"+e;$jQ("#mChatSessMess").html(mChatSessEnds+" "+r);if(session_time<=0){clearInterval(counter);$jQ("#mChatSessMess").html(mChatSessOut).addClass("mchat-alert")}},clear:function(){if($jQ("#mChatMessage").val()==""){return false}var e=confirm(mChatReset);if(e){if($jQ("#mChatRefreshText").hasClass("mchat-alert")){$jQ("#mChatRefreshText").removeClass("mchat-alert")}if(mChatPause){interval=setInterval(function(){mChat.refresh()},mChatRefresh)}$jQ("#mChatOkIMG").show();$jQ("#mChatLoadIMG, #mChatErrorIMG, #mChatPauseIMG").hide();$jQ("#mChatRefreshText").html(mChatRefreshYes);$jQ("#mChatMessage").val("").focus()}else{$jQ("#mChatMessage").focus()}},sound:function(e){if($jQ.cookie("mChatNoSound")=="yes"){return}if($jQ.browser.msie){$jQ("#mChatSound").html('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" height="0" width="0" type="application/x-shockwave-flash"><param name="movie" value="'+e+'"></object>')}else{$jQ("#mChatSound").html('<embed src="'+e+'" width="0" height="0" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>')}},notice:function(){if(!hasFocus){$jQ.titleAlert(mChatNewMessageAlert,{interval:1e3})}},toggle:function(e){$jQ("#mChat"+e).slideToggle("normal",function(){if($jQ("#mChat"+e).is(":visible")){$jQ.cookie("mChatShow"+e,"yes")}if($jQ("#mChat"+e).is(":hidden")){$jQ.cookie("mChatShow"+e,null)}})},add:function(){if($jQ("#mChatMessage").val()==""){return false}var e=$jQ("#mChatMessage").val().replace(/ /g,"");if(e.length>mChatMssgLngth&&mChatMssgLngth){alert(mChatMssgLngthLong);return}$jQ.ajax({url:mChatFile,timeout:1e4,type:"POST",data:$jQ("#postform").serialize(),async:true,dataType:"text",beforeSend:function(){$jQ("#submit_button").attr("disabled","disabled");if(mChatUserTimeout){clearInterval(activeinterval);clearInterval(counter)}clearInterval(interval)},success:function(){mChat.refresh()},error:function(e){if(e.status==400){alert(mChatFlood)}else if(e.status==403){alert(mChatNoAccess)}else if(e.status==501){alert(mChatNoMessageInput)}},complete:function(){if($jQ("#mChatData").children("#mChatNoMessage :last")){$jQ("#mChatNoMessage").remove()}$jQ("#submit_button").removeAttr("disabled");interval=setInterval(function(){mChat.refresh()},mChatRefresh);if(mChatUserTimeout){session_time=mChatUserTimeout?mChatUserTimeout/1e3:false;counter=setInterval(function(){mChat.countDown()},1e3);activeinterval=setInterval(function(){mChat.active()},mChatUserTimeout)}$jQ("#mChatMessage").val("").focus()}})},edit:function(id){var message=$jQ('#edit'+id).val();apprise(mChatEditInfo,{'textarea':message,'animate':true,'position':200,'confirm':true}, function(r){if(r){$jQ.ajax({url:mChatFile,timeout:10000,type:'POST',data:{mode:'edit',message_id:id,message:r},dataType:'text',beforeSend:function(){clearInterval(interval);if(mChatUserTimeout){clearInterval(actLine truncated
|
|
||||||
function mChatTimeShow(id){var tid = parseInt(id);$(".mchatrow" + id).show();}function mChatTimeHide(id){var tid = parseInt(id);$(".mchatrow" + id).hide();}
|
|
||||||
// Apprise 1.5 by Daniel Raftery
|
|
||||||
// http://thrivingkings.com/apprise
|
|
||||||
//
|
|
||||||
// Button text added by Adam Bezulski
|
|
||||||
//
|
|
||||||
// Cached jQuery variables, position center added by Josiah Ruddell
|
|
||||||
|
|
||||||
function apprise(a,b,c){a='<span style="font-weight:bold; font-size:1.2em;">'+a+"</span>";var d={confirm:false,verify:false,input:false,textarea:false,animate:false,textOk:"Ok",textCancel:"Cancel",textYes:"Yes",textNo:"No",position:"center"};if(b){for(var e in d){if(typeof b[e]=="undefined")b[e]=d[e]}}var f=$(document).height(),g=$(document).width(),h=$('<div class="appriseOuter"></div>'),i=$('<div class="appriseOverlay" id="aOverlay"></div>'),j=$('<div class="appriseInner"></div>'),k=$('<div class="aButtons"></div>'),l=300;i.css({height:f,width:g}).appendTo("body").fadeIn(100,function(){$(this).css("filter","alpha(opacity=70)")});h.prependTo("body");j.append(a).appendTo(h);if(b){if(b["input"]){if(typeof b["input"]=="string"){j.append('<div class="aInput"><input type="text" class="aTextbox" t="aTextbox" value="'+b["input"]+'" /></div>')}else{j.append('<div class="aInput"><input type="text" class="aTextbox" t="aTextbox" /></div>')}$(".aTextbox").focus()}if(typeof b["textarea"]=="string"){j.append('<div class="aInput"><textarea name="message" class="aEdit" style="height: 9em;" rows="5" cols="180">'+b["textarea"]+"</textarea></div>");$(".aEdit").focus()}}j.append(k);if(b){if(b["confirm"]||b["input"]){k.append('<button value="ok">'+b["textOk"]+"</button>");k.append('<button value="cancel">'+b["textCancel"]+"</button>")}else if(b["verify"]){k.append('<button value="ok">'+b["textYes"]+"</button>");k.append('<button value="cancel">'+b["textNo"]+"</button>")}else{k.append('<button value="ok">'+b["textOk"]+"</button>")}}else{k.append('<button value="ok">Ok</button>')}h.css("left",($(window).width()-$(".appriseOuter").width())/2+$(window).scrollLeft()+"px");if(b){if(b["position"]&&b["position"]==="center"){l=(f-h.height())/2}if(b["animate"]){var m=b["animate"];if(isNaN(m)){m=400}h.css("top","-200px").show().animate({top:l},m)}else{h.css("top",l).fadeIn(200)}}else{h.css("top",l).fadeIn(200)}$(document).keydown(function(a){if(i.is(":visible")){if(a.shiftKey&&a.keyCode==13){$(".aEdit").append("<br />")}else if(a.keyCode==13){$('.aButtons > button[value="ok"]').click()}else if(a.keyCode==27){$('.aButtons > button[value="cancel"]').click()}}});var n=$(".aTextbox").val();if(!n){n=false}$(".aTextbox").bind('keydown blur',function(){n=$(this).val()});var o=$(".aEdit").val();if(!o){o=false}$(".aEdit").bind('keydown blur',function(){o=$(this).val()});$(".aButtons > button").click(function(){i.remove();h.remove();if(c){$(this).text("");var a=$(this).attr("value");if(a=="ok"){if(b){if(b["input"]){c(n)}else if(b["textarea"]){c(o)}else{c(true)}}else{c(true)};$('#mChatMessage').focus();}else if(a=="cancel"){c(false);$('#mChatMessage').focus();}}})}
|
|
||||||
@@ -5,12 +5,8 @@
|
|||||||
<!-- INCLUDEJS editor.js -->
|
<!-- INCLUDEJS editor.js -->
|
||||||
<!-- INCLUDEJS jquery.titlealert.min.js -->
|
<!-- INCLUDEJS jquery.titlealert.min.js -->
|
||||||
<!-- INCLUDEJS jquery_cookie_mini.js -->
|
<!-- INCLUDEJS jquery_cookie_mini.js -->
|
||||||
<!-- IF MCHAT_MESSAGE_TOP -->
|
|
||||||
<!-- INCLUDEJS mchat_ajax_mini_top.js -->
|
|
||||||
<!-- ELSE -->
|
|
||||||
<!-- INCLUDEJS mchat_ajax_mini.js -->
|
|
||||||
<!-- ENDIF -->
|
|
||||||
<!-- INCLUDEJS jquery.maxlength.min.js -->
|
<!-- INCLUDEJS jquery.maxlength.min.js -->
|
||||||
|
<!-- INCLUDEJS mchat.min.js -->
|
||||||
|
|
||||||
<!-- IF MCHAT_ARCHIVE_MODE -->
|
<!-- IF MCHAT_ARCHIVE_MODE -->
|
||||||
<!--**
|
<!--**
|
||||||
@@ -50,64 +46,38 @@
|
|||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
// <![CDATA[
|
// <![CDATA[
|
||||||
// Define mChat setting
|
// Define mChat setting
|
||||||
var mChatNoMessage = '{MCHAT_NOMESSAGE_MODE}';
|
window.mChat = {
|
||||||
var mChatFile = '{MCHAT_FILE_NAME}';
|
messageTop : <!-- IF MCHAT_MESSAGE_TOP -->true<!-- ELSE -->false<!-- ENDIF -->,
|
||||||
var mChatForumRoot = '{ROOT_PATH}';
|
noMessage : '{MCHAT_NOMESSAGE_MODE}',
|
||||||
var mChatCustomPage = '{MCHAT_CUSTOM_PAGE}';
|
file : '{MCHAT_FILE_NAME}',
|
||||||
<!-- IF not MCHAT_ARCHIVE_MODE -->
|
forumRoot : '{ROOT_PATH}',
|
||||||
var mChatPause = '{MCHAT_PAUSE_ON_INPUT}';
|
customPage : '{MCHAT_CUSTOM_PAGE}',
|
||||||
var mChatRefresh = '{MCHAT_REFRESH_JS}';
|
pause : <!-- IF not MCHAT_ARCHIVE_MODE -->'{MCHAT_PAUSE_ON_INPUT}'<!-- ELSE -->false<!-- ENDIF -->,
|
||||||
<!-- ELSE -->
|
refreshTime : <!-- IF not MCHAT_ARCHIVE_MODE -->'{MCHAT_REFRESH_JS}'<!-- ELSE -->false<!-- ENDIF -->,
|
||||||
var mChatPause = false;
|
userTimeout : <!-- IF MCHAT_USER_TIMEOUT -->'{MCHAT_USER_TIMEOUT}'<!-- ELSE -->false<!-- ENDIF -->,
|
||||||
var mChatRefresh = false;
|
newMessageAlert : '{LA_MCHAT_NEW_CHAT}',
|
||||||
<!-- ENDIF -->
|
noMessageInput : '{LA_MCHAT_NOMESSAGEINPUT}',
|
||||||
<!-- IF MCHAT_USER_TIMEOUT -->
|
noMessages : '{LA_MCHAT_NOMESSAGE}',
|
||||||
var mChatUserTimeout = '{MCHAT_USER_TIMEOUT}';
|
editInfo : '{LA_MCHAT_EDITINFO}',
|
||||||
<!-- ELSE -->
|
noAccess : '{LA_MCHAT_NOACCESS}',
|
||||||
var mChatUserTimeout = false;
|
flood : '{LA_MCHAT_FLOOD}',
|
||||||
<!-- ENDIF -->
|
delConfirm : '{LA_MCHAT_DELCONFIRM}',
|
||||||
var mChatNewMessageAlert = '{LA_MCHAT_NEW_CHAT}';
|
reset : '{LA_MCHAT_RESET_QUESTION}',
|
||||||
var mChatNoMessageInput = '{LA_MCHAT_NOMESSAGEINPUT}';
|
refreshing : '{LA_MCHAT_REFRESHING}',
|
||||||
var mChatNoMessage = '{LA_MCHAT_NOMESSAGE}';
|
sessOut : '{LA_MCHAT_SESSION_OUT}',
|
||||||
var mChatEditInfo = '{LA_MCHAT_EDITINFO}';
|
sessEnds : '{LA_MCHAT_SESSION_ENDS}',
|
||||||
var mChatNoAccess = '{LA_MCHAT_NOACCESS}';
|
refreshYes : '{MCHAT_REFRESH_YES}',
|
||||||
var mChatFlood = '{LA_MCHAT_FLOOD}';
|
refreshNo : '{LA_MCHAT_REFRESH_NO}',
|
||||||
var mChatDelConfirm = '{LA_MCHAT_DELCONFIRM}';
|
mssgLngthLong : '{MCHAT_MESS_LONG}',
|
||||||
var mChatReset = '{LA_MCHAT_RESET_QUESTION}';
|
likes : '{LA_MCHAT_LIKES}',
|
||||||
var mChatRefreshing = '{LA_MCHAT_REFRESHING}';
|
mssgLngth : <!-- IF MCHAT_MESSAGE_LNGTH -->'{MCHAT_MESSAGE_LNGTH}'<!-- ELSE -->false<!-- ENDIF -->,
|
||||||
var mChatSessOut = '{LA_MCHAT_SESSION_OUT}';
|
playSound : <!-- IF S_MCHAT_SOUND_YES -->true<!-- ELSE -->false<!-- ENDIF -->,
|
||||||
var mChatSessEnds = '{LA_MCHAT_SESSION_ENDS}';
|
whois : <!-- IF MCHAT_WHOIS -->true<!-- ELSE -->false<!-- ENDIF -->,
|
||||||
var mChatRefreshYes = '{MCHAT_REFRESH_YES}';
|
whoisRefresh : <!-- IF MCHAT_WHOIS -->'{MCHAT_WHOIS_REFRESH}'<!-- ELSE -->false<!-- ENDIF -->,
|
||||||
var mChatRefreshNo = '{LA_MCHAT_REFRESH_NO}';
|
focusFix : <!-- IF MCHAT_ARCHIVE_MODE -->false<!-- ELSE -->true<!-- ENDIF -->,
|
||||||
var mChatMssgLngthLong = '{MCHAT_MESS_LONG}';
|
archiveMode : <!-- IF MCHAT_ARCHIVE_MODE -->true<!-- ELSE -->false<!-- ENDIF -->
|
||||||
var mChatLikes = '{LA_MCHAT_LIKES}';
|
};
|
||||||
<!-- IF MCHAT_MESSAGE_LNGTH -->
|
function insert_quote(user, text) {
|
||||||
var mChatMssgLngth = '{MCHAT_MESSAGE_LNGTH}';
|
|
||||||
<!-- ELSE -->
|
|
||||||
var mChatMssgLngth = false;
|
|
||||||
<!-- ENDIF -->
|
|
||||||
<!-- IF S_MCHAT_SOUND_YES -->
|
|
||||||
var mChatSound = true;
|
|
||||||
<!-- ELSE -->
|
|
||||||
var mChatSound = false;
|
|
||||||
<!-- ENDIF -->
|
|
||||||
<!-- IF MCHAT_WHOIS -->
|
|
||||||
var mChatWhois = true;
|
|
||||||
var mChatWhoisRefresh = '{MCHAT_WHOIS_REFRESH}';
|
|
||||||
<!-- ELSE -->
|
|
||||||
var mChatWhois = false;
|
|
||||||
var mChatWhoisRefresh = false;
|
|
||||||
<!-- ENDIF -->
|
|
||||||
<!-- IF MCHAT_ARCHIVE_MODE -->
|
|
||||||
var mChatArchiveMode = true;
|
|
||||||
<!-- ELSE -->
|
|
||||||
var mChatArchiveMode = false;
|
|
||||||
var form_name = 'postform';
|
|
||||||
var text_name = 'message';
|
|
||||||
var mChatFocusFix = true;
|
|
||||||
<!-- ENDIF -->
|
|
||||||
function insert_quote(user,text)
|
|
||||||
{
|
|
||||||
var quote = decodeURIComponent(text.replace(/\+/g, " "));
|
var quote = decodeURIComponent(text.replace(/\+/g, " "));
|
||||||
quote = quote.replace(/</g, "<");
|
quote = quote.replace(/</g, "<");
|
||||||
quote = quote.replace(/>/g, ">");
|
quote = quote.replace(/>/g, ">");
|
||||||
@@ -122,12 +92,10 @@
|
|||||||
username = username.replace(/./g, '.');
|
username = username.replace(/./g, '.');
|
||||||
username = username.replace(/&/g, '&');
|
username = username.replace(/&/g, '&');
|
||||||
username = username.replace(/"/g, '"');
|
username = username.replace(/"/g, '"');
|
||||||
document.getElementById('mChatMessage').value += '[quote="' + username + '"]' + ' ' + quote + '[/quote]';
|
document.getElementById('mChatMessage').value += '[quote="' + username + '"]' + quote + '[/quote]';
|
||||||
document.getElementById('mChatMessage').focus();
|
document.getElementById('mChatMessage').focus();
|
||||||
}
|
}
|
||||||
|
function insert_like(user, text) {
|
||||||
function insert_like(user,text)
|
|
||||||
{
|
|
||||||
var quote = decodeURIComponent(text.replace(/\+/g, " "));
|
var quote = decodeURIComponent(text.replace(/\+/g, " "));
|
||||||
quote = quote.replace(/</g, "<");
|
quote = quote.replace(/</g, "<");
|
||||||
quote = quote.replace(/>/g, ">");
|
quote = quote.replace(/>/g, ">");
|
||||||
@@ -142,7 +110,7 @@
|
|||||||
username = username.replace(/./g, '.');
|
username = username.replace(/./g, '.');
|
||||||
username = username.replace(/&/g, '&');
|
username = username.replace(/&/g, '&');
|
||||||
username = username.replace(/"/g, '"');
|
username = username.replace(/"/g, '"');
|
||||||
document.getElementById('mChatMessage').value += '' + mChatLikes + '[quote="' + username + '"]' + ' ' + quote + '[/quote]';
|
document.getElementById('mChatMessage').value += '' + mChat.likes + '[quote="' + username + '"]' + quote + '[/quote]';
|
||||||
document.getElementById('mChatMessage').focus();
|
document.getElementById('mChatMessage').focus();
|
||||||
}
|
}
|
||||||
// ]]>
|
// ]]>
|
||||||
|
|||||||
Reference in new issue
Block a user