mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-01-08 07:48:02 +08:00
950579c7f5
We use json as response
78 lines
1.4 KiB
JavaScript
78 lines
1.4 KiB
JavaScript
|
|
(function () {
|
|
|
|
if (!window.rl)
|
|
{
|
|
return;
|
|
}
|
|
|
|
/**
|
|
* @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);
|
|
}
|
|
|
|
CustomUserSettings.prototype.customJsonSaveData = function ()
|
|
{
|
|
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
|
|
}
|
|
|
|
}, 'JsonSaveCustomUserData', {
|
|
'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 || '');
|
|
}
|
|
|
|
}, 'JsonGetCustomUserData');
|
|
|
|
};
|
|
|
|
window.rl.addSettingsViewModel(CustomUserSettings, 'PluginCustomSettingsTab',
|
|
'SETTINGS_CUSTOM_PLUGIN/TAB_NAME', 'custom');
|
|
|
|
}());
|