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

Content deleted Content added
Revert to https://en.wikipedia.org/w/index.php?title=User:DemonDays64/Scripts/Dumb_quotes.js&oldid=950073978
Update (I'm making progress on my library)
Line 3:
 
$(document).ready(function () {
var modifiedPage = originalPage;
var modifiedPage;
 
//add a tab on the left
Line 8 ⟶ 10:
$(dumbQuotesLink).click(function (event) {
event.preventDefault();
setDumbQuoteseditPage();
});
function setDumbQuotesrunRegex(regex) {
 
modifiedPage = modifiedPage.replace(singleQuoteRegexregex.find, singleQuoteRegexregex.replace);
function setEditSummary() {
document.editform.wpMinoredit.checked = true;
document.editform.wpSummary.value = 'Replaced smart quotes with dumb. Problem? [[User talk:DemonDays64|Tell me]].';
doaction('diff');
}
function setDumbQuotes() {
var singleQuoteRegex = {
find: /(‘|’)/g,
replace: "'"
}
 
function makeAndRunRegex(findRegex, replace) {
var doubleQuoteRegex = {
var singleQuoteRegexregexObject = {
find: /(“|”)/g,
replacefind: '"'findRegex,
replace: "'"replace
}
runRegex(regexObject);
 
}
var originalPage = document.editform.wpTextbox1.value;
function doEdit() {
var modifiedPage = originalPage;
 
modifiedPage = modifiedPage.replace(singleQuoteRegex.find, singleQuoteRegex.replace);
modifiedPage = modifiedPage.replace(doubleQuoteRegex.find, doubleQuoteRegex.replace);
document.editform.wpTextbox1.value = modifiedPage;
}
setEditSummary();
function setEditSummary(summary, isMinor) {
document.editform.wpMinoredit.checked = trueisMinor;
document.editform.wpSummary.value = summary;
}
function showDiff() {
document.editform.diff();
}
function editPage() {
 
var originalPagepageBeforeEdit = document.editform.wpTextbox1.value;
modifiedPage = pageBeforeEdit;
 
find: makeAndRunRegex(/(‘|’)/g, "'")
find: makeAndRunRegex(/(“|”)/g, '"')
doEdit();
document.editform.wpSummary.value = 'setEditSummary("Replaced smart quotes with dumb. Problem? [[User talk:DemonDays64|Tell me]].'", true);
showDiff();
}
});