6819 lines
494 KiB
JavaScript
Executable File
6819 lines
494 KiB
JavaScript
Executable File
/*Generated on:Sat Nov 24 2018 14:43:39 GMT+0100 (CET)*/
|
|
var AutomaticDispose_Branch = "master";
|
|
var AutomaticDispose_URL = "https://jf.git.rest/Jomaar/automatic-dispose/raw/branch/";
|
|
var da_lss_adis_time = new Date().getTime();
|
|
|
|
var ADis_AllMissions = {"0":{"id":"0","type":"0","name":"Mülleimerbrand","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"1":{"id":"1","type":"1","name":"Containerbrand","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"2":{"id":"2","type":"2","name":"Brennender PKW","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"3":{"id":"3","type":"3","name":"Motorrad-Brand","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"4":{"id":"4","type":"4","name":"Brennendes Gras","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"5":{"id":"5","type":"5","name":"Zimmerbrand","fire_department":{"num_LF":2,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":1,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"6":{"id":"6","type":"6","name":"Gartenlaubenbrand","fire_department":{"num_LF":2,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"7":{"id":"7","type":"7","name":"Brennendes Laub","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"8":{"id":"8","type":"8","name":"Sperrmüllbrand","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"9":{"id":"9","type":"9","name":"Strohballen Brand","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"10":{"id":"10","type":"10","name":"Traktor Brand","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"11":{"id":"11","type":"11","name":"Brennende Telefonzelle","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"12":{"id":"12","type":"12","name":"Baum auf Straße","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"13":{"id":"13","type":"13","name":"Brennender LKW","fire_department":{"num_LF":2,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"14":{"id":"14","type":"14","name":"Kleiner Feldbrand","fire_department":{"num_LF":2,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"15":{"id":"15","type":"15","name":"Kleiner Waldbrand","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"16":{"id":"16","type":"16","name":"Wohnwagenbrand","fire_department":{"num_LF":2,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"17":{"id":"17","type":"17","name":"Brand in Briefkasten","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"18":{"id":"18","type":"18","name":"Brennendes Gebüsch","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"19":{"id":"19","type":"19","name":"Brennender Anhänger","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"20":{"id":"20","type":"20","name":"Kellerbrand","fire_department":{"num_LF":3,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":false,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"21":{"id":"21","type":"21","name":"Schornsteinbrand","fire_department":{"num_LF":1,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":1,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"22":{"id":"22","type":"22","name":"Dachstuhlbrand","fire_department":{"num_LF":3,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":1,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"23":{"id":"23","type":"23","name":"Fettbrand in Pommesbude","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"24":{"id":"24","type":"24","name":"Brennendes Bus-Häuschen","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"25":{"id":"25","type":"25","name":"Verkehrsunfall","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"26":{"id":"26","type":"26","name":"Brand im Supermarkt","fire_department":{"num_LF":3,"num_ELW_1":1,"num_ELW_2":1,"num_DLK":1,"num_RW":1,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"27":{"id":"27","type":"27","name":"Auffahrunfall","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":1,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"28":{"id":"28","type":"28","name":"Garagenbrand","fire_department":{"num_LF":2,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"29":{"id":"29","type":"29","name":"Maschinenbrand","fire_department":{"num_LF":3,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":0,"num_RW":1,"num_FwK":0,"num_GW_A":1,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":1,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"30":{"id":"30","type":"30","name":"Große Ölspur","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":1,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"31":{"id":"31","type":"31","name":"Auslaufende Betriebsstoffe","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"32":{"id":"32","type":"32","name":"Kaminbrand","fire_department":{"num_LF":1,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":1,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"33":{"id":"33","type":"33","name":"Mähdrescher Brand","fire_department":{"num_LF":2,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"34":{"id":"34","type":"34","name":"Brand im Supermarkt","fire_department":{"num_LF":3,"num_ELW_1":1,"num_ELW_2":1,"num_DLK":1,"num_RW":1,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":1,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":false,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"35":{"id":"35","type":"35","name":"Feuer im Krankenhaus","fire_department":{"num_LF":4,"num_ELW_1":1,"num_ELW_2":1,"num_DLK":1,"num_RW":2,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"36":{"id":"36","type":"36","name":"Brennender Güterwaggon","fire_department":{"num_LF":4,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":1,"num_RW":2,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":1,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":1,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"37":{"id":"37","type":"37","name":"Mülleimerbrand","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"38":{"id":"38","type":"38","name":"Mülleimerbrand","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"39":{"id":"39","type":"39","name":"Mülleimerbrand","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"40":{"id":"40","type":"40","name":"Mülleimerbrand","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"41":{"id":"41","type":"41","name":"Großbrand","fire_department":{"num_LF":6,"num_ELW_1":2,"num_ELW_2":1,"num_DLK":2,"num_RW":0,"num_FwK":0,"num_GW_A":1,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":1,"num_SW":1,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"42":{"id":"42","type":"42","name":"Tankstellenbrand","fire_department":{"num_LF":4,"num_ELW_1":1,"num_ELW_2":1,"num_DLK":1,"num_RW":2,"num_FwK":0,"num_GW_A":0,"num_GW_G":1,"num_GW_Oel":0,"num_GW_Mess":1,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"43":{"id":"43","type":"43","name":"Massenkarambolage","fire_department":{"num_LF":10,"num_ELW_1":2,"num_ELW_2":0,"num_DLK":0,"num_RW":5,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":2,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":false,"use_RTH":false,"use_LNA":true,"use_OrgL":true,"use_SEG_FULL":true,"use_SEG_ELW1_Only":false}},"44":{"id":"44","type":"44","name":"Alkoholintoxikation","emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":false,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"45":{"id":"45","type":"45","name":"Nasenbluten unstillbar","emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":false,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"46":{"id":"46","type":"46","name":"Herzinfarkt","emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"47":{"id":"47","type":"47","name":"akuter Asthma-Anfall","emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"48":{"id":"48","type":"48","name":"Krampfanfall","emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"49":{"id":"49","type":"49","name":"Fieber","emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"50":{"id":"50","type":"50","name":"Gestürzte Person","emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"51":{"id":"51","type":"51","name":"Brand in Werkstatt","fire_department":{"num_LF":4,"num_ELW_1":1,"num_ELW_2":1,"num_DLK":1,"num_RW":1,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"52":{"id":"52","type":"52","name":"Brand auf Weihnachtsmarkt","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"53":{"id":"53","type":"53","name":"Verkehrsunfall durch Glatteis","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":1,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":false,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"54":{"id":"54","type":"54","name":"Personenschaden durch Verbrennung","emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"55":{"id":"55","type":"55","name":"Brennender Tannenbaum","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"56":{"id":"56","type":"56","name":"Betrunkene Person auf Weihnachtsmarkt","emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":false,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"57":{"id":"57","type":"57","name":"Gestürzter Fußgänger","emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":false,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"58":{"id":"58","type":"58","name":"Gestürzter Radfahrer","emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":false,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"59":{"id":"59","type":"59","name":"Gefahrgutunfall","fire_department":{"num_LF":20,"num_ELW_1":3,"num_ELW_2":1,"num_DLK":2,"num_RW":5,"num_FwK":0,"num_GW_A":3,"num_GW_G":4,"num_GW_Oel":0,"num_GW_Mess":4,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":false,"use_RTH":false,"use_LNA":true,"use_OrgL":true,"use_SEG_FULL":true,"use_SEG_ELW1_Only":false}},"60":{"id":"60","type":"60","name":"Ladendiebstahl","police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"61":{"id":"61","type":"61","name":"Ladendiebstahl","police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"62":{"id":"62","type":"62","name":"Parkendes Auto gerammt","police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"63":{"id":"63","type":"63","name":"Parkendes Auto gerammt","police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"64":{"id":"64","type":"64","name":"Metalldiebstahl","police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"65":{"id":"65","type":"65","name":"Taschendiebstahl","police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"66":{"id":"66","type":"66","name":"Notebook aus Schule entwendet","police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"67":{"id":"67","type":"67","name":"Personalienaufnahme von Schwarzfahrer","police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"68":{"id":"68","type":"68","name":"Personalienaufnahme von Schwarzfahrer","police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"69":{"id":"69","type":"69","name":"Personalienaufnahme von Schwarzfahrer","police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"70":{"id":"70","type":"70","name":"Personalienaufnahme von Schwarzfahrer","police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"71":{"id":"71","type":"71","name":"Parkendes Auto gerammt","police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"72":{"id":"72","type":"72","name":"Bewusstloser Kranführer","fire_department":{"num_LF":1,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":1,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"73":{"id":"73","type":"73","name":"Schlägerei","police_department":{"num_FuStW":3,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":false,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"74":{"id":"74","type":"74","name":"Randalierende Person","police_department":{"num_FuStW":2,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"75":{"id":"75","type":"75","name":"Unangemeldete Demonstration","police_department":{"num_FuStW":7,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"76":{"id":"76","type":"76","name":"Küchenbrand","fire_department":{"num_LF":2,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"77":{"id":"77","type":"77","name":"Person hinter Tür","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"78":{"id":"78","type":"78","name":"Kleintier in Not","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":1,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"79":{"id":"79","type":"79","name":"Verletzte Person auf Baugerüst","fire_department":{"num_LF":1,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":1,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":1,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":false,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"80":{"id":"80","type":"80","name":"Rauchentwicklung in Museum","fire_department":{"num_LF":3,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":1,"num_RW":0,"num_FwK":0,"num_GW_A":1,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":2,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":true,"use_OrgL":false,"use_SEG_FULL":true,"use_SEG_ELW1_Only":false}},"81":{"id":"81","type":"81","name":"Einbruch in Keller","police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"82":{"id":"82","type":"82","name":"Einbruch in Wohnung","police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"83":{"id":"83","type":"83","name":"Gefahrgut-LKW verunglückt","fire_department":{"num_LF":3,"num_ELW_1":1,"num_ELW_2":1,"num_DLK":0,"num_RW":1,"num_FwK":0,"num_GW_A":0,"num_GW_G":1,"num_GW_Oel":0,"num_GW_Mess":1,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":1,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":2,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":false,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"84":{"id":"84","type":"84","name":"Brennende Lok","fire_department":{"num_LF":4,"num_ELW_1":1,"num_ELW_2":1,"num_DLK":0,"num_RW":1,"num_FwK":0,"num_GW_A":1,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":1,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":false,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"85":{"id":"85","type":"85","name":"Sachbeschädigung","police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"86":{"id":"86","type":"86","name":"Sporthallenbrand","fire_department":{"num_LF":7,"num_ELW_1":1,"num_ELW_2":1,"num_DLK":2,"num_RW":0,"num_FwK":0,"num_GW_A":1,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":1,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"87":{"id":"87","type":"87","name":"Kleinflugzeug abgestürzt","fire_department":{"num_LF":3,"num_ELW_1":1,"num_ELW_2":1,"num_DLK":0,"num_RW":1,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":2,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":true,"use_OrgL":false,"use_SEG_FULL":true,"use_SEG_ELW1_Only":false}},"88":{"id":"88","type":"88","name":"Brennender Bollerwagen","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"89":{"id":"89","type":"89","name":"LKW Auffahrunfall","fire_department":{"num_LF":3,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":0,"num_RW":1,"num_FwK":0,"num_GW_A":0,"num_GW_G":1,"num_GW_Oel":1,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":2,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"90":{"id":"90","type":"90","name":"Ruhestörung","police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"91":{"id":"91","type":"91","name":"Keller unter Wasser","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"92":{"id":"92","type":"92","name":"Schlaganfall","emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"93":{"id":"93","type":"93","name":"Brennender Bus","fire_department":{"num_LF":5,"num_ELW_1":1,"num_ELW_2":1,"num_DLK":0,"num_RW":1,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":2,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":true,"use_OrgL":true,"use_SEG_FULL":true,"use_SEG_ELW1_Only":false}},"94":{"id":"94","type":"94","name":"Kleine Ölspur","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"95":{"id":"95","type":"95","name":"Ausgedehnte Ölspur","fire_department":{"num_LF":6,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":1,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":2,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"96":{"id":"96","type":"96","name":"Feuer in Schnellrestaurant","fire_department":{"num_LF":3,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":false,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"97":{"id":"97","type":"97","name":"Aufgerissener Öltank","fire_department":{"num_LF":3,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":1,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"98":{"id":"98","type":"98","name":"Angefahrene Person","police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":false,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"99":{"id":"99","type":"99","name":"Flugzeug abgestürzt","fire_department":{"num_LF":22,"num_ELW_1":2,"num_ELW_2":2,"num_DLK":1,"num_RW":6,"num_FwK":0,"num_GW_A":1,"num_GW_G":0,"num_GW_Oel":1,"num_GW_Mess":1,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":10,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":true,"use_OrgL":true,"use_SEG_FULL":true,"use_SEG_ELW1_Only":false}},"100":{"id":"100","type":"100","name":"Küchenbrand","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"101":{"id":"101","type":"101","name":"Zimmerbrand","fire_department":{"num_LF":2,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":1,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"102":{"id":"102","type":"102","name":"Feuer in Einfamilienhaus","fire_department":{"num_LF":3,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":1,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"103":{"id":"103","type":"103","name":"Feuer in Einfamilienhaus","fire_department":{"num_LF":3,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":1,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"104":{"id":"104","type":"104","name":"Feuer in Einfamilienhaus","fire_department":{"num_LF":3,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":1,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"105":{"id":"105","type":"105","name":"Feuer in Einfamilienhaus","fire_department":{"num_LF":3,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":1,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"106":{"id":"106","type":"106","name":"Massenschlägerei","police_department":{"num_FuStW":5,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"107":{"id":"107","type":"107","name":"Massenschlägerei","police_department":{"num_FuStW":5,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":true,"use_OrgL":false,"use_SEG_FULL":true,"use_SEG_ELW1_Only":false}},"108":{"id":"108","type":"108","name":"Schwangere in Notsituation","emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"109":{"id":"109","type":"109","name":"Beginnende Geburt","emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"110":{"id":"110","type":"110","name":"Vaginale Blutung","emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"111":{"id":"111","type":"111","name":"Brennende Vogelscheuche","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"112":{"id":"112","type":"112","name":"Brennendes Kürbisfeld","fire_department":{"num_LF":2,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"113":{"id":"113","type":"113","name":"Kürbissuppe übergekocht","fire_department":{"num_LF":2,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":1,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":false,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"114":{"id":"114","type":"114","name":"Hexe hängt in Baum","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":1,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":false,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"115":{"id":"115","type":"115","name":"Zombiebiss","emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":false,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"116":{"id":"116","type":"116","name":"Monster ausgebrochen","police_department":{"num_FuStW":4,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"117":{"id":"117","type":"117","name":"Kürbisse geklaut","police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"118":{"id":"118","type":"118","name":"Frankenstein gesichtet","police_department":{"num_FuStW":3,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"119":{"id":"119","type":"119","name":"Süßigkeitendiebstahl","police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"120":{"id":"120","type":"120","name":"LKW umgestürzt","fire_department":{"num_LF":2,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":0,"num_RW":1,"num_FwK":1,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"121":{"id":"121","type":"121","name":"LKW umgestürzt","fire_department":{"num_LF":2,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":0,"num_RW":1,"num_FwK":1,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":2,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"122":{"id":"122","type":"122","name":"Motorradunfall","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"123":{"id":"123","type":"123","name":"Verkehrsunfall","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"124":{"id":"124","type":"124","name":"Verkehrsunfall","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":1,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"125":{"id":"125","type":"125","name":"Verkehrsunfall","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":1,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"126":{"id":"126","type":"126","name":"Verkehrsunfall","fire_department":{"num_LF":2,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":1,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"127":{"id":"127","type":"127","name":"Verkehrsunfall","fire_department":{"num_LF":2,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":1,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":2,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"128":{"id":"128","type":"128","name":"Auffahrunfall","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":false,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"129":{"id":"129","type":"129","name":"Brennender Adventskranz","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"130":{"id":"130","type":"130","name":"Rangelei auf Weihnachtsmarkt","police_department":{"num_FuStW":2,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":false,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"131":{"id":"131","type":"131","name":"Mittlerer Feldbrand","fire_department":{"num_LF":3,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":1,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"132":{"id":"132","type":"132","name":"Großer Feldbrand","fire_department":{"num_LF":5,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":1,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"133":{"id":"133","type":"133","name":"Großer Feldbrand","fire_department":{"num_LF":5,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":1,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"134":{"id":"134","type":"134","name":"Großer Waldbrand","fire_department":{"num_LF":3,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":1,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"135":{"id":"135","type":"135","name":"Großer Waldbrand","fire_department":{"num_LF":3,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":1,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"136":{"id":"136","type":"136","name":"Großfeuer im Wald","fire_department":{"num_LF":10,"num_ELW_1":2,"num_ELW_2":1,"num_DLK":1,"num_RW":0,"num_FwK":0,"num_GW_A":1,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":1,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":false,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"137":{"id":"137","type":"137","name":"Großfeuer im Wald","fire_department":{"num_LF":10,"num_ELW_1":2,"num_ELW_2":1,"num_DLK":1,"num_RW":0,"num_FwK":0,"num_GW_A":1,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":1,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":3,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":false,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"138":{"id":"138","type":"138","name":"Flächenbrand","fire_department":{"num_LF":2,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"139":{"id":"139","type":"139","name":"Flächenbrand","fire_department":{"num_LF":4,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":1,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"140":{"id":"140","type":"140","name":"Flächenbrand","fire_department":{"num_LF":2,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":2,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"141":{"id":"141","type":"141","name":"Flächenbrand","fire_department":{"num_LF":4,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":1,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":2,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"142":{"id":"142","type":"142","name":"Feuer auf Balkon","fire_department":{"num_LF":2,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":1,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"143":{"id":"143","type":"143","name":"Brennende Papiercontainer","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"144":{"id":"144","type":"144","name":"Brennende Hecke","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"145":{"id":"145","type":"145","name":"Trunkenheitsfahrt","police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"146":{"id":"146","type":"146","name":"Brennendes Reetdachhaus","fire_department":{"num_LF":5,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":1,"num_RW":0,"num_FwK":0,"num_GW_A":1,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":2,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"147":{"id":"147","type":"147","name":"Krankentransport","emergency_medical_service":{"use_KTW":true,"use_RTW":false,"use_NEF":false,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"148":{"id":"148","type":"148","name":"Ampelausfall","police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"149":{"id":"149","type":"149","name":"Pannenfahrzeug","police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"150":{"id":"150","type":"150","name":"Hausfriedensbruch","police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"151":{"id":"151","type":"151","name":"Raub","police_department":{"num_FuStW":3,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"152":{"id":"152","type":"152","name":"Häusliche Gewalt","police_department":{"num_FuStW":2,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":false,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"153":{"id":"153","type":"153","name":"Hilflose Person","police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"154":{"id":"154","type":"154","name":"Hilflose Person","police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":false,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"155":{"id":"155","type":"155","name":"Akuter Harnstau","emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"156":{"id":"156","type":"156","name":"Harnleiter Blutung","emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"157":{"id":"157","type":"157","name":"Herzrhythmusstörungen","emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"158":{"id":"158","type":"158","name":"Tiefgarage unter Wasser","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"159":{"id":"159","type":"159","name":"Äste auf Fahrbahn","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"160":{"id":"160","type":"160","name":"Umherfliegendes Baumaterial","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"161":{"id":"161","type":"161","name":"Baum auf PKW","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"162":{"id":"162","type":"162","name":"Baum auf PKW","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"163":{"id":"163","type":"163","name":"Baum auf Dach","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":1,"num_RW":0,"num_FwK":1,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"164":{"id":"164","type":"164","name":"Kopfplatzwunde","emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":false,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"165":{"id":"165","type":"165","name":"Gehirnerschütterung","emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"166":{"id":"166","type":"166","name":"Fassadenteile drohen zu fallen","fire_department":{"num_LF":1,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":1,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":1,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"167":{"id":"167","type":"167","name":"Beschädigter Dachbereich","fire_department":{"num_LF":2,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":1,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":1,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"168":{"id":"168","type":"168","name":"Baum auf Gleisen","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"169":{"id":"169","type":"169","name":"Baum auf Gleisen","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"170":{"id":"170","type":"170","name":"Baum auf Gleisen","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"171":{"id":"171","type":"171","name":"Parkdeck voll Wasser gelaufen","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":1,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":1,"num_GW_Mess":0,"num_SW":1,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":2,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"172":{"id":"172","type":"172","name":"Straße unter Wasser","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"173":{"id":"173","type":"173","name":"Straße unter Wasser","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":2,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"174":{"id":"174","type":"174","name":"Erdrutsch","police_department":{"num_FuStW":2,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"technical_emergency_service":{"num_GKW":1,"num_MzKW":0,"num_MTW_TZ":1,"num_LKW_K9":1,"num_BRmG_R":1,"num_Anh_DLE":0,"num_MLW_5":1,"num_LKW_7Lkr":0}},"175":{"id":"175","type":"175","name":"Erdrutsch","technical_emergency_service":{"num_GKW":1,"num_MzKW":0,"num_MTW_TZ":1,"num_LKW_K9":1,"num_BRmG_R":1,"num_Anh_DLE":0,"num_MLW_5":1,"num_LKW_7Lkr":0}},"176":{"id":"176","type":"176","name":"LKW in Hauswand","fire_department":{"num_LF":2,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":1,"num_RW":0,"num_FwK":1,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"technical_emergency_service":{"num_GKW":1,"num_MzKW":1,"num_MTW_TZ":1,"num_LKW_K9":0,"num_BRmG_R":0,"num_Anh_DLE":0,"num_MLW_5":1,"num_LKW_7Lkr":0}},"177":{"id":"177","type":"177","name":"Eingestürztes Wohnhaus","fire_department":{"num_LF":3,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":1,"num_RW":1,"num_FwK":1,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":2,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":false,"use_RTH":false,"use_LNA":true,"use_OrgL":false,"use_SEG_FULL":true,"use_SEG_ELW1_Only":false},"technical_emergency_service":{"num_GKW":2,"num_MzKW":1,"num_MTW_TZ":1,"num_LKW_K9":0,"num_BRmG_R":2,"num_Anh_DLE":0,"num_MLW_5":1,"num_LKW_7Lkr":0}},"178":{"id":"178","type":"178","name":"Gefahrgut-LKW verunglückt","fire_department":{"num_LF":3,"num_ELW_1":1,"num_ELW_2":1,"num_DLK":0,"num_RW":1,"num_FwK":0,"num_GW_A":0,"num_GW_G":1,"num_GW_Oel":0,"num_GW_Mess":1,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":1,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":2,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":false,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false},"technical_emergency_service":{"num_GKW":1,"num_MzKW":0,"num_MTW_TZ":0,"num_LKW_K9":0,"num_BRmG_R":1,"num_Anh_DLE":0,"num_MLW_5":1,"num_LKW_7Lkr":0}},"179":{"id":"179","type":"179","name":"Schädelverletzung","emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"180":{"id":"180","type":"180","name":"Wirbelsäulenverletzung","emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":true,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"181":{"id":"181","type":"181","name":"Sturz aus Höhe","emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":true,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"182":{"id":"182","type":"182","name":"Sturz aus Höhe","emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"183":{"id":"183","type":"183","name":"Sonnenstich","emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"184":{"id":"184","type":"184","name":"Hitzschlag","emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"185":{"id":"185","type":"185","name":"Hitzekrampf","emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"186":{"id":"186","type":"186","name":"Lagerhallenbrand","fire_department":{"num_LF":5,"num_ELW_1":1,"num_ELW_2":1,"num_DLK":2,"num_RW":1,"num_FwK":1,"num_GW_A":1,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":1,"num_SW":1,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":2,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false},"technical_emergency_service":{"num_GKW":1,"num_MzKW":0,"num_MTW_TZ":1,"num_LKW_K9":1,"num_BRmG_R":1,"num_Anh_DLE":1,"num_MLW_5":1,"num_LKW_7Lkr":0}},"187":{"id":"187","type":"187","name":"Feuer im Lagerraum","fire_department":{"num_LF":2,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":1,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":1,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"188":{"id":"188","type":"188","name":"Personenkontrolle","police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"189":{"id":"189","type":"189","name":"Verkehrsbehinderung","police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"190":{"id":"190","type":"190","name":"Diebstahl aus Kfz","police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"191":{"id":"191","type":"191","name":"Baum auf Radweg","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"192":{"id":"192","type":"192","name":"Brennende Trafostation","fire_department":{"num_LF":2,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"193":{"id":"193","type":"193","name":"Brennende Trafostation","fire_department":{"num_LF":2,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"194":{"id":"194","type":"194","name":"Person unter Baum eingeklemmt","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"195":{"id":"195","type":"195","name":"Schwerpunkteinsatz Tageswohnungseinbrüche","police_department":{"num_FuStW":0,"num_leBefKw":1,"num_GruKw":3,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"196":{"id":"196","type":"196","name":"Schwerpunkteinsatz Verkehrsüberwachung","police_department":{"num_FuStW":0,"num_leBefKw":1,"num_GruKw":3,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"197":{"id":"197","type":"197","name":"Präsenzeinsatz Volksfest","police_department":{"num_FuStW":0,"num_leBefKw":1,"num_GruKw":3,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"198":{"id":"198","type":"198","name":"Jugendschutzkontrolle in Diskothek","police_department":{"num_FuStW":2,"num_leBefKw":1,"num_GruKw":3,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"199":{"id":"199","type":"199","name":"Geländedurchsuchung nach Beweismittel","police_department":{"num_FuStW":0,"num_leBefKw":1,"num_GruKw":3,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"200":{"id":"200","type":"200","name":"Geplante Razzia","police_department":{"num_FuStW":2,"num_leBefKw":2,"num_GruKw":6,"num_FueKw":0,"num_GefKw":1,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"201":{"id":"201","type":"201","name":"Fußball Bundesliga-Spiel","police_department":{"num_FuStW":2,"num_leBefKw":3,"num_GruKw":9,"num_FueKw":1,"num_GefKw":1,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"202":{"id":"202","type":"202","name":"Diebstahl auf Weihnachtsmarkt","police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"203":{"id":"203","type":"203","name":"Brennende Weihnachtsmarktbude","fire_department":{"num_LF":2,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"204":{"id":"204","type":"204","name":"Scheunenbrand","fire_department":{"num_LF":6,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":1,"num_RW":0,"num_FwK":0,"num_GW_A":1,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":1,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":false,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"205":{"id":"205","type":"205","name":"Feuer auf Bauernhof - Mittel","fire_department":{"num_LF":7,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":2,"num_RW":0,"num_FwK":0,"num_GW_A":1,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":1,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":3,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"206":{"id":"206","type":"206","name":"Feuer auf Bauernhof - Groß","fire_department":{"num_LF":15,"num_ELW_1":2,"num_ELW_2":1,"num_DLK":4,"num_RW":0,"num_FwK":1,"num_GW_A":2,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":2,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":3,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":true,"use_OrgL":false,"use_SEG_FULL":true,"use_SEG_ELW1_Only":false},"technical_emergency_service":{"num_GKW":2,"num_MzKW":0,"num_MTW_TZ":1,"num_LKW_K9":2,"num_BRmG_R":2,"num_Anh_DLE":0,"num_MLW_5":1,"num_LKW_7Lkr":0}},"207":{"id":"207","type":"207","name":"Gefahrgutunfall - Groß","fire_department":{"num_LF":20,"num_ELW_1":3,"num_ELW_2":1,"num_DLK":2,"num_RW":5,"num_FwK":0,"num_GW_A":3,"num_GW_G":4,"num_GW_Oel":0,"num_GW_Mess":4,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":1,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":3,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":false,"use_RTH":false,"use_LNA":true,"use_OrgL":true,"use_SEG_FULL":true,"use_SEG_ELW1_Only":false},"technical_emergency_service":{"num_GKW":2,"num_MzKW":0,"num_MTW_TZ":1,"num_LKW_K9":2,"num_BRmG_R":2,"num_Anh_DLE":0,"num_MLW_5":1,"num_LKW_7Lkr":0}},"208":{"id":"208","type":"208","name":"Leck in Chemikalientank","fire_department":{"num_LF":8,"num_ELW_1":1,"num_ELW_2":1,"num_DLK":0,"num_RW":2,"num_FwK":0,"num_GW_A":1,"num_GW_G":1,"num_GW_Oel":1,"num_GW_Mess":2,"num_SW":1,"num_GW_Hoeh":0,"num_Dekon_P":1,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":2,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":true,"use_OrgL":true,"use_SEG_FULL":true,"use_SEG_ELW1_Only":false}},"209":{"id":"209","type":"209","name":"Fahrraddiebstahl","police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"210":{"id":"210","type":"210","name":"Unfall mit Motorsäge","emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"211":{"id":"211","type":"211","name":"Unterzuckerung","emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"212":{"id":"212","type":"212","name":"Akute Bauchschmerzen","emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"213":{"id":"213","type":"213","name":"Gasexplosion","fire_department":{"num_LF":20,"num_ELW_1":4,"num_ELW_2":2,"num_DLK":2,"num_RW":2,"num_FwK":1,"num_GW_A":2,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":2,"num_SW":2,"num_GW_Hoeh":0,"num_Dekon_P":1,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":4,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":true,"use_OrgL":true,"use_SEG_FULL":true,"use_SEG_ELW1_Only":false},"technical_emergency_service":{"num_GKW":1,"num_MzKW":1,"num_MTW_TZ":1,"num_LKW_K9":1,"num_BRmG_R":1,"num_Anh_DLE":1,"num_MLW_5":1,"num_LKW_7Lkr":0}},"214":{"id":"214","type":"214","name":"Bürobrand","fire_department":{"num_LF":6,"num_ELW_1":1,"num_ELW_2":1,"num_DLK":2,"num_RW":2,"num_FwK":0,"num_GW_A":1,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":2,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":true,"use_OrgL":true,"use_SEG_FULL":true,"use_SEG_ELW1_Only":false}},"215":{"id":"215","type":"215","name":"Chlorgasaustritt","fire_department":{"num_LF":7,"num_ELW_1":2,"num_ELW_2":1,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":2,"num_GW_G":1,"num_GW_Oel":0,"num_GW_Mess":1,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":4,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":true,"use_OrgL":true,"use_SEG_FULL":true,"use_SEG_ELW1_Only":false}},"216":{"id":"216","type":"216","name":"Brennender Bollerwagen","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"217":{"id":"217","type":"217","name":"Brennender Bollerwagen","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"218":{"id":"218","type":"218","name":"Brennender Bollerwagen","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"219":{"id":"219","type":"219","name":"Brennender Bollerwagen","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"220":{"id":"220","type":"220","name":"Brennender Bollerwagen","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"221":{"id":"221","type":"221","name":"Zugunglück (Groß)","fire_department":{"num_LF":30,"num_ELW_1":6,"num_ELW_2":3,"num_DLK":3,"num_RW":6,"num_FwK":4,"num_GW_A":4,"num_GW_G":0,"num_GW_Oel":1,"num_GW_Mess":0,"num_SW":2,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":12,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":true,"use_OrgL":true,"use_SEG_FULL":true,"use_SEG_ELW1_Only":false},"technical_emergency_service":{"num_GKW":1,"num_MzKW":1,"num_MTW_TZ":1,"num_LKW_K9":2,"num_BRmG_R":2,"num_Anh_DLE":0,"num_MLW_5":1,"num_LKW_7Lkr":0}},"222":{"id":"222","type":"222","name":"Zugunglück (Klein)","fire_department":{"num_LF":20,"num_ELW_1":3,"num_ELW_2":1,"num_DLK":2,"num_RW":3,"num_FwK":2,"num_GW_A":2,"num_GW_G":0,"num_GW_Oel":1,"num_GW_Mess":0,"num_SW":1,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":6,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":true,"use_OrgL":true,"use_SEG_FULL":true,"use_SEG_ELW1_Only":false},"technical_emergency_service":{"num_GKW":0,"num_MzKW":0,"num_MTW_TZ":1,"num_LKW_K9":1,"num_BRmG_R":1,"num_Anh_DLE":0,"num_MLW_5":1,"num_LKW_7Lkr":0}},"223":{"id":"223","type":"223","name":"Brandsicherheitswache bei Volksfest","fire_department":{"num_LF":3,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"224":{"id":"224","type":"224","name":"Brandsicherheitswachdienst im Theater","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":false,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"225":{"id":"225","type":"225","name":"Dorf/Stadtfest","fire_department":{"num_LF":3,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":false,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":true,"use_SEG_ELW1_Only":false}},"226":{"id":"226","type":"226","name":"Volkslauf","emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":false,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":true,"use_SEG_ELW1_Only":false}},"227":{"id":"227","type":"227","name":"Angemeldete Demonstration","police_department":{"num_FuStW":3,"num_leBefKw":2,"num_GruKw":6,"num_FueKw":1,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":false,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"228":{"id":"228","type":"228","name":"Absicherung Musikumzug","police_department":{"num_FuStW":2,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"229":{"id":"229","type":"229","name":"Absicherung Radrennen","police_department":{"num_FuStW":2,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":false,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"230":{"id":"230","type":"230","name":"Feuerprobealarm an Schule","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"231":{"id":"231","type":"231","name":"Entflohener Gefangener","police_department":{"num_FuStW":10,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":1,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"232":{"id":"232","type":"232","name":"Kabeldiebstahl","police_department":{"num_FuStW":2,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":1,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"233":{"id":"233","type":"233","name":"Suche nach Vermissten","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":2,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":1,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":false,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"234":{"id":"234","type":"234","name":"Entschärfung von Weltkriegsbombe","fire_department":{"num_LF":10,"num_ELW_1":1,"num_ELW_2":1,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":5,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"235":{"id":"235","type":"235","name":"Verletzte Person auf Hochspannungsmast","fire_department":{"num_LF":2,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":1,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":1,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"236":{"id":"236","type":"236","name":"Verletzte Person auf Hochspannungsmast","fire_department":{"num_LF":2,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":1,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":1,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":true,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"237":{"id":"237","type":"237","name":"Verkehrsunfall mit Zug","fire_department":{"num_LF":2,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":0,"num_RW":1,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":2,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":true,"use_OrgL":false,"use_SEG_FULL":true,"use_SEG_ELW1_Only":false}},"238":{"id":"238","type":"238","name":"Verkehrsunfall mit Linienbus","fire_department":{"num_LF":2,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":0,"num_RW":1,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":2,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":true,"use_OrgL":false,"use_SEG_FULL":true,"use_SEG_ELW1_Only":false}},"239":{"id":"239","type":"239","name":"Verkehrsunfall mit Linienbus","fire_department":{"num_LF":5,"num_ELW_1":2,"num_ELW_2":1,"num_DLK":0,"num_RW":2,"num_FwK":1,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":1,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":4,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":true,"use_OrgL":true,"use_SEG_FULL":true,"use_SEG_ELW1_Only":false}},"240":{"id":"240","type":"240","name":"Gasgeruch","fire_department":{"num_LF":3,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":1,"num_GW_Oel":0,"num_GW_Mess":1,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":1,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"241":{"id":"241","type":"241","name":"Wildunfall","police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"242":{"id":"242","type":"242","name":"Pfefferspray in Schule","fire_department":{"num_LF":2,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":1,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":3,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":true,"use_OrgL":true,"use_SEG_FULL":true,"use_SEG_ELW1_Only":false}},"243":{"id":"243","type":"243","name":"Reitunfall mit Pkw","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"244":{"id":"244","type":"244","name":"Person in Wasser","water_rescue":{"num_GW_W":1,"num_GW_T":1,"num_MzB":1}},"245":{"id":"245","type":"245","name":"Person in Wasser","emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false},"water_rescue":{"num_GW_W":1,"num_GW_T":1,"num_MzB":1}},"246":{"id":"246","type":"246","name":"Person in Wasser","fire_department":{"num_LF":3,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false},"water_rescue":{"num_GW_W":1,"num_GW_T":1,"num_MzB":1}},"247":{"id":"247","type":"247","name":"Pkw in Wasser","fire_department":{"num_LF":3,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":2,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false},"water_rescue":{"num_GW_W":2,"num_GW_T":2,"num_MzB":2}},"248":{"id":"248","type":"248","name":"LKW in Wasser","fire_department":{"num_LF":5,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":3,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false},"water_rescue":{"num_GW_W":3,"num_GW_T":3,"num_MzB":3}},"249":{"id":"249","type":"249","name":"Bus in Wasser","fire_department":{"num_LF":5,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":3,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":true,"use_OrgL":true,"use_SEG_FULL":true,"use_SEG_ELW1_Only":false},"water_rescue":{"num_GW_W":3,"num_GW_T":3,"num_MzB":3}},"250":{"id":"250","type":"250","name":"Person in Wasser","water_rescue":{"num_GW_W":1,"num_GW_T":1,"num_MzB":1}},"251":{"id":"251","type":"251","name":"Person in Wasser","emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false},"water_rescue":{"num_GW_W":1,"num_GW_T":1,"num_MzB":1}},"252":{"id":"252","type":"252","name":"Person in Wasser","fire_department":{"num_LF":3,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false},"water_rescue":{"num_GW_W":1,"num_GW_T":1,"num_MzB":1}},"253":{"id":"253","type":"253","name":"Pkw in Wasser","fire_department":{"num_LF":3,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":2,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false},"water_rescue":{"num_GW_W":2,"num_GW_T":2,"num_MzB":2}},"254":{"id":"254","type":"254","name":"LKW in Wasser","fire_department":{"num_LF":5,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":3,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false},"water_rescue":{"num_GW_W":3,"num_GW_T":3,"num_MzB":3}},"255":{"id":"255","type":"255","name":"Bus in Wasser","fire_department":{"num_LF":5,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":3,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":true,"use_OrgL":true,"use_SEG_FULL":true,"use_SEG_ELW1_Only":false},"water_rescue":{"num_GW_W":3,"num_GW_T":3,"num_MzB":3}},"256":{"id":"256","type":"256","name":"Zusammenstoß zweier Boote","fire_department":{"num_LF":6,"num_ELW_1":2,"num_ELW_2":1,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":5,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":true,"use_OrgL":true,"use_SEG_FULL":true,"use_SEG_ELW1_Only":false},"water_rescue":{"num_GW_W":6,"num_GW_T":6,"num_MzB":6}},"257":{"id":"257","type":"257","name":"Verkehrsüberwachung","police_department":{"num_FuStW":2,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"258":{"id":"258","type":"258","name":"Baumaschine umgestürzt","fire_department":{"num_LF":4,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":1,"num_RW":2,"num_FwK":1,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":1,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":3,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":false,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"259":{"id":"259","type":"259","name":"Brennender PKW durch Feuerwerkskörper","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"260":{"id":"260","type":"260","name":"Sperrmüllbrand durch Feuerwerkskörper","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"261":{"id":"261","type":"261","name":"Kleiner Feldbrand durch Feuerwerkskörper","fire_department":{"num_LF":2,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"262":{"id":"262","type":"262","name":"Kellerbrand durch Feuerwerkskörper","fire_department":{"num_LF":3,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":false,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"263":{"id":"263","type":"263","name":"Brennendes Bus-Häuschen durch Feuerwerkskörper","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"264":{"id":"264","type":"264","name":"Feuer auf Balkon durch Feuerwerkskörper","fire_department":{"num_LF":2,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":1,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"265":{"id":"265","type":"265","name":"Brennende Papiercontainer durch Feuerwerkskörper","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"266":{"id":"266","type":"266","name":"Brennende Hecke durch Feuerwerkskörper","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"267":{"id":"267","type":"267","name":"Trunkenheitsfahrt nach Silvesterparty","police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"268":{"id":"268","type":"268","name":"Brennendes Reetdachhaus durch Feuerwerkskörper","fire_department":{"num_LF":5,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":1,"num_RW":0,"num_FwK":0,"num_GW_A":1,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":2,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"269":{"id":"269","type":"269","name":"Kfz durch Feuerwerkskörper beschädigt","police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"270":{"id":"270","type":"270","name":"Verstoß gegen Sprengstoffverordnung","police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"271":{"id":"271","type":"271","name":"Beschädigter Kesselwagen","fire_department":{"num_LF":10,"num_ELW_1":2,"num_ELW_2":1,"num_DLK":1,"num_RW":1,"num_FwK":0,"num_GW_A":0,"num_GW_G":1,"num_GW_Oel":0,"num_GW_Mess":1,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":1,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":3,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"technical_emergency_service":{"num_GKW":1,"num_MzKW":0,"num_MTW_TZ":0,"num_LKW_K9":0,"num_BRmG_R":0,"num_Anh_DLE":0,"num_MLW_5":1,"num_LKW_7Lkr":0}},"272":{"id":"272","type":"272","name":"Gewässerverschmutzung durch Öl","fire_department":{"num_LF":2,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":1,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"water_rescue":{"num_GW_W":1,"num_GW_T":1,"num_MzB":1}},"273":{"id":"273","type":"273","name":"Gewässerverschmutzung durch Öl","fire_department":{"num_LF":2,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":1,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"water_rescue":{"num_GW_W":1,"num_GW_T":1,"num_MzB":1}},"274":{"id":"274","type":"274","name":"Bewusstlose Person","emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"275":{"id":"275","type":"275","name":"Absicherung Rockkonzert","fire_department":{"num_LF":2,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":4,"num_leBefKw":3,"num_GruKw":9,"num_FueKw":1,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":false,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"276":{"id":"276","type":"276","name":"Schwertransport","police_department":{"num_FuStW":4,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"277":{"id":"277","type":"277","name":"Person im Aufzug","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":false,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"278":{"id":"278","type":"278","name":"LKW in Supermarkt","fire_department":{"num_LF":2,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":1,"num_RW":0,"num_FwK":1,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":2,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false},"technical_emergency_service":{"num_GKW":1,"num_MzKW":1,"num_MTW_TZ":1,"num_LKW_K9":0,"num_BRmG_R":0,"num_Anh_DLE":0,"num_MLW_5":1,"num_LKW_7Lkr":0}},"279":{"id":"279","type":"279","name":"LKW in Supermarkt","fire_department":{"num_LF":2,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":1,"num_RW":0,"num_FwK":1,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":2,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false},"technical_emergency_service":{"num_GKW":1,"num_MzKW":1,"num_MTW_TZ":1,"num_LKW_K9":0,"num_BRmG_R":0,"num_Anh_DLE":0,"num_MLW_5":1,"num_LKW_7Lkr":0}},"280":{"id":"280","type":"280","name":"Baum auf Oberleitung","fire_department":{"num_LF":3,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":1,"num_RW":1,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"281":{"id":"281","type":"281","name":"Stromschlag","emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":true,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"282":{"id":"282","type":"282","name":"Geplatzte Wasserleitung","fire_department":{"num_LF":2,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":0,"num_RW":1,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"283":{"id":"283","type":"283","name":"Bürobrand (Groß)","fire_department":{"num_LF":10,"num_ELW_1":3,"num_ELW_2":1,"num_DLK":2,"num_RW":2,"num_FwK":0,"num_GW_A":1,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":3,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":true,"use_OrgL":true,"use_SEG_FULL":true,"use_SEG_ELW1_Only":false}},"284":{"id":"284","type":"284","name":"Ostereier-Dieb","police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"285":{"id":"285","type":"285","name":"Pinsel aus Werkstatt entwendet","police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"286":{"id":"286","type":"286","name":"Eingestürzter Hasenbau","police_department":{"num_FuStW":2,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"technical_emergency_service":{"num_GKW":1,"num_MzKW":0,"num_MTW_TZ":1,"num_LKW_K9":1,"num_BRmG_R":1,"num_Anh_DLE":0,"num_MLW_5":1,"num_LKW_7Lkr":0}},"287":{"id":"287","type":"287","name":"Angefahrener Osterhase","police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":false,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"288":{"id":"288","type":"288","name":"Brennendes Osternest","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"289":{"id":"289","type":"289","name":"Schokoladenspur auf Strasse","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"290":{"id":"290","type":"290","name":"Eierkocherbrand","fire_department":{"num_LF":2,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"291":{"id":"291","type":"291","name":"Hasentreffen in Ostereistedt","fire_department":{"num_LF":2,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":4,"num_leBefKw":3,"num_GruKw":9,"num_FueKw":1,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":false,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"292":{"id":"292","type":"292","name":"Tankbetrug","police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"293":{"id":"293","type":"293","name":"Bluthochdruck","emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"294":{"id":"294","type":"294","name":"Fußball Bundesliga-Risikospiel","fire_department":{"num_LF":2,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":5,"num_leBefKw":9,"num_GruKw":27,"num_FueKw":3,"num_GefKw":2,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":false,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"295":{"id":"295","type":"295","name":"Tankstellenüberfall","police_department":{"num_FuStW":6,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"296":{"id":"296","type":"296","name":"Gasunfall in Werkstatt","fire_department":{"num_LF":3,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":0,"num_RW":1,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"297":{"id":"297","type":"297","name":"Arbeitsunfall im Garten","emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"298":{"id":"298","type":"298","name":"Hilflose Person auf Wasser","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":true,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false},"water_rescue":{"num_GW_W":1,"num_GW_T":1,"num_MzB":1}},"299":{"id":"299","type":"299","name":"Strohballen qualmen in Scheune","fire_department":{"num_LF":5,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":1,"num_RW":0,"num_FwK":0,"num_GW_A":1,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":1,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"300":{"id":"300","type":"300","name":"Abgestürzter Kletterer","fire_department":{"num_LF":2,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":1,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":1,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":true,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"301":{"id":"301","type":"301","name":"Tiere auf der Fahrbahn","police_department":{"num_FuStW":2,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"302":{"id":"302","type":"302","name":"Brennendes Kleinflugzeug","fire_department":{"num_LF":8,"num_ELW_1":2,"num_ELW_2":1,"num_DLK":1,"num_RW":1,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":1,"num_GW_Mess":0,"num_SW":1,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":3,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":true,"use_OrgL":false,"use_SEG_FULL":true,"use_SEG_ELW1_Only":false}},"303":{"id":"303","type":"303","name":"Carportbrand","fire_department":{"num_LF":2,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":1,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"304":{"id":"304","type":"304","name":"Angemeldete Demonstration - Gefahrenpotential","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":6,"num_leBefKw":3,"num_GruKw":6,"num_FueKw":1,"num_GefKw":0,"num_WaWe":3,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":false,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"305":{"id":"305","type":"305","name":"Fußball Bundesliga-Risikospiel","fire_department":{"num_LF":2,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":5,"num_leBefKw":10,"num_GruKw":27,"num_FueKw":3,"num_GefKw":2,"num_WaWe":3,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":false,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"306":{"id":"306","type":"306","name":"Absicherung Rockkonzert - Gefahrenpotential","fire_department":{"num_LF":2,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":8,"num_leBefKw":4,"num_GruKw":9,"num_FueKw":1,"num_GefKw":0,"num_WaWe":2,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":false,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"307":{"id":"307","type":"307","name":"Spontaner Aufstand","police_department":{"num_FuStW":7,"num_leBefKw":4,"num_GruKw":9,"num_FueKw":1,"num_GefKw":0,"num_WaWe":3,"num_PHu":1,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"308":{"id":"308","type":"308","name":"Brennender Müllwagen","fire_department":{"num_LF":2,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"309":{"id":"309","type":"309","name":"Tauchunfall","emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false},"water_rescue":{"num_GW_W":1,"num_GW_T":1,"num_MzB":1}},"310":{"id":"310","type":"310","name":"Tauchunfall","emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false},"water_rescue":{"num_GW_W":1,"num_GW_T":1,"num_MzB":1}},"311":{"id":"311","type":"311","name":"Mitarbeiter unter PKW eingeklemmt","fire_department":{"num_LF":2,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":0,"num_RW":1,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"312":{"id":"312","type":"312","name":"Verunglückter Fallschirmspringer","emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"313":{"id":"313","type":"313","name":"Verunglückter Fallschirmspringer","fire_department":{"num_LF":2,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":1,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"314":{"id":"314","type":"314","name":"Verunglückter Fallschirmspringer","fire_department":{"num_LF":3,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":1,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":1,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"315":{"id":"315","type":"315","name":"Chemieunfall an Schule","fire_department":{"num_LF":8,"num_ELW_1":2,"num_ELW_2":1,"num_DLK":1,"num_RW":0,"num_FwK":0,"num_GW_A":1,"num_GW_G":2,"num_GW_Oel":0,"num_GW_Mess":1,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":1,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":true,"use_OrgL":true,"use_SEG_FULL":true,"use_SEG_ELW1_Only":false}},"316":{"id":"316","type":"316","name":"Unbekannte Substanz","fire_department":{"num_LF":12,"num_ELW_1":2,"num_ELW_2":1,"num_DLK":0,"num_RW":2,"num_FwK":0,"num_GW_A":1,"num_GW_G":1,"num_GW_Oel":0,"num_GW_Mess":2,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":1,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":4,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"317":{"id":"317","type":"317","name":"Person in Baumaschine eingeklemmt","fire_department":{"num_LF":2,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":0,"num_RW":1,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"318":{"id":"318","type":"318","name":"Ausgelöster Heimrauchmelder","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"319":{"id":"319","type":"319","name":"Person in Baugrube","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":1,"num_RW":1,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"320":{"id":"320","type":"320","name":"Großfeuer im Krankenhaus","fire_department":{"num_LF":20,"num_ELW_1":6,"num_ELW_2":4,"num_DLK":5,"num_RW":2,"num_FwK":0,"num_GW_A":3,"num_GW_G":2,"num_GW_Oel":0,"num_GW_Mess":3,"num_SW":2,"num_GW_Hoeh":1,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":6,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":true,"use_OrgL":true,"use_SEG_FULL":true,"use_SEG_ELW1_Only":false},"technical_emergency_service":{"num_GKW":1,"num_MzKW":1,"num_MTW_TZ":1,"num_LKW_K9":1,"num_BRmG_R":1,"num_Anh_DLE":0,"num_MLW_5":1,"num_LKW_7Lkr":0}},"321":{"id":"321","type":"321","name":"Saunabrand","fire_department":{"num_LF":3,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":1,"num_RW":0,"num_FwK":0,"num_GW_A":1,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":2,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"322":{"id":"322","type":"322","name":"Geplante Autobahnsperrung","police_department":{"num_FuStW":4,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"323":{"id":"323","type":"323","name":"Dehnfugenbrand","fire_department":{"num_LF":2,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":1,"num_RW":1,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"324":{"id":"324","type":"324","name":"Brand in Baumarkt","fire_department":{"num_LF":15,"num_ELW_1":4,"num_ELW_2":2,"num_DLK":3,"num_RW":1,"num_FwK":1,"num_GW_A":2,"num_GW_G":1,"num_GW_Oel":0,"num_GW_Mess":2,"num_SW":1,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":5,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":true,"use_OrgL":true,"use_SEG_FULL":true,"use_SEG_ELW1_Only":false},"technical_emergency_service":{"num_GKW":2,"num_MzKW":2,"num_MTW_TZ":2,"num_LKW_K9":2,"num_BRmG_R":2,"num_Anh_DLE":0,"num_MLW_5":1,"num_LKW_7Lkr":0}},"325":{"id":"325","type":"325","name":"Absicherung Castor-Transport","police_department":{"num_FuStW":10,"num_leBefKw":6,"num_GruKw":18,"num_FueKw":2,"num_GefKw":0,"num_WaWe":2,"num_PHu":1,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":false,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"326":{"id":"326","type":"326","name":"Handverletzung durch Feuerwerkskörper","emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"327":{"id":"327","type":"327","name":"Tiefgaragenbrand","fire_department":{"num_LF":6,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":2,"num_RW":0,"num_FwK":0,"num_GW_A":2,"num_GW_G":0,"num_GW_Oel":1,"num_GW_Mess":1,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"328":{"id":"328","type":"328","name":"Rauch in Kabine","fire_department":{"num_LF":2,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":1,"num_Rettungstreppe":1,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"329":{"id":"329","type":"329","name":"Rauch in Kabine","fire_department":{"num_LF":2,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"330":{"id":"330","type":"330","name":"Überhitzte Bremsen","fire_department":{"num_LF":1,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":1,"num_Rettungstreppe":1,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"331":{"id":"331","type":"331","name":"Flugzeugzusammenstoß am Boden","fire_department":{"num_LF":1,"num_ELW_1":2,"num_ELW_2":1,"num_DLK":0,"num_RW":2,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":2,"num_Rettungstreppe":1,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":false,"use_RTH":false,"use_LNA":true,"use_OrgL":false,"use_SEG_FULL":true,"use_SEG_ELW1_Only":false}},"332":{"id":"332","type":"332","name":"Flugzeugbrand","fire_department":{"num_LF":10,"num_ELW_1":2,"num_ELW_2":1,"num_DLK":0,"num_RW":3,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":4,"num_Rettungstreppe":1,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":true,"use_OrgL":true,"use_SEG_FULL":true,"use_SEG_ELW1_Only":false}},"333":{"id":"333","type":"333","name":"Flugzeugbrand","fire_department":{"num_LF":10,"num_ELW_1":2,"num_ELW_2":1,"num_DLK":0,"num_RW":3,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":4,"num_Rettungstreppe":1,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":true,"use_OrgL":true,"use_SEG_FULL":true,"use_SEG_ELW1_Only":false}},"334":{"id":"334","type":"334","name":"Brennendes Kleinflugzeug","fire_department":{"num_LF":8,"num_ELW_1":2,"num_ELW_2":1,"num_DLK":1,"num_RW":1,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":1,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":true,"use_OrgL":false,"use_SEG_FULL":true,"use_SEG_ELW1_Only":false}},"335":{"id":"335","type":"335","name":"Brennendes Kleinflugzeug","fire_department":{"num_LF":8,"num_ELW_1":2,"num_ELW_2":1,"num_DLK":1,"num_RW":1,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":1,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":true,"use_OrgL":false,"use_SEG_FULL":true,"use_SEG_ELW1_Only":false}},"336":{"id":"336","type":"336","name":"Absicherung Betankung","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":2,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"337":{"id":"337","type":"337","name":"Brennender PKW","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"338":{"id":"338","type":"338","name":"Motorrad-Brand","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"339":{"id":"339","type":"339","name":"Herzinfarkt","emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"340":{"id":"340","type":"340","name":"akuter Asthma-Anfall","emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"341":{"id":"341","type":"341","name":"Krampfanfall","emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"342":{"id":"342","type":"342","name":"Triebwerksbrand","fire_department":{"num_LF":2,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":0,"num_RW":1,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":4,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"343":{"id":"343","type":"343","name":"Triebwerksbrand","fire_department":{"num_LF":2,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":0,"num_RW":1,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":4,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"344":{"id":"344","type":"344","name":"Mehrere brennende Fahrzeuge","fire_department":{"num_LF":4,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":1,"num_RW":1,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"345":{"id":"345","type":"345","name":"Höhenrettung am Fahrgeschäft","fire_department":{"num_LF":2,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":1,"num_RW":1,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":1,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":false,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"346":{"id":"346","type":"346","name":"Gebäudesprengung","fire_department":{"num_LF":2,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":1,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":3,"num_leBefKw":1,"num_GruKw":3,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":false,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false},"technical_emergency_service":{"num_GKW":1,"num_MzKW":1,"num_MTW_TZ":1,"num_LKW_K9":0,"num_BRmG_R":0,"num_Anh_DLE":0,"num_MLW_5":1,"num_LKW_7Lkr":0}},"347":{"id":"347","type":"347","name":"Helikopter in Baum","fire_department":{"num_LF":6,"num_ELW_1":2,"num_ELW_2":1,"num_DLK":1,"num_RW":2,"num_FwK":1,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":1,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":1,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":3,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"348":{"id":"348","type":"348","name":"Explosion in Biogasanlage","fire_department":{"num_LF":20,"num_ELW_1":4,"num_ELW_2":2,"num_DLK":2,"num_RW":4,"num_FwK":0,"num_GW_A":2,"num_GW_G":0,"num_GW_Oel":1,"num_GW_Mess":1,"num_SW":2,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":3,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":true,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false},"technical_emergency_service":{"num_GKW":1,"num_MzKW":1,"num_MTW_TZ":1,"num_LKW_K9":1,"num_BRmG_R":1,"num_Anh_DLE":0,"num_MLW_5":1,"num_LKW_7Lkr":0}},"349":{"id":"349","type":"349","name":"Brandgeruch","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"350":{"id":"350","type":"350","name":"Flughafenbrand","fire_department":{"num_LF":40,"num_ELW_1":6,"num_ELW_2":2,"num_DLK":8,"num_RW":6,"num_FwK":0,"num_GW_A":2,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":3,"num_SW":4,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":6,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":10,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":2,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":true,"use_OrgL":true,"use_SEG_FULL":true,"use_SEG_ELW1_Only":false},"technical_emergency_service":{"num_GKW":2,"num_MzKW":2,"num_MTW_TZ":2,"num_LKW_K9":2,"num_BRmG_R":2,"num_Anh_DLE":0,"num_MLW_5":1,"num_LKW_7Lkr":0}},"351":{"id":"351","type":"351","name":"Brand im Terminal","fire_department":{"num_LF":6,"num_ELW_1":2,"num_ELW_2":1,"num_DLK":2,"num_RW":0,"num_FwK":0,"num_GW_A":1,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":1,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":2,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":true,"use_OrgL":true,"use_SEG_FULL":true,"use_SEG_ELW1_Only":false}},"352":{"id":"352","type":"352","name":"Brand in Mehrfamilienhaus","fire_department":{"num_LF":12,"num_ELW_1":3,"num_ELW_2":1,"num_DLK":3,"num_RW":1,"num_FwK":0,"num_GW_A":1,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":1,"num_SW":1,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":4,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":true,"use_LNA":true,"use_OrgL":true,"use_SEG_FULL":true,"use_SEG_ELW1_Only":false}},"353":{"id":"353","type":"353","name":"Großkontrolle Betäubungsmittel","police_department":{"num_FuStW":3,"num_leBefKw":1,"num_GruKw":3,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"354":{"id":"354","type":"354","name":"Grillunfall","emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":true,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"355":{"id":"355","type":"355","name":"Waffenentzug","police_department":{"num_FuStW":4,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":1,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":3,"num_MEK_MTF":1}},"356":{"id":"356","type":"356","name":"Häusliche Gewalt - eskaliert","police_department":{"num_FuStW":4,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":1,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":3,"num_SEK_MTF":1,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":false,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"357":{"id":"357","type":"357","name":"Bank: Stiller Alarm","police_department":{"num_FuStW":2,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"358":{"id":"358","type":"358","name":"Banküberfall","police_department":{"num_FuStW":8,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":1,"num_GefKw":0,"num_WaWe":0,"num_PHu":1,"num_SEK_ZF":3,"num_SEK_MTF":1,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":true,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"359":{"id":"359","type":"359","name":"Geplante Razzia - Verdächtiger flüchtig","police_department":{"num_FuStW":5,"num_leBefKw":2,"num_GruKw":6,"num_FueKw":1,"num_GefKw":1,"num_WaWe":0,"num_PHu":1,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":3,"num_MEK_MTF":1}},"360":{"id":"360","type":"360","name":"Brennender Blumenstrauß","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"361":{"id":"361","type":"361","name":"Brennender Blumenstrauß","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"362":{"id":"362","type":"362","name":"Brennender Blumenstrauß","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"363":{"id":"363","type":"363","name":"Brennender Blumenstrauß","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"364":{"id":"364","type":"364","name":"Brennender Blumenstrauß","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"365":{"id":"365","type":"365","name":"Brennender Blumenstrauß","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"366":{"id":"366","type":"366","name":"Vollstreckung Haftbefehl","police_department":{"num_FuStW":2,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"367":{"id":"367","type":"367","name":"Vollstreckung Haftbefehl - eskaliert","police_department":{"num_FuStW":6,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":1,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":3,"num_SEK_MTF":1,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"368":{"id":"368","type":"368","name":"Brennende Kirche","fire_department":{"num_LF":15,"num_ELW_1":3,"num_ELW_2":1,"num_DLK":3,"num_RW":4,"num_FwK":0,"num_GW_A":2,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":1,"num_SW":2,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":4,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":true,"use_LNA":true,"use_OrgL":false,"use_SEG_FULL":true,"use_SEG_ELW1_Only":false},"technical_emergency_service":{"num_GKW":1,"num_MzKW":1,"num_MTW_TZ":1,"num_LKW_K9":1,"num_BRmG_R":1,"num_Anh_DLE":1,"num_MLW_5":1,"num_LKW_7Lkr":0}},"369":{"id":"369","type":"369","name":"Austritt Kohlenmonoxid","fire_department":{"num_LF":2,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":1,"num_RW":1,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":1,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":true,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"370":{"id":"370","type":"370","name":"Geisterfahrer","police_department":{"num_FuStW":4,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"371":{"id":"371","type":"371","name":"Fußball aufpumpen","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"372":{"id":"372","type":"372","name":"Mannschaftsbus in Halteverbot abgestellt","police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"373":{"id":"373","type":"373","name":"Behandlung nach Schwalbe","emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"374":{"id":"374","type":"374","name":"Prellung nach Lattenpraller","emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"375":{"id":"375","type":"375","name":"Tor gefallen","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"376":{"id":"376","type":"376","name":"Pokal geklaut","police_department":{"num_FuStW":2,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"377":{"id":"377","type":"377","name":"Überzuckerung","emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"378":{"id":"378","type":"378","name":"Observation","police_department":{"num_FuStW":0,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":1,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":3,"num_MEK_MTF":1}},"379":{"id":"379","type":"379","name":"PKW im Gleisbett","fire_department":{"num_LF":3,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":0,"num_RW":1,"num_FwK":1,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"380":{"id":"380","type":"380","name":"PKW im Gleisbett","fire_department":{"num_LF":3,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":0,"num_RW":1,"num_FwK":1,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"381":{"id":"381","type":"381","name":"PKW im Gleisbett","fire_department":{"num_LF":3,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":0,"num_RW":1,"num_FwK":1,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"382":{"id":"382","type":"382","name":"PKW im Gleisbett","fire_department":{"num_LF":3,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":0,"num_RW":1,"num_FwK":1,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"383":{"id":"383","type":"383","name":"Kind in PKW eingeschlossen","police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"384":{"id":"384","type":"384","name":"Brennende Ballenpresse","fire_department":{"num_LF":2,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"385":{"id":"385","type":"385","name":"Unfall beim Umpumpen von Flüssigkeiten","fire_department":{"num_LF":4,"num_ELW_1":1,"num_ELW_2":1,"num_DLK":1,"num_RW":0,"num_FwK":0,"num_GW_A":1,"num_GW_G":1,"num_GW_Oel":1,"num_GW_Mess":1,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":1,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"386":{"id":"386","type":"386","name":"Ammoniakaustritt","fire_department":{"num_LF":5,"num_ELW_1":2,"num_ELW_2":1,"num_DLK":1,"num_RW":0,"num_FwK":0,"num_GW_A":1,"num_GW_G":1,"num_GW_Oel":0,"num_GW_Mess":1,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":1,"num_ULF_mit_Loescharm":1,"num_Turboloescher":1},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":true,"use_OrgL":false,"use_SEG_FULL":true,"use_SEG_ELW1_Only":false}},"387":{"id":"387","type":"387","name":"Brennende Pipeline-Isolierung","fire_department":{"num_LF":8,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":1,"num_RW":0,"num_FwK":0,"num_GW_A":1,"num_GW_G":1,"num_GW_Oel":0,"num_GW_Mess":1,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":1,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":1,"num_ULF_mit_Loescharm":1,"num_Turboloescher":1},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"388":{"id":"388","type":"388","name":"Feuer in Verwaltungsgebäude","fire_department":{"num_LF":5,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":1,"num_RW":1,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"389":{"id":"389","type":"389","name":"Brand in Chemiepark - Produktion","fire_department":{"num_LF":16,"num_ELW_1":3,"num_ELW_2":1,"num_DLK":4,"num_RW":1,"num_FwK":0,"num_GW_A":1,"num_GW_G":1,"num_GW_Oel":0,"num_GW_Mess":1,"num_SW":1,"num_GW_Hoeh":0,"num_Dekon_P":1,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":1,"num_ULF_mit_Loescharm":1,"num_Turboloescher":1},"police_department":{"num_FuStW":3,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"390":{"id":"390","type":"390","name":"Sicherheitslandung","fire_department":{"num_LF":1,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":2,"num_Rettungstreppe":1,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":false,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"391":{"id":"391","type":"391","name":"Vergiftung","emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"392":{"id":"392","type":"392","name":"Person durch Hubmaschine eingeklemmt","fire_department":{"num_LF":2,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":0,"num_RW":1,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"393":{"id":"393","type":"393","name":"Einsturzgefährdeter Balkon","fire_department":{"num_LF":2,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":1,"num_RW":1,"num_FwK":1,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"technical_emergency_service":{"num_GKW":1,"num_MzKW":0,"num_MTW_TZ":0,"num_LKW_K9":0,"num_BRmG_R":0,"num_Anh_DLE":0,"num_MLW_5":1,"num_LKW_7Lkr":0}},"394":{"id":"394","type":"394","name":"LKW auf Stauende","fire_department":{"num_LF":5,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":0,"num_RW":1,"num_FwK":0,"num_GW_A":0,"num_GW_G":1,"num_GW_Oel":1,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":4,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"395":{"id":"395","type":"395","name":"Maschinenbrand in Produktionshalle","fire_department":{"num_LF":3,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":0,"num_RW":1,"num_FwK":0,"num_GW_A":1,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":1,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"396":{"id":"396","type":"396","name":"Maschinenbrand in Produktionshalle","fire_department":{"num_LF":3,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":0,"num_RW":1,"num_FwK":0,"num_GW_A":1,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":1,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"397":{"id":"397","type":"397","name":"Schnittwunde","emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":false,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"398":{"id":"398","type":"398","name":"Brennende Absauganlage","fire_department":{"num_LF":4,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":1,"num_RW":1,"num_FwK":0,"num_GW_A":1,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":1,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"399":{"id":"399","type":"399","name":"Brand in Kabelkanal","fire_department":{"num_LF":3,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":0,"num_RW":1,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":1,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"400":{"id":"400","type":"400","name":"Brand in Lackiererei","fire_department":{"num_LF":7,"num_ELW_1":2,"num_ELW_2":1,"num_DLK":1,"num_RW":1,"num_FwK":0,"num_GW_A":1,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":1,"num_ULF_mit_Loescharm":1,"num_Turboloescher":0}},"401":{"id":"401","type":"401","name":"Umgestürzter Gabelstapler","fire_department":{"num_LF":2,"num_ELW_1":1,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":1,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"402":{"id":"402","type":"402","name":"Brennender PKW","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"403":{"id":"403","type":"403","name":"Mülleimerbrand","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"404":{"id":"404","type":"404","name":"Mülleimerbrand","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"405":{"id":"405","type":"405","name":"Brennender LKW","fire_department":{"num_LF":2,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"406":{"id":"406","type":"406","name":"Brennender LKW","fire_department":{"num_LF":2,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"407":{"id":"407","type":"407","name":"Brennende Filteranlage","fire_department":{"num_LF":6,"num_ELW_1":2,"num_ELW_2":1,"num_DLK":1,"num_RW":1,"num_FwK":0,"num_GW_A":1,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":1,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"408":{"id":"408","type":"408","name":"Rauchentwicklung an Förderband","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"409":{"id":"409","type":"409","name":"Brennender LKW","fire_department":{"num_LF":2,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"410":{"id":"410","type":"410","name":"Mülleimerbrand","fire_department":{"num_LF":1,"num_ELW_1":0,"num_ELW_2":0,"num_DLK":0,"num_RW":0,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"411":{"id":"411","type":"411","name":"Heißluftballon in Hochspannungsmast","fire_department":{"num_LF":6,"num_ELW_1":2,"num_ELW_2":1,"num_DLK":1,"num_RW":2,"num_FwK":0,"num_GW_A":0,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":1,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":0,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":2,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":1,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":true,"use_OrgL":false,"use_SEG_FULL":true,"use_SEG_ELW1_Only":false},"technical_emergency_service":{"num_GKW":2,"num_MzKW":0,"num_MTW_TZ":0,"num_LKW_K9":0,"num_BRmG_R":0,"num_Anh_DLE":0,"num_MLW_5":1,"num_LKW_7Lkr":0}},"412":{"id":"412","type":"412","name":"Verpuffung","fire_department":{"num_LF":6,"num_ELW_1":1,"num_ELW_2":1,"num_DLK":1,"num_RW":1,"num_FwK":0,"num_GW_A":1,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":1,"num_ULF_mit_Loescharm":1,"num_Turboloescher":0}},"413":{"id":"413","type":"413","name":"Verpuffung","fire_department":{"num_LF":6,"num_ELW_1":1,"num_ELW_2":1,"num_DLK":0,"num_RW":1,"num_FwK":0,"num_GW_A":1,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":1,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0}},"414":{"id":"414","type":"414","name":"Verpuffung","fire_department":{"num_LF":6,"num_ELW_1":1,"num_ELW_2":1,"num_DLK":1,"num_RW":1,"num_FwK":0,"num_GW_A":1,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":0,"num_SW":0,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":1,"num_ULF_mit_Loescharm":1,"num_Turboloescher":0}},"415":{"id":"415","type":"415","name":"Jäger verletzt Passant durch Schuss","police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":true,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"416":{"id":"416","type":"416","name":"Jäger stürzt von Hochsitz","emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"417":{"id":"417","type":"417","name":"Jäger durch Wildtier verletzt","emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"418":{"id":"418","type":"418","name":"Absicherung Pannen-LKW","police_department":{"num_FuStW":1,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0}},"419":{"id":"419","type":"419","name":"Austritt Flüssiggas","fire_department":{"num_LF":6,"num_ELW_1":2,"num_ELW_2":1,"num_DLK":2,"num_RW":3,"num_FwK":0,"num_GW_A":2,"num_GW_G":0,"num_GW_Oel":0,"num_GW_Mess":1,"num_SW":1,"num_GW_Hoeh":0,"num_Dekon_P":0,"num_FLF":0,"num_Rettungstreppe":0,"num_GW_Werkfeuerwehr":1,"num_ULF_mit_Loescharm":0,"num_Turboloescher":0},"police_department":{"num_FuStW":2,"num_leBefKw":0,"num_GruKw":0,"num_FueKw":0,"num_GefKw":0,"num_WaWe":0,"num_PHu":0,"num_SEK_ZF":0,"num_SEK_MTF":0,"num_MEK_ZF":0,"num_MEK_MTF":0},"emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":true,"use_RTH":false,"use_LNA":true,"use_OrgL":false,"use_SEG_FULL":true,"use_SEG_ELW1_Only":false}},"420":{"id":"420","type":"420","name":"Schlechter Allgemeinzustand","emergency_medical_service":{"use_KTW":false,"use_RTW":true,"use_NEF":false,"use_RTH":false,"use_LNA":false,"use_OrgL":false,"use_SEG_FULL":false,"use_SEG_ELW1_Only":false}},"421":{"id":"421","type":"421","name":null}};
|
|
|
|
if (typeof window.name != 'undefined') {
|
|
console.log(window.name);
|
|
}
|
|
|
|
var ADis_MyHead = document.getElementsByTagName('head')[0];
|
|
var ADis_MyBody = document.getElementsByTagName('body')[0];
|
|
|
|
function includesString(string1, string2) {
|
|
return string1.toLowerCase().includes(string2.toLowerCase());
|
|
}
|
|
|
|
async function ADisSettings() {
|
|
var res = {};
|
|
await ADisDB.ADisSettings.each((setting) => {
|
|
res[setting.name] = setting.value;
|
|
});
|
|
return res;
|
|
}
|
|
|
|
/*
|
|
* Dexie.js - a minimalistic wrapper for IndexedDB
|
|
* ===============================================
|
|
*
|
|
* By David Fahlander, david.fahlander@gmail.com
|
|
*
|
|
* Version 2.0.4, Fri May 25 2018
|
|
*
|
|
* http://dexie.org
|
|
*
|
|
* Apache License Version 2.0, January 2004, http://www.apache.org/licenses/
|
|
*/
|
|
|
|
(function (global, factory) {
|
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
typeof define === 'function' && define.amd ? define(factory) :
|
|
(global.Dexie = factory());
|
|
}(this, (function () { 'use strict';
|
|
|
|
var keys = Object.keys;
|
|
var isArray = Array.isArray;
|
|
var _global = typeof self !== 'undefined' ? self :
|
|
typeof window !== 'undefined' ? window :
|
|
global;
|
|
function extend(obj, extension) {
|
|
if (typeof extension !== 'object')
|
|
return obj;
|
|
keys(extension).forEach(function (key) {
|
|
obj[key] = extension[key];
|
|
});
|
|
return obj;
|
|
}
|
|
var getProto = Object.getPrototypeOf;
|
|
var _hasOwn = {}.hasOwnProperty;
|
|
function hasOwn(obj, prop) {
|
|
return _hasOwn.call(obj, prop);
|
|
}
|
|
function props(proto, extension) {
|
|
if (typeof extension === 'function')
|
|
extension = extension(getProto(proto));
|
|
keys(extension).forEach(function (key) {
|
|
setProp(proto, key, extension[key]);
|
|
});
|
|
}
|
|
var defineProperty = Object.defineProperty;
|
|
function setProp(obj, prop, functionOrGetSet, options) {
|
|
defineProperty(obj, prop, extend(functionOrGetSet && hasOwn(functionOrGetSet, "get") && typeof functionOrGetSet.get === 'function' ?
|
|
{ get: functionOrGetSet.get, set: functionOrGetSet.set, configurable: true } :
|
|
{ value: functionOrGetSet, configurable: true, writable: true }, options));
|
|
}
|
|
function derive(Child) {
|
|
return {
|
|
from: function (Parent) {
|
|
Child.prototype = Object.create(Parent.prototype);
|
|
setProp(Child.prototype, "constructor", Child);
|
|
return {
|
|
extend: props.bind(null, Child.prototype)
|
|
};
|
|
}
|
|
};
|
|
}
|
|
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
function getPropertyDescriptor(obj, prop) {
|
|
var pd = getOwnPropertyDescriptor(obj, prop), proto;
|
|
return pd || (proto = getProto(obj)) && getPropertyDescriptor(proto, prop);
|
|
}
|
|
var _slice = [].slice;
|
|
function slice(args, start, end) {
|
|
return _slice.call(args, start, end);
|
|
}
|
|
function override(origFunc, overridedFactory) {
|
|
return overridedFactory(origFunc);
|
|
}
|
|
function assert(b) {
|
|
if (!b)
|
|
throw new Error("Assertion Failed");
|
|
}
|
|
function asap(fn) {
|
|
if (_global.setImmediate)
|
|
setImmediate(fn);
|
|
else
|
|
setTimeout(fn, 0);
|
|
}
|
|
|
|
/** Generate an object (hash map) based on given array.
|
|
* @param extractor Function taking an array item and its index and returning an array of 2 items ([key, value]) to
|
|
* instert on the resulting object for each item in the array. If this function returns a falsy value, the
|
|
* current item wont affect the resulting object.
|
|
*/
|
|
function arrayToObject(array, extractor) {
|
|
return array.reduce(function (result, item, i) {
|
|
var nameAndValue = extractor(item, i);
|
|
if (nameAndValue)
|
|
result[nameAndValue[0]] = nameAndValue[1];
|
|
return result;
|
|
}, {});
|
|
}
|
|
function trycatcher(fn, reject) {
|
|
return function () {
|
|
try {
|
|
fn.apply(this, arguments);
|
|
}
|
|
catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
}
|
|
function tryCatch(fn, onerror, args) {
|
|
try {
|
|
fn.apply(null, args);
|
|
}
|
|
catch (ex) {
|
|
onerror && onerror(ex);
|
|
}
|
|
}
|
|
function getByKeyPath(obj, keyPath) {
|
|
// http://www.w3.org/TR/IndexedDB/#steps-for-extracting-a-key-from-a-value-using-a-key-path
|
|
if (hasOwn(obj, keyPath))
|
|
return obj[keyPath]; // This line is moved from last to first for optimization purpose.
|
|
if (!keyPath)
|
|
return obj;
|
|
if (typeof keyPath !== 'string') {
|
|
var rv = [];
|
|
for (var i = 0, l = keyPath.length; i < l; ++i) {
|
|
var val = getByKeyPath(obj, keyPath[i]);
|
|
rv.push(val);
|
|
}
|
|
return rv;
|
|
}
|
|
var period = keyPath.indexOf('.');
|
|
if (period !== -1) {
|
|
var innerObj = obj[keyPath.substr(0, period)];
|
|
return innerObj === undefined ? undefined : getByKeyPath(innerObj, keyPath.substr(period + 1));
|
|
}
|
|
return undefined;
|
|
}
|
|
function setByKeyPath(obj, keyPath, value) {
|
|
if (!obj || keyPath === undefined)
|
|
return;
|
|
if ('isFrozen' in Object && Object.isFrozen(obj))
|
|
return;
|
|
if (typeof keyPath !== 'string' && 'length' in keyPath) {
|
|
assert(typeof value !== 'string' && 'length' in value);
|
|
for (var i = 0, l = keyPath.length; i < l; ++i) {
|
|
setByKeyPath(obj, keyPath[i], value[i]);
|
|
}
|
|
}
|
|
else {
|
|
var period = keyPath.indexOf('.');
|
|
if (period !== -1) {
|
|
var currentKeyPath = keyPath.substr(0, period);
|
|
var remainingKeyPath = keyPath.substr(period + 1);
|
|
if (remainingKeyPath === "")
|
|
if (value === undefined)
|
|
delete obj[currentKeyPath];
|
|
else
|
|
obj[currentKeyPath] = value;
|
|
else {
|
|
var innerObj = obj[currentKeyPath];
|
|
if (!innerObj)
|
|
innerObj = (obj[currentKeyPath] = {});
|
|
setByKeyPath(innerObj, remainingKeyPath, value);
|
|
}
|
|
}
|
|
else {
|
|
if (value === undefined)
|
|
delete obj[keyPath];
|
|
else
|
|
obj[keyPath] = value;
|
|
}
|
|
}
|
|
}
|
|
function delByKeyPath(obj, keyPath) {
|
|
if (typeof keyPath === 'string')
|
|
setByKeyPath(obj, keyPath, undefined);
|
|
else if ('length' in keyPath)
|
|
[].map.call(keyPath, function (kp) {
|
|
setByKeyPath(obj, kp, undefined);
|
|
});
|
|
}
|
|
function shallowClone(obj) {
|
|
var rv = {};
|
|
for (var m in obj) {
|
|
if (hasOwn(obj, m))
|
|
rv[m] = obj[m];
|
|
}
|
|
return rv;
|
|
}
|
|
var concat = [].concat;
|
|
function flatten(a) {
|
|
return concat.apply([], a);
|
|
}
|
|
//https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm
|
|
var intrinsicTypes = "Boolean,String,Date,RegExp,Blob,File,FileList,ArrayBuffer,DataView,Uint8ClampedArray,ImageData,Map,Set"
|
|
.split(',').concat(flatten([8, 16, 32, 64].map(function (num) { return ["Int", "Uint", "Float"].map(function (t) { return t + num + "Array"; }); }))).filter(function (t) { return _global[t]; }).map(function (t) { return _global[t]; });
|
|
function deepClone(any) {
|
|
if (!any || typeof any !== 'object')
|
|
return any;
|
|
var rv;
|
|
if (isArray(any)) {
|
|
rv = [];
|
|
for (var i = 0, l = any.length; i < l; ++i) {
|
|
rv.push(deepClone(any[i]));
|
|
}
|
|
}
|
|
else if (intrinsicTypes.indexOf(any.constructor) >= 0) {
|
|
rv = any;
|
|
}
|
|
else {
|
|
rv = any.constructor ? Object.create(any.constructor.prototype) : {};
|
|
for (var prop in any) {
|
|
if (hasOwn(any, prop)) {
|
|
rv[prop] = deepClone(any[prop]);
|
|
}
|
|
}
|
|
}
|
|
return rv;
|
|
}
|
|
function getObjectDiff(a, b, rv, prfx) {
|
|
// Compares objects a and b and produces a diff object.
|
|
rv = rv || {};
|
|
prfx = prfx || '';
|
|
keys(a).forEach(function (prop) {
|
|
if (!hasOwn(b, prop))
|
|
rv[prfx + prop] = undefined; // Property removed
|
|
else {
|
|
var ap = a[prop], bp = b[prop];
|
|
if (typeof ap === 'object' && typeof bp === 'object' &&
|
|
ap && bp &&
|
|
// Now compare constructors are same (not equal because wont work in Safari)
|
|
('' + ap.constructor) === ('' + bp.constructor))
|
|
// Same type of object but its properties may have changed
|
|
getObjectDiff(ap, bp, rv, prfx + prop + ".");
|
|
else if (ap !== bp)
|
|
rv[prfx + prop] = b[prop]; // Primitive value changed
|
|
}
|
|
});
|
|
keys(b).forEach(function (prop) {
|
|
if (!hasOwn(a, prop)) {
|
|
rv[prfx + prop] = b[prop]; // Property added
|
|
}
|
|
});
|
|
return rv;
|
|
}
|
|
// If first argument is iterable or array-like, return it as an array
|
|
var iteratorSymbol = typeof Symbol !== 'undefined' && Symbol.iterator;
|
|
var getIteratorOf = iteratorSymbol ? function (x) {
|
|
var i;
|
|
return x != null && (i = x[iteratorSymbol]) && i.apply(x);
|
|
} : function () { return null; };
|
|
var NO_CHAR_ARRAY = {};
|
|
// Takes one or several arguments and returns an array based on the following criteras:
|
|
// * If several arguments provided, return arguments converted to an array in a way that
|
|
// still allows javascript engine to optimize the code.
|
|
// * If single argument is an array, return a clone of it.
|
|
// * If this-pointer equals NO_CHAR_ARRAY, don't accept strings as valid iterables as a special
|
|
// case to the two bullets below.
|
|
// * If single argument is an iterable, convert it to an array and return the resulting array.
|
|
// * If single argument is array-like (has length of type number), convert it to an array.
|
|
function getArrayOf(arrayLike) {
|
|
var i, a, x, it;
|
|
if (arguments.length === 1) {
|
|
if (isArray(arrayLike))
|
|
return arrayLike.slice();
|
|
if (this === NO_CHAR_ARRAY && typeof arrayLike === 'string')
|
|
return [arrayLike];
|
|
if ((it = getIteratorOf(arrayLike))) {
|
|
a = [];
|
|
while ((x = it.next()), !x.done)
|
|
a.push(x.value);
|
|
return a;
|
|
}
|
|
if (arrayLike == null)
|
|
return [arrayLike];
|
|
i = arrayLike.length;
|
|
if (typeof i === 'number') {
|
|
a = new Array(i);
|
|
while (i--)
|
|
a[i] = arrayLike[i];
|
|
return a;
|
|
}
|
|
return [arrayLike];
|
|
}
|
|
i = arguments.length;
|
|
a = new Array(i);
|
|
while (i--)
|
|
a[i] = arguments[i];
|
|
return a;
|
|
}
|
|
|
|
// By default, debug will be true only if platform is a web platform and its page is served from localhost.
|
|
// When debug = true, error's stacks will contain asyncronic long stacks.
|
|
var debug = typeof location !== 'undefined' &&
|
|
// By default, use debug mode if served from localhost.
|
|
/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);
|
|
function setDebug(value, filter) {
|
|
debug = value;
|
|
libraryFilter = filter;
|
|
}
|
|
var libraryFilter = function () { return true; };
|
|
var NEEDS_THROW_FOR_STACK = !new Error("").stack;
|
|
function getErrorWithStack() {
|
|
"use strict";
|
|
if (NEEDS_THROW_FOR_STACK)
|
|
try {
|
|
// Doing something naughty in strict mode here to trigger a specific error
|
|
// that can be explicitely ignored in debugger's exception settings.
|
|
// If we'd just throw new Error() here, IE's debugger's exception settings
|
|
// will just consider it as "exception thrown by javascript code" which is
|
|
// something you wouldn't want it to ignore.
|
|
getErrorWithStack.arguments;
|
|
throw new Error(); // Fallback if above line don't throw.
|
|
}
|
|
catch (e) {
|
|
return e;
|
|
}
|
|
return new Error();
|
|
}
|
|
function prettyStack(exception, numIgnoredFrames) {
|
|
var stack = exception.stack;
|
|
if (!stack)
|
|
return "";
|
|
numIgnoredFrames = (numIgnoredFrames || 0);
|
|
if (stack.indexOf(exception.name) === 0)
|
|
numIgnoredFrames += (exception.name + exception.message).split('\n').length;
|
|
return stack.split('\n')
|
|
.slice(numIgnoredFrames)
|
|
.filter(libraryFilter)
|
|
.map(function (frame) { return "\n" + frame; })
|
|
.join('');
|
|
}
|
|
function deprecated(what, fn) {
|
|
return function () {
|
|
console.warn(what + " is deprecated. See https://github.com/dfahlander/Dexie.js/wiki/Deprecations. " + prettyStack(getErrorWithStack(), 1));
|
|
return fn.apply(this, arguments);
|
|
};
|
|
}
|
|
|
|
var dexieErrorNames = [
|
|
'Modify',
|
|
'Bulk',
|
|
'OpenFailed',
|
|
'VersionChange',
|
|
'Schema',
|
|
'Upgrade',
|
|
'InvalidTable',
|
|
'MissingAPI',
|
|
'NoSuchDatabase',
|
|
'InvalidArgument',
|
|
'SubTransaction',
|
|
'Unsupported',
|
|
'Internal',
|
|
'DatabaseClosed',
|
|
'PrematureCommit',
|
|
'ForeignAwait'
|
|
];
|
|
var idbDomErrorNames = [
|
|
'Unknown',
|
|
'Constraint',
|
|
'Data',
|
|
'TransactionInactive',
|
|
'ReadOnly',
|
|
'Version',
|
|
'NotFound',
|
|
'InvalidState',
|
|
'InvalidAccess',
|
|
'Abort',
|
|
'Timeout',
|
|
'QuotaExceeded',
|
|
'Syntax',
|
|
'DataClone'
|
|
];
|
|
var errorList = dexieErrorNames.concat(idbDomErrorNames);
|
|
var defaultTexts = {
|
|
VersionChanged: "Database version changed by other database connection",
|
|
DatabaseClosed: "Database has been closed",
|
|
Abort: "Transaction aborted",
|
|
TransactionInactive: "Transaction has already completed or failed"
|
|
};
|
|
//
|
|
// DexieError - base class of all out exceptions.
|
|
//
|
|
function DexieError(name, msg) {
|
|
// Reason we don't use ES6 classes is because:
|
|
// 1. It bloats transpiled code and increases size of minified code.
|
|
// 2. It doesn't give us much in this case.
|
|
// 3. It would require sub classes to call super(), which
|
|
// is not needed when deriving from Error.
|
|
this._e = getErrorWithStack();
|
|
this.name = name;
|
|
this.message = msg;
|
|
}
|
|
derive(DexieError).from(Error).extend({
|
|
stack: {
|
|
get: function () {
|
|
return this._stack ||
|
|
(this._stack = this.name + ": " + this.message + prettyStack(this._e, 2));
|
|
}
|
|
},
|
|
toString: function () { return this.name + ": " + this.message; }
|
|
});
|
|
function getMultiErrorMessage(msg, failures) {
|
|
return msg + ". Errors: " + failures
|
|
.map(function (f) { return f.toString(); })
|
|
.filter(function (v, i, s) { return s.indexOf(v) === i; }) // Only unique error strings
|
|
.join('\n');
|
|
}
|
|
//
|
|
// ModifyError - thrown in Collection.modify()
|
|
// Specific constructor because it contains members failures and failedKeys.
|
|
//
|
|
function ModifyError(msg, failures, successCount, failedKeys) {
|
|
this._e = getErrorWithStack();
|
|
this.failures = failures;
|
|
this.failedKeys = failedKeys;
|
|
this.successCount = successCount;
|
|
}
|
|
derive(ModifyError).from(DexieError);
|
|
function BulkError(msg, failures) {
|
|
this._e = getErrorWithStack();
|
|
this.name = "BulkError";
|
|
this.failures = failures;
|
|
this.message = getMultiErrorMessage(msg, failures);
|
|
}
|
|
derive(BulkError).from(DexieError);
|
|
//
|
|
//
|
|
// Dynamically generate error names and exception classes based
|
|
// on the names in errorList.
|
|
//
|
|
//
|
|
// Map of {ErrorName -> ErrorName + "Error"}
|
|
var errnames = errorList.reduce(function (obj, name) { return (obj[name] = name + "Error", obj); }, {});
|
|
// Need an alias for DexieError because we're gonna create subclasses with the same name.
|
|
var BaseException = DexieError;
|
|
// Map of {ErrorName -> exception constructor}
|
|
var exceptions = errorList.reduce(function (obj, name) {
|
|
// Let the name be "DexieError" because this name may
|
|
// be shown in call stack and when debugging. DexieError is
|
|
// the most true name because it derives from DexieError,
|
|
// and we cannot change Function.name programatically without
|
|
// dynamically create a Function object, which would be considered
|
|
// 'eval-evil'.
|
|
var fullName = name + "Error";
|
|
function DexieError(msgOrInner, inner) {
|
|
this._e = getErrorWithStack();
|
|
this.name = fullName;
|
|
if (!msgOrInner) {
|
|
this.message = defaultTexts[name] || fullName;
|
|
this.inner = null;
|
|
}
|
|
else if (typeof msgOrInner === 'string') {
|
|
this.message = msgOrInner;
|
|
this.inner = inner || null;
|
|
}
|
|
else if (typeof msgOrInner === 'object') {
|
|
this.message = msgOrInner.name + " " + msgOrInner.message;
|
|
this.inner = msgOrInner;
|
|
}
|
|
}
|
|
derive(DexieError).from(BaseException);
|
|
obj[name] = DexieError;
|
|
return obj;
|
|
}, {});
|
|
// Use ECMASCRIPT standard exceptions where applicable:
|
|
exceptions.Syntax = SyntaxError;
|
|
exceptions.Type = TypeError;
|
|
exceptions.Range = RangeError;
|
|
var exceptionMap = idbDomErrorNames.reduce(function (obj, name) {
|
|
obj[name + "Error"] = exceptions[name];
|
|
return obj;
|
|
}, {});
|
|
function mapError(domError, message) {
|
|
if (!domError || domError instanceof DexieError || domError instanceof TypeError || domError instanceof SyntaxError || !domError.name || !exceptionMap[domError.name])
|
|
return domError;
|
|
var rv = new exceptionMap[domError.name](message || domError.message, domError);
|
|
if ("stack" in domError) {
|
|
// Derive stack from inner exception if it has a stack
|
|
setProp(rv, "stack", { get: function () {
|
|
return this.inner.stack;
|
|
} });
|
|
}
|
|
return rv;
|
|
}
|
|
var fullNameExceptions = errorList.reduce(function (obj, name) {
|
|
if (["Syntax", "Type", "Range"].indexOf(name) === -1)
|
|
obj[name + "Error"] = exceptions[name];
|
|
return obj;
|
|
}, {});
|
|
fullNameExceptions.ModifyError = ModifyError;
|
|
fullNameExceptions.DexieError = DexieError;
|
|
fullNameExceptions.BulkError = BulkError;
|
|
|
|
function nop() { }
|
|
function mirror(val) { return val; }
|
|
function pureFunctionChain(f1, f2) {
|
|
// Enables chained events that takes ONE argument and returns it to the next function in chain.
|
|
// This pattern is used in the hook("reading") event.
|
|
if (f1 == null || f1 === mirror)
|
|
return f2;
|
|
return function (val) {
|
|
return f2(f1(val));
|
|
};
|
|
}
|
|
function callBoth(on1, on2) {
|
|
return function () {
|
|
on1.apply(this, arguments);
|
|
on2.apply(this, arguments);
|
|
};
|
|
}
|
|
function hookCreatingChain(f1, f2) {
|
|
// Enables chained events that takes several arguments and may modify first argument by making a modification and then returning the same instance.
|
|
// This pattern is used in the hook("creating") event.
|
|
if (f1 === nop)
|
|
return f2;
|
|
return function () {
|
|
var res = f1.apply(this, arguments);
|
|
if (res !== undefined)
|
|
arguments[0] = res;
|
|
var onsuccess = this.onsuccess, // In case event listener has set this.onsuccess
|
|
onerror = this.onerror; // In case event listener has set this.onerror
|
|
this.onsuccess = null;
|
|
this.onerror = null;
|
|
var res2 = f2.apply(this, arguments);
|
|
if (onsuccess)
|
|
this.onsuccess = this.onsuccess ? callBoth(onsuccess, this.onsuccess) : onsuccess;
|
|
if (onerror)
|
|
this.onerror = this.onerror ? callBoth(onerror, this.onerror) : onerror;
|
|
return res2 !== undefined ? res2 : res;
|
|
};
|
|
}
|
|
function hookDeletingChain(f1, f2) {
|
|
if (f1 === nop)
|
|
return f2;
|
|
return function () {
|
|
f1.apply(this, arguments);
|
|
var onsuccess = this.onsuccess, // In case event listener has set this.onsuccess
|
|
onerror = this.onerror; // In case event listener has set this.onerror
|
|
this.onsuccess = this.onerror = null;
|
|
f2.apply(this, arguments);
|
|
if (onsuccess)
|
|
this.onsuccess = this.onsuccess ? callBoth(onsuccess, this.onsuccess) : onsuccess;
|
|
if (onerror)
|
|
this.onerror = this.onerror ? callBoth(onerror, this.onerror) : onerror;
|
|
};
|
|
}
|
|
function hookUpdatingChain(f1, f2) {
|
|
if (f1 === nop)
|
|
return f2;
|
|
return function (modifications) {
|
|
var res = f1.apply(this, arguments);
|
|
extend(modifications, res); // If f1 returns new modifications, extend caller's modifications with the result before calling next in chain.
|
|
var onsuccess = this.onsuccess, // In case event listener has set this.onsuccess
|
|
onerror = this.onerror; // In case event listener has set this.onerror
|
|
this.onsuccess = null;
|
|
this.onerror = null;
|
|
var res2 = f2.apply(this, arguments);
|
|
if (onsuccess)
|
|
this.onsuccess = this.onsuccess ? callBoth(onsuccess, this.onsuccess) : onsuccess;
|
|
if (onerror)
|
|
this.onerror = this.onerror ? callBoth(onerror, this.onerror) : onerror;
|
|
return res === undefined ?
|
|
(res2 === undefined ? undefined : res2) :
|
|
(extend(res, res2));
|
|
};
|
|
}
|
|
function reverseStoppableEventChain(f1, f2) {
|
|
if (f1 === nop)
|
|
return f2;
|
|
return function () {
|
|
if (f2.apply(this, arguments) === false)
|
|
return false;
|
|
return f1.apply(this, arguments);
|
|
};
|
|
}
|
|
|
|
function promisableChain(f1, f2) {
|
|
if (f1 === nop)
|
|
return f2;
|
|
return function () {
|
|
var res = f1.apply(this, arguments);
|
|
if (res && typeof res.then === 'function') {
|
|
var thiz = this, i = arguments.length, args = new Array(i);
|
|
while (i--)
|
|
args[i] = arguments[i];
|
|
return res.then(function () {
|
|
return f2.apply(thiz, args);
|
|
});
|
|
}
|
|
return f2.apply(this, arguments);
|
|
};
|
|
}
|
|
|
|
/*
|
|
* Copyright (c) 2014-2017 David Fahlander
|
|
* Apache License Version 2.0, January 2004, http://www.apache.org/licenses/LICENSE-2.0
|
|
*/
|
|
//
|
|
// Promise and Zone (PSD) for Dexie library
|
|
//
|
|
// I started out writing this Promise class by copying promise-light (https://github.com/taylorhakes/promise-light) by
|
|
// https://github.com/taylorhakes - an A+ and ECMASCRIPT 6 compliant Promise implementation.
|
|
//
|
|
// In previous versions this was fixed by not calling setTimeout when knowing that the resolve() or reject() came from another
|
|
// tick. In Dexie v1.4.0, I've rewritten the Promise class entirely. Just some fragments of promise-light is left. I use
|
|
// another strategy now that simplifies everything a lot: to always execute callbacks in a new micro-task, but have an own micro-task
|
|
// engine that is indexedDB compliant across all browsers.
|
|
// Promise class has also been optimized a lot with inspiration from bluebird - to avoid closures as much as possible.
|
|
// Also with inspiration from bluebird, asyncronic stacks in debug mode.
|
|
//
|
|
// Specific non-standard features of this Promise class:
|
|
// * Custom zone support (a.k.a. PSD) with ability to keep zones also when using native promises as well as
|
|
// native async / await.
|
|
// * Promise.follow() method built upon the custom zone engine, that allows user to track all promises created from current stack frame
|
|
// and below + all promises that those promises creates or awaits.
|
|
// * Detect any unhandled promise in a PSD-scope (PSD.onunhandled).
|
|
//
|
|
// David Fahlander, https://github.com/dfahlander
|
|
//
|
|
// Just a pointer that only this module knows about.
|
|
// Used in Promise constructor to emulate a private constructor.
|
|
var INTERNAL = {};
|
|
// Async stacks (long stacks) must not grow infinitely.
|
|
var LONG_STACKS_CLIP_LIMIT = 100;
|
|
var MAX_LONG_STACKS = 20;
|
|
var ZONE_ECHO_LIMIT = 7;
|
|
var nativePromiseInstanceAndProto = (function () {
|
|
try {
|
|
// Be able to patch native async functions
|
|
return new Function("let F=async ()=>{},p=F();return [p,Object.getPrototypeOf(p),Promise.resolve(),F.constructor];")();
|
|
}
|
|
catch (e) {
|
|
var P = _global.Promise;
|
|
return P ?
|
|
[P.resolve(), P.prototype, P.resolve()] :
|
|
[];
|
|
}
|
|
})();
|
|
var resolvedNativePromise = nativePromiseInstanceAndProto[0];
|
|
var nativePromiseProto = nativePromiseInstanceAndProto[1];
|
|
var resolvedGlobalPromise = nativePromiseInstanceAndProto[2];
|
|
var nativePromiseThen = nativePromiseProto && nativePromiseProto.then;
|
|
var NativePromise = resolvedNativePromise && resolvedNativePromise.constructor;
|
|
var AsyncFunction = nativePromiseInstanceAndProto[3];
|
|
var patchGlobalPromise = !!resolvedGlobalPromise;
|
|
var stack_being_generated = false;
|
|
/* The default function used only for the very first promise in a promise chain.
|
|
As soon as then promise is resolved or rejected, all next tasks will be executed in micro ticks
|
|
emulated in this module. For indexedDB compatibility, this means that every method needs to
|
|
execute at least one promise before doing an indexedDB operation. Dexie will always call
|
|
db.ready().then() for every operation to make sure the indexedDB event is started in an
|
|
indexedDB-compatible emulated micro task loop.
|
|
*/
|
|
var schedulePhysicalTick = resolvedGlobalPromise ?
|
|
function () { resolvedGlobalPromise.then(physicalTick); }
|
|
:
|
|
_global.setImmediate ?
|
|
// setImmediate supported. Those modern platforms also supports Function.bind().
|
|
setImmediate.bind(null, physicalTick) :
|
|
_global.MutationObserver ?
|
|
// MutationObserver supported
|
|
function () {
|
|
var hiddenDiv = document.createElement("div");
|
|
(new MutationObserver(function () {
|
|
physicalTick();
|
|
hiddenDiv = null;
|
|
})).observe(hiddenDiv, { attributes: true });
|
|
hiddenDiv.setAttribute('i', '1');
|
|
} :
|
|
// No support for setImmediate or MutationObserver. No worry, setTimeout is only called
|
|
// once time. Every tick that follows will be our emulated micro tick.
|
|
// Could have uses setTimeout.bind(null, 0, physicalTick) if it wasnt for that FF13 and below has a bug
|
|
function () { setTimeout(physicalTick, 0); };
|
|
// Configurable through Promise.scheduler.
|
|
// Don't export because it would be unsafe to let unknown
|
|
// code call it unless they do try..catch within their callback.
|
|
// This function can be retrieved through getter of Promise.scheduler though,
|
|
// but users must not do Promise.scheduler = myFuncThatThrowsException
|
|
var asap$1 = function (callback, args) {
|
|
microtickQueue.push([callback, args]);
|
|
if (needsNewPhysicalTick) {
|
|
schedulePhysicalTick();
|
|
needsNewPhysicalTick = false;
|
|
}
|
|
};
|
|
var isOutsideMicroTick = true;
|
|
var needsNewPhysicalTick = true;
|
|
var unhandledErrors = [];
|
|
var rejectingErrors = [];
|
|
var currentFulfiller = null;
|
|
var rejectionMapper = mirror; // Remove in next major when removing error mapping of DOMErrors and DOMExceptions
|
|
var globalPSD = {
|
|
id: 'global',
|
|
global: true,
|
|
ref: 0,
|
|
unhandleds: [],
|
|
onunhandled: globalError,
|
|
pgp: false,
|
|
env: {},
|
|
finalize: function () {
|
|
this.unhandleds.forEach(function (uh) {
|
|
try {
|
|
globalError(uh[0], uh[1]);
|
|
}
|
|
catch (e) { }
|
|
});
|
|
}
|
|
};
|
|
var PSD = globalPSD;
|
|
var microtickQueue = []; // Callbacks to call in this or next physical tick.
|
|
var numScheduledCalls = 0; // Number of listener-calls left to do in this physical tick.
|
|
var tickFinalizers = []; // Finalizers to call when there are no more async calls scheduled within current physical tick.
|
|
function Promise(fn) {
|
|
if (typeof this !== 'object')
|
|
throw new TypeError('Promises must be constructed via new');
|
|
this._listeners = [];
|
|
this.onuncatched = nop; // Deprecate in next major. Not needed. Better to use global error handler.
|
|
// A library may set `promise._lib = true;` after promise is created to make resolve() or reject()
|
|
// execute the microtask engine implicitely within the call to resolve() or reject().
|
|
// To remain A+ compliant, a library must only set `_lib=true` if it can guarantee that the stack
|
|
// only contains library code when calling resolve() or reject().
|
|
// RULE OF THUMB: ONLY set _lib = true for promises explicitely resolving/rejecting directly from
|
|
// global scope (event handler, timer etc)!
|
|
this._lib = false;
|
|
// Current async scope
|
|
var psd = (this._PSD = PSD);
|
|
if (debug) {
|
|
this._stackHolder = getErrorWithStack();
|
|
this._prev = null;
|
|
this._numPrev = 0; // Number of previous promises (for long stacks)
|
|
}
|
|
if (typeof fn !== 'function') {
|
|
if (fn !== INTERNAL)
|
|
throw new TypeError('Not a function');
|
|
// Private constructor (INTERNAL, state, value).
|
|
// Used internally by Promise.resolve() and Promise.reject().
|
|
this._state = arguments[1];
|
|
this._value = arguments[2];
|
|
if (this._state === false)
|
|
handleRejection(this, this._value); // Map error, set stack and addPossiblyUnhandledError().
|
|
return;
|
|
}
|
|
this._state = null; // null (=pending), false (=rejected) or true (=resolved)
|
|
this._value = null; // error or result
|
|
++psd.ref; // Refcounting current scope
|
|
executePromiseTask(this, fn);
|
|
}
|
|
// Prepare a property descriptor to put onto Promise.prototype.then
|
|
var thenProp = {
|
|
get: function () {
|
|
var psd = PSD, microTaskId = totalEchoes;
|
|
function then(onFulfilled, onRejected) {
|
|
var _this = this;
|
|
var possibleAwait = !psd.global && (psd !== PSD || microTaskId !== totalEchoes);
|
|
if (possibleAwait)
|
|
decrementExpectedAwaits();
|
|
var rv = new Promise(function (resolve, reject) {
|
|
propagateToListener(_this, new Listener(nativeAwaitCompatibleWrap(onFulfilled, psd, possibleAwait), nativeAwaitCompatibleWrap(onRejected, psd, possibleAwait), resolve, reject, psd));
|
|
});
|
|
debug && linkToPreviousPromise(rv, this);
|
|
return rv;
|
|
}
|
|
then.prototype = INTERNAL; // For idempotense, see setter below.
|
|
return then;
|
|
},
|
|
// Be idempotent and allow another framework (such as zone.js or another instance of a Dexie.Promise module) to replace Promise.prototype.then
|
|
// and when that framework wants to restore the original property, we must identify that and restore the original property descriptor.
|
|
set: function (value) {
|
|
setProp(this, 'then', value && value.prototype === INTERNAL ?
|
|
thenProp : // Restore to original property descriptor.
|
|
{
|
|
get: function () {
|
|
return value; // Getter returning provided value (behaves like value is just changed)
|
|
},
|
|
set: thenProp.set // Keep a setter that is prepared to restore original.
|
|
});
|
|
}
|
|
};
|
|
props(Promise.prototype, {
|
|
then: thenProp,
|
|
_then: function (onFulfilled, onRejected) {
|
|
// A little tinier version of then() that don't have to create a resulting promise.
|
|
propagateToListener(this, new Listener(null, null, onFulfilled, onRejected, PSD));
|
|
},
|
|
catch: function (onRejected) {
|
|
if (arguments.length === 1)
|
|
return this.then(null, onRejected);
|
|
// First argument is the Error type to catch
|
|
var type = arguments[0], handler = arguments[1];
|
|
return typeof type === 'function' ? this.then(null, function (err) {
|
|
// Catching errors by its constructor type (similar to java / c++ / c#)
|
|
// Sample: promise.catch(TypeError, function (e) { ... });
|
|
return err instanceof type ? handler(err) : PromiseReject(err);
|
|
})
|
|
: this.then(null, function (err) {
|
|
// Catching errors by the error.name property. Makes sense for indexedDB where error type
|
|
// is always DOMError but where e.name tells the actual error type.
|
|
// Sample: promise.catch('ConstraintError', function (e) { ... });
|
|
return err && err.name === type ? handler(err) : PromiseReject(err);
|
|
});
|
|
},
|
|
finally: function (onFinally) {
|
|
return this.then(function (value) {
|
|
onFinally();
|
|
return value;
|
|
}, function (err) {
|
|
onFinally();
|
|
return PromiseReject(err);
|
|
});
|
|
},
|
|
stack: {
|
|
get: function () {
|
|
if (this._stack)
|
|
return this._stack;
|
|
try {
|
|
stack_being_generated = true;
|
|
var stacks = getStack(this, [], MAX_LONG_STACKS);
|
|
var stack = stacks.join("\nFrom previous: ");
|
|
if (this._state !== null)
|
|
this._stack = stack; // Stack may be updated on reject.
|
|
return stack;
|
|
}
|
|
finally {
|
|
stack_being_generated = false;
|
|
}
|
|
}
|
|
},
|
|
timeout: function (ms, msg) {
|
|
var _this = this;
|
|
return ms < Infinity ?
|
|
new Promise(function (resolve, reject) {
|
|
var handle = setTimeout(function () { return reject(new exceptions.Timeout(msg)); }, ms);
|
|
_this.then(resolve, reject).finally(clearTimeout.bind(null, handle));
|
|
}) : this;
|
|
}
|
|
});
|
|
if (typeof Symbol !== 'undefined' && Symbol.toStringTag)
|
|
setProp(Promise.prototype, Symbol.toStringTag, 'Promise');
|
|
// Now that Promise.prototype is defined, we have all it takes to set globalPSD.env.
|
|
// Environment globals snapshotted on leaving global zone
|
|
globalPSD.env = snapShot();
|
|
function Listener(onFulfilled, onRejected, resolve, reject, zone) {
|
|
this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null;
|
|
this.onRejected = typeof onRejected === 'function' ? onRejected : null;
|
|
this.resolve = resolve;
|
|
this.reject = reject;
|
|
this.psd = zone;
|
|
}
|
|
// Promise Static Properties
|
|
props(Promise, {
|
|
all: function () {
|
|
var values = getArrayOf.apply(null, arguments) // Supports iterables, implicit arguments and array-like.
|
|
.map(onPossibleParallellAsync); // Handle parallell async/awaits
|
|
return new Promise(function (resolve, reject) {
|
|
if (values.length === 0)
|
|
resolve([]);
|
|
var remaining = values.length;
|
|
values.forEach(function (a, i) { return Promise.resolve(a).then(function (x) {
|
|
values[i] = x;
|
|
if (!--remaining)
|
|
resolve(values);
|
|
}, reject); });
|
|
});
|
|
},
|
|
resolve: function (value) {
|
|
if (value instanceof Promise)
|
|
return value;
|
|
if (value && typeof value.then === 'function')
|
|
return new Promise(function (resolve, reject) {
|
|
value.then(resolve, reject);
|
|
});
|
|
var rv = new Promise(INTERNAL, true, value);
|
|
linkToPreviousPromise(rv, currentFulfiller);
|
|
return rv;
|
|
},
|
|
reject: PromiseReject,
|
|
race: function () {
|
|
var values = getArrayOf.apply(null, arguments).map(onPossibleParallellAsync);
|
|
return new Promise(function (resolve, reject) {
|
|
values.map(function (value) { return Promise.resolve(value).then(resolve, reject); });
|
|
});
|
|
},
|
|
PSD: {
|
|
get: function () { return PSD; },
|
|
set: function (value) { return PSD = value; }
|
|
},
|
|
//totalEchoes: {get: ()=>totalEchoes},
|
|
//task: {get: ()=>task},
|
|
newPSD: newScope,
|
|
usePSD: usePSD,
|
|
scheduler: {
|
|
get: function () { return asap$1; },
|
|
set: function (value) { asap$1 = value; }
|
|
},
|
|
rejectionMapper: {
|
|
get: function () { return rejectionMapper; },
|
|
set: function (value) { rejectionMapper = value; } // Map reject failures
|
|
},
|
|
follow: function (fn, zoneProps) {
|
|
return new Promise(function (resolve, reject) {
|
|
return newScope(function (resolve, reject) {
|
|
var psd = PSD;
|
|
psd.unhandleds = []; // For unhandled standard- or 3rd party Promises. Checked at psd.finalize()
|
|
psd.onunhandled = reject; // Triggered directly on unhandled promises of this library.
|
|
psd.finalize = callBoth(function () {
|
|
var _this = this;
|
|
// Unhandled standard or 3rd part promises are put in PSD.unhandleds and
|
|
// examined upon scope completion while unhandled rejections in this Promise
|
|
// will trigger directly through psd.onunhandled
|
|
run_at_end_of_this_or_next_physical_tick(function () {
|
|
_this.unhandleds.length === 0 ? resolve() : reject(_this.unhandleds[0]);
|
|
});
|
|
}, psd.finalize);
|
|
fn();
|
|
}, zoneProps, resolve, reject);
|
|
});
|
|
}
|
|
});
|
|
/**
|
|
* Take a potentially misbehaving resolver function and make sure
|
|
* onFulfilled and onRejected are only called once.
|
|
*
|
|
* Makes no guarantees about asynchrony.
|
|
*/
|
|
function executePromiseTask(promise, fn) {
|
|
// Promise Resolution Procedure:
|
|
// https://github.com/promises-aplus/promises-spec#the-promise-resolution-procedure
|
|
try {
|
|
fn(function (value) {
|
|
if (promise._state !== null)
|
|
return; // Already settled
|
|
if (value === promise)
|
|
throw new TypeError('A promise cannot be resolved with itself.');
|
|
var shouldExecuteTick = promise._lib && beginMicroTickScope();
|
|
if (value && typeof value.then === 'function') {
|
|
executePromiseTask(promise, function (resolve, reject) {
|
|
value instanceof Promise ?
|
|
value._then(resolve, reject) :
|
|
value.then(resolve, reject);
|
|
});
|
|
}
|
|
else {
|
|
promise._state = true;
|
|
promise._value = value;
|
|
propagateAllListeners(promise);
|
|
}
|
|
if (shouldExecuteTick)
|
|
endMicroTickScope();
|
|
}, handleRejection.bind(null, promise)); // If Function.bind is not supported. Exception is handled in catch below
|
|
}
|
|
catch (ex) {
|
|
handleRejection(promise, ex);
|
|
}
|
|
}
|
|
function handleRejection(promise, reason) {
|
|
rejectingErrors.push(reason);
|
|
if (promise._state !== null)
|
|
return;
|
|
var shouldExecuteTick = promise._lib && beginMicroTickScope();
|
|
reason = rejectionMapper(reason);
|
|
promise._state = false;
|
|
promise._value = reason;
|
|
debug && reason !== null && typeof reason === 'object' && !reason._promise && tryCatch(function () {
|
|
var origProp = getPropertyDescriptor(reason, "stack");
|
|
reason._promise = promise;
|
|
setProp(reason, "stack", {
|
|
get: function () {
|
|
return stack_being_generated ?
|
|
origProp && (origProp.get ?
|
|
origProp.get.apply(reason) :
|
|
origProp.value) :
|
|
promise.stack;
|
|
}
|
|
});
|
|
});
|
|
// Add the failure to a list of possibly uncaught errors
|
|
addPossiblyUnhandledError(promise);
|
|
propagateAllListeners(promise);
|
|
if (shouldExecuteTick)
|
|
endMicroTickScope();
|
|
}
|
|
function propagateAllListeners(promise) {
|
|
//debug && linkToPreviousPromise(promise);
|
|
var listeners = promise._listeners;
|
|
promise._listeners = [];
|
|
for (var i = 0, len = listeners.length; i < len; ++i) {
|
|
propagateToListener(promise, listeners[i]);
|
|
}
|
|
var psd = promise._PSD;
|
|
--psd.ref || psd.finalize(); // if psd.ref reaches zero, call psd.finalize();
|
|
if (numScheduledCalls === 0) {
|
|
// If numScheduledCalls is 0, it means that our stack is not in a callback of a scheduled call,
|
|
// and that no deferreds where listening to this rejection or success.
|
|
// Since there is a risk that our stack can contain application code that may
|
|
// do stuff after this code is finished that may generate new calls, we cannot
|
|
// call finalizers here.
|
|
++numScheduledCalls;
|
|
asap$1(function () {
|
|
if (--numScheduledCalls === 0)
|
|
finalizePhysicalTick(); // Will detect unhandled errors
|
|
}, []);
|
|
}
|
|
}
|
|
function propagateToListener(promise, listener) {
|
|
if (promise._state === null) {
|
|
promise._listeners.push(listener);
|
|
return;
|
|
}
|
|
var cb = promise._state ? listener.onFulfilled : listener.onRejected;
|
|
if (cb === null) {
|
|
// This Listener doesnt have a listener for the event being triggered (onFulfilled or onReject) so lets forward the event to any eventual listeners on the Promise instance returned by then() or catch()
|
|
return (promise._state ? listener.resolve : listener.reject)(promise._value);
|
|
}
|
|
++listener.psd.ref;
|
|
++numScheduledCalls;
|
|
asap$1(callListener, [cb, promise, listener]);
|
|
}
|
|
function callListener(cb, promise, listener) {
|
|
try {
|
|
// Set static variable currentFulfiller to the promise that is being fullfilled,
|
|
// so that we connect the chain of promises (for long stacks support)
|
|
currentFulfiller = promise;
|
|
// Call callback and resolve our listener with it's return value.
|
|
var ret, value = promise._value;
|
|
if (promise._state) {
|
|
// cb is onResolved
|
|
ret = cb(value);
|
|
}
|
|
else {
|
|
// cb is onRejected
|
|
if (rejectingErrors.length)
|
|
rejectingErrors = [];
|
|
ret = cb(value);
|
|
if (rejectingErrors.indexOf(value) === -1)
|
|
markErrorAsHandled(promise); // Callback didnt do Promise.reject(err) nor reject(err) onto another promise.
|
|
}
|
|
listener.resolve(ret);
|
|
}
|
|
catch (e) {
|
|
// Exception thrown in callback. Reject our listener.
|
|
listener.reject(e);
|
|
}
|
|
finally {
|
|
// Restore env and currentFulfiller.
|
|
currentFulfiller = null;
|
|
if (--numScheduledCalls === 0)
|
|
finalizePhysicalTick();
|
|
--listener.psd.ref || listener.psd.finalize();
|
|
}
|
|
}
|
|
function getStack(promise, stacks, limit) {
|
|
if (stacks.length === limit)
|
|
return stacks;
|
|
var stack = "";
|
|
if (promise._state === false) {
|
|
var failure = promise._value, errorName, message;
|
|
if (failure != null) {
|
|
errorName = failure.name || "Error";
|
|
message = failure.message || failure;
|
|
stack = prettyStack(failure, 0);
|
|
}
|
|
else {
|
|
errorName = failure; // If error is undefined or null, show that.
|
|
message = "";
|
|
}
|
|
stacks.push(errorName + (message ? ": " + message : "") + stack);
|
|
}
|
|
if (debug) {
|
|
stack = prettyStack(promise._stackHolder, 2);
|
|
if (stack && stacks.indexOf(stack) === -1)
|
|
stacks.push(stack);
|
|
if (promise._prev)
|
|
getStack(promise._prev, stacks, limit);
|
|
}
|
|
return stacks;
|
|
}
|
|
function linkToPreviousPromise(promise, prev) {
|
|
// Support long stacks by linking to previous completed promise.
|
|
var numPrev = prev ? prev._numPrev + 1 : 0;
|
|
if (numPrev < LONG_STACKS_CLIP_LIMIT) {
|
|
promise._prev = prev;
|
|
promise._numPrev = numPrev;
|
|
}
|
|
}
|
|
/* The callback to schedule with setImmediate() or setTimeout().
|
|
It runs a virtual microtick and executes any callback registered in microtickQueue.
|
|
*/
|
|
function physicalTick() {
|
|
beginMicroTickScope() && endMicroTickScope();
|
|
}
|
|
function beginMicroTickScope() {
|
|
var wasRootExec = isOutsideMicroTick;
|
|
isOutsideMicroTick = false;
|
|
needsNewPhysicalTick = false;
|
|
return wasRootExec;
|
|
}
|
|
/* Executes micro-ticks without doing try..catch.
|
|
This can be possible because we only use this internally and
|
|
the registered functions are exception-safe (they do try..catch
|
|
internally before calling any external method). If registering
|
|
functions in the microtickQueue that are not exception-safe, this
|
|
would destroy the framework and make it instable. So we don't export
|
|
our asap method.
|
|
*/
|
|
function endMicroTickScope() {
|
|
var callbacks, i, l;
|
|
do {
|
|
while (microtickQueue.length > 0) {
|
|
callbacks = microtickQueue;
|
|
microtickQueue = [];
|
|
l = callbacks.length;
|
|
for (i = 0; i < l; ++i) {
|
|
var item = callbacks[i];
|
|
item[0].apply(null, item[1]);
|
|
}
|
|
}
|
|
} while (microtickQueue.length > 0);
|
|
isOutsideMicroTick = true;
|
|
needsNewPhysicalTick = true;
|
|
}
|
|
function finalizePhysicalTick() {
|
|
var unhandledErrs = unhandledErrors;
|
|
unhandledErrors = [];
|
|
unhandledErrs.forEach(function (p) {
|
|
p._PSD.onunhandled.call(null, p._value, p);
|
|
});
|
|
var finalizers = tickFinalizers.slice(0); // Clone first because finalizer may remove itself from list.
|
|
var i = finalizers.length;
|
|
while (i)
|
|
finalizers[--i]();
|
|
}
|
|
function run_at_end_of_this_or_next_physical_tick(fn) {
|
|
function finalizer() {
|
|
fn();
|
|
tickFinalizers.splice(tickFinalizers.indexOf(finalizer), 1);
|
|
}
|
|
tickFinalizers.push(finalizer);
|
|
++numScheduledCalls;
|
|
asap$1(function () {
|
|
if (--numScheduledCalls === 0)
|
|
finalizePhysicalTick();
|
|
}, []);
|
|
}
|
|
function addPossiblyUnhandledError(promise) {
|
|
// Only add to unhandledErrors if not already there. The first one to add to this list
|
|
// will be upon the first rejection so that the root cause (first promise in the
|
|
// rejection chain) is the one listed.
|
|
if (!unhandledErrors.some(function (p) { return p._value === promise._value; }))
|
|
unhandledErrors.push(promise);
|
|
}
|
|
function markErrorAsHandled(promise) {
|
|
// Called when a reject handled is actually being called.
|
|
// Search in unhandledErrors for any promise whos _value is this promise_value (list
|
|
// contains only rejected promises, and only one item per error)
|
|
var i = unhandledErrors.length;
|
|
while (i)
|
|
if (unhandledErrors[--i]._value === promise._value) {
|
|
// Found a promise that failed with this same error object pointer,
|
|
// Remove that since there is a listener that actually takes care of it.
|
|
unhandledErrors.splice(i, 1);
|
|
return;
|
|
}
|
|
}
|
|
function PromiseReject(reason) {
|
|
return new Promise(INTERNAL, false, reason);
|
|
}
|
|
function wrap(fn, errorCatcher) {
|
|
var psd = PSD;
|
|
return function () {
|
|
var wasRootExec = beginMicroTickScope(), outerScope = PSD;
|
|
try {
|
|
switchToZone(psd, true);
|
|
return fn.apply(this, arguments);
|
|
}
|
|
catch (e) {
|
|
errorCatcher && errorCatcher(e);
|
|
}
|
|
finally {
|
|
switchToZone(outerScope, false);
|
|
if (wasRootExec)
|
|
endMicroTickScope();
|
|
}
|
|
};
|
|
}
|
|
//
|
|
// variables used for native await support
|
|
//
|
|
var task = { awaits: 0, echoes: 0, id: 0 }; // The ongoing macro-task when using zone-echoing.
|
|
var taskCounter = 0; // ID counter for macro tasks.
|
|
var zoneStack = []; // Stack of left zones to restore asynchronically.
|
|
var zoneEchoes = 0; // zoneEchoes is a must in order to persist zones between native await expressions.
|
|
var totalEchoes = 0; // ID counter for micro-tasks. Used to detect possible native await in our Promise.prototype.then.
|
|
var zone_id_counter = 0;
|
|
function newScope(fn, props$$1, a1, a2) {
|
|
var parent = PSD, psd = Object.create(parent);
|
|
psd.parent = parent;
|
|
psd.ref = 0;
|
|
psd.global = false;
|
|
psd.id = ++zone_id_counter;
|
|
// Prepare for promise patching (done in usePSD):
|
|
var globalEnv = globalPSD.env;
|
|
psd.env = patchGlobalPromise ? {
|
|
Promise: Promise,
|
|
PromiseProp: { value: Promise, configurable: true, writable: true },
|
|
all: Promise.all,
|
|
race: Promise.race,
|
|
resolve: Promise.resolve,
|
|
reject: Promise.reject,
|
|
nthen: getPatchedPromiseThen(globalEnv.nthen, psd),
|
|
gthen: getPatchedPromiseThen(globalEnv.gthen, psd) // global then
|
|
} : {};
|
|
if (props$$1)
|
|
extend(psd, props$$1);
|
|
// unhandleds and onunhandled should not be specifically set here.
|
|
// Leave them on parent prototype.
|
|
// unhandleds.push(err) will push to parent's prototype
|
|
// onunhandled() will call parents onunhandled (with this scope's this-pointer though!)
|
|
++parent.ref;
|
|
psd.finalize = function () {
|
|
--this.parent.ref || this.parent.finalize();
|
|
};
|
|
var rv = usePSD(psd, fn, a1, a2);
|
|
if (psd.ref === 0)
|
|
psd.finalize();
|
|
return rv;
|
|
}
|
|
// Function to call if scopeFunc returns NativePromise
|
|
// Also for each NativePromise in the arguments to Promise.all()
|
|
function incrementExpectedAwaits() {
|
|
if (!task.id)
|
|
task.id = ++taskCounter;
|
|
++task.awaits;
|
|
task.echoes += ZONE_ECHO_LIMIT;
|
|
return task.id;
|
|
}
|
|
// Function to call when 'then' calls back on a native promise where onAwaitExpected() had been called.
|
|
// Also call this when a native await calls then method on a promise. In that case, don't supply
|
|
// sourceTaskId because we already know it refers to current task.
|
|
function decrementExpectedAwaits(sourceTaskId) {
|
|
if (!task.awaits || (sourceTaskId && sourceTaskId !== task.id))
|
|
return;
|
|
if (--task.awaits === 0)
|
|
task.id = 0;
|
|
task.echoes = task.awaits * ZONE_ECHO_LIMIT; // Will reset echoes to 0 if awaits is 0.
|
|
}
|
|
// Call from Promise.all() and Promise.race()
|
|
function onPossibleParallellAsync(possiblePromise) {
|
|
if (task.echoes && possiblePromise && possiblePromise.constructor === NativePromise) {
|
|
incrementExpectedAwaits();
|
|
return possiblePromise.then(function (x) {
|
|
decrementExpectedAwaits();
|
|
return x;
|
|
}, function (e) {
|
|
decrementExpectedAwaits();
|
|
return rejection(e);
|
|
});
|
|
}
|
|
return possiblePromise;
|
|
}
|
|
function zoneEnterEcho(targetZone) {
|
|
++totalEchoes;
|
|
if (!task.echoes || --task.echoes === 0) {
|
|
task.echoes = task.id = 0; // Cancel zone echoing.
|
|
}
|
|
zoneStack.push(PSD);
|
|
switchToZone(targetZone, true);
|
|
}
|
|
function zoneLeaveEcho() {
|
|
var zone = zoneStack[zoneStack.length - 1];
|
|
zoneStack.pop();
|
|
switchToZone(zone, false);
|
|
}
|
|
function switchToZone(targetZone, bEnteringZone) {
|
|
var currentZone = PSD;
|
|
if (bEnteringZone ? task.echoes && (!zoneEchoes++ || targetZone !== PSD) : zoneEchoes && (!--zoneEchoes || targetZone !== PSD)) {
|
|
// Enter or leave zone asynchronically as well, so that tasks initiated during current tick
|
|
// will be surrounded by the zone when they are invoked.
|
|
enqueueNativeMicroTask(bEnteringZone ? zoneEnterEcho.bind(null, targetZone) : zoneLeaveEcho);
|
|
}
|
|
if (targetZone === PSD)
|
|
return;
|
|
PSD = targetZone; // The actual zone switch occurs at this line.
|
|
// Snapshot on every leave from global zone.
|
|
if (currentZone === globalPSD)
|
|
globalPSD.env = snapShot();
|
|
if (patchGlobalPromise) {
|
|
// Let's patch the global and native Promises (may be same or may be different)
|
|
var GlobalPromise = globalPSD.env.Promise;
|
|
// Swich environments (may be PSD-zone or the global zone. Both apply.)
|
|
var targetEnv = targetZone.env;
|
|
// Change Promise.prototype.then for native and global Promise (they MAY differ on polyfilled environments, but both can be accessed)
|
|
// Must be done on each zone change because the patched method contains targetZone in its closure.
|
|
nativePromiseProto.then = targetEnv.nthen;
|
|
GlobalPromise.prototype.then = targetEnv.gthen;
|
|
if (currentZone.global || targetZone.global) {
|
|
// Leaving or entering global zone. It's time to patch / restore global Promise.
|
|
// Set this Promise to window.Promise so that transiled async functions will work on Firefox, Safari and IE, as well as with Zonejs and angular.
|
|
Object.defineProperty(_global, 'Promise', targetEnv.PromiseProp);
|
|
// Support Promise.all() etc to work indexedDB-safe also when people are including es6-promise as a module (they might
|
|
// not be accessing global.Promise but a local reference to it)
|
|
GlobalPromise.all = targetEnv.all;
|
|
GlobalPromise.race = targetEnv.race;
|
|
GlobalPromise.resolve = targetEnv.resolve;
|
|
GlobalPromise.reject = targetEnv.reject;
|
|
}
|
|
}
|
|
}
|
|
function snapShot() {
|
|
var GlobalPromise = _global.Promise;
|
|
return patchGlobalPromise ? {
|
|
Promise: GlobalPromise,
|
|
PromiseProp: Object.getOwnPropertyDescriptor(_global, "Promise"),
|
|
all: GlobalPromise.all,
|
|
race: GlobalPromise.race,
|
|
resolve: GlobalPromise.resolve,
|
|
reject: GlobalPromise.reject,
|
|
nthen: nativePromiseProto.then,
|
|
gthen: GlobalPromise.prototype.then
|
|
} : {};
|
|
}
|
|
function usePSD(psd, fn, a1, a2, a3) {
|
|
var outerScope = PSD;
|
|
try {
|
|
switchToZone(psd, true);
|
|
return fn(a1, a2, a3);
|
|
}
|
|
finally {
|
|
switchToZone(outerScope, false);
|
|
}
|
|
}
|
|
function enqueueNativeMicroTask(job) {
|
|
//
|
|
// Precondition: nativePromiseThen !== undefined
|
|
//
|
|
nativePromiseThen.call(resolvedNativePromise, job);
|
|
}
|
|
function nativeAwaitCompatibleWrap(fn, zone, possibleAwait) {
|
|
return typeof fn !== 'function' ? fn : function () {
|
|
var outerZone = PSD;
|
|
if (possibleAwait)
|
|
incrementExpectedAwaits();
|
|
switchToZone(zone, true);
|
|
try {
|
|
return fn.apply(this, arguments);
|
|
}
|
|
finally {
|
|
switchToZone(outerZone, false);
|
|
}
|
|
};
|
|
}
|
|
function getPatchedPromiseThen(origThen, zone) {
|
|
return function (onResolved, onRejected) {
|
|
return origThen.call(this, nativeAwaitCompatibleWrap(onResolved, zone, false), nativeAwaitCompatibleWrap(onRejected, zone, false));
|
|
};
|
|
}
|
|
var UNHANDLEDREJECTION = "unhandledrejection";
|
|
function globalError(err, promise) {
|
|
var rv;
|
|
try {
|
|
rv = promise.onuncatched(err);
|
|
}
|
|
catch (e) { }
|
|
if (rv !== false)
|
|
try {
|
|
var event, eventData = { promise: promise, reason: err };
|
|
if (_global.document && document.createEvent) {
|
|
event = document.createEvent('Event');
|
|
event.initEvent(UNHANDLEDREJECTION, true, true);
|
|
extend(event, eventData);
|
|
}
|
|
else if (_global.CustomEvent) {
|
|
event = new CustomEvent(UNHANDLEDREJECTION, { detail: eventData });
|
|
extend(event, eventData);
|
|
}
|
|
if (event && _global.dispatchEvent) {
|
|
dispatchEvent(event);
|
|
if (!_global.PromiseRejectionEvent && _global.onunhandledrejection)
|
|
// No native support for PromiseRejectionEvent but user has set window.onunhandledrejection. Manually call it.
|
|
try {
|
|
_global.onunhandledrejection(event);
|
|
}
|
|
catch (_) { }
|
|
}
|
|
if (!event.defaultPrevented) {
|
|
console.warn("Unhandled rejection: " + (err.stack || err));
|
|
}
|
|
}
|
|
catch (e) { }
|
|
}
|
|
var rejection = Promise.reject;
|
|
|
|
function Events(ctx) {
|
|
var evs = {};
|
|
var rv = function (eventName, subscriber) {
|
|
if (subscriber) {
|
|
// Subscribe. If additional arguments than just the subscriber was provided, forward them as well.
|
|
var i = arguments.length, args = new Array(i - 1);
|
|
while (--i)
|
|
args[i - 1] = arguments[i];
|
|
evs[eventName].subscribe.apply(null, args);
|
|
return ctx;
|
|
}
|
|
else if (typeof (eventName) === 'string') {
|
|
// Return interface allowing to fire or unsubscribe from event
|
|
return evs[eventName];
|
|
}
|
|
};
|
|
rv.addEventType = add;
|
|
for (var i = 1, l = arguments.length; i < l; ++i) {
|
|
add(arguments[i]);
|
|
}
|
|
return rv;
|
|
function add(eventName, chainFunction, defaultFunction) {
|
|
if (typeof eventName === 'object')
|
|
return addConfiguredEvents(eventName);
|
|
if (!chainFunction)
|
|
chainFunction = reverseStoppableEventChain;
|
|
if (!defaultFunction)
|
|
defaultFunction = nop;
|
|
var context = {
|
|
subscribers: [],
|
|
fire: defaultFunction,
|
|
subscribe: function (cb) {
|
|
if (context.subscribers.indexOf(cb) === -1) {
|
|
context.subscribers.push(cb);
|
|
context.fire = chainFunction(context.fire, cb);
|
|
}
|
|
},
|
|
unsubscribe: function (cb) {
|
|
context.subscribers = context.subscribers.filter(function (fn) { return fn !== cb; });
|
|
context.fire = context.subscribers.reduce(chainFunction, defaultFunction);
|
|
}
|
|
};
|
|
evs[eventName] = rv[eventName] = context;
|
|
return context;
|
|
}
|
|
function addConfiguredEvents(cfg) {
|
|
// events(this, {reading: [functionChain, nop]});
|
|
keys(cfg).forEach(function (eventName) {
|
|
var args = cfg[eventName];
|
|
if (isArray(args)) {
|
|
add(eventName, cfg[eventName][0], cfg[eventName][1]);
|
|
}
|
|
else if (args === 'asap') {
|
|
// Rather than approaching event subscription using a functional approach, we here do it in a for-loop where subscriber is executed in its own stack
|
|
// enabling that any exception that occur wont disturb the initiator and also not nescessary be catched and forgotten.
|
|
var context = add(eventName, mirror, function fire() {
|
|
// Optimazation-safe cloning of arguments into args.
|
|
var i = arguments.length, args = new Array(i);
|
|
while (i--)
|
|
args[i] = arguments[i];
|
|
// All each subscriber:
|
|
context.subscribers.forEach(function (fn) {
|
|
asap(function fireEvent() {
|
|
fn.apply(null, args);
|
|
});
|
|
});
|
|
});
|
|
}
|
|
else
|
|
throw new exceptions.InvalidArgument("Invalid event config");
|
|
});
|
|
}
|
|
}
|
|
|
|
/*
|
|
* Dexie.js - a minimalistic wrapper for IndexedDB
|
|
* ===============================================
|
|
*
|
|
* Copyright (c) 2014-2017 David Fahlander
|
|
*
|
|
* Version 2.0.4, Fri May 25 2018
|
|
*
|
|
* http://dexie.org
|
|
*
|
|
* Apache License Version 2.0, January 2004, http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
*/
|
|
var DEXIE_VERSION = '2.0.4';
|
|
var maxString = String.fromCharCode(65535);
|
|
var maxKey = (function () { try {
|
|
IDBKeyRange.only([[]]);
|
|
return [[]];
|
|
}
|
|
catch (e) {
|
|
return maxString;
|
|
} })();
|
|
var minKey = -Infinity;
|
|
var INVALID_KEY_ARGUMENT = "Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.";
|
|
var STRING_EXPECTED = "String expected.";
|
|
var connections = [];
|
|
var isIEOrEdge = typeof navigator !== 'undefined' && /(MSIE|Trident|Edge)/.test(navigator.userAgent);
|
|
var hasIEDeleteObjectStoreBug = isIEOrEdge;
|
|
var hangsOnDeleteLargeKeyRange = isIEOrEdge;
|
|
var dexieStackFrameFilter = function (frame) { return !/(dexie\.js|dexie\.min\.js)/.test(frame); };
|
|
var dbNamesDB; // Global database for backing Dexie.getDatabaseNames() on browser without indexedDB.webkitGetDatabaseNames()
|
|
// Init debug
|
|
setDebug(debug, dexieStackFrameFilter);
|
|
function Dexie(dbName, options) {
|
|
/// <param name="options" type="Object" optional="true">Specify only if you wich to control which addons that should run on this instance</param>
|
|
var deps = Dexie.dependencies;
|
|
var opts = extend({
|
|
// Default Options
|
|
addons: Dexie.addons,
|
|
autoOpen: true,
|
|
indexedDB: deps.indexedDB,
|
|
IDBKeyRange: deps.IDBKeyRange // Backend IDBKeyRange api. Default to browser env.
|
|
}, options);
|
|
var addons = opts.addons, autoOpen = opts.autoOpen, indexedDB = opts.indexedDB, IDBKeyRange = opts.IDBKeyRange;
|
|
var globalSchema = this._dbSchema = {};
|
|
var versions = [];
|
|
var dbStoreNames = [];
|
|
var allTables = {};
|
|
///<var type="IDBDatabase" />
|
|
var idbdb = null; // Instance of IDBDatabase
|
|
var dbOpenError = null;
|
|
var isBeingOpened = false;
|
|
var onReadyBeingFired = null;
|
|
var openComplete = false;
|
|
var READONLY = "readonly", READWRITE = "readwrite";
|
|
var db = this;
|
|
var dbReadyResolve, dbReadyPromise = new Promise(function (resolve) {
|
|
dbReadyResolve = resolve;
|
|
}), cancelOpen, openCanceller = new Promise(function (_, reject) {
|
|
cancelOpen = reject;
|
|
});
|
|
var autoSchema = true;
|
|
var hasNativeGetDatabaseNames = !!getNativeGetDatabaseNamesFn(indexedDB), hasGetAll;
|
|
function init() {
|
|
// Default subscribers to "versionchange" and "blocked".
|
|
// Can be overridden by custom handlers. If custom handlers return false, these default
|
|
// behaviours will be prevented.
|
|
db.on("versionchange", function (ev) {
|
|
// Default behavior for versionchange event is to close database connection.
|
|
// Caller can override this behavior by doing db.on("versionchange", function(){ return false; });
|
|
// Let's not block the other window from making it's delete() or open() call.
|
|
// NOTE! This event is never fired in IE,Edge or Safari.
|
|
if (ev.newVersion > 0)
|
|
console.warn("Another connection wants to upgrade database '" + db.name + "'. Closing db now to resume the upgrade.");
|
|
else
|
|
console.warn("Another connection wants to delete database '" + db.name + "'. Closing db now to resume the delete request.");
|
|
db.close();
|
|
// In many web applications, it would be recommended to force window.reload()
|
|
// when this event occurs. To do that, subscribe to the versionchange event
|
|
// and call window.location.reload(true) if ev.newVersion > 0 (not a deletion)
|
|
// The reason for this is that your current web app obviously has old schema code that needs
|
|
// to be updated. Another window got a newer version of the app and needs to upgrade DB but
|
|
// your window is blocking it unless we close it here.
|
|
});
|
|
db.on("blocked", function (ev) {
|
|
if (!ev.newVersion || ev.newVersion < ev.oldVersion)
|
|
console.warn("Dexie.delete('" + db.name + "') was blocked");
|
|
else
|
|
console.warn("Upgrade '" + db.name + "' blocked by other connection holding version " + ev.oldVersion / 10);
|
|
});
|
|
}
|
|
//
|
|
//
|
|
//
|
|
// ------------------------- Versioning Framework---------------------------
|
|
//
|
|
//
|
|
//
|
|
this.version = function (versionNumber) {
|
|
/// <param name="versionNumber" type="Number"></param>
|
|
/// <returns type="Version"></returns>
|
|
if (idbdb || isBeingOpened)
|
|
throw new exceptions.Schema("Cannot add version when database is open");
|
|
this.verno = Math.max(this.verno, versionNumber);
|
|
var versionInstance = versions.filter(function (v) { return v._cfg.version === versionNumber; })[0];
|
|
if (versionInstance)
|
|
return versionInstance;
|
|
versionInstance = new Version(versionNumber);
|
|
versions.push(versionInstance);
|
|
versions.sort(lowerVersionFirst);
|
|
// Disable autoschema mode, as at least one version is specified.
|
|
autoSchema = false;
|
|
return versionInstance;
|
|
};
|
|
function Version(versionNumber) {
|
|
this._cfg = {
|
|
version: versionNumber,
|
|
storesSource: null,
|
|
dbschema: {},
|
|
tables: {},
|
|
contentUpgrade: null
|
|
};
|
|
this.stores({}); // Derive earlier schemas by default.
|
|
}
|
|
extend(Version.prototype, {
|
|
stores: function (stores) {
|
|
/// <summary>
|
|
/// Defines the schema for a particular version
|
|
/// </summary>
|
|
/// <param name="stores" type="Object">
|
|
/// Example: <br/>
|
|
/// {users: "id++,first,last,&username,*email", <br/>
|
|
/// passwords: "id++,&username"}<br/>
|
|
/// <br/>
|
|
/// Syntax: {Table: "[primaryKey][++],[&][*]index1,[&][*]index2,..."}<br/><br/>
|
|
/// Special characters:<br/>
|
|
/// "&" means unique key, <br/>
|
|
/// "*" means value is multiEntry, <br/>
|
|
/// "++" means auto-increment and only applicable for primary key <br/>
|
|
/// </param>
|
|
this._cfg.storesSource = this._cfg.storesSource ? extend(this._cfg.storesSource, stores) : stores;
|
|
// Derive stores from earlier versions if they are not explicitely specified as null or a new syntax.
|
|
var storesSpec = {};
|
|
versions.forEach(function (version) {
|
|
extend(storesSpec, version._cfg.storesSource);
|
|
});
|
|
var dbschema = (this._cfg.dbschema = {});
|
|
this._parseStoresSpec(storesSpec, dbschema);
|
|
// Update the latest schema to this version
|
|
// Update API
|
|
globalSchema = db._dbSchema = dbschema;
|
|
removeTablesApi([allTables, db, Transaction.prototype]); // Keep Transaction.prototype even though it should be depr.
|
|
setApiOnPlace([allTables, db, Transaction.prototype, this._cfg.tables], keys(dbschema), dbschema);
|
|
dbStoreNames = keys(dbschema);
|
|
return this;
|
|
},
|
|
upgrade: function (upgradeFunction) {
|
|
this._cfg.contentUpgrade = upgradeFunction;
|
|
return this;
|
|
},
|
|
_parseStoresSpec: function (stores, outSchema) {
|
|
keys(stores).forEach(function (tableName) {
|
|
if (stores[tableName] !== null) {
|
|
var instanceTemplate = {};
|
|
var indexes = parseIndexSyntax(stores[tableName]);
|
|
var primKey = indexes.shift();
|
|
if (primKey.multi)
|
|
throw new exceptions.Schema("Primary key cannot be multi-valued");
|
|
if (primKey.keyPath)
|
|
setByKeyPath(instanceTemplate, primKey.keyPath, primKey.auto ? 0 : primKey.keyPath);
|
|
indexes.forEach(function (idx) {
|
|
if (idx.auto)
|
|
throw new exceptions.Schema("Only primary key can be marked as autoIncrement (++)");
|
|
if (!idx.keyPath)
|
|
throw new exceptions.Schema("Index must have a name and cannot be an empty string");
|
|
setByKeyPath(instanceTemplate, idx.keyPath, idx.compound ? idx.keyPath.map(function () { return ""; }) : "");
|
|
});
|
|
outSchema[tableName] = new TableSchema(tableName, primKey, indexes, instanceTemplate);
|
|
}
|
|
});
|
|
}
|
|
});
|
|
function runUpgraders(oldVersion, idbtrans, reject) {
|
|
var trans = db._createTransaction(READWRITE, dbStoreNames, globalSchema);
|
|
trans.create(idbtrans);
|
|
trans._completion.catch(reject);
|
|
var rejectTransaction = trans._reject.bind(trans);
|
|
newScope(function () {
|
|
PSD.trans = trans;
|
|
if (oldVersion === 0) {
|
|
// Create tables:
|
|
keys(globalSchema).forEach(function (tableName) {
|
|
createTable(idbtrans, tableName, globalSchema[tableName].primKey, globalSchema[tableName].indexes);
|
|
});
|
|
Promise.follow(function () { return db.on.populate.fire(trans); }).catch(rejectTransaction);
|
|
}
|
|
else
|
|
updateTablesAndIndexes(oldVersion, trans, idbtrans).catch(rejectTransaction);
|
|
});
|
|
}
|
|
function updateTablesAndIndexes(oldVersion, trans, idbtrans) {
|
|
// Upgrade version to version, step-by-step from oldest to newest version.
|
|
// Each transaction object will contain the table set that was current in that version (but also not-yet-deleted tables from its previous version)
|
|
var queue = [];
|
|
var oldVersionStruct = versions.filter(function (version) { return version._cfg.version === oldVersion; })[0];
|
|
if (!oldVersionStruct)
|
|
throw new exceptions.Upgrade("Dexie specification of currently installed DB version is missing");
|
|
globalSchema = db._dbSchema = oldVersionStruct._cfg.dbschema;
|
|
var anyContentUpgraderHasRun = false;
|
|
var versToRun = versions.filter(function (v) { return v._cfg.version > oldVersion; });
|
|
versToRun.forEach(function (version) {
|
|
/// <param name="version" type="Version"></param>
|
|
queue.push(function () {
|
|
var oldSchema = globalSchema;
|
|
var newSchema = version._cfg.dbschema;
|
|
adjustToExistingIndexNames(oldSchema, idbtrans);
|
|
adjustToExistingIndexNames(newSchema, idbtrans);
|
|
globalSchema = db._dbSchema = newSchema;
|
|
var diff = getSchemaDiff(oldSchema, newSchema);
|
|
// Add tables
|
|
diff.add.forEach(function (tuple) {
|
|
createTable(idbtrans, tuple[0], tuple[1].primKey, tuple[1].indexes);
|
|
});
|
|
// Change tables
|
|
diff.change.forEach(function (change) {
|
|
if (change.recreate) {
|
|
throw new exceptions.Upgrade("Not yet support for changing primary key");
|
|
}
|
|
else {
|
|
var store = idbtrans.objectStore(change.name);
|
|
// Add indexes
|
|
change.add.forEach(function (idx) {
|
|
addIndex(store, idx);
|
|
});
|
|
// Update indexes
|
|
change.change.forEach(function (idx) {
|
|
store.deleteIndex(idx.name);
|
|
addIndex(store, idx);
|
|
});
|
|
// Delete indexes
|
|
change.del.forEach(function (idxName) {
|
|
store.deleteIndex(idxName);
|
|
});
|
|
}
|
|
});
|
|
if (version._cfg.contentUpgrade) {
|
|
anyContentUpgraderHasRun = true;
|
|
return Promise.follow(function () {
|
|
version._cfg.contentUpgrade(trans);
|
|
});
|
|
}
|
|
});
|
|
queue.push(function (idbtrans) {
|
|
if (!anyContentUpgraderHasRun || !hasIEDeleteObjectStoreBug) {
|
|
var newSchema = version._cfg.dbschema;
|
|
// Delete old tables
|
|
deleteRemovedTables(newSchema, idbtrans);
|
|
}
|
|
});
|
|
});
|
|
// Now, create a queue execution engine
|
|
function runQueue() {
|
|
return queue.length ? Promise.resolve(queue.shift()(trans.idbtrans)).then(runQueue) :
|
|
Promise.resolve();
|
|
}
|
|
return runQueue().then(function () {
|
|
createMissingTables(globalSchema, idbtrans); // At last, make sure to create any missing tables. (Needed by addons that add stores to DB without specifying version)
|
|
});
|
|
}
|
|
function getSchemaDiff(oldSchema, newSchema) {
|
|
var diff = {
|
|
del: [],
|
|
add: [],
|
|
change: [] // Array of {name: tableName, recreate: newDefinition, del: delIndexNames, add: newIndexDefs, change: changedIndexDefs}
|
|
};
|
|
for (var table in oldSchema) {
|
|
if (!newSchema[table])
|
|
diff.del.push(table);
|
|
}
|
|
for (table in newSchema) {
|
|
var oldDef = oldSchema[table], newDef = newSchema[table];
|
|
if (!oldDef) {
|
|
diff.add.push([table, newDef]);
|
|
}
|
|
else {
|
|
var change = {
|
|
name: table,
|
|
def: newDef,
|
|
recreate: false,
|
|
del: [],
|
|
add: [],
|
|
change: []
|
|
};
|
|
if (oldDef.primKey.src !== newDef.primKey.src) {
|
|
// Primary key has changed. Remove and re-add table.
|
|
change.recreate = true;
|
|
diff.change.push(change);
|
|
}
|
|
else {
|
|
// Same primary key. Just find out what differs:
|
|
var oldIndexes = oldDef.idxByName;
|
|
var newIndexes = newDef.idxByName;
|
|
for (var idxName in oldIndexes) {
|
|
if (!newIndexes[idxName])
|
|
change.del.push(idxName);
|
|
}
|
|
for (idxName in newIndexes) {
|
|
var oldIdx = oldIndexes[idxName], newIdx = newIndexes[idxName];
|
|
if (!oldIdx)
|
|
change.add.push(newIdx);
|
|
else if (oldIdx.src !== newIdx.src)
|
|
change.change.push(newIdx);
|
|
}
|
|
if (change.del.length > 0 || change.add.length > 0 || change.change.length > 0) {
|
|
diff.change.push(change);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return diff;
|
|
}
|
|
function createTable(idbtrans, tableName, primKey, indexes) {
|
|
/// <param name="idbtrans" type="IDBTransaction"></param>
|
|
var store = idbtrans.db.createObjectStore(tableName, primKey.keyPath ? { keyPath: primKey.keyPath, autoIncrement: primKey.auto } : { autoIncrement: primKey.auto });
|
|
indexes.forEach(function (idx) { addIndex(store, idx); });
|
|
return store;
|
|
}
|
|
function createMissingTables(newSchema, idbtrans) {
|
|
keys(newSchema).forEach(function (tableName) {
|
|
if (!idbtrans.db.objectStoreNames.contains(tableName)) {
|
|
createTable(idbtrans, tableName, newSchema[tableName].primKey, newSchema[tableName].indexes);
|
|
}
|
|
});
|
|
}
|
|
function deleteRemovedTables(newSchema, idbtrans) {
|
|
for (var i = 0; i < idbtrans.db.objectStoreNames.length; ++i) {
|
|
var storeName = idbtrans.db.objectStoreNames[i];
|
|
if (newSchema[storeName] == null) {
|
|
idbtrans.db.deleteObjectStore(storeName);
|
|
}
|
|
}
|
|
}
|
|
function addIndex(store, idx) {
|
|
store.createIndex(idx.name, idx.keyPath, { unique: idx.unique, multiEntry: idx.multi });
|
|
}
|
|
//
|
|
//
|
|
// Dexie Protected API
|
|
//
|
|
//
|
|
this._allTables = allTables;
|
|
this._createTransaction = function (mode, storeNames, dbschema, parentTransaction) {
|
|
return new Transaction(mode, storeNames, dbschema, parentTransaction);
|
|
};
|
|
/* Generate a temporary transaction when db operations are done outside a transaction scope.
|
|
*/
|
|
function tempTransaction(mode, storeNames, fn) {
|
|
if (!openComplete && (!PSD.letThrough)) {
|
|
if (!isBeingOpened) {
|
|
if (!autoOpen)
|
|
return rejection(new exceptions.DatabaseClosed());
|
|
db.open().catch(nop); // Open in background. If if fails, it will be catched by the final promise anyway.
|
|
}
|
|
return dbReadyPromise.then(function () { return tempTransaction(mode, storeNames, fn); });
|
|
}
|
|
else {
|
|
var trans = db._createTransaction(mode, storeNames, globalSchema);
|
|
try {
|
|
trans.create();
|
|
}
|
|
catch (ex) {
|
|
return rejection(ex);
|
|
}
|
|
return trans._promise(mode, function (resolve, reject) {
|
|
return newScope(function () {
|
|
PSD.trans = trans;
|
|
return fn(resolve, reject, trans);
|
|
});
|
|
}).then(function (result) {
|
|
// Instead of resolving value directly, wait with resolving it until transaction has completed.
|
|
// Otherwise the data would not be in the DB if requesting it in the then() operation.
|
|
// Specifically, to ensure that the following expression will work:
|
|
//
|
|
// db.friends.put({name: "Arne"}).then(function () {
|
|
// db.friends.where("name").equals("Arne").count(function(count) {
|
|
// assert (count === 1);
|
|
// });
|
|
// });
|
|
//
|
|
return trans._completion.then(function () { return result; });
|
|
}); /*.catch(err => { // Don't do this as of now. If would affect bulk- and modify methods in a way that could be more intuitive. But wait! Maybe change in next major.
|
|
trans._reject(err);
|
|
return rejection(err);
|
|
});*/
|
|
}
|
|
}
|
|
this._whenReady = function (fn) {
|
|
return openComplete || PSD.letThrough ? fn() : new Promise(function (resolve, reject) {
|
|
if (!isBeingOpened) {
|
|
if (!autoOpen) {
|
|
reject(new exceptions.DatabaseClosed());
|
|
return;
|
|
}
|
|
db.open().catch(nop); // Open in background. If if fails, it will be catched by the final promise anyway.
|
|
}
|
|
dbReadyPromise.then(resolve, reject);
|
|
}).then(fn);
|
|
};
|
|
//
|
|
//
|
|
//
|
|
//
|
|
// Dexie API
|
|
//
|
|
//
|
|
//
|
|
this.verno = 0;
|
|
this.open = function () {
|
|
if (isBeingOpened || idbdb)
|
|
return dbReadyPromise.then(function () { return dbOpenError ? rejection(dbOpenError) : db; });
|
|
debug && (openCanceller._stackHolder = getErrorWithStack()); // Let stacks point to when open() was called rather than where new Dexie() was called.
|
|
isBeingOpened = true;
|
|
dbOpenError = null;
|
|
openComplete = false;
|
|
// Function pointers to call when the core opening process completes.
|
|
var resolveDbReady = dbReadyResolve,
|
|
// upgradeTransaction to abort on failure.
|
|
upgradeTransaction = null;
|
|
return Promise.race([openCanceller, new Promise(function (resolve, reject) {
|
|
// Multiply db.verno with 10 will be needed to workaround upgrading bug in IE:
|
|
// IE fails when deleting objectStore after reading from it.
|
|
// A future version of Dexie.js will stopover an intermediate version to workaround this.
|
|
// At that point, we want to be backward compatible. Could have been multiplied with 2, but by using 10, it is easier to map the number to the real version number.
|
|
// If no API, throw!
|
|
if (!indexedDB)
|
|
throw new exceptions.MissingAPI("indexedDB API not found. If using IE10+, make sure to run your code on a server URL " +
|
|
"(not locally). If using old Safari versions, make sure to include indexedDB polyfill.");
|
|
var req = autoSchema ? indexedDB.open(dbName) : indexedDB.open(dbName, Math.round(db.verno * 10));
|
|
if (!req)
|
|
throw new exceptions.MissingAPI("IndexedDB API not available"); // May happen in Safari private mode, see https://github.com/dfahlander/Dexie.js/issues/134
|
|
req.onerror = eventRejectHandler(reject);
|
|
req.onblocked = wrap(fireOnBlocked);
|
|
req.onupgradeneeded = wrap(function (e) {
|
|
upgradeTransaction = req.transaction;
|
|
if (autoSchema && !db._allowEmptyDB) {
|
|
// Caller did not specify a version or schema. Doing that is only acceptable for opening alread existing databases.
|
|
// If onupgradeneeded is called it means database did not exist. Reject the open() promise and make sure that we
|
|
// do not create a new database by accident here.
|
|
req.onerror = preventDefault; // Prohibit onabort error from firing before we're done!
|
|
upgradeTransaction.abort(); // Abort transaction (would hope that this would make DB disappear but it doesnt.)
|
|
// Close database and delete it.
|
|
req.result.close();
|
|
var delreq = indexedDB.deleteDatabase(dbName); // The upgrade transaction is atomic, and javascript is single threaded - meaning that there is no risk that we delete someone elses database here!
|
|
delreq.onsuccess = delreq.onerror = wrap(function () {
|
|
reject(new exceptions.NoSuchDatabase("Database " + dbName + " doesnt exist"));
|
|
});
|
|
}
|
|
else {
|
|
upgradeTransaction.onerror = eventRejectHandler(reject);
|
|
var oldVer = e.oldVersion > Math.pow(2, 62) ? 0 : e.oldVersion; // Safari 8 fix.
|
|
runUpgraders(oldVer / 10, upgradeTransaction, reject, req);
|
|
}
|
|
}, reject);
|
|
req.onsuccess = wrap(function () {
|
|
// Core opening procedure complete. Now let's just record some stuff.
|
|
upgradeTransaction = null;
|
|
idbdb = req.result;
|
|
connections.push(db); // Used for emulating versionchange event on IE/Edge/Safari.
|
|
if (autoSchema)
|
|
readGlobalSchema();
|
|
else if (idbdb.objectStoreNames.length > 0) {
|
|
try {
|
|
adjustToExistingIndexNames(globalSchema, idbdb.transaction(safariMultiStoreFix(idbdb.objectStoreNames), READONLY));
|
|
}
|
|
catch (e) {
|
|
// Safari may bail out if > 1 store names. However, this shouldnt be a showstopper. Issue #120.
|
|
}
|
|
}
|
|
idbdb.onversionchange = wrap(function (ev) {
|
|
db._vcFired = true; // detect implementations that not support versionchange (IE/Edge/Safari)
|
|
db.on("versionchange").fire(ev);
|
|
});
|
|
if (!hasNativeGetDatabaseNames && dbName !== '__dbnames') {
|
|
dbNamesDB.dbnames.put({ name: dbName }).catch(nop);
|
|
}
|
|
resolve();
|
|
}, reject);
|
|
})]).then(function () {
|
|
// Before finally resolving the dbReadyPromise and this promise,
|
|
// call and await all on('ready') subscribers:
|
|
// Dexie.vip() makes subscribers able to use the database while being opened.
|
|
// This is a must since these subscribers take part of the opening procedure.
|
|
onReadyBeingFired = [];
|
|
return Promise.resolve(Dexie.vip(db.on.ready.fire)).then(function fireRemainders() {
|
|
if (onReadyBeingFired.length > 0) {
|
|
// In case additional subscribers to db.on('ready') were added during the time db.on.ready.fire was executed.
|
|
var remainders = onReadyBeingFired.reduce(promisableChain, nop);
|
|
onReadyBeingFired = [];
|
|
return Promise.resolve(Dexie.vip(remainders)).then(fireRemainders);
|
|
}
|
|
});
|
|
}).finally(function () {
|
|
onReadyBeingFired = null;
|
|
}).then(function () {
|
|
// Resolve the db.open() with the db instance.
|
|
isBeingOpened = false;
|
|
return db;
|
|
}).catch(function (err) {
|
|
try {
|
|
// Did we fail within onupgradeneeded? Make sure to abort the upgrade transaction so it doesnt commit.
|
|
upgradeTransaction && upgradeTransaction.abort();
|
|
}
|
|
catch (e) { }
|
|
isBeingOpened = false; // Set before calling db.close() so that it doesnt reject openCanceller again (leads to unhandled rejection event).
|
|
db.close(); // Closes and resets idbdb, removes connections, resets dbReadyPromise and openCanceller so that a later db.open() is fresh.
|
|
// A call to db.close() may have made on-ready subscribers fail. Use dbOpenError if set, since err could be a follow-up error on that.
|
|
dbOpenError = err; // Record the error. It will be used to reject further promises of db operations.
|
|
return rejection(dbOpenError);
|
|
}).finally(function () {
|
|
openComplete = true;
|
|
resolveDbReady(); // dbReadyPromise is resolved no matter if open() rejects or resolved. It's just to wake up waiters.
|
|
});
|
|
};
|
|
this.close = function () {
|
|
var idx = connections.indexOf(db);
|
|
if (idx >= 0)
|
|
connections.splice(idx, 1);
|
|
if (idbdb) {
|
|
try {
|
|
idbdb.close();
|
|
}
|
|
catch (e) { }
|
|
idbdb = null;
|
|
}
|
|
autoOpen = false;
|
|
dbOpenError = new exceptions.DatabaseClosed();
|
|
if (isBeingOpened)
|
|
cancelOpen(dbOpenError);
|
|
// Reset dbReadyPromise promise:
|
|
dbReadyPromise = new Promise(function (resolve) {
|
|
dbReadyResolve = resolve;
|
|
});
|
|
openCanceller = new Promise(function (_, reject) {
|
|
cancelOpen = reject;
|
|
});
|
|
};
|
|
this.delete = function () {
|
|
var hasArguments = arguments.length > 0;
|
|
return new Promise(function (resolve, reject) {
|
|
if (hasArguments)
|
|
throw new exceptions.InvalidArgument("Arguments not allowed in db.delete()");
|
|
if (isBeingOpened) {
|
|
dbReadyPromise.then(doDelete);
|
|
}
|
|
else {
|
|
doDelete();
|
|
}
|
|
function doDelete() {
|
|
db.close();
|
|
var req = indexedDB.deleteDatabase(dbName);
|
|
req.onsuccess = wrap(function () {
|
|
if (!hasNativeGetDatabaseNames) {
|
|
dbNamesDB.dbnames.delete(dbName).catch(nop);
|
|
}
|
|
resolve();
|
|
});
|
|
req.onerror = eventRejectHandler(reject);
|
|
req.onblocked = fireOnBlocked;
|
|
}
|
|
});
|
|
};
|
|
this.backendDB = function () {
|
|
return idbdb;
|
|
};
|
|
this.isOpen = function () {
|
|
return idbdb !== null;
|
|
};
|
|
this.hasBeenClosed = function () {
|
|
return dbOpenError && (dbOpenError instanceof exceptions.DatabaseClosed);
|
|
};
|
|
this.hasFailed = function () {
|
|
return dbOpenError !== null;
|
|
};
|
|
this.dynamicallyOpened = function () {
|
|
return autoSchema;
|
|
};
|
|
//
|
|
// Properties
|
|
//
|
|
this.name = dbName;
|
|
// db.tables - an array of all Table instances.
|
|
props(this, {
|
|
tables: {
|
|
get: function () {
|
|
/// <returns type="Array" elementType="Table" />
|
|
return keys(allTables).map(function (name) { return allTables[name]; });
|
|
}
|
|
}
|
|
});
|
|
//
|
|
// Events
|
|
//
|
|
this.on = Events(this, "populate", "blocked", "versionchange", { ready: [promisableChain, nop] });
|
|
this.on.ready.subscribe = override(this.on.ready.subscribe, function (subscribe) {
|
|
return function (subscriber, bSticky) {
|
|
Dexie.vip(function () {
|
|
if (openComplete) {
|
|
// Database already open. Call subscriber asap.
|
|
if (!dbOpenError)
|
|
Promise.resolve().then(subscriber);
|
|
// bSticky: Also subscribe to future open sucesses (after close / reopen)
|
|
if (bSticky)
|
|
subscribe(subscriber);
|
|
}
|
|
else if (onReadyBeingFired) {
|
|
// db.on('ready') subscribers are currently being executed and have not yet resolved or rejected
|
|
onReadyBeingFired.push(subscriber);
|
|
if (bSticky)
|
|
subscribe(subscriber);
|
|
}
|
|
else {
|
|
// Database not yet open. Subscribe to it.
|
|
subscribe(subscriber);
|
|
// If bSticky is falsy, make sure to unsubscribe subscriber when fired once.
|
|
if (!bSticky)
|
|
subscribe(function unsubscribe() {
|
|
db.on.ready.unsubscribe(subscriber);
|
|
db.on.ready.unsubscribe(unsubscribe);
|
|
});
|
|
}
|
|
});
|
|
};
|
|
});
|
|
this.transaction = function () {
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="mode" type="String">"r" for readonly, or "rw" for readwrite</param>
|
|
/// <param name="tableInstances">Table instance, Array of Table instances, String or String Array of object stores to include in the transaction</param>
|
|
/// <param name="scopeFunc" type="Function">Function to execute with transaction</param>
|
|
var args = extractTransactionArgs.apply(this, arguments);
|
|
return this._transaction.apply(this, args);
|
|
};
|
|
function extractTransactionArgs(mode, _tableArgs_, scopeFunc) {
|
|
// Let table arguments be all arguments between mode and last argument.
|
|
var i = arguments.length;
|
|
if (i < 2)
|
|
throw new exceptions.InvalidArgument("Too few arguments");
|
|
// Prevent optimzation killer (https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments)
|
|
// and clone arguments except the first one into local var 'args'.
|
|
var args = new Array(i - 1);
|
|
while (--i)
|
|
args[i - 1] = arguments[i];
|
|
// Let scopeFunc be the last argument and pop it so that args now only contain the table arguments.
|
|
scopeFunc = args.pop();
|
|
var tables = flatten(args); // Support using array as middle argument, or a mix of arrays and non-arrays.
|
|
return [mode, tables, scopeFunc];
|
|
}
|
|
this._transaction = function (mode, tables, scopeFunc) {
|
|
var parentTransaction = PSD.trans;
|
|
// Check if parent transactions is bound to this db instance, and if caller wants to reuse it
|
|
if (!parentTransaction || parentTransaction.db !== db || mode.indexOf('!') !== -1)
|
|
parentTransaction = null;
|
|
var onlyIfCompatible = mode.indexOf('?') !== -1;
|
|
mode = mode.replace('!', '').replace('?', ''); // Ok. Will change arguments[0] as well but we wont touch arguments henceforth.
|
|
try {
|
|
//
|
|
// Get storeNames from arguments. Either through given table instances, or through given table names.
|
|
//
|
|
var storeNames = tables.map(function (table) {
|
|
var storeName = table instanceof Table ? table.name : table;
|
|
if (typeof storeName !== 'string')
|
|
throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");
|
|
return storeName;
|
|
});
|
|
//
|
|
// Resolve mode. Allow shortcuts "r" and "rw".
|
|
//
|
|
if (mode == "r" || mode == READONLY)
|
|
mode = READONLY;
|
|
else if (mode == "rw" || mode == READWRITE)
|
|
mode = READWRITE;
|
|
else
|
|
throw new exceptions.InvalidArgument("Invalid transaction mode: " + mode);
|
|
if (parentTransaction) {
|
|
// Basic checks
|
|
if (parentTransaction.mode === READONLY && mode === READWRITE) {
|
|
if (onlyIfCompatible) {
|
|
// Spawn new transaction instead.
|
|
parentTransaction = null;
|
|
}
|
|
else
|
|
throw new exceptions.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");
|
|
}
|
|
if (parentTransaction) {
|
|
storeNames.forEach(function (storeName) {
|
|
if (parentTransaction && parentTransaction.storeNames.indexOf(storeName) === -1) {
|
|
if (onlyIfCompatible) {
|
|
// Spawn new transaction instead.
|
|
parentTransaction = null;
|
|
}
|
|
else
|
|
throw new exceptions.SubTransaction("Table " + storeName +
|
|
" not included in parent transaction.");
|
|
}
|
|
});
|
|
}
|
|
if (onlyIfCompatible && parentTransaction && !parentTransaction.active) {
|
|
// '?' mode should not keep using an inactive transaction.
|
|
parentTransaction = null;
|
|
}
|
|
}
|
|
}
|
|
catch (e) {
|
|
return parentTransaction ?
|
|
parentTransaction._promise(null, function (_, reject) { reject(e); }) :
|
|
rejection(e);
|
|
}
|
|
// If this is a sub-transaction, lock the parent and then launch the sub-transaction.
|
|
return (parentTransaction ?
|
|
parentTransaction._promise(mode, enterTransactionScope, "lock") :
|
|
PSD.trans ?
|
|
// no parent transaction despite PSD.trans exists. Make sure also
|
|
// that the zone we create is not a sub-zone of current, because
|
|
// Promise.follow() should not wait for it if so.
|
|
usePSD(PSD.transless, function () { return db._whenReady(enterTransactionScope); }) :
|
|
db._whenReady(enterTransactionScope));
|
|
function enterTransactionScope() {
|
|
return Promise.resolve().then(function () {
|
|
// Keep a pointer to last non-transactional PSD to use if someone calls Dexie.ignoreTransaction().
|
|
var transless = PSD.transless || PSD;
|
|
// Our transaction.
|
|
//return new Promise((resolve, reject) => {
|
|
var trans = db._createTransaction(mode, storeNames, globalSchema, parentTransaction);
|
|
// Let the transaction instance be part of a Promise-specific data (PSD) value.
|
|
var zoneProps = {
|
|
trans: trans,
|
|
transless: transless
|
|
};
|
|
if (parentTransaction) {
|
|
// Emulate transaction commit awareness for inner transaction (must 'commit' when the inner transaction has no more operations ongoing)
|
|
trans.idbtrans = parentTransaction.idbtrans;
|
|
}
|
|
else {
|
|
trans.create(); // Create the backend transaction so that complete() or error() will trigger even if no operation is made upon it.
|
|
}
|
|
// Support for native async await.
|
|
if (scopeFunc.constructor === AsyncFunction) {
|
|
incrementExpectedAwaits();
|
|
}
|
|
var returnValue;
|
|
var promiseFollowed = Promise.follow(function () {
|
|
// Finally, call the scope function with our table and transaction arguments.
|
|
returnValue = scopeFunc.call(trans, trans);
|
|
if (returnValue) {
|
|
if (returnValue.constructor === NativePromise) {
|
|
var decrementor = decrementExpectedAwaits.bind(null, null);
|
|
returnValue.then(decrementor, decrementor);
|
|
}
|
|
else if (typeof returnValue.next === 'function' && typeof returnValue.throw === 'function') {
|
|
// scopeFunc returned an iterator with throw-support. Handle yield as await.
|
|
returnValue = awaitIterator(returnValue);
|
|
}
|
|
}
|
|
}, zoneProps);
|
|
return (returnValue && typeof returnValue.then === 'function' ?
|
|
// Promise returned. User uses promise-style transactions.
|
|
Promise.resolve(returnValue).then(function (x) { return trans.active ?
|
|
x // Transaction still active. Continue.
|
|
: rejection(new exceptions.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn")); })
|
|
// No promise returned. Wait for all outstanding promises before continuing.
|
|
: promiseFollowed.then(function () { return returnValue; })).then(function (x) {
|
|
// sub transactions don't react to idbtrans.oncomplete. We must trigger a completion:
|
|
if (parentTransaction)
|
|
trans._resolve();
|
|
// wait for trans._completion
|
|
// (if root transaction, this means 'complete' event. If sub-transaction, we've just fired it ourselves)
|
|
return trans._completion.then(function () { return x; });
|
|
}).catch(function (e) {
|
|
trans._reject(e); // Yes, above then-handler were maybe not called because of an unhandled rejection in scopeFunc!
|
|
return rejection(e);
|
|
});
|
|
});
|
|
}
|
|
};
|
|
this.table = function (tableName) {
|
|
/// <returns type="Table"></returns>
|
|
if (!hasOwn(allTables, tableName)) {
|
|
throw new exceptions.InvalidTable("Table " + tableName + " does not exist");
|
|
}
|
|
return allTables[tableName];
|
|
};
|
|
//
|
|
//
|
|
//
|
|
// Table Class
|
|
//
|
|
//
|
|
//
|
|
function Table(name, tableSchema, optionalTrans) {
|
|
/// <param name="name" type="String"></param>
|
|
this.name = name;
|
|
this.schema = tableSchema;
|
|
this._tx = optionalTrans;
|
|
this.hook = allTables[name] ? allTables[name].hook : Events(null, {
|
|
"creating": [hookCreatingChain, nop],
|
|
"reading": [pureFunctionChain, mirror],
|
|
"updating": [hookUpdatingChain, nop],
|
|
"deleting": [hookDeletingChain, nop]
|
|
});
|
|
}
|
|
function BulkErrorHandlerCatchAll(errorList, done, supportHooks) {
|
|
return (supportHooks ? hookedEventRejectHandler : eventRejectHandler)(function (e) {
|
|
errorList.push(e);
|
|
done && done();
|
|
});
|
|
}
|
|
function bulkDelete(idbstore, trans, keysOrTuples, hasDeleteHook, deletingHook) {
|
|
// If hasDeleteHook, keysOrTuples must be an array of tuples: [[key1, value2],[key2,value2],...],
|
|
// else keysOrTuples must be just an array of keys: [key1, key2, ...].
|
|
return new Promise(function (resolve, reject) {
|
|
var len = keysOrTuples.length, lastItem = len - 1;
|
|
if (len === 0)
|
|
return resolve();
|
|
if (!hasDeleteHook) {
|
|
for (var i = 0; i < len; ++i) {
|
|
var req = idbstore.delete(keysOrTuples[i]);
|
|
req.onerror = eventRejectHandler(reject);
|
|
if (i === lastItem)
|
|
req.onsuccess = wrap(function () { return resolve(); });
|
|
}
|
|
}
|
|
else {
|
|
var hookCtx, errorHandler = hookedEventRejectHandler(reject), successHandler = hookedEventSuccessHandler(null);
|
|
tryCatch(function () {
|
|
for (var i = 0; i < len; ++i) {
|
|
hookCtx = { onsuccess: null, onerror: null };
|
|
var tuple = keysOrTuples[i];
|
|
deletingHook.call(hookCtx, tuple[0], tuple[1], trans);
|
|
var req = idbstore.delete(tuple[0]);
|
|
req._hookCtx = hookCtx;
|
|
req.onerror = errorHandler;
|
|
if (i === lastItem)
|
|
req.onsuccess = hookedEventSuccessHandler(resolve);
|
|
else
|
|
req.onsuccess = successHandler;
|
|
}
|
|
}, function (err) {
|
|
hookCtx.onerror && hookCtx.onerror(err);
|
|
throw err;
|
|
});
|
|
}
|
|
});
|
|
}
|
|
props(Table.prototype, {
|
|
//
|
|
// Table Protected Methods
|
|
//
|
|
_trans: function getTransaction(mode, fn, writeLocked) {
|
|
var trans = this._tx || PSD.trans;
|
|
return trans && trans.db === db ?
|
|
trans === PSD.trans ?
|
|
trans._promise(mode, fn, writeLocked) :
|
|
newScope(function () { return trans._promise(mode, fn, writeLocked); }, { trans: trans, transless: PSD.transless || PSD }) :
|
|
tempTransaction(mode, [this.name], fn);
|
|
},
|
|
_idbstore: function getIDBObjectStore(mode, fn, writeLocked) {
|
|
var tableName = this.name;
|
|
function supplyIdbStore(resolve, reject, trans) {
|
|
if (trans.storeNames.indexOf(tableName) === -1)
|
|
throw new exceptions.NotFound("Table" + tableName + " not part of transaction");
|
|
return fn(resolve, reject, trans.idbtrans.objectStore(tableName), trans);
|
|
}
|
|
return this._trans(mode, supplyIdbStore, writeLocked);
|
|
},
|
|
//
|
|
// Table Public Methods
|
|
//
|
|
get: function (keyOrCrit, cb) {
|
|
if (keyOrCrit && keyOrCrit.constructor === Object)
|
|
return this.where(keyOrCrit).first(cb);
|
|
var self = this;
|
|
return this._idbstore(READONLY, function (resolve, reject, idbstore) {
|
|
var req = idbstore.get(keyOrCrit);
|
|
req.onerror = eventRejectHandler(reject);
|
|
req.onsuccess = wrap(function () {
|
|
resolve(self.hook.reading.fire(req.result));
|
|
}, reject);
|
|
}).then(cb);
|
|
},
|
|
where: function (indexOrCrit) {
|
|
if (typeof indexOrCrit === 'string')
|
|
return new WhereClause(this, indexOrCrit);
|
|
if (isArray(indexOrCrit))
|
|
return new WhereClause(this, "[" + indexOrCrit.join('+') + "]");
|
|
// indexOrCrit is an object map of {[keyPath]:value}
|
|
var keyPaths = keys(indexOrCrit);
|
|
if (keyPaths.length === 1)
|
|
// Only one critera. This was the easy case:
|
|
return this
|
|
.where(keyPaths[0])
|
|
.equals(indexOrCrit[keyPaths[0]]);
|
|
// Multiple criterias.
|
|
// Let's try finding a compound index that matches all keyPaths in
|
|
// arbritary order:
|
|
var compoundIndex = this.schema.indexes.concat(this.schema.primKey).filter(function (ix) {
|
|
return ix.compound &&
|
|
keyPaths.every(function (keyPath) { return ix.keyPath.indexOf(keyPath) >= 0; }) &&
|
|
ix.keyPath.every(function (keyPath) { return keyPaths.indexOf(keyPath) >= 0; });
|
|
})[0];
|
|
if (compoundIndex && maxKey !== maxString)
|
|
// Cool! We found such compound index
|
|
// and this browser supports compound indexes (maxKey !== maxString)!
|
|
return this
|
|
.where(compoundIndex.name)
|
|
.equals(compoundIndex.keyPath.map(function (kp) { return indexOrCrit[kp]; }));
|
|
if (!compoundIndex)
|
|
console.warn("The query " + JSON.stringify(indexOrCrit) + " on " + this.name + " would benefit of a " +
|
|
("compound index [" + keyPaths.join('+') + "]"));
|
|
// Ok, now let's fallback to finding at least one matching index
|
|
// and filter the rest.
|
|
var idxByName = this.schema.idxByName;
|
|
var simpleIndex = keyPaths.reduce(function (r, keyPath) { return [
|
|
r[0] || idxByName[keyPath],
|
|
r[0] || !idxByName[keyPath] ?
|
|
combine(r[1], function (x) { return '' + getByKeyPath(x, keyPath) ==
|
|
'' + indexOrCrit[keyPath]; })
|
|
: r[1]
|
|
]; }, [null, null]);
|
|
var idx = simpleIndex[0];
|
|
return idx ?
|
|
this.where(idx.name).equals(indexOrCrit[idx.keyPath])
|
|
.filter(simpleIndex[1]) :
|
|
compoundIndex ?
|
|
this.filter(simpleIndex[1]) : // Has compound but browser bad. Allow filter.
|
|
this.where(keyPaths).equals(''); // No index at all. Fail lazily.
|
|
},
|
|
count: function (cb) {
|
|
return this.toCollection().count(cb);
|
|
},
|
|
offset: function (offset) {
|
|
return this.toCollection().offset(offset);
|
|
},
|
|
limit: function (numRows) {
|
|
return this.toCollection().limit(numRows);
|
|
},
|
|
reverse: function () {
|
|
return this.toCollection().reverse();
|
|
},
|
|
filter: function (filterFunction) {
|
|
return this.toCollection().and(filterFunction);
|
|
},
|
|
each: function (fn) {
|
|
return this.toCollection().each(fn);
|
|
},
|
|
toArray: function (cb) {
|
|
return this.toCollection().toArray(cb);
|
|
},
|
|
orderBy: function (index) {
|
|
return new Collection(new WhereClause(this, isArray(index) ?
|
|
"[" + index.join('+') + "]" :
|
|
index));
|
|
},
|
|
toCollection: function () {
|
|
return new Collection(new WhereClause(this));
|
|
},
|
|
mapToClass: function (constructor, structure) {
|
|
/// <summary>
|
|
/// Map table to a javascript constructor function. Objects returned from the database will be instances of this class, making
|
|
/// it possible to the instanceOf operator as well as extending the class using constructor.prototype.method = function(){...}.
|
|
/// </summary>
|
|
/// <param name="constructor">Constructor function representing the class.</param>
|
|
/// <param name="structure" optional="true">Helps IDE code completion by knowing the members that objects contain and not just the indexes. Also
|
|
/// know what type each member has. Example: {name: String, emailAddresses: [String], password}</param>
|
|
this.schema.mappedClass = constructor;
|
|
var instanceTemplate = Object.create(constructor.prototype);
|
|
if (structure) {
|
|
// structure and instanceTemplate is for IDE code competion only while constructor.prototype is for actual inheritance.
|
|
applyStructure(instanceTemplate, structure);
|
|
}
|
|
this.schema.instanceTemplate = instanceTemplate;
|
|
// Now, subscribe to the when("reading") event to make all objects that come out from this table inherit from given class
|
|
// no matter which method to use for reading (Table.get() or Table.where(...)... )
|
|
var readHook = function (obj) {
|
|
if (!obj)
|
|
return obj; // No valid object. (Value is null). Return as is.
|
|
// Create a new object that derives from constructor:
|
|
var res = Object.create(constructor.prototype);
|
|
// Clone members:
|
|
for (var m in obj)
|
|
if (hasOwn(obj, m))
|
|
try {
|
|
res[m] = obj[m];
|
|
}
|
|
catch (_) { }
|
|
return res;
|
|
};
|
|
if (this.schema.readHook) {
|
|
this.hook.reading.unsubscribe(this.schema.readHook);
|
|
}
|
|
this.schema.readHook = readHook;
|
|
this.hook("reading", readHook);
|
|
return constructor;
|
|
},
|
|
defineClass: function (structure) {
|
|
/// <summary>
|
|
/// Define all members of the class that represents the table. This will help code completion of when objects are read from the database
|
|
/// as well as making it possible to extend the prototype of the returned constructor function.
|
|
/// </summary>
|
|
/// <param name="structure">Helps IDE code completion by knowing the members that objects contain and not just the indexes. Also
|
|
/// know what type each member has. Example: {name: String, emailAddresses: [String], properties: {shoeSize: Number}}</param>
|
|
return this.mapToClass(Dexie.defineClass(structure), structure);
|
|
},
|
|
bulkDelete: function (keys$$1) {
|
|
if (this.hook.deleting.fire === nop) {
|
|
return this._idbstore(READWRITE, function (resolve, reject, idbstore, trans) {
|
|
resolve(bulkDelete(idbstore, trans, keys$$1, false, nop));
|
|
});
|
|
}
|
|
else {
|
|
return this
|
|
.where(':id')
|
|
.anyOf(keys$$1)
|
|
.delete()
|
|
.then(function () { }); // Resolve with undefined.
|
|
}
|
|
},
|
|
bulkPut: function (objects, keys$$1) {
|
|
var _this = this;
|
|
return this._idbstore(READWRITE, function (resolve, reject, idbstore) {
|
|
if (!idbstore.keyPath && !_this.schema.primKey.auto && !keys$$1)
|
|
throw new exceptions.InvalidArgument("bulkPut() with non-inbound keys requires keys array in second argument");
|
|
if (idbstore.keyPath && keys$$1)
|
|
throw new exceptions.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");
|
|
if (keys$$1 && keys$$1.length !== objects.length)
|
|
throw new exceptions.InvalidArgument("Arguments objects and keys must have the same length");
|
|
if (objects.length === 0)
|
|
return resolve(); // Caller provided empty list.
|
|
var done = function (result) {
|
|
if (errorList.length === 0)
|
|
resolve(result);
|
|
else
|
|
reject(new BulkError(_this.name + ".bulkPut(): " + errorList.length + " of " + numObjs + " operations failed", errorList));
|
|
};
|
|
var req, errorList = [], errorHandler, numObjs = objects.length, table = _this;
|
|
if (_this.hook.creating.fire === nop && _this.hook.updating.fire === nop) {
|
|
//
|
|
// Standard Bulk (no 'creating' or 'updating' hooks to care about)
|
|
//
|
|
errorHandler = BulkErrorHandlerCatchAll(errorList);
|
|
for (var i = 0, l = objects.length; i < l; ++i) {
|
|
req = keys$$1 ? idbstore.put(objects[i], keys$$1[i]) : idbstore.put(objects[i]);
|
|
req.onerror = errorHandler;
|
|
}
|
|
// Only need to catch success or error on the last operation
|
|
// according to the IDB spec.
|
|
req.onerror = BulkErrorHandlerCatchAll(errorList, done);
|
|
req.onsuccess = eventSuccessHandler(done);
|
|
}
|
|
else {
|
|
var effectiveKeys = keys$$1 || idbstore.keyPath && objects.map(function (o) { return getByKeyPath(o, idbstore.keyPath); });
|
|
// Generate map of {[key]: object}
|
|
var objectLookup = effectiveKeys && arrayToObject(effectiveKeys, function (key, i) { return key != null && [key, objects[i]]; });
|
|
var promise = !effectiveKeys ?
|
|
// Auto-incremented key-less objects only without any keys argument.
|
|
table.bulkAdd(objects) :
|
|
// Keys provided. Either as inbound in provided objects, or as a keys argument.
|
|
// Begin with updating those that exists in DB:
|
|
table.where(':id').anyOf(effectiveKeys.filter(function (key) { return key != null; })).modify(function () {
|
|
this.value = objectLookup[this.primKey];
|
|
objectLookup[this.primKey] = null; // Mark as "don't add this"
|
|
}).catch(ModifyError, function (e) {
|
|
errorList = e.failures; // No need to concat here. These are the first errors added.
|
|
}).then(function () {
|
|
// Now, let's examine which items didnt exist so we can add them:
|
|
var objsToAdd = [], keysToAdd = keys$$1 && [];
|
|
// Iterate backwards. Why? Because if same key was used twice, just add the last one.
|
|
for (var i = effectiveKeys.length - 1; i >= 0; --i) {
|
|
var key = effectiveKeys[i];
|
|
if (key == null || objectLookup[key]) {
|
|
objsToAdd.push(objects[i]);
|
|
keys$$1 && keysToAdd.push(key);
|
|
if (key != null)
|
|
objectLookup[key] = null; // Mark as "dont add again"
|
|
}
|
|
}
|
|
// The items are in reverse order so reverse them before adding.
|
|
// Could be important in order to get auto-incremented keys the way the caller
|
|
// would expect. Could have used unshift instead of push()/reverse(),
|
|
// but: http://jsperf.com/unshift-vs-reverse
|
|
objsToAdd.reverse();
|
|
keys$$1 && keysToAdd.reverse();
|
|
return table.bulkAdd(objsToAdd, keysToAdd);
|
|
}).then(function (lastAddedKey) {
|
|
// Resolve with key of the last object in given arguments to bulkPut():
|
|
var lastEffectiveKey = effectiveKeys[effectiveKeys.length - 1]; // Key was provided.
|
|
return lastEffectiveKey != null ? lastEffectiveKey : lastAddedKey;
|
|
});
|
|
promise.then(done).catch(BulkError, function (e) {
|
|
// Concat failure from ModifyError and reject using our 'done' method.
|
|
errorList = errorList.concat(e.failures);
|
|
done();
|
|
}).catch(reject);
|
|
}
|
|
}, "locked"); // If called from transaction scope, lock transaction til all steps are done.
|
|
},
|
|
bulkAdd: function (objects, keys$$1) {
|
|
var self = this, creatingHook = this.hook.creating.fire;
|
|
return this._idbstore(READWRITE, function (resolve, reject, idbstore, trans) {
|
|
if (!idbstore.keyPath && !self.schema.primKey.auto && !keys$$1)
|
|
throw new exceptions.InvalidArgument("bulkAdd() with non-inbound keys requires keys array in second argument");
|
|
if (idbstore.keyPath && keys$$1)
|
|
throw new exceptions.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");
|
|
if (keys$$1 && keys$$1.length !== objects.length)
|
|
throw new exceptions.InvalidArgument("Arguments objects and keys must have the same length");
|
|
if (objects.length === 0)
|
|
return resolve(); // Caller provided empty list.
|
|
function done(result) {
|
|
if (errorList.length === 0)
|
|
resolve(result);
|
|
else
|
|
reject(new BulkError(self.name + ".bulkAdd(): " + errorList.length + " of " + numObjs + " operations failed", errorList));
|
|
}
|
|
var req, errorList = [], errorHandler, successHandler, numObjs = objects.length;
|
|
if (creatingHook !== nop) {
|
|
//
|
|
// There are subscribers to hook('creating')
|
|
// Must behave as documented.
|
|
//
|
|
var keyPath = idbstore.keyPath, hookCtx;
|
|
errorHandler = BulkErrorHandlerCatchAll(errorList, null, true);
|
|
successHandler = hookedEventSuccessHandler(null);
|
|
tryCatch(function () {
|
|
for (var i = 0, l = objects.length; i < l; ++i) {
|
|
hookCtx = { onerror: null, onsuccess: null };
|
|
var key = keys$$1 && keys$$1[i];
|
|
var obj = objects[i], effectiveKey = keys$$1 ? key : keyPath ? getByKeyPath(obj, keyPath) : undefined, keyToUse = creatingHook.call(hookCtx, effectiveKey, obj, trans);
|
|
if (effectiveKey == null && keyToUse != null) {
|
|
if (keyPath) {
|
|
obj = deepClone(obj);
|
|
setByKeyPath(obj, keyPath, keyToUse);
|
|
}
|
|
else {
|
|
key = keyToUse;
|
|
}
|
|
}
|
|
req = key != null ? idbstore.add(obj, key) : idbstore.add(obj);
|
|
req._hookCtx = hookCtx;
|
|
if (i < l - 1) {
|
|
req.onerror = errorHandler;
|
|
if (hookCtx.onsuccess)
|
|
req.onsuccess = successHandler;
|
|
}
|
|
}
|
|
}, function (err) {
|
|
hookCtx.onerror && hookCtx.onerror(err);
|
|
throw err;
|
|
});
|
|
req.onerror = BulkErrorHandlerCatchAll(errorList, done, true);
|
|
req.onsuccess = hookedEventSuccessHandler(done);
|
|
}
|
|
else {
|
|
//
|
|
// Standard Bulk (no 'creating' hook to care about)
|
|
//
|
|
errorHandler = BulkErrorHandlerCatchAll(errorList);
|
|
for (var i = 0, l = objects.length; i < l; ++i) {
|
|
req = keys$$1 ? idbstore.add(objects[i], keys$$1[i]) : idbstore.add(objects[i]);
|
|
req.onerror = errorHandler;
|
|
}
|
|
// Only need to catch success or error on the last operation
|
|
// according to the IDB spec.
|
|
req.onerror = BulkErrorHandlerCatchAll(errorList, done);
|
|
req.onsuccess = eventSuccessHandler(done);
|
|
}
|
|
});
|
|
},
|
|
add: function (obj, key) {
|
|
/// <summary>
|
|
/// Add an object to the database. In case an object with same primary key already exists, the object will not be added.
|
|
/// </summary>
|
|
/// <param name="obj" type="Object">A javascript object to insert</param>
|
|
/// <param name="key" optional="true">Primary key</param>
|
|
var creatingHook = this.hook.creating.fire;
|
|
return this._idbstore(READWRITE, function (resolve, reject, idbstore, trans) {
|
|
var hookCtx = { onsuccess: null, onerror: null };
|
|
if (creatingHook !== nop) {
|
|
var effectiveKey = (key != null) ? key : (idbstore.keyPath ? getByKeyPath(obj, idbstore.keyPath) : undefined);
|
|
var keyToUse = creatingHook.call(hookCtx, effectiveKey, obj, trans); // Allow subscribers to when("creating") to generate the key.
|
|
if (effectiveKey == null && keyToUse != null) {
|
|
if (idbstore.keyPath)
|
|
setByKeyPath(obj, idbstore.keyPath, keyToUse);
|
|
else
|
|
key = keyToUse;
|
|
}
|
|
}
|
|
try {
|
|
var req = key != null ? idbstore.add(obj, key) : idbstore.add(obj);
|
|
req._hookCtx = hookCtx;
|
|
req.onerror = hookedEventRejectHandler(reject);
|
|
req.onsuccess = hookedEventSuccessHandler(function (result) {
|
|
// TODO: Remove these two lines in next major release (2.0?)
|
|
// It's no good practice to have side effects on provided parameters
|
|
var keyPath = idbstore.keyPath;
|
|
if (keyPath)
|
|
setByKeyPath(obj, keyPath, result);
|
|
resolve(result);
|
|
});
|
|
}
|
|
catch (e) {
|
|
if (hookCtx.onerror)
|
|
hookCtx.onerror(e);
|
|
throw e;
|
|
}
|
|
});
|
|
},
|
|
put: function (obj, key) {
|
|
var _this = this;
|
|
/// <summary>
|
|
/// Add an object to the database but in case an object with same primary key alread exists, the existing one will get updated.
|
|
/// </summary>
|
|
/// <param name="obj" type="Object">A javascript object to insert or update</param>
|
|
/// <param name="key" optional="true">Primary key</param>
|
|
var creatingHook = this.hook.creating.fire, updatingHook = this.hook.updating.fire;
|
|
if (creatingHook !== nop || updatingHook !== nop) {
|
|
//
|
|
// People listens to when("creating") or when("updating") events!
|
|
// We must know whether the put operation results in an CREATE or UPDATE.
|
|
//
|
|
var keyPath = this.schema.primKey.keyPath;
|
|
var effectiveKey = (key !== undefined) ? key : (keyPath && getByKeyPath(obj, keyPath));
|
|
if (effectiveKey == null)
|
|
return this.add(obj);
|
|
// Since key is optional, make sure we get it from obj if not provided
|
|
// Primary key exist. Lock transaction and try modifying existing. If nothing modified, call add().
|
|
// clone obj before this async call. If caller modifies obj the line after put(), the IDB spec requires that it should not affect operation.
|
|
obj = deepClone(obj);
|
|
return this._trans(READWRITE, function () {
|
|
return _this.where(":id").equals(effectiveKey).modify(function () {
|
|
// Replace extisting value with our object
|
|
// CRUD event firing handled in Collection.modify()
|
|
this.value = obj;
|
|
}).then(function (count) { return count === 0 ? _this.add(obj, key) : effectiveKey; });
|
|
}, "locked"); // Lock needed because operation is splitted into modify() and add().
|
|
}
|
|
else {
|
|
// Use the standard IDB put() method.
|
|
return this._idbstore(READWRITE, function (resolve, reject, idbstore) {
|
|
var req = key !== undefined ? idbstore.put(obj, key) : idbstore.put(obj);
|
|
req.onerror = eventRejectHandler(reject);
|
|
req.onsuccess = wrap(function (ev) {
|
|
var keyPath = idbstore.keyPath;
|
|
if (keyPath)
|
|
setByKeyPath(obj, keyPath, ev.target.result);
|
|
resolve(req.result);
|
|
});
|
|
});
|
|
}
|
|
},
|
|
'delete': function (key) {
|
|
/// <param name="key">Primary key of the object to delete</param>
|
|
if (this.hook.deleting.subscribers.length) {
|
|
// People listens to when("deleting") event. Must implement delete using Collection.delete() that will
|
|
// call the CRUD event. Only Collection.delete() will know whether an object was actually deleted.
|
|
return this.where(":id").equals(key).delete();
|
|
}
|
|
else {
|
|
// No one listens. Use standard IDB delete() method.
|
|
return this._idbstore(READWRITE, function (resolve, reject, idbstore) {
|
|
var req = idbstore.delete(key);
|
|
req.onerror = eventRejectHandler(reject);
|
|
req.onsuccess = wrap(function () {
|
|
resolve(req.result);
|
|
});
|
|
});
|
|
}
|
|
},
|
|
clear: function () {
|
|
if (this.hook.deleting.subscribers.length) {
|
|
// People listens to when("deleting") event. Must implement delete using Collection.delete() that will
|
|
// call the CRUD event. Only Collection.delete() will knows which objects that are actually deleted.
|
|
return this.toCollection().delete();
|
|
}
|
|
else {
|
|
return this._idbstore(READWRITE, function (resolve, reject, idbstore) {
|
|
var req = idbstore.clear();
|
|
req.onerror = eventRejectHandler(reject);
|
|
req.onsuccess = wrap(function () {
|
|
resolve(req.result);
|
|
});
|
|
});
|
|
}
|
|
},
|
|
update: function (keyOrObject, modifications) {
|
|
if (typeof modifications !== 'object' || isArray(modifications))
|
|
throw new exceptions.InvalidArgument("Modifications must be an object.");
|
|
if (typeof keyOrObject === 'object' && !isArray(keyOrObject)) {
|
|
// object to modify. Also modify given object with the modifications:
|
|
keys(modifications).forEach(function (keyPath) {
|
|
setByKeyPath(keyOrObject, keyPath, modifications[keyPath]);
|
|
});
|
|
var key = getByKeyPath(keyOrObject, this.schema.primKey.keyPath);
|
|
if (key === undefined)
|
|
return rejection(new exceptions.InvalidArgument("Given object does not contain its primary key"));
|
|
return this.where(":id").equals(key).modify(modifications);
|
|
}
|
|
else {
|
|
// key to modify
|
|
return this.where(":id").equals(keyOrObject).modify(modifications);
|
|
}
|
|
}
|
|
});
|
|
//
|
|
//
|
|
//
|
|
// Transaction Class
|
|
//
|
|
//
|
|
//
|
|
function Transaction(mode, storeNames, dbschema, parent) {
|
|
var _this = this;
|
|
/// <summary>
|
|
/// Transaction class. Represents a database transaction. All operations on db goes through a Transaction.
|
|
/// </summary>
|
|
/// <param name="mode" type="String">Any of "readwrite" or "readonly"</param>
|
|
/// <param name="storeNames" type="Array">Array of table names to operate on</param>
|
|
this.db = db;
|
|
this.mode = mode;
|
|
this.storeNames = storeNames;
|
|
this.idbtrans = null;
|
|
this.on = Events(this, "complete", "error", "abort");
|
|
this.parent = parent || null;
|
|
this.active = true;
|
|
this._reculock = 0;
|
|
this._blockedFuncs = [];
|
|
this._resolve = null;
|
|
this._reject = null;
|
|
this._waitingFor = null;
|
|
this._waitingQueue = null;
|
|
this._spinCount = 0; // Just for debugging waitFor()
|
|
this._completion = new Promise(function (resolve, reject) {
|
|
_this._resolve = resolve;
|
|
_this._reject = reject;
|
|
});
|
|
this._completion.then(function () {
|
|
_this.active = false;
|
|
_this.on.complete.fire();
|
|
}, function (e) {
|
|
var wasActive = _this.active;
|
|
_this.active = false;
|
|
_this.on.error.fire(e);
|
|
_this.parent ?
|
|
_this.parent._reject(e) :
|
|
wasActive && _this.idbtrans && _this.idbtrans.abort();
|
|
return rejection(e); // Indicate we actually DO NOT catch this error.
|
|
});
|
|
}
|
|
props(Transaction.prototype, {
|
|
//
|
|
// Transaction Protected Methods (not required by API users, but needed internally and eventually by dexie extensions)
|
|
//
|
|
_lock: function () {
|
|
assert(!PSD.global); // Locking and unlocking reuires to be within a PSD scope.
|
|
// Temporary set all requests into a pending queue if they are called before database is ready.
|
|
++this._reculock; // Recursive read/write lock pattern using PSD (Promise Specific Data) instead of TLS (Thread Local Storage)
|
|
if (this._reculock === 1 && !PSD.global)
|
|
PSD.lockOwnerFor = this;
|
|
return this;
|
|
},
|
|
_unlock: function () {
|
|
assert(!PSD.global); // Locking and unlocking reuires to be within a PSD scope.
|
|
if (--this._reculock === 0) {
|
|
if (!PSD.global)
|
|
PSD.lockOwnerFor = null;
|
|
while (this._blockedFuncs.length > 0 && !this._locked()) {
|
|
var fnAndPSD = this._blockedFuncs.shift();
|
|
try {
|
|
usePSD(fnAndPSD[1], fnAndPSD[0]);
|
|
}
|
|
catch (e) { }
|
|
}
|
|
}
|
|
return this;
|
|
},
|
|
_locked: function () {
|
|
// Checks if any write-lock is applied on this transaction.
|
|
// To simplify the Dexie API for extension implementations, we support recursive locks.
|
|
// This is accomplished by using "Promise Specific Data" (PSD).
|
|
// PSD data is bound to a Promise and any child Promise emitted through then() or resolve( new Promise() ).
|
|
// PSD is local to code executing on top of the call stacks of any of any code executed by Promise():
|
|
// * callback given to the Promise() constructor (function (resolve, reject){...})
|
|
// * callbacks given to then()/catch()/finally() methods (function (value){...})
|
|
// If creating a new independant Promise instance from within a Promise call stack, the new Promise will derive the PSD from the call stack of the parent Promise.
|
|
// Derivation is done so that the inner PSD __proto__ points to the outer PSD.
|
|
// PSD.lockOwnerFor will point to current transaction object if the currently executing PSD scope owns the lock.
|
|
return this._reculock && PSD.lockOwnerFor !== this;
|
|
},
|
|
create: function (idbtrans) {
|
|
var _this = this;
|
|
if (!this.mode)
|
|
return this;
|
|
assert(!this.idbtrans);
|
|
if (!idbtrans && !idbdb) {
|
|
switch (dbOpenError && dbOpenError.name) {
|
|
case "DatabaseClosedError":
|
|
// Errors where it is no difference whether it was caused by the user operation or an earlier call to db.open()
|
|
throw new exceptions.DatabaseClosed(dbOpenError);
|
|
case "MissingAPIError":
|
|
// Errors where it is no difference whether it was caused by the user operation or an earlier call to db.open()
|
|
throw new exceptions.MissingAPI(dbOpenError.message, dbOpenError);
|
|
default:
|
|
// Make it clear that the user operation was not what caused the error - the error had occurred earlier on db.open()!
|
|
throw new exceptions.OpenFailed(dbOpenError);
|
|
}
|
|
}
|
|
if (!this.active)
|
|
throw new exceptions.TransactionInactive();
|
|
assert(this._completion._state === null);
|
|
idbtrans = this.idbtrans = idbtrans || idbdb.transaction(safariMultiStoreFix(this.storeNames), this.mode);
|
|
idbtrans.onerror = wrap(function (ev) {
|
|
preventDefault(ev); // Prohibit default bubbling to window.error
|
|
_this._reject(idbtrans.error);
|
|
});
|
|
idbtrans.onabort = wrap(function (ev) {
|
|
preventDefault(ev);
|
|
_this.active && _this._reject(new exceptions.Abort(idbtrans.error));
|
|
_this.active = false;
|
|
_this.on("abort").fire(ev);
|
|
});
|
|
idbtrans.oncomplete = wrap(function () {
|
|
_this.active = false;
|
|
_this._resolve();
|
|
});
|
|
return this;
|
|
},
|
|
_promise: function (mode, fn, bWriteLock) {
|
|
var _this = this;
|
|
if (mode === READWRITE && this.mode !== READWRITE)
|
|
return rejection(new exceptions.ReadOnly("Transaction is readonly"));
|
|
if (!this.active)
|
|
return rejection(new exceptions.TransactionInactive());
|
|
if (this._locked()) {
|
|
return new Promise(function (resolve, reject) {
|
|
_this._blockedFuncs.push([function () {
|
|
_this._promise(mode, fn, bWriteLock).then(resolve, reject);
|
|
}, PSD]);
|
|
});
|
|
}
|
|
else if (bWriteLock) {
|
|
return newScope(function () {
|
|
var p = new Promise(function (resolve, reject) {
|
|
_this._lock();
|
|
var rv = fn(resolve, reject, _this);
|
|
if (rv && rv.then)
|
|
rv.then(resolve, reject);
|
|
});
|
|
p.finally(function () { return _this._unlock(); });
|
|
p._lib = true;
|
|
return p;
|
|
});
|
|
}
|
|
else {
|
|
var p = new Promise(function (resolve, reject) {
|
|
var rv = fn(resolve, reject, _this);
|
|
if (rv && rv.then)
|
|
rv.then(resolve, reject);
|
|
});
|
|
p._lib = true;
|
|
return p;
|
|
}
|
|
},
|
|
_root: function () {
|
|
return this.parent ? this.parent._root() : this;
|
|
},
|
|
waitFor: function (promise) {
|
|
// Always operate on the root transaction (in case this is a sub stransaction)
|
|
var root = this._root();
|
|
// For stability reasons, convert parameter to promise no matter what type is passed to waitFor().
|
|
// (We must be able to call .then() on it.)
|
|
promise = Promise.resolve(promise);
|
|
if (root._waitingFor) {
|
|
// Already called waitFor(). Wait for both to complete.
|
|
root._waitingFor = root._waitingFor.then(function () { return promise; });
|
|
}
|
|
else {
|
|
// We're not in waiting state. Start waiting state.
|
|
root._waitingFor = promise;
|
|
root._waitingQueue = [];
|
|
// Start interacting with indexedDB until promise completes:
|
|
var store = root.idbtrans.objectStore(root.storeNames[0]);
|
|
(function spin() {
|
|
++root._spinCount; // For debugging only
|
|
while (root._waitingQueue.length)
|
|
(root._waitingQueue.shift())();
|
|
if (root._waitingFor)
|
|
store.get(-Infinity).onsuccess = spin;
|
|
}());
|
|
}
|
|
var currentWaitPromise = root._waitingFor;
|
|
return new Promise(function (resolve, reject) {
|
|
promise.then(function (res) { return root._waitingQueue.push(wrap(resolve.bind(null, res))); }, function (err) { return root._waitingQueue.push(wrap(reject.bind(null, err))); }).finally(function () {
|
|
if (root._waitingFor === currentWaitPromise) {
|
|
// No one added a wait after us. Safe to stop the spinning.
|
|
root._waitingFor = null;
|
|
}
|
|
});
|
|
});
|
|
},
|
|
//
|
|
// Transaction Public Properties and Methods
|
|
//
|
|
abort: function () {
|
|
this.active && this._reject(new exceptions.Abort());
|
|
this.active = false;
|
|
},
|
|
tables: {
|
|
get: deprecated("Transaction.tables", function () { return allTables; })
|
|
},
|
|
table: function (name) {
|
|
var table = db.table(name); // Don't check that table is part of transaction. It must fail lazily!
|
|
return new Table(name, table.schema, this);
|
|
}
|
|
});
|
|
//
|
|
//
|
|
//
|
|
// WhereClause
|
|
//
|
|
//
|
|
//
|
|
function WhereClause(table, index, orCollection) {
|
|
/// <param name="table" type="Table"></param>
|
|
/// <param name="index" type="String" optional="true"></param>
|
|
/// <param name="orCollection" type="Collection" optional="true"></param>
|
|
this._ctx = {
|
|
table: table,
|
|
index: index === ":id" ? null : index,
|
|
or: orCollection
|
|
};
|
|
}
|
|
props(WhereClause.prototype, function () {
|
|
// WhereClause private methods
|
|
function fail(collectionOrWhereClause, err, T) {
|
|
var collection = collectionOrWhereClause instanceof WhereClause ?
|
|
new Collection(collectionOrWhereClause) :
|
|
collectionOrWhereClause;
|
|
collection._ctx.error = T ? new T(err) : new TypeError(err);
|
|
return collection;
|
|
}
|
|
function emptyCollection(whereClause) {
|
|
return new Collection(whereClause, function () { return IDBKeyRange.only(""); }).limit(0);
|
|
}
|
|
function upperFactory(dir) {
|
|
return dir === "next" ? function (s) { return s.toUpperCase(); } : function (s) { return s.toLowerCase(); };
|
|
}
|
|
function lowerFactory(dir) {
|
|
return dir === "next" ? function (s) { return s.toLowerCase(); } : function (s) { return s.toUpperCase(); };
|
|
}
|
|
function nextCasing(key, lowerKey, upperNeedle, lowerNeedle, cmp, dir) {
|
|
var length = Math.min(key.length, lowerNeedle.length);
|
|
var llp = -1;
|
|
for (var i = 0; i < length; ++i) {
|
|
var lwrKeyChar = lowerKey[i];
|
|
if (lwrKeyChar !== lowerNeedle[i]) {
|
|
if (cmp(key[i], upperNeedle[i]) < 0)
|
|
return key.substr(0, i) + upperNeedle[i] + upperNeedle.substr(i + 1);
|
|
if (cmp(key[i], lowerNeedle[i]) < 0)
|
|
return key.substr(0, i) + lowerNeedle[i] + upperNeedle.substr(i + 1);
|
|
if (llp >= 0)
|
|
return key.substr(0, llp) + lowerKey[llp] + upperNeedle.substr(llp + 1);
|
|
return null;
|
|
}
|
|
if (cmp(key[i], lwrKeyChar) < 0)
|
|
llp = i;
|
|
}
|
|
if (length < lowerNeedle.length && dir === "next")
|
|
return key + upperNeedle.substr(key.length);
|
|
if (length < key.length && dir === "prev")
|
|
return key.substr(0, upperNeedle.length);
|
|
return (llp < 0 ? null : key.substr(0, llp) + lowerNeedle[llp] + upperNeedle.substr(llp + 1));
|
|
}
|
|
function addIgnoreCaseAlgorithm(whereClause, match, needles, suffix) {
|
|
/// <param name="needles" type="Array" elementType="String"></param>
|
|
var upper, lower, compare, upperNeedles, lowerNeedles, direction, nextKeySuffix, needlesLen = needles.length;
|
|
if (!needles.every(function (s) { return typeof s === 'string'; })) {
|
|
return fail(whereClause, STRING_EXPECTED);
|
|
}
|
|
function initDirection(dir) {
|
|
upper = upperFactory(dir);
|
|
lower = lowerFactory(dir);
|
|
compare = (dir === "next" ? simpleCompare : simpleCompareReverse);
|
|
var needleBounds = needles.map(function (needle) {
|
|
return { lower: lower(needle), upper: upper(needle) };
|
|
}).sort(function (a, b) {
|
|
return compare(a.lower, b.lower);
|
|
});
|
|
upperNeedles = needleBounds.map(function (nb) { return nb.upper; });
|
|
lowerNeedles = needleBounds.map(function (nb) { return nb.lower; });
|
|
direction = dir;
|
|
nextKeySuffix = (dir === "next" ? "" : suffix);
|
|
}
|
|
initDirection("next");
|
|
var c = new Collection(whereClause, function () {
|
|
return IDBKeyRange.bound(upperNeedles[0], lowerNeedles[needlesLen - 1] + suffix);
|
|
});
|
|
c._ondirectionchange = function (direction) {
|
|
// This event onlys occur before filter is called the first time.
|
|
initDirection(direction);
|
|
};
|
|
var firstPossibleNeedle = 0;
|
|
c._addAlgorithm(function (cursor, advance, resolve) {
|
|
/// <param name="cursor" type="IDBCursor"></param>
|
|
/// <param name="advance" type="Function"></param>
|
|
/// <param name="resolve" type="Function"></param>
|
|
var key = cursor.key;
|
|
if (typeof key !== 'string')
|
|
return false;
|
|
var lowerKey = lower(key);
|
|
if (match(lowerKey, lowerNeedles, firstPossibleNeedle)) {
|
|
return true;
|
|
}
|
|
else {
|
|
var lowestPossibleCasing = null;
|
|
for (var i = firstPossibleNeedle; i < needlesLen; ++i) {
|
|
var casing = nextCasing(key, lowerKey, upperNeedles[i], lowerNeedles[i], compare, direction);
|
|
if (casing === null && lowestPossibleCasing === null)
|
|
firstPossibleNeedle = i + 1;
|
|
else if (lowestPossibleCasing === null || compare(lowestPossibleCasing, casing) > 0) {
|
|
lowestPossibleCasing = casing;
|
|
}
|
|
}
|
|
if (lowestPossibleCasing !== null) {
|
|
advance(function () { cursor.continue(lowestPossibleCasing + nextKeySuffix); });
|
|
}
|
|
else {
|
|
advance(resolve);
|
|
}
|
|
return false;
|
|
}
|
|
});
|
|
return c;
|
|
}
|
|
//
|
|
// WhereClause public methods
|
|
//
|
|
return {
|
|
between: function (lower, upper, includeLower, includeUpper) {
|
|
/// <summary>
|
|
/// Filter out records whose where-field lays between given lower and upper values. Applies to Strings, Numbers and Dates.
|
|
/// </summary>
|
|
/// <param name="lower"></param>
|
|
/// <param name="upper"></param>
|
|
/// <param name="includeLower" optional="true">Whether items that equals lower should be included. Default true.</param>
|
|
/// <param name="includeUpper" optional="true">Whether items that equals upper should be included. Default false.</param>
|
|
/// <returns type="Collection"></returns>
|
|
includeLower = includeLower !== false; // Default to true
|
|
includeUpper = includeUpper === true; // Default to false
|
|
try {
|
|
if ((cmp(lower, upper) > 0) ||
|
|
(cmp(lower, upper) === 0 && (includeLower || includeUpper) && !(includeLower && includeUpper)))
|
|
return emptyCollection(this); // Workaround for idiotic W3C Specification that DataError must be thrown if lower > upper. The natural result would be to return an empty collection.
|
|
return new Collection(this, function () { return IDBKeyRange.bound(lower, upper, !includeLower, !includeUpper); });
|
|
}
|
|
catch (e) {
|
|
return fail(this, INVALID_KEY_ARGUMENT);
|
|
}
|
|
},
|
|
equals: function (value) {
|
|
return new Collection(this, function () { return IDBKeyRange.only(value); });
|
|
},
|
|
above: function (value) {
|
|
return new Collection(this, function () { return IDBKeyRange.lowerBound(value, true); });
|
|
},
|
|
aboveOrEqual: function (value) {
|
|
return new Collection(this, function () { return IDBKeyRange.lowerBound(value); });
|
|
},
|
|
below: function (value) {
|
|
return new Collection(this, function () { return IDBKeyRange.upperBound(value, true); });
|
|
},
|
|
belowOrEqual: function (value) {
|
|
return new Collection(this, function () { return IDBKeyRange.upperBound(value); });
|
|
},
|
|
startsWith: function (str) {
|
|
/// <param name="str" type="String"></param>
|
|
if (typeof str !== 'string')
|
|
return fail(this, STRING_EXPECTED);
|
|
return this.between(str, str + maxString, true, true);
|
|
},
|
|
startsWithIgnoreCase: function (str) {
|
|
/// <param name="str" type="String"></param>
|
|
if (str === "")
|
|
return this.startsWith(str);
|
|
return addIgnoreCaseAlgorithm(this, function (x, a) { return x.indexOf(a[0]) === 0; }, [str], maxString);
|
|
},
|
|
equalsIgnoreCase: function (str) {
|
|
/// <param name="str" type="String"></param>
|
|
return addIgnoreCaseAlgorithm(this, function (x, a) { return x === a[0]; }, [str], "");
|
|
},
|
|
anyOfIgnoreCase: function () {
|
|
var set = getArrayOf.apply(NO_CHAR_ARRAY, arguments);
|
|
if (set.length === 0)
|
|
return emptyCollection(this);
|
|
return addIgnoreCaseAlgorithm(this, function (x, a) { return a.indexOf(x) !== -1; }, set, "");
|
|
},
|
|
startsWithAnyOfIgnoreCase: function () {
|
|
var set = getArrayOf.apply(NO_CHAR_ARRAY, arguments);
|
|
if (set.length === 0)
|
|
return emptyCollection(this);
|
|
return addIgnoreCaseAlgorithm(this, function (x, a) {
|
|
return a.some(function (n) {
|
|
return x.indexOf(n) === 0;
|
|
});
|
|
}, set, maxString);
|
|
},
|
|
anyOf: function () {
|
|
var set = getArrayOf.apply(NO_CHAR_ARRAY, arguments);
|
|
var compare = ascending;
|
|
try {
|
|
set.sort(compare);
|
|
}
|
|
catch (e) {
|
|
return fail(this, INVALID_KEY_ARGUMENT);
|
|
}
|
|
if (set.length === 0)
|
|
return emptyCollection(this);
|
|
var c = new Collection(this, function () { return IDBKeyRange.bound(set[0], set[set.length - 1]); });
|
|
c._ondirectionchange = function (direction) {
|
|
compare = (direction === "next" ? ascending : descending);
|
|
set.sort(compare);
|
|
};
|
|
var i = 0;
|
|
c._addAlgorithm(function (cursor, advance, resolve) {
|
|
var key = cursor.key;
|
|
while (compare(key, set[i]) > 0) {
|
|
// The cursor has passed beyond this key. Check next.
|
|
++i;
|
|
if (i === set.length) {
|
|
// There is no next. Stop searching.
|
|
advance(resolve);
|
|
return false;
|
|
}
|
|
}
|
|
if (compare(key, set[i]) === 0) {
|
|
// The current cursor value should be included and we should continue a single step in case next item has the same key or possibly our next key in set.
|
|
return true;
|
|
}
|
|
else {
|
|
// cursor.key not yet at set[i]. Forward cursor to the next key to hunt for.
|
|
advance(function () { cursor.continue(set[i]); });
|
|
return false;
|
|
}
|
|
});
|
|
return c;
|
|
},
|
|
notEqual: function (value) {
|
|
return this.inAnyRange([[minKey, value], [value, maxKey]], { includeLowers: false, includeUppers: false });
|
|
},
|
|
noneOf: function () {
|
|
var set = getArrayOf.apply(NO_CHAR_ARRAY, arguments);
|
|
if (set.length === 0)
|
|
return new Collection(this); // Return entire collection.
|
|
try {
|
|
set.sort(ascending);
|
|
}
|
|
catch (e) {
|
|
return fail(this, INVALID_KEY_ARGUMENT);
|
|
}
|
|
// Transform ["a","b","c"] to a set of ranges for between/above/below: [[minKey,"a"], ["a","b"], ["b","c"], ["c",maxKey]]
|
|
var ranges = set.reduce(function (res, val) { return res ? res.concat([[res[res.length - 1][1], val]]) : [[minKey, val]]; }, null);
|
|
ranges.push([set[set.length - 1], maxKey]);
|
|
return this.inAnyRange(ranges, { includeLowers: false, includeUppers: false });
|
|
},
|
|
/** Filter out values withing given set of ranges.
|
|
* Example, give children and elders a rebate of 50%:
|
|
*
|
|
* db.friends.where('age').inAnyRange([[0,18],[65,Infinity]]).modify({Rebate: 1/2});
|
|
*
|
|
* @param {(string|number|Date|Array)[][]} ranges
|
|
* @param {{includeLowers: boolean, includeUppers: boolean}} options
|
|
*/
|
|
inAnyRange: function (ranges, options) {
|
|
if (ranges.length === 0)
|
|
return emptyCollection(this);
|
|
if (!ranges.every(function (range) { return range[0] !== undefined && range[1] !== undefined && ascending(range[0], range[1]) <= 0; })) {
|
|
return fail(this, "First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower", exceptions.InvalidArgument);
|
|
}
|
|
var includeLowers = !options || options.includeLowers !== false; // Default to true
|
|
var includeUppers = options && options.includeUppers === true; // Default to false
|
|
function addRange(ranges, newRange) {
|
|
for (var i = 0, l = ranges.length; i < l; ++i) {
|
|
var range = ranges[i];
|
|
if (cmp(newRange[0], range[1]) < 0 && cmp(newRange[1], range[0]) > 0) {
|
|
range[0] = min(range[0], newRange[0]);
|
|
range[1] = max(range[1], newRange[1]);
|
|
break;
|
|
}
|
|
}
|
|
if (i === l)
|
|
ranges.push(newRange);
|
|
return ranges;
|
|
}
|
|
var sortDirection = ascending;
|
|
function rangeSorter(a, b) { return sortDirection(a[0], b[0]); }
|
|
// Join overlapping ranges
|
|
var set;
|
|
try {
|
|
set = ranges.reduce(addRange, []);
|
|
set.sort(rangeSorter);
|
|
}
|
|
catch (ex) {
|
|
return fail(this, INVALID_KEY_ARGUMENT);
|
|
}
|
|
var i = 0;
|
|
var keyIsBeyondCurrentEntry = includeUppers ?
|
|
function (key) { return ascending(key, set[i][1]) > 0; } :
|
|
function (key) { return ascending(key, set[i][1]) >= 0; };
|
|
var keyIsBeforeCurrentEntry = includeLowers ?
|
|
function (key) { return descending(key, set[i][0]) > 0; } :
|
|
function (key) { return descending(key, set[i][0]) >= 0; };
|
|
function keyWithinCurrentRange(key) {
|
|
return !keyIsBeyondCurrentEntry(key) && !keyIsBeforeCurrentEntry(key);
|
|
}
|
|
var checkKey = keyIsBeyondCurrentEntry;
|
|
var c = new Collection(this, function () {
|
|
return IDBKeyRange.bound(set[0][0], set[set.length - 1][1], !includeLowers, !includeUppers);
|
|
});
|
|
c._ondirectionchange = function (direction) {
|
|
if (direction === "next") {
|
|
checkKey = keyIsBeyondCurrentEntry;
|
|
sortDirection = ascending;
|
|
}
|
|
else {
|
|
checkKey = keyIsBeforeCurrentEntry;
|
|
sortDirection = descending;
|
|
}
|
|
set.sort(rangeSorter);
|
|
};
|
|
c._addAlgorithm(function (cursor, advance, resolve) {
|
|
var key = cursor.key;
|
|
while (checkKey(key)) {
|
|
// The cursor has passed beyond this key. Check next.
|
|
++i;
|
|
if (i === set.length) {
|
|
// There is no next. Stop searching.
|
|
advance(resolve);
|
|
return false;
|
|
}
|
|
}
|
|
if (keyWithinCurrentRange(key)) {
|
|
// The current cursor value should be included and we should continue a single step in case next item has the same key or possibly our next key in set.
|
|
return true;
|
|
}
|
|
else if (cmp(key, set[i][1]) === 0 || cmp(key, set[i][0]) === 0) {
|
|
// includeUpper or includeLower is false so keyWithinCurrentRange() returns false even though we are at range border.
|
|
// Continue to next key but don't include this one.
|
|
return false;
|
|
}
|
|
else {
|
|
// cursor.key not yet at set[i]. Forward cursor to the next key to hunt for.
|
|
advance(function () {
|
|
if (sortDirection === ascending)
|
|
cursor.continue(set[i][0]);
|
|
else
|
|
cursor.continue(set[i][1]);
|
|
});
|
|
return false;
|
|
}
|
|
});
|
|
return c;
|
|
},
|
|
startsWithAnyOf: function () {
|
|
var set = getArrayOf.apply(NO_CHAR_ARRAY, arguments);
|
|
if (!set.every(function (s) { return typeof s === 'string'; })) {
|
|
return fail(this, "startsWithAnyOf() only works with strings");
|
|
}
|
|
if (set.length === 0)
|
|
return emptyCollection(this);
|
|
return this.inAnyRange(set.map(function (str) {
|
|
return [str, str + maxString];
|
|
}));
|
|
}
|
|
};
|
|
});
|
|
//
|
|
//
|
|
//
|
|
// Collection Class
|
|
//
|
|
//
|
|
//
|
|
function Collection(whereClause, keyRangeGenerator) {
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="whereClause" type="WhereClause">Where clause instance</param>
|
|
/// <param name="keyRangeGenerator" value="function(){ return IDBKeyRange.bound(0,1);}" optional="true"></param>
|
|
var keyRange = null, error = null;
|
|
if (keyRangeGenerator)
|
|
try {
|
|
keyRange = keyRangeGenerator();
|
|
}
|
|
catch (ex) {
|
|
error = ex;
|
|
}
|
|
var whereCtx = whereClause._ctx, table = whereCtx.table;
|
|
this._ctx = {
|
|
table: table,
|
|
index: whereCtx.index,
|
|
isPrimKey: (!whereCtx.index || (table.schema.primKey.keyPath && whereCtx.index === table.schema.primKey.name)),
|
|
range: keyRange,
|
|
keysOnly: false,
|
|
dir: "next",
|
|
unique: "",
|
|
algorithm: null,
|
|
filter: null,
|
|
replayFilter: null,
|
|
justLimit: true,
|
|
isMatch: null,
|
|
offset: 0,
|
|
limit: Infinity,
|
|
error: error,
|
|
or: whereCtx.or,
|
|
valueMapper: table.hook.reading.fire
|
|
};
|
|
}
|
|
function isPlainKeyRange(ctx, ignoreLimitFilter) {
|
|
return !(ctx.filter || ctx.algorithm || ctx.or) &&
|
|
(ignoreLimitFilter ? ctx.justLimit : !ctx.replayFilter);
|
|
}
|
|
props(Collection.prototype, function () {
|
|
//
|
|
// Collection Private Functions
|
|
//
|
|
function addFilter(ctx, fn) {
|
|
ctx.filter = combine(ctx.filter, fn);
|
|
}
|
|
function addReplayFilter(ctx, factory, isLimitFilter) {
|
|
var curr = ctx.replayFilter;
|
|
ctx.replayFilter = curr ? function () { return combine(curr(), factory()); } : factory;
|
|
ctx.justLimit = isLimitFilter && !curr;
|
|
}
|
|
function addMatchFilter(ctx, fn) {
|
|
ctx.isMatch = combine(ctx.isMatch, fn);
|
|
}
|
|
/** @param ctx {
|
|
* isPrimKey: boolean,
|
|
* table: Table,
|
|
* index: string
|
|
* }
|
|
* @param store IDBObjectStore
|
|
**/
|
|
function getIndexOrStore(ctx, store) {
|
|
if (ctx.isPrimKey)
|
|
return store;
|
|
var indexSpec = ctx.table.schema.idxByName[ctx.index];
|
|
if (!indexSpec)
|
|
throw new exceptions.Schema("KeyPath " + ctx.index + " on object store " + store.name + " is not indexed");
|
|
return store.index(indexSpec.name);
|
|
}
|
|
/** @param ctx {
|
|
* isPrimKey: boolean,
|
|
* table: Table,
|
|
* index: string,
|
|
* keysOnly: boolean,
|
|
* range?: IDBKeyRange,
|
|
* dir: "next" | "prev"
|
|
* }
|
|
*/
|
|
function openCursor(ctx, store) {
|
|
var idxOrStore = getIndexOrStore(ctx, store);
|
|
return ctx.keysOnly && 'openKeyCursor' in idxOrStore ?
|
|
idxOrStore.openKeyCursor(ctx.range || null, ctx.dir + ctx.unique) :
|
|
idxOrStore.openCursor(ctx.range || null, ctx.dir + ctx.unique);
|
|
}
|
|
function iter(ctx, fn, resolve, reject, idbstore) {
|
|
var filter = ctx.replayFilter ? combine(ctx.filter, ctx.replayFilter()) : ctx.filter;
|
|
if (!ctx.or) {
|
|
iterate(openCursor(ctx, idbstore), combine(ctx.algorithm, filter), fn, resolve, reject, !ctx.keysOnly && ctx.valueMapper);
|
|
}
|
|
else
|
|
(function () {
|
|
var set = {};
|
|
var resolved = 0;
|
|
function resolveboth() {
|
|
if (++resolved === 2)
|
|
resolve(); // Seems like we just support or btwn max 2 expressions, but there are no limit because we do recursion.
|
|
}
|
|
function union(item, cursor, advance) {
|
|
if (!filter || filter(cursor, advance, resolveboth, reject)) {
|
|
var primaryKey = cursor.primaryKey;
|
|
var key = '' + primaryKey;
|
|
if (key === '[object ArrayBuffer]')
|
|
key = '' + new Uint8Array(primaryKey);
|
|
if (!hasOwn(set, key)) {
|
|
set[key] = true;
|
|
fn(item, cursor, advance);
|
|
}
|
|
}
|
|
}
|
|
ctx.or._iterate(union, resolveboth, reject, idbstore);
|
|
iterate(openCursor(ctx, idbstore), ctx.algorithm, union, resolveboth, reject, !ctx.keysOnly && ctx.valueMapper);
|
|
})();
|
|
}
|
|
return {
|
|
//
|
|
// Collection Protected Functions
|
|
//
|
|
_read: function (fn, cb) {
|
|
var ctx = this._ctx;
|
|
return ctx.error ?
|
|
ctx.table._trans(null, rejection.bind(null, ctx.error)) :
|
|
ctx.table._idbstore(READONLY, fn).then(cb);
|
|
},
|
|
_write: function (fn) {
|
|
var ctx = this._ctx;
|
|
return ctx.error ?
|
|
ctx.table._trans(null, rejection.bind(null, ctx.error)) :
|
|
ctx.table._idbstore(READWRITE, fn, "locked"); // When doing write operations on collections, always lock the operation so that upcoming operations gets queued.
|
|
},
|
|
_addAlgorithm: function (fn) {
|
|
var ctx = this._ctx;
|
|
ctx.algorithm = combine(ctx.algorithm, fn);
|
|
},
|
|
_iterate: function (fn, resolve, reject, idbstore) {
|
|
return iter(this._ctx, fn, resolve, reject, idbstore);
|
|
},
|
|
clone: function (props$$1) {
|
|
var rv = Object.create(this.constructor.prototype), ctx = Object.create(this._ctx);
|
|
if (props$$1)
|
|
extend(ctx, props$$1);
|
|
rv._ctx = ctx;
|
|
return rv;
|
|
},
|
|
raw: function () {
|
|
this._ctx.valueMapper = null;
|
|
return this;
|
|
},
|
|
//
|
|
// Collection Public methods
|
|
//
|
|
each: function (fn) {
|
|
var ctx = this._ctx;
|
|
return this._read(function (resolve, reject, idbstore) {
|
|
iter(ctx, fn, resolve, reject, idbstore);
|
|
});
|
|
},
|
|
count: function (cb) {
|
|
var ctx = this._ctx;
|
|
if (isPlainKeyRange(ctx, true)) {
|
|
// This is a plain key range. We can use the count() method if the index.
|
|
return this._read(function (resolve, reject, idbstore) {
|
|
var idx = getIndexOrStore(ctx, idbstore);
|
|
var req = (ctx.range ? idx.count(ctx.range) : idx.count());
|
|
req.onerror = eventRejectHandler(reject);
|
|
req.onsuccess = function (e) {
|
|
resolve(Math.min(e.target.result, ctx.limit));
|
|
};
|
|
}, cb);
|
|
}
|
|
else {
|
|
// Algorithms, filters or expressions are applied. Need to count manually.
|
|
var count = 0;
|
|
return this._read(function (resolve, reject, idbstore) {
|
|
iter(ctx, function () { ++count; return false; }, function () { resolve(count); }, reject, idbstore);
|
|
}, cb);
|
|
}
|
|
},
|
|
sortBy: function (keyPath, cb) {
|
|
/// <param name="keyPath" type="String"></param>
|
|
var parts = keyPath.split('.').reverse(), lastPart = parts[0], lastIndex = parts.length - 1;
|
|
function getval(obj, i) {
|
|
if (i)
|
|
return getval(obj[parts[i]], i - 1);
|
|
return obj[lastPart];
|
|
}
|
|
var order = this._ctx.dir === "next" ? 1 : -1;
|
|
function sorter(a, b) {
|
|
var aVal = getval(a, lastIndex), bVal = getval(b, lastIndex);
|
|
return aVal < bVal ? -order : aVal > bVal ? order : 0;
|
|
}
|
|
return this.toArray(function (a) {
|
|
return a.sort(sorter);
|
|
}).then(cb);
|
|
},
|
|
toArray: function (cb) {
|
|
var ctx = this._ctx;
|
|
return this._read(function (resolve, reject, idbstore) {
|
|
if (hasGetAll && ctx.dir === 'next' && isPlainKeyRange(ctx, true) && ctx.limit > 0) {
|
|
// Special optimation if we could use IDBObjectStore.getAll() or
|
|
// IDBKeyRange.getAll():
|
|
var readingHook = ctx.table.hook.reading.fire;
|
|
var idxOrStore = getIndexOrStore(ctx, idbstore);
|
|
var req = ctx.limit < Infinity ?
|
|
idxOrStore.getAll(ctx.range, ctx.limit) :
|
|
idxOrStore.getAll(ctx.range);
|
|
req.onerror = eventRejectHandler(reject);
|
|
req.onsuccess = readingHook === mirror ?
|
|
eventSuccessHandler(resolve) :
|
|
eventSuccessHandler(function (res) {
|
|
try {
|
|
resolve(res.map(readingHook));
|
|
}
|
|
catch (e) {
|
|
reject(e);
|
|
}
|
|
});
|
|
}
|
|
else {
|
|
// Getting array through a cursor.
|
|
var a = [];
|
|
iter(ctx, function (item) { a.push(item); }, function arrayComplete() {
|
|
resolve(a);
|
|
}, reject, idbstore);
|
|
}
|
|
}, cb);
|
|
},
|
|
offset: function (offset) {
|
|
var ctx = this._ctx;
|
|
if (offset <= 0)
|
|
return this;
|
|
ctx.offset += offset; // For count()
|
|
if (isPlainKeyRange(ctx)) {
|
|
addReplayFilter(ctx, function () {
|
|
var offsetLeft = offset;
|
|
return function (cursor, advance) {
|
|
if (offsetLeft === 0)
|
|
return true;
|
|
if (offsetLeft === 1) {
|
|
--offsetLeft;
|
|
return false;
|
|
}
|
|
advance(function () {
|
|
cursor.advance(offsetLeft);
|
|
offsetLeft = 0;
|
|
});
|
|
return false;
|
|
};
|
|
});
|
|
}
|
|
else {
|
|
addReplayFilter(ctx, function () {
|
|
var offsetLeft = offset;
|
|
return function () { return (--offsetLeft < 0); };
|
|
});
|
|
}
|
|
return this;
|
|
},
|
|
limit: function (numRows) {
|
|
this._ctx.limit = Math.min(this._ctx.limit, numRows); // For count()
|
|
addReplayFilter(this._ctx, function () {
|
|
var rowsLeft = numRows;
|
|
return function (cursor, advance, resolve) {
|
|
if (--rowsLeft <= 0)
|
|
advance(resolve); // Stop after this item has been included
|
|
return rowsLeft >= 0; // If numRows is already below 0, return false because then 0 was passed to numRows initially. Otherwise we wouldnt come here.
|
|
};
|
|
}, true);
|
|
return this;
|
|
},
|
|
until: function (filterFunction, bIncludeStopEntry) {
|
|
addFilter(this._ctx, function (cursor, advance, resolve) {
|
|
if (filterFunction(cursor.value)) {
|
|
advance(resolve);
|
|
return bIncludeStopEntry;
|
|
}
|
|
else {
|
|
return true;
|
|
}
|
|
});
|
|
return this;
|
|
},
|
|
first: function (cb) {
|
|
return this.limit(1).toArray(function (a) { return a[0]; }).then(cb);
|
|
},
|
|
last: function (cb) {
|
|
return this.reverse().first(cb);
|
|
},
|
|
filter: function (filterFunction) {
|
|
/// <param name="jsFunctionFilter" type="Function">function(val){return true/false}</param>
|
|
addFilter(this._ctx, function (cursor) {
|
|
return filterFunction(cursor.value);
|
|
});
|
|
// match filters not used in Dexie.js but can be used by 3rd part libraries to test a
|
|
// collection for a match without querying DB. Used by Dexie.Observable.
|
|
addMatchFilter(this._ctx, filterFunction);
|
|
return this;
|
|
},
|
|
and: function (filterFunction) {
|
|
return this.filter(filterFunction);
|
|
},
|
|
or: function (indexName) {
|
|
return new WhereClause(this._ctx.table, indexName, this);
|
|
},
|
|
reverse: function () {
|
|
this._ctx.dir = (this._ctx.dir === "prev" ? "next" : "prev");
|
|
if (this._ondirectionchange)
|
|
this._ondirectionchange(this._ctx.dir);
|
|
return this;
|
|
},
|
|
desc: function () {
|
|
return this.reverse();
|
|
},
|
|
eachKey: function (cb) {
|
|
var ctx = this._ctx;
|
|
ctx.keysOnly = !ctx.isMatch;
|
|
return this.each(function (val, cursor) { cb(cursor.key, cursor); });
|
|
},
|
|
eachUniqueKey: function (cb) {
|
|
this._ctx.unique = "unique";
|
|
return this.eachKey(cb);
|
|
},
|
|
eachPrimaryKey: function (cb) {
|
|
var ctx = this._ctx;
|
|
ctx.keysOnly = !ctx.isMatch;
|
|
return this.each(function (val, cursor) { cb(cursor.primaryKey, cursor); });
|
|
},
|
|
keys: function (cb) {
|
|
var ctx = this._ctx;
|
|
ctx.keysOnly = !ctx.isMatch;
|
|
var a = [];
|
|
return this.each(function (item, cursor) {
|
|
a.push(cursor.key);
|
|
}).then(function () {
|
|
return a;
|
|
}).then(cb);
|
|
},
|
|
primaryKeys: function (cb) {
|
|
var ctx = this._ctx;
|
|
if (hasGetAll && ctx.dir === 'next' && isPlainKeyRange(ctx, true) && ctx.limit > 0) {
|
|
// Special optimation if we could use IDBObjectStore.getAllKeys() or
|
|
// IDBKeyRange.getAllKeys():
|
|
return this._read(function (resolve, reject, idbstore) {
|
|
var idxOrStore = getIndexOrStore(ctx, idbstore);
|
|
var req = ctx.limit < Infinity ?
|
|
idxOrStore.getAllKeys(ctx.range, ctx.limit) :
|
|
idxOrStore.getAllKeys(ctx.range);
|
|
req.onerror = eventRejectHandler(reject);
|
|
req.onsuccess = eventSuccessHandler(resolve);
|
|
}).then(cb);
|
|
}
|
|
ctx.keysOnly = !ctx.isMatch;
|
|
var a = [];
|
|
return this.each(function (item, cursor) {
|
|
a.push(cursor.primaryKey);
|
|
}).then(function () {
|
|
return a;
|
|
}).then(cb);
|
|
},
|
|
uniqueKeys: function (cb) {
|
|
this._ctx.unique = "unique";
|
|
return this.keys(cb);
|
|
},
|
|
firstKey: function (cb) {
|
|
return this.limit(1).keys(function (a) { return a[0]; }).then(cb);
|
|
},
|
|
lastKey: function (cb) {
|
|
return this.reverse().firstKey(cb);
|
|
},
|
|
distinct: function () {
|
|
var ctx = this._ctx, idx = ctx.index && ctx.table.schema.idxByName[ctx.index];
|
|
if (!idx || !idx.multi)
|
|
return this; // distinct() only makes differencies on multiEntry indexes.
|
|
var set = {};
|
|
addFilter(this._ctx, function (cursor) {
|
|
var strKey = cursor.primaryKey.toString(); // Converts any Date to String, String to String, Number to String and Array to comma-separated string
|
|
var found = hasOwn(set, strKey);
|
|
set[strKey] = true;
|
|
return !found;
|
|
});
|
|
return this;
|
|
},
|
|
//
|
|
// Methods that mutate storage
|
|
//
|
|
modify: function (changes) {
|
|
var self = this, ctx = this._ctx, hook = ctx.table.hook, updatingHook = hook.updating.fire, deletingHook = hook.deleting.fire;
|
|
return this._write(function (resolve, reject, idbstore, trans) {
|
|
var modifyer;
|
|
if (typeof changes === 'function') {
|
|
// Changes is a function that may update, add or delete propterties or even require a deletion the object itself (delete this.item)
|
|
if (updatingHook === nop && deletingHook === nop) {
|
|
// Noone cares about what is being changed. Just let the modifier function be the given argument as is.
|
|
modifyer = changes;
|
|
}
|
|
else {
|
|
// People want to know exactly what is being modified or deleted.
|
|
// Let modifyer be a proxy function that finds out what changes the caller is actually doing
|
|
// and call the hooks accordingly!
|
|
modifyer = function (item) {
|
|
var origItem = deepClone(item); // Clone the item first so we can compare laters.
|
|
if (changes.call(this, item, this) === false)
|
|
return false; // Call the real modifyer function (If it returns false explicitely, it means it dont want to modify anyting on this object)
|
|
if (!hasOwn(this, "value")) {
|
|
// The real modifyer function requests a deletion of the object. Inform the deletingHook that a deletion is taking place.
|
|
deletingHook.call(this, this.primKey, item, trans);
|
|
}
|
|
else {
|
|
// No deletion. Check what was changed
|
|
var objectDiff = getObjectDiff(origItem, this.value);
|
|
var additionalChanges = updatingHook.call(this, objectDiff, this.primKey, origItem, trans);
|
|
if (additionalChanges) {
|
|
// Hook want to apply additional modifications. Make sure to fullfill the will of the hook.
|
|
item = this.value;
|
|
keys(additionalChanges).forEach(function (keyPath) {
|
|
setByKeyPath(item, keyPath, additionalChanges[keyPath]); // Adding {keyPath: undefined} means that the keyPath should be deleted. Handled by setByKeyPath
|
|
});
|
|
}
|
|
}
|
|
};
|
|
}
|
|
}
|
|
else if (updatingHook === nop) {
|
|
// changes is a set of {keyPath: value} and no one is listening to the updating hook.
|
|
var keyPaths = keys(changes);
|
|
var numKeys = keyPaths.length;
|
|
modifyer = function (item) {
|
|
var anythingModified = false;
|
|
for (var i = 0; i < numKeys; ++i) {
|
|
var keyPath = keyPaths[i], val = changes[keyPath];
|
|
if (getByKeyPath(item, keyPath) !== val) {
|
|
setByKeyPath(item, keyPath, val); // Adding {keyPath: undefined} means that the keyPath should be deleted. Handled by setByKeyPath
|
|
anythingModified = true;
|
|
}
|
|
}
|
|
return anythingModified;
|
|
};
|
|
}
|
|
else {
|
|
// changes is a set of {keyPath: value} and people are listening to the updating hook so we need to call it and
|
|
// allow it to add additional modifications to make.
|
|
var origChanges = changes;
|
|
changes = shallowClone(origChanges); // Let's work with a clone of the changes keyPath/value set so that we can restore it in case a hook extends it.
|
|
modifyer = function (item) {
|
|
var anythingModified = false;
|
|
var additionalChanges = updatingHook.call(this, changes, this.primKey, deepClone(item), trans);
|
|
if (additionalChanges)
|
|
extend(changes, additionalChanges);
|
|
keys(changes).forEach(function (keyPath) {
|
|
var val = changes[keyPath];
|
|
if (getByKeyPath(item, keyPath) !== val) {
|
|
setByKeyPath(item, keyPath, val);
|
|
anythingModified = true;
|
|
}
|
|
});
|
|
if (additionalChanges)
|
|
changes = shallowClone(origChanges); // Restore original changes for next iteration
|
|
return anythingModified;
|
|
};
|
|
}
|
|
var count = 0;
|
|
var successCount = 0;
|
|
var iterationComplete = false;
|
|
var failures = [];
|
|
var failKeys = [];
|
|
var currentKey = null;
|
|
function modifyItem(item, cursor) {
|
|
currentKey = cursor.primaryKey;
|
|
var thisContext = {
|
|
primKey: cursor.primaryKey,
|
|
value: item,
|
|
onsuccess: null,
|
|
onerror: null
|
|
};
|
|
function onerror(e) {
|
|
failures.push(e);
|
|
failKeys.push(thisContext.primKey);
|
|
checkFinished();
|
|
return true; // Catch these errors and let a final rejection decide whether or not to abort entire transaction
|
|
}
|
|
if (modifyer.call(thisContext, item, thisContext) !== false) {
|
|
var bDelete = !hasOwn(thisContext, "value");
|
|
++count;
|
|
tryCatch(function () {
|
|
var req = (bDelete ? cursor.delete() : cursor.update(thisContext.value));
|
|
req._hookCtx = thisContext;
|
|
req.onerror = hookedEventRejectHandler(onerror);
|
|
req.onsuccess = hookedEventSuccessHandler(function () {
|
|
++successCount;
|
|
checkFinished();
|
|
});
|
|
}, onerror);
|
|
}
|
|
else if (thisContext.onsuccess) {
|
|
// Hook will expect either onerror or onsuccess to always be called!
|
|
thisContext.onsuccess(thisContext.value);
|
|
}
|
|
}
|
|
function doReject(e) {
|
|
if (e) {
|
|
failures.push(e);
|
|
failKeys.push(currentKey);
|
|
}
|
|
return reject(new ModifyError("Error modifying one or more objects", failures, successCount, failKeys));
|
|
}
|
|
function checkFinished() {
|
|
if (iterationComplete && successCount + failures.length === count) {
|
|
if (failures.length > 0)
|
|
doReject();
|
|
else
|
|
resolve(successCount);
|
|
}
|
|
}
|
|
self.clone().raw()._iterate(modifyItem, function () {
|
|
iterationComplete = true;
|
|
checkFinished();
|
|
}, doReject, idbstore);
|
|
});
|
|
},
|
|
'delete': function () {
|
|
var _this = this;
|
|
var ctx = this._ctx, range = ctx.range, deletingHook = ctx.table.hook.deleting.fire, hasDeleteHook = deletingHook !== nop;
|
|
if (!hasDeleteHook &&
|
|
isPlainKeyRange(ctx) &&
|
|
((ctx.isPrimKey && !hangsOnDeleteLargeKeyRange) || !range)) {
|
|
// May use IDBObjectStore.delete(IDBKeyRange) in this case (Issue #208)
|
|
// For chromium, this is the way most optimized version.
|
|
// For IE/Edge, this could hang the indexedDB engine and make operating system instable
|
|
// (https://gist.github.com/dfahlander/5a39328f029de18222cf2125d56c38f7)
|
|
return this._write(function (resolve, reject, idbstore) {
|
|
// Our API contract is to return a count of deleted items, so we have to count() before delete().
|
|
var onerror = eventRejectHandler(reject), countReq = (range ? idbstore.count(range) : idbstore.count());
|
|
countReq.onerror = onerror;
|
|
countReq.onsuccess = function () {
|
|
var count = countReq.result;
|
|
tryCatch(function () {
|
|
var delReq = (range ? idbstore.delete(range) : idbstore.clear());
|
|
delReq.onerror = onerror;
|
|
delReq.onsuccess = function () { return resolve(count); };
|
|
}, function (err) { return reject(err); });
|
|
};
|
|
});
|
|
}
|
|
// Default version to use when collection is not a vanilla IDBKeyRange on the primary key.
|
|
// Divide into chunks to not starve RAM.
|
|
// If has delete hook, we will have to collect not just keys but also objects, so it will use
|
|
// more memory and need lower chunk size.
|
|
var CHUNKSIZE = hasDeleteHook ? 2000 : 10000;
|
|
return this._write(function (resolve, reject, idbstore, trans) {
|
|
var totalCount = 0;
|
|
// Clone collection and change its table and set a limit of CHUNKSIZE on the cloned Collection instance.
|
|
var collection = _this
|
|
.clone({
|
|
keysOnly: !ctx.isMatch && !hasDeleteHook
|
|
}) // load just keys (unless filter() or and() or deleteHook has subscribers)
|
|
.distinct() // In case multiEntry is used, never delete same key twice because resulting count
|
|
.limit(CHUNKSIZE)
|
|
.raw(); // Don't filter through reading-hooks (like mapped classes etc)
|
|
var keysOrTuples = [];
|
|
// We're gonna do things on as many chunks that are needed.
|
|
// Use recursion of nextChunk function:
|
|
var nextChunk = function () { return collection.each(hasDeleteHook ? function (val, cursor) {
|
|
// Somebody subscribes to hook('deleting'). Collect all primary keys and their values,
|
|
// so that the hook can be called with its values in bulkDelete().
|
|
keysOrTuples.push([cursor.primaryKey, cursor.value]);
|
|
} : function (val, cursor) {
|
|
// No one subscribes to hook('deleting'). Collect only primary keys:
|
|
keysOrTuples.push(cursor.primaryKey);
|
|
}).then(function () {
|
|
// Chromium deletes faster when doing it in sort order.
|
|
hasDeleteHook ?
|
|
keysOrTuples.sort(function (a, b) { return ascending(a[0], b[0]); }) :
|
|
keysOrTuples.sort(ascending);
|
|
return bulkDelete(idbstore, trans, keysOrTuples, hasDeleteHook, deletingHook);
|
|
}).then(function () {
|
|
var count = keysOrTuples.length;
|
|
totalCount += count;
|
|
keysOrTuples = [];
|
|
return count < CHUNKSIZE ? totalCount : nextChunk();
|
|
}); };
|
|
resolve(nextChunk());
|
|
});
|
|
}
|
|
};
|
|
});
|
|
//
|
|
//
|
|
//
|
|
// ------------------------- Help functions ---------------------------
|
|
//
|
|
//
|
|
//
|
|
function lowerVersionFirst(a, b) {
|
|
return a._cfg.version - b._cfg.version;
|
|
}
|
|
function setApiOnPlace(objs, tableNames, dbschema) {
|
|
tableNames.forEach(function (tableName) {
|
|
var schema = dbschema[tableName];
|
|
objs.forEach(function (obj) {
|
|
if (!(tableName in obj)) {
|
|
if (obj === Transaction.prototype || obj instanceof Transaction) {
|
|
// obj is a Transaction prototype (or prototype of a subclass to Transaction)
|
|
// Make the API a getter that returns this.table(tableName)
|
|
setProp(obj, tableName, { get: function () { return this.table(tableName); } });
|
|
}
|
|
else {
|
|
// Table will not be bound to a transaction (will use Dexie.currentTransaction)
|
|
obj[tableName] = new Table(tableName, schema);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
}
|
|
function removeTablesApi(objs) {
|
|
objs.forEach(function (obj) {
|
|
for (var key in obj) {
|
|
if (obj[key] instanceof Table)
|
|
delete obj[key];
|
|
}
|
|
});
|
|
}
|
|
function iterate(req, filter, fn, resolve, reject, valueMapper) {
|
|
// Apply valueMapper (hook('reading') or mappped class)
|
|
var mappedFn = valueMapper ? function (x, c, a) { return fn(valueMapper(x), c, a); } : fn;
|
|
// Wrap fn with PSD and microtick stuff from Promise.
|
|
var wrappedFn = wrap(mappedFn, reject);
|
|
if (!req.onerror)
|
|
req.onerror = eventRejectHandler(reject);
|
|
if (filter) {
|
|
req.onsuccess = trycatcher(function filter_record() {
|
|
var cursor = req.result;
|
|
if (cursor) {
|
|
var c = function () { cursor.continue(); };
|
|
if (filter(cursor, function (advancer) { c = advancer; }, resolve, reject))
|
|
wrappedFn(cursor.value, cursor, function (advancer) { c = advancer; });
|
|
c();
|
|
}
|
|
else {
|
|
resolve();
|
|
}
|
|
}, reject);
|
|
}
|
|
else {
|
|
req.onsuccess = trycatcher(function filter_record() {
|
|
var cursor = req.result;
|
|
if (cursor) {
|
|
var c = function () { cursor.continue(); };
|
|
wrappedFn(cursor.value, cursor, function (advancer) { c = advancer; });
|
|
c();
|
|
}
|
|
else {
|
|
resolve();
|
|
}
|
|
}, reject);
|
|
}
|
|
}
|
|
function parseIndexSyntax(indexes) {
|
|
/// <param name="indexes" type="String"></param>
|
|
/// <returns type="Array" elementType="IndexSpec"></returns>
|
|
var rv = [];
|
|
indexes.split(',').forEach(function (index) {
|
|
index = index.trim();
|
|
var name = index.replace(/([&*]|\+\+)/g, ""); // Remove "&", "++" and "*"
|
|
// Let keyPath of "[a+b]" be ["a","b"]:
|
|
var keyPath = /^\[/.test(name) ? name.match(/^\[(.*)\]$/)[1].split('+') : name;
|
|
rv.push(new IndexSpec(name, keyPath || null, /\&/.test(index), /\*/.test(index), /\+\+/.test(index), isArray(keyPath), /\./.test(index)));
|
|
});
|
|
return rv;
|
|
}
|
|
function cmp(key1, key2) {
|
|
return indexedDB.cmp(key1, key2);
|
|
}
|
|
function min(a, b) {
|
|
return cmp(a, b) < 0 ? a : b;
|
|
}
|
|
function max(a, b) {
|
|
return cmp(a, b) > 0 ? a : b;
|
|
}
|
|
function ascending(a, b) {
|
|
return indexedDB.cmp(a, b);
|
|
}
|
|
function descending(a, b) {
|
|
return indexedDB.cmp(b, a);
|
|
}
|
|
function simpleCompare(a, b) {
|
|
return a < b ? -1 : a === b ? 0 : 1;
|
|
}
|
|
function simpleCompareReverse(a, b) {
|
|
return a > b ? -1 : a === b ? 0 : 1;
|
|
}
|
|
function combine(filter1, filter2) {
|
|
return filter1 ?
|
|
filter2 ?
|
|
function () { return filter1.apply(this, arguments) && filter2.apply(this, arguments); } :
|
|
filter1 :
|
|
filter2;
|
|
}
|
|
function readGlobalSchema() {
|
|
db.verno = idbdb.version / 10;
|
|
db._dbSchema = globalSchema = {};
|
|
dbStoreNames = slice(idbdb.objectStoreNames, 0);
|
|
if (dbStoreNames.length === 0)
|
|
return; // Database contains no stores.
|
|
var trans = idbdb.transaction(safariMultiStoreFix(dbStoreNames), 'readonly');
|
|
dbStoreNames.forEach(function (storeName) {
|
|
var store = trans.objectStore(storeName), keyPath = store.keyPath, dotted = keyPath && typeof keyPath === 'string' && keyPath.indexOf('.') !== -1;
|
|
var primKey = new IndexSpec(keyPath, keyPath || "", false, false, !!store.autoIncrement, keyPath && typeof keyPath !== 'string', dotted);
|
|
var indexes = [];
|
|
for (var j = 0; j < store.indexNames.length; ++j) {
|
|
var idbindex = store.index(store.indexNames[j]);
|
|
keyPath = idbindex.keyPath;
|
|
dotted = keyPath && typeof keyPath === 'string' && keyPath.indexOf('.') !== -1;
|
|
var index = new IndexSpec(idbindex.name, keyPath, !!idbindex.unique, !!idbindex.multiEntry, false, keyPath && typeof keyPath !== 'string', dotted);
|
|
indexes.push(index);
|
|
}
|
|
globalSchema[storeName] = new TableSchema(storeName, primKey, indexes, {});
|
|
});
|
|
setApiOnPlace([allTables], keys(globalSchema), globalSchema);
|
|
}
|
|
function adjustToExistingIndexNames(schema, idbtrans) {
|
|
/// <summary>
|
|
/// Issue #30 Problem with existing db - adjust to existing index names when migrating from non-dexie db
|
|
/// </summary>
|
|
/// <param name="schema" type="Object">Map between name and TableSchema</param>
|
|
/// <param name="idbtrans" type="IDBTransaction"></param>
|
|
var storeNames = idbtrans.db.objectStoreNames;
|
|
for (var i = 0; i < storeNames.length; ++i) {
|
|
var storeName = storeNames[i];
|
|
var store = idbtrans.objectStore(storeName);
|
|
hasGetAll = 'getAll' in store;
|
|
for (var j = 0; j < store.indexNames.length; ++j) {
|
|
var indexName = store.indexNames[j];
|
|
var keyPath = store.index(indexName).keyPath;
|
|
var dexieName = typeof keyPath === 'string' ? keyPath : "[" + slice(keyPath).join('+') + "]";
|
|
if (schema[storeName]) {
|
|
var indexSpec = schema[storeName].idxByName[dexieName];
|
|
if (indexSpec)
|
|
indexSpec.name = indexName;
|
|
}
|
|
}
|
|
}
|
|
// Bug with getAll() on Safari ver<604 on Workers only, see discussion following PR #579
|
|
if (/Safari/.test(navigator.userAgent) &&
|
|
!/(Chrome\/|Edge\/)/.test(navigator.userAgent) &&
|
|
_global.WorkerGlobalScope && _global instanceof _global.WorkerGlobalScope &&
|
|
[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1] < 604) {
|
|
hasGetAll = false;
|
|
}
|
|
}
|
|
function fireOnBlocked(ev) {
|
|
db.on("blocked").fire(ev);
|
|
// Workaround (not fully*) for missing "versionchange" event in IE,Edge and Safari:
|
|
connections
|
|
.filter(function (c) { return c.name === db.name && c !== db && !c._vcFired; })
|
|
.map(function (c) { return c.on("versionchange").fire(ev); });
|
|
}
|
|
extend(this, {
|
|
Collection: Collection,
|
|
Table: Table,
|
|
Transaction: Transaction,
|
|
Version: Version,
|
|
WhereClause: WhereClause
|
|
});
|
|
init();
|
|
addons.forEach(function (fn) {
|
|
fn(db);
|
|
});
|
|
}
|
|
function parseType(type) {
|
|
if (typeof type === 'function') {
|
|
return new type();
|
|
}
|
|
else if (isArray(type)) {
|
|
return [parseType(type[0])];
|
|
}
|
|
else if (type && typeof type === 'object') {
|
|
var rv = {};
|
|
applyStructure(rv, type);
|
|
return rv;
|
|
}
|
|
else {
|
|
return type;
|
|
}
|
|
}
|
|
function applyStructure(obj, structure) {
|
|
keys(structure).forEach(function (member) {
|
|
var value = parseType(structure[member]);
|
|
obj[member] = value;
|
|
});
|
|
return obj;
|
|
}
|
|
function hookedEventSuccessHandler(resolve) {
|
|
// wrap() is needed when calling hooks because the rare scenario of:
|
|
// * hook does a db operation that fails immediately (IDB throws exception)
|
|
// For calling db operations on correct transaction, wrap makes sure to set PSD correctly.
|
|
// wrap() will also execute in a virtual tick.
|
|
// * If not wrapped in a virtual tick, direct exception will launch a new physical tick.
|
|
// * If this was the last event in the bulk, the promise will resolve after a physical tick
|
|
// and the transaction will have committed already.
|
|
// If no hook, the virtual tick will be executed in the reject()/resolve of the final promise,
|
|
// because it is always marked with _lib = true when created using Transaction._promise().
|
|
return wrap(function (event) {
|
|
var req = event.target, ctx = req._hookCtx, // Contains the hook error handler. Put here instead of closure to boost performance.
|
|
result = ctx.value || req.result, // Pass the object value on updates. The result from IDB is the primary key.
|
|
hookSuccessHandler = ctx && ctx.onsuccess;
|
|
hookSuccessHandler && hookSuccessHandler(result);
|
|
resolve && resolve(result);
|
|
}, resolve);
|
|
}
|
|
function eventRejectHandler(reject) {
|
|
return wrap(function (event) {
|
|
preventDefault(event);
|
|
reject(event.target.error);
|
|
return false;
|
|
});
|
|
}
|
|
function eventSuccessHandler(resolve) {
|
|
return wrap(function (event) {
|
|
resolve(event.target.result);
|
|
});
|
|
}
|
|
function hookedEventRejectHandler(reject) {
|
|
return wrap(function (event) {
|
|
// See comment on hookedEventSuccessHandler() why wrap() is needed only when supporting hooks.
|
|
var req = event.target, err = req.error, ctx = req._hookCtx, // Contains the hook error handler. Put here instead of closure to boost performance.
|
|
hookErrorHandler = ctx && ctx.onerror;
|
|
hookErrorHandler && hookErrorHandler(err);
|
|
preventDefault(event);
|
|
reject(err);
|
|
return false;
|
|
});
|
|
}
|
|
function preventDefault(event) {
|
|
if (event.stopPropagation)
|
|
event.stopPropagation();
|
|
if (event.preventDefault)
|
|
event.preventDefault();
|
|
}
|
|
function awaitIterator(iterator) {
|
|
var callNext = function (result) { return iterator.next(result); }, doThrow = function (error) { return iterator.throw(error); }, onSuccess = step(callNext), onError = step(doThrow);
|
|
function step(getNext) {
|
|
return function (val) {
|
|
var next = getNext(val), value = next.value;
|
|
return next.done ? value :
|
|
(!value || typeof value.then !== 'function' ?
|
|
isArray(value) ? Promise.all(value).then(onSuccess, onError) : onSuccess(value) :
|
|
value.then(onSuccess, onError));
|
|
};
|
|
}
|
|
return step(callNext)();
|
|
}
|
|
//
|
|
// IndexSpec struct
|
|
//
|
|
function IndexSpec(name, keyPath, unique, multi, auto, compound, dotted) {
|
|
/// <param name="name" type="String"></param>
|
|
/// <param name="keyPath" type="String"></param>
|
|
/// <param name="unique" type="Boolean"></param>
|
|
/// <param name="multi" type="Boolean"></param>
|
|
/// <param name="auto" type="Boolean"></param>
|
|
/// <param name="compound" type="Boolean"></param>
|
|
/// <param name="dotted" type="Boolean"></param>
|
|
this.name = name;
|
|
this.keyPath = keyPath;
|
|
this.unique = unique;
|
|
this.multi = multi;
|
|
this.auto = auto;
|
|
this.compound = compound;
|
|
this.dotted = dotted;
|
|
var keyPathSrc = typeof keyPath === 'string' ? keyPath : keyPath && ('[' + [].join.call(keyPath, '+') + ']');
|
|
this.src = (unique ? '&' : '') + (multi ? '*' : '') + (auto ? "++" : "") + keyPathSrc;
|
|
}
|
|
//
|
|
// TableSchema struct
|
|
//
|
|
function TableSchema(name, primKey, indexes, instanceTemplate) {
|
|
/// <param name="name" type="String"></param>
|
|
/// <param name="primKey" type="IndexSpec"></param>
|
|
/// <param name="indexes" type="Array" elementType="IndexSpec"></param>
|
|
/// <param name="instanceTemplate" type="Object"></param>
|
|
this.name = name;
|
|
this.primKey = primKey || new IndexSpec();
|
|
this.indexes = indexes || [new IndexSpec()];
|
|
this.instanceTemplate = instanceTemplate;
|
|
this.mappedClass = null;
|
|
this.idxByName = arrayToObject(indexes, function (index) { return [index.name, index]; });
|
|
}
|
|
function safariMultiStoreFix(storeNames) {
|
|
return storeNames.length === 1 ? storeNames[0] : storeNames;
|
|
}
|
|
function getNativeGetDatabaseNamesFn(indexedDB) {
|
|
var fn = indexedDB && (indexedDB.getDatabaseNames || indexedDB.webkitGetDatabaseNames);
|
|
return fn && fn.bind(indexedDB);
|
|
}
|
|
// Export Error classes
|
|
props(Dexie, fullNameExceptions); // Dexie.XXXError = class XXXError {...};
|
|
//
|
|
// Static methods and properties
|
|
//
|
|
props(Dexie, {
|
|
//
|
|
// Static delete() method.
|
|
//
|
|
delete: function (databaseName) {
|
|
var db = new Dexie(databaseName), promise = db.delete();
|
|
promise.onblocked = function (fn) {
|
|
db.on("blocked", fn);
|
|
return this;
|
|
};
|
|
return promise;
|
|
},
|
|
//
|
|
// Static exists() method.
|
|
//
|
|
exists: function (name) {
|
|
return new Dexie(name).open().then(function (db) {
|
|
db.close();
|
|
return true;
|
|
}).catch(Dexie.NoSuchDatabaseError, function () { return false; });
|
|
},
|
|
//
|
|
// Static method for retrieving a list of all existing databases at current host.
|
|
//
|
|
getDatabaseNames: function (cb) {
|
|
var getDatabaseNames = getNativeGetDatabaseNamesFn(Dexie.dependencies.indexedDB);
|
|
return getDatabaseNames ? new Promise(function (resolve, reject) {
|
|
var req = getDatabaseNames();
|
|
req.onsuccess = function (event) {
|
|
resolve(slice(event.target.result, 0)); // Converst DOMStringList to Array<String>
|
|
};
|
|
req.onerror = eventRejectHandler(reject);
|
|
}).then(cb) : dbNamesDB.dbnames.toCollection().primaryKeys(cb);
|
|
},
|
|
defineClass: function () {
|
|
// Default constructor able to copy given properties into this object.
|
|
function Class(properties) {
|
|
/// <param name="properties" type="Object" optional="true">Properties to initialize object with.
|
|
/// </param>
|
|
if (properties)
|
|
extend(this, properties);
|
|
}
|
|
return Class;
|
|
},
|
|
applyStructure: applyStructure,
|
|
ignoreTransaction: function (scopeFunc) {
|
|
// In case caller is within a transaction but needs to create a separate transaction.
|
|
// Example of usage:
|
|
//
|
|
// Let's say we have a logger function in our app. Other application-logic should be unaware of the
|
|
// logger function and not need to include the 'logentries' table in all transaction it performs.
|
|
// The logging should always be done in a separate transaction and not be dependant on the current
|
|
// running transaction context. Then you could use Dexie.ignoreTransaction() to run code that starts a new transaction.
|
|
//
|
|
// Dexie.ignoreTransaction(function() {
|
|
// db.logentries.add(newLogEntry);
|
|
// });
|
|
//
|
|
// Unless using Dexie.ignoreTransaction(), the above example would try to reuse the current transaction
|
|
// in current Promise-scope.
|
|
//
|
|
// An alternative to Dexie.ignoreTransaction() would be setImmediate() or setTimeout(). The reason we still provide an
|
|
// API for this because
|
|
// 1) The intention of writing the statement could be unclear if using setImmediate() or setTimeout().
|
|
// 2) setTimeout() would wait unnescessary until firing. This is however not the case with setImmediate().
|
|
// 3) setImmediate() is not supported in the ES standard.
|
|
// 4) You might want to keep other PSD state that was set in a parent PSD, such as PSD.letThrough.
|
|
return PSD.trans ?
|
|
usePSD(PSD.transless, scopeFunc) : // Use the closest parent that was non-transactional.
|
|
scopeFunc(); // No need to change scope because there is no ongoing transaction.
|
|
},
|
|
vip: function (fn) {
|
|
// To be used by subscribers to the on('ready') event.
|
|
// This will let caller through to access DB even when it is blocked while the db.ready() subscribers are firing.
|
|
// This would have worked automatically if we were certain that the Provider was using Dexie.Promise for all asyncronic operations. The promise PSD
|
|
// from the provider.connect() call would then be derived all the way to when provider would call localDatabase.applyChanges(). But since
|
|
// the provider more likely is using non-promise async APIs or other thenable implementations, we cannot assume that.
|
|
// Note that this method is only useful for on('ready') subscribers that is returning a Promise from the event. If not using vip()
|
|
// the database could deadlock since it wont open until the returned Promise is resolved, and any non-VIPed operation started by
|
|
// the caller will not resolve until database is opened.
|
|
return newScope(function () {
|
|
PSD.letThrough = true; // Make sure we are let through if still blocking db due to onready is firing.
|
|
return fn();
|
|
});
|
|
},
|
|
async: function (generatorFn) {
|
|
return function () {
|
|
try {
|
|
var rv = awaitIterator(generatorFn.apply(this, arguments));
|
|
if (!rv || typeof rv.then !== 'function')
|
|
return Promise.resolve(rv);
|
|
return rv;
|
|
}
|
|
catch (e) {
|
|
return rejection(e);
|
|
}
|
|
};
|
|
},
|
|
spawn: function (generatorFn, args, thiz) {
|
|
try {
|
|
var rv = awaitIterator(generatorFn.apply(thiz, args || []));
|
|
if (!rv || typeof rv.then !== 'function')
|
|
return Promise.resolve(rv);
|
|
return rv;
|
|
}
|
|
catch (e) {
|
|
return rejection(e);
|
|
}
|
|
},
|
|
// Dexie.currentTransaction property
|
|
currentTransaction: {
|
|
get: function () { return PSD.trans || null; }
|
|
},
|
|
waitFor: function (promiseOrFunction, optionalTimeout) {
|
|
// If a function is provided, invoke it and pass the returning value to Transaction.waitFor()
|
|
var promise = Promise.resolve(typeof promiseOrFunction === 'function' ? Dexie.ignoreTransaction(promiseOrFunction) : promiseOrFunction)
|
|
.timeout(optionalTimeout || 60000); // Default the timeout to one minute. Caller may specify Infinity if required.
|
|
// Run given promise on current transaction. If no current transaction, just return a Dexie promise based
|
|
// on given value.
|
|
return PSD.trans ? PSD.trans.waitFor(promise) : promise;
|
|
},
|
|
// Export our Promise implementation since it can be handy as a standalone Promise implementation
|
|
Promise: Promise,
|
|
// Dexie.debug proptery:
|
|
// Dexie.debug = false
|
|
// Dexie.debug = true
|
|
// Dexie.debug = "dexie" - don't hide dexie's stack frames.
|
|
debug: {
|
|
get: function () { return debug; },
|
|
set: function (value) {
|
|
setDebug(value, value === 'dexie' ? function () { return true; } : dexieStackFrameFilter);
|
|
}
|
|
},
|
|
// Export our derive/extend/override methodology
|
|
derive: derive,
|
|
extend: extend,
|
|
props: props,
|
|
override: override,
|
|
// Export our Events() function - can be handy as a toolkit
|
|
Events: Events,
|
|
// Utilities
|
|
getByKeyPath: getByKeyPath,
|
|
setByKeyPath: setByKeyPath,
|
|
delByKeyPath: delByKeyPath,
|
|
shallowClone: shallowClone,
|
|
deepClone: deepClone,
|
|
getObjectDiff: getObjectDiff,
|
|
asap: asap,
|
|
maxKey: maxKey,
|
|
minKey: minKey,
|
|
// Addon registry
|
|
addons: [],
|
|
// Global DB connection list
|
|
connections: connections,
|
|
MultiModifyError: exceptions.Modify,
|
|
errnames: errnames,
|
|
// Export other static classes
|
|
IndexSpec: IndexSpec,
|
|
TableSchema: TableSchema,
|
|
//
|
|
// Dependencies
|
|
//
|
|
// These will automatically work in browsers with indexedDB support, or where an indexedDB polyfill has been included.
|
|
//
|
|
// In node.js, however, these properties must be set "manually" before instansiating a new Dexie().
|
|
// For node.js, you need to require indexeddb-js or similar and then set these deps.
|
|
//
|
|
dependencies: (function () {
|
|
try {
|
|
return {
|
|
// Required:
|
|
indexedDB: _global.indexedDB || _global.mozIndexedDB || _global.webkitIndexedDB || _global.msIndexedDB,
|
|
IDBKeyRange: _global.IDBKeyRange || _global.webkitIDBKeyRange
|
|
};
|
|
}
|
|
catch (e) {
|
|
return {
|
|
indexedDB: null,
|
|
IDBKeyRange: null
|
|
};
|
|
}
|
|
})(),
|
|
// API Version Number: Type Number, make sure to always set a version number that can be comparable correctly. Example: 0.9, 0.91, 0.92, 1.0, 1.01, 1.1, 1.2, 1.21, etc.
|
|
semVer: DEXIE_VERSION,
|
|
version: DEXIE_VERSION.split('.')
|
|
.map(function (n) { return parseInt(n); })
|
|
.reduce(function (p, c, i) { return p + (c / Math.pow(10, i * 2)); }),
|
|
// https://github.com/dfahlander/Dexie.js/issues/186
|
|
// typescript compiler tsc in mode ts-->es5 & commonJS, will expect require() to return
|
|
// x.default. Workaround: Set Dexie.default = Dexie.
|
|
default: Dexie,
|
|
// Make it possible to import {Dexie} (non-default import)
|
|
// Reason 1: May switch to that in future.
|
|
// Reason 2: We declare it both default and named exported in d.ts to make it possible
|
|
// to let addons extend the Dexie interface with Typescript 2.1 (works only when explicitely
|
|
// exporting the symbol, not just default exporting)
|
|
Dexie: Dexie
|
|
});
|
|
// Map DOMErrors and DOMExceptions to corresponding Dexie errors. May change in Dexie v2.0.
|
|
Promise.rejectionMapper = mapError;
|
|
// Initialize dbNamesDB (won't ever be opened on chromium browsers')
|
|
dbNamesDB = new Dexie('__dbnames');
|
|
dbNamesDB.version(1).stores({ dbnames: 'name' });
|
|
(function () {
|
|
// Migrate from Dexie 1.x database names stored in localStorage:
|
|
var DBNAMES = 'Dexie.DatabaseNames';
|
|
try {
|
|
if (typeof localStorage !== undefined && _global.document !== undefined) {
|
|
// Have localStorage and is not executing in a worker. Lets migrate from Dexie 1.x.
|
|
JSON.parse(localStorage.getItem(DBNAMES) || "[]")
|
|
.forEach(function (name) { return dbNamesDB.dbnames.put({ name: name }).catch(nop); });
|
|
localStorage.removeItem(DBNAMES);
|
|
}
|
|
}
|
|
catch (_e) { }
|
|
})();
|
|
|
|
return Dexie;
|
|
|
|
})));
|
|
//# sourceMappingURL=dexie.js.map
|
|
|
|
|
|
// Create own MDisDB to use it later
|
|
window.ADisDB = new Dexie('LSS_AutomaticDispo');
|
|
var ADisDB = window.ADisDB;
|
|
ADisDB.version(1).stores({
|
|
/**
|
|
* AvailabelMissions
|
|
* - missionID
|
|
* - type
|
|
* - name
|
|
* - jsondata
|
|
*/
|
|
ADisAvailabelMissions: "++missionID,type,name",
|
|
/**
|
|
* Sprechwunsch
|
|
* - vehicleID
|
|
* - done
|
|
*/
|
|
ADisSprechwunsch: "++vehicleID,done",
|
|
/**
|
|
* Sprechwunsch Police
|
|
* - missionID
|
|
* - done
|
|
*/
|
|
ADisSprechwunschPolice: "++missionID,last_check,next_check,done",
|
|
/**
|
|
* Krankentransport
|
|
* - missionID
|
|
* - done
|
|
*/
|
|
ADisKrankentransport: "++missionID,last_check,next_check,done",
|
|
/**
|
|
* Settings
|
|
* - id
|
|
* - name
|
|
* - done
|
|
*/
|
|
ADisSettings: "&name,value",
|
|
/**
|
|
* MissionsOwn
|
|
* MissionsVerband
|
|
* MissionsVerbandEvent
|
|
* - missionID
|
|
* - type
|
|
* - name
|
|
* - available
|
|
* - done
|
|
* - street
|
|
* - village
|
|
* - last_check
|
|
* - next_check
|
|
*/
|
|
ADisMissionsOwn: "++missionID,type,name,last_check,next_check,available,done",
|
|
ADisMissionsVerband: "++missionID,type,name,last_check,next_check,available,done",
|
|
ADisMissionsVerbandEvent: "++missionID,type,name,last_check,next_check,available,done",
|
|
});
|
|
ADisDB.on("populate", function() {
|
|
ADisDB.ADisSettings.add({name: "Krankentransport-Automatic", value: 'true'});
|
|
ADisDB.ADisSettings.add({name: "Sprechwunsch-Automatic", value: 'true'});
|
|
ADisDB.ADisSettings.add({name: "MissionsOwn-Automatic", value: 'true'});
|
|
ADisDB.ADisSettings.add({name: "Alliance-Automatic", value: 'false'});
|
|
ADisDB.ADisSettings.add({name: "AllianceEvent-Automatic", value: 'false'});
|
|
});
|
|
ADisDB.open().catch(function (err) {
|
|
console.error(err.stack || err);
|
|
});
|
|
|
|
ADisDB.on("ready", () => {
|
|
|
|
//console.log(ADisDB);
|
|
//console.log(ADisSettings('Krankentransport-Automatic'));
|
|
|
|
// -
|
|
// - Google Font
|
|
// -
|
|
|
|
var styleElement = document.createElement("link");
|
|
styleElement.rel = "stylesheet";
|
|
styleElement.href = "https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700";
|
|
ADis_MyHead.appendChild(styleElement);
|
|
|
|
// -
|
|
// - FontAwesome 5
|
|
// -
|
|
|
|
var scriptElement = document.createElement("script");
|
|
scriptElement.type = "text/javascript";
|
|
scriptElement.src = "https://use.fontawesome.com/releases/v5.5.0/js/all.js";
|
|
ADis_MyHead.appendChild(scriptElement);
|
|
|
|
// -
|
|
// - Navbar Dashboard
|
|
// -
|
|
|
|
if (window.location.pathname === "/" || window.location.pathname === "/#") {
|
|
$(document).ready(function () {
|
|
ADis_CreateDashboard();
|
|
ADis_CreateIframes();
|
|
|
|
console.log(" Automatic Dispose: UI geladen");
|
|
});
|
|
|
|
function ADis_CreateDashboard() {
|
|
$('#news_li').before('<li id="adis-nav-item"></li>');
|
|
$('#adis-nav-item').load(AutomaticDispose_URL + AutomaticDispose_Branch + "/html/navbar.html", function () {
|
|
$("#adis-dashboard").css({
|
|
display: "none",
|
|
opacity: "0"
|
|
});
|
|
});
|
|
}
|
|
|
|
function ADis_CreateIframes() {
|
|
$("body").append('<div id="adis-frame-container"></div>');
|
|
$("#adis-frame-container").load(AutomaticDispose_URL + AutomaticDispose_Branch + "/html/iframes.html");
|
|
|
|
$("#adis-frame-container").css({
|
|
display: "none",
|
|
opacity: "0"
|
|
});
|
|
}
|
|
var styleElement = document.createElement("link");
|
|
styleElement.rel = "stylesheet";
|
|
styleElement.type = "text/css";
|
|
styleElement.media = "screen";
|
|
styleElement.href = AutomaticDispose_URL + AutomaticDispose_Branch + "/style/interface.css";
|
|
ADis_MyHead.appendChild(styleElement);
|
|
}
|
|
|
|
// -
|
|
// - Load Automatic Modes
|
|
// - Load Opener
|
|
// -
|
|
|
|
function ADis_UpdateOwnMissionsToDone(MissionID, updateData) {
|
|
if (typeof updateData != 'undefined') {
|
|
return ADisDB.ADisMissionsOwn.put({
|
|
missionID: MissionID
|
|
}, updateData).catch((err) => {})
|
|
}
|
|
return ADisDB.ADisMissionsOwn.put({
|
|
missionID: MissionID,
|
|
done: 'true'
|
|
}).catch((err) => {})
|
|
}
|
|
|
|
// -
|
|
// - Mission Variablen
|
|
// -
|
|
var MissionID;
|
|
var MissionType;
|
|
var MissionConfig;
|
|
var CurrentTime;
|
|
var MaxVehicleID = 86;
|
|
var OwnMissionsFrameWatchDog;
|
|
var KrankentransportFrameWatchDog;
|
|
var VerbandMissionFrameWatchDog;
|
|
var VerbandEventsFrameWatchDog;
|
|
var PlannedEventsFrameWatchDog;
|
|
|
|
window.ADis_MissionDone = function ADis_MissionDone(WindowName) {
|
|
if (['adis-krankentransporte'].indexOf(WindowName) !== -1) {
|
|
$("#adis-krankentransporte-frame").attr("src", "");
|
|
$("#adis-krankentransporte-frame").attr("mission_id", "empty");
|
|
clearTimeout(KrankentransportFrameWatchDog);
|
|
} else if (['adis-plannedevents'].indexOf(WindowName) !== -1) {
|
|
$("#adis-plannedevents-frame").attr("src", "");
|
|
$("#adis-plannedevents-frame").attr("mission_id", "empty");
|
|
clearTimeout(PlannedEventsFrameWatchDog);
|
|
} else if (['adis-ownmissions'].indexOf(WindowName) !== -1) {
|
|
$("#adis-ownmissions-frame").attr("src", "");
|
|
$("#adis-ownmissions-frame").attr("mission_id", "empty");
|
|
clearTimeout(OwnMissionsFrameWatchDog);
|
|
} else if (['adis-verbandmission'].indexOf(WindowName) !== -1) {
|
|
$("#adis-verbandmission-frame").attr("src", "");
|
|
$("#adis-verbandmission-frame").attr("mission_id", "empty");
|
|
clearTimeout(VerbandMissionFrameWatchDog);
|
|
} else if (['adis-verbandmission-event'].indexOf(WindowName) !== -1) {
|
|
$("#adis-verbandmission-event-frame").attr("src", "");
|
|
$("#adis-verbandmission-event-frame").attr("mission_id", "empty");
|
|
clearTimeout(VerbandEventsFrameWatchDog);
|
|
}
|
|
}
|
|
window.ADis_MissionUpdateDone = function ADis_MissionUpdateDone(WindowName, MissionID) {
|
|
if (['adis-krankentransporte'].indexOf(WindowName) !== -1) {
|
|
clearTimeout(KrankentransportFrameWatchDog);
|
|
ADis_UpdateKrankentransportToDone(MissionID).then(()=>{
|
|
$("#adis-krankentransporte-frame").attr("src", "");
|
|
$("#adis-krankentransporte-frame").attr("mission_id", "empty");
|
|
});
|
|
} else if (['adis-plannedevents'].indexOf(WindowName) !== -1) {
|
|
$("#adis-plannedevents-frame").attr("src", "");
|
|
$("#adis-plannedevents-frame").attr("mission_id", "empty");
|
|
clearTimeout(PlannedEventsFrameWatchDog);
|
|
} else if (['adis-ownmissions'].indexOf(WindowName) !== -1) {
|
|
$("#adis-ownmissions-frame").attr("src", "");
|
|
$("#adis-ownmissions-frame").attr("mission_id", "empty");
|
|
clearTimeout(OwnMissionsFrameWatchDog);
|
|
} else if (['adis-verbandmission'].indexOf(WindowName) !== -1) {
|
|
$("#adis-verbandmission-frame").attr("src", "");
|
|
$("#adis-verbandmission-frame").attr("mission_id", "empty");
|
|
clearTimeout(VerbandMissionFrameWatchDog);
|
|
} else if (['adis-verbandmission-event'].indexOf(WindowName) !== -1) {
|
|
$("#adis-verbandmission-event-frame").attr("src", "");
|
|
$("#adis-verbandmission-event-frame").attr("mission_id", "empty");
|
|
clearTimeout(VerbandEventsFrameWatchDog);
|
|
}
|
|
}
|
|
|
|
window.ADis_MissionUpdate = function ADis_MissionUpdate(WindowName, UpdateData) {
|
|
if (['adis-krankentransporte'].indexOf(WindowName) !== -1) {
|
|
ADis_UpdateKrankentransport(UpdateData);
|
|
} else if (['adis-plannedevents'].indexOf(WindowName) !== -1) {
|
|
ADis_UpdatePlannedEvents(UpdateData);
|
|
} else if (['adis-ownmissions'].indexOf(WindowName) !== -1) {
|
|
ADis_UpdateOwnMissions(UpdateData);
|
|
} else if (['adis-verbandmission'].indexOf(WindowName) !== -1) {
|
|
ADis_UpdateVerbandMissions(UpdateData);
|
|
} else if (['adis-verbandmission-event'].indexOf(WindowName) !== -1) {
|
|
ADis_UpdateVerbandEvents(UpdateData);
|
|
}
|
|
}
|
|
|
|
|
|
window.ADis_MissionDelete = function ADis_MissionDelete(WindowName, MissionID) {
|
|
if (['adis-krankentransporte'].indexOf(WindowName) !== -1) {
|
|
ADis_RemoveKrankentransportFromQueue(MissionID);
|
|
} else if (['adis-plannedevents'].indexOf(WindowName) !== -1) {
|
|
ADis_RemovePlannedEventsFromQueue(MissionID);
|
|
} else if (['adis-ownmissions'].indexOf(WindowName) !== -1) {
|
|
ADis_RemoveOwnMissionsFromQueue(MissionID);
|
|
} else if (['adis-verbandmission'].indexOf(WindowName) !== -1) {
|
|
ADis_RemoveVerbandMissionsFromQueue(MissionID);
|
|
} else if (['adis-verbandmission-event'].indexOf(WindowName) !== -1) {
|
|
ADis_RemoveVerbandEventsFromQueue(MissionID);
|
|
}
|
|
}
|
|
|
|
// -
|
|
// - Mission Opener
|
|
// -
|
|
if (window.location.pathname === "/" || window.location.pathname === "/#") {
|
|
$(document).ready(function () {
|
|
console.log("Manager load");
|
|
//setInterval(ADis_GetAvailableMissions, 600000); // update availabla missions every 10 minutes
|
|
ADis_GetAvailableMissions(); // get availabla missions after page ready
|
|
});
|
|
|
|
|
|
// - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
|
// -
|
|
// - Grab Mission-Configuration from GitHub
|
|
// -
|
|
// - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
|
|
|
function ADis_GetAvailableMissions() {
|
|
// Get all available missions with there config
|
|
//$.getJSON(AutomaticDispose_URL + AutomaticDispose_Branch + "/all_missions.json", function (Response) {
|
|
for (let i in ADis_AllMissions) {
|
|
Mission = ADis_AllMissions[i];
|
|
ADis_AddAvailableMissions(Mission);
|
|
}
|
|
//});
|
|
}
|
|
|
|
function ADis_CollectMissions() {
|
|
return ADisDB.transaction('rw', [ADisDB.ADisMissionsOwn, ADisDB.ADisSettings, ADisDB.ADisAvailabelMissions], () => {
|
|
ADisSettings().then((setting) => {
|
|
if (setting['MissionsOwn-Automatic'] == 'true') {
|
|
return ADisDB.ADisMissionsOwn.where({
|
|
done: 'false'
|
|
}).limit(1)
|
|
}
|
|
}).then((Missions) => {
|
|
if (Missions === undefined) {
|
|
return;
|
|
}
|
|
return Missions.count(function (count) {
|
|
if (count > 0) {
|
|
return Missions.each(async (Mission) => {
|
|
return await ADisDB.ADisAvailabelMissions.get({
|
|
type: Mission.type
|
|
}).then((available) => {
|
|
if (available == undefined) {
|
|
ADis_RemoveMissionFromQueue(Mission.missionID);
|
|
}
|
|
}).then(() => {
|
|
if ($("#mission_" + Mission.missionID).length == 0) {
|
|
return ADis_RemoveMissionFromQueue(Mission.missionID);
|
|
|
|
}
|
|
}).then(() => {
|
|
|
|
if ($("#mission_" + Mission.missionID).css("display") == "none") {
|
|
return ADis_RemoveMissionFromQueue(Mission.missionID);
|
|
|
|
}
|
|
}).then(() => {
|
|
|
|
$("#mission_" + Mission.id).animate({
|
|
opacity: 0.5
|
|
}, 500);
|
|
});
|
|
});
|
|
}
|
|
})
|
|
}).then(() => {
|
|
$("#mission_list").find(".missionSideBarEntry").each(async function () {
|
|
var MissionID = $(this).attr("mission_id");
|
|
// var MissionType = $(this).attr("mission_type_id");
|
|
// var MissionName = $(this).find(".map_position_mover").text();
|
|
|
|
// - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
|
// - Emergency Missions | Automatic
|
|
// - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
|
await ADis_AddMission(MissionID);
|
|
|
|
});
|
|
});
|
|
});
|
|
}
|
|
|
|
function ADis_AddMission(ID) {
|
|
return ADisSettings().then((setting) => {
|
|
if (setting['MissionsOwn-Automatic'] == 'true') {
|
|
return ADisDB.ADisMissionsOwn.where({
|
|
missionID: ID
|
|
}).limit(1)
|
|
}
|
|
}).then((Missions) => {
|
|
if (Missions === undefined) {
|
|
return;
|
|
}
|
|
return Missions.count(function (count) {
|
|
if (count > 0) {
|
|
return Missions.each((Mission) => {
|
|
var MissionElement = $("#mission_" + ID);
|
|
|
|
var MissionID = MissionElement.attr("mission_id");
|
|
var MissionType = MissionElement.attr("mission_type_id");
|
|
var addr = MissionElement.find(".map_position_mover").text().split(",")
|
|
var MissionName = addr[0];
|
|
var MissionStreet = addr[1];
|
|
var MissionVillage = addr[2];
|
|
|
|
return ADisDB.ADisAvailabelMissions.get({
|
|
type: MissionType
|
|
}).then((available) => {
|
|
return ADis_AddMissionToQueue({
|
|
"id": MissionID,
|
|
"type": MissionType,
|
|
"name": MissionName,
|
|
"street": MissionStreet,
|
|
"village": MissionVillage,
|
|
"available": (available !== undefined),
|
|
"done": false,
|
|
"last_check": Math.floor(new Date().getTime() / 1000),
|
|
"next_check": Math.floor(new Date().getTime() / 1000) + 1
|
|
});
|
|
});
|
|
});
|
|
} else {
|
|
var MissionElement = $("#mission_" + ID);
|
|
|
|
var MissionID = MissionElement.attr("mission_id");
|
|
var MissionType = MissionElement.attr("mission_type_id");
|
|
var addr = MissionElement.find(".map_position_mover").text().split(",")
|
|
var MissionName = addr[0];
|
|
var MissionStreet = addr[1];
|
|
var MissionVillage = addr[2];
|
|
|
|
return ADisDB.ADisAvailabelMissions.get({
|
|
type: MissionType
|
|
}).then((available) => {
|
|
return ADis_AddMissionToQueue({
|
|
"id": MissionID,
|
|
"type": MissionType,
|
|
"name": MissionName,
|
|
"street": MissionStreet,
|
|
"village": MissionVillage,
|
|
"available": (available !== undefined),
|
|
"done": false,
|
|
"last_check": Math.floor(new Date().getTime() / 1000),
|
|
"next_check": Math.floor(new Date().getTime() / 1000) + 1
|
|
});
|
|
});
|
|
}
|
|
});
|
|
});
|
|
|
|
}
|
|
|
|
function ADis_AddAvailableMissions(Mission) {
|
|
return ADisDB.ADisAvailabelMissions.put({
|
|
missionID: Mission.id,
|
|
type: Mission.type,
|
|
name: Mission.name,
|
|
jsondata: Mission
|
|
}).catch((err) => {
|
|
console.error(err)
|
|
})
|
|
}
|
|
|
|
function ADis_AddMissionToQueue(Mission) {
|
|
return ADisDB.ADisMissionsOwn.put({
|
|
missionID: Mission.id,
|
|
type: Mission.type,
|
|
name: Mission.name,
|
|
available: Mission.available ? 'true' : 'false',
|
|
done: Mission.done ? 'true' : 'false',
|
|
street: Mission.street,
|
|
village: Mission.village,
|
|
last_check: Mission.last_check,
|
|
next_check: Mission.next_check
|
|
}).catch((err) => {
|
|
console.error(err)
|
|
});
|
|
}
|
|
|
|
function ADis_RemoveMissionFromQueue(MissionID) {
|
|
return ADisDB.ADisMissionsOwn.where({
|
|
missionID: MissionID
|
|
}).delete();
|
|
}
|
|
// - =require mission/opener.js
|
|
$(document).ready(function () {
|
|
setTimeout(ADis_OpenNextOwnMissions, 5000);
|
|
setTimeout(ADis_CollectOwnMissions, 500);
|
|
});
|
|
|
|
// - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
|
// -
|
|
// - Collect Own Missions
|
|
// -
|
|
// - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
|
|
|
function ADis_CollectOwnMissions() {
|
|
|
|
var observer2 = new MutationObserver(function (mutations) {
|
|
if (mutations[0].type == "childList") {
|
|
if (mutations[0].addedNodes.length >= 1) {
|
|
// do it here
|
|
for (var i = 0; i < mutations[0].addedNodes.length; i++)
|
|
ADis_ReadAndAddOwnMissions(mutations[0].addedNodes[i].attributes.getNamedItem("mission_id").value)
|
|
}
|
|
} else {
|
|
console.log("DEBUG OwnMissions", mutations);
|
|
}
|
|
});
|
|
|
|
// Notify new alerts
|
|
var targetNode2 = document.getElementById("mission_list");
|
|
observer2.observe(targetNode2, {
|
|
attributes: false,
|
|
//attributeFilter: ['class'],
|
|
//attributeOldValue: true,
|
|
characterData: false,
|
|
characterDataOldValue: false,
|
|
childList: true,
|
|
subtree: false
|
|
});
|
|
|
|
ADis_ReadAndAddOwnMissions();
|
|
}
|
|
|
|
function ADis_ReadAndAddOwnMissions(MissionID) {
|
|
if (typeof MissionID != "undefined") {
|
|
ADis_AddOwnMissionsToQueue(MissionID);
|
|
} else {
|
|
$("#mission_list").find(".missionSideBarEntry").each(function () {
|
|
MissionID = $(this).attr("mission_id");
|
|
|
|
// - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
|
// -
|
|
// - Ambulance Service | Full-Automatic
|
|
// - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
|
|
|
ADis_AddOwnMissionsToQueue(MissionID);
|
|
});
|
|
}
|
|
}
|
|
|
|
function ADis_OpenNextOwnMissions() {
|
|
ADisSettings().then((setting) => {
|
|
if (setting['MissionsOwn-Automatic'] == 'true') {
|
|
return ADisDB.ADisMissionsOwn.where({
|
|
done: 'false'
|
|
}).and(function (item) {
|
|
return item.next_check <= Math.floor(new Date().getTime() / 1000)
|
|
}).limit(1)
|
|
}
|
|
}).then((Wunsch) => {
|
|
if (Wunsch !== undefined) {
|
|
return Wunsch.count(function (count) {
|
|
if (count > 0) {
|
|
return Wunsch.each((myWunsch) => {
|
|
let MissionID = myWunsch.missionID;
|
|
myWunsch.next_check = Math.floor(new Date().getTime() / 1000) + 300;
|
|
|
|
return ADis_UpdateOwnMissions(myWunsch).then(() => {
|
|
if ($("#adis-ownmissions-frame").attr("mission_id") == "empty") {
|
|
$("#adis-ownmissions-frame").attr("src", "https://www.leitstellenspiel.de/missions/" + MissionID);
|
|
$("#adis-ownmissions-frame").attr("mission_id", MissionID);
|
|
|
|
OwnMissionsFrameWatchDog = setTimeout(async function () {
|
|
ADis_RemoveOwnMissionsFromQueue(MissionID).then((deleteCount) => {
|
|
// TODO: tellParent("ADisMissionDone(" + window.name + "," + MissionID + ");");
|
|
$("#adis-ownmissions-frame").attr("src", "");
|
|
$("#adis-ownmissions-frame").attr("mission_id", "empty");
|
|
setTimeout(ADis_OpenNextOwnMissions, 1000);
|
|
});
|
|
}, 5000);
|
|
}
|
|
});
|
|
});
|
|
}
|
|
return setTimeout(ADis_OpenNextOwnMissions, 5000);
|
|
});
|
|
}
|
|
return setTimeout(ADis_OpenNextOwnMissions, 5000);
|
|
});
|
|
}
|
|
|
|
|
|
window.ADis_AddOwnMissionsToQueue = function ADis_AddOwnMissionsToQueue(MissionID) {
|
|
return ADisDB.ADisMissionsOwn.add({
|
|
missionID: MissionID,
|
|
done: 'false'
|
|
}).catch((err) => {})
|
|
}
|
|
|
|
window.ADis_UpdateOwnMissions = function ADis_UpdateOwnMissions(Mission) {
|
|
return ADisDB.ADisMissionsOwn.put(Mission).catch((err) => {})
|
|
}
|
|
|
|
window.ADis_UpdateOwnMissionsToDone = function ADis_UpdateOwnMissionsToDone(MissionID) {
|
|
return ADisDB.ADisMissionsOwn.update(MissionID, {
|
|
missionID: MissionID,
|
|
done: 'true'
|
|
}).catch((err) => {})
|
|
}
|
|
|
|
window.ADis_RemoveOwnMissionsFromQueue = function ADis_RemoveOwnMissionsFromQueue(MissionID) {
|
|
return ADisDB.ADisMissionsOwn.where({
|
|
missionID: MissionID
|
|
}).delete();
|
|
}
|
|
$(document).ready(function () {
|
|
console.log('Krankentransporte geladen!');
|
|
setTimeout(ADis_OpenNextKrankentransporte, 5000);
|
|
setTimeout(ADis_CollectKrankentransporte, 500);
|
|
});
|
|
|
|
// - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
|
// -
|
|
// - Collect Krankentransporte
|
|
// -
|
|
// - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
|
|
|
function ADis_CollectKrankentransporte() {
|
|
|
|
var observer2 = new MutationObserver(function (mutations) {
|
|
if (mutations[0].type == "childList") {
|
|
if (mutations[0].addedNodes.length >= 1) {
|
|
// do it here
|
|
for (var i = 0; i < mutations[0].addedNodes.length; i++)
|
|
ADis_ReadAndAddKrankentransporte(mutations[0].addedNodes[i].attributes.getNamedItem("mission_id").value)
|
|
}
|
|
} else {
|
|
console.log("DEBUG Krankentransporte", mutations);
|
|
}
|
|
});
|
|
|
|
// Notify new alerts
|
|
var targetNode2 = document.getElementById("mission_list_krankentransporte");
|
|
observer2.observe(targetNode2, {
|
|
attributes: false,
|
|
//attributeFilter: ['class'],
|
|
//attributeOldValue: true,
|
|
characterData: false,
|
|
characterDataOldValue: false,
|
|
childList: true,
|
|
subtree: false
|
|
});
|
|
|
|
ADis_ReadAndAddKrankentransporte();
|
|
}
|
|
|
|
function ADis_ReadAndAddKrankentransporte(MissionID) {
|
|
if (typeof MissionID != "undefined") {
|
|
ADis_AddKrankentransportToQueue(MissionID);
|
|
} else {
|
|
$("#mission_list_krankentransporte").find(".missionSideBarEntry").each(function () {
|
|
MissionID = $(this).attr("mission_id");
|
|
|
|
// - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
|
// -
|
|
// - Ambulance Service | Full-Automatic
|
|
// - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
|
|
|
ADis_AddKrankentransportToQueue(MissionID);
|
|
});
|
|
}
|
|
}
|
|
|
|
function ADis_OpenNextKrankentransporte() {
|
|
return ADisDB.transaction('rw', [ADisDB.ADisKrankentransport, ADisDB.ADisSettings, ADisDB.ADisAvailabelMissions], () => {
|
|
ADisSettings().then((setting) => {
|
|
if (setting['Krankentransport-Automatic'] == 'true') {
|
|
return ADisDB.ADisKrankentransport.where({
|
|
done: 'false'
|
|
}).and(function (item) {
|
|
return item.next_check <= Math.floor(new Date().getTime() / 1000)
|
|
}).limit(1)
|
|
}
|
|
}).then((Wunsch) => {
|
|
if (Wunsch !== undefined) {
|
|
return Wunsch.count(function (count) {
|
|
if (count > 0) {
|
|
return Wunsch.each((myWunsch) => {
|
|
let MissionID = myWunsch.missionID;
|
|
myWunsch.last_check = Math.floor(new Date().getTime() / 1000);
|
|
myWunsch.next_check = Math.floor(new Date().getTime() / 1000) + 300;
|
|
return ADis_UpdateKrankentransport(myWunsch).then(() => {
|
|
if ($("#adis-krankentransporte-frame").attr("mission_id") == "empty") {
|
|
$("#adis-krankentransporte-frame").attr("src", "https://www.leitstellenspiel.de/missions/" + MissionID);
|
|
$("#adis-krankentransporte-frame").attr("mission_id", MissionID);
|
|
|
|
KrankentransportFrameWatchDog = setTimeout(async function () {
|
|
$("#adis-krankentransporte-frame").attr("src", "");
|
|
$("#adis-krankentransporte-frame").attr("mission_id", "empty");
|
|
setTimeout(ADis_OpenNextKrankentransporte, 1000);
|
|
}, 3500);
|
|
}
|
|
});
|
|
});
|
|
}
|
|
return setTimeout(ADis_OpenNextKrankentransporte, 5000);
|
|
});
|
|
}
|
|
return setTimeout(ADis_OpenNextKrankentransporte, 5000);
|
|
});
|
|
});
|
|
}
|
|
|
|
|
|
window.ADis_AddKrankentransportToQueue = function ADis_AddKrankentransportToQueue(MissionID) {
|
|
return ADisDB.ADisKrankentransport.put({
|
|
missionID: MissionID,
|
|
last_check: Math.floor(new Date().getTime() / 1000),
|
|
next_check: Math.floor(new Date().getTime() / 1000) + 1,
|
|
done: 'false'
|
|
}).catch((err) => {
|
|
console.error(err)
|
|
});
|
|
}
|
|
|
|
window.ADis_UpdateKrankentransport = function ADis_UpdateKrankentransport(Mission) {
|
|
return ADisDB.ADisKrankentransport.put(Mission).catch((err) => {
|
|
console.error(err)
|
|
})
|
|
}
|
|
|
|
window.ADis_UpdateKrankentransportToDone = function ADis_UpdateKrankentransportToDone(MissionID) {
|
|
return ADisDB.ADisKrankentransport.update(MissionID, {
|
|
missionID: MissionID,
|
|
done: 'true'
|
|
}).catch((err) => {
|
|
console.error(err)
|
|
});
|
|
}
|
|
|
|
window.ADis_RemoveKrankentransportFromQueue = function ADis_RemoveKrankentransportFromQueue(MissionID) {
|
|
return ADisDB.ADisKrankentransport.where({
|
|
missionID: MissionID
|
|
}).delete();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// -
|
|
// - Mission Alert
|
|
// -
|
|
if (window.location.pathname.indexOf("/missions/") !== -1 && ['adis-krankentransporte', 'adis-ownmissions', 'adis-verbandmission', 'adis-verbandmission-event'].indexOf(window.name) !== -1) {
|
|
console.log('load Mission Handler');
|
|
$(document).ready(function () {
|
|
setTimeout(function () {
|
|
MissionID = document.location.pathname.substr(document.location.pathname.lastIndexOf("/") + 1);
|
|
var help_el = $('a#mission_help');
|
|
if (help_el.length > 0) {
|
|
MissionType = help_el[0].href.split("?")[0];
|
|
var re = /\d+$/i;
|
|
var found = MissionType.match(re);
|
|
MissionType = Number(found[0]);
|
|
}
|
|
CurrentTime = Math.floor(new Date().getTime() / 1000);
|
|
console.log("MissionID", MissionID);
|
|
console.log("MissionType", MissionType);
|
|
console.log("CurrentTime", CurrentTime);
|
|
if (MissionType !== null) {
|
|
if (includesString($('#iframe-inside-container > div.alert.fade.in.alert-success').text(), "wurde erfolgreich informiert") || $('#vehicle_show_table_all input[type="checkbox"]:checked').size() > 0) {
|
|
return ADis_MissionUpdateDone(MissionID);; // update Mission here as updated or full
|
|
}
|
|
setTimeout(function () {
|
|
if (['adis-ownmissions', 'adis-krankentransporte'].indexOf(window.name) != -1) {
|
|
ADis_CheckMissionAutomatic();
|
|
} else if (['adis-verbandmission','adis-verbandmission-event'].indexOf(window.name) != -1) {
|
|
ADis_WorkVerbandMission();
|
|
}
|
|
}, 400);
|
|
} else {
|
|
if (includesString($('#iframe-inside-container > div.missionNotFound > div.missionNotFoundText').text(),'Der Einsatz wurde erfolgreich abgeschlossen.')) {
|
|
return ADis_MissionDelete(MissionID); // delete Mission here as completed
|
|
}
|
|
}
|
|
}, 250);
|
|
});
|
|
|
|
// - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
|
// -
|
|
// - Grab Run Verbands Missions
|
|
// -
|
|
// - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
|
|
|
function ADis_WorkVerbandMission() {
|
|
ADisSettings().then((setting) => {
|
|
var title = document.getElementById('missionH1');
|
|
var isVerband = title.innerText.toLowerCase().includes("[verband]");
|
|
if (setting['Alliance-Automatic'] == 'true' && isVerband) {
|
|
if ([52,55,129,203].indexOf(MissionType) !== -1 && $('#vehicle_show_table_all tr[vehicle_type="FuStW"] input[type="checkbox"]').size() > 0) {
|
|
$('#vehicle_show_table_all tr[vehicle_type="FuStW"] input[type="checkbox"]')[0].click();
|
|
} else if ([53,130,202].indexOf(MissionType) !== -1){
|
|
if ($('#vehicle_show_table_all tr[vehicle_type="FLF"] input[type="checkbox"]').size() > 0) {
|
|
$('#vehicle_show_table_all tr[vehicle_type="FLF"] input[type="checkbox"]')[0].click();
|
|
} else if ($('#vehicle_show_table_all tr[vehicle_type="GW-A"] input[type="checkbox"]').size() > 0) {
|
|
$('#vehicle_show_table_all tr[vehicle_type="GW-A"] input[type="checkbox"]')[0].click();
|
|
} else if ($('#vehicle_show_table_all tr[vehicle_type="GW-Öl"] input[type="checkbox"]').size() > 0) {
|
|
$('#vehicle_show_table_all tr[vehicle_type="GW-Öl"] input[type="checkbox"]')[0].click();
|
|
} else if ($('#vehicle_show_table_all tr[vehicle_type="NEF"] input[type="checkbox"]').size() > 0) {
|
|
$('#vehicle_show_table_all tr[vehicle_type="NEF"] input[type="checkbox"]')[0].click();
|
|
}
|
|
} else if ([54,56].indexOf(MissionType) !== -1){
|
|
if ($('#vehicle_show_table_all tr[vehicle_type="FLF"] input[type="checkbox"]').size() > 0) {
|
|
$('#vehicle_show_table_all tr[vehicle_type="FLF"] input[type="checkbox"]')[0].click();
|
|
} else if ($('#vehicle_show_table_all tr[vehicle_type="FuStW"] input[type="checkbox"]').size() > 0) {
|
|
$('#vehicle_show_table_all tr[vehicle_type="FuStW"] input[type="checkbox"]')[0].click();
|
|
} else if ($('#vehicle_show_table_all tr[vehicle_type="GW-A"] input[type="checkbox"]').size() > 0) {
|
|
$('#vehicle_show_table_all tr[vehicle_type="GW-A"] input[type="checkbox"]')[0].click();
|
|
} else if ($('#vehicle_show_table_all tr[vehicle_type="GW-Öl"] input[type="checkbox"]').size() > 0) {
|
|
$('#vehicle_show_table_all tr[vehicle_type="GW-Öl"] input[type="checkbox"]')[0].click();
|
|
} else if ($('#vehicle_show_table_all tr[vehicle_type="LF 20"] input[type="checkbox"]').size() > 0) {
|
|
$('#vehicle_show_table_all tr[vehicle_type="LF 20"] input[type="checkbox"]')[0].click();
|
|
} else if ($('#vehicle_show_table_all tr[vehicle_type="LF 20/16"] input[type="checkbox"]').size() > 0) {
|
|
$('#vehicle_show_table_all tr[vehicle_type="LF 20/16"] input[type="checkbox"]')[0].click();
|
|
} else if ($('#vehicle_show_table_all tr[vehicle_type="HLF 20"] input[type="checkbox"]').size() > 0) {
|
|
$('#vehicle_show_table_all tr[vehicle_type="HLF 20"] input[type="checkbox"]')[0].click();
|
|
} else if ($('#vehicle_show_table_all tr[vehicle_type="TLF 8/8"] input[type="checkbox"]').size() > 0) {
|
|
$('#vehicle_show_table_all tr[vehicle_type="TLF 8/8"] input[type="checkbox"]')[0].click();
|
|
}
|
|
} else {
|
|
if ($('#vehicle_show_table_all tr[vehicle_type="FuStW"] input[type="checkbox"]').size() > 0) {
|
|
$('#vehicle_show_table_all tr[vehicle_type="FuStW"] input[type="checkbox"]')[0].click();
|
|
} else if ($('#vehicle_show_table_all tr[vehicle_type="KTW Typ B"] input[type="checkbox"]').size() > 0) {
|
|
$('#vehicle_show_table_all tr[vehicle_type="KTW Typ B"] input[type="checkbox"]')[0].click();
|
|
}
|
|
}
|
|
// Todo add alternative cars, please no LF because of Mülltonne....
|
|
if ($('#vehicle_show_table_all input[type="checkbox"]:checked').size() > 0) {
|
|
$('#mission_alarm_btn').click();
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
// - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
|
// -
|
|
// - Grab Mission-Configuration from GitHub
|
|
// -
|
|
// - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
|
|
|
function ADis_CheckMissionAutomatic() {
|
|
var setOpt;
|
|
var missionLoad;
|
|
if (window.name == 'adis-ownmissions') {
|
|
setOpt = 'MissionsOwn-Automatic';
|
|
missionLoad = 'ADisMissionsOwn';
|
|
} else if (window.name == 'adis-krankentransporte') {
|
|
setOpt = 'Krankentransport-Automatic';
|
|
missionLoad = 'ADisKrankentransport';
|
|
}
|
|
if (setOpt && missionLoad) {
|
|
ADisSettings().then((setting) => {
|
|
if (setting[setOpt] == 'true') {
|
|
var coll = ADisDB[missionLoad].where({
|
|
done: 'false'
|
|
})
|
|
if (missionLoad != "ADisKrankentransport") {
|
|
coll = coll.and(function (item) {
|
|
return item.next_check < Math.floor(new Date().getTime() / 1000)
|
|
});
|
|
}
|
|
return coll.limit(1).toArray()
|
|
}
|
|
}).then((Missions) => {
|
|
if (Missions.length > 0) {
|
|
var Mission = Missions[0];
|
|
AD_GetMissionConfiguration(missionLoad == 'ADisKrankentransport' ? 147 : Mission.type);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
function AD_GetMissionConfiguration(MissionType) {
|
|
return ADisDB.transaction('rw', [ADisDB.ADisMissionsOwn, ADisDB.ADisSettings, ADisDB.ADisAvailabelMissions], () => {
|
|
return ADisDB.ADisAvailabelMissions.get({
|
|
type: MissionType.toString()
|
|
}).then((availableMission) => {
|
|
if (availableMission != undefined && availableMission.jsondata) {
|
|
MissionConfig = availableMission.jsondata;
|
|
AD_StartAlarmProcess();
|
|
} else {
|
|
var updateData = {
|
|
available: false,
|
|
next_check: CurrentTime + 60
|
|
};
|
|
ADis_UpdateOwnMissionsToDone(MissionID, updateData);
|
|
}
|
|
});
|
|
});
|
|
|
|
}
|
|
|
|
function AD_StartAlarmProcess() {
|
|
console.log(" Automatic Dispose: Starte Alarmierungsprozess");
|
|
|
|
|
|
setTimeout(function () // Process Fire Department
|
|
{
|
|
Promise.resolve().then(async () => {
|
|
return await ADis_PrepareVehicleNeedList();
|
|
}).then(async () => {
|
|
return await ADis_CollectInvolvedVehicles();
|
|
}).then(async () => {
|
|
return await ADis_CollectPatients();
|
|
})
|
|
.then(async () => {
|
|
return await Promise.all([
|
|
ADis_ProcessEmergencyMedicalService(),
|
|
ADis_ProcessFireDepartment(),
|
|
ADis_ProcessPoliceDepartment(),
|
|
ADis_ProcessTechnicalEmergencyService(),
|
|
ADis_ProcessWaterRescue(),
|
|
]).then((result) => {
|
|
var updateData = {
|
|
last_check: CurrentTime,
|
|
next_check: CurrentTime + 60
|
|
};
|
|
ADis_UpdateOwnMissionsToDone(MissionID, updateData);
|
|
if (['adis-ownmissions', 'adis-krankentransporte', 'adis-verbandmission'].indexOf(window.name) != -1) {
|
|
setTimeout(() => {
|
|
$('#mission_alarm_btn').click();
|
|
}, 250);
|
|
}
|
|
})
|
|
});
|
|
|
|
}, 250);
|
|
}
|
|
|
|
// - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
|
// -
|
|
// - Collect Involved Vehicles & Patients
|
|
// -
|
|
// - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
|
|
|
var AD_Vehicles = {};
|
|
var AD_Patients = {};
|
|
|
|
function ADis_CollectInvolvedVehicles() {
|
|
$("#mission_vehicle_driving tbody").find("tr").each(function () {
|
|
var VehicleID = $(this).find("a").first().attr("href").substr($(this).find("a").first().attr("href").lastIndexOf("/") + 1);
|
|
var VehicleName = $(this).find("a").first().text();
|
|
var VehicleType = $(this).find("a").first().attr("vehicle_type_id");
|
|
|
|
AD_Vehicles[VehicleID] = {
|
|
"id": VehicleID,
|
|
"name": VehicleName,
|
|
"type": VehicleType
|
|
}
|
|
});
|
|
|
|
$("#mission_vehicle_at_mission tbody").find("tr").each(function () {
|
|
var VehicleID = $(this).find("a").first().attr("href").substr($(this).find("a").first().attr("href").lastIndexOf("/") + 1);
|
|
var VehicleName = $(this).find("a").first().text();
|
|
var VehicleType = $(this).find("a").first().attr("vehicle_type_id");
|
|
|
|
AD_Vehicles[VehicleID] = {
|
|
"id": VehicleID,
|
|
"name": VehicleName,
|
|
"type": VehicleType
|
|
}
|
|
});
|
|
|
|
console.log(" Automatic Dispose: Bereits beteiligte Fahrzeuge:");
|
|
console.log(AD_Vehicles);
|
|
return AD_Vehicles;
|
|
}
|
|
|
|
function ADis_CollectPatients() {
|
|
var PatientCounter = 0;
|
|
|
|
$(".mission_patient").each(function () {
|
|
var PatientName = $(this).text();
|
|
var PatientNeedRTW = false;
|
|
var PatientNeedNEF = false;
|
|
var PatientNeedRTH = false;
|
|
var PatientNeedLNA = false;
|
|
var PatientNeedOrgL = false;
|
|
var PatientNeedSEGKTWB = false;
|
|
var PatientNeedTragehilfe = false;
|
|
|
|
// Wir benötigen einen RTW oder KTW Typ B.
|
|
if ($(this).find(".alert-danger").length > 0 && $(this).find(".alert-danger").text().indexOf("Wir benötigen einen RTW oder KTW Typ B") != -1) {
|
|
PatientNeedSEGKTWB = true;
|
|
}
|
|
|
|
// Wir benötigen einen RTW.
|
|
if ($(this).find(".alert-danger").length > 0 && $(this).find(".alert-danger").text().indexOf("Wir benötigen ein RTW") != -1) {
|
|
PatientNeedRTW = true;
|
|
}
|
|
|
|
// Wir benötigen einen NEF.
|
|
if ($(this).find(".alert-danger").length > 0 && $(this).find(".alert-danger").text().indexOf("Wir benötigen ein NEF") != -1) {
|
|
PatientNeedNEF = true;
|
|
}
|
|
|
|
// Wir benötigen einen RTH.
|
|
if ($(this).find(".alert-danger").length > 0 && $(this).find(".alert-danger").text().indexOf("Wir benötigen ein RTH") != -1) {
|
|
PatientNeedRTH = true;
|
|
}
|
|
|
|
// Wir benötigen einen LNA.
|
|
if ($(this).find(".alert-danger").length > 0 && $(this).find(".alert-danger").text().indexOf("Wir benötigen einen LNA") != -1) {
|
|
PatientNeedLNA = true;
|
|
}
|
|
|
|
// Wir benötigen einen OrgL.
|
|
if ($(this).find(".alert-danger").length > 0 && $(this).find(".alert-danger").text().indexOf("Wir benötigen einen OrgL") != -1) {
|
|
PatientNeedOrgL = true;
|
|
}
|
|
|
|
// Wir benötigen eine Tragehilfe (z.B. durch ein LF).
|
|
if ($(this).find(".alert-danger").length > 0 && $(this).find(".alert-danger").text().indexOf("Wir benötigen eine Tragehilfe") != -1) {
|
|
PatientNeedTragehilfe = true;
|
|
}
|
|
|
|
AD_Patients[PatientCounter] = {
|
|
"name": PatientName,
|
|
"need_RTW": PatientNeedRTW,
|
|
"need_NEF": PatientNeedNEF,
|
|
"need_RTH": PatientNeedRTH,
|
|
"need_LNA": PatientNeedLNA,
|
|
"need_OrgL": PatientNeedOrgL,
|
|
"need_SEG_KTWB": PatientNeedSEGKTWB,
|
|
"need_Tragehilfe": PatientNeedTragehilfe
|
|
}
|
|
|
|
PatientCounter++;
|
|
});
|
|
|
|
console.log(" Automatic Dispose: Patientenliste:");
|
|
console.log(AD_Patients);
|
|
return AD_Patients;
|
|
}
|
|
|
|
// - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
|
// -
|
|
// - Process Emergency_Medical_Service
|
|
// -
|
|
// - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
|
|
|
function ADis_ProcessEmergencyMedicalService() {
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
// -
|
|
// - Emergency Medical Service: Vehicles
|
|
// -
|
|
// - 38: KTW
|
|
// - 28: RTW
|
|
// - 29: NEF
|
|
// - 74: NAW
|
|
// - 73: GRTW
|
|
// - 31: RTH
|
|
// - 55: LNA
|
|
// - 56: OrgL
|
|
// -
|
|
// - 58: (SEG) KTW Typ B
|
|
// - 59: (SEG) ELW 1
|
|
// - 60: (SEG) GW-San
|
|
// -
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
if (typeof MissionConfig.emergency_medical_service == "object") // Wenn der EMS-Block in der Config definiert ist
|
|
{
|
|
if (Object.keys(AD_Patients).length >= 5) { // need LNA
|
|
ADis_VehiclesNeed["55"]=1;
|
|
}
|
|
|
|
if (Object.keys(AD_Patients).length >= 10) { // need OrgL
|
|
ADis_VehiclesNeed["56"]=1;
|
|
}
|
|
|
|
//$.each(AD_Patients, function (Key, Patient) {
|
|
for (var Key in AD_Patients) {
|
|
var Patient = AD_Patients[Key];
|
|
if (MissionConfig.emergency_medical_service.use_KTW == true) {
|
|
if (!Patient.need_RTW && !Patient.need_NEF && !Patient.need_RTH)
|
|
ADis_VehiclesNeed["38"]++;
|
|
}
|
|
|
|
if (Patient.need_LNA && ADis_VehiclesNeed["55"] < 1)
|
|
ADis_VehiclesNeed["55"] = 1;
|
|
|
|
if (Patient.need_OrgL && ADis_VehiclesNeed["56"] < 1)
|
|
ADis_VehiclesNeed["56"]=1;
|
|
|
|
if (Patient.need_Tragehilfe == true)
|
|
ADis_VehiclesNeed["0"]++;
|
|
|
|
if (MissionConfig.emergency_medical_service.use_RTW == true)
|
|
ADis_VehiclesNeed["28"]++;
|
|
|
|
if (MissionConfig.emergency_medical_service.use_NEF == true)
|
|
ADis_VehiclesNeed["29"]++;
|
|
|
|
if (MissionConfig.emergency_medical_service.use_RTH == true)
|
|
ADis_VehiclesNeed["31"]++;
|
|
};
|
|
|
|
// TODO: need to be refactored to make sure first KTW Typ B before RTW.
|
|
if (MissionConfig.emergency_medical_service.use_SEG_ELW1_Only == "true") {
|
|
ADis_VehiclesNeed["59"]++;
|
|
} else if (MissionConfig.emergency_medical_service.use_SEG_FULL == "true" || Object.keys(AD_Patients).length >= 3) {
|
|
ADis_VehiclesNeed["58"]++;
|
|
ADis_VehiclesNeed["58"]++; // 3x KTW Type B
|
|
ADis_VehiclesNeed["58"]++;
|
|
ADis_VehiclesNeed["59"]++;
|
|
ADis_VehiclesNeed["60"]++;
|
|
}
|
|
|
|
var VehicleTable;
|
|
|
|
if ($("#vehicle_show_table_body_all").length > 0) {
|
|
VehicleTable = $("#vehicle_show_table_body_all");
|
|
} else {
|
|
VehicleTable = $("#vehicle_show_table_body_rett");
|
|
}
|
|
|
|
VehicleTable.find(".vehicle_select_table_tr").each(function () {
|
|
var VehicleID = $(this).attr("id").replace("vehicle_element_content_", "");
|
|
// var VehicleDistanceTime = $("#vehicle_sort_" + VehicleID).attr("sortvalue");
|
|
var VehicleType = $(this).attr("vehicle_type");
|
|
|
|
if ($("#vehicle_checkbox_" + VehicleID + ":enabled").length === 0){
|
|
return;
|
|
}
|
|
|
|
if (VehicleType == "KTW" && ADis_VehiclesNeed["38"] > 0) {
|
|
// console.log(" Automatic Dispose: Fahrzeug " + VehicleID + " " + VehicleType + " markiert");
|
|
$("#vehicle_checkbox_" + VehicleID).click();
|
|
ADis_VehiclesNeed["38"]--;
|
|
} else if ((VehicleType == "LF 20" || VehicleType == "LF 10" ||
|
|
VehicleType == "LF 8/6" || VehicleType == "LF 20/16" ||
|
|
VehicleType == "LF 10/6" || VehicleType == "LF 16-TS" ||
|
|
VehicleType == "HLF 20" || VehicleType == "TSF-W" ||
|
|
VehicleType == "TLF 2000" || VehicleType == "TLF 3000" ||
|
|
VehicleType == "TLF 8/8" || VehicleType == "TLF 8/18" ||
|
|
VehicleType == "TLF 16/24-Tr" || VehicleType == "TLF 16/25" ||
|
|
VehicleType == "TLF 16/45" || VehicleType == "TLF 20/40" ||
|
|
VehicleType == "TLF 20/40-SL" || VehicleType == "TLF 16") &&
|
|
ADis_VehiclesNeed["0"] + ADis_VehiclesNeed["1"] + ADis_VehiclesNeed["6"] + ADis_VehiclesNeed["7"] +
|
|
ADis_VehiclesNeed["8"] + ADis_VehiclesNeed["9"] + ADis_VehiclesNeed["30"] + ADis_VehiclesNeed["37"] +
|
|
ADis_VehiclesNeed["17"] + ADis_VehiclesNeed["18"] + ADis_VehiclesNeed["19"] + ADis_VehiclesNeed["20"] +
|
|
ADis_VehiclesNeed["21"] + ADis_VehiclesNeed["22"] + ADis_VehiclesNeed["23"] + ADis_VehiclesNeed["24"] +
|
|
ADis_VehiclesNeed["25"] + ADis_VehiclesNeed["26"] > 0) { // LF acts as 'Tragehilfe'
|
|
$("#vehicle_checkbox_" + VehicleID).click();
|
|
ADis_VehiclesNeed["0"]--;
|
|
} else if (VehicleType == "NAW" && ADis_VehiclesNeed["28"] > 0 && ADis_VehiclesNeed["29"] > 0) {
|
|
$("#vehicle_checkbox_" + VehicleID).click();
|
|
ADis_VehiclesNeed["74"]--;
|
|
ADis_VehiclesNeed["28"]--;
|
|
ADis_VehiclesNeed["29"]--;
|
|
} else if (VehicleType == "GRTW" && ADis_VehiclesNeed["73"] > 0) {
|
|
$("#vehicle_checkbox_" + VehicleID).click();
|
|
ADis_VehiclesNeed["73"]--;
|
|
} else if (VehicleType == "RTW" && ADis_VehiclesNeed["28"] > 0) {
|
|
$("#vehicle_checkbox_" + VehicleID).click();
|
|
ADis_VehiclesNeed["28"]--;
|
|
} else if (VehicleType == "NEF" && ADis_VehiclesNeed["29"] > 0) {
|
|
$("#vehicle_checkbox_" + VehicleID).click();
|
|
ADis_VehiclesNeed["29"]--;
|
|
} else if (VehicleType == "RTH" && ADis_VehiclesNeed["31"] > 0) {
|
|
$("#vehicle_checkbox_" + VehicleID).click();
|
|
ADis_VehiclesNeed["31"]--;
|
|
} else if (VehicleType == "KdoW-LNA" && ADis_VehiclesNeed["55"] > 0) {
|
|
$("#vehicle_checkbox_" + VehicleID).click();
|
|
ADis_VehiclesNeed["55"]--;
|
|
} else if (VehicleType == "KdoW-OrgL" && ADis_VehiclesNeed["56"] > 0) {
|
|
$("#vehicle_checkbox_" + VehicleID).click();
|
|
ADis_VehiclesNeed["56"]--;
|
|
} else if (VehicleType == "KTW Typ B" && ADis_VehiclesNeed["58"] > 0) {
|
|
$("#vehicle_checkbox_" + VehicleID).click();
|
|
ADis_VehiclesNeed["58"]--;
|
|
ADis_VehiclesNeed["28"]--; // no need for RTW if KTW Type B is called
|
|
} else if (VehicleType == "ELW 1 (SEG)" && ADis_VehiclesNeed["59"] > 0) {
|
|
$("#vehicle_checkbox_" + VehicleID).click();
|
|
ADis_VehiclesNeed["59"]--;
|
|
} else if (VehicleType == "GW-San" && ADis_VehiclesNeed["60"] > 0) {
|
|
$("#vehicle_checkbox_" + VehicleID).click();
|
|
ADis_VehiclesNeed["60"]--;
|
|
ADis_VehiclesNeed["29"]--; // no need for NEF if GW-SAN is called
|
|
}
|
|
});
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
// - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
|
// -
|
|
// - Process Fire_Department
|
|
// -
|
|
// - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
|
|
|
function ADis_ProcessFireDepartment() {
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
// -
|
|
// - Fire Department: Vehicles
|
|
// -
|
|
// - 0: LF 20
|
|
// - 1: LF 10
|
|
// - 6: LF 8/6
|
|
// - 7: LF 20/16
|
|
// - 8: LF 10/6
|
|
// - 9: LF 16-TS
|
|
// - 30: HLF 20
|
|
// - 37: TSF-W
|
|
// -
|
|
// - 17: TLF 2000
|
|
// - 18: TLF 3000
|
|
// - 19: TLF 8/8
|
|
// - 20: TLF 8/18
|
|
// - 21: TLF 16/24-Tr
|
|
// - 22: TLF 16/25
|
|
// - 23: TLF 16/45
|
|
// - 24: TLF 20/40
|
|
// - 25: TLF 20/40-SL
|
|
// - 26: TLF 16
|
|
// -
|
|
// - 2: DLK 23
|
|
// - 3: ELW 1
|
|
// - 34: ELW 2
|
|
// - 36: MTW
|
|
// - 57: FwK
|
|
// -
|
|
// - 4: RW
|
|
// - 5: GW-A
|
|
// - 10: GW-Öl
|
|
// - 12: GW-Mess
|
|
// - 53: GW-Dekon-P
|
|
// - 27: GW-Gefahrgut
|
|
// - 33: GW-Höhenrettung
|
|
// -
|
|
// - 11: GW-L2-Wasser
|
|
// - 13: SW 1000
|
|
// - 14: SW 2000
|
|
// - 15: SW 2000-Tr
|
|
// - 16: SW KatS
|
|
// -
|
|
// - 71: AB-MZB (see WaterRescue)
|
|
// -
|
|
// - 46: WLF
|
|
// - 47: AB-Rüst
|
|
// - 48: AB-Atemschutz
|
|
// - 49: AB-Öl
|
|
// - 54: AB-Dekon-P
|
|
// - 62: AB-Schlauch
|
|
// -
|
|
// - 75: FLF
|
|
// - 76: Rettungstreppe
|
|
// - 77: AB-Gefahrgut
|
|
// - 78: AB-Einsatzleitung
|
|
// -
|
|
// - 83: GW-Werkfeuerwehr
|
|
// - 84: ULF mit Löscharm
|
|
// - 85: TM 50
|
|
// - 86: Turbolöscher
|
|
// -
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
if (typeof MissionConfig.fire_department == "object") // Wenn der FD-Block in der Config definiert ist
|
|
{
|
|
console.log(ADis_VehiclesNeed);
|
|
|
|
ADis_VehiclesNeed["0"] += parseInt(MissionConfig.fire_department.num_LF);
|
|
ADis_VehiclesNeed["3"] += parseInt(MissionConfig.fire_department.num_ELW_1);
|
|
ADis_VehiclesNeed["34"] += parseInt(MissionConfig.fire_department.num_ELW_2);
|
|
ADis_VehiclesNeed["2"] += parseInt(MissionConfig.fire_department.num_DLK);
|
|
ADis_VehiclesNeed["4"] += parseInt(MissionConfig.fire_department.num_RW);
|
|
ADis_VehiclesNeed["57"] += parseInt(MissionConfig.fire_department.num_FwK);
|
|
ADis_VehiclesNeed["5"] += parseInt(MissionConfig.fire_department.num_GW_A);
|
|
ADis_VehiclesNeed["27"] += parseInt(MissionConfig.fire_department.num_GW_G);
|
|
ADis_VehiclesNeed["10"] += parseInt(MissionConfig.fire_department.num_GW_Oel);
|
|
ADis_VehiclesNeed["12"] += parseInt(MissionConfig.fire_department.num_GW_Mess);
|
|
ADis_VehiclesNeed["11"] += parseInt(MissionConfig.fire_department.num_SW);
|
|
ADis_VehiclesNeed["33"] += parseInt(MissionConfig.fire_department.num_GW_Hoeh);
|
|
ADis_VehiclesNeed["53"] += parseInt(MissionConfig.fire_department.num_Dekon_P);
|
|
ADis_VehiclesNeed["75"] += parseInt(MissionConfig.fire_department.num_FLF);
|
|
ADis_VehiclesNeed["76"] += parseInt(MissionConfig.fire_department.num_Rettungstreppe);
|
|
ADis_VehiclesNeed["83"] += parseInt(MissionConfig.fire_department.num_GW_Werkfeuerwehr);
|
|
ADis_VehiclesNeed["84"] += parseInt(MissionConfig.fire_department.num_ULF_mit_Loescharm);
|
|
ADis_VehiclesNeed["86"] += parseInt(MissionConfig.fire_department.num_Turboloescher);
|
|
|
|
var dangerText = $('#iframe-inside-container > div.alert.alert-danger').text();
|
|
|
|
if (includesString(dangerText, "Wir benötigen min.") && includesString(dangerText, "Feuerwehrleute.") ) {
|
|
const weNeed = ADis_VehiclesNeed["0"];
|
|
const regex = /(\d+) Feuerwehrleute/gm;
|
|
const newNeed = Math.ceil(Number(parseInt(dangerText.match(regex))) / 6) - weNeed;
|
|
ADis_VehiclesNeed["0"] = newNeed;
|
|
}
|
|
|
|
$("#vehicle_show_table_body_all").find(".vehicle_select_table_tr").each(function () {
|
|
var VehicleID = $(this).attr("id").replace("vehicle_element_content_", "");
|
|
// var VehicleDistanceTime = $("#vehicle_sort_" + VehicleID).attr("sortvalue");
|
|
var VehicleType = $(this).attr("vehicle_type");
|
|
|
|
if ($("#vehicle_checkbox_" + VehicleID + ":enabled").length === 0){
|
|
return;
|
|
}
|
|
|
|
if ((VehicleType == "LF 20" || VehicleType == "LF 10" ||
|
|
VehicleType == "LF 8/6" || VehicleType == "LF 20/16" ||
|
|
VehicleType == "LF 10/6" || VehicleType == "LF 16-TS" ||
|
|
VehicleType == "HLF 20" || VehicleType == "TSF-W" ||
|
|
VehicleType == "TLF 2000" || VehicleType == "TLF 3000" ||
|
|
VehicleType == "TLF 8/8" || VehicleType == "TLF 8/18" ||
|
|
VehicleType == "TLF 16/24-Tr" || VehicleType == "TLF 16/25" ||
|
|
VehicleType == "TLF 16/45" || VehicleType == "TLF 20/40" ||
|
|
VehicleType == "TLF 20/40-SL" || VehicleType == "TLF 16") &&
|
|
ADis_VehiclesNeed["0"] + ADis_VehiclesNeed["1"] + ADis_VehiclesNeed["6"] + ADis_VehiclesNeed["7"] +
|
|
ADis_VehiclesNeed["8"] + ADis_VehiclesNeed["9"] + ADis_VehiclesNeed["30"] + ADis_VehiclesNeed["37"] +
|
|
ADis_VehiclesNeed["17"] + ADis_VehiclesNeed["18"] + ADis_VehiclesNeed["19"] + ADis_VehiclesNeed["20"] +
|
|
ADis_VehiclesNeed["21"] + ADis_VehiclesNeed["22"] + ADis_VehiclesNeed["23"] + ADis_VehiclesNeed["24"] +
|
|
ADis_VehiclesNeed["25"] + ADis_VehiclesNeed["26"] > 0) {
|
|
$("#vehicle_checkbox_" + VehicleID).click();
|
|
ADis_VehiclesNeed["0"]--;
|
|
|
|
} else if (VehicleType == "HLF 20" && ADis_VehiclesNeed["4"] > 0) // HLF 20 acts as RW
|
|
{
|
|
ADis_VehiclesNeed["0"]--;
|
|
ADis_VehiclesNeed["4"]--;
|
|
$("#vehicle_checkbox_" + VehicleID).click();
|
|
} else if ((VehicleType == "DLK 23" || VehicleType == "TM 50") && ADis_VehiclesNeed["2"] > 0) // DLK 23
|
|
{
|
|
$("#vehicle_checkbox_" + VehicleID).click();
|
|
ADis_VehiclesNeed["2"]--;
|
|
} else if ($(this).attr("vehicle_type" == "AB-Einsatzleitung") &&
|
|
ADis_VehiclesNeed["3"] + ADis_VehiclesNeed["34"] + ADis_VehiclesNeed["78"] > 0) // ELW 1 + ELW 2
|
|
{
|
|
$("#vehicle_checkbox_" + VehicleID).click();
|
|
ADis_VehiclesNeed["3"]--;
|
|
ADis_VehiclesNeed["34"]--;
|
|
} else if (VehicleType == "ELW 2" && ADis_VehiclesNeed["3"] + ADis_VehiclesNeed["34"] > 0) // ELW 2
|
|
{
|
|
$("#vehicle_checkbox_" + VehicleID).click();
|
|
ADis_VehiclesNeed["3"]--;
|
|
ADis_VehiclesNeed["34"]--;
|
|
} else if (VehicleType == "ELW 1" && ADis_VehiclesNeed["3"] > 0) // ELW 1
|
|
{
|
|
$("#vehicle_checkbox_" + VehicleID).click();
|
|
ADis_VehiclesNeed["3"]--;
|
|
} else if (VehicleType == "MTW" && ADis_VehiclesNeed["36"] > 0) // MTW
|
|
{
|
|
$("#vehicle_checkbox_" + VehicleID).click();
|
|
ADis_VehiclesNeed["36"]--;
|
|
} else if (VehicleType == "FwK" && ADis_VehiclesNeed["57"] > 0) // FwK
|
|
{
|
|
$("#vehicle_checkbox_" + VehicleID).click();
|
|
ADis_VehiclesNeed["57"]--;
|
|
} else if (VehicleType == "GWK" &&
|
|
ADis_VehiclesNeed["4"] > 0) // GWK acts as RW
|
|
{
|
|
$("#vehicle_checkbox_" + VehicleID).click();
|
|
ADis_VehiclesNeed["4"]--;
|
|
ADis_VehiclesNeed["39"]--;
|
|
} else if ((VehicleType == "RW" ||
|
|
VehicleType == "HLF 20" ||
|
|
VehicleType == "AB-Rüst") &&
|
|
ADis_VehiclesNeed["4"] > 0) // RW
|
|
{
|
|
$("#vehicle_checkbox_" + VehicleID).click();
|
|
ADis_VehiclesNeed["4"]--;
|
|
} else if ((VehicleType == "GW-A" ||
|
|
VehicleType == "AB-Atemschutz") &&
|
|
ADis_VehiclesNeed["5"] > 0) // GW-A
|
|
{
|
|
$("#vehicle_checkbox_" + VehicleID).click();
|
|
ADis_VehiclesNeed["5"]--;
|
|
} else if ((VehicleType == "GW-Öl" ||
|
|
VehicleType == "AB-Öl") &&
|
|
ADis_VehiclesNeed["10"] > 0) // GW-Öl
|
|
{
|
|
$("#vehicle_checkbox_" + VehicleID).click();
|
|
ADis_VehiclesNeed["10"]--;
|
|
} else if (VehicleType == "GW-Messtechnik" && ADis_VehiclesNeed["12"] > 0) // FwK
|
|
{
|
|
$("#vehicle_checkbox_" + VehicleID).click();
|
|
ADis_VehiclesNeed["12"]--;
|
|
} else if ((VehicleType == "GW-L2-Wasser" ||
|
|
VehicleType == "SW 1000" ||
|
|
VehicleType == "SW 2000" ||
|
|
VehicleType == "SW 2000-Tr" ||
|
|
VehicleType == "SW Kats" ||
|
|
VehicleType == "AB-Schlauch") &&
|
|
ADis_VehiclesNeed["11"] > 0) // SW
|
|
{
|
|
$("#vehicle_checkbox_" + VehicleID).click();
|
|
ADis_VehiclesNeed["11"]--;
|
|
} else if ((VehicleType == "GW-Gefahrgut" ||
|
|
VehicleType == "AB-Gefahrgut") && ADis_VehiclesNeed["27"] > 0) // GW-Gefahrgut
|
|
{
|
|
$("#vehicle_checkbox_" + VehicleID).click();
|
|
ADis_VehiclesNeed["27"]--;
|
|
} else if (VehicleType == "GW-Höhenrettung" && ADis_VehiclesNeed["33"] > 0) // GW-Höhenrettung
|
|
{
|
|
$("#vehicle_checkbox_" + VehicleID).click();
|
|
ADis_VehiclesNeed["33"]--;
|
|
} else if ((VehicleType == "Dekon-P" ||
|
|
VehicleType == "AB-Dekon-P") &&
|
|
ADis_VehiclesNeed["53"] > 0) // Dekon-P
|
|
{
|
|
$("#vehicle_checkbox_" + VehicleID).click();
|
|
ADis_VehiclesNeed["53"]--;
|
|
} else if (VehicleType == "GW-Werkfeuerwehr" &&
|
|
ADis_VehiclesNeed["83"] > 0) // GW-Werkfeuerwehr
|
|
{
|
|
$("#vehicle_checkbox_" + VehicleID).click();
|
|
ADis_VehiclesNeed["83"]--;
|
|
} else if (VehicleType == "ULF mit Löscharm" &&
|
|
ADis_VehiclesNeed["84"] > 0) // ULF mit Löscharm
|
|
{
|
|
$("#vehicle_checkbox_" + VehicleID).click();
|
|
ADis_VehiclesNeed["84"]--;
|
|
}
|
|
/*
|
|
else if (VehicleType == "TM 50" &&
|
|
ADis_VehiclesNeed["85"] > 0) // TM 50
|
|
{
|
|
$("#vehicle_checkbox_" + VehicleID).click();
|
|
ADis_VehiclesNeed["85"]--;
|
|
}
|
|
*/
|
|
else if (VehicleType == "Turbolöscher" &&
|
|
ADis_VehiclesNeed["86"] > 0) // Turbolöscher
|
|
{
|
|
$("#vehicle_checkbox_" + VehicleID).click();
|
|
ADis_VehiclesNeed["86"]--;
|
|
} else if (VehicleType == "FLF" &&
|
|
ADis_VehiclesNeed["75"] > 0) // FLF
|
|
{
|
|
$("#vehicle_checkbox_" + VehicleID).click();
|
|
ADis_VehiclesNeed["75"]--;
|
|
} else if (VehicleType == "Rettungstreppe" &&
|
|
ADis_VehiclesNeed["76"] > 0) // Rettungstreppe
|
|
{
|
|
$("#vehicle_checkbox_" + VehicleID).click();
|
|
ADis_VehiclesNeed["76"]--;
|
|
}
|
|
});
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
// - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
|
// -
|
|
// - Process Police_Department
|
|
// -
|
|
// - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
|
|
|
function ADis_ProcessPoliceDepartment() {
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
// -
|
|
// - Fire Department: Vehicles
|
|
// -
|
|
// - 32: FuStW
|
|
// - 35: leBefKw
|
|
// - 50: GruKw
|
|
// - 51: FüKw
|
|
// - 52: GefKw
|
|
// - 72: WaWe
|
|
// - 61: Polizeihubschrauber
|
|
// - 79: SEK - ZF
|
|
// - 80: SEK - MTF
|
|
// - 81: MEK - ZF
|
|
// - 82: MEK - MTF
|
|
// -
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
if (typeof MissionConfig.police_department == "object") // Wenn der FD-Block in der Config definiert ist
|
|
{
|
|
ADis_VehiclesNeed["32"] += parseInt(MissionConfig.police_department.num_FuStW);
|
|
ADis_VehiclesNeed["35"] += parseInt(MissionConfig.police_department.num_leBefKw);
|
|
ADis_VehiclesNeed["50"] += parseInt(MissionConfig.police_department.num_GruKw);
|
|
ADis_VehiclesNeed["51"] += parseInt(MissionConfig.police_department.num_FueKw);
|
|
ADis_VehiclesNeed["52"] += parseInt(MissionConfig.police_department.num_GefKw);
|
|
ADis_VehiclesNeed["72"] += parseInt(MissionConfig.police_department.num_WaWe);
|
|
ADis_VehiclesNeed["61"] += parseInt(MissionConfig.police_department.num_PHu);
|
|
ADis_VehiclesNeed["79"] += parseInt(MissionConfig.police_department.num_SEK_ZF);
|
|
ADis_VehiclesNeed["80"] += parseInt(MissionConfig.police_department.num_SEK_MTF);
|
|
ADis_VehiclesNeed["81"] += parseInt(MissionConfig.police_department.num_MEK_ZF);
|
|
ADis_VehiclesNeed["82"] += parseInt(MissionConfig.police_department.num_MEK_MTF);
|
|
|
|
$("#vehicle_show_table_body_all").find(".vehicle_select_table_tr").each(function () {
|
|
var VehicleID = $(this).attr("id").replace("vehicle_element_content_", "");
|
|
// var VehicleDistanceTime = $("#vehicle_sort_" + VehicleID).attr("sortvalue");
|
|
var VehicleType = $(this).attr("vehicle_type");
|
|
|
|
if ($("#vehicle_checkbox_" + VehicleID + ":enabled").length === 0){
|
|
return;
|
|
}
|
|
|
|
if (VehicleType == "FuStW" && ADis_VehiclesNeed["32"] > 0) // FuStW
|
|
{
|
|
$("#vehicle_checkbox_" + VehicleID).click();
|
|
ADis_VehiclesNeed["32"]--;
|
|
} else if (VehicleType == "leBefKw" && ADis_VehiclesNeed["35"] > 0) // leBefKw
|
|
{
|
|
$("#vehicle_checkbox_" + VehicleID).click();
|
|
ADis_VehiclesNeed["35"]--;
|
|
} else if (VehicleType == "GruKw" && ADis_VehiclesNeed["50"] > 0) // GruKw
|
|
{
|
|
$("#vehicle_checkbox_" + VehicleID).click();
|
|
ADis_VehiclesNeed["50"]--;
|
|
} else if (VehicleType == "FüKw" && ADis_VehiclesNeed["51"] > 0) // FüKw
|
|
{
|
|
$("#vehicle_checkbox_" + VehicleID).click();
|
|
ADis_VehiclesNeed["51"]--;
|
|
} else if (VehicleType == "GefKw" && ADis_VehiclesNeed["52"] > 0) // GefKw
|
|
{
|
|
$("#vehicle_checkbox_" + VehicleID).click();
|
|
ADis_VehiclesNeed["52"]--;
|
|
} else if (VehicleType == "WaWe 10" && ADis_VehiclesNeed["72"] > 0) // WaWe 10
|
|
{
|
|
$("#vehicle_checkbox_" + VehicleID).click();
|
|
ADis_VehiclesNeed["72"]--;
|
|
} else if (VehicleType == "Polizeihubschrauber" && ADis_VehiclesNeed["61"] > 0) // PHu
|
|
{
|
|
$("#vehicle_checkbox_" + VehicleID).click();
|
|
ADis_VehiclesNeed["61"]--;
|
|
} else if (VehicleType == "SEK - ZF" && ADis_VehiclesNeed["79"] > 0) // SEK-ZF
|
|
{
|
|
$("#vehicle_checkbox_" + VehicleID).click();
|
|
ADis_VehiclesNeed["79"]--;
|
|
} else if (VehicleType == "SEK - MTF" && ADis_VehiclesNeed["80"] > 0) // SEK-MTF
|
|
{
|
|
$("#vehicle_checkbox_" + VehicleID).click();
|
|
ADis_VehiclesNeed["80"]--;
|
|
} else if (VehicleType == "MEK - ZF" && ADis_VehiclesNeed["81"] > 0) // MEK-ZF
|
|
{
|
|
$("#vehicle_checkbox_" + VehicleID).click();
|
|
ADis_VehiclesNeed["81"]--;
|
|
} else if (VehicleType == "MEK - MTF" && ADis_VehiclesNeed["82"] > 0) // MEK-MTF
|
|
{
|
|
$("#vehicle_checkbox_" + VehicleID).click();
|
|
ADis_VehiclesNeed["82"]--;
|
|
}
|
|
});
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
// - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
|
// -
|
|
// - Process Water_Rescue
|
|
// -
|
|
// - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
|
|
|
function ADis_ProcessWaterRescue() {
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
// -
|
|
// - Water Rescue: Vehicles
|
|
// -
|
|
// - 63: GW-Taucher
|
|
// - 64: GW-Wasserrettung
|
|
// - 69: Tauchkraftwagen (handel it here;TechnicalEmergencyService)
|
|
// -
|
|
// - Boote:
|
|
// -
|
|
// - 66: Anh MzB (handel it here;TechnicalEmergencyService)
|
|
// - 67: Anh SchlB (handel it here;TechnicalEmergencyService)
|
|
// - 68: Anh MzAB (handel it here;TechnicalEmergencyService)
|
|
// - 70: MZB
|
|
// - 71: AB-MZB (handel it here;FireDepartment)
|
|
// -
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
if (typeof MissionConfig.water_rescue == "object") {
|
|
ADis_VehiclesNeed["63"] += parseInt(MissionConfig.water_rescue.num_GW_T);
|
|
ADis_VehiclesNeed["64"] += parseInt(MissionConfig.water_rescue.num_GW_W);
|
|
ADis_VehiclesNeed["70"] += parseInt(MissionConfig.water_rescue.num_MzB);
|
|
|
|
$("#vehicle_show_table_body_all").find(".vehicle_select_table_tr").each(function () {
|
|
var VehicleID = $(this).attr("id").replace("vehicle_element_content_", "");
|
|
// var VehicleDistanceTime = $("#vehicle_sort_" + VehicleID).attr("sortvalue");
|
|
var VehicleType = $(this).attr("vehicle_type");
|
|
|
|
if ($("#vehicle_checkbox_" + VehicleID + ":enabled").length === 0){
|
|
return;
|
|
}
|
|
|
|
if ((VehicleType == "GW-Taucher" ||
|
|
VehicleType == "Tauchkraftwagen") && ADis_VehiclesNeed["63"] > 0) // GW-Taucher
|
|
{
|
|
$("#vehicle_checkbox_" + VehicleID).click();
|
|
ADis_VehiclesNeed["63"]--;
|
|
} else if (VehicleType == "GW-Wasserrettung" && ADis_VehiclesNeed["64"] > 0) // GW-Wasserrettung
|
|
{
|
|
$("#vehicle_checkbox_" + VehicleID).click();
|
|
ADis_VehiclesNeed["64"]--;
|
|
} else if ((VehicleType == "MZB" || VehicleType == "Anh MzB" ||
|
|
VehicleType == "Anh MzAB" || VehicleType == "Anh SchlB" ||
|
|
VehicleType == "AB-MZB") && ADis_VehiclesNeed["66"] + ADis_VehiclesNeed["67"] + ADis_VehiclesNeed["68"] +
|
|
ADis_VehiclesNeed["70"] + ADis_VehiclesNeed["71"] > 0) // Boote
|
|
{
|
|
$("#vehicle_checkbox_" + VehicleID).click();
|
|
ADis_VehiclesNeed["70"]--;
|
|
}
|
|
});
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
// - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
|
// -
|
|
// - Process Technical Emergency Service
|
|
// -
|
|
// - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
|
|
|
function ADis_ProcessTechnicalEmergencyService() {
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
// -
|
|
// - THW: Vehicles
|
|
// -
|
|
// - 39: GKW (see also FireDepartment)
|
|
// - 40: MTW-TZ
|
|
// - 41: MzKW
|
|
// - 42: LKW K 9
|
|
// - 43: BRmG R
|
|
// -
|
|
// - 44: Anh DLE
|
|
// - 45: MLW 5
|
|
// - 65: LKW 7 Lkr 19 tm
|
|
// - 69: Tauchkraftwagen (see WaterRescue)
|
|
// -
|
|
// - 66: Anh MzB (see WaterRescue)
|
|
// - 67: Anh SchlB (see WaterRescue)
|
|
// - 68: Anh MzAB (see WaterRescue)
|
|
// -
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
if (typeof MissionConfig.technical_emergency_service == "object") {
|
|
ADis_VehiclesNeed["39"] += parseInt(MissionConfig.technical_emergency_service.num_GKW);
|
|
ADis_VehiclesNeed["40"] += parseInt(MissionConfig.technical_emergency_service.num_MTW_TZ);
|
|
ADis_VehiclesNeed["41"] += parseInt(MissionConfig.technical_emergency_service.num_MzKW);
|
|
ADis_VehiclesNeed["42"] += parseInt(MissionConfig.technical_emergency_service.num_LKW_K9);
|
|
ADis_VehiclesNeed["43"] += parseInt(MissionConfig.technical_emergency_service.num_BRmG_R);
|
|
ADis_VehiclesNeed["44"] += parseInt(MissionConfig.technical_emergency_service.num_Anh_DLE);
|
|
ADis_VehiclesNeed["45"] += parseInt(MissionConfig.technical_emergency_service.num_MLW_5);
|
|
ADis_VehiclesNeed["65"] += parseInt(MissionConfig.technical_emergency_service.num_LKW_7Lkr);
|
|
|
|
$("#vehicle_show_table_body_all").find(".vehicle_select_table_tr").each(function () {
|
|
var VehicleID = $(this).attr("id").replace("vehicle_element_content_", "");
|
|
// var VehicleDistanceTime = $("#vehicle_sort_" + VehicleID).attr("sortvalue");
|
|
var VehicleType = $(this).attr("vehicle_type");
|
|
|
|
if ($("#vehicle_checkbox_" + VehicleID + ":enabled").length === 0){
|
|
return;
|
|
}
|
|
|
|
if (VehicleType == "GKW" && ADis_VehiclesNeed["39"] > 0) // GKW
|
|
{
|
|
$("#vehicle_checkbox_" + VehicleID).click();
|
|
ADis_VehiclesNeed["39"]--;
|
|
} else if (VehicleType == "MTW-TZ" && ADis_VehiclesNeed["40"] > 0) // MTW-TZ
|
|
{
|
|
$("#vehicle_checkbox_" + VehicleID).click();
|
|
ADis_VehiclesNeed["40"]--;
|
|
} else if (VehicleType == "MzKW" && ADis_VehiclesNeed["41"] > 0) // MzKW
|
|
{
|
|
$("#vehicle_checkbox_" + VehicleID).click();
|
|
ADis_VehiclesNeed["41"]--;
|
|
} else if (VehicleType == "LKW K 9" && ADis_VehiclesNeed["42"] > 0) // LKW K 9
|
|
{
|
|
$("#vehicle_checkbox_" + VehicleID).click();
|
|
ADis_VehiclesNeed["42"]--;
|
|
} else if (VehicleType == "BRmG R" && ADis_VehiclesNeed["43"] > 0) // BRmG R
|
|
{
|
|
$("#vehicle_checkbox_" + VehicleID).click();
|
|
ADis_VehiclesNeed["43"]--;
|
|
} else if (VehicleType == "Anh DLE" && ADis_VehiclesNeed["44"] > 0) // Anh DLE
|
|
{
|
|
$("#vehicle_checkbox_" + VehicleID).click();
|
|
ADis_VehiclesNeed["44"]--;
|
|
} else if (VehicleType == "MLW 5" && ADis_VehiclesNeed["45"] > 0) // MLW 5
|
|
{
|
|
$("#vehicle_checkbox_" + VehicleID).click();
|
|
ADis_VehiclesNeed["45"]--;
|
|
} else if (VehicleType == "LKW 7 Lkr 19 tm" && ADis_VehiclesNeed["65"] > 0) // LKW 7 Lkr 19 tm
|
|
{
|
|
$("#vehicle_checkbox_" + VehicleID).click();
|
|
ADis_VehiclesNeed["65"]--;
|
|
}
|
|
});
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
var ADis_VehiclesNeed = {};
|
|
|
|
function ADis_PrepareVehicleNeedList() {
|
|
for (VehicleTypeID = 0; VehicleTypeID <= MaxVehicleID; VehicleTypeID++) {
|
|
ADis_VehiclesNeed[VehicleTypeID] = 0;
|
|
}
|
|
for (VehicleTypeID = 0; VehicleTypeID <= MaxVehicleID; VehicleTypeID++) {
|
|
ADis_CountInvolvedVehiclesOfType(VehicleTypeID);
|
|
}
|
|
console.log("ADis_PrepareVehicleNeedList: ok");
|
|
return true;
|
|
}
|
|
|
|
function ADis_CountInvolvedVehiclesOfType(VehicleTypeID) {
|
|
for (var Key in AD_Vehicles) {
|
|
var Vehicle = AD_Vehicles[Key];
|
|
if (Vehicle.type == VehicleTypeID) {
|
|
ADis_SelectCountVehicles(VehicleTypeID);
|
|
}
|
|
};
|
|
|
|
$("#mission_vehicle_driving tbody, #mission_vehicle_at_mission tbody").find("tr").each(function () {
|
|
if ($(this).find("a").first().attr("vehicle_type_id") == VehicleTypeID) {
|
|
ADis_SelectCountVehicles(VehicleTypeID);
|
|
}
|
|
});
|
|
|
|
return;
|
|
}
|
|
|
|
function ADis_SelectCountVehicles(VehicleTypeID) {
|
|
var VehicleTypeID = Number(VehicleTypeID);
|
|
if ([38].indexOf(VehicleTypeID) != -1) {
|
|
ADis_VehiclesNeed[VehicleTypeID]--;
|
|
} else if ([0, 1, 6, 7, 8, 9, 30, 37, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26].indexOf(VehicleTypeID) != -1) { // LF acts as 'Tragehilfe'
|
|
// 30 acts as Rüstwagen
|
|
if ([30].indexOf(VehicleTypeID) != -1) {
|
|
ADis_VehiclesNeed["4"]--;
|
|
ADis_VehiclesNeed["39"]--;
|
|
}
|
|
// 0 acts as all LF
|
|
ADis_VehiclesNeed["0"]--;
|
|
} else if ([74].indexOf(VehicleTypeID) != -1) {
|
|
ADis_VehiclesNeed["74"]--;
|
|
ADis_VehiclesNeed["28"]--;
|
|
ADis_VehiclesNeed["29"]--;
|
|
} else if ([73].indexOf(VehicleTypeID) != -1) {
|
|
ADis_VehiclesNeed["73"]--;
|
|
} else if ([28].indexOf(VehicleTypeID) != -1) {
|
|
ADis_VehiclesNeed["28"]--;
|
|
} else if ([29].indexOf(VehicleTypeID) != -1) {
|
|
ADis_VehiclesNeed["29"]--;
|
|
} else if ([31].indexOf(VehicleTypeID) != -1) {
|
|
ADis_VehiclesNeed["31"]--;
|
|
} else if ([55].indexOf(VehicleTypeID) != -1) {
|
|
ADis_VehiclesNeed["55"]--;
|
|
} else if ([56].indexOf(VehicleTypeID) != -1) {
|
|
ADis_VehiclesNeed["56"]--;
|
|
} else if ([58].indexOf(VehicleTypeID) != -1) {
|
|
ADis_VehiclesNeed["58"]--;
|
|
} else if ([59].indexOf(VehicleTypeID) != -1) {
|
|
ADis_VehiclesNeed["59"]--;
|
|
} else if ([60].indexOf(VehicleTypeID) != -1) {
|
|
ADis_VehiclesNeed["60"]--;
|
|
} else if ([2].indexOf(VehicleTypeID) != -1) {
|
|
ADis_VehiclesNeed["2"]--;
|
|
} else if ([34, 78].indexOf(VehicleTypeID) != -1) {
|
|
ADis_VehiclesNeed["3"]--;
|
|
ADis_VehiclesNeed["34"]--;
|
|
} else if ([3].indexOf(VehicleTypeID) != -1) {
|
|
ADis_VehiclesNeed["3"]--;
|
|
} else if ([36].indexOf(VehicleTypeID) != -1) {
|
|
ADis_VehiclesNeed["36"]--;
|
|
} else if ([57].indexOf(VehicleTypeID) != -1) {
|
|
ADis_VehiclesNeed["57"]--;
|
|
} else if ([4,39].indexOf(VehicleTypeID) != -1) {
|
|
ADis_VehiclesNeed["4"]--;
|
|
ADis_VehiclesNeed["39"]--;
|
|
} else if ([4, 47].indexOf(VehicleTypeID) != -1) {
|
|
ADis_VehiclesNeed["4"]--;
|
|
} else if ([5, 48].indexOf(VehicleTypeID) != -1) {
|
|
ADis_VehiclesNeed["5"]--;
|
|
} else if ([10, 49].indexOf(VehicleTypeID) != -1) {
|
|
ADis_VehiclesNeed["10"]--;
|
|
} else if ([12].indexOf(VehicleTypeID) != -1) {
|
|
ADis_VehiclesNeed["12"]--;
|
|
} else if ([11, 13, 14, 15, 16].indexOf(VehicleTypeID) != -1) {
|
|
ADis_VehiclesNeed["11"]--;
|
|
} else if ([27, 77].indexOf(VehicleTypeID) != -1) {
|
|
ADis_VehiclesNeed["27"]--;
|
|
} else if ([33].indexOf(VehicleTypeID) != -1) {
|
|
ADis_VehiclesNeed["33"]--;
|
|
} else if ([53, 54].indexOf(VehicleTypeID) != -1) {
|
|
ADis_VehiclesNeed["53"]--;
|
|
} else if ([83].indexOf(VehicleTypeID) != -1) {
|
|
ADis_VehiclesNeed["83"]--;
|
|
} else if ([84].indexOf(VehicleTypeID) != -1) {
|
|
ADis_VehiclesNeed["84"]--;
|
|
} else if ([85].indexOf(VehicleTypeID) != -1) {
|
|
ADis_VehiclesNeed["85"]--;
|
|
ADis_VehiclesNeed["2"]--;
|
|
} else if ([86].indexOf(VehicleTypeID) != -1) {
|
|
ADis_VehiclesNeed["86"]--;
|
|
} else if ([75].indexOf(VehicleTypeID) != -1) {
|
|
ADis_VehiclesNeed["75"]--;
|
|
} else if ([76].indexOf(VehicleTypeID) != -1) {
|
|
ADis_VehiclesNeed["76"]--;
|
|
} else if ([32].indexOf(VehicleTypeID) != -1) {
|
|
ADis_VehiclesNeed["32"]--;
|
|
} else if ([35].indexOf(VehicleTypeID) != -1) {
|
|
ADis_VehiclesNeed["35"]--;
|
|
} else if ([50].indexOf(VehicleTypeID) != -1) {
|
|
ADis_VehiclesNeed["50"]--;
|
|
} else if ([51].indexOf(VehicleTypeID) != -1) {
|
|
ADis_VehiclesNeed["51"]--;
|
|
} else if ([52].indexOf(VehicleTypeID) != -1) {
|
|
ADis_VehiclesNeed["52"]--;
|
|
} else if ([72].indexOf(VehicleTypeID) != -1) {
|
|
ADis_VehiclesNeed["72"]--;
|
|
} else if ([61].indexOf(VehicleTypeID) != -1) {
|
|
ADis_VehiclesNeed["61"]--;
|
|
} else if ([79].indexOf(VehicleTypeID) != -1) {
|
|
ADis_VehiclesNeed["79"]--;
|
|
} else if ([80].indexOf(VehicleTypeID) != -1) {
|
|
ADis_VehiclesNeed["80"]--;
|
|
} else if ([81].indexOf(VehicleTypeID) != -1) {
|
|
ADis_VehiclesNeed["81"]--;
|
|
} else if ([82].indexOf(VehicleTypeID) != -1) {
|
|
ADis_VehiclesNeed["82"]--;
|
|
} else if ([63, 69].indexOf(VehicleTypeID) != -1) {
|
|
ADis_VehiclesNeed["63"]--;
|
|
} else if ([64].indexOf(VehicleTypeID) != -1) {
|
|
ADis_VehiclesNeed["64"]--;
|
|
} else if ([66, 67, 68, 70, 71].indexOf(VehicleTypeID) != -1) {
|
|
ADis_VehiclesNeed["70"]--;
|
|
} else if ([40].indexOf(VehicleTypeID) != -1) {
|
|
ADis_VehiclesNeed["40"]--;
|
|
} else if ([41].indexOf(VehicleTypeID) != -1) {
|
|
ADis_VehiclesNeed["41"]--;
|
|
} else if ([42].indexOf(VehicleTypeID) != -1) {
|
|
ADis_VehiclesNeed["42"]--;
|
|
} else if ([43].indexOf(VehicleTypeID) != -1) {
|
|
ADis_VehiclesNeed["43"]--;
|
|
} else if ([44].indexOf(VehicleTypeID) != -1) {
|
|
ADis_VehiclesNeed["44"]--;
|
|
} else if ([45].indexOf(VehicleTypeID) != -1) {
|
|
ADis_VehiclesNeed["45"]--;
|
|
} else if ([65].indexOf(VehicleTypeID) != -1) {
|
|
ADis_VehiclesNeed["65"]--;
|
|
}
|
|
}
|
|
|
|
function ADis_CheckNeedMoreVehicles() {
|
|
var NeedMoreVehicles = false;
|
|
|
|
for (var Key in ADis_VehiclesNeed) {
|
|
var VehicleCount = ADis_VehiclesNeed[Key];
|
|
if (VehicleCount > 0) {
|
|
NeedMoreVehicles = true;
|
|
}
|
|
};
|
|
|
|
return NeedMoreVehicles;
|
|
}
|
|
}
|
|
// -
|
|
// - Sprechwunsch Variablen
|
|
// -
|
|
var Jails = [];
|
|
var JailRegEx = /\(Freie Zellen\:\s+(\d)\,\s+Entfernung\:\s+(\d+\,\d+)\s+km(?:\,\s+Abgabe an Besitzer\:\s+(\d+)%)?\)/g;
|
|
var Hospitals = [];
|
|
var RescueVehicleFrameWatchDog;
|
|
var PoliceVehicleFrameWatchDog;
|
|
|
|
|
|
// -
|
|
// - Sprechwunsch Queue
|
|
// -
|
|
|
|
function ADis_RemovePoliceSprechwunschFromQueue(WunschID) {
|
|
console.log(WunschID, typeof WunschID);
|
|
return ADisDB.ADisSprechwunschPolice.where({
|
|
missionID: WunschID
|
|
}).delete();
|
|
}
|
|
|
|
// -
|
|
// - Sprechwunsch Opener
|
|
// -
|
|
if (window.location.pathname === "/" || window.location.pathname === "/#") {
|
|
$(document).ready(function () {
|
|
setInterval(ADis_CollectRescueSprechwuensche, 2500);
|
|
setInterval(ADis_OpenNextRescueSprechwunsch, 2500);
|
|
ADis_CollectRescueSprechwuensche();
|
|
});
|
|
|
|
// - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
|
// -
|
|
// - Assign & Unassign Missions to Dispatchers
|
|
// -
|
|
// - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
|
|
|
function ADis_CollectRescueSprechwuensche() {
|
|
ADisDB.ADisSprechwunsch.where({
|
|
done: 'false'
|
|
}).each((Wunsch) => {
|
|
if ($("#vehicle_list_" + Wunsch.vehicleID).find(".building_list_fms").text() != "5") {
|
|
return ADis_RemoveRescueSprechwunschFromQueue(Wunsch.vehicleID);
|
|
}
|
|
}).then(() => {
|
|
$("#building_list").find(".building_list_vehicle_element").each(function () {
|
|
var VehicleStatus = $(this).find(".building_list_fms").text();
|
|
// var VehicleType = $(this).find("a").attr("vehicle_type_id");
|
|
var VehicleID = $(this).attr("vehicle_id");
|
|
if (VehicleStatus == "5") {
|
|
ADis_AddRescueSprechwunschToQueue(VehicleID);
|
|
}
|
|
});
|
|
});
|
|
}
|
|
|
|
function ADis_OpenNextRescueSprechwunsch() {
|
|
ADisSettings().then((setting) => {
|
|
if (setting['Sprechwunsch-Automatic'] == 'true') {
|
|
return ADisDB.ADisSprechwunsch.where({
|
|
done: 'false'
|
|
}).limit(1)
|
|
}
|
|
}).then((Wunsch) => {
|
|
if (Wunsch !== undefined) {
|
|
Wunsch.each((myWunsch) => {
|
|
let VehicleID = myWunsch.vehicleID;
|
|
ADis_UpdateRescueSprechwunschToDone(VehicleID).then(() => {
|
|
if ($("#adis-sprechwunsch-rescue-frame").attr("vehicle_id") == "empty") {
|
|
$("#adis-sprechwunsch-rescue-frame").attr("src", "https://www.leitstellenspiel.de/vehicles/" + VehicleID);
|
|
$("#adis-sprechwunsch-rescue-frame").attr("vehicle_id", VehicleID);
|
|
|
|
RescueVehicleFrameWatchDog = setTimeout(async function () {
|
|
ADis_RemoveRescueSprechwunschFromQueue(VehicleID).then((deleteCount) => {
|
|
$("#adis-sprechwunsch-rescue-frame").attr("src", "");
|
|
$("#adis-sprechwunsch-rescue-frame").attr("vehicle_id", "empty");
|
|
});
|
|
}, 1500);
|
|
}
|
|
});
|
|
});
|
|
}
|
|
});
|
|
}
|
|
|
|
function ADis_AddRescueSprechwunschToQueue(WunschID) {
|
|
return ADisDB.ADisSprechwunsch.add({
|
|
vehicleID: WunschID,
|
|
done: 'false'
|
|
}).catch((err) => {})
|
|
}
|
|
|
|
|
|
function ADis_UpdateRescueSprechwunschToDone(WunschID) {
|
|
return ADisDB.ADisSprechwunsch.put({
|
|
vehicleID: WunschID,
|
|
done: 'true'
|
|
}).catch((err) => {})
|
|
}
|
|
|
|
function ADis_RemoveRescueSprechwunschFromQueue(WunschID) {
|
|
return ADisDB.ADisSprechwunsch.where({
|
|
vehicleID: WunschID
|
|
}).delete();
|
|
}
|
|
$(document).ready(function () {
|
|
setInterval(ADis_CollectPoliceSprechwuensche, 7500);
|
|
setInterval(ADis_OpenNextPoliceSprechwunsch, 7500);
|
|
ADis_CollectPoliceSprechwuensche();
|
|
});
|
|
|
|
// - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
|
// -
|
|
// - Assign & Unassign Missions to Dispatchers
|
|
// -
|
|
// - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
|
|
|
function ADis_CollectPoliceSprechwuensche() {
|
|
ADisDB.ADisSprechwunschPolice.where({
|
|
done: 'false'
|
|
}).each((Wunsch) => {
|
|
if (!$("#mission_" + Wunsch.missionID).text().match(/Gefangene sollen abtransportiert werden/g)) {
|
|
$("#mission_" + Wunsch.missionID).remove();
|
|
return ADis_RemovePoliceSprechwunschFromQueue(Wunsch.missionID);
|
|
}
|
|
}).then(() => {
|
|
var MOIODOS = $('div#mission_list div.missionSideBarEntry:visible');
|
|
MOIODOS.each(function (index) {
|
|
if ($(this).text().match(/Gefangene sollen abtransportiert werden\./gmu)) {
|
|
var MissionID = $(this).attr("mission_id");
|
|
ADis_AddPoliceSprechwunschToQueue(MissionID);
|
|
}
|
|
});
|
|
});
|
|
}
|
|
|
|
function ADis_OpenNextPoliceSprechwunsch() {
|
|
ADisSettings().then((setting) => {
|
|
if (setting['Sprechwunsch-Automatic'] == 'true') {
|
|
return ADisDB.ADisSprechwunschPolice.where({
|
|
done: 'false'
|
|
}).limit(1)
|
|
}
|
|
}).then((Wunsch) => {
|
|
if (Wunsch !== undefined) {
|
|
Wunsch.each((myWunsch) => {
|
|
let MissionID = myWunsch.missionID;
|
|
ADis_UpdatePoliceSprechwunschToDone(MissionID).then(() => {
|
|
if ($("#adis-sprechwunsch-police-frame").attr("mission_id") == "empty") {
|
|
$("#adis-sprechwunsch-police-frame").attr("src", "https://www.leitstellenspiel.de/missions/" + MissionID);
|
|
$("#adis-sprechwunsch-police-frame").attr("mission_id", MissionID);
|
|
|
|
PoliceVehicleFrameWatchDog = setTimeout(async function (MissionID) {
|
|
ADis_RemovePoliceSprechwunschFromQueue(MissionID).then((deleteCount) => {
|
|
$("#adis-sprechwunsch-police-frame").attr("src", "");
|
|
$("#adis-sprechwunsch-police-frame").attr("mission_id", "empty");
|
|
});
|
|
}, 2500, MissionID);
|
|
}
|
|
});
|
|
});
|
|
}
|
|
});
|
|
}
|
|
|
|
function ADis_AddPoliceSprechwunschToQueue(WunschID) {
|
|
return ADisDB.ADisSprechwunschPolice.add({
|
|
missionID: WunschID,
|
|
done: 'false'
|
|
}).catch((err) => {})
|
|
}
|
|
|
|
|
|
function ADis_UpdatePoliceSprechwunschToDone(WunschID) {
|
|
console.log(WunschID, typeof WunschID);
|
|
return ADisDB.ADisSprechwunschPolice.add({
|
|
missionID: WunschID,
|
|
done: 'true'
|
|
}).catch((err) => {})
|
|
}
|
|
|
|
/**
|
|
* #mission_missing_905214286
|
|
* //*[@id="mission_missing_905214286"]
|
|
*
|
|
* const regex = /^Gefangene sollen abtransportiert werden\.$/gmu;
|
|
const str = `Alarm Massenschlägerei, Uferweg, 27749 Düsternort Delmenhorst
|
|
Gefangene sollen abtransportiert werden.
|
|
Sophie V.
|
|
Anna T.
|
|
Franziska M.`;
|
|
let m;
|
|
|
|
while ((m = regex.exec(str)) !== null) {
|
|
// This is necessary to avoid infinite loops with zero-width matches
|
|
if (m.index === regex.lastIndex) {
|
|
regex.lastIndex++;
|
|
}
|
|
|
|
// The result can be accessed through the `m`-variable.
|
|
m.forEach((match, groupIndex) => {
|
|
console.log(`Found match, group ${groupIndex}: ${match}`);
|
|
});
|
|
}
|
|
*/
|
|
}
|
|
|
|
// -
|
|
// - Sprechwunsch Handler Rettung
|
|
// -
|
|
if (window.location.pathname.indexOf("/vehicles/") !== -1 && window.name == 'adis-sprechwunsch-rescue') {
|
|
$(document).ready(function () {
|
|
setTimeout(function () {
|
|
ADis_Check_Call_Active();
|
|
}, 500);
|
|
});
|
|
|
|
function ADis_Check_Call_Active() {
|
|
if ($("h4:contains('Eigene Krankenhäuser')").length > 0 || $("h4:contains('Verbandskrankenhäuser')").length > 0) {
|
|
ADis_Collect_Hospitals();
|
|
}
|
|
}
|
|
|
|
// Krankenhaus auswählen
|
|
function ADis_Collect_Hospitals() {
|
|
if ($("h4:contains('Eigene Krankenhäuser')").length > 0) {
|
|
$("h4:contains('Eigene Krankenhäuser')").next("table").find("tbody").find("tr").each(function () {
|
|
var HospitalHref = $(this).find("a:contains('Anfahren')").attr("href");
|
|
var HospitalID = Number(parseInt($(this).find("a:contains('Anfahren')").attr("id").replace("btn_approach_", "")));
|
|
var HospitalDistance = parseInt($(this).find("td").eq("1").text());
|
|
var HospitalFreeBeds = parseInt($(this).find("td").eq("2").text());
|
|
|
|
var HospitalValue = HospitalDistance * 450 * -1;
|
|
HospitalValue += 2000; // Own Hospitals are better :-)
|
|
if ($(this).find(".label:contains('Ja')").length > 0) {
|
|
HospitalValue += 2000;
|
|
}
|
|
|
|
if (HospitalFreeBeds > 0) {
|
|
Hospitals.push({
|
|
"id": HospitalID,
|
|
"value": HospitalValue,
|
|
"distance": HospitalDistance,
|
|
"href": HospitalHref
|
|
});
|
|
}
|
|
});
|
|
}
|
|
|
|
if ($("h4:contains('Verbandskrankenhäuser')").length > 0) {
|
|
$("h4:contains('Verbandskrankenhäuser')").next("table").find("tbody").find("tr").each(function () {
|
|
var HospitalHref = $(this).find("a").attr("href")
|
|
var HospitalID = Number(parseInt(HospitalHref.substr(HospitalHref.lastIndexOf("/") + 1)));
|
|
var HospitalDistance = parseInt($(this).find("td").eq("1").text());
|
|
var HospitalFreeBeds = parseInt($(this).find("td").eq("2").text());
|
|
var HospitalTaxes = parseInt($(this).find("td").eq("3").text());
|
|
var HospitalSpecialDepartment = false;
|
|
|
|
// Add Button-ID to Alliance-Hospital
|
|
$(this).find("a").attr("id", "btn_approach_" + HospitalID.toString());
|
|
|
|
var HospitalValue = HospitalDistance * 450 * -1;
|
|
|
|
if ($(this).find(".label:contains('Ja')").length > 0) {
|
|
HospitalSpecialDepartment = true;
|
|
HospitalValue += 2000;
|
|
}
|
|
|
|
if (HospitalTaxes == 0) {
|
|
HospitalValue += 2000;
|
|
} else if (HospitalTaxes > 0 && HospitalTaxes <= 10) {
|
|
HospitalValue += 1000;
|
|
} else if (HospitalTaxes > 10 && HospitalTaxes <= 20) {
|
|
HospitalValue += 0;
|
|
} else {
|
|
HospitalValue -= 5000;
|
|
}
|
|
|
|
if (HospitalFreeBeds > 0 && HospitalSpecialDepartment) {
|
|
Hospitals.push({
|
|
"id": HospitalID,
|
|
"value": HospitalValue,
|
|
"taxes": HospitalTaxes,
|
|
"distance": HospitalDistance,
|
|
"href": HospitalHref
|
|
});
|
|
}
|
|
});
|
|
}
|
|
|
|
Hospitals.sort(function (a, b) {
|
|
return a.value - b.value;
|
|
});
|
|
|
|
Hospitals.reverse();
|
|
ADis_Send_Vehicle_To_Hospital()
|
|
}
|
|
|
|
// Krankenhaus einlieferung
|
|
function ADis_Send_Vehicle_To_Hospital() {
|
|
//var HospitalID = Hospitals[0].id;
|
|
var HospitalHref = Hospitals[0].href;
|
|
|
|
// TODO: tellParent("ADisMissionDone(" + window.name + "," + MissionID + ");");
|
|
document.location.href = document.location.origin + HospitalHref;
|
|
|
|
}
|
|
}
|
|
|
|
// -
|
|
// - Sprechwunsch Handler Polizei/Gefangene
|
|
// -
|
|
if (window.location.pathname.indexOf("/missions/") !== -1 && window.name == 'adis-sprechwunsch-police') {
|
|
$(document).ready(function () {
|
|
setTimeout(function () {
|
|
ADis_Check_Call_Police_Active();
|
|
}, 500);
|
|
});
|
|
|
|
function ADis_Check_Call_Police_Active() {
|
|
if ($('#h2_prisoners').length > 0) {
|
|
ADis_Collect_Jails();
|
|
} else {
|
|
ADis_RemovePoliceSprechwunschFromQueue(MissionID).then((deleteCount) => {
|
|
$("#adis-sprechwunsch-police-frame").attr("src", "");
|
|
$("#adis-sprechwunsch-police-frame").attr("mission_id", "empty");
|
|
});
|
|
}
|
|
}
|
|
|
|
// Gefängnis auswählen
|
|
function ADis_Collect_Jails() {
|
|
var CountGefangene = Number(parseInt($('#h2_prisoners').text()));
|
|
var parentNode = $('#mission_vehicle_at_mission tr > td:nth-child(5) > a:contains("Jomaar")').parent().parent();
|
|
var GefKw = parentNode.find('td:nth-child(2) > a[vehicle_type_id="52"]');
|
|
var FuStW = parentNode.find('td:nth-child(2) > a[vehicle_type_id="32"]');
|
|
var GefKwGefaegnisse = $(GefKw[0]).parent().parent().next('tr');
|
|
var FuStWGefaegnisse = $(FuStW[0]).parent().parent().next('tr');
|
|
|
|
GefKwGefaegnisse.find("a:contains('Freie Zellen')").each(function () {
|
|
var JailHref = $(this).attr("href");
|
|
var JailID = JailHref.split("/").pop();
|
|
var JailText = $(this).text();
|
|
var JailFreeBeds = 0;
|
|
var JailDistance = 0;
|
|
var JailTax = 0;
|
|
let m;
|
|
while ((m = JailRegEx.exec(JailText)) !== null) {
|
|
// This is necessary to avoid infinite loops with zero-width matches
|
|
if (m.index === JailRegEx.lastIndex) {
|
|
JailRegEx.lastIndex++;
|
|
}
|
|
|
|
// The result can be accessed through the `m`-variable.
|
|
m.forEach((match, groupIndex) => {
|
|
if (groupIndex == 1) {
|
|
JailFreeBeds = parseInt(match.trim());
|
|
} else if (groupIndex == 2) {
|
|
JailDistance = parseInt(match.trim());
|
|
} else if (groupIndex == 3 && typeof match != "undefined") {
|
|
JailTax = parseInt(match.trim());
|
|
}
|
|
});
|
|
}
|
|
|
|
var JailValue = JailDistance * 450 * -1;
|
|
JailValue += 11; //GefKw bevorzugt
|
|
|
|
if (JailTax == 0) {
|
|
JailValue += 10000;
|
|
} else if (JailTax > 0 && JailTax <= 10) {
|
|
JailValue += 5000;
|
|
} else if (JailTax > 10 && JailTax <= 20) {
|
|
JailValue += 1000;
|
|
} else {
|
|
JailValue -= 10000;
|
|
}
|
|
|
|
if (JailFreeBeds >= 5) {
|
|
JailValue += 15000;
|
|
} else if (JailFreeBeds >= 1) {
|
|
JailValue += 1000;
|
|
} else {
|
|
JailValue -= 5000;
|
|
}
|
|
|
|
if (JailFreeBeds >= 5) {
|
|
Jails.push({
|
|
"id": JailID,
|
|
"value": JailValue + 1000,
|
|
"text": JailText,
|
|
"distance": JailDistance,
|
|
"href": JailHref
|
|
});
|
|
} else if (JailFreeBeds >= 1) {
|
|
Jails.push({
|
|
"id": JailID,
|
|
"value": JailValue,
|
|
"text": JailText,
|
|
"distance": JailDistance,
|
|
"href": JailHref
|
|
});
|
|
}
|
|
});
|
|
FuStWGefaegnisse.find("a:contains('Freie Zellen')").each(function () {
|
|
var JailHref = $(this).attr("href");
|
|
var JailID = JailHref.split("/").pop();
|
|
var JailText = $(this).text();
|
|
var JailFreeBeds = 0;
|
|
var JailDistance = 0;
|
|
var JailTax = 0;
|
|
let m;
|
|
while ((m = JailRegEx.exec(JailText)) !== null) {
|
|
// This is necessary to avoid infinite loops with zero-width matches
|
|
if (m.index === JailRegEx.lastIndex) {
|
|
JailRegEx.lastIndex++;
|
|
}
|
|
|
|
// The result can be accessed through the `m`-variable.
|
|
m.forEach((match, groupIndex) => {
|
|
if (groupIndex == 1) {
|
|
JailFreeBeds = parseInt(match.trim());
|
|
} else if (groupIndex == 2) {
|
|
JailDistance = parseInt(match.trim());
|
|
} else if (groupIndex == 3 && typeof match != "undefined") {
|
|
JailTax = parseInt(match.trim());
|
|
}
|
|
});
|
|
}
|
|
|
|
var JailValue = JailDistance * 450 * -1;
|
|
|
|
if (JailTax == 0) {
|
|
JailValue += 10000;
|
|
} else if (JailTax > 0 && JailTax <= 10) {
|
|
JailValue += 5000;
|
|
} else if (JailTax > 10 && JailTax <= 20) {
|
|
JailValue += 1000;
|
|
} else {
|
|
JailValue -= 10000;
|
|
}
|
|
|
|
if (JailFreeBeds >= 5) {
|
|
JailValue += 15000;
|
|
} else if (JailFreeBeds >= 1) {
|
|
JailValue += 1000;
|
|
} else {
|
|
JailValue -= 5000;
|
|
}
|
|
|
|
if (JailFreeBeds >= CountGefangene) {
|
|
Jails.push({
|
|
"id": JailID,
|
|
"value": JailValue + 1000,
|
|
"text": JailText,
|
|
"distance": JailDistance,
|
|
"href": JailHref
|
|
});
|
|
} else if (JailFreeBeds >= 1) {
|
|
Jails.push({
|
|
"id": JailID,
|
|
"value": JailValue,
|
|
"text": JailText,
|
|
"distance": JailDistance,
|
|
"href": JailHref
|
|
});
|
|
}
|
|
});
|
|
|
|
Jails.sort(function (a, b) {
|
|
return a.value - b.value;
|
|
});
|
|
|
|
Jails.reverse();
|
|
if (Jails.length > 0) {
|
|
ADis_Send_Vehicle_To_Jail()
|
|
} else {
|
|
$("#mission_vehicle_driving tbody, #mission_vehicle_at_mission tbody").find("tr").each(function () {
|
|
var CalledVehicleID = parseInt($(this).find("a").first().attr("vehicle_type_id"));
|
|
if (CalledVehicleID == 52) {
|
|
CountGefangene -= 5;
|
|
} else if (CalledVehicleID == 32) {
|
|
CountGefangene -= 1;
|
|
}
|
|
});
|
|
|
|
if ($('#vehicle_show_table_all tr[vehicle_type="GefKw"] input[type="checkbox"]').size() > 0 && CountGefangene >= 5) {
|
|
$('#vehicle_show_table_all tr[vehicle_type="GefKw"] input[type="checkbox"]').each(function () {
|
|
if (CountGefangene > 0) {
|
|
$(this).click()
|
|
CountGefangene -= 5;
|
|
}
|
|
});
|
|
}
|
|
if ($('#vehicle_show_table_all tr[vehicle_type="FuStW"] input[type="checkbox"]').size() > 0 && CountGefangene > 0) {
|
|
$('#vehicle_show_table_all tr[vehicle_type="FuStW"] input[type="checkbox"]').each(function () {
|
|
if (CountGefangene > 0) {
|
|
$(this).click()
|
|
CountGefangene -= 1;
|
|
}
|
|
});
|
|
}
|
|
if ($('#vehicle_show_table_all input[type="checkbox"]:checked').size() > 0) {
|
|
$('#mission_alarm_btn').click();
|
|
}
|
|
}
|
|
}
|
|
|
|
// Gefängnis einlieferung
|
|
function ADis_Send_Vehicle_To_Jail() {
|
|
var JailHref = Jails[0].href
|
|
document.location.href = document.location.origin + JailHref;
|
|
}
|
|
}
|
|
|
|
}); |