MediaWiki:Common.js: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
sblocco
v. https://it.wikiquote.org/wiki/Wikiquote:Bar/Archivio_2023-01--05#Template:Int,_parametro_h
Etichetta: Annullato
Riga 97:
 
$( document ).ready( headersClass );
/**
 
* Mobile collapsible fixed.
* This snippet fixes headings with links.
* So, the first time you click on the heading, it does not visit the link,
* but it opens the collapsible instead.
* @author [[User:Valerio_Bozzolan]]
* @licese CC BY-SA 4.0 or GNU GPL v2+ at your opinion.
*/
$(function() {
// Match links from mobile headings
$('h2.collapsible-heading a').click(function(e) {
// Do not visit the link if the block is closed.
// Since the user may just want to open the collapsible.
var $linkInHeading = $(this);
var $heading = $linkInHeading.closest( 'h1,h2' );
if( !$heading.hasClass('open-block') ) {
// Don't visit the link
e.preventDefault();
// Open the collapsible instead.
$heading.click();
}
});
});
// Altro in MediaWiki:Gadget-site.js!