var yj_ANIM_SPEED = 300; navigator.serviceWorker.register('https://yakajack.io/sw.js'); navigator.serviceWorker.onmessage = function (e) { if (e.data.url.indexOf('agent-console') >= 0) { if (e.data.data && e.data.data.chatkey) { $('#nav-item-' + e.data.data.chatkey).trigger('click'); } } } class DesktopNotifications { static isAvailable = function () { return (window.Notification != null); } static isEnabled = function () { return (Notification.permission === 'granted'); } static requestPermission = function () { return new Promise(function (resolve) { Notification.requestPermission() .then(function (permission) { if (permission === 'granted') { resolve(true); } else { resolve(false); } }); }); } static send = function (title, body, url, additionalData) { navigator.serviceWorker.ready .then(function (registration) { var notif = registration.showNotification(title, { body: body, icon: 'https://yakajack.io/img/YakaJack_512px.png', silent: false, vibrate: [200, 100, 200, 100, 200, 100], data: { url: url, data: additionalData } }); }); } } function sendDesktopNotification(title, body, url, additionalData) { if (DesktopNotifications.isAvailable()) { if (DesktopNotifications.isEnabled()) { DesktopNotifications.send(title, body, url, additionalData); } else { DesktopNotifications.requestPermission() .then(function (result) { if (result) { DesktopNotifications.send(title, body, url, additionalData); } else { console.warn('Desktop notifications were denied or ignored. In order to see desktop notifications for new chats, etc., please allow the permission in your browser.'); } }); } } else { console.warn('Desktop notifications are not available in this browser. We recommend you upgrade your browser.'); } } function getAdditionalFeature(item, isAvailable, title, text, reditrectTo) { if (isAvailable) { if ($(item).attr('data-navigateto')) window.location.href = $(item).attr('data-navigateto'); else window.location.href = $(item).attr('href'); } else { new modalOptions({ title: title, text: text + ' But you can get more by either uprading your package or paying to get extra.

What would you like to do?', text: text + ' You can either buy additional websites or upgrade your package.', opt1: 'Upgrade Package', opt2: 'Purchase Additional Websites' }) .action1(function () { window.location.href = 'https://yakajack.io/account/features/upgrade.aspx'; }) .action2(function () { window.location.href = reditrectTo; }); } } function htmlDecode(encodedString) { return $('
').html(encodedString).text(); } function htmlEncode(decodedString) { return $('
').text(decodedString).html(); } function scrollTo(ele, additionalOffset, useParent) { if (additionalOffset == undefined) { additionalOffset = 0; } if (useParent == undefined) { useParent = false; } _useParent = false; if ((typeof (useParent) === 'boolean' && useParent) || typeof(useParent) === 'string') { _useParent = true; } if (_useParent) { var parent = null; if (typeof (useParent) === 'boolean') { parent = $(ele).parent(); } else { parent = $(ele).closest(useParent); } $(parent).animate({ scrollTop: $(ele).offset().top - additionalOffset }); } else { $('html,body').animate({ scrollTop: $(ele).offset().top - additionalOffset }); } } var ajaxParams = { url: 'https://yakajack.io/api/ajax.asmx/', type: 'post', contentType: 'application/json; charset=utf-8', data: JSON.stringify({}), dataType: 'json', sync: false, async: true }; function formatJSONResponse(data) { data = $.parseJSON(data.d); info = $.parseJSON(data.info); data.info = info; if (data.error == 'USER NOT AUTHED') { data.error = 'none'; new modalAlert({ title: 'Not Logged In', text: 'Sorry, but we have had a problem checking if you are logged in or not.

You will be asked to log back in and will then be redirected back here.' }) .ok(function () { window.location.href = 'https://yakajack.io/account/login.aspx?ref=' + encodeURI(window.location.href); }); } return data; } function configureAJAXParams(mthd, params) { var _ajaxParams = JSON.parse(JSON.stringify(ajaxParams)); _ajaxParams.url += mthd; _ajaxParams.data = JSON.stringify(params); return _ajaxParams; } // JavaScript autoComplete v1.0.4 // https://github.com/Pixabay/JavaScript-autoComplete var autoComplete=function(){function e(e){function t(e,t){return e.classList?e.classList.contains(t):new RegExp("\\b"+t+"\\b").test(e.className)}function o(e,t,o){e.attachEvent?e.attachEvent("on"+t,o):e.addEventListener(t,o)}function s(e,t,o){e.detachEvent?e.detachEvent("on"+t,o):e.removeEventListener(t,o)}function n(e,s,n,l){o(l||document,s,function(o){for(var s,l=o.target||o.srcElement;l&&!(s=t(l,e));)l=l.parentElement;s&&n.call(l,o)})}if(document.querySelector){var l={selector:0,source:0,minChars:3,delay:150,offsetLeft:0,offsetTop:1,cache:1,menuClass:"",renderItem:function(e,t){t=t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&");var o=new RegExp("("+t.split(" ").join("|")+")","gi");return'
'+e.replace(o,"$1")+"
"},onSelect:function(){}};for(var c in e)e.hasOwnProperty(c)&&(l[c]=e[c]);for(var a="object"==typeof l.selector?[l.selector]:document.querySelectorAll(l.selector),u=0;u0?i.sc.scrollTop=n+i.sc.suggestionHeight+s-i.sc.maxHeight:0>n&&(i.sc.scrollTop=n+s)}else i.sc.scrollTop=0},o(window,"resize",i.updateSC),document.body.appendChild(i.sc),n("autocomplete-suggestion","mouseleave",function(){var e=i.sc.querySelector(".autocomplete-suggestion.selected");e&&setTimeout(function(){e.className=e.className.replace("selected","")},20)},i.sc),n("autocomplete-suggestion","mouseover",function(){var e=i.sc.querySelector(".autocomplete-suggestion.selected");e&&(e.className=e.className.replace("selected","")),this.className+=" selected"},i.sc),n("autocomplete-suggestion","mousedown",function(e){if(t(this,"autocomplete-suggestion")){var o=this.getAttribute("data-val");i.value=o,l.onSelect(e,o,this),i.sc.style.display="none"}},i.sc),i.blurHandler=function(){try{var e=document.querySelector(".autocomplete-suggestions:hover")}catch(t){var e=0}e?i!==document.activeElement&&setTimeout(function(){i.focus()},20):(i.last_val=i.value,i.sc.style.display="none",setTimeout(function(){i.sc.style.display="none"},350))},o(i,"blur",i.blurHandler);var r=function(e){var t=i.value;if(i.cache[t]=e,e.length&&t.length>=l.minChars){for(var o="",s=0;st||t>40)&&13!=t&&27!=t){var o=i.value;if(o.length>=l.minChars){if(o!=i.last_val){if(i.last_val=o,clearTimeout(i.timer),l.cache){if(o in i.cache)return void r(i.cache[o]);for(var s=1;s