Skip to content

Commit 5fe4b6f

Browse files
committed
JS: highlight enum links
1 parent 6e66c21 commit 5fe4b6f

File tree

5 files changed

+22
-9
lines changed

5 files changed

+22
-9
lines changed

js-src/api/core.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ api.core.init = function(version, page, is_url_version) {
3232
api.page.highlightOnLoad(location.hash.substr(1));
3333

3434
api.page.fixAccordionLinks();
35+
api.page.fixEnumLinks();
3536
api.pageScrolling.init();
3637

3738
if (page == "" || page.indexOf("?entry=") > -1) {

js-src/api/page.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,8 @@ api.page.highlightOnLoad = function(target) {
9494
api.pageScrolling.highlightScroll(target);
9595
if ($("#" + target).parent().hasClass("panel-heading"))
9696
$("#" + target).parent().parent().parent().parent().addClass("active");
97-
// disable higilight in enums
98-
//else
99-
// $("#" + target).parent().addClass("active");
97+
else
98+
$("#" + target).parent().addClass("active");
10099
};
101100

102101
api.page.highlightCategory = function(target) {
@@ -176,6 +175,7 @@ api.page.load = function(target, opt_pushToHistory, opt_scrollTree) {
176175
api.page.fixLinks();
177176
api.page.fixListings();
178177
api.page.fixAccordionLinks();
178+
api.page.fixEnumLinks();
179179

180180
if (hash)
181181
api.page.highlight(hash);
@@ -184,6 +184,13 @@ api.page.load = function(target, opt_pushToHistory, opt_scrollTree) {
184184
return false;
185185
};
186186

187+
api.page.fixEnumLinks = function() {
188+
$("td.th a.category").click(function(e) {
189+
var id = $(this).attr("id");
190+
api.page.highlight(id, false, false, false);
191+
});
192+
};
193+
187194
api.page.fixAccordionLinks = function() {
188195
$(".method-block").each(function() {
189196
var id = $(this).find("h3").attr("id");

js-src/api/pageScrolling.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ api.pageScrolling.getFirstVisible_ = function(top) {
4141
var $minEl = null;
4242

4343
// find more closest to abstract line element
44-
var d = $("div.content-block.methods h3,div.content-block.methods .const-block h4").each(function() {
44+
$("div.content-block.methods h3,div.content-block.methods .const-block h4, a.category.type-link").each(function() {
4545
var $el = $(this);
4646
var distance = Math.abs($el.offset().top - 100);
4747
if (distance < minDistance) {
@@ -51,7 +51,7 @@ api.pageScrolling.getFirstVisible_ = function(top) {
5151
});
5252

5353
if ($minEl) {
54-
var $first = $("div.content-block.methods h3,div.content-block.methods h4").first();
54+
var $first = $("div.content-block.methods h3,div.content-block.methods h4, a.category.type-link").first();
5555
// if selected highlighted object is first on page and it's hidden over bottom browser border - return null
5656
// 40 const - to show it when only title appears
5757
if ($first.position().top == $minEl.position().top) {

resources/public/js/reference.min.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src-scss/style.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,11 @@ code {
555555
color: #cdcdcd;
556556
}
557557

558+
// enums anchor links
559+
td.scroll-active {
560+
background-color: #f5f5f5;
561+
}
562+
558563
.category.type-link {
559564
color: #323c44;
560565
}

0 commit comments

Comments
 (0)