Jump to content

User:GeorgeMoney/UserScripts/examplejpg

From Wikipedia, the free encyclopedia

//

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)\]\]|#REDIRECT \[\[Insert text\]\]|<s>Strike-through text<\/s>|<sup>Superscript text<\/sup>|<sub>Subscript text<\/sub>|<small>Small Text<\/small>|<!-- Comment -->|<gallery>\s+Image:Example.jpg\|Caption1\s+Image:Example.jpg\|Caption2\s+<\/gallery>|<blockquote>\s+Block quote\s+<\/blockquote>|\{\| class="wikitable"\s+\|-\s+! header 1\s+! header 2\s+! header 3\s+\|-\s+\| row 1, cell 1\s+\| row 1, cell 2\s+\| row 1, cell 3\s+\|-\s+\| row 2, cell 1\s+\| row 2, cell 2\s+\| row 2, cell 3\s+\|\})/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, "example.jpg", "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";
        }
    }
	});
}
//