User:Micki/templates.js

From Meta, a Wikimedia project coordination wiki

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
/**
 * 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() {
	function autoSubmit() { $('#wpSave').click(); }
	
	pathoschild.TemplateScript.add(
		[
			{ name: 'Attack', template: '{{subst:attack}}~~~~', editSummary: 'attack', headline: 'Attacks', script: autoSubmit },
			{ name: 'Blocked', template: '{{subst:blocked|1=length|2=reason|sig=~~~~}}', editSummary: 'block', headline: 'Block' },
			{ name: 'Deleted userpage', template: '{{subst:deleted userpage}}', editSummary: 'deleted userpage', headline: 'Deleted page', script: autoSubmit },
			{ name: 'No recreate', template: '{{subst:norecreate}}~~~~', editSummary: 'no recreate', headline: 'Recreating pages', script: autoSubmit },
			{ name: 'Not Wikipedia', template: '{{subst:notwp}} ~~~~', editSummary: 'notwp', headline: 'Off-topic', script: autoSubmit },
			{ name: 'Off topic', template: '{{subst:offtopic}}', editSummary: 'off-topic', headline: 'Off-topic', script: autoSubmit },
			{ name: 'Off topic edits', template: '{{subst:offtopic-edits}}', editSummary: 'off-topic', headline: 'Off-topic', script: autoSubmit },
			{ name: 'Spam', template: '{{subst:spam}}', editSummary: 'spam', headline: 'Spam', script: autoSubmit },
			{ name: 'Test 1', template: '{{subst:test1}}~~~~', editSummary: 'test', headline: 'Test', script: autoSubmit },
			{ name: 'Test 2', template: '{{subst:test2}}~~~~', editSummary: 'test2', headline: 'Test', script: autoSubmit },
			{ name: 'Test 3', template: '{{subst:test3}}~~~~', editSummary: 'test3', headline: 'Test', script: autoSubmit },
			{ name: 'Test 4', template: '{{subst:test4}}~~~~', editSummary: 'test4', headline: 'Test', script: autoSubmit },
			{ name: 'Welcome', template: '{{subst:welcome}} ~~~~', editSummary: 'welcome', script: autoSubmit  }
		],
		{ category:'Templates', forNamespaces:'user talk' }
	);
});
// </nowiki>