function create(cur_url, url_img, token, width, height){
var els = document.getElementsByClassName(token);
var target = null;
var loadOne = false;
[].forEach.call(els, function (el) {
if(!loadOne){
if(!el.classList.contains("loaded")){
target = el;
}
el.style.width = width;
el.style.height = height;
el.style.maxWidth = "100%";
if(target != null){
if(target.parentNode.classList.value.includes("kz-widget-pub-interstiel") && url_img != ""){
target.parentNode.classList.add("kz-widget-pub-interstiel-mob");
}
target.innerHTML = ""
+""
+"
"
+"";
target.classList.add("loaded");
loadOne=true;
}
}
});
}
function load(){
var arr = [{"zone_id":"9","ad_id":"231","priority":"normale","url_image":"https:\/\/www.kideaz.com\/wp-content\/uploads\/2025\/05\/Interstitiel-mobile_640x920px.jpg","url_target":"https:\/\/environnement.public.lu\/fr\/actualites\/2025\/06\/emweltdeeg-2025.html","start_date":"2025-05-14 00:00:00","end_date":"2025-06-15 00:00:00","statut":"En diffusion"}];
var default_arr= []
var ad = arr[Math.floor(Math.random() * arr.length)];
var url_img = ad["url_image"];
var cur_url = "https://prod-myagency.lu/tracking/ads_stats.php?tar="+btoa("tracking/incr/ads/"+ad["ad_id"])+"&red="+ad["url_target"];
var tmp_img = new Image();
var xhttp = new XMLHttpRequest();
var token = "banner_content_SUa5zLqQpBkGt5bOURkc";
var width = "320px";
var height = "460px";
if(ad["ad_id"] !== undefined){
tmp_img.onerror = function(){
ad = default_arr[Math.floor(Math.random() * default_arr.length)];
url_img = ad["url_image"];
cur_url = ad["cur_url"];
cur_url = "https://prod-myagency.lu/tracking/ads_stats.php?tar="+btoa("tracking/incr/ads/"+ad["ad_id"])+"&red="+ad["url_target"];
if(cur_url != "" && url_img != ""){
xhttp.open("POST", "https://prod-myagency.lu/tracking/../php/rooter.php", true);
xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhttp.send("ac=incr_stat&ad_id="+ad["ad_id"]);
create(cur_url, url_img, token, width, height);
}
}
tmp_img.onload = function(){
xhttp.open("POST", "https://prod-myagency.lu/tracking/../php/rooter.php", true);
xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhttp.send("ac=incr_stat&ad_id="+ad["ad_id"]);
create(cur_url, url_img, token, width, height);
}
tmp_img.src = url_img;
}
}
var Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(e){var t="";var n,r,i,s,o,u,a;var f=0;e=Base64._utf8_encode(e);while(f>2;o=(n&3)<<4|r>>4;u=(r&15)<<2|i>>6;a=i&63;if(isNaN(r)){u=a=64}else if(isNaN(i)){a=64}t=t+this._keyStr.charAt(s)+this._keyStr.charAt(o)+this._keyStr.charAt(u)+this._keyStr.charAt(a)}return t},decode:function(e){var t="";var n,r,i;var s,o,u,a;var f=0;e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(f>4;r=(o&15)<<4|u>>2;i=(u&3)<<6|a;t=t+String.fromCharCode(n);if(u!=64){t=t+String.fromCharCode(r)}if(a!=64){t=t+String.fromCharCode(i)}}t=Base64._utf8_decode(t);return t},_utf8_encode:function(e){e=e.replace(/\r\n/g,"\n");var t="";for(var n=0;n127&&r<2048){t+=String.fromCharCode(r>>6|192);t+=String.fromCharCode(r&63|128)}else{t+=String.fromCharCode(r>>12|224);t+=String.fromCharCode(r>>6&63|128);t+=String.fromCharCode(r&63|128)}}return t},_utf8_decode:function(e){var t="";var n=0;var r=c1=c2=0;while(n191&&r<224){c2=e.charCodeAt(n+1);t+=String.fromCharCode((r&31)<<6|c2&63);n+=2}else{c2=e.charCodeAt(n+1);c3=e.charCodeAt(n+2);t+=String.fromCharCode((r&15)<<12|(c2&63)<<6|c3&63);n+=3}}return t}}
window.btoa = function(str) {
return Base64.encode(str);
}
load();