Rework handling of icons and tinting of external icons

This commit is contained in:
2026-02-25 13:34:34 +01:00
parent f0b768e5bb
commit 582ed5fd60
31 changed files with 70 additions and 134 deletions

View File

@@ -87,6 +87,34 @@ jQuery(function(){
this.blur();
});
// make edit toolbar icons themeable by converting img icons to CSS masks
(function enhanceEditToolbarIcons() {
function toMaskIcons() {
jQuery('.dokuwiki #tool__bar button.toolbutton img').each(function () {
var $img = jQuery(this);
var src = $img.attr('src');
if (!src) {
return;
}
var $icon = jQuery('<span/>', {
'class': 'toolicon',
'aria-hidden': 'true'
});
$icon[0].style.setProperty('--icon-url', 'url("' + src.replace(/"/g, '\\"') + '")');
$img.replaceWith($icon);
});
}
toMaskIcons();
var toolbar = document.getElementById('tool__bar');
if (toolbar && window.MutationObserver) {
new MutationObserver(toMaskIcons).observe(toolbar, {childList: true, subtree: true});
}
}());
// enhance header search with suggestions and keyboard navigation
(function enhanceSearch(){
var $input = jQuery('#qsearch__in');