2015-02-19 09:01:59 +08:00
|
|
|
|
|
|
|
(function () {
|
|
|
|
|
2019-07-05 03:09:27 +08:00
|
|
|
if (!window.rl)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-02-19 09:01:59 +08:00
|
|
|
/**
|
|
|
|
* @constructor
|
|
|
|
*/
|
|
|
|
function CustomUserSettings()
|
|
|
|
{
|
|
|
|
this.userSkype = ko.observable('');
|
|
|
|
this.userFacebook = ko.observable('');
|
|
|
|
|
|
|
|
this.loading = ko.observable(false);
|
|
|
|
this.saving = ko.observable(false);
|
|
|
|
|
|
|
|
this.savingOrLoading = ko.computed(function () {
|
|
|
|
return this.loading() || this.saving();
|
|
|
|
}, this);
|
|
|
|
}
|
|
|
|
|
2020-12-30 22:50:47 +08:00
|
|
|
CustomUserSettings.prototype.customJsonSaveData = function ()
|
2015-02-19 09:01:59 +08:00
|
|
|
{
|
|
|
|
var self = this;
|
|
|
|
|
|
|
|
if (this.saving())
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
this.saving(true);
|
|
|
|
|
|
|
|
window.rl.pluginRemoteRequest(function (sResult, oData) {
|
|
|
|
|
|
|
|
self.saving(false);
|
|
|
|
|
|
|
|
if (window.rl.Enums.StorageResultType.Success === sResult && oData && oData.Result)
|
|
|
|
{
|
|
|
|
// true
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// false
|
|
|
|
}
|
|
|
|
|
2020-12-30 22:50:47 +08:00
|
|
|
}, 'JsonSaveCustomUserData', {
|
2015-02-19 09:01:59 +08:00
|
|
|
'UserSkype': this.userSkype(),
|
|
|
|
'UserFacebook': this.userFacebook()
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
CustomUserSettings.prototype.onBuild = function () // special function
|
|
|
|
{
|
|
|
|
var self = this;
|
|
|
|
|
|
|
|
this.loading(true);
|
|
|
|
|
|
|
|
window.rl.pluginRemoteRequest(function (sResult, oData) {
|
|
|
|
|
|
|
|
self.loading(false);
|
|
|
|
|
|
|
|
if (window.rl.Enums.StorageResultType.Success === sResult && oData && oData.Result)
|
|
|
|
{
|
|
|
|
self.userSkype(oData.Result.UserSkype || '');
|
|
|
|
self.userFacebook(oData.Result.UserFacebook || '');
|
|
|
|
}
|
|
|
|
|
2020-12-30 22:50:47 +08:00
|
|
|
}, 'JsonGetCustomUserData');
|
2016-06-05 04:26:50 +08:00
|
|
|
|
2015-02-19 09:01:59 +08:00
|
|
|
};
|
|
|
|
|
2016-06-05 04:26:50 +08:00
|
|
|
window.rl.addSettingsViewModel(CustomUserSettings, 'PluginCustomSettingsTab',
|
2015-02-19 09:01:59 +08:00
|
|
|
'SETTINGS_CUSTOM_PLUGIN/TAB_NAME', 'custom');
|
|
|
|
|
2020-12-30 22:50:47 +08:00
|
|
|
}());
|