mirror of
https://github.com/next-theme/hexo-theme-next.git
synced 2026-01-19 18:42:34 +00:00
Separate inline listeners (#303)
This commit is contained in:
parent
e942dc2d7e
commit
2329059cbd
@ -1,6 +1,6 @@
|
|||||||
<div class="reward-container">
|
<div class="reward-container">
|
||||||
<div>{{ page.reward_settings.comment }}</div>
|
<div>{{ page.reward_settings.comment }}</div>
|
||||||
<button onclick="document.querySelector('.post-reward').classList.toggle('active');">
|
<button>
|
||||||
{{ __('reward.donate') }}
|
{{ __('reward.donate') }}
|
||||||
</button>
|
</button>
|
||||||
<div class="post-reward">
|
<div class="post-reward">
|
||||||
|
|||||||
@ -62,10 +62,8 @@
|
|||||||
|
|
||||||
{%- if theme.chat.enable and (theme.chatra.enable or theme.tidio.enable or theme.gitter.enable) %}
|
{%- if theme.chat.enable and (theme.chatra.enable or theme.tidio.enable or theme.gitter.enable) %}
|
||||||
<div class="sidebar-button site-overview-item animated">
|
<div class="sidebar-button site-overview-item animated">
|
||||||
{%- if theme.chatra.enable %}
|
{%- if theme.chatra.enable or theme.tidio.enable %}
|
||||||
<button onclick="Chatra('openChat', true);">
|
<button>
|
||||||
{%- elif theme.tidio.enable %}
|
|
||||||
<button onclick="tidioChatApi.open();">
|
|
||||||
{%- elif theme.gitter.enable %}
|
{%- elif theme.gitter.enable %}
|
||||||
<button class="js-gitter-toggle-chat-button">
|
<button class="js-gitter-toggle-chat-button">
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|||||||
1
layout/_third-party/chat/tidio.njk
vendored
1
layout/_third-party/chat/tidio.njk
vendored
@ -1 +1,2 @@
|
|||||||
<script src="//code.tidio.co/{{ theme.tidio.key }}.js"></script>
|
<script src="//code.tidio.co/{{ theme.tidio.key }}.js"></script>
|
||||||
|
{{ next_js('third-party/chat/tidio.js') }}
|
||||||
|
|||||||
@ -76,6 +76,7 @@ NexT.boot.refresh = function() {
|
|||||||
NexT.utils.registerActiveMenuItem();
|
NexT.utils.registerActiveMenuItem();
|
||||||
NexT.utils.registerLangSelect();
|
NexT.utils.registerLangSelect();
|
||||||
NexT.utils.registerSidebarTOC();
|
NexT.utils.registerSidebarTOC();
|
||||||
|
NexT.utils.registerPostReward();
|
||||||
NexT.utils.wrapTableWithBox();
|
NexT.utils.wrapTableWithBox();
|
||||||
NexT.utils.registerVideoIframe();
|
NexT.utils.registerVideoIframe();
|
||||||
};
|
};
|
||||||
|
|||||||
25
source/js/third-party/chat/chatra.js
vendored
25
source/js/third-party/chat/chatra.js
vendored
@ -1,10 +1,19 @@
|
|||||||
/* global CONFIG */
|
/* global CONFIG, Chatra */
|
||||||
|
|
||||||
if (CONFIG.chatra.embed) {
|
(function() {
|
||||||
window.ChatraSetup = {
|
if (CONFIG.chatra.embed) {
|
||||||
mode : 'frame',
|
window.ChatraSetup = {
|
||||||
injectTo: CONFIG.chatra.embed
|
mode : 'frame',
|
||||||
};
|
injectTo: CONFIG.chatra.embed
|
||||||
}
|
};
|
||||||
|
}
|
||||||
|
|
||||||
window.ChatraID = CONFIG.chatra.id;
|
window.ChatraID = CONFIG.chatra.id;
|
||||||
|
|
||||||
|
const chatButton = document.querySelector('.sidebar-button button');
|
||||||
|
if (chatButton) {
|
||||||
|
chatButton.addEventListener('click', () => {
|
||||||
|
Chatra('openChat', true);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|||||||
10
source/js/third-party/chat/tidio.js
vendored
Normal file
10
source/js/third-party/chat/tidio.js
vendored
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
/* global tidioChatApi */
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
const chatButton = document.querySelector('.sidebar-button button');
|
||||||
|
if (chatButton) {
|
||||||
|
chatButton.addEventListener('click', () => {
|
||||||
|
tidioChatApi.open();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})();
|
||||||
@ -282,6 +282,14 @@ NexT.utils = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
registerPostReward: function() {
|
||||||
|
const button = document.querySelector('.reward-container button');
|
||||||
|
if (!button) return;
|
||||||
|
button.addEventListener('click', () => {
|
||||||
|
document.querySelector('.post-reward').classList.toggle('active');
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
activateNavByIndex: function(index) {
|
activateNavByIndex: function(index) {
|
||||||
const target = document.querySelectorAll('.post-toc li a.nav-link')[index];
|
const target = document.querySelectorAll('.post-toc li a.nav-link')[index];
|
||||||
if (!target || target.classList.contains('active-current')) return;
|
if (!target || target.classList.contains('active-current')) return;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user