Differenze tra le versioni di "MediaWiki:Common.js"

Da IBolli Wiki.
 
Riga 1: Riga 1:
/* Il codice JavaScript inserito qui viene caricato da ciascuna pagina, per tutti gli utenti. */
+
var customizeToolbar = function () {
if (mwCustomEditButtons) {
 
 
mwCustomEditButtons[mwCustomEditButtons.length] = {
 
  "imageFile": "https://wiki.ibolli.it/wiki/skins/common/images/Button_category03.png",
 
  "speedTip": "Categoria",
 
  "tagOpen": "[[Categoria: ",
 
  "tagClose": "]]",
 
  "sampleText": ""
 
}
 
mwCustomEditButtons[mwCustomEditButtons.length] = {
 
  "imageFile": "https://wiki.ibolli.it/wiki/skins/common/images/Button_enter.png",
 
  "speedTip": "Br clear",
 
  "tagOpen": "<br clear=\"both\" />",
 
  "tagClose": "",
 
  "sampleText": ""
 
}
 
mwCustomEditButtons[mwCustomEditButtons.length] = {
 
  "imageFile": "https://wiki.ibolli.it/wiki/skins/common/images/Button_insert_table.png",
 
  "speedTip": "Tabella",
 
  "tagOpen": "{|\n!\n|-\n|\n|-",
 
  "tagClose": "\n|}",
 
  "sampleText": ""
 
}
 
mwCustomEditButtons[mwCustomEditButtons.length] = {
 
  "imageFile": "https://wiki.ibolli.it/wiki/skins/common/images/Button_gallery.png",
 
  "speedTip": "Galleria",
 
  "tagOpen": "<gallery>\nImmagine:\nImmagine:\nImmagine:\n",
 
  "tagClose": "</gallery>",
 
  "sampleText": ""
 
}
 
mwCustomEditButtons[mwCustomEditButtons.length] = {
 
  "imageFile": "https://wiki.ibolli.it/wiki/skins/common/images/Button_redirect.png",
 
  "speedTip": "Redirect",
 
  "tagOpen": "#REDIRECT [[",
 
  "tagClose": "]]\n\n__NOAUTOLINK__",
 
  "sampleText": ""
 
}
 
mwCustomEditButtons[mwCustomEditButtons.length] = {
 
  "imageFile": "https://wiki.ibolli.it/wiki/skins/common/images/Button_advanced_image.png",
 
  "speedTip": "IMG thumb left inline",
 
  "tagOpen": "[[Immagine:",
 
  "tagClose": "|none|thumb|800px]]",
 
  "sampleText": ""
 
}
 
mwCustomEditButtons[mwCustomEditButtons.length] = {
 
  "imageFile": "https://wiki.ibolli.it/wiki/skins/common/images/Button_advanced_image.png",
 
  "speedTip": "IMG thumb right",
 
  "tagOpen": "[[Immagine:",
 
  "tagClose": "|thumb|300px]]",
 
  "sampleText": ""
 
}
 
mwCustomEditButtons[mwCustomEditButtons.length] = {
 
  "imageFile": "https://wiki.ibolli.it/wiki/skins/common/images/Button_disambig_small.png",
 
  "speedTip": "Disambigua",
 
  "tagOpen": "\{\{Nota disambigua|descrizione=altri significati di ''",
 
  "tagClose": "''|titolo=[[ (disambigua)]]\}\}",
 
  "sampleText": ""
 
}
 
mwCustomEditButtons[mwCustomEditButtons.length] = {
 
  "imageFile": "https://wiki.ibolli.it/wiki/skins/common/images/Button_smiley_face_smile.png",
 
  "speedTip": "Icona",
 
  "tagOpen": "\{\{#icon: ",
 
  "tagClose": "|alt|80|link\}\}",
 
  "sampleText": ""
 
}
 
mwCustomEditButtons[mwCustomEditButtons.length] = {
 
  "imageFile": "https://wiki.ibolli.it/wiki/skins/common/images/Button_blockquote.png",
 
  "speedTip": "Blockquote",
 
  "tagOpen": "<blockquote><i>\n",
 
  "tagClose": "\n</i></blockquote>",
 
  "sampleText": ""
 
}
 
mwCustomEditButtons[mwCustomEditButtons.length] = {
 
  "imageFile": "https://wiki.ibolli.it/wiki/skins/common/images/Button_plantilla.png",
 
  "speedTip": "Template",
 
  "tagOpen": "\{\{",
 
  "tagClose": "\}\}",
 
  "sampleText": ""
 
}
 
mwCustomEditButtons[mwCustomEditButtons.length] = {
 
  "imageFile": "https://wiki.ibolli.it/wiki/skins/common/images/Button_plantilla2.png",
 
  "speedTip": "Triple",
 
  "tagOpen": "\{\{\{",
 
  "tagClose": "\}\}\}",
 
  "sampleText": ""
 
}
 
mwCustomEditButtons[mwCustomEditButtons.length] = {
 
  "imageFile": "https://wiki.ibolli.it/wiki/skins/common/images/Button_category03.png",
 
  "speedTip": "Categoria",
 
  "tagOpen": "[[Categoria: ",
 
  "tagClose": "]]\n\n[[Categoria: da finire]]\n[[Categoria: todo immagini]]",
 
  "sampleText": ""
 
}
 
  
 +
    'action': {
 +
        'type': 'encapsulate',
 +
            'options': {
 +
                'pre': "'''",
 +
                'periMsg': 'wikieditor-toolbar-tool-bold-example',
 +
                'post': "'''"
 +
            }
 +
        }
 +
    }
 +
 +
      action: {
 +
          type: 'callback',
 +
                execute: function(context){
 +
                      indentSelection();
 +
                }
 +
      }
 +
 +
 +
};
 +
 +
/* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar … */
 +
if ( $.inArray( mw.config.get( 'wgAction' ), [ 'edit', 'submit' ] ) !== -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 );
 +
}
 +
} );
 
}
 
}

Versione delle 13:06, 22 nov 2018

var customizeToolbar = function () {

    'action': {
        'type': 'encapsulate',
            'options': {
                'pre': "'''",
                'periMsg': 'wikieditor-toolbar-tool-bold-example',
                'post': "'''"
            }
        }
    }

      action: {
           type: 'callback',
                execute: function(context){
                       indentSelection();
                }
      }


};

/* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar … */
if ( $.inArray( mw.config.get( 'wgAction' ), [ 'edit', 'submit' ] ) !== -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 );
		}
	} );
}