bifocal/assets/js/main.js

40 lines
877 B
JavaScript

function initParallax() {
jarallax(document.querySelectorAll('.has-parallax-feed .gh-card'), {
speed: 0.8,
});
}
(function () {
initParallax();
})();
(function () {
const toggle = document.querySelector('[data-toggle-comments]');
if (!toggle) return;
toggle.addEventListener('click', function () {
document.body.classList.toggle('comments-opened');
});
})();
(function () {
const element = document.querySelector('.gh-article-excerpt');
if (!element) return;
let text = element.textContent;
const emojiRE = /\p{EPres}|\p{ExtPict}/gu;
const emojis = text.match(emojiRE);
if (!emojis) return;
emojis.forEach(function (emoji) {
text = text.replace(emoji, `<span class="emoji">${emoji}</span>`);
});
element.innerHTML = text;
})();
// (function () {
// pagination(true);
// })();