User:Theonewhoishere/common.js
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
mw.loader.load("//simple.wikipedia.org/w/index.php?title=User:Intforce/lastactive.js&action=raw&ctype=text/javascript");
/**
* Adds a tab to link to the page with the same title on the English Wikipedia
* @author Grunny
*/
$( function () {
var enwikiUrlPath = 'http://en.wikipedia.org/wiki/';
if( mw.config.get( 'wgServer' ).indexOf( 'https://' ) === 0 ) {
enwikiUrlPath = mw.config.get( 'wgServer' ) + '/wikipedia/en/wiki/';
}
if( mw.config.get( 'skin' ) === 'vector' ) {
//Could just use p-views in the addPortletLink for vector, but it looks weird after the watch star
$( '#p-views ul li#ca-history' ).after( '<li id="ca-enwiki-link"><span><a href="' + enwikiUrlPath + encodeURIComponent( mw.config.get( 'wgPageName' ) )
+ '" title="View same page on the English Wikipedia">EnWiki</a></span></li>' );
} else {
mw.util.addPortletLink( 'p-cactions', enwikiUrlPath + encodeURIComponent( mw.config.get( 'wgPageName' ) ),
"enwiki", "ca-enwiki-link", "View same page on the English Wikipedia" );
}
} );
mw.loader.load('https://en.wikipedia.org/w/index.php?title=MediaWiki:Gadget-ProveIt.js&action=raw&ctype=text/javascript');
// [[:en:User:ProveIt GT]]
mw.loader.load('//www.wikidata.org/w/index.php?title=User:Yair_rand/checksitelinks.js&action=raw&ctype=text/javascript');
mw.loader.load(['ext.gadget.Twinkle']);
/* Link classifier */
mw.loader.load('//simple.wikipedia.org/w/index.php?title=User:Auntof6/linkclassifier.js&action=raw&ctype=text/javascript');
importStylesheet('User:Auntof6/linkclassifier.css');
mw.loader.load( "https://meta.wikimedia.org/w/index.php?title=User:Zhaofeng_Li/Reflinks.js&action=raw&ctype=text/javascript" );
/* AWB style script */
mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Joeytje50/AWB.js/load.js&action=raw&ctype=text/javascript');
/**
* SWViewer
* See [https://meta.wikimedia.org/wiki/SWViewer]
* Authored by Tulsi Bhagat [https://meta.wikimedia.org/wiki/User:Tulsi_Bhagat]
* Shortcut key [alt-shift-v]
*/
mw.loader.load('//meta.wikimedia.org/w/index.php?title=User:Tulsi_Bhagat/swviewer.js&action=raw&ctype=text/javascript');
/**
* This script lets you use a custom summary with the rollback feature
* by adding a "sum" link wherever a rollback link appears. When you
* click "sum" you are prompted for a custom summary, and the script
* adds an additional summary parameter to the rollback URL submitting it.
*
* For usage and extra options, see [[:en:User:MC10/rollbackSummary]].
* Borrowed from [[:en:User:Gracenotes/rollback.js]]
*
* Linkback: [[User:MC10/rollbackSummary.js]]
*/
(function ($, undefined) { // Wrap with jQuery
function addSumLink() {
var rbnode = [], diffnode, index = {}, gebcn = function(a, b, c) { return a ? a.getElementsByClassName(c) : [] };
if (typeof window.rollbackLinksDisable === 'object' && $.isArray(window.rollbackLinksDisable)) {
for (var i = 0; i < window.rollbackLinksDisable.length; i++)
index[window.rollbackLinksDisable[i]] = true;
}
if (!('user' in index) && mw.config.get("wgCanonicalSpecialPageName") === "Contributions" ||
!('recent' in index) && mw.config.get("wgCanonicalSpecialPageName") === "Recentchanges" ||
!('watchlist' in index) && mw.config.get("wgCanonicalSpecialPageName") === "Watchlist") {
rbnode = gebcn(document.getElementById("bodyContent"), "span", "mw-rollback-link");
} else if (!('history' in index) && mw.config.get("wgAction") === "history") {
rbnode = gebcn(document.getElementById("pagehistory"), "span", "mw-rollback-link");
} else if (!('diff' in index) && (diffnode = document.getElementById("mw-diff-ntitle2"))) {
rbnode = gebcn(diffnode, "span", "mw-rollback-link");
}
for (var i = 0, len = rbnode.length; i < len; i++)
addRollbackSummaryLink(rbnode[i]);
};
function confirmRollback() {
var url = this.href;
var user = url.match(/[?&]from=([^&]*)/);
if (!user)
return;
user = decodeURIComponent(user[1].replace(/\+/g, " "));
var summary = prompt("Enter a summary to use for rollback.\n\nLeave blank to use the default. $user will be replaced with \"" + user + "\".",
window.rollbackSummaryDefault);
if (summary === undefined || summary === null) {
return false;
} else if (summary === "") {
return true;
}
this.href += "&summary=" + encodeURIComponent(summary.replace(/\$user/g, user));
return true;
};
function addRollbackSummaryLink(rbnode) {
var rblink = rbnode.getElementsByTagName("a")[0];
var alink = rblink.cloneNode(true);
alink.className = ""; // don't confuse other scripts
alink.firstChild.nodeValue = "sum";
alink.onclick = confirmRollback;
rbnode.insertBefore(alink, rblink.nextSibling);
rbnode.insertBefore(document.createTextNode(" | "), alink);
};
if (window.rollbackLinksDisable === undefined)
window.rollbackLinksDisable = [];
if (window.rollbackSummaryDefault === undefined)
window.rollbackSummaryDefault = null; // = ""
$(addSumLink);
}(jQuery)) // End wrap with jQuery
// [[Category:Wikipedia scripts]]
//////////STATUS CHANGER
// Creator: Misza13
// Credits: Voyagerfan5761 for some minor improvements
// Modified by Xenocidic to simply use /Status as a one word indicator,
// Modified by Kraftlos to include Sleep status
// compatible with {{Statustop}} for display
$(function (){
//Check if the config is defined
if (typeof(statusChangerConfig) == 'undefined') {
statusChangerConfig = {}
}
if (typeof(statusChangerConfig.statusList) == 'undefined') {
statusChangerConfig.statusList = [ 'online', 'busy', 'around', 'offline', 'sleep' ];
}
if (typeof(statusChangerConfig.statusPage) == 'undefined') {
statusChangerConfig.statusPage = 'User:' + wgUserName + '/Status';
}
//Add the links
for (var i=0; i<statusChangerConfig.statusList.length; i++) {
var stat = statusChangerConfig.statusList[i];
var message = (stat === "sleep") ? link = "asleep" : link = stat;
mw.util.addPortletLink(
"p-personal", //target tab - personal links
mw.config.get('wgServer') + mw.config.get('wgScript') + "?title=" + statusChangerConfig.statusPage + "&action=edit&newstatus=" + stat, //link URL
stat, //link text
"pt-status-" + stat, //id of new button
"I'm " + message + "!", //hover text
"", //???
document.getElementById("pt-logout")); //add before logout button
}
if (location.href.indexOf("&action=edit&newstatus=") == -1) return; //Are we here to auto-edit the status?
//Get new status
statusRegExp = /&action=edit&newstatus=(.*)/;
var status = statusRegExp.exec(location.href)[1];
//Modify the form
document.getElementById('wpTextbox1').value = status;
if (status == "sleep")
{ status = "sleeping"; }
document.getElementById('wpSummary').value = wgUserName + " is now " + status +".";
document.getElementById('wpMinoredit').checked = true;
//Submit it!
document.getElementById('editform').submit();
});
//[[Category:Wikipedia scripts|statusChanger]]
//Check if the config is defined
if (typeof(statusChangerConfig) == 'undefined') {
statusChangerConfig = {}
}
if (typeof(statusChangerConfig.statusList) == 'undefined') {
statusChangerConfig.statusList = [ 'online', 'busy', 'around', 'offline', 'sleep' ];
}
if (typeof(statusChangerConfig.statusPage) == 'undefined') {
statusChangerConfig.statusPage = 'User:' + wgUserName + '/Status';
}
//Add the links
for (var i=0; i<statusChangerConfig.statusList.length; i++) {
var stat = statusChangerConfig.statusList[i];
var message = (stat === "sleep") ? link = "asleep" : link = stat;
mw.util.addPortletLink(
"p-personal", //target tab - personal links
wgServer + wgScript + "?title=" + statusChangerConfig.statusPage + "&action=edit&newstatus=" + stat, //link URL
stat, //link text
"pt-status-" + stat, //id of new button
"I'm " + message + "!", //hover text
"", //???
document.getElementById("pt-logout")); //add before logout button
}
if (location.href.indexOf("&action=edit&newstatus=") == -1) return; //Are we here to auto-edit the status?
//Get new status
statusRegExp = /&action=edit&newstatus=(.*)/;
var status = statusRegExp.exec(location.href)[1];
//Modify the form
document.getElementById('wpTextbox1').value = status;
if (status == "sleep")
{ status = "sleeping"; }
document.getElementById('wpSummary').value = wgUserName + " is now " + status +".";
document.getElementById('wpMinoredit').checked = true;
//Submit it!
document.getElementById('editform').submit();
// FastButtons, based on the original work of Racso from Spanish Wikipedia,
// translated by [[User:Macy|Macy]]
// edited by [[User:MC10|MC10]]
// [[User:MC10/FastButtons.js]]
// <nowiki>
var pagina = '',
mot = '',
txt = '',
botones = '',
usuario = '',
temporal = '',
sep = "|",
biblio = false,
ufb = '. ([[User:MC10/FastButtons.js|FBs]])',
dire = "//en.wikipedia.org/w/index.php?title=",
fin_otro = "edit&borrar=otro-",
fin_aviso = "edit&aviso=",
textopruebas = "Warn user:\n—Vandalism:\n1: Level 1\n2: Level 2\n3: Level 3\n4: Level 4\n4im: Level 4im\n \nAdditionally, you may add the article name\nfollowed by a |",
FBpersonal = false, // Personal configuration
FBpruebas = true, // Test edits
FBblanco = true, // Vandalism
FBne = true, // Nonsense pages
FBinfra = true, // Attack pages
FBautopromo = true, // Promotional
FBbio = true, // A7
FBband = true, // A7
FBweb = true, // A7
FBinc = true, // Nonsense pages
FBotro = true, // Custom CSD
FBcommons = true, // Now Commons
FBimfu = true, // No fair use rationale
FBwikify = true, // Wikify
FBunref = true, // Unreferenced
FBcleanup = true, // Cleanup
FBnpov = true, // POV
FBglobal = true, // Globalize
FBcedit = true, // Copyedit
FBborrar = false, // Speedy delete (test)
FBaviso = true, // Warn user
FBwelcome = false; // Welcome user
// All data is here:
for (i = 0; i < mw.config.get("wgUserGroups").length; i++) {
if (mw.config.get("wgUserGroups")[i] === "sysop") biblio = true;
}
for (i = 0; i < mw.config.get("wgUserGroups").length; i++) {
if (mw.config.get("wgUserGroups")[i] === "autoconfirmed") autoconfirmed = true;
}
pagina = encodeURI(mw.config.get("wgPageName"));
if (pagina.match("&")) {
pagina = pagina.replace("&", "%26");
}
dire = dire + pagina + "&action=";
usuario = pagina.split(":")[1];
if (pagina === "Special:Contributions") {
usuario = location.href.substring(location.href.indexOf('Contributions/') + 14, location.href.length);
}
// Start
if (biblio) {
tmp = '';
if (FBborrar) {
tmp += '[<a href=' + dire + 'delete&rapido=si>speedy delete!</a>] ';
}
if (tmp !== '') {
botones = botones + 'Sysop buttons: ' + tmp + '<br>';
}
}
if (!biblio && autoconfirmed) {
tmp = '';
if (mw.config.get("wgNamespaceNumber") === 0) {
if (FBpruebas) {
tmp += '[<a href=' + dire + 'edit&borrar=blanco>test</a>] ';
}
if (FBblanco) {
tmp += '[<a href=' + dire + 'edit&borrar=pruebas>vandalism</a>] ';
}
if (FBne) {
tmp += '[<a href=' + dire + 'edit&borrar=NE>nonsense</a>] ';
}
if (FBinfra) {
tmp += '[<a href=' + dire + 'edit&borrar=infra>attack</a>] ';
}
if (FBautopromo) {
tmp += '[<a href=' + dire + 'edit&borrar=autopromo>promotional</a>] ';
}
if (FBotro) {
tmp += '[<a onclick="mot=prompt(/Enter reason:/);location.href=dire + fin_otro +encodeURI(mot) ;"> other </a>] ';
}
if (FBbio) {
tmp += '/ A7: <b>[</b><a href=' + dire + 'edit&borrar=bio>person</a> ';
}
if (FBband) {
tmp += '| <a href=' + dire + 'edit&borrar=band>band</a> ';
}
if (FBweb) {
tmp += '| <a href=' + dire + 'edit&borrar=web>web</a> ';
}
if (FBinc) {
tmp += '| <a href=' + dire + 'edit&borrar=inc>inc</a><b>]</b> ';
}
} else if (mw.config.get("wgNamespaceNumber") === 6) {
if (FBimfu) {
tmp += '[<a href=' + dire + 'edit&borrar=norat>no fair use</a>] ';
}
if (FBcommons) {
tmp += '[<a href=' + dire + 'edit&borrar=commons>commons</a>] ';
}
}
if (tmp !== '') {
botones = botones + 'CSD: ' + tmp + '<br>';
}
}
tmp = '';
if (mw.config.get("wgNamespaceNumber") === 0 || mw.config.get("wgNamespaceNumber") === 1) {
if (FBwikify) {
tmp += '[<a href=' + dire + 'edit&plant=wikify>wikify</a>] ';
}
if (FBunref) {
tmp += '[<a href=' + dire + 'edit&plant=unref>unreferenced</a>] ';
}
if (FBcleanup) {
tmp += '[<a href=' + dire + 'edit&plant=cleanup>cleanup</a>] ';
}
if (FBnpov) {
tmp += '[<a href=' + dire + 'edit&plant=npov>POV</a>] ';
}
if (FBglobal) {
tmp += '[<a href=' + dire + 'edit&plant=global>globalize</a>] ';
}
if (FBcedit) {
tmp += '[<a href=' + dire + 'edit&plant=cedit>copyedit</a>] ';
}
}
if (tmp !== '') {
botones = botones + 'Templates: ' + tmp + '<br>';
}
tmp = '';
if (mw.config.get("wgNamespaceNumber") === 3) {
if (FBaviso) {
tmp += '[<a onclick="mot=prompt(textopruebas);location.href=dire + fin_aviso +encodeURI(mot) ;">warn user</a>] ';
}
if (FBwelcome) {
tmp += '[<a href="' + dire + 'edit&plant=welcome">welcome</a>] ';
}
}
if (tmp !== '') {
botones = botones + 'Special: ' + tmp + '<br>';
}
/* Botones funcionando */
$(function () {
if (document.getElementById('contentSub').innerHTML != '') {
document.getElementById('contentSub').innerHTML += '<br>';
}
document.getElementById('contentSub').innerHTML = document.getElementById('contentSub').innerHTML + botones;
if (location.href.match("borrar=blanco")) {
txt = document.getElementById("wpTextbox1").value;
if (!(txt.match("\{db"))) {
txt = '\{\{db-test}}\n' + txt;
document.getElementById("wpTextbox1").value = txt;
document.editform.wpSummary.value = 'Requesting speedy deletion G2' + ufb;
document.editform.submit();
}
} else if (location.href.match("borrar=pruebas")) {
txt = document.getElementById("wpTextbox1").value;
if (!(txt.match("\{db")) && (txt !== "")) {
txt = '\{\{db-vandalism}}\n' + txt;
document.getElementById("wpTextbox1").value = txt;
document.editform.wpSummary.value = 'Requesting speedy deletion G3' + ufb;
document.editform.submit();
}
} else if (location.href.match("borrar=NE")) {
txt = document.getElementById("wpTextbox1").value
if (!(txt.match("\{db")) && (txt !== "")) {
txt = '\{\{db-nonsense}}\n' + txt
document.getElementById("wpTextbox1").value = txt;
document.editform.wpSummary.value = 'Requesting speedy deletion G1' + ufb;
document.editform.submit();
}
} else if (location.href.match("borrar=infra")) {
txt = document.getElementById("wpTextbox1").value
if (!(txt.match("\{db")) && (txt !== "")) {
txt = '\{\{db-attack}}\n' + txt
document.getElementById("wpTextbox1").value = txt;
document.editform.wpSummary.value = 'Requesting speedy deletion G10' + ufb;
document.editform.submit();
}
} else if (location.href.match("borrar=autopromo")) {
txt = document.getElementById("wpTextbox1").value
if (!(txt.match("\{db")) && (txt !== "")) {
txt = '\{\{db-g11}}\n' + txt
document.getElementById("wpTextbox1").value = txt;
document.editform.wpSummary.value = 'Requesting speedy deletion G11' + ufb;
document.editform.submit();
}
} else if (location.href.match("borrar=otro")) {
txt = document.getElementById("wpTextbox1").value
if (!(txt.match("\{db")) && (txt !== "")) {
mot = location.href.substring(location.href.indexOf('otro-') + 5, location.href.length)
if (mot != null) {
txt = '\{\{delete|' + decodeURI(mot) + '}}\n' + txt;
document.getElementById("wpTextbox1").value = txt;
document.editform.wpSummary.value = 'Requesting speedy deletion' + ufb;
document.editform.submit();
}
}
} else if (location.href.match("borrar=norat")) {
txt = document.getElementById("wpTextbox1").value
if (!(txt.match("\{db")) && (txt !== "")) {
txt = '\{\{db-i8}}\n' + txt
document.getElementById("wpTextbox1").value = txt;
document.editform.wpSummary.value = 'Requesting speedy deletion I8' + ufb;
document.editform.submit();
}
} else if (location.href.match("borrar=commons")) {
txt = document.getElementById("wpTextbox1").value
if (!(txt.match("\{db")) && (txt !== "")) {
txt = '\{\{db-i6}}\n' + txt
document.getElementById("wpTextbox1").value = txt;
document.editform.wpSummary.value = 'Requesting speedy deletion I6' + ufb;
document.editform.submit();
}
} else if (location.href.match("borrar=bio")) {
txt = document.getElementById("wpTextbox1").value
if (!(txt.match("\{db")) && (txt !== "")) {
txt = '\{\{db-person}}\n' + txt
document.getElementById("wpTextbox1").value = txt;
document.editform.wpSummary.value = 'Requesting speedy deletion A7' + ufb;
document.editform.submit();
}
} else if (location.href.match("borrar=band")) {
txt = document.getElementById("wpTextbox1").value
if (!(txt.match("\{db")) && (txt !== "")) {
txt = '\{\{db-band}}\n' + txt
document.getElementById("wpTextbox1").value = txt;
document.editform.wpSummary.value = 'Requesting speedy deletion A7' + ufb;
document.editform.submit();
}
} else if (location.href.match("borrar=web")) {
txt = document.getElementById("wpTextbox1").value
if (!(txt.match("\{db")) && (txt !== "")) {
txt = '\{\{db-web}}\n' + txt
document.getElementById("wpTextbox1").value = txt;
document.editform.wpSummary.value = 'Requesting speedy deletion A7' + ufb;
document.editform.submit();
}
} else if (location.href.match("borrar=inc")) {
txt = document.getElementById("wpTextbox1").value
if (!(txt.match("{db")) && (txt !== "")) {
txt = '\{\{db-inc}}\n' + txt
document.getElementById("wpTextbox1").value = txt;
document.editform.wpSummary.value = 'Requesting speedy deletion A7' + ufb;
document.editform.submit();
}
} else if (location.href.match("plant=wikify")) {
txt = document.getElementById("wpTextbox1").value
if (!(txt.match("\{wikify")) && (txt !== "")) {
txt = '\{\{wikify|date=October 2011}}\n' + txt;
document.getElementById("wpTextbox1").value = txt;
document.editform.wpSummary.value = 'Tagged with \{\{wikify}}' + ufb;
document.editform.submit();
}
} else if (location.href.match("plant=unref")) {
txt = document.getElementById("wpTextbox1").value
if (!(txt.match("\{unreferenced")) && (txt !== "")) {
txt = '\{\{unreferenced|date=October 2011}}\n' + txt;
document.getElementById("wpTextbox1").value = txt;
document.editform.wpSummary.value = 'Tagged with \{\{unreferenced}}' + ufb;
document.editform.submit();
}
} else if (location.href.match("plant=cleanup")) {
txt = document.getElementById("wpTextbox1").value
if (!(txt.match("{cleanup")) && (txt !== "")) {
txt = '\{\{cleanup|date=October 2011}}\n' + txt;
document.getElementById("wpTextbox1").value = txt;
document.editform.wpSummary.value = 'Tagged with \{\{cleanup}}' + ufb;
document.editform.wpSave.click();
}
} else if (location.href.match("plant=npov")) {
txt = document.getElementById("wpTextbox1").value
if (!(txt.match("\{POV")) && (txt !== "")) {
txt = '\{\{POV|date=October 2011}}\n' + txt;
document.getElementById("wpTextbox1").value = txt;
document.editform.wpSummary.value = 'Tagged with \{\{POV}}' + ufb;
document.editform.wpSave.click();
}
} else if (location.href.match("plant=global")) {
txt = document.getElementById("wpTextbox1").value
if (!(txt.match("\{globalize")) && (txt !== "")) {
txt = '\{\{globalize|date=October 2011}}\n' + txt;
document.getElementById("wpTextbox1").value = txt;
document.editform.wpSummary.value = 'Tagged with \{\{globalize}}' + ufb;
document.editform.wpSave.click();
}
} else if (location.href.match("plant=cedit")) {
txt = document.getElementById("wpTextbox1").value
if (!(txt.match("\{copyedit")) && (txt !== "")) {
txt = '\{\{copyedit|date=October 2011}}\n' + txt;
document.getElementById("wpTextbox1").value = txt;
document.editform.wpSummary.value = 'Tagged with \{\{copyedit}}' + ufb;
document.editform.submit();
}
} else if (location.href.match("plant=welcome")) {
txt = document.getElementById("wpTextbox1").value
if (!(txt.match("\{welcome"))) {
txt = '\{\{subst:User:MC10/Welcome}}\n' + txt;
document.getElementById("wpTextbox1").value = txt;
document.editform.wpSummary.value = 'Welcoming user' + ufb;
document.editform.submit();
}
} else if (location.href.match("rapido=si")) {
document.getElementById("wpConfirmB").click();
} else if (location.href.match("aviso=")) {
txt = document.getElementById("wpCombobox1").value;
mot = location.href.substring(location.href.indexOf('aviso=') + 6, location.href.length);
txt = txt + '\n\n\{\{subst:uw-vandalism' + decodeURI(mot) + '}} --\~\~\~\~';
document.getElementById("wpTextbox1").value = txt;
document.editform.wpSummary.value = 'Warning user' + ufb;
document.editform.submit();
}
});
// Special FastButtons start here
// Edit count FastButton
$(function () {
if (mw.config.get("wgTitle").indexOf("/") !== -1 || document.title.indexOf("- History -") !== -1) // no subpages or history
return;
if (mw.config.get("wgCanonicalNamespace") === "User" || mw.config.get("wgCanonicalNamespace") === "User_talk") {
var username = encodeURIComponent(mw.config.get("wgTitle"));
var checkurl = "//toolserver.org/~soxred93/count/index.php?name=" + username + "&lang=simple&wiki=wikipedia";
mw.util.addPortletLink("p-cactions", checkurl, "edc", "ca-contrib", "View edit count by this user");
}
});
// Special:PrefixIndex FastButton
$(function () {
if (mw.config.get("wgTitle").indexOf("/") !== -1 || document.title.indexOf("- History -") !== -1) // no subpages or history
return;
if (mw.config.get("wgCanonicalNamespace") === "User" || mw.config.get("wgCanonicalNamespace") === "User_talk") {
var username = encodeURIComponent(mw.config.get("wgTitle"));
var checkurl = mw.config.get("wgServer") + "/w/index.php?title=Special:PrefixIndex&prefix=" + username + "&namespace=2";
mw.util.addPortletLink("p-cactions", checkurl, "all pages", "ca-contrib", "List of pages by this user");
}
});
// </nowiki>
// [[Category:Wikipedia scripts]]
// Revised from [[User:Ais523/votesymbols.js]]
// Code for adding icons to !votes in AfDs, RfAs, etc...
// Doesn't affect the page, just shows the icons when this code is installed.
// Please see [[:Image:Votesymbols.js-enhanced_SfD.png]] and
// [[c:Category:Norro style 1 icons]] for copyright info on the images that are added.
function lowerNoPunct(s)
{
return s.toLowerCase().split('.').join('').split(',').join('').split(':').join('').split(';').join('').split('+').join('');
}
function mergeWords(a, b, j, k) {
try {
if(lowerNoPunct(j[k])==a&&lowerNoPunct(j[k+1])==b) {
j.splice(k, 2, a+' '+b);
}
return j;
} catch(e) {
return j;
}
}
$(function() {
if(mw.config.get('wgNamespaceNumber')===0) return; //avoid article space, generally speaking
if(mw.config.get('wgNamespaceNumber')===6) return; //file
if(mw.config.get('wgNamespaceNumber')===8) return; //mediawiki
if(mw.config.get('wgNamespaceNumber')===10) return; //template
if(mw.config.get('wgNamespaceNumber')===12) return; //category
if(mw.config.get('wgNamespaceNumber')===14) return; //help
if(mw.config.get('wgNamespaceNumber')===118) return; //draft
if(mw.config.get('wgNamespaceNumber')===100) return; //portal
var vs=
"//upload.wikimedia.org/wikipedia/commons/thumb/9/94/Symbol_support_vote.svg/60px-Symbol_support_vote.svg.png#"+
"//upload.wikimedia.org/wikipedia/commons/thumb/d/d0/Symbol_keep_vote.svg/60px-Symbol_keep_vote.svg.png#"+
"//upload.wikimedia.org/wikipedia/commons/thumb/7/7f/Symbol_oppose_vote.svg/60px-Symbol_oppose_vote.svg.png#"+
"//upload.wikimedia.org/wikipedia/commons/thumb/8/89/Symbol_delete_vote.svg/60px-Symbol_delete_vote.svg.png#"+
"//upload.wikimedia.org/wikipedia/commons/thumb/8/89/Symbol_neutral_vote.svg/60px-Symbol_neutral_vote.svg.png#"+
"//upload.wikimedia.org/wikipedia/commons/thumb/b/b0/Symbol_merge_vote.svg/60px-Symbol_merge_vote.svg.png#"+
"//upload.wikimedia.org/wikipedia/commons/thumb/5/50/Symbol_move_vote.svg/60px-Symbol_move_vote.svg.png#"+
"//upload.wikimedia.org/wikipedia/commons/thumb/0/0c/Symbol_redirect_vote.svg/60px-Symbol_redirect_vote.svg.png#"+
"//upload.wikimedia.org/wikipedia/commons/thumb/b/ba/Symbol_opinion_vote.svg/60px-Symbol_opinion_vote.svg.png#"+
"//upload.wikimedia.org/wikipedia/commons/thumb/e/e0/Symbol_comment_vote.svg/60px-Symbol_comment_vote.svg.png#"+
"//upload.wikimedia.org/wikipedia/commons/thumb/f/f6/Symbol_unsupport_vote.svg/60px-Symbol_unsupport_vote.svg.png#"+
"//upload.wikimedia.org/wikipedia/commons/thumb/e/e0/Symbol_question.svg/60px-Symbol_question.svg.png#"+
"//upload.wikimedia.org/wikipedia/commons/thumb/2/2a/Symbol_dab_class.svg/60px-Symbol_dab_class.svg.png#"+
"//upload.wikimedia.org/wikipedia/commons/thumb/5/54/Symbol_wait.svg/60px-Symbol_wait.svg.png#"+
"//upload.wikimedia.org/wikipedia/commons/thumb/0/0a/Symbol_rename_vote.svg/60px-Symbol_rename_vote.svg.png#"+
"//upload.wikimedia.org/wikipedia/commons/thumb/c/c5/Symbol_support2_vote.svg/60px-Symbol_support2_vote.svg.png#"+
"//upload.wikimedia.org/wikipedia/commons/thumb/3/3b/Symbol_no_support_vote.svg/60px-Symbol_no_support_vote.svg.png#"+
"//upload.wikimedia.org/wikipedia/commons/thumb/0/0d/Symbol_split_vote.svg/60px-Symbol_split_vote.svg.png#"+
"//upload.wikimedia.org/wikipedia/commons/thumb/6/61/Symbol_abstain_vote.svg/60px-Symbol_abstain_vote.svg.png#"+
"//upload.wikimedia.org/wikipedia/commons/thumb/0/09/Symbol_draft_class.svg/60px-Symbol_draft_class.svg.png#"+
"//upload.wikimedia.org/wikipedia/commons/thumb/1/13/Symbol_user_class.svg/60px-Symbol_user_class.svg.png#"+
"//upload.wikimedia.org/wikipedia/commons/thumb/d/db/Symbol_list_class.svg/60px-Symbol_list_class.svg.png#"+
"//upload.wikimedia.org/wikipedia/commons/thumb/d/d2/Symbol_reply.svg/60px-Symbol_reply.svg.png#"+
"//upload.wikimedia.org/wikipedia/commons/thumb/6/66/Symbol_create_protect_vote.svg/60px-Symbol_create_protect_vote.svg.png#"+
"//upload.wikimedia.org/wikipedia/commons/thumb/8/85/Symbol_unrelated.svg/60px-Symbol_unrelated.svg.png#"+
"//upload.wikimedia.org/wikipedia/commons/thumb/8/8c/Symbol_information_vote.svg/60px-Symbol_information_vote.svg.png#"+
"//upload.wikimedia.org/wikipedia/commons/thumb/1/18/Symbol_version_future.svg/60px-Symbol_version_future.svg.png#"+
"//upload.wikimedia.org/wikipedia/commons/thumb/d/d3/Bouncing_Snowball.png/60px-Bouncing_Snowball.png#"+
"//upload.wikimedia.org/wikipedia/commons/thumb/1/1b/Symbol_plain_white.svg/60px-Symbol_plain_white.svg.png#"+
"//upload.wikimedia.org/wikipedia/commons/thumb/6/6d/Symbol_speedy_delete_vote.svg/60px-Symbol_speedy_delete_vote.svg.png#"+
"//upload.wikimedia.org/wikipedia/commons/thumb/b/bc/Symbol_speedy_keep_vote.svg/60px-Symbol_speedy_keep_vote.svg.png#"+
"//upload.wikimedia.org/wikipedia/commons/thumb/2/22/Symbol_speedy_redirect_vote.svg/60px-Symbol_speedy_redirect_vote.svg.png#"+
"//upload.wikimedia.org/wikipedia/commons/thumb/8/84/Symbol_strong_support_vote.svg/60px-Symbol_strong_support_vote.svg.png#"+
"//upload.wikimedia.org/wikipedia/commons/thumb/5/5e/Symbol_oppose_vote_oversat.svg/60px-Symbol_oppose_vote_oversat.svg.png#"+
"//upload.wikimedia.org/wikipedia/commons/thumb/8/8c/GA_candidate.svg/60px-GA_candidate.svg.png#"+
"//upload.wikimedia.org/wikipedia/commons/thumb/f/f5/BA_candidate.svg/60px-BA_candidate.svg.png#"+
"//upload.wikimedia.org/wikipedia/commons/thumb/b/b2/Symbol_conditional_support.svg/60px-Symbol_conditional_support.svg.png#"+
"//upload.wikimedia.org/wikipedia/commons/thumb/e/e3/Symbol_wait_blue.svg/60px-Symbol_wait_blue.svg.png#"+
"//upload.wikimedia.org/wikipedia/commons/thumb/8/83/Symbol_template_class_pink.svg/60px-Symbol_template_class_pink.svg.png#"+
"//upload.wikimedia.org/wikipedia/commons/thumb/c/c5/Symbol_mark_historical_vote.svg/60px-Symbol_mark_historical_vote.svg.png#"+
"";
var vt=vs.split("#");
var la=[];
la['support']=0; la['endorse']=0; la['accept']=0; la['good block']=0;
la['keep']=1; la['allow']=1; la['permit']=1;
la['oppose']=2; la['overturn']=2; la['object']=2; la['disallow']=2; la['decline']=2; la['bad block']=2;
la['delete']=3; la['remove']=3; la['pull']=3;
la['neutral']=4;
la['merge']=5; la['upmerge']=5;
la['move']=6; la['transwiki']=6; la['convert']=6; la['transwikify']=6;
la['redirect']=7; la['retarget']=7; la['repost']=7;
la['relist']=8; la['subst']=8; la['change']=8; la['recuse']=8; la['refine']=8;
// Note that icon 8 on the list is often used for debate-specific !votes
la['comment']=9; la['note']=9; la['comments']=9;
la['delist']=10; la['demote']=10; la['unsupport']=10;
la['question']=11; la['query']=11;
la['disambiguate']=12; la['dab']=12; la['dabify']=12; la['set index']=12; la['sia']=12;
la['wait']=13; la['hold']=13;
la['rename']=14;
la['undelete']=15; la['restore']=15;
la['close']=16;
la['split']=17;
la['abstain']=18; la['unnecessary']=18; la['moot']=18; la['mu']=18;
la['draftify']=19; la['incubate']=19;
la['userfy']=20;
la['listify']=21;
la['reply']=22;
la['salt']=23;
la['withdraw']=24; la['withdrawn']=24;
la['information']=25; la['info']=25;
la['update']=26; la['answer']=26;
la['snow']=27; la['snowball']=27;
la['blank']=28;la['keep blanked']=28;
la['speedy']=29; la['speedy delete']=29;
la['speedy keep']=30;
la['speedy redirect']=31;
la['strong support']=32; la['strongly support']=32;
la['strong oppose']=33; la['strongly oppose']=33;
la['weak support']=34;
la['weak oppose']=35;
la['partial support']=36; la['conditional support']=36;
la['ongoing']=37;
la['tag']=38; la['retag']=38;
la['historical']=39;
var btc=document.body.getElementsByTagName("B");
i=btc.length;
while(i--)
{
var j,k;
j=btc[i].textContent
j=j.split("<").join(" ").split(">").join(" ").split("/").join(" ").split(" ");
k=0;
var x="";
while(k<j.length)
{
if(lowerNoPunct(j[k])=="don't"||lowerNoPunct(j[k])=='not'
||lowerNoPunct(j[k])=='no'||lowerNoPunct(j[k])=='without') break;
mergeWords('speedy','delete',j,k);
mergeWords('speedy','keep',j,k);
mergeWords('speedy','redirect',j,k);
mergeWords('strong','support',j,k);
mergeWords('strongly','support',j,k);
mergeWords('weak','support',j,k);
mergeWords('strong','oppose',j,k);
mergeWords('strongly','oppose',j,k);
mergeWords('weak','oppose',j,k);
mergeWords('partial','support',j,k);
mergeWords('conditional','support',j,k);
mergeWords('good','block',j,k);
mergeWords('bad','block',j,k);
mergeWords('set','index',j,k);
mergeWords('keep','blanked',j,k);
var l=la[lowerNoPunct(j[k])];
if(l!==undefined)
{
x+='<img src="'+vt[l]+'" alt="" style="height:15px" /> '
}
k++;
}
if(x!=="") btc[i].innerHTML=x+btc[i].innerHTML;
}
});
mw.loader.load('//simple.wikipedia.org/w/index.php?title=User:Kangaroopower/MRollback.js&action=raw&ctype=text/javascript');
//[[Category:Wikipedia scripts]]
// A few useful tabs
// Author: MC10
// Linkback: [[User:MC10/UsefulTabs.js]]
(function ($, undefined) { // Wrap with jQuery
// Purge
/*
$(function () {
if (mw.config.get("wgNamespaceNumber") === -1) // No special pages
return;
var url = mw.config.get("wgServer") + mw.config.get("wgScript") + "?title=" + mw.config.get("wgPageName") + "&action=purge";
mw.util.addPortletLink('p-cactions', url, 'Purge', 'ca-purge', 'Purge server cache for this page', '0');
});
*/
// Special:PrefixIndex
$(function () {
if (mw.config.get("wgTitle").indexOf("/") !== -1 || mw.config.get("wgAction") === "history") // No subpages or history
return;
if (mw.config.get("wgNamespaceNumber") === 2 || mw.config.get("wgNamespaceNumber") === 3) {
var username = encodeURIComponent(mw.config.get("wgTitle")),
checkurl = mw.config.get("wgServer") + mw.config.get("wgScriptPath") + "/index.php?title=Special:PrefixIndex&prefix=" + username + "&namespace=2" ;
mw.util.addPortletLink("p-cactions", checkurl, "Subpages", "ca-contrib", "Subpages of user");
}
});
// Edit count
$(function() {
if (mw.config.get("wgTitle").indexOf("/") !== -1 || mw.config.get("wgAction") === "history") // No subpages or history
return;
if (mw.config.get("wgNamespaceNumber") === 2 || mw.config.get("wgNamespaceNumber") === 3) {
var username = encodeURIComponent(mw.config.get("wgTitle")),
checkurl = "//toolserver.org/~soxred93/pcount/index.php?name=" + username + "&lang=simple&wiki=wikipedia";
mw.util.addPortletLink("p-cactions", checkurl, "Edits", "ca-contrib", "Analysis of edits by user");
}
});
// Quick edit count
$(function() {
var quickEditCount = {
retrieveData: function(user) {
$.ajax({
url: mw.config.get("wgServer") + mw.config.get("wgScriptPath") + "/api.php?action=query&format=json&list=users&usprop=editcount&ususers=" + user,
dataType: "json",
success: function(data) {
var info = data.query.users[0];
var editcount = info.editcount;
var name = info.name;
$("#contentSub").html($("#contentSub").html() + "<br /><strong>" + name + " has " + editcount + " total edits.</strong>");
}
});
},
editCount: function() {
var subpagename = mw.config.get("wgTitle").split("/")[1],
countuser;
if ((mw.config.get("wgNamespaceNumber") === 2 || mw.config.get("wgNamespaceNumber") === 3) && !subpagename) {
countuser = mw.config.get("wgTitle").split(":")[0];
} else if (mw.config.get("wgNamespaceNumber") === -1 && mw.config.get("wgTitle").indexOf("Contributions") !== -1) {
if (!document.getElementById("contentSub"))
return;
countuser = mw.config.get("wgTitle").slice(14);
}
this.retrieveData(countuser);
}
}
var subpagename = mw.config.get("wgTitle").split("/")[1];
if (((mw.config.get("wgNamespaceNumber") === 2 || mw.config.get("wgNamespaceNumber") === 3)
&& subpagename === undefined && mw.config.get("wgAction") !== "history")
|| mw.config.get("wgCanonicalSpecialPageName") === "Contributions") {
var portletLink = mw.util.addPortletLink("p-cactions", "#", "Count", "ca-editcount", "Quick edit count of user");
$(portletLink).click(function(e) {
e.preventDefault();
quickEditCount.editCount();
});
}
});
}(jQuery)) // End wrap with jQuery
// [[Category:Wikipedia scripts]]