2015-01-27 05:06:00 +08:00
|
|
|
|
2016-06-30 08:02:45 +08:00
|
|
|
var
|
|
|
|
ko = require('ko'),
|
2015-01-27 05:06:00 +08:00
|
|
|
|
2016-06-30 08:02:45 +08:00
|
|
|
Utils = require('Common/Utils'),
|
2015-01-27 05:06:00 +08:00
|
|
|
|
2016-06-30 08:02:45 +08:00
|
|
|
Settings = require('Storage/Settings');
|
2015-01-27 05:06:00 +08:00
|
|
|
|
2016-06-30 08:02:45 +08:00
|
|
|
/**
|
|
|
|
* @constructor
|
|
|
|
*/
|
|
|
|
function ThemeStore()
|
|
|
|
{
|
|
|
|
this.themes = ko.observableArray([]);
|
|
|
|
this.themeBackgroundName = ko.observable('');
|
|
|
|
this.themeBackgroundHash = ko.observable('');
|
2015-01-27 05:06:00 +08:00
|
|
|
|
2016-06-30 08:02:45 +08:00
|
|
|
this.theme = ko.observable('')
|
|
|
|
.extend({'limitedList': this.themes});
|
|
|
|
}
|
2015-01-27 05:06:00 +08:00
|
|
|
|
2016-06-30 08:02:45 +08:00
|
|
|
ThemeStore.prototype.populate = function()
|
|
|
|
{
|
|
|
|
var aThemes = Settings.appSettingsGet('themes');
|
2015-01-27 05:06:00 +08:00
|
|
|
|
2016-06-30 08:02:45 +08:00
|
|
|
this.themes(Utils.isArray(aThemes) ? aThemes : []);
|
|
|
|
this.theme(Settings.settingsGet('Theme'));
|
|
|
|
this.themeBackgroundName(Settings.settingsGet('UserBackgroundName'));
|
|
|
|
this.themeBackgroundHash(Settings.settingsGet('UserBackgroundHash'));
|
|
|
|
};
|
2015-01-27 05:06:00 +08:00
|
|
|
|
2016-06-30 08:02:45 +08:00
|
|
|
module.exports = new ThemeStore();
|