mirror of
https://github.com/opencv/opencv.git
synced 2026-07-31 08:13:04 +04:00
GSoC 2016 - Adding ALIASES for tutorial (#7041)
* GSoC 2016 - Adding toggle files to be used by tutorials. Add a toggle option for tutorials. * adds a button on the HTML tutorial pages to switch between blocks * the default option is for languages: one can write a block for C++ and another one for Python without re-writing the tutorial Add aliases to the doxyfile. * adding alises to make a link to previous and next tutorial. * adding alias to specify the toggle options in the tutorials index. * adding alias to add a youtube video directly from link. Add a sample tutorial (mat_mask_opertaions) using the developed aliases: * youtube alias * previous and next tutorial alias * buttons * languages info for tutorial table of content * code referances with snippets (and associated sample code files) * Removing the automatic ordering. Adding specific toggles for cpp, java and python. Move all the code to the footer / header and Doxyfile. Updating documentation.
This commit is contained in:
committed by
Maksim Shabunin
parent
36b5abf6b7
commit
fcddfa4f86
@@ -17,5 +17,74 @@ $generatedby  <a href="http://www.doxygen.org/index.html">
|
||||
</a> $doxygenversion
|
||||
</small></address>
|
||||
<!--END !GENERATE_TREEVIEW-->
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
function addButton(label, buttonName) {
|
||||
var b = document.createElement("BUTTON");
|
||||
b.innerHTML = buttonName;
|
||||
b.setAttribute('class', 'toggleable_button label_' + label);
|
||||
b.onclick = function() {
|
||||
$('.toggleable_button').css({
|
||||
border: '2px outset',
|
||||
'border-radius': '4px'
|
||||
});
|
||||
$('.toggleable_button.label_' + label).css({
|
||||
border: '2px inset',
|
||||
'border-radius': '4px'
|
||||
});
|
||||
$('.toggleable_div').css('display', 'none');
|
||||
$('.toggleable_div.label_' + label).css('display', 'block');
|
||||
};
|
||||
b.style.border = '2px outset';
|
||||
b.style.borderRadius = '4px';
|
||||
b.style.margin = '2px';
|
||||
return b;
|
||||
}
|
||||
function buttonsToAdd($elements, $heading, $type) {
|
||||
if ($elements.length === 0) {
|
||||
$elements = $("" + $type + ":contains(" + $heading.html() + ")").parent().prev("div.newInnerHTML");
|
||||
}
|
||||
var arr = jQuery.makeArray($elements);
|
||||
var seen = {};
|
||||
arr.forEach(function(e) {
|
||||
var txt = e.innerHTML;
|
||||
if (!seen[txt]) {
|
||||
$button = addButton(e.title, txt);
|
||||
if (Object.keys(seen).length == 0) {
|
||||
var linebreak1 = document.createElement("br");
|
||||
var linebreak2 = document.createElement("br");
|
||||
($heading).append(linebreak1);
|
||||
($heading).append(linebreak2);
|
||||
}
|
||||
($heading).append($button);
|
||||
seen[txt] = true;
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
$("h2").each(function() {
|
||||
$heading = $(this);
|
||||
$smallerHeadings = $(this).nextUntil("h2").filter("h3").add($(this).nextUntil("h2").find("h3"));
|
||||
if ($smallerHeadings.length) {
|
||||
$smallerHeadings.each(function() {
|
||||
var $elements = $(this).nextUntil("h3").filter("div.newInnerHTML");
|
||||
buttonsToAdd($elements, $(this), "h3");
|
||||
});
|
||||
} else {
|
||||
var $elements = $(this).nextUntil("h2").filter("div.newInnerHTML");
|
||||
buttonsToAdd($elements, $heading, "h2");
|
||||
}
|
||||
});
|
||||
$(".toggleable_button").first().click();
|
||||
var $clickDefault = $('.toggleable_button.label_python').first();
|
||||
if ($clickDefault.length) {
|
||||
$clickDefault.click();
|
||||
}
|
||||
$clickDefault = $('.toggleable_button.label_cpp').first();
|
||||
if ($clickDefault.length) {
|
||||
$clickDefault.click();
|
||||
}
|
||||
//]]>
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user