mirror of
https://github.com/opencv/opencv.git
synced 2025-06-07 17:44:04 +08:00
Merge pull request #25213 from mshabunin:fix-doc-buttons
doc: fix toggle buttons in some tutorials
This commit is contained in:
commit
bf2626e4db
@ -50,7 +50,7 @@ function addButton(label, buttonName) {
|
|||||||
|
|
||||||
function buttonsToAdd($elements, $heading, $type) {
|
function buttonsToAdd($elements, $heading, $type) {
|
||||||
if ($elements.length === 0) {
|
if ($elements.length === 0) {
|
||||||
$elements = $("" + $type + ":contains(" + $heading.html() + ")").parent().prev("div.newInnerHTML");
|
return;
|
||||||
}
|
}
|
||||||
var arr = jQuery.makeArray($elements);
|
var arr = jQuery.makeArray($elements);
|
||||||
var seen = {};
|
var seen = {};
|
||||||
@ -72,18 +72,12 @@ function buttonsToAdd($elements, $heading, $type) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function addTutorialsButtons() {
|
function addTutorialsButtons() {
|
||||||
$("h2").each(function() {
|
$("h1").each(function() {
|
||||||
$heading = $(this);
|
var $elements = $(this).nextUntil("h1")
|
||||||
$smallerHeadings = $(this).nextUntil("h2").filter("h3").add($(this).nextUntil("h2").find("h3"));
|
var $lower = $elements.find("div.newInnerHTML")
|
||||||
if ($smallerHeadings.length) {
|
$elements = $elements.add($lower)
|
||||||
$smallerHeadings.each(function() {
|
$elements = $elements.filter("div.newInnerHTML")
|
||||||
var $elements = $(this).nextUntil("h2,h3").filter("div.newInnerHTML");
|
buttonsToAdd($elements, $(this), "h1")
|
||||||
buttonsToAdd($elements, $(this), "h3");
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
var $elements = $(this).nextUntil("h2").filter("div.newInnerHTML");
|
|
||||||
buttonsToAdd($elements, $heading, "h2");
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
$(".toggleable_button").first().click();
|
$(".toggleable_button").first().click();
|
||||||
var $clickDefault = $('.toggleable_button.label_python').first();
|
var $clickDefault = $('.toggleable_button.label_python').first();
|
||||||
|
Loading…
Reference in New Issue
Block a user