29 lines
976 B
Plaintext
29 lines
976 B
Plaintext
<script defer>
|
|
window.addEventListener('DOMContentLoaded', (event) => {
|
|
ctx.services = Object.assign({}, JSON.parse(`<%- JSON.stringify(theme.data_services) %>`));
|
|
for (let id of Object.keys(ctx.services)) {
|
|
const js = ctx.services[id].js;
|
|
if (id == 'siteinfo') {
|
|
ctx.cardlinks = document.querySelectorAll('a.link-card[cardlink]');
|
|
if (ctx.cardlinks?.length > 0) {
|
|
utils.js(js, { defer: true }).then(function () {
|
|
setCardLink(ctx.cardlinks);
|
|
});
|
|
}
|
|
} else {
|
|
const els = document.getElementsByClassName(`ds-${id}`);
|
|
if (els?.length > 0) {
|
|
utils.jq(() => {
|
|
if (id == 'timeline' || 'memos' || 'marked') {
|
|
utils.js(deps.marked).then(function () {
|
|
utils.js(js, { defer: true });
|
|
});
|
|
} else {
|
|
utils.js(js, { defer: true });
|
|
}
|
|
});
|
|
}
|
|
}
|
|
}
|
|
});
|
|
</script> |