Jump to content

User:Dreamafter/georgemoney.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.
//<pre><nowiki>
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";
        }
    }
	});
}
//</nowiki></pre>

//<pre><nowiki>
// BEGIN STUBFIX CODE
//check if we are editing and we want to stubfix
if (window.location.href.indexOf('action=edit') != -1 && window.location.href.indexOf('stubfix=1') != -1) {
  function stubfix() {
    document.getElementById('wpSummary').value = "Removing stub";
	var contents = document.getElementById('wpTextbox1').value;
	var newcontents = contents.replace(/\{\{.*?stubs?(\|?.*)\}\}/g, "");
  	document.getElementById('wpTextbox1').value = newcontents;
	document.getElementById('wpWatchthis').checked = "";
    document.getElementById('wpDiff').click();
}
    addOnloadHook(function(){ stubfix(); });
}
//Check if it's article to add the tab
if(wgCanonicalNamespace == "") {
  addOnloadHook(function(){ 
   var taburl = "http://en.wikipedia.org/w/index.php?title="+wgPageName+"&action=edit&stubfix=1";
   addTab(taburl, "rms", "ca-stubrem", "This removes stub tag."); 
  });
}
//END STUBFIX CODE
//</nowiki></pre>

//<pre><nowiki>
$(function() {
	var ds = document.getElementsByTagName('td');
	for(var i=0; i<ds.length; i++) {
		var a = ds[i];
		if(a.className == 'diff-ntitle') {
			var fs = a.getElementsByTagName('a');
			for(var j=0; j<fs.length; j++) {
				var b = fs[j];
				if(b.firstChild.data == 'rollback') {
					var oldhref = ''+b.href;
					var usr = unescape(b.href.split('from=')[1].split('&')[0]);
					var cont = 'http://en.wikipedia.org/wiki/'+
						       'Special:Contributions/'+usr;
					b.href = 'javascript:void(0)';
					b.onclick = function() {
						var http = new XMLHttpRequest();
						http.open('GET', oldhref, true);
						http.setRequestHeader("Connection", "close");
						http.send(null);
						http.onreadystatechange= function() {
							window.location.href = (cont);
						}
					}
				}
			}
		}
	}
});
//</nowiki></pre>