User:DemonDays64/Scripts/Dumb quotes.js: Difference between revisions

Content deleted Content added
Undid revision 968184943 by DemonDays64 (talk)
Revert
Line 1:
// Make sure the utilities module is loaded (will only load if not already)
// !!!!!!!! IMPORTANT !!!!!!!!
// When installed at [[Special:MyPage/common.js]]
// if you want to have it edit foreign characters (i.e. ‹single guillemets›, «double guillemets», and „comma-level quotes”)
// YOU MUST PUT THE FOLLOWING LINE ON THE PAGE **BEFORE** THE LINE TO IMPORT Dumb quotes.js:
/*
 
var editOtherQuotes = true;
 
*/
// otherwise only standard curly quotes and backticks will be fixed.
 
mw.loader.using('mediawiki.util', function () {
 
Line 16 ⟶ 6:
var modifiedPage;
var previousSummary;
if (editOtherQuotes == null) {
var editOtherQuotes = false;
}
 
//add a tab on the left
Line 59 ⟶ 46:
modifiedPage = pageBeforeEdit;
 
//‘Single smart quotes’
makeAndRunRegex(/(‘|’)/g, "'");
//“Double smart quotes”
makeAndRunRegex(/(“|”)/g, '"');
makeAndRunRegex(/(«|»)/g, '"');
 
makeAndRunRegex(/(‹|›)/g, "'");
//`Backticks´
makeAndRunRegex(/(`|´)/g, '"');
 
if (editOtherQuotes) {
//‹Single guillemets›
makeAndRunRegex(/(‹|›)/g, "'");
//«Double guillemets»
makeAndRunRegex(/(«|»)/g, '"');
 
//‚Single down quotes‘
makeAndRunRegex(/‚/g, "'");
//„Double down quotes“
makeAndRunRegex(/„/g, '"');
}
 
doEdit();
setEditSummary("StandardizedReplaced quotesmart stylesquotes with dumb with [[User:DemonDays64/Scripts/Dumb quotes.js|script]] per [[MOS:CQ]]. Problem? [[User talk:DemonDays64|Tell the author]]", true);
showDiff();
}