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

Content deleted Content added
temporary revert for testing
Undid revision 950261326 by DemonDays64 (talk)
Line 3:
 
$(document).ready(function () {
var pageBeforeEdit;
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);
}
function doEdit() {
document.editform.wpTextbox1.value = modifiedPage;
}
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;
var modifiedPage = originalPagepageBeforeEdit;
 
makeAndRunRegex(/a/g, "b")
modifiedPage = modifiedPage.replace(singleQuoteRegex.find, singleQuoteRegex.replace);
makeAndRunRegex(/e/g, 'd')
modifiedPage = modifiedPage.replace(doubleQuoteRegex.find, doubleQuoteRegex.replace);
doEdit();
document.editform.wpTextbox1.value = modifiedPage;
document.editform.wpSummary.value = 'setEditSummary("Replaced smart quotes with dumb. Problem? [[User talk:DemonDays64|Tell me]].'", true);
setEditSummary();
document.editform.diff();
}