User:GeorgeMoney/UserScripts/examplejpg

From Wikipedia, the free encyclopedia

//

//------------- BEGIN EXAMPLEJPG CODE
if (window.location.href.indexOf('action=edit') != -1 && window.location.href.indexOf('remexamplejpg=1') != -1) {
  function RemoveExampleJpg() {
    document.getElementById('wpSummary').value = "Removing [[Image:Example.jpg]], '''bold text''', etc...";
        var contents = document.getElementById('wpTextbox1').value;
        var newcontents = contents.replace(/(\[http:\/\/www\.example\.com link title\]|== Headline text ==|<math>Insert formula here<\/math>|<nowiki>Insert non-formatted text here<\/nowiki>|#REDIRECT \[\[Insert text\]\]|'''Bold text'''|''Italic text''|\[\[(Media:Example\.ogg|Image:Example\.jpg|Link title)\]\])/g, "");
        document.getElementById('wpTextbox1').value = newcontents;
        document.getElementById('wpWatchthis').checked = "";
    document.getElementById('wpDiff').click();
}
    addOnloadHook(function(){ RemoveExampleJpg(); });
}

if(wgCanonicalNamespace != "Special") {
  addOnloadHook(function(){ 
   var taburl = "http://en.wikipedia.org/w/index.php?title="+wgPageName+"&action=edit&remexamplejpg=1";
   addTab(taburl, "rmv", "ca-examplejpgfix", "This is to remove Image:Example.jpg from stuff"); 
  });
}

function openmypages() {
   window.open('http://en.wikipedia.org/wiki/Image:Example.jpg?action=purge#filelinks');
   window.open('http://en.wikipedia.org/wiki/Image:Example.ogg?action=purge#filelinks');
   window.open('http://en.wikipedia.org/w/index.php?action=purge&title=Special:Whatlinkshere&target=Link_title');
   window.open('http://en.wikipedia.org/w/index.php?action=purge&title=Special:Whatlinkshere&target=Insert_text');
}

if (window.location.href.indexOf('Special:Whatlinkshere&target=Link_title') != -1 || window.location.href.indexOf('Special:Whatlinkshere&target=Insert_text') != -1 || window.location.href.indexOf('Image:Example.jpg') != -1 || window.location.href.indexOf('Image:Example.ogg') != -1 || window.location.href.indexOf('Media:Example.ogg') != -1) {
   addOnloadHook(function(){ 
    var len=document.links.length;
    for(var i=0; i<len; ++i) {
        var l=document.links[i];
        if (l.className != 'new') {
            l.href=l.href+"?action=edit&remexamplejpg=1";
        }
    }
        });
}

// ---------------------- END EXAMPLEJPG CODE
//