33 * @var $block \Vendic\Zopim\Block\View
44 */
55?>
6- <?php if ($ block ->getIsEnabled () && !empty ($ block ->getZopimId ())) : ?>
7-
8- <script>
9- require([
10- 'jquery'
11- ], function () {
12- jQuery(document).ready(function() {
13-
14- setTimeout(function (){
15-
16- var isMobile = /(iphone|ipod|android|blackberry|windows ce|palm|symbian)/i.test(navigator.userAgent);
17- var curl = window.location.href;
18- var arr = curl.split("/");
19- var result = arr[2];
20- if (isMobile) {
21- }else{
22- window.$zopim||(function(d,s){var z=$zopim=function(c){z._.push(c)},$=z.s=
23- d.createElement(s),e=d.getElementsByTagName(s)[0];z.set=function(o){z.set.
24- _.push(o)};z._=[];z.set._=[];$.async=!0;$.setAttribute("charset","utf-8");
25- $.src="//v2.zopim.com/?<?php echo $ block ->getZopimId () ?> ";z.t=+new Date;$.
26- type="text/javascript";e.parentNode.insertBefore($,e)})(document,"script");
27- }
6+ <?php if ($ block ->config ->getIsEnabled () && !empty ($ block ->config ->getZopimId ())) : ?>
7+ <?php if ($ block ->config ->getCookiesEnabled ()) : ?>
8+ <script>
9+ require([
10+ 'jquery',
11+ 'jquery/jquery.cookie',
12+ 'domReady!'
13+ ], function ($) {
14+ $(document).ready(function () {
15+
16+ var cookieName = "<?php echo $ block ->config ->getExpectedCookieName () ?> "
17+ var cookieValue = "<?php echo $ block ->config ->getExpectedCookieValue () ?> "
18+
19+ console.log(cookieName);
20+ console.log(cookieValue);
21+ console.log($.cookie(cookieValue));
22+
23+ if ($.cookie(cookieName) === cookieValue) {
2824
29- }, <?php echo $ block -> getDelay () ?> );
25+ setTimeout(function () {
3026
27+ var isMobile = /(iphone|ipod|android|blackberry|windows ce|palm|symbian)/i.test(navigator.userAgent);
28+ var curl = window.location.href;
29+ var arr = curl.split("/");
30+ var result = arr[2];
31+ if (isMobile) {
32+ } else {
33+ window.$zopim || (function (d, s) {
34+ var z = $zopim = function (c) {
35+ z._.push(c)
36+ }, $ = z.s =
37+ d.createElement(s), e = d.getElementsByTagName(s)[0];
38+ z.set = function (o) {
39+ z.set._.push(o)
40+ };
41+ z._ = [];
42+ z.set._ = [];
43+ $.async = !0;
44+ $.setAttribute("charset", "utf-8");
45+ $.src = "//v2.zopim.com/?<?php echo $ block ->config ->getZopimId () ?> ";
46+ z.t = +new Date;
47+ $.type = "text/javascript";
48+ e.parentNode.insertBefore($, e)
49+ })(document, "script");
50+ }
51+
52+ }, <?php echo $ block ->config ->getDelay () ?> );
53+
54+ }
55+
56+ });
3157 });
32- });
33- </script>
58+ </script>
59+ <?php else : ?>
60+ <script>
61+ require([
62+ 'jquery'
63+ ], function ($) {
64+ $(document).ready(function () {
65+
66+ setTimeout(function () {
67+
68+ var isMobile = /(iphone|ipod|android|blackberry|windows ce|palm|symbian)/i.test(navigator.userAgent);
69+ var curl = window.location.href;
70+ var arr = curl.split("/");
71+ var result = arr[2];
72+ if (isMobile) {
73+ } else {
74+ window.$zopim || (function (d, s) {
75+ var z = $zopim = function (c) {
76+ z._.push(c)
77+ }, $ = z.s =
78+ d.createElement(s), e = d.getElementsByTagName(s)[0];
79+ z.set = function (o) {
80+ z.set._.push(o)
81+ };
82+ z._ = [];
83+ z.set._ = [];
84+ $.async = !0;
85+ $.setAttribute("charset", "utf-8");
86+ $.src = "//v2.zopim.com/?<?php echo $ block ->config ->getZopimId () ?> ";
87+ z.t = +new Date;
88+ $.type = "text/javascript";
89+ e.parentNode.insertBefore($, e)
90+ })(document, "script");
91+ }
3492
93+ }, <?php echo $ block ->config ->getDelay () ?> );
94+
95+ });
96+ });
97+ </script>
98+ <?php endif ; ?>
3599<?php endif ; ?>
0 commit comments