aboutsummaryrefslogtreecommitdiff
path: root/docs/_static
diff options
context:
space:
mode:
authorRapptz <[email protected]>2017-05-16 03:12:43 -0400
committerRapptz <[email protected]>2017-05-16 03:12:43 -0400
commit9cbbd8af65e01ba659787b94b2ad60be4c4c7b9d (patch)
tree88ee993a1195cce21ed6da6ef58b5c5d445f33a3 /docs/_static
parentClient.get_user_info uses int for IDs not str. (diff)
downloaddiscord.py-9cbbd8af65e01ba659787b94b2ad60be4c4c7b9d.tar.xz
discord.py-9cbbd8af65e01ba659787b94b2ad60be4c4c7b9d.zip
Highlight currently visited section.
Diffstat (limited to 'docs/_static')
-rw-r--r--docs/_static/custom.js31
-rw-r--r--docs/_static/style.css5
2 files changed, 36 insertions, 0 deletions
diff --git a/docs/_static/custom.js b/docs/_static/custom.js
new file mode 100644
index 00000000..235a14ea
--- /dev/null
+++ b/docs/_static/custom.js
@@ -0,0 +1,31 @@
+$(document).ready(function () {
+ var sections = $('div.section');
+ var activeLink = null;
+ var bottomHeightThreshold = $(document).height() - 30;
+
+ $(window).scroll(function (event) {
+ var distanceFromTop = $(this).scrollTop();
+ var currentSection = null;
+
+ if(distanceFromTop + window.innerHeight > bottomHeightThreshold) {
+ currentSection = $(sections[sections.length - 1]);
+ }
+ else {
+ sections.each(function () {
+ var section = $(this);
+ if (section.offset().top - 1 < distanceFromTop) {
+ currentSection = section;
+ }
+ });
+ }
+
+ if (activeLink) {
+ activeLink.parent().removeClass('active');
+ }
+
+ if (currentSection) {
+ activeLink = $('.sphinxsidebar a[href="#' + currentSection.attr('id') + '"]');
+ activeLink.parent().addClass('active');
+ }
+ });
+});
diff --git a/docs/_static/style.css b/docs/_static/style.css
index b7d1ac29..9afc6f31 100644
--- a/docs/_static/style.css
+++ b/docs/_static/style.css
@@ -421,6 +421,11 @@ div#welcome-to-discord-py > h1 {
display: none;
}
+.active {
+ background-color: #dbdbdb;
+ border-left: 5px solid #dbdbdb;
+}
+
@media screen and (max-width: 870px) {
div.document {