From 61357300e3e4e009571bae58713ed17a3d4d3d7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20Fr=C3=B6hle?= Date: Mon, 17 Dec 2018 20:57:15 +0100 Subject: [PATCH] v2 update :ai --- dist/autoloader.js | 2 +- dist/autoloaderV2.js | 104 +++++++++++++++++++++++-------------------- src/autoloaderV2.js | 102 ++++++++++++++++++++++-------------------- 3 files changed, 110 insertions(+), 98 deletions(-) diff --git a/dist/autoloader.js b/dist/autoloader.js index 7678b0c..1ecff0d 100755 --- a/dist/autoloader.js +++ b/dist/autoloader.js @@ -1,4 +1,4 @@ -/*Generated on:Mon Dec 17 2018 20:46:50 GMT+0100 (CET)*/ +/*Generated on:Mon Dec 17 2018 20:57:14 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 d2b4cf0..e216090 100644 --- a/dist/autoloaderV2.js +++ b/dist/autoloaderV2.js @@ -1,4 +1,4 @@ -/*Generated on:Mon Dec 17 2018 20:46:50 GMT+0100 (CET)*/ +/*Generated on:Mon Dec 17 2018 20:57:14 GMT+0100 (CET)*/ /* * Dexie.js - a minimalistic wrapper for IndexedDB * =============================================== @@ -18531,7 +18531,7 @@ class AutomaticDispose { // remove console.log("Remove :", MyMission) self.RemoveMissionsFromQueue(MyMission.missionID) - } + } }); } }); @@ -18786,22 +18786,28 @@ class AutomaticDispose { const runnerID = self.ADisSettings.runner_iframesName.indexOf(window.name); self.MyRunner = self.ADisSettings.runner[runnerID]; self.MyRunnerSettings = self.ADisSettings.runner_settings[runnerID]; - setTimeout(function () { - self.MissionID = document.location.pathname.substr(document.location.pathname.lastIndexOf("/") + 1); - var help_el = $('a#mission_help'); - if (help_el.length > 0) { - self.MissionType = help_el[0].href.split("?")[0]; - var re = /\d+$/i; - var found = self.MissionType.match(re); - self.MissionType = Number(found[0]); - } else { - self.MissionType = null; - } - // console.log("MissionID", self.MissionID); - // console.log("MissionType", self.MissionType); - // console.log("Window", window.name); - // console.log("self.MyRunner", self.MyRunner); - // console.log("self.MyRunnerSettings", self.MyRunnerSettings); + + self.MissionID = document.location.pathname.substr(document.location.pathname.lastIndexOf("/") + 1); + var help_el = $('a#mission_help'); + if (help_el.length > 0) { + self.MissionType = help_el[0].href.split("?")[0]; + var re = /\d+$/i; + var found = self.MissionType.match(re); + self.MissionType = Number(found[0]); + } else { + self.MissionType = null; + } + // console.log("MissionID", self.MissionID); + // console.log("MissionType", self.MissionType); + // console.log("Window", window.name); + // console.log("self.MyRunner", self.MyRunner); + // console.log("self.MyRunnerSettings", self.MyRunnerSettings); + if (self.includesString($('#iframe-inside-container > div.missionNotFound > div.missionNotFoundText').text(), 'Der Einsatz wurde erfolgreich abgeschlossen.')) { + console.log("DONE: " + self.MissionID); + 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 { return self.ADisDB.transaction('rw', [self.ADisDB.ADisMissions], () => { self.ADSettings().then((setting) => { if (setting[self.MyRunnerSettings] === 'true') { @@ -18835,7 +18841,8 @@ class AutomaticDispose { } }) }) - }, 1500); + } + } @@ -18846,8 +18853,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 }) - } - 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').size() > 0*/ ) { console.log("SEND: " + self.MissionID); return self.UpdateMissionsToDone(self.MissionID).then(() => { return tellParent(`console.log('handler:2000:update:${window.name}:${self.MissionID}');window.AutomaticDisposeCall.FreeIframe('${self.MyRunner}');`); // update Mission here as updated or full @@ -19036,33 +19042,33 @@ class AutomaticDispose { } } - 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}');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);`); - } - //} - }); - + 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}');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);`); + } + //} + }); + }) } @@ -19092,7 +19098,7 @@ class AutomaticDispose { } }, 150); - } + } // - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- diff --git a/src/autoloaderV2.js b/src/autoloaderV2.js index 6b35220..796f217 100644 --- a/src/autoloaderV2.js +++ b/src/autoloaderV2.js @@ -871,7 +871,7 @@ class AutomaticDispose { // remove console.log("Remove :", MyMission) self.RemoveMissionsFromQueue(MyMission.missionID) - } + } }); } }); @@ -1126,22 +1126,28 @@ class AutomaticDispose { const runnerID = self.ADisSettings.runner_iframesName.indexOf(window.name); self.MyRunner = self.ADisSettings.runner[runnerID]; self.MyRunnerSettings = self.ADisSettings.runner_settings[runnerID]; - setTimeout(function () { - self.MissionID = document.location.pathname.substr(document.location.pathname.lastIndexOf("/") + 1); - var help_el = $('a#mission_help'); - if (help_el.length > 0) { - self.MissionType = help_el[0].href.split("?")[0]; - var re = /\d+$/i; - var found = self.MissionType.match(re); - self.MissionType = Number(found[0]); - } else { - self.MissionType = null; - } - // console.log("MissionID", self.MissionID); - // console.log("MissionType", self.MissionType); - // console.log("Window", window.name); - // console.log("self.MyRunner", self.MyRunner); - // console.log("self.MyRunnerSettings", self.MyRunnerSettings); + + self.MissionID = document.location.pathname.substr(document.location.pathname.lastIndexOf("/") + 1); + var help_el = $('a#mission_help'); + if (help_el.length > 0) { + self.MissionType = help_el[0].href.split("?")[0]; + var re = /\d+$/i; + var found = self.MissionType.match(re); + self.MissionType = Number(found[0]); + } else { + self.MissionType = null; + } + // console.log("MissionID", self.MissionID); + // console.log("MissionType", self.MissionType); + // console.log("Window", window.name); + // console.log("self.MyRunner", self.MyRunner); + // console.log("self.MyRunnerSettings", self.MyRunnerSettings); + if (self.includesString($('#iframe-inside-container > div.missionNotFound > div.missionNotFoundText').text(), 'Der Einsatz wurde erfolgreich abgeschlossen.')) { + console.log("DONE: " + self.MissionID); + 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 { return self.ADisDB.transaction('rw', [self.ADisDB.ADisMissions], () => { self.ADSettings().then((setting) => { if (setting[self.MyRunnerSettings] === 'true') { @@ -1175,7 +1181,8 @@ class AutomaticDispose { } }) }) - }, 1500); + } + } @@ -1186,8 +1193,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 }) - } - 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').size() > 0*/ ) { console.log("SEND: " + self.MissionID); return self.UpdateMissionsToDone(self.MissionID).then(() => { return tellParent(`console.log('handler:2000:update:${window.name}:${self.MissionID}');window.AutomaticDisposeCall.FreeIframe('${self.MyRunner}');`); // update Mission here as updated or full @@ -1376,33 +1382,33 @@ class AutomaticDispose { } } - 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}');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);`); - } - //} - }); - + 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}');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);`); + } + //} + }); + }) } @@ -1432,7 +1438,7 @@ class AutomaticDispose { } }, 150); - } + } // - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --