MediaWiki:Common.js: Difference between revisions

From The Jolly Contrarian
Jump to navigation Jump to search
Replaced content with "$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { 'section': 'emoticons', 'group': 'faces', 'tools': { 'smile': { label: 'Smile!', // or use labelMsg for a localize..."
Undo revision 10162 by Amwelladmin (talk)
Line 1: Line 1:
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
var customizeToolbar = function() {
'section': 'emoticons',
$('#wpTextbox1').wikiEditor('addToToolbar', {
'group': 'faces',
section: 'advanced',
'tools': {
group: 'format',
'smile': {
tools: {
label: 'Smile!', // or use labelMsg for a localized label, see above
"strikethrough": {
label: 'Strike',
type: 'button',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/a/a4/Gnome-face-smile.svg/22px-Gnome-face-smile.svg.png',
icon: '//upload.wikimedia.org/wikipedia/commons/3/30/Btn_toolbar_rayer.png',
action: {
action: {
type: 'encapsulate',
type: 'encapsulate',
options: {
options: {
pre: ":)" // text to be inserted
pre: "<s>",
post: "</s>"
}
}
}
}
}
}
}
}
} );
});
};
 
/* 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 );
 
 
 
 
 
/* Any JavaScript here will be loaded for all users on every page load. */
 
/* Any JavaScript here will be loaded for all users on every page load. */
/* Good site for buttons: http://commons.wikimedia.org/wiki/Mediawiki_edit_toolbar */
if (mwCustomEditButtons) {
  mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "http://amwellclear.co.uk/w/images/e/e2/Button_Tag.PNG",
    "speedTip": "tag (links and categorises)",
    "tagOpen": "{{tag|",
    "tagClose": "}}",
    "sampleText": "text"}
  mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "http://amwellclear.co.uk/w/images/b/b8/Button_Tg2.PNG",
    "speedTip": "tag (links and categorises and allows a short name)",
    "tagOpen": "{{t2|",
    "tagClose": "}}",
    "sampleText": "LongText|Shorttext"}
 
  mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "http://images.wikia.com/central/images/c/c8/Button_redirect.png",
    "speedTip": "Redirect",
    "tagOpen": "#REDIRECT [[",
    "tagClose": "]]",
    "sampleText": "Insert text"};
  mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "http://amwellclear.co.uk/w/images/e/ed/Button_I.PNG",
    "speedTip": "isdaprov",
    "tagOpen": "{{isdaprov|",
    "tagClose": "}}",
    "sampleText": "provision"};
  mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "http://amwellclear.co.uk/w/images/5/56/Button_Ia.PNG",
    "speedTip": "isdaanatomy",
    "tagOpen": "{{isdaanatomy}}",
    "tagClose": "",
    "sampleText": ""};
 
  mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "http://upload.wikimedia.org/wikipedia/commons/2/29/Button_double_angle_quotes_with_ellipsis.png",
    "speedTip": "isdaquote",
    "tagOpen": "{{isdaquote|",
    "tagClose": "|SECTION|2002}}",
    "sampleText": "Provision"};
  mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "http://amwellclear.co.uk/w/images/a/a7/Button_G.PNG",
    "speedTip": "gmraprov",
    "tagOpen": "{{gmraprov|",
    "tagClose": "}}",
    "sampleText": "provision"};
  mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "http://upload.wikimedia.org/wikipedia/commons/9/94/Vector_toolbar_insert_new_line_button.png",
    "speedTip": "linebreak",
    "tagOpen": "<br>",
    "tagClose": "",
    "sampleText": ""};
  mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "http://amwellclear.co.uk/w/images/b/ba/Clausebutton.png",
    "speedTip": "clause",
    "tagOpen": "{{clause|",
    "tagClose": "}}",
    "sampleText": "SHORTNAME|AGREEMENT|EDITION|CLAUSE"};
  mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "http://amwellclear.co.uk/w/images/d/d6/Button_ccp.PNG",
    "speedTip": "ccp",
    "tagOpen": "{{ccp|",
    "tagClose": "}}",
    "sampleText": "text"};
 
  mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "http://amwellclear.co.uk/w/images/c/cd/Button_cdea.PNG",
    "speedTip": "cassprov",
    "tagOpen": "{{cassprov|",
    "tagClose": "}}",
    "sampleText": "text"};
 
  mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "http://upload.wikimedia.org/wikipedia/commons/5/50/Vector_toolbar_italic_C_button.png",
    "speedTip": "csaprov",
    "tagOpen": "{{csaprov|",
    "tagClose": "}}",
    "sampleText": "text"};
  mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "http://upload.wikimedia.org/wikipedia/commons/7/74/Button_API_%C9%9B.png",
    "speedTip": "eqderivprov",
    "tagOpen": "{{eqderivprov|",
    "tagClose": "}}",
    "sampleText": "text"};
  mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "http://upload.wikimedia.org/wikipedia/commons/9/94/Subst-button-bg.png",
    "speedTip": "subst",
    "tagOpen": "{{subst:",
    "tagClose": "}}",
    "sampleText": "text"};
  mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "http://upload.wikimedia.org/wikipedia/commons/1/17/Button_small_2.png",
    "speedTip": "TOC",
    "tagOpen": "{{YEAR AGREEMENT Section NUMBER TOC}}",
    "tagClose": "",
    "sampleText": ""};
  mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "http://upload.wikimedia.org/wikipedia/commons/a/a4/Vector_toolbar_bold_G_button.png",
    "speedTip": "GMSLAprov",
    "tagOpen": "{{gmslaprov|",
    "tagClose": "}}",
    "sampleText": ""};
 
  mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "http://upload.wikimedia.org/wikipedia/commons/f/fe/Button_context.png",
    "speedTip": "CASS",
    "tagOpen": "{{cassprov|",
    "tagClose": "}}",
    "sampleText": ""};
 
  mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "http://upload.wikimedia.org/wikipedia/commons/b/b4/Button_category03.png",
    "speedTip": "BIPRU",
    "tagOpen": "{{bipruprov|",
    "tagClose": "}}",
    "sampleText": ""};
 
 
  mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "http://upload.wikimedia.org/wikipedia/commons/7/77/Button_cyrillic_capital_fita.png",
    "speedTip": "COBS Provision",
    "tagOpen": "{{cobsprov|",
    "tagClose": "}}",
    "sampleText": ""};
 
  mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "http://upload.wikimedia.org/wikipedia/commons/c/cd/Button_recycler.png",
    "speedTip": "FCA Provision",
    "tagOpen": "{{fcaprov|",
    "tagClose": "}}",
    "sampleText": "text"};
 
  mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "http://upload.wikimedia.org/wikipedia/commons/b/bb/Wiki-button-italic-be.png",
    "speedTip": "pca",
    "tagOpen": "{{pcaprov|",
    "tagClose": "}}",
    "sampleText": "text"};
 
  mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "https://upload.wikimedia.org/wikipedia/commons/1/14/Vector_toolbar_bold_A_button.png",
    "speedTip": "aifmdprov",
    "tagOpen": "{{aifmdprov|",
    "tagClose": "}}",
    "sampleText": "text"}
 
  mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "https://upload.wikimedia.org/wikipedia/commons/5/5c/Button_h2p.png",
    "speedTip": "aifmdprov|DR",
    "tagOpen": "{{aifmdprov|DR",
    "tagClose": "}}",
    "sampleText": "text"}
 
  mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "https://upload.wikimedia.org/wikipedia/commons/4/41/Btn_toolbar_unicode.png",
    "speedTip": "ucitsprov",
    "tagOpen": "{{ucitsprov|",
    "tagClose": "}}",
    "sampleText": "text"}
 
  mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "http://upload.wikimedia.org/wikipedia/commons/e/e1/Button_flag_of_France.png",
    "speedTip": "eudirprov/mifid",
    "tagOpen": "{{eudirprov|",
    "tagClose": "|MiFID}}",
    "sampleText": "text"}
 
 
 
  }

Revision as of 11:02, 22 December 2015

var customizeToolbar = function() {
$('#wpTextbox1').wikiEditor('addToToolbar', {
	section: 'advanced',
	group: 'format',
	tools: {
		"strikethrough": {
			label: 'Strike',
			type: 'button',
			icon: '//upload.wikimedia.org/wikipedia/commons/3/30/Btn_toolbar_rayer.png',
			action: {
				type: 'encapsulate',
				options: {
					pre: "<s>",
					post: "</s>"
				}
			}
		}
	}
});	
};

/* 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 );





/* Any JavaScript here will be loaded for all users on every page load. */

 /* Any JavaScript here will be loaded for all users on every page load. */
 /* Good site for buttons: http://commons.wikimedia.org/wiki/Mediawiki_edit_toolbar */
 
 if (mwCustomEditButtons) {
 
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://amwellclear.co.uk/w/images/e/e2/Button_Tag.PNG",
     "speedTip": "tag (links and categorises)",
     "tagOpen": "{{tag|",
     "tagClose": "}}",
     "sampleText": "text"}
 
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://amwellclear.co.uk/w/images/b/b8/Button_Tg2.PNG",
     "speedTip": "tag (links and categorises and allows a short name)",
     "tagOpen": "{{t2|",
     "tagClose": "}}",
     "sampleText": "LongText|Shorttext"}
  
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://images.wikia.com/central/images/c/c8/Button_redirect.png",
     "speedTip": "Redirect",
     "tagOpen": "#REDIRECT [[",
     "tagClose": "]]",
     "sampleText": "Insert text"};
 
  mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://amwellclear.co.uk/w/images/e/ed/Button_I.PNG",
     "speedTip": "isdaprov",
     "tagOpen": "{{isdaprov|",
     "tagClose": "}}",
     "sampleText": "provision"};
 
  mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://amwellclear.co.uk/w/images/5/56/Button_Ia.PNG",
     "speedTip": "isdaanatomy",
     "tagOpen": "{{isdaanatomy}}",
     "tagClose": "",
     "sampleText": ""};

  mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://upload.wikimedia.org/wikipedia/commons/2/29/Button_double_angle_quotes_with_ellipsis.png",
     "speedTip": "isdaquote",
     "tagOpen": "{{isdaquote|",
     "tagClose": "|SECTION|2002}}",
     "sampleText": "Provision"};
 
  mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://amwellclear.co.uk/w/images/a/a7/Button_G.PNG",
     "speedTip": "gmraprov",
     "tagOpen": "{{gmraprov|",
     "tagClose": "}}",
     "sampleText": "provision"};
 
  mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://upload.wikimedia.org/wikipedia/commons/9/94/Vector_toolbar_insert_new_line_button.png",
     "speedTip": "linebreak",
     "tagOpen": "<br>",
     "tagClose": "",
     "sampleText": ""};
 
  mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://amwellclear.co.uk/w/images/b/ba/Clausebutton.png",
     "speedTip": "clause",
     "tagOpen": "{{clause|",
     "tagClose": "}}",
     "sampleText": "SHORTNAME|AGREEMENT|EDITION|CLAUSE"};
 
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://amwellclear.co.uk/w/images/d/d6/Button_ccp.PNG",
     "speedTip": "ccp",
     "tagOpen": "{{ccp|",
     "tagClose": "}}",
     "sampleText": "text"};

   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://amwellclear.co.uk/w/images/c/cd/Button_cdea.PNG",
     "speedTip": "cassprov",
     "tagOpen": "{{cassprov|",
     "tagClose": "}}",
     "sampleText": "text"};

   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://upload.wikimedia.org/wikipedia/commons/5/50/Vector_toolbar_italic_C_button.png",
     "speedTip": "csaprov",
     "tagOpen": "{{csaprov|",
     "tagClose": "}}",
     "sampleText": "text"};
 
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://upload.wikimedia.org/wikipedia/commons/7/74/Button_API_%C9%9B.png",
     "speedTip": "eqderivprov",
     "tagOpen": "{{eqderivprov|",
     "tagClose": "}}",
     "sampleText": "text"};
 
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://upload.wikimedia.org/wikipedia/commons/9/94/Subst-button-bg.png",
     "speedTip": "subst",
     "tagOpen": "{{subst:",
     "tagClose": "}}",
     "sampleText": "text"};
 
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://upload.wikimedia.org/wikipedia/commons/1/17/Button_small_2.png",
     "speedTip": "TOC",
     "tagOpen": "{{YEAR AGREEMENT Section NUMBER TOC}}",
     "tagClose": "",
     "sampleText": ""};
 
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://upload.wikimedia.org/wikipedia/commons/a/a4/Vector_toolbar_bold_G_button.png",
     "speedTip": "GMSLAprov",
     "tagOpen": "{{gmslaprov|",
     "tagClose": "}}",
     "sampleText": ""};

  mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://upload.wikimedia.org/wikipedia/commons/f/fe/Button_context.png",
     "speedTip": "CASS",
     "tagOpen": "{{cassprov|",
     "tagClose": "}}",
     "sampleText": ""};

  mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://upload.wikimedia.org/wikipedia/commons/b/b4/Button_category03.png",
     "speedTip": "BIPRU",
     "tagOpen": "{{bipruprov|",
     "tagClose": "}}",
     "sampleText": ""};

  
  mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://upload.wikimedia.org/wikipedia/commons/7/77/Button_cyrillic_capital_fita.png",
     "speedTip": "COBS Provision",
     "tagOpen": "{{cobsprov|",
     "tagClose": "}}",
     "sampleText": ""};

   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://upload.wikimedia.org/wikipedia/commons/c/cd/Button_recycler.png",
     "speedTip": "FCA Provision",
     "tagOpen": "{{fcaprov|",
     "tagClose": "}}",
     "sampleText": "text"};

   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://upload.wikimedia.org/wikipedia/commons/b/bb/Wiki-button-italic-be.png",
     "speedTip": "pca",
     "tagOpen": "{{pcaprov|",
     "tagClose": "}}",
     "sampleText": "text"};

   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "https://upload.wikimedia.org/wikipedia/commons/1/14/Vector_toolbar_bold_A_button.png",
     "speedTip": "aifmdprov",
     "tagOpen": "{{aifmdprov|",
     "tagClose": "}}",
     "sampleText": "text"}

   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "https://upload.wikimedia.org/wikipedia/commons/5/5c/Button_h2p.png",
     "speedTip": "aifmdprov|DR",
     "tagOpen": "{{aifmdprov|DR",
     "tagClose": "}}",
     "sampleText": "text"}

   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "https://upload.wikimedia.org/wikipedia/commons/4/41/Btn_toolbar_unicode.png",
     "speedTip": "ucitsprov",
     "tagOpen": "{{ucitsprov|",
     "tagClose": "}}",
     "sampleText": "text"}

   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://upload.wikimedia.org/wikipedia/commons/e/e1/Button_flag_of_France.png",
     "speedTip": "eudirprov/mifid",
     "tagOpen": "{{eudirprov|",
     "tagClose": "|MiFID}}",
     "sampleText": "text"}



  }