From: Mike Frysinger Date: Sun, 12 Mar 2017 06:43:03 +0000 (-0800) Subject: pull default settings out into constants X-Git-Tag: v0.2.0~2 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=e54503ce22e4745dcb7489fc1d83087c22986514;p=chrome-ext%2Fwake-on-lan.git pull default settings out into constants --- diff --git a/js/main.js b/js/main.js index 0978f8f..bfe3530 100644 --- a/js/main.js +++ b/js/main.js @@ -202,20 +202,26 @@ var settings_keys = [ 'theme', ]; +var default_theme = 'dark'; +var default_host = '192.168.0.255'; +var default_port = '40000'; +var default_mac = '20:00:00:00:00:00'; +var default_pass = '00:00:00:00:00:00'; + function load_settings() { var storage = chrome.storage.local; chrome.storage.local.get(settings_keys, function(settings) { - set_theme(settings['theme'] || 'dark'); + set_theme(settings['theme'] || default_theme); var form = $$('form[name=settings]'); - form.host.value = settings['host'] || '192.168.0.255'; - form.port.value = settings['port'] || '40000'; + form.host.value = settings['host'] || default_host; + form.port.value = settings['port'] || default_port; // We assume we only get called during init. paste_mac(); - form.mac.value = settings['mac'] || '20:00:00:00:00:00'; + form.mac.value = settings['mac'] || default_mac; paste_mac(); paste_pass(); - form.pass.value = settings['pass'] || '00:00:00:00:00:00'; + form.pass.value = settings['pass'] || default_pass; paste_pass(); }); }