if (typeof selectm != "undefined") {
const metfield = document.createElement("a");
metfield.innerHTML = (selectm[0].charAt(selectm[0].length-4) == " "?selectm[0].slice(0,selectm[0].length-4):selectm[0]);
metfield.setAttribute("class","");
metfield.setAttribute("onclick","metLocSel('" + selectm[1] + "',this.innerHTML)");
metfield.setAttribute("title","(from wpts) " + selectm[1].toUpperCase());
// document.getElementById("metarlist").appendChild(metfield);
document.getElementById("metarlist").insertBefore(metfield,metarlist.lastElementChild);
}
if (typeof selectm != "undefined") {document.getElementById("wptstext").setAttribute("class","point ufirst"); wptstext.title = "click \u2799 " + selectm[0]}
}
// end onLoad()
function moveObject(e) {
e = window.event || e;
return Math.max(-1, Math.min(1, (e.wheelDelta || -e.detail)));
}
function Resize(e) {
var delta = moveObject(e);
ct = Math.round(timei/1000) + ioffs + (delta*60);
if (ct < 3599 && ct >- 3599) {ioffs += (delta*60)}
ct = Math.floor(timei/1000) + ioffs;
var d = Math.abs(ct)%60;
var f = Math.floor(Math.abs(ct)/60);
txt.value = (ct < 0?"-":"")+checkLead(f)+":"+checkLead(d);
if (ct > delay*60) {setColor("txt","red",0);} else {setColor("txt","green",0);}
}
function Resize1(e) {
var delta = moveObject(e);
var exdelay = delay;
delay+=delta;
if (delay<2 || delay>59) {delay -= delta;} //correction des limites
delay = Math.round(delay*100)/100; // correction des arrondis
document.getElementById("dely").innerHTML = delay;
var title_auto = document.getElementById("reload").title;
title_auto = title_auto.replace(exdelay,delay);
document.getElementById("reload").title = title_auto;
}
function Resize2(e) {
var delta = moveObject(e);
var y = document.getElementById("htime").value;
var yalt = 5;
var yshft = 0;
if (e.altKey) {yalt = 1}
if (e.shiftKey) {yshft = delta; yalt = 0;}
if (!y || y.substr(2,1)!=":") {document.getElementById("htime").value = ret_time(); yalt = 0; yshift = 0;} else {
//var yy = parseInt(y.slice(0,2))*60+(yshft*60)+parseInt(y.slice(2,4))+(delta*yalt);
var yy = parseInt(y.substr(0,1))*10+parseInt(y.substr(1,1))
if (yy>23 || isNaN(yy)) {yy=23}
yy *= 60
yy += (yshft*60)
var yz = parseInt(y.substr(3,1))*10+parseInt(y.substr(4,1))
if (yz>59 || isNaN(yz)) {yz=59}
yy += yz
yy += (delta*yalt);
if (yy >= 24*60) {yy -= 24*60; Resize3(e);}
if (yy < 0) {yy += 24*60; Resize3(e);}
var d = Math.abs(yy)%60;
var f = Math.floor(Math.abs(yy)/60);
document.getElementById("htime").value = checkLead(f)+":"+checkLead(d);
}}
function Resize3(e) {
var delta = moveObject(e);
var y = document.getElementById("hdate").value;
if (!(y) || !(y.substr(4,1) == "-" && y.substr(7,1) == "-" && !y.match(regd))) {document.getElementById("hdate").value = ret_date();} else {
y=y.replace(/-/ig,"");
var an = parseInt(y.substr(0,4)); // an
var mo = parseInt(y.substr(4,1))*10+parseInt(y.substr(5,1)); // mois
var jo = parseInt(y.substr(6,1))*10+parseInt(y.substr(7,1))//+delta; // jour
jo=parseInt(jo+delta);
if (isNaN(an) || isNaN(mo) || isNaN(jo)) {document.getElementById("hdate").value = ret_date();} else {
if (jo == 0) {jo=31; mo-=1;
if (mo == 2 || mo == 4 || mo == 6 || mo == 9 || mo == 11) {jo=30;} if (mo == 2) {jo=28}}
if (jo == 32 || (jo == 31 && (mo == 4 || mo == 6 || mo == 9 || mo == 11)) || (jo == 29 && mo == 2)) {jo=1; mo+=1;}
if (mo == 0) {mo=12; an-=1;}
if (mo == 13) {mo=1; an+=1;}
var auj = new Date(checkLeads(an),checkLead(mo)-1,checkLead(jo),0,0,0,0);
var jrSem = auj.getDay();
hdate.title = wkD[jrSem];
document.getElementById("hdate").value = checkLeads(an)+"-"+checkLead(mo)+"-"+checkLead(jo);
}}}
function Resize4(e) {
var delta = moveObject(e);
var y = parseInt(document.getElementById('zoomval').value);
y += delta;
if (!(y>15 || y<1)) {document.getElementById('zoomval').value = y;}
}
function Resize5(e) {
var delta = moveObject(e);
var y = parseInt(document.getElementById('maxspeed').value); (isNaN(y)?y = 0:"");
y += (10*delta);
if (!(y>800 || y<0)) {document.getElementById('maxspeed').value = y;}
if (minspeed.value.length && parseInt(maxspeed.value) < parseInt(minspeed.value)) {minspeed.value = maxspeed.value;}
warnFilter();
}
function Resize6(e) {
var delta = moveObject(e);
var y = parseInt(document.getElementById('minspeed').value); (isNaN(y)?y = 0:"");
y += (10*delta);
if (!(y>800 || y<0)) {document.getElementById('minspeed').value = y;}
if (maxspeed.value.length && parseInt(minspeed.value) > parseInt(maxspeed.value)) {maxspeed.value = minspeed.value;}
warnFilter();
}
function Resize7(e) {
var delta = moveObject(e);
var y = parseInt(document.getElementById('maxalt').value); (isNaN(y)?y = 0:"");
y += (1000*delta);
if (!(y>altmax || y<0)) {document.getElementById('maxalt').value = y;} else {
if (y>altmax) {document.getElementById('maxalt').value = altmax;} else {document.getElementById('maxalt').value = 0;}}
if (minalt.value.length && parseInt(maxalt.value) < parseInt(minalt.value)) {minalt.value = maxalt.value;}
warnFilter();
}
function Resize8(e) {
var delta = moveObject(e);
var y = parseInt(document.getElementById('minalt').value); (isNaN(y)?y = 0:"");
y += (1000*delta);
if (!(y>altmax || y<0)) {document.getElementById('minalt').value = y;} else {
if (y>altmax) {document.getElementById('minalt').value = altmax;} else {document.getElementById('minalt').value = 0;}}
if (maxalt.value.length && parseInt(minalt.value) > parseInt(maxalt.value)) {maxalt.value = minalt.value;}
warnFilter();
}
function baloon() {return (filter_type.value.toLowerCase().includes("ball")?" BALLON ":"")
}
function docTitle(t) {
document.title = t.replace(/ /g,"");
}
function fillvisu(tevisu) {
if (typeof tevisu == "undefined") {tevisu = "emplacement non défini"}
document.getElementById("visu").value = tevisu.replace(/ /ig,"");
dispMessage(tevisu.replace(/ /ig,""),false);
}
function zoom(lat,lon,scale,title_text) { //inutilisée
new1 = "https://www.flightradar24.com/simple?lat="+lat+"&lon="+lon+"&z="+scale;
document.getElementById("fr").src = new1;
resetCount();
var new2 = traf + (filter_type.value.toLowerCase() == "ball"?" BALLON ":"") + text_title[title_text];
docTitle (new2);
fillvisu(text_title[title_text]);
}
function upd_title(title_text) {
//if (remember) {title_text = remember;}
if (typeof selectm == "undefined" || selectm[0] == "") {docTitle(hostid + traf + baloon() + (title_text= wptAptNum) {fillthis.push(12)} else {fillthis.push(10)};
document.getElementById("latval").value = fillthis[0];
document.getElementById("longval").value = fillthis[1];
document.getElementById("zoomval").value = fillthis[2];
(typeof selectm == "undefined"?"":selectm[2] = ""); // start up variable, no longer useful after loading
setColor("label_opt","black",0);
(remember == index?"":setColor("go","red",0));
upd_title(index); // update page title
remember = index;
colLabel();
}
function flash(item,duree) {if (typeof(duree) == "undefined") {duree = 500}; var item1 = document.getElementById(item);
item1.classList.add("txtbg"); setTimeout(function(){item1.classList.remove("txtbg")},duree);
}
function subst() { // no action if anyone of the 3 fields -> empty
if (!latval.value || isNaN(latval.value)) {flash(latval);}
else if (!longval.value || isNaN(longval.value)) {flash (longval);}
else if (!zoomval.value || isNaN(zoomval.value)) {flash (zoomval);}
else {
if (hdate.value!="act"){
resetCount();
setColor("go","black",0);
/// upd_title(remember);
var link = makeLine();
setColor("checklink",inherit,0);
if (dt.style.color == "green" && hdate.value && htime.value && !debugOn) {dt.classList.add("dtb"); histo.classList.add("dtb")} else {dt.classList.remove("dtb"); histo.classList.remove("dtb")}
document.getElementById("checklink").value = link;
//// if (!event.altKey) {flightradar.location.href = link;} // not working
//// if (evt!=16 && !debugOn) {flightradar.location.href = link;}
if (evt!=16 && debugOn == 0) {flightradar.location.href = link;}
} }
}
const tabc = " ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜßàáâãäåçèéêëìíîïñòóôõöùúûüýÿ"
function unicode(utext) {
var resu = "";
for (var i=0; i-1) {resu += "%" + tabc.charCodeAt(ma).toString(16).toUpperCase()} else {resu += utext.charAt(i)}
}
return resu;
}
function makeLine() {
var Latitude = document.getElementById("latval");
var Longitude = document.getElementById("longval");
var Zoom = document.getElementById("zoomval");
var Reg = document.getElementById("regval");
var Call = document.getElementById("callval");
var Maxspeed = document.getElementById("maxspeed").value; if (isNaN(Maxspeed)) {Maxspeed=""; document.getElementById("maxspeed").value="";} else {(Maxspeed?Maxspeed="&maxspeed="+Maxspeed:"");}
var Minspeed = document.getElementById("minspeed").value; if (isNaN(Minspeed)) {Minspeed=""; document.getElementById("minspeed").value="";} else {(Minspeed?Minspeed="&minspeed="+Minspeed:"");}
var Maxalt = document.getElementById("maxalt").value; if (isNaN(Maxalt)) {Maxalt=""; document.getElementById("maxalt").value="";} else {(Maxalt?Maxalt="&maxalt="+Maxalt:"");}
var Minalt = document.getElementById("minalt").value; if (isNaN(Minalt)) {Minalt=""; document.getElementById("minalt").value="";} else {(Minalt?Minalt="&minalt="+Minalt:"");}
var retun = "https://www.flightradar24.com/simple"+
(Latitude.value || Longitude.value || Zoom.value || Reg.value || Call.value?"?":"")+
(Latitude.value?"lat="+Latitude.value + "&":"")+
(Longitude.value?"lon="+Longitude.value + "&":"")+
(Zoom.value?"z="+Zoom.value:"")+
(document.getElementById("portval").checked == true&&Zoom.value>5?"&airports=1":"")+
(document.getElementById("sizval").checked == true?build():"")+
(Call.value?"&callsign="+Call.value.toUpperCase():"")+
(Reg.value&&!Call.value?"®="+Reg.value.toUpperCase():"")+
(document.getElementById("solo").checked == true&&(regval.value || callval.value)?"&solo=1":"")+
(document.getElementById("dt").style.color == "green" && hdate.value && htime.value?"&pb_date="+hdate.value+"&pb_time="+htime.value:"")+
(filter_type.value?"&filter_type="+removeDuplicate(filter_type.value):"")+
//! (filter_callsign.value.replace("unknown","")&&!sig_code?"&filter_callsign="+removeDuplicate(filter_callsign.value.replace("unknown",""),"a"):"")+
(!sig_code?
(filter_callsign.value.replace("unknown","")?"&filter_callsign="+removeDuplicate(filter_callsign.value.replace("unknown",""),"a"):"")
:(0?"&filter_callsign="+"":""))+
Maxspeed+Minspeed+Maxalt+Minalt+
(document.getElementById("weather").checked?"&weather=1":"")+
(document.getElementById("clouds").checked?"&clouds=1":"");
// console.log(unicode(retun));
// retun = retun.replace('undefined', ''); // raison inconnue
return unicode(retun.replace(/ /g, ''));
}
function nempty() {if (document.getElementById("dt").style.color == "green" && hdate.value && htime.value && !filter_type.value && !filter_callsign.value) {return "&filter_type=A,B,D,R,C,G,P,S,T,F,J,E,H,I,L,M,X,V";} else {return "";} // provoque l'envoi d'un filtre bidon si date+heure actifs et aucun filtre pour forcer l'affichage de "fr24.com/simple"
}
function InsertContent(d) {
if (!document.getElementById(d).style.display || document.getElementById(d).style.display == "none") document.getElementById(d).style.display = "inline";
}
function RemoveContent(d) {
if (document.getElementById(d).style.display == "inline") document.getElementById(d).style.display = "none";
}
function ToggleContent(d) {
if (document.getElementById(d).style.display == "none")
{document.getElementById(d).style.display = "inline"; return true;} else {document.getElementById(d).style.display = "none"; return false;}
}
function copyContent(src,dest) {
if (document.getElementById(src).value) {document.getElementById(dest).value = document.getElementById(src).value;}
}
var flink = document.querySelector("link[rel*=\'icon\']") || document.createElement("flink");
flink.type = "image/x-icon";
flink.rel = "shortcut icon";
function set0(num) { // if favicon exists, switch according to color of AUTO
flink.href = "Images/flt"+num+".ico";
document.getElementsByTagName("head")[0].appendChild(flink);
}
function ToggleColor(d,color1,color2,b) {
if (document.getElementById(d).style.color == color1) {
setColor(d,color2,b); setbgcolor(d,"lightgrey"); (d == "reload"?set0(1):"");} else {setColor(d,color1,b); setbgcolor(d,"white"); (d == "reload"?set0(""):"");}
}
function ToggleSpace() {ToggleContent("space"); RemoveContent("labelsel");
if (document.getElementById("space").style.display == "none") {InsertContent("field");} else {RemoveContent("field"); RemoveContent("debug_line");}
}
function build() {
var label1 = reveal("L1");
var label2 = reveal("L2"); //console.log(label2)
var label3 = reveal("L3");
var fulllabel = (label1!="none"?"&label1="+label1:"")+(label2!="none"?"&label2="+label2:"")+(label3!="none"?"&label3="+label3:"");
return fulllabel;
}
function reveal(radio_name) {
var oRadio = document.forms["labelForm"].elements[radio_name]; //console.log(oRadio)
for(i = 0; i < oRadio.length; i++) {
if (oRadio[i].checked)
{return oRadio[i].value;}
}
return 'none';
}
const googleMaps = "https://maps.google.com/maps";
function fill_paste() { // décompte des avions et des types avec filtre actif (select all + copié de l'IFRAME, collé dans le champ "checklink")
q1 = new Date(); // sauvegarde de l'heure du paste
/// COPY from checklink
var str = document.getElementById("checklink").value;
/// CLEAN str
str = str.replace(/[^\x20-\x7F]/g, " "); str = str.replace(/\s+/g," "); // remplace tout sauf unicode par un espace et supprime multi-espaces
if (str.includes(googleMaps)) {str = str.substr(str.lastIndexOf(googleMaps))} // if str == googleMap, then suppress the rest
str = str.replace(/Operated by easyJet Europe |Operated by easyJet Switzerland |Florencio Martin Melian |Jose Antonio Ruiz |Fernando Roca |William Verguet |Dutch |Justin St ckel |Sebastian Sowa |Javier Rodriguez - Amics de Son Sant Joan |Flightradar24 |Bianca Renz |Davide Mascheroni |Marco Mochelato |Monica De Guidi |Fabrizio Gandolfo |ukasz Stawiarz |Dominic Hall |Nelson Sousa |Oksana |JakkoFly |Carlos Miguel Seabra |Pierre Pm |Julian S. |B rbara Costa |Rui Marques |Javier Rodriguez - Amics de Son Sant Joan |Tony Goldin |Gianluca Mantellini |Mart n Marrero Hdez |Alexis Boidron |Roberto Falciola |Pampillonia Francesco - Plane Spotters Bari |Benjamin Barbe |FUMAGALLI ANDREA |Kuba Kawczynski |Oliver K hnel |David Oates |Simone Previdi |St phane Mutzenberg |Matteo Lamberts |Matteo Mariani |Not Pauli |mkwia |Jo o Lopes |Stefano R |Matteo Generoso |doguegev |Onat Eronat |Paul Denton |Herv Champain /gi,""); // suppress photograf's name, incl. trailing space
str = str.replace(/Want to view more aviation photos|\? |Visit JetPhotos today to access more than 6 million high-quality photos of all types of aircraft./gi,"").replace(/\s+/g," "); // new implementation 26.08.24
// since 26 Jul 24 instead of "SCHEDULED","UTC", take "Scheduled","utc"
if (str.split("Scheduled").length > 2 && str.includes("utc ")) { // new implementation 21.06.21
str = str.replace(/ACTUAL/i,"ATD");
str = str.replace(/ESTIMATED/i,"ETA");
var str1 = str.split("utc ");
var str2 = str1[2].split("Scheduled");
/*str = str1[0] + "STD" + str2[1] + str1[1] + "STA" + str2[2].slice(0,(str2[2].includes(" -")?13:16)); // old*/
/*str = str1[0] + "STD" + str2[1] + str2[2].slice(7,17) + str1[1] + "STA" + str2[2].slice(0,7) + str2[2].slice(16,26) // new implementation 29.06.23*/
var str3 = str1[0].split(" ");
str = str3[1] + " /" + str3[0] + " " + str3[3] + " " + str3[4] + " " + str3[5] + " " + "STD" + str2[1] + str2[2].slice(7,17) + str1[1] + "STA" + str2[2].slice(0,7) + str2[2].slice(16,26); // new implementation 29.06.23
}
else if (str.includes("ACTUAL ") && str.includes("ESTIMATED ") && str.includes("UTC ")) { // if no scheduled time (only ACTUAL and ESTIMATED)
str = str.replace(/ACTUAL/i,"ATD");
var str1 = str.split("UTC ");
var str2 = str1[2].split(" ESTIMATED");
str = str1[0] + str2[0] + " " + str1[1] + "ETA" + str2[1].slice(0,6);
}
/* OLD stuff
str = str.replace(/FLIGHT STATUS |3D VIEW |N\x2FA ARRIVAL SCHEDULED /ig,"");
str = str.replace(/SCHEDULED DEPARTURE |UTC DEPARTURE SCHEDULED |ScheduledDeparture /ig,"STD ");
str = str.replace(/SCHEDULED ARRIVAL |UTC ARRIVAL SCHEDULED |ScheduledArrival /ig,"STA ");
str = str.replace(/ACTUAL DEPARTURE |ACTUAL |ActualDeparture |UTC ACTUAL |UTCACTUAL /ig,"ATD ");
str = str.replace(/Actual/ig,"ATD ");
str = str.replace(/ESTIMATED ARRIVAL |ESTIMATED |EstimatedArrival |UTC ESTIMATED |UTCESTIMATED /ig,"ETA ");
str = str.replace(/Estimated/ig,"ETA "); str = str.replace(/UTC SCHEDULED /i,"STD "); str = str.replace(/UTC SCHEDULED /i,"STA "); // 2 remplacements successifs distincts
str = str.replace(/UTC SCHEDULED /i,"STD "); str = str.replace(/UTC SCHEDULED /i,"STA "); // 2 remplacements successifs distincts
str = str.replace(/UTC Scheduled/i,"STD "); str = str.replace(/UTC Scheduled/i,"STA "); // 2 remplacements successifs distincts
*/
// EXTRACT LONGITUDE and LATITUDE and write back to checklink
var n0 = -1; (evt == 16?"":n0 = str.indexOf("SQUAWK")); //console.log("n0="+n0);
var posL = (n0>-1&&str.indexOf("longitude ")>-1?str.indexOf(str.indexOf(" "),str.indexOf("longitude")+1):0);
// if (n0>-1&&str.length-n0-1&&str.length-n0>posL) {str = str.replace(str.slice(n0,posL)," ")}
//console.log("n0="+n0+" | posL="+posL+" | str.length-n0="+(str.length-n0)+" | 600 car.: "+str.substr(0,600));
str = str.replace(/TERMS of Use|MAP DATA|Report a map error|Flightradar24.com - Simple version|Google/ig,""); // supprime le pied
str = str.replace(/\s+/g," "); // suppr. multiple espace
str = str.trim();
/// CORRECT IF "(UTC " present, then adjust times
var utcorig = str, utctimes = [], utsplit = [], utcpartres = [], utcslice;
if (utcorig.includes("(UTC ")) {
var utcsplit = utcorig.split(" (UTC "); // 3 parts, considering 2 last
for (var i = 1; i<3; i++) {var utccor = utcsplit[i].slice(0,3); // each decode offset (sign and value)
if (i<3) {utcsplit[i-1] = utcsplit[i-1].slice(0,utcsplit[i-1].lastIndexOf(" "));} // suppress type of UTC offset (WEST)
utcadd = parseInt(utcsplit[i].slice(0,3)); // pick up adders
utcsplit[i] = utcsplit[i].slice(18); // take rest at NN:NN XXX NN:NN
utctimes[0] = parseInt(utcsplit[i].slice(0,2))-utcadd;
if (utctimes[0]>23) {utctimes[0] = utctimes[0]-24;}
if (utctimes[0]<0) {utctimes[0] = utctimes[0]+24;}
utctimes[0] = (utctimes[0]>9?utctimes[0]:"0"+utctimes[0]); // 2 digits
if (utcsplit[i].includes(":",4)) {
utctimes[1] = parseInt(utcsplit[i].slice(10,12))-utcadd; if (utctimes[1]>23) {utctimes[1] = utctimes[1]-24;};; if (utctimes[1]<0) {utctimes[1] = utctimes[1]+24;}
utctimes[1] = (utctimes[1]>9?utctimes[1]:"0"+utctimes[1]); // 2 digits
utcslice = 12;
} else {utctimes[1] = ""; utcslice = 10;}
utcpartres[i] = (i == 1?"STD":"STA")
utcpartres[i] += " "+utctimes[0]+utcsplit[i].slice(2,10)+utctimes[1]+utcsplit[i].slice(utcslice,utcsplit[i].lastIndexOf(" "))+(i == 2&&utcsplit[i].includes(":",4)?utcsplit[i].slice(-3):"");
}
utcorig = utcsplit[0]+" "+utcpartres[1]+" "+utcpartres[2];
str = utcorig;
}
/// WRITE back to checklink
setColor("checklink","red",0);
document.getElementById("checklink").value = str; // checklink.value.select();
/// EXTRACT VISIBLE if "type" or "callsign" not empty
var flag = false;
if (filter_type.value)
{clear_html("scrat"); flag = true; show_fi("filter_type",0);
}
if (filter_callsign.value)
{if (!flag) {clear_html("scrat");} if (flag&&filter_callsign) {if (lcnt) {document.getElementById("scrat").innerHTML += "
";}} show_fi("filter_callsign",1);
}
/// EXTRACT "@z" format
/* Modèle: https://www.google.com/maps/@46.2299744,6.0919941,13z/data=!
*/
var n1 = str.indexOf("/@")+2; // copié du lien "Report a map error", collé dans "checklink" (format Déc 14)
var n2 = str.indexOf(",",n1);
var n3 = str.indexOf(",",n2+1);
var n4 = str.indexOf("z",n3);
if (n2>n1 && n3>n2 && n4>n3) {
setColor("checklink","green",0);
if (!isNaN(str.slice(n1,n2)) && !isNaN(str.slice(n2+1,n3))) {
document.getElementById("latval").value = Math.round(str.slice(n1,n2)*100)/100;
document.getElementById("longval").value = Math.round(str.slice(n2+1,n3)*100)/100;
}
var zvalue = str.slice(n3+1,n4);
if (parseInt(zvalue)>=1 && parseInt(zvalue)<16) {document.getElementById("zoomval").value = zvalue;}
document.getElementById("checklink").value = str.slice(n1-1,n4+1) + "\n" + str.slice(n1,n3);
colLabel();
visu.value = str.slice(n4+1).replace(/%20/g," ").substr(0,24); // complete visu field
} else { // copié du tableau de sélection à gauche (champs Latitude à Longitude) [n0: Registration], collé dans "checklink"
var n0 = str.indexOf("REGISTRATION "); if (n0 > -1) {var na = str.slice(n0+13,str.indexOf(" ",n0+13)); if (na != "N/A") {(document.getElementById("regval").value != ""?clear_f("regval"):""); document.getElementById("regval").value = na} setColor("checklink","green",0);}
var n1 = str.indexOf("latitude");
var n2 = str.indexOf("long");
var n3 = str.indexOf("gitude");
var n4 = (str.indexOf(" ",n3+7)>n3?str.indexOf(" ")-1:n3+15);
if (n1>-1 && n2>n1 && n3>n2) {
setColor("checklink","green",0);
if (strp_str(str.slice(n1+9,n2-1))) {document.getElementById("latval").value = Math.round(parseInt(strp_str(str.slice(n1+9,n2-1))*100))/100;}
if (strp_str(str.slice(n3+7,n4))) {document.getElementById("longval").value = Math.round(parseInt(strp_str(str.slice(n3+7,n4))*100))/100;}
}
/// EXTRACT GOOGLE format ll
if (str.search("ll=")>-1) { // format Google.map
setColor("checklink","green",0);
var gx = str.match(/\?ll=(.*?)&t/);
gx = gx[1].replace(/&z=/i,",");
checklink.value = "@"+gx+"z";
var gx = gx.split(",");
if (!isNaN(gx[0]) && !isNaN(gx[1])) {
document.getElementById("latval").value = Math.round(gx[0]*100)/100;
document.getElementById("longval").value = Math.round(gx[1]*100)/100;
document.getElementById("zoomval").value = gx[2];}
}
colLabel();
}
function elim_dbl(str,orig) { // elimine doublons
var dbln=0, str1 = str.sort();
for (ie=1; ie" + prnt + ": " + sca + (sca>1?" avions visibles":" avion visible") + elim_dbl(scas,orig)+"":"");
}
if (lcnt>1&&dcnt>5) {document.getElementById("scrat").innerHTML += "total ("+_filtre_o[orig]+"): "+dcnt+(dcnt>1?" avions visibles":" avion visible")+"
"}; document.getElementById("scrat").innerHTML += show_res;
}
/// cas où élément fa est au début de l'array scasx => ajouter un élément non-espace au début de scasx pour permettre le test du caractère précédent !=? espace
function zearch_false(scasx,fa,tmp1) {if (str1.indexOf(fa) == 0) {scasx.unshift("@")} for (var iz=1; iz-1) {tmp1++} (0?console.log("fa="+fa+" | "+scasx[iz-1].slice(-1).toLowerCase()+fa+" | "+_doute.indexOf(scasx[iz-1].slice(-1).toLowerCase()+fa)+" | tmp1:"+tmp1):""); (0?console.log(fa+" "+scasx[iz-1].lastIndexOf(" ")+" "+(scasx[iz-1].length-1)+" "+scasx[iz-1].substr(scasx[iz-1].lemgth,1)+" "+tmp1):"");} return tmp1
}
function strp_str(string) { // enlève tous les espaces
return string.replace(/\x20/g,"");
}
//setColor("go","red",0); //?
}
var varStore = [];
function clear_f(d) {
var aaa = document.getElementById(d).value, bbb = (typeof(varStore[d]) == "undefined"?"":varStore[d]), tmp;
tmp = aaa; aaa = bbb; bbb = tmp; // swap
document.getElementById(d).value = aaa; varStore[d] = (aaa === bbb?"":bbb); // avoid same value in both
document.getElementById(d).focus();
if (varStore[d]) {classRed("p"+d);} else {classBlack("p"+d);}
}
function classReplace(where) {where1 = document.getElementById(where); where1.classList.toggle("dbfr"); where1.classList.toggle("dbfn") // not used
}
function classRed(where) {where1 = document.getElementById(where); where1.classList.remove("dbfn"); where1.classList.add("dbfr")
}
function classBlack(where) {where1 = document.getElementById(where); where1.classList.remove("dbfr"); where1.classList.add("dbfn")
}
function clear_ff(d) { // efface double
varStore[d] = "";
document.getElementById(d).value = "";
document.getElementById(d).focus();
}
var regex = /( |<([^>]+)>)/ig;
function setColor(d,ncolor,b) {
if (typeof b === 'undefined') {b = 0}; //console.log("d="+d+" | "+arguments.callee.caller.name+" | "+typeof d);
if (typeof d == "object") {d="timedCount"} //{console.log("object d="+d+" | "+arguments.callee.caller.name)}
document.getElementById(d).style.color = ncolor;
if (b == 1) { // b est le paramètre indiquant de changer le tag background (1 ou 0)
var oldback = document.getElementById(d).innerHTML;
var newback = ""+oldback+"";
if (ncolor == "red" || (d == "dt"&&ncolor == "green")) {document.getElementById(d).innerHTML=newback;} else {document.getElementById(d).innerHTML=oldback.replace(regex, ""); //console.log("oldback="+oldback.replace(regex, ""));
}
}
}
function setbgcolor (d,color) {if (d == "dt") document.getElementById(d).style.backgroundColor = color
}
function clear_html(d) {document.getElementById(d).innerHTML = "";
}
function ret_date() {
var d = new Date();
var mois = checkLead(d.getUTCMonth()+1);
var jours = checkLead(d.getUTCDate());
return d.getFullYear()+'-'+mois+'-'+jours;
}
function whichKey(e) {
if (window.event) {
evt=event.keyCode;
} else {
evt= e.which;
}
}
function clrevt() {evt=""}
var evt="";
document.onkeydown = whichKey;
document.onkeyup = clrevt;
function ret_time() {
var d = new Date();
var min_u = d.getUTCMinutes()-10; // moins 10 min
if (event.shiftKey || event.altKey || 0) {min_u+=10} // shift ou alt ou API?
var heur = d.getUTCHours();
if (min_u<0) {min_u += 60; heur -= 1;}
if (heur<0) {heur += 24;}
return checkLead(heur)+':'+checkLead(min_u);
}
function svtime() {
(timeb?document.getElementById("checklink").value += "\nheure précédente: "+timeb:""); // copy last saved htime into checklink
}
var locw = "", trafcnt = 109, loct=""; // position within msg trafic for title (subtract 5 for every "→")
function stripFirstFig (ftext) {
for (i=0; i"z" && ftext.substr(0,1) < "0") || ftext.substr(0,1) == "–") {ftext = ftext.substr(1,ftext.length-1)} // strip leading higher than z
return ftext;
}
function copyCoord1() { // when click on text "Waypoints", reset to initial wpts
if (typeof selectm != "undefined") {copyCoord(selectw1,selectw); document.getElementById("repPoint").selectedIndex = parseInt(selectm[3]); colLabel();}
}
function copyCoord(line,text) {
if (typeof text == "undefined") {text = ""};
//if (typeof selectm != "undefined" && evt == 17) {repPoint.selectedIndex = parseInt(selectm[3])} // not useful
text = stripFirstFig(text); // all before 1st figure
var cooor = line.split(" ");
if (line) {
var checkl = document.getElementById("checklink");
// checkl.value = text + " \n" + "LATITUDE " + line.replace(" "," LONGITUDE "); fill_paste();
document.getElementById("latval").value = cooor[0]; document.getElementById("longval").value = cooor[1];
checkl.value = "@" + line.replace(" ",",") + ",10z" + unicode(text); checkl.style.color = "black";} // display @ format in checklink
locw = (text.match(" ")?text.slice(-3).toLowerCase():"");
if (text != "Select coord.") {loct = (text.split(" ").length>1?text.slice(0,-4):text); trafic.title = trafic.title.slice(0,trafcnt) + loct;}
else {loct = ""}
docTitle(traf + baloon() + "à " + loct); // docTitle(traf + "à " + text.slice(0,-4));
if (text.split(" ").length > 1 && !event.shiftKey) {fillvisu(loct)} else {fillvisu(text)} // update visu copycopy
dispMessage(""+text+"",false); // show text briefly
}
function transfer_(origin,destination) {
var tor = document.getElementById(origin).value; var tde = document.getElementById(destination).value; document.getElementById(destination).value = tor; document.getElementById(origin).value = tde
}
function putTitle(d,textSup) {
(evt == 16?textSup="":""); //shift
if (document.getElementById(d).value) {document.getElementById(d).title=""} else {document.getElementById(d).title="double clic: [UTC]" + textSup;}
}
function warnFilter() {
if (filter_type.value || filter_callsign.value || maxspeed.value || minspeed.value || maxalt.value || minalt.value) {setColor("tit_fil","red",1);} else {setColor("tit_fil",inherit,1);}
}
function TogHist() {
if (document.getElementById("dt").style.color == "green" && document.getElementById("hdate").value && document.getElementById("htime").value) {setColor("histo","red",1);} else {setColor("histo",inherit,1);}
if (Array.isArray(document.getElementById("hdate").value.match(/[^0-9-]/g))) {document.getElementById("hdate").value = "";}
if (Array.isArray(document.getElementById("htime").value.match(/[^0-9:]/g))) {document.getElementById("htime").value = "";}
timeb = document.getElementById("htime").value; // save present value somewhere
}
function FiCheck() {
if (filter_type.value || filter_callsign.value) {setColor("tit_fil","red",1);} else {setColor("tit_fil",inherit,1);}
}
function capt_label() {document.getElementById("capt_lab").innerHTML=""+(document.getElementById("sizval").checked == true?" actives":" inactives");
}
var _airl_even = ""; for (var i=3; i<_airl.length; i+=2) {_airl_even += _airl[i]+(i>_airl.length-2?"":",");}
var _airl_short = _airl_even;
var _type_even = ""; for (var i=3; i<_type.length; i+=2) {_type_even += _type[i]+(i>_type.length-2?"":",");}
function fi_all(d) {if (d == "filter_callsign") {document.getElementById(d).value = (event.shiftKey?(sig_code?ficcMod():_airl_short):_airl_even)}
// else {document.getElementById(d).value = (event.shiftKey?"A,B,D,R,C,G,P,S,T,F,J,E,H,I,L,M,X,V":_type_even)};
else {document.getElementById(d).value = (event.shiftKey?typnog:_type_even)}; // special config without GRND
}
function ficcMod() {var fiMo = (filter_callsign.value.search(" ")>-1?filter_callsign.value:" "+filter_callsign.value.replace(/,/g,", ")); return fiMo.replace(/ n/,"|n");;
}
function firstFicoAll() {
if (ficoAll == 2) {filter_callsign.value = (sig_code?" "+_airl_short.replace(/,/g,", ").replace(/ n/,"|n"):_airl_short)} else if (ficoAll == 1) {filter_callsign.value = _airl_short} else {return ""}
}
function removeDuplicate(list,remair) { //http://www.roseindia.net/java/javascript-array/javascript-array-remove-duplicat.shtml
remair = (remair == "undefined"?"":remair);
list = list.replace(/\x20/g,(sig_code&&remair?"¬":"")); // if not CCode => strip spaces, else replace with "¬"
if (list) {
var arrayName = [];
arrayName = list.split(",");
var newArray = [];
label:for(var i=0; i-1)
continue label;
}
newArray[newArray.length] = arrayName[i].replace(/¬/g," ");
}
return newArray;
} else return "";
}
function recheck(formul,nameu,val) {
var f = document.forms[formul]; //console.log("formul="+formul+", nameu="+nameu+", val="+nameu+",f.length="+f.elements.length+", f(3)="+f[3])
for (var i=0; i new right hand window else floating window
if (evt == 16) {deletethis(fieldv)}; // if shift -> erase fieldv as last operation
}
function colLabel() { // check selected coord match the lat&long&zoom and set color accordingly
var idex = document.getElementById("label_opt").selectedIndex;
var idey = document.getElementById("repPoint").selectedIndex;
var coy = document.getElementById("repPoint")[idey].value.split(" ");
var latvaln = Number(document.getElementById("latval").value), longvaln = Number(document.getElementById("longval").value);
if (latvaln == _lat[idex] && longvaln == _long[idex] && document.getElementById("zoomval").value == _scale[idex]) {setColor("label_opt",inherit);}
else {setColor("label_opt","crimson");}
if (latvaln == coy[0] && longvaln == coy[1] || !idey) {setColor("repPoint",inherit);}
else {setColor("repPoint","crimson");}
}
function rectz() { // correct wrong zoom value
var zv = parseInt(document.getElementById("zoomval").value);
if (zv>15 || zv<1) {zoomval.value="12";}
}
function init_hist() { // si "&his=act" n'active pas "date+heure"
if (document.getElementById("hdate").value) {InsertContent("date_"); (hdate.value != "act"?setColor("dt","green",1):""); setColor("histo","red",1); subst();}
}
var copyClick = function() {
if (event.shiftKey) {var cklval = document.getElementById("checklink").value; htempo.innerHTML = htime.value; var acttime = cklval.slice(cklval.indexOf("ATD ")+4,cklval.indexOf("ATD ")+9); (acttime == "- CDG"?"":htime.value = acttime);} /*si shift -> met l'heure de ATD dans htime*/
var delta = 0, d = new Date(), y = document.getElementById("htime").value;
if (!y) {console.warn("hour field empty"); InsertContent('date_'); htime.style.background="pink"; flash("copypos",200); return false} else {
var th = parseInt(y.substr(0,1))*10+parseInt(y.substr(1,1))
var tm = parseInt(y.substr(3,1))*10+parseInt(y.substr(4,1))
th -= d.getTimezoneOffset()/60
if (th >= 24) {th -= 24; delta = 1;}
if (th < 0) {th += 24; delta = -1;}
y = document.getElementById("hdate").value;
if (!y) {console.warn("date field empty"); InsertContent('date_'); hdate.style.background="pink"; flash("copypos",200); return false} else {
y = y.replace(/-/ig,"");
var jo = parseInt(y.substr(6,1))*10+parseInt(y.substr(7.1)); // jour
var mo = parseInt(y.substr(4,1))*10+parseInt(y.substr(5,1)); // mois
var an = parseInt(y.substr(0,4)); // an
jo = parseInt(jo + delta);
if (jo == 0) {jo=31; mo-=1;
if (mo == 2 || mo == 4 || mo == 6 || mo == 9 || mo == 11) {jo=30;} if (mo == 2) {jo = 28}}
if (jo == 32 || (jo == 31 && (mo == 4 || mo == 6 || mo == 9 || mo == 11)) || (jo == 29 && mo == 2)) {jo = 1; mo += 1;}
if (mo == 0) {mo = 12; an -= 1;}
if (mo == 13) {mo = 1; an += 1;}
var TimeStamp = checkLead(th)+":"+checkLead(tm)+" "+checkLead(jo)+"."+checkLead(mo)+"."+checkLeads(an)+" ";
document.getElementById("checklink").value = TimeStamp+document.getElementById("checklink").value;
var copyText = document.getElementById("checklink");
copyText.select();
document.execCommand("Copy",false,null);
document.getElementById("checklink").focus();
document.getElementById("checklink").select();
clear_html("scrat");
}}}
var scratText = function() {
if (evt == 16) {
if (typeof q1 === "undefined") {var q = new Date()} else {var q = q1};
var containerid = "scrat";
var n = q.getTimezoneOffset(); n = (n == 0?"":n*-1/60); n = "UTC"+(n>-1?"+":"")+n;
var DateStamp = checkLead(q.getHours())+":"+checkLead(q.getMinutes())+" "+checkLead(q.getDate())+"."+checkLead(q.getMonth()+1)+"."+q.getFullYear()+" "+n;
document.getElementById(containerid).innerHTML = ""+DateStamp+"
"+document.getElementById(containerid).innerHTML;
if (document.selection) {
var range = document.body.createTextRange();
range.moveToElementText(document.getElementById(containerid));
range.select();
document.execCommand("Copy",false,null);
document.getElementById("adate").outerHTML = "";
//range.blur();
} else if (window.getSelection) {
var range = document.createRange();
range.selectNode(document.getElementById(containerid));
window.getSelection().removeAllRanges();
window.getSelection().addRange(range);
document.execCommand("Copy",false,null);
document.getElementById("adate").outerHTML = "";
setTimeout(function(){removeselect();},200);
}
}
else if (evt == 17) {clear_html("scrat");}
else explain();
}
function removeselect() {window.getSelection().removeAllRanges();
}
function explain() {var DateStamp = checkLead(q1.getHours())+":"+checkLead(q1.getMinutes())+" "+checkLead(q1.getDate())+"."+checkLead(q1.getMonth()+1)+"."+q1.getFullYear()
document.getElementById("scrat1").innerHTML = "shift + click = copy
ctrl + click = clearTime + date = "+DateStamp+"
"; setTimeout(function(){clear_html("scrat1");},6000);
}
function cpa() {flightradar.focus(); document.flightradar.select(); document.execCommand("copy",false,null); //ne fonctionne pas: The frame requesting access has a protocol of "http", the frame being accessed has a protocol of "https". Protocols must match.
}
var ary1 = []; var ary2 = [];
function splitArray(sourceArray) {
ary1 = []; ary2 = [];
for (var i = 2; i"+ary1.length.toString()+""); ary1.push("items");}
// var listTable = "