diff --git a/appinfo/info.xml b/appinfo/info.xml
index 3f5e80d..dcf5e6a 100644
--- a/appinfo/info.xml
+++ b/appinfo/info.xml
@@ -4,7 +4,7 @@
Minimal Profile
Hides profile fields to create a minimal user profile
Allows administrators to hide profile fields like pronouns, social links, etc.
- 1.0.18
+ 1.0.19
AGPL
Your Name
MinimalProfile
@@ -14,7 +14,4 @@
-
-
-
\ No newline at end of file
diff --git a/css/minimalprofile.css b/css/minimalprofile.css
index cd03594..2324269 100644
--- a/css/minimalprofile.css
+++ b/css/minimalprofile.css
@@ -1,2 +1,13 @@
-/* Test if CSS loads - blue border */
-#content { border: 5px solid blue !important; }
\ No newline at end of file
+/* 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; }
\ No newline at end of file
diff --git a/js/minimalprofile.js b/js/minimalprofile.js
index f0f7689..6637d83 100644
--- a/js/minimalprofile.js
+++ b/js/minimalprofile.js
@@ -4,7 +4,7 @@
var fieldSelectors = {
'pronouns': '#account-property-pronouns',
- 'role': '#account-property-role',
+ 'role': '#account-property-role',
'headline': '#account-property-headline',
'biography': '#account-property-biography',
'organisation': '#account-property-organisation',
@@ -17,63 +17,48 @@
'location': '#account-property-location'
};
- function applyCss(hiddenFields) {
- console.log('MinimalProfile: Hidden fields:', hiddenFields);
-
+ function updateCss(hiddenFields) {
if (!hiddenFields || hiddenFields.length === 0) {
- console.log('MinimalProfile: No hidden fields to apply');
+ console.log('MinimalProfile: No hidden fields');
return;
}
-
var css = '';
hiddenFields.forEach(function(field) {
var selector = fieldSelectors[field];
if (selector) {
- css += '.personal-settings-setting-box:has(' + selector + ') { display: none !important; } ';
- console.log('MinimalProfile: Hiding field:', field);
- } else {
- console.log('MinimalProfile: Unknown field:', field);
+ css += selector + ' { display: none !important; } ';
+ console.log('MinimalProfile: Hiding', field, selector);
}
- });
+ }));
- if (css) {
- var style = document.createElement('style');
- style.id = 'minimalprofile-style';
- style.textContent = css;
- document.head.appendChild(style);
- console.log('MinimalProfile: CSS applied:', css);
+ var style = document.createElement('style');
+ style.id = 'minimalprofile-style';
+ style.textContent = css;
+ document.head.appendChild(style);
+ console.log('MinimalProfile: CSS applied', css);
+ }
+
+ var req = new XMLHttpRequest();
+ req.onload = function() {
+ console.log('MinimalProfile: Response status', req.status);
+ if (req.status === 200) {
+ try {
+ var data = JSON.parse(req.responseText);
+ console.log('MinimalProfile: Data', data);
+ updateCss(data.hiddenFields);
+ } catch (e) {
+ console.error('MinimalProfile: Error', e);
+ }
}
- }
+ };
+ req.onerror = function() {
+ console.error('MinimalProfile: Request failed');
+ };
+ req.open('GET', OC.generateUrl('/apps/minimalprofile/api/v1/hidden-fields'));
+ req.send();
- function init() {
- var url = OC.generateUrl('/apps/minimalprofile/api/v1/hidden-fields');
- console.log('MinimalProfile: Fetching:', url);
-
- var req = new XMLHttpRequest();
- req.open('GET', url);
- req.onload = function() {
- console.log('MinimalProfile: Response status:', req.status);
- if (req.status === 200) {
- try {
- var data = JSON.parse(req.responseText);
- console.log('MinimalProfile: Response data:', data);
- applyCss(data.hiddenFields || []);
- } catch (e) {
- console.error('MinimalProfile: Parse error', e);
- }
- } else {
- console.error('MinimalProfile: HTTP error:', req.status);
- }
- };
- req.onerror = function() {
- console.error('MinimalProfile: Request failed');
- };
- req.send();
- }
-
- if (document.readyState === 'loading') {
- document.addEventListener('DOMContentLoaded', init);
- } else {
- init();
- }
+ setTimeout(function() {
+ var el = document.querySelector('#account-property-pronouns');
+ console.log('MinimalProfile: Pronouns element found?', !!el);
+ }, 3000);
})();
\ No newline at end of file
diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php
index e569d45..b80e7d9 100644
--- a/lib/AppInfo/Application.php
+++ b/lib/AppInfo/Application.php
@@ -24,7 +24,6 @@ class Application extends App implements IBootstrap {
TemplateResponse::EVENT_LOAD_ADDITIONAL_SCRIPTS,
function() {
Util::addStyle('minimalprofile', 'minimalprofile');
- Util::addScript('minimalprofile', 'minimalprofile');
}
);
}