Update section edit buttons
This commit is contained in:
21
script.js
21
script.js
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user