|
|
| (3 intermediate revisions by the same user not shown) |
| Line 1: |
Line 1: |
| // Twinkle mobile TEST adapter - for personal testing only | | // Twinkle mobile support is now site-wide via the Twinkle gadget (MediaWiki:Gadget-TwinkleMobile.js). This personal test page is no longer needed. |
| | |
| // 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' } );
| |
| } );
| |
| }() );
| |
// Twinkle mobile support is now site-wide via the Twinkle gadget (MediaWiki:Gadget-TwinkleMobile.js). This personal test page is no longer needed.