🚀 Sync 2026-05-14 20:40:35

This commit is contained in:
github-actions[bot] committed 2026-05-14 20:40:35 +08:00
1 parent 6497237a92
commit cb5dd3d710
35 files changed
+710 -611

No files matched your search

@@ -1,20 +1,15 @@
// 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.
//
// Purpose: inject the theme-aware stylesheet amlogic.css into <head> on first
// page load so every view can use .amlogic-status-* / .amlogic-snap-* classes
// and prefers-color-scheme dark mode overrides without 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.
// Inject amlogic.css once; guarded by element id to prevent duplicates.
ensureCss: function () {
if (document.getElementById('amlogic-shared-css')) return;
const link = document.createElement('link');