User:Nxtstep101/global.js

importScriptPage('User:Seaside98/global.js','c');

/* Talk Page Notifications - by Seaside98 */ if (wgServer+wgPageName == 'http://lmbtest.wikia.comUser:'+wgUserName+'/Talk' || !$.cookie('talkLastVisited')) { setStamp; } else { $.ajax({        contentType: "application/json; charset=utf-8",         url: "http://lmbtest.wikia.com/api.php?action=query&prop=revisions&titles=User:"+encodeURIComponent(wgUserName)+"/Talk&rvprop=user&rvend="+$.cookie('talkLastVisited')+"&format=json",         dataType: "jsonp",         cache: false    }).done(function(data) {         var userAry =[];         var userList;         var plural;         var p; for (p in data.query.pages) { break; }         if ("revisions" in data.query.pages[p]) {             for (var i=0; i<data.query.pages[p].revisions.length; i++) {                 userAry[i]=data.query.pages[p].revisions[i].user;             }             $.unique(userAry);             if (userAry.length == 1) {                 userList = userAry[0];                 plural = 'a new message'            } else {                 var userFirst = userAry.pop;                 userList = userAry.join(", ")+' and '+userFirst; plural = 'new messages' }            if (!$('#WikiaNotifications').length) { $('#WikiaBarWrapper').before(''); }            if (wgServer == 'http://lmbtest.wikia.com') { $('#WikiaNotifications').append(' You have '+plural+' from '+userList+'. '); } else { $('#WikiaNotifications').append(' You have '+plural+' on the LEGO Message Boards Wiki from '+userList+'. '); }        }     }); } function setStamp {     $.ajax({ contentType: "application/json; charset=utf-8", url: "http://lmbtest.wikia.com/api.php?action=query&prop=revisions&titles=User:"+encodeURIComponent(wgUserName)+"/Talk&rvprop=timestamp&rvlimit=1&format=json", dataType: "jsonp", cache: false }).done(function(data) { var p; for (p in data.query.pages) { break; } var curTime = (parseInt(data.query.pages[p].revisions[0].timestamp.replace(/[^0-9]/g, ""))+1).toString $.cookie('talkLastVisited',curTime,{expires: 5, path: '/', domain: '.wikia.com'}); console.log(curTime); });    $('#LmbwTalk').remove; } /*function makeStamp(d) {     var y = d.getUTCFullYear,     M = d.getUTCMonth + 1,     D = d.getUTCDate,     h = d.getUTCHours,     m = d.getUTCMinutes,     s = d.getUTCSeconds,     pad = function (x) {         x = x+'';         if (x.length == 1) {             return '0' + x;         }         return x;     };     return y + pad(M) + pad(D) + pad(h) + pad(m) + pad(s); }*/