1 Commits

Author SHA1 Message Date
Jomaar 36ddb429fa adoa 2018-12-19 17:54:33 +01:00
3 changed files with 802 additions and 1006 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
/*Generated on:Wed Dec 19 2018 18:06:36 GMT+0100 (CET)*/
/*Generated on:Tue Dec 18 2018 02:47:49 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();
+108 -210
View File
@@ -1,4 +1,4 @@
/*Generated on:Wed Dec 19 2018 18:06:36 GMT+0100 (CET)*/
/*Generated on:Tue Dec 18 2018 02:47:49 GMT+0100 (CET)*/
/*
* Dexie.js - a minimalistic wrapper for IndexedDB
* ===============================================
@@ -4479,7 +4479,6 @@ class AutomaticDispose {
// Variablen
get ADisSettings() {
let self = this
return {
url: "https://jf.git.rest/Jomaar/automatic-dispose/raw/branch/",
branch: "master",
@@ -17016,7 +17015,7 @@ class AutomaticDispose {
}
}
}`),
name: self.name,
name: this.name,
runner: ['kt', 'om', 'os', 'vm', 've'],
runner_divs: ['mission_list_krankentransporte', 'mission_list', /*'mission_list_sicherheitswache',*/ 'mission_list_alliance', 'mission_list_alliance_event'],
runner_settings: ['Krankentransport-Automatic', 'MissionsOwn-Automatic', /*'MissionsOwn-Automatic',*/ 'Alliance-Automatic', 'AllianceEvent-Automatic'],
@@ -17039,20 +17038,20 @@ class AutomaticDispose {
self.Vehicles = {}
self.Patients = {}
self.ADis_MyHead = document.getElementsByTagName('head')[0];
self.ADis_MyBody = document.getElementsByTagName('body')[0];
this.ADis_MyHead = document.getElementsByTagName('head')[0];
this.ADis_MyBody = document.getElementsByTagName('body')[0];
// -
// - Sprechwunsch Variablen
// -
self.Jails = [];
self.JailRegEx = /\(Freie Zellen\:\s+(\d)\,\s+Entfernung\:\s+(\d+\,\d+)\s+km(?:\,\s+Abgabe an Besitzer\:\s+(\d+)%)?\)/g;
self.Hospitals = [];
self.RescueVehicleFrameWatchDog = null;
self.PoliceVehicleFrameWatchDog = null;
this.Jails = [];
this.JailRegEx = /\(Freie Zellen\:\s+(\d)\,\s+Entfernung\:\s+(\d+\,\d+)\s+km(?:\,\s+Abgabe an Besitzer\:\s+(\d+)%)?\)/g;
this.Hospitals = [];
this.RescueVehicleFrameWatchDog = null;
this.PoliceVehicleFrameWatchDog = null;
self.ADisDB = new Dexie('LSS_AutomaticDispo');
self.ADisDB.version(1).stores({
this.ADisDB = new Dexie('LSS_AutomaticDispo');
this.ADisDB.version(1).stores({
/**
* AvailabelMissions
* - missionID
@@ -17097,7 +17096,7 @@ class AutomaticDispose {
*/
ADisMissions: "++missionID,runner,available,done,[missionID+available+done],[missionID+runner],[missionID+runner+done],[runner+available+done]"
});
self.ADisDB.on("populate", () => {
this.ADisDB.on("populate", () => {
self.ADisDB.ADisSettings.add({
name: "Krankentransport-Automatic",
value: 'true'
@@ -17119,10 +17118,10 @@ class AutomaticDispose {
value: 'false'
});
});
self.ADisDB.open().catch((err) => {
this.ADisDB.open().catch((err) => {
console.error(err.stack || err);
});
self.ADisDB.on("ready", async () => {
this.ADisDB.on("ready", async () => {
self.adis_settings = {
'Krankentransport-Automatic': false,
'Sprechwunsch-Automatic': false,
@@ -17202,26 +17201,14 @@ class AutomaticDispose {
// - Sprechwunsch Queue
// -
RemovePoliceSprechwunschFromQueue(WunschID) {
let self = this;
return self.ADisDB.transaction('rw!', [self.ADisDB.ADisSprechwunschPolice], async () => {
return await self.ADisDB.ADisSprechwunschPolice.where({
return this.ADisDB.ADisSprechwunschPolice.where({
missionID: WunschID
}).delete();
}).catch((err) => {
console.error(err)
})
}
RemoveRescueSprechwunschFromQueue(WunschID) {
let self = this;
return self.ADisDB.transaction('rw!', [self.ADisDB.ADisSprechwunsch], async () => {
return await self.ADisDB.ADisSprechwunsch.where({
return this.ADisDB.ADisSprechwunsch.where({
vehicleID: WunschID
}).delete();
}).catch((err) => {
console.error(err)
})
}
// - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
@@ -17232,7 +17219,6 @@ class AutomaticDispose {
CollectRescueSprechwuensche() {
let self = this;
return self.ADisDB.transaction('rw!', [self.ADisDB.ADisSprechwunsch], async () => {
new Promise(async (resolve, reject) => {
await self.ADisDB.ADisSprechwunsch.where({
done: 'false'
@@ -17251,16 +17237,12 @@ class AutomaticDispose {
self.AddRescueSprechwunschToQueue(VehicleID);
}
});
})
}).catch((err) => {
console.error(err)
})
});
}
OpenNextRescueSprechwunsch() {
let self = this;
return self.ADisDB.transaction('rw!', [self.ADisDB.ADisSprechwunsch], async () => {
return await self.ADSettings().then((setting) => {
this.ADSettings().then((setting) => {
if (setting['Sprechwunsch-Automatic'] == 'true') {
return self.ADisDB.ADisSprechwunsch.where({
done: 'false'
@@ -17268,55 +17250,39 @@ class AutomaticDispose {
}
}).then((Wunsch) => {
if (Wunsch !== undefined) {
Wunsch.each(async (myWunsch) => {
Wunsch.each((myWunsch) => {
let VehicleID = myWunsch.vehicleID;
await self.UpdateRescueSprechwunschToDone(VehicleID).then(() => {
self.UpdateRescueSprechwunschToDone(VehicleID).then(() => {
if ($("#adis-sprechwunsch-rescue-frame").attr("vehicle_id") == "empty") {
$("#adis-sprechwunsch-rescue-frame").attr("src", "https://www.leitstellenspiel.de/vehicles/" + VehicleID);
$("#adis-sprechwunsch-rescue-frame").attr("vehicle_id", VehicleID);
self.RescueVehicleFrameWatchDog = setTimeout(async function () {
let self = this;
return self.ADisDB.transaction('rw!', [self.ADisDB.ADisSprechwunsch], async () => {
self.RescueVehicleFrameWatchDog = setTimeout(async () => {
self.RemoveRescueSprechwunschFromQueue(VehicleID).then((deleteCount) => {
$("#adis-sprechwunsch-rescue-frame").attr("src", "");
$("#adis-sprechwunsch-rescue-frame").attr("vehicle_id", "empty");
});
});
}.bind(self), 1500);
}, 1500);
}
});
});
}
})
}).catch((err) => {
console.error(err)
})
});
}
AddRescueSprechwunschToQueue(WunschID) {
let self = this
return self.ADisDB.transaction('rw!', [self.ADisDB.ADisSprechwunsch], async () => {
return await self.ADisDB.ADisSprechwunsch.put({
return this.ADisDB.ADisSprechwunsch.put({
vehicleID: WunschID,
done: 'false'
})
}).catch((err) => {
console.error(err)
})
}).catch((err) => {})
}
UpdateRescueSprechwunschToDone(WunschID) {
let self = this
return self.ADisDB.transaction('rw!', [self.ADisDB.ADisSprechwunsch], async () => {
return await self.ADisDB.ADisSprechwunsch.put({
return this.ADisDB.ADisSprechwunsch.put({
vehicleID: WunschID,
done: 'true'
})
}).catch((err) => {
console.error(err)
})
}).catch((err) => {})
}
@@ -17406,7 +17372,7 @@ class AutomaticDispose {
});
self.Hospitals.reverse();
self.Send_Vehicle_To_Hospital()
this.Send_Vehicle_To_Hospital()
}
// Krankenhaus einlieferung
@@ -17427,8 +17393,7 @@ class AutomaticDispose {
CollectPoliceSprechwuensche() {
let self = this;
return self.ADisDB.transaction('rw!', [self.ADisDB.ADisSprechwunschPolice], async () => {
await new Promise(async (resolve, reject) => {
new Promise(async (resolve, reject) => {
await self.ADisDB.ADisSprechwunschPolice.where({
done: 'false'
}).each((myWunsch) => {
@@ -17440,14 +17405,14 @@ class AutomaticDispose {
return resolve();
}).then(() => {
var MOIODOS = $('div#mission_list div.missionSideBarEntry:visible');
return MOIODOS.each(async (_, elem) => {
return MOIODOS.each((_, elem) => {
if ($(elem).text().match(/Gefangene sollen abtransportiert werden/g)) {
var MissionID = $(elem).attr("mission_id");
await self.AddPoliceSprechwunschToQueue(MissionID);
self.AddPoliceSprechwunschToQueue(MissionID);
}
});
}).then(() => {
$("#building_list").find(".building_list_vehicle_element").each(async (_, elem) => {
$("#building_list").find(".building_list_vehicle_element").each((_, elem) => {
var VehicleStatus = $(elem).find(".building_list_fms").text();
var VehicleType = Number(parseInt($(elem).find("a").attr("vehicle_type_id")));
var VehicleID = $(elem).attr("vehicle_id");
@@ -17457,21 +17422,17 @@ class AutomaticDispose {
var _meap = String(map2.attr('href'));
var MissionID = _meap.substr(_meap.lastIndexOf("/") + 1);
if (MissionID) {
await self.AddPoliceSprechwunschToQueue(MissionID);
self.AddPoliceSprechwunschToQueue(MissionID);
}
}
}
});
})
}).catch((err) => {
console.error(err)
})
});
}
OpenNextPoliceSprechwunsch() {
let self = this;
return self.ADisDB.transaction('rw!', [self.ADisDB.ADisSprechwunschPolice], async () => {
return await self.ADSettings().then((setting) => {
this.ADSettings().then((setting) => {
if (setting['Sprechwunsch-Automatic'] == 'true') {
return self.ADisDB.ADisSprechwunschPolice.where({
done: 'false'
@@ -17479,54 +17440,38 @@ class AutomaticDispose {
}
}).then((Wunsch) => {
if (Wunsch !== undefined) {
Wunsch.each(async (myWunsch) => {
Wunsch.each((myWunsch) => {
let MissionID = myWunsch.missionID;
await self.UpdatePoliceSprechwunschToDone(MissionID).then(() => {
self.UpdatePoliceSprechwunschToDone(MissionID).then(() => {
if ($("#adis-sprechwunsch-police-frame").attr("mission_id") == "empty") {
$("#adis-sprechwunsch-police-frame").attr("src", "https://www.leitstellenspiel.de/missions/" + MissionID);
$("#adis-sprechwunsch-police-frame").attr("mission_id", MissionID);
self.PoliceVehicleFrameWatchDog = setTimeout(async function (MissionID) {
let self = this;
return self.ADisDB.transaction('rw!', [self.ADisDB.ADisSprechwunschPolice], async () => {
await self.RemovePoliceSprechwunschFromQueue(MissionID).then((deleteCount) => {
self.PoliceVehicleFrameWatchDog = setTimeout(async (MissionID) => {
self.RemovePoliceSprechwunschFromQueue(MissionID).then((deleteCount) => {
$("#adis-sprechwunsch-police-frame").attr("src", "");
$("#adis-sprechwunsch-police-frame").attr("mission_id", "empty");
});
});
}.bind(self), 1500, MissionID);
}, 1500, MissionID);
}
});
});
}
})
}).catch((err) => {
console.error(err)
})
});
}
AddPoliceSprechwunschToQueue(WunschID) {
let self = this;
return self.ADisDB.transaction('rw!', [self.ADisDB.ADisSprechwunschPolice], async () => {
return await self.ADisDB.ADisSprechwunschPolice.put({
return this.ADisDB.ADisSprechwunschPolice.put({
missionID: WunschID,
done: 'false'
})
}).catch((err) => {
console.error(err)
})
}).catch((err) => {})
}
UpdatePoliceSprechwunschToDone(WunschID) {
let self = this;
return self.ADisDB.transaction('rw!', [self.ADisDB.ADisSprechwunschPolice], async () => {
return await self.ADisDB.ADisSprechwunschPolice.put({
return this.ADisDB.ADisSprechwunschPolice.add({
missionID: WunschID,
done: 'true'
})
}).catch((err) => {
console.error(err)
})
}).catch((err) => {})
}
@@ -17690,7 +17635,7 @@ class AutomaticDispose {
self.Jails.reverse();
if (self.Jails.length > 0) {
self.Send_Vehicle_To_Jail()
this.Send_Vehicle_To_Jail()
} else {
$("#mission_vehicle_driving tbody, #mission_vehicle_at_mission tbody").find("tr").each((_, elem) => {
var CalledVehicleID = parseInt($(elem).find("a").first().attr("vehicle_type_id"));
@@ -18135,14 +18080,11 @@ class AutomaticDispose {
}
AddAvailableMissions(Mission) {
let self = this;
return self.ADisDB.transaction('rw!', [self.ADisDB.ADisAvailabelMissions], async () => {
return self.ADisDB.ADisAvailabelMissions.put({
return this.ADisDB.ADisAvailabelMissions.put({
missionID: Mission.id,
type: Mission.type,
name: Mission.name,
jsondata: Mission
})
}).catch((err) => {
console.error(err)
})
@@ -18184,8 +18126,9 @@ class AutomaticDispose {
ReadAndAddMissions(MissionID, Runner) {
const self = this;
return self.ADisDB.transaction('rw!', [self.ADisDB.ADisMissions, self.ADisDB.ADisAvailabelMissions], async () => {
return self.ADSettings().then(async () => {
return self.ADisDB.transaction('rw', [self.ADisDB.ADisMissions, self.ADisDB.ADisAvailabelMissions], () => {
self.ADSettings().then(() => {
return self.ADisDB.ADisMissions.toCollection()
}).then((Missions) => {
if (typeof Missions !== "undefined") {
@@ -18196,7 +18139,7 @@ class AutomaticDispose {
if (MissionElement.length == 0 || $('#mission_panel_' + MyMission.missionID).hasClass('mission_panel_green')) {
// remove
console.log("Remove :", MyMission)
return self.RemoveMissionsFromQueue(MyMission.missionID)
self.RemoveMissionsFromQueue(MyMission.missionID)
}
});
}
@@ -18214,10 +18157,8 @@ class AutomaticDispose {
});
})
}
})
}).catch((err) => {
console.error(err)
});;
});
});
}
AddMission(ID, Runner) {
@@ -18226,7 +18167,7 @@ class AutomaticDispose {
const runnerID = self.ADisSettings.runner_divs.indexOf(Runner);
const settingOpt = self.ADisSettings.runner_settings[runnerID];
const runnerOpt = self.ADisSettings.runner[runnerID];
return self.ADisDB.transaction('rw!', [self.ADisDB.ADisMissions, self.ADisDB.ADisAvailabelMissions], async () => {
return self.ADSettings().then((setting) => {
if (setting[settingOpt] == 'true') {
let where = {
@@ -18280,7 +18221,7 @@ class AutomaticDispose {
var MissionVillage = addr[2];
console.log('update mission', MissionID)
return self.ADisDB.ADisAvailabelMissions.get({
type: _MissionType
type: MissionType
}).then((available) => {
return self.UpdateMissions({
"missionID": _MissionID,
@@ -18327,30 +18268,21 @@ class AutomaticDispose {
}
});
});
});
}
AddMissionsToQueue(Mission) {
const self = this;
return self.ADisDB.transaction('rw!', [self.ADisDB.ADisMissions], async () => {
return self.ADisDB.ADisMissions.put(Mission).catch((err) => {
console.error(err)
});
}).catch((err) => {
console.error(err)
});
}
UpdateMissions(Mission) {
const self = this;
return self.ADisDB.transaction('rw!', [self.ADisDB.ADisMissions], async () => {
return self.ADisDB.ADisMissions.put(Mission).catch((err) => {
console.error(err)
});
}).catch((err) => {
console.error(err)
});
})
}
FreeIframe(Runner) {
@@ -18364,11 +18296,9 @@ class AutomaticDispose {
UpdateMissionsToDone(MissionID) {
const self = this;
return self.ADisDB.transaction('rw!', [self.ADisDB.ADisMissions], async () => {
return self.ADisDB.ADisMissions.update(MissionID, {
last_check: Math.floor(new Date().getTime() / 1000),
next_check: Math.floor(new Date().getTime() / 1000) + 120
})
}).catch((err) => {
console.error(err)
})
@@ -18376,11 +18306,9 @@ class AutomaticDispose {
RemoveMissionsFromQueue(MissionID) {
const self = this;
return self.ADisDB.transaction('rw!', [self.ADisDB.ADisMissions], async () => {
return self.ADisDB.ADisMissions.where({
missionID: MissionID
}).delete()
}).catch((err) => {
}).delete().catch((err) => {
console.error(err)
})
}
@@ -18400,10 +18328,10 @@ class AutomaticDispose {
// runnerIframe:runnerIframe
// })
return self.ADisDB.transaction('rw!', [self.ADisDB.ADisMissions, self.ADisDB.ADisAvailabelMissions], async () => {
return await self.ADSettings().then(async (setting) => {
return self.ADisDB.transaction('rw', [self.ADisDB.ADisMissions, self.ADisDB.ADisAvailabelMissions], () => {
self.ADSettings().then((setting) => {
if (setting[runnerSettings] == 'true') {
return await self.ADisDB.ADisMissions.where({
return self.ADisDB.ADisMissions.where({
runner: Runner,
available: 'true',
done: 'false'
@@ -18411,7 +18339,6 @@ class AutomaticDispose {
return item.next_check <= Math.floor(new Date().getTime() / 1000)
}).limit(1)
}
})
}).then((Wunsch) => {
// console.table(Wunsch);
if (Wunsch !== undefined) {
@@ -18436,13 +18363,12 @@ class AutomaticDispose {
}
});
} else {
return setTimeout(Dexie.ignoreTransaction(function () {self.OpenNextMission.bind(self, Runner)}), 1000);
return setTimeout(self.OpenNextMission.bind(self), 1000, Runner);
}
});
}
return setTimeout(Dexie.ignoreTransaction(function () {self.OpenNextMission.bind(self, Runner)}), 1000);
}).catch((err) => {
console.error(err)
return setTimeout(self.OpenNextMission.bind(self), 1000, Runner);
});
});
}
@@ -18483,8 +18409,8 @@ class AutomaticDispose {
// 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, ], async () => {
return self.ADSettings().then(async (setting) => {
return self.ADisDB.transaction('rw', [self.ADisDB.ADisMissions], () => {
self.ADSettings().then((setting) => {
if (setting[self.MyRunnerSettings] === 'true') {
let where = {
@@ -18517,8 +18443,6 @@ class AutomaticDispose {
})
}
})
}).catch((err) => {
console.error(err)
})
// }
}, 500);
@@ -18527,31 +18451,27 @@ class AutomaticDispose {
MainHandler() {
const self = this;
if (self.includesString($('div.missionNotFoundText').text(), 'Der Einsatz wurde erfolgreich abgeschlossen.')) {
if (self.includesString($('#iframe-inside-container > div.missionNotFound > div.missionNotFoundText').text(), 'Der Einsatz wurde erfolgreich abgeschlossen.')) {
console.log("DONE!");
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 if (self.includesString($('#iframe-inside-container div.alert.fade.in.alert-success').text(), "wurde erfolgreich informiert")) {
} 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(() => {
return tellParent(`console.log('handler:2000:update:${window.name}:${self.MissionID}');window.AutomaticDisposeCall.FreeIframe('${self.MyRunner}');`); // update Mission here as updated or full
});
} else {
setTimeout(function () {
if (['adis-ownmissions', 'adis-plannedevents', 'adis-krankentransporte'].indexOf(window.name) != -1) {
console.log("WILL SEND?")
return self.CheckMissionAutomatic();
self.CheckMissionAutomatic();
} else if (['adis-verbandmission', 'adis-verbandmission-event'].indexOf(window.name) != -1) {
return self.WorkVerbandMission();
self.WorkVerbandMission();
}
}, 250);
}
}
@@ -18563,9 +18483,6 @@ class AutomaticDispose {
WorkVerbandMission() {
const self = this;
const runnerID = self.ADisSettings.runner_iframesName.indexOf(window.name);
self.MyRunner = self.ADisSettings.runner[runnerID];
self.MyRunnerSettings = self.ADisSettings.runner_settings[runnerID];
self.ADSettings().then((setting) => {
var title = document.getElementById('missionH1');
var isVerband = title.innerText.toLowerCase().includes("[verband]");
@@ -18623,14 +18540,15 @@ class AutomaticDispose {
CheckMissionAutomatic() {
const self = this;
const runnerID = self.ADisSettings.runner_iframesName.indexOf(window.name);
self.MyRunner = self.ADisSettings.runner[runnerID];
self.MyRunnerSettings = self.ADisSettings.runner_settings[runnerID];
if (self.MyRunnerSettings && self.MyRunner) {
console.log("debug 1");
var setOpt;
if (window.name == 'adis-ownmissions' || window.name == 'adis-plannedevents') {
setOpt = 'MissionsOwn-Automatic';
} else if (window.name == 'adis-krankentransporte') {
setOpt = 'Krankentransport-Automatic';
}
if (setOpt && self.MyRunner) {
self.ADSettings().then((setting) => {
if (setting[self.MyRunnerSettings] === 'true') {
if (setting[setOpt] == 'true') {
let where = {
missionID: self.MissionID,
runner: self.MyRunner,
@@ -18645,21 +18563,14 @@ class AutomaticDispose {
return coll.limit(1).toArray()
}
}).then((Missions) => {
console.log("debug 2", Missions);
if (Missions.length > 0) {
var Mission = Missions[0];
if (self.MyRunner == 'os') {
self.OweSecure = true;
}
self.GetMissionConfiguration(Mission.type);
} else {
tellParent(`console.log('config:1000:update:${window.name}:${self.MissionID}');window.AutomaticDisposeCall.FreeIframe('${self.MyRunner}');`); // update Mission here as updated or full
}
}).catch((err) => {
console.error(err)
});
} else {
tellParent(`console.log('config:2000:update:${window.name}:${self.MissionID}');window.AutomaticDisposeCall.FreeIframe('${self.MyRunner}');`); // update Mission here as updated or full
}
}
@@ -18667,14 +18578,10 @@ class AutomaticDispose {
GetMissionConfiguration(MissionType) {
const self = this;
console.log("debug 3")
return self.ADisDB.transaction('rw!', [self.ADisDB.ADisMissions, self.ADisDB.ADisAvailabelMissions], function () {
console.log("debug 3", MissionType, MissionType.toString())
return self.ADisDB.transaction('rw', [self.ADisDB.ADisMissions, self.ADisDB.ADisAvailabelMissions], () => {
return self.ADisDB.ADisAvailabelMissions.get({
type: MissionType.toString()
})
}).then((availableMission) => {
console.log("debug 3", availableMission)
if (availableMission != undefined && availableMission.jsondata) {
self.MissionConfig = availableMission.jsondata;
// console.log('MissionConfig: ', MissionType.toString(), JSON.stringify(self.MissionConfig, null, 2))
@@ -18684,19 +18591,17 @@ class AutomaticDispose {
available: false,
next_check: CurrentTime + 60
};
self.UpdateMissionsToDone(self.MissionID);
tellParent(`console.log('config:3000:update:${window.name}:${self.MissionID}');window.AutomaticDisposeCall.FreeIframe('${self.MyRunner}');`); // update Mission here as updated or full
self.UpdateOwnMissionsToDone(self.MissionID, updateData);
}
}).catch((err) => {
console.error(err)
});;
});
});
}
StartAlarmProcess() {
const self = this;
const alarming = function alarming(self) {
Promise.resolve().then(async () => {
return await self.PrepareVehicleNeedList();
}).then(async () => {
@@ -18749,22 +18654,38 @@ class AutomaticDispose {
setTimeout(() => {
self.UpdateMissionsToDone(self.MissionID).then(() => {
if ($('#vehicle_show_table_all tr input[type="checkbox"]:checked').length > 0) {
tellParent(`console.log('ok:${window.name}:${self.MissionID}');`);
window.$('#mission_alarm_btn').click();
} else {
tellParent(`window.AutomaticDisposeCall.FreeIframe('${self.MyRunner}');`);
}
});
}, 250);
}).catch((err) => {
console.error(err)
})
};
var $div = $("#mission-form > div:nth-child(7) > a");
var isShow = $div.is(':hidden');
//console.log($div, isShow);
if ($div.length && isShow && 1 == 0) {
var observer = new MutationObserver(function (mutations) {
mutations.forEach(function (mutation) {
if (mutation.attributeName === "style") {
setTimeout(function () {
alarming(self)
}, 1500);
}
});
});
observer.observe($div[0], {
attributes: true
});
$div.click();
} else {
setTimeout(function () {
alarming(self)
}, 500);
}
}
@@ -19716,28 +19637,5 @@ class AutomaticDispose {
}
}
$(document).ready(function () {
var $div = $("a:contains('Fahrzeuganzeige begrenzt! Fehlende Fahrzeuge laden!')");
var isShow = $div.is(':hidden');
//console.log($div, isShow);
if ($div.length && isShow && 1 == 0) {
var observer = new MutationObserver(function (mutations) {
mutations.forEach(function (mutation) {
if (mutation.attributeName === "style") {
setTimeout(function () {
window.AutomaticDisposeCall = new AutomaticDispose();
}, 1500);
}
});
});
observer.observe($div[0], {
attributes: true
});
$div.click();
} else {
setTimeout(function () {
window.AutomaticDisposeCall = new AutomaticDispose();
}, 500);
}
});
window.AutomaticDisposeCall = new AutomaticDispose();
+97 -199
View File
@@ -4,12 +4,11 @@ class AutomaticDispose {
// Variablen
get ADisSettings() {
let self = this
return {
url: "https://jf.git.rest/Jomaar/automatic-dispose/raw/branch/",
branch: "master",
all_missions: /***ADis_AllMissions***/ 0,
name: self.name,
name: this.name,
runner: ['kt', 'om', 'os', 'vm', 've'],
runner_divs: ['mission_list_krankentransporte', 'mission_list', /*'mission_list_sicherheitswache',*/ 'mission_list_alliance', 'mission_list_alliance_event'],
runner_settings: ['Krankentransport-Automatic', 'MissionsOwn-Automatic', /*'MissionsOwn-Automatic',*/ 'Alliance-Automatic', 'AllianceEvent-Automatic'],
@@ -195,26 +194,14 @@ class AutomaticDispose {
// - Sprechwunsch Queue
// -
RemovePoliceSprechwunschFromQueue(WunschID) {
let self = this;
return self.ADisDB.transaction('rw!', [self.ADisDB.ADisSprechwunschPolice], async () => {
return await self.ADisDB.ADisSprechwunschPolice.where({
return this.ADisDB.ADisSprechwunschPolice.where({
missionID: WunschID
}).delete();
}).catch((err) => {
console.error(err)
})
}
RemoveRescueSprechwunschFromQueue(WunschID) {
let self = this;
return self.ADisDB.transaction('rw!', [self.ADisDB.ADisSprechwunsch], async () => {
return await self.ADisDB.ADisSprechwunsch.where({
return this.ADisDB.ADisSprechwunsch.where({
vehicleID: WunschID
}).delete();
}).catch((err) => {
console.error(err)
})
}
// - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
@@ -225,7 +212,6 @@ class AutomaticDispose {
CollectRescueSprechwuensche() {
let self = this;
return self.ADisDB.transaction('rw!', [self.ADisDB.ADisSprechwunsch], async () => {
new Promise(async (resolve, reject) => {
await self.ADisDB.ADisSprechwunsch.where({
done: 'false'
@@ -244,16 +230,12 @@ class AutomaticDispose {
self.AddRescueSprechwunschToQueue(VehicleID);
}
});
})
}).catch((err) => {
console.error(err)
})
});
}
OpenNextRescueSprechwunsch() {
let self = this;
return self.ADisDB.transaction('rw!', [self.ADisDB.ADisSprechwunsch], async () => {
return await self.ADSettings().then((setting) => {
self.ADSettings().then((setting) => {
if (setting['Sprechwunsch-Automatic'] == 'true') {
return self.ADisDB.ADisSprechwunsch.where({
done: 'false'
@@ -261,55 +243,39 @@ class AutomaticDispose {
}
}).then((Wunsch) => {
if (Wunsch !== undefined) {
Wunsch.each(async (myWunsch) => {
Wunsch.each((myWunsch) => {
let VehicleID = myWunsch.vehicleID;
await self.UpdateRescueSprechwunschToDone(VehicleID).then(() => {
self.UpdateRescueSprechwunschToDone(VehicleID).then(() => {
if ($("#adis-sprechwunsch-rescue-frame").attr("vehicle_id") == "empty") {
$("#adis-sprechwunsch-rescue-frame").attr("src", "https://www.leitstellenspiel.de/vehicles/" + VehicleID);
$("#adis-sprechwunsch-rescue-frame").attr("vehicle_id", VehicleID);
self.RescueVehicleFrameWatchDog = setTimeout(async function () {
let self = this;
return self.ADisDB.transaction('rw!', [self.ADisDB.ADisSprechwunsch], async () => {
self.RescueVehicleFrameWatchDog = setTimeout(async () => {
self.RemoveRescueSprechwunschFromQueue(VehicleID).then((deleteCount) => {
$("#adis-sprechwunsch-rescue-frame").attr("src", "");
$("#adis-sprechwunsch-rescue-frame").attr("vehicle_id", "empty");
});
});
}.bind(self), 1500);
}, 1500);
}
});
});
}
})
}).catch((err) => {
console.error(err)
})
});
}
AddRescueSprechwunschToQueue(WunschID) {
let self = this
return self.ADisDB.transaction('rw!', [self.ADisDB.ADisSprechwunsch], async () => {
return await self.ADisDB.ADisSprechwunsch.put({
return this.ADisDB.ADisSprechwunsch.put({
vehicleID: WunschID,
done: 'false'
})
}).catch((err) => {
console.error(err)
})
}).catch((err) => {})
}
UpdateRescueSprechwunschToDone(WunschID) {
let self = this
return self.ADisDB.transaction('rw!', [self.ADisDB.ADisSprechwunsch], async () => {
return await self.ADisDB.ADisSprechwunsch.put({
return this.ADisDB.ADisSprechwunsch.put({
vehicleID: WunschID,
done: 'true'
})
}).catch((err) => {
console.error(err)
})
}).catch((err) => {})
}
@@ -420,8 +386,7 @@ class AutomaticDispose {
CollectPoliceSprechwuensche() {
let self = this;
return self.ADisDB.transaction('rw!', [self.ADisDB.ADisSprechwunschPolice], async () => {
await new Promise(async (resolve, reject) => {
new Promise(async (resolve, reject) => {
await self.ADisDB.ADisSprechwunschPolice.where({
done: 'false'
}).each((myWunsch) => {
@@ -433,14 +398,14 @@ class AutomaticDispose {
return resolve();
}).then(() => {
var MOIODOS = $('div#mission_list div.missionSideBarEntry:visible');
return MOIODOS.each(async (_, elem) => {
return MOIODOS.each((_, elem) => {
if ($(elem).text().match(/Gefangene sollen abtransportiert werden/g)) {
var MissionID = $(elem).attr("mission_id");
await self.AddPoliceSprechwunschToQueue(MissionID);
self.AddPoliceSprechwunschToQueue(MissionID);
}
});
}).then(() => {
$("#building_list").find(".building_list_vehicle_element").each(async (_, elem) => {
$("#building_list").find(".building_list_vehicle_element").each((_, elem) => {
var VehicleStatus = $(elem).find(".building_list_fms").text();
var VehicleType = Number(parseInt($(elem).find("a").attr("vehicle_type_id")));
var VehicleID = $(elem).attr("vehicle_id");
@@ -450,21 +415,17 @@ class AutomaticDispose {
var _meap = String(map2.attr('href'));
var MissionID = _meap.substr(_meap.lastIndexOf("/") + 1);
if (MissionID) {
await self.AddPoliceSprechwunschToQueue(MissionID);
self.AddPoliceSprechwunschToQueue(MissionID);
}
}
}
});
})
}).catch((err) => {
console.error(err)
})
});
}
OpenNextPoliceSprechwunsch() {
let self = this;
return self.ADisDB.transaction('rw!', [self.ADisDB.ADisSprechwunschPolice], async () => {
return await self.ADSettings().then((setting) => {
self.ADSettings().then((setting) => {
if (setting['Sprechwunsch-Automatic'] == 'true') {
return self.ADisDB.ADisSprechwunschPolice.where({
done: 'false'
@@ -472,54 +433,38 @@ class AutomaticDispose {
}
}).then((Wunsch) => {
if (Wunsch !== undefined) {
Wunsch.each(async (myWunsch) => {
Wunsch.each((myWunsch) => {
let MissionID = myWunsch.missionID;
await self.UpdatePoliceSprechwunschToDone(MissionID).then(() => {
self.UpdatePoliceSprechwunschToDone(MissionID).then(() => {
if ($("#adis-sprechwunsch-police-frame").attr("mission_id") == "empty") {
$("#adis-sprechwunsch-police-frame").attr("src", "https://www.leitstellenspiel.de/missions/" + MissionID);
$("#adis-sprechwunsch-police-frame").attr("mission_id", MissionID);
self.PoliceVehicleFrameWatchDog = setTimeout(async function (MissionID) {
let self = this;
return self.ADisDB.transaction('rw!', [self.ADisDB.ADisSprechwunschPolice], async () => {
await self.RemovePoliceSprechwunschFromQueue(MissionID).then((deleteCount) => {
self.PoliceVehicleFrameWatchDog = setTimeout(async (MissionID) => {
self.RemovePoliceSprechwunschFromQueue(MissionID).then((deleteCount) => {
$("#adis-sprechwunsch-police-frame").attr("src", "");
$("#adis-sprechwunsch-police-frame").attr("mission_id", "empty");
});
});
}.bind(self), 1500, MissionID);
}, 1500, MissionID);
}
});
});
}
})
}).catch((err) => {
console.error(err)
})
});
}
AddPoliceSprechwunschToQueue(WunschID) {
let self = this;
return self.ADisDB.transaction('rw!', [self.ADisDB.ADisSprechwunschPolice], async () => {
return await self.ADisDB.ADisSprechwunschPolice.put({
return this.ADisDB.ADisSprechwunschPolice.put({
missionID: WunschID,
done: 'false'
})
}).catch((err) => {
console.error(err)
})
}).catch((err) => {})
}
UpdatePoliceSprechwunschToDone(WunschID) {
let self = this;
return self.ADisDB.transaction('rw!', [self.ADisDB.ADisSprechwunschPolice], async () => {
return await self.ADisDB.ADisSprechwunschPolice.put({
return this.ADisDB.ADisSprechwunschPolice.add({
missionID: WunschID,
done: 'true'
})
}).catch((err) => {
console.error(err)
})
}).catch((err) => {})
}
@@ -733,7 +678,7 @@ class AutomaticDispose {
var styleElement = document.createElement("link");
styleElement.rel = "stylesheet";
styleElement.href = "https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700";
this.ADis_MyHead.appendChild(styleElement);
self.ADis_MyHead.appendChild(styleElement);
// -
// - FontAwesome 5
@@ -741,7 +686,7 @@ class AutomaticDispose {
var scriptElement = document.createElement("script");
scriptElement.type = "text/javascript";
scriptElement.src = "https://use.fontawesome.com/releases/v5.5.0/js/all.js";
this.ADis_MyHead.appendChild(scriptElement);
self.ADis_MyHead.appendChild(scriptElement);
// -
// - Navbar Dashboard
@@ -750,8 +695,8 @@ class AutomaticDispose {
styleElement.rel = "stylesheet";
styleElement.type = "text/css";
styleElement.media = "screen";
styleElement.href = this.ADisSettings.url + this.ADisSettings.branch + "/style/interface.css";
this.ADis_MyHead.appendChild(styleElement);
styleElement.href = self.ADisSettings.url + self.ADisSettings.branch + "/style/interface.css";
self.ADis_MyHead.appendChild(styleElement);
// Create Dashboard
$('#news_li').before('<li id="adis-nav-item"></li>');
@@ -894,14 +839,11 @@ class AutomaticDispose {
}
AddAvailableMissions(Mission) {
let self = this;
return self.ADisDB.transaction('rw!', [self.ADisDB.ADisAvailabelMissions], async () => {
return self.ADisDB.ADisAvailabelMissions.put({
return this.ADisDB.ADisAvailabelMissions.put({
missionID: Mission.id,
type: Mission.type,
name: Mission.name,
jsondata: Mission
})
}).catch((err) => {
console.error(err)
})
@@ -943,8 +885,9 @@ class AutomaticDispose {
ReadAndAddMissions(MissionID, Runner) {
const self = this;
return self.ADisDB.transaction('rw!', [self.ADisDB.ADisMissions, self.ADisDB.ADisAvailabelMissions], async () => {
return self.ADSettings().then(async () => {
return self.ADisDB.transaction('rw', [self.ADisDB.ADisMissions, self.ADisDB.ADisAvailabelMissions], () => {
self.ADSettings().then(() => {
return self.ADisDB.ADisMissions.toCollection()
}).then((Missions) => {
if (typeof Missions !== "undefined") {
@@ -955,7 +898,7 @@ class AutomaticDispose {
if (MissionElement.length == 0 || $('#mission_panel_' + MyMission.missionID).hasClass('mission_panel_green')) {
// remove
console.log("Remove :", MyMission)
return self.RemoveMissionsFromQueue(MyMission.missionID)
self.RemoveMissionsFromQueue(MyMission.missionID)
}
});
}
@@ -973,10 +916,8 @@ class AutomaticDispose {
});
})
}
})
}).catch((err) => {
console.error(err)
});;
});
});
}
AddMission(ID, Runner) {
@@ -985,7 +926,7 @@ class AutomaticDispose {
const runnerID = self.ADisSettings.runner_divs.indexOf(Runner);
const settingOpt = self.ADisSettings.runner_settings[runnerID];
const runnerOpt = self.ADisSettings.runner[runnerID];
return self.ADisDB.transaction('rw!', [self.ADisDB.ADisMissions, self.ADisDB.ADisAvailabelMissions], async () => {
return self.ADSettings().then((setting) => {
if (setting[settingOpt] == 'true') {
let where = {
@@ -1039,7 +980,7 @@ class AutomaticDispose {
var MissionVillage = addr[2];
console.log('update mission', MissionID)
return self.ADisDB.ADisAvailabelMissions.get({
type: _MissionType
type: MissionType
}).then((available) => {
return self.UpdateMissions({
"missionID": _MissionID,
@@ -1086,30 +1027,21 @@ class AutomaticDispose {
}
});
});
});
}
AddMissionsToQueue(Mission) {
const self = this;
return self.ADisDB.transaction('rw!', [self.ADisDB.ADisMissions], async () => {
return self.ADisDB.ADisMissions.put(Mission).catch((err) => {
console.error(err)
});
}).catch((err) => {
console.error(err)
});
}
UpdateMissions(Mission) {
const self = this;
return self.ADisDB.transaction('rw!', [self.ADisDB.ADisMissions], async () => {
return self.ADisDB.ADisMissions.put(Mission).catch((err) => {
console.error(err)
});
}).catch((err) => {
console.error(err)
});
})
}
FreeIframe(Runner) {
@@ -1123,11 +1055,9 @@ class AutomaticDispose {
UpdateMissionsToDone(MissionID) {
const self = this;
return self.ADisDB.transaction('rw!', [self.ADisDB.ADisMissions], async () => {
return self.ADisDB.ADisMissions.update(MissionID, {
last_check: Math.floor(new Date().getTime() / 1000),
next_check: Math.floor(new Date().getTime() / 1000) + 120
})
}).catch((err) => {
console.error(err)
})
@@ -1135,11 +1065,9 @@ class AutomaticDispose {
RemoveMissionsFromQueue(MissionID) {
const self = this;
return self.ADisDB.transaction('rw!', [self.ADisDB.ADisMissions], async () => {
return self.ADisDB.ADisMissions.where({
missionID: MissionID
}).delete()
}).catch((err) => {
}).delete().catch((err) => {
console.error(err)
})
}
@@ -1159,10 +1087,10 @@ class AutomaticDispose {
// runnerIframe:runnerIframe
// })
return self.ADisDB.transaction('rw!', [self.ADisDB.ADisMissions, self.ADisDB.ADisAvailabelMissions], async () => {
return await self.ADSettings().then(async (setting) => {
return self.ADisDB.transaction('rw', [self.ADisDB.ADisMissions, self.ADisDB.ADisAvailabelMissions], () => {
self.ADSettings().then((setting) => {
if (setting[runnerSettings] == 'true') {
return await self.ADisDB.ADisMissions.where({
return self.ADisDB.ADisMissions.where({
runner: Runner,
available: 'true',
done: 'false'
@@ -1170,7 +1098,6 @@ class AutomaticDispose {
return item.next_check <= Math.floor(new Date().getTime() / 1000)
}).limit(1)
}
})
}).then((Wunsch) => {
// console.table(Wunsch);
if (Wunsch !== undefined) {
@@ -1195,13 +1122,12 @@ class AutomaticDispose {
}
});
} else {
return setTimeout(Dexie.ignoreTransaction(function () {self.OpenNextMission.bind(self, Runner)}), 1000);
return setTimeout(self.OpenNextMission.bind(self), 1000, Runner);
}
});
}
return setTimeout(Dexie.ignoreTransaction(function () {self.OpenNextMission.bind(self, Runner)}), 1000);
}).catch((err) => {
console.error(err)
return setTimeout(self.OpenNextMission.bind(self), 1000, Runner);
});
});
}
@@ -1242,8 +1168,8 @@ class AutomaticDispose {
// 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, ], async () => {
return self.ADSettings().then(async (setting) => {
return self.ADisDB.transaction('rw', [self.ADisDB.ADisMissions], () => {
self.ADSettings().then((setting) => {
if (setting[self.MyRunnerSettings] === 'true') {
let where = {
@@ -1276,8 +1202,6 @@ class AutomaticDispose {
})
}
})
}).catch((err) => {
console.error(err)
})
// }
}, 500);
@@ -1286,31 +1210,27 @@ class AutomaticDispose {
MainHandler() {
const self = this;
if (self.includesString($('div.missionNotFoundText').text(), 'Der Einsatz wurde erfolgreich abgeschlossen.')) {
if (self.includesString($('#iframe-inside-container > div.missionNotFound > div.missionNotFoundText').text(), 'Der Einsatz wurde erfolgreich abgeschlossen.')) {
console.log("DONE!");
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 if (self.includesString($('#iframe-inside-container div.alert.fade.in.alert-success').text(), "wurde erfolgreich informiert")) {
} 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(() => {
return tellParent(`console.log('handler:2000:update:${window.name}:${self.MissionID}');window.AutomaticDisposeCall.FreeIframe('${self.MyRunner}');`); // update Mission here as updated or full
});
} else {
setTimeout(function () {
if (['adis-ownmissions', 'adis-plannedevents', 'adis-krankentransporte'].indexOf(window.name) != -1) {
console.log("WILL SEND?")
return self.CheckMissionAutomatic();
self.CheckMissionAutomatic();
} else if (['adis-verbandmission', 'adis-verbandmission-event'].indexOf(window.name) != -1) {
return self.WorkVerbandMission();
self.WorkVerbandMission();
}
}, 250);
}
}
@@ -1322,9 +1242,6 @@ class AutomaticDispose {
WorkVerbandMission() {
const self = this;
const runnerID = self.ADisSettings.runner_iframesName.indexOf(window.name);
self.MyRunner = self.ADisSettings.runner[runnerID];
self.MyRunnerSettings = self.ADisSettings.runner_settings[runnerID];
self.ADSettings().then((setting) => {
var title = document.getElementById('missionH1');
var isVerband = title.innerText.toLowerCase().includes("[verband]");
@@ -1382,14 +1299,15 @@ class AutomaticDispose {
CheckMissionAutomatic() {
const self = this;
const runnerID = self.ADisSettings.runner_iframesName.indexOf(window.name);
self.MyRunner = self.ADisSettings.runner[runnerID];
self.MyRunnerSettings = self.ADisSettings.runner_settings[runnerID];
if (self.MyRunnerSettings && self.MyRunner) {
console.log("debug 1");
var setOpt;
if (window.name == 'adis-ownmissions' || window.name == 'adis-plannedevents') {
setOpt = 'MissionsOwn-Automatic';
} else if (window.name == 'adis-krankentransporte') {
setOpt = 'Krankentransport-Automatic';
}
if (setOpt && self.MyRunner) {
self.ADSettings().then((setting) => {
if (setting[self.MyRunnerSettings] === 'true') {
if (setting[setOpt] == 'true') {
let where = {
missionID: self.MissionID,
runner: self.MyRunner,
@@ -1404,21 +1322,14 @@ class AutomaticDispose {
return coll.limit(1).toArray()
}
}).then((Missions) => {
console.log("debug 2", Missions);
if (Missions.length > 0) {
var Mission = Missions[0];
if (self.MyRunner == 'os') {
self.OweSecure = true;
}
self.GetMissionConfiguration(Mission.type);
} else {
tellParent(`console.log('config:1000:update:${window.name}:${self.MissionID}');window.AutomaticDisposeCall.FreeIframe('${self.MyRunner}');`); // update Mission here as updated or full
}
}).catch((err) => {
console.error(err)
});
} else {
tellParent(`console.log('config:2000:update:${window.name}:${self.MissionID}');window.AutomaticDisposeCall.FreeIframe('${self.MyRunner}');`); // update Mission here as updated or full
}
}
@@ -1426,14 +1337,10 @@ class AutomaticDispose {
GetMissionConfiguration(MissionType) {
const self = this;
console.log("debug 3")
return self.ADisDB.transaction('rw!', [self.ADisDB.ADisMissions, self.ADisDB.ADisAvailabelMissions], function () {
console.log("debug 3", MissionType, MissionType.toString())
return self.ADisDB.transaction('rw', [self.ADisDB.ADisMissions, self.ADisDB.ADisAvailabelMissions], () => {
return self.ADisDB.ADisAvailabelMissions.get({
type: MissionType.toString()
})
}).then((availableMission) => {
console.log("debug 3", availableMission)
if (availableMission != undefined && availableMission.jsondata) {
self.MissionConfig = availableMission.jsondata;
// console.log('MissionConfig: ', MissionType.toString(), JSON.stringify(self.MissionConfig, null, 2))
@@ -1443,19 +1350,17 @@ class AutomaticDispose {
available: false,
next_check: CurrentTime + 60
};
self.UpdateMissionsToDone(self.MissionID);
tellParent(`console.log('config:3000:update:${window.name}:${self.MissionID}');window.AutomaticDisposeCall.FreeIframe('${self.MyRunner}');`); // update Mission here as updated or full
self.UpdateOwnMissionsToDone(self.MissionID, updateData);
}
}).catch((err) => {
console.error(err)
});;
});
});
}
StartAlarmProcess() {
const self = this;
const alarming = function alarming(self) {
Promise.resolve().then(async () => {
return await self.PrepareVehicleNeedList();
}).then(async () => {
@@ -1508,22 +1413,38 @@ class AutomaticDispose {
setTimeout(() => {
self.UpdateMissionsToDone(self.MissionID).then(() => {
if ($('#vehicle_show_table_all tr input[type="checkbox"]:checked').length > 0) {
tellParent(`console.log('ok:${window.name}:${self.MissionID}');`);
window.$('#mission_alarm_btn').click();
} else {
tellParent(`window.AutomaticDisposeCall.FreeIframe('${self.MyRunner}');`);
}
});
}, 250);
}).catch((err) => {
console.error(err)
})
};
var $div = $("#mission-form > div:nth-child(7) > a");
var isShow = $div.is(':hidden');
//console.log($div, isShow);
if ($div.length && isShow && 1 == 0) {
var observer = new MutationObserver(function (mutations) {
mutations.forEach(function (mutation) {
if (mutation.attributeName === "style") {
setTimeout(function () {
alarming(self)
}, 1500);
}
});
});
observer.observe($div[0], {
attributes: true
});
$div.click();
} else {
setTimeout(function () {
alarming(self)
}, 500);
}
}
@@ -2475,28 +2396,5 @@ class AutomaticDispose {
}
}
$(document).ready(function () {
var $div = $("a:contains('Fahrzeuganzeige begrenzt! Fehlende Fahrzeuge laden!')");
var isShow = $div.is(':hidden');
//console.log($div, isShow);
if ($div.length && isShow && 1 == 0) {
var observer = new MutationObserver(function (mutations) {
mutations.forEach(function (mutation) {
if (mutation.attributeName === "style") {
setTimeout(function () {
window.AutomaticDisposeCall = new AutomaticDispose();
}, 1500);
}
});
});
observer.observe($div[0], {
attributes: true
});
$div.click();
} else {
setTimeout(function () {
window.AutomaticDisposeCall = new AutomaticDispose();
}, 500);
}
});
window.AutomaticDisposeCall = new AutomaticDispose();