jQuery(document).ready(function($) {
var customizeToolbar = function() {
$( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', {
'section': 'main',
'group': 'format'
});
$( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', {
'section': 'main',
'group': 'insert'
});
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'main',
'groups': {
'balises': {
'tools': {
'newline': {
'labelMsg': 'wikieditor-toolbar-tool-newline',
'type': 'button',
'oouiIcon': 'newline',
'action': {
'type': 'encapsulate',
'options': {
'pre': '<br>\n'
}
}
},
'kode': {
'label': 'kode',
'type': 'button',
'oouiIcon': 'code',
'action': {
'type': 'encapsulate',
'options': {
'pre': "<kode lang=''>\n",
'post': "\n</kode>"
}
}
},
'filebox': {
'label': 'filebox',
'type': 'button',
'oouiIcon': 'article',
'action': {
'type': 'encapsulate',
'options': {
'pre': "<filebox fn=''>\n",
'post': "\n< /filebox>"
}
}
},
'syntaxhighlight': {
'label': 'syntaxhighlight',
'type': 'button',
'oouiIcon': 'highlight',
'action': {
'type': 'encapsulate',
'options': {
'pre': "<syntaxhighlight lang='' inline>",
'post': "< /syntaxhighlight>"
}
}
},
'pre': {
'label': 'pre',
'type': 'button',
'oouiIcon': 'markup',
'action': {
'type': 'encapsulate',
'options': {
'pre': "<pre>",
'post': "</pre>"
}
}
}
}
},
'templates': {
'tools': {
'boxx': {
'label': 'boxx',
'type': 'button',
'oouiIcon': 'window',
'action': {
'type': 'encapsulate',
'options': {
'pre': "{{boxx|",
'post': "}}"
}
}
},
'info': {
'label': 'info',
'type': 'button',
'oouiIcon': 'notice',
'action': {
'type': 'encapsulate',
'options': {
'pre': "{{info | ",
'post': "}}"
}
}
},
'warn': {
'label': 'warn',
'type': 'button',
'oouiIcon': 'alert',
'action': {
'type': 'encapsulate',
'options': {
'pre': "{{warn | ",
'post': "}}"
}
}
},
'list-plus': {
'label': 'list-plus',
'type': 'button',
'oouiIcon': 'add',
'action': {
'type': 'encapsulate',
'options': {
'pre': "{{ListPlusMinus|type=plus|list=\n",
'post': "\n}}"
}
}
},
'list-minus': {
'label': 'list-minus',
'type': 'button',
'oouiIcon': 'subtract',
'action': {
'type': 'encapsulate',
'options': {
'pre': "{{ListPlusMinus|type=minus|list=\n",
'post': "\n}}"
}
}
}
}
},
'char': {
'tools': {
'->': {
'label': '\u2192',
'type': 'button',
'oouiIcon': 'arrowNext',
'action': {
'type': 'encapsulate',
'options': {
'pre': "\u2192"
}
}
},
'«»': {
'label': "\u00ab\u00bb",
'type': 'button',
'oouiIcon': 'ongoingConversation',
'action': {
'type': 'encapsulate',
'options': {
'pre': "\u00ab ",
'post': " \u00bb"
}
}
}
}
},
'insert': {
'tools': {
'category': {
'label': 'category',
'type': 'button',
'oouiIcon': 'linkExternal',
'action': {
'type': 'encapsulate',
'options': {
'pre': "[[Category:",
'post': "]]"
}
}
},
'image': {
'label': 'image',
'type': 'button',
'oouiIcon': 'imageGallery',
'action': {
'type': 'encapsulate',
'options': {
'pre': "[[File:",
'post': "]]"
}
}
},
'table': {
'labelMsg': 'wikieditor-toolbar-tool-table',
'type': 'button',
'oouiIcon': 'table',
'filters': [ '#wpTextbox1:not(.toolbar-dialogs)' ],
'action': {
'type': 'encapsulate',
'options': {
'pre': "{| class=\"wikitable wtp\" \n",
'peri': '! Titre colonne 1\n! Titre colonne 2\n|-\n| colonne1 || colonne2',
'post': "\n|}",
'ownline': true
}
}
},
nowiki: {
labelMsg: 'wikieditor-toolbar-tool-nowiki',
type: 'button',
oouiIcon: 'noWikiText',
action: {
type: 'encapsulate',
options: {
pre: '<nowiki>',
periMsg: 'wikieditor-toolbar-tool-nowiki-example',
post: '</nowiki>'
}
}
}
}
}
}
} );
};
if ( $.inArray( mw.config.get( 'wgAction' ), [ 'edit', 'submit' ] ) !== -1 ) {
mw.loader.using( 'user.options').then( function () {
if ( mw.user.options.get( 'usebetatoolbar' ) == 1 ) {
$.when(
mw.loader.using( 'ext.wikiEditor' ), $.ready
).then( customizeToolbar );
}
} );
}
});
|