User:Tar Lócesilion/common.js

From translatewiki.net
Jump to: navigation, search
	//
	// Zakładki
	//
	if (wgNamespaceNumber!=-1)
	{
		var els = null;
		switch (skin)
		{
			case 'vector':
			case 'monobook':
				els = document.getElementById('ca-talk').parentNode.getElementsByTagName('li');
			break;
				//els = document.getElementById('pt-mytalk').getElementsByTagName('li');
		}
		if (els!=null && els.length)
		{
			var tmp = encodeURIComponent(wgTitle);
			var nn = (wgNamespaceNumber%2==1) ? wgNamespaceNumber-1 : wgNamespaceNumber;
			var staticEls = [];
			staticEls[0] = els[0];
			staticEls[1] = els[1];
			for (var i=0; i<staticEls.length; i++)
			{
				// tworzenie
				nel = staticEls[i].cloneNode(false);
				if (wgVersion.indexOf('1.16')==0)
					nel.innerHTML = '<a href="/w/index.php?title=Special:Prefixindex&namespace='+(nn+i)+'&prefix='+tmp+'"><span>/</span></a>';
				else
					nel.innerHTML = '<span><a href="/w/index.php?title=Special:Prefixindex&namespace='+(nn+i)+'&prefix='+tmp+'">/</a></span>';
				// przyklejanie
				staticEls[i].style.marginRight = '0px'
				staticEls[i].style.paddingRight = '0px'
				staticEls[i].style.borderRight = '0px none'
				// wstawianie
				if (staticEls[i] == staticEls[i].parentNode.lastChild)
				{
					staticEls[i].parentNode.appendChild(nel);
				}
				else
				{
					staticEls[i].parentNode.insertBefore(nel, staticEls[i].nextSibling);
				}
			}
		}
	}