2016-07-16 03:54:37 +08:00
|
|
|
import ko from 'ko';
|
|
|
|
|
2021-03-10 18:44:48 +08:00
|
|
|
import { SettingsGet } from 'Common/Globals';
|
2020-08-07 00:24:46 +08:00
|
|
|
import { settingsSaveHelperSimpleFunction } from 'Common/Utils';
|
2016-07-16 03:54:37 +08:00
|
|
|
|
2020-09-15 01:40:56 +08:00
|
|
|
import Remote from 'Remote/Admin/Fetch';
|
2016-08-24 06:17:50 +08:00
|
|
|
|
2021-01-22 23:32:08 +08:00
|
|
|
export class BrandingAdminSettings {
|
2016-07-16 05:29:42 +08:00
|
|
|
constructor() {
|
2021-03-10 18:44:48 +08:00
|
|
|
this.title = ko.observable(SettingsGet('Title')).idleTrigger();
|
|
|
|
this.loadingDesc = ko.observable(SettingsGet('LoadingDescription')).idleTrigger();
|
|
|
|
this.faviconUrl = ko.observable(SettingsGet('FaviconUrl')).idleTrigger();
|
2016-07-16 03:54:37 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
onBuild() {
|
2020-07-23 02:28:25 +08:00
|
|
|
setTimeout(() => {
|
2019-07-05 03:19:24 +08:00
|
|
|
const f1 = settingsSaveHelperSimpleFunction(this.title.trigger, this),
|
2016-07-16 03:54:37 +08:00
|
|
|
f2 = settingsSaveHelperSimpleFunction(this.loadingDesc.trigger, this),
|
|
|
|
f3 = settingsSaveHelperSimpleFunction(this.faviconUrl.trigger, this);
|
|
|
|
|
|
|
|
this.title.subscribe((value) => {
|
|
|
|
Remote.saveAdminConfig(f1, {
|
2020-08-07 00:24:46 +08:00
|
|
|
'Title': value.trim()
|
2016-07-16 03:54:37 +08:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
this.loadingDesc.subscribe((value) => {
|
|
|
|
Remote.saveAdminConfig(f2, {
|
2020-08-07 00:24:46 +08:00
|
|
|
'LoadingDescription': value.trim()
|
2016-07-16 03:54:37 +08:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
this.faviconUrl.subscribe((value) => {
|
|
|
|
Remote.saveAdminConfig(f3, {
|
2020-08-07 00:24:46 +08:00
|
|
|
'FaviconUrl': value.trim()
|
2016-07-16 03:54:37 +08:00
|
|
|
});
|
|
|
|
});
|
2020-08-14 04:58:41 +08:00
|
|
|
}, 50);
|
2016-07-16 03:54:37 +08:00
|
|
|
}
|
|
|
|
}
|