v1.0.32 - only run on settings page
This commit is contained in:
@@ -1,9 +1,16 @@
|
||||
/**
|
||||
* Minimal Profile - Load and hide configured fields
|
||||
* Minimal Profile - Only run on settings page
|
||||
*/
|
||||
(function() {
|
||||
'use strict';
|
||||
console.log('MinimalProfile: START - version 1.0.31');
|
||||
|
||||
// Only run on settings page
|
||||
if (!window.location.pathname.includes('/settings/')) {
|
||||
console.log('MinimalProfile: Not on settings page, skipping');
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('MinimalProfile: START - v1.0.32');
|
||||
|
||||
var fieldSelectors = {
|
||||
'pronouns': '#account-property-pronouns',
|
||||
@@ -22,7 +29,6 @@
|
||||
|
||||
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');
|
||||
@@ -43,32 +49,28 @@
|
||||
style.textContent = css;
|
||||
style.id = 'minimalprofile-dynamic';
|
||||
document.head.appendChild(style);
|
||||
console.log('MinimalProfile: CSS applied:', css);
|
||||
console.log('MinimalProfile: CSS applied');
|
||||
}
|
||||
}
|
||||
|
||||
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.open('GET', OC.generateUrl('/apps/minimalprofile/api/v1/hidden-fields'));
|
||||
req.onload = function() {
|
||||
console.log('MinimalProfile: Status:', req.status, req.statusText);
|
||||
console.log('MinimalProfile: Response:', req.responseText);
|
||||
console.log('MinimalProfile: Status:', req.status);
|
||||
if (req.status === 200) {
|
||||
try {
|
||||
var data = JSON.parse(req.responseText);
|
||||
console.log('MinimalProfile: Parsed data:', data);
|
||||
applyCss(data.hiddenFields);
|
||||
console.log('MinimalProfile: Data:', data);
|
||||
applyCss(data.hiddenFields || []);
|
||||
} catch (e) {
|
||||
console.error('MinimalProfile: Parse error', e);
|
||||
}
|
||||
}
|
||||
};
|
||||
req.onerror = function() {
|
||||
console.error('MinimalProfile: Request FAILED');
|
||||
console.error('MinimalProfile: Request failed');
|
||||
};
|
||||
req.send();
|
||||
})();
|
||||
Reference in New Issue
Block a user