add tooltip to icons (#477)

add tooltip to icons and previous/next chapter links
This commit is contained in:
François 2017-10-27 14:46:55 +02:00 committed by Michał Budzyński
parent cd711bfb1c
commit aecc403fb8
2 changed files with 10 additions and 8 deletions

View File

@ -186,15 +186,17 @@ $( document ).ready(function() {
if(!lines_hidden) { return; }
// add expand button
pre_block.prepend("<div class=\"buttons\"><i class=\"fa fa-expand\"></i></div>");
pre_block.prepend("<div class=\"buttons\"><i class=\"fa fa-expand\" title=\"Show hidden lines\"></i></div>");
pre_block.find("i").click(function(e){
if( $(this).hasClass("fa-expand") ) {
$(this).removeClass("fa-expand").addClass("fa-compress");
$(this).attr("title", "Hide lines");
pre_block.find("span.hidden").removeClass("hidden").addClass("unhidden");
}
else {
$(this).removeClass("fa-compress").addClass("fa-expand");
$(this).attr("title", "Show hidden lines");
pre_block.find("span.unhidden").removeClass("unhidden").addClass("hidden");
}
});
@ -209,12 +211,12 @@ $( document ).ready(function() {
pre_block.prepend("<div class=\"buttons\"></div>");
buttons = pre_block.find(".buttons");
}
buttons.prepend("<i class=\"fa fa-play play-button hidden\"></i>");
buttons.prepend("<i class=\"fa fa-copy clip-button\"><i class=\"tooltiptext\"></i></i>");
buttons.prepend("<i class=\"fa fa-play play-button hidden\" title=\"Run this code\"></i>");
buttons.prepend("<i class=\"fa fa-copy clip-button\" title=\"Copy to clipboard\"><i class=\"tooltiptext\"></i></i>");
let code_block = pre_block.find("code").first();
if (window.ace && code_block.hasClass("editable")) {
buttons.prepend("<i class=\"fa fa-history reset-button\"></i>");
buttons.prepend("<i class=\"fa fa-history reset-button\" title=\"Undo changes\"></i>");
}
buttons.find(".play-button").click(function(e){

View File

@ -76,8 +76,8 @@
<div class="page" tabindex="-1">
<div id="menu-bar" class="menu-bar">
<div class="left-buttons">
<i id="sidebar-toggle" class="fa fa-bars"></i>
<i id="theme-toggle" class="fa fa-paint-brush"></i>
<i id="sidebar-toggle" class="fa fa-bars" title="Toggle sidebar"></i>
<i id="theme-toggle" class="fa fa-paint-brush" title="Change theme"></i>
</div>
<h1 class="menu-title">{{ book_title }}</h1>
@ -95,13 +95,13 @@
<!-- Mobile navigation buttons -->
{{#previous}}
<a rel="prev" href="{{link}}" class="mobile-nav-chapters previous">
<a rel="prev" href="{{link}}" class="mobile-nav-chapters previous" title="Previous chapter">
<i class="fa fa-angle-left"></i>
</a>
{{/previous}}
{{#next}}
<a rel="next" href="{{link}}" class="mobile-nav-chapters next">
<a rel="next" href="{{link}}" class="mobile-nav-chapters next" title="Next chapter">
<i class="fa fa-angle-right"></i>
</a>
{{/next}}