further iframe fixes & changes

- add iframe-dark
- add autoDarkMode for loaded iframes
- add border-dark overwrite in dark-mode
- fix markup with Default IFrame Tab on load
This commit is contained in:
REJack
2021-07-12 21:28:23 +02:00
parent d6b66aa353
commit eb5be81a11
4 changed files with 828 additions and 4 deletions

View File

@@ -51,6 +51,7 @@ const Default = {
autoIframeMode: true,
autoItemActive: true,
autoShowNewTab: true,
autoDarkMode: false,
allowDuplicates: false,
loadingScreen: true,
useNavbarItems: true,
@@ -69,7 +70,6 @@ class IFrame {
constructor(element, config) {
this._config = config
this._element = element
this._init()
}
@@ -239,7 +239,12 @@ class IFrame {
_initFrameElement() {
if (window.frameElement && this._config.autoIframeMode) {
$('body').addClass(CLASS_NAME_IFRAME_MODE)
const $body = $('body')
$body.addClass(CLASS_NAME_IFRAME_MODE)
if (this._config.autoDarkMode) {
$body.addClass('dark-mode')
}
}
}
@@ -385,6 +390,8 @@ class IFrame {
}
const _options = $.extend({}, Default, typeof config === 'object' ? config : data)
localStorage.setItem('AdminLTE:IFrame:Options', JSON.stringify(_options))
const plugin = new IFrame($(this), _options)
$(this).data(DATA_KEY, typeof config === 'object' ? config : data)
@@ -393,7 +400,7 @@ class IFrame {
plugin[config]()
}
} else {
new IFrame($(this), Default)._initFrameElement()
new IFrame($(this), JSON.parse(localStorage.getItem('AdminLTE:IFrame:Options')))._initFrameElement()
}
}
}