Removed: twitter, google, dropbox, facebook, owncloud, modernizr from JavaScript

This commit is contained in:
djmaze 2020-03-11 12:55:03 +01:00
parent e8d38a6870
commit 4468d5bd22
60 changed files with 7 additions and 4152 deletions

View file

@ -14,7 +14,6 @@ import {
import { trim, inArray, pInt, convertLangName, triggerAutocompleteInputChange } from 'Common/Utils';
import { $win } from 'Common/Globals';
import { socialFacebook, socialGoogle, socialTwitter } from 'Common/Links';
import { getNotification, getNotificationFromResponse, reload as translatorReload } from 'Common/Translator';
import * as Plugins from 'Common/Plugins';
@ -141,19 +140,6 @@ class LoginUserView extends AbstractViewNext {
this.signMeVisibility = ko.computed(() => LoginSignMeType.Unused !== this.signMeType());
this.facebookLoginEnabled = ko.observable(false);
this.googleLoginEnabled = ko.observable(false);
this.googleGmailLoginEnabled = ko.observable(false);
this.twitterLoginEnabled = ko.observable(false);
this.socialLoginEnabled = ko.computed(() => {
const bF = this.facebookLoginEnabled(),
bG = this.googleLoginEnabled(),
bT = this.twitterLoginEnabled();
return bF || bG || bT;
});
if (Settings.settingsGet('AdditionalLoginError') && !this.submitError()) {
this.submitError(Settings.settingsGet('AdditionalLoginError'));
}
@ -163,30 +149,6 @@ class LoginUserView extends AbstractViewNext {
return `left=200,top=100,width=${wh},height=${wh},menubar=no,status=no,resizable=yes,scrollbars=yes`;
}
@command((self) => !self.submitRequest() && self.facebookLoginEnabled())
facebookCommand() {
window.open(socialFacebook(), 'Facebook', this.windowOpenFeatures(500));
return true;
}
@command((self) => !self.submitRequest() && self.googleLoginEnabled())
googleCommand() {
window.open(socialGoogle(), 'Google', this.windowOpenFeatures(550));
return true;
}
@command((self) => !self.submitRequest() && self.googleGmailLoginEnabled())
googleGmailCommand() {
window.open(socialGoogle(true), 'Google', this.windowOpenFeatures(550));
return true;
}
@command((self) => !self.submitRequest() && self.twitterLoginEnabled())
twitterCommand() {
window.open(socialTwitter(), 'Twitter', this.windowOpenFeatures(500));
return true;
}
@command((self) => !self.submitRequest())
submitCommand() {
triggerAutocompleteInputChange();
@ -328,25 +290,7 @@ class LoginUserView extends AbstractViewNext {
onBuild() {
const signMeLocal = Local.get(ClientSideKeyName.LastSignMe),
signMe = (Settings.settingsGet('SignMe') || 'unused').toLowerCase(),
jsHash = Settings.appSettingsGet('jsHash'),
fSocial = (iErrorCode) => {
iErrorCode = pInt(iErrorCode);
if (0 === iErrorCode) {
this.submitRequest(true);
getApp().loginAndLogoutReload(false);
} else {
this.submitError(getNotification(iErrorCode));
}
};
this.facebookLoginEnabled(!!Settings.settingsGet('AllowFacebookSocial'));
this.twitterLoginEnabled(!!Settings.settingsGet('AllowTwitterSocial'));
this.googleLoginEnabled(
!!Settings.settingsGet('AllowGoogleSocial') && !!Settings.settingsGet('AllowGoogleSocialAuth')
);
this.googleGmailLoginEnabled(
!!Settings.settingsGet('AllowGoogleSocial') && !!Settings.settingsGet('AllowGoogleSocialAuthGmail')
);
jsHash = Settings.appSettingsGet('jsHash');
switch (signMe) {
case LoginSignMeTypeAsString.DefaultOff:
@ -375,18 +319,6 @@ class LoginUserView extends AbstractViewNext {
this.email(AppStore.devEmail);
this.password(AppStore.devPassword);
if (this.googleLoginEnabled() || this.googleGmailLoginEnabled()) {
window['rl_' + jsHash + '_google_login_service'] = fSocial;
}
if (this.facebookLoginEnabled()) {
window['rl_' + jsHash + '_facebook_login_service'] = fSocial;
}
if (this.twitterLoginEnabled()) {
window['rl_' + jsHash + '_twitter_login_service'] = fSocial;
}
_.delay(() => {
LanguageStore.language.subscribe((value) => {
this.langRequest(true);

View file

@ -43,7 +43,6 @@ import { attachmentDownload } from 'Common/Links';
import { getUserPic, storeMessageFlagsToCache } from 'Common/Cache';
import SocialStore from 'Stores/Social';
import AppStore from 'Stores/User/App';
import SettingsStore from 'Stores/User/Settings';
import AccountStore from 'Stores/User/Account';
@ -144,46 +143,6 @@ class MessageViewMailBoxUserView extends AbstractViewNext {
this.downloadAsZipLoading = ko.observable(false);
this.downloadAsZipError = ko.observable(false).extend({ falseTimeout: 7000 });
this.saveToOwnCloudAllowed = ko.computed(
() => -1 < inArray('owncloud', this.attachmentsActions()) && this.allowAttachmnetControls()
);
this.saveToOwnCloudLoading = ko.observable(false);
this.saveToOwnCloudSuccess = ko.observable(false).extend({ falseTimeout: 2000 });
this.saveToOwnCloudError = ko.observable(false).extend({ falseTimeout: 7000 });
this.saveToOwnCloudSuccess.subscribe((v) => {
if (v) {
this.saveToOwnCloudError(false);
}
});
this.saveToOwnCloudError.subscribe((v) => {
if (v) {
this.saveToOwnCloudSuccess(false);
}
});
this.saveToDropboxAllowed = ko.computed(
() => -1 < inArray('dropbox', this.attachmentsActions()) && this.allowAttachmnetControls()
);
this.saveToDropboxLoading = ko.observable(false);
this.saveToDropboxSuccess = ko.observable(false).extend({ falseTimeout: 2000 });
this.saveToDropboxError = ko.observable(false).extend({ falseTimeout: 7000 });
this.saveToDropboxSuccess.subscribe((v) => {
if (v) {
this.saveToDropboxError(false);
}
});
this.saveToDropboxError.subscribe((v) => {
if (v) {
this.saveToDropboxSuccess(false);
}
});
this.showAttachmnetControls.subscribe((v) => {
if (this.message()) {
_.each(this.message().attachments(), (item) => {
@ -243,9 +202,6 @@ class MessageViewMailBoxUserView extends AbstractViewNext {
this.spamCommand = createCommandActionHelper(FolderType.Spam, true);
this.notSpamCommand = createCommandActionHelper(FolderType.NotSpam, true);
this.dropboxEnabled = SocialStore.dropbox.enabled;
this.dropboxApiKey = SocialStore.dropbox.apiKey;
// viewer
this.viewBodyTopValue = ko.observable(0);
@ -606,8 +562,6 @@ class MessageViewMailBoxUserView extends AbstractViewNext {
Local.set(ClientSideKeyName.MessageHeaderFullInfo, value ? '1' : '0');
});
SocialStore.appendDropbox();
this.oHeaderDom = $('.messageItemHeader', dom);
this.oHeaderDom = this.oHeaderDom[0] ? this.oHeaderDom : null;
@ -956,77 +910,6 @@ class MessageViewMailBoxUserView extends AbstractViewNext {
}
}
saveToOwnCloud() {
const hashes = this.getAttachmentsHashes();
if (0 < hashes.length) {
Promises.attachmentsActions('OwnCloud', hashes, this.saveToOwnCloudLoading)
.then((result) => {
if (result && result.Result) {
this.saveToOwnCloudSuccess(true);
} else {
this.saveToOwnCloudError(true);
}
})
.catch(() => {
this.saveToOwnCloudError(true);
});
} else {
this.highlightUnselectedAttachments(true);
}
}
saveToDropbox() {
const files = [],
hashes = this.getAttachmentsHashes();
if (0 < hashes.length) {
if (window.Dropbox) {
Promises.attachmentsActions('Dropbox', hashes, this.saveToDropboxLoading)
.then((result) => {
if (result && result.Result && result.Result.Url && result.Result.ShortLife && result.Result.Files) {
if (window.Dropbox && isArray(result.Result.Files)) {
_.each(result.Result.Files, (item) => {
files.push({
url: result.Result.Url + attachmentDownload(item.Hash, result.Result.ShortLife),
filename: item.FileName
});
});
window.Dropbox.save({
files: files,
progress: () => {
this.saveToDropboxLoading(true);
this.saveToDropboxError(false);
this.saveToDropboxSuccess(false);
},
cancel: () => {
this.saveToDropboxSuccess(false);
this.saveToDropboxError(false);
this.saveToDropboxLoading(false);
},
success: () => {
this.saveToDropboxSuccess(true);
this.saveToDropboxLoading(false);
},
error: () => {
this.saveToDropboxError(true);
this.saveToDropboxLoading(false);
}
});
} else {
this.saveToDropboxError(true);
}
}
})
.catch(() => {
this.saveToDropboxError(true);
});
}
} else {
this.highlightUnselectedAttachments(true);
}
}
/**
* @param {MessageModel} oMessage
* @returns {void}