HN: "Save to drafts" plugin / extension / script / button
New here? Learn about Bountify and follow @bountify to get notified of new bounties! x

See this screenshot of the website HackerNews. I've added a button.

Expected behaviour

A user types text into the text entry box. The user clicks the (save to drafts) button. Instead of posting the text to hacker news the plugin / extension / script will save the text to the user's local machine. There will also be some kind of link to the reply the text would have been for with the text. The screenshot shows item?id=4794227. That fragment is enough information.

Requirements and clarifications

1) Must work in either Chrome or Firefox on OS X.

2) Use any technology you like. Greasemonkey scripts or plugins or anything is fine.

3) The saved file should be human readable text file. I don't particularly care how you delimit the URLs and the saved text and the next URL etc.

4) Drafts can either be one enormous text file, or a folder with single files for each draft post. The name is unimportant.

5) options (if any) should be user configurable. This can be with command line switches, or editing a config file, or editing the script. Pretty much anything short of recompilation of a binary is acceptable.

6) I'm not sure how licensing works on bountify, but you'll own this and can release it under any licence you like. You can also do the "show HN" post if you want.

7) I'm going to leave this open for the full week before I award the bounty.

Please don't hesitate to ask me if I can provide any clarification, and thank you for reading this bounty.

could the draft be saved to the browser's localStorage or does it need to be written to a file? ... localStorage would make this really easy
slang over 7 years ago
"There will also be some kind of link to the reply the text would have been for with the text. The screenshot shows item?id=4794227." Could you clarify this part?
weslly over 7 years ago
When the user is viewing the drafts there should be the text of the draft message, and there should also be an url of the message that the user was replying to. The drafts can be saved anywhere, so long as they are viewable in future somehow by the user.
danbc over 7 years ago
New draft for the same message must override old one or all drafts must be stored?
AjiTae over 7 years ago
awarded to slang

Crowdsource coding tasks.

2 Solutions

Here is my solution as a chrome extension,

extension files

crx file

If you see any bug, I can fix it. And If you like it, I can also publish it in google chrome webstore.

Winning solution


After literally 25 lines of CoffeeScript, it seems to all be working!

I made this as a Userscript script that saves your drafts to your browser's localStorage. The script adds a button to HN which, when clicked, saves whatever text you have in the textarea. When you navigate to a page where you have saved a draft, your saved text is automatically loaded. All interaction is done without leaving HN because the script adds all needed controls directly to the website.

It works in both Greasemonkey and Tampermonkey (Firefox and Chrome, respectively)... and because it is so simple, it probably works with similar plugins too.

To install, get one of the plugins mentioned above and then click here.

I would be happy to add any other features you like (within reason), such as:

  • fancy automatic saving (like gmail does for drafts)
  • discard draft button on the side of the save button

... whatever you would like!

Update: Added a table to the account settings page that lists all the drafts you have saved on your browser, as well as some other improvements.

View Timeline