Jump to content

User:JackSchmidt/chick.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by JackSchmidt (talk | contribs) at 05:47, 27 January 2008 (typo). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
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.
importScript('User:Lupin/popups.js');
importScript('User:Lupin/recent2.js');

importScript('User:JackSchmidt/JS Ajax.js');
importScript('User:JackSchmidt/JS_UserWatch.js');
importScript('User:JackSchmidt/JS Watchlist.js');
// importScript('User:JackSchmidt/JS CatWatch.js');
importScript('User:JackSchmidt/JS FDG.js');

function RemoveBlofeld() {
  var ols=document.getElementsByTagName("ol");
  for(var i=0;i<ols.length;i++) {
    if(ols[i].className=="special") {
      var lis=ols[i].getElementsByTagName("li");
      for(var j=0;i<lis.length;j++) {
        var as=lis[j].getElementsByTagName("a");
        for(var k=0;k<as.length;k++) {
          if(as[k].title=="Blofeld of SPECTRE") {
            lis[j].style.display="none";
          }
        }
      }
    }
  }
}

function ParseXML(xml_as_text) {
  return (new DOMParser()).parseFromString(xml_as_text, "text/xml");
}

function ParseXSLT(xslt_as_txt) {
  var xslt_as_xml = ParseXML(xslt_as_txt);
  var xsltProcessor = new XSLTProcessor();
  xsltProcessor.importStylesheet(xslt_as_xml);
  return { transform: function(xml) { try { return xsltProcessor.transformToDocument(xml); } catch(e) { alert('Failed to transform doc: ' + e ); } } }
}

var JS_XSLT,JS_XSLT2;

function GotXslt2( id, xslt ) {
  JS_XSLT2 = ParseXSLT(xslt);
  var snarflist, rcl_as_xml;
  snarflist = ParseXML(
    '<snarfs>' +
    '  <snarf page="List_of_mathematics_articles_(A-C)"/>' +
    '  <snarf page="List_of_mathematics_articles_(D-F)"/>' +
    '  <snarf page="List_of_mathematics_articles_(G-I)"/>' +
    '  <snarf page="List_of_mathematics_articles_(J-L)"/>' +
    '  <snarf page="List_of_mathematics_articles_(M-O)"/>' +
    '  <snarf page="List_of_mathematics_articles_(P-R)"/>' +
    '  <snarf page="List_of_mathematics_articles_(S-U)"/>' +
    '  <snarf page="List_of_mathematics_articles_(V-Z)"/>' +
    '</snarfs>'
  );
  rcl_as_xml = JS_XSLT.transform( snarflist );
  rcl_as_xml = JS_XSLT2.transform( rcl_as_xml );
  rcl_as_txt = (new XMLSerializer()).serializeToString(rcl_as_xml);
  rcl_as_txt = rcl_as_txt.replace(new RegExp('<transformiix:result xmlns:transformiix="http://www.mozilla.org/TransforMiix">'),'');
  rcl_as_txt = rcl_as_txt.replace(new RegExp('</transformiix:result>'),'');
  alert( rcl_as_txt );
}
function GotXslt( id, xslt ) {
  JS_XSLT = ParseXSLT(xslt);
  JS_INDEX( {title:"User:JackSchmidt/FormatRecentChanges.xslt.xml",action:"raw"}, "snagxslt", GotXslt2 );
}

addOnloadHook( function () { 
//  addPortletLink('p-cactions', "javascript:JS_CatWatch.AddThemAll()", "CatWatch", "ca-catwatch", "Add 'Watch By Category' buttons");
  JS_UserWatch.MakeButton("KathrynLybarger","kat");
  JS_UserWatch.MakeButton("Michael_Slone","mps");
  JS_UserWatch.MakeButton("JackSchmidt","jack");
  //if(wgPageName=='Special:Watchlist' || wgPageName=='User:JackSchmidt/chick.js')
  //JS_INDEX( {title:"User:JackSchmidt/ParseRecentChanges.xslt.xml",action:"raw"}, "snagxslt", GotXslt );
  if(wgPageName=='Special:Newpages') RemoveBlofeld();
});