User:Kazkaskazkasako/global.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.
/*
* Script list:
*# Hide left sidebar
*# Highlight nearby links
*# highlightredirects (seems not to work [14/11/27])
*# show the most relevant languages first
*/
//importScript(":en:User:PleaseStand/hide-vector-sidebar.js");
/* hide-vector-sidebar.js: Adds a button to toggle visibility of the Vector sidebar.
Written by PleaseStand. Public domain; all copyright claims waived as described
in http://en.wikipedia.org/wiki/Template:PD-self */
/*global document, window, addOnloadHook, addPortletLink, skin*/
// WORKS [14/03/06]
var sidebarSwitch;
function sidebarHide() {
document.getElementById("mw-panel").style.visibility = "hidden";
document.getElementById("mw-head-base").style.marginLeft = "0";
document.getElementById("content").style.marginLeft = "0";
document.getElementById("left-navigation").style.left = "0";
document.getElementById("footer").style.marginLeft = "0";
if(typeof sidebarSwitch == "object") {
sidebarSwitch.parentNode.removeChild(sidebarSwitch);
}
sidebarSwitch = mw.util.addPortletLink("p-cactions", "javascript:sidebarShow()", "Show sidebar", "ca-sidebar", "Show the navigation links", "a");
}
function sidebarShow() {
document.getElementById("mw-panel").style.visibility = "";
document.getElementById("mw-head-base").style.marginLeft = "";
document.getElementById("content").style.marginLeft = "";
document.getElementById("left-navigation").style.left = "";
document.getElementById("footer").style.marginLeft = "";
if(typeof sidebarSwitch == "object") {
sidebarSwitch.parentNode.removeChild(sidebarSwitch);
}
sidebarSwitch = mw.util.addPortletLink("p-cactions", "javascript:sidebarHide()", "Hide sidebar", "ca-sidebar", "Hide the navigation links", "a");
}
// Only activate on Vector skin
if(skin == "vector") {
addOnloadHook(function() {
// Change this if you want to show the sidebar by default
sidebarHide();
});
}
// From < http://en.wikipedia.org/wiki/User:Gary_King/highlight_nearby_links.js >
/*
HIGHLIGHT NEARBY LINKS
Description: If two links are next to each other so it's hard to tell if they are one link or two separate ones (such as [[New York]] [[City]]),
both links will be underlined so that it is clear that they are separate.
Link: [[User:Gary King/highlight nearby links.js]]
*/
if (typeof(unsafeWindow) != 'undefined')
{
appendCSS = unsafeWindow.appendCSS;
wgAction = unsafeWindow.wgAction;
wgCanonicalNamespace = unsafeWindow.wgCanonicalNamespace;
wgPageName = unsafeWindow.wgPageName;
}
function highlightNearbyLinks()
{
if (!(wgAction == 'view' || (wgPageName == 'Wikipedia:Sandbox' && wgAction == 'submit')))
return;
mw.util.addCSS('a.highlight-nearby { text-decoration: underline; }');
mw.util.addCSS('a.highlight-nearby:hover { text-decoration: none; }');
links = document.getElementById((wgPageName == 'Wikipedia:Sandbox' && wgAction == 'submit' ? 'wikiPreview' : 'bodyContent')).getElementsByTagName('a');
// loop through links in page body
for (var i = 0; i < links.length; i++)
{
l = links[i];
next = l.nextSibling;
// next node is a text node with only spaces, followed by a link
if (!next || !next.nextSibling || !(next.nodeType == 3 && next.nodeValue.replace(/ /g, '') == '' && next.nextSibling.nodeName == 'A'))
continue;
// current and next link are not images
if ((l.className && l.className.indexOf('image') != -1) || (next.className && next.className.indexOf('image') != -1))
continue;
// this is a refname
if ((l.firstChild && l.firstChild.nodeName == 'SUP') || (next.firstChild && next.firstChild.nodeName == 'SUP'))
continue;
l.className += ' highlight-nearby';
next.nextSibling.className += ' highlight-nearby';
}
}
if (typeof(unsafeWindow) == 'undefined')
addOnloadHook(highlightNearbyLinks);
else
highlightNearbyLinks();
// [[User:Dschwen/highlightredirects.js]] - please include this line
mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Dschwen/highlightredirects.js'
+ '&action=raw&ctype=text/javascript');
//Worked before, then not working due to WikiData:
// http://en.wikipedia.org/wiki/User:Lampak/MyLanguages
//importScript('User:Lampak/MyLanguages.js');
//var mylangsArray = ["de", "ru", "lt"];
//var mylangsArray = new Array("de", "ru", "lt", "bat-smg");
//Alternatives to Lampak's old script:
var moveInterwikisToTopArray = ["en", "de", "ru", "lt", "bat-smg"];
mw.loader.load('//de.wikipedia.org/w/index.php?title=Benutzer:TMg/moveInterwikisToTop.js&action=raw&ctype=text/javascript');