File tree Expand file tree Collapse file tree 8 files changed +108
-1
lines changed
Expand file tree Collapse file tree 8 files changed +108
-1
lines changed Original file line number Diff line number Diff line change @@ -269,6 +269,14 @@ back2top:
269269 # Scroll percent label in b2t button.
270270 scrollpercent : false
271271
272+ # A button to open designated chat widget in sidebar.
273+ # Firstly, you need enable the chat service you want to activate its sidebar button.
274+ chat :
275+ enable : false
276+ # service: chatra
277+ # service: tidio
278+ text : Chat # button text, change it as you wish
279+
272280# ---------------------------------------------------------------
273281# Post Settings
274282# See: https://theme-next.org/docs/theme-settings/posts/
@@ -827,6 +835,21 @@ reading_progress:
827835 color : " #37c6c0"
828836 height : 2px
829837
838+ # Chatra Support
839+ # See: https://chatra.io
840+ # Dashboard: https://app.chatra.io/settings/general
841+ chatra :
842+ enable : false
843+ async : true
844+ id : # visit Dashboard to get your ChatraID
845+ # embed: # unfinished experimental feature for developers, See: https://chatra.io/help/api/#injectto
846+
847+ # Tidio Support
848+ # See: https://www.tidiochat.com
849+ # Dashboard: https://www.tidiochat.com/panel/dashboard
850+ tidio :
851+ enable : false
852+ key : # Public Key, get it from Dashboard, See: https://www.tidiochat.com/panel/settings/developer
830853
831854# ---------------------------------------------------------------
832855# Tags Settings
Original file line number Diff line number Diff line change 120120 {% include ' _third-party/pangu.swig' %}
121121 {% include ' _third-party/bookmark.swig' %}
122122 {% include ' _third-party/copy-code.swig' %}
123+ {% include ' _third-party/chatra.swig' %}
124+ {% include ' _third-party/tidio.swig' %}
123125</body>
124126</html>
Original file line number Diff line number Diff line change 103103 </div>
104104 {% endif %}
105105
106+ {% if theme.chat .enable and theme.chat .service !== ' ' %}
107+ <div class =" chat motion-element" >
108+ {% if theme.chat .service == ' chatra' and theme.chatra .enable %}
109+ <a onclick=" Chatra('openChat', true)" >
110+ {% endif %}
111+ {% if theme.chat .service == ' tidio' and theme.tidio .enable %}
112+ <a onclick=" tidioChatApi.open();" >
113+ {% endif %}
114+ <i class =" fa fa-comment" ></i>
115+ {{ theme.chat .text }}
116+ </a>
117+ </div>
118+ {% endif %}
119+
106120 {% if theme.social %}
107121 <div class =" links-of-author motion-element" >
108122 {% for name, link in theme.social %}
111125 {% if not (theme.social_icons .enable ) or (not theme.social_icons .icons_only ) %}
112126 {% set sidebarText = name %}
113127 {% endif %}
114- {% if theme.social_icons .enable %}
128+ {% if theme.social_icons .enable %}
115129 {% set sidebarIcon = ' <i class="fa fa-fw fa-' + link.split (' ||' )[1 ] | trim | default (' globe' ) + ' "></i>' %}
116130 {% endif %}
117131 {{ next_url (sidebarURL, sidebarIcon + sidebarText, {title: name + ' → ' + sidebarURL}) }}
Original file line number Diff line number Diff line change 1+ {% if theme.chatra .enable %}
2+ {% if theme.chatra .embed %}
3+ <script>
4+ window.ChatraSetup = {
5+ mode: ' frame' ,
6+ injectTo: ' {{ theme.chatra.embed }}'
7+ };
8+ </script>
9+ {% endif %}
10+ <script>
11+ (function(d, w, c) {
12+ w.ChatraID = ' {{ theme.chatra.id }}' ;
13+ var s = d.createElement (' script' );
14+ w[c] = w[c] || function () {
15+ (w[c].q = w[c].q || []).push (arguments);
16+ };
17+ s.async = {{ theme.chatra .async }};
18+ s.src = ' https://call.chatra.io/chatra.js' ;
19+ if (d.head ) d.head .appendChild (s);
20+ })(document, window, ' Chatra' );
21+ </script>
22+ {% endif %}
Original file line number Diff line number Diff line change 1+ {% if theme.tidio .enable %}
2+ <script src=" //code.tidio.co/{{ theme.tidio.key }}.js" ></script>
3+ {% endif %}
Original file line number Diff line number Diff line change 1+ .chat {
2+ margin-top : 10px ;
3+
4+ a {
5+ display : inline-block ;
6+ padding : 0 15px ;
7+ color : rgb (252 , 100 , 35 );
8+ border : 1px solid rgb (252 , 100 , 35 );
9+ border-radius : 4px ;
10+
11+ i {
12+ color : rgb (252 , 100 , 35 );
13+ font-size : 14px ;
14+ }
15+
16+ & :hover {
17+ color : white ;
18+ background : rgb (252 , 100 , 35 );
19+
20+ i { color : white ; }
21+ }
22+ }
23+ }
Original file line number Diff line number Diff line change 6363@import "sidebar-nav" ;
6464@import "sidebar-toc" ;
6565@import "sidebar-dimmer" if hexo-config('sidebar.dimmer' );
66+ @import "sidebar-chat" if hexo-config('chat.enable' );
Original file line number Diff line number Diff line change 7676 }
7777}
7878
79+ .chat {
80+ border-top : 1px dotted $grey-light ;
81+ border-bottom : 1px dotted $grey-light ;
82+ text-align : center ;
83+ }
84+
85+ .chat a {
86+ display : block ;
87+ color : $orange ;
88+ border : none ;
89+
90+ & :hover {
91+ background : none ;
92+ color : darken ($orange , 20% );
93+
94+ i { color : darken ($orange , 20% ); }
95+ }
96+ }
97+
7998.links-of-author {
8099 // clearfix();
81100 display : flex ;
You can’t perform that action at this time.
0 commit comments