# Description

Gives you little checkboxes above the edit summary with preset options like "formatted code" or "removed signature."

# Userscript

http://userscripts.org/scripts/show/184914

# Code

// ==UserScript==
// @name       Edit summary options
// @description  Gives you little checkboxes above the edit summary with preset options like "formatted code" or "removed signature."
// @version    1.0
// @match      http://*.mathoverflow.net/*
// @match      http://*.onstartups.com/*
// @match      http://*.serverfault.com/*
// @match      http://*.stackapps.com/*
// @match      http://*.stackexchange.com/*
// @match      http://*.stackoverflow.com/*
// @match      http://*.superuser.com/*
// ==/UserScript==

var config = localStorage.__edit_summary_opts_config || {
Grammar: 'fixed grammar',
Spelling: 'fixed spelling',
Format: 'formatting',
'Code Format': 'formatted code',
Dethank: 'removed thanks',
Desig: 'removed signature',
Degreet: 'removed greeting'
}

$('.edit-post').click(function() { var intr = setInterval(function() { var ec =$('.edit-comment')
if (ec.length) {
clearInterval(intr)
ec.css('opacity', '1')
var i = 0
var summaryDiv = ec.parents().eq(4)
for (var x in config) {
summaryDiv.before($('<input>').attr({type: 'checkbox', id: 'cb' + i}) .change((function(x) { return function() { if (this.checked) { ec.val(ec.val() ? ec.val() + ', ' + config[x] : config[x]) } else { ec.val(ec.val().replace(new RegExp(config[x] + '(, )?|, ' + config[x] + '$'), ''))
}
}})(x)))
.before($('<label>').attr({for: 'cb' + i++}) .css({padding: '5px'}) .text(x)) } summaryDiv.after($('<button>').text('Edit')
.click(function() {
config = localStorage.__edit_summary_opts_config = JSON.parse(prompt('Enter JSON, formatted like {"checkbox name": "value", ...}', JSON.stringify(config)) || JSON.stringify(config))
}))
}
}, 100)
})


# Issues

• Make config... well... configurable, so user can set his/her own options (save with localStorage)
• Make it work for suggested edits too
• Text in the edit summary is a bit messed up when you click edit a second time on a different post on the same page
-
This doesn't seem to work. I don't see the check boxes when I click the edit link and launch the Edit page. – ADTC Jan 25 '14 at 1:45
@ADTC You don't have 2000 rep. This script requires that. – Doorknob Jan 25 '14 at 1:48
That doesn't make any sense. I'm always making suggested edits, and I would find this script incredibly useful in making it easier. I'm constantly finding myself typing the same summaries over and over again. – ADTC Jan 25 '14 at 1:52
@ADTC Alright, added [feature-request] (I haven't actually worked on this for a while... or at all, so I think I will now :P) – Doorknob Jan 25 '14 at 1:52
Mind explaining what .edit-post is, and whether it has to be clicked before the check boxes can be displayed? I had been trying to modify the script to work with the suggested edit page, but can't get it to even make an alert for the life of me.. I thought both suggested edit and >2000 rep edit are the same page in code, so it just flies past my head why this script wouldn't work for suggested edit... – ADTC Jan 25 '14 at 7:03
Actually Chrome's Inspector shows \$ is not defined. Even changing to jQuery doesn't help: jQuery is not defined. Now the question is, how did you get the extension to run its JS only after jQuery JS was loaded? – ADTC Jan 25 '14 at 7:47
I have made changes to the script to make it run in Chrome, and to make it work for suggested edits. Note that this is not a revised version. Doorknob, please use this script to improve yours. I hope you will test in Chrome as I found the localStorage to break. Download from Dropbox – ADTC Jan 25 '14 at 9:05
This doesn't work for me at all - I have 2000 rep, but I don't see the checkboxes – Alex K Dec 4 '14 at 8:05
For those having problems with this script, see Request for script, or fix, to add Edit-Reason checkboxes -- where you can find whole new script(s) that are tested against the latest Stack Exchange and work for all edits, suggested edits, and review edits -- irregardless of how much rep you have. – Brock Adams Jan 16 '15 at 0:24