fix: load script synchronously (#482)
* fix: constant path * fix: load script synchronously
This commit is contained in:
parent
6679dbd07b
commit
692f1fda5a
|
@ -6,10 +6,7 @@
|
|||
if (!el) return;
|
||||
utils.css('<%- theme.comments.artalk.css %>');
|
||||
utils.js('<%- theme.comments.artalk.js %>', {defer: true}).then(function () {
|
||||
const path = el.getAttribute('comment_id');
|
||||
if (!path) {
|
||||
path = decodeURI(window.location.pathname);
|
||||
}
|
||||
const path = el.getAttribute('comment_id') ?? decodeURI(window.location.pathname);
|
||||
const artalk = Artalk.init({
|
||||
el: '#artalk_container',
|
||||
pageKey: path,
|
||||
|
|
|
@ -1,14 +1,11 @@
|
|||
<script type="module">
|
||||
const el = document.getElementById('artalk_container');
|
||||
const el = document.getElementById('twikoo_container');
|
||||
util.viewportLazyload(el, load_twikoo, <%= theme.comments.lazyload ?? false %>);
|
||||
|
||||
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);
|
||||
}
|
||||
const path = el.getAttribute('comment_id') ?? decodeURI(window.location.pathname);
|
||||
twikoo.init(Object.assign(<%- JSON.stringify(theme.comments.twikoo) %>, {
|
||||
el: '#twikoo_container',
|
||||
path: path,
|
||||
|
|
|
@ -10,11 +10,7 @@
|
|||
utils.css('<%- theme.comments.waline.css %>');
|
||||
utils.css('<%- theme.comments.waline.meta_css %>');
|
||||
|
||||
const path = el.getAttribute('comment_id');
|
||||
if (!path) {
|
||||
path = decodeURI(window.location.pathname);
|
||||
}
|
||||
|
||||
const path = el.getAttribute('comment_id') ?? decodeURI(window.location.pathname);
|
||||
const waline = init(Object.assign(<%- JSON.stringify(theme.comments.waline) %>, {
|
||||
el: '#waline_container',
|
||||
path: path,
|
||||
|
|
|
@ -21,7 +21,7 @@ function custom_inject() {
|
|||
<%- partial('scripts/tagtree') %>
|
||||
|
||||
<!-- required -->
|
||||
<script src="<%- `${theme.stellar.main_js}?v=${stellar_info('version')}` %>" async></script>
|
||||
<script src="<%- `${theme.stellar.main_js}?v=${stellar_info('version')}` %>" defer></script>
|
||||
|
||||
<%- partial('scripts/theme') %>
|
||||
|
||||
|
|
Loading…
Reference in New Issue