MediaWiki:Common.js: Porovnání verzí

Z Gewiki
Bez shrnutí editace
Bez shrnutí editace
Řádek 3: Řádek 3:
// install [[Wikipedia:User:Cacycle/wikEd]] in-browser text editor
// install [[Wikipedia:User:Cacycle/wikEd]] in-browser text editor
//importScriptURI('resources/wikEd.js');
//importScriptURI('resources/wikEd.js');
 
var customizeToolbar = function() {
console.log("Common.js launched");
if ( mw.toolbar ) {
if ( mw.toolbar ) {
  console.log("if works");
     mw.toolbar.addButton( {
     mw.toolbar.addButton( {
         imageFile: '//upload.wikimedia.org/wikipedia/en/3/34/Button_hide_comment.png',
         imageFile: '//upload.wikimedia.org/wikipedia/en/3/34/Button_hide_comment.png',
Řádek 16: Řádek 14:
     } );
     } );
}
}
};
/* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar … */
if ( mw.toolbar ) {
mw.loader.using( 'user.options', 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.toolbar' ), $.ready
).then( customizeToolbar );
}
} );
}
// Add the customizations to LiquidThreads' edit toolbar, if available
mw.hook( 'ext.lqt.textareaCreated' ).add( customizeToolbar );

Verze z 31. 1. 2015, 11:35

/* Zde uvedený JavaScript bude použit pro všechny uživatele při načtení každé stránky. */

// install [[Wikipedia:User:Cacycle/wikEd]] in-browser text editor
//importScriptURI('resources/wikEd.js');
var customizeToolbar = function() {
if ( mw.toolbar ) {
    mw.toolbar.addButton( {
        imageFile: '//upload.wikimedia.org/wikipedia/en/3/34/Button_hide_comment.png',
        speedTip: 'Comment visible only for editors',
        tagOpen: '<!-- ',
        tagClose: ' -->',
        sampleText: 'Insert comment here',
        imageId: 'button-comment'
    } );
}
};
 
/* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar … */
if ( mw.toolbar ) {
	mw.loader.using( 'user.options', 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.toolbar' ), $.ready
			).then( customizeToolbar );
		}
	} );
}
// Add the customizations to LiquidThreads' edit toolbar, if available
mw.hook( 'ext.lqt.textareaCreated' ).add( customizeToolbar );