-
Notifications
You must be signed in to change notification settings - Fork 407
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add firebase caching rules * add native lazy-loading for images * Add preloads and async CSS optimizations * Fix SVG logo - typography needed flattening * Fix Firefox rendering issue for main logo
- Loading branch information
1 parent
468b4ec
commit 3f796f6
Showing
10 changed files
with
149 additions
and
54 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -1,53 +1,55 @@ | ||
function initGoToTopBtn() { | ||
const goTopBtn = document.querySelector('.back-to-top'); | ||
|
||
function trackScroll() { | ||
const scrolled = window.pageYOffset; | ||
const threshold = 400; | ||
|
||
if (scrolled > threshold) { | ||
goTopBtn.classList.remove('hidden'); | ||
} | ||
if (scrolled < threshold) { | ||
goTopBtn.classList.add('hidden'); | ||
window.addEventListener('load', () => { | ||
function initGoToTopBtn() { | ||
const goTopBtn = document.querySelector('.back-to-top'); | ||
|
||
function trackScroll() { | ||
const scrolled = window.pageYOffset; | ||
const threshold = 400; | ||
|
||
if (scrolled > threshold) { | ||
goTopBtn.classList.remove('hidden'); | ||
} | ||
if (scrolled < threshold) { | ||
goTopBtn.classList.add('hidden'); | ||
} | ||
} | ||
} | ||
|
||
function scrollToTop() { | ||
const c = document.documentElement.scrollTop || document.body.scrollTop; | ||
if (c > 0) { | ||
window.requestAnimationFrame(scrollToTop); | ||
window.scrollTo(0, c - c / 8); | ||
function scrollToTop() { | ||
const c = document.documentElement.scrollTop || document.body.scrollTop; | ||
if (c > 0) { | ||
window.requestAnimationFrame(scrollToTop); | ||
window.scrollTo(0, c - c / 8); | ||
} | ||
} | ||
} | ||
|
||
function backToTop() { | ||
if (window.pageYOffset > 0) { | ||
scrollToTop(); | ||
function backToTop() { | ||
if (window.pageYOffset > 0) { | ||
scrollToTop(); | ||
} | ||
} | ||
} | ||
|
||
window.addEventListener('scroll', trackScroll, { passive: true }); | ||
goTopBtn.addEventListener('click', backToTop); | ||
}; | ||
window.addEventListener('scroll', trackScroll, { passive: true }); | ||
goTopBtn.addEventListener('click', backToTop); | ||
}; | ||
|
||
initGoToTopBtn(); | ||
initGoToTopBtn(); | ||
|
||
const clipboard = new ClipboardJS('#copy-snippet-button'); | ||
clipboard.on('success', function (e) { | ||
console.info('[clipboard success] Action:', e.action); | ||
console.info('[clipboard success] Text:', e.text); | ||
console.info('[clipboard success] Trigger:', e.trigger); | ||
const clipboard = new ClipboardJS('#copy-snippet-button'); | ||
clipboard.on('success', function (e) { | ||
console.info('[clipboard success] Action:', e.action); | ||
console.info('[clipboard success] Text:', e.text); | ||
console.info('[clipboard success] Trigger:', e.trigger); | ||
|
||
e.clearSelection(); | ||
e.trigger.blur(); | ||
const notifyCopiedSnippet = document.querySelector(".notify-copied-snippet"); | ||
notifyCopiedSnippet.classList.add("notify-copied-snippet--displayed"); | ||
}); | ||
e.clearSelection(); | ||
e.trigger.blur(); | ||
const notifyCopiedSnippet = document.querySelector(".notify-copied-snippet"); | ||
notifyCopiedSnippet.classList.add("notify-copied-snippet--displayed"); | ||
}); | ||
|
||
clipboard.on('error', function (e) { | ||
console.error('[clipboard error] Action:', e.action); | ||
console.error('[clipboard error] Trigger:', e.trigger); | ||
}); | ||
clipboard.on('error', function (e) { | ||
console.error('[clipboard error] Action:', e.action); | ||
console.error('[clipboard error] Trigger:', e.trigger); | ||
}); | ||
|
||
hljs.initHighlightingOnLoad(); | ||
hljs.initHighlightingOnLoad(); | ||
}); |
Oops, something went wrong.