MediaWiki:Gadget-TemplateScript.js: Difference between revisions

MediaWiki interface page
(Created page with "→‎* * TemplateScript adds configurable templates and scripts to the sidebar, and adds an example regex editor. * @see https://meta.wikimedia.org/wiki/TemplateScript * @update-token [[File:Pathoschild/templatescript.js]]: // <nowiki> $.ajax('//tools-static.wmflabs.org/meta/scripts/pathoschild.templatescript.js', { dataType:'script', cache:true }).then(function() { pathoschild.TemplateScript.add([ // add your own templates or scripts here { name: 'welcome', temp...")
 
No edit summary
Line 5: Line 5:
  */
  */
// <nowiki>
// <nowiki>
mw.config.set('userjs-templatescript', { regexEditor: false });
$.ajax('//tools-static.wmflabs.org/meta/scripts/pathoschild.templatescript.js', { dataType:'script', cache:true }).then(function() {
$.ajax('//tools-static.wmflabs.org/meta/scripts/pathoschild.templatescript.js', { dataType:'script', cache:true }).then(function() {
pathoschild.TemplateScript.add([
pathoschild.TemplateScript.add([

Revision as of 16:23, 12 July 2023

/**
 * TemplateScript adds configurable templates and scripts to the sidebar, and adds an example regex editor.
 * @see https://meta.wikimedia.org/wiki/TemplateScript
 * @update-token [[File:Pathoschild/templatescript.js]]
 */
// <nowiki>
mw.config.set('userjs-templatescript', { regexEditor: false });
$.ajax('//tools-static.wmflabs.org/meta/scripts/pathoschild.templatescript.js', { dataType:'script', cache:true }).then(function() {
	pathoschild.TemplateScript.add([
		// add your own templates or scripts here
		{ name: 'welcome', template: '{{subst:welcome}} ~~~~', position: 'after', editSummary: 'welcome!', forNamespaces: 'user talk' },
	]);
});
// </nowiki>