Twinkle mobile test adapter v2: relocate menu into Minerva overflow |
No edit summary |
||
| Line 1: | Line 1: | ||
// Twinkle mobile TEST adapter | // Twinkle mobile TEST adapter - for personal testing only | ||
// | |||
// | // Location: User:Bharatwiki Socrates/minerva.js (runs only on the Minerva skin) | ||
// | |||
// Purpose: Without modifying the gadget definitions, load Twinkle's raw files on | |||
// | |||
// mobile to test whether the menus and dialogs work in Minerva. | |||
// | // Once the test passes, this file will be removed, and the actual fix will be made | ||
// through the gadget definitions and a small mobile CSS gadget. | |||
( function () { | ( function () { | ||
| Line 34: | Line 36: | ||
} | } | ||
// Mobile par dialog screen ke andar rahe, iske liye CSS fitting | |||
mw.util.addCSS( | mw.util.addCSS( | ||
'.ui-dialog { max-width: 96vw !important; left: 2vw !important; }' + | '.ui-dialog { max-width: 96vw !important; left: 2vw !important; }' + | ||
| Line 39: | Line 42: | ||
'.morebits-dialog-content { overflow-x: auto; }' + | '.morebits-dialog-content { overflow-x: auto; }' + | ||
'.select2-container { max-width: 90vw; }' + | '.select2-container { max-width: 90vw; }' + | ||
'#twinkle | '#p-twinkle, .twinkle-menu { font-size: 100%; }' | ||
); | ); | ||
rawCss( 'MediaWiki:Gadget-Twinkle.css' ); | rawCss( 'MediaWiki:Gadget-Twinkle.css' ); | ||
rawCss( 'MediaWiki:Gadget-morebits.css' ); | rawCss( 'MediaWiki:Gadget-morebits.css' ); | ||
rawCss( 'MediaWiki:Gadget-select2.min.css' ); | rawCss( 'MediaWiki:Gadget-select2.min.css' ); | ||
mw.loader.using( [ | mw.loader.using( [ | ||
| Line 132: | Line 58: | ||
return loadScript( 'MediaWiki:Gadget-Twinkle.js' ); | return loadScript( 'MediaWiki:Gadget-Twinkle.js' ); | ||
} ).then( function () { | } ).then( function () { | ||
mw.notify( 'Twinkle mobile test load ho gaya', { type: 'info' } ); | |||
} ).catch( function ( err ) { | } ).catch( function ( err ) { | ||
mw.notify( 'Twinkle mobile test load FAIL: ' + err, | mw.notify( 'Twinkle mobile test load FAIL: ' + err, { type: 'error' } ); | ||
} ); | } ); | ||
}() ); | }() ); | ||
Revision as of 04:48, 1 November 2026
// Twinkle mobile TEST adapter - for personal testing only
// Location: User:Bharatwiki Socrates/minerva.js (runs only on the Minerva skin)
// Purpose: Without modifying the gadget definitions, load Twinkle's raw files on
// mobile to test whether the menus and dialogs work in Minerva.
// Once the test passes, this file will be removed, and the actual fix will be made
// through the gadget definitions and a small mobile CSS gadget.
( function () {
if ( mw.config.get( 'skin' ) !== 'minerva' ) {
return;
}
if ( window.twinkleMobileTestLoaded ) {
return;
}
window.twinkleMobileTestLoaded = true;
var indexPhp = mw.util.wikiScript( 'index' );
function rawUrl( title ) {
return indexPhp + '?title=' + encodeURIComponent( title ) +
'&action=raw&ctype=text/javascript';
}
function rawCss( title ) {
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.href = indexPhp + '?title=' + encodeURIComponent( title ) +
'&action=raw&ctype=text/css';
document.head.appendChild( link );
}
function loadScript( title ) {
return $.getScript( rawUrl( title ) );
}
// Mobile par dialog screen ke andar rahe, iske liye CSS fitting
mw.util.addCSS(
'.ui-dialog { max-width: 96vw !important; left: 2vw !important; }' +
'.morebits-dialog { max-width: 96vw !important; }' +
'.morebits-dialog-content { overflow-x: auto; }' +
'.select2-container { max-width: 90vw; }' +
'#p-twinkle, .twinkle-menu { font-size: 100%; }'
);
rawCss( 'MediaWiki:Gadget-Twinkle.css' );
rawCss( 'MediaWiki:Gadget-morebits.css' );
rawCss( 'MediaWiki:Gadget-select2.min.css' );
mw.loader.using( [
'mediawiki.util', 'mediawiki.api', 'mediawiki.storage',
'mediawiki.Title', 'mediawiki.user', 'jquery.ui'
] ).then( function () {
return loadScript( 'MediaWiki:Gadget-select2.min.js' );
} ).then( function () {
return loadScript( 'MediaWiki:Gadget-morebits.js' );
} ).then( function () {
return loadScript( 'MediaWiki:Gadget-Twinkle.js' );
} ).then( function () {
mw.notify( 'Twinkle mobile test load ho gaya', { type: 'info' } );
} ).catch( function ( err ) {
mw.notify( 'Twinkle mobile test load FAIL: ' + err, { type: 'error' } );
} );
}() );