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

Content deleted Content added
updated version
Line 1:
/*
\\\Quick scripts///
* A rudimentary thing to copy and paste to make a regex find and replace script.
* To edit, go to editArticle() and edit makeAndRunRegex(). Call it again to add another search.
* Remember to set portledId, linkURL, linkText, and tooltip (along with the others if you want)
 
*/
mw.loader.using('mediawiki.util', function () {
 
Line 23 ⟶ 16:
});
 
function setEditSummary(summary, isMinor) {
document.editform.wpMinoredit.checked = trueisMinor;
document.editform.wpSummary.value = summary;
doaction('diff');
}
 
Line 33 ⟶ 25:
}
 
function makeAndRunRegex(name, findRegex, replace) {
var nameregexObject = {
find: findRegex,
replace: replace
}
runRegex(nameregexObject);
}
 
Line 51 ⟶ 43:
//EDIT HERE
function editArticle() {
var originalPage = document.editform.wpTextbox1.value;
var modifiedPage = originalPage;
 
makeAndRunRegex(singleQuoteRegex, /(‘|’)/g, "'");
makeAndRunRegex(doubleQuoteRegex, /(“|”)/g, '"');
 
makeAndRunRegex(/find (regex)/g, "replace");
doEdit();
setEditSummary("summary", true);
showDiff();
}