User:Toohool/monobook.js

importScript('Wikipedia:WikiProject User scripts/Scripts/qSig'); importScript('User:Ais523 non-admin/adminrights.js'); importScript('User:AzaToth/twinkle.js'); importScript('User:Anomie/ajaxpreview.js'); // Linkback: User:Anomie/ajaxpreview.js

// jncsp-start The section below (up to jncsp-end) is maintained by WikiProject_User_scripts/User-script_manager // jncsp-config editTop addUserTabs

if (location.href == "http://en.wikipedia.org/wiki/Wikipedia:WikiProject_User_scripts/User-script_manager") document.write(' ');

// From WikiProject User_scripts/Scripts/Add_LI_link, revision 73544143

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 && typeof ta !== 'undefined') {       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    if(typeof akeytt !== 'undefined') akeytt; return li; }

// From WikiProject User_scripts/Scripts/Add_tab, revision 73544604

function addTab(url, name, id, title, key){ var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; return addlilink(tabs, url, name, id, title, key) };

// From WikiProject User_scripts/Scripts/User_tabs, revision 73795341

//Please leave the following line //user:Where/usertabs addOnloadHook(function {  if (document.title.search("/") != -1 || document.title.search("- History -") != -1) { //no subpages or history      return;   }   if (document.title.indexOf("User:") == 0 || document.title.indexOf("User talk:") == 0) {      username_a = document.URL.match(/:.*:(.*)/);      username=username_a[1];      addTab("http://en.wikipedia.org/wiki/Special:Contributions/" + username, "contrib", "ca-contrib", "contribs", "");      addTab("http://en.wikipedia.org/w/index.php?title=Special%3ALog&type=move&user=" + username, "page moves", "ca-pagemoves", "page moves", "");      addTab("http://en.wikipedia.org/w/index.php?title=Special%3ALog&type=block&user=" + username, "block log", "ca-blog", "blog", "");      addTab("http://tools.wikimedia.de/~interiot/cgi-bin/count_edits?dbname=enwiki_p&user=" + username, "edit count", "ca-kate", "kate", "");   } });

// From WikiProject User_scripts/Scripts/Edit_Top, revision 87854342

// This will add an [edit] link at the top of all pages except preview pages and the main page // by User:Pile0nades

// Add an [edit] link to pages addOnloadHook(function { // if this is preview page or generated page, stop  if(document.getElementById("wikiPreview") || window.location.href.indexOf("/wiki/Special:") != -1) return;

// if this is a revision history, stop if(document.getElementById("histlegend ") || window.location.href.indexOf("/wiki/Special:") != -1) return;

// if this is a diff page, stop if(document.getElementById("difference ") || window.location.href.indexOf("/wiki/Special:") != -1) return;

// if this is a watchlist, stop if(document.getElementById("watchdetails") || window.location.href.indexOf("/wiki/Special:") != -1) return;

// if this is the main page, stop if(document.getElementById("mainpage") || window.location.href.indexOf("/wiki/Special:") != -1) return;

// get the page title var pageTitle = document.title.split(" - ")[0].replace(" ", "_");

// create div and set innerHTML to link var divContainer = document.createElement("div"); divContainer.innerHTML = ' [edit] ';

// insert divContainer into the DOM below the h1 if(window.location.href.indexOf("&action=edit") == -1) document.getElementById("content").insertBefore(divContainer, document.getElementsByTagName("h1")[0]);

if(window.location.href.indexOf("&action=edit&section=0") != -1) document.getElementById("wpSummary").value = "/* Intro */ "; });

// jncsp-end

function addPortlet(id, text) { var portlet = document.createElement("div"); portlet.id = id; portlet.className = "portlet";

var header = document.createElement("h5"); header.appendChild(document.createTextNode(text)); portlet.appendChild(header);

var pbody = document.createElement("div"); pbody.className = "pBody"; portlet.appendChild(pbody);

var list = document.createElement("ul"); pbody.appendChild(list);

var sidebar = document.getElementById("column-one"); sidebar.appendChild(portlet); }

function getTemplates(cb) { var xhr = sajax_init_object; if (!xhr) return;

var url = mw.config.get('wgScriptPath') + "/api.php?action=query&prop=templates&format=json&tllimit=50&titles=" + mw.config.get('wgPageName');

xhr.open("GET", url, true);

xhr.onreadystatechange = function { if (xhr.readyState != 4) return;

var data = eval("(" + xhr.responseText + ")"); if (!(data && data.query && data.query.pages)) return;

var titles = []; for (var id in data.query.pages) { var arr = data.query.pages[id].templates; if (arr) { for (var i = 0; i < arr.length; i++) titles.push(arr[i].title); }   }

if (cb) cb(titles); }; xhr.send(null); }

function addTemplatesPortlet { getTemplates(function(titles) {   if (titles.length == 0) return;

addPortlet("p-templates", "templates");

for (var i = 0; i < titles.length; i++) { var text = titles[i].replace(/^Template:/, ""); var path = titles[i].replace(/ /g, "_"); mw.util.addPortletLink("p-templates", mw.config.get('wgArticlePath').replace(/\$1/, path), text, null, titles[i]); } }); };

//if (mw.config.get('wgAction') == "view") // addOnloadHook(addTemplatesPortlet);