User:Ansumang/vector.js
Appearance
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:Ansumang/vector.css. |
//importScript('User:Lightmouse/monobook.js/script.js');
importScript('User:Pyrospirit/metadata.js'); // Metadata Assessment
importScript('User:Tra/sidebartranslate.js'); //[[User:Tra/sidebartranslate.js]]
importScript('User:Js/ajaxPreview.js')
ajaxPreviewPos = 'bottom'; //Buttons on the bottom, replacing standard buttons.
ajaxPreviewScrollTop = true;
ajaxPreviewExec = function(previewArea){ //code to execute after each preview update
if (window.setupTooltips) setupTooltips(previewArea)
}
importScript('User:Splarka/dabfinder.js'); // Disambiguation lookup script
//importScript('User:Splarka/timestamplocalizer.js');
importScript('User:Gimmetrow/fixRefs.js'); // Fix References
importScript('User:Dr pda/prosesize.js'); // Prose Size
//importScript('User:Dr_pda/prosesizebytes.js'); //[[User:Dr_pda/prosesizebytes.js]]
importScript('User:Cameltrader/Advisor.js');
importScript('User:Shubinator/DYKcheck.js');
importScript('User:Ale_jrb/Scripts/igloo.js'); // [[User:Ale_jrb/Scripts/igloo]]
importScript('User:Splarka/sysopdectector.js'); // Admin Detector
var showUserGroupSettings = { 'groups': true, 'groupless': true }
importScript('User:Δ/Copyvio Detection Candidates.js');
importScript('User:GregU/dashes.js');
//importScript('User:PleaseStand/segregate-refs.js');
//importScript('User:Plastikspork/datetools.js');
//importScript('User:Splarka/electrocute.js');
importScript('User:Gary King/nominations viewer.js'); // [[Wikipedia:Nominations Viewer]]
//importScript('MediaWiki:Gadget-edittop.js'); // Edit Top
//importScript('User:AndyZ/peerreviewer.js'); [[User:AndyZ/peerreviewer.js]] semi-automated MOS formatter
importScript('User:Sross_(Public_Policy)/ambassadorwikilove.js');
importScript('User:TheDJ/qui.js');
importScript('User:Smith609/endnote.js');
importScript('User:Smith609/toolbox.js');
importScript('User:Smith609/refsByName.js');
importScript('User:Gracenotes/rollback.js');
//importScript('User:Mr.Z-man/closeAFD.js'); //[[User:Mr.Z-man/closeAFD.js]]
//importScript('User:Σ/Testing facility/Foobar.js'); //[[User:Σ/Testing facility/Foobar.js]]
//importScript('User:Σ/Testing facility/Barbaz.js'); //[[User:Σ/Testing facility/Barbaz.js]] and [[User:Ais523/votesymbols.js]]
//importScript('User:Ale_jrb/Scripts/csdhelper.js'); //[[User:Ale_jrb/Scripts]] Decline CSD or PROD articles
var notifyByDefaultNew = false;
importScript('User:AzaToth/autocopyvio.js');
//This function adds a tab which, when clicked, extracts data from an infobox and
//populates the fields of the Persondata template. See the talk page for more details.
//
//
importScript('User:Dr pda/persondata.js'); //[[User:Dr pda/persondata.js]]
importScript('User:Ale_jrb/Scripts/statusCheck.js'); //[[User:Ale_jrb/Scripts]]
var offlineAfter = 7200;
var statPosition = new Array(0, 827);
//importScript('User:Rami_R/rfppClerk.js');
pr_timeout = 1
fr_timeout = 6
/**** navpop ****/
// [[User:Lupin/popups.js]]
importScript('User:Lupin/popups.js');
var popupFixDabs = true;
var popupSummaryData = true;
var popupFixDabsSummary;
var popupFixRedirs = true;
// Adds a link to the admin dashboard
//
addOnloadHook(function () {
addPortletLink( "p-personal",
wgServer + wgScriptPath + "/index.php?title=Template:Admin_dashboard",
"admin dashboard", "pt-admindashboard", "Link to admin dashboard",
"A", document.getElementById("pt-logout"));
});
// Adds a link to the acc tool
//
addOnloadHook(function () {
addPortletLink( "p-personal",
"http://toolserver.org/~acc/acc.php",
"acc tool", "pt-acctool", "Link to acc tool",
"7", document.getElementById("pt-logout"));
});
LocalComments = {
dateDifference: true,
dateFormat: 'dmy',
timeFirst: true,
twentyFourHours: true
};
importScript('Wikipedia:AutoEd/complete.js');
addOnloadHook( function() {
if( wgCanonicalSpecialPageName == 'Log' ) {
var form = document.forms[0];
var labels = form.getElementsByTagName( 'label' );
// Save the given text from the beginning, first one is the "user" field, and the nect one is the "page" field;
var old = {};
old.user = labels[0].textContent;
old.page = labels[1].textContent;
var logLabelCallback = function logLabelCallback( event ) {
var form = event.target;
var value = form.type.value;
labels = form.getElementsByTagName( 'label' );
switch( value ) {
case 'block':
labels[0].textContent = 'Blocker:';
labels[1].textContent = 'Blockee:';
break;
default:
labels[0].textContent = old.user;
labels[1].textContent = old.page;
break;
}
}
// We add an event listener to the callback in the form element
form.addEventListener( 'change', logLabelCallback, false );
// to make it "pop up" on load, we initiate an change event
var evt = document.createEvent( "Event" );
evt.initEvent( 'change', true, true );
form.dispatchEvent( evt );
}
});
if(!document.all) {
addOnloadHook(function() {var s=document.evaluate('//div[span/a/@class="image" and starts-with(span/a/@title,"Replace this image") and contains(span/a/@title,".svg")]',document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);for(var i=0;i<s.snapshotLength;++i){var c=s.snapshotItem(i);c.parentNode.removeChild(c);}});
/*
// Lousy hack ↓
function getParamValue(paramName, h) {
if (typeof h == 'undefined' ) { h = document.location.href; }
var cmdRe=RegExp('[&?]'+paramName+'=([^&]*)');
var m=cmdRe.exec(h);
if (m) {
try {
return decodeURI(m[1]);
} catch (someError) {}
}
return null;
}
addOnloadHook(function () {
var summary=getParamValue('autosummary');
if (document.editform && summary) { document.editform.wpSummary.value=summary; }
});
*/
/* Ajax file move module, version [0.0.4c]
Originally from: http://en.wikipedia.org/wiki/User:Splarka/ajaxfilemove.js
Notes:
* Very complex script, but very simple operation:
** Go to a File: page, click [speedy move], enter new name.
* Specifically written to move requested images, summaries and template removal regex are hard coded.
** Framework can be forked though.
* Does not suppress redirects, a feature could be written though.
** This would need more complex input, than a prompt().
*/
var sfmMoveToken = '';
var sfmNewTitle = '';
if(wgNamespaceNumber == 6 && wgCurRevisionId) {
addOnloadHook(function() {
var move = document.getElementById('ca-move');
if(!move) return
var sm = addPortletLink('p-cactions','javascript:sfmInit()','speedy move','ca-gonzales','Speed move this File','i',move);
});
}
function sfmInit() {
var def = wgCanonicalNamespace + ':';
var suggest = getElementsByClassName(document,'span','media-move-suggestion');
if(suggest.length > 0) def = getInnerText(suggest[0])
var newtitle = prompt('Move file to page:',def);
if(!newtitle) return
if(newtitle.toLowerCase().indexOf(wgCanonicalNamespace.toLowerCase() + ':') != 0) {
alert('You can\'t move files to other namespaces');
return;
}
var oldext = wgPageName.split('.')[wgPageName.split('.').length-1];
var newext = newtitle.split('.')[newtitle.split('.').length-1];
if(oldext.toLowerCase() != newext.toLowerCase()) {
var conf = confirm('Warning: you appear to be changing this file\'s extension from "' + oldext + '" to "' + newext + '".\nWhile this is works sometimes for very old files uploaded with the wrong\nextension, this is rare. Are you really sure you want to try that?');
if(!conf) return
}
var bar = document.getElementById('contentSub') || document.getElementById('topbar');
var out = document.createElement('pre');
out.setAttribute('id','sfm-output');
appendCSS('#sfm-output {border:1px solid black !important;padding:.5em;overflow:auto;font-size:120%}');
bar.appendChild(out);
var badchars = /([#<>\[\]{}|\/]|\:.*\:)/;
if(newtitle == wgPageName || newtitle.indexOf(wgCanonicalNamespace + ':') != 0 || badchars.test(newtitle)) {
out.appendChild(document.createTextNode('! That seems like a bad title to me: [[' + newtitle + ']]'));
return;
}
out.appendChild(document.createTextNode('* Input accepted, fetching edit/move tokens and page text...\n'));
document.getElementById('ca-gonzales').style.display = 'none';
var url = wgScriptPath + '/api.php?action=query&prop=info|revisions&rvprop=content|timestamp&indexpageids=1&intoken=edit|move&format=json&titles=' + encodeURIComponent(wgPageName);
var req = sajax_init_object();
req.open('GET', url, true);
req.onreadystatechange = function() {
if(req.readyState == 4 && req.status == 200) {
eval("sfmTokens(" + req.responseText + ",'" + req.responseText.replace(/\'/g,"`") + "')");
}
}
sfmNewTitle = newtitle;
req.send(null);
}
function sfmTokens(obj,txt) {
//test.wikipedia.org/w/api.php?action=query&prop=info|revisions&rvprop=content|timestamp&indexpageids=1&intoken=edit|move&format=jsonfm&titles=File:Test.png
var out = document.getElementById('sfm-output');
if(obj['error']) {
out.appendChild(document.createTextNode('! Api error: ' + obj['error']['code'] + ' - ' + obj['error']['info'] + '\n'));
return;
}
if(!obj['query'] || !obj['query']['pageids'] || !obj['query']['pages'][obj['query']['pageids'][0]] || !obj['query']['pages'][obj['query']['pageids'][0]]['movetoken'] || !obj['query']['pages'][obj['query']['pageids'][0]]['edittoken'] || !obj['query']['pages'][obj['query']['pageids'][0]]['revisions'][0]['timestamp'] || !obj['query']['pages'][obj['query']['pageids'][0]]['revisions'][0]['*']) {
out.appendChild(document.createTextNode('? Unexpected response: ' + txt + '\n'));
return;
}
if(obj['query']['pages'][obj['query']['pageids'][0]]['redirect']) {
out.appendChild(document.createTextNode('! This file is apparently a redirect, and should not be moved again.\n'));
return;
}
var edittoken = obj['query']['pages'][obj['query']['pageids'][0]]['edittoken'];
var movetoken = obj['query']['pages'][obj['query']['pageids'][0]]['movetoken'];
var pagetext = obj['query']['pages'][obj['query']['pageids'][0]]['revisions'][0]['*'];
var timestamp = obj['query']['pages'][obj['query']['pageids'][0]]['revisions'][0]['timestamp'];
var startstamp = obj['query']['pages'][obj['query']['pageids'][0]]['starttimestamp'];
out.appendChild(document.createTextNode('* Got tokens and text, searching for templates...\n'));
var templates = /\{\{[\s\n\t]*(ifr|rename[ _]*media|rename[ _]*image|ImageRename|rename)[\s\n\t]*(\|[^\}]*|)\}\}/ig;
var found = templates.test(pagetext);
if(!found) {
out.appendChild(document.createTextNode('! No automatically removable templates found, please continue manually.'));
return;
}
out.appendChild(document.createTextNode('* Move template(s) found and removed, attempting edit...\n'));
pagetext = pagetext.replace(templates,'');
var params = 'action=edit&format=json&title=' + encodeURIComponent(wgPageName) + '&text=' + encodeURIComponent(pagetext) + '&token=' + encodeURIComponent(edittoken) + '&summary=' + encodeURIComponent('Automatic removal of requested move templates in preparation for move.') + '&minor=1&basetimestamp=' + timestamp.replace(/[^\d]/g,'');
if(startstamp) params += '&starttimestamp=' + startstamp.replace(/[^\d]/g,'')
var url = wgScriptPath + '/api.php';
var req = sajax_init_object();
req.open('POST', url, true);
req.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
req.setRequestHeader('Content-length', params.length);
req.setRequestHeader('Connection', 'close');
req.onreadystatechange = function() {
if(req.readyState == 4 && req.status == 200) {
eval("sfmEdit(" + req.responseText + ",'" + req.responseText.replace(/\'/g,"`") + "')");
}
}
sfmMoveToken = movetoken;
req.send(params);
}
function sfmEdit(obj,txt) {
var out = document.getElementById('sfm-output');
if(obj['error']) {
out.appendChild(document.createTextNode('! Api error: ' + obj['error']['code'] + ' - ' + obj['error']['info'] + '\n* Please finish manually.'));
return;
} else if(obj['edit'] && obj['edit']['result']) {
out.appendChild(document.createTextNode('* Edit returned as "' + obj['edit']['result'] + '", attempting to move page to [[' + sfmNewTitle + ']]... \n'));
} else {
out.appendChild(document.createTextNode('? Unexpected response: ' + txt + '\n* Please finish manually.'));
return;
}
var def = "Semi-automated file move";
var reason = getElementsByClassName(document,'span','media-move-reason');
if(reason.length > 0) def = getInnerText(reason[0])
var params = 'action=move&format=json&token=' + encodeURIComponent(sfmMoveToken) + '&movetalk=1&from=' + encodeURIComponent(wgPageName) + '&to=' + encodeURIComponent(sfmNewTitle) + '&reason=' + encodeURIComponent( 'using [[User:Splarka/ajaxfilemove.js]];' +def );
var url = wgScriptPath + '/api.php';
var req = sajax_init_object();
req.open('POST', url, true);
req.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
req.setRequestHeader('Content-length', params.length);
req.setRequestHeader('Connection', 'close');
req.onreadystatechange = function() {
if(req.readyState == 4 && req.status == 200) {
eval("sfmMove(" + req.responseText + ",'" + req.responseText.replace(/\'/g,"`") + "')");
}
}
req.send(params);
}
function sfmMove(obj,txt) {
var out = document.getElementById('sfm-output');
if(obj['error']) {
out.appendChild(document.createTextNode('* Api error: ' + obj['error']['code'] + ' - ' + obj['error']['info'] + '\n* Please finish manually.'));
} else if(obj['move'] && obj['move']['from'] && obj['move']['to']) {
out.appendChild(document.createTextNode('* File [[' + obj['move']['from'] + ']] moved to [[' + obj['move']['to'] + ']]\n* Be sure to '));
var a = document.createElement('a');
a.setAttribute('href',wgScript + '?title=Special:WhatLinksHere&hidelinks=1&hidetrans=1&target=' + encodeURIComponent(obj['move']['to']));
a.appendChild(document.createTextNode('Check for double redirects!'));
out.appendChild(a);
} else {
out.appendChild(document.createTextNode('? Unexpected response: ' + txt + '\n* Please finish manually.'));
}
}
function test_protect(){
// testing date protection inside image names
var txt=document.editform.wpTextbox1;
Ohc_protect_ISO_convert();
}
// Add [[WP:Reflinks]] launcher in the toolbox on left
addOnloadHook(function () {
addPortletLink(
"p-tb", // toolbox portlet
"http://toolserver.org/~dispenser/cgi-bin/webreflinks.py/" + wgPageName
+ "?client=script&citeweb=on&overwrite=&limit=30&lang=" + wgContentLanguage,
"Reflinks" // link label
)});
/*** BEGIN WIKIBREAK ENFORCER ***/
addOnloadHook(function() {
/*** Start editing here ***/
// When you want to end your break?
// no leading zeroes. (example: 7 - correct, 07 - incorrect)
var date = { year: 2011, month: 11, day: 3};
var time = { hours: 18, minutes: 30, seconds: 0 };
/*** Stop editing here ***/
var currentDate = new Date();
var enforcedBreakEnd = new Date(
date.year,date.month-1,date.day,time.hours,time.minutes,time.seconds);
if (currentDate <= enforcedBreakEnd) {
alert("Enforced wikibreak until "+enforcedBreakEnd.toLocaleString()
+ "\n(now is "+currentDate.toLocaleString()+")\n\nBye!");
location = "http://"+location.host+"/w/index.php?title="
+ "Special:Userlogout&returnto=Main_Page";
}
});
/*** END WIKIBREAK ENFORCER ***/