live_chat.tpl 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. {if $public_setting['live_chat'] === 'tawk'}
  2. <script type="text/javascript">
  3. var Tawk_API=Tawk_API||{}, Tawk_LoadStart=new Date();
  4. (function(){
  5. var id = "{$public_setting['tawk_id']}";
  6. var s1=document.createElement("script"),s0=document.getElementsByTagName("script")[0];
  7. s1.async=true;
  8. s1.src='https://embed.tawk.to/' + id + '/default';
  9. s1.setAttribute('crossorigin','*');
  10. s0.parentNode.insertBefore(s1,s0);
  11. })();
  12. </script>
  13. {/if}
  14. {if $public_setting['live_chat'] === 'crisp'}
  15. <script type="text/javascript"> window.$crisp = [];
  16. window.CRISP_WEBSITE_ID = "{$public_setting["crisp_id"]}";
  17. (function () {
  18. d = document;
  19. s = d.createElement("script");
  20. s.src = "https://client.crisp.chat/l.js";
  21. s.async = 1;
  22. d.getElementsByTagName("head")[0].appendChild(s);
  23. })();
  24. $crisp.push(["safe", true])
  25. $crisp.push(["set","user:nickname", "{$user->user_name}"],
  26. ["set","user:email","{$user->email}"],
  27. ["set", "session:data",
  28. [[
  29. ["user_id","{$user->id}"],
  30. ["user_class","{$user->class}"],
  31. ["reg_email","{$user->email}"],
  32. ["expire_in","{$user->expire_in}"],
  33. ["class_expire_time","{$user->class_expire}"],
  34. ["available_traffic","{$user->unusedTraffic()}"],
  35. ["balance","{$user->money}"]
  36. ]]
  37. ]);
  38. </script>
  39. {/if}
  40. {if $public_setting['live_chat'] === 'livechat'}
  41. <script>
  42. window.__lc = window.__lc || { };
  43. window.__lc.license = "{$public_setting['livechat_id']}";
  44. window.__lc.params = [
  45. { name: '用户编号', value: '{$user->id}' },
  46. { name: '用户类别', value: '{$user->class}' },
  47. { name: '注册邮箱', value: '{$user->email}' },
  48. { name: '到期时间', value: '{$user->expire_in}' },
  49. { name: '等级时间', value: '{$user->class_expire}' },
  50. { name: '剩余流量', value: '{$user->unusedTraffic()}' },
  51. { name: '账户余额', value: '{$user->money}' }
  52. ];
  53. (function(n, t, c) {
  54. function i(n) {
  55. return e._h ? e._h.apply(null, n) : e._q.push(n)
  56. }
  57. var e = {
  58. _q: [],
  59. _h: null,
  60. _v: "2.0",
  61. on: function() {
  62. i(["on", c.call(arguments)])
  63. },
  64. once: function() {
  65. i(["once", c.call(arguments)])
  66. },
  67. off: function() {
  68. i(["off", c.call(arguments)])
  69. },
  70. get: function() {
  71. if (!e._h) throw new Error("[LiveChatWidget] You can't use getters before load.");
  72. return i(["get", c.call(arguments)])
  73. },
  74. call: function() {
  75. i(["call", c.call(arguments)])
  76. },
  77. init: function() {
  78. var n = t.createElement("script");
  79. n.async = !0,
  80. n.type = "text/javascript",
  81. n.src = "https://cdn.livechatinc.com/tracking.js",
  82. t.head.appendChild(n)
  83. }
  84. }; ! n.__lc.asyncInit && e.init(),
  85. n.LiveChatWidget = n.LiveChatWidget || e
  86. } (window, document, [].slice))
  87. </script>
  88. {/if}
  89. {if $public_setting['live_chat'] === 'mylivechat'}
  90. <script type="text/javascript">
  91. (() => {
  92. var hccid = "{$public_setting['mylivechat_id']}";
  93. var nt = document.createElement("script");
  94. nt.async = true;
  95. nt.src = "https://mylivechat.com/chatinline.aspx?hccid=" + hccid;
  96. var ct = document.getElementsByTagName("script")[0];
  97. ct.parentNode.insertBefore(nt, ct);
  98. })();
  99. </script>
  100. {/if}