Skip to content

Commit

Permalink
Merge branch 'master' into bugfix-PR
Browse files Browse the repository at this point in the history
  • Loading branch information
classicrocker883 authored Nov 21, 2024
2 parents 81d3d05 + 65f960c commit a4812e4
Show file tree
Hide file tree
Showing 37 changed files with 414 additions and 411 deletions.
1 change: 1 addition & 0 deletions .github/workflows/pr-filter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:

jobs:
check-template:
if: github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
runs-on: ubuntu-latest
permissions:
pull-requests: write
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/scripts/pr-filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ module.exports = async ({ github, context, core }) => {
const action = context.payload.action;

const isValid =
pr.labels.length > 0 || // PR create by Dependabot would have labels
(markdown !== '' && hasTypes(markdown) && hasDescription(markdown));
markdown !== '' && hasTypes(markdown) && hasDescription(markdown);

if (!isValid) {
await github.rest.pulls.update({
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ permissions:
pull-requests: write

env:
STALE_LABEL: stale
STALE_LABEL: inactive
EXEMPT_LABELS: "pending,planning,in progress"
MESSAGE: >
This conversation has been automatically marked as stale because it has not had recent activity.
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ platforms :mingw, :x64_mingw, :mswin, :jruby do
gem "tzinfo-data"
end

gem "wdm", "~> 0.1.1", :platforms => [:mingw, :x64_mingw, :mswin]
gem "wdm", "~> 0.2.0", :platforms => [:mingw, :x64_mingw, :mswin]
1 change: 0 additions & 1 deletion _includes/analytics/cloudflare.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@
src="https://static.cloudflareinsights.com/beacon.min.js"
data-cf-beacon='{"token": "{{ site.analytics.cloudflare.id }}"}'
></script>
<!-- End Cloudflare Web Analytics -->
5 changes: 2 additions & 3 deletions _includes/analytics/fathom.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@
<script
src="https://cdn.usefathom.com/script.js"
data-site="{{ site.analytics.fathom.id }}"
defer>
</script>
<!-- End Fathom Code -->
defer
></script>
2 changes: 1 addition & 1 deletion _includes/analytics/google.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!-- Global site tag (gtag.js) - Google Analytics -->
<script defer src="https://www.googletagmanager.com/gtag/js?id={{ site.analytics.google.id }}"></script>
<script>
document.addEventListener('DOMContentLoaded', function (event) {
document.addEventListener('DOMContentLoaded', () => {
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
Expand Down
13 changes: 6 additions & 7 deletions _includes/analytics/matomo.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
<!-- Matomo -->
<script type="text/javascript">
var _paq = window._paq = window._paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
<script>
document.addEventListener('DOMContentLoaded', () => {
var _paq = (window._paq = window._paq || []);
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
var u="//{{ site.analytics.matomo.domain }}/";
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', {{ site.analytics.matomo.id }}]);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
})();
});
</script>
<!-- End Matomo Code -->
File renamed without changes.
65 changes: 36 additions & 29 deletions _includes/comments/disqus.html
Original file line number Diff line number Diff line change
@@ -1,38 +1,25 @@
<!-- The Disqus lazy loading. -->

<div id="disqus_thread">
<p class="text-center text-muted small">Comments powered by <a href="https://disqus.com/">Disqus</a>.</p>
</div>

<script type="text/javascript">
<script>
var disqus_config = function () {
this.page.url = '{{ page.url | absolute_url }}';
this.page.identifier = '{{ page.url }}';
};

{%- comment -%} Lazy loading {%- endcomment -%}
var disqus_observer = new IntersectionObserver(
function (entries) {
if (entries[0].isIntersecting) {
(function () {
var d = document,
s = d.createElement('script');
s.src = 'https://{{ site.comments.disqus.shortname }}.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();

disqus_observer.disconnect();
}
},
{ threshold: [0] }
);
function addDisqus() {
let disqusThread = document.createElement('div');
let paragraph = document.createElement('p');

disqus_observer.observe(document.getElementById('disqus_thread'));
disqusThread.id = 'disqus_thread';
paragraph.className = 'text-center text-muted small';
paragraph.innerHTML = 'Comments powered by <a href="https://disqus.com/">Disqus</a>.';
disqusThread.appendChild(paragraph);

const footer = document.querySelector('footer');
footer.insertAdjacentElement("beforebegin", disqusThread);
}

{%- comment -%} Auto switch theme {%- endcomment -%}
function reloadDisqus() {
if (event.source === window && event.data && event.data.direction === ModeToggle.ID) {
function reloadDisqus(event) {
if (event.source === window && event.data && event.data.id === Theme.ID) {
{%- comment -%} Disqus hasn't been loaded {%- endcomment -%}
if (typeof DISQUS === 'undefined') {
return;
Expand All @@ -44,7 +31,27 @@
}
}
if (document.getElementById('mode-toggle')) {
window.addEventListener('message', reloadDisqus);
addDisqus();
if (Theme.switchable) {
addEventListener('message', reloadDisqus);
}
{%- comment -%} Lazy loading {%- endcomment -%}
var disqusObserver = new IntersectionObserver(
function (entries) {
if (entries[0].isIntersecting) {
var d = document,
s = d.createElement('script');
s.src = 'https://{{ site.comments.disqus.shortname }}.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);

disqusObserver.disconnect();
}
},
{ threshold: [0] }
);

disqusObserver.observe(document.getElementById('disqus_thread'));
</script>
44 changes: 14 additions & 30 deletions _includes/comments/giscus.html
Original file line number Diff line number Diff line change
@@ -1,21 +1,8 @@
<!-- https://giscus.app/ -->
<script type="text/javascript">
<script>
(function () {
const origin = 'https://giscus.app';
const lightTheme = 'light';
const darkTheme = 'dark_dimmed';

let initTheme = lightTheme;
const html = document.documentElement;

if (
(html.hasAttribute('data-mode') &&
html.getAttribute('data-mode') === 'dark') ||
(!html.hasAttribute('data-mode') &&
window.matchMedia('(prefers-color-scheme: dark)').matches)
) {
initTheme = darkTheme;
}
const themeMapper = Theme.getThemeMapper('light', 'dark_dimmed');
const initTheme = themeMapper[Theme.visualState];

let lang = '{{ site.comments.giscus.lang | default: lang }}';
{%- comment -%} https://github.com/giscus/giscus/tree/main/locales {%- endcomment -%}
Expand All @@ -41,30 +28,27 @@
async: ''
};

let giscusScript = document.createElement('script');
let giscusNode = document.createElement('script');
Object.entries(giscusAttributes).forEach(([key, value]) =>
giscusScript.setAttribute(key, value)
giscusNode.setAttribute(key, value)
);
document.getElementById('tail-wrapper').appendChild(giscusScript);

const $footer = document.querySelector('footer');
$footer.insertAdjacentElement("beforebegin", giscusNode);

addEventListener('message', (event) => {
if (
event.source === window &&
event.data &&
event.data.direction === ModeToggle.ID
) {
{%- comment -%} global theme mode changed {%- endcomment -%}
const mode = event.data.message;
const theme = mode === ModeToggle.DARK_MODE ? darkTheme : lightTheme;
if (event.source === window && event.data && event.data.id === Theme.ID) {
const newTheme = themeMapper[Theme.visualState];

const message = {
setConfig: {
theme: theme
theme: newTheme
}
};

const giscus = document.getElementsByClassName('giscus-frame')[0].contentWindow;
giscus.postMessage({ giscus: message }, origin);
const giscus =
document.getElementsByClassName('giscus-frame')[0].contentWindow;
giscus.postMessage({ giscus: message }, 'https://giscus.app');
}
});
})();
Expand Down
63 changes: 26 additions & 37 deletions _includes/comments/utterances.html
Original file line number Diff line number Diff line change
@@ -1,49 +1,38 @@
<!-- https://utteranc.es/ -->
<script
src="https://utteranc.es/client.js"
repo="{{ site.comments.utterances.repo }}"
issue-term="{{ site.comments.utterances.issue_term }}"
crossorigin="anonymous"
async
></script>

<script type="text/javascript">
<script>
(function () {
const origin = 'https://utteranc.es';
const lightTheme = 'github-light';
const darkTheme = 'github-dark';
let initTheme = lightTheme;
const html = document.documentElement;
const themeMapper = Theme.getThemeMapper('github-light', 'github-dark');
const initTheme = themeMapper[Theme.visualState];

let script = document.createElement('script');
script.src = 'https://utteranc.es/client.js';
script.setAttribute('repo', '{{ site.comments.utterances.repo }}');
script.setAttribute('issue-term', '{{ site.comments.utterances.issue_term }}');
script.setAttribute('theme', initTheme);
script.crossOrigin = 'anonymous';
script.async = true;

if (
(html.hasAttribute('data-mode') && html.getAttribute('data-mode') === 'dark') ||
(!html.hasAttribute('data-mode') && window.matchMedia('(prefers-color-scheme: dark)').matches)
) {
initTheme = darkTheme;
}
const $footer = document.querySelector('footer');
$footer.insertAdjacentElement('beforebegin', script);

addEventListener('message', (event) => {
let theme;
let newTheme;

{%- comment -%} credit to <https://github.com/utterance/utterances/issues/170#issuecomment-594036347> {%- endcomment -%}
if (event.origin === origin) {
{%- comment -%} page initial {%- endcomment -%}
theme = initTheme;
} else if (event.source === window && event.data && event.data.direction === ModeToggle.ID) {
{%- comment -%} global theme mode changed {%- endcomment -%}
const mode = event.data.message;
theme = mode === ModeToggle.DARK_MODE ? darkTheme : lightTheme;
} else {
return;
}
{%- comment -%}
Credit to <https://github.com/utterance/utterances/issues/170#issuecomment-594036347>
{%- endcomment -%}
if (event.source === window && event.data && event.data.id === Theme.ID) {
newTheme = themeMapper[Theme.visualState];

const message = {
type: 'set-theme',
theme: theme
};
const message = {
type: 'set-theme',
theme: newTheme
};

const utterances = document.getElementsByClassName('utterances-frame')[0].contentWindow;
utterances.postMessage(message, origin);
const utterances = document.querySelector('.utterances-frame').contentWindow;
utterances.postMessage(message, origin);
}
});
})();
</script>
25 changes: 23 additions & 2 deletions _includes/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,32 @@
<link rel="stylesheet" href="{{ site.data.origin[type].glightbox.css | relative_url }}">
{% endif %}

<!-- JavaScript -->
<!-- Scripts -->

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

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

{% if jekyll.environment == 'production' %}
<!-- PWA -->
{% if site.pwa.enabled %}
<script
defer
src="{{ '/app.min.js' | relative_url }}?baseurl={{ site.baseurl | default: '' }}&register={{ site.pwa.cache.enabled }}"
></script>
{% endif %}

<!-- Web Analytics -->
{% for analytics in site.analytics %}
{% capture str %}{{ analytics }}{% endcapture %}
{% assign platform = str | split: '{' | first %}
{% if site.analytics[platform].id and site.analytics[platform].id != empty %}
{% include analytics/{{ platform }}.html %}
{% endif %}
{% endfor %}
{% endif %}

{% include metadata-hook.html %}
</head>
29 changes: 3 additions & 26 deletions _includes/js-selector.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@

{% capture script %}/assets/js/dist/{{ js }}.min.js{% endcapture %}

<script src="{{ script | relative_url }}"></script>
<script defer src="{{ script | relative_url }}"></script>

{% if page.math %}
<!-- MathJax -->
<script src="{{ '/assets/js/data/mathjax.js' | relative_url }}"></script>
<script src="https://cdnjs.cloudflare.com/polyfill/v3/polyfill.min.js?features=es6"></script>
<script async src="{{ '/assets/js/data/mathjax.js' | relative_url }}"></script>
<script async src="https://cdnjs.cloudflare.com/polyfill/v3/polyfill.min.js?features=es6"></script>
<script id="MathJax-script" async src="{{ site.data.origin[type].mathjax.js | relative_url }}"></script>
{% endif %}

Expand All @@ -84,26 +84,3 @@
{% endcase %}
{% endif %}
{% endif %}

{% if page.mermaid %}
{% include mermaid.html %}
{% endif %}

{% if jekyll.environment == 'production' %}
<!-- PWA -->
{% if site.pwa.enabled %}
<script
defer
src="{{ 'app.min.js' | relative_url }}?baseurl={{ site.baseurl | default: '' }}&register={{ site.pwa.cache.enabled }}"
></script>
{% endif %}

<!-- Web Analytics -->
{% for analytics in site.analytics %}
{% capture str %}{{ analytics }}{% endcapture %}
{% assign type = str | split: '{' | first %}
{% if site.analytics[type].id and site.analytics[type].id != empty %}
{% include analytics/{{ type }}.html %}
{% endif %}
{% endfor %}
{% endif %}
Loading

0 comments on commit a4812e4

Please sign in to comment.