Files
nextcloud_minimalprofile/js/minimalprofile.js

50 lines
1.3 KiB
JavaScript
Raw Permalink Normal View History

2026-04-16 16:37:44 +02:00
/**
2026-04-16 20:58:17 +02:00
* MinimalProfile v46 - Clean version
2026-04-16 16:37:44 +02:00
*/
(function() {
2026-04-16 16:37:44 +02:00
'use strict';
2026-04-16 20:34:38 +02:00
if (!window.location.pathname.includes('/settings/')) {
return;
}
2026-04-16 20:47:35 +02:00
var map = {
'pronouns': '#account-property-pronouns',
'role': '#account-property-role',
2026-04-16 20:47:35 +02:00
'headline': '#account-property-headline'
};
2026-04-16 18:37:54 +02:00
function hideFields(hidden) {
if (!hidden || !hidden.length) return;
var css = '';
hidden.forEach(function(f) {
if (map[f]) {
css += '.personal-settings-setting-box:has(' + map[f] + ') { display: none !important; }';
}
});
if (css) {
var s = document.createElement('style');
s.textContent = css;
document.head.appendChild(s);
}
}
2026-04-16 20:47:35 +02:00
function loadConfig() {
var xhr = new XMLHttpRequest();
2026-04-16 20:54:35 +02:00
xhr.open('GET', '/ocs/v2.php/apps/minimalprofile/api/v1/hidden-fields', true);
xhr.onload = function() {
if (xhr.status === 200) {
try {
var data = JSON.parse(xhr.responseText);
2026-04-16 20:57:16 +02:00
var fields = data?.ocs?.data?.hiddenFields || data?.hiddenFields;
2026-04-16 20:55:54 +02:00
hideFields(fields);
2026-04-16 20:58:17 +02:00
} catch(e) {}
}
};
xhr.send();
2026-04-16 20:47:35 +02:00
}
loadConfig();
})();