Skip to content

Commit

Permalink
Переносит весь код скрпитов в html
Browse files Browse the repository at this point in the history
  • Loading branch information
monochromer committed Aug 19, 2024
1 parent ece6d03 commit 6ede1ee
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
1 change: 1 addition & 0 deletions src/eleventy-config/transforms.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ export default function(eleventyConfig) {
if (outputPath && outputPath.endsWith('.html')) {
return htmlmin.minify(content, {
collapseWhitespace: true,
minifyJS: true,
});
}
return content;
Expand Down
14 changes: 14 additions & 0 deletions src/includes/dark-mode.njk
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@
}
}
function toggleDarkMode() {
applyColorScheme(
!document.querySelector('html').classList.contains(window.classNameDark),
true
);
}
colorSchemeMediaQuery.addEventListener('change', (mediaQuery) => {
applyColorScheme(mediaQuery.matches);
});
Expand All @@ -39,4 +46,11 @@
// В противном случае берём системное значение
applyColorScheme(isPrefersDarkColorScheme);
}
document.addEventListener('DOMContentLoaded', () => {
const colorSchemeButton = document.querySelector('.scheme-switcher__button');
colorSchemeButton.addEventListener('click', () => {
toggleDarkMode();
});
});
</script>
1 change: 0 additions & 1 deletion src/scripts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ import './modules/menu.js';
import './modules/copy-link.js';
import './modules/video.js';
import './modules/podcast.js';
import './modules/dark-mode.js';
11 changes: 0 additions & 11 deletions src/scripts/modules/dark-mode.js

This file was deleted.

0 comments on commit 6ede1ee

Please sign in to comment.