Benutzer: HIWI/common.js: Unterschied zwischen den Versionen
Aus Joachim Camerarius (1500-1574)
HIWI (Diskussion | Beiträge) (Die Seite wurde neu angelegt: „let customizeToolbar = function () { $('#wpTextbox1').wikiEditor('addToToolbar', { //Create new toolbar section Camerarius which is itself a toolbar…“) |
HIWI (Diskussion | Beiträge) Keine Bearbeitungszusammenfassung |
||
Zeile 11: | Zeile 11: | ||
'tools': { | 'tools': { | ||
//Create the button parts | //Create the button parts | ||
'LOL': { | |||
'label': 'LOL', | |||
'type': 'button', | |||
'icon': { | |||
'default': 'format-bold-B.png', | |||
'en': 'format-bold-B.png', | |||
'de': 'format-bold-B.png' | |||
}, | |||
'action': { | |||
'type': 'encapsulate', | |||
'options': { | |||
'pre': 'LOL', | |||
} | |||
} | |||
'Beschreibungen': { | 'Beschreibungen': { | ||
'label': 'Beschreibungen', | 'label': 'Beschreibungen', |
Version vom 16. Februar 2023, 20:01 Uhr
let customizeToolbar = function () { $('#wpTextbox1').wikiEditor('addToToolbar', { //Create new toolbar section Camerarius which is itself a toolbar sections: { camerarius: { type: 'toolbar', label: 'Camerarius-Attribute', //Create dropdown part of the toolbar 'groups': { 'format': { 'tools': { //Create the button parts 'LOL': { 'label': 'LOL', 'type': 'button', 'icon': { 'default': 'format-bold-B.png', 'en': 'format-bold-B.png', 'de': 'format-bold-B.png' }, 'action': { 'type': 'encapsulate', 'options': { 'pre': 'LOL', } } 'Beschreibungen': { 'label': 'Beschreibungen', 'type': 'button', 'icon': { 'default': 'format-bold-B.png', 'en': 'format-bold-B.png', 'de': 'format-bold-B.png' }, 'action': { 'type': 'encapsulate', 'options': { 'pre': "{{Beschreibungen|", 'periMsg': 'Seitenname', 'post': "}}" } } }, 'MBW': { 'label': 'MBW', 'type': 'button', 'icon': { 'default': 'https://upload.wikimedia.org/wikipedia/commons/5/54/Mbutton.png', 'en': 'https://upload.wikimedia.org/wikipedia/commons/5/54/Mbutton.png', 'de': 'https://upload.wikimedia.org/wikipedia/commons/5/54/Mbutton.png' }, 'action': { 'type': 'encapsulate', 'options': { 'pre': "[https://www.hadw-bw.de/forschung/forschungsstelle/melanchthon-briefwechsel-mbw/mbw-regest?rn=1 MBW - Regesten online], Nr. ", 'periMsg': 'Regestnr.' } } }, 'Link': { 'label': 'Verlinkung', 'type': 'button', 'icon': { 'default': 'insert-ilink.png', 'en': 'insert-ilink.png', 'de': 'insert-ilink.png' }, 'action': { 'type': 'encapsulate', 'options': { 'pre': "[[", 'periMsg': 'Text', 'post': "]]" } } }, 'Binnenverweis': { 'label': 'Binnenverweis auf Lexikonseiten', 'type': 'button', 'icon': { 'default': 'https://upload.wikimedia.org/wikipedia/commons/1/13/Vector_toolbar_redirect_button.png', 'en': 'https://upload.wikimedia.org/wikipedia/commons/1/13/Vector_toolbar_redirect_button.png', 'de': 'https://upload.wikimedia.org/wikipedia/commons/1/13/Vector_toolbar_redirect_button.png' }, 'action': { 'type': 'encapsulate', 'options': { 'pre': '[[', 'periMsg': 'Lexikonseite#Kapitelname unformatiert|Kapitelname', 'post': "]]" } } } } } } } } }); }; /* 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' ).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.toolbar' ), $.ready ).then( customizeToolbar ); } } ); }