Merge branch 'master' into production
This commit is contained in:
commit
6c112c641a
7 changed files with 35 additions and 32 deletions
|
@ -212,8 +212,8 @@ exclude:
|
||||||
- tools
|
- tools
|
||||||
- README.md
|
- README.md
|
||||||
- LICENSE
|
- LICENSE
|
||||||
- "*.config.js"
|
- "*.js"
|
||||||
- package*.json
|
- "package*.json"
|
||||||
|
|
||||||
jekyll-archives:
|
jekyll-archives:
|
||||||
enabled: [categories, tags]
|
enabled: [categories, tags]
|
||||||
|
|
|
@ -99,9 +99,7 @@
|
||||||
|
|
||||||
<!-- Scripts -->
|
<!-- Scripts -->
|
||||||
|
|
||||||
{% unless site.theme_mode %}
|
<script src="{{ '/assets/js/dist/theme.min.js' | relative_url }}"></script>
|
||||||
<script src="{{ '/assets/js/dist/theme.min.js' | relative_url }}"></script>
|
|
||||||
{% endunless %}
|
|
||||||
|
|
||||||
{% include js-selector.html lang=lang %}
|
{% include js-selector.html lang=lang %}
|
||||||
|
|
||||||
|
|
|
@ -1,19 +1,21 @@
|
||||||
<!-- Display GoatCounter pageviews -->
|
<!-- Display GoatCounter pageviews -->
|
||||||
<script>
|
<script>
|
||||||
let pv = document.getElementById('pageviews');
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
|
const pv = document.getElementById('pageviews');
|
||||||
|
|
||||||
if (pv !== null) {
|
if (pv !== null) {
|
||||||
const uri = location.pathname.replace(/\/$/, '');
|
const uri = location.pathname.replace(/\/$/, '');
|
||||||
const url = `https://{{ site.analytics.goatcounter.id }}.goatcounter.com/counter/${encodeURIComponent(uri)}.json`;
|
const url = `https://{{ site.analytics.goatcounter.id }}.goatcounter.com/counter/${encodeURIComponent(uri)}.json`;
|
||||||
|
|
||||||
fetch(url)
|
fetch(url)
|
||||||
.then((response) => response.json())
|
.then((response) => response.json())
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
const count = data.count.replace(/\s/g, '');
|
const count = data.count.replace(/\s/g, '');
|
||||||
pv.innerText = new Intl.NumberFormat().format(count);
|
pv.innerText = new Intl.NumberFormat().format(count);
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
pv.innerText = '1';
|
pv.innerText = '1';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
{% if enable_toc %}
|
{% if enable_toc %}
|
||||||
<div class="toc-border-cover z-3"></div>
|
<div class="toc-border-cover z-3"></div>
|
||||||
<section id="toc-wrapper" class="position-sticky ps-0 pe-4">
|
<section id="toc-wrapper" class="invisible position-sticky ps-0 pe-4 pb-4">
|
||||||
<h2 class="panel-heading ps-3 pb-2 mb-0">{{- site.data.locales[include.lang].panel.toc -}}</h2>
|
<h2 class="panel-heading ps-3 pb-2 mb-0">{{- site.data.locales[include.lang].panel.toc -}}</h2>
|
||||||
<nav id="toc"></nav>
|
<nav id="toc"></nav>
|
||||||
</section>
|
</section>
|
||||||
|
|
|
@ -15,8 +15,11 @@ export class TocDesktop {
|
||||||
}
|
}
|
||||||
|
|
||||||
static init() {
|
static init() {
|
||||||
if (document.getElementById('toc-wrapper')) {
|
const $tocWrapper = document.getElementById('toc-wrapper');
|
||||||
|
|
||||||
|
if ($tocWrapper) {
|
||||||
tocbot.init(this.options);
|
tocbot.init(this.options);
|
||||||
|
$tocWrapper.classList.remove('invisible');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -234,14 +234,11 @@ header {
|
||||||
@keyframes fade-up {
|
@keyframes fade-up {
|
||||||
from {
|
from {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
position: relative;
|
margin-top: 4rem;
|
||||||
top: 2rem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
to {
|
to {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
position: relative;
|
|
||||||
top: 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -263,7 +260,7 @@ header {
|
||||||
-webkit-animation: fade-up 0.8s;
|
-webkit-animation: fade-up 0.8s;
|
||||||
animation: fade-up 0.8s;
|
animation: fade-up 0.8s;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
max-height: calc(100vh - 2rem);
|
max-height: 100vh;
|
||||||
scrollbar-width: none;
|
scrollbar-width: none;
|
||||||
margin-top: 2rem;
|
margin-top: 2rem;
|
||||||
|
|
||||||
|
@ -336,7 +333,7 @@ header {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
width: 15%;
|
width: 15%;
|
||||||
height: 3.25rem;
|
height: 2.25rem;
|
||||||
margin-left: -1px;
|
margin-left: -1px;
|
||||||
background: linear-gradient(transparent, var(--main-bg) 70%);
|
background: linear-gradient(transparent, var(--main-bg) 70%);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,11 +11,11 @@ const DIST = 'assets/js/dist';
|
||||||
const banner = `/*!
|
const banner = `/*!
|
||||||
* ${pkg.name} v${pkg.version} | © ${pkg.since} ${pkg.author} | ${pkg.license} Licensed | ${pkg.homepage}
|
* ${pkg.name} v${pkg.version} | © ${pkg.since} ${pkg.author} | ${pkg.license} Licensed | ${pkg.homepage}
|
||||||
*/`;
|
*/`;
|
||||||
|
|
||||||
const frontmatter = `---\npermalink: /:basename\n---\n`;
|
const frontmatter = `---\npermalink: /:basename\n---\n`;
|
||||||
|
|
||||||
const isProd = process.env.BUILD === 'production';
|
const isProd = process.env.BUILD === 'production';
|
||||||
|
|
||||||
|
let hasWatched = false;
|
||||||
|
|
||||||
function cleanup() {
|
function cleanup() {
|
||||||
fs.rmSync(DIST, { recursive: true, force: true });
|
fs.rmSync(DIST, { recursive: true, force: true });
|
||||||
console.log(`> Directory "${DIST}" has been cleaned.`);
|
console.log(`> Directory "${DIST}" has been cleaned.`);
|
||||||
|
@ -39,6 +39,11 @@ function build(
|
||||||
{ src = SRC_DEFAULT, jekyll = false, outputName = null } = {}
|
{ src = SRC_DEFAULT, jekyll = false, outputName = null } = {}
|
||||||
) {
|
) {
|
||||||
const input = `${src}/${filename}.js`;
|
const input = `${src}/${filename}.js`;
|
||||||
|
const shouldWatch = hasWatched ? false : true;
|
||||||
|
|
||||||
|
if (!hasWatched) {
|
||||||
|
hasWatched = true;
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
input,
|
input,
|
||||||
|
@ -49,9 +54,7 @@ function build(
|
||||||
banner,
|
banner,
|
||||||
sourcemap: !isProd && !jekyll
|
sourcemap: !isProd && !jekyll
|
||||||
},
|
},
|
||||||
watch: {
|
...(shouldWatch && { watch: { include: `${SRC_DEFAULT}/**/*.js` } }),
|
||||||
include: input
|
|
||||||
},
|
|
||||||
plugins: [
|
plugins: [
|
||||||
babel({
|
babel({
|
||||||
babelHelpers: 'bundled',
|
babelHelpers: 'bundled',
|
||||||
|
|
Loading…
Reference in a new issue