Jump to content

User:GorillaWarfare/script/curlies.js

From Wikipedia, the free encyclopedia

This is the current revision of this page, as edited by GorillaWarfare (talk | contribs) at 16:07, 30 December 2020 (do this the same way OhConfucius does). The present address (URL) is a permanent link to this version.

(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
 // This script replaces curly quotes (“”‘’) with straight quotes ("') per the
 // guidance at [[MOS:CURLY]].
 
 /**
 * 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([
		{
			name: 'Curlies',
			script: function(editor) {
				editor
					.replace(/[“”]/g, '"')
					.replace(/[‘’]/g, "'")
					.options({ minor: true })
					.appendEditSummary("replaced curly quotes (“”‘’) with straight quotes (\"') per [[MOS:CURLY]], by [[User:GorillaWarfare/script/curlies.js|script]]")
					.clickDiff();
			}
		},
	]);
});
// </nowiki>