MediaWiki:Common.js: Unterschied zwischen den Versionen

Aus crazylinux.de
Zur Navigation springen Zur Suche springen
K (x)
K (x)
Zeile 16: Zeile 16:
                                 label: 'Highlight SourceCode',
                                 label: 'Highlight SourceCode',
                                 type: 'button',
                                 type: 'button',
                                 icon: 'skins/common/images/button_image.png',
                                 icon: '/skins/common/images/button_image.png',
                                 action: {
                                 action: {
                                         type: 'encapsulate',
                                         type: 'encapsulate',
Zeile 28: Zeile 28:
                 }
                 }
});
});
}; /* 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', function () {               if ( mw.user.options.get('usebetatoolbar') ) {                       mw.loader.using( 'ext.wikiEditor.toolbar', function () {                               $(document).ready( customizeToolbar );                       } );               }       } );}
}; /* 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', function () {
                if ( mw.user.options.get('usebetatoolbar') ) {
                        mw.loader.using( 'ext.wikiEditor.toolbar', function () {
                                $(document).ready( customizeToolbar );
                        } );
                }
        }
);}

Version vom 18. Mai 2013, 02:24 Uhr

 1 /* Jedes JavaScript hier wird für alle Benutzer für jede Seite geladen. 
 2 var button = {
 3         "imageFile": "skins/common/images/button_image.png",  //image to be shown on the button (may be a full URL too), 22x22 pixels
 4         "speedTip": "Highlight SourceCode",    //text shown in a tooltip when hovering the mouse over the button
 5         "tagOpen": "<source lang=\"php\">",        //the text to use to mark the beginning of the block
 6         "tagClose": "</source>",      //the text to use to mark the end of the block (if any)
 7         "sampleText": "<?php\n\n?>"   //the sample text to place inside the block
 8 };
 9 mwCustomEditButtons.push(button);*/
10 
11 var customizeToolbar = function() {        /* Your code goes here */$('#wpTextbox1').wikiEditor('addToToolbar', {
12                 section: 'advanced',
13                 group: 'format',
14                 tools: {
15                         buttonId: {
16                                 label: 'Highlight SourceCode',
17                                 type: 'button',
18                                 icon: '/skins/common/images/button_image.png',
19                                 action: {
20                                         type: 'encapsulate',
21                                         options: {
22                                                 pre: "<source lang=\"php\">",
23                                                 peri: "<?php\n\n?>",
24                                                 post: "</source>"
25                                         }
26                                 }
27                         }
28                 }
29 });
30 }; /* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar . . . */
31 if ( $.inArray( mw.config.get( 'wgAction' ), ['edit', 'submit'] ) !== -1 ) {
32         mw.loader.using( 'user.options', function () {
33                 if ( mw.user.options.get('usebetatoolbar') ) {
34                         mw.loader.using( 'ext.wikiEditor.toolbar', function () {
35                                 $(document).ready( customizeToolbar );
36                         } );
37                 }
38         }
39 );}