-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
95c8aa8
commit b46d9b6
Showing
68 changed files
with
3,794 additions
and
102 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{% comment %} | ||
Placeholder to allow defining custom head, in principle, you can add anything here, e.g. favicons: | ||
|
||
1. Head over to https://realfavicongenerator.net/ to add your own favicons. | ||
2. Customize default _includes/custom-head.html in your source directory and insert the given code snippet. | ||
{% endcomment %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<div id="click-to-top" class="click-to-top"> | ||
<i class="fa fa-arrow-up"></i> | ||
</div> | ||
<script> | ||
(function () { | ||
const clickToTop = document.getElementById('click-to-top'); | ||
window.addEventListener('scroll', () => { | ||
if (window.scrollY > 100) { | ||
clickToTop.classList.add('show') | ||
}else { | ||
clickToTop.classList.remove('show') | ||
} | ||
}); | ||
clickToTop.addEventListener('click', () => { | ||
window.smoothScrollTo(0); | ||
}); | ||
})(); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/styles/default.min.css"> | ||
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/highlight.min.js"></script> | ||
<!-- and it's easy to individually load additional languages --> | ||
<script charset="UTF-8" | ||
src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/languages/go.min.js" | ||
async></script> | ||
|
||
{%- assign name = 'code_badge.enabled' -%} | ||
{%- include functions.html func='get_value' default='true' -%} | ||
{%- assign badge_enabled = return -%} | ||
|
||
{%- assign name = 'code_badge.color' -%} | ||
{%- include functions.html func='get_value' default='#fff' -%} | ||
{%- assign badge_color = return -%} | ||
|
||
{%- assign name = 'code_badge.background_color' -%} | ||
{%- include functions.html func='get_value' default='#ff4e00' -%} | ||
{%- assign badge_background_color = return -%} | ||
|
||
{%- assign name = 'code_badge.text_transform' -%} | ||
{%- include functions.html func='get_value' default='uppercase' -%} | ||
{%- assign badge_text_transform = return -%} | ||
|
||
<script> | ||
// Init highlight js | ||
document.addEventListener('DOMContentLoaded', function(event) { | ||
var els = document.querySelectorAll('pre code') | ||
|
||
function addLangData(block) { | ||
var outer = block.parentElement.parentElement.parentElement; | ||
var lang = block.getAttribute('data-lang'); | ||
for (var i = 0; i < outer.classList.length; i++) { | ||
var cls = outer.classList[i]; | ||
if (cls.startsWith('language-')) { | ||
lang = cls; | ||
break; | ||
} | ||
} | ||
if (!lang) { | ||
cls = block.getAttribute('class'); | ||
lang = cls ? cls.replace('hljs ', '') : ''; | ||
} | ||
if (lang.startsWith('language-')) { | ||
lang = lang.substr(9); | ||
} | ||
block.setAttribute('class', 'hljs ' + lang); | ||
block.parentNode.setAttribute('data-lang', lang); | ||
} | ||
|
||
function addBadge(block) { | ||
var enabled = ('{{ badge_enabled }}' || 'true').toLowerCase(); | ||
if (enabled == 'true') { | ||
var pre = block.parentElement; | ||
pre.classList.add('badge'); | ||
} | ||
} | ||
|
||
function handle(block) { | ||
addLangData(block); | ||
addBadge(block) | ||
hljs.highlightBlock(block); | ||
} | ||
|
||
for (var i = 0; i < els.length; i++) { | ||
var el = els[i]; | ||
handle(el); | ||
} | ||
}); | ||
</script> | ||
|
||
<style> | ||
/* code language badge */ | ||
pre.badge::before { | ||
content: attr(data-lang); | ||
color: {{badge_color}}; | ||
background-color: {{badge_background_color}}; | ||
padding: 0 .5em; | ||
border-radius: 0 2px; | ||
text-transform: {{badge_text_transform}}; | ||
text-align: center; | ||
min-width: 32px; | ||
display: inline-block; | ||
position: absolute; | ||
right: 0; | ||
} | ||
|
||
/* fix wrong badge display for firefox browser */ | ||
code > table pre::before { | ||
display: none; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<div id="disqus_thread"></div> | ||
<script> | ||
var disqus_config = function () { | ||
this.page.url = '{{ page.url | absolute_url }}'; | ||
this.page.identifier = '{{ page.url | absolute_url }}'; | ||
}; | ||
|
||
(function() { | ||
var d = document, s = d.createElement('script'); | ||
|
||
s.src = 'https://{{ site.disqus.shortname }}.disqus.com/embed.js'; | ||
|
||
s.setAttribute('data-timestamp', +new Date()); | ||
(d.head || d.body).appendChild(s); | ||
})(); | ||
</script> | ||
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a></noscript> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<div id="gitment_thread"></div> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/theme-next/theme-next-gitment@1/default.css"/> | ||
<script src="https://cdn.jsdelivr.net/gh/theme-next/theme-next-gitment@1/gitment.browser.js" async></script> | ||
<script> | ||
var gitment = new Gitment({ | ||
id: '{{ page.id }}', | ||
owner: '{{ site.gitment.username }}', | ||
repo: '{{ site.gitment.repo }}', | ||
oauth: { | ||
client_id: '{{ site.gitment.client_id }}', | ||
client_secret: '{{ site.gitment.client_secret }}', | ||
}, | ||
}); | ||
gitment.render('gitment_thread') | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
{%- if site.utterances.follow_site_theme -%} | ||
<div id="utterances-placeholder"></div> | ||
<script> | ||
const utterancesThemeFromDataTheme = () => { | ||
const dataTheme = document.documentElement.getAttribute('data-theme'); | ||
return `github-${dataTheme}`; | ||
}; | ||
|
||
const setUtterancesTheme = () => { | ||
const iframe = document.querySelector('.utterances-frame'); | ||
if (iframe) { | ||
const message = { | ||
type: 'set-theme', | ||
theme: utterancesThemeFromDataTheme() | ||
}; | ||
iframe.contentWindow.postMessage(message, 'https://utteranc.es'); | ||
} | ||
} | ||
|
||
// dynamic change | ||
const observer = new MutationObserver((mutationsList, observer) => { | ||
for (let mutation of mutationsList) { | ||
if (mutation.type === 'attributes' && mutation.attributeName === 'data-theme') { | ||
setUtterancesTheme(); | ||
} | ||
} | ||
}); | ||
observer.observe(document.documentElement, { attributes: true, childList: false, subtree: false }); | ||
|
||
let utterancesScript = document.createElement('script'); | ||
utterancesScript.async = true; | ||
utterancesScript.src = 'https://utteranc.es/client.js'; | ||
utterancesScript.crossOrigin = 'anonymous'; | ||
utterancesScript.setAttribute('issue-term', '{{ site.utterances.issue_term }}'); | ||
utterancesScript.setAttribute('label', '{{ site.utterances.label }}'); | ||
utterancesScript.setAttribute('repo', '{{ site.utterances.repo }}'); | ||
utterancesScript.setAttribute('theme', utterancesThemeFromDataTheme()); | ||
|
||
const placeholder = document.getElementById('utterances-placeholder'); | ||
placeholder.parentNode.replaceChild(utterancesScript, placeholder); | ||
</script> | ||
{%- else -%} | ||
<script async | ||
crossorigin="anonymous" | ||
issue-term="{{ site.utterances.issue_term }}" | ||
label="{{ site.utterances.label }}" | ||
repo="{{ site.utterances.repo }}" | ||
src="https://utteranc.es/client.js" | ||
theme="{{ site.utterances.theme }}"> | ||
</script> | ||
{%- endif -%} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{% if include.selector %} | ||
{% assign selector = include.selector %} | ||
{% endif %} | ||
|
||
{% if include.seed %} | ||
{% assign seed = include.seed %} | ||
{% endif %} | ||
|
||
<script src="https://cdnjs.cloudflare.com/ajax/libs/geopattern/1.2.3/js/geopattern.min.js"></script> | ||
<script> | ||
function setRandomBgImage(selector, seed) { | ||
var pattern = GeoPattern.generate(seed); | ||
var element = document.querySelector(selector) | ||
if (element) { | ||
element.style.backgroundImage = pattern.toDataUrl(); | ||
} | ||
} | ||
|
||
setRandomBgImage('{{ selector }}', '{{ seed }}'); | ||
</script> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<!-- Google tag (gtag.js) --> | ||
<script> | ||
function initGoogleAnalytics() { | ||
var doNotTrack = (window.doNotTrack === "1" || navigator.doNotTrack === "1" || | ||
navigator.doNotTrack === "yes" || navigator.msDoNotTrack === "1"); | ||
var enableDNT = "{{ site.enableDNT | default: true }}" == "true"; | ||
|
||
if (!enableDNT || !doNotTrack) { | ||
var measurementId = '{{ site.google_analytics }}'; | ||
|
||
(function(src) { | ||
var tag = document.createElement('script'); | ||
tag.src = src; | ||
tag.async = true; | ||
var firstScriptTag = document.getElementsByTagName('script')[0]; | ||
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); | ||
})('https://www.googletagmanager.com/gtag/js?id=' + measurementId); | ||
|
||
window.dataLayer = window.dataLayer || []; | ||
function gtag(){dataLayer.push(arguments);} | ||
gtag('js', new Date()); | ||
gtag('config', measurementId); | ||
} | ||
} | ||
window.addEventListener("load", initGoogleAnalytics); | ||
</script> | ||
|
Oops, something went wrong.