mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-01 05:29:20 +03:00
Removed opentip
Cleanup lightgallery
This commit is contained in:
parent
a8ef5ec75b
commit
f5a444aa14
31 changed files with 2196 additions and 5957 deletions
42
dev/External/Opentip.js
vendored
42
dev/External/Opentip.js
vendored
|
|
@ -1,42 +0,0 @@
|
|||
const Opentip = window.Opentip || {};
|
||||
|
||||
Opentip.styles = Opentip.styles || {};
|
||||
|
||||
Opentip.styles.rainloop = {
|
||||
'extends': 'standard',
|
||||
|
||||
'fixed': true,
|
||||
'target': true,
|
||||
|
||||
'delay': 0.2,
|
||||
'hideDelay': 0,
|
||||
|
||||
'hideEffect': 'fade',
|
||||
'hideEffectDuration': 0.2,
|
||||
|
||||
'showEffect': 'fade',
|
||||
'showEffectDuration': 0.2,
|
||||
|
||||
'showOn': 'mouseover click',
|
||||
'removeElementsOnHide': true,
|
||||
|
||||
'background': '#fff',
|
||||
'shadow': false,
|
||||
|
||||
'borderColor': '#999',
|
||||
'borderRadius': 2,
|
||||
'borderWidth': 1
|
||||
};
|
||||
|
||||
Opentip.styles.rainloopTip = {
|
||||
'extends': 'rainloop',
|
||||
'delay': 0.4,
|
||||
'group': 'rainloopTips'
|
||||
};
|
||||
|
||||
Opentip.styles.rainloopErrorTip = {
|
||||
'extends': 'rainloop',
|
||||
'className': 'rainloopErrorTip'
|
||||
};
|
||||
|
||||
export { Opentip, Opentip as default };
|
||||
132
dev/External/ko.js
vendored
132
dev/External/ko.js
vendored
|
|
@ -1,17 +1,9 @@
|
|||
import Opentip from 'Opentip';
|
||||
|
||||
import { SaveSettingsStep, Magics } from 'Common/Enums';
|
||||
|
||||
const
|
||||
$ = jQuery,
|
||||
ko = window.ko,
|
||||
fDisposalTooltipHelper = (element) => {
|
||||
ko.utils.domNodeDisposal.addDisposeCallback(element, () => {
|
||||
if (element && element.__opentip) {
|
||||
element.__opentip.deactivate();
|
||||
}
|
||||
});
|
||||
},
|
||||
Translator = () => require('Common/Translator'),
|
||||
isFunction = v => typeof v === 'function';
|
||||
|
||||
ko.bindingHandlers.editor = {
|
||||
|
|
@ -112,79 +104,35 @@ ko.bindingHandlers.visibleAnimated = {
|
|||
|
||||
ko.bindingHandlers.tooltip = {
|
||||
init: (element, fValueAccessor) => {
|
||||
const $el = $(element),
|
||||
fValue = fValueAccessor(),
|
||||
isMobile = 'on' === ($el.data('tooltip-mobile') || 'off'),
|
||||
isI18N = 'on' === ($el.data('tooltip-i18n') || 'on'),
|
||||
const fValue = fValueAccessor(),
|
||||
Globals = require('Common/Globals');
|
||||
|
||||
if (!Globals.bMobileDevice || isMobile) {
|
||||
if (!Globals.bMobileDevice || 'on' === element.dataset.tooltipMobile) {
|
||||
const sValue = !ko.isObservable(fValue) && isFunction(fValue) ? fValue() : ko.unwrap(fValue);
|
||||
|
||||
element.__opentip = new Opentip(element, {
|
||||
'style': 'rainloopTip',
|
||||
'element': element,
|
||||
'tipJoint': $el.data('tooltip-join') || 'bottom'
|
||||
});
|
||||
|
||||
Globals.dropdownVisibility.subscribe((v) => {
|
||||
if (v) {
|
||||
element.__opentip.hide();
|
||||
}
|
||||
});
|
||||
|
||||
if (sValue) {
|
||||
element.__opentip.activate();
|
||||
if ('off' === element.dataset.tooltipI18n) {
|
||||
element.title = sValue;
|
||||
} else {
|
||||
element.__opentip.hide();
|
||||
element.__opentip.deactivate();
|
||||
element.__opentip.setContent('');
|
||||
element.title = Translator().i18n(sValue);
|
||||
Translator().trigger.subscribe(() =>
|
||||
element.title = Translator().i18n(sValue)
|
||||
);
|
||||
Globals.dropdownVisibility.subscribe(() =>
|
||||
element.title = Translator().i18n(sValue)
|
||||
);
|
||||
}
|
||||
|
||||
if (isI18N) {
|
||||
const Translator = require('Common/Translator');
|
||||
|
||||
element.__opentip.setContent(Translator.i18n(sValue));
|
||||
|
||||
Translator.trigger.subscribe(() => {
|
||||
element.__opentip.setContent(Translator.i18n(sValue));
|
||||
});
|
||||
|
||||
Globals.dropdownVisibility.subscribe(() => {
|
||||
if (element && element.__opentip) {
|
||||
element.__opentip.setContent(Translator.i18n(sValue));
|
||||
}
|
||||
});
|
||||
} else {
|
||||
element.__opentip.setContent(sValue);
|
||||
}
|
||||
|
||||
addEventListener('rl.tooltips.diactivate', () => {
|
||||
element.__opentip.hide();
|
||||
element.__opentip.deactivate();
|
||||
});
|
||||
|
||||
addEventListener('rl.tooltips.activate', () => {
|
||||
element.__opentip.activate();
|
||||
});
|
||||
}
|
||||
},
|
||||
update: (element, fValueAccessor) => {
|
||||
const $el = $(element),
|
||||
fValue = fValueAccessor(),
|
||||
isMobile = 'on' === ($el.data('tooltip-mobile') || 'off'),
|
||||
isI18N = 'on' === ($el.data('tooltip-i18n') || 'on'),
|
||||
const fValue = fValueAccessor(),
|
||||
Globals = require('Common/Globals');
|
||||
|
||||
if ((!Globals.bMobileDevice || isMobile) && element.__opentip) {
|
||||
if (!Globals.bMobileDevice || 'on' === element.dataset.tooltipMobile) {
|
||||
const sValue = !ko.isObservable(fValue) && isFunction(fValue) ? fValue() : ko.unwrap(fValue);
|
||||
if (sValue) {
|
||||
element.__opentip.setContent(isI18N ? require('Common/Translator').i18n(sValue) : sValue);
|
||||
element.__opentip.activate();
|
||||
element.title = 'off' === element.dataset.tooltipI18n ? sValue : Translator().i18n(sValue);
|
||||
} else {
|
||||
element.__opentip.hide();
|
||||
element.__opentip.deactivate();
|
||||
element.__opentip.setContent('');
|
||||
element.title = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -192,49 +140,21 @@ ko.bindingHandlers.tooltip = {
|
|||
|
||||
ko.bindingHandlers.tooltipErrorTip = {
|
||||
init: function(element) {
|
||||
const $el = $(element);
|
||||
|
||||
element.__opentip = new Opentip(element, {
|
||||
style: 'rainloopErrorTip',
|
||||
hideOn: 'mouseout click',
|
||||
element: element,
|
||||
tipJoint: $el.data('tooltip-join') || 'top'
|
||||
});
|
||||
|
||||
element.__opentip.deactivate();
|
||||
|
||||
$(document).on('click', () => {
|
||||
if (element && element.__opentip) {
|
||||
element.__opentip.hide();
|
||||
}
|
||||
element.removeAttribute('data-rainloopErrorTip')
|
||||
});
|
||||
ko.utils.domNodeDisposal.addDisposeCallback(element, () => {
|
||||
element.removeAttribute('data-rainloopErrorTip')
|
||||
});
|
||||
|
||||
fDisposalTooltipHelper(element);
|
||||
},
|
||||
update: (element, fValueAccessor) => {
|
||||
const $el = $(element),
|
||||
fValue = fValueAccessor(),
|
||||
value = !ko.isObservable(fValue) && isFunction(fValue) ? fValue() : ko.unwrap(fValue),
|
||||
openTips = element.__opentip;
|
||||
const fValue = fValueAccessor(),
|
||||
value = !ko.isObservable(fValue) && isFunction(fValue) ? fValue() : ko.unwrap(fValue);
|
||||
|
||||
if (openTips) {
|
||||
if (value) {
|
||||
setTimeout(() => {
|
||||
if ($el.is(':visible')) {
|
||||
openTips.setContent(value);
|
||||
openTips.activate();
|
||||
openTips.show();
|
||||
} else {
|
||||
openTips.hide();
|
||||
openTips.deactivate();
|
||||
openTips.setContent('');
|
||||
}
|
||||
}, Magics.Time100ms);
|
||||
} else {
|
||||
openTips.hide();
|
||||
openTips.deactivate();
|
||||
openTips.setContent('');
|
||||
}
|
||||
if (value) {
|
||||
setTimeout(() => element.setAttribute('data-rainloopErrorTip', value), Magics.Time100ms);
|
||||
} else {
|
||||
element.removeAttribute('data-rainloopErrorTip');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -23,43 +23,55 @@
|
|||
opacity: 0;
|
||||
}
|
||||
|
||||
.opentip-container {
|
||||
|
||||
[data-rainloopTip],
|
||||
[data-rainloopErrorTip] {
|
||||
position: relative;
|
||||
}
|
||||
[data-rainloopTip]::before,
|
||||
[data-rainloopErrorTip]::before {
|
||||
background: #fff;
|
||||
border-radius: 3px;
|
||||
border: 1px solid #999;
|
||||
content : attr(data-rainloopTip);
|
||||
font-size: 13px;
|
||||
left: 100%;
|
||||
opacity : 0;
|
||||
padding: 0.25em;
|
||||
position : absolute;
|
||||
text-align: left;
|
||||
top: 100%;
|
||||
transition: opacity 0.2s ease-in-out;
|
||||
white-space: nowrap;
|
||||
z-index: 2001 !important;
|
||||
.ot-content {
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
&.style-rainloopErrorTip .ot-content {
|
||||
color: red;
|
||||
}
|
||||
|
||||
&.ot-show-effect-none, &.ot-hide-effect-none {
|
||||
transition: none !important;
|
||||
}
|
||||
|
||||
&.ot-show-effect-fade {
|
||||
|
||||
transition: none;
|
||||
|
||||
&.ot-hidden {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
&.ot-going-to-show {
|
||||
opacity: 0;
|
||||
transition: opacity 0.2s ease-in-out;
|
||||
}
|
||||
&.ot-showing {
|
||||
opacity: 1;
|
||||
transition: opacity 0.2s ease-in-out;
|
||||
}
|
||||
&.ot-visible {
|
||||
opacity: 1;
|
||||
transition: none;
|
||||
}
|
||||
}
|
||||
@media only screen and (max-width: 600px) {
|
||||
[data-rainloopTip]::before,
|
||||
[data-rainloopErrorTip]::before {
|
||||
min-width: 60vw;
|
||||
white-space: normal;
|
||||
}
|
||||
}
|
||||
[data-rainloopErrorTip]::before {
|
||||
color: red;
|
||||
content : attr(data-rainloopErrorTip);
|
||||
opacity : 1;
|
||||
}
|
||||
[data-tooltip]:hover::before {
|
||||
opacity : 1;
|
||||
}
|
||||
[data-rainloopTip]::after,
|
||||
[data-rainloopErrorTip]::after {
|
||||
border-color: transparent transparent #999 transparent;
|
||||
border-style: solid;
|
||||
border-width: 5px;
|
||||
content: "";
|
||||
margin: -5px;
|
||||
max-width: 80vw;
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
transform: rotate(-45deg);
|
||||
z-index: 2002;
|
||||
}
|
||||
|
||||
svg-icon {
|
||||
display: none;
|
||||
|
|
|
|||
|
|
@ -1,119 +0,0 @@
|
|||
import ko from 'ko';
|
||||
|
||||
import { StorageResultType, Notification } from 'Common/Enums';
|
||||
import { RAINLOOP_TRIAL_KEY } from 'Common/Consts';
|
||||
import { i18n, getNotification } from 'Common/Translator';
|
||||
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
import Remote from 'Remote/Admin/Ajax';
|
||||
import LicenseStore from 'Stores/Admin/License';
|
||||
|
||||
import { popup, command } from 'Knoin/Knoin';
|
||||
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
||||
|
||||
@popup({
|
||||
name: 'View/Popup/Activate',
|
||||
templateID: 'PopupsActivate'
|
||||
})
|
||||
class ActivatePopupView extends AbstractViewNext {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
this.domain = ko.observable('');
|
||||
this.key = ko.observable('');
|
||||
this.key.focus = ko.observable(false);
|
||||
this.activationSuccessed = ko.observable(false);
|
||||
|
||||
this.licenseTrigger = LicenseStore.licenseTrigger;
|
||||
|
||||
this.activateProcess = ko.observable(false);
|
||||
this.activateText = ko.observable('');
|
||||
this.activateText.isError = ko.observable(false);
|
||||
|
||||
this.htmlDescription = ko.computed(() => i18n('POPUPS_ACTIVATE/HTML_DESC', { 'DOMAIN': this.domain() }));
|
||||
|
||||
this.key.subscribe(() => {
|
||||
this.activateText('');
|
||||
this.activateText.isError(false);
|
||||
});
|
||||
|
||||
this.activationSuccessed.subscribe((value) => {
|
||||
if (value) {
|
||||
this.licenseTrigger(!this.licenseTrigger());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@command(
|
||||
(self) => !self.activateProcess() && self.domain() && self.key() && !self.activationSuccessed()
|
||||
)
|
||||
activateCommand() {
|
||||
this.activateProcess(true);
|
||||
if (this.validateSubscriptionKey()) {
|
||||
Remote.licensingActivate(
|
||||
(sResult, oData) => {
|
||||
this.activateProcess(false);
|
||||
if (StorageResultType.Success === sResult && oData.Result) {
|
||||
if (true === oData.Result) {
|
||||
this.activationSuccessed(true);
|
||||
this.activateText(i18n('POPUPS_ACTIVATE/SUBS_KEY_ACTIVATED'));
|
||||
this.activateText.isError(false);
|
||||
} else {
|
||||
this.activateText(oData.Result);
|
||||
this.activateText.isError(true);
|
||||
this.key.focus(true);
|
||||
}
|
||||
} else if (oData.ErrorCode) {
|
||||
this.activateText(getNotification(oData.ErrorCode));
|
||||
this.activateText.isError(true);
|
||||
this.key.focus(true);
|
||||
} else {
|
||||
this.activateText(getNotification(Notification.UnknownError));
|
||||
this.activateText.isError(true);
|
||||
this.key.focus(true);
|
||||
}
|
||||
},
|
||||
this.domain(),
|
||||
this.key().replace(/[^A-Z0-9-]/gi, '')
|
||||
);
|
||||
} else {
|
||||
this.activateProcess(false);
|
||||
this.activateText(i18n('POPUPS_ACTIVATE/ERROR_INVALID_SUBS_KEY'));
|
||||
this.activateText.isError(true);
|
||||
this.key.focus(true);
|
||||
}
|
||||
}
|
||||
|
||||
onShow(isTrial) {
|
||||
this.domain(Settings.settingsGet('AdminDomain'));
|
||||
if (!this.activateProcess()) {
|
||||
isTrial = undefined === isTrial ? false : !!isTrial;
|
||||
|
||||
this.key(isTrial ? RAINLOOP_TRIAL_KEY : '');
|
||||
this.activateText('');
|
||||
this.activateText.isError(false);
|
||||
this.activationSuccessed(false);
|
||||
}
|
||||
}
|
||||
|
||||
onShowWithDelay() {
|
||||
if (!this.activateProcess()) {
|
||||
this.key.focus(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {boolean}
|
||||
*/
|
||||
validateSubscriptionKey() {
|
||||
const value = this.key();
|
||||
return (
|
||||
!value ||
|
||||
RAINLOOP_TRIAL_KEY === value ||
|
||||
!!/^RL[\d]+-[A-Z0-9-]+Z$/.test(value.trim().replace(/[^A-Z0-9-]/gi, ''))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export { ActivatePopupView, ActivatePopupView as default };
|
||||
Loading…
Add table
Add a link
Reference in a new issue