Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page.
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.
//Interiot's javascript edit counterif(document.title.indexOf('User:Interiot/Tool2/code.js')!=-1){mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Interiot/Tool2/code.js&action=raw&ctype=text/javascript');}//Edit and "revert to" JS//addOnloadHook(adddifflinks)functionadddifflinks(){vareditlink='<strong><span style="color:black;">[</span>edit this version<span style="color:black;">]</span></strong> ';varrvname=' <strong><span style="color:black;">[</span><span style="color:red;">restore this revision</span><span style="color:black;">]</span></strong><br>';varuser_name=document.getElementById('pt-userpage').getElementsByTagName('a')[0].innerHTML;if(location.href.indexOf('diff=')!=-1&&location.href.indexOf('&oldid=')!=-1){vardoctd=document.getElementById('bodyContent').getElementsByTagName('td');vargood_user=doctd[0].getElementsByTagName('a')[2].innerHTML;varlink=doctd[0].getElementsByTagName('a')[0].href.replace('&','&')+"&action=edit";varrvlink=doctd[0].getElementsByTagName('a')[0].href.replace('&','&')+"&action=edit&fakeaction=autorevert&byuser="+escape(user_name)+"&oldrvtouser="+escape(good_user);document.getElementById('bodyContent').getElementsByTagName('td')[0].innerHTML='<a href="'+rvlink+'">'+rvname+'</a>'+document.getElementById('bodyContent').getElementsByTagName('td')[0].innerHTML;}}//END$(IEhistory_revert)functionIEhistory_revert(){if(location.href.indexOf('&action=history&limit=8&fakeaction=IEnormalrevert&user=')!=-1){varfound=0;varuser_name=document.getElementById('pt-userpage').getElementsByTagName('a')[0].innerHTML;if(unescape(location.href.split('&byuser=')[1])!=user_name){alert('Invalid user match');return;}varvandal=unescape(location.href.split('&fakeaction=IEnormalrevert&user=')[1].split('&byuser=')[0]);varl=document.getElementsByTagName('li');if(l[0].getElementsByTagName('a')[2].innerHTML!=vandal){alert('Could not rollback. Last contributor has changed.');return;}for(i=1;i<l.length;i++){if(!l[i].getElementsByTagName('a')[3]){alert('Could not find a version of this page that is not by the user you attempted to rollback from.'+'\n'+'Most likely, the user is the only author of the page.'+'\n'+'This revert function only looks at the last 6 page edits, so you may want to look back further and use "restore".');history.go(-1);return;}if(l[i].getElementsByTagName('a')[3].innerHTML!=vandal){vargood_user=l[i].getElementsByTagName('a')[3].innerHTML;varURL=l[i].getElementsByTagName('a')[2].href+"&action=edit&fakeaction=autorevert&byuser="+escape(user_name)+"&oldrvtouser="+escape(good_user)+"&revertfromuser="+escape(vandal);location.href=URL;found=1;break;}}if(found==0){alert('Could not find a version of this page that is not by the user you attempted to rollback from.'+'\n'+'Most likely, the user is the only author of the page.'+'\n'+'This revert function only looks at the last 6 page edits, so you may want to look back further and use "restore".');history.go(-1);}}if(location.href.indexOf('&action=history&limit=8&fakeaction=IErollback&vandal=')!=-1){varfound=0;varuser_name=document.getElementById('pt-userpage').getElementsByTagName('a')[0].innerHTML;if(unescape(location.href.split('&byuser=')[1])!=user_name){alert('Invalid user match');return;}varvandal=unescape(location.href.split('&fakeaction=IErollback&vandal=')[1].split('&byuser=')[0]);varl=document.getElementsByTagName('li');if(l[0].getElementsByTagName('a')[2].innerHTML!=vandal){alert('Could not rollback vandal. Last contributor has changed.');return;}for(i=1;i<l.length;i++){if(!l[i].getElementsByTagName('a')[3]){alert('Could not find a version of this page that is not by the user you attempted to rollback from.'+'\n'+'Most likely, the user is the only author of the page.'+'\n'+'This revert function only looks at the last 6 page edits, so you may want to look back further and use "restore".');history.go(-1);return;}if(l[i].getElementsByTagName('a')[3].innerHTML!=vandal){vargood_user=l[i].getElementsByTagName('a')[3].innerHTML;varURL=l[i].getElementsByTagName('a')[2].href+"&action=edit&fakeaction=autorevertvandal&byuser="+escape(user_name)+"&oldrvtouser="+escape(good_user)+"&revertfromuser="+escape(vandal);location.href=URL;found=1;break;}}if(found==0){alert('Could not find a version of this page that is not by the user you attempted to rollback from.'+'\n'+'Most likely, the user is the only author of the page.'+'\n'+'This revert function only looks at the last 6 page edits, so you may want to look back further and use "restore".');history.go(-1);}}}//ENDfunctionautosave(){user_name=escape(document.getElementById('pt-userpage').getElementsByTagName('a')[0].innerHTML);if(location.href.indexOf("&fakeaction=autorevert&byuser="+user_name)!=-1||location.href.indexOf("&fakeaction=autorevertvandal&byuser="+user_name)!=-1){if(location.href.indexOf('&revertfromuser')==-1&&location.href.indexOf('&fakeaction=autorevertvandal')==-1){varmessage="Are you sure you want to revert to this revision?";varreturn_value=confirm(message);if(return_value!=true){history.go(-1);return;}}vargood_user=unescape(location.href.split("&oldrvtouser=")[1].split('&revertfromuser=')[0]);varID=location.href.split("&oldid=")[1].split("&action=edit")[0];form=document.getElementById('bodyContent');l=form.getElementsByTagName('input');for(i=0;i<l.length;i++){if(l[i].name=='wpMinoredit'){l[i].value='1';l[i].checked=true;}}if(location.href.indexOf('&fakeaction=autorevertvandal')!=-1){varartname=document.title.split('Editing ')[1].split(' - ')[0];varvandal=unescape(location.href.split('&revertfromuser=')[1]);document.editform.wpSummary.value+='JS: Reverted [[WP:VAND|vandalism]] by [[Special:contributions/'+vandal+'|'+vandal+']] to last version by '+good_user+'.';varform=document.getElementById('editform');window.open('http://en.wikipedia.org/w/index.php?title=User talk:'+vandal+'&action=edit'+'&action=edit&vanarticle='+artname,'targetname','location=no,toolbar=no,status=no,directories=no,scrollbars=yes,width=1024,height=768');form.submit();}elseif(location.href.indexOf('&revertfromuser=')!=-1){varvandal=unescape(location.href.split('&revertfromuser=')[1]);document.editform.wpSummary.value+='JS: Reverted edits by [[Special:contributions/'+vandal+'|'+vandal+']] to last version by '+good_user+'.';varform=document.getElementById('editform');form.submit();}else{document.editform.wpSummary.value+='JS: Revert to revision '+ID+' by [[User:'+good_user+'|'+good_user+']].';varform=document.getElementById('editform');form.submit();}}}//END//Revert options$(NArevertfunctions)functionNArevertfunctions(){adddifflinks();autosave();}// Script from [[User:Lupin/recent2.js]]mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Lupin/recent2.js'+'&action=raw&ctype=text/javascript&dontcountme=s');//This code will change ISBN links to point to the url of your choice,//instead of Special:Book_sources. ////How to use it:////First, you must copy this code to your user javascript page. This is //at User:<your username>/monobook.js . My username is Lunchboxhero so//my javascript page is User:Lunchboxhero/monobook.js . You must be logged//in to edit your javascript page.////Once you have copied the code and saved the page, you need to refresh your//browser's cache. For Mozilla/Safari/Konqueror: hold down Shift while clicking //Reload (or press Ctrl-Shift-R), IE: press Ctrl-F5, Opera: press F5.////The code should now work, as long as you are logged in.////You can change the destination url by simply modifying the quoted url that//follows document.links[i].href=////Good luck, and if you have any questions, leave me a comment on the discussion//page of User:Lunchboxhero/monobook.js .////(Every line that starts with "//" is a comment and can be discarded.)functionexternISBN(){for(vari=0;i<document.links.length;i++){varln=document.links[i].href.match(/isbn=(.*)/);if(ln){document.links[i].href='http://www.amazon.com/exec/obidos/ASIN/'+RegExp.$1;}}}$(externISBN);// This will add an [edit top] link at the top of all pages except preview pages// by User:Pile0nadessetTimeout("editTopLink()",0)// this is equivalent of onloadfunctioneditTopLink(){// if this is preview page or generated page, stopif(document.getElementById("wikiPreview")||window.location.href.indexOf("w/index.php?title=Special:")!=-1)return;// get the page titlevarpageTitle=document.title.split(" - ")[0].replace(" ","_");// create div and set innerHTML to linkvardivContainer=document.createElement("div");divContainer.innerHTML='<div class="editsection" style="float:right;margin-left:5px;margin-top:3px;">[<a href="/w/index.php?title='+pageTitle+'&action=edit§ion=0" title="'+document.title.split(" - ")[0]+'">edit top</a>]</div>';// insert divContainer into the DOM before the h1document.getElementById("content").insertBefore(divContainer,document.getElementsByTagName("h1")[0]);}