User:Begoon/addVectorLinks.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. |
![]() | Documentation for this user script can be added at User:Begoon/addVectorLinks. |
//add some links to Vector interface
//ensure mediawiki.util loaded
//////////////////////////////
mw.loader.using( 'mediawiki.util', function () {
//call on page load
///////////////////
jQuery( function( $ ) {
//Alternative sandbox link - don't want &action=edit
////////////////////////////////////////////////////
//mw.util.addPortletLink('p-personal','/w/index.php?title=Special:MyPage/sandbox',
// 'Sandbox','pt-mysandbox', 'Go to your sandbox', null, '#pt-preferences' );
//Alternative watchlist link - don't want bots
////////////////////////////////////////////////////
//remove old link
var WlElemW = document.getElementById("pt-watchlist");
WlElemW.parentNode.removeChild(WlElemW);
//add new link
mw.util.addPortletLink('p-personal','/w/index.php?title=Special:Watchlist&days=99&hidebots=1',
'Watchlist','pt-watchlist', 'View your watchlist', null, '#pt-mycontris' );
//Alternative contributions link - show 1000
////////////////////////////////////////////////////
//remove old link
var WlElemC = document.getElementById("pt-mycontris");
WlElemC.parentNode.removeChild(WlElemC);
//add new link
mw.util.addPortletLink('p-personal','/w/index.php?title=Special:Contributions/Begoon&offset=&limit=1000',
'Contributions','pt-mycontris', 'View your contributions', null, '#pt-logout' );
//Uploads link
///////////////
//add new link
var followNode = document.getElementById("pt-watchlist").nextSibling;
mw.util.addPortletLink('p-personal', 'http://en.wikipedia.org/wiki/Special:ListFiles?limit=250&user=Begoon',
'Uploads', 'pt-myuploads', 'View your uploads','',followNode);
// add Pending Changes link to Interaction
//////////////////////////////////////////
var followNode = document.getElementById("n-recentchanges").nextSibling;
mw.util.addPortletLink('p-interaction', 'http://en.wikipedia.org/wiki/Special:OldReviewedPages',
'Pending changes', 'n-pendingchanges', 'The list of changes not yet Reviewed','',followNode);
//add Edit Requests link to Interaction
///////////////////////////////////////
var followNode = document.getElementById("n-pendingchanges").nextSibling;
mw.util.addPortletLink('p-interaction', 'http://en.wikipedia.org/wiki/Category:Wikipedia_semi-protected_edit_requests',
'Edit requests', 'n-semiprotected', 'Semi-protected edit requests','',followNode);
//Use basic upload form
///////////////////////
//remove old link
var WlElemU = document.getElementById("n-upload");
WlElemU.parentNode.removeChild(WlElemU);
//add new link
mw.util.addPortletLink('p-interaction','https://en.wikipedia.org/wiki/Special:Upload',
'Upload file','n-upload', 'Basic upload form', null);
//reFill 2
//////////
if (mw.config.get('wgNamespaceNumber') == 0 || mw.config.get('wgNamespaceNumber') == 118) {
var followNode = document.getElementById("t-specialpages").nextSibling;
mw.util.addPortletLink('p-tb', 'https://tools.wmflabs.org/refill/ng/result.php?page=' + mw.config.get('wgPageName') + '&defaults=y&wiki=en',
'Run reFill 2', 't-refill2', 'Run reFill 2','', followNode);
}
//User:Salix alba/Citoid.js
///////////////////////////
importScript('User:Salix alba/Citoid.js');
//add Preferences link to end of Twinkle menu
/////////////////////////////////////////////
//counter to timeout jwait loop if p-twinkle never created
var loopcnt = 0;
//define jwait - test condition, execute or wait/loop
var jwait = function(condFunc, readyFunc, checkInterval) {
var checkFunc = function() {
if (condFunc()) { readyFunc(); }
else { loopcnt++; setTimeout(checkFunc, checkInterval);} };
checkFunc(); };
jwait(
// condFunc - test for condition
function() { return $('#p-twinkle').length > 0 || loopcnt > 300;},
// readyFunc - action to take if condition true
function() { if (loopcnt <= 300) {mw.util.addPortletLink('p-twinkle', 'http://en.wikipedia.org/wiki/Wikipedia:Twinkle/Preferences',
'Settings', 'tw-editprefs', 'Edit your Twinkle settings', null, '');}},
// checkInterval - msecs to wait before next test if condition false
50);
//close functions
/////////////////
}); //jQuery( function( $ ) {
}); //mw.loader.using( 'mediawiki.util', function () {