Update section edit buttons

This commit is contained in:
2026-03-17 10:51:30 +01:00
parent b81e5cf6e4
commit e1e89b40fb
3 changed files with 113 additions and 5 deletions

View File

@@ -139,6 +139,27 @@ jQuery(function(){
}
}());
// Relocate section edit buttons next to their headings.
// DokuWiki renders the edit marker after the section content div,
// so we match by secid: .editbutton_N belongs to h*.sectioneditN.
(function enhanceSectionEditButtons() {
jQuery('#dokuwiki__content .secedit[class*="editbutton_"]').each(function () {
var $btn = jQuery(this);
var match = $btn.attr('class').match(/editbutton_(\d+)/);
if (!match) return;
var $heading = jQuery('#dokuwiki__content .sectionedit' + match[1]);
if (!$heading.length || !$heading.is('h1,h2,h3,h4,h5,h6')) return;
// Skip if already relocated
if ($heading.parent().hasClass('section-heading-row')) return;
var $wrapper = jQuery('<div/>', {'class': 'section-heading-row'});
$heading.before($wrapper);
$wrapper.append($heading, $btn);
});
}());
// enhance header search with suggestions and keyboard navigation
(function enhanceSearch(){
var $input = jQuery('#qsearch__in');