MediaWiki:Mobile.js: Difference between revisions

Content deleted Content added
No edit summary
Tags: Mobile edit Mobile web edit
No edit summary
 
Line 1:
/* Any JavaScript here will be loaded for users using the mobile site */
 
console.log('Running from Mobile.js');
mw.hook('wikipage.content').add(function() {
Line 11 ⟶ 12:
// This is a spinoff from Factotum. (https://en.wikipedia.org/wiki/User:Alexis_Jazz/Factotum)
// MakeMobileCollapsible is public domain, irrevocably released as WTFPL Version 2[www.wtfpl.net/about/] by its author, Alexis Jazz.
/*/ globals $:false,mw:false*/
//<nowiki>
/*
let MMCollap = {};
MMCollap.do = function( $content ) {
console.log('MMCollap.do was called');
/*/ OutcommentedCommented out for now, to be revisited later as some people raised potential concerns with providing mobile-only features:
// Allow content to be collapsible only on the mobile site which could be useful as mobile displays are smaller, so the threshold to wish to make something collapsible could be greater
// to achieve this, change "mw-" to "MMC-" in all classes used. Do NOT use custom toggles as they won't be hidden on the desktop site.
// classes = ['collapsible','collapsed','collapsible-toggle','collapsible-content','collapsible-toggle-placeholder','collapsible-toggle-expanded'];
// if ( $('.MMC-collapsible,.MMC-collapsed')[0] ) {
// for(int=0;int<classes.length;int++){
// $('.MMC-'+classes[int]).addClass('mw-'+classes[int]);
// }
}*// }
MMCollap.modules = [];
MMCollap.els = $content.find( '.mw-collapsible' );
Line 45 ⟶ 47:
mw.hook( 'wikipage.content' ).add( MMCollap.do ); //make collapsible content collapsible whenever the page is rendered, on load but also e.g. after saving an edit
//</nowiki>
*/