User:BethNaught/BNUtils.js

/** * TemplateScript adds configurable templates and scripts to the sidebar, and adds an example regex editor. * @see https://meta.wikimedia.org/wiki/TemplateScript * @update-token */ $.ajax('//tools-static.wmflabs.org/meta/scripts/pathoschild.templatescript.js', { dataType:'script', cache:true }).then(function {	// Page: NS	pathoschild.TemplateScript.add([ { category: 'BNUtils', name: 'Append ', script: function(editor) { editor.append('\n') }		},

{ category: 'BNUtils', name: 'Blank footer', script: function(editor) { editor.forField('#wpFooterTextbox').set("") }		},

{ category: 'BNUtils', name: 'Delig. fi, fl', script: function(editor) { editor.replace(/ﬁ/g, 'fi'); editor.replace(/ﬂ/g, 'fl') }		 },

{ category: 'BNUtils', name: 'Despace emdashes', script: function(editor) { editor.replace(/ —/g, '—'); editor.replace(/— /g, '—'); }		},		{ category: 'BNUtils', name: 'Gen. misc. cleanup', script: function(editor) { editor.replace(/\n" /g, '\n"'); editor.replace(/\/'/g, ',"')		 }		},		{ category: 'BNUtils',		  name: 'Insert ',		  template: '',		  position: 'cursor'		},

{ category: 'BNUtils', name: 'Remove first line', script: function(editor) { editor.replace(/^.*\n/, ''); },		},

/** Not currently in use { category: 'BNUtils', name: 'smaller B.C./A.D.', script: function(editor) { editor.replace(/(B\.C\.|A\.D\.)/g, '$1') }		}, **/	],	{ forNamespaces: 'page' } );	// Main NS	pathoschild.TemplateScript.add([ { category: 'BNUtils', name: ' ', template: ' ', position: 'cursor' },		{ category: 'BNUtils', name: 'break', template: '', position: 'cursor' },		{ category: 'BNUtils', name: '', template: '', position: 'cursor' }	],	{ forNamespaces: [0] } ) });