Re: Greasemonkey script to prompt confirmation before closing draft.

I can swear I've lost over 10,000 words due to browser mishaps while using the draft editor. I hit some hotkey or misclick or the internet eats my homework and bang! draft lost.

While premium comes with auto-save, I don't have one. While I could write in google docs and then copy-paste, I don't want to.

Therefore I whipped up a simple greasemonkey script that prompts when a draft is being unloaded. Saved me some 4,000 words already.

Without further ado, here it is:

// ==UserScript==
// @name RoyalRoad Unload Warning
// @namespace MDW
// @description makes a yes / no window pop up when a draft is about to be unloaded.
// @include **
// ==/UserScript==
window.addEventListener ('beforeunload', confirmClose, false);

function confirmClose (zEvent) {
    zEvent.preventDefault ();