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 t;"undefined"!=typeof window?t=window:"undefined"!=typeof global?t=global:"undefined"!=typeof self&&(t=self),t.sbjs=e()}}(function(){return function e(t,r,n){function s(i,o){if(!r[i]){if(!t[i]){var c="function"==typeof require&&require;if(!o&&c)return c(i,!0);if(a)return a(i,!0);var u=new Error("Cannot find module '"+i+"'");throw u.code="MODULE_NOT_FOUND",u}var p=r[i]={exports:{}};t[i][0].call(p.exports,function(e){var r=t[i][1][e];return s(r?r:e)},p,p.exports,e,t,r,n)}return r[i].exports}for(var a="function"==typeof require&&require,i=0;i0))return k=a.getHost(e),!0;for(var t=0;t0)for(var a=0;a0)for(var i=0;i= this.workTimeBegin
&& LIRACRM.currentTime <= this.workTimeEnd);
},
defaultPrefix: '+380',
defaultPlaceholder: 'Номер телефона',
domain: 'service.voip.com.ua',
domain_callme: 'callme1.voip.com.ua',
statusUrl: '/script/status/',
callUrl: '/script/call/',
init: function () {
this.prepareWorkTime();
}
},
/* CallTracking Options */
ctOptions: {
token: '53e57a5b8715806449708e859e70f3a4',
workTimeBegin: new Date(),
workTimeEnd: new Date(),
prepareWorkTime: function () {
this.workTimeBegin.setUTCHours(2);
this.workTimeBegin.setUTCMinutes(59);
this.workTimeBegin.setUTCSeconds(00);
this.workTimeEnd.setUTCHours(20);
this.workTimeEnd.setUTCMinutes(59);
this.workTimeEnd.setUTCSeconds(00);
},
workDay: {
0: 1,
1: 1,
2: 1,
3: 1,
4: 1,
5: 1,
6: 1,
},
isWorkTime: function () {
LIRACRM.currentTime = new Date();
return (this.workDay[LIRACRM.currentTime.getDay()]
&& LIRACRM.currentTime >= this.workTimeBegin
&& LIRACRM.currentTime <= this.workTimeEnd);
},
init: function () {
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;
if (typeof callback === 'function') callback();
},
loadWidget: function () {
if (typeof this.widgetOptions.token === 'undefined' || !this.widgetOptions.token) {
//throw "Widget not declared";
return;
};
this.loadScript('//callme1.voip.com.ua/widget.base.dev.js?rand=296', function () {
LIRACRM.widgetOptions.init();
});
},
loadCt: function () {
if (typeof this.ctOptions.token === 'undefined' || !this.ctOptions.token) {
return;
};
var referrer = document.referrer,
url = document.URL,
clientId = this.ga.getClientId(),
token = this.ctOptions.token,
sbjs_current_src = sbjs.get.current.src,
sbjs_current_mdm = sbjs.get.current.mdm,
sbjs_current_cmp = sbjs.get.current.cmp,
sbjs_current_trm = sbjs.get.current.trm;
if (LIRACRM.cookie.get('roistat_visit') != undefined){
var roistat_visit = LIRACRM.cookie.get('roistat_visit');
} else {
var roistat_visit = "";
};
this.loadScript('//callme1.voip.com.ua/script/ct/' + token +
'?rand=296' +
'&referrer=' + encodeURIComponent(referrer) +
'&url=' + encodeURIComponent(url) +
'&clientId=' + encodeURIComponent(clientId) +
'&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_cmp=' + encodeURIComponent(sbjs_current_cmp) +
'&sbjs_current_trm=' + encodeURIComponent(sbjs_current_trm) +
'&roistat_visit=' + encodeURIComponent(roistat_visit)
, function () {
LIRACRM.ctOptions.init();
});
},
/* 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();
});
};
};
return clientId;
},
getTrackingId: function () {
var trackingId;
if (typeof (ga) !== "undefined") {
ga(function (tracker) {
trackingId = tracker.get('trackingId');
});
if (trackingId == undefined) {
ga(function() {
trackingId = ga.getAll()[0].get('trackingId');
});
};
};
return trackingId;
}
},
replacePhone: function (phone, liracrm_ct_c, liracrm_phone) {
console.log(phone);
console.log(liracrm_ct_c);
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) {
var ct_phone = jQuery(".ct-phone");
var ct_phone_href = ct_phone.attr('href');
if (ct_phone_href) {
if (ct_phone_href.indexOf('tel:') !== -1 ) ct_phone.attr('href', 'tel:+'+liracrm_ct_phones_nomask[i].replace('+',''));
if (ct_phone_href.indexOf('callto:') !== -1 ) ct_phone.attr('href', 'callto:+'+liracrm_ct_phones_nomask[i].replace('+',''));
if (ct_phone_href.indexOf('callto:') == -1 && ct_phone_href.indexOf('tel:') == -1) ct_phone.attr('href', 'tel:+'+liracrm_ct_phones_nomask[i].replace('+',''));
};
jQuery(".ct-phone").html(liracrm_ct_phones[i]);
} else {
if (liracrm_ct_c[i] != 0) {
var ct_phone = jQuery(".ct-phone-"+i);
var ct_phone_href = ct_phone.attr('href');
if (ct_phone_href) {
if (ct_phone_href.indexOf('tel:') !== -1 ) ct_phone.attr('href', 'tel:+'+liracrm_ct_phones_nomask[i].replace('+',''));
if (ct_phone_href.indexOf('callto:') !== -1 ) ct_phone.attr('href', 'callto:+'+liracrm_ct_phones_nomask[i].replace('+',''));
if (ct_phone_href.indexOf('callto:') == -1 && ct_phone_href.indexOf('tel:') == -1) ct_phone.attr('href', 'tel:+'+liracrm_ct_phones_nomask[i].replace('+',''));
};
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: '/'
});
},
/* Initialization */
init: function () {
if (typeof(ga) == 'undefined') {
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');
};
setTimeout(function () {
LIRACRM.init()
}, 50);
return;
};
/* UTM Set */
sbjs.init();
this.loadWidget();
this.ga.getClientId(function() {
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();