1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

doc: utilize smartmenus

This commit is contained in:
Martine Lenders 2017-04-15 14:57:18 +02:00
parent 993ed203b5
commit b092179787
No known key found for this signature in database
GPG Key ID: 8E97A9FE55F25D62
10 changed files with 220 additions and 31 deletions

View File

@ -6,6 +6,8 @@
</div>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="bootstrap.min.js"></script>
<script src="jquery.smartmenus.min.js"></script>
<script src="jquery.smartmenus.bootstrap.min.js"></script>
<script src="riot-doxy.js"></script>
</body>
</html>

View File

@ -21,6 +21,7 @@
<link href="$relpath^doxygen.css" rel="stylesheet">
<link href="$relpath^fonts.css" rel="stylesheet">
<link href="$relpath^bootstrap.min.css" rel="stylesheet">
<link href="$relpath^jquery.smartmenus.bootstrap.css" rel="stylesheet">
<link href="$relpath^riot.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
@ -49,7 +50,8 @@
<div class="collapse navbar-collapse" id="navbar-collapse">
<p class="navbar-text navbar-left"><span id="projectbrief">$projectbrief</span></p>
<ul id="riot-navlist" class="nav navbar-nav"></ul>
<form class="navbar-form navbar-left navbar-right hidden-sm hidden-xs">
<!--BEGIN SEARCHENGINE-->
<form id="riot-searchform" class="navbar-form navbar-left navbar-right hidden-sm hidden-xs">
<div class="form-group">
<div id="MSearchBox" class="MSearchBoxActive">
<div class="input-group">
@ -64,6 +66,7 @@
</div>
</div>
</form>
<!--END SEARCHENGINE-->
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>

View File

@ -1121,6 +1121,7 @@ HTML_EXTRA_STYLESHEET = src/css/riot.css
HTML_EXTRA_FILES = src/css/bootstrap.min.css \
src/css/fonts.css \
src/css/jquery.smartmenus.bootstrap.css \
src/css/riot.css \
src/favicon.png \
src/fonts/glyphicons-halflings-regular.eot \
@ -1136,7 +1137,10 @@ HTML_EXTRA_FILES = src/css/bootstrap.min.css \
src/js/doxy-jquery.js \
src/js/jquery.min.js \
src/js/jquery.powertip.min.js \
src/js/jquery.smartmenus.min.js \
src/js/jquery.smartmenus.bootstrap.min.js \
src/js/jquery-ui.min.js \
src/js/menu.js \
src/js/riot-doxy.js
# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen

View File

@ -0,0 +1,122 @@
/*
You probably do not need to edit this at all.
Add some SmartMenus required styles not covered in Bootstrap 3's default CSS.
These are theme independent and should work with any Bootstrap 3 theme mod.
*/
/* sub menus arrows on desktop */
.navbar-nav:not(.sm-collapsible) ul .caret {
position: absolute;
right: 0;
margin-top: 6px;
margin-right: 15px;
border-top: 4px solid transparent;
border-bottom: 4px solid transparent;
border-left: 4px dashed;
}
.navbar-nav:not(.sm-collapsible) ul a.has-submenu {
padding-right: 30px;
}
/* make sub menu arrows look like +/- buttons in collapsible mode */
.navbar-nav.sm-collapsible .caret, .navbar-nav.sm-collapsible ul .caret {
position: absolute;
right: 0;
margin: -3px 15px 0 0;
padding: 0;
width: 32px;
height: 26px;
line-height: 24px;
text-align: center;
border-width: 1px;
border-style: solid;
}
.navbar-nav.sm-collapsible .caret:before {
content: '+';
font-family: monospace;
font-weight: bold;
}
.navbar-nav.sm-collapsible .open > a > .caret:before {
content: '-';
}
.navbar-nav.sm-collapsible a.has-submenu {
padding-right: 50px;
}
/* revert to Bootstrap's default carets in collapsible mode when the "data-sm-skip-collapsible-behavior" attribute is set to the ul.navbar-nav */
.navbar-nav.sm-collapsible[data-sm-skip-collapsible-behavior] .caret, .navbar-nav.sm-collapsible[data-sm-skip-collapsible-behavior] ul .caret {
position: static;
margin: 0 0 0 2px;
padding: 0;
width: 0;
height: 0;
border-top: 4px dashed;
border-right: 4px solid transparent;
border-bottom: 0;
border-left: 4px solid transparent;
}
.navbar-nav.sm-collapsible[data-sm-skip-collapsible-behavior] .caret:before {
content: '' !important;
}
.navbar-nav.sm-collapsible[data-sm-skip-collapsible-behavior] a.has-submenu {
padding-right: 15px;
}
/* scrolling arrows for tall menus */
.navbar-nav span.scroll-up, .navbar-nav span.scroll-down {
position: absolute;
display: none;
visibility: hidden;
height: 20px;
overflow: hidden;
text-align: center;
}
.navbar-nav span.scroll-up-arrow, .navbar-nav span.scroll-down-arrow {
position: absolute;
top: -2px;
left: 50%;
margin-left: -8px;
width: 0;
height: 0;
overflow: hidden;
border-top: 7px dashed transparent;
border-right: 7px dashed transparent;
border-bottom: 7px solid;
border-left: 7px dashed transparent;
}
.navbar-nav span.scroll-down-arrow {
top: 6px;
border-top: 7px solid;
border-right: 7px dashed transparent;
border-bottom: 7px dashed transparent;
border-left: 7px dashed transparent;
}
/* add more indentation for 2+ level sub in collapsible mode - Bootstrap normally supports just 1 level sub menus */
.navbar-nav.sm-collapsible ul .dropdown-menu > li > a,
.navbar-nav.sm-collapsible ul .dropdown-menu .dropdown-header {
padding-left: 35px;
}
.navbar-nav.sm-collapsible ul ul .dropdown-menu > li > a,
.navbar-nav.sm-collapsible ul ul .dropdown-menu .dropdown-header {
padding-left: 45px;
}
.navbar-nav.sm-collapsible ul ul ul .dropdown-menu > li > a,
.navbar-nav.sm-collapsible ul ul ul .dropdown-menu .dropdown-header {
padding-left: 55px;
}
.navbar-nav.sm-collapsible ul ul ul ul .dropdown-menu > li > a,
.navbar-nav.sm-collapsible ul ul ul ul .dropdown-menu .dropdown-header {
padding-left: 65px;
}
/* fix SmartMenus sub menus auto width (subMenusMinWidth and subMenusMaxWidth options) */
.navbar-nav .dropdown-menu > li > a {
white-space: normal;
}
.navbar-nav ul.sm-nowrap > li > a {
white-space: nowrap;
}
.navbar-nav.sm-collapsible ul.sm-nowrap > li > a {
white-space: normal;
}
/* fix .navbar-right subs alignment */
.navbar-right ul.dropdown-menu {
left: 0;
right: auto;
}

View File

@ -48,6 +48,9 @@ dl {
font-size: 14px;
z-index: 3;
}
#FSearchBox #MSearchField {
margin-left: auto;
}
#MSearchField {
background: #000000;
border: #eeeeee solid 1px;
@ -89,7 +92,8 @@ a.SelectItem:active {
#nav-tree {
background: #f5f5f5;
}
#nav-tree img {
#nav-tree img,
#nav-tree span {
-webkit-box-sizing: content-box;
box-sizing: content-box;
}
@ -202,7 +206,7 @@ div.line.glow {
}
span.lineno {
background-color: transparent;
border-right: 3px solid #e3e3e3;
border-right: 2px solid #e3e3e3;
}
span.lineno a {
background-color: transparent;

View File

@ -91,7 +91,7 @@ a.SelectItem:active {
#nav-tree {
background: @well-bg;
}
#nav-tree img {
#nav-tree img, #nav-tree span {
-webkit-box-sizing: content-box;
box-sizing: content-box;
}

View File

@ -0,0 +1,3 @@
/*! SmartMenus jQuery Plugin Bootstrap Addon - v0.3.1 - November 1, 2016
* http://www.smartmenus.org/
* Copyright Vasil Dinkov, Vadikom Web Ltd. http://vadikom.com; Licensed MIT */(function(t){"function"==typeof define&&define.amd?define(["jquery","jquery.smartmenus"],t):"object"==typeof module&&"object"==typeof module.exports?module.exports=t(require("jquery")):t(jQuery)})(function(t){return t.extend(t.SmartMenus.Bootstrap={},{keydownFix:!1,init:function(){var e=t("ul.navbar-nav:not([data-sm-skip])");e.each(function(){function e(){o.find("a.current").parent().addClass("active"),o.find("a.has-submenu").each(function(){var e=t(this);e.is('[data-toggle="dropdown"]')&&e.dataSM("bs-data-toggle-dropdown",!0).removeAttr("data-toggle"),e.is('[role="button"]')&&e.dataSM("bs-role-button",!0).removeAttr("role")})}function s(){o.find("a.current").parent().removeClass("active"),o.find("a.has-submenu").each(function(){var e=t(this);e.dataSM("bs-data-toggle-dropdown")&&e.attr("data-toggle","dropdown").removeDataSM("bs-data-toggle-dropdown"),e.dataSM("bs-role-button")&&e.attr("role","button").removeDataSM("bs-role-button")})}function i(t){var e=a.getViewportWidth();if(e!=n||t){var s=o.find(".caret");a.isCollapsible()?(o.addClass("sm-collapsible"),o.is("[data-sm-skip-collapsible-behavior]")||s.addClass("navbar-toggle sub-arrow")):(o.removeClass("sm-collapsible"),o.is("[data-sm-skip-collapsible-behavior]")||s.removeClass("navbar-toggle sub-arrow")),n=e}}var o=t(this),a=o.data("smartmenus");if(!a){o.smartmenus({subMenusSubOffsetX:2,subMenusSubOffsetY:-6,subIndicators:!1,collapsibleShowFunction:null,collapsibleHideFunction:null,rightToLeftSubMenus:o.hasClass("navbar-right"),bottomToTopSubMenus:o.closest(".navbar").hasClass("navbar-fixed-bottom")}).bind({"show.smapi":function(e,s){var i=t(s),o=i.dataSM("scroll-arrows");o&&o.css("background-color",t(document.body).css("background-color")),i.parent().addClass("open")},"hide.smapi":function(e,s){t(s).parent().removeClass("open")}}),e(),a=o.data("smartmenus"),a.isCollapsible=function(){return!/^(left|right)$/.test(this.$firstLink.parent().css("float"))},a.refresh=function(){t.SmartMenus.prototype.refresh.call(this),e(),i(!0)},a.destroy=function(e){s(),t.SmartMenus.prototype.destroy.call(this,e)},o.is("[data-sm-skip-collapsible-behavior]")&&o.bind({"click.smapi":function(e,s){if(a.isCollapsible()){var i=t(s),o=i.parent().dataSM("sub");if(o&&o.dataSM("shown-before")&&o.is(":visible"))return a.itemActivate(i),a.menuHide(o),!1}}});var n;i(),t(window).bind("resize.smartmenus"+a.rootId,i)}}),e.length&&!t.SmartMenus.Bootstrap.keydownFix&&(t(document).off("keydown.bs.dropdown.data-api",".dropdown-menu"),t.fn.dropdown&&t.fn.dropdown.Constructor&&t(document).on("keydown.bs.dropdown.data-api",'.dropdown-menu:not([id^="sm-"])',t.fn.dropdown.Constructor.prototype.keydown),t.SmartMenus.Bootstrap.keydownFix=!0)}}),t(t.SmartMenus.Bootstrap.init),t});

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,45 @@
function initMenu(relPath,searchEnabled,serverSide,searchPage,search) {
function makeTree(data,relPath,dropdown=false) {
var result='';
if ('children' in data) {
if (dropdown) {
result += '<ul class="dropdown-menu">';
}
for (var i in data.children) {
var active = '';
if (location.pathname.endsWith(relPath + data.children[i].url) ||
(location.pathname.endsWith("/") &&
(location.pathname + "index.html").endsWith(relPath + data.children[i].url))) {
console.log(location.pathname)
active = ' class="active"';
}
result += '<li'+active+'><a href="' + relPath+data.children[i].url+'">' +
data.children[i].text;
if ('children' in data.children[i]) {
result += '<span class="caret"></span>'
}
result += '</a>' + makeTree(data.children[i],relPath,true) + '</li>';
}
if (dropdown) {
result += '</ul>';
}
}
return result;
}
/* code adapted from original menu.js of Doxygen, but made
* bootstrap ready via
* http://vadikom.github.io/smartmenus/src/demo/bootstrap-navbar.html */
$('#riot-navlist').append(makeTree(menudata,relPath));
if (searchEnabled) {
$("#MSearchBox").remove();
if (serverSide) {
$('#riot-searchform').attr("id", "FSearchBox");
$('#FSearchBox').attr("action", searchPage);
$('#FSearchBox').attr("method", "get");
$('#FSearchBox div.form-group').append('<div id="MSearchBox" class="MSearchBoxInactive"><div class="input-group"><div class="input-group-addon"><span id="MSearchSelect" class="glyphicon glyphicon-search" aria-hidden="true"></span></div><input class="form-control" type="text" id="MSearchField" name="query" placeholder="'+search+'" value="'+search+'" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)"></form></div></div>');
} else {
$('#riot-searchform div.form-group').append('<div id="MSearchBox" class="MSearchBoxInactive"><div class="input-group"><div class="input-group-addon"><span id="MSearchSelect" class="glyphicon glyphicon-search" aria-hidden="true" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()"></span></div><input class="form-control" type="text" id="MSearchField" placeholder="'+search+'" value="'+search+'" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/><a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><span id="search-reset" class="glyphicon glyphicon-remove-circle" aria-hidden="true"></span></a></div></div>');
}
}
}

View File

@ -4,34 +4,36 @@
* Distributed under terms of the LGPLv2.1 license (see LICENSE)
*/
$("#MSearchBox").first(function(index) {
$(this).remove();
});
$("#navrow1 ul.tablist li").each(function(index) {
var element = $(this).detach();
if (element.text().trim() == "") {
return;
}
if (element.attr("class") == "current") {
element.attr("class", "active");
}
$("#riot-navlist").append(element);
});
$("#navrow1").remove()
var prev_element = $("nav.navbar")
for (i = 2; i < 5; i++) {
$("#navrow" + i + " ul.tablist").each(function(index) {
var element = $(this).detach();
element.attr("class", "nav nav-tabs nav-tabs-regs");
element.children("li.current").each(function(i) {
$(this).attr("class", "active");
});
prev_element.after(element);
prev_element = element;
if ( $("#navrow1").length ) {
$("#MSearchBox").first(function(index) {
$(this).remove();
});
$("#navrow" + i)
$("#navrow1 ul.tablist li").each(function(index) {
var element = $(this).detach();
if (element.text().trim() == "") {
return;
}
if (element.attr("class") == "current") {
element.attr("class", "active");
}
$("#riot-navlist").append(element);
});
$("#navrow1").remove()
var prev_element = $("nav.navbar")
for (i = 2; i < 5; i++) {
$("#navrow" + i + " ul.tablist").each(function(index) {
var element = $(this).detach();
element.attr("class", "nav nav-tabs nav-tabs-regs");
element.children("li.current").each(function(i) {
$(this).attr("class", "active");
});
prev_element.after(element);
prev_element = element;
});
$("#navrow" + i)
}
}
$(".image > img").addClass("img-responsive")
@ -71,6 +73,7 @@ function resize_handler()
}
$(document).ready(function() {
var sidenav = $("#side-nav");
original_padding = sidenav.css("padding-right")
window_before = $(window).width()
original_sidenav_width = (window_before >= 740) ? sidenav.width() : 275;