MediaWiki:Common.js: Difference between revisions

From The Jolly Contrarian
Jump to navigation Jump to search
No edit summary
No edit summary
Line 92: Line 92:
}
}
});
});
$('#wpTextbox1').wikiEditor('addToToolbar', {
$('#wpTextbox1').wikiEditor('addToToolbar', {
section: 'advanced',
section: 'advanced',
group: 'format',
group: 'format',
tools: {
tools: {
"redirect": {
"Substitute": {
label: '==>',
label: 'subst:',
type: 'button',
type: 'button',
icon: 'https://jollycontrarian.com/images/9/91/Redirect.png',
icon: 'https://jollycontrarian.com/images/0/03/Sbs.png',
action: {
action: {
type: 'encapsulate',
type: 'encapsulate',
options: {
options: {
pre: "#redirect[[",
pre: "{{subst:",
post: "]]"
post: "}}"
}
}
}
}
Line 115: Line 116:
group: 'format',
group: 'format',
tools: {
tools: {
"ISDAprov": {
"redirect": {
label: 'isdaprov',
label: '==>',
type: 'button',
type: 'button',
icon: 'https://jollycontrarian.com/images/5/50/Isd.png',
icon: 'https://jollycontrarian.com/images/9/91/Redirect.png',
action: {
action: {
type: 'encapsulate',
type: 'encapsulate',
options: {
options: {
pre: "{{isdaprov|",
pre: "#redirect[[",
post: "}}"
post: "]]"
}
}
}
}
Line 129: Line 130:
}
}
});
});
$('#wpTextbox1').wikiEditor('addToToolbar', {
$('#wpTextbox1').wikiEditor('addToToolbar', {
section: 'advanced',
section: 'advanced',
group: 'format',
group: 'format',
tools: {
tools: {
"gmslaprov": {
"template": {
label: 'gmslaprov',
label: 'tag',
type: 'button',
type: 'button',
icon: 'https://jollycontrarian.com/images/e/e9/Gms.png',
icon: 'https://jollycontrarian.com/images/7/76/Tag.png',
action: {
action: {
type: 'encapsulate',
type: 'encapsulate',
options: {
options: {
pre: "{{gmslaprov|",
pre: "{{t|",
post: "}}"
post: "}}"
}
}
Line 152: Line 155:
group: 'format',
group: 'format',
tools: {
tools: {
"gmraprov": {
"ISDAprov": {
label: 'grmaprov',
label: 'isdaprov',
type: 'button',
type: 'button',
icon: 'https://jollycontrarian.com/images/4/49/Gmr.png',
icon: 'https://jollycontrarian.com/images/5/50/Isd.png',
action: {
action: {
type: 'encapsulate',
type: 'encapsulate',
options: {
options: {
pre: "{{gmraprov|",
pre: "{{isdaprov|",
post: "}}"
post: "}}"
}
}
Line 166: Line 169:
}
}
});
});
$('#wpTextbox1').wikiEditor('addToToolbar', {
$('#wpTextbox1').wikiEditor('addToToolbar', {
section: 'advanced',
section: 'advanced',
group: 'format',
group: 'format',
tools: {
tools: {
"Substitute": {
"gmslaprov": {
label: 'subst:',
label: 'gmslaprov',
type: 'button',
type: 'button',
icon: 'https://jollycontrarian.com/images/0/03/Sbs.png',
icon: 'https://jollycontrarian.com/images/e/e9/Gms.png',
action: {
action: {
type: 'encapsulate',
type: 'encapsulate',
options: {
options: {
pre: "{{subst:",
pre: "{{gmslaprov|",
post: "}}"
post: "}}"
}
}
Line 190: Line 192:
group: 'format',
group: 'format',
tools: {
tools: {
"Equity Derivs": {
"gmraprov": {
label: 'eqderivprov',
label: 'grmaprov',
type: 'button',
type: 'button',
icon: 'https://jollycontrarian.com/images/c/c3/Eqd.png',
icon: 'https://jollycontrarian.com/images/4/49/Gmr.png',
action: {
action: {
type: 'encapsulate',
type: 'encapsulate',
options: {
options: {
pre: "{{eqderivprov|",
pre: "{{gmraprov|",
post: "}}"
post: "}}"
}
}
Line 204: Line 206:
}
}
});
});


$('#wpTextbox1').wikiEditor('addToToolbar', {
$('#wpTextbox1').wikiEditor('addToToolbar', {
Line 210: Line 211:
group: 'format',
group: 'format',
tools: {
tools: {
"template": {
"Equity Derivs": {
label: 'tag',
label: 'eqderivprov',
type: 'button',
type: 'button',
icon: 'https://jollycontrarian.com/images/7/76/Tag.png',
icon: 'https://jollycontrarian.com/images/c/c3/Eqd.png',
action: {
action: {
type: 'encapsulate',
type: 'encapsulate',
options: {
options: {
pre: "{{t|",
pre: "{{eqderivprov|",
post: "}}"
post: "}}"
}
}
Line 224: Line 225:
}
}
});
});


$('#wpTextbox1').wikiEditor('addToToolbar', {
$('#wpTextbox1').wikiEditor('addToToolbar', {

Revision as of 15:12, 3 July 2020

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: {
		"ISDAprov": {
			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: {
		"gmslaprov": {
			label: 'gmslaprov',
			type: 'button',
			icon: 'https://jollycontrarian.com/images/e/e9/Gms.png',
			action: {
				type: 'encapsulate',
				options: {
					pre: "{{gmslaprov|",
					post: "}}"
				}
			}
		}
	}
});	

$('#wpTextbox1').wikiEditor('addToToolbar', {
	section: 'advanced',
	group: 'format',
	tools: {
		"gmraprov": {
			label: 'grmaprov',
			type: 'button',
			icon: 'https://jollycontrarian.com/images/4/49/Gmr.png',
			action: {
				type: 'encapsulate',
				options: {
					pre: "{{gmraprov|",
					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: 'csaprov',
			type: 'button',
			icon: 'https://jollycontrarian.com/images/3/37/Csa.png',
			action: {
				type: 'encapsulate',
				options: {
					pre: "{{csaprov|",
					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: "|title=|tagline=|documentation=|booklets=|customisability=|asset classes=|amendability=|transferability=|tenor=|leverage=|collateral=|longevity=|frightometer=}}"
				}
			}
		}
	}
});
$('#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: 'confiprov',
			type: 'button',
			icon: 'https://jollycontrarian.com/images/e/ec/Cp.png',
			action: {
				type: 'encapsulate',
				options: {
					pre: "{{confiprov|",
					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: '{{aifmdprov|}}',
			type: 'button',
			icon: 'https://jollycontrarian.com/images/8/83/Aif.PNG',
			action: {
				type: 'encapsulate',
				options: {
					pre: "{{aifmdprov|",
					post: "}}"
				}
			}
		}
	}
});
$('#wpTextbox1').wikiEditor('addToToolbar', {
	section: 'manual',
	group: 'tags',
	tools: {
		"template": {
			label: 'MI2002',
			type: 'button',
			icon: 'https://jollycontrarian.com/images/c/c2/MI2002.png',
			action: {
				type: 'encapsulate',
				options: {
					pre: "{{manual|MI|2002|",
					post: "|Section||medium}}"
				}
			}
		}
	}
});
$('#wpTextbox1').wikiEditor('addToToolbar', {
	section: 'manual',
	group: 'tags',
	tools: {
		"template": {
			label: 'MI1992',
			type: 'button',
			icon: 'https://jollycontrarian.com/images/8/83/MI1992.png',
			action: {
				type: 'encapsulate',
				options: {
					pre: "{{manual|MI|1992|",
					post: "|Section||medium}}"
				}
			}
		}
	}
});
$('#wpTextbox1').wikiEditor('addToToolbar', {
	section: 'manual',
	group: 'tags',
	tools: {
		"template": {
			label: 'MCAE1995',
			type: 'button',
			icon: 'https://jollycontrarian.com/images/b/b3/MCAE1995.png',
			action: {
				type: 'encapsulate',
				options: {
					pre: "{{Manual|MCAE|1995|",
					post: "|Paragraph||medium}}"
				}
			}
		}
	}
});	
$('#wpTextbox1').wikiEditor('addToToolbar', {
	section: 'manual',
	group: 'tags',
	tools: {
		"template": {
			label: 'MCAE2016',
			type: 'button',
			icon: 'https://jollycontrarian.com/images/7/7d/MCAE2016.png',
			action: {
				type: 'encapsulate',
				options: {
					pre: "{{Manual|MCAE|2016|",
					post: "|Paragraph||medium}}"
				}
			}
		}
	}
});	
$('#wpTextbox1').wikiEditor('addToToolbar', {
	section: 'manual',
	group: 'tags',
	tools: {
		"template": {
			label: 'MCAN1994',
			type: 'button',
			icon: 'https://jollycontrarian.com/images/4/44/MCAN1994.png',
			action: {
				type: 'encapsulate',
				options: {
					pre: "{{Manual|MCAN|1994|",
					post: "|Paragraph||medium}}"
				}
			}
		}
	}
});	
$('#wpTextbox1').wikiEditor('addToToolbar', {
	section: 'manual',
	group: 'tags',
	tools: {
		"template": {
			label: 'MCAN2016',
			type: 'button',
			icon: 'https://jollycontrarian.com/images/2/26/MCAN2016.png',
			action: {
				type: 'encapsulate',
				options: {
					pre: "{{Manual|MCAN|2016|",
					post: "|Paragraph||medium}}"
				}
			}
		}
	}
});
$('#wpTextbox1').wikiEditor('addToToolbar', {
	section: 'manual',
	group: 'tags',
	tools: {
		"template": {
			label: 'MSG2010',
			type: 'button',
			icon: 'https://jollycontrarian.com/images/2/26/MCAN2016.png',
			action: {
				type: 'encapsulate',
				options: {
					pre: "{{Manual|MSG|2010|",
					post: "|Clause||medium}}"
				}
			}
		}
	}
});
$('#wpTextbox1').wikiEditor('addToToolbar', {
	section: 'manual',
	group: 'tags',
	tools: {
		"template": {
			label: 'MRG2000',
			type: 'button',
			icon: 'https://jollycontrarian.com/images/2/26/MCAN2016.png',
			action: {
				type: 'encapsulate',
				options: {
					pre: "{{Manual|MRG|2000|",
					post: "|Paragraph||medium}}"
				}
			}
		}
	}
});
$('#wpTextbox1').wikiEditor('addToToolbar', {
	section: 'manual',
	group: 'tags',
	tools: {
		"template": {
			label: 'MCAN2016',
			type: 'button',
			icon: 'https://jollycontrarian.com/images/2/26/MCAN2016.png',
			action: {
				type: 'encapsulate',
				options: {
					pre: "{{Manual|DEQ|2002|",
					post: "|Section||medium}}"
				}
			}
		}
	}
});

};

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