Difference between revisions of "MediaWiki:Common.js"

From Makers Local 256
Jump to: navigation, search
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:
if (mwCustomEditButtons) {  
+
mw.loader.load( 'ext.wikiEditor.toolbar' );
  mwCustomEditButtons[mwCustomEditButtons.length] = {
+
var customizeToolbar = function() {
    "imageFile": "https://256.makerslocal.org/wiki/images/project.png",
+
$('#wpTextbox1').wikiEditor('addToToolbar', {
    "speedTip": "New Project",
+
section: 'main',
    "tagOpen": "\{\{Project|Creator=User Name",
+
group: 'insert',
    "tagClose": "\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\-\-\>",
+
tools: {
    "sampleText": ""};
+
"strikethrough": {
 
+
label: 'New Project',
  mwCustomEditButtons[mwCustomEditButtons.length] = {
+
type: 'button',
    "imageFile": "https://256.makerslocal.org/wiki/images/proposal.png",
+
icon: '//256.makerslocal.org/wiki/images/project.png',
    "speedTip": "New Proposal",
+
action: {
    "tagOpen": "\=\= Proposal Name \=\=\n",
+
type: 'encapsulate',
    "tagClose": "\* Call To Vote Date: \~\~\~\~\~\n* Voting Period Shall end in 72 hours from Call to Vote date.\n\*\* Called by: \~\~\~\~\n\*\* Seconded by:\n\n\=\= Summary \=\=\n\<\!\-\- Remove and place summary \-\-\>\n\n\=\= Proposal \=\=\n\<\!\-\- Remove and place proposal\-\-\>\n\n\=\= Discussion \=\=\n\<\!\-\- Remove and place discussion notes\-\-\>\n\n\=\= Votes \=\=\n\=\=\= Yay \=\=\=\n\n\=\=\= Nay \=\=\=\n\n\=\=\= Abstain \=\=\=\n\n\[\[Category\:Proposals\]\]\n\[\[Category\:Proposals\/Active\]\]",
+
options: {
    "sampleText": ""};
+
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 );