v1.0.31 - debug JS logging

This commit is contained in:
2026-04-16 18:37:54 +02:00
parent ac3d4737cb
commit efdafcb764
2 changed files with 20 additions and 6 deletions

View File

@@ -4,7 +4,7 @@
<name>Minimal Profile</name> <name>Minimal Profile</name>
<summary>Hides profile fields to create a minimal user profile</summary> <summary>Hides profile fields to create a minimal user profile</summary>
<description>Allows administrators to hide profile fields like pronouns, social links, etc.</description> <description>Allows administrators to hide profile fields like pronouns, social links, etc.</description>
<version>1.0.30</version> <version>1.0.31</version>
<licence>AGPL</licence> <licence>AGPL</licence>
<author>Your Name</author> <author>Your Name</author>
<namespace>MinimalProfile</namespace> <namespace>MinimalProfile</namespace>

View File

@@ -3,7 +3,7 @@
*/ */
(function() { (function() {
'use strict'; 'use strict';
console.log('MinimalProfile: START'); console.log('MinimalProfile: START - version 1.0.31');
var fieldSelectors = { var fieldSelectors = {
'pronouns': '#account-property-pronouns', 'pronouns': '#account-property-pronouns',
@@ -21,6 +21,9 @@
}; };
function applyCss(hiddenFields) { 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) { if (!hiddenFields || hiddenFields.length === 0) {
console.log('MinimalProfile: No fields to hide'); console.log('MinimalProfile: No fields to hide');
return; return;
@@ -38,23 +41,34 @@
if (css) { if (css) {
var style = document.createElement('style'); var style = document.createElement('style');
style.textContent = css; style.textContent = css;
style.id = 'minimalprofile-dynamic';
document.head.appendChild(style); 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(); var req = new XMLHttpRequest();
req.open('GET', url);
req.onload = function() { req.onload = function() {
console.log('MinimalProfile: Status:', req.status, req.statusText);
console.log('MinimalProfile: Response:', req.responseText);
if (req.status === 200) { if (req.status === 200) {
try { try {
var data = JSON.parse(req.responseText); var data = JSON.parse(req.responseText);
applyCss(data.hiddenFields || []); console.log('MinimalProfile: Parsed data:', data);
applyCss(data.hiddenFields);
} catch (e) { } catch (e) {
console.error('MinimalProfile: Parse error', 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(); req.send();
})(); })();