forEach Array in Array print all results in one line - javascript

please need your help as I am still learning. I've been looking for 2 days and I've come as far as here. Now I've tried various things and just can't get any further.
var txt ='%xt%ain%1%0%{"A":{"DOA":1,"SP":1,"BL":[],"BC":[],"M":[{"OID":6233759,"DUM":false,"N":"Kilian29","E":{"BGT":3,"BGC1":14408394,"BGC2":39783,"SPT":4,"S1":29,"SC1":14408394,"S2":13,"SC2":11993088,"IS":1},"L":22,"LL":0,"H":0,"AVP":70,"CF":23,"HF":23,"PRE":1,"SUF":-1,"TOPX":-1,"MP":786,"R":0,"AID":146249,"AR":7,"AN":"Klasse 1b","RPT":0,"AP":[[0,7492461,919,53,1],[0,7577432,920,49,4]],"VP":[],"SA":0,"VF":0,"PF":0,"RRD":0,"TI":-1},{"OID":6238489,"DUM":false,"N":"JohnDoe","E":{"BGT":3,"BGC1":14408394,"BGC2":13509737,"SPT":4,"S1":29,"SC1":14408394,"S2":13,"SC2":11993088,"IS":1},"L":22,"LL":0,"H":0,"AVP":65,"CF":18,"HF":18,"PRE":0,"SUF":-1,"TOPX":-1,"MP":1086,"R":0,"AID":146249,"AR":7,"AN":"Klasse 1b","RPT":0,"AP":[[0,7452613,926,66,4],[0,7494756,925,63,1]],"VP":[],"SA":0,"VF":0,"PF":0,"RRD":0,"TI":-1},{"OID":6233816,"DUM":false,"N":"Skelletor98","E":{"BGT":3,"BGC1":14408394,"BGC2":5319690,"SPT":4,"S1":29,"SC1":14408394,"S2":13,"SC2":11993088,"IS":1},"L":22,"LL":0,"H":0,"AVP":70,"CF":0,"HF":0,"PRE":0,"SUF":-1,"TOPX":-1,"MP":707,"R":0,"AID":146249,"AR":7,"AN":"Klasse 1b","RPT":0,"AP":[[0,7492496,916,52,1],[0,7577439,918,57,4]],"VP":[],"SA":0,"VF":0,"PF":0,"RRD":0,"TI":-1},{"OID":6233751,"DUM":false,"N":"Gudrun1947","E":{"BGT":3,"BGC1":14408394,"BGC2":1644825,"SPT":4,"S1":29,"SC1":14408394,"S2":13,"SC2":11993088,"IS":1},"L":22,"LL":0,"H":0,"AVP":70,"CF":668,"HF":668,"PRE":2,"SUF":-1,"TOPX":-1,"MP":888,"R":0,"AID":146249,"AR":7,"AN":"Klasse 1b","RPT":0,"AP":[[0,7492452,914,65,1],[0,7570865,916,63,4],[0,7590122,910,68,4]],"VP":[],"SA":0,"VF":0,"PF":0,"RRD":0,"TI":-1},{"OID":6240471,"DUM":false,"N":"Lausebub","E":{"BGT":3,"BGC1":14408394,"BGC2":5319690,"SPT":4,"S1":29,"SC1":14408394,"S2":13,"SC2":11993088,"IS":1},"L":22,"LL":0,"H":0,"AVP":535,"CF":176,"HF":176,"PRE":2,"SUF":-1,"TOPX":-1,"MP":956,"R":0,"AID":146249,"AR":7,"AN":"Klasse 1b","RPT":0,"AP":[[0,7478154,910,62,4],[0,7496479,909,61,1]],"VP":[],"SA":0,"VF":0,"PF":0,"RRD":0,"TI":-1},{"OID":6240533,"DUM":false,"N":"Omikroon","E":{"BGT":3,"BGC1":14408394,"BGC2":5319690,"SPT":4,"S1":29,"SC1":14408394,"S2":13,"SC2":11993088,"IS":1},"L":22,"LL":0,"H":0,"AVP":505,"CF":460,"HF":460,"PRE":2,"SUF":-1,"TOPX":-1,"MP":884,"R":0,"AID":146249,"AR":7,"AN":"Klasse 1b","RPT":0,"AP":[[0,7496534,911,57,1],[0,7578396,908,62,4]],"VP":[],"SA":0,"VF":0,"PF":0,"RRD":0,"TI":-1},{"OID":6233743,"DUM":false,"N":"Constanze66","E":{"BGT":3,"BGC1":14408394,"BGC2":16341788,"SPT":4,"S1":29,"SC1":14408394,"S2":13,"SC2":11993088,"IS":1},"L":22,"LL":0,"H":0,"AVP":70,"CF":0,"HF":0,"PRE":0,"SUF":-1,"TOPX":-1,"MP":742,"R":0,"AID":146249,"AR":7,"AN":"Klasse 1b","RPT":0,"AP":[[0,7450275,927,67,4],[0,7492447,923,69,1]],"VP":[],"SA":0,"VF":0,"PF":0,"RRD":0,"TI":-1},{"OID":6233837,"DUM":false,"N":"KillerHai1","E":{"BGT":3,"BGC1":14408394,"BGC2":39783,"SPT":4,"S1":29,"SC1":14408394,"S2":13,"SC2":11993088,"IS":1},"L":22,"LL":0,"H":0,"AVP":70,"CF":0,"HF":0,"PRE":0,"SUF":-1,"TOPX":-1,"MP":729,"R":0,"AID":146249,"AR":7,"AN":"Klasse 1b","RPT":0,"AP":[[0,7352073,918,61,4],[0,7492513,920,61,1]],"VP":[],"SA":0,"VF":0,"PF":0,"RRD":0,"TI":-1},{"OID":6238188,"DUM":false,"N":"Kong25","E":{"BGT":3,"BGC1":14408394,"BGC2":39783,"SPT":4,"S1":29,"SC1":14408394,"S2":13,"SC2":11993088,"IS":1},"L":22,"LL":0,"H":0,"AVP":55,"CF":28,"HF":28,"PRE":1,"SUF":-1,"TOPX":-1,"MP":784,"R":0,"AID":146249,"AR":7,"AN":"Klasse 1b","RPT":0,"AP":[[0,7494539,914,57,1],[0,7577664,914,63,4]],"VP":[],"SA":0,"VF":0,"PF":0,"RRD":0,"TI":-1},{"OID":6238504,"DUM":false,"N":"Kaboom6","E":{"BGT":3,"BGC1":14408394,"BGC2":1644825,"SPT":4,"S1":29,"SC1":14408394,"S2":13,"SC2":11993088,"IS":1},"L":22,"LL":0,"H":100,"AVP":515,"CF":67,"HF":67,"PRE":1,"SUF":-1,"TOPX":-1,"MP":795,"R":0,"AID":146249,"AR":7,"AN":"Klasse 1b","RPT":0,"AP":[[0,7494766,934,65,1],[0,7578388,933,63,4],[0,7590074,936,67,4]],"VP":[],"SA":0,"VF":0,"PF":0,"RRD":0,"TI":-1},{"OID":6233735,"DUM":false,"N":"Baltilde1","E":{"BGT":3,"BGC1":14408394,"BGC2":39783,"SPT":4,"S1":29,"SC1":14408394,"S2":13,"SC2":11993088,"IS":1},"L":22,"LL":0,"H":0,"AVP":65,"CF":171,"HF":171,"PRE":2,"SUF":-1,"TOPX":-1,"MP":890,"R":0,"AID":146249,"AR":0,"AN":"Klasse 1b","RPT":0,"AP":[[0,7249101,924,70,4],[0,7492437,924,72,1]],"VP":[],"SA":0,"VF":0,"PF":0,"RRD":0,"TI":-1},{"OID":6238471,"DUM":false,"N":"Pfeiffer2","E":{"BGT":3,"BGC1":14408394,"BGC2":13550873,"SPT":4,"S1":29,"SC1":14408394,"S2":13,"SC2":11993088,"IS":1},"L":22,"LL":0,"H":0,"AVP":65,"CF":34,"HF":34,"PRE":1,"SUF":-1,"TOPX":-1,"MP":1344,"R":0,"AID":146249,"AR":7,"AN":"Klasse 1b","RPT":0,"AP":[[0,7163457,907,53,4],[0,7494740,914,54,1]],"VP":[],"SA":0,"VF":0,"PF":0,"RRD":0,"TI":-1},{"OID":6238182,"DUM":false,"N":"Furry95","E":{"BGT":3,"BGC1":14408394,"BGC2":39783,"SPT":4,"S1":29,"SC1":14408394,"S2":13,"SC2":11993088,"IS":1},"L":22,"LL":0,"H":0,"AVP":70,"CF":0,"HF":0,"PRE":0,"SUF":-1,"TOPX":-1,"MP":711,"R":0,"AID":146249,"AR":7,"AN":"Klasse 1b","RPT":0,"AP":[[0,7430487,924,61,4],[0,7494530,925,60,1]],"VP":[],"SA":0,"VF":0,"PF":0,"RRD":0,"TI":-1},{"OID":6240038,"DUM":false,"N":"CatWoomen","E":{"BGT":3,"BGC1":8993831,"BGC2":11993088,"SPT":4,"S1":29,"SC1":14408394,"S2":13,"SC2":11993088,"IS":1},"L":22,"LL":0,"H":0,"AVP":500,"CF":28,"HF":28,"PRE":1,"SUF":-1,"TOPX":-1,"MP":1202,"R":0,"AID":146249,"AR":7,"AN":"Klasse 1b","RPT":0,"AP":[[0,7418039,923,53,4],[0,7496059,924,54,1]],"VP":[],"SA":0,"VF":0,"PF":0,"RRD":0,"TI":-1},{"OID":6233891,"DUM":false,"N":"Flipper78","E":{"BGT":3,"BGC1":14408394,"BGC2":39783,"SPT":4,"S1":29,"SC1":14408394,"S2":13,"SC2":11993088,"IS":1},"L":22,"LL":0,"H":0,"AVP":70,"CF":0,"HF":0,"PRE":0,"SUF":-1,"TOPX":-1,"MP":708,"R":0,"AID":146249,"AR":7,"AN":"Klasse 1b","RPT":0,"AP":[[0,7450927,920,59,4],[0,7492557,927,58,1]],"VP":[],"SA":0,"VF":0,"PF":0,"RRD":0,"TI":-1}],"AID":146249,"N":"Klasse 1b","CF":549,"MP":13212,"D":"Beschreibt hier Eure Allianz!","ALL":"de","HP":1,"IS":1,"IA":0,"KA":0,"ML":0}}%'
if (txt.includes('%xt%ain%1%0%')) {
var Alli = JSON.parse(txt.replace(/.*?({.*}).*/, "$1"))
Alli.A.M.forEach(spieler);
function spieler(item) {
console.log("Allianz:" + item.AN + " ;" + "Name:" + item.N + ";" + " MP:" + item.MP + " ;" + "OID:" + item.OID + " ;" + "Level:" + item.L + "; " + "LL:" + item.LL + " ;" + "Taube:" + item.RPT + " ;" + item.AP)
}
}
So far everything is as I want it.
Get all the information I need.
After that I tried the following:
Alli.A.M.forEach(spieler);
function spieler(item) {
var burgen = item.AP.forEach(burgen);
function burgen(burg) {
var welt = burg[0]
var art = burg[4]
var x = burg[2]
var y = burg[3]
var koor = x + ":" + y
if (welt === 0 && art === 4) {
var bn = "AP"
}
if (welt === 0 && art === 1) {
var bn = "HB"
}
if (welt === 0 && art === 3) {
var bn = "HS Grün"
}
if (welt === 0 && art === 22) {
var bn = "HM"
}
if (welt === 0 && art === 23) {
var bn = "KT"
}
if (welt === 0 && art === 26) {
var bn = "Monument"
}
if (welt === 0 && art === 28) {
var bn = "Labor"
}
if (welt === 2 && art === 12) {
var bn = "Eis"
}
if (welt === 2 && art === 3) {
var bn = "Eis HS"
}
if (welt === 1 && art === 12) {
var bn = "Sand"
}
if (welt === 1 && art === 3) {
var bn = "Sand HS"
}
if (welt === 3 && art === 12) {
var bn = "Feuer"
}
if (welt === 3 && art === 3) {
var bn = "Feuer HS"
}
if (welt === 4 && art === 12) {
var bn = "Wasser"
}
if (welt === 4 && art === 24) {
var bn = "RohstoffInsel"
}
console.log("Allianz:" + item.AN + " ;" + "Name:" + item.N + ";" + " MP:" + item.MP + " ;" + "OID:" + item.OID + " ;" + "Level:" + item.L + "; " + "LL:" + item.LL + " ;" + "Taube:" + item.RPT + " ;" + bn + ":" + koor)
}
}
item.AP2 is the Second Array
This also works almost as I want, except for one small problem
If you look at the picture1, you will see the name twice under each other with the correct data.
What I would like to have now is where I can't get any further
I would like to output the data all in one line, like in picture 2.
I hope to be able to explain my problem as well as possible

Every call to console.log() is on a new line. If you want everything on one line, concatenate them all into a string and log that at the end.
Have the function return the string instead of logging it. Then you can use map() to get all of them in an array, and join() to concatenate them.
var txt ='%xt%ain%1%0%{"A":{"DOA":1,"SP":1,"BL":[],"BC":[],"M":[{"OID":6233759,"DUM":false,"N":"Kilian29","E":{"BGT":3,"BGC1":14408394,"BGC2":39783,"SPT":4,"S1":29,"SC1":14408394,"S2":13,"SC2":11993088,"IS":1},"L":22,"LL":0,"H":0,"AVP":70,"CF":23,"HF":23,"PRE":1,"SUF":-1,"TOPX":-1,"MP":786,"R":0,"AID":146249,"AR":7,"AN":"Klasse 1b","RPT":0,"AP":[[0,7492461,919,53,1],[0,7577432,920,49,4]],"VP":[],"SA":0,"VF":0,"PF":0,"RRD":0,"TI":-1},{"OID":6238489,"DUM":false,"N":"JohnDoe","E":{"BGT":3,"BGC1":14408394,"BGC2":13509737,"SPT":4,"S1":29,"SC1":14408394,"S2":13,"SC2":11993088,"IS":1},"L":22,"LL":0,"H":0,"AVP":65,"CF":18,"HF":18,"PRE":0,"SUF":-1,"TOPX":-1,"MP":1086,"R":0,"AID":146249,"AR":7,"AN":"Klasse 1b","RPT":0,"AP":[[0,7452613,926,66,4],[0,7494756,925,63,1]],"VP":[],"SA":0,"VF":0,"PF":0,"RRD":0,"TI":-1},{"OID":6233816,"DUM":false,"N":"Skelletor98","E":{"BGT":3,"BGC1":14408394,"BGC2":5319690,"SPT":4,"S1":29,"SC1":14408394,"S2":13,"SC2":11993088,"IS":1},"L":22,"LL":0,"H":0,"AVP":70,"CF":0,"HF":0,"PRE":0,"SUF":-1,"TOPX":-1,"MP":707,"R":0,"AID":146249,"AR":7,"AN":"Klasse 1b","RPT":0,"AP":[[0,7492496,916,52,1],[0,7577439,918,57,4]],"VP":[],"SA":0,"VF":0,"PF":0,"RRD":0,"TI":-1},{"OID":6233751,"DUM":false,"N":"Gudrun1947","E":{"BGT":3,"BGC1":14408394,"BGC2":1644825,"SPT":4,"S1":29,"SC1":14408394,"S2":13,"SC2":11993088,"IS":1},"L":22,"LL":0,"H":0,"AVP":70,"CF":668,"HF":668,"PRE":2,"SUF":-1,"TOPX":-1,"MP":888,"R":0,"AID":146249,"AR":7,"AN":"Klasse 1b","RPT":0,"AP":[[0,7492452,914,65,1],[0,7570865,916,63,4],[0,7590122,910,68,4]],"VP":[],"SA":0,"VF":0,"PF":0,"RRD":0,"TI":-1},{"OID":6240471,"DUM":false,"N":"Lausebub","E":{"BGT":3,"BGC1":14408394,"BGC2":5319690,"SPT":4,"S1":29,"SC1":14408394,"S2":13,"SC2":11993088,"IS":1},"L":22,"LL":0,"H":0,"AVP":535,"CF":176,"HF":176,"PRE":2,"SUF":-1,"TOPX":-1,"MP":956,"R":0,"AID":146249,"AR":7,"AN":"Klasse 1b","RPT":0,"AP":[[0,7478154,910,62,4],[0,7496479,909,61,1]],"VP":[],"SA":0,"VF":0,"PF":0,"RRD":0,"TI":-1},{"OID":6240533,"DUM":false,"N":"Omikroon","E":{"BGT":3,"BGC1":14408394,"BGC2":5319690,"SPT":4,"S1":29,"SC1":14408394,"S2":13,"SC2":11993088,"IS":1},"L":22,"LL":0,"H":0,"AVP":505,"CF":460,"HF":460,"PRE":2,"SUF":-1,"TOPX":-1,"MP":884,"R":0,"AID":146249,"AR":7,"AN":"Klasse 1b","RPT":0,"AP":[[0,7496534,911,57,1],[0,7578396,908,62,4]],"VP":[],"SA":0,"VF":0,"PF":0,"RRD":0,"TI":-1},{"OID":6233743,"DUM":false,"N":"Constanze66","E":{"BGT":3,"BGC1":14408394,"BGC2":16341788,"SPT":4,"S1":29,"SC1":14408394,"S2":13,"SC2":11993088,"IS":1},"L":22,"LL":0,"H":0,"AVP":70,"CF":0,"HF":0,"PRE":0,"SUF":-1,"TOPX":-1,"MP":742,"R":0,"AID":146249,"AR":7,"AN":"Klasse 1b","RPT":0,"AP":[[0,7450275,927,67,4],[0,7492447,923,69,1]],"VP":[],"SA":0,"VF":0,"PF":0,"RRD":0,"TI":-1},{"OID":6233837,"DUM":false,"N":"KillerHai1","E":{"BGT":3,"BGC1":14408394,"BGC2":39783,"SPT":4,"S1":29,"SC1":14408394,"S2":13,"SC2":11993088,"IS":1},"L":22,"LL":0,"H":0,"AVP":70,"CF":0,"HF":0,"PRE":0,"SUF":-1,"TOPX":-1,"MP":729,"R":0,"AID":146249,"AR":7,"AN":"Klasse 1b","RPT":0,"AP":[[0,7352073,918,61,4],[0,7492513,920,61,1]],"VP":[],"SA":0,"VF":0,"PF":0,"RRD":0,"TI":-1},{"OID":6238188,"DUM":false,"N":"Kong25","E":{"BGT":3,"BGC1":14408394,"BGC2":39783,"SPT":4,"S1":29,"SC1":14408394,"S2":13,"SC2":11993088,"IS":1},"L":22,"LL":0,"H":0,"AVP":55,"CF":28,"HF":28,"PRE":1,"SUF":-1,"TOPX":-1,"MP":784,"R":0,"AID":146249,"AR":7,"AN":"Klasse 1b","RPT":0,"AP":[[0,7494539,914,57,1],[0,7577664,914,63,4]],"VP":[],"SA":0,"VF":0,"PF":0,"RRD":0,"TI":-1},{"OID":6238504,"DUM":false,"N":"Kaboom6","E":{"BGT":3,"BGC1":14408394,"BGC2":1644825,"SPT":4,"S1":29,"SC1":14408394,"S2":13,"SC2":11993088,"IS":1},"L":22,"LL":0,"H":100,"AVP":515,"CF":67,"HF":67,"PRE":1,"SUF":-1,"TOPX":-1,"MP":795,"R":0,"AID":146249,"AR":7,"AN":"Klasse 1b","RPT":0,"AP":[[0,7494766,934,65,1],[0,7578388,933,63,4],[0,7590074,936,67,4]],"VP":[],"SA":0,"VF":0,"PF":0,"RRD":0,"TI":-1},{"OID":6233735,"DUM":false,"N":"Baltilde1","E":{"BGT":3,"BGC1":14408394,"BGC2":39783,"SPT":4,"S1":29,"SC1":14408394,"S2":13,"SC2":11993088,"IS":1},"L":22,"LL":0,"H":0,"AVP":65,"CF":171,"HF":171,"PRE":2,"SUF":-1,"TOPX":-1,"MP":890,"R":0,"AID":146249,"AR":0,"AN":"Klasse 1b","RPT":0,"AP":[[0,7249101,924,70,4],[0,7492437,924,72,1]],"VP":[],"SA":0,"VF":0,"PF":0,"RRD":0,"TI":-1},{"OID":6238471,"DUM":false,"N":"Pfeiffer2","E":{"BGT":3,"BGC1":14408394,"BGC2":13550873,"SPT":4,"S1":29,"SC1":14408394,"S2":13,"SC2":11993088,"IS":1},"L":22,"LL":0,"H":0,"AVP":65,"CF":34,"HF":34,"PRE":1,"SUF":-1,"TOPX":-1,"MP":1344,"R":0,"AID":146249,"AR":7,"AN":"Klasse 1b","RPT":0,"AP":[[0,7163457,907,53,4],[0,7494740,914,54,1]],"VP":[],"SA":0,"VF":0,"PF":0,"RRD":0,"TI":-1},{"OID":6238182,"DUM":false,"N":"Furry95","E":{"BGT":3,"BGC1":14408394,"BGC2":39783,"SPT":4,"S1":29,"SC1":14408394,"S2":13,"SC2":11993088,"IS":1},"L":22,"LL":0,"H":0,"AVP":70,"CF":0,"HF":0,"PRE":0,"SUF":-1,"TOPX":-1,"MP":711,"R":0,"AID":146249,"AR":7,"AN":"Klasse 1b","RPT":0,"AP":[[0,7430487,924,61,4],[0,7494530,925,60,1]],"VP":[],"SA":0,"VF":0,"PF":0,"RRD":0,"TI":-1},{"OID":6240038,"DUM":false,"N":"CatWoomen","E":{"BGT":3,"BGC1":8993831,"BGC2":11993088,"SPT":4,"S1":29,"SC1":14408394,"S2":13,"SC2":11993088,"IS":1},"L":22,"LL":0,"H":0,"AVP":500,"CF":28,"HF":28,"PRE":1,"SUF":-1,"TOPX":-1,"MP":1202,"R":0,"AID":146249,"AR":7,"AN":"Klasse 1b","RPT":0,"AP":[[0,7418039,923,53,4],[0,7496059,924,54,1]],"VP":[],"SA":0,"VF":0,"PF":0,"RRD":0,"TI":-1},{"OID":6233891,"DUM":false,"N":"Flipper78","E":{"BGT":3,"BGC1":14408394,"BGC2":39783,"SPT":4,"S1":29,"SC1":14408394,"S2":13,"SC2":11993088,"IS":1},"L":22,"LL":0,"H":0,"AVP":70,"CF":0,"HF":0,"PRE":0,"SUF":-1,"TOPX":-1,"MP":708,"R":0,"AID":146249,"AR":7,"AN":"Klasse 1b","RPT":0,"AP":[[0,7450927,920,59,4],[0,7492557,927,58,1]],"VP":[],"SA":0,"VF":0,"PF":0,"RRD":0,"TI":-1}],"AID":146249,"N":"Klasse 1b","CF":549,"MP":13212,"D":"Beschreibt hier Eure Allianz!","ALL":"de","HP":1,"IS":1,"IA":0,"KA":0,"ML":0}}%'
if (txt.includes('%xt%ain%1%0%')) {
var Alli = JSON.parse(txt.replace(/.*?({.*}).*/, "$1"))
Alli.A.M.forEach(spieler);
}
function spieler(item) {
var burgen = item.AP.map(burgen);
console.log("Allianz:" + item.AN + " ;" + "Name:" + item.N + ";" + " MP:" + item.MP + " ;" + "OID:" + item.OID + " ;" + "Level:" + item.L + "; " + "LL:" + item.LL + " ;" + "Taube:" + item.RPT + " ;" + burgen.join(' ;'))
function burgen(burg) {
var welt = burg[0]
var art = burg[4]
var x = burg[2]
var y = burg[3]
var koor = x + ":" + y
if (welt === 0 && art === 4) {
var bn = "AP"
}
if (welt === 0 && art === 1) {
var bn = "HB"
}
if (welt === 0 && art === 3) {
var bn = "HS Grün"
}
if (welt === 0 && art === 22) {
var bn = "HM"
}
if (welt === 0 && art === 23) {
var bn = "KT"
}
if (welt === 0 && art === 26) {
var bn = "Monument"
}
if (welt === 0 && art === 28) {
var bn = "Labor"
}
if (welt === 2 && art === 12) {
var bn = "Eis"
}
if (welt === 2 && art === 3) {
var bn = "Eis HS"
}
if (welt === 1 && art === 12) {
var bn = "Sand"
}
if (welt === 1 && art === 3) {
var bn = "Sand HS"
}
if (welt === 3 && art === 12) {
var bn = "Feuer"
}
if (welt === 3 && art === 3) {
var bn = "Feuer HS"
}
if (welt === 4 && art === 12) {
var bn = "Wasser"
}
if (welt === 4 && art === 24) {
var bn = "RohstoffInsel"
}
return bn + ":" + koor;
}
}

Related

How to get Google meet link thru google calendar api in javascript?

I want to create a line notify which can send the event detail from my google calendar everyday.
I can get the title, description, location...etc, but I don't see the conference data in calendar API.
I use Google Apps Script to run the code.
Here is my code.
const Now = new Date();
const Start = new Date(new Date().setHours(0, 0, 0, 0));
const End = new Date(new Date().setHours(23, 59, 59, 999));
const calendarData = calendar.getEvents(Start, End);
function Notify() {
var NotifyContents = '';
var i = 1;
calendarData.forEach(item =>{
if (Now <= item.getStartTime()) {
NotifyContents += (item.getTitle() != "") ? ("\n" + i+". "+ item.getTitle() + "\n") : ("\n\nNo Title\n");
NotifyContents += (item.getDescription() != "") ? item.getDescription() + "\n" : "";
NotifyContents += (item.getStartTime() != "" && item.getEndTime() != "") ? "Time:" + item.getStartTime().toLocaleTimeString() + "-" + item.getEndTime().toLocaleTimeString() + "\n": "";
NotifyContents += (item.getconferencedata() != "") ? ("\n" + i+". "+ item.getconferencedata()) : ("No Conference\n");
i++;
}
}
)
if (typeof NotifyContents === 'string' && NotifyContents.length === 0) {
return;
}
NotifyTokens.forEach(function(value){
UrlFetchApp.fetch("https://notify-api.line.me/api/notify", {
"method" : "post",
"payload" : {"message" : NotifyContents},
"headers" : {"Authorization" : "Bearer " + value}
});
});
}
Reference - Calendar API Link
In order to retrieve the meet link from the event, it seems that in the current stage, Calendar API is required to be used. When this is reflected in your script, how about the following modification?
Modified script:
Before you use this script, please enable Calendar API at Advanced Google services.
From:
var NotifyContents = '';
var i = 1;
calendarData.forEach(item => {
if (Now <= item.getStartTime()) {
NotifyContents += (item.getTitle() != "") ? ("\n" + i + ". " + item.getTitle() + "\n") : ("\n\nNo Title\n");
NotifyContents += (item.getDescription() != "") ? item.getDescription() + "\n" : "";
NotifyContents += (item.getStartTime() != "" && item.getEndTime() != "") ? "Time:" + item.getStartTime().toLocaleTimeString() + "-" + item.getEndTime().toLocaleTimeString() + "\n" : "";
NotifyContents += (item.getconferencedata() != "") ? ("\n" + i + ". " + item.getconferencedata()) : ("No Conference\n");
i++;
}
}
)
To:
const eventList = Calendar.Events.list(calendar.getId(), { timeMin: Start.toISOString(), timeMax: End.toISOString(), maxResults: 2500 }).items.reduce((o, e) => (o[e.id] = e.conferenceData.entryPoints.map(({ uri }) => uri).join(","), o), {});
var NotifyContents = '';
var i = 1;
calendarData.forEach(item => {
if (Now <= item.getStartTime()) {
NotifyContents += (item.getTitle() != "") ? ("\n" + i + ". " + item.getTitle() + "\n") : ("\n\nNo Title\n");
NotifyContents += (item.getDescription() != "") ? item.getDescription() + "\n" : "";
NotifyContents += (item.getStartTime() != "" && item.getEndTime() != "") ? "Time:" + item.getStartTime().toLocaleTimeString() + "-" + item.getEndTime().toLocaleTimeString() + "\n" : "";
var eventId = item.getId().split("#")[0];
NotifyContents += eventList[eventId] != "" ? ("\n" + i + ". " + eventList[eventId]) : ("No Conference\n");
i++;
}
});
In this modification, it supposes that calendar has already been declaread. Please be careful about this.
Reference:
Events: list

My page navigation script don't show more than 150 posts. Can I change that?

I am using this script on a blogger blog but since my posts are more than 150 it shows only the first 150. Can I change that?
<div class='pagenavi'>
<script type='text/javascript'>
var pageNaviConf = {
perPage: 10,
numPages: 9,
firstText: "First",
lastText: "Last",
nextText: "Next",
prevText: "Prev"
}
</script>
<script type='text/javascript'>
//<![CDATA[
function pageNavi(o) {
var m = location.href,
l = m.indexOf("/search/label/") != -1,
a = l ? m.substr(m.indexOf("/search/label/") + 14, m.length) : "";
a = a.indexOf("?") != -1 ? a.substr(0, a.indexOf("?")) : a;
var g = l ? "/search/label/" + a + "?updated-max=" : "/search?updated-max=",
k = o.feed.entry.length,
e = Math.ceil(k / pageNaviConf.perPage);
if (e <= 1) {
return
}
var n = 1,
h = [""];
l ? h.push("/search/label/" + a + "?max-results=" + pageNaviConf.perPage) : h.push("/?max-results=" + pageNaviConf.perPage);
for (var d = 2; d <= e; d++) {
var c = (d - 1) * pageNaviConf.perPage - 1,
b = o.feed.entry[c].published.$t,
f = b.substring(0, 19) + b.substring(23, 29);
f = encodeURIComponent(f);
if (m.indexOf(f) != -1) {
n = d
}
h.push(g + f + "&max-results=" + pageNaviConf.perPage)
}
pageNavi.show(h, n, e)
}
pageNavi.show = function(f, e, a) {
var d = Math.floor((pageNaviConf.numPages - 1) / 2),
g = pageNaviConf.numPages - 1 - d,
c = e - d;
if (c <= 0) {
c = 1
}
endPage = e + g;
if ((endPage - c) < pageNaviConf.numPages) {
endPage = c + pageNaviConf.numPages - 1
}
if (endPage > a) {
endPage = a;
c = a - pageNaviConf.numPages + 1
}
if (c <= 0) {
c = 1
}
var b = '<span class="pages">Pages ' + e + ' of ' + a + "</span> ";
if (c > 1) {
b += '' + pageNaviConf.firstText + ""
}
if (e > 1) {
b += '' + pageNaviConf.prevText + ""
}
for (i = c; i <= endPage; ++i) {
if (i == e) {
b += '<span class="current">' + i + "</span>"
} else {
b += '' + i + ""
}
}
if (e < a) {
b += '' + pageNaviConf.nextText + ""
}
if (endPage < a) {
b += '' + pageNaviConf.lastText + ""
}
document.write(b)
};
(function() {
var b = location.href;
if (b.indexOf("?q=") != -1 || b.indexOf(".html") != -1) {
return
}
var d = b.indexOf("/search/label/") + 14;
if (d != 13) {
var c = b.indexOf("?"),
a = (c == -1) ? b.substring(d) : b.substring(d, c);
document.write('<script type="text/javascript" src="/feeds/posts/summary/-/' + a + '?alt=json-in-script&callback=pageNavi&max-results=9999"><\/script>')
} else {
document.write('<script type="text/javascript" src="/feeds/posts/summary?alt=json-in-script&callback=pageNavi&max-results=9999"><\/script>')
}
})();
//]]>
</script>

time diffrence in double digit

i want to display TravelTimeHoursDiff and TravelTimeMinutesDiff in double digit now my time is shown as 7:0 i want to display like 07:00
if ($scope.DispatchStatus.ArrivalTime != undefined){
var today = $rootScope.getSysDate().split(" ");
var timeArrival = new Date(today[0] + ' ' + $scope.DispatchStatus.ArrivalTime);
var TravelTime = new Date(today[0] + ' ' + $scope.Route.TravelTime);
var timeArrivalHours = timeArrival.getHours();
var TravelTimeHoursDiff = timeArrivalHours - TravelTime.getHours() ;
var TravelTimeMinutesDiff = (timeArrival.getMinutes() - TravelTime.getMinutes());
if(TravelTimeHoursDiff < 0 || (TravelTimeHoursDiff <= 0 && TravelTimeMinutesDiff < 0) || (TravelTimeHoursDiff == 0 && TravelTimeMinutesDiff == 0)){
$scope.formvalidationbit = $scope.DispatchStatusAddForm[fieldName].$invalid = true;
angular.element('#' + fieldName).addClass('ng-invalid');
angular.element('#' + fieldName).removeClass('ng-valid');
$scope.DispatchStatusAddForm.$valid = false;
var errorbit = 1;
}else{
if (isNaN(TravelTimeHoursDiff)) {
TravelTimeHoursDiff = '--';
}
if (isNaN(TravelTimeMinutesDiff)) {
TravelTimeMinutesDiff = '--';
}
if(TravelTimeMinutesDiff <0){
TravelTimeMinutesDiff = TravelTimeMinutesDiff * (-1);
}
$scope.TravelTime = TravelTimeHoursDiff + ':' + TravelTimeMinutesDiff;
}
}
Just add leading 0 to values smaller then 10, something like:
let addLeadingZero(v){
return v < 10 ? ("0" + v) : v;
}
$scope.TravelTime = addLeadingZero(TravelTimeHoursDiff) + ':' + addLeadingZero(TravelTimeMinutesDiff);

Numbered page navigation script not working for search label and query results

I am working on a blog with custom template which includes this numbered page navigation script below. Script is working in all pages except search results for queries and labels!!! I tried some changes but as I am not a javascript expert and I couldn't make it work... So, any kind of help would be really appreciated!!!
var pageCount = 9;
var displayPageNum = 3;
var upPageWord = "<i class='fa fa-angle-left'></i>";
var downPageWord = "<i class='fa fa-angle-right'></i>";
function showpageCount(x) {
var C = home_page_url;
var E = new Array();
var y = 1;
var H = 1;
var v = 0;
var p = 0;
var G = 0;
var F = "";
var J = "";
var w = "";
for (var z = 0, A; A = x.feed.entry[z]; z++) {
var u = A.published.$t.substring(0, 19) + A.published.$t.substring(23, 29);
timestamp = encodeURIComponent(u);
var i = A.title.$t;
if (i != "") {
if (v == 0 || (v % pageCount == (pageCount - 1))) {
if (C.indexOf(timestamp) != -1) {
y = H
}
if (i != "") {
H++
}
E[E.length] = "/search?updated-max=" + timestamp + "&max-results=" + pageCount
}
}
v++
}
for (var D = 0; D < E.length; D++) {
if (D >= (y - displayPageNum - 1) && D < (y + displayPageNum)) {
if (p == 0 && D == y - 2) {
if (y == 2) {
J = '<span class="showpage">' + upPageWord + "</span>"
} else {
J = '<span class="showpage">' + upPageWord + "</span>"
}
p++
}
if (D == (y - 1)) {
F += '<span class="showpagePoint">' + y + "</span>"
} else {
if (D == 0) {
F += '<span class="showpageNum">1</span>'
} else {
F += '<span class="showpageNum">' + (D + 1) + "</span>"
}
}
if (G == 0 && D == y) {
w = '<span class="showpage"> ' + downPageWord + "</span>";
G++
}
}
}
if (y > 1) {
F = "" + J + " " + F + " "
}
F = '<div class="showpageArea">' + F;
if (y < (H - 1)) {
F += w
}
if (H == 1) {
H++
}
F += "</div>";
var I = document.getElementsByName("pageArea");
var B = document.getElementById("blog-pager");
if (H <= 2) {
F = ""
}
for (var D = 0; D < I.length; D++) {
I[D].innerHTML = F
}
if (I && I.length > 0) {
F = ""
}
if (B) {
B.innerHTML = F
}
}
function showpageCount2(A) {
var F = home_page_url;
var G = new Array();
var J = F.indexOf("/search/label/") != -1;
var M = J ? F.substr(F.indexOf("/search/label/") + 14, F.length) : "";
M = M.indexOf("?") != -1 ? M.substr(0, M.indexOf("?")) : M;
var B = 1;
var L = 1;
var y = 0;
var p = 0;
var K = 0;
var I = "";
var P = "";
var z = "";
var N = '<span class="showpageNum"><a href="/search/label/' + M + "?&max-results=" + pageCount + '">';
var F = home_page_url;
for (var C = 0, D; D = A.feed.entry[C]; C++) {
var x = D.published.$t.substring(0, 19) + D.published.$t.substring(23, 29);
timestamp = encodeURIComponent(x);
var i = D.title.$t;
if (i != "") {
if (y == 0 || (y % pageCount == (pageCount - 1))) {
if (F.indexOf(timestamp) != -1) {
B = L
}
if (i != "") {
L++
}
G[G.length] = "/search/label/" + M + "?updated-max=" + timestamp + "&max-results=" + pageCount
}
}
y++
}
for (var H = 0; H < G.length; H++) {
if (H >= (B - displayPageNum - 1) && H < (B + displayPageNum)) {
if (p == 0 && H == B - 2) {
if (B == 2) {
P = N + upPageWord + "</a></span>"
} else {
P = '<span class="showpage">' + upPageWord + "</span>"
}
p++
}
if (H == (B - 1)) {
I += '<span class="showpagePoint">' + B + "</span>"
} else {
if (H == 0) {
I = N + "1</a></span>"
} else {
I += '<span class="showpageNum">' + (H + 1) + "</span>"
}
}
if (K == 0 && H == B) {
z = '<span class="showpage"> ' + downPageWord + "</span>";
K++
}
}
}
if (B > 1) {
if (!J) {
I = "" + P + " " + I + " "
} else {
I = "" + P + " " + I + " "
}
}
I = '<div class="showpageArea">' + I;
if (B < (L - 1)) {
I += z
}
if (L == 1) {
L++
}
I += "</div>";
var O = document.getElementsByName("pageArea");
var E = document.getElementById("blog-pager");
if (L <= 2) {
I = ""
}
for (var H = 0; H < O.length; H++) {
O[H].innerHTML = I
}
if (O && O.length > 0) {
I = ""
}
if (E) {
E.innerHTML = I
}
}
var home_page_url = location.href;
var thisUrl = home_page_url;
if (thisUrl.indexOf("/search/label/") != -1) {
if (thisUrl.indexOf("?updated-max") != -1) {
var lblname1 = thisUrl.substring(thisUrl.indexOf("/search/label/") + 14, thisUrl.indexOf("?updated-max"))
} else {
var lblname1 = thisUrl.substring(thisUrl.indexOf("/search/label/") + 14, thisUrl.indexOf("?&max"))
}
}
var home_page = "/";
if (thisUrl.indexOf("?q=") == -1) {
if (thisUrl.indexOf("/search/label/") == -1) {
document.write('<script src="' + home_page + 'feeds/posts/summary?alt=json-in-script&callback=showpageCount&max-results=99999" ><\/script>')
} else {
document.write('<script src="' + home_page + "feeds/posts/full/-/" + lblname1 + '?alt=json-in-script&callback=showpageCount2&max-results=99999" ><\/script>')
}
};
We are currently facing the same problem. The pagination links are good for even pages, but not for off pages. The whole script seems quite buggy, but only for 'search keywords'. Will post results if we achieve any progress.

Sum of value in label having same class

I am trying to add all values of class tmpcpa and place result in final_cpa but final_cpa always return 0.
document.getElementById('cpa' + arr[0]).innerHTML = cpa + '(' + '<label id="tmpcpa">' + tmp_cpa + "</label>" +' For Final' + ')';
var final_cpa = calculate_final_cpa();
console.log(final_cpa);
function calculate_final_cpa() {
var final_cpa = 0;
$('.tmpcpa').each(function () {
if ($(this).val() != 0)
final_cpa += parseInt($(this).text()) || 0;
});
return final_cpa;
}
Surprisingly when i view source code in browser HTML appears as
<label class="tmpcpa">0</label> but when i do inspect element it shows as
<label class="tmpcpa">30.0</label>
Update here is the whole JS. HTML calls process function which ultimately calls calculate_final_cpa()
//"use strict";
function process(arr) {
document.getElementById('txtgrade' + arr[0] + arr[1] + arr[2]).innerHTML = show_grade(document.getElementById('txtpercentage' + arr[0] + arr[1] + arr[2]).value);
if (validateForm(arr)) {
var module_percentage = +document.getElementById('txtpercentage' + arr[0] + arr[1] + arr[2]).value;
var module_credit = +document.getElementById('txtcredit' + arr[0] + arr[1] + arr[2]).innerHTML;
if (!isNaN(module_percentage) || !isNaN(module_credit)) {
module_percentage = 0;
module_credit = 0;
var total_credit_semester = 0;
var sum_module_percentage_x_credit = 0;
for ( i= 2 ; i <= arr[3] + 1 ; i++) {
module_percentage = +document.getElementById('txtpercentage' + arr[0] + arr[1] + i).value;
module_credit = +document.getElementById('txtcredit' + arr[0] + arr[1] + i).innerHTML;
sum_module_percentage_x_credit += module_percentage * module_credit;
total_credit_semester += module_credit;
}
//console.log(module_percentage);
var spa = sum_module_percentage_x_credit / total_credit_semester;
spa = spa.toFixed(1);
document.getElementById('spa' + arr[0] + arr[1]).innerHTML = spa;
calculate_cpa(arr);
}
}
}
function validateForm(arr) {
var isValid = true;
var tbl_id = 'tbl_semester' + arr[0] + arr[1];
$('#' + tbl_id + ' :input').each(function () {
if ($(this).val() === '')
isValid = false;
});
return isValid;
}
function calculate_final_cpa() {
var final_cpa = 0;
$('.tmpcpa').each(function () {
if ($(this).val() != 0)
final_cpa += parseInt($(this).text()) || 0;
});
return final_cpa;
}
/*
* Works for 2 semester per level and 3 year course (optimize later)
*/
function calculate_cpa(arr) {
var isValid = true;
for ( i= 1 ; i <= 2 ; i++) {
var spa = document.getElementById('spa' + arr[0] + i).innerHTML;
if (spa == "N/A") {
isValid = false;
}
}
if (isValid) {
var total_credit_level = 0;
var total_spa_x_credit = 0;
for ( i= 1 ; i <= 2 ; i++) {
var arr2= [arr[0], i];
var spa = +document.getElementById('spa' + arr[0] + i).innerHTML;
total_spa_x_credit += spa * getcredits(arr2);
total_credit_level += getcredits(arr2);
}
var cpa = total_spa_x_credit / total_credit_level;
cpa = cpa.toFixed(1);
document.getElementById('cpa' + arr[0]).innerHTML = cpa;
var level = +document.getElementById('level' + arr[0]).innerHTML
var tmp_cpa = ((level / 100) * cpa).toFixed(1);
document.getElementById('cpa' + arr[0]).innerHTML = cpa + '(' + '<label class="tmpcpa">' + tmp_cpa + "</label>" +' For Final' + ')';
var final_cpa = calculate_final_cpa();
console.log(final_cpa);
if (final_cpa != 0) {
var award = show_award(final_cpa);
document.getElementById('award').innerHTML = award;
document.getElementById('finalcpa').innerHTML = final_cpa;
}
}
}
function getcredits(arr) {
var sum = 0;
var tbl_id = 'tbl_semester' + arr[0] + arr[1];
$('#' + tbl_id + ' .sum').each(function () {
sum += parseInt($(this).text())||0;
});
return sum;
}
function show_grade(module_percentage) {
if (isNaN(module_percentage)) {
return 'N/A';
}
if (module_percentage >= 70 && module_percentage <= 100) {
return 'A';
} else if (module_percentage >= 60 && module_percentage < 70) {
return 'B';
} else if (module_percentage >= 50 && module_percentage < 60) {
return 'C';
} else if (module_percentage >= 40 && module_percentage < 50) {
return 'D';
} else {
return 'F';
}
}
function show_award(cpa) {
if (isNaN(cpa)) {
return 'N/A';
}
if (cpa >= 70 && cpa <= 100) {
return 'First Class with Honours';
} else if (cpa >= 60 && cpa < 70) {
return 'Second Class First Division with Honours';
} else if (cpa >= 50 && cpa < 60) {
return 'Second Class Second Division with Honours';
} else if (cpa >= 45 && cpa < 50) {
return 'Third Class with Honours';
} else if (cpa >= 40 && cpa < 45) {
return 'Pass';
} else if (cpa < 40) {
return 'No award';
}
}
you need to be sure you are calling the function after the document is ready.
Also, you are using unassigned value.
</body>
<script>
function calculate_final_cpa() {
var final_cpa = 0;
$('.tmpcpa').each(function () {
if ($(this).val() != 0)
final_cpa += parseInt($(this).text()) || 0;
});
return final_cpa;
}
$(document).ready(function(){
var final_cpa = calculate_final_cpa();
document.getElementById('cpa' + arr[0]).innerHTML = cpa + '(' + '<label id="tmpcpa">' + final_cpa + "</label>" +' For Final' + ')';
console.log(final_cpa);
});
</script>

Categories