MediaWiki:Common.js: Unterschied zwischen den Versionen

Aus Die Offene Bibel

Wechseln zu: Navigation, Suche
Zeile 1: Zeile 1:
if (typeof $.fn.wikiEditor != 'undefined') {
+
var customizeToolbar = function () {
 
   var $box = $('#wpTextbox1');
 
   var $box = $('#wpTextbox1');
 
   $box.wikiEditor( 'removeFromToolbar', {
 
   $box.wikiEditor( 'removeFromToolbar', {
Zeile 41: Zeile 41:
 
     'page': 'canadianaboriginal',
 
     'page': 'canadianaboriginal',
 
   });
 
   });
 +
};
  
 +
/* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar … */
 +
if ( [ 'edit', 'submit' ].indexOf( mw.config.get( 'wgAction' ) ) !== -1 ) {
 +
mw.loader.using( 'user.options' ).then( function () {
 +
// This can be the string "0" if the user disabled the preference ([[phab:T54542#555387]])
 +
if ( mw.user.options.get( 'usebetatoolbar' ) == 1 ) {
 +
$.when(
 +
mw.loader.using( 'ext.wikiEditor' ), $.ready
 +
).then( customizeToolbar );
 +
}
 +
} );
 
}
 
}

Version vom 9. November 2020, 01:38 Uhr

var customizeToolbar = function () {
  var $box = $('#wpTextbox1');
  $box.wikiEditor( 'removeFromToolbar', {
    'section': 'characters',
    'page': 'bangla',
    });
  $box.wikiEditor( 'removeFromToolbar', {
    'section': 'characters',
    'page': 'tamil',
  });
  $box.wikiEditor( 'removeFromToolbar', {
    'section': 'characters',
    'page': 'telugu',
  });
  $box.wikiEditor( 'removeFromToolbar', {
    'section': 'characters',
    'page': 'sinhala',
  });
  $box.wikiEditor( 'removeFromToolbar', {
    'section': 'characters',
    'page': 'devanagari',
  });
  $box.wikiEditor( 'removeFromToolbar', {
    'section': 'characters',
    'page': 'gujarati',
  });
  $box.wikiEditor( 'removeFromToolbar', {
    'section': 'characters',
    'page': 'thai',
  });
  $box.wikiEditor( 'removeFromToolbar', {
    'section': 'characters',
    'page': 'lao',
  });
  $box.wikiEditor( 'removeFromToolbar', {
    'section': 'characters',
    'page': 'khmer',
  });
  $box.wikiEditor( 'removeFromToolbar', {
    'section': 'characters',
    'page': 'canadianaboriginal',
  });
};

/* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar … */
if ( [ 'edit', 'submit' ].indexOf( mw.config.get( 'wgAction' ) ) !== -1 ) {
	mw.loader.using( 'user.options' ).then( function () {
		// This can be the string "0" if the user disabled the preference ([[phab:T54542#555387]])
		if ( mw.user.options.get( 'usebetatoolbar' ) == 1 ) {
			$.when(
				mw.loader.using( 'ext.wikiEditor' ), $.ready
			).then( customizeToolbar );
		}
	} );
}