(function() {
this.inArray = [].indexOf || function(g) {
for (var f = 0, i = this.length; f < i; f++) {
if (f in this && this[f] === g) {
return f;
}
}
return -1;
};
this.glob = function(f) {
var l, k;
k = f.split(".");
l = window;
for (var j = 0, g = k.length; j < g; j++) {
a = k[j];
l[a] = l[a] || {};
l = l[a];
}
return l;
};
glob("em");
this.self = em;
self.DEBUG = false;
// self.DOMAIN = self.DEBUG ? "cbh.dev" : "trapu.com";
self.DOMAIN = self.DEBUG ? "cbh.dev" : "callbackhero.com";
self.JQUERY_URL = "//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js";
self.JS_CDN = "//" + self.DOMAIN + "/js/";
self.PUBLIC_SERVER = "//" + self.DOMAIN + "/";
self.JQUERY_VERSIONS = "1.11.2 1.11.1 1.11.0 1.10.2 1.10.1 1.10.0 1.9.1 1.9.0".split(" ");
self.LAST_SPEED = self.LEAVE_POINT = self.LAST_Х_POSITION = self.LAST_Y_POSITION = 0;
self.timer = 27000;
self.activity = 0;
self.clock = null;
self.stat = {
x: null,
y: null,
s: null,
t: 0,
a: 0,
l: 0
};
self.total_time = 0;
self.last_visit_timeout = 0;
self.beforeOpenWidget = null;
h = _emv.key;
self.cc = "__cbh_" + h;
self.ct = "__cbh_timeout_" + h;
self.cg = "__cbh_guid_" + h;
(function(k, l, q, p, n, j, f) {
k.GoogleAnalyticsObject = n;
k[n] = k[n] || function() {
(k[n].q = k[n].q || []).push(arguments);
}, k[n].l = 1 * new Date();
j = l.createElement(q), f = l.getElementsByTagName(q)[0];
j.async = 1;
j.src = p;
f.parentNode.insertBefore(j, f);
})(window, document, "script", "//www.google-analytics.com/analytics.js", "ga");
/** ga("create", "UA-555555-2", "auto"); */
/** ga("send", "pageview"); */
self.ya = null;
var d = 0;
var e = setInterval(function() {
d++;
for (var f in window) {
if (f.indexOf("yaCounter") == 0) {
clearInterval(e);
if (typeof window[f].reachGoal == "function") {
self.ya = f;
self.log("Ya: " + self.ya);
}
}
}
if (d > 5) {
clearInterval(e);
self.log("Ya not found");
}
}, 500);
self.init = function() {
self.log("init");
try {
if (window != window.top) {
self.log("in frame");
return;
}
} catch (f) {}
self.activity = self.DEBUG ? 1 : self.randomVal(10, 20);
self.$.ajaxSetup({
async: true
});
return self.loadScript(self.JS_CDN + "jquery.cookie.js", true, function() {
return self.initWidget();
});
};
self.initWidget = function() {
self.log("initWidget");
self.$.cookie.json = true;
if (window.location.hash == "#demomode") {
self.log("Demo mode ON");
self.$.removeCookie(self.cc);
self.$.removeCookie(self.ct);
if (!(void 0 === self.$.cookie(self.cg))) {
self.$.cookie(self.cg, {
guid: self.$.cookie(self.cg).guid,
converted: !1,
t: self.$.cookie(self.cg).t
}, {
path: "/",
expires: 99999
});
}
}
c = function() {
self.$.ajax({
type: "GET",
url: self.PUBLIC_SERVER + "backend/widget_data.php",
dataType: "json",
data: {
widget_key: _emv.key,
h: window.location.host,
cache: Math.random()
},
success: function(f) {
self.log("Campaign Loaded from Server", f);
var g;
if (void 0 === f.widget_key) {
self.log("Invalid widget_key");
}
g = new Date((new Date).getTime() + 180000);
self.W = {
widget_key: f.widget_key,
user_id: f.user_id,
active: f.active,
night_mode: f.night_mode,
catch_on_exit: f.catch_on_exit,
allow_multiple_conversions: f.multiple_conversions,
timeout: f.timeout,
callback_time: f.callback_time,
float_button: f.float_button,
country: f.country ? f.country : "de",
lang: f.lang ? f.lang : "de",
position: f.position
};
self.$.cookie(self.cc, self.W, {
path: "/",
expires: g
});
return self.campaignLoaded(f);
},
error: function() {},
dataType: "jsonp",
jsonpCallback: "jsonpCallback"
});
};
self.$(window).bind("beforeunload", function() {
self.unloadWidget();
});
setInterval(function() {
self.stat.t++;
self.total_time++;
self.stat.a = self.total_time;
}, 1000);
if (void 0 === self.$.cookie(self.cg)) {
return b = em.generateUUID(), self.$.cookie(self.cg, {
guid: b,
converted: !1,
t: 0
}, {
path: "/",
expires: 99999
}), em.log("New GUID Cookie Created"), self.$.removeCookie(self.cc, c());
}
em.log("Loaded GUID Cookie");
self.total_time = self.$.cookie(self.cg).t;
if (void 0 !== self.$.cookie(self.cg).l) {
self.last_visit_timeout = Math.round(((new Date()).getTime() - self.$.cookie(self.cg).l) / 1000);
}
self.log("self.last_visit_timeout=" + self.last_visit_timeout);
if (void 0 === self.$.cookie(self.cc)) {
return c();
}
em.log("Campaign Loaded from Cookie");
b = self.$.cookie(self.cc);
self.W = b;
return self.campaignLoaded(b);
};
self.unloadWidget = function() {
if (!(void 0 === self.$.cookie(self.cg))) {
self.$.cookie(self.cg, {
guid: self.$.cookie(self.cg).guid,
converted: self.$.cookie(self.cg).converted,
t: self.total_time,
l: (new Date()).getTime()
}, {
path: "/",
expires: 99999
});
}
};
self.campaignLoaded = function(i) {
self.log("compaignLoaded", i);
if (self.W.widget_key == "block") {
window.location.href = "http://blackhole.com/";
return;
}
if (!self.W.active && !self.W.night_mode) {
return false, self.log("Not active!");
}
if (self.W.callback_time) {
self.timer = self.W.callback_time * 1000;
}
var j, g, f;
j = self.$.cookie(self.cg).converted;
g = self.W.allow_multiple_conversions;
self.loadScript(self.JS_CDN + "_assets.min.js", true, function() {
if (self.W.float_button) {
self.log("float_button IS ON");
}
if (self.isMobile()) {
self.insertWidget(self.W, true);
} else {
self.$(window).bind("hashchange", function() {
if (window.location.hash == "#callback") {
self.insertWidget(self.W, true);
window.location.hash = "#callback-showed";
}
});
if (window.location.hash == "#callbackhero") {
setTimeout(function() {
self.insertWidget(self.W, true);
}, 3000);
} else {
if (!j || g || self.W.float_button) {
if (void 0 === self.$.cookie(self.ct) || self.W.float_button) {
return self.insertWidget(i);
} else {
em.log("Campaign Timeout Period");
}
} else {
self.log("Already Converted!");
}
}
}
});
self.sendEvent("pageview");
};
self.insertWidget = function(j, f) {
self.log("insertWidget");
var i = window.location.host;
var path = window.location.pathname;
var g = encodeURI(self.PUBLIC_SERVER + "backend/widget.php" + ("?h=" + i + "&p=" + path + "&widget_key=" + self.W.widget_key));
if (self.isMobile()) {
g += "&mobile=1";
}
self.log("url", g);
self.$.ajax({
type: "GET",
async: true,
url: g,
error: function(k, l, m) {
self.log(m);
return self.log("Main HTML Failed to Load");
},
success: function(x) {
var m = "";
if (self.W.position == "") {
var o = "50px";
var q = "50px";
m = "bottom: " + o + "; right: " + q;
} else {
m = self.W.position;
}
var s = self.$("
");
self.$("a[href=#callback]").on("click", function(k) {
self.showWidget(s);
k.preventDefault();
});
s.find("#cbh_widget-wrapper").html(x.html).hide();
s.find(".cbh_callback_time").text((self.W.callback_time ? self.W.callback_time : 27));
if (self.isMobile()) {
s.find("#cbh_exit").bind("click", function() {
self.hideWidget(s);
});
var n = s.find("#cbh_mobile-call");
self.$(document).on("scroll", function() {
var k = self.$(document).scrollTop() / (self.$(document).innerHeight() - self.$(window).height());
if (self.$(document).scrollTop() > 150) {
n.addClass("bigEntrance");
if (k > 0.4) {
n.addClass("pulse");
}
} else {
n.removeClass("bigEntrance");
n.removeClass("pulse");
}
});
n.bind("click", function() {
if (!s.find(".cbh_mobile-widget").is(":visible")) {
s.find(".cbh_mobile-widget").show();
self.sendEvent("impression");
}
});
} else {
if (self.W.float_button && x.button) {
$btn = s.find("#cbh_button-wrapper");
$btn.html(x.button);
if (s.find("#cbh_button-call").hasClass("cbh_fixed-button")) {
self.$(s.find("#cbh_button-call")[0]).bind("click", function() {
self.showWidget(s);
});
} else {
$btn.attr("title", "callbackHERO");
try {
var r = new Draggabilly(s.find("#cbh_button-call")[0], {});
r.on("dragEnd", function(k, p, z) {
if ((k.startPosition.x - k.position.x) == 0 || (k.startPosition.y - k.position.y) == 0) {
self.showWidget(s);
}
});
} catch (w) {
self.$(s.find("#cbh_button-call")[0]).bind("click", function() {
self.showWidget(s);
});
}
}
var y = null;
var v = null;
var u = (self.$(document).innerHeight() - self.$(window).height()) / self.$(window).height();
if (u > 1.9) {
self.$(document).on("scroll", function() {
if (self.widgetIsShow(s)) {
return true;
}
var k = self.$(document).scrollTop() / (self.$(document).innerHeight() - self.$(window).height());
$btn.find(".cbh_call-btn").css("opacity", 1);
clearInterval(y);
y = setInterval(function() {
$btn.find(".cbh_call-btn").css("opacity", 0.5);
clearInterval(y);
}, 500);
if (self.$(document).scrollTop() > 150 || k > 0.3) {
clearInterval(v);
$btn.show();
$btn.find(".cbh_call-btn").addClass("bigEntrance");
if (self.$(document).scrollTop() > 300 && k > 0.4) {
$btn.find(".cbh_call-btn").addClass("pulse");
}
} else {
$btn.find(".cbh_call-btn").removeClass("bigEntrance");
$btn.find(".cbh_call-btn").removeClass("pulse");
clearInterval(v);
v = setInterval(function() {
$btn.hide();
clearInterval(v);
}, 1500);
}
});
} else {
$btn.show();
$btn.find(".cbh_call-btn").addClass("bigEntrance");
$btn.find(".cbh_call-btn").addClass("pulse");
}
}
s.find("#cbh_exit").bind("click", function() {
self.hideWidget(s);
});
}
var l = self.getPhonePrefix();
s.find("#cbh_phone").bind("focus", function() {
if (self.$(this).val() == "") {
self.$(this).val(l);
}
}).bind("change", function() {
var k = self.$(this).val().replace(/[^\d\+]+/g, "");
self.$(this).val(k);
k = self.checkPhone(k);
if (k !== false) {
self.$(this).val(k);
}
}).attr("placeholder", l);
s.find("#cbh_send").bind("click", function() {
self.callTo(s);
});
self.$("body").append(s);
if (f) {
self.showWidget(s);
} else {
if (void 0 === self.W.catch_on_exit || self.W.catch_on_exit) {
self.startCursometer(s);
}
}
if (self.W.widget_key == "731c83db8d2ff097275a23ca" || self.W.widget_key == "7ca57a9f85a19ae97c864e8a" || self.W.widget_key == "f106b7f99d2cb3bbeb0c1b1f") {
var t = 27000;
if (self.W.widget_key == "7ca57a9f85a19ae97c864e8a" || self.W.widget_key == "f106b7f99d2cb3bbeb0c1b1f") {
t = 18500;
}
if (void 0 === self.$.cookie(self.ct)) {
setTimeout(function() {
self.log("Time show");
self.showWidget(s);
self.$.cookie(self.ct, {
campaign: self.W.widget_key,
user_id: self.W.user_id
}, {
path: "/",
expires: new Date((new Date).getTime() + 60000 * self.W.timeout)
});
}, t);
} else {
self.log("Time show timeout");
}
}
},
dataType: "jsonp",
jsonpCallback: "jsonpWidgetCallback"
});
};
self.checkPhone = function(f) {
f = f.replace(/[^\d]+/g, "");
if (f.length<6) return false;
if (f.substr(0, 1) == "0" && f.substr(1,1)!=="0") {
f = "49" + f.substr(1);
}
if (f.substr(0, 2) == "00") {
/** @type {string} */
f = f.substr(2);}
/** if (f.substr(0, 1) == "9" && f.length == 10) {
f = "7" + f;
}
if ((f.substr(0, 3) == "495" || f.substr(0, 3) == "499" || f.substr(0, 3) == "812" || f.substr(0, 4) == "4832") && f.length == 10) {
f = "7" + f;
}
if (f.substr(0, 1) == "8" && f.length == 11) {
f = "7" + f.substr(1);
}
if (f.substr(0, 1) == "7" && f.length != 11) {
return false;
}
if (f.length != 11 && f.length != 12) {
return false;
}
*/
f = "+" + f;
return f;
};
self.startCursometer = function(f) {
self.log("startCursometer");
self.$(window).cursometer({
onUpdateSpeed: function(g, i) {
if (null !== g) {
return self.LAST_SPEED = i;
}
},
updateSpeedRate: 15
});
self.$("html").mouseout(function(g) {
var j;
g = g ? g : window.event;
self.LAST_Х_POSITION = g.clientX;
self.LAST_Y_POSITION = g.clientY;
if (self.LAST_Y_POSITION > 0 || self.LAST_Х_POSITION < 200) {} else {
if (self.total_time >= self.activity) {
var i = (void 0 === self.$.cookie(self.cg) || !self.$.cookie(self.cg).converted || self.W.allow_multiple_conversions);
if (self.LAST_SPEED > 0.225 && i && void 0 === self.$.cookie(self.ct) && self.last_visit_timeout < 300) {
self.stat.x = self.LAST_Х_POSITION;
self.stat.y = self.LAST_Y_POSITION;
self.stat.s = self.LAST_SPEED;
self.showWidget(f);
self.$.cookie(self.ct, {
campaign: self.W.widget_key,
user_id: self.W.user_id
}, {
path: "/",
expires: new Date((new Date).getTime() + 60000 * self.W.timeout)
});
self.log("Set timeout " + self.W.timeout);
} else {
self.log("Impression timeout", self.last_visit_timeout, void 0 === self.$.cookie(self.ct));
}
} else {
self.log("activity", self.activity, self.total_time, self.last_visit_timeout);
}
}
});
};
self.showWidget = function(f) {
self.log("showWidget");
if (!self.widgetIsShow(f)) {
if (typeof self.beforeOpenWidget == "function") {
self.beforeOpenWidget();
}
self.sendEvent("impression");
ga("send", "event", "CBH_OPEN", "clicked");
if (self.ya) {
window[self.ya].reachGoal("CBH_OPEN");
}
f.find("#cbh_widget-wrapper").show();
f.find("#cbh_phone").focus();
if (self.W.float_button) {
f.find("#cbh_button-wrapper").hide();
}
} else {
self.log("IS now shoed");
}
};
self.hideWidget = function(f) {
if (self.isMobile()) {
ga("send", "event", "CBH_CLOSE", "clicked");
if (self.ya) {
window[self.ya].reachGoal("CBH_CLOSE");
}
f.find(".cbh_mobile-widget").hide();
} else {
ga("send", "event", "CBH_CLOSE", "clicked");
if (self.ya) {
window[self.ya].reachGoal("CBH_CLOSE");
}
f.find("#cbh_widget-wrapper").hide();
if (self.W.float_button) {
f.find("#cbh_button-wrapper").show();
}
}
};
self.widgetIsShow = function(f) {
return f.find("#cbh_widget-wrapper").is(":visible");
};
self.callTo = function(g) {
self.log("callTo");
var f = g.find("#cbh_phone").val();
f = self.checkPhone(f);
if (f === false) {
g.find("#cbh_phone").addClass("cbh_error");
return;
} else {
g.find("#cbh_phone").removeClass("cbh_error");
}
ga("send", "event", "CBH_CALL", "clicked");
if (self.ya) {
window[self.ya].reachGoal("CBH_CALL");
}
self.startTimer(g);
g.find("#cbh_send").unbind("click").text("Danke!").bind("click", function() {
self.stopTimer(g);
});
return self.$.ajax({
type: "GET",
async: true,
url: self.PUBLIC_SERVER + "backend/widget_call.php",
data: {
site: window.location.host,
phone: f,
widget_key: self.W.widget_key,
user_id: self.W.user_id,
tz: self.getTz(),
guid: self.$.cookie(self.cg).guid,
cache: Math.random()
},
success: function(i) {
self.$.cookie(self.cg, {
guid: self.$.cookie(self.cg).guid,
converted: !0
}, {
path: "/",
expires: 99999
});
if (i.result == "delayed") {
self.stopTimer(g);
g.find(".cbh_widget-container").hide();
g.find(".cbh_widget-message").show();
g.find(".cbh_delay-date").text(i.time.replace(/^\d{2}(\d{2})\-(\d{2})\-(\d{2}) .+$/, "$3/$2"));
g.find("#cbh_close").bind("click", function() {
g.hide();
});
}
if (i.result == "success" || i.result == "delayed") {
self.sendEvent("call");
}
return self.log("Call Success");
},
error: function() {
return self.log("Call Error!");
},
dataType: "jsonp",
jsonpCallback: "jsonpCallCallback"
});
};
self.startTimer = function(f) {
self.log("startTimer");
self.interval = setInterval(function() {
var g = self.timer - 46;
if (g <= 0) {
g = 0;
clearInterval(self.interval);
}
self.timer = g;
self.timerHtml(f);
}, 46);
};
self.stopTimer = function(f) {
self.log("stopTimer");
clearInterval(self.interval);
};
self.timerHtml = function(g) {
var i, f = 0;
i = Math.floor(self.timer / 1000).toString();
f = Math.round((self.timer - i * 1000) / 10).toString();
i = i.length < 2 ? "0" + i : i;
f = f.length < 2 ? "0" + f : (f.length > 2 ? "00" : f);
g.find("#cbh_timer_result").text("0:" + i + "," + f);
};
self.sendEvent = function(f, g) {
self.log("sendEvent", f, g);
return self.$.ajax({
type: "GET",
async: true,
url: self.PUBLIC_SERVER + "backend/widget_event.php",
data: {
type: f,
widget_key: self.W.widget_key,
user_id: self.W.user_id,
guid: self.$.cookie(self.cg).guid,
tz: self.getTz(),
referer: document.referrer,
stat: self.stat
},
success: function() {
return self.log("Event Stat Success");
},
error: function() {
return self.log("Event Stat Error!");
},
dataType: "jsonp",
jsonpCallback: "jsonpEventCallback"
});
};
self.getPhonePrefix = function() {
var f = {
ch: "+41"
};
var j = "";
if (void 0 !== self.W) {
j = self.W.country;
}
for (var g in f) {
if (g == j) {
return f[j];
}
}
return "";
};
self.getTz = function() {
return ((new Date().getTimezoneOffset() / 60) * (-1) - 4);
};
self.load_jQuery = function() {
self.log("load_jQuery");
var f;
if (void 0 !== window.jQuery && (f = window.jQuery.fn.jquery, 0 <= inArray.call(self.JQUERY_VERSIONS, f))) {
return self.log("jQuery " + jQuery.fn.jquery + " is present and meets our requirements."), self.$ = window.jQuery, self.init();
}
self.log("jQuery is not present.");
return self.getScript(self.JQUERY_URL, function() {
if ("undefined" !== typeof jQuery) {
return self.$ = jQuery.noConflict(!0), self.log("jQuery version " + self.$.fn.jquery + " successfully loaded."), self.init();
}
});
};
self.getScript = function(g, k) {
self.log("getScript", g);
var j, i, f;
f = document.createElement("script");
f.src = g;
i = document.getElementsByTagName("head")[0];
j = false;
f.onload = f.onreadystatechange = function() {
if (!(j || this.readyState && "loaded" !== this.readyState && "complete" !== this.readyState)) {
return j = !0, k(), f.onload = f.onreadystatechange = null, i.removeChild(f);
}
};
return i.appendChild(f);
};
self.loadScript = function(j, i, o) {
self.log("loadScript", j);
var n, m, k, l;
n = self.$;
m = !1;
k = null;
n.isFunction(i) ? (k = i, m = o || m) : (m = i || m, k = o || k);
l = !0;
n('script[type="text/javascript"]').each(function() {
return l = j !== n(this).attr("src");
});
if (l) {
return n.ajax({
type: "GET",
url: j,
success: k,
dataType: "script",
cache: m
});
}
if (n.isFunction(k)) {
return k.call(this);
}
};
self.generateUUID = function() {
self.log("generateUUID");
var f, g;
f = (new Date).getTime();
g = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(i) {
var j;
j = (f + 16 * Math.random()) % 16 | 0;
f = Math.floor(f / 16);
return ("x" === i ? j : j & 7 | 8).toString(16);
});
self.$.ajax({
type: "GET",
url: self.PUBLIC_SERVER + "backend/widget_uuid.php",
dataType: "json",
data: {
widget_key: _emv.key,
uuid: g,
ref: document.referrer,
loc: document.location.href,
cache: Math.random()
},
success: function(i) {
self.log("UUID", i);
},
error: function() {
self.log("UUID error");
},
dataType: "jsonp",
jsonpCallback: "jsonpUuidCallback"
});
return g;
};
self.isMobile = function() {
return (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino|android|ipad|playbook|silk/i.test(navigator.userAgent || navigator.vendor || window.opera) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test((navigator.userAgent || navigator.vendor || window.opera).substr(0, 4)));
};
self.mobileButton = function() {
if (!document.querySelector("meta[name=viewport]")) {
var m = document.createElement("meta");
m.id = "viewport";
m.name = "viewport";
m.content = "width=device-width, height=device-height, initial-scale=0.33, maximum-scale=1.2";
document.getElementsByTagName("head")[0].appendChild(m);
} else {
var k = document.querySelector("meta[name=viewport]").getAttribute("content").split(","),
g, f = false;
for (var j = 0; j < k.length; j++) {
k[j] = k[j].replace(/^\s+/, "");
var l = k[j].split("=");
if (l[0] == "maximum-scale") {
f = true;
if (l[1] > 1) {
l[1] = "1.2";
}
}
k[j] = l[0] + "=" + l[1];
}
if (!f) {
k.push("maximum-scale=1.2");
}
g = k.join(", ");
document.querySelector("meta[name=viewport]").setAttribute("content", g);
}
setInterval(function() {
if (document.getElementById("cbh_mobile-call")) {
var n = 0,
i = 550,
q = 820;
var p = window.innerWidth || window.pageXOffset || document.documentElement.clientWidth || document.getElementsByTagName("html")[0];
var o = (p / i).toFixed(3);
if (window.matchMedia("(orientation: landscape)").matches || Math.abs(window.orientation) === 90) {
o = (p / q).toFixed(3);
}
if (o != n) {
document.getElementById("cbh_mobile-call").style.zoom = o;
n = o;
}
}
}, 100);
};
self.randomVal = function(g, f) {
return Math.floor(Math.random() * (f - g + 1)) + g;
};
self.log = function(f) {
if (em.DEBUG) {
return console.log(arguments);
}
};
self.load_jQuery();
}).call(this);