{%- if page.comments %} {%- if theme.injects.comment.length == 1 %} {%- set inject_item = theme.injects.comment[0] %} {{ partial(inject_item.layout, inject_item.locals, inject_item.options) }} {%- elif theme.injects.comment.length > 1 %} {%- if theme.comments.style == 'buttons' %}
{%- for inject_item in theme.injects.comment %} {{ inject_item.locals.button }} {%- endfor %}
{%- for inject_item in theme.injects.comment %}
{{ partial(inject_item.layout, inject_item.locals, inject_item.options) }}
{%- endfor %} (function() { let commentButton = document.querySelectorAll('.comment-button'); commentButton.forEach(element => { let commentClass = element.classList[2]; element.addEventListener('click', () => { commentButton.forEach(rmActive => rmActive.classList.remove('active')); element.classList.add('active'); document.querySelectorAll('.comment-position').forEach(rmActive => rmActive.classList.remove('active')); document.querySelector(`.comment-position.${commentClass}`).classList.add('active'); if (CONFIG.comments.storage) { localStorage.setItem('comments_active', commentClass); } }); }); let { activeClass } = CONFIG.comments; if (CONFIG.comments.storage) { activeClass = localStorage.getItem('comments_active') || activeClass; } if (activeClass) { let activeButton = document.querySelector(`.comment-button.${activeClass}`); if (activeButton) { activeButton.click(); } } })(); {%- elif theme.comments.style == 'tabs' %}
{%- for inject_item in theme.injects.comment %}
{{ partial(inject_item.layout, inject_item.locals, inject_item.options) }}
{%- endfor %}
{%- endif %} {%- endif %} {%- endif %}