This is a simple Greasemonkey script which adds Save and Clear buttons for use when composing question/answer drafts. Otherwise when editing a post, it checks for updates from concurrent edits. As an added bonus, the Save hotkey (Ctrl+S) returns along with a Clear hotkey (Ctrl+Backspace) and a "Return to Question" link has been added when editing questions, useful if you want to open the question in a separate tab after having started editing.
This is an alternative implementation of the script found here from which the code was inspired by. It unfortunately didn't handle certain use cases well, this aimed to improve on it.
There are primarily 2 aspects of the original script that I wanted to improve on:
- Control when the links would be included and what type of link it was.
You can save drafts of new questions or answers but not when edits are made as far as I can tell. So the appropriate link names are used for each view.
- It was impossible to clear the contents until you pressed a keyboard key within the editor.
This will simulate a key press prior to attempting to save or clear so the changes go through.
Written for and tested on Firefox 4.0 on Windows 7. I will be trying to maintain compatibility with Chrome in future releases. Specifically on Chrome 11.0 on Windows XP. Hopefully combinations of either browser and OS will still work.
This will be part of a larger project which is a collection of scripts to enhance Stack Exchange if and when I figure out how to do it.