Jump to content

User:Nux/monobook.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
function nuxjs(js_wikiurl)
{
 document.write('<'+'script type="text/javascript" src="' + js_wikiurl + '&action=raw&ctype=text/javascript&dontcountme=s"'+'><'+'/'+'script>');
}

/*
== Popups ==
Original: [[:en:User:Lupin/popups.js]]
*/

// disabled by default
if (document.cookie.indexOf("popup_disabled=0")!=-1)
{

 //
 // Settings
 var simplePopups=true;
 var popupDelay=2;		// opóźnienie w sekundach
 var popupFixRedirs=true;	// naprawianie linków do przekierowań
 var popupFixDabs=true;	// naprawianie linków do stron ujednoznaczniających
 var popupRevertSummaryPrompt=true; // możliwość zmiany tekstu przy revertowaniu
 var popupOnlyArticleLinks=false;   // nie tylko linki z artykułów
 var imagePopupsForImages=false;    // nie wyświetlanie obrazków nad obrazkami
}

/*
== Various scripts ==
*/

nuxjs('http://wiki.riteme.site/w/index.php?title=User:Nux/replylinks.js');

nuxjs('http://pl.wikipedia.org/w/index.php?title=Wikipedysta:Nux/SearchBox.js');

window.hideSidebarByDefault = true;
nuxjs('http://pl.wikipedia.org/w/index.php?title=Wikipedysta:Nux/hideSidebar.js');

/*
== Private ;) ==
*/
//
// Ustawienia
//
disableRealTitle = true;

//
// OnLoad...
//
$(function()
{
	//
	// extra tabs
	//
	if (mw.config.get('wgNamespaceNumber')!=-1)
	{
		var els = document.getElementById('ca-talk').parentNode.getElementsByTagName('li');
		var nn = (mw.config.get('wgNamespaceNumber')%2==1) ? mw.config.get('wgNamespaceNumber')-1 : mw.config.get('wgNamespaceNumber');
		var tmp = encodeURIComponent(mw.config.get('wgTitle'));
		els[0].innerHTML += '<a href="/w/index.php?title=Special:Prefixindex&namespace='+nn+'&from='+tmp+'">.*</a>';
		els[1].innerHTML += '<a href="/w/index.php?title=Special:Prefixindex&namespace='+(nn+1)+'&from='+tmp+'">.*</a>';
	}

	//
	// Upper menu
	//
	var el = document.getElementById('pt-userpage');
	el.style.cssText = 'font-weight:bold';

	var elBefore = document.getElementById('pt-mytalk');
	elBefore.style.cssText = 'font-weight:bold';
	elBefore.firstChild.innerHTML = 'talk';

	var elNew = document.createElement('li');
	elNew.innerHTML = '<a href="/w/index.php?title=Special:Prefixindex&namespace=2&from=Nux/">nux/</a>';
	elBefore.parentNode.insertBefore(elNew, elBefore);

	var elNew = document.createElement('li');
	elNew.innerHTML = '<a href="/w/index.php?title=Special:Prefixindex&namespace=3&from=Nux/">talk/</a>';
	elBefore.parentNode.insertBefore(elNew, elBefore);

	var elNew = document.createElement('li');
	elNew.innerHTML = '<a href="/wiki/User:Nux/monobook.js?diff=cur">mb.js</a>.<a href="/wiki/User:Nux/monobook.css">css</a>';
	elBefore.parentNode.insertBefore(elNew, elBefore);

	var elNew = document.createElement('li');
	elNew.innerHTML = '<a href="http://meta.wikimedia.org/wiki/Help:Variable">meta:var</a>';
	elBefore.parentNode.insertBefore(elNew, elBefore);

	// popups on/off (works after reloading)
	var elNew = document.createElement('li');
	if (document.cookie.indexOf("popup_disabled=0")!=-1)
		elNew.innerHTML = '<a href="javascript:var xxx = document.cookie=\'popup_disabled=1; path=/\'">pop-off</a>';
	else
		elNew.innerHTML = '<a href="javascript:var xxx = document.cookie=\'popup_disabled=0; path=/\'">pop-on</a>';
	elBefore.parentNode.insertBefore(elNew, elBefore);

});

// END OF User:Nux/monobook.js