MediaWiki:Common.js: Difference between revisions

From The Jolly Contrarian
Jump to navigation Jump to search
(Aif)
No edit summary
 
(37 intermediate revisions by the same user not shown)
Line 1: Line 1:
var customizeToolbar = function() {
var customizeToolbar = function() {
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'sections': {
'manual': {
'type': 'toolbar', // Can also be 'booklet'
'label': 'Manual'
// or 'labelMsg': 'section-manual-label' for a localized label
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'manual',
'groups': {
'tags': {
'label': 'Tags' // or use labelMsg for a localized label, see above
}
}
} );


$('#wpTextbox1').wikiEditor('addToToolbar', {
$('#wpTextbox1').wikiEditor('addToToolbar', {
Line 5: Line 23:
group: 'format',
group: 'format',
tools: {
tools: {
"redirect": {
"template": {
label: '==>',
label: 'long dash',
type: 'button',
type: 'button',
icon: 'http://amwellclear.co.uk/w/images/9/91/Redirect.png',
icon: 'https://jollycontrarian.com/images/5/55/Dash.png',
action: {
action: {
type: 'encapsulate',
type: 'encapsulate',
options: {
options: {
pre: "#redirect[[",
pre: "",
post: "]]"
post: ""
}
}
}
}
}
}
}
}
});
});
 
$('#wpTextbox1').wikiEditor('addToToolbar', {
$('#wpTextbox1').wikiEditor('addToToolbar', {
section: 'advanced',
section: 'advanced',
group: 'format',
group: 'format',
tools: {
tools: {
"ISDAprov": {
"template": {
label: 'isdaprov',
label: 'scarequotes',
type: 'button',
type: 'button',
icon: 'http://amwellclear.co.uk/w/images/e/ed/Button_I.PNG',
icon: 'https://jollycontrarian.com/images/b/ba/Scare.png',
action: {
action: {
type: 'encapsulate',
type: 'encapsulate',
options: {
options: {
pre: "{{isdaprov|",
pre: "",
post: "}}"
post: ""
}
}
}
}
Line 38: Line 55:
}
}
});
});
$('#wpTextbox1').wikiEditor('addToToolbar', {
$('#wpTextbox1').wikiEditor('addToToolbar', {
section: 'advanced',
section: 'advanced',
group: 'format',
group: 'format',
tools: {
tools: {
"gmslaprov": {
"template": {
label: 'gmslaprov',
label: 'apostrophe',
type: 'button',
type: 'button',
icon: 'http://amwellclear.co.uk/w/images/f/f7/G.png',
icon: 'https://jollycontrarian.com/images/5/5b/Apo.png',
action: {
action: {
type: 'encapsulate',
type: 'encapsulate',
options: {
options: {
pre: "{{gmslaprov|",
pre: "",
post: "}}"
post: ""
}
}
}
}
}
}
}
}
});
});


$('#wpTextbox1').wikiEditor('addToToolbar', {
$('#wpTextbox1').wikiEditor('addToToolbar', {
Line 63: Line 78:
group: 'format',
group: 'format',
tools: {
tools: {
"gmraprov": {
"template": {
label: 'grmaprov',
label: '{{ - }}',
type: 'button',
type: 'button',
icon: 'http://amwellclear.co.uk/w/images/4/49/Gmr.png',
icon: 'https://jollycontrarian.com/images/3/30/Template.png',
action: {
action: {
type: 'encapsulate',
type: 'encapsulate',
options: {
options: {
pre: "{{gmraprov|",
pre: "{{",
post: "}}"
post: "}}"
}
}
Line 85: Line 100:
label: 'subst:',
label: 'subst:',
type: 'button',
type: 'button',
icon: 'http://amwellclear.co.uk/w/images/0/03/Sbs.png',
icon: 'https://jollycontrarian.com/images/0/03/Sbs.png',
action: {
action: {
type: 'encapsulate',
type: 'encapsulate',
Line 101: Line 116:
group: 'format',
group: 'format',
tools: {
tools: {
"Equity Derivs": {
"redirect": {
label: 'eqderivprov',
label: '==>',
type: 'button',
type: 'button',
icon: 'http://amwellclear.co.uk/w/images/1/1a/Eq.png',
icon: 'https://jollycontrarian.com/images/9/91/Redirect.png',
action: {
action: {
type: 'encapsulate',
type: 'encapsulate',
options: {
options: {
pre: "{{eqderivprov|",
pre: "#redirect[[",
post: "}}"
post: "]]"
}
}
}
}
Line 115: Line 130:
}
}
});
});


$('#wpTextbox1').wikiEditor('addToToolbar', {
$('#wpTextbox1').wikiEditor('addToToolbar', {
Line 121: Line 137:
tools: {
tools: {
"template": {
"template": {
label: '{{ - }}',
label: 'tag',
type: 'button',
type: 'button',
icon: 'http://amwellclear.co.uk/w/images/3/30/Template.png',
icon: 'https://jollycontrarian.com/images/7/76/Tag.png',
action: {
action: {
type: 'encapsulate',
type: 'encapsulate',
options: {
options: {
pre: "{{",
pre: "{{t|",
post: "}}"
post: "}}"
}
}
Line 139: Line 155:
group: 'format',
group: 'format',
tools: {
tools: {
"template": {
"Prov": {
label: 'tag',
label: 'isdaprov',
type: 'button',
type: 'button',
icon: 'http://amwellclear.co.uk/w/images/7/7d/Tag2.png',
icon: 'https://jollycontrarian.com/images/5/50/Isd.png',
action: {
action: {
type: 'encapsulate',
type: 'encapsulate',
options: {
options: {
pre: "{{t|",
pre: "{{isdaprov|",
post: "}}"
post: "}}"
}
}
Line 152: Line 168:
}
}
}
}
});
});


$('#wpTextbox1').wikiEditor('addToToolbar', {
$('#wpTextbox1').wikiEditor('addToToolbar', {
Line 158: Line 174:
group: 'format',
group: 'format',
tools: {
tools: {
"template": {
"Prov": {
label: 'csaprov',
label: 'euaprov',
type: 'button',
type: 'button',
icon: 'http://amwellclear.co.uk/w/images/6/69/CSA.png',
icon: 'https://jollycontrarian.com/images/5/50/eua.png',
action: {
action: {
type: 'encapsulate',
type: 'encapsulate',
options: {
options: {
pre: "{{csaprov|",
pre: "{{euaprov|",
post: "}}"
post: "}}"
}
}
Line 176: Line 192:
group: 'format',
group: 'format',
tools: {
tools: {
"template": {
"ietaprov": {
label: 'scarequotes',
label: 'ietaprov',
type: 'button',
type: 'button',
icon: 'http://amwellclear.co.uk/w/images/6/65/Quotes.png',
icon: 'https://jollycontrarian.com/images/e/e9/Gms.png',
action: {
action: {
type: 'encapsulate',
type: 'encapsulate',
options: {
options: {
pre: "",
pre: "{{ietaprov|",
post: ""
post: "}}"
}
}
}
}
Line 190: Line 206:
}
}
});
});
$('#wpTextbox1').wikiEditor('addToToolbar', {
$('#wpTextbox1').wikiEditor('addToToolbar', {
section: 'advanced',
section: 'advanced',
group: 'format',
group: 'format',
tools: {
tools: {
"template": {
"gmraprov": {
label: 'apostrophe',
label: '{{{1}}}|',
type: 'button',
type: 'button',
icon: 'http://amwellclear.co.uk/w/images/5/57/Apostrophe.png',
icon: 'https://jollycontrarian.com/images/4/49/blank.png',
action: {
action: {
type: 'encapsulate',
type: 'encapsulate',
options: {
options: {
pre: "",
pre: "{{{{{1}}}|",
post: ""
post: "}}"
}
}
}
}
Line 208: Line 225:
}
}
});
});
$('#wpTextbox1').wikiEditor('addToToolbar', {
$('#wpTextbox1').wikiEditor('addToToolbar', {
section: 'advanced',
section: 'advanced',
group: 'format',
group: 'format',
tools: {
tools: {
"template": {
"Equity Derivs": {
label: 'flannel',
label: 'eqderivprov',
type: 'button',
type: 'button',
icon: 'http://amwellclear.co.uk/w/images/c/c5/Flannel.png',
icon: 'https://jollycontrarian.com/images/c/c3/Eqd.png',
action: {
action: {
type: 'encapsulate',
type: 'encapsulate',
options: {
options: {
pre: "{{f|",
pre: "{{eqderivprov|",
post: "}}"
post: "}}"
}
}
Line 225: Line 243:
}
}
}
}
});
});
 
 
$('#wpTextbox1').wikiEditor('addToToolbar', {
$('#wpTextbox1').wikiEditor('addToToolbar', {
section: 'advanced',
section: 'advanced',
Line 231: Line 251:
tools: {
tools: {
"template": {
"template": {
label: 'long dash',
label: 'vmcsaprov',
type: 'button',
type: 'button',
icon: 'http://amwellclear.co.uk/w/images/5/55/Dash.png',
icon: 'https://jollycontrarian.com/images/3/37/Csa.png',
action: {
action: {
type: 'encapsulate',
type: 'encapsulate',
options: {
options: {
pre: "—",
pre: "{{vmcsaprov|",
post: ""
post: "}}"
}
}
}
}
});
$('#wpTextbox1').wikiEditor('addToToolbar', {
section: 'advanced',
group: 'format',
tools: {
"template": {
label: 'FullAnat',
type: 'button',
icon: 'http://amwellclear.co.uk/w/images/3/3c/Vector_toolbar_bold_F_button.png',
action: {
type: 'encapsulate',
options: {
pre: "{{fullanat|AGMT|CLAUSE|EDITION}}",
post: ""
}
}
}
}
});
$('#wpTextbox1').wikiEditor('addToToolbar', {
section: 'advanced',
group: 'format',
tools: {
"template": {
label: 'FullAnat2',
type: 'button',
icon: 'http://amwellclear.co.uk/w/images/2/22/Vector_toolbar_bold_F2_button.png',
action: {
type: 'encapsulate',
options: {
pre: "{{fullanat2|AGMT|CLAUSE|EDITION|CLAUSE|EDITION}}",
post: ""
}
}
}
}
});
$('#wpTextbox1').wikiEditor('addToToolbar', {
section: 'advanced',
group: 'format',
tools: {
"template": {
label: 'FullAnatOpen',
type: 'button',
icon: 'http://amwellclear.co.uk/w/images/2/22/Vector_toolbar_bold_F2_button.png',
action: {
type: 'encapsulate',
options: {
pre: "{{fullanatopen|AGMT|{{AGMTquote|AGMT|YEAR|CLAUSE}}<br>{{AGMTquote|AGMT|YEAR|CLAUSE}}}}",
post: ""
}
}
}
}
});
$('#wpTextbox1').wikiEditor('addToToolbar', {
section: 'advanced',
group: 'format',
tools: {
"template": {
label: 'isdaanat',
type: 'button',
icon: 'http://amwellclear.co.uk/w/images/e/ed/Button_I.PNG',
action: {
type: 'encapsulate',
options: {
pre: "{{isdaanat|CLAUSE}}",
post: ""
}
}
}
}
Line 323: Line 271:
label: 'top trumps',
label: 'top trumps',
type: 'button',
type: 'button',
icon: 'http://amwellclear.co.uk/w/images/7/7d/Tag2.png',
icon: 'http://jollycontrarian.com/w/images/7/7d/Tag2.png',
action: {
action: {
type: 'encapsulate',
type: 'encapsulate',
options: {
options: {
pre: "{{fwmdtt|nickname=",
pre: "{{fwmdtt|nickname=",
post: "|title=|tagline=|documentation=|booklets=|customisability=|asset classes=|amendability=|transferability=|tenor=|leverage=|collateral=|longevity=|frightometer=}}"
post: "| imagetype=png| tagline= | documentation= | docscore=0| amendability= |amendscore=0| collateral= | collateralscore =0| transferability= | transferscore =0| leverage= | leveragescore =0| frightometer= | frightscore=0}}"
}
}
}
}
Line 357: Line 305:
tools: {
tools: {
"template": {
"template": {
label: 'confiprov',
label: 'cddprov',
type: 'button',
type: 'button',
icon: 'https://jollycontrarian.com/images/e/ec/Cp.png',
icon: 'https://jollycontrarian.com/images/e/ec/Cp.png',
Line 363: Line 311:
type: 'encapsulate',
type: 'encapsulate',
options: {
options: {
pre: "{{confiprov|",
pre: "{{cddprov|",
post: "}}"
post: "}}"
}
}
Line 429: Line 377:
tools: {
tools: {
"template": {
"template": {
label: '{{aifmdprov|}}',
label: '{{strike|}}',
type: 'button',
type: 'button',
icon: 'https://jollycontrarian.com/images/8/83/Aif.PNG',
icon: 'https://jollycontrarian.com/images/8/83/Aif.PNG',
Line 435: Line 383:
type: 'encapsulate',
type: 'encapsulate',
options: {
options: {
pre: "{{aifmdprov|",
pre: "{{strike|",
post: "|}}"
}
}
}
}
});
$('#wpTextbox1').wikiEditor('addToToolbar', {
section: 'advanced',
group: 'tags',
tools: {
"template": {
label: 'isdamanual',
type: 'button',
icon: 'https://jollycontrarian.com/images/c/c2/MI2002.png',
action: {
type: 'encapsulate',
options: {
pre: "{{isdamanual|",
post: "}}"
post: "}}"
}
}
Line 442: Line 408:
}
}
});
});
};
};


 
if ( [ 'edit', 'submit' ].indexOf( mw.config.get( 'wgAction' ) ) !== -1 ) {
 
mw.loader.using( 'user.options' ).then( function () {
/* 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 ) {
if ( mw.user.options.get( 'usebetatoolbar' ) == 1 ) {
$.when(
$.when(
mw.loader.using( 'ext.wikiEditor.toolbar' ), $.ready
mw.loader.using( 'ext.wikiEditor' ), $.ready
).then( customizeToolbar );
).then( customizeToolbar );
}
}
} );
} );
}
}


// Add the customizations to LiquidThreads' edit toolbar, if available
// Add the customizations to LiquidThreads' edit toolbar, if available

Latest revision as of 15:07, 1 February 2024

var customizeToolbar = function() {

$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	'sections': {
		'manual': {
			'type': 'toolbar', // Can also be 'booklet'
			'label': 'Manual'
			// or 'labelMsg': 'section-manual-label' for a localized label
		}
	}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	'section': 'manual',
	'groups': {
		'tags': {
			'label': 'Tags' // or use labelMsg for a localized label, see above
		}
	}
} );

$('#wpTextbox1').wikiEditor('addToToolbar', {
	section: 'advanced',
	group: 'format',
	tools: {
		"template": {
			label: 'long dash',
			type: 'button',
			icon: 'https://jollycontrarian.com/images/5/55/Dash.png',
			action: {
				type: 'encapsulate',
				options: {
					pre: "—",
					post: ""
				}
			}
		}
	}
});
$('#wpTextbox1').wikiEditor('addToToolbar', {
	section: 'advanced',
	group: 'format',
	tools: {
		"template": {
			label: 'scarequotes',
			type: 'button',
			icon: 'https://jollycontrarian.com/images/b/ba/Scare.png',
			action: {
				type: 'encapsulate',
				options: {
					pre: "“",
					post: "”"
				}
			}
		}
	}
});	
$('#wpTextbox1').wikiEditor('addToToolbar', {
	section: 'advanced',
	group: 'format',
	tools: {
		"template": {
			label: 'apostrophe',
			type: 'button',
			icon: 'https://jollycontrarian.com/images/5/5b/Apo.png',
			action: {
				type: 'encapsulate',
				options: {
					pre: "’",
					post: ""
				}
			}
		}
	}
});

$('#wpTextbox1').wikiEditor('addToToolbar', {
	section: 'advanced',
	group: 'format',
	tools: {
		"template": {
			label: '{{ - }}',
			type: 'button',
			icon: 'https://jollycontrarian.com/images/3/30/Template.png',
			action: {
				type: 'encapsulate',
				options: {
					pre: "{{",
					post: "}}"
				}
			}
		}
	}
});	

$('#wpTextbox1').wikiEditor('addToToolbar', {
	section: 'advanced',
	group: 'format',
	tools: {
		"Substitute": {
			label: 'subst:',
			type: 'button',
			icon: 'https://jollycontrarian.com/images/0/03/Sbs.png',
			action: {
				type: 'encapsulate',
				options: {
					pre: "{{subst:",
					post: "}}"
				}
			}
		}
	}
});	

$('#wpTextbox1').wikiEditor('addToToolbar', {
	section: 'advanced',
	group: 'format',
	tools: {
		"redirect": {
			label: '==>',
			type: 'button',
			icon: 'https://jollycontrarian.com/images/9/91/Redirect.png',
			action: {
				type: 'encapsulate',
				options: {
					pre: "#redirect[[",
					post: "]]"
				}
			}
		}
	}
});	
	

$('#wpTextbox1').wikiEditor('addToToolbar', {
	section: 'advanced',
	group: 'format',
	tools: {
		"template": {
			label: 'tag',
			type: 'button',
			icon: 'https://jollycontrarian.com/images/7/76/Tag.png',
			action: {
				type: 'encapsulate',
				options: {
					pre: "{{t|",
					post: "}}"
				}
			}
		}
	}
});	

$('#wpTextbox1').wikiEditor('addToToolbar', {
	section: 'advanced',
	group: 'format',
	tools: {
		"Prov": {
			label: 'isdaprov',
			type: 'button',
			icon: 'https://jollycontrarian.com/images/5/50/Isd.png',
			action: {
				type: 'encapsulate',
				options: {
					pre: "{{isdaprov|",
					post: "}}"
				}
			}
		}
	}
});

$('#wpTextbox1').wikiEditor('addToToolbar', {
	section: 'advanced',
	group: 'format',
	tools: {
		"Prov": {
			label: 'euaprov',
			type: 'button',
			icon: 'https://jollycontrarian.com/images/5/50/eua.png',
			action: {
				type: 'encapsulate',
				options: {
					pre: "{{euaprov|",
					post: "}}"
				}
			}
		}
	}
});	
$('#wpTextbox1').wikiEditor('addToToolbar', {
	section: 'advanced',
	group: 'format',
	tools: {
		"ietaprov": {
			label: 'ietaprov',
			type: 'button',
			icon: 'https://jollycontrarian.com/images/e/e9/Gms.png',
			action: {
				type: 'encapsulate',
				options: {
					pre: "{{ietaprov|",
					post: "}}"
				}
			}
		}
	}
});	

$('#wpTextbox1').wikiEditor('addToToolbar', {
	section: 'advanced',
	group: 'format',
	tools: {
		"gmraprov": {
			label: '{{{1}}}|',
			type: 'button',
			icon: 'https://jollycontrarian.com/images/4/49/blank.png',
			action: {
				type: 'encapsulate',
				options: {
					pre: "{{{{{1}}}|",
					post: "}}"
				}
			}
		}
	}
});	

$('#wpTextbox1').wikiEditor('addToToolbar', {
	section: 'advanced',
	group: 'format',
	tools: {
		"Equity Derivs": {
			label: 'eqderivprov',
			type: 'button',
			icon: 'https://jollycontrarian.com/images/c/c3/Eqd.png',
			action: {
				type: 'encapsulate',
				options: {
					pre: "{{eqderivprov|",
					post: "}}"
				}
			}
		}
	}
});	


$('#wpTextbox1').wikiEditor('addToToolbar', {
	section: 'advanced',
	group: 'format',
	tools: {
		"template": {
			label: 'vmcsaprov',
			type: 'button',
			icon: 'https://jollycontrarian.com/images/3/37/Csa.png',
			action: {
				type: 'encapsulate',
				options: {
					pre: "{{vmcsaprov|",
					post: "}}"
				}
			}
		}
	}
});
$('#wpTextbox1').wikiEditor('addToToolbar', {
	section: 'advanced',
	group: 'format',
	tools: {
		"template": {
			label: 'top trumps',
			type: 'button',
			icon: 'http://jollycontrarian.com/w/images/7/7d/Tag2.png',
			action: {
				type: 'encapsulate',
				options: {
					pre: "{{fwmdtt|nickname=",
					post: "| imagetype=png| tagline= | documentation= | docscore=0| amendability= |amendscore=0| collateral= | collateralscore =0| transferability= | transferscore =0| leverage= | leveragescore =0| frightometer= | frightscore=0}}"
				}
			}
		}
	}
});
$('#wpTextbox1').wikiEditor('addToToolbar', {
	section: 'advanced',
	group: 'format',
	tools: {
		"template": {
			label: 'wasteprov',
			type: 'button',
			icon: 'https://jollycontrarian.com/images/2/27/Wp.png',
			action: {
				type: 'encapsulate',
				options: {
					pre: "{{wasteprov|",
					post: "}}"
				}
			}
		}
	}
});
$('#wpTextbox1').wikiEditor('addToToolbar', {
	section: 'advanced',
	group: 'format',
	tools: {
		"template": {
			label: 'cddprov',
			type: 'button',
			icon: 'https://jollycontrarian.com/images/e/ec/Cp.png',
			action: {
				type: 'encapsulate',
				options: {
					pre: "{{cddprov|",
					post: "}}"
				}
			}
		}
	}
});
$('#wpTextbox1').wikiEditor('addToToolbar', {
	section: 'advanced',
	group: 'format',
	tools: {
		"template": {
			label: '{{g}}',
			type: 'button',
			icon: 'https://jollycontrarian.com/images/a/a7/Gl.PNG',
			action: {
				type: 'encapsulate',
				options: {
					pre: "{{g}}",
					post: ""
				}
			}
		}
	}
});
$('#wpTextbox1').wikiEditor('addToToolbar', {
	section: 'advanced',
	group: 'format',
	tools: {
		"template": {
			label: '{{sa}}',
			type: 'button',
			icon: 'https://jollycontrarian.com/images/7/7c/Sa.PNG',
			action: {
				type: 'encapsulate',
				options: {
					pre: "{{sa}}",
					post: ""
				}
			}
		}
	}
});
$('#wpTextbox1').wikiEditor('addToToolbar', {
	section: 'advanced',
	group: 'format',
	tools: {
		"template": {
			label: '{{ucits5prov|}}',
			type: 'button',
			icon: 'https://jollycontrarian.com/images/d/d7/U.PNG',
			action: {
				type: 'encapsulate',
				options: {
					pre: "{{ucits5prov|",
					post: "}}"
				}
			}
		}
	}
});
$('#wpTextbox1').wikiEditor('addToToolbar', {
	section: 'advanced',
	group: 'format',
	tools: {
		"template": {
			label: '{{strike|}}',
			type: 'button',
			icon: 'https://jollycontrarian.com/images/8/83/Aif.PNG',
			action: {
				type: 'encapsulate',
				options: {
					pre: "{{strike|",
					post: "|}}"
				}
			}
		}
	}
});
$('#wpTextbox1').wikiEditor('addToToolbar', {
	section: 'advanced',
	group: 'tags',
	tools: {
		"template": {
			label: 'isdamanual',
			type: 'button',
			icon: 'https://jollycontrarian.com/images/c/c2/MI2002.png',
			action: {
				type: 'encapsulate',
				options: {
					pre: "{{isdamanual|",
					post: "}}"
				}
			}
		}
	}
});

};

if ( [ 'edit', 'submit' ].indexOf( mw.config.get( 'wgAction' ) ) !== -1 ) {
	mw.loader.using( 'user.options' ).then( function () {
		if ( mw.user.options.get( 'usebetatoolbar' ) == 1 ) {
			$.when(
				mw.loader.using( 'ext.wikiEditor' ), $.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 */