MediaWiki:Common.js: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
K (x) |
K (update) |
||
(7 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt) | |||
Zeile 1: | Zeile 1: | ||
var customizeToolbar = function() { /* Your code goes here */$('#wpTextbox1').wikiEditor('addToToolbar', { | |||
var | |||
$('#wpTextbox1').wikiEditor('addToToolbar', { | |||
section: 'advanced', | section: 'advanced', | ||
group: 'format', | group: 'format', | ||
Zeile 16: | Zeile 6: | ||
label: 'Highlight SourceCode', | label: 'Highlight SourceCode', | ||
type: 'button', | type: 'button', | ||
icon: 'skins/common/images/ | icon: '/skins/common/images/button_code.png', | ||
action: { | action: { | ||
type: 'encapsulate', | type: 'encapsulate', | ||
options: { | options: { | ||
pre: "< | pre: "<syntaxhighlight lang=\"php\">", | ||
peri: "<?php\n\n?>", | peri: "<?php\n\n?>", | ||
post: "</ | post: "</syntaxhighlight>" | ||
} | } | ||
} | } | ||
Zeile 28: | Zeile 18: | ||
} | } | ||
}); | }); | ||
}; | |||
/* 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 ); | |||
} ); | |||
} | |||
} | |||
);} |
Aktuelle Version vom 30. August 2014, 21:55 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_code.png',
9 action: {
10 type: 'encapsulate',
11 options: {
12 pre: "<syntaxhighlight lang=\"php\">",
13 peri: "<?php\n\n?>",
14 post: "</syntaxhighlight>"
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 );}