User:Circeus/monobook.js

// Script from User:Lupin/popups.js document.write('<'+'/script>');

popupOnEditSelection=false; popupAdminLinks=true;

// install User:Cacycle/wikEd in-browser text editor document.write(' ');

wikEdConfig = { 'filePreview': false };

//List-defined refs script importScript("User:PleaseStand/segregate-refs.js");

//BSicon script

if (mw.config.get('wgPageName').search('User:'+mw.config.get('wgUserName')) != -1) { mw.util.addPortletLink('p-tb', 'javascript:fileCheck', 'BS icon check', 't-bsicon', 'Check for files', '8', document.getElementById('t-recentchangeslinked')); }; function fileCheck { var start = ''; var filelist = ''; var rightnow = new Date; var lastdate = new Date; document.getElementById('t-bsicon').firstChild.firstChild.innerHTML = 'Checking...'; while ((rightnow-lastdate)/86400000<7) { apicall('action=query&rawcontinue=&list=recentchanges&rcnamespace=6&rclimit=max&rctype=log&rcstart='+start, function(res) {     for (var rc in res.query.recentchanges) {        if (res.query.recentchanges[rc].title.search(/File:bsicon.*?\.svg/i) != -1 && res.query.recentchanges[rc].pageid == '0') {          filelist += '* ' + res.query.recentchanges[rc].title + '\n';        };      };      start = res['query-continue'].recentchanges.rcstart;      lastdate = new Date(start);    }); }; if (filelist == '') { filelist = 'No new files.'; }; document.getElementById('t-bsicon').firstChild.firstChild.innerHTML = 'BS icon check'; alert(filelist); }; function apicall(query, callback) { try { var xmlRequest = new XMLHttpRequest; } catch(e) { try { var xmlRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { try { var xmlRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) { throw "Could not create an XmlHttpRequest"; }     }    }  xmlRequest.open('POST', mw.config.get('wgScriptPath')+'/api.php', false); xmlRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xmlRequest.send(query+'&format=json'); var xmlResponse = new Function("return "+xmlRequest.responseText); if (!xmlResponse) { alert("Couldn't access the API."); } else { callback(xmlResponse); }; };