background.js
// gets all or some options, filling in defaults when needed
gets all or some options, filling in defaults when needed
gets all or some options filling in defaults when needed
function GetOptions()
{
    var options;
    var defaultOptions = GetDefaultOptions();
    if(localStorage["options"] == null)
    {
        options = GetDefaultOptions();
    }
    else
    {
        options = JSON.parse(localStorage["options"]);
        for (key in defaultOptions)
        {
            if(options[key] == undefined)
            {
                options[key] = defaultOptions[key];
            }
        }
    }
    return options;
}
function GetOptions ( ) { var options ; var defaultOptions = GetDefaultOptions ( ) ; if ( localStorage [ "options" ] == null ) { options = GetDefaultOptions ( ) ; } else { options = JSON . parse ( localStorage [ "options" ] ) ; for ( key in defaultOptions ) { if ( options [ key ] == undefined ) { options [ key ] = defaultOptions [ key ] ; } } } return options ; }
gets all or some options, filling in defaults when needed
gets all or some options filling in defaults when needed
// fill in defaults for new options