Skip to content

Commit

Permalink
Merge branch 'master' into production
Browse files Browse the repository at this point in the history
  • Loading branch information
cotes2020 committed Dec 5, 2024
2 parents 3df83fd + 976e1a1 commit 6c112c6
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 32 deletions.
4 changes: 2 additions & 2 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@ exclude:
- tools
- README.md
- LICENSE
- "*.config.js"
- package*.json
- "*.js"
- "package*.json"

jekyll-archives:
enabled: [categories, tags]
Expand Down
4 changes: 1 addition & 3 deletions _includes/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,7 @@

<!-- Scripts -->

{% unless site.theme_mode %}
<script src="{{ '/assets/js/dist/theme.min.js' | relative_url }}"></script>
{% endunless %}
<script src="{{ '/assets/js/dist/theme.min.js' | relative_url }}"></script>

{% include js-selector.html lang=lang %}

Expand Down
30 changes: 16 additions & 14 deletions _includes/pageviews/goatcounter.html
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
<!-- Display GoatCounter pageviews -->
<script>
let pv = document.getElementById('pageviews');
document.addEventListener('DOMContentLoaded', () => {
const pv = document.getElementById('pageviews');

if (pv !== null) {
const uri = location.pathname.replace(/\/$/, '');
const url = `https://{{ site.analytics.goatcounter.id }}.goatcounter.com/counter/${encodeURIComponent(uri)}.json`;
if (pv !== null) {
const uri = location.pathname.replace(/\/$/, '');
const url = `https://{{ site.analytics.goatcounter.id }}.goatcounter.com/counter/${encodeURIComponent(uri)}.json`;

fetch(url)
.then((response) => response.json())
.then((data) => {
const count = data.count.replace(/\s/g, '');
pv.innerText = new Intl.NumberFormat().format(count);
})
.catch((error) => {
pv.innerText = '1';
});
}
fetch(url)
.then((response) => response.json())
.then((data) => {
const count = data.count.replace(/\s/g, '');
pv.innerText = new Intl.NumberFormat().format(count);
})
.catch((error) => {
pv.innerText = '1';
});
}
});
</script>
2 changes: 1 addition & 1 deletion _includes/toc.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

{% if enable_toc %}
<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>
<nav id="toc"></nav>
</section>
Expand Down
5 changes: 4 additions & 1 deletion _javascript/modules/components/toc/toc-desktop.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ export class TocDesktop {
}

static init() {
if (document.getElementById('toc-wrapper')) {
const $tocWrapper = document.getElementById('toc-wrapper');

if ($tocWrapper) {
tocbot.init(this.options);
$tocWrapper.classList.remove('invisible');
}
}
}
9 changes: 3 additions & 6 deletions _sass/pages/_post.scss
Original file line number Diff line number Diff line change
Expand Up @@ -234,14 +234,11 @@ header {
@keyframes fade-up {
from {
opacity: 0;
position: relative;
top: 2rem;
margin-top: 4rem;
}

to {
opacity: 1;
position: relative;
top: 0;
}
}

Expand All @@ -263,7 +260,7 @@ header {
-webkit-animation: fade-up 0.8s;
animation: fade-up 0.8s;
overflow-y: auto;
max-height: calc(100vh - 2rem);
max-height: 100vh;
scrollbar-width: none;
margin-top: 2rem;

Expand Down Expand Up @@ -336,7 +333,7 @@ header {
position: fixed;
bottom: 0;
width: 15%;
height: 3.25rem;
height: 2.25rem;
margin-left: -1px;
background: linear-gradient(transparent, var(--main-bg) 70%);
}
Expand Down
13 changes: 8 additions & 5 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ const DIST = 'assets/js/dist';
const banner = `/*!
* ${pkg.name} v${pkg.version} | © ${pkg.since} ${pkg.author} | ${pkg.license} Licensed | ${pkg.homepage}
*/`;

const frontmatter = `---\npermalink: /:basename\n---\n`;

const isProd = process.env.BUILD === 'production';

let hasWatched = false;

function cleanup() {
fs.rmSync(DIST, { recursive: true, force: true });
console.log(`> Directory "${DIST}" has been cleaned.`);
Expand All @@ -39,6 +39,11 @@ function build(
{ src = SRC_DEFAULT, jekyll = false, outputName = null } = {}
) {
const input = `${src}/${filename}.js`;
const shouldWatch = hasWatched ? false : true;

if (!hasWatched) {
hasWatched = true;
}

return {
input,
Expand All @@ -49,9 +54,7 @@ function build(
banner,
sourcemap: !isProd && !jekyll
},
watch: {
include: input
},
...(shouldWatch && { watch: { include: `${SRC_DEFAULT}/**/*.js` } }),
plugins: [
babel({
babelHelpers: 'bundled',
Expand Down

0 comments on commit 6c112c6

Please sign in to comment.