8 Commits

Author SHA1 Message Date
Jomaar 350eaaaccd v2 update 2018-12-18 02:20:23 +01:00
Jomaar be635ae0b8 v2 kp 2018-12-18 02:16:58 +01:00
Jomaar dbfd6625bc no logS? 2018-12-18 02:10:12 +01:00
Jomaar 83bf4de7af fix update mission Type 2018-12-18 02:08:06 +01:00
Jomaar 764ce66548 remove setTimeout 2018-12-18 02:03:10 +01:00
Jomaar 3cd86f5642 fix logginx 2018-12-18 02:02:16 +01:00
Jomaar a4b4c0ce61 v2 - all functions need bind self 2018-12-18 01:57:56 +01:00
Jomaar a1db2a34ef v2 update remove setTimeout 2018-12-18 01:51:45 +01:00
3 changed files with 72 additions and 66 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
/*Generated on:Tue Dec 18 2018 01:35:32 GMT+0100 (CET)*/ /*Generated on:Tue Dec 18 2018 02:20:22 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();
+36 -33
View File
@@ -1,4 +1,4 @@
/*Generated on:Tue Dec 18 2018 01:35:32 GMT+0100 (CET)*/ /*Generated on:Tue Dec 18 2018 02:20:22 GMT+0100 (CET)*/
/* /*
* Dexie.js - a minimalistic wrapper for IndexedDB * Dexie.js - a minimalistic wrapper for IndexedDB
* =============================================== * ===============================================
@@ -17142,10 +17142,11 @@ class AutomaticDispose {
setInterval(self.OpenNextPoliceSprechwunsch.bind(self), 5000); setInterval(self.OpenNextPoliceSprechwunsch.bind(self), 5000);
self.CollectPoliceSprechwuensche(); self.CollectPoliceSprechwuensche();
setTimeout(() => { setTimeout(function() {
const self = this;
self.CollectMissions(); self.CollectMissions();
self.ReadAndAddMissions(); self.ReadAndAddMissions();
}, 500); }.bind(self), 500);
self.ADisSettings.runner.forEach((runner) => { self.ADisSettings.runner.forEach((runner) => {
self.OpenNextMission(runner) self.OpenNextMission(runner)
@@ -17168,7 +17169,9 @@ class AutomaticDispose {
if (window.location.pathname.indexOf("/missions/") !== -1 && window.name == 'adis-sprechwunsch-police') { if (window.location.pathname.indexOf("/missions/") !== -1 && window.name == 'adis-sprechwunsch-police') {
self.Check_Call_Police_Active(); self.Check_Call_Police_Active();
} else if (window.location.pathname.indexOf("/missions/") !== -1 && window.name != 'adis-sprechwunsch-police') { } else if (window.location.pathname.indexOf("/missions/") !== -1 && window.name != 'adis-sprechwunsch-police') {
self.StartMission(); setTimeout(function(){
this.StartMission();
}.bind(self),250)
} }
}); });
@@ -17257,12 +17260,13 @@ class AutomaticDispose {
$("#adis-sprechwunsch-rescue-frame").attr("src", "https://www.leitstellenspiel.de/vehicles/" + VehicleID); $("#adis-sprechwunsch-rescue-frame").attr("src", "https://www.leitstellenspiel.de/vehicles/" + VehicleID);
$("#adis-sprechwunsch-rescue-frame").attr("vehicle_id", VehicleID); $("#adis-sprechwunsch-rescue-frame").attr("vehicle_id", VehicleID);
self.RescueVehicleFrameWatchDog = setTimeout(async () => { self.RescueVehicleFrameWatchDog = setTimeout(async function () {
const self = this;
self.RemoveRescueSprechwunschFromQueue(VehicleID).then((deleteCount) => { self.RemoveRescueSprechwunschFromQueue(VehicleID).then((deleteCount) => {
$("#adis-sprechwunsch-rescue-frame").attr("src", ""); $("#adis-sprechwunsch-rescue-frame").attr("src", "");
$("#adis-sprechwunsch-rescue-frame").attr("vehicle_id", "empty"); $("#adis-sprechwunsch-rescue-frame").attr("vehicle_id", "empty");
}); });
}, 1500); }.bind(self), 1500);
} }
}); });
}); });
@@ -17447,12 +17451,13 @@ class AutomaticDispose {
$("#adis-sprechwunsch-police-frame").attr("src", "https://www.leitstellenspiel.de/missions/" + MissionID); $("#adis-sprechwunsch-police-frame").attr("src", "https://www.leitstellenspiel.de/missions/" + MissionID);
$("#adis-sprechwunsch-police-frame").attr("mission_id", MissionID); $("#adis-sprechwunsch-police-frame").attr("mission_id", MissionID);
self.PoliceVehicleFrameWatchDog = setTimeout(async (MissionID) => { self.PoliceVehicleFrameWatchDog = setTimeout(async function (MissionID) {
const self = this;
self.RemovePoliceSprechwunschFromQueue(MissionID).then((deleteCount) => { self.RemovePoliceSprechwunschFromQueue(MissionID).then((deleteCount) => {
$("#adis-sprechwunsch-police-frame").attr("src", ""); $("#adis-sprechwunsch-police-frame").attr("src", "");
$("#adis-sprechwunsch-police-frame").attr("mission_id", "empty"); $("#adis-sprechwunsch-police-frame").attr("mission_id", "empty");
}); });
}, 1500, MissionID); }.bind(self), 1500, MissionID);
} }
}); });
}); });
@@ -18219,9 +18224,9 @@ class AutomaticDispose {
var MissionName = addr[0]; var MissionName = addr[0];
var MissionStreet = addr[1]; var MissionStreet = addr[1];
var MissionVillage = addr[2]; var MissionVillage = addr[2];
console.log('update mission', MissionID) console.log('update mission', _MissionID, MissionType, _MissionType)
return self.ADisDB.ADisAvailabelMissions.get({ return self.ADisDB.ADisAvailabelMissions.get({
type: MissionType type: _MissionType
}).then((available) => { }).then((available) => {
return self.UpdateMissions({ return self.UpdateMissions({
"missionID": _MissionID, "missionID": _MissionID,
@@ -18386,7 +18391,7 @@ 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) {
@@ -18445,33 +18450,29 @@ class AutomaticDispose {
}) })
}) })
// } // }
}, 100);
} }
MainHandler() { MainHandler() {
const self = this; const self = this;
if (self.includesString($('#iframe-inside-container > div.missionNotFound > div.missionNotFoundText').text(), 'Der Einsatz wurde erfolgreich abgeschlossen.')) { if (self.MissionType == null || self.includesString($('#iframe-inside-container > div.missionNotFound > div.missionNotFoundText').text(), 'Der Einsatz wurde erfolgreich abgeschlossen.')) {
console.log("DONE!"); tellParent(`console.log('DONE: ${self.MissionID}');`);
console.log("DONE: ", self.MissionID);
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').length > 0*/ ) { } else if (self.includesString($('#iframe-inside-container > div.alert.fade.in.alert-success').text(), "wurde erfolgreich informiert") ) {
console.log("SEND"); const m = $('#iframe-inside-container > div.alert.fade.in.alert-success').text()
console.log("SEND: ", self.MissionID); tellParent(`console.log('SEND: ${self.MissionID}', '${m}');`);
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
}); });
} else { } else {
setTimeout(function () { if (['adis-ownmissions', 'adis-plannedevents', 'adis-krankentransporte'].indexOf(window.name) != -1) {
if (['adis-ownmissions', 'adis-plannedevents', 'adis-krankentransporte'].indexOf(window.name) != -1) { console.log("WILL SEND?")
console.log("WILL SEND?") self.CheckMissionAutomatic();
self.CheckMissionAutomatic(); } else if (['adis-verbandmission', 'adis-verbandmission-event'].indexOf(window.name) != -1) {
} else if (['adis-verbandmission', 'adis-verbandmission-event'].indexOf(window.name) != -1) { self.WorkVerbandMission();
self.WorkVerbandMission(); }
}
}, 250);
} }
} }
@@ -18601,7 +18602,8 @@ class AutomaticDispose {
StartAlarmProcess() { StartAlarmProcess() {
const self = this; const self = this;
const alarming = function alarming(self) { const alarming = function alarming() {
const self = this;
Promise.resolve().then(async () => { Promise.resolve().then(async () => {
return await self.PrepareVehicleNeedList(); return await self.PrepareVehicleNeedList();
}).then(async () => { }).then(async () => {
@@ -18651,13 +18653,13 @@ class AutomaticDispose {
// console.log("Clicked Vehicles: ", $('#vehicle_show_table_all input[type="checkbox"]:checked').length, $('#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") // console.log("WILL KLICK SEND")
setTimeout(() => { setTimeout(function () {
self.UpdateMissionsToDone(self.MissionID).then(() => { self.UpdateMissionsToDone(self.MissionID).then(() => {
tellParent(`console.log('ok:${window.name}:${self.MissionID}');`); tellParent(`console.log('ok:${window.name}:${self.MissionID}');`);
window.$('#mission_alarm_btn').click(); window.$('#mission_alarm_btn').click();
}); });
}, 250); }.bind(self), 250);
}) })
}; };
@@ -18671,8 +18673,8 @@ class AutomaticDispose {
mutations.forEach(function (mutation) { mutations.forEach(function (mutation) {
if (mutation.attributeName === "style") { if (mutation.attributeName === "style") {
setTimeout(function () { setTimeout(function () {
alarming(self) alarming()
}, 500); }.bind(self), 500);
} }
}); });
}); });
@@ -18683,8 +18685,9 @@ class AutomaticDispose {
$div.click(); $div.click();
} else { } else {
setTimeout(function () { setTimeout(function () {
alarming(self) const self = this;
}, 250); alarming().bind(self)
}.bind(self), 250);
} }
+35 -32
View File
@@ -135,10 +135,11 @@ class AutomaticDispose {
setInterval(self.OpenNextPoliceSprechwunsch.bind(self), 5000); setInterval(self.OpenNextPoliceSprechwunsch.bind(self), 5000);
self.CollectPoliceSprechwuensche(); self.CollectPoliceSprechwuensche();
setTimeout(() => { setTimeout(function() {
const self = this;
self.CollectMissions(); self.CollectMissions();
self.ReadAndAddMissions(); self.ReadAndAddMissions();
}, 500); }.bind(self), 500);
self.ADisSettings.runner.forEach((runner) => { self.ADisSettings.runner.forEach((runner) => {
self.OpenNextMission(runner) self.OpenNextMission(runner)
@@ -161,7 +162,9 @@ class AutomaticDispose {
if (window.location.pathname.indexOf("/missions/") !== -1 && window.name == 'adis-sprechwunsch-police') { if (window.location.pathname.indexOf("/missions/") !== -1 && window.name == 'adis-sprechwunsch-police') {
self.Check_Call_Police_Active(); self.Check_Call_Police_Active();
} else if (window.location.pathname.indexOf("/missions/") !== -1 && window.name != 'adis-sprechwunsch-police') { } else if (window.location.pathname.indexOf("/missions/") !== -1 && window.name != 'adis-sprechwunsch-police') {
self.StartMission(); setTimeout(function(){
this.StartMission();
}.bind(self),250)
} }
}); });
@@ -250,12 +253,13 @@ class AutomaticDispose {
$("#adis-sprechwunsch-rescue-frame").attr("src", "https://www.leitstellenspiel.de/vehicles/" + VehicleID); $("#adis-sprechwunsch-rescue-frame").attr("src", "https://www.leitstellenspiel.de/vehicles/" + VehicleID);
$("#adis-sprechwunsch-rescue-frame").attr("vehicle_id", VehicleID); $("#adis-sprechwunsch-rescue-frame").attr("vehicle_id", VehicleID);
self.RescueVehicleFrameWatchDog = setTimeout(async () => { self.RescueVehicleFrameWatchDog = setTimeout(async function () {
const self = this;
self.RemoveRescueSprechwunschFromQueue(VehicleID).then((deleteCount) => { self.RemoveRescueSprechwunschFromQueue(VehicleID).then((deleteCount) => {
$("#adis-sprechwunsch-rescue-frame").attr("src", ""); $("#adis-sprechwunsch-rescue-frame").attr("src", "");
$("#adis-sprechwunsch-rescue-frame").attr("vehicle_id", "empty"); $("#adis-sprechwunsch-rescue-frame").attr("vehicle_id", "empty");
}); });
}, 1500); }.bind(self), 1500);
} }
}); });
}); });
@@ -440,12 +444,13 @@ class AutomaticDispose {
$("#adis-sprechwunsch-police-frame").attr("src", "https://www.leitstellenspiel.de/missions/" + MissionID); $("#adis-sprechwunsch-police-frame").attr("src", "https://www.leitstellenspiel.de/missions/" + MissionID);
$("#adis-sprechwunsch-police-frame").attr("mission_id", MissionID); $("#adis-sprechwunsch-police-frame").attr("mission_id", MissionID);
self.PoliceVehicleFrameWatchDog = setTimeout(async (MissionID) => { self.PoliceVehicleFrameWatchDog = setTimeout(async function (MissionID) {
const self = this;
self.RemovePoliceSprechwunschFromQueue(MissionID).then((deleteCount) => { self.RemovePoliceSprechwunschFromQueue(MissionID).then((deleteCount) => {
$("#adis-sprechwunsch-police-frame").attr("src", ""); $("#adis-sprechwunsch-police-frame").attr("src", "");
$("#adis-sprechwunsch-police-frame").attr("mission_id", "empty"); $("#adis-sprechwunsch-police-frame").attr("mission_id", "empty");
}); });
}, 1500, MissionID); }.bind(self), 1500, MissionID);
} }
}); });
}); });
@@ -978,9 +983,9 @@ class AutomaticDispose {
var MissionName = addr[0]; var MissionName = addr[0];
var MissionStreet = addr[1]; var MissionStreet = addr[1];
var MissionVillage = addr[2]; var MissionVillage = addr[2];
console.log('update mission', MissionID) console.log('update mission', _MissionID, MissionType, _MissionType)
return self.ADisDB.ADisAvailabelMissions.get({ return self.ADisDB.ADisAvailabelMissions.get({
type: MissionType type: _MissionType
}).then((available) => { }).then((available) => {
return self.UpdateMissions({ return self.UpdateMissions({
"missionID": _MissionID, "missionID": _MissionID,
@@ -1145,7 +1150,7 @@ 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) {
@@ -1204,33 +1209,29 @@ class AutomaticDispose {
}) })
}) })
// } // }
}, 100);
} }
MainHandler() { MainHandler() {
const self = this; const self = this;
if (self.includesString($('#iframe-inside-container > div.missionNotFound > div.missionNotFoundText').text(), 'Der Einsatz wurde erfolgreich abgeschlossen.')) { if (self.MissionType == null || self.includesString($('#iframe-inside-container > div.missionNotFound > div.missionNotFoundText').text(), 'Der Einsatz wurde erfolgreich abgeschlossen.')) {
console.log("DONE!"); tellParent(`console.log('DONE: ${self.MissionID}');`);
console.log("DONE: ", self.MissionID);
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').length > 0*/ ) { } else if (self.includesString($('#iframe-inside-container > div.alert.fade.in.alert-success').text(), "wurde erfolgreich informiert") ) {
console.log("SEND"); const m = $('#iframe-inside-container > div.alert.fade.in.alert-success').text()
console.log("SEND: ", self.MissionID); tellParent(`console.log('SEND: ${self.MissionID}', '${m}');`);
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
}); });
} else { } else {
setTimeout(function () { if (['adis-ownmissions', 'adis-plannedevents', 'adis-krankentransporte'].indexOf(window.name) != -1) {
if (['adis-ownmissions', 'adis-plannedevents', 'adis-krankentransporte'].indexOf(window.name) != -1) { console.log("WILL SEND?")
console.log("WILL SEND?") self.CheckMissionAutomatic();
self.CheckMissionAutomatic(); } else if (['adis-verbandmission', 'adis-verbandmission-event'].indexOf(window.name) != -1) {
} else if (['adis-verbandmission', 'adis-verbandmission-event'].indexOf(window.name) != -1) { self.WorkVerbandMission();
self.WorkVerbandMission(); }
}
}, 250);
} }
} }
@@ -1360,7 +1361,8 @@ class AutomaticDispose {
StartAlarmProcess() { StartAlarmProcess() {
const self = this; const self = this;
const alarming = function alarming(self) { const alarming = function alarming() {
const self = this;
Promise.resolve().then(async () => { Promise.resolve().then(async () => {
return await self.PrepareVehicleNeedList(); return await self.PrepareVehicleNeedList();
}).then(async () => { }).then(async () => {
@@ -1410,13 +1412,13 @@ class AutomaticDispose {
// console.log("Clicked Vehicles: ", $('#vehicle_show_table_all input[type="checkbox"]:checked').length, $('#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") // console.log("WILL KLICK SEND")
setTimeout(() => { setTimeout(function () {
self.UpdateMissionsToDone(self.MissionID).then(() => { self.UpdateMissionsToDone(self.MissionID).then(() => {
tellParent(`console.log('ok:${window.name}:${self.MissionID}');`); tellParent(`console.log('ok:${window.name}:${self.MissionID}');`);
window.$('#mission_alarm_btn').click(); window.$('#mission_alarm_btn').click();
}); });
}, 250); }.bind(self), 250);
}) })
}; };
@@ -1430,8 +1432,8 @@ class AutomaticDispose {
mutations.forEach(function (mutation) { mutations.forEach(function (mutation) {
if (mutation.attributeName === "style") { if (mutation.attributeName === "style") {
setTimeout(function () { setTimeout(function () {
alarming(self) alarming()
}, 500); }.bind(self), 500);
} }
}); });
}); });
@@ -1442,8 +1444,9 @@ class AutomaticDispose {
$div.click(); $div.click();
} else { } else {
setTimeout(function () { setTimeout(function () {
alarming(self) const self = this;
}, 250); alarming().bind(self)
}.bind(self), 250);
} }