User:IceWelder/USEnglish.js

// NOTICE: This script uses Ohconfucius' EngvarB script, all credit goes to them $.ajax('/w/index.php?title=User:Ohconfucius/script/EngvarB.js&action=raw&ctype=text/javascript', {   dataType: 'script',    cache: true }).then(function {    ohc_retask_pipes = function(editor) {}

ohc_ENGVAR_insert_template = function(editor, variation) { // Add a template to the article identifying English variant // Build a string with "Month YYYY" var date_object = new Date; var month_map = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']; var date_string = month_map[date_object.getMonth] + ' ' + date_object.getFullYear;

var template_string; switch (variation) { case 'B': template_string = ''; break; case 'O': template_string = ''; break; case 'C': template_string = ''; break; case 'U': template_string = ''; break; default: return; }

// Matcher for every English variation template var template_matcher = new RegExp('', 'gi');

// If not already tagged if (!editor.contains(template_matcher)) { // Prepend new template editor.prepend(template_string + '\r\n'); } else { // Replace old template editor.replace(template_matcher, template_string); }   }

ohc_ENGVAR_edit_summary = function(editor, variation) { // Add a tag to the summary box var variation_string; switch (variation) { case 'B': variation_string = 'British English'; break; case 'O': variation_string = 'Oxford spelling'; break; case 'C': variation_string = 'Canadian English'; break; case 'U': variation_string = 'American English'; break; default: return; }

editor.appendEditSummary(variation_string); } });