From e4210300ce521368e6e6dccc3b4471e72d4e1e78 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Tue, 4 Mar 2014 19:53:20 -0800 Subject: adjust volume with scroll wheel --- settings.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'settings.js') diff --git a/settings.js b/settings.js index cc4a30d5..dc913e15 100644 --- a/settings.js +++ b/settings.js @@ -3,10 +3,15 @@ function setting(name) { return JSON.parse(localStorage[name]); } +// Settings should be changed with this function +function changeSetting(name, value) { + localStorage[name] = JSON.stringify(value); +} + // Default settings function setDefault(name, value) { if (!(name in localStorage)) { - localStorage[name] = JSON.stringify(value); + changeSetting(name, value); } } setDefault("videoexpand", true); @@ -38,9 +43,9 @@ function refreshSettings() { function setupControl(control) { if (control.addEventListener) control.addEventListener("change", function(e) { if (control.type == "checkbox") { - localStorage[control.name] = JSON.stringify(control.checked); + changeSetting(control.name, control.checked); } else if (control.type == "range") { - localStorage[control.name] = JSON.stringify(control.value); + changeSetting(control.name, control.value); } }, false); } -- cgit v1.3