-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Finalize darklight mode switching 43 (#48)
Dark and Ligth mode skin is now easily switchable - mode can be switched from cookies (settings UI is not added yet, a separate GitHub issue has been added for it already) - fixed cases if masthead is turned off completely in the site config, the search must work nicely (with the hotkey) even if it is turned off - added support for tiny tooltips (similar to the classic short ones) that can have predefined text - added support for static tooltips (that remain steady even if the content is scrolled) - added some enhancements around hiding the tooltip Signed-off-by: Hofi <[email protected]>
- Loading branch information
Showing
30 changed files
with
763 additions
and
217 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,13 @@ | |
|
||
remote_theme: mmistakes/[email protected] | ||
#theme: minimal-mistakes-jekyll | ||
minimal_mistakes_skin: "midnight" # "default", "air", "aqua", "contrast", "dark", "dirt", "midnight", "mint", "neon", "plum", "sunrise" | ||
# Default minimal-mistakes skins | ||
# - # "default", "air", "aqua", "contrast", "dark", "dirt", "mint", "neon", "plum", "sunrise" | ||
# Additional skins | ||
# - "oi-midnight", "oi-light", "oi-dark" | ||
# NOTE: This one is not used at all, an d has no effect anymore, as we have our custom dynamic skin loading/swapping solution yet, | ||
# that is turned on by default via "skin_switchable: true" | ||
minimal_mistakes_skin: "oi-light" | ||
skin_switchable: true | ||
|
||
# Disable caching of content to disk in order to skip creating a .jekyll-cache or similar directory | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
{% comment %} | ||
<!-- Global variables, scripts that require an early access, go through liquid parsimg, and/or cannot be moved to main.min.js--> | ||
{% endcomment %} | ||
|
||
<script async="false"> | ||
|
||
const searchEnabled = {% if site.search == true %} true {% else %} false {% endif %}; | ||
const hasMastHead = {% if site.masthead != false %} true {% else %} false {% endif %}; | ||
const searchFromMastHead = {% if site.masthead != false and site.search_from_masthead == true %} true {% else %} false {% endif %}; | ||
|
||
const docRoot = '{{ site.baseurl }}'; | ||
|
||
function docPrefix() { | ||
return (docRoot != '' ? docRoot + '/' : ''); | ||
} | ||
|
||
function setCookie(name, value, days = 365 * 100) { | ||
var expires = ""; | ||
if (days) { | ||
var date = new Date(); | ||
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); | ||
expires = "; expires=" + date.toUTCString(); | ||
} | ||
document.cookie = name + "=" + (value || "") + expires + "; path=/; SameSite=Strict"; | ||
} | ||
|
||
function getCookie(name, defaultValue = null, saveIfMissing = false) { | ||
var nameEQ = name + "="; | ||
var ca = document.cookie.split(';'); | ||
for (var i = 0; i < ca.length; i++) { | ||
var c = ca[i]; | ||
while (c.charAt(0) == ' ') { | ||
c = c.substring(1, c.length); | ||
} | ||
if (c.indexOf(nameEQ) == 0) { | ||
return c.substring(nameEQ.length, c.length); | ||
} | ||
} | ||
if (saveIfMissing && defaultValue != null) | ||
setCookie(name, defaultValue); | ||
return defaultValue; | ||
} | ||
|
||
function compareDOMRect(rect1, rect2) { | ||
return { | ||
top: rect1.top === rect2.top, | ||
right: rect1.right === rect2.right, | ||
bottom: rect1.bottom === rect2.bottom, | ||
left: rect1.left === rect2.left, | ||
width: rect1.width === rect2.width, | ||
height: rect1.height === rect2.height | ||
}; | ||
} | ||
|
||
function getElementPositionRelativeToRoot(element) { | ||
var rect = element.getBoundingClientRect(); | ||
|
||
// Calculate the position relative to the document | ||
var scrollLeft = window.pageXOffset || document.documentElement.scrollLeft; | ||
var scrollTop = window.pageYOffset || document.documentElement.scrollTop; | ||
|
||
var position = { | ||
top: rect.top + scrollTop, | ||
left: rect.left + scrollLeft | ||
}; | ||
return position; | ||
} | ||
|
||
function comparePositions(pos1, pos2) { | ||
return pos1.top === pos2.top && pos1.left === pos2.left; | ||
} | ||
|
||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.