MediaWiki:Monobook.js: Porovnání verzí
Skočit na navigaci
Skočit na vyhledávání
Řádek 1: | Řádek 1: | ||
/* | |||
<pre> | |||
*/ | |||
/* tooltips and access keys */ | /* tooltips and access keys */ | ||
ta = new Object(); | ta = new Object(); | ||
Řádek 50: | Řádek 54: | ||
ta['ca-nstab-help'] = new Array('c','Zobrazit stránku nápovědy.'); | ta['ca-nstab-help'] = new Array('c','Zobrazit stránku nápovědy.'); | ||
ta['ca-nstab-category'] = new Array('c','Zobrazit kategorii.'); | ta['ca-nstab-category'] = new Array('c','Zobrazit kategorii.'); | ||
if (window.showModalDialog && document.compatMode && document.compatMode == "CSS1Compat") | |||
{ | |||
var oldWidth; | |||
var docEl = document.documentElement; | |||
function fixIEScroll() | |||
{ | |||
if (!oldWidth || docEl.clientWidth > oldWidth) | |||
doFixIEScroll(); | |||
else | |||
setTimeout(doFixIEScroll, 1); | |||
oldWidth = docEl.clientWidth; | |||
} | |||
function doFixIEScroll() { | |||
docEl.style.overflowX = (docEl.scrollWidth - docEl.clientWidth < 4) ? "hidden" : ""; | |||
} | |||
document.attachEvent("onreadystatechange", fixIEScroll); | |||
attachEvent("onresize", fixIEScroll); | |||
} | |||
function addLoadEvent(func) | |||
{ | |||
if (window.addEventListener) | |||
window.addEventListener("load", func, false); | |||
else if (window.attachEvent) | |||
window.attachEvent("onload", func); | |||
} | |||
function LinkFA() | |||
{ | |||
// iterate over all <span>-elements | |||
for(var i=0; a = document.getElementsByTagName("span")[i]; i++) { | |||
// if found a FA span | |||
if(a.className == "FA") { | |||
// iterate over all <li>-elements | |||
for(var j=0; b = document.getElementsByTagName("li")[j]; j++) { | |||
// if found a FA link | |||
if(b.className == "interwiki-" + a.id) { | |||
b.style.padding = "0 0 0 16px"; | |||
b.style.backgroundImage = "url('http://upload.wikimedia.org/wikipedia/en/6/60/LinkFA-star.png')"; | |||
b.style.backgroundRepeat = "no-repeat"; | |||
b.title = "This article has gained featured status"; | |||
} | |||
} | |||
} | |||
} | |||
} | |||
addLoadEvent(LinkFA); | |||
// ============================================================ | |||
// BEGIN Dynamic Navigation Bars (experimantal) | |||
// set up the words in your language | |||
var NavigationBarHide = '[ Hide ]'; | |||
var NavigationBarShow = '[ Show ]'; | |||
// set up max count of Navigation Bars on page, | |||
// if there are more, all will be hidden | |||
// NavigationBarShowDefault = 0; // all bars will be hidden | |||
// NavigationBarShowDefault = 1; // on pages with more than 1 bar all bars will be hidden | |||
var NavigationBarShowDefault = 1; | |||
// shows and hides content and picture (if available) of navigation bars | |||
// Parameters: | |||
// indexNavigationBar: the index of navigation bar to be toggled | |||
function toggleNavigationBar(indexNavigationBar) | |||
{ | |||
var NavToggle = document.getElementById("NavToggle" + indexNavigationBar); | |||
var NavFrame = document.getElementById("NavFrame" + indexNavigationBar); | |||
if (!NavFrame || !NavToggle) { | |||
return false; | |||
} | |||
// if shown now | |||
if (NavToggle.firstChild.data == NavigationBarHide) { | |||
for ( | |||
var NavChild = NavFrame.firstChild; | |||
NavChild != null; | |||
NavChild = NavChild.nextSibling | |||
) { | |||
if (NavChild.className == 'NavPic') { | |||
NavChild.style.display = 'none'; | |||
} | |||
if (NavChild.className == 'NavContent') { | |||
NavChild.style.display = 'none'; | |||
} | |||
} | |||
NavToggle.firstChild.data = NavigationBarShow; | |||
// if hidden now | |||
} else if (NavToggle.firstChild.data == NavigationBarShow) { | |||
for ( | |||
var NavChild = NavFrame.firstChild; | |||
NavChild != null; | |||
NavChild = NavChild.nextSibling | |||
) { | |||
if (NavChild.className == 'NavPic') { | |||
NavChild.style.display = 'block'; | |||
} | |||
if (NavChild.className == 'NavContent') { | |||
NavChild.style.display = 'block'; | |||
} | |||
} | |||
NavToggle.firstChild.data = NavigationBarHide; | |||
} | |||
} | |||
// adds show/hide-button to navigation bars | |||
function createNavigationBarToggleButton() | |||
{ | |||
var indexNavigationBar = 0; | |||
// iterate over all < div >-elements | |||
for( | |||
var i=0; | |||
NavFrame = document.getElementsByTagName("div")[i]; | |||
i++ | |||
) { | |||
// if found a navigation bar | |||
if (NavFrame.className == "NavFrame") { | |||
indexNavigationBar++; | |||
var NavToggle = document.createElement("a"); | |||
NavToggle.className = 'NavToggle'; | |||
NavToggle.setAttribute('id', 'NavToggle' + indexNavigationBar); | |||
NavToggle.setAttribute('href', 'javascript:toggleNavigationBar(' + indexNavigationBar + ');'); | |||
var NavToggleText = document.createTextNode(NavigationBarHide); | |||
NavToggle.appendChild(NavToggleText); | |||
// Find the NavHead and attach the toggle link (Must be this complicated because Moz's firstChild handling is borked) | |||
for( | |||
var j=0; | |||
j < NavFrame.childNodes.length; | |||
j++ | |||
) { | |||
if (NavFrame.childNodes[j].className == "NavHead") { | |||
NavFrame.childNodes[j].appendChild(NavToggle); | |||
} | |||
} | |||
NavFrame.setAttribute('id', 'NavFrame' + indexNavigationBar); | |||
} | |||
} | |||
// if more Navigation Bars found than Default: hide all | |||
if (NavigationBarShowDefault < indexNavigationBar) { | |||
for( | |||
var i=1; | |||
i<=indexNavigationBar; | |||
i++ | |||
) { | |||
toggleNavigationBar(i); | |||
} | |||
} | |||
} | |||
addLoadEvent(createNavigationBarToggleButton); | |||
// END Dynamic Navigation Bars | |||
// ============================================================ | |||
var mpTitle = "Wikipedia:WikiProject Usability/Main Page/Draft"; | |||
var isMainPage = (document.title.substr(0, mpTitle.length) == mpTitle) | |||
if (isMainPage) | |||
{ | |||
document.write('<style type="text/css"> #siteSub, #contentSub, h1.firstHeading { display: none!important; } #content, #content div.thumb, #p-cactions li a, #p-cactions li a:hover, #p-cactions li.selected a { background: #fff!important; } </style>'); | |||
var mpSmallEnabled; | |||
var mpMinWidth = 700; | |||
function mainPageTransform() | |||
{ | |||
var mpContentEl = document.getElementById("bodyContent"); | |||
var mpBrowseEl = document.getElementById("EnWpMpBrowse"); | |||
var mpContainEl = document.getElementById("EnWpMpBrowseContainer"); | |||
var mpMarginEl = document.getElementById("EnWpMpMargin"); | |||
var mpEl = document.getElementById("EnWpMainPage"); | |||
if (!mpContentEl || !mpBrowseEl || !mpContainEl || !mpMarginEl || !mpEl) | |||
return; | |||
if (!mpSmallEnabled && mpContentEl.offsetWidth < mpMinWidth) | |||
{ | |||
mpContainEl.insertBefore(mpBrowseEl, mpContainEl.firstChild); | |||
mpBrowseEl.className = "EnWpMpBrowseBottom"; | |||
mpMarginEl.style.marginRight = 0; | |||
mpSmallEnabled = true; | |||
} | |||
else if (mpSmallEnabled && mpContentEl.offsetWidth > mpMinWidth) | |||
{ | |||
mpEl.insertBefore(mpBrowseEl, mpEl.firstChild); | |||
mpBrowseEl.className = "EnWpMpBrowseRight"; | |||
mpMarginEl.style.marginRight = "13.8em"; | |||
mpSmallEnabled = false; | |||
} | |||
} | |||
var onloadFuncts = [ mainPageTransform ]; | |||
if (window.addEventListener) | |||
window.addEventListener("resize", mainPageTransform, false); | |||
else if (window.attachEvent) | |||
window.attachEvent("onresize", mainPageTransform); | |||
} | |||
/* add a redirect button to the edit page toolbar */ | |||
function InsertButtonsToToolBar() | |||
{ | |||
tooly = document.getElementById('toolbar'); | |||
if (tooly != null) | |||
{ | |||
RedirectButton = "<a href=\"javascript:insertTags('#REDIRECT [[',']]','Insert text');\"><img src=\"http://upload.wikimedia.org/wikipedia/en/c/c8/Button_redirect.png\" alt=\"Redirect\" title=\"Insert redirect link\"></a>"; | |||
tooly.innerHTML = tooly.innerHTML + RedirectButton; | |||
} | |||
} | |||
window.onload = InsertButtonsToToolBar; | |||
/* | |||
</pre> | |||
*/ |
Verze z 9. 3. 2006, 23:11
/* <pre> */ /* tooltips and access keys */ ta = new Object(); ta['pt-userpage'] = new Array('.','Moje uživatelská stránka'); ta['pt-anonuserpage'] = new Array('.','Uživatelská stránka pro IP adresu, ze které editujete'); ta['pt-mytalk'] = new Array('n','Moje diskusní stránka'); ta['pt-anontalk'] = new Array('n','Diskuse o editacích provedených z této IP adresy'); ta['pt-preferences'] = new Array('','Moje preference'); ta['pt-watchlist'] = new Array('l','Seznam stránek, jejichž změny sleduji'); ta['pt-mycontris'] = new Array('y','Seznam mých příspěvků'); ta['pt-login'] = new Array('o','Doporučujeme vám přihlásit se, ovšem není to povinné.'); ta['pt-anonlogin'] = new Array('o','Doporučujeme vám přihlásit se, ovšem není to povinné.'); ta['pt-logout'] = new Array('o','Odhlásit se'); ta['ca-talk'] = new Array('t','Diskuse ke stránce'); ta['ca-edit'] = new Array('e','Tuto stránku můžete editovat. Prosíme použijte tlačítko Ukázat náhled před uložením.'); ta['ca-addsection'] = new Array('+','Přidat k této diskusi svůj komentář.'); ta['ca-viewsource'] = new Array('e','Tato stránka je zamčena. Můžete si prohlédnout její zdrojový kód.'); ta['ca-history'] = new Array('h','Starší verze této stránky.'); ta['ca-protect'] = new Array('=','Zamknout tuto stránku.'); ta['ca-delete'] = new Array('d','Smazat tuto stránku.'); ta['ca-undelete'] = new Array('d','Obnovit editace této stránky provedené před jejím smazáním.'); ta['ca-move'] = new Array('m','Přesunout tuto stránku'); ta['ca-nomove'] = new Array('','Nemáte oprávnění přesunout tuto stránku'); ta['ca-watch'] = new Array('w','Přidat tuto stránku mezi sledované'); ta['ca-unwatch'] = new Array('w','Vyjmout tuto stránku ze sledovaných'); ta['search'] = new Array('f','Hledat na této wiki'); ta['p-logo'] = new Array('','Hlavní strana'); ta['n-mainpage'] = new Array('z','Navštívit Hlavní stranu'); ta['n-portal'] = new Array('','O projektu, jak můžete pomoci, kde hledat'); ta['n-currentevents'] = new Array('','Informace o aktuálních událostech'); ta['n-recentchanges'] = new Array('r','Seznam posledních změn na této wiki'); ta['n-randompage'] = new Array('x','Přejít na náhodně vybranou stránku'); ta['n-help'] = new Array('','Místo, kde najdete pomoc'); ta['n-sitesupport'] = new Array('','Podpořte nás'); ta['t-whatlinkshere'] = new Array('j','Seznam všech wikistránek, které sem odkazují'); ta['t-recentchangeslinked'] = new Array('k','Nedávné změny stránek, které sem odkazují'); ta['feed-rss'] = new Array('','RSS kanál pro tuto stránku'); ta['feed-atom'] = new Array('','Atom kanál pro tuto stránku'); ta['t-contributions'] = new Array('','Prohlédnout si seznam příspěvků tohoto uživatele'); ta['t-emailuser'] = new Array('','Poslat e-mail tomuto uživateli'); ta['t-upload'] = new Array('u','Nahrát obrázky či jiná multimédia'); ta['t-specialpages'] = new Array('q','Seznam všech speciálních stránek'); ta['ca-nstab-main'] = new Array('c','Zobrazit článek'); ta['ca-nstab-user'] = new Array('c','Zobrazit uživatelovu stránku'); ta['ca-nstab-media'] = new Array('c','Zobrazit stránku souboru'); ta['ca-nstab-special'] = new Array('','Toto je speciální stránka, kterou nelze editovat.'); ta['ca-nstab-wp'] = new Array('a','Zobrazit stránku o wiki.'); ta['ca-nstab-image'] = new Array('c','Zobrazit stránku obrázku.'); ta['ca-nstab-mediawiki'] = new Array('c','Zobrazit systémovou zprávu.'); ta['ca-nstab-template'] = new Array('c','Zobrazit šablonu.'); ta['ca-nstab-help'] = new Array('c','Zobrazit stránku nápovědy.'); ta['ca-nstab-category'] = new Array('c','Zobrazit kategorii.'); if (window.showModalDialog && document.compatMode && document.compatMode == "CSS1Compat") { var oldWidth; var docEl = document.documentElement; function fixIEScroll() { if (!oldWidth || docEl.clientWidth > oldWidth) doFixIEScroll(); else setTimeout(doFixIEScroll, 1); oldWidth = docEl.clientWidth; } function doFixIEScroll() { docEl.style.overflowX = (docEl.scrollWidth - docEl.clientWidth < 4) ? "hidden" : ""; } document.attachEvent("onreadystatechange", fixIEScroll); attachEvent("onresize", fixIEScroll); } function addLoadEvent(func) { if (window.addEventListener) window.addEventListener("load", func, false); else if (window.attachEvent) window.attachEvent("onload", func); } function LinkFA() { // iterate over all <span>-elements for(var i=0; a = document.getElementsByTagName("span")[i]; i++) { // if found a FA span if(a.className == "FA") { // iterate over all <li>-elements for(var j=0; b = document.getElementsByTagName("li")[j]; j++) { // if found a FA link if(b.className == "interwiki-" + a.id) { b.style.padding = "0 0 0 16px"; b.style.backgroundImage = "url('http://upload.wikimedia.org/wikipedia/en/6/60/LinkFA-star.png')"; b.style.backgroundRepeat = "no-repeat"; b.title = "This article has gained featured status"; } } } } } addLoadEvent(LinkFA); // ============================================================ // BEGIN Dynamic Navigation Bars (experimantal) // set up the words in your language var NavigationBarHide = '[ Hide ]'; var NavigationBarShow = '[ Show ]'; // set up max count of Navigation Bars on page, // if there are more, all will be hidden // NavigationBarShowDefault = 0; // all bars will be hidden // NavigationBarShowDefault = 1; // on pages with more than 1 bar all bars will be hidden var NavigationBarShowDefault = 1; // shows and hides content and picture (if available) of navigation bars // Parameters: // indexNavigationBar: the index of navigation bar to be toggled function toggleNavigationBar(indexNavigationBar) { var NavToggle = document.getElementById("NavToggle" + indexNavigationBar); var NavFrame = document.getElementById("NavFrame" + indexNavigationBar); if (!NavFrame || !NavToggle) { return false; } // if shown now if (NavToggle.firstChild.data == NavigationBarHide) { for ( var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling ) { if (NavChild.className == 'NavPic') { NavChild.style.display = 'none'; } if (NavChild.className == 'NavContent') { NavChild.style.display = 'none'; } } NavToggle.firstChild.data = NavigationBarShow; // if hidden now } else if (NavToggle.firstChild.data == NavigationBarShow) { for ( var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling ) { if (NavChild.className == 'NavPic') { NavChild.style.display = 'block'; } if (NavChild.className == 'NavContent') { NavChild.style.display = 'block'; } } NavToggle.firstChild.data = NavigationBarHide; } } // adds show/hide-button to navigation bars function createNavigationBarToggleButton() { var indexNavigationBar = 0; // iterate over all < div >-elements for( var i=0; NavFrame = document.getElementsByTagName("div")[i]; i++ ) { // if found a navigation bar if (NavFrame.className == "NavFrame") { indexNavigationBar++; var NavToggle = document.createElement("a"); NavToggle.className = 'NavToggle'; NavToggle.setAttribute('id', 'NavToggle' + indexNavigationBar); NavToggle.setAttribute('href', 'javascript:toggleNavigationBar(' + indexNavigationBar + ');'); var NavToggleText = document.createTextNode(NavigationBarHide); NavToggle.appendChild(NavToggleText); // Find the NavHead and attach the toggle link (Must be this complicated because Moz's firstChild handling is borked) for( var j=0; j < NavFrame.childNodes.length; j++ ) { if (NavFrame.childNodes[j].className == "NavHead") { NavFrame.childNodes[j].appendChild(NavToggle); } } NavFrame.setAttribute('id', 'NavFrame' + indexNavigationBar); } } // if more Navigation Bars found than Default: hide all if (NavigationBarShowDefault < indexNavigationBar) { for( var i=1; i<=indexNavigationBar; i++ ) { toggleNavigationBar(i); } } } addLoadEvent(createNavigationBarToggleButton); // END Dynamic Navigation Bars // ============================================================ var mpTitle = "Wikipedia:WikiProject Usability/Main Page/Draft"; var isMainPage = (document.title.substr(0, mpTitle.length) == mpTitle) if (isMainPage) { document.write('<style type="text/css"> #siteSub, #contentSub, h1.firstHeading { display: none!important; } #content, #content div.thumb, #p-cactions li a, #p-cactions li a:hover, #p-cactions li.selected a { background: #fff!important; } </style>'); var mpSmallEnabled; var mpMinWidth = 700; function mainPageTransform() { var mpContentEl = document.getElementById("bodyContent"); var mpBrowseEl = document.getElementById("EnWpMpBrowse"); var mpContainEl = document.getElementById("EnWpMpBrowseContainer"); var mpMarginEl = document.getElementById("EnWpMpMargin"); var mpEl = document.getElementById("EnWpMainPage"); if (!mpContentEl || !mpBrowseEl || !mpContainEl || !mpMarginEl || !mpEl) return; if (!mpSmallEnabled && mpContentEl.offsetWidth < mpMinWidth) { mpContainEl.insertBefore(mpBrowseEl, mpContainEl.firstChild); mpBrowseEl.className = "EnWpMpBrowseBottom"; mpMarginEl.style.marginRight = 0; mpSmallEnabled = true; } else if (mpSmallEnabled && mpContentEl.offsetWidth > mpMinWidth) { mpEl.insertBefore(mpBrowseEl, mpEl.firstChild); mpBrowseEl.className = "EnWpMpBrowseRight"; mpMarginEl.style.marginRight = "13.8em"; mpSmallEnabled = false; } } var onloadFuncts = [ mainPageTransform ]; if (window.addEventListener) window.addEventListener("resize", mainPageTransform, false); else if (window.attachEvent) window.attachEvent("onresize", mainPageTransform); } /* add a redirect button to the edit page toolbar */ function InsertButtonsToToolBar() { tooly = document.getElementById('toolbar'); if (tooly != null) { RedirectButton = "<a href=\"javascript:insertTags('#REDIRECT [[',']]','Insert text');\"><img src=\"http://upload.wikimedia.org/wikipedia/en/c/c8/Button_redirect.png\" alt=\"Redirect\" title=\"Insert redirect link\"></a>"; tooly.innerHTML = tooly.innerHTML + RedirectButton; } } window.onload = InsertButtonsToToolBar; /* </pre> */