From 9a538f875aa8de8c2cf602bf86ec6eaa4e40b939 Mon Sep 17 00:00:00 2001 From: Caleb Spare Date: Wed, 22 Aug 2012 15:19:29 -0700 Subject: Prompt if exiting the options page with unsaved changes. Fixes #549. --- options/options.coffee | 3 +++ 1 file changed, 3 insertions(+) diff --git a/options/options.coffee b/options/options.coffee index 9f43defd..248750ca 100644 --- a/options/options.coffee +++ b/options/options.coffee @@ -28,6 +28,9 @@ document.addEventListener "DOMContentLoaded", -> document.getElementById("restoreSettings").addEventListener "click", restoreToDefaults document.getElementById("saveOptions").addEventListener "click", saveOptions +window.onbeforeunload = -> + if $("saveOptions").disabled then null else "You have unsaved changes to options." + onOptionKeyup = (event) -> if (event.target.getAttribute("type") isnt "checkbox" and event.target.getAttribute("savedValue") isnt event.target.value) -- cgit v1.2.3