Jump to content

User:Voice of All/Backlog/monobook.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
////////////Backlog bar////////////
$(adminbacklog)
function adminbacklog()
{
  gml_xmlhttp = HTTPClient();
  if (!gml_xmlhttp)
    return;
  var pageurl = 'http://en.wikipedia.org/w/index.php?title=Special:Whatlinkshere&target=Template%3AAdminbacklog';
  gml_xmlhttp.open("GET", pageurl, true);
  gml_xmlhttp.onreadystatechange = adminbacklogbar;
  gml_xmlhttp.send(null);
}
//

//
function adminbacklogbar()
{
  if (gml_xmlhttp.readyState != 4)
    return;
  xml = gml_xmlhttp.responseText.split('Retrieved from "<a href=')[0].split('Retrieved from "<A href=')[0].split('The following pages link to here:')[1];
  var links = xml.split('" title="');
  var backlog = '';
for (i=0; i<links.length; i++)
  {
  var name = links[i].split('">')[0];
  if (name.search('(/|:Image|:Suspected)') == -1 && links[i].split('</li>')[0].indexOf('(transclusion)') != -1 && (name.indexOf('Wikipedia:') != -1 || name.indexOf('Category:') != -1))
  {backlog += ', <a href="/wiki/' + name + '" title="' + name + '">' + name.replace('Wikipedia:','').replace('Category:','') + '</a>';}
  }
backlog = backlog.replace(', ','');
if (backlog != '')
  {
  var message = '<div style="align: center; padding: .4em; font-size:9pt;">' + '<span style="color: darkred"><strong>Administrator backlogs:</span></strong> ' + backlog + '</div>';
  var csub=document.getElementById("top");
  var msg=document.createElement("backlog");
  msg.innerHTML = message;
  msg.className="backlogs";
  csub.insertBefore(msg, csub.firstChild)
  }
}

function HTTPClient() 
{
  var gml_http;
  if(window.XMLHttpRequest) {
    gml_http = new XMLHttpRequest();
  } else if (window.ActiveXObject) {
    try {
      gml_http = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        gml_http = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (E) {
        gml_http = false;
      }
    }
  }
  return gml_http;
}
////////////