Skip to content

Commit

Permalink
perf: drop instantclick support
Browse files Browse the repository at this point in the history
  • Loading branch information
reuixiy committed Mar 2, 2020
1 parent 63a311f commit b9cea3b
Show file tree
Hide file tree
Showing 16 changed files with 52 additions and 767 deletions.
14 changes: 5 additions & 9 deletions assets/js/back-to-top.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
function backToTop() {
const backToTop = document.getElementById('back-to-top');
const backToTop = document.getElementById('back-to-top');

if (backToTop !== null) {
window.addEventListener('scroll', function() {
window.scrollY > 100 ? backToTop.classList.add('show') : backToTop.classList.remove('show');
});
}
if (backToTop !== null) {
window.addEventListener('scroll', function() {
window.scrollY > 100 ? backToTop.classList.add('show') : backToTop.classList.remove('show');
});
}

backToTop();
16 changes: 6 additions & 10 deletions assets/js/comments.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
function comments() {
const commentsToggle = document.getElementById('load-comments');
const commentsToggle = document.getElementById('load-comments');

if (commentsToggle !== null) {
commentsToggle.addEventListener('click', function () {
loadComments();
this.style = "display: none";
});
}
if (commentsToggle !== null) {
commentsToggle.addEventListener('click', function () {
loadComments();
this.style = "display: none";
});
}

comments();
30 changes: 13 additions & 17 deletions assets/js/dark-mode.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,25 +36,21 @@ lightModeMediaQuery.addListener((e) => {
// Theme Switcher
// https://derekkedziora.com/blog/dark-mode

function themeSwitch() {
const themeSwitcher = document.getElementById('theme-switcher');
const themeSwitcher = document.getElementById('theme-switcher');

themeSwitcher.addEventListener('click', function() {
const currentMode = document.documentElement.getAttribute('data-theme');
themeSwitcher.addEventListener('click', function() {
const currentMode = document.documentElement.getAttribute('data-theme');

if (currentMode === 'dark') {
changeModeMeta('light');
changeMode('light');
setMode('light');
} else {
changeModeMeta('dark');
changeMode('dark');
setMode('dark');
}
});
}

themeSwitch();
if (currentMode === 'dark') {
changeModeMeta('light');
changeMode('light');
setMode('light');
} else {
changeModeMeta('dark');
changeMode('dark');
setMode('dark');
}
});

// Sync Across Tabs
// https://codepen.io/tevko/pen/GgWYpg
Expand Down

0 comments on commit b9cea3b

Please sign in to comment.