Jump to content

User:Paranomia/rights.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Paranomia (talk | contribs) at 20:49, 13 April 2008 (create). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
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.
// scraped from VoA's code
function get_userlist_xml()
{
  document.getElementById('contentSub').innerHTML += '<br><strong>Searching for current usergroup information.' + '\n' + 'Please wait...</strong>';
  gml_xmlhttp = sajax_init_object();
  if(!gml_xmlhttp)
    return;
  editlk = wgTitle;
  var slloc = editlk.indexOf('/');
  if(slloc > 0) editlk = editlk.substring(0, slloc);
  if(wgPageName == 'Special:Contributions') editlk = document.getElementById('bodyContent').getElementsByTagName('a')[0].innerHTML; 
  var pageurl = '/w/index.php?title=Special:Listusers&group=&username=' + escape(editlk);
  gml_xmlhttp.open("GET", pageurl, true);
  gml_xmlhttp.onreadystatechange = alertget;
  gml_xmlhttp.send(null);
}
function alertget()
{
  if(gml_xmlhttp.readyState != 4)
    return;
  xml = gml_xmlhttp.responseText.replace(/<body.*"ns-4">/, '<body class="ns-4">');
  obj = new DOMParser().parseFromString(string, "text/xml");
  doc = obj.parseFromString(string, "text/xml")
  var rights = '(username invalid)';
  if(doc.getElementsByTagName('li')[0])
    {rights = doc.getElementsByTagName('li')[0].innerHTML;}
  document.getElementById('contentSub').innerHTML += '<br><span style="color:blue;"><strong>' + rights + '</strong></span>';
}