Highlight comments if hash is present in URL
This commit is contained in:
@@ -1,3 +1,11 @@
|
|||||||
|
Version 1.0.39 (unreleased)
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
Improvements:
|
||||||
|
|
||||||
|
* Comments are highlighted if hash (#comment-123) is present in URL
|
||||||
|
* Documentation translated in Turkish
|
||||||
|
|
||||||
Version 1.0.38 (Jan 28, 2017)
|
Version 1.0.38 (Jan 28, 2017)
|
||||||
-----------------------------
|
-----------------------------
|
||||||
|
|
||||||
|
|||||||
2
assets/css/app.min.css
vendored
2
assets/css/app.min.css
vendored
File diff suppressed because one or more lines are too long
6
assets/js/app.min.js
vendored
6
assets/js/app.min.js
vendored
File diff suppressed because one or more lines are too long
21
assets/js/components/comment-highlight.js
Normal file
21
assets/js/components/comment-highlight.js
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
KB.on('dom.ready', function () {
|
||||||
|
function highlightComment() {
|
||||||
|
if (window.location.hash.indexOf('#comment-') === 0) {
|
||||||
|
var commentElement = KB.find(window.location.hash);
|
||||||
|
|
||||||
|
if (commentElement) {
|
||||||
|
var commentsElement = document.querySelectorAll('.comment');
|
||||||
|
|
||||||
|
commentsElement.forEach(function (element) {
|
||||||
|
KB.dom(element).removeClass('comment-highlighted');
|
||||||
|
});
|
||||||
|
|
||||||
|
commentElement.addClass('comment-highlighted');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
window.addEventListener('hashchange', highlightComment);
|
||||||
|
|
||||||
|
highlightComment();
|
||||||
|
});
|
||||||
1
assets/js/core/bootstrap.js
vendored
1
assets/js/core/bootstrap.js
vendored
@@ -3,4 +3,5 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
KB.render();
|
KB.render();
|
||||||
KB.listen();
|
KB.listen();
|
||||||
KB.keyboardShortcuts();
|
KB.keyboardShortcuts();
|
||||||
|
KB.trigger('dom.ready');
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -15,6 +15,14 @@
|
|||||||
&:hover
|
&:hover
|
||||||
background: #fafafa
|
background: #fafafa
|
||||||
|
|
||||||
|
.comment-highlighted
|
||||||
|
background-color: #FFF8DC
|
||||||
|
border: 2px solid #FFF8DC
|
||||||
|
border-left: 2px solid #ffeb8e
|
||||||
|
&:hover
|
||||||
|
background-color: #FFF8DC
|
||||||
|
border: 2px solid #ffeb8e
|
||||||
|
|
||||||
.comment-title
|
.comment-title
|
||||||
border-bottom: 1px dotted #eee
|
border-bottom: 1px dotted #eee
|
||||||
margin-left: 55px
|
margin-left: 55px
|
||||||
|
|||||||
Reference in New Issue
Block a user