User:Kazkaskazkasako/vector.js

/*	For more scripts look here: http://en.wikipedia.org/wiki/Wikipedia:Customisation http://en.wikipedia.org/wiki/Wikipedia:WikiProject_User_scripts/Scripts

// importScript("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 */

( function ( mw, $ ) {	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.marginLeft = '0'; document.getElementById( 'footer' ).style.marginLeft = '0'; if ( sidebarSwitch ) { sidebarSwitch.parentNode.removeChild(sidebarSwitch); }		sidebarSwitch = mw.util.addPortletLink( 'p-cactions', '#', 'Show sidebar', 'ca-sidebar', 'Show the navigation links', 'a' ); $( sidebarSwitch ).click( function ( e ) {			e.preventDefault;			sidebarShow;		} ); }	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.marginLeft = ''; document.getElementById( 'footer' ).style.marginLeft = ''; if ( sidebarSwitch ) { sidebarSwitch.parentNode.removeChild(sidebarSwitch); }		sidebarSwitch = mw.util.addPortletLink( 'p-cactions', '#', 'Hide sidebar', 'ca-sidebar', 'Hide the navigation links', 'a' ); $( sidebarSwitch ).click( function ( e ) {			e.preventDefault;			sidebarHide;		} ); }	// Only activate on Vector skin if ( mw.config.get( 'skin' ) === 'vector' ) { $.when($.ready,mw.loader.using('mediawiki.util')).then(function{			// Change this if you want to show the sidebar by default			sidebarHide;		} ); } }( mediaWiki, jQuery ) );

// From < https://en.wikipedia.org/wiki/User:Gary/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.

if (typeof(unsafeWindow) != 'undefined') {	mw = unsafeWindow.mw; }

$(highlightNearbyLinks);

function highlightNearbyLinks {	if (!(mw.config.get('wgAction') == 'view' || (mw.config.get('wgPageName') == 'Wikipedia:Sandbox' && mw.config.get('wgAction') == 'submit'))) return false; mw.util.addCSS('a.highlight-nearby { text-decoration: underline; }'); mw.util.addCSS('a.highlight-nearby:hover { text-decoration: none; }'); var bodyId = mw.config.get('wgPageName') == 'Wikipedia:Sandbox' && mw.config.get('wgAction') == 'submit' ? 'wikiPreview' : 'bodyContent'; var body = $('#' + bodyId); if (!body.length) return false; var links = $('a', body); // loop through links in page body links.each(function	{		var link = $(this);		var next = link.next;		// NOT: next node is a link, preceded by spaces		// NOT: next node is a link and is also the next sibling		if (!(next.length && next[0].nodeName == 'A' && ((link[0].nextSibling.nodeType == 3 && link[0].nextSibling.nodeValue.replace(/ /g, ) == ) || link[0].nextSibling == next[0]))) return true;		// NOT: current and next links are not images		if (!(!link.hasClass('image') && !next.hasClass('image'))) return true;		// this is a refname		if ((link.children.length && link.children.first[0].nodeName == 'SUP') || (next.children.length && next.children.first[0].nodeName == 'SUP')) return true;		link.addClass('highlight-nearby');		next.addClass('highlight-nearby');	}); }

// https://en.wikipedia.org/wiki/User:Dschwen/highlightredirects.js // https://en.wikipedia.org/wiki/User:Dschwen/HighlightRedirects if (mw.config.get('wgAction') !== 'edit' && mw.config.get('wgCanonicalNamespace') !== 'Special') { var highlightRedirects = { tab_redirects : null,

run : function { mw.util.addCSS('a.mw-redirect { color:green} a.mw-redirect:visited { color:darkgreen}'); },

install : function { with(highlightRedirects) {  mw.util.addPortletLink('p-cactions', 'javascript:highlightRedirects.run;', 'Redirects') || mw.util.addPortletLink('views', 'javascript:highlightRedirects.run;', 'Redirects'); } }

};

// // Hook up installation function // $(highlightRedirects.install); }

// From < http://en.wikipedia.org/wiki/User:TheDJ/Folded_references > // importScript('User:TheDJ/foldrefs.js');

//Worked before, now NOT working due to WikiData var moveInterwikisToTopArray = ["en", "de", "ru", "lt", "bat-smg"]; /** * Verschiebt bevorzugte Interlanguage-Links in der Liste „Andere Sprachen“ nach * oben. Eine ausführliche Beschreibung ist auf der Diskussionsseite zu finden. */ (function {	var n = 0, u, l;	if (!(u = document.getElementById('p-lang'))) return;	if (!(u = u.getElementsByTagName('UL')) || !u.length) return;	u = u[0];	if (!(l = u.getElementsByTagName('LI')) || !l.length) return;	/* Priorisierte Liste mit den nach oben zu sortierenden Sprachen */	var a = window.moveInterwikisToTopArray || [ 'de', 'en' ];	for (var p = a.length; p--; )	{		var r = new RegExp('(?:^|\\s)interwiki-' + a[p] + '(?:\\s|$)', 'i');		for (var i = l.length; i--; )			if (r.test(l[i].className))			{				/* Kleiner Abstand, wenn >1 Link umsortiert wurde */				if (++n === 2)					u.firstChild.style.marginBottom = '.5em';				u.insertBefore(l[i], u.firstChild);				break;			}	} });