User:CBM/vector.js
Appearance
< User:CBM
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:CBM/vector.css. |
importScript('User:Mr.Z-man/rollbackSummary.js');
importScript('User:CBM/patrollinks.js');
/*
importScript('User:CBM/dates.js');
*/
importScript('User:CBM/quickpreview.js');
importScript('User:CBM/csd.js');
importScript("MediaWiki:Gadget-morebits.js");
importScript('User:CBM/ratemath.js');
importScript('User:CBM/stubtagtab.js');
importScript('User:CBM/nostubtagtab.js');
/*
var noUnreferenced = 1;
importScript('User:CBM/shortambox.js');
*/
/* Bypass ISBN page to go straight to amazon */
function externISBN() {
var magicURL = "http://www.amazon.com/s?search-alias=stripbooks&field-isbn=MAGICNUMBER";
var magicRegex = /MAGICNUMBER/ig;
if(wgPageName != "Special:Booksources"
&& wgPageName != "Wikipedia:Book_sources"){
for (var i = 0; i < document.links.length; i++) {
if( document.links[i].href.match(/Special:BookSources\/(.*)/) ) {
document.links[i].href=magicURL.replace(magicRegex, RegExp.$1);
}
}
}
}
addOnloadHook(externISBN);
addOnloadHook(function delete_dropdown() {
var list = document.getElementById('wpDeleteReasonList');
if(!list) return;
list.options[0] = new Option("Blank","");
list.selectedIndex = 0;
});
addOnloadHook(function() {
var contentSub = document.getElementById("contentSub");
if(!contentSub) return;
var elem = contentSub.nextSibling;
while(elem.nodeType != 1) elem = elem.nextSibling;
if(elem.className != 'usermessage') return;
elem.getElementsByTagName('A')[1].href = elem.getElementsByTagName('A')[1].href.replace("diff=cur","action=history")
elem.getElementsByTagName('A')[1].textContent = "history";
});
/* This will add an [edit] link for the first section
* 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") ||
document.getElementById("histlegend") ||
document.getElementById("difference") ||
document.getElementById("watchdetails") ||
document.getElementById("ca-viewsource") ||
window.location.href.indexOf("/wiki/Special:") != -1
) {
if(window.location.href.indexOf("&action=edit§ion=0") != -1) {
document.getElementById("wpSummary").value = "/* [[WP:LEAD|Lede]] */ ";
}
return;
};
// get the page title
var pageTitle = wgPageName;
// create div and set innerHTML to link
var divContainer = document.createElement("div");
divContainer.innerHTML = '<div class="editsection">[<a href="/w/index.php?title='+pageTitle+'&action=edit§ion=0" title="Edit section: '+pageTitle+'">edit lede</a>]</div>';
// 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]);
}
});
/* Add LI to a UL */
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);
// re-render the title and accesskeys from existing code in wikibits.js
return li;
}
/* Add Personal */
function addPersonal(url, name, id, title, key){
var tabs = document.getElementById('p-personal').getElementsByTagName('ul')[0];
return addlilink(tabs, url, name, id, title, key);
}
addOnloadHook(function () {
addPersonal("https://en.wikipedia.org/w/index.php?title=Special:RecentChangesLinked&days=7&limit=250&target=User%3AVeblenBot%2FList_of_mathematical_logic_articles", "Watched articles", "Tools3", "Tools4", "Tools5");
});
/* recreate Simple skin */
/*
addOnloadHook(function () {
/* move p-personal to left bar */
personal = document.getElementById("p-personal");
parent = personal.parentNode;
parent.removeChild(personal);
nav = document.getElementById("mw-panel");
nav.insertBefore(personal, nav.firstChild);
/* load CSS */
filename = 'http://en.wikipedia.org/w/index.php?action=raw&title=User:CBM/vector2.css&ctype=text/css';
file=document.createElement("link")
file.rel = "stylesheet";
file.media = "screen";
file.type = "text/css";
file.href = filename;
document.getElementsByTagName("head")[0].appendChild(file);
});
addOnloadHook(function () {
/* align right nav box (must be done after CSS loads) */
rgt = document.getElementById("right-navigation");
content= document.getElementById("content");
nav = document.getElementById("mw-panel");
// should be content.clientWidth but that doesn't work right now
width = 800 + nav.clientWidth;
left = width - rgt.clientWidth;
pos = left.toString() + 'px';
rgt.style.left = pos;
});
*/