live_chat.tpl 4.0 KB

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