Différences entre versions de « Utilisateur:EvaNeeChance/monobook.js »
De Wiki Dofus
Aller à la navigationAller à la recherche (Page créée avec « /================================================================================ // drop down menus $(function(){ $("div.dropdownmenu ul li").hov... ») |
m |
||
Ligne 1 : | Ligne 1 : | ||
− | /================================================================================ | + | //================================================================================ |
+ | //*** Dynamic Expandable Bars | ||
+ | |||
+ | // set up the words in your language | ||
+ | var ExpandableBarHide = 'Hide'; | ||
+ | var ExpandableBarShow = 'Show'; | ||
+ | |||
+ | |||
+ | // adds show/hide-button to Expandable bars | ||
+ | jQuery( document ).ready(function() { | ||
+ | |||
+ | // shows and hides content and picture (if available) of Expandable bars | ||
+ | // Parameters: | ||
+ | // indexExpandableBar: the index of Expandable bar to be toggled | ||
+ | function toggleExpandableBar(ExpandableToggle, ExpandableFrame) | ||
+ | { | ||
+ | if (!ExpandableFrame || !ExpandableToggle) { | ||
+ | return false; | ||
+ | } | ||
+ | |||
+ | // if shown now | ||
+ | if (ExpandableToggle.firstChild.data == ExpandableBarHide) { | ||
+ | for ( | ||
+ | var ExpandableChild = ExpandableFrame.firstChild; | ||
+ | ExpandableChild != null; | ||
+ | ExpandableChild = ExpandableChild.nextSibling | ||
+ | ) { | ||
+ | if (ExpandableChild.className == 'ExpandablePic') { | ||
+ | ExpandableChild.style.display = 'none'; | ||
+ | } | ||
+ | if (ExpandableChild.className == 'ExpandableContent') { | ||
+ | ExpandableChild.style.display = 'none'; | ||
+ | } | ||
+ | if (ExpandableChild.className == 'ExpandableToggle') { | ||
+ | ExpandableChild.firstChild.data = ExpandableBarShow; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // if hidden now | ||
+ | } else if (ExpandableToggle.firstChild.data == ExpandableBarShow) { | ||
+ | for ( | ||
+ | var ExpandableChild = ExpandableFrame.firstChild; | ||
+ | ExpandableChild != null; | ||
+ | ExpandableChild = ExpandableChild.nextSibling | ||
+ | ) { | ||
+ | if (ExpandableChild.className == 'ExpandablePic') { | ||
+ | ExpandableChild.style.display = 'block'; | ||
+ | } | ||
+ | if (ExpandableChild.className == 'ExpandableContent') { | ||
+ | ExpandableChild.style.display = 'block'; | ||
+ | } | ||
+ | if (ExpandableChild.className == 'ExpandableToggle') { | ||
+ | ExpandableChild.firstChild.data = ExpandableBarHide; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | function toggleExpandableBarFunction(ExpandableToggle, ExpandableFrame) { | ||
+ | return function() { | ||
+ | toggleExpandableBar(ExpandableToggle, ExpandableFrame); | ||
+ | return false; | ||
+ | }; | ||
+ | } | ||
+ | // iterate over all ExpandableFrames | ||
+ | var ExpandableFrames = jQuery( 'div.ExpandableFrame' ); | ||
+ | |||
+ | // if more Expandable Bars found and not template namespace than Default: hide all | ||
+ | var initiallyToggle = true; | ||
+ | for (var i=0; i<ExpandableFrames.length; i++) { | ||
+ | var ExpandableFrame = ExpandableFrames[i]; | ||
+ | var ExpandableToggle = document.createElement("a"); | ||
+ | ExpandableToggle.className = 'ExpandableToggle'; | ||
+ | ExpandableToggle.setAttribute('href', '#'); | ||
+ | |||
+ | var ExpandableToggleText = document.createTextNode(ExpandableBarHide); | ||
+ | ExpandableToggle.appendChild(ExpandableToggleText); | ||
+ | |||
+ | // add ExpandableToggle-Button as first div-element | ||
+ | // in < div class="ExpandableFrame" > | ||
+ | ExpandableFrame.insertBefore(ExpandableToggle, ExpandableFrame.firstChild); | ||
+ | |||
+ | ExpandableToggle.onclick = toggleExpandableBarFunction(ExpandableToggle, ExpandableFrame); | ||
+ | if (initiallyToggle) { | ||
+ | toggleExpandableBar(ExpandableToggle, ExpandableFrame); | ||
+ | } | ||
+ | } | ||
+ | }); | ||
+ | |||
+ | |||
+ | |||
+ | //================================================================================ | ||
// drop down menus | // drop down menus | ||
Version du 20 avril 2013 à 00:01
//================================================================================ //*** Dynamic Expandable Bars // set up the words in your language var ExpandableBarHide = 'Hide'; var ExpandableBarShow = 'Show'; // adds show/hide-button to Expandable bars jQuery( document ).ready(function() { // shows and hides content and picture (if available) of Expandable bars // Parameters: // indexExpandableBar: the index of Expandable bar to be toggled function toggleExpandableBar(ExpandableToggle, ExpandableFrame) { if (!ExpandableFrame || !ExpandableToggle) { return false; } // if shown now if (ExpandableToggle.firstChild.data == ExpandableBarHide) { for ( var ExpandableChild = ExpandableFrame.firstChild; ExpandableChild != null; ExpandableChild = ExpandableChild.nextSibling ) { if (ExpandableChild.className == 'ExpandablePic') { ExpandableChild.style.display = 'none'; } if (ExpandableChild.className == 'ExpandableContent') { ExpandableChild.style.display = 'none'; } if (ExpandableChild.className == 'ExpandableToggle') { ExpandableChild.firstChild.data = ExpandableBarShow; } } // if hidden now } else if (ExpandableToggle.firstChild.data == ExpandableBarShow) { for ( var ExpandableChild = ExpandableFrame.firstChild; ExpandableChild != null; ExpandableChild = ExpandableChild.nextSibling ) { if (ExpandableChild.className == 'ExpandablePic') { ExpandableChild.style.display = 'block'; } if (ExpandableChild.className == 'ExpandableContent') { ExpandableChild.style.display = 'block'; } if (ExpandableChild.className == 'ExpandableToggle') { ExpandableChild.firstChild.data = ExpandableBarHide; } } } } function toggleExpandableBarFunction(ExpandableToggle, ExpandableFrame) { return function() { toggleExpandableBar(ExpandableToggle, ExpandableFrame); return false; }; } // iterate over all ExpandableFrames var ExpandableFrames = jQuery( 'div.ExpandableFrame' ); // if more Expandable Bars found and not template namespace than Default: hide all var initiallyToggle = true; for (var i=0; i<ExpandableFrames.length; i++) { var ExpandableFrame = ExpandableFrames[i]; var ExpandableToggle = document.createElement("a"); ExpandableToggle.className = 'ExpandableToggle'; ExpandableToggle.setAttribute('href', '#'); var ExpandableToggleText = document.createTextNode(ExpandableBarHide); ExpandableToggle.appendChild(ExpandableToggleText); // add ExpandableToggle-Button as first div-element // in < div class="ExpandableFrame" > ExpandableFrame.insertBefore(ExpandableToggle, ExpandableFrame.firstChild); ExpandableToggle.onclick = toggleExpandableBarFunction(ExpandableToggle, ExpandableFrame); if (initiallyToggle) { toggleExpandableBar(ExpandableToggle, ExpandableFrame); } } }); //================================================================================ // drop down menus $(function(){ $("div.dropdownmenu ul li").hover(function(){ $(this).addClass("hover"); $('ul:first',this).css('visibility', 'visible'); }, function(){ $(this).removeClass("hover"); $('ul:first',this).css('visibility', 'hidden'); }); $("div.dropdownmenu ul li ul li:has(ul)").find("a:first").append(" » "); });