Skip to content

Commit

Permalink
🎨
Browse files Browse the repository at this point in the history
  • Loading branch information
pradyunsg committed Aug 30, 2020
1 parent 4337dec commit 9a4f952
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 17 deletions.
12 changes: 6 additions & 6 deletions .boussole.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"SOURCES_PATH": "src/mawek/assets/styles",
"TARGET_PATH": "src/mawek/theme/static/styles",
"LIBRARY_PATHS": [],
"OUTPUT_STYLES": "compressed",
"SOURCE_COMMENTS": false,
"EXCLUDES": []
"SOURCES_PATH": "src/mawek/assets/styles",
"TARGET_PATH": "src/mawek/theme/static/styles",
"LIBRARY_PATHS": [],
"OUTPUT_STYLES": "compressed",
"SOURCE_COMMENTS": false,
"EXCLUDES": []
}
5 changes: 1 addition & 4 deletions src/mawek/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,7 @@ def _html_page_context(app, pagename, templatename, context, doctree):
# Inject information about styles
colors = get_pygments_style_colors(
app.builder.highlighter.formatter_args["style"],
fallbacks={
"foreground": "#000000",
"background": "#FFFFFF",
}
fallbacks={"foreground": "#000000", "background": "#FFFFFF"},
)
context["mawek_pygments"] = colors

Expand Down
3 changes: 1 addition & 2 deletions src/mawek/code.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Get information about the under-use pygments theme."""

from pygments.token import Text
from pygments.style import Style
from pygments.token import Text


def get_pygments_style_colors(style, *, fallbacks):
Expand Down
16 changes: 11 additions & 5 deletions src/mawek/theme/static/scripts/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,15 @@ function scrollHandler(positionY) {
header.classList.add("scrolled");
}

if (tocScroll === null) { return; }
if (tocScroll === null) {
return;
}

if (positionY == 0) {
tocScroll.scrollTo(0, 0);
} else if (Math.ceil(window.innerHeight + positionY) >= document.body.offsetHeight) {
} else if (
Math.ceil(window.innerHeight + positionY) >= document.body.offsetHeight
) {
tocScroll.scrollTo(0, tocScroll.scrollHeight);
}
}
Expand All @@ -22,11 +26,11 @@ function setupScrollHandler() {
let last_known_scroll_position = 0;
let ticking = false;

window.addEventListener('scroll', function(e) {
window.addEventListener("scroll", function (e) {
last_known_scroll_position = window.scrollY;

if (!ticking) {
window.requestAnimationFrame(function() {
window.requestAnimationFrame(function () {
scrollHandler(last_known_scroll_position);
ticking = false;
});
Expand All @@ -39,7 +43,9 @@ function setupScrollHandler() {
function setup() {
setupScrollHandler();

if (tocScroll === null) { return; }
if (tocScroll === null) {
return;
}

console.log(tocScroll);

Expand Down

0 comments on commit 9a4f952

Please sign in to comment.