var jboxquery = $.noConflict(true); var scripturl = ""; var scripts = document.getElementsByTagName( 'script' ); for(var i =0; i < scripts.length; i++) { if(scripts[i].src.search("leavingbox.php") > 0 && scripts[i].src.lastIndexOf("/") >= 0) { scripturl = scripts[i].src.substring(0, scripts[i].src.lastIndexOf("/") + 1); break; } } var exitpopped = 0; var showpop = 0; var delay = 3000; var exitpopisopen = false; var template_content = ""; setTimeout(function () { showpop = 1; }, delay); state = 0; var isMobile = { Android: function () { return navigator.userAgent.match(/Android/i); }, BlackBerry: function () { return navigator.userAgent.match(/BlackBerry/i); }, iOS: function () { return navigator.userAgent.match(/iPhone|iPad|iPod/i); }, Opera: function () { return navigator.userAgent.match(/Opera Mini/i); }, Windows: function () { return navigator.userAgent.match(/IEMobile/i); }, any: function () { return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows()); } }; jboxquery(document).mousemove(function (e) { if (e.clientY <= 5 && exitpopped == 0 && showpop == 1) { exitpopped = 1; leavingbox(); } }); function set_state(url, id) { state = id; for (var i = 1; i <= state; i++) { jboxquery("#img" + i).attr("src", url+"star1.png"); } for (var i = state + 1; i <= 5; i++) { jboxquery("#img" + i).attr("src", url+"star.png"); } jboxquery("#kwwbox_stern").val(state); } function leavingbox() { if(exitpopisopen===false) { exitpopisopen = true; jboxquery("#leavingbox_background").remove(); var str = ""; if(isMobile.any()) { str += "

"; } else { str += "
"; } str += "
schließen
"; str += template_content; str += ""; str += "
"; jboxquery('
').appendTo('body'); jboxquery("#leavingbox_background").append(str); try { ga('send', 'pageview', "#leavingbox_open"); } catch(e) { } } } var elements = []; function kundenwillweg_angebot() { try { ga('send', 'pageview', "#kundenwillweg_angebot"); } catch(e) { } } function leavingbox_send() { jboxquery('#leavingbox').find("*").each(function() { var id = ""+jboxquery(this).attr("id"); var value = jboxquery(this).val(); try { if(id !== undefined && id.indexOf("kwwbox_") > -1) { var array = new Array(); array.push(id); array.push(value); elements.push(array); } } catch(e) { } }); jboxquery.ajax({ url: scripturl+'sendmail.php', type: 'POST', data: JSON.stringify(elements), contentType: 'application/json; charset=utf-8', success: function (response) { //your success code }, error: function (results) { console.log(results); } }); jboxquery("#leavingbox").empty(); var str = ""; str += "

Wir danken für Ihre Meinung.

"; str += "

Es hilft uns unser Angebot weiter zu entwickeln!

"; str += "

" jboxquery("#leavingbox").append(str); try { ga('send', 'pageview', "#kundenwillweg_send"); } catch(e) { } } function leavingbox_exit() { jboxquery("#leavingbox_background").remove(); exitpopisopen = false; } var last_index = 0; var has_bottom = false; jboxquery(function () { jboxquery.ajax({ url: scripturl+'template.php', type: 'GET', contentType: 'application/json; charset=utf-8', success: function(html){ template_content = html; }, error: function () { } }); jboxquery(window).scroll(function () { if(isMobile.any()) { var docElement = jboxquery(document)[0].documentElement; var winElement = jboxquery(window)[0]; if(has_bottom === true) { if(last_index > winElement.pageYOffset) { leavingbox(); } } if ((docElement.scrollHeight - winElement.innerHeight) * 0.5 <= winElement.pageYOffset && has_bottom === false) { has_bottom = true; last_index = winElement.pageYOffset; } } }); });