Fix icon hover colors, text alignment, and UI improvements
This commit is contained in:
+23
-1
@@ -39,6 +39,7 @@ document.head.appendChild(authStyle);
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
if (isAuthExemptPage()) {
|
||||
unlockAdminUi();
|
||||
enforceSafeBlankLinks();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -46,10 +47,21 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
initSidebar();
|
||||
initDropdowns();
|
||||
initLogout();
|
||||
enforceSafeBlankLinks();
|
||||
|
||||
checkAuth();
|
||||
});
|
||||
|
||||
function enforceSafeBlankLinks(scope = document) {
|
||||
scope.querySelectorAll('a[target="_blank"]').forEach(link => {
|
||||
const currentRel = (link.getAttribute('rel') || '').toLowerCase();
|
||||
const relParts = new Set(currentRel.split(/\s+/).filter(Boolean));
|
||||
relParts.add('noopener');
|
||||
relParts.add('noreferrer');
|
||||
link.setAttribute('rel', Array.from(relParts).join(' '));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Sidebar Toggle
|
||||
*/
|
||||
@@ -430,11 +442,21 @@ function debounce(func, wait) {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* HTML Escape Helper — prevents XSS when inserting dynamic values into innerHTML
|
||||
*/
|
||||
function escapeHtml(str) {
|
||||
const div = document.createElement('div');
|
||||
div.appendChild(document.createTextNode(String(str ?? '')));
|
||||
return div.innerHTML;
|
||||
}
|
||||
|
||||
// Export for use in other scripts
|
||||
window.MSPE = {
|
||||
API,
|
||||
showNotification,
|
||||
formatDate,
|
||||
confirmDialog,
|
||||
debounce
|
||||
debounce,
|
||||
escapeHtml
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user