Skip to content

Commit

Permalink
Only saving setting when leaving web-interface when inputs are still …
Browse files Browse the repository at this point in the history
…focues.
  • Loading branch information
benjaminfuchs committed Dec 23, 2017
1 parent 2589b17 commit ebfbcef
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
// Update settings before leaving page.
$(window).bind('beforeunload', function(){
console.log("Updating alarm with current settings before leaving page.");
saveSettings();
if(document.getElementById("select_sound").is(':focus') ||
document.getElementById("alarm_time").is(':focus')) {
console.log("Updating alarm with current settings before leaving page.");
saveSettings();
}
});

(function(window, document) {
Expand Down

0 comments on commit ebfbcef

Please sign in to comment.