From 44448319ab878df2963c5f64d792a1f3da031dd3 Mon Sep 17 00:00:00 2001 From: fda77 Date: Wed, 23 Oct 2024 13:26:53 +0200 Subject: [PATCH] freetz functions: add cockpit_pruner --- tools/freetz_functions | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tools/freetz_functions b/tools/freetz_functions index 7b974af69a..3ea0245e0e 100644 --- a/tools/freetz_functions +++ b/tools/freetz_functions @@ -17,6 +17,21 @@ supervisor_delete_service() { } +# removes a div by id name in all cock pits (since fos8) +cockpit_pruner() { + local theid="$1" + for oem in $(supported_brandings) all; do + [ -d "${FILESYSTEM_MOD_DIR}/usr/www/${oem}" -a ! -L "${FILESYSTEM_MOD_DIR}/usr/www/${oem}" ] || continue + for file in ${FILESYSTEM_MOD_DIR}/usr/www/${oem}/js3/views/overview/cockpit.html ${FILESYSTEM_MOD_DIR}/usr/www/${oem}/js3/views/overview/cockpit.*.html; do + [ ! -e ${file} ] && continue + modsed -r \ + "s/(=\"${theid}\"[^>]*)>/\1 style=\"display: none;\">/" \ + "$file" + done + done +} + + #linkbox_remove #removes links within a box on the left linkbox_remove() {