mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-01 13:39:22 +03:00
CommonJS (research/3)
This commit is contained in:
parent
586abbb802
commit
06bb124379
99 changed files with 51037 additions and 42961 deletions
|
|
@ -9,6 +9,7 @@
|
|||
Enums = require('../../Common/Enums.js'),
|
||||
Utils = require('../../Common/Utils.js'),
|
||||
|
||||
AppSettings = require('../../Storages/AppSettings.js'),
|
||||
Data = require('../../Storages/AdminDataStorage.js'),
|
||||
Remote = require('../../Storages/AdminAjaxRemoteStorage.js'),
|
||||
|
||||
|
|
@ -106,7 +107,7 @@
|
|||
|
||||
PopupsActivateViewModel.prototype.onShow = function ()
|
||||
{
|
||||
this.domain(RL.settingsGet('AdminDomain'));
|
||||
this.domain(AppSettings.settingsGet('AdminDomain'));
|
||||
if (!this.activateProcess())
|
||||
{
|
||||
this.key('');
|
||||
|
|
@ -133,6 +134,6 @@
|
|||
return '' === sValue || !!/^RL[\d]+-[A-Z0-9\-]+Z$/.test(Utils.trim(sValue));
|
||||
};
|
||||
|
||||
module.exports = new PopupsActivateViewModel();
|
||||
module.exports = PopupsActivateViewModel;
|
||||
|
||||
}(module));
|
||||
|
|
@ -11,6 +11,8 @@
|
|||
Utils = require('../../Common/Utils.js'),
|
||||
|
||||
Remote = require('../../Storages/WebMailAjaxRemoteStorage.js'),
|
||||
|
||||
RL = require('../../Boots/RainLoopApp.js'),
|
||||
|
||||
kn = require('../../Knoin/Knoin.js'),
|
||||
KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js')
|
||||
|
|
@ -110,6 +112,6 @@
|
|||
this.emailFocus(true);
|
||||
};
|
||||
|
||||
module.exports = new PopupsAddAccountViewModel();
|
||||
module.exports = PopupsAddAccountViewModel;
|
||||
|
||||
}(module));
|
||||
|
|
@ -11,6 +11,8 @@
|
|||
|
||||
Data = require('../../Storages/WebMailDataStorage.js'),
|
||||
|
||||
RL = require('../../Boots/RainLoopApp.js'),
|
||||
|
||||
kn = require('../../Knoin/Knoin.js'),
|
||||
KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js')
|
||||
;
|
||||
|
|
@ -104,6 +106,6 @@
|
|||
this.key.focus(true);
|
||||
};
|
||||
|
||||
module.exports = new PopupsAddOpenPgpKeyViewModel();
|
||||
module.exports = PopupsAddOpenPgpKeyViewModel;
|
||||
|
||||
}(module));
|
||||
|
|
@ -152,6 +152,6 @@
|
|||
this.fromFocus(true);
|
||||
};
|
||||
|
||||
module.exports = new PopupsAdvancedSearchViewModel();
|
||||
module.exports = PopupsAdvancedSearchViewModel;
|
||||
|
||||
}(module));
|
||||
|
|
@ -123,6 +123,6 @@
|
|||
}, this));
|
||||
};
|
||||
|
||||
module.exports = new PopupsAskViewModel();
|
||||
module.exports = PopupsAskViewModel;
|
||||
|
||||
}(module));
|
||||
|
|
@ -257,6 +257,6 @@
|
|||
this.text(sText);
|
||||
};
|
||||
|
||||
module.exports = new PopupsComposeOpenPgpViewModel();
|
||||
module.exports = PopupsComposeOpenPgpViewModel;
|
||||
|
||||
}(module));
|
||||
|
|
@ -5,6 +5,7 @@
|
|||
'use strict';
|
||||
|
||||
var
|
||||
window = require('../../External/window.js'),
|
||||
$ = require('../../External/jquery.js'),
|
||||
_ = require('../../External/underscore.js'),
|
||||
ko = require('../../External/ko.js'),
|
||||
|
|
@ -13,12 +14,20 @@
|
|||
Enums = require('../../Common/Enums.js'),
|
||||
Consts = require('../../Common/Consts.js'),
|
||||
Utils = require('../../Common/Utils.js'),
|
||||
LinkBuilder = require('../Common/LinkBuilder.js'),
|
||||
Globals = require('../../Common/Globals.js'),
|
||||
LinkBuilder = require('../../Common/LinkBuilder.js'),
|
||||
Events = require('../../Common/Events.js'),
|
||||
NewHtmlEditorWrapper = require('../../Common/NewHtmlEditorWrapper.js'),
|
||||
|
||||
AppSettings = require('../../Storages/AppSettings.js'),
|
||||
Data = require('../../Storages/WebMailDataStorage.js'),
|
||||
Cache = require('../../Storages/WebMailCacheStorage.js'),
|
||||
Remote = require('../../Storages/WebMailAjaxRemoteStorage.js'),
|
||||
|
||||
RL = require('../../Boots/RainLoopApp.js'),
|
||||
|
||||
PopupsComposeOpenPgpViewModel = require('./PopupsComposeOpenPgpViewModel.js'),
|
||||
|
||||
kn = require('../../Knoin/Knoin.js'),
|
||||
KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js')
|
||||
;
|
||||
|
|
@ -38,7 +47,7 @@
|
|||
this.bSkipNext = false;
|
||||
this.sReferences = '';
|
||||
|
||||
this.bCapaAdditionalIdentities = RL.capa(Enums.Capa.AdditionalIdentities);
|
||||
this.bCapaAdditionalIdentities = AppSettings.capa(Enums.Capa.AdditionalIdentities);
|
||||
|
||||
var
|
||||
self = this,
|
||||
|
|
@ -330,7 +339,7 @@
|
|||
|
||||
}, this.canBeSendedOrSaved);
|
||||
|
||||
RL.sub('interval.1m', function () {
|
||||
Events.sub('interval.1m', function () {
|
||||
if (this.modalVisibility() && !Data.draftFolderNotEnabled() && !this.isEmptyForm(false) &&
|
||||
!this.bSkipNext && !this.saving() && !this.sending() && !this.savedError())
|
||||
{
|
||||
|
|
@ -343,7 +352,7 @@
|
|||
this.triggerForResize();
|
||||
}, this);
|
||||
|
||||
this.dropboxEnabled = ko.observable(!!RL.settingsGet('DropboxApiKey'));
|
||||
this.dropboxEnabled = ko.observable(!!AppSettings.settingsGet('DropboxApiKey'));
|
||||
|
||||
this.dropboxCommand = Utils.createCommand(this, function () {
|
||||
|
||||
|
|
@ -370,7 +379,7 @@
|
|||
});
|
||||
|
||||
this.driveEnabled = ko.observable(Globals.bXMLHttpRequestSupported &&
|
||||
!!RL.settingsGet('GoogleClientID') && !!RL.settingsGet('GoogleApiKey'));
|
||||
!!AppSettings.settingsGet('GoogleClientID') && !!AppSettings.settingsGet('GoogleApiKey'));
|
||||
|
||||
this.driveVisible = ko.observable(false);
|
||||
|
||||
|
|
@ -390,11 +399,22 @@
|
|||
|
||||
this.tryToClosePopup = _.debounce(_.bind(this.tryToClosePopup, this), 200);
|
||||
|
||||
this.emailsSource = _.bind(this.emailsSource, this);
|
||||
|
||||
kn.constructorEnd(this);
|
||||
}
|
||||
|
||||
kn.extendAsViewModel('PopupsComposeViewModel', PopupsComposeViewModel);
|
||||
|
||||
PopupsComposeViewModel.prototype.emailsSource = function (oData, fResponse)
|
||||
{
|
||||
RL.getAutocomplete(oData.term, function (aData) {
|
||||
fResponse(_.map(aData, function (oEmailItem) {
|
||||
return oEmailItem.toLine(false);
|
||||
}));
|
||||
});
|
||||
};
|
||||
|
||||
PopupsComposeViewModel.prototype.openOpenPgpPopup = function ()
|
||||
{
|
||||
if (this.capaOpenPGP() && this.oEditor && !this.oEditor.isHtml())
|
||||
|
|
@ -1037,7 +1057,7 @@
|
|||
oScript = document.createElement('script');
|
||||
oScript.type = 'text/javascript';
|
||||
oScript.src = 'https://www.dropbox.com/static/api/1/dropins.js';
|
||||
$(oScript).attr('id', 'dropboxjs').attr('data-app-key', RL.settingsGet('DropboxApiKey'));
|
||||
$(oScript).attr('id', 'dropboxjs').attr('data-app-key', AppSettings.settingsGet('DropboxApiKey'));
|
||||
|
||||
document.body.appendChild(oScript);
|
||||
}
|
||||
|
|
@ -1136,7 +1156,7 @@
|
|||
new window.google.picker.DocsView()
|
||||
.setIncludeFolders(true)
|
||||
)
|
||||
.setAppId(RL.settingsGet('GoogleClientID'))
|
||||
.setAppId(AppSettings.settingsGet('GoogleClientID'))
|
||||
.setOAuthToken(oOauthToken.access_token)
|
||||
.setCallback(_.bind(self.driveCallback, self, oOauthToken.access_token))
|
||||
.enableFeature(window.google.picker.Feature.NAV_HIDDEN)
|
||||
|
|
@ -1161,7 +1181,7 @@
|
|||
if (!oAuthToken)
|
||||
{
|
||||
window.gapi.auth.authorize({
|
||||
'client_id': RL.settingsGet('GoogleClientID'),
|
||||
'client_id': AppSettings.settingsGet('GoogleClientID'),
|
||||
'scope': 'https://www.googleapis.com/auth/drive.readonly',
|
||||
'immediate': true
|
||||
}, function (oAuthResult) {
|
||||
|
|
@ -1176,7 +1196,7 @@
|
|||
else
|
||||
{
|
||||
window.gapi.auth.authorize({
|
||||
'client_id': RL.settingsGet('GoogleClientID'),
|
||||
'client_id': AppSettings.settingsGet('GoogleClientID'),
|
||||
'scope': 'https://www.googleapis.com/auth/drive.readonly',
|
||||
'immediate': false
|
||||
}, function (oAuthResult) {
|
||||
|
|
@ -1229,7 +1249,7 @@
|
|||
{
|
||||
var
|
||||
oUploadCache = {},
|
||||
iAttachmentSizeLimit = Utils.pInt(RL.settingsGet('AttachmentLimit')),
|
||||
iAttachmentSizeLimit = Utils.pInt(AppSettings.settingsGet('AttachmentLimit')),
|
||||
oJua = new Jua({
|
||||
'action': LinkBuilder.upload(),
|
||||
'name': 'uploader',
|
||||
|
|
@ -1478,7 +1498,7 @@
|
|||
});
|
||||
};
|
||||
},
|
||||
iAttachmentSizeLimit = Utils.pInt(RL.settingsGet('AttachmentLimit')),
|
||||
iAttachmentSizeLimit = Utils.pInt(AppSettings.settingsGet('AttachmentLimit')),
|
||||
mSize = oDropboxFile['bytes']
|
||||
;
|
||||
|
||||
|
|
@ -1539,7 +1559,7 @@
|
|||
});
|
||||
};
|
||||
},
|
||||
iAttachmentSizeLimit = Utils.pInt(RL.settingsGet('AttachmentLimit')),
|
||||
iAttachmentSizeLimit = Utils.pInt(AppSettings.settingsGet('AttachmentLimit')),
|
||||
oAttachment = null,
|
||||
mSize = oDriveFile['fileSize'] ? Utils.pInt(oDriveFile['fileSize']) : 0
|
||||
;
|
||||
|
|
@ -1751,6 +1771,6 @@
|
|||
this.editorResizeThrottle();
|
||||
};
|
||||
|
||||
module.exports = new PopupsComposeViewModel();
|
||||
module.exports = PopupsComposeViewModel;
|
||||
|
||||
}(module));
|
||||
|
|
@ -15,11 +15,14 @@
|
|||
Consts = require('../../Common/Consts.js'),
|
||||
Globals = require('../../Common/Globals.js'),
|
||||
Utils = require('../../Common/Utils.js'),
|
||||
LinkBuilder = require('../Common/LinkBuilder.js'),
|
||||
LinkBuilder = require('../../Common/LinkBuilder.js'),
|
||||
Selector = require('../../Common/Selector.js'),
|
||||
|
||||
Data = require('../../Storages/WebMailDataStorage.js'),
|
||||
Remote = require('../../Storages/WebMailAjaxRemoteStorage.js'),
|
||||
|
||||
RL = require('../../Boots/RainLoopApp.js'),
|
||||
|
||||
kn = require('../../Knoin/Knoin.js'),
|
||||
KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js')
|
||||
;
|
||||
|
|
@ -380,11 +383,22 @@
|
|||
|
||||
this.sDefaultKeyScope = Enums.KeyState.ContactList;
|
||||
|
||||
this.contactTagsSource = _.bind(this.contactTagsSource, this);
|
||||
|
||||
kn.constructorEnd(this);
|
||||
}
|
||||
|
||||
kn.extendAsViewModel('PopupsContactsViewModel', PopupsContactsViewModel);
|
||||
|
||||
PopupsContactsViewModel.prototype.contactTagsSource = function (oData, fResponse)
|
||||
{
|
||||
RL.getContactTagsAutocomplete(oData.term, function (aData) {
|
||||
fResponse(_.map(aData, function (oTagItem) {
|
||||
return oTagItem.toLine(false);
|
||||
}));
|
||||
});
|
||||
};
|
||||
|
||||
PopupsContactsViewModel.prototype.getPropertyPlceholder = function (sType)
|
||||
{
|
||||
var sResult = '';
|
||||
|
|
@ -763,6 +777,6 @@
|
|||
this.contacts([]);
|
||||
};
|
||||
|
||||
module.exports = new PopupsContactsViewModel();
|
||||
module.exports = PopupsContactsViewModel;
|
||||
|
||||
}(module));
|
||||
|
|
@ -13,6 +13,8 @@
|
|||
Utils = require('../../Common/Utils.js'),
|
||||
|
||||
Remote = require('../../Storages/AdminAjaxRemoteStorage.js'),
|
||||
|
||||
RL = require('../../Boots/AdminApp.js'),
|
||||
|
||||
kn = require('../../Knoin/Knoin.js'),
|
||||
KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js')
|
||||
|
|
@ -313,6 +315,6 @@
|
|||
this.whiteList('');
|
||||
};
|
||||
|
||||
module.exports = new PopupsDomainViewModel();
|
||||
module.exports = PopupsDomainViewModel;
|
||||
|
||||
}(module));
|
||||
|
|
@ -47,11 +47,6 @@
|
|||
this.filter(oFilter);
|
||||
};
|
||||
|
||||
// PopupsFilterViewModel.prototype.onFocus = function ()
|
||||
// {
|
||||
//
|
||||
// };
|
||||
|
||||
module.exports = new PopupsFilterViewModel();
|
||||
module.exports = PopupsFilterViewModel;
|
||||
|
||||
}(module));
|
||||
|
|
@ -15,6 +15,8 @@
|
|||
Cache = require('../../Storages/WebMailCacheStorage.js'),
|
||||
Remote = require('../../Storages/WebMailAjaxRemoteStorage.js'),
|
||||
|
||||
RL = require('../../Boots/RainLoopApp.js'),
|
||||
|
||||
kn = require('../../Knoin/Knoin.js'),
|
||||
KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js')
|
||||
;
|
||||
|
|
@ -115,6 +117,6 @@
|
|||
}
|
||||
};
|
||||
|
||||
module.exports = new PopupsFolderClearViewModel();
|
||||
module.exports = PopupsFolderClearViewModel;
|
||||
|
||||
}(module));
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@
|
|||
Data = require('../../Storages/WebMailDataStorage.js'),
|
||||
Remote = require('../../Storages/WebMailAjaxRemoteStorage.js'),
|
||||
|
||||
RL = require('../../Boots/RainLoopApp.js'),
|
||||
|
||||
kn = require('../../Knoin/Knoin.js'),
|
||||
KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js')
|
||||
;
|
||||
|
|
@ -57,7 +59,7 @@
|
|||
};
|
||||
}
|
||||
|
||||
return RL.folderListOptionsBuilder([], aList, [], aTop, null, fDisableCallback, fVisibleCallback, fRenameCallback);
|
||||
return Utils.folderListOptionsBuilder([], aList, [], aTop, null, fDisableCallback, fVisibleCallback, fRenameCallback);
|
||||
|
||||
}, this);
|
||||
|
||||
|
|
@ -123,6 +125,6 @@
|
|||
this.folderName.focused(true);
|
||||
};
|
||||
|
||||
module.exports = new PopupsFolderCreateViewModel();
|
||||
module.exports = PopupsFolderCreateViewModel;
|
||||
|
||||
}(module));
|
||||
|
|
@ -11,9 +11,12 @@
|
|||
Consts = require('../../Common/Consts.js'),
|
||||
Utils = require('../../Common/Utils.js'),
|
||||
|
||||
AppSettings = require('../../Storages/AppSettings.js'),
|
||||
Data = require('../../Storages/WebMailDataStorage.js'),
|
||||
Remote = require('../../Storages/WebMailAjaxRemoteStorage.js'),
|
||||
|
||||
RL = require('../../Boots/RainLoopApp.js'),
|
||||
|
||||
kn = require('../../Knoin/Knoin.js'),
|
||||
KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js')
|
||||
;
|
||||
|
|
@ -34,7 +37,7 @@
|
|||
this.notification = ko.observable('');
|
||||
|
||||
this.folderSelectList = ko.computed(function () {
|
||||
return RL.folderListOptionsBuilder([], Data.folderList(), Data.folderListSystemNames(), [
|
||||
return Utils.folderListOptionsBuilder([], Data.folderList(), Data.folderListSystemNames(), [
|
||||
['', this.sChooseOnText],
|
||||
[Consts.Values.UnuseOptionValue, this.sUnuseText]
|
||||
]);
|
||||
|
|
@ -54,11 +57,11 @@
|
|||
|
||||
fSaveSystemFolders = _.debounce(function () {
|
||||
|
||||
RL.settingsSet('SentFolder', self.sentFolder());
|
||||
RL.settingsSet('DraftFolder', self.draftFolder());
|
||||
RL.settingsSet('SpamFolder', self.spamFolder());
|
||||
RL.settingsSet('TrashFolder', self.trashFolder());
|
||||
RL.settingsSet('ArchiveFolder', self.archiveFolder());
|
||||
AppSettings.settingsSet('SentFolder', self.sentFolder());
|
||||
AppSettings.settingsSet('DraftFolder', self.draftFolder());
|
||||
AppSettings.settingsSet('SpamFolder', self.spamFolder());
|
||||
AppSettings.settingsSet('TrashFolder', self.trashFolder());
|
||||
AppSettings.settingsSet('ArchiveFolder', self.archiveFolder());
|
||||
|
||||
Remote.saveSystemFolders(Utils.emptyFunction, {
|
||||
'SentFolder': self.sentFolder(),
|
||||
|
|
@ -73,11 +76,11 @@
|
|||
|
||||
fCallback = function () {
|
||||
|
||||
RL.settingsSet('SentFolder', self.sentFolder());
|
||||
RL.settingsSet('DraftFolder', self.draftFolder());
|
||||
RL.settingsSet('SpamFolder', self.spamFolder());
|
||||
RL.settingsSet('TrashFolder', self.trashFolder());
|
||||
RL.settingsSet('ArchiveFolder', self.archiveFolder());
|
||||
AppSettings.settingsSet('SentFolder', self.sentFolder());
|
||||
AppSettings.settingsSet('DraftFolder', self.draftFolder());
|
||||
AppSettings.settingsSet('SpamFolder', self.spamFolder());
|
||||
AppSettings.settingsSet('TrashFolder', self.trashFolder());
|
||||
AppSettings.settingsSet('ArchiveFolder', self.archiveFolder());
|
||||
|
||||
fSaveSystemFolders();
|
||||
};
|
||||
|
|
@ -129,6 +132,6 @@
|
|||
this.notification(sNotification);
|
||||
};
|
||||
|
||||
module.exports = new PopupsFolderSystemViewModel();
|
||||
module.exports = PopupsFolderSystemViewModel;
|
||||
|
||||
}(module));
|
||||
|
|
@ -12,6 +12,8 @@
|
|||
|
||||
Data = require('../../Storages/WebMailDataStorage.js'),
|
||||
|
||||
RL = require('../../Boots/RainLoopApp.js'),
|
||||
|
||||
kn = require('../../Knoin/Knoin.js'),
|
||||
KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js')
|
||||
;
|
||||
|
|
@ -110,6 +112,6 @@
|
|||
this.email.focus(true);
|
||||
};
|
||||
|
||||
module.exports = new PopupsGenerateNewOpenPgpKeyViewModel();
|
||||
module.exports = PopupsGenerateNewOpenPgpKeyViewModel;
|
||||
|
||||
}(module));
|
||||
|
|
@ -14,6 +14,8 @@
|
|||
Remote = require('../../Storages/WebMailAjaxRemoteStorage.js'),
|
||||
Data = require('../../Storages/WebMailDataStorage.js'),
|
||||
|
||||
RL = require('../../Boots/RainLoopApp.js'),
|
||||
|
||||
KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js')
|
||||
;
|
||||
|
||||
|
|
@ -165,6 +167,6 @@
|
|||
}
|
||||
};
|
||||
|
||||
module.exports = new PopupsIdentityViewModel();
|
||||
module.exports = PopupsIdentityViewModel;
|
||||
|
||||
}(module));
|
||||
|
|
@ -58,6 +58,6 @@
|
|||
}, this));
|
||||
};
|
||||
|
||||
module.exports = new AdminPaneViewModel();
|
||||
module.exports = PopupsKeyboardShortcutsHelpViewModel;
|
||||
|
||||
}(module));
|
||||
|
|
@ -76,6 +76,6 @@
|
|||
this.cancelCommand();
|
||||
};
|
||||
|
||||
module.exports = new PopupsLanguagesViewModel();
|
||||
module.exports = PopupsLanguagesViewModel;
|
||||
|
||||
}(module));
|
||||
|
|
@ -160,6 +160,6 @@
|
|||
}, this));
|
||||
};
|
||||
|
||||
module.exports = new PopupsPluginViewModel();
|
||||
module.exports = PopupsPluginViewModel;
|
||||
|
||||
}(module));
|
||||
|
|
@ -70,6 +70,6 @@
|
|||
this.code.focused(true);
|
||||
};
|
||||
|
||||
module.exports = new PopupsTwoFactorTestViewModel();
|
||||
module.exports = PopupsTwoFactorTestViewModel;
|
||||
|
||||
}(module));
|
||||
|
|
@ -51,6 +51,6 @@
|
|||
}
|
||||
};
|
||||
|
||||
module.exports = new PopupsViewOpenPgpKeyViewModel();
|
||||
module.exports = PopupsViewOpenPgpKeyViewModel;
|
||||
|
||||
}(module));
|
||||
Loading…
Add table
Add a link
Reference in a new issue