live_chat.tpl 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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. ["class_expire_time", "{$user->class_expire}"],
  33. ["available_traffic", "{$user->unusedTraffic()}"],
  34. ["balance", "{$user->money}"]
  35. ]]
  36. ]);
  37. </script>
  38. {/if}
  39. {if $public_setting['live_chat'] === 'livechat'}
  40. <script>
  41. window.__lc = window.__lc ||
  42. {
  43. };
  44. window.__lc.license = "{$public_setting['livechat_id']}";
  45. window.__lc.params = [
  46. {
  47. name: '用户编号', value: '{$user->id}'
  48. },
  49. {
  50. name: '用户类别', value: '{$user->class}'
  51. },
  52. {
  53. name: '注册邮箱', value: '{$user->email}'
  54. },
  55. {
  56. name: '等级时间', value: '{$user->class_expire}'
  57. },
  58. {
  59. name: '剩余流量', value: '{$user->unusedTraffic()}'
  60. },
  61. {
  62. name: '账户余额', value: '{$user->money}'
  63. }
  64. ];
  65. (function (n, t, c) {
  66. function i(n) {
  67. return e._h ? e._h.apply(null, n) : e._q.push(n)
  68. }
  69. var e = {
  70. _q: [],
  71. _h: null,
  72. _v: "2.0",
  73. on: function () {
  74. i(["on", c.call(arguments)])
  75. },
  76. once: function () {
  77. i(["once", c.call(arguments)])
  78. },
  79. off: function () {
  80. i(["off", c.call(arguments)])
  81. },
  82. get: function () {
  83. if (!e._h) throw new Error("[LiveChatWidget] You can't use getters before load.");
  84. return i(["get", c.call(arguments)])
  85. },
  86. call: function () {
  87. i(["call", c.call(arguments)])
  88. },
  89. init: function () {
  90. var n = t.createElement("script");
  91. n.async = !0,
  92. n.type = "text/javascript",
  93. n.src = "https://cdn.livechatinc.com/tracking.js",
  94. t.head.appendChild(n)
  95. }
  96. };
  97. !n.__lc.asyncInit && e.init(),
  98. n.LiveChatWidget = n.LiveChatWidget || e
  99. }(window, document, [].slice))
  100. </script>
  101. {/if}
  102. {if $public_setting['live_chat'] === 'mylivechat'}
  103. <script type="text/javascript">
  104. (() => {
  105. var hccid = "{$public_setting['mylivechat_id']}";
  106. var nt = document.createElement("script");
  107. nt.async = true;
  108. nt.src = "https://mylivechat.com/chatinline.aspx?hccid=" + hccid;
  109. var ct = document.getElementsByTagName("script")[0];
  110. ct.parentNode.insertBefore(nt, ct);
  111. })();
  112. </script>
  113. {/if}