Difference between revisions of "MediaWiki:Common.js"
From Awesome Baozam
Line 5: | Line 5: | ||
mw.hook( 'wikipage.content' ).add( function ( $content ) { | mw.hook( 'wikipage.content' ).add( function ( $content ) { | ||
$content.find('.details' ).each( function() { | $content.find('.details' ).each( function() { | ||
− | + | var d = $('<div>').html( $(this).html() ).slideUp( 'fast' ); | |
+ | $(this).html("").append( '<h4>Details <span class="toctoggle">[ <a href=#></a> ]</span></h4>' ).append( d ); | ||
+ | $(this).find( 'h4 a' ); | ||
} ); | } ); | ||
} ); | } ); | ||
}( mediaWiki, jQuery ) ); | }( mediaWiki, jQuery ) ); |
Revision as of 11:25, 6 July 2016
( function ( mw, $ ) { 'use strict'; // Table of contents toggle mw.hook( 'wikipage.content' ).add( function ( $content ) { $content.find('.details' ).each( function() { var d = $('<div>').html( $(this).html() ).slideUp( 'fast' ); $(this).html("").append( '<h4>Details <span class="toctoggle">[ <a href=#></a> ]</span></h4>' ).append( d ); $(this).find( 'h4 a' ); } ); } ); }( mediaWiki, jQuery ) );