v1.0.17 - more debug
This commit is contained in:
@@ -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.16</version>
|
<version>1.0.17</version>
|
||||||
<licence>AGPL</licence>
|
<licence>AGPL</licence>
|
||||||
<author>Your Name</author>
|
<author>Your Name</author>
|
||||||
<namespace>MinimalProfile</namespace>
|
<namespace>MinimalProfile</namespace>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
'role': '#account-property-role',
|
'role': '#account-property-role',
|
||||||
'headline': '#account-property-headline',
|
'headline': '#account-property-headline',
|
||||||
'biography': '#account-property-biography',
|
'biography': '#account-property-biography',
|
||||||
organisation': '#account-property-organisation',
|
'organisation': '#account-property-organisation',
|
||||||
'phone': '#account-property-phone',
|
'phone': '#account-property-phone',
|
||||||
'address': '#account-property-address',
|
'address': '#account-property-address',
|
||||||
'birthdate': '#account-property-birthdate',
|
'birthdate': '#account-property-birthdate',
|
||||||
@@ -18,8 +18,10 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
function applyCss(hiddenFields) {
|
function applyCss(hiddenFields) {
|
||||||
|
console.log('MinimalProfile: Hidden fields:', hiddenFields);
|
||||||
|
|
||||||
if (!hiddenFields || hiddenFields.length === 0) {
|
if (!hiddenFields || hiddenFields.length === 0) {
|
||||||
console.log('MinimalProfile: No hidden fields');
|
console.log('MinimalProfile: No hidden fields to apply');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -28,7 +30,9 @@
|
|||||||
var selector = fieldSelectors[field];
|
var selector = fieldSelectors[field];
|
||||||
if (selector) {
|
if (selector) {
|
||||||
css += '.personal-settings-setting-box:has(' + selector + ') { display: none !important; } ';
|
css += '.personal-settings-setting-box:has(' + selector + ') { display: none !important; } ';
|
||||||
console.log('MinimalProfile: Hiding', field);
|
console.log('MinimalProfile: Hiding field:', field);
|
||||||
|
} else {
|
||||||
|
console.log('MinimalProfile: Unknown field:', field);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -37,26 +41,33 @@
|
|||||||
style.id = 'minimalprofile-style';
|
style.id = 'minimalprofile-style';
|
||||||
style.textContent = css;
|
style.textContent = css;
|
||||||
document.head.appendChild(style);
|
document.head.appendChild(style);
|
||||||
console.log('MinimalProfile: CSS applied');
|
console.log('MinimalProfile: CSS applied:', css);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
|
var url = OC.generateUrl('/apps/minimalprofile/api/v1/hidden-fields');
|
||||||
|
console.log('MinimalProfile: Fetching:', url);
|
||||||
|
|
||||||
var req = new XMLHttpRequest();
|
var req = new XMLHttpRequest();
|
||||||
|
req.open('GET', url);
|
||||||
req.onload = function() {
|
req.onload = function() {
|
||||||
|
console.log('MinimalProfile: Response status:', req.status);
|
||||||
if (req.status === 200) {
|
if (req.status === 200) {
|
||||||
try {
|
try {
|
||||||
var data = JSON.parse(req.responseText);
|
var data = JSON.parse(req.responseText);
|
||||||
|
console.log('MinimalProfile: Response data:', data);
|
||||||
applyCss(data.hiddenFields || []);
|
applyCss(data.hiddenFields || []);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('MinimalProfile: Parse error', e);
|
console.error('MinimalProfile: Parse error', e);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
console.error('MinimalProfile: HTTP error:', req.status);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
req.onerror = function() {
|
req.onerror = function() {
|
||||||
console.error('MinimalProfile: Request failed');
|
console.error('MinimalProfile: Request failed');
|
||||||
};
|
};
|
||||||
req.open('GET', OC.generateUrl('/apps/minimalprofile/api/v1/hidden-fields'));
|
|
||||||
req.send();
|
req.send();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user