מדיה ויקי:Common.js: הבדלים בין גרסאות בדף
קפיצה לניווט
קפיצה לחיפוש
מגזין יהלום (שיחה | תרומות) (ניסוי) |
מגזין יהלום (שיחה | תרומות) מ (שוחזר מעריכות של מגזין יהלום (שיחה) לעריכה האחרונה של Eburcat) תגית: שחזור |
||
שורה 1: | שורה 1: | ||
− | + | /* כל סקריפט JavaScript שנכתב כאן ירוץ עבור כל המשתמשים בכל טעינת עמוד */ | |
− | + | ||
− | + | var customizeToolbar = function() { | |
− | + | $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { | |
− | + | 'section': 'main', | |
− | + | 'group': 'format', | |
− | + | 'tools': { | |
− | + | 'strike': { | |
− | + | label: 'טקסט מחוק', | |
− | + | type: 'button', | |
− | + | icon: '//ecowiki.org.il/images/8/8d/NewInlineBtn.png', | |
− | + | action: { | |
− | + | type: 'encapsulate', | |
− | + | options: { | |
− | + | pre: "<s>", | |
− | + | post: "</s>" | |
− | + | } | |
− | + | } | |
− | + | } | |
− | + | } | |
− | + | } ); | |
− | + | $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { | |
− | + | 'section': 'advanced', | |
− | + | 'group': 'format', | |
− | + | 'tools': { | |
− | + | 'strike': { | |
− | + | label: 'הזחה', | |
− | + | type: 'button', | |
− | + | icon: '//ecowiki.org.il/images/3/3b/Vector_toolbar_indentation_button_rtl.png', | |
− | + | action: { | |
− | } | + | type: 'encapsulate', |
− | + | options: { | |
− | + | pre: ":" | |
− | + | } | |
− | + | } | |
− | + | } | |
− | + | } | |
− | + | } ); | |
− | + | }; | |
− | + | ||
− | + | /* 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 () { | |
− | + | // 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 ); | |
− | |||
− | |||
− | |||
− | |||
− | mw.loader.using(' | ||
− | |||
− | |||
− | |||
− | . | ||
} | } | ||
− | + | } ); | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | }); | ||
} | } | ||
− | + | // Add the customizations to LiquidThreads' edit toolbar, if available | |
+ | mw.hook( 'ext.lqt.textareaCreated' ).add( customizeToolbar ); |
גרסה מ־13:19, 23 באוקטובר 2020
/* כל סקריפט JavaScript שנכתב כאן ירוץ עבור כל המשתמשים בכל טעינת עמוד */ var customizeToolbar = function() { $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { 'section': 'main', 'group': 'format', 'tools': { 'strike': { label: 'טקסט מחוק', type: 'button', icon: '//ecowiki.org.il/images/8/8d/NewInlineBtn.png', action: { type: 'encapsulate', options: { pre: "<s>", post: "</s>" } } } } } ); $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { 'section': 'advanced', 'group': 'format', 'tools': { 'strike': { label: 'הזחה', type: 'button', icon: '//ecowiki.org.il/images/3/3b/Vector_toolbar_indentation_button_rtl.png', action: { type: 'encapsulate', options: { pre: ":" } } } } } ); }; /* 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 () { // 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 );