提供: Minecraft Modding Wiki
Defeatedcrow (トーク | 投稿記録) |
Defeatedcrow (トーク | 投稿記録) |
||
(同じ利用者による、間の1版が非表示) | |||
14行目: | 14行目: | ||
type: 'encapsulate', | type: 'encapsulate', | ||
options: { | options: { | ||
− | pre: '< | + | pre: '<syntaxhighlight lang="java">', |
peri: 'Insert code here', | peri: 'Insert code here', | ||
− | post: '</ | + | post: '</syntaxhighlight>' |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
} | } | ||
} | } | ||
118行目: | 99行目: | ||
/* 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 … */ | ||
− | + | mw.loader.using( 'user.options', 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 ); | |
− | + | } | |
− | + | } ); | |
− | + | ||
− | |||
// Add the customizations to LiquidThreads' edit toolbar, if available | // Add the customizations to LiquidThreads' edit toolbar, if available | ||
mw.hook( 'ext.lqt.textareaCreated' ).add( customizeToolbar ); | mw.hook( 'ext.lqt.textareaCreated' ).add( customizeToolbar ); | ||
} ); | } ); |
2018年8月23日 (木) 22:33時点における最新版
jQuery( document ).ready( function ( $ ) { $( 'div#edittoolbar' ).wikiEditor(); var customizeToolbar = function() { $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { section: 'advanced', group: 'format', tools: { buttonId: { label: 'source code', type: 'button', icon: '//defeatedcrow.jp/modwiki/extensions/WikiEditor/modules/images/toolbar/code-java.png', action: { type: 'encapsulate', options: { pre: '<syntaxhighlight lang="java">', peri: 'Insert code here', post: '</syntaxhighlight>' } } } } } ); $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { section: 'advanced', group: 'format', tools: { buttonId: { label: 'red', type: 'button', icon: '//defeatedcrow.jp/modwiki/extensions/WikiEditor/modules/images/toolbar/color-red.png', action: { type: 'encapsulate', options: { pre: '<span style="color: red">', peri: 'Insert text', post: '</span>' } } } } } ); $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { section: 'advanced', group: 'format', tools: { buttonId: { label: 'blue', type: 'button', icon: '//defeatedcrow.jp/modwiki/extensions/WikiEditor/modules/images/toolbar/color-blue.png', action: { type: 'encapsulate', options: { pre: '<span style="color: blue">', peri: 'Insert text', post: '</span>' } } } } } ); $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { section: 'advanced', group: 'format', tools: { buttonId: { label: 'del', type: 'button', icon: '//defeatedcrow.jp/modwiki/extensions/WikiEditor/modules/images/toolbar/delete.png', action: { type: 'encapsulate', options: { pre: '<s>', peri: 'Insert here', post: '</s>' } } } } } ); $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { section: 'advanced', group: 'format', tools: { buttonId: { label: 'notoc', type: 'button', icon: '//defeatedcrow.jp/modwiki/extensions/WikiEditor/modules/images/toolbar/notoc.png', action: { type: 'encapsulate', options: { pre: '__NOTOC__', } } } } } ); }; /* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar … */ mw.loader.using( 'user.options', 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 ); } } ); // Add the customizations to LiquidThreads' edit toolbar, if available mw.hook( 'ext.lqt.textareaCreated' ).add( customizeToolbar ); } );