From 310679ce3cc931e893e982639f6ff3ce994bb586 Mon Sep 17 00:00:00 2001 From: Guy Van Sanden Date: Wed, 9 Apr 2025 13:51:08 +0200 Subject: [PATCH] Renamed script --- appinfo/app.php | 4 ++-- appinfo/info.xml | 2 +- js/hidePronouns.js | 19 +++++++++++++++++++ js/script.js | 7 ------- 4 files changed, 22 insertions(+), 10 deletions(-) create mode 100644 js/hidePronouns.js delete mode 100644 js/script.js diff --git a/appinfo/app.php b/appinfo/app.php index 0bc7662..87e5bf4 100644 --- a/appinfo/app.php +++ b/appinfo/app.php @@ -3,5 +3,5 @@ namespace OCA\MinimalProfile\AppInfo; use OCP\Util; -Util::addStyle('minimalprofile', 'style'); -Util::addScript('minimalprofile', 'script'); +Util::addStyle("minimalprofile", "style"); +Util::addScript("minimalprofile", "hidePronouns"); diff --git a/appinfo/info.xml b/appinfo/info.xml index 7bfe7cd..e24c4b2 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -9,7 +9,7 @@ 1.0.0 agpl - Your Name + Guy Van Sanden MinimalProfile diff --git a/js/hidePronouns.js b/js/hidePronouns.js new file mode 100644 index 0000000..e7d17a3 --- /dev/null +++ b/js/hidePronouns.js @@ -0,0 +1,19 @@ +document.addEventListener("DOMContentLoaded", function () { + function tryToHidePronouns() { + const sections = document.querySelectorAll("section"); + + for (const section of sections) { + const label = section.querySelector("label"); + if (label && label.textContent.trim().toLowerCase() === "pronouns") { + console.log("Found Pronouns field, hiding section..."); + section.style.display = "none"; + clearInterval(checkInterval); // stop checking + return; + } + } + } + + const checkInterval = setInterval(tryToHidePronouns, 500); // retry every half second + + console.log("Started polling to find Pronouns field..."); +}); diff --git a/js/script.js b/js/script.js deleted file mode 100644 index 98b2ea0..0000000 --- a/js/script.js +++ /dev/null @@ -1,7 +0,0 @@ - -document.addEventListener('DOMContentLoaded', function () { - const pronounField = document.querySelector('[data-profile-field="pronouns"]'); - if (pronounField) { - pronounField.style.display = 'none'; - } -});