forked from xaoxuu/hexo-theme-stellar
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
8 changed files
with
98 additions
and
95 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
@@ -1,25 +1,24 @@ | ||
<script> | ||
<script type="module"> | ||
const el = document.getElementById('artalk_container'); | ||
util.viewportLazyload(el, load_artalk, <%= theme.comments.lazyload ?? false %>); | ||
function load_artalk() { | ||
if (!document.querySelectorAll("#artalk_container")[0]) return; | ||
if (!el) return; | ||
utils.css('<%- theme.comments.artalk.css %>'); | ||
utils.js('<%- theme.comments.artalk.js %>', {defer: true}).then(function () { | ||
const el = document.getElementById("artalk_container"); | ||
var path = el.getAttribute('comment_id'); | ||
const path = el.getAttribute('comment_id'); | ||
if (!path) { | ||
path = decodeURI(window.location.pathname); | ||
} | ||
var artalk = Artalk.init({ | ||
const artalk = Artalk.init({ | ||
el: '#artalk_container', | ||
pageKey: path, | ||
pageTitle: '<%= page.title %>', | ||
server: '<%= theme.comments.artalk.server %>', | ||
placeholder: '<%= theme.comments.artalk.placeholder %>', | ||
site: "<%- config.title %>", | ||
darkMode: '<%= theme.comments.artalk.darkMode %>' | ||
}) | ||
}); | ||
}); | ||
} | ||
window.addEventListener('DOMContentLoaded', (event) => { | ||
load_artalk(); | ||
}); | ||
</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 |
---|---|---|
@@ -1,26 +1,23 @@ | ||
<script> | ||
function loadBeaudar() { | ||
const els = document.querySelectorAll("#comments #beaudar"); | ||
if (els.length === 0) return; | ||
els.forEach((el, i) => { | ||
try { | ||
el.innerHTML = ''; | ||
} catch (error) { | ||
console.error(error); | ||
<script type="module"> | ||
const el = document.querySelector('#comments #beaudar'); | ||
util.viewportLazyload(el, load_beaudar, <%= theme.comments.lazyload ?? false %>); | ||
function load_beaudar() { | ||
if (!el) return; | ||
try { | ||
el.innerHTML = ''; | ||
} catch (error) { | ||
console.error(error); | ||
} | ||
const script = document.createElement('script'); | ||
script.src = 'https://beaudar.lipk.org/client.js'; | ||
script.async = true; | ||
for (const key of Object.keys(el.attributes)) { | ||
const attr = el.attributes[key]; | ||
if (['class', 'id'].includes(attr.name) === false) { | ||
script.setAttribute(attr.name, attr.value); | ||
} | ||
var script = document.createElement('script'); | ||
script.src = 'https://beaudar.lipk.org/client.js'; | ||
script.async = true; | ||
for (let key of Object.keys(el.attributes)) { | ||
let attr = el.attributes[key]; | ||
if (['class', 'id'].includes(attr.name) === false) { | ||
script.setAttribute(attr.name, attr.value); | ||
} | ||
} | ||
el.appendChild(script); | ||
}); | ||
} | ||
el.appendChild(script); | ||
} | ||
window.addEventListener('DOMContentLoaded', (event) => { | ||
loadBeaudar(); | ||
}); | ||
</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 |
---|---|---|
@@ -1,22 +1,22 @@ | ||
<script> | ||
window.addEventListener('DOMContentLoaded', (event) => { | ||
const els = document.querySelectorAll("#comments #giscus"); | ||
if (els.length === 0) return; | ||
els.forEach((el, i) => { | ||
try { | ||
<script type="module"> | ||
const el = document.querySelector('#comments #giscus'); | ||
util.viewportLazyload(el, load_discus, <%= theme.comments.lazyload ?? false %>); | ||
function load_discus() { | ||
if (!el) return; | ||
try { | ||
el.innerHTML = ''; | ||
} catch (error) { | ||
console.error(error); | ||
} | ||
var script = document.createElement('script'); | ||
const script = document.createElement('script'); | ||
script.async = true; | ||
for (let key of Object.keys(el.attributes)) { | ||
let attr = el.attributes[key]; | ||
for (const key of Object.keys(el.attributes)) { | ||
const attr = el.attributes[key]; | ||
if (['class', 'id'].includes(attr.name) === false) { | ||
script.setAttribute(attr.name, attr.value); | ||
} | ||
} | ||
el.appendChild(script); | ||
}); | ||
}); | ||
} | ||
</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 |
---|---|---|
@@ -1,20 +1,18 @@ | ||
<script> | ||
function load_twikoo() { | ||
if (!document.querySelectorAll("#twikoo_container")[0]) return; | ||
utils.js('<%- theme.comments.twikoo.js %>', {defer: true}).then(function () { | ||
const el = document.getElementById("twikoo_container"); | ||
var path = el.getAttribute('comment_id'); | ||
if (!path) { | ||
path = decodeURI(window.location.pathname); | ||
} | ||
twikoo.init(Object.assign(<%- JSON.stringify(theme.comments.twikoo) %>, { | ||
el: '#twikoo_container', | ||
path: path, | ||
})); | ||
}); | ||
} | ||
<script type="module"> | ||
const el = document.getElementById('artalk_container'); | ||
util.viewportLazyload(el, load_twikoo, <%= theme.comments.lazyload ?? false %>); | ||
window.addEventListener('DOMContentLoaded', (event) => { | ||
load_twikoo(); | ||
function load_twikoo() { | ||
if (!el) return; | ||
utils.js('<%- theme.comments.twikoo.js %>', {defer: true}).then(function () { | ||
const path = el.getAttribute('comment_id'); | ||
if (!path) { | ||
path = decodeURI(window.location.pathname); | ||
} | ||
twikoo.init(Object.assign(<%- JSON.stringify(theme.comments.twikoo) %>, { | ||
el: '#twikoo_container', | ||
path: path, | ||
})); | ||
}); | ||
} | ||
</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 |
---|---|---|
@@ -1,26 +1,23 @@ | ||
<script> | ||
function loadUtterances() { | ||
const els = document.querySelectorAll("#comments #utterances"); | ||
if (els.length === 0) return; | ||
els.forEach((el, i) => { | ||
try { | ||
el.innerHTML = ''; | ||
} catch (error) { | ||
console.error(error); | ||
<script type="module"> | ||
const el = document.querySelector("#comments #utterances"); | ||
util.viewportLazyload(el, load_utterances, <%= theme.comments.lazyload ?? false %>); | ||
function load_utterances() { | ||
if (!el) return; | ||
try { | ||
el.innerHTML = ''; | ||
} catch (error) { | ||
console.error(error); | ||
} | ||
const script = document.createElement('script'); | ||
script.src = 'https://utteranc.es/client.js'; | ||
script.async = true; | ||
for (const key of Object.keys(el.attributes)) { | ||
const attr = el.attributes[key]; | ||
if (['class', 'id'].includes(attr.name) === false) { | ||
script.setAttribute(attr.name, attr.value); | ||
} | ||
var script = document.createElement('script'); | ||
script.src = 'https://utteranc.es/client.js'; | ||
script.async = true; | ||
for (let key of Object.keys(el.attributes)) { | ||
let attr = el.attributes[key]; | ||
if (['class', 'id'].includes(attr.name) === false) { | ||
script.setAttribute(attr.name, attr.value); | ||
} | ||
} | ||
el.appendChild(script); | ||
}); | ||
} | ||
el.appendChild(script); | ||
} | ||
window.addEventListener('DOMContentLoaded', (event) => { | ||
loadUtterances(); | ||
}); | ||
</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
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