Back to static CSS that works (hides all)
This commit is contained in:
@@ -1 +1,13 @@
|
|||||||
/* Base styles - can add custom styles here */
|
/* Hide profile fields */
|
||||||
|
.personal-settings-setting-box:has(#account-property-pronouns) { display: none !important; }
|
||||||
|
.personal-settings-setting-box:has(#account-property-role) { display: none !important; }
|
||||||
|
.personal-settings-setting-box:has(#account-property-headline) { display: none !important; }
|
||||||
|
.personal-settings-setting-box:has(#account-property-biography) { display: none !important; }
|
||||||
|
.personal-settings-setting-box:has(#account-property-organisation) { display: none !important; }
|
||||||
|
.personal-settings-setting-box:has(#account-property-phone) { display: none !important; }
|
||||||
|
.personal-settings-setting-box:has(#account-property-address) { display: none !important; }
|
||||||
|
.personal-settings-setting-box:has(#account-property-birthdate) { display: none !important; }
|
||||||
|
.personal-settings-setting-box:has(#account-property-website) { display: none !important; }
|
||||||
|
.personal-settings-setting-box:has(#account-property-twitter) { display: none !important; }
|
||||||
|
.personal-settings-setting-box:has(#account-property-fediverse) { display: none !important; }
|
||||||
|
.personal-settings-setting-box:has(#account-property-location) { display: none !important; }
|
||||||
@@ -1,62 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Minimal Profile - Hide specific fields based on config
|
* Minimal Profile - minimal JS (placeholder)
|
||||||
*/
|
*/
|
||||||
(function() {
|
(function() {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var fieldSelectors = {
|
|
||||||
'pronouns': '#account-property-pronouns',
|
|
||||||
'role': '#account-property-role',
|
|
||||||
'headline': '#account-property-headline',
|
|
||||||
'biography': '#account-property-biography',
|
|
||||||
'organisation': '#account-property-organisation',
|
|
||||||
'phone': '#account-property-phone',
|
|
||||||
'address': '#account-property-address',
|
|
||||||
'birthdate': '#account-property-birthdate',
|
|
||||||
'website': '#account-property-website',
|
|
||||||
'twitter': '#account-property-twitter',
|
|
||||||
'fediverse': '#account-property-fediverse',
|
|
||||||
'location': '#account-property-location'
|
|
||||||
};
|
|
||||||
|
|
||||||
function hideFields(hiddenFields) {
|
|
||||||
if (!hiddenFields || hiddenFields.length === 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var css = '';
|
|
||||||
hiddenFields.forEach(function(field) {
|
|
||||||
var selector = fieldSelectors[field];
|
|
||||||
if (selector) {
|
|
||||||
css += '.personal-settings-setting-box:has(' + selector + ') { display: none !important; } ';
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (css) {
|
|
||||||
var style = document.createElement('style');
|
|
||||||
style.id = 'minimalprofile-dynamic';
|
|
||||||
style.textContent = css;
|
|
||||||
document.head.appendChild(style);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function init() {
|
|
||||||
var req = new XMLHttpRequest();
|
|
||||||
req.onload = function() {
|
|
||||||
if (req.status === 200) {
|
|
||||||
try {
|
|
||||||
var data = JSON.parse(req.responseText);
|
|
||||||
hideFields(data.hiddenFields || []);
|
|
||||||
} catch (e) {}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
req.open('GET', OC.generateUrl('/apps/minimalprofile/api/v1/hidden-fields'));
|
|
||||||
req.send();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (document.readyState === 'loading') {
|
|
||||||
document.addEventListener('DOMContentLoaded', init);
|
|
||||||
} else {
|
|
||||||
init();
|
|
||||||
}
|
|
||||||
})();
|
})();
|
||||||
Reference in New Issue
Block a user