/** * MinimalProfile v45 - Handle both OCS and plain JSON */ (function() { 'use strict'; if (!window.location.pathname.includes('/settings/')) { return; } console.log('MinimalProfile v45: Starting'); var map = { 'pronouns': '#account-property-pronouns', 'role': '#account-property-role', 'headline': '#account-property-headline' }; 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; }'; console.log('Hiding:', f); } }); if (css) { var s = document.createElement('style'); s.textContent = css; document.head.appendChild(s); } } function loadConfig() { var xhr = new XMLHttpRequest(); xhr.open('GET', '/ocs/v2.php/apps/minimalprofile/api/v1/hidden-fields', true); xhr.onload = function() { console.log('MinimalProfile v45: Response', xhr.status, xhr.responseText); if (xhr.status === 200) { try { var data = JSON.parse(xhr.responseText); var fields = data?.ocs?.data?.hiddenFields || data?.hiddenFields; console.log('MinimalProfile v45: Fields:', fields); hideFields(fields); } catch(e) { console.error('MinimalProfile v45: Parse error', e); } } else { console.error('MinimalProfile v45: API failed', xhr.status); } }; xhr.onerror = function() { console.error('MinimalProfile v45: Network error'); }; xhr.send(); } loadConfig(); })();