MediaWiki:Gadget-MiniNormdaten.js

Z Wikipedii, wolnej encyklopedii

Uwaga: aby zobaczyć zmiany po opublikowaniu, może zajść potrzeba wyczyszczenia pamięci podręcznej przeglądarki.

  • Firefox / Safari: Przytrzymaj Shift podczas klikania Odśwież bieżącą stronę, lub naciśnij klawisze Ctrl+F5, lub Ctrl+R (⌘-R na komputerze Mac)
  • Google Chrome: Naciśnij Ctrl-Shift-R (⌘-Shift-R na komputerze Mac)
  • Internet Explorer / Edge: Przytrzymaj Ctrl, jednocześnie klikając Odśwież, lub naciśnij klawisze Ctrl+F5
  • Opera: Naciśnij klawisze Ctrl+F5.
// mini normdaten
$(document).ready(function()
{
	if (location.search.match(/[?&]printable=yes/))
	{
		// do nothing in printable version
		return;
	}
	
	$("div.normdaten-typ-p,div.normdaten-typ-k,div.normdaten-typ-v,div.normdaten-typ-w,div.normdaten-typ-s,div.normdaten-typ-g,div.normdaten-typ-fehlt,div.normdaten-andere").each(function(i)
	{
		var uls = $("ul", this);
		if (uls.length == 1)
		{
			uls.first().css("margin", "0.3em 0px 0px 0px");
			var lis = $("li", uls.first()).each(function(j)
			{
				var uids = $("span.uid", this);
				if (uids.length == 1)
				{
					var uid0 = uids.first();
					var label = $("a", this).first().html();
					var href = $("a", uid0).attr("href");
					var title = uid0.text();
					$(this).html("<a class='external text' rel='nofollow' href='"+href+"' title='"+title+"'>"+label+"</a>");
				}
				else if (uids.length > 1)
				{
					var a0 = $("a", this).first();
					var label = a0.text();
					a0.replaceWith("<span>"+label+"</span>");
					uids.each(function(k)
					{
						var a = $("a", this).first();
						$(this).attr("title", a.text());
						a.text(k + 1);
					})
				}
			});
		}
	})
});