Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ExeBy/smexe_ro.../var/softacul.../mt
File: mt.js
// The cookie name to use for storing the blog-side comment session cookie.
[0] Fix | Delete
var mtCookieName = "mt_blog_user";
[1] Fix | Delete
var mtCookieDomain = ".[[domhost]]";
[2] Fix | Delete
var mtCookiePath = "/";
[3] Fix | Delete
var mtCookieTimeout = 14400;
[4] Fix | Delete
[5] Fix | Delete
[6] Fix | Delete
function mtHide(id) {
[7] Fix | Delete
var el = (typeof id == "string") ? document.getElementById(id) : id;
[8] Fix | Delete
if (el) el.style.display = 'none';
[9] Fix | Delete
}
[10] Fix | Delete
[11] Fix | Delete
[12] Fix | Delete
function mtShow(id) {
[13] Fix | Delete
var el = (typeof id == "string") ? document.getElementById(id) : id;
[14] Fix | Delete
if (el) el.style.display = 'block';
[15] Fix | Delete
}
[16] Fix | Delete
[17] Fix | Delete
[18] Fix | Delete
function mtAttachEvent(eventName,func) {
[19] Fix | Delete
var onEventName = 'on' + eventName;
[20] Fix | Delete
var old = window[onEventName];
[21] Fix | Delete
if( typeof old != 'function' )
[22] Fix | Delete
window[onEventName] = func;
[23] Fix | Delete
else {
[24] Fix | Delete
window[onEventName] = function( evt ) {
[25] Fix | Delete
old( evt );
[26] Fix | Delete
return func( evt );
[27] Fix | Delete
};
[28] Fix | Delete
}
[29] Fix | Delete
}
[30] Fix | Delete
[31] Fix | Delete
[32] Fix | Delete
function mtFireEvent(eventName,param) {
[33] Fix | Delete
var fn = window['on' + eventName];
[34] Fix | Delete
if (typeof fn == 'function') return fn(param);
[35] Fix | Delete
return;
[36] Fix | Delete
}
[37] Fix | Delete
[38] Fix | Delete
if(!this.JSON){JSON={};}(function(){function f(n){return n<10?'0'+n:n;}if(typeof Date.prototype.toJSON!=='function'){Date.prototype.toJSON=function(key){return this.getUTCFullYear()+'-'+f(this.getUTCMonth()+1)+'-'+f(this.getUTCDate())+'T'+f(this.getUTCHours())+':'+f(this.getUTCMinutes())+':'+f(this.getUTCSeconds())+'Z';};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf();};}var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==='string'?c:'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4);})+'"':'"'+string+'"';}function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==='object'&&typeof value.toJSON==='function'){value=value.toJSON(key);}if(typeof rep==='function'){value=rep.call(holder,key,value);}switch(typeof value){case'string':return quote(value);case'number':return isFinite(value)?String(value):'null';case'boolean':case'null':return String(value);case'object':if(!value){return'null';}gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==='[object Array]'){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||'null';}v=partial.length===0?'[]':gap?'[\n'+gap+partial.join(',\n'+gap)+'\n'+mind+']':'['+partial.join(',')+']';gap=mind;return v;}if(rep&&typeof rep==='object'){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==='string'){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}v=partial.length===0?'{}':gap?'{\n'+gap+partial.join(',\n'+gap)+'\n'+mind+'}':'{'+partial.join(',')+'}';gap=mind;return v;}}if(typeof JSON.stringify!=='function'){JSON.stringify=function(value,replacer,space){var i;gap='';indent='';if(typeof space==='number'){for(i=0;i<space;i+=1){indent+=' ';}}else if(typeof space==='string'){indent=space;}rep=replacer;if(replacer&&typeof replacer!=='function'&&(typeof replacer!=='object'||typeof replacer.length!=='number')){throw new Error('JSON.stringify');}return str('',{'':value});};}if(typeof JSON.parse!=='function'){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==='object'){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v;}else{delete value[k];}}}}return reviver.call(holder,key,value);}cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4);});}if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,''))){j=eval('('+text+')');return typeof reviver==='function'?walk({'':j},''):j;}throw new SyntaxError('JSON.parse');};}}());
[39] Fix | Delete
[40] Fix | Delete
var MT = window.MT || {};
[41] Fix | Delete
[42] Fix | Delete
MT.cons = function () {
[43] Fix | Delete
return {
[44] Fix | Delete
LOG : 'log',
[45] Fix | Delete
WARN : 'warn',
[46] Fix | Delete
DEBUG : 'debug',
[47] Fix | Delete
INFO : 'info',
[48] Fix | Delete
ERR : 'error',
[49] Fix | Delete
JSON : 'json'
[50] Fix | Delete
};
[51] Fix | Delete
}();
[52] Fix | Delete
[53] Fix | Delete
[54] Fix | Delete
MT.core = function (o) {
[55] Fix | Delete
var _debug = false;
[56] Fix | Delete
[57] Fix | Delete
return {
[58] Fix | Delete
[59] Fix | Delete
connect : function (url,respType,respHandler) {
[60] Fix | Delete
var xh = mtGetXmlHttp();
[61] Fix | Delete
if (!xh) return false;
[62] Fix | Delete
[63] Fix | Delete
xh.onreadystatechange = function() {
[64] Fix | Delete
if ( xh.readyState == 4 ) {
[65] Fix | Delete
if ( xh.status && ( xh.status != 200 ) ) {
[66] Fix | Delete
// error - ignore
[67] Fix | Delete
} else {
[68] Fix | Delete
switch (respType) {
[69] Fix | Delete
case 'json':
[70] Fix | Delete
respHandler(JSON.parse(xh.responseText));
[71] Fix | Delete
break;
[72] Fix | Delete
[73] Fix | Delete
case 'xml':
[74] Fix | Delete
break;
[75] Fix | Delete
[76] Fix | Delete
case 'text':
[77] Fix | Delete
break;
[78] Fix | Delete
}
[79] Fix | Delete
}
[80] Fix | Delete
}
[81] Fix | Delete
};
[82] Fix | Delete
[83] Fix | Delete
xh.open('GET',url);
[84] Fix | Delete
xh.send(null);
[85] Fix | Delete
},
[86] Fix | Delete
[87] Fix | Delete
getEl : function (el) {
[88] Fix | Delete
return MT.util.checkNodeType(el)==='element' ? id : (document.getElementById(el) || false);
[89] Fix | Delete
},
[90] Fix | Delete
[91] Fix | Delete
addEvent : function (el,type,func,obj) {
[92] Fix | Delete
if(!obj && document.addEventListener) {
[93] Fix | Delete
el.addEventListener(type,func,false);
[94] Fix | Delete
} else if(obj && document.addEventListener) {
[95] Fix | Delete
el.addEventListener(type,function () {
[96] Fix | Delete
func.call(obj,event);
[97] Fix | Delete
},false);
[98] Fix | Delete
} else {
[99] Fix | Delete
if(obj) {
[100] Fix | Delete
el.attachEvent('on' + type,function () {
[101] Fix | Delete
func.call(obj,event);
[102] Fix | Delete
});
[103] Fix | Delete
} else {
[104] Fix | Delete
el.attachEvent('on' + type,function () {
[105] Fix | Delete
func.call(el,event);
[106] Fix | Delete
});
[107] Fix | Delete
}
[108] Fix | Delete
}
[109] Fix | Delete
},
[110] Fix | Delete
[111] Fix | Delete
[112] Fix | Delete
log : function (level,msg) {
[113] Fix | Delete
if(_debug && window.console) {
[114] Fix | Delete
switch(level) {
[115] Fix | Delete
case 'warn':
[116] Fix | Delete
case 'debug':
[117] Fix | Delete
case 'info':
[118] Fix | Delete
case 'error':
[119] Fix | Delete
case 'log':
[120] Fix | Delete
console[level](msg);
[121] Fix | Delete
break;
[122] Fix | Delete
[123] Fix | Delete
default:
[124] Fix | Delete
return false;
[125] Fix | Delete
}
[126] Fix | Delete
} else {
[127] Fix | Delete
return false;
[128] Fix | Delete
}
[129] Fix | Delete
}
[130] Fix | Delete
}
[131] Fix | Delete
}();
[132] Fix | Delete
[133] Fix | Delete
[134] Fix | Delete
MT.util = function () {
[135] Fix | Delete
return {
[136] Fix | Delete
toggleVisibility : {
[137] Fix | Delete
show : function () {
[138] Fix | Delete
var i = arguments.length;
[139] Fix | Delete
[140] Fix | Delete
while(i--) {
[141] Fix | Delete
if(MT.util.checkNodeType(arguments[i])==='element') {
[142] Fix | Delete
arguments[i].style.visibility = 'visible';
[143] Fix | Delete
} else {
[144] Fix | Delete
MT.core.getEl(arguments[i]).style.visibility = 'visible';
[145] Fix | Delete
}
[146] Fix | Delete
}
[147] Fix | Delete
},
[148] Fix | Delete
[149] Fix | Delete
hide : function () {
[150] Fix | Delete
var i = arguments.length;
[151] Fix | Delete
while(i--) {
[152] Fix | Delete
if(MT.util.checkNodeType(arguments[i])==='element') {
[153] Fix | Delete
arguments[i].style.visibility = 'hidden';
[154] Fix | Delete
} else {
[155] Fix | Delete
MT.core.getEl(arguments[i]).style.visibility = 'hidden';
[156] Fix | Delete
}
[157] Fix | Delete
}
[158] Fix | Delete
}
[159] Fix | Delete
},
[160] Fix | Delete
[161] Fix | Delete
toggleDisplay : {
[162] Fix | Delete
show : function () {
[163] Fix | Delete
var i = arguments.length;
[164] Fix | Delete
while(i--) {
[165] Fix | Delete
if(MT.util.checkNodeType(arguments[i])==='element') {
[166] Fix | Delete
arguments[i].style.display = '';
[167] Fix | Delete
} else {
[168] Fix | Delete
MT.core.getEl(arguments[i]).style.display = '';
[169] Fix | Delete
}
[170] Fix | Delete
}
[171] Fix | Delete
},
[172] Fix | Delete
[173] Fix | Delete
hide : function () {
[174] Fix | Delete
var i = arguments.length;
[175] Fix | Delete
while(i--) {
[176] Fix | Delete
if(MT.util.checkNodeType(arguments[i])==='element') {
[177] Fix | Delete
arguments[i].style.display = 'none';
[178] Fix | Delete
} else {
[179] Fix | Delete
MT.core.getEl(arguments[i]).style.display = 'none';
[180] Fix | Delete
}
[181] Fix | Delete
}
[182] Fix | Delete
}
[183] Fix | Delete
},
[184] Fix | Delete
[185] Fix | Delete
[186] Fix | Delete
findDefiningParent : function (origin) {
[187] Fix | Delete
if(MT.util.checkNodeType(origin)==='element') {
[188] Fix | Delete
for(var node=origin.parentNode;node.parentNode;node=node.parentNode) {
[189] Fix | Delete
if((node.hasAttribute && node.hasAttribute('id')) || node.getAttribute('id')) {
[190] Fix | Delete
return node;
[191] Fix | Delete
}
[192] Fix | Delete
}
[193] Fix | Delete
}
[194] Fix | Delete
return false;
[195] Fix | Delete
},
[196] Fix | Delete
[197] Fix | Delete
[198] Fix | Delete
checkNodeType : function (obj) {
[199] Fix | Delete
if (obj && obj.nodeName){
[200] Fix | Delete
switch (obj.nodeType) {
[201] Fix | Delete
case 1: return 'element';
[202] Fix | Delete
case 3: return (/\S/).test(obj.nodeValue) ? 'textnode' : 'whitespace';
[203] Fix | Delete
}
[204] Fix | Delete
}
[205] Fix | Delete
}
[206] Fix | Delete
}
[207] Fix | Delete
}();
[208] Fix | Delete
[209] Fix | Delete
[210] Fix | Delete
(function () {
[211] Fix | Delete
var M = MT.core,
[212] Fix | Delete
c = MT.cons,
[213] Fix | Delete
u = MT.util,
[214] Fix | Delete
cache,
[215] Fix | Delete
isLoading,
[216] Fix | Delete
direction,
[217] Fix | Delete
currentComments,
[218] Fix | Delete
commentAnchor,
[219] Fix | Delete
commentArrId,
[220] Fix | Delete
commentsPerPage,
[221] Fix | Delete
commentsTotalPages,
[222] Fix | Delete
loadingIcon,
[223] Fix | Delete
pageNum,
[224] Fix | Delete
commentsOffset,
[225] Fix | Delete
totalComments,
[226] Fix | Delete
entryID,
[227] Fix | Delete
commentContentDiv,
[228] Fix | Delete
topNav,
[229] Fix | Delete
nav,
[230] Fix | Delete
currentCommentsSpan,
[231] Fix | Delete
topCurrentCommentsSpan;
[232] Fix | Delete
[233] Fix | Delete
M.addEvent(window,'load',_init);
[234] Fix | Delete
[235] Fix | Delete
/**
[236] Fix | Delete
* Initializes the class
[237] Fix | Delete
*
[238] Fix | Delete
* @return void
[239] Fix | Delete
*/
[240] Fix | Delete
function _init () {
[241] Fix | Delete
if(!MT.entryCommentCount) {
[242] Fix | Delete
return;
[243] Fix | Delete
}
[244] Fix | Delete
[245] Fix | Delete
_initializeVariables();
[246] Fix | Delete
_setCommentOffset(false);
[247] Fix | Delete
_checkForAnchor();
[248] Fix | Delete
_setCurrentComments();
[249] Fix | Delete
_toggleNavLinks();
[250] Fix | Delete
_initializeEvents();
[251] Fix | Delete
}
[252] Fix | Delete
[253] Fix | Delete
[254] Fix | Delete
function _initializeVariables() {
[255] Fix | Delete
cache = {};
[256] Fix | Delete
isLoading = false;
[257] Fix | Delete
commentAnchor = '';
[258] Fix | Delete
commentArrId = '';
[259] Fix | Delete
commentsPerPage = MT.commentsPerPage || 50;
[260] Fix | Delete
currentComments = '';
[261] Fix | Delete
direction = 'ascend';
[262] Fix | Delete
entryID = MT.entryID;
[263] Fix | Delete
totalComments = MT.entryCommentCount;
[264] Fix | Delete
commentsTotalPages = Math.ceil(totalComments / commentsPerPage);
[265] Fix | Delete
pageNum = 1;
[266] Fix | Delete
[267] Fix | Delete
loadingIcon = "<img title='Loading...' src='[[wwwurl]]/mt-static/images/indicator.white.gif' alt='Loading' />";
[268] Fix | Delete
[269] Fix | Delete
commentContentDiv = M.getEl("comments-content");
[270] Fix | Delete
topNav = M.getEl("top-comment-nav");
[271] Fix | Delete
nav = M.getEl("comment-nav");
[272] Fix | Delete
[273] Fix | Delete
currentCommentsSpan = M.getEl("current-comments");
[274] Fix | Delete
topCurrentCommentsSpan = M.getEl("top-current-comments");
[275] Fix | Delete
}
[276] Fix | Delete
[277] Fix | Delete
function _initializeEvents() {
[278] Fix | Delete
if (commentsPerPage < totalComments) {
[279] Fix | Delete
M.addEvent(nav,'click',_handleEvents);
[280] Fix | Delete
M.addEvent(topNav,'click',_handleEvents);
[281] Fix | Delete
}
[282] Fix | Delete
}
[283] Fix | Delete
[284] Fix | Delete
[285] Fix | Delete
function _checkForAnchor() {
[286] Fix | Delete
var found = String(window.location.hash).match( /comment-(\d{1,6})/ );
[287] Fix | Delete
[288] Fix | Delete
if (found) {
[289] Fix | Delete
M.log(c.DEBUG,found);
[290] Fix | Delete
if (!Object.prototype.hasOwnProperty.call(M.getEl(found[0]), 'className')) {
[291] Fix | Delete
if (_findIdMatch(found[1])) {
[292] Fix | Delete
pageNum = Math.floor(commentArrId / commentsPerPage) + 1;
[293] Fix | Delete
M.log(c.DEBUG,'Comment Array Id: ' + commentArrId);
[294] Fix | Delete
M.log(c.DEBUG,'Comments Per Page: ' + commentsPerPage);
[295] Fix | Delete
M.log(c.DEBUG,'Page Number: ' + pageNum);
[296] Fix | Delete
M.log(c.DEBUG,'Comment Offset: ' + _getCommentOffset());
[297] Fix | Delete
_updateComments();
[298] Fix | Delete
}
[299] Fix | Delete
}
[300] Fix | Delete
}
[301] Fix | Delete
}
[302] Fix | Delete
[303] Fix | Delete
[304] Fix | Delete
function _setCommentOffset() {
[305] Fix | Delete
commentsOffset = commentsPerPage * (pageNum-1);
[306] Fix | Delete
}
[307] Fix | Delete
[308] Fix | Delete
[309] Fix | Delete
function _getCommentOffset() {
[310] Fix | Delete
return commentsOffset;
[311] Fix | Delete
}
[312] Fix | Delete
[313] Fix | Delete
[314] Fix | Delete
function _handleEvents (e) {
[315] Fix | Delete
var origin = e.target || e.srcElement,
[316] Fix | Delete
parentId;
[317] Fix | Delete
[318] Fix | Delete
// stupid IE
[319] Fix | Delete
origin = origin.id && M.getEl(origin.id) || false;
[320] Fix | Delete
[321] Fix | Delete
if(origin) {
[322] Fix | Delete
parentId = u.checkNodeType(origin.parentNode)==='element' && origin.parentNode.getAttribute('id') && origin.parentNode.id;
[323] Fix | Delete
} else {
[324] Fix | Delete
return false;
[325] Fix | Delete
}
[326] Fix | Delete
[327] Fix | Delete
switch(origin.nodeName) {
[328] Fix | Delete
case 'A':
[329] Fix | Delete
switch (parentId) {
[330] Fix | Delete
case 'prev-comments':
[331] Fix | Delete
case 'top-prev-comments':
[332] Fix | Delete
if(e.preventDefault) {
[333] Fix | Delete
e.preventDefault();
[334] Fix | Delete
} else {
[335] Fix | Delete
e.returnValue = false;
[336] Fix | Delete
}
[337] Fix | Delete
if(!isLoading) {
[338] Fix | Delete
_previousPage();
[339] Fix | Delete
}
[340] Fix | Delete
break;
[341] Fix | Delete
case 'next-comments':
[342] Fix | Delete
case 'top-next-comments':
[343] Fix | Delete
if(e.preventDefault) {
[344] Fix | Delete
e.preventDefault();
[345] Fix | Delete
} else {
[346] Fix | Delete
e.returnValue = false;
[347] Fix | Delete
}
[348] Fix | Delete
if(!isLoading) {
[349] Fix | Delete
_nextPage();
[350] Fix | Delete
}
[351] Fix | Delete
break;
[352] Fix | Delete
}
[353] Fix | Delete
break;
[354] Fix | Delete
}
[355] Fix | Delete
}
[356] Fix | Delete
[357] Fix | Delete
[358] Fix | Delete
function _toggleNavLinks () {
[359] Fix | Delete
M.log(c.DEBUG,M.getEl('top-prev-comments'));
[360] Fix | Delete
if(pageNum <= commentsTotalPages && pageNum !== 1) {
[361] Fix | Delete
u.toggleVisibility.show('prev-comments');
[362] Fix | Delete
u.toggleVisibility.show('top-prev-comments');
[363] Fix | Delete
}
[364] Fix | Delete
[365] Fix | Delete
if(pageNum >= 1 && pageNum !== commentsTotalPages) {
[366] Fix | Delete
u.toggleVisibility.show('next-comments');
[367] Fix | Delete
u.toggleVisibility.show('top-next-comments');
[368] Fix | Delete
}
[369] Fix | Delete
[370] Fix | Delete
if(pageNum===1 || nav.style.visibility==='hidden') {
[371] Fix | Delete
u.toggleVisibility.hide('prev-comments');
[372] Fix | Delete
u.toggleVisibility.hide('top-prev-comments');
[373] Fix | Delete
}
[374] Fix | Delete
[375] Fix | Delete
if(pageNum===commentsTotalPages || nav.style.visibility==='hidden') {
[376] Fix | Delete
u.toggleVisibility.hide('next-comments');
[377] Fix | Delete
u.toggleVisibility.hide('top-next-comments');
[378] Fix | Delete
}
[379] Fix | Delete
}
[380] Fix | Delete
[381] Fix | Delete
[382] Fix | Delete
function _nextPage () {
[383] Fix | Delete
if(pageNum < commentsTotalPages) {
[384] Fix | Delete
pageNum++;
[385] Fix | Delete
_updateComments();
[386] Fix | Delete
}
[387] Fix | Delete
}
[388] Fix | Delete
[389] Fix | Delete
[390] Fix | Delete
function _previousPage() {
[391] Fix | Delete
if(pageNum > 1) {
[392] Fix | Delete
pageNum--;
[393] Fix | Delete
_updateComments();
[394] Fix | Delete
}
[395] Fix | Delete
}
[396] Fix | Delete
[397] Fix | Delete
[398] Fix | Delete
function _findIdMatch (id) {
[399] Fix | Delete
var len = MT.commentIds.length;
[400] Fix | Delete
[401] Fix | Delete
while (len--) {
[402] Fix | Delete
if (MT.commentIds[len] == id) {
[403] Fix | Delete
commentAnchor = "comment-" + id;
[404] Fix | Delete
commentArrId = len;
[405] Fix | Delete
return true;
[406] Fix | Delete
}
[407] Fix | Delete
}
[408] Fix | Delete
[409] Fix | Delete
return false;
[410] Fix | Delete
}
[411] Fix | Delete
[412] Fix | Delete
[413] Fix | Delete
function _setCurrentComments() {
[414] Fix | Delete
var commentsOnPage = pageNum != commentsTotalPages ? commentsOffset + commentsPerPage : totalComments;
[415] Fix | Delete
[416] Fix | Delete
_setCurrentCommentsContent([commentsOffset+1," - ",commentsOnPage].join(''));
[417] Fix | Delete
}
[418] Fix | Delete
[419] Fix | Delete
[420] Fix | Delete
function _setCurrentCommentsContent(currentCommentsHTML) {
[421] Fix | Delete
currentCommentsSpan.innerHTML = currentCommentsHTML;
[422] Fix | Delete
topCurrentCommentsSpan.innerHTML = currentCommentsHTML;
[423] Fix | Delete
}
[424] Fix | Delete
[425] Fix | Delete
[426] Fix | Delete
function _setCommentContent(commentHTML) {
[427] Fix | Delete
commentContentDiv.innerHTML = commentHTML;
[428] Fix | Delete
}
[429] Fix | Delete
[430] Fix | Delete
[431] Fix | Delete
function _updateComments() {
[432] Fix | Delete
var comments, jsonUrl, cacheKey, offset;
[433] Fix | Delete
isLoading = true;
[434] Fix | Delete
_setCurrentCommentsContent(loadingIcon);
[435] Fix | Delete
_setCommentOffset();
[436] Fix | Delete
[437] Fix | Delete
offset = _getCommentOffset();
[438] Fix | Delete
cacheKey = [direction, entryID, commentsPerPage, offset]
[439] Fix | Delete
.join('-')
[440] Fix | Delete
.replace(/[^a-zA-Z0-9-]/g, '');
[441] Fix | Delete
jsonUrl = [
[442] Fix | Delete
"[[softurl]]/mt-comments.cgi?__mode=comment_listing&direction=",
[443] Fix | Delete
direction,
[444] Fix | Delete
"&entry_id=",
[445] Fix | Delete
entryID,
[446] Fix | Delete
"&limit=",
[447] Fix | Delete
commentsPerPage,
[448] Fix | Delete
"&offset=",
[449] Fix | Delete
offset,
[450] Fix | Delete
"&cacheKey=",
[451] Fix | Delete
cacheKey,
[452] Fix | Delete
"&jsonp=mtUpdateCommentsCallback",
[453] Fix | Delete
"&ts=",
[454] Fix | Delete
new Date().getTime()
[455] Fix | Delete
].join('');
[456] Fix | Delete
[457] Fix | Delete
if (!commentAnchor) {
[458] Fix | Delete
commentAnchor = "comments-content";
[459] Fix | Delete
}
[460] Fix | Delete
[461] Fix | Delete
if(cache.hasOwnProperty(cacheKey)) {
[462] Fix | Delete
_refreshComments(cache[cacheKey]);
[463] Fix | Delete
isLoading = false;
[464] Fix | Delete
} else {
[465] Fix | Delete
var script = document.createElement('script');
[466] Fix | Delete
script.src = jsonUrl;
[467] Fix | Delete
(document.getElementsByTagName('head'))[0].appendChild(script);
[468] Fix | Delete
}
[469] Fix | Delete
}
[470] Fix | Delete
[471] Fix | Delete
window['mtUpdateCommentsCallback'] = function(json) {
[472] Fix | Delete
cache[json.cacheKey] = json.comments;
[473] Fix | Delete
_refreshComments(json.comments);
[474] Fix | Delete
isLoading = false;
[475] Fix | Delete
}
[476] Fix | Delete
[477] Fix | Delete
[478] Fix | Delete
function _refreshComments(commentData) {
[479] Fix | Delete
_setCommentContent(commentData);
[480] Fix | Delete
_setCurrentComments();
[481] Fix | Delete
window.location.hash = 'reset';
[482] Fix | Delete
window.location.hash = commentAnchor;
[483] Fix | Delete
_toggleNavLinks();
[484] Fix | Delete
}
[485] Fix | Delete
})();
[486] Fix | Delete
[487] Fix | Delete
[488] Fix | Delete
function mtRelativeDate(ts, fds) {
[489] Fix | Delete
var now = new Date();
[490] Fix | Delete
var ref = ts;
[491] Fix | Delete
var delta = Math.floor((now.getTime() - ref.getTime()) / 1000);
[492] Fix | Delete
[493] Fix | Delete
var str;
[494] Fix | Delete
if (delta < 60) {
[495] Fix | Delete
str = 'moments ago';
[496] Fix | Delete
} else if (delta <= 86400) {
[497] Fix | Delete
// less than 1 day
[498] Fix | Delete
var hours = Math.floor(delta / 3600);
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function