MediaWiki:Common.js: Difference between revisions
No edit summary |
No edit summary |
||
| Line 2: | Line 2: | ||
mw.hook( 'wikipage.content' ).add( function ( $content ) { | mw.hook( 'wikipage.content' ).add( function ( $content ) { | ||
$content.find( '.commentary-toggle' ).on( 'click', function () { | $content.find( '.commentary-toggle' ).on( 'click', function () { | ||
var | var verseId = $( this ).attr( 'data-verse' ); | ||
var $ | var $block = $( '#' + CSS.escape( verseId ) ); | ||
var $bodies = $block.find( '.commentary-body' ); | |||
var isHidden = $bodies.first().hasClass( 'commentary-hidden' ); | |||
$bodies.toggleClass( 'commentary-hidden', !isHidden ); | |||
$( this ).toggleClass( 'commentary-toggle-active', isHidden ); | |||
} ); | } ); | ||
} ); | } ); | ||