Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/wangchucheng/hugo-eureka.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/assets
diff options
context:
space:
mode:
authorWang Chucheng <ccwangchn@gmail.com>2020-05-27 17:30:28 +0300
committerWang Chucheng <ccwangchn@gmail.com>2020-05-27 17:30:28 +0300
commit9448de4ae2f3baf481ae91f933817a5bfd7cb0a1 (patch)
tree0da0801fdb0d7dbeb84fd026dc4904bf0650e3dc /assets
parentf690e591e84a3cbb8a155060a510a7d82a4eb28c (diff)
docs: add authors to exampleSite
Diffstat (limited to 'assets')
-rw-r--r--assets/css/markdown.css6
-rw-r--r--assets/css/postcss.config.js23
-rw-r--r--assets/css/tailwind.config.js11
-rw-r--r--assets/js/eureka.js126
4 files changed, 68 insertions, 98 deletions
diff --git a/assets/css/markdown.css b/assets/css/markdown.css
index 2b35bb6..b9206b6 100644
--- a/assets/css/markdown.css
+++ b/assets/css/markdown.css
@@ -1,9 +1,3 @@
-/* Additional vertical padding used by kbd tag. */
-.py-05 {
- padding-top: 0.125rem;
- padding-bottom: 0.125rem;
-}
-
.content {
@apply text-primary-text leading-normal break-words;
}
diff --git a/assets/css/postcss.config.js b/assets/css/postcss.config.js
index af2c238..121ed3f 100644
--- a/assets/css/postcss.config.js
+++ b/assets/css/postcss.config.js
@@ -1,27 +1,5 @@
const themeDir = __dirname + '/../../';
-const purgecss = require('@fullhuman/postcss-purgecss')({
-
- // Specify the paths to all of the template files in your project
- content: [
- themeDir + 'layouts/**/*.html',
- themeDir + 'exampleSite/content/**/*.html',
- 'layouts/**/*.html',
- 'content/**/*.html',
- ],
-
- // This is the function used to extract class names from your templates
- defaultExtractor: content => {
- // Capture as liberally as possible, including things like `h-(screen-1.5)`
- const broadMatches = content.match(/[^<>"'`\s]*[^<>"'`\s:]/g) || []
-
- // Capture classes within other delimiters like .block(class="w-1/2") in Pug
- const innerMatches = content.match(/[^<>"'`\s.()]*[^<>"'`\s.():]/g) || []
-
- return broadMatches.concat(innerMatches)
- }
-})
-
module.exports = {
plugins: [
require('postcss-import')({
@@ -31,6 +9,5 @@ module.exports = {
require('autoprefixer')({
path: [themeDir]
}),
- ...(process.env.HUGO_ENVIRONMENT === 'production' ? [purgecss] : [])
]
}
diff --git a/assets/css/tailwind.config.js b/assets/css/tailwind.config.js
index 58c9603..af75cf1 100644
--- a/assets/css/tailwind.config.js
+++ b/assets/css/tailwind.config.js
@@ -1,5 +1,16 @@
+const themeDir = __dirname + '/../../';
+
module.exports = {
important: true,
+ purge: {
+ enabled: true,
+ content: [
+ themeDir + 'layouts/**/*.html',
+ themeDir + 'exampleSite/content/**/*.html',
+ 'layouts/**/*.html',
+ 'content/**/*.html',
+ ],
+ },
theme: {
fontFamily: {
'serif': ['Lora', 'Noto Serif SC', 'serif'],
diff --git a/assets/js/eureka.js b/assets/js/eureka.js
index beff315..30ede24 100644
--- a/assets/js/eureka.js
+++ b/assets/js/eureka.js
@@ -1,75 +1,73 @@
function enableStickyToc() {
- window.addEventListener('DOMContentLoaded', () => {
- const observer = new IntersectionObserver(entries => {
- entries.forEach(entry => {
- const id = entry.target.getAttribute('id');
- if (entry.intersectionRatio > 0) {
- if (delay == true) {
- let element = document.querySelector('.sticky-toc li.active')
- element.firstChild.classList.remove(textColor);
- element.classList.remove('active');
- delay = false;
- updatePosAndColor();
- }
- document.querySelector(`.sticky-toc li a[href="#${id}"]`).parentElement.classList.add('active');
+ const observer = new IntersectionObserver(entries => {
+ entries.forEach(entry => {
+ const id = entry.target.getAttribute('id');
+ if (entry.intersectionRatio > 0) {
+ if (delay == true) {
+ let element = document.querySelector('.sticky-toc li.active')
+ element.firstChild.classList.remove(textColor);
+ element.classList.remove('active');
+ delay = false;
updatePosAndColor();
+ }
+ document.querySelector(`.sticky-toc li a[href="#${id}"]`).parentElement.classList.add('active');
+ updatePosAndColor();
+ } else {
+ if (document.querySelectorAll('.sticky-toc li.active').length == 1) {
+ delay = true;
} else {
- if (document.querySelectorAll('.sticky-toc li.active').length == 1) {
- delay = true;
- } else {
- let element = document.querySelector(`.sticky-toc li a[href="#${id}"]`)
- element.classList.remove(textColor);
- element.parentElement.classList.remove('active');
- updatePosAndColor();
- }
+ let element = document.querySelector(`.sticky-toc li a[href="#${id}"]`)
+ element.classList.remove(textColor);
+ element.parentElement.classList.remove('active');
+ updatePosAndColor();
}
- });
+ }
});
+ });
- var delay = false;
- var targetPos = window.innerHeight * 0.4
- var textColor = 'text-eureka'
+ var delay = false;
+ var targetPos = window.innerHeight * 0.4
+ var textColor = 'text-eureka'
- function updatePosAndColor() {
- let elements = document.querySelectorAll('.sticky-toc li.active')
- let len = elements.length
- if (len != 0) {
- let firstElement = elements[0]
- firstElement.firstChild.classList.add(textColor)
- let offset = firstElement.offsetTop - targetPos;
- if (offset > 0) {
- document.querySelector(`.sticky-toc`).style.top = `calc( 7rem - ${offset}px)`
- } else {
- document.querySelector(`.sticky-toc`).removeAttribute("style");
- }
- for (let i = 1; i < len; i++) {
- elements[i].firstChild.classList.remove(textColor)
- }
+ function updatePosAndColor() {
+ let elements = document.querySelectorAll('.sticky-toc li.active')
+ let len = elements.length
+ if (len != 0) {
+ let firstElement = elements[0]
+ firstElement.firstChild.classList.add(textColor)
+ let offset = firstElement.offsetTop - targetPos;
+ if (offset > 0) {
+ document.querySelector(`.sticky-toc`).style.top = `calc( 7rem - ${offset}px)`
+ } else {
+ document.querySelector(`.sticky-toc`).removeAttribute("style");
+ }
+ for (let i = 1; i < len; i++) {
+ elements[i].firstChild.classList.remove(textColor)
}
}
+ }
- // Track all sections that have an `id` applied
- document.querySelectorAll('.content h1[id]').forEach((section) => {
- observer.observe(section);
- });
- document.querySelectorAll('.content h2[id]').forEach((section) => {
- observer.observe(section);
- });
- document.querySelectorAll('.content h3[id]').forEach((section) => {
- observer.observe(section);
- });
+ // Track all sections that have an `id` applied
+ document.querySelectorAll('.content h1[id]').forEach((section) => {
+ observer.observe(section);
+ });
+ document.querySelectorAll('.content h2[id]').forEach((section) => {
+ observer.observe(section);
+ });
+ document.querySelectorAll('.content h3[id]').forEach((section) => {
+ observer.observe(section);
+ });
- document.querySelectorAll('.content h4[id]').forEach((section) => {
- observer.observe(section);
- });
+ document.querySelectorAll('.content h4[id]').forEach((section) => {
+ observer.observe(section);
+ });
- document.querySelectorAll('.content h5[id]').forEach((section) => {
- observer.observe(section);
- });
+ document.querySelectorAll('.content h5[id]').forEach((section) => {
+ observer.observe(section);
+ });
- document.querySelectorAll('.content h6[id]').forEach((section) => {
- observer.observe(section);
- });
+ document.querySelectorAll('.content h6[id]').forEach((section) => {
+ observer.observe(section);
});
}
@@ -92,14 +90,4 @@ function resizeAllGridItems() {
function resizeInstance(instance) {
item = instance.elements[0];
resizeGridItem(item);
-}
-
-function enableMasonry() {
- window.onload = resizeAllGridItems();
- window.addEventListener("resize", resizeAllGridItems);
-
- allItems = document.getElementsByClassName("item");
- for (x = 0; x < allItems.length; x++) {
- imagesLoaded(allItems[x], resizeInstance);
- }
} \ No newline at end of file