Browse Source

preferences now set default if no value is stored

master
edoardoo 10 years ago
parent
commit
2bd58959f3
2 changed files with 8 additions and 10 deletions
  1. +1
    -1
      main.js
  2. +7
    -9
      preferences/preferences.js

+ 1
- 1
main.js View File

@ -7,7 +7,7 @@ function setupVideoObject(){
};
}
// not actually working:
function getSettings( setting ){
var value = chrome.storage.sync.get( setting, function(obj){
settings = obj;


+ 7
- 9
preferences/preferences.js View File

@ -240,8 +240,11 @@ function updateSettings( storedSettings ){
var type = settingObject.getAttribute('data-type');
var settingValue = settings[i].defaultValue;
var usedDefault = true;
if( storedSettings[ settingId ] ){
settingValue = storedSettings[settingId];
usedDefault = false;
}
switch( type ){
case ( "checkbox" ):
@ -260,17 +263,12 @@ function updateSettings( storedSettings ){
settingObject.childNodes[1].childNodes[0].value = settingValue;
break;
}
if( usedDefault ){
saveSettings.call( displayedSettings[i] );
}
};
// for( var settingId in storedSettings ){
// settingId = String( settingId );
// settingObject = document.getElementById( "setting_"+settingId );
// if( typeof settingObject != "undefined" && settingObject != null){
// }
// }
}


Loading…
Cancel
Save