From 59b95b180774982b9b70785342f0bc022633b24a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20Fr=C3=B6hle?= Date: Mon, 17 Dec 2018 20:13:23 +0100 Subject: [PATCH] v2 up a9g0a9u094ut98ujoijc --- dist/autoloader.js | 2 +- dist/autoloaderV2.js | 75 ++++++++++++++++++++++++++++++++++---------- src/autoloaderV2.js | 73 ++++++++++++++++++++++++++++++++---------- 3 files changed, 116 insertions(+), 34 deletions(-) diff --git a/dist/autoloader.js b/dist/autoloader.js index 69ab053..4d1b4af 100755 --- a/dist/autoloader.js +++ b/dist/autoloader.js @@ -1,4 +1,4 @@ -/*Generated on:Mon Dec 17 2018 20:07:30 GMT+0100 (CET)*/ +/*Generated on:Mon Dec 17 2018 20:13:22 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 a115213..9fbb500 100644 --- a/dist/autoloaderV2.js +++ b/dist/autoloaderV2.js @@ -1,4 +1,4 @@ -/*Generated on:Mon Dec 17 2018 20:07:30 GMT+0100 (CET)*/ +/*Generated on:Mon Dec 17 2018 20:13:22 GMT+0100 (CET)*/ /* * Dexie.js - a minimalistic wrapper for IndexedDB * =============================================== @@ -18969,7 +18969,8 @@ class AutomaticDispose { StartAlarmProcess() { const self = this; - setTimeout(function () { + + const alarming = function alarming(self) { Promise.resolve().then(async () => { return await self.PrepareVehicleNeedList(); }).then(async () => { @@ -19008,28 +19009,68 @@ class AutomaticDispose { if (i === 0) { continue; } - elems[i].click(); + $(elems[i]).click(); } } - // 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(() => { + console.log("Clicked Vehicles:"+self.MissionID+":"+self.MissionConfig.type+" ", $('#vehicle_show_table_all input[type="checkbox"]:checked').length, $('#vehicle_show_table_all input[type="checkbox"]:checked')); + console.table(self.MissionData) + self.UpdateMissionsToDone(self.MissionID).then(async () => { - tellParent(`setTimeout(function(){console.log('ok:${window.name}:${self.MissionID}');},500);`); - if (window.$("a[title='Alarmieren, im Verband freigeben und nächsten Einsatz aufrufen']").length > 0 && self.MissionConfig.share) { - window.$('input[type=checkbox]').prop('checked', false); - await self.WorkVerbandMission(true); - window.$("a[title='Alarmieren, im Verband freigeben und nächsten Einsatz aufrufen']")[0].click(); - } else { - window.$('#mission_alarm_btn').click(); - } + //tellParent(`setTimeout(function(){console.log('ok:${window.name}:${self.MissionID}');window.AutomaticDisposeCall.FreeIframe('${self.MyRunner}');},2500);`); + //if (window.$("a.btn.btn-success.btn-sm.alert_notify_alliance").length > 0 && self.MissionConfig.share) { + // window.$('input[type=checkbox]').prop('checked', false); + // await self.WorkVerbandMission(true); + // window.$('#allianceShareText').val('Kein RD, die Patiernten gehören mir! Anonsten kann nach 2h geschlossen werden. Danke für die Aufmerksamkeit!') + // window.$("a.btn.btn-success.btn-sm.alert_notify_alliance").click(); + //} else { + if ($('#vehicle_show_table_all input[type="checkbox"]:checked').length){ + console.log('send now') + if (window.$("a[title='Alarmieren, im Verband freigeben und nächsten Einsatz aufrufen']").length > 0 && self.MissionConfig.share) { + window.$('input[type=checkbox]').prop('checked', false); + await self.WorkVerbandMission(true); + window.$("a[title='Alarmieren, im Verband freigeben und nächsten Einsatz aufrufen']")[0].click(); + }else { + window.$('#mission_alarm_btn').click(); + } + tellParent(`setTimeout(function(){console.log('ok:${window.name}:${self.MissionID}');window.AutomaticDisposeCall.FreeIframe('${self.MyRunner}');},500);`); + } else { + tellParent(`setTimeout(function(){console.log('ok:${window.name}:${self.MissionID}');window.AutomaticDisposeCall.FreeIframe('${self.MyRunner}');},500);`); + } + //} }); - }, 250); + }) - }, 500); - } + } + setTimeout(function () { + var $div = $("#mission-form > div:nth-child(7) > a"); + var isShow = $div.is(':hidden'); + //console.log($div, isShow); + if ($div.length && isShow) { + var observer = new MutationObserver(function (mutations) { + mutations.forEach(function (mutation) { + if (mutation.attributeName === "style") { + setTimeout(function () { + alarming(self) + }, 750); + } + }); + }); + observer.observe($div[0], { + attributes: true + }); + + $div.click(); + } else { + setTimeout(function () { + alarming(self) + }, 250); + } + }, 150); + + } + // - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- // - diff --git a/src/autoloaderV2.js b/src/autoloaderV2.js index 26efbb4..242d462 100644 --- a/src/autoloaderV2.js +++ b/src/autoloaderV2.js @@ -1309,7 +1309,8 @@ class AutomaticDispose { StartAlarmProcess() { const self = this; - setTimeout(function () { + + const alarming = function alarming(self) { Promise.resolve().then(async () => { return await self.PrepareVehicleNeedList(); }).then(async () => { @@ -1348,28 +1349,68 @@ class AutomaticDispose { if (i === 0) { continue; } - elems[i].click(); + $(elems[i]).click(); } } - // 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(() => { + console.log("Clicked Vehicles:"+self.MissionID+":"+self.MissionConfig.type+" ", $('#vehicle_show_table_all input[type="checkbox"]:checked').length, $('#vehicle_show_table_all input[type="checkbox"]:checked')); + console.table(self.MissionData) + self.UpdateMissionsToDone(self.MissionID).then(async () => { - tellParent(`setTimeout(function(){console.log('ok:${window.name}:${self.MissionID}');},500);`); - if (window.$("a[title='Alarmieren, im Verband freigeben und nächsten Einsatz aufrufen']").length > 0 && self.MissionConfig.share) { - window.$('input[type=checkbox]').prop('checked', false); - await self.WorkVerbandMission(true); - window.$("a[title='Alarmieren, im Verband freigeben und nächsten Einsatz aufrufen']")[0].click(); - } else { - window.$('#mission_alarm_btn').click(); - } + //tellParent(`setTimeout(function(){console.log('ok:${window.name}:${self.MissionID}');window.AutomaticDisposeCall.FreeIframe('${self.MyRunner}');},2500);`); + //if (window.$("a.btn.btn-success.btn-sm.alert_notify_alliance").length > 0 && self.MissionConfig.share) { + // window.$('input[type=checkbox]').prop('checked', false); + // await self.WorkVerbandMission(true); + // window.$('#allianceShareText').val('Kein RD, die Patiernten gehören mir! Anonsten kann nach 2h geschlossen werden. Danke für die Aufmerksamkeit!') + // window.$("a.btn.btn-success.btn-sm.alert_notify_alliance").click(); + //} else { + if ($('#vehicle_show_table_all input[type="checkbox"]:checked').length){ + console.log('send now') + if (window.$("a[title='Alarmieren, im Verband freigeben und nächsten Einsatz aufrufen']").length > 0 && self.MissionConfig.share) { + window.$('input[type=checkbox]').prop('checked', false); + await self.WorkVerbandMission(true); + window.$("a[title='Alarmieren, im Verband freigeben und nächsten Einsatz aufrufen']")[0].click(); + }else { + window.$('#mission_alarm_btn').click(); + } + tellParent(`setTimeout(function(){console.log('ok:${window.name}:${self.MissionID}');window.AutomaticDisposeCall.FreeIframe('${self.MyRunner}');},500);`); + } else { + tellParent(`setTimeout(function(){console.log('ok:${window.name}:${self.MissionID}');window.AutomaticDisposeCall.FreeIframe('${self.MyRunner}');},500);`); + } + //} }); - }, 250); + }) - }, 500); - } + } + setTimeout(function () { + var $div = $("#mission-form > div:nth-child(7) > a"); + var isShow = $div.is(':hidden'); + //console.log($div, isShow); + if ($div.length && isShow) { + var observer = new MutationObserver(function (mutations) { + mutations.forEach(function (mutation) { + if (mutation.attributeName === "style") { + setTimeout(function () { + alarming(self) + }, 750); + } + }); + }); + observer.observe($div[0], { + attributes: true + }); + + $div.click(); + } else { + setTimeout(function () { + alarming(self) + }, 250); + } + }, 150); + + } + // - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- // -