|
|
Linia 1: |
Linia 1: |
− | // Tekst udostępniany na licencji Creative Commons: uznanie autorstwa, na tych samych warunkach
| + | $('div#content').append( "<div class='content-footer'></div>" ); |
− | // <pre>
| |
− | window.onload = function() {
| |
− | if (document.getElementById("buttonm") !=null) {
| |
− | var buttonm = document.getElementById("buttonm").innerHTML = "<div class='menukx'><img alt='Misje.png' src='http://wiki.metin2.pl/images/thumb/3/3e/Misje.png/16px-Misje.png'><button>Misje</button><div class='submenukx'><a href='/index.php/Lista_misji' title='Lista misji'>Lista misji</a> • <a href='/index.php/Kategoria:Misje' title='Kategoria:Misje'>Kategoria</a><br><a href='/index.php/Chain_quests' title='Chain quests'>Główne Misje</a> • <a href='/index.php/Misje_konne' title='Misje konne'>Misje konne</a></div><img alt='Polowania.png' src='http://wiki.metin2.pl/images/thumb/3/35/Polowania.png/16px-Polowania.png'><button>Polowania</button><div class='submenukx'><a href='/index.php/Polowania' title='Polowania'>Lista polowań</a></div><img alt='Księgi misji.png' src='/images/thumb/b/b2/Ksi%C4%99gi_misji.png/16px-Ksi%C4%99gi_misji.png' ><button>Księgi</button><div class='submenukx'><a href='/index.php/Kategoria:Zadania_ksi%C4%85g_misji' title='Kategoria:Zadania ksiąg misji'>Lista zadań</a></div></div>";
| |
− | }
| |
− | if (document.getElementById("buttonk") !=null) {
| |
− | var buttonk = document.getElementById("buttonk").innerHTML = "<div class='menukx'><button>Wojownik</button><div class='submenukx'><a href='/index.php/Wojownik/Zbroje' title='Wojownik/Zbroje'>Zbroje</a> • <a href='/index.php/Wojownik/Bronie' title='Wojownik/Bronie'>Bronie</a><br> <a href='/index.php/Wojownik/He%C5%82my' title='Wojownik/Hełmy'>Hełmy</a> • <a href='/index.php/Wojownik/Umiej%C4%99tno%C5%9Bci' title='Wojownik/Umiejętności'>Umiejętności</a></div><button>Sura</button><div class='submenukx'><a href='/index.php/Sura/Zbroje' title='Sura/Zbroje'>Zbroje</a> • <a href='/index.php/Sura/Bronie' title='Sura/Bronie'>Bronie</a><br><a href='/index.php/Sura/He%C5%82my' title='Sura/Hełmy'>Hełmy</a> • <a href='/index.php/Sura/Umiej%C4%99tno%C5%9Bci' title='Sura/Umiejętności'>Umiejętności</a></div><button>Ninja</button><div class='submenukx'><a href='/index.php/Ninja/Zbroje' title='Ninja/Zbroje'>Zbroje</a> • <a href='/index.php/Ninja/Bronie' title='Ninja/Bronie'>Bronie</a><br><a href='/index.php/Ninja/He%C5%82my' title='Ninja/Hełmy'>Hełmy</a> • <a href='/index.php/Ninja/Umiej%C4%99tno%C5%9Bci' title='Ninja/Umiejętności'>Umiejętności</a></div><button>Szaman</button><div class='submenukx'><a href='/index.php/Szaman/Zbroje' title='Szaman/Zbroje'>Zbroje</a> • <a href='/index.php/Szaman/Bronie' title='Szaman/Bronie'>Bronie</a><br><a href='/index.php/Szaman/He%C5%82my' title='Szaman/Hełmy'>Hełmy</a> • <a href='/index.php/Szaman/Umiej%C4%99tno%C5%9Bci' title='Szaman/Umiejętności'>Umiejętności</a></div><button>Likan</button><div class='submenukx'><a href='/index.php/Likan/Zbroje' title='Likan/Zbroje'>Zbroje</a> • <a href='/index.php/Likan/Bronie' title='Likan/Bronie'>Bronie</a><br><a href='/index.php/Likan/He%C5%82my' title='Likan/Hełmy'>Hełmy</a> • <a href='/index.php/Likan/Umiej%C4%99tno%C5%9Bci' title='Likan/Umiejętności'>Umiejętności</a></div></div>";
| |
− | }
| |
− | if (document.getElementById("buttoni") !=null) {
| |
− | var buttoni = document.getElementById("buttoni").innerHTML = "<div class='menukx'><button>Przedmioty</button><div class='submenukx'><table><tr><td width='95px'>Bransolety: </td><td>(<a href='/index.php/Kategoria:Bransolety' title='Kategoria:Bransolety'>Kategoria</a> / <a href='/index.php/Bransolety' title='Bransolety'>Lista</a>)</td></tr><tr><td width='95px'>Buty: </td><td>(<a href='/index.php/Kategoria:Buty' title='Kategoria:Buty'>Kategoria</a> / <a href='/index.php/Buty' title='Buty'>Lista</a>)</td></tr><tr><td width='95px'>Kolczyki:</td><td>(<a href='/index.php/Kategoria:Kolczyki' title='Kategoria:Kolczyki'>Kategoria</a> / <a href='/index.php/Kolczyki' title='Kolczyki'>Lista</a>)</td></tr><tr><td width='95px'>Naszyjniki:</td><td>(<a href='/index.php/Kategoria:Naszyjniki' title='Kategoria:Naszyjniki'>Kategoria</a> / <a href='/index.php/Naszyjniki' title='Naszyjniki'>Lista</a>)</td></tr><tr><td width='95px'>Pasy:</td><td>(<a href='/index.php/Kategoria:Pasy' title='Kategoria:Pasy'>Kategoria</a> / <a href='/index.php/Pasy' title='Pasy'>Lista</a>)</td></tr><tr><td width='95px'>Tarcze:</td><td>(<a href='/index.php/Kategoria:Tarcze' title='Kategoria:Tarcze'>Kategoria</a> / <a href='/index.php/Tarcze' title='Tarcze'>Lista</a>)</td></tr><tr><td width='95px'>Specjalne:</td><td>(<a href='/index.php/Kategoria:Przedmioty_Specjalne' title='Kategoria:Przedmioty Specjalne'>Kategoria</a> / <a href='/index.php/Przedmioty_Specjalne' title='Przedmioty Specjalne'>Lista</a>)</td></tr><tr><td width='95px'>Przedmioty w Metin2:</td><td>(<a href='/index.php/Kategoria:Przedmioty' title='Kategoria:Przedmioty'>Kategoria</a> / <a href='/index.php/Przedmioty' title='Przedmioty'>Lista</a>)</td></tr></table></div><button>Postacie</button><div class='submenukx'><table><tr><td width='95px'>Umiejętności:</td><td>(<a href='/index.php/Kategoria:Umiej%C4%99tno%C5%9Bci' title='Kategoria:Umiejętności'>Kategoria</a> dla wszystkich klas)</td></tr><tr><td width='95px'>NPC:</td><td>(<a href='/index.php/Kategoria:NPC' title='Kategoria:NPC'>Kategoria</a> / <a href='/index.php/NPC' title='NPC'>Lista</a>)</td></tr><tr><td width='95px'>Bonusy:</td><td>(<a href='/index.php/Bonusy' title='Bonusy'>Lista</a>)</td></tr></table></div><button>Inne</button><div class='submenukx'><table><tr><td width='95px'>Gildia</td><td>(<a href='/index.php/Kategoria:Gildie' title='Kategoria:Gildie'>Lista Gildii</a> / <a href='/index.php/Gildia' title='Gildia'>Informacje</a>)</td></tr><tr><td width='95px'>Kamienie metin:</td><td>(<a href='/index.php/Kategoria:Metin' title='Kategoria:Metin'>Kategoria</a> / <a href='/index.php/Metin' title='Metin'>Lista</a>)</td></tr><tr><td width='95px'>Kombinacje:</td><td>(<a href='/index.php/Kombinacje' title='Kombinacje'>Lista</a>)</td></tr><tr><td width='95px'>Potwory:</td><td>(<a href='/index.php/Kategoria:Potwory' title='Kategoria:Potwory'>Kategoria</a> / <a href='/index.php/Potwory' title='Potwory'>Lista</a>)</td></tr><tr><td width='95px'>Wierzchowce:</td><td>(<a href='/index.php/Kategoria:Wierzchowce' title='Kategoria:Wierzchowce'>Kategoria</a> / <a href='/index.php/Wierzchowce' title='Wierzchowce'>Lista</a>)</td></tr><tr><td width='95px'>Zwierzątka:</td><td>(<a href='/index.php/Kategoria:Zwierz%C4%85tka' title='Kategoria:Zwierzątka'>Kategoria</a> / <a href='/index.php/Zwierz%C4%85tka' title='Zwierzątka'>Lista</a>)</td></tr><tr><td width='95px'>Żyły:</td><td>(<a href='/index.php/Kategoria:%C5%BBy%C5%82y' title='Kategoria:Żyły'>Kategoria</a> / <a href='/index.php/%C5%BBy%C5%82y' title='Żyły'>Lista</a>)</td></tr><tr><td width='95px'>Inne:</td><td>(<a href='/index.php/Kategoria:Informacje' title='Kategoria:Informacje'>Informacje</a> • <a href='/index.php/Kategoria:Poradnik' title='Kategoria:Poradnik'>Poradniki</a> • <a href='/index.php/Kategoria:Szablony' title='Kategoria:Szablony'>Szablony</a>)</td></tr></table></div></div>";
| |
− | }
| |
− | if (document.getElementById("buttonmap") !=null) {
| |
− | var buttonmap = document.getElementById("buttonmap").innerHTML = "<div class='menukx'><button>Tereny neutralne</button><div class='submenukx'><a href='/index.php/Czerwony_Las' title='Czerwony Las'>Czerwony Las</a><br><a href='/index.php/Dolina_Seungryong' title='Dolina Seungryong'>Dolina Seungryong = Dolina orków</a><br><a href='/index.php/Doyyumhwaji' title='Doyyumhwaji'>Doyyumhwaji = Dojum-Papier = Piekło</a><br><a href='/index.php/G%C3%B3ra_Sohan' title='Góra Sohan'>Góra Sohan = Góra Suh-han = Lodowa ziemia</a><br><a href='/index.php/G%C3%B3ry_Grzmotu' title='Góry Grzmotu'>Góry Grzmotu</a><br><a href='/index.php/Kraina_Gigant%C3%B3w' title='Kraina Gigantów'>Kraina Gigantów</a><br><a href='/index.php/Lungsam' title='Lungsam'>Lungsam = Las duchów</a><br><a href='/index.php/Nefrytowa_Zatoka' title='Nefrytowa Zatoka'>Nefrytowa Zatoka</a><br><a href='/index.php/Przyl%C4%85dek_Smoczego_Ognia' title='Przylądek Smoczego Ognia'>Przylądek Smoczego Ognia</a><br><a href='/index.php/Pustynia_Yongbi' title='Pustynia Yongbi'>Pustynia Yongbi = Wielka pustynia</a><br><a href='/index.php/%C5%9Awi%C4%85tynia_Hwang' title='Świątynia Hwang'>Świątynia Hwang = Mroczna świątynia</a><br><a href='/index.php/W%C4%99%C5%BCowe_Pole' title='Wężowe Pole'>Wężowe Pole</a><br><a href='/index.php/Wie%C5%BCa_Demon%C3%B3w' title='Wieża Demonów'>Wieża Demonów = Demons Tower = DT</a><br><a href='/index.php/Zbocze_Gautama' title='Zbocze Gautama'>Zbocze Gautama</a></div><button>Lochy małp</button><div class='submenukx'><a href='/index.php/Hasun_Dong' title='Hasun Dong'>Hasun Dong = Loch słabych małp</a><br><a href='/index.php/Jungsun_Dong' title='Jungsun Dong'>Jungsun Dong = Loch normalnych małp</a><br><a href='/index.php/Sangsun_Dong' title='Sangsun Dong'>Sangsun Dong = Loch trudnych małp</a></div><button>Lochy pająków</button><div class='submenukx'><a href='/index.php/Kuahklo_Dong' title='Kuahklo Dong'>Kuahklo Dong = Loch pająków</a><br><a href='/index.php/2_loch_paj%C4%85k%C3%B3w' title='2 loch pająków'>2 loch pająków</a><br><a href='/index.php/3_Loch_Paj%C4%85k%C3%B3w' title='3 Loch Pająków'>3 Loch Pająków</a></div><button>Grota Wygnańców</button><div class='submenukx'><a href='/index.php/Grota_Wygna%C5%84c%C3%B3w' title='Grota Wygnańców'>Grota Wygnańców Poziom 1</a><br><a href='/index.php/Grota_Wygna%C5%84c%C3%B3w_2' title='Grota Wygnańców 2'>Grota Wygnańców Poziom 2</a></div><button>Dungeon'y</button><div class='submenukx'><a href='/index.php/Piekielne_Katakumby' title='Piekielne Katakumby'>Piekielne Katakumby = DC</a><br><a href='/index.php/Stra%C5%BCnica_Nemere' title='Strażnica Nemere'>Strażnica Nemere</a><br><a href='/index.php/%C5%9Awi%C4%85tynia_Smoka' title='Świątynia Smoka'>Świątynia Smoka</a><br><a href='/index.php/Twierdza_Czerwonego_Smoka' title='Twierdza Czerwonego Smoka'>Twierdza Czerwonego Smoka</a></div><button>Mapy specjalne</button><div class='submenukx'><a href='/index.php/Arena_Walk' title='Arena Walk'>Arena Walk</a><br><a href='/index.php/Arena_Wojen_Gildii' title='Arena Wojen Gildii'>Arena Wojen Gildii</a><br><a href='/index.php/Konkurs_OX' title='Konkurs OX'>Konkurs OX</a><br><a href='/index.php/Obszar_%C5%9Alubny' title='Obszar Ślubny'>Obszar Ślubny</a><br><a href='/index.php/Plac_Zabaw' title='Plac Zabaw'>Plac Zabaw</a><br><a href='/index.php/Wojna_Kr%C3%B3lestw' title='Wojna Królestw'>Wojna Królestw</a></div></div>";
| |
− | }
| |
− | }
| |
− | | |
− | /* Test if an element has a certain class **************************************
| |
− | *
| |
− | * Description: Uses regular expressions and caching for better performance.
| |
− | * Maintainers: [[User:Mike Dillon]], [[User:R. Koot]], [[User:SG]]
| |
− | */
| |
− | | |
− | var hasClass = (function () {
| |
− | var reCache = {};
| |
− | return function (element, className) {
| |
− | return (reCache[className] ? reCache[className] : (reCache[className] = new RegExp("(?:\\s|^)" + className + "(?:\\s|$)"))).test(element.className);
| |
− | };ff
| |
− | })();
| |
− | | |
− | /** Collapsible tables *********************************************************
| |
− | *
| |
− | * Description: Allows tables to be collapsed, showing only the header. See
| |
− | * [[en:Wikipedia:NavFrame]].
| |
− | * Maintainers: [[User:R. Koot]]
| |
− | */
| |
| | | |
| var autoCollapse = 2; | | var autoCollapse = 2; |
− | var collapseCaption = "ukryj"; | + | var collapseCaption = 'weniger'; |
− | var expandCaption = "pokaż"; | + | var expandCaption = 'mehr'; |
− | | + | |
− | function collapseTable( tableIndex ) | + | function collapseTable( tableIndex ) { |
− | { | + | var Button = document.getElementById( 'collapseButton' + tableIndex ); |
− | var Button = document.getElementById( "collapseButton" + tableIndex );
| + | var Table = document.getElementById( 'collapsibleTable' + tableIndex ); |
− | var Table = document.getElementById( "collapsibleTable" + tableIndex );
| + | |
− | | + | if ( !Table || !Button ) { |
− | if ( !Table || !Button ) {
| + | return false; |
− | return false;
| + | } |
− | }
| + | |
− | | + | var Rows = Table.rows; |
− | var Rows = Table.rows;
| + | |
− | | + | if ( Button.firstChild.data == collapseCaption ) { |
− | if ( Button.firstChild.data == collapseCaption ) {
| + | for ( var i = 1; i < Rows.length; i++ ) { |
− | for ( var i = 1; i < Rows.length; i++ ) {
| + | Rows[i].style.display = 'none'; |
− | Rows[i].style.display = "none";
| + | } |
− | }
| + | Button.firstChild.data = expandCaption; |
− | Button.firstChild.data = expandCaption;
| + | } else { |
− | } else {
| + | for ( var i = 1; i < Rows.length; i++ ) { |
− | for ( var i = 1; i < Rows.length; i++ ) {
| + | Rows[i].style.display = Rows[0].style.display; |
− | Rows[i].style.display = Rows[0].style.display;
| + | } |
− | }
| + | Button.firstChild.data = collapseCaption; |
− | Button.firstChild.data = collapseCaption;
| + | } |
− | }
| |
| } | | } |
− | | + | |
− | function createCollapseButtons() | + | function createCollapseButtons() { |
− | { | + | var tableIndex = 0; |
− | var tableIndex = 0;
| + | var NavigationBoxes = new Object(); |
− | var NavigationBoxes = new Object();
| + | var Tables = document.getElementsByTagName( 'table' ); |
− | var Tables = document.getElementsByTagName( "table" );
| + | |
− | | + | for ( var i = 0; i < Tables.length; i++ ) { |
− | for ( var i = 0; i < Tables.length; i++ ) {
| + | if ( hasClass( Tables[i], 'collapsible' ) ) { |
− | if ( hasClass( Tables[i], "collapsible" ) ) {
| + | |
− | | + | /* only add button and increment count if there is a header row to work with */ |
− | /* only add button and increment count if there is a header row to work with */
| + | var HeaderRow = Tables[i].getElementsByTagName( 'tr' )[0]; |
− | var HeaderRow = Tables[i].getElementsByTagName( "tr" )[0];
| + | if ( !HeaderRow ) { |
− | if (!HeaderRow) continue;
| + | continue; |
− | var Header = HeaderRow.getElementsByTagName( "th" )[0];
| + | } |
− | if (!Header) continue;
| + | var Header = HeaderRow.getElementsByTagName( 'th' )[0]; |
− | | + | if ( !Header ) { |
− | NavigationBoxes[ tableIndex ] = Tables[i];
| + | continue; |
− | Tables[i].setAttribute( "id", "collapsibleTable" + tableIndex );
| + | } |
− | | + | |
− | var Button = document.createElement( "span" );
| + | NavigationBoxes[tableIndex] = Tables[i]; |
− | var ButtonLink = document.createElement( "a" );
| + | Tables[i].setAttribute( 'id', 'collapsibleTable' + tableIndex ); |
− | var ButtonText = document.createTextNode( collapseCaption );
| + | |
− | | + | var Button = document.createElement( 'span' ); |
− | Button.style.styleFloat = "right";
| + | var ButtonLink = document.createElement( 'a' ); |
− | Button.style.cssFloat = "right";
| + | var ButtonText = document.createTextNode( collapseCaption ); |
− | Button.style.fontWeight = "normal";
| + | |
− | Button.style.textAlign = "right";
| + | Button.className = 'collapseButton'; // Styles are declared in [[MediaWiki:Common.css]] |
− | Button.style.width = "6em";
| + | |
− | | + | ButtonLink.style.color = Header.style.color; |
− | ButtonLink.style.color = Header.style.color;
| + | ButtonLink.setAttribute( 'id', 'collapseButton' + tableIndex ); |
− | ButtonLink.setAttribute( "id", "collapseButton" + tableIndex );
| + | ButtonLink.setAttribute( 'href', "javascript:collapseTable(" + tableIndex + ");" ); |
− | ButtonLink.setAttribute( "href", "javascript:collapseTable(" + tableIndex + ");" );
| + | ButtonLink.appendChild( ButtonText ); |
− | ButtonLink.appendChild( ButtonText );
| + | |
− | | + | Button.appendChild( document.createTextNode( '[' ) ); |
− | Button.appendChild( document.createTextNode( "[" ) );
| + | Button.appendChild( ButtonLink ); |
− | Button.appendChild( ButtonLink );
| + | Button.appendChild( document.createTextNode( ']' ) ); |
− | Button.appendChild( document.createTextNode( "]" ) );
| + | |
− | | + | Header.insertBefore( Button, Header.childNodes[0] ); |
− | Header.insertBefore( Button, Header.childNodes[0] );
| + | tableIndex++; |
− | tableIndex++;
| + | } |
− | }
| + | } |
− | }
| + | |
− | | + | for ( var i = 0; i < tableIndex; i++ ) { |
− | for ( var i = 0; i < tableIndex; i++ ) {
| + | if ( hasClass( NavigationBoxes[i], 'collapsed' ) || ( tableIndex >= autoCollapse && hasClass( NavigationBoxes[i], 'autocollapse' ) ) ) { |
− | if ( hasClass( NavigationBoxes[i], "collapsed" ) || ( tableIndex >= autoCollapse && hasClass( NavigationBoxes[i], "autocollapse" ) ) ) {
| + | collapseTable( i ); |
− | collapseTable( i );
| + | } else if ( hasClass( NavigationBoxes[i], 'innercollapse' ) ) { |
− | }
| + | var element = NavigationBoxes[i]; |
− | else if ( hasClass( NavigationBoxes[i], "innercollapse" ) ) {
| + | while ( element = element.parentNode ) { |
− | var element = NavigationBoxes[i];
| + | if ( hasClass( element, 'outercollapse' ) ) { |
− | while (element = element.parentNode) {
| + | collapseTable( i ); |
− | if ( hasClass( element, "outercollapse" ) ) {
| + | break; |
− | collapseTable ( i );
| + | } |
− | break;
| + | } |
− | }
| + | } |
− | }
| + | } |
− | }
| |
− | }
| |
| } | | } |
− | | + | |
− | $(document).ready( createCollapseButtons );
| + | addOnloadHook( createCollapseButtons ); |
− | | + | |
− | | + | /** Test if an element has a certain class ************************************** |
− | /** Dynamic Navigation Bars (experimental) ************************************* | |
| * | | * |
− | * Description: See [[Wikipedia:NavFrame]]. | + | * Description: Uses regular expressions and caching for better performance. |
− | * Maintainers: UNMAINTAINED
| + | * Maintainers: [[User:Mike Dillon]], [[User:R. Koot]], [[User:SG]] |
| */ | | */ |
| + | |
| + | var hasClass = ( function() { |
| + | var reCache = {}; |
| + | return function( element, className ) { |
| + | return ( reCache[className] ? reCache[className] : ( reCache[className] = new RegExp( "(?:\\s|^)" + className + "(?:\\s|$)" ) ) ).test( element.className ); |
| + | }; |
| + | })(); |
| | | |
− | // set up the words in your language
| + | if ( $( '#p-lang' ).length ) { |
− | var NavigationBarHide = '[' + collapseCaption + ']';
| + | $( '#p-tb .portletNavKetteEnd' ).removeClass( 'portletNavKetteEnd' ).addClass( 'portletNavKette' ); |
− | var NavigationBarShow = '[' + expandCaption + ']';
| |
− | | |
− | // 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 ( hasClass( NavChild, 'NavPic' ) ) {
| |
− | NavChild.style.display = 'none';
| |
− | }
| |
− | if ( hasClass( NavChild, '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 (hasClass(NavChild, 'NavPic')) {
| |
− | NavChild.style.display = 'block';
| |
− | }
| |
− | if (hasClass(NavChild, '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
| |
− | var divs = document.getElementsByTagName("div");
| |
− | for (var i = 0; NavFrame = divs[i]; i++) {
| |
− | // if found a navigation bar
| |
− | if (hasClass(NavFrame, "NavFrame")) {
| |
− |
| |
− | indexNavigationBar++;
| |
− | var NavToggle = document.createElement("a");
| |
− | NavToggle.className = 'NavToggle';
| |
− | NavToggle.setAttribute('id', 'NavToggle' + indexNavigationBar);
| |
− | NavToggle.setAttribute('href', 'javascript:toggleNavigationBar(' + indexNavigationBar + ');');
| |
− |
| |
− | var isCollapsed = hasClass( NavFrame, "collapsed" );
| |
− | /*
| |
− | * Check if any children are already hidden. This loop is here for backwards compatibility:
| |
− | * the old way of making NavFrames start out collapsed was to manually add style="display:none"
| |
− | * to all the NavPic/NavContent elements. Since this was bad for accessibility (no way to make
| |
− | * the content visible without JavaScript support), the new recommended way is to add the class
| |
− | * "collapsed" to the NavFrame itself, just like with collapsible tables.
| |
− | */
| |
− | for (var NavChild = NavFrame.firstChild; NavChild != null && !isCollapsed; NavChild = NavChild.nextSibling) {
| |
− | if ( hasClass( NavChild, 'NavPic' ) || hasClass( NavChild, 'NavContent' ) ) {
| |
− | if ( NavChild.style.display == 'none' ) {
| |
− | isCollapsed = true;
| |
− | }
| |
− | }
| |
− | }
| |
− | if (isCollapsed) {
| |
− | for (var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling) {
| |
− | if ( hasClass( NavChild, 'NavPic' ) || hasClass( NavChild, 'NavContent' ) ) {
| |
− | NavChild.style.display = 'none';
| |
− | }
| |
− | }
| |
− | }
| |
− | var NavToggleText = document.createTextNode(isCollapsed ? NavigationBarShow : 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 (hasClass(NavFrame.childNodes[j], "NavHead")) {
| |
− | NavFrame.childNodes[j].appendChild(NavToggle);
| |
− | }
| |
− | }
| |
− | NavFrame.setAttribute('id', 'NavFrame' + indexNavigationBar);
| |
− | }
| |
− | }
| |
− | }
| |
− |
| |
− | $(document).ready( createNavigationBarToggleButton );
| |
− |
| |
− | function toggle(div_id) {
| |
− | var menu = document.getElementById(div_id);
| |
− | menu.style.display = (menu.style.display == "none") ? "block" : "none";
| |
− | }
| |
− |
| |
− | importScript('MediaWiki:Common.js/SkinFixes.js');
| |
| | | |
| (function () { | | (function () { |