Add default settings again

This commit is contained in:
Lorenz Hübschle-Schneider 2014-12-30 20:24:33 +01:00 committed by Tor Hveem
parent be6e356363
commit 54bb9dad13
2 changed files with 29 additions and 0 deletions

View file

@ -17,6 +17,26 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
$scope.command = ''; $scope.command = '';
$scope.themes = ['dark', 'light']; $scope.themes = ['dark', 'light'];
settings.setDefaults({
'theme': 'dark',
'host': 'localhost',
'port': 9001,
'ssl': (window.location.protocol === "https:"),
'savepassword': false,
'autoconnect': false,
'nonicklist': utils.isMobileUi(),
'noembed': utils.isMobileUi(),
'onlyUnread': false,
'hotlistsync': true,
'orderbyserver': true,
'useFavico': true,
'showtimestamp': true,
'showtimestampSeconds': false,
'fontsize': '14px',
'fontfamily': (utils.isMobileUi() ? 'sans-serif' : 'Inconsolata, Consolas, Monaco, Ubuntu Mono, monospace'),
'readlineBindings': false
});
$scope.settings = settings; $scope.settings = settings;
// From: http://stackoverflow.com/a/18539624 by StackOverflow user "plantian" // From: http://stackoverflow.com/a/18539624 by StackOverflow user "plantian"

View file

@ -53,6 +53,15 @@ weechat.factory('settings', ['$store', '$rootScope', function($store, $rootScope
}, 0); }, 0);
}; };
this.setDefaults = function(defaults) {
for (var key in defaults) {
// null means the key isn't set
if ($store.get(key) === null) {
this[key] = defaults[key];
}
}
};
return this; return this;
}]); }]);