v2 update :ai

This commit is contained in:
2018-12-17 20:57:15 +01:00
parent 17c33e5bb3
commit 61357300e3
3 changed files with 110 additions and 98 deletions
+1 -1
View File
@@ -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_Branch = "master";
var AutomaticDispose_URL = "https://jf.git.rest/Jomaar/automatic-dispose/raw/branch/"; var AutomaticDispose_URL = "https://jf.git.rest/Jomaar/automatic-dispose/raw/branch/";
var da_lss_adis_time = new Date().getTime(); var da_lss_adis_time = new Date().getTime();
+51 -45
View File
@@ -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 * Dexie.js - a minimalistic wrapper for IndexedDB
* =============================================== * ===============================================
@@ -18786,22 +18786,28 @@ class AutomaticDispose {
const runnerID = self.ADisSettings.runner_iframesName.indexOf(window.name); const runnerID = self.ADisSettings.runner_iframesName.indexOf(window.name);
self.MyRunner = self.ADisSettings.runner[runnerID]; self.MyRunner = self.ADisSettings.runner[runnerID];
self.MyRunnerSettings = self.ADisSettings.runner_settings[runnerID]; self.MyRunnerSettings = self.ADisSettings.runner_settings[runnerID];
setTimeout(function () {
self.MissionID = document.location.pathname.substr(document.location.pathname.lastIndexOf("/") + 1); self.MissionID = document.location.pathname.substr(document.location.pathname.lastIndexOf("/") + 1);
var help_el = $('a#mission_help'); var help_el = $('a#mission_help');
if (help_el.length > 0) { if (help_el.length > 0) {
self.MissionType = help_el[0].href.split("?")[0]; self.MissionType = help_el[0].href.split("?")[0];
var re = /\d+$/i; var re = /\d+$/i;
var found = self.MissionType.match(re); var found = self.MissionType.match(re);
self.MissionType = Number(found[0]); self.MissionType = Number(found[0]);
} else { } else {
self.MissionType = null; self.MissionType = null;
} }
// console.log("MissionID", self.MissionID); // console.log("MissionID", self.MissionID);
// console.log("MissionType", self.MissionType); // console.log("MissionType", self.MissionType);
// console.log("Window", window.name); // console.log("Window", window.name);
// console.log("self.MyRunner", self.MyRunner); // console.log("self.MyRunner", self.MyRunner);
// console.log("self.MyRunnerSettings", self.MyRunnerSettings); // 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], () => { return self.ADisDB.transaction('rw', [self.ADisDB.ADisMissions], () => {
self.ADSettings().then((setting) => { self.ADSettings().then((setting) => {
if (setting[self.MyRunnerSettings] === 'true') { 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 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 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*/ ) {
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); console.log("SEND: " + self.MissionID);
return self.UpdateMissionsToDone(self.MissionID).then(() => { 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 return tellParent(`console.log('handler:2000:update:${window.name}:${self.MissionID}');window.AutomaticDisposeCall.FreeIframe('${self.MyRunner}');`); // update Mission here as updated or full
@@ -19036,32 +19042,32 @@ 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.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) console.table(self.MissionData)
self.UpdateMissionsToDone(self.MissionID).then(async () => { self.UpdateMissionsToDone(self.MissionID).then(async () => {
//tellParent(`setTimeout(function(){console.log('ok:${window.name}:${self.MissionID}');window.AutomaticDisposeCall.FreeIframe('${self.MyRunner}');},2500);`); //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) { //if (window.$("a.btn.btn-success.btn-sm.alert_notify_alliance").length > 0 && self.MissionConfig.share) {
// window.$('input[type=checkbox]').prop('checked', false); // window.$('input[type=checkbox]').prop('checked', false);
// await self.WorkVerbandMission(true); // 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.$('#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(); // window.$("a.btn.btn-success.btn-sm.alert_notify_alliance").click();
//} else { //} else {
if ($('#vehicle_show_table_all input[type="checkbox"]:checked').length){ if ($('#vehicle_show_table_all input[type="checkbox"]:checked').length) {
console.log('send now') console.log('send now')
if (window.$("a[title='Alarmieren, im Verband freigeben und nächsten Einsatz aufrufen']").length > 0 && self.MissionConfig.share) { 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); window.$('input[type=checkbox]').prop('checked', false);
await self.WorkVerbandMission(true); await self.WorkVerbandMission(true);
window.$("a[title='Alarmieren, im Verband freigeben und nächsten Einsatz aufrufen']")[0].click(); window.$("a[title='Alarmieren, im Verband freigeben und nächsten Einsatz aufrufen']")[0].click();
}else { } else {
window.$('#mission_alarm_btn').click(); window.$('#mission_alarm_btn').click();
} }
tellParent(`setTimeout(function(){console.log('ok:${window.name}:${self.MissionID}');window.AutomaticDisposeCall.FreeIframe('${self.MyRunner}');},500);`); tellParent(`setTimeout(function(){console.log('ok:${window.name}:${self.MissionID}');window.AutomaticDisposeCall.FreeIframe('${self.MyRunner}');},500);`);
} else { } else {
tellParent(`setTimeout(function(){console.log('ok:${window.name}:${self.MissionID}');window.AutomaticDisposeCall.FreeIframe('${self.MyRunner}');},500);`); tellParent(`setTimeout(function(){console.log('ok:${window.name}:${self.MissionID}');window.AutomaticDisposeCall.FreeIframe('${self.MyRunner}');},500);`);
} }
//} //}
}); });
}) })
+50 -44
View File
@@ -1126,22 +1126,28 @@ class AutomaticDispose {
const runnerID = self.ADisSettings.runner_iframesName.indexOf(window.name); const runnerID = self.ADisSettings.runner_iframesName.indexOf(window.name);
self.MyRunner = self.ADisSettings.runner[runnerID]; self.MyRunner = self.ADisSettings.runner[runnerID];
self.MyRunnerSettings = self.ADisSettings.runner_settings[runnerID]; self.MyRunnerSettings = self.ADisSettings.runner_settings[runnerID];
setTimeout(function () {
self.MissionID = document.location.pathname.substr(document.location.pathname.lastIndexOf("/") + 1); self.MissionID = document.location.pathname.substr(document.location.pathname.lastIndexOf("/") + 1);
var help_el = $('a#mission_help'); var help_el = $('a#mission_help');
if (help_el.length > 0) { if (help_el.length > 0) {
self.MissionType = help_el[0].href.split("?")[0]; self.MissionType = help_el[0].href.split("?")[0];
var re = /\d+$/i; var re = /\d+$/i;
var found = self.MissionType.match(re); var found = self.MissionType.match(re);
self.MissionType = Number(found[0]); self.MissionType = Number(found[0]);
} else { } else {
self.MissionType = null; self.MissionType = null;
} }
// console.log("MissionID", self.MissionID); // console.log("MissionID", self.MissionID);
// console.log("MissionType", self.MissionType); // console.log("MissionType", self.MissionType);
// console.log("Window", window.name); // console.log("Window", window.name);
// console.log("self.MyRunner", self.MyRunner); // console.log("self.MyRunner", self.MyRunner);
// console.log("self.MyRunnerSettings", self.MyRunnerSettings); // 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], () => { return self.ADisDB.transaction('rw', [self.ADisDB.ADisMissions], () => {
self.ADSettings().then((setting) => { self.ADSettings().then((setting) => {
if (setting[self.MyRunnerSettings] === 'true') { 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 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 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*/ ) {
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); console.log("SEND: " + self.MissionID);
return self.UpdateMissionsToDone(self.MissionID).then(() => { 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 return tellParent(`console.log('handler:2000:update:${window.name}:${self.MissionID}');window.AutomaticDisposeCall.FreeIframe('${self.MyRunner}');`); // update Mission here as updated or full
@@ -1376,32 +1382,32 @@ 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.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) console.table(self.MissionData)
self.UpdateMissionsToDone(self.MissionID).then(async () => { self.UpdateMissionsToDone(self.MissionID).then(async () => {
//tellParent(`setTimeout(function(){console.log('ok:${window.name}:${self.MissionID}');window.AutomaticDisposeCall.FreeIframe('${self.MyRunner}');},2500);`); //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) { //if (window.$("a.btn.btn-success.btn-sm.alert_notify_alliance").length > 0 && self.MissionConfig.share) {
// window.$('input[type=checkbox]').prop('checked', false); // window.$('input[type=checkbox]').prop('checked', false);
// await self.WorkVerbandMission(true); // 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.$('#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(); // window.$("a.btn.btn-success.btn-sm.alert_notify_alliance").click();
//} else { //} else {
if ($('#vehicle_show_table_all input[type="checkbox"]:checked').length){ if ($('#vehicle_show_table_all input[type="checkbox"]:checked').length) {
console.log('send now') console.log('send now')
if (window.$("a[title='Alarmieren, im Verband freigeben und nächsten Einsatz aufrufen']").length > 0 && self.MissionConfig.share) { 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); window.$('input[type=checkbox]').prop('checked', false);
await self.WorkVerbandMission(true); await self.WorkVerbandMission(true);
window.$("a[title='Alarmieren, im Verband freigeben und nächsten Einsatz aufrufen']")[0].click(); window.$("a[title='Alarmieren, im Verband freigeben und nächsten Einsatz aufrufen']")[0].click();
}else { } else {
window.$('#mission_alarm_btn').click(); window.$('#mission_alarm_btn').click();
} }
tellParent(`setTimeout(function(){console.log('ok:${window.name}:${self.MissionID}');window.AutomaticDisposeCall.FreeIframe('${self.MyRunner}');},500);`); tellParent(`setTimeout(function(){console.log('ok:${window.name}:${self.MissionID}');window.AutomaticDisposeCall.FreeIframe('${self.MyRunner}');},500);`);
} else { } else {
tellParent(`setTimeout(function(){console.log('ok:${window.name}:${self.MissionID}');window.AutomaticDisposeCall.FreeIframe('${self.MyRunner}');},500);`); tellParent(`setTimeout(function(){console.log('ok:${window.name}:${self.MissionID}');window.AutomaticDisposeCall.FreeIframe('${self.MyRunner}');},500);`);
} }
//} //}
}); });
}) })