From e2324e640e5b5025dcd8609539af4009d8f009bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20Fr=C3=B6hle?= Date: Tue, 18 Dec 2018 00:03:26 +0100 Subject: [PATCH] v2 update planned events --- dist/autoloader.js | 2 +- dist/autoloaderV2.js | 68 ++++++++++++++++++++++++++++---------------- src/autoloaderV2.js | 66 ++++++++++++++++++++++++++---------------- 3 files changed, 86 insertions(+), 50 deletions(-) diff --git a/dist/autoloader.js b/dist/autoloader.js index dbda173..4559e45 100755 --- a/dist/autoloader.js +++ b/dist/autoloader.js @@ -1,4 +1,4 @@ -/*Generated on:Mon Dec 17 2018 23:55:27 GMT+0100 (CET)*/ +/*Generated on:Tue Dec 18 2018 00:03:25 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(); diff --git a/dist/autoloaderV2.js b/dist/autoloaderV2.js index 90c292a..2ba98ef 100644 --- a/dist/autoloaderV2.js +++ b/dist/autoloaderV2.js @@ -1,4 +1,4 @@ -/*Generated on:Mon Dec 17 2018 23:55:27 GMT+0100 (CET)*/ +/*Generated on:Tue Dec 18 2018 00:03:25 GMT+0100 (CET)*/ /* * Dexie.js - a minimalistic wrapper for IndexedDB * =============================================== @@ -17646,7 +17646,7 @@ class AutomaticDispose { } }); - if ($('#vehicle_show_table_all tr[vehicle_type="GefKw"] input[type="checkbox"]').size() > 0 && CountGefangene >= 5) { + if ($('#vehicle_show_table_all tr[vehicle_type="GefKw"] input[type="checkbox"]').length > 0 && CountGefangene >= 5) { $('#vehicle_show_table_all tr[vehicle_type="GefKw"] input[type="checkbox"]').each((_, elem) => { if (CountGefangene > 0) { $(elem).click() @@ -17654,7 +17654,7 @@ class AutomaticDispose { } }); } - if ($('#vehicle_show_table_all tr[vehicle_type="FuStW"] input[type="checkbox"]').size() > 0 && CountGefangene > 0) { + if ($('#vehicle_show_table_all tr[vehicle_type="FuStW"] input[type="checkbox"]').length > 0 && CountGefangene > 0) { $('#vehicle_show_table_all tr[vehicle_type="FuStW"] input[type="checkbox"]').each((_, elem) => { if (CountGefangene > 0) { $(elem).click() @@ -17662,7 +17662,7 @@ class AutomaticDispose { } }); } - if ($('#vehicle_show_table_all input[type="checkbox"]:checked').size() > 0) { + if ($('#vehicle_show_table_all input[type="checkbox"]:checked').length > 0) { $('#mission_alarm_btn').click(); } } @@ -18432,7 +18432,7 @@ class AutomaticDispose { return self.RemoveMissionsFromQueue(self.MissionID).then(() => { return tellParent(`console.log('handler:1000:done:${window.name}:${self.MissionID}');window.AutomaticDisposeCall.FreeIframe('${self.MyRunner}');`); // delete Mission here as completed }) - } else if (self.includesString($('#iframe-inside-container > div.alert.fade.in.alert-success').text(), "wurde erfolgreich informiert") /*|| $('#vehicle_show_table_all input[type="checkbox"]:checked').size() > 0*/ ) { + } else if (self.includesString($('#iframe-inside-container > div.alert.fade.in.alert-success').text(), "wurde erfolgreich informiert") /*|| $('#vehicle_show_table_all input[type="checkbox"]:checked').length > 0*/ ) { console.log("SEND"); console.log("SEND: " + self.MissionID); return self.UpdateMissionsToDone(self.MissionID).then(() => { @@ -18462,45 +18462,45 @@ class AutomaticDispose { var title = document.getElementById('missionH1'); var isVerband = title.innerText.toLowerCase().includes("[verband]"); if (setting['Alliance-Automatic'] == 'true' && isVerband) { - if ([52, 55, 129, 203].indexOf(self.MissionType) !== -1 && $('#vehicle_show_table_all tr[vehicle_type="FuStW"] input[type="checkbox"]').size() > 0) { + if ([52, 55, 129, 203].indexOf(self.MissionType) !== -1 && $('#vehicle_show_table_all tr[vehicle_type="FuStW"] input[type="checkbox"]').length > 0) { $('#vehicle_show_table_all tr[vehicle_type="FuStW"] input[type="checkbox"]')[0].click(); } else if ([53, 130, 202].indexOf(self.MissionType) !== -1) { - if ($('#vehicle_show_table_all tr[vehicle_type="FLF"] input[type="checkbox"]').size() > 0) { + if ($('#vehicle_show_table_all tr[vehicle_type="FLF"] input[type="checkbox"]').length > 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) { + } else if ($('#vehicle_show_table_all tr[vehicle_type="GW-A"] input[type="checkbox"]').length > 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) { + } else if ($('#vehicle_show_table_all tr[vehicle_type="GW-Öl"] input[type="checkbox"]').length > 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) { + } else if ($('#vehicle_show_table_all tr[vehicle_type="NEF"] input[type="checkbox"]').length > 0) { $('#vehicle_show_table_all tr[vehicle_type="NEF"] input[type="checkbox"]')[0].click(); } } else if ([54, 56].indexOf(self.MissionType) !== -1) { - if ($('#vehicle_show_table_all tr[vehicle_type="FLF"] input[type="checkbox"]').size() > 0) { + if ($('#vehicle_show_table_all tr[vehicle_type="FLF"] input[type="checkbox"]').length > 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) { + } else if ($('#vehicle_show_table_all tr[vehicle_type="FuStW"] input[type="checkbox"]').length > 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) { + } else if ($('#vehicle_show_table_all tr[vehicle_type="GW-A"] input[type="checkbox"]').length > 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) { + } else if ($('#vehicle_show_table_all tr[vehicle_type="GW-Öl"] input[type="checkbox"]').length > 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) { + } else if ($('#vehicle_show_table_all tr[vehicle_type="LF 20"] input[type="checkbox"]').length > 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) { + } else if ($('#vehicle_show_table_all tr[vehicle_type="LF 20/16"] input[type="checkbox"]').length > 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) { + } else if ($('#vehicle_show_table_all tr[vehicle_type="HLF 20"] input[type="checkbox"]').length > 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) { + } else if ($('#vehicle_show_table_all tr[vehicle_type="TLF 8/8"] input[type="checkbox"]').length > 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) { + if ($('#vehicle_show_table_all tr[vehicle_type="FuStW"] input[type="checkbox"]').length > 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) { + } else if ($('#vehicle_show_table_all tr[vehicle_type="KTW Typ B"] input[type="checkbox"]').length > 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) { + if ($('#vehicle_show_table_all input[type="checkbox"]:checked').length > 0) { $('#mission_alarm_btn').click(); } } @@ -18543,7 +18543,7 @@ class AutomaticDispose { if (self.MyRunner == 'os') { self.OweSecure = true; } - self.GetMissionConfiguration(self.MyRunner == 'kt' ? 147 : Mission.type); + self.GetMissionConfiguration(Mission.type); } }); } @@ -18582,31 +18582,49 @@ class AutomaticDispose { }).then(async () => { return await self.CollectInvolvedVehicles(); }).then(async () => { + if (self.MyRunner == 'os' && self.Vehicles.length > 0){ + return + } return await self.CollectPatients(); }) .then(async () => { + if (self.MyRunner == 'os' && self.Vehicles.length > 0){ + return + } return await self.ProcessEmergencyMedicalService() }) .then(async () => { + if (self.MyRunner == 'os' && self.Vehicles.length > 0){ + return + } return await self.ProcessFireDepartment() }) .then(async () => { + if (self.MyRunner == 'os' && self.Vehicles.length > 0){ + return + } return await self.ProcessPoliceDepartment() }) .then(async () => { + if (self.MyRunner == 'os' && self.Vehicles.length > 0){ + return + } return await self.ProcessTechnicalEmergencyService() }) .then(async () => { + if (self.MyRunner == 'os' && self.Vehicles.length > 0){ + return + } return await self.ProcessWaterRescue() }).then(() => { - if (self.OweSecure) { - if ($('#vehicle_show_table_all tr[vehicle_type="FuStW"] input[type="checkbox"]:not(:checked)').size() > 0) { + if (self.OweSecure && $('#vehicle_show_table_all tr[vehicle_type="FuStW"] input[type="checkbox"]:checked').length == 0) { + if ($('#vehicle_show_table_all tr[vehicle_type="FuStW"] input[type="checkbox"]:not(:checked)').length > 0) { $('#vehicle_show_table_all tr[vehicle_type="FuStW"] input[type="checkbox"]:not(:checked)')[0].click(); } } - // console.log("Clicked Vehicles: ", $('#vehicle_show_table_all input[type="checkbox"]:checked').size(), $('#vehicle_show_table_all input[type="checkbox"]:checked')); + // console.log("Clicked Vehicles: ", $('#vehicle_show_table_all input[type="checkbox"]:checked').length, $('#vehicle_show_table_all input[type="checkbox"]:checked')); // console.log("WILL KLICK SEND") setTimeout(() => { diff --git a/src/autoloaderV2.js b/src/autoloaderV2.js index 678600a..30028ca 100644 --- a/src/autoloaderV2.js +++ b/src/autoloaderV2.js @@ -639,7 +639,7 @@ class AutomaticDispose { } }); - if ($('#vehicle_show_table_all tr[vehicle_type="GefKw"] input[type="checkbox"]').size() > 0 && CountGefangene >= 5) { + if ($('#vehicle_show_table_all tr[vehicle_type="GefKw"] input[type="checkbox"]').length > 0 && CountGefangene >= 5) { $('#vehicle_show_table_all tr[vehicle_type="GefKw"] input[type="checkbox"]').each((_, elem) => { if (CountGefangene > 0) { $(elem).click() @@ -647,7 +647,7 @@ class AutomaticDispose { } }); } - if ($('#vehicle_show_table_all tr[vehicle_type="FuStW"] input[type="checkbox"]').size() > 0 && CountGefangene > 0) { + if ($('#vehicle_show_table_all tr[vehicle_type="FuStW"] input[type="checkbox"]').length > 0 && CountGefangene > 0) { $('#vehicle_show_table_all tr[vehicle_type="FuStW"] input[type="checkbox"]').each((_, elem) => { if (CountGefangene > 0) { $(elem).click() @@ -655,7 +655,7 @@ class AutomaticDispose { } }); } - if ($('#vehicle_show_table_all input[type="checkbox"]:checked').size() > 0) { + if ($('#vehicle_show_table_all input[type="checkbox"]:checked').length > 0) { $('#mission_alarm_btn').click(); } } @@ -1191,7 +1191,7 @@ class AutomaticDispose { return self.RemoveMissionsFromQueue(self.MissionID).then(() => { return tellParent(`console.log('handler:1000:done:${window.name}:${self.MissionID}');window.AutomaticDisposeCall.FreeIframe('${self.MyRunner}');`); // delete Mission here as completed }) - } else if (self.includesString($('#iframe-inside-container > div.alert.fade.in.alert-success').text(), "wurde erfolgreich informiert") /*|| $('#vehicle_show_table_all input[type="checkbox"]:checked').size() > 0*/ ) { + } else if (self.includesString($('#iframe-inside-container > div.alert.fade.in.alert-success').text(), "wurde erfolgreich informiert") /*|| $('#vehicle_show_table_all input[type="checkbox"]:checked').length > 0*/ ) { console.log("SEND"); console.log("SEND: " + self.MissionID); return self.UpdateMissionsToDone(self.MissionID).then(() => { @@ -1221,45 +1221,45 @@ class AutomaticDispose { var title = document.getElementById('missionH1'); var isVerband = title.innerText.toLowerCase().includes("[verband]"); if (setting['Alliance-Automatic'] == 'true' && isVerband) { - if ([52, 55, 129, 203].indexOf(self.MissionType) !== -1 && $('#vehicle_show_table_all tr[vehicle_type="FuStW"] input[type="checkbox"]').size() > 0) { + if ([52, 55, 129, 203].indexOf(self.MissionType) !== -1 && $('#vehicle_show_table_all tr[vehicle_type="FuStW"] input[type="checkbox"]').length > 0) { $('#vehicle_show_table_all tr[vehicle_type="FuStW"] input[type="checkbox"]')[0].click(); } else if ([53, 130, 202].indexOf(self.MissionType) !== -1) { - if ($('#vehicle_show_table_all tr[vehicle_type="FLF"] input[type="checkbox"]').size() > 0) { + if ($('#vehicle_show_table_all tr[vehicle_type="FLF"] input[type="checkbox"]').length > 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) { + } else if ($('#vehicle_show_table_all tr[vehicle_type="GW-A"] input[type="checkbox"]').length > 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) { + } else if ($('#vehicle_show_table_all tr[vehicle_type="GW-Öl"] input[type="checkbox"]').length > 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) { + } else if ($('#vehicle_show_table_all tr[vehicle_type="NEF"] input[type="checkbox"]').length > 0) { $('#vehicle_show_table_all tr[vehicle_type="NEF"] input[type="checkbox"]')[0].click(); } } else if ([54, 56].indexOf(self.MissionType) !== -1) { - if ($('#vehicle_show_table_all tr[vehicle_type="FLF"] input[type="checkbox"]').size() > 0) { + if ($('#vehicle_show_table_all tr[vehicle_type="FLF"] input[type="checkbox"]').length > 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) { + } else if ($('#vehicle_show_table_all tr[vehicle_type="FuStW"] input[type="checkbox"]').length > 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) { + } else if ($('#vehicle_show_table_all tr[vehicle_type="GW-A"] input[type="checkbox"]').length > 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) { + } else if ($('#vehicle_show_table_all tr[vehicle_type="GW-Öl"] input[type="checkbox"]').length > 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) { + } else if ($('#vehicle_show_table_all tr[vehicle_type="LF 20"] input[type="checkbox"]').length > 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) { + } else if ($('#vehicle_show_table_all tr[vehicle_type="LF 20/16"] input[type="checkbox"]').length > 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) { + } else if ($('#vehicle_show_table_all tr[vehicle_type="HLF 20"] input[type="checkbox"]').length > 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) { + } else if ($('#vehicle_show_table_all tr[vehicle_type="TLF 8/8"] input[type="checkbox"]').length > 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) { + if ($('#vehicle_show_table_all tr[vehicle_type="FuStW"] input[type="checkbox"]').length > 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) { + } else if ($('#vehicle_show_table_all tr[vehicle_type="KTW Typ B"] input[type="checkbox"]').length > 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) { + if ($('#vehicle_show_table_all input[type="checkbox"]:checked').length > 0) { $('#mission_alarm_btn').click(); } } @@ -1302,7 +1302,7 @@ class AutomaticDispose { if (self.MyRunner == 'os') { self.OweSecure = true; } - self.GetMissionConfiguration(self.MyRunner == 'kt' ? 147 : Mission.type); + self.GetMissionConfiguration(Mission.type); } }); } @@ -1341,31 +1341,49 @@ class AutomaticDispose { }).then(async () => { return await self.CollectInvolvedVehicles(); }).then(async () => { + if (self.MyRunner == 'os' && self.Vehicles.length > 0){ + return + } return await self.CollectPatients(); }) .then(async () => { + if (self.MyRunner == 'os' && self.Vehicles.length > 0){ + return + } return await self.ProcessEmergencyMedicalService() }) .then(async () => { + if (self.MyRunner == 'os' && self.Vehicles.length > 0){ + return + } return await self.ProcessFireDepartment() }) .then(async () => { + if (self.MyRunner == 'os' && self.Vehicles.length > 0){ + return + } return await self.ProcessPoliceDepartment() }) .then(async () => { + if (self.MyRunner == 'os' && self.Vehicles.length > 0){ + return + } return await self.ProcessTechnicalEmergencyService() }) .then(async () => { + if (self.MyRunner == 'os' && self.Vehicles.length > 0){ + return + } return await self.ProcessWaterRescue() }).then(() => { - if (self.OweSecure) { - if ($('#vehicle_show_table_all tr[vehicle_type="FuStW"] input[type="checkbox"]:not(:checked)').size() > 0) { + if (self.OweSecure && $('#vehicle_show_table_all tr[vehicle_type="FuStW"] input[type="checkbox"]:checked').length == 0) { + if ($('#vehicle_show_table_all tr[vehicle_type="FuStW"] input[type="checkbox"]:not(:checked)').length > 0) { $('#vehicle_show_table_all tr[vehicle_type="FuStW"] input[type="checkbox"]:not(:checked)')[0].click(); } } - // console.log("Clicked Vehicles: ", $('#vehicle_show_table_all input[type="checkbox"]:checked').size(), $('#vehicle_show_table_all input[type="checkbox"]:checked')); + // console.log("Clicked Vehicles: ", $('#vehicle_show_table_all input[type="checkbox"]:checked').length, $('#vehicle_show_table_all input[type="checkbox"]:checked')); // console.log("WILL KLICK SEND") setTimeout(() => {