User:Pfctdayelise/monobook.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.
// [[User:Lupin/popups.js]] - please include this line 

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

popupDelay = 2.0;


/**** afd helper ****/
document.write('<script type="text/javascript"' +
  'src="http://en.wikipedia.org/w/index.php?title=User:Jnothman/afd_helper/' +
  'script.js&action=raw&ctype=text/javascript&dontcountme=s"></script>');

/* This is to keep track of who is using this extension: [[User:Jnothman/afd_helper/script.js]] */

function addlilink(tabs, url, name, id, title, key){
    var na = document.createElement('a');
    na.href = url;
    na.appendChild(document.createTextNode(name));
    var li = document.createElement('li');
    if(id) li.id = id;
    li.appendChild(na);
    tabs.appendChild(li);
    if(id)
    {
        if(key && title)
        {
            ta[id] = [key, title];
        }
        else if(key)
        {
            ta[id] = [key, ''];
        }
        else if(title)
        {
            ta[id] = ['', title];
        }
    }
    // re-render the title and accesskeys from existing code in wikibits.js
    akeytt();
    return li;
}

// 


//************************************ Changes since I last edited ****************************
//From User:JesseW/monobook.js 
function addSinceTab() {
    if (window.location.href.indexOf("&action=history&gotosince=true")!=-1) {
       do_since_I_last_edited()
    }
    else if (!/wiki\/Special:|w\/index.php?title=Special:/.test(window.location.href)) {
       var thetitle=document.title.slice(0, String(document.title).indexOf(" - "));
       var l=addLink('p-cactions', "/w/index.php?title="+thetitle+"&action=history&gotosince=true", 'since', 'pc-since', 'Changes since I last edited', '', 0);
    }
}
function do_since_I_last_edited() {
	var csub=document.getElementById("contentSub");
	var msg=document.createElement("p");
	msg.appendChild(document.createTextNode
			("Parsing history... please wait..."));
	msg.className="error";
	csub.insertBefore(msg, csub.firstChild)

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

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



// Add Unwatch to watch list
// from [[User:Matthewmayer/monobook.js]]
$( function () {
   if (window.location.href.indexOf("Special:Watchlist")!=-1) {
      //correct page, so retrieve watchlist items
      var items=document.getElementById('bodyContent').getElementsByTagName('li');
      for (var i=0;i<items.length;i++) {
            //what is the title of this page?
            pagename=items[i].getElementsByTagName('a')[0].title;
            //create 'unwatch' element
            unwatchelt=document.createElement('a');
            unwatchelt.setAttribute('href','/w/index.php?title='+pagename+'&action=unwatch');
            unwatchelt.setAttribute('title','Unwatch '+pagename);
            unwatchelt.appendChild(document.createTextNode('(unwatch)'));
            //add the 'unwatch' element
            items[i].appendChild(unwatchelt);
      }
    }
 }
);



// adds a 'logs for this page' link to the navigation bar
// if the page is a user's page, talk page or subpage, the link will go to logs for the user instead
// if the page is a special page, then no link is displayed

$(function () {

 // get page title
 var pagetitleRe=/[^:]*:\/\/en\.wikipedia\.org\/(wiki\/|w\/index\.php\?title=)([^&?#]*)/;
 ptitle = pagetitleRe.exec(decodeURI(location.href))[2].split('_').join(' ');
 
 // if this is a user, show the logs for the user rather than the page
 if( (window.location.href.indexOf("User:") != -1) || (window.location.href.indexOf("User_talk:") != -1) ) {
  regDropSubpages = /[User|User_talk]:([^&?\/]*)[\/]?.*/;
  user = regDropSubpages.exec(ptitle)[1];
  url = "http://en.wikipedia.org/w/index.php?title=Special%3ALog&user=" + user;
 } else if(window.location.href.indexOf("Special:") != -1) {
  // don't display link for special pages
  return;
 } else {
  url = "http://en.wikipedia.org/w/index.php?title=Special%3ALog&page=" + ptitle;
 }
 
 tabs = document.getElementById('p-tb').getElementsByTagName('ul')[0];
 l = addlilink(tabs, url, "Logs", "pt-logs");

});

/**** quick image delete ****/
document.write('<script type="text/javascript"' +
  'src="http://en.wikipedia.org/w/index.php?title=User:Howcheng/quickimgdelete.js' +
  '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

/* This is to keep track of who is using this extension: [[User:Howcheng/quickimgdelete.js]] */


//




 //<nowiki> Log tools
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/Sleeper/monobook.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

//</nowiki>[[Category:Wikipedians who use VoA script|{{PAGENAME}}]]


importScript('user:js/watchlist.js');