MediaWiki:Common.js: Unterschied zwischen den Versionen

Aus crazylinux.de
Zur Navigation springen Zur Suche springen
K (x)
K (x)
Zeile 1: Zeile 1:
/* Jedes JavaScript hier wird für alle Benutzer für jede Seite geladen.
var button = {
        "imageFile": "skins/common/images/button_image.png",  //image to be shown on the button (may be a full URL too), 22x22 pixels
        "speedTip": "Highlight SourceCode",    //text shown in a tooltip when hovering the mouse over the button
        "tagOpen": "<source lang=\"php\">",        //the text to use to mark the beginning of the block
        "tagClose": "</source>",      //the text to use to mark the end of the block (if any)
        "sampleText": "<?php\n\n?>"  //the sample text to place inside the block
};
mwCustomEditButtons.push(button);*/
var customizeToolbar = function() {        /* Your code goes here */$('#wpTextbox1').wikiEditor('addToToolbar', {
var customizeToolbar = function() {        /* Your code goes here */$('#wpTextbox1').wikiEditor('addToToolbar', {
                 section: 'advanced',
                 section: 'advanced',
Zeile 28: Zeile 18:
                 }
                 }
});
});
}; /* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar . . . */
};  
 
/* 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 ) {
if ( $.inArray( mw.config.get( 'wgAction' ), ['edit', 'submit'] ) !== -1 ) {
         mw.loader.using( 'user.options', function () {
         mw.loader.using( 'user.options', function () {

Version vom 18. Mai 2013, 02:49 Uhr

 1 var customizeToolbar = function() {        /* Your code goes here */$('#wpTextbox1').wikiEditor('addToToolbar', {
 2                 section: 'advanced',
 3                 group: 'format',
 4                 tools: {
 5                         buttonId: {
 6                                 label: 'Highlight SourceCode',
 7                                 type: 'button',
 8                                 icon: '/skins/common/images/button_image.png',
 9                                 action: {
10                                         type: 'encapsulate',
11                                         options: {
12                                                 pre: "<source lang=\"php\">",
13                                                 peri: "<?php\n\n?>",
14                                                 post: "</source>"
15                                         }
16                                 }
17                         }
18                 }
19 });
20 }; 
21 
22 /* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar . . . */
23 if ( $.inArray( mw.config.get( 'wgAction' ), ['edit', 'submit'] ) !== -1 ) {
24         mw.loader.using( 'user.options', function () {
25                 if ( mw.user.options.get('usebetatoolbar') ) {
26                         mw.loader.using( 'ext.wikiEditor.toolbar', function () {
27                                 $(document).ready( customizeToolbar );
28                         } );
29                 }
30         }
31 );}