mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-05 18:44:03 +08:00
✨ Sync 2026-05-11 21:02:00
This commit is contained in:
1 parent
3d2fefa43a
commit
ce784c582e
60 files changed
+3238
-2526
No files matched your search
@@ -0,0 +1,27 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
//
|
||||
// Shared helper module for all luci-app-amlogic JS views.
|
||||
// Purpose: on first page load, inject the theme-aware stylesheet amlogic.css
|
||||
// into <head> (which contains .amlogic-status-* status colors, .amlogic-snap-*
|
||||
// snapshot cards, and prefers-color-scheme dark mode overrides) so every view
|
||||
// can rely on the same set of classes instead of duplicating inline styles.
|
||||
|
||||
'use strict';
|
||||
'require baseclass';
|
||||
|
||||
return baseclass.extend({
|
||||
// Inject the shared stylesheet (idempotent).
|
||||
// We tag the <link> element with a fixed id 'amlogic-shared-css' so that
|
||||
// subsequent calls return immediately and avoid appending it twice. The
|
||||
// stylesheet path is resolved via L.resource() to
|
||||
// /luci-static/resources/view/amlogic/amlogic.css.
|
||||
ensureCss: function () {
|
||||
if (document.getElementById('amlogic-shared-css')) return;
|
||||
const link = document.createElement('link');
|
||||
link.id = 'amlogic-shared-css';
|
||||
link.rel = 'stylesheet';
|
||||
link.type = 'text/css';
|
||||
link.href = L.resource('view/amlogic/amlogic.css');
|
||||
document.head.appendChild(link);
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user