]> git.wh0rd.org - chrome-ext/wake-on-lan.git/blobdiff - js/main.js
add a light/dark theme selector
[chrome-ext/wake-on-lan.git] / js / main.js
index b6ce2a9f6d184677d098dca4300a5a27fc64a0fa..0978f8faf0999fa434c5e2642aeedadcdb9e7821 100644 (file)
@@ -199,12 +199,14 @@ var settings_keys = [
        'mac',
        'pass',
        'port',
+       'theme',
 ];
 
 function load_settings() {
        var storage = chrome.storage.local;
 
        chrome.storage.local.get(settings_keys, function(settings) {
+               set_theme(settings['theme'] || 'dark');
                var form = $$('form[name=settings]');
                form.host.value = settings['host'] || '192.168.0.255';
                form.port.value = settings['port'] || '40000';
@@ -227,6 +229,7 @@ function store_settings() {
                'mac': form.mac.value,
                'pass': form.pass.value,
                'port': form.port.value,
+               'theme': curr_theme,
        };
        chrome.storage.local.set(settings);
 }
@@ -238,6 +241,7 @@ window.onload = function() {
        $$('form[name=settings]').onsubmit = send;
        $$('a[name=mac-paste]').onclick = paste_mac;
        $$('a[name=pass-paste]').onclick = paste_pass;
+       $$('input[name=theme]').onclick = toggle_theme;
 
        load_settings();
 };