This script is no longer needed
Stack Exchange now denotes that you've already voted to close/reopen/delete/undelete with an asterisk, e.g. Delete (1*)
. Thus, this script isn't really needed anymore.
About
Ever forget you voted to delete something and ended up retracting your vote accidentally?
Well, so have a bunch of other people, myself included, so let's make that a bit more obvious.
This script renames the "Delete" button to "Retract Delete" if you've already voted to delete a particular post, making it more obvious that you've already voted. The same will occur with the "Undelete" button.
It also makes the prompts when clicking this button more obvious that you're retracting a vote, rather than casting one.
For keyboard shortcut users, the simple alert modal is replaced with a Stacks showConfirmModal
that's very in-your-face and defaults to "Cancel" to prevent muscle-memory from doing something you might not have wanted to do.
The same treatment is given to reopen votes, as the confirmation dialog presented to the user isn't eye-catchingly different enough when you're about to retract a reopen vote:
Installation
Most script managers should be able to run this without any issues. I've only tested Tampermonkey and Violentmonkey, though.
Click to install with a script manager
Repository
If you run into a problem, feel free to let me know, I'll do my best to fix it. Otherwise, you're always free to fix it yourself with a pull request. My JavaScript/jQuery knowledge could use some serious refining, so don't expect greatness.