1var hour = new Date().getHours(); 2 3if (hour >= 10 && hour < 17){ 4 5 // code... 6 7 8 9// NOTE: MAKE SURE YOU ARE USING v1.1.4!!!!!! 10 11 // Load the TalkJS library 12 (function(t,a,l,k,j,s){ 13 s=a.createElement('script');s.async=1;s.src="https://cdn.talkjs.com/talk.js";a.head.appendChild(s) 14 ;k=t.Promise;t.Talk={v:2,ready:{then:function(f){if(k)return new k(function(r,e){l.push([f,r,e])});l 15 .push([f])},catch:function(){return k&&new k()},c:l}};})(window,document,[]); 16 17 const notificationsSupported = !!(window.Notification && Notification.requestPermission) 18 19 // Define the chat options 20 // See next section for more details 21 // as an example we are includng here `customerRole` and `cookieOptions` but they are optional and can be removed 22 var COOSTO_WEBCHAT_OPTIONS = { 23 appId: 'Dr1BuJVu', 24 companyName: 'Fletcher Hotels', 25 companyLogo: 'https://www.fletcher.nl/data/images/1/3/2/0/9/1/logo_fletcher_hotels.png', 26 welcomeMessage: { 27 default: { 28 // the first entry in this 'default' section will be the one used as a 'last resort' option if the local can not be detected 29 'nl-NL': 'Wat leuk dat u ons een berichtje stuurt! Bedankt daarvoor. Wij proberen uw berichtje zo snel mogelijk te beantwoorden. Met vriendelijke groet, -Team Fletcher', 30 }, 31 }, 32 systemMessages: {}, 33 locale: navigator.language || 'nl-NL', 34 customerRole: 'default', 35 // cookieOptions: ';max-age=86400' 36 // notificationsEnabled: notificationsSupported 37 autoOpen: 'false', 38 // autoOpenDelay:5000, 39 // avoidAutoOpenOnClose: false, 40 // showCloseInHeader: false, 41 // customButton: { 42 // elementId: 'message_bubble', 43 // closeElementId: 'close_button' 44 // }, 45 // emailEnabled: true, 46 keepOpen: true, 47 launcher: 'always' // 'always', 'close-only', 'never' 48 } 49 50 // v1.1.4 51 !function(){"use strict";var e=function(e,t){this.talkJsInstance=e,this.options=t,this.cookiesOptions={popupClosed:!1}};function t(e,t,o){ 52 var s=e+"="+t;o&&(s+=";"+o),document.cookie=s}e.prototype.build=function(){this.participants=this.setupParticipants() 53 ;var e=new this.talkJsInstance.Session({appId:this.options.appId,me:this.participants.customerUser}) 54 ;e.setDesktopNotificationEnabled(this.options.notificationsEnabled);var t=this.setupConversation(e,this.participants) 55 ;return this.chatWindow=this.setupChatWindow(e,t),e},e.prototype.setupParticipants=function(){var e=this.options,t=e.customerId+"_"+e.locale;return{ 56 webCareUser:new this.talkJsInstance.User({id:e.appId+"_"+t,name:e.companyName,photoUrl:e.companyLogo,welcomeMessage:this.getWelcomeMessage(), 57 role:e.webCareAgentRole}),customerUser:new this.talkJsInstance.User({id:t,name:e.customerName,role:e.customerRole,locale:e.locale})}}, 58 e.prototype.setupConversation=function(e,t){this.conversationId=this.talkJsInstance.oneOnOneId(t.customerUser,t.webCareUser) 59 ;var o=e.getOrCreateConversation(this.conversationId),s={welcomeMessages:this.getSystemMessages(),custom:{url:window.location.href}} 60 ;return o.setAttributes(s),o.setParticipant(t.customerUser),o.setParticipant(t.webCareUser),o},e.prototype.setupChatWindow=function(e,t){ 61 var o=e.createPopup(t,{keepOpen:this.options.keepOpen,launcher:this.options.launcher,showCloseInHeader:this.options.showCloseInHeader}) 62 ;return o.mount({show:!1}),this.shouldAutoOpen()&&setTimeout((function(){o.show()}),this.options.autoOpenDelay),o.on("focus",(function(){o.select(t) 63 })),o},e.prototype.enableEmailFeature=function(e){if(this.options.emailEnabled){var t=this.options.customerRole,o=this.options.webCareAgentRole 64 ;if(t||o){var s=this.conversationId,n=this.participants.customerUser.id,i=this.options.cookieName;this.chatWindow.createHtmlPanel({ 65 url:"./email-form.html",height:130}).then((function(o){e?o.DOMContentLoadedPromise.then((function(){ 66 o.window.document.getElementById("register-form").addEventListener("submit",(function(e){o&&(o.hide(),o.window.saveForm(s,t,n,i),e.preventDefault()) 67 }))})):o.hide()})).catch((function(e){return console.log(e)}))}}},e.prototype.isMobile=function(){ 68 return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)},e.prototype.shouldAutoOpen=function(){ 69 if(this.options.avoidAutoOpenOnClose&&this.cookiesOptions.popupClosed)return!1;switch(this.options.autoOpen){case"mobileOnly":return this.isMobile() 70 ;case"desktopOnly":return!this.isMobile();case"always":return!0;case"never":default:return!1}},e.prototype.isValidObject=function(e){ 71 return"object"==typeof e&&Object.keys(e).length>0},e.prototype.getWelcomeMessage=function(){var e,t=this.options 72 ;if(!this.isValidObject(t.welcomeMessage))throw new Error("Invalid `welcomeMessage`");if(e=t.welcomeMessage.default||{}, 73 !this.isValidObject(e))throw new Error("Invalid `welcomeMessage.default`");var o=e[Object.keys(e)[0]] 74 ;if(t.welcomeMessage.urls&&"object"==typeof t.welcomeMessage.urls){var s=Object.keys(t.welcomeMessage.urls).find((function(e){ 75 return window.location.href.toLowerCase().includes(e.toLowerCase())}));if(s&&(e=t.welcomeMessage.urls[s], 76 !this.isValidObject(e)))throw new Error("Invalid `welcomeMessage for url`")}return e[t.locale]?e[t.locale]:o}, 77 e.prototype.getSystemMessages=function(){var e=this.options,t=e.systemMessages||{} 78 ;return t&&this.isValidObject(t)?t[e.locale]||t[Object.keys(t)[0]]:null},e.prototype.getChatWindow=function(){return this.chatWindow} 79 ;var o=function(e,t){void 0===e&&(e="COOKIE_STORE"),void 0===t&&(t=""),this.keyPrefix=e,this.cookieOptions=t};o.prototype._getCookieName=function(e){ 80 return this.keyPrefix+"_"+e},o.prototype.get=function(e){return function(e){for(var t=e+"=",o=document.cookie.split(";"),s=0,n=o.length;s<n;s++){ 81 for(var i=o[s];" "===i.charAt(0);)i=i.substring(1,i.length);if(0===i.indexOf(t))return i.substring(t.length,i.length)}return null 82 }(this._getCookieName(e))},o.prototype.set=function(e,o){return t(this._getCookieName(e),o,this.cookieOptions)},o.prototype.remove=function(e){ 83 return o=this._getCookieName(e),s=this.cookieOptions,n="expires=Thu, 01 Jan 1970 00:00:00 GMT",void t(o,"",s?s+"; "+n:n);var o,s,n};var s={appId:null, 84 companyName:"",companyLogo:null,webCareAgentRole:null,welcomeMessage:{},customerId:null,customerName:"Guest",customerRole:null, 85 notificationsEnabled:!1,autoOpen:"always",autoOpenDelay:5e3,avoidAutoOpenOnClose
85:!1,showCloseInHeader:!1,cookieName:"COOSTO_WEBCHAT",cookieOptions:"", 86 metadataPollInterval:6e4,lastMessageTimeThreshold:36e5,locale:"nl-NL",customButton:{elementId:"message_bubble",closeElementId:"close_button"}, 87 systemMessages:{},keepOpen:!1,launcher:"always",emailEnabled:!1},n=function(e,t){var n=Object.assign({},s,t);n.appId&&(this.talkJsInstance=e, 88 this.options=n,this.store=new o(this.options.cookieName,this.options.cookieOptions),this.session=null,this.initialize())},i={customerId:{ 89 configurable:!0},hasActiveConversation:{configurable:!0}};function a(){ 90 if(void 0!==window.Talk&&void 0!==window.COOSTO_WEBCHAT_OPTIONS)return new n(window.Talk,window.COOSTO_WEBCHAT_OPTIONS)}i.customerId.get=function(){ 91 if(this.options.customerId)return this.options.customerId;var e=this.store.get("USER_ID");return e||(e="_"+Math.random().toString(36).substr(2,9), 92 this.store.set("USER_ID",e)),e},i.hasActiveConversation.get=function(){var e=Number(this.store.get("LAST_MESSAGE")) 93 ;return!(!e||isNaN(e))&&(new Date).getTime()-e<this.options.lastMessageTimeThreshold},n.prototype.initialize=function(){var t=this 94 ;this.checkStatus().then((function(o){if(o||t.hasActiveConversation){var s=Object.assign({},t.options,{customerId:t.customerId 95 }),n=new e(t.talkJsInstance,s);n.cookiesOptions={popupClosed:t.store.get("TALKJS_POPUP_CLOSED")},t.session=n.build(),t.chatWindow=n.getChatWindow(), 96 t.session.on("message",(function(e){t.store.set("LAST_MESSAGE",e.timestamp)})),t.monitorChatAvailability(),t.handleMessageBubble(), 97 t.askUserForEmail(n),t.setPopupClosedCookie(),t.options.afterLoadHook&&t.options.afterLoadHook()}}))},n.prototype.setPopupClosedCookie=function(){ 98 if(this.options.avoidAutoOpenOnClose){var e=this.store;this.chatWindow.onClose((function(){e.set("TALKJS_POPUP_CLOSED",!0)}))}}, 99 n.prototype.askUserForEmail=function(e){var t=this.store.get("TALKJS_EMAIL");e.enableEmailFeature(!t)},n.prototype.checkStatus=function(){ 100 return this.talkJsInstance.getAppMetadata(this.options.appId).then((function(e){return!e.custom.closed}))},n.prototype.closeChat=function(){ 101 this.session&&this.session.getPopups().forEach((function(e){return e.destroy()}))},n.prototype.monitorChatAvailability=function(){var e=this 102 ;if(this.options.metadataPollInterval)var t=setInterval((function(){e.checkStatus().then((function(o){o||e.hasActiveConversation||(e.closeChat(), 103 clearInterval(t))}))}),this.options.metadataPollInterval)},n.prototype.handleMessageBubble=function(){ 104 var e="open",t=this.options.customButton.elementId,o=this.options.customButton.closeElementId,s=document.getElementById("__talkjs_launcher"),n=document.getElementById(t) 105 ;if(n&&"always"===this.options.launcher){n.style.display=s.classList.contains(e)?"none":"block";var i=this.chatWindow 106 ;n.addEventListener("click",(function(){i.show()}));var a=s.classList.contains(e),r=new MutationObserver((function(t){t.forEach((function(t){ 107 if("class"===t.attributeName){var o=t.target.classList.contains(e);a!==o&&(a=o,n.style.display=o?"none":"block")}}))}));r.observe(s,{attributes:!0}) 108 ;var c=document.getElementById(o);c&&c.addEventListener("click",(function(e){n.style.display="none",r.disconnect(),e.stopPropagation()}))}}, 109 Object.defineProperties(n.prototype,i),window.addEventListener("load",a),"complete"===document.readyState&&a()}(); 110 111 }
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.