PageSourceSearch

https://www.staysure.co.uk/scripts/cxone-chat-script.js

js staysure.co.uk collected 2026-09-24 20:33:08 UTC 15,996 bytes, 375 lines download raw bytes

1(function () {
2  const isMobileOrTablet = () => {
3    const ua = navigator.userAgent;
4
5    const isMobileUA = /Android|iPhone|iPad|iPod/i.test(ua);
6
7    const isIPadOS =
8      navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1;
9
10    const isTouchDevice =
11      navigator.maxTouchPoints > 0 &&
12      window.matchMedia("(pointer: coarse)").matches;
13
14    return isMobileUA || isIPadOS || isTouchDevice;
15  };
16
17  const CUSTOMER_AND_AGENT_MESSAGE_BUBBLE_LINE_HEIGHT = isMobileOrTablet()
18    ? "24px"
19    : "27px";
20
21  const CUSTOMER_AND_AGENT_MESSAGE_BUBBLE_MAX_WIDTH = isMobileOrTablet()
22    ? "100%"
23    : "350px";
24
25  const CUSTOMER_AND_AGENT_MESSAGE_BUBBLE_FONT_SIZE = isMobileOrTablet()
26    ? "16px"
27    : "18px";
28
29  const TEXTAREA_AND_PLACEHOLDER_FONT_SIZE = isMobileOrTablet()
30    ? "16px"
31    : "18px";
32
33  const TEXTAREA_AND_PLACEHOLDER_LINE_HEIGHT = isMobileOrTablet()
34    ? "24px"
35    : "27px";
36
37  (function (n, u) {
38    (window.CXoneDfo = n),
39      (window[n] =
40        window[n] ||
41        function () {
42          (window[n].q = window[n].q || []).push(arguments);
43        }),
44      (window[n].u = u),
45      (e = document.createElement("script")),
46      (e.type = "module"),
47      (e.src = u + "?" + Math.round(Date.now() / 1e3 / 3600)),
48      document.head.appendChild(e);
49  })(
50    "cxone",
51    "https://web-modules-de-uk1.niceincontact.com/loader/1/loader.js"
52  );
53
54  cxone("init", "1386");
55  cxone("guide", "init");
56  cxone("guide", "setButtonSize", "80px");
57  cxone("guide", "setDesiredGuideWidth", "28.0625em");
58  cxone("guide", "setDesiredGuideHeight", "55em");
59  cxone("chat", "hidePreSurvey");
60  cxone("chat", "autoStartSession");
61  cxone("chat", "showSendButton");
62  cxone("chat", "sendFirstMessageAutomatically", "Let's get started");
63  cxone("chat", "showCustomerAvatar");
64  cxone("chat", "setTranslation", "replyBoxPlaceholder", "Type a message");
65
66  // Apply Custom Styles AFTER chat loads
67  cxone("chat", "setCustomCss",`
68          @font-face {
69            font-family: 'Proxima Nova';
70            font-style: normal;
71            font-weight: 400;
72            font-display: swap;
73            src: url('/fonts/proxima-nova/ProximaNova-Regular.woff2') format('woff2'),
74                url('/fonts/proxima-nova/ProximaNova-Regular.woff') format('woff');
75        }
76
77        @font-face {
78            font-family: 'Proxima Nova';
79            font-style: normal;
80            font-weight: 600;
81            font-display: swap;
82            src: url('/fonts/proxima-nova/ProximaNova-Semibold.woff2') format('woff2'),
83                url('/fonts/proxima-nova/ProximaNova-Semibold.woff') format('woff');
84        }
85        @import url('https://use.typekit.net/nwl1eft.css');
86        :root {
87            --font-family-Proxima-Nova: 'Proxima Nova';
88            --font-weight-regular: 400;
89            --font-weight-semibold: 600;
90            --font-size-4XS: 12px;
91            --font-size-3XS: 14px;
92            --font-size-2XS: 16px;
93            --font-size-XS: 18px;
94            --line-height-16: 16px;
95            --line-height-18: 18px;
96            --line-height-21: 21px;
97            --line-height-24: 24px;
98            --line-height-27: 27px;
99            --Text-primary: #272427;
100            --Text-body: #2E2E2E;
101            --Text-disabled: #616161;
102            --Text-placeholder: #4F4F4F;
103            --Surface-Accent-1-Primary: #522367;
104            --Radius-Full: 120px;
105            --Spacing-XXS: 4px;
106            --Size-L: 40px;
107        }
108
109        [data-selector="HEADER_ACTION_MENU_BUTTON"] {
110            margin-right: 12px !important;
111        }
112
113        [data-selector="AGENT_MESSAGE"] .MessageContent_Message__AyydE {
114            margin-top: 4px !important;
115        }
116
117        .be-icon-resolved {
118            font-size: 0 !important;
119            line-height: 0 !important;
120            color: transparent !important;
121            display: inline-block !important;
122            background-repeat: no-repeat !important;
123            background-size: contain !important;
124            background-position: center !important;
125            background-image: none !important;
126        }
127
128        [data-selector="HEADER"] {
129           background-color: var(--Surface-Accent-1-Primary, #522367) !important;
130           height: 46px !important;
131           padding: 8px 16px !important;
132        }
133
134        [data-selector="GUIDE_SINGLE_MENU_CLOSE_BUTTON"] {
135            background-color: var(--Surface-Accent-1-Primary, #522367) !important;
136        }
137
138        [data-selector="ACTIVITY_BAR"] {display: none !important;}
139
140        [data-selector="AVATAR"] {
141            background-color: #4F4F4F !important;
142            display: flex !important;
143            width: 24px !important;
144            height: 24px !important;
145            padding: 10px !important;
146            justify-content: center !important;
147            align-items: center !important;
148            gap: 10px !important;
149            aspect-ratio: 1 / 1 !important;
150            border-radius: var(--Radius-Full, 120px) !important;
151            background-repeat: no-repeat !important;
152            background-position: center !important;
153            background-size: 19px 19px !important;
154            /* data-uri SVG (fill color encoded as %23 for '#') */
155            background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='19' height='19' viewBox='0 0 19 19' fill='none'><path d='M12.6667 5.54167C12.6667 7.29057 11.2489 8.70833 9.49999 8.70833C7.75109 8.70833 6.33333 7.29057 6.33333 5.54167C6.33333 3.79276 7.75109 2.375 9.49999 2.375C11.2489 2.375 12.6667 3.79276 12.6667 5.54167Z' fill='%23FFFFFF'/><path d='M15.0417 16.625V15.0417C15.0417 14.2018 14.708 13.3964 14.1142 12.8025C13.5203 12.2086 12.7148 11.875 11.875 11.875H7.12499C6.28514 11.875 5.47969 12.2086 4.88582 12.8025C4.29196 13.3964 3.95833 14.2018 3.95833 15.0417V16.625H15.0417Z' fill='%23FFFFFF'/></svg>") !important;
156        }
157
158        [data-selector="AVATAR"] img {
159            display: none;
160        }
161
162        [data-selector="CUSTOMER_MESSAGE"] .popup-content {
163            display: none !important;
164        }
165
166         div.MessageContent_Message__AyydE {
167            margin-top: 4px !important;
168        }
169
170        [data-selector="SCROLL_BOX_CONTENT"] {
171            padding: 12px 16px 8px 16px !important;
172        }
173
174        [data-selector="CUSTOMER_MESSAGE_BUBBLE"] {
175            background: #E3D6F1 !important;
176            font-size: ${CUSTOMER_AND_AGENT_MESSAGE_BUBBLE_FONT_SIZE} !important;
177            font-weight: var(--font-weight-regular, 400) !important;
178            color: var(--Text-body, #2E2E2E) !important;
179            font-family: var(--font-family-Proxima-Nova, "Proxima Nova") !important;
180            font-style: normal !important;
181            line-height: ${CUSTOMER_AND_AGENT_MESSAGE_BUBBLE_LINE_HEIGHT} !important;
182            border-bottom-right-radius: 0 !important;
183            padding: 10px !important;
184            margin-right: 0 !important;
185            margin-left: 0 !important;
186            box-sizing: border-box !important;
187        }
188
189        [data-selector="AGENT_MESSAGE_BUBBLE"], [data-selector="QUICK_REPL
189IES"] ._zfKCt {
190            background: #F0F0F0 !important;
191            font-family: var(--font-family-Proxima-Nova, "Proxima Nova") !important;
192            font-weight: var(--font-weight-regular, 400) !important;
193            font-style: normal !important;
194            padding: 10px !important;
195            margin-right: 0 !important;
196            margin-left: 0 !important;
197            font-size: ${CUSTOMER_AND_AGENT_MESSAGE_BUBBLE_FONT_SIZE} !important;
198            line-height: ${CUSTOMER_AND_AGENT_MESSAGE_BUBBLE_LINE_HEIGHT} !important;
199            letter-spacing: 0 !important;
200            border-bottom-left-radius: 0 !important;
201            color: var(--Text-body, #2E2E2E) !important;
202            max-width: ${CUSTOMER_AND_AGENT_MESSAGE_BUBBLE_MAX_WIDTH} !important;
203        }
204
205        [data-selector="SEND_BUTTON"] {
206            background: #F6B052 !important;
207            opacity: 1 !important;
208            background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none"><g clip-path="url(%23clip0_146_4921)"><path d="M18.3333 1.66667L9.16666 10.8333M18.3333 1.66667L12.5 18.3333L9.16666 10.8333M18.3333 1.66667L1.66666 7.5L9.16666 10.8333" stroke="%23272427" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></g><defs><clipPath id="clip0_146_4921"><rect width="20" height="20" fill="white"/></clipPath></defs></svg>') !important;
209            background-repeat: no-repeat !important;
210            background-position: center !important;
211            background-size: 16.67px 16.67px !important;
212            color: var(--Text-body, #2E2E2E) !important;
213            height: 40px !important;
214            width: 40px !important;
215            margin-left: 8px !important;
216        }
217
218        [data-selector="SEND_BUTTON"] > * {
219            display: none !important;
220        }
221
222        [data-selector="UPLOAD_ATTACHMENT_BUTTON"] {
223            opacity: 1 !important;
224            color: rgba(79,79,79,1) !important;
225            background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="21" height="22" viewBox="0 0 21 22" fill="none"><path d="M20.1883 9.79576L10.9983 18.9858C9.87249 20.1116 8.34552 20.7441 6.75334 20.7441C5.16115 20.7441 3.63418 20.1116 2.50834 18.9858C1.38249 17.8599 0.75 16.3329 0.75 14.7408C0.75 13.1486 1.38249 11.6216 2.50834 10.4958L11.0783 1.92576C11.8289 1.17387 12.8474 0.750939 13.9098 0.750002C14.9722 0.749064 15.9914 1.1702 16.7433 1.92076C17.4952 2.67132 17.9182 3.68983 17.9191 4.75223C17.92 5.81462 17.4989 6.83387 16.7483 7.58576L8.15834 16.1558C7.78306 16.531 7.27406 16.7419 6.74334 16.7419C6.21261 16.7419 5.70362 16.531 5.32834 16.1558C4.95306 15.7805 4.74222 15.2715 4.74222 14.7408C4.74222 14.21 4.95306 13.701 5.32834 13.3258L13.8183 4.84576" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>') !important;
226            background-repeat: no-repeat !important;
227            background-position: center !important;
228            height: 24px !important;
229            width: 24px !important;
230        }
231
232        [data-selector="UPLOAD_ATTACHMENT_BUTTON"]::before,
233        [data-selector="UPLOAD_ATTACHMENT_BUTTON"]::after,
234        [data-selector="UPLOAD_ATTACHMENT_BUTTON"] > * {
235            display: none !important;
236            opacity: 0 !important;
237            content: none !important;
238        }
239
240        [data-selector="REPLY_BOX"] {
241            height: 64px !important;
242        }
243
244       div[data-selector="MESSAGE_STATUS_LINE"], 
245        div.MessageStatusLineLegacy_StatusLine__1to6x {
246            margin-top:0px !important;
247            position: relative !important;
248        }
249
250        [data-selector="SCROLL_DOWN_UNREAD_BADGE"] {
251            font-family: var(--font-family-Proxima-Nova, "Proxima Nova") !important;
252            font-size: 12px !important;
253            font-style: normal !important;
254            font-weight: 400 !important;
255            line-height: 16px !important;
256            background: rgba(202,48,43,1);
257        }
258
259        [data-selector="MESSAGE_TIMESTAMP"] {
260            margin:12px 0px 8px 0px !important;
261            display: block !important;
262            text-align: center !important;
263            width: 100% !important;
264            color: var(--Text-disabled, #616161) !important;
265            font-family: var(--font-family-Proxima-Nova, "Proxima Nova") !important;
266            font-size: var(--font-size-4XS, 12px) !important;
267            font-style: normal !important;
268            font-weight: 400 !important;
269            line-height: var(--line-height-16, 16px) !important;
270            position: relative !important;
271            left: 50% !important;
272            transform: translateX(-50%) !important;
273            white-space: nowrap !important;
274        }
275
276        [data-selector="TEXTAREA"] {
277            color: var(--Text-placeholder, #4F4F4F) !important;
278            font-family: var(--font-family-Proxima-Nova, "Proxima Nova") !important;
279            font-size: ${TEXTAREA_AND_PLACEHOLDER_FONT_SIZE} !important;
280            font-style: normal !important;
281            font-weight: var(--font-weight-regular, 600) !important;
282            line-height: ${TEXTAREA_AND_PLACEHOLDER_LINE_HEIGHT} !important;
283        }
284
285        [data-selector="TEXTAREA"]::placeholder {
286            color: var(--Text-placeholder, #4F4F4F) !important;
287            font-family: var(--font-family-Proxima-Nova, "Proxima Nova") !important;
288            font-weight: var(--font-weight-regular, 400) !important;
289            font-style: normal !important;
290            font-size: ${TEXTAREA_AND_PLACEHOLDER_FONT_SIZE} !important;
291            line-height: ${TEXTAREA_AND_PLACEHOLDER_LINE_HEIGHT} !important;
292            letter-spacing: 0px !important;
293            opacity: 1 !important;
294        }
295
296        [data-selector="FORM_FIELD_CONTAINER"] {
297            padding-top: 0 !important;
298            padding-left: 16px !important;
299            padding-right: 16px !important;
300        }
301
302        [data-selector="QUICK_REPLY_BUTTON"] {
303            font-family: var(--font-family-Proxima-Nova, "Proxima Nova") !important;
304            font-weight: var(--font-weight-semibold, 600) !important;
305            font-style: normal !important;
306            font-size: var(--font-size-XS, 18px) !important;
307            line-height: var(--line-height-27, 27px) !important;
308            letter-spacing: 0px !important;
309            text-align: center !important;
310            vertical-align: middle !important;
311            color: #272427 !important;
312            height: 40px !important;
313            gap: 4px !important;
314            opacity: 1 !important;
315            border-radius: 999px !important;
316            border-width: 1.5px !important;
317            border-style: solid !important;
318            padding: 8px 16px !important;
319            background: #FFD050  !important;
320            box-sizing: border-box !important;
321        }
322
323        [data-selector="QUICK_REPLIES"] {
324            display: flex !important;
325            flex-wrap: wrap !important;
326            gap: var(--Spacing-XXS, 4px) !important;
327            padding: 8px 0 !important;
328            box-sizing: border-box !important;
329            }
330
331        [data-selector="QUICK_REPLIES"] button,
332        [data-selector="QUICK_REPLIES"] ._aRHTb {
333            display: flex !important;
334            height: var(--Size-L, 40px) !important;
335            padding: 11px 14.5px !important;
336            justify-content: center !important;
337            align-items: center !important;
338            gap: var(--Spacing-XXS, 4px) !important;
339            border-radius: var(--Radius-Full, 120px) !important;
340            background: #F6B052 !important;
341            color: var(--Text-primary, #272427) !important;
342            text-align: center !important;
343            font-family: var(--font-family-Proxima-Nova, 'Proxima Nova') !important;
344            font-size: var(--font-size-XS, 18px) !important;
345            font-style: normal !important;
346            font-weight: var(--font-weight-semibold, 600) !important;
347            line-height: var(--line-height-27, 27px) !important;
348            white-space: nowrap !important;
349            box-sizing: border-box !important;
350            border: none !important;
351            cursor: pointer !important;
352        }
353
354        \`;
355      })());
356  
357        // Visibility change listener to minimize chat
358        window.addEventListener("beforeunload", function () {
359            console.log('Before unload triggered');
360          
361              if (window.cxone) {
362                const minimizeBtn = document.querySelector(
363                  '[data-selector="GUIDE_SINGLE_MENU_CLOSE_BUTTON"]'
364              );
365              if (minimizeBtn) {
366                  console.log("Minimizing CXone chat");
367                  minimizeBtn.click();
368              }
369          }
370        
371        });
372      `
373  );
374})();
375

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.