Difference between revisions of "MediaWiki:Common.js"
From Makers Local 256
m (update to make project button work, after Last Molested changed) |
m (maybe?!) |
||
(7 intermediate revisions by one user not shown) | |||
Line 1: | Line 1: | ||
− | + | mw.loader.load( 'ext.wikiEditor.toolbar' ); | |
− | + | var customizeToolbar = function() { | |
− | + | $('#wpTextbox1').wikiEditor('addToToolbar', { | |
− | + | section: 'main', | |
− | + | group: 'insert', | |
− | + | tools: { | |
− | + | "strikethrough": { | |
− | + | label: 'New Project', | |
− | + | type: 'button', | |
− | + | icon: '//256.makerslocal.org/wiki/images/project.png', | |
− | + | action: { | |
− | + | type: 'encapsulate', | |
− | + | options: { | |
− | + | pre: "\{\{Project|Creator=User Name", | |
+ | post: "\n|Status=\<onlyinclude\> Your Status \<\/onlyinclude\> \<\!\-\-LEAVE ONLYINCLUDES FOR STATUS HACK\-\-\> \n|Born On=\~\~\~\~\~ \<\!\-\-DO NOT EDIT \-\-\>\n|Last Updated=\{\{\#time\: H\:i\, d F Y\| \{\{REVISIONTIMESTAMP\}\} \}\} \(CDT\) \<\!\-\-DO NOT EDIT \-\-\>\n\}\}\n\n==Overview==\nThis is for a description of your project.\n\n\n\n\n\[\[Category:Put Category Here\]\] \<\!\-\-MAKE AS MANY CATEGORIES AS YOU NEED\-\-\>" | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | }); | ||
+ | }; | ||
+ | |||
+ | /* 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 ); | ||
+ | } ); | ||
+ | } | ||
+ | } ); | ||
} | } | ||
+ | // Add the customizations to LiquidThreads' edit toolbar, if available | ||
+ | mw.hook( 'ext.lqt.textareaCreated' ).add( customizeToolbar ); |
Latest revision as of 10:22, 14 February 2014
mw.loader.load( 'ext.wikiEditor.toolbar' ); var customizeToolbar = function() { $('#wpTextbox1').wikiEditor('addToToolbar', { section: 'main', group: 'insert', tools: { "strikethrough": { label: 'New Project', type: 'button', icon: '//256.makerslocal.org/wiki/images/project.png', action: { type: 'encapsulate', options: { pre: "\{\{Project|Creator=User Name", post: "\n|Status=\<onlyinclude\> Your Status \<\/onlyinclude\> \<\!\-\-LEAVE ONLYINCLUDES FOR STATUS HACK\-\-\> \n|Born On=\~\~\~\~\~ \<\!\-\-DO NOT EDIT \-\-\>\n|Last Updated=\{\{\#time\: H\:i\, d F Y\| \{\{REVISIONTIMESTAMP\}\} \}\} \(CDT\) \<\!\-\-DO NOT EDIT \-\-\>\n\}\}\n\n==Overview==\nThis is for a description of your project.\n\n\n\n\n\[\[Category:Put Category Here\]\] \<\!\-\-MAKE AS MANY CATEGORIES AS YOU NEED\-\-\>" } } } } }); }; /* 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 ); } ); } } ); } // Add the customizations to LiquidThreads' edit toolbar, if available mw.hook( 'ext.lqt.textareaCreated' ).add( customizeToolbar );