MediaWiki:Common.js: Difference between revisions

Jump to navigation Jump to search
Content deleted Content added
imported>Hendrik Brummermann
No edit summary
imported>Hendrik Brummermann
No edit summary
 
(21 intermediate revisions by the same user not shown)
Line 3: Line 3:
// set up the words in your language
// set up the words in your language
var ExpandableBarHide = 'Einklappen';
var ExpandableBarHide = 'Hide';
var ExpandableBarShow = 'Ausklappen';
var ExpandableBarShow = 'Show';
// set up max count of Expandable Bars on page,
// if there are more, all will be hidden
// ExpandableBarShowDefault = 0; // all bars will be hidden
// ExpandableBarShowDefault = 1; // on pages with more than 1 bar all bars will be hidden
// adds show/hide-button to Expandable bars
// adds show/hide-button to Expandable bars
jQuery( document ).ready(function() {
jQuery( document ).ready(function() {
if(!mw.user.options.exists( 'ExpandableBarShowDefault' )){
if (typeof ExpandableBarShowDefault != 'undefined' ) {
mw.user.options.set( 'ExpandableBarShowDefault',ExpandableBarShowDefault)
}
}
// shows and hides content and picture (if available) of Expandable bars
// shows and hides content and picture (if available) of Expandable bars
Line 73: Line 64:
}
}
// iterate over all ExpandableFrames
// iterate over all ExpandableFrames
var ExpandableFrames = mw.util.$content.find( 'div.ExpandableFrame' );
var ExpandableFrames = jQuery( 'div.ExpandableFrame' );
// if more Expandable Bars found and not template namespace than Default: hide all
// if more Expandable Bars found and not template namespace than Default: hide all
var initiallyToggle = true;
var initiallyToggle = mw.user.options.get( 'ExpandableBarShowDefault',1 ) < ExpandableFrames.length && mw.config.get( 'wgNamespaceNumber' ) != 10;
for (var i=0; i<ExpandableFrames.length; i++) {
for (var i=0; i<ExpandableFrames.length; i++) {
var ExpandableFrame = ExpandableFrames[i];
var ExpandableFrame = ExpandableFrames[i];
Line 95: Line 86:
}
}
}
}
});




//================================================================================
// 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(" &raquo; ");
});
});