Cleanup __APP__/getApp code

This commit is contained in:
djmaze 2020-09-15 09:29:25 +02:00
parent 29cf711a6a
commit b904eca98e
34 changed files with 86 additions and 146 deletions

View file

@ -18,7 +18,7 @@ export const useKeyboardShortcuts = ko.observable(true);
* @type {boolean}
*/
export const bMobileDevice = (/android|iphone|ipod|ipad|blackberry|mobile/i).test(
(window.navigator && navigator.userAgent && navigator.userAgent.toLowerCase()) || ''
(navigator.userAgent && navigator.userAgent.toLowerCase()) || ''
);
export const VIEW_MODELS = {
@ -59,14 +59,14 @@ export const keyScope = ko.computed({
// restoreKeyFilter
key.filter = (event) => {
if (useKeyboardShortcuts()) {
const el = event.target || event.srcElement,
tagName = el ? el.tagName.toUpperCase() : '';
const el = event.target,
nodeName = el ? el.nodeName : '';
return !(
'INPUT' === tagName ||
'SELECT' === tagName ||
'TEXTAREA' === tagName ||
(el && 'DIV' === tagName && ('editorHtmlArea' === el.className || 'true' === '' + el.contentEditable))
'INPUT' === nodeName ||
'SELECT' === nodeName ||
'TEXTAREA' === nodeName ||
(el && el.contentEditable)
);
}
@ -96,10 +96,3 @@ dropdownVisibility.subscribe((value) => {
keyScope(keyScopeFake());
}
});
/**
* @type {*}
*/
export const data = {
__APP__: null
};

View file

@ -55,6 +55,6 @@ export function timeToNode(element, time) {
}
addEventListener('reload-time', () => setTimeout(() =>
document.querySelectorAll('[data-bind*="moment:"]').forEach(element => timeToNode(element))
document.querySelectorAll('[data-bind*="moment:"]').forEach(element => timeToNode(element))
, 1)
);

View file

@ -1,5 +1,3 @@
import { data as GlobalsData } from 'Common/Globals';
const USER_VIEW_MODELS_HOOKS = [],
ADMIN_VIEW_MODELS_HOOKS = [];
@ -18,8 +16,8 @@ export function mainSettingsGet(name) {
* @param {?number=} timeout
*/
export function remoteRequest(callback, action, parameters, timeout) {
if (GlobalsData.__APP__) {
GlobalsData.__APP__.remote().defaultRequest(callback, 'Plugin' + action, parameters, timeout);
if (rl.app) {
rl.app.remote().defaultRequest(callback, 'Plugin' + action, parameters, timeout);
}
}