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

Content deleted Content added
hmm
temporary revert for testing
Line 3:
 
$(document).ready(function () {
var pageBeforeEdit;
var modifiedPage;
 
//add a tab on the left
Line 10 ⟶ 8:
$(dumbQuotesLink).click(function (event) {
event.preventDefault();
editPagesetDumbQuotes();
});
 
function runRegex(regex) {
function setEditSummary(summary, isMinor) {
modifiedPage = modifiedPage.replace(regex.find, regex.replace);
document.editform.wpMinoredit.checked = isMinortrue;
setEditSummary("document.editform.wpSummary.value = 'Replaced smart quotes with dumb. Problem? [[User talk:DemonDays64|Tell me]].", true)';
doaction('diff');
}
function runRegexsetDumbQuotes(regex) {
var regexObjectsingleQuoteRegex = {
find: /(‘|’)/g,
replace: replace"'"
}
 
var doubleQuoteRegex = {
function makeAndRunRegex(findRegex, replace) {
find: /(“|”)/g,
var regexObject = {
findreplace: findRegex,'"'
replace: replace
}
runRegex(regexObject);
}
function doEdit() {
document.editform.wpTextbox1.value = modifiedPage;
}
function setEditSummary(summary, isMinor) {
document.editform.wpMinoredit.checked = isMinor;
document.editform.wpSummary.value = summary;
}
function showDiff() {
document.editform.diff();
}
function editPage() {
 
pageBeforeEditvar originalPage = document.editform.wpTextbox1.value;
var modifiedPage = pageBeforeEditoriginalPage;
 
modifiedPage = modifiedPage.replace(regexsingleQuoteRegex.find, regexsingleQuoteRegex.replace);
makeAndRunRegex(/a/g, "b")
modifiedPage = modifiedPage.replace(doubleQuoteRegex.find, doubleQuoteRegex.replace);
makeAndRunRegex(/e/g, 'd')
document.editform.wpTextbox1.value = modifiedPage;
doEdit();
setEditSummary();
setEditSummary("Replaced smart quotes with dumb. Problem? [[User talk:DemonDays64|Tell me]].", true);
document.editform.diff();
}