PageSourceSearch

https://www.pos.com.my/assets/csp-init.js

js pos.com.my collected 2026-09-24 07:29:03 UTC 6,757 bytes, 223 lines download raw bytes

1(function () {
2  var host = (window.location.hostname || '').toLowerCase();
3  var isLocalHost = host === 'localhost' || host === '127.0.0.1' || host === '0.0.0.0' || host.endsWith('.local');
4  var isTrustedHost = host === 'pos.com.my' || host.endsWith('.pos.com.my') || host.endsWith('.amplifyapp.com');
5  var shouldLoadMarketingScripts = !isLocalHost && isTrustedHost;
6
7  // Google Tag Manager
8  if (shouldLoadMarketingScripts) {
9    (function (w, d, s, l, i) {
10      w[l] = w[l] || [];
11      w[l].push({
12        'gtm.start': new Date().getTime(),
13        event: 'gtm.js',
14      });
15      var f = d.getElementsByTagName(s)[0],
16        j = d.createElement(s),
17        dl = l != 'dataLayer' ? '&l=' + l : '';
18      j.async = true;
19      j.src = 'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
20      f.parentNode.insertBefore(j, f);
21    })(window, document, 'script', 'dataLayer', 'GTM-MF5HPS2');
22  }
23
24  // Sprinklr chat settings (must exist before the widget loader runs)
25  window.sprChatSettings = window.sprChatSettings || {};
26  window.sprChatSettings = { appId: '65956cf7f491cf0ab76c5ac4_app_9046265', skin: 'MODERN' };
27
28  // Sprinklr chat loader
29  (function () {
30    var t = window,
31      e = t.sprChat,
32      a = e && !!e.loaded,
33      n = document,
34      r = function () {
35        r.m(arguments);
36      };
37    (r.q = []),
38      (r.m = function (t) {
39        r.q.push(t);
40      }),
41      (t.sprChat = a ? e : r);
42
43    var e2 = t.sprTeamChat,
44      r2 = function () {
45        r2.m(arguments);
46      };
47    (r2.q = []),
48      (r2.m = function (t) {
49        r2.q.push(t);
50      }),
51      (t.sprTeamChat = e2 ? e2 : r2);
52
53    var o = function () {
54      var e = n.createElement('script');
55      (e.type = 'text/javascript'),
56        (e.async = !0),
57        (e.src = 'https://prod8-live-chat.sprinklr.com/api/livechat/handshake/widget/' + t.sprChatSettings.appId);
58      (e.onerror = function () {
59        t.sprChat.loaded = !1;
60      }),
61        (e.onload = function () {
62          t.sprChat.loaded = !0;
63        });
64      var a = n.getElementsByTagName('script')[0];
65      a.parentNode.insertBefore(e, a);
66    };
67
68    'function' == typeof e
69      ? a
70        ? e('update', t.sprChatSettings)
71        : o()
72      : 'loading' !== n.readyState
73        ? o()
74        : n.addEventListener('DOMContentLoaded', o);
75  })();
76
77  // Function to open the chatbot if #askpos is present in the URL
78  window.openChatIfAskposExists = function () {
79    if (window.location.hash === '#AskPos' || window.location.hash === '#askpos') {
80      window.openSprinklrChat();
81    }
82  };
83
84  // Function to open Sprinklr chat widget
85  window.openSprinklrChat = function () {
86    if (window.sprChat) {
87      if (typeof window.sprChatRequestNotificationPermission === 'function') {
88        window.sprChatRequestNotificationPermission();
89      }
90      if (typeof window.sprChatPrimeNotificationSound === 'function') {
91        window.sprChatPrimeNotificationSound();
92      }
93      window.sprChat('open');
94    } else {
95      // eslint-disable-next-line no-console
96      console.error('Sprinklr chat function not found.');
97    }
98  };
99
100  // Debug helper to test notification manually
101  window.testNotification = function () {
102    if (typeof window.sprChatTestNotification === 'function') {
103      window.sprChatTestNotification();
104    }
105  };
106
107  document.addEventListener('DOMContentLoaded', window.openChatIfAskposExists);
108
109  // Qualtrics Site Intercept
110  if (shouldLoadMarketingScripts) {
111    (function () {
112    var g = function (e, h, f, g) {
113      this.get = function (a) {
114        for (var a = a + '=', c = document.cookie.split(';'), b = 0, e = c.length; b < e; b++) {
115          for (var d = c[b]; ' ' == d.charAt(0); ) d = d.substring(1, d.length);
116          if (0 == d.indexOf(a)) return d.substring(a.length, d.length);
117        }
118        return null;
119      };
120
121      this.set = function (a, c) {
122        var b = '',
123          b = new Date();
124        b.setTime(b.getTime() + 6048e5);
125        b = '; expires=' + b.toGMTString();
126        document.cookie = a + '=' + c + b + '; path=/; ';
127      };
128
129      this.check = function () {
130        var a = this.get(f);
131        if (a) a = a.split(':');
132        else if (100 != e)
133          'v' == h && (e = Math.random() >= e / 100 ? 0 : 100), (a = [h, e, 0]), this.set(f, a.join(':'));
134        else return !0;
135        var c = a[1];
136        if (100 == c) return !0;
137        switch (a[0]) {
138          case 'v':
139            return !1;
140          case 'r':
141            return (c = a[2] % Math.floor(100 / c)), a[2]++, this.set(f, a.join(':')), !c;
142        }
143        return !0;
144      };
145
146      this.go = function () {
147        if (this.check()) {
148          var a = document.createElement('script');
149          a.type = 'text/javascript';
150          a.src = g;
151          document.body && document.body.appendChild(a);
152        }
153      };
154
155      this.start = function () {
156        var t = this;
157        'complete' !== document.readyState
158          ? window.addEventListener
159            ? window.addEventListener(
160                'load',
161                function () {
162                  t.go();
163                },
164                !1
165              )
166            : window.attachEvent &&
167              window.attachEvent('onload', function () {
168                t.go();
169              })
170          : t.go();
171      };
172    };
173
174    try {
175      new g(
176        100,
177        'r',
178        'QSI_S_ZN_3DWaLmeGxRdMlZI',
179        'https://zn3dwalmegxrdmlzi-posvoc.siteintercept.qualtrics.com/SIE/?Q_ZID=ZN_3DWaLmeGxRdMlZI'
180      ).start();
181    } catch (i) {}
182    })();
183  }
184
185  // Bind AskPos links (elements may be injected by Angular after DOMContentLoaded)
186  document.addEventListener('DOMContentLoaded', function () {
187    var tempInterval = setInterval(function () {
188      var tempButton = document.getElementById('linkAskPos');
189
190      if (tempButton) {
191        tempButton.addEventListener('click', function () {
192          window.sprChat('open');
193        });
194
195        clearInterval(tempInterval);
196      }
197    }, 100);
198
199    var tempIntervalChatWithUs = setInterval(function () {
200      var tempButtonChatWithUs = document.getElementById('chatWithUs');
201
202      if (tempButtonChatWithUs) {
203        tempButtonChatWithUs.addEventListener('click', function () {
204          window.sprChat('open');
205        });
206
207        clearInterval(tempIntervalChatWithUs);
208      }
209    }, 100);
210
211    var tempIntervalChatWithUsMobile = setInterval(function () {
212      var tempButtonChatWithUsMobile = document.getElementById('chatWithUsMobile');
213
214      if (tempButtonChatWithUsMobile) {
215        tempButtonChatWithUsMobile.addEventListener('click', function () {
216          window.sprChat('open');
217        });
218
219        clearInterval(tempIntervalChatWithUsMobile);
220      }
221    }, 100);
222  });
223})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.