Skip to content

Commit 4398e0b

Browse files
authored
Merge pull request opencv#26340 from Kumataro:wa26339
doc: fix the position of toggle button opencv#26340 Close opencv#26339 ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [x] There is a reference to the original bug report and related work - [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [ ] The feature is well documented and sample code can be built with the project CMake
1 parent 94d5ad0 commit 4398e0b

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

doc/tutorial-utils.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,23 @@ function buttonsToAdd($elements, $heading, $type) {
7272
}
7373

7474
function addTutorialsButtons() {
75-
$("h1").each(function() {
76-
var $elements = $(this).nextUntil("h1")
75+
// See https://github.com/opencv/opencv/issues/26339
76+
$lastHeader = undefined
77+
$("h1,h2,h3,div.newInnerHTML").each(function() {
78+
if( this.tagName.startsWith("H") ) {
79+
$lastHeader = $(this)
80+
return true // loop-continue
81+
}
82+
if( $lastHeader === undefined ) {
83+
return true // loop-continue
84+
}
85+
var $toggleHeader = $lastHeader.tagName
86+
var $elements = $lastHeader.nextUntil($toggleHeader)
7787
var $lower = $elements.find("div.newInnerHTML")
7888
$elements = $elements.add($lower)
7989
$elements = $elements.filter("div.newInnerHTML")
80-
buttonsToAdd($elements, $(this), "h1")
90+
buttonsToAdd($elements, $lastHeader, $toggleHeader)
91+
$lastHeader = undefined
8192
});
8293
$(".toggleable_button").first().click();
8394
var $clickDefault = $('.toggleable_button.label_python').first();

0 commit comments

Comments
 (0)