if (typeof sbjs === 'undefined') {
/** sourcebuster v1.0.5 **/
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var r;"undefined"!=typeof window?r=window:"undefined"!=typeof global?r=global:"undefined"!=typeof self&&(r=self),r.sbjs=e()}}(function(){return function e(r,t,s){function n(a,i){if(!t[a]){if(!r[a]){var c="function"==typeof require&&require;if(!i&&c)return c(a,!0);if(o)return o(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var p=t[a]={exports:{}};r[a][0].call(p.exports,function(e){var t=r[a][1][e];return n(t?t:e)},p,p.exports,e,r,t,s)}return t[a].exports}for(var o="function"==typeof require&&require,a=0;a0))return x=a.getHost(e),!0;for(var r=0;r0)for(var o=0;o0)for(var a=0;a=5 && currentHours<11) {
return this.greetingMessageAll[1];
} else if (currentHours>=11 && currentHours<16) {
return this.greetingMessageAll[2];
} else {
return this.greetingMessageAll[3];
}
},
chat_greeting_online: 'Вітаю! Чим можемо бути корисні!',
chat_greeting_offline: 'Будь ласка, залишіть своє повідомлення і ми з Вами звяжемося якнайшвидше!',
chat_header_open_online: 'Напишіть нам!',
chat_header_open_offline: 'Ми поза мережею!',
chat_subheader_open_online: 'Ми на зв\'язку',
chat_subheader_open_offline: 'Залишіть повідомлення',
chat_placeholder: 'Напишіть повідомлення і натисніть Enter!',
chat_operator_usersubtitle: 'Менеджер із комунікації',
chat_text_today: 'Сьогодні',
chat_operator_typing: 'Оператор пише повідомлення',
chat_lost_connect: 'Сервер не доступний',
chat_lost_reconnect: 'З\'єднання',
chat_lost_reload: 'Перевантажити сторінки',
workTimeBegin: new Date(),
workTimeEnd: new Date(),
prepareWorkTime: function () {
this.workTimeBegin.setUTCHours('6');
this.workTimeBegin.setUTCMinutes('00');
this.workTimeBegin.setUTCSeconds('00');
this.workTimeEnd.setUTCHours('15');
this.workTimeEnd.setUTCMinutes('00');
this.workTimeEnd.setUTCSeconds('00');
},
workDay: {
0: 0,
1: 1,
2: 1,
3: 1,
4: 1,
5: 1,
6: 0,
},
isWorkTime: function () {
if (LIRACRM.serverIsWorkTime == 0) {
return false;
} else {
return true;
}
},
checkWorkTime: function () {
LIRACRM.currentTime = new Date();
return (this.workDay[LIRACRM.currentTime.getDay()]
&& LIRACRM.currentTime >= this.workTimeBegin
&& LIRACRM.currentTime <= this.workTimeEnd);
},
cashVersion: '300',
defaultPrefix: '380',
defaultPlaceholder: 'Ваш номер телефону.',
placeLeft: 0,
placeRight: 1,
domain: 'service.voip.com.ua',
domain_callme: 'callme1.voip.com.ua',
socket_callme: 'callme2.voip.com.ua:10081',
statusUrl: '/script/status/',
callUrl: '/script/call/',
widgetDebugLevel: '1',
init: function () {
this.prepareWorkTime();
}
},
/* CallTracking Options */
ctOptions: {
token: '',
workTimeBegin: new Date(),
workTimeEnd: new Date(),
prepareWorkTime: function () {
this.workTimeBegin.setUTCHours('0');
this.workTimeBegin.setUTCMinutes('00');
this.workTimeBegin.setUTCSeconds('00');
this.workTimeEnd.setUTCHours('0');
this.workTimeEnd.setUTCMinutes('00');
this.workTimeEnd.setUTCSeconds('00');
},
workDay: {
0: 0,
1: 0,
2: 0,
3: 0,
4: 0,
5: 0,
6: 0,
},
isWorkTime: function () {
LIRACRM.currentTime = new Date();
return (this.workDay[LIRACRM.currentTime.getDay()]
&& LIRACRM.currentTime >= this.workTimeBegin
&& LIRACRM.currentTime <= this.workTimeEnd);
},
init: function () {
if (LIRACRM.widgetOptions.widgetDebugLevel > 4) {
console.log('init ct options');
};
this.prepareWorkTime();
}
},
/* Load JavaScript file */
loadScript: function (url, callback) {
var sc = document.getElementsByTagName("script");
var iA = sc[0];
var se = document.createElement("script");
se.type = "text/javascript";
se.async = true;
se.charset = "UTF-8";
iA.parentNode.insertBefore(se, iA).src = url;
se.onload = function() {
if (typeof callback === 'function') callback();
}
},
loadWidget: function () {
if ( (typeof this.widgetOptions.token === 'undefined' || !this.widgetOptions.token) && this.widgetOptions.hide_widget == 0) {
//throw "Widget not declared";
return;
};
if (this.widgetOptions.chatShow || LIRACRM.widgetOptions.widgetShow) {
this.loadScript('//callme1.voip.com.ua/lirawidget/supportwidget.js?rand=300' , function () {
});
}
// hide widget but keep connection by Websocket
if (this.widgetOptions.hide_widget == 1) {
this.loadScript('//callme1.voip.com.ua/lirawidget/supportwidget_hidden.js?rand=300' , function () {
});
}
},
loadModalWidget: function () {
if ( (typeof this.widgetOptions.token === 'undefined' || !this.widgetOptions.token) && this.widgetOptions.hide_widget == 0) {
//throw "Widget not declared";
return;
};
this.loadScript('//callme1.voip.com.ua/lirawidget/widgetpopup.js?rand=300', function () {
});
},
loadColorjs: function () {
if ( (typeof this.widgetOptions.token === 'undefined' || !this.widgetOptions.token) && this.widgetOptions.hide_widget == 0) {
//throw "Widget not declared";
return;
};
this.loadScript('//callme1.voip.com.ua/lirawidget/color.min.js?rand=300', function () {
LIRACRM.loadWidget();
});
},
loadCt: function (rand) {
if (typeof this.ctOptions.token === 'undefined' || !this.ctOptions.token) {
return;
};
if (rand === undefined) {
rand = 300;
};
var referrer = document.referrer,
url = document.URL,
clientId = this.ga.getClientId(),
token = this.ctOptions.token,
sessionId = this.ga.getSessionId(),
sbjs_current_src = sbjs.get.current.src,
sbjs_current_mdm = sbjs.get.current.mdm,
sbjs_current_cnt = sbjs.get.current.cnt,
sbjs_current_cmp = sbjs.get.current.cmp,
sbjs_current_trm = sbjs.get.current.trm;
function getFbClientId() {
let result = /_fbp=(fb\.1\.\d+\.\d+)/.exec(window.document.cookie);
if (!(result && result[1])) {
return null;
}
return result[1];
}
var fbp = getFbClientId();
var url_string = window.location.href;
var url = new URL(url_string);
var fbc = url.searchParams.get("fbclid");
if (sbjs_current_src == '(direct)' && sbjs_current_mdm == '(none)') {
if (fbc !== null && fbc.length > 1) {
sbjs_current_src = 'facebook.com';
sbjs_current_mdm = 'referral';
sbjs_current_trm = fbc;
}
}
if (fbp !== null && fbp.length > 1) {
sbjs_current_trm = sbjs_current_trm+'fbp='+fbp;
}
if (LIRACRM.cookie.get('roistat_visit') != undefined){
var roistat_visit = LIRACRM.cookie.get('roistat_visit');
} else {
var roistat_visit = "";
};
//console.log('referrer',referrer);
//console.log('url',url);
if (LIRACRM.widgetOptions.widgetDebugLevel > 4) {
console.log('load ct');
};
// * get yandex client id
if (LIRACRM.widgetOptions.yaCounter != '') {
var liraxYaCounter = 'yaCounter'+LIRACRM.widgetOptions.yaCounter;
var liraxYaCounterFunc = liraxYaCounter+'.getClientID()';
try{
var liraxYaClientId = eval(liraxYaCounterFunc);
}
catch(error)
{
liraxYaClientId = '';
}
} else { var liraxYaClientId = ''; }
if (lirax_custom_var === undefined || lirax_custom_var === null) {
var lirax_custom_var = '';
}
if (lirax_custom_var.length == 0 && localStorage.getItem('lirax_custom_var') !== null) {
lirax_custom_var = localStorage.getItem('lirax_custom_var');
}
this.loadScript('//callme1.voip.com.ua/lirawidget/script/ct/' + token +
'?rand=' + encodeURIComponent(rand) +
'&clientId=' + encodeURIComponent(clientId) +
'&sessionId=' + encodeURIComponent(sessionId) +
'&yaClientId=' + encodeURIComponent(liraxYaClientId) +
'&ct_c=' + encodeURIComponent(LIRACRM.cookie.get('liracrm_ct_c')) +
'&sbjs_current_src=' + encodeURIComponent(sbjs_current_src) +
'&sbjs_current_mdm=' + encodeURIComponent(sbjs_current_mdm) +
'&sbjs_current_cnt=' + encodeURIComponent(sbjs_current_cnt) +
'&sbjs_current_cmp=' + encodeURIComponent(sbjs_current_cmp) +
'&sbjs_current_trm=' + encodeURIComponent(sbjs_current_trm) +
'&roistat_visit=' + encodeURIComponent(roistat_visit) +
'&url=' + encodeURIComponent(url) +
'&referrer=' + encodeURIComponent(referrer) +
'&custom_lirax_var=' + encodeURIComponent(lirax_custom_var)
, function () {
});
},
/* Cookie */
cookie: {
set: function (name, value, options) {
options = options || {};
var expires = options.expires;
if (typeof expires == "number" && expires) {
var d = new Date();
d.setTime(d.getTime() + expires * 1000);
expires = options.expires = d;
};
if (expires && expires.toUTCString) {
options.expires = expires.toUTCString();
};
value = encodeURIComponent(value);
var updatedCookie = name + "=" + value;
for (var propName in options) {
updatedCookie += "; " + propName;
var propValue = options[propName];
if (propValue !== true) {
updatedCookie += "=" + propValue;
}
};
document.cookie = updatedCookie;
},
get: function (name) {
var matches = document.cookie.match(new RegExp(
"(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\/\+^])/g, '\$1') + "=([^;]*)"
));
return matches ? decodeURIComponent(matches[1]) : undefined;
}
},
/* Google Analytics */
ga: {
getClientId: function (callback) {
var clientId;
if (typeof (ga) !== "undefined") {
ga(function (tracker) {
clientId = tracker.get('clientId');
if (clientId !== undefined) {
if (typeof callback === 'function') callback();
};
});
if (clientId == undefined) {
ga(function() {
clientId = ga.getAll()[0].get('clientId');
if (typeof callback === 'function') callback();
});
};
} else if (clientId == undefined) {
let cookieName = "_ga=";
let allCookieArray = document.cookie.split(';');
for(var i = 0; i < allCookieArray.length; i++) {
let temp = allCookieArray[i].trim();
if (temp.indexOf(cookieName) == 0) {
clientId = temp.substring(cookieName.length,temp.length);
clientId = clientId.slice( clientId.indexOf('.', clientId.indexOf('.')+1)+1 );
}
}
}
if (clientId == undefined) {
clientId = document.cookie.match(/_ga=(.+?);/)[1].split('.').slice(-2).join(".");
};
return clientId;
},
getSessionId: function (callback) {
var sessionId;
const trackingId = this.getTrackingId();
const gaRegex = /^G-/;
const trimmedGaId = trackingId.replace(gaRegex, '');
const cookies = document.cookie.split(';');
const gaCookie = cookies.find(c => c.trim().startsWith('_ga_'+trimmedGaId+'='));
if (gaCookie) {
const gaValue = gaCookie.split('=')[1];
const gaValues = gaValue.split('.');
sessionId = gaValues[2];
} else {
sessionId = 0;
}
return sessionId;
},
getTrackingId: function () {
var trackingId = 'UA-167311959-1';
if (trackingId.length > 0) {
return trackingId;
} else if (typeof (ga) !== "undefined") {
ga(function (tracker) {
trackingId = tracker.get('trackingId');
});
if (trackingId == undefined) {
ga(function() {
trackingId = ga.getAll()[0].get('trackingId');
});
};
} else if (trackingId.length > 0) {
trackingId = tmp;
}
return trackingId;
}
},
replacePhone: function (phone = 'empty', liracrm_ct_c = 'empty', liracrm_phone = 'empty') {
if (LIRACRM.widgetOptions.widgetDebugLevel > 4) {
console.log(phone);
console.log(liracrm_ct_c);
};
if (phone == 'empty' || liracrm_ct_c == 'empty' || liracrm_phone == 'empty') {
phone = LIRACRM.ct_data.phone;
liracrm_ct_c = LIRACRM.ct_data.liracrm_ct_c;
liracrm_phone = LIRACRM.ct_data.liracrm_phone;
}
var liracrm_ct_phones = phone;
var liracrm_ct_phones_nomask = liracrm_phone;
var liracrm_ct_ids = liracrm_ct_c;
for (var i = 0; i < liracrm_ct_c.length; i++) {
if (i == 0 && liracrm_ct_c[i] != 0) {
jQuery("nkd").each(function () {
var ct_phone = jQuery(this);
var ct_phone_href = ct_phone.attr('href');
var ct_phone_parent = ct_phone.parent();
var ct_phone_parent_href = ct_phone.parent().attr('href');
var ct_phone_number = liracrm_ct_phones_nomask[i];
if (ct_phone_number.slice(0,1) != '0') {
ct_phone_number = '+'+ct_phone_number;
}
if (ct_phone_href) {
if (ct_phone_href.indexOf('tel:') !== -1 ) ct_phone.attr('href', 'tel:'+ct_phone_number);
if (ct_phone_href.indexOf('callto:') !== -1 ) ct_phone.attr('href', 'callto:'+ct_phone_number);
if (ct_phone_href.indexOf('callto:') == -1 && ct_phone_href.indexOf('tel:') == -1) ct_phone.attr('href', 'tel:+'+ct_phone_number);
}else if (ct_phone_parent_href) {
if (ct_phone_parent_href.indexOf('tel:') !== -1 ) ct_phone_parent.attr('href', 'tel:'+ct_phone_number);
if (ct_phone_parent_href.indexOf('callto:') !== -1 ) ct_phone_parent.attr('href', 'callto:'+ct_phone_number);
if (ct_phone_parent_href.indexOf('callto:') == -1 && ct_phone_parent_href.indexOf('tel:') == -1) ct_phone_parent.attr('href', 'tel:'+ct_phone_number);
};
jQuery('.lirax-hide').hide();
ct_phone.html(liracrm_ct_phones[i]);
})
} else {
if (liracrm_ct_c[i] != 0 && liracrm_ct_c[i] != null) {
jQuery("nkd-"+i).each(function () {
var ct_phone = jQuery(this);
var ct_phone_href = ct_phone.attr('href');
var ct_phone_parent = ct_phone.parent();
var ct_phone_parent_href = ct_phone.parent().attr('href');
var ct_phone_number = liracrm_ct_phones_nomask[i];
if (ct_phone_number.slice(0,1) != '0') {
ct_phone_number = '+'+ct_phone_number;
}
if (ct_phone_href) {
if (ct_phone_href.indexOf('tel:') !== -1 ) ct_phone.attr('href', 'tel:'+ct_phone_number);
if (ct_phone_href.indexOf('callto:') !== -1 ) ct_phone.attr('href', 'callto:'+ct_phone_number);
if (ct_phone_href.indexOf('callto:') == -1 && ct_phone_href.indexOf('tel:') == -1) ct_phone.attr('href', 'tel:'+ct_phone_number);
};
ct_phone.html(liracrm_ct_phones[i]);
})
};
};
};
LIRACRM.cookie.set('liracrm_ct_c', liracrm_ct_c, {
expires: new Date(new Date().getTime() + 12000 * 1000),
path: '/'
});
LIRACRM.ct_data.phone = phone
LIRACRM.ct_data.liracrm_ct_c = liracrm_ct_c
LIRACRM.ct_data.liracrm_phone = liracrm_phone
},
/* Initialization */
startLira: 0,
init: function () {
if (typeof(ga) == 'undefined' && LIRACRM.startLira == 0) {
LIRACRM.startLira++;
setTimeout(function () {
LIRACRM.init()
}, 500);
return;
};
if (typeof(jQuery) == 'undefined') {
if (!this.jQueryScriptOutputted) {
this.jQueryScriptOutputted = true;
this.loadScript('//ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js', function(){
LIRACRM.init();
});
};
/*setTimeout(function () {
LIRACRM.init()
}, 1000);*/
//return;
} else {
this.loadColorjs(function(){
});
/* UTM Set */
sbjs.init();
LIRACRM.widgetOptions.init();
this.loadModalWidget();
if (typeof (ga) !== "undefined") {
this.ga.getClientId(function() {
LIRACRM.ctOptions.init();
LIRACRM.loadCt();
});
} else if (typeof (gtag) !== "undefined") {
LIRACRM.ctOptions.init();
LIRACRM.loadCt();
} else {
LIRACRM.ctOptions.init();
LIRACRM.loadCt();
}
}
},
showWidget: function() {
jQuery("#liracrm-modal-callme").trigger('click');
}
};
if (typeof LIRAX != "undefined" && typeof LIRAX.widgetOptions != "undefined") {
for(var propertyName in LIRAX.widgetOptions) {
LIRACRM.widgetOptions[propertyName] = LIRAX.widgetOptions[propertyName];
};
LIRAX = LIRACRM;
} else {
var LIRAX = LIRACRM;
};
LIRACRM.init();