Deep extend diff settings to preserve defaults

This commit is contained in:
Jesse van den Kieboom 2015-03-15 10:57:04 +01:00
parent 28f7631be7
commit 3557112676

View file

@ -15,7 +15,7 @@ var params = function(query) {
return ret;
}(document.location.search.substring(1));
var settings = {
var default_settings = {
wrap: true,
tab_width: 4,
debug: false,
@ -34,10 +34,15 @@ var settings = {
};
var avatar_cache = {};
var settings;
if ('settings' in params)
{
$.extend(settings, JSON.parse(params.settings));
settings = $.extend(true, {}, default_settings, JSON.parse(params.settings));
}
else
{
settings = default_settings;
}
var escapeDiv = document.createElement('div');
@ -516,7 +521,7 @@ function update_diff(id, lsettings)
if (typeof lsettings != 'undefined')
{
$.extend(settings, lsettings);
settings = $.extend(true, {}, default_settings, lsettings);
}
workeruri = 'diff-view-html-builder.js';