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 WlElem = document.getElementById("pt-watchlist");
WlElem.parentNode.removeChild(WlElem);
//add new link
mw.util.addPortletLink('p-personal','/w/index.php?title=Special:Watchlist&days=7&hidebots=1','Watchlist','pt-watchlist', 'View your watchlist', null, '#pt-mycontris' );
//Alternative contributions link - show 500
////////////////////////////////////////////////////
//remove old link
var WlElem = document.getElementById("pt-mycontris");
WlElem.parentNode.removeChild(WlElem);
//add new link
mw.util.addPortletLink('p-personal','/w/index.php?title=Special:Contributions/Begoon&offset=&limit=500', 'Contributions','pt-mycontris', 'View your contributions', null, '#pt-logout' );
// 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);
//add User script sandbox to Tools
//////////////////////////////////
var followNode = document.getElementById("t-specialpages").nextSibling;
mw.util.addPortletLink('p-tb', 'http://en.wikipedia.org/wiki/Wikipedia:User_script_sandbox',
'Script sandbox', 't-scriptsandbox', 'User script sandbox','',followNode);
//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 () {