Jump to content
Wikipedia The Free Encyclopedia

User:Nathanm mn/monobook.js

From Wikipedia, the free encyclopedia
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.
The accompanying .css page for this skin is at User:Nathanm mn/monobook.css.
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.
 //
 // From User:Lunchboxhero/monobook.js
 //

 varmagicURL="http://www.amazon.com/gp/search?ie=UTF8&field-isbn=MAGICNUMBER&tag=wikipedia08-20";
 importScript('User:Lunchboxhero/externISBN.js');


 //
 //Interiot's javascript edit counter
 //

 if(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');}

 functionKateLink()
 {
 // use the "edit this page" tab to get user name
 varuser=document.getElementById('ca-edit').getElementsByTagName('a')[0].href;
 // cut everything up to "title=" from the start and everything past "&action=edit" from the end
 user=user.substring(user.indexOf('title=')+6,user.lastIndexOf('&action=edit'));
 user=user.substring(user.indexOf(':')+1);

 varli=document.createElement('li');
 li.id='pt-kate';

 vara=document.createElement('a');
 a.appendChild(document.createTextNode('count'));// eh, the css makes the text lowercase
 a.href='http://en.wikipedia.org/wiki/User:Interiot/Tool2/code.js?username='+user;

 li.appendChild(a);

 if(!gsKateInsertBefore)// append to end (right) of list
 {
 document.getElementById('pt-logout').parentNode.appendChild(li);
 }
 else
 {
 varbefore=document.getElementById(gsKateInsertBefore);
 before.appendChild(li,before);
 }
 }

 //add this if to Main() or load function
 if(document.title.indexOf("User")!=-1)
 KateLink();//count menu option on user pages

 //
 // add navigation popups
 // [[User:Lupin/popups.js]]
 //

 mw.loader.load(
 'https://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js'
 +'&action=raw&ctype=text/javascript&dontcountme=s');

 //
 // Wikipedia:WikiProject User scripts/Scripts/Show last diff
 //

 $(function(){
 if(mw.config.get('wgCanonicalNamespace')!="Special"){
 mw.util.addPortletLink('p-cactions',mw.config.get('wgServer')+'/w/index.php?title='+mw.config.get('wgPageName')+'&diff=cur&oldid=prev','last','ca-last','Show most recent diff');
 }
 });

 //
 // Wikipedia:WikiProject User scripts/Scripts/Changes since I last edited
 //

 functionaddSinceTab(){
 if(window.location.href.indexOf("&action=history&gotosince=true")!=-1){
 do_since_I_last_edited()
 }
 elseif(mw.config.get('wgCanonicalNamespace')!="Special"){
 mw.util.addPortletLink("p-cactions","/w/index.php?title="+mw.config.get('wgPageName')+"&action=history&gotosince=true",'Changes since I last edited','',"Changes since I last edited");
 }
 }
 functiondo_since_I_last_edited(){
 varcsub=document.getElementById("contentSub");
 varmsg=document.createElement("p");
 msg.appendChild(document.createTextNode
 ("Parsing history... please wait..."));
 msg.className="error";
 csub.insertBefore(msg,csub.firstChild)

 varusername=document.getElementById("pt-userpage").textContent;
 varhists=document.getElementById("pagehistory").getElementsByTagName('li');
 for(n=0;n<hists.length;n++){
 if(hists[n].getElementsByTagName("span")[0].getElementsByTagName('a')[0].textContent==username){
 document.location=hists[n].childNodes[1].href;
 return;
 }
 }

 msg.replaceChild(document.createTextNode
 ("You have not edited this page! (recently)"),
 msg.firstChild);
 }

 $(addSinceTab);

 //
 // Wikipedia:WikiProject User scripts/Scripts/Duplicate tabs at bottom
 // depends on CSS in [[User:Nathanm mn/monobook.css]]
 //

 $(function(){
 vartabs=document.getElementById('p-cactions').cloneNode(true);
 tabs.id='mytabs';
 varlistitems=tabs.getElementsByTagName('LI');
 for(i=0;i<listitems.length;i++){
 if(listitems[i].id)listitems[i].id='mytabs-'+listitems[i].id;
 }

 content=document.getElementById("content");// Find the content div
 content.parentNode.insertBefore(tabs,content.nextSibling);// Place tab list right after content div
 });

AltStyle によって変換されたページ (->オリジナル) /