Skip to content

Commit b8b5a25

Browse files
mockersfbudziq
authored andcommitted
add tooltip to icons (rust-lang#477)
add tooltip to icons and previous/next chapter links
1 parent f7c262b commit b8b5a25

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

src/theme/book.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,15 +186,17 @@ $( document ).ready(function() {
186186
if(!lines_hidden) { return; }
187187

188188
// add expand button
189-
pre_block.prepend("<div class=\"buttons\"><i class=\"fa fa-expand\"></i></div>");
189+
pre_block.prepend("<div class=\"buttons\"><i class=\"fa fa-expand\" title=\"Show hidden lines\"></i></div>");
190190

191191
pre_block.find("i").click(function(e){
192192
if( $(this).hasClass("fa-expand") ) {
193193
$(this).removeClass("fa-expand").addClass("fa-compress");
194+
$(this).attr("title", "Hide lines");
194195
pre_block.find("span.hidden").removeClass("hidden").addClass("unhidden");
195196
}
196197
else {
197198
$(this).removeClass("fa-compress").addClass("fa-expand");
199+
$(this).attr("title", "Show hidden lines");
198200
pre_block.find("span.unhidden").removeClass("unhidden").addClass("hidden");
199201
}
200202
});
@@ -209,12 +211,12 @@ $( document ).ready(function() {
209211
pre_block.prepend("<div class=\"buttons\"></div>");
210212
buttons = pre_block.find(".buttons");
211213
}
212-
buttons.prepend("<i class=\"fa fa-play play-button hidden\"></i>");
213-
buttons.prepend("<i class=\"fa fa-copy clip-button\"><i class=\"tooltiptext\"></i></i>");
214+
buttons.prepend("<i class=\"fa fa-play play-button hidden\" title=\"Run this code\"></i>");
215+
buttons.prepend("<i class=\"fa fa-copy clip-button\" title=\"Copy to clipboard\"><i class=\"tooltiptext\"></i></i>");
214216

215217
let code_block = pre_block.find("code").first();
216218
if (window.ace && code_block.hasClass("editable")) {
217-
buttons.prepend("<i class=\"fa fa-history reset-button\"></i>");
219+
buttons.prepend("<i class=\"fa fa-history reset-button\" title=\"Undo changes\"></i>");
218220
}
219221

220222
buttons.find(".play-button").click(function(e){

src/theme/index.hbs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@
7676
<div class="page" tabindex="-1">
7777
<div id="menu-bar" class="menu-bar">
7878
<div class="left-buttons">
79-
<i id="sidebar-toggle" class="fa fa-bars"></i>
80-
<i id="theme-toggle" class="fa fa-paint-brush"></i>
79+
<i id="sidebar-toggle" class="fa fa-bars" title="Toggle sidebar"></i>
80+
<i id="theme-toggle" class="fa fa-paint-brush" title="Change theme"></i>
8181
</div>
8282

8383
<h1 class="menu-title">{{ book_title }}</h1>
@@ -95,13 +95,13 @@
9595

9696
<!-- Mobile navigation buttons -->
9797
{{#previous}}
98-
<a rel="prev" href="{{link}}" class="mobile-nav-chapters previous">
98+
<a rel="prev" href="{{link}}" class="mobile-nav-chapters previous" title="Previous chapter">
9999
<i class="fa fa-angle-left"></i>
100100
</a>
101101
{{/previous}}
102102

103103
{{#next}}
104-
<a rel="next" href="{{link}}" class="mobile-nav-chapters next">
104+
<a rel="next" href="{{link}}" class="mobile-nav-chapters next" title="Next chapter">
105105
<i class="fa fa-angle-right"></i>
106106
</a>
107107
{{/next}}

0 commit comments

Comments
 (0)