MediaWiki:Common.js

From Makers Local 256
Jump to: navigation, search

Note: After saving, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Clear the cache in Tools → Preferences
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 );