From efdafcb764e41def98ba1d109b5404af23c99aeb Mon Sep 17 00:00:00 2001 From: Guy Van Sanden Date: Thu, 16 Apr 2026 18:37:54 +0200 Subject: [PATCH] v1.0.31 - debug JS logging --- appinfo/info.xml | 2 +- js/minimalprofile.js | 24 +++++++++++++++++++----- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/appinfo/info.xml b/appinfo/info.xml index 6b90749..a8132fd 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -4,7 +4,7 @@ Minimal Profile Hides profile fields to create a minimal user profile Allows administrators to hide profile fields like pronouns, social links, etc. - 1.0.30 + 1.0.31 AGPL Your Name MinimalProfile diff --git a/js/minimalprofile.js b/js/minimalprofile.js index 99873f9..294aaa4 100644 --- a/js/minimalprofile.js +++ b/js/minimalprofile.js @@ -3,7 +3,7 @@ */ (function() { 'use strict'; - console.log('MinimalProfile: START'); + console.log('MinimalProfile: START - version 1.0.31'); var fieldSelectors = { 'pronouns': '#account-property-pronouns', @@ -21,6 +21,9 @@ }; function applyCss(hiddenFields) { + console.log('MinimalProfile: applyCss called with', hiddenFields); + console.log('MinimalProfile: hiddenFields type', typeof hiddenFields, Array.isArray(hiddenFields)); + if (!hiddenFields || hiddenFields.length === 0) { console.log('MinimalProfile: No fields to hide'); return; @@ -38,23 +41,34 @@ if (css) { var style = document.createElement('style'); style.textContent = css; + style.id = 'minimalprofile-dynamic'; document.head.appendChild(style); - console.log('MinimalProfile: CSS applied'); + console.log('MinimalProfile: CSS applied:', css); } } - // Fetch config + console.log('MinimalProfile: Fetching config...'); + + var url = OC.generateUrl('/apps/minimalprofile/api/v1/hidden-fields'); + console.log('MinimalProfile: URL:', url); + var req = new XMLHttpRequest(); + req.open('GET', url); req.onload = function() { + console.log('MinimalProfile: Status:', req.status, req.statusText); + console.log('MinimalProfile: Response:', req.responseText); if (req.status === 200) { try { var data = JSON.parse(req.responseText); - applyCss(data.hiddenFields || []); + console.log('MinimalProfile: Parsed data:', data); + applyCss(data.hiddenFields); } catch (e) { console.error('MinimalProfile: Parse error', e); } } }; - req.open('GET', OC.generateUrl('/apps/minimalprofile/api/v1/hidden-fields')); + req.onerror = function() { + console.error('MinimalProfile: Request FAILED'); + }; req.send(); })(); \ No newline at end of file