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

Da IBolli Wiki.
(16 versioni intermedie di uno stesso utente non sono mostrate)
Riga 1: Riga 1:
var customizeToolbar = function () {
+
/* google analytics è caricato in localsettings, tramite estensione headscript */
    'action': {
+
 
        'type': 'encapsulate',
+
/* custom buttons in edit*/
            'options': {
+
var customizeToolbar = function (){
                'pre': "'''",
+
  $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
                 'periMsg': 'wikieditor-toolbar-tool-bold-example',
+
'sections': {
                 'post': "'''"
+
'custom': {
             }
+
'type': 'toolbar', // Can also be 'booklet'
 +
'label': 'Custom'
 +
// or 'labelMsg': 'section-emoticons-label' for a localized label
 +
}
 +
}
 +
  });
 +
  $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
 +
'section': 'custom',
 +
'groups': {
 +
'format': {
 +
'label': 'Formato' // or use labelMsg for a localized label, see above
 +
}
 +
}
 +
  });
 +
 
 +
 
 +
    $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
 +
        section: 'custom',
 +
        group: 'format',
 +
        tools: {
 +
            buttonId: {
 +
                label: 'Categoria',
 +
                 type: 'button',
 +
                icon: '//upload.wikimedia.org/wikipedia/commons/f/f9/Toolbaricon_regular_S_stroke.png',
 +
                 action: {
 +
                    type: 'encapsulate',
 +
                    options: {
 +
                        pre: '[[Categoria: ',
 +
                        peri: 'Inserisci nome di categoria qui',
 +
                        post: ']]'
 +
                    }
 +
                }
 +
             },
 
         }
 
         }
     }
+
     } );
 +
 
 +
    $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
 +
        section: 'custom',
 +
        group: 'format',
 +
        tools: {
 +
            buttonId: {
 +
                label: 'Tabella',
 +
                type: 'button',
 +
                icon: '//upload.wikimedia.org/wikipedia/commons/f/f9/Toolbaricon_regular_S_stroke.png',
 +
                action: {
 +
                    type: 'encapsulate',
 +
                    options: {
 +
                        pre: '{|\n!\n|-\n|\n|-',
 +
                        peri: 'Inserisci nome di categoria qui',
 +
                        post: '\n|}'
 +
                    }
 +
                }
 +
            },
 +
        }
 +
    } );
 +
 
 +
    $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
 +
        section: 'custom',
 +
        group: 'format',
 +
        tools: {
 +
            buttonId: {
 +
                label: 'Gallery',
 +
                type: 'button',
 +
                icon: '//upload.wikimedia.org/wikipedia/commons/f/f9/Toolbaricon_regular_S_stroke.png',
 +
                action: {
 +
                    type: 'encapsulate',
 +
                    options: {
 +
                        pre: '{|\n!\n|-\n|\n|-',
 +
                        peri: '<gallery>\nImmagine:\nImmagine:\nImmagine:\n',
 +
                        post: '</gallery>'
 +
                    }
 +
                }
 +
            },
 +
        }
 +
    } );
 +
 
 
};
 
};
  

Versione delle 10:01, 19 dic 2019

/* google analytics è caricato in localsettings, tramite estensione headscript */

/* custom buttons in edit*/
var customizeToolbar = function (){
   $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	'sections': {
		'custom': {
			'type': 'toolbar', // Can also be 'booklet'
			'label': 'Custom'
			// or 'labelMsg': 'section-emoticons-label' for a localized label
		}
	}
   });
   $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	'section': 'custom',
	'groups': {
		'format': {
			'label': 'Formato' // or use labelMsg for a localized label, see above
		}
	}
   });


    $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        section: 'custom',
        group: 'format',
        tools: {
            buttonId: {
                label: 'Categoria',
                type: 'button',
                icon: '//upload.wikimedia.org/wikipedia/commons/f/f9/Toolbaricon_regular_S_stroke.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: '[[Categoria: ',
                        peri: 'Inserisci nome di categoria qui',
                        post: ']]'
                    }
                }
            },
        }
    } );

    $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        section: 'custom',
        group: 'format',
        tools: {
            buttonId: {
                label: 'Tabella',
                type: 'button',
                icon: '//upload.wikimedia.org/wikipedia/commons/f/f9/Toolbaricon_regular_S_stroke.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: '{|\n!\n|-\n|\n|-',
                        peri: 'Inserisci nome di categoria qui',
                        post: '\n|}'
                    }
                }
            },
        }
    } );

    $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        section: 'custom',
        group: 'format',
        tools: {
            buttonId: {
                label: 'Gallery',
                type: 'button',
                icon: '//upload.wikimedia.org/wikipedia/commons/f/f9/Toolbaricon_regular_S_stroke.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: '{|\n!\n|-\n|\n|-',
                        peri: '<gallery>\nImmagine:\nImmagine:\nImmagine:\n',
                        post: '</gallery>'
                    }
                }
            },
        }
    } );

};

/* 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 );
		}
	} );
}