v1.0.32 - only run on settings page
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.31</version>
|
<version>1.0.32</version>
|
||||||
<licence>AGPL</licence>
|
<licence>AGPL</licence>
|
||||||
<author>Your Name</author>
|
<author>Your Name</author>
|
||||||
<namespace>MinimalProfile</namespace>
|
<namespace>MinimalProfile</namespace>
|
||||||
|
|||||||
@@ -1,9 +1,16 @@
|
|||||||
/**
|
/**
|
||||||
* Minimal Profile - Load and hide configured fields
|
* Minimal Profile - Only run on settings page
|
||||||
*/
|
*/
|
||||||
(function() {
|
(function() {
|
||||||
'use strict';
|
'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 = {
|
var fieldSelectors = {
|
||||||
'pronouns': '#account-property-pronouns',
|
'pronouns': '#account-property-pronouns',
|
||||||
@@ -22,7 +29,6 @@
|
|||||||
|
|
||||||
function applyCss(hiddenFields) {
|
function applyCss(hiddenFields) {
|
||||||
console.log('MinimalProfile: applyCss called with', 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');
|
||||||
@@ -43,32 +49,28 @@
|
|||||||
style.textContent = css;
|
style.textContent = css;
|
||||||
style.id = 'minimalprofile-dynamic';
|
style.id = 'minimalprofile-dynamic';
|
||||||
document.head.appendChild(style);
|
document.head.appendChild(style);
|
||||||
console.log('MinimalProfile: CSS applied:', css);
|
console.log('MinimalProfile: CSS applied');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('MinimalProfile: Fetching 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.open('GET', OC.generateUrl('/apps/minimalprofile/api/v1/hidden-fields'));
|
||||||
req.onload = function() {
|
req.onload = function() {
|
||||||
console.log('MinimalProfile: Status:', req.status, req.statusText);
|
console.log('MinimalProfile: Status:', req.status);
|
||||||
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);
|
||||||
console.log('MinimalProfile: Parsed data:', data);
|
console.log('MinimalProfile: Data:', data);
|
||||||
applyCss(data.hiddenFields);
|
applyCss(data.hiddenFields || []);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('MinimalProfile: Parse error', e);
|
console.error('MinimalProfile: Parse error', e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
req.onerror = function() {
|
req.onerror = function() {
|
||||||
console.error('MinimalProfile: Request FAILED');
|
console.error('MinimalProfile: Request failed');
|
||||||
};
|
};
|
||||||
req.send();
|
req.send();
|
||||||
})();
|
})();
|
||||||
Reference in New Issue
Block a user