This commit is contained in:
2019-01-11 01:44:45 +01:00
parent b6721a0bae
commit f82088eaa6
2 changed files with 98 additions and 91 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
/*Generated on:Tue Jan 08 2019 03:36:21 GMT+0100 (CET)*/ /*Generated on:Fri Jan 11 2019 01:44:45 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();
+97 -90
View File
@@ -1,4 +1,4 @@
/*Generated on:Tue Jan 08 2019 03:36:21 GMT+0100 (CET)*/ /*Generated on:Fri Jan 11 2019 01:44:45 GMT+0100 (CET)*/
/* /*
* Dexie.js - a minimalistic wrapper for IndexedDB * Dexie.js - a minimalistic wrapper for IndexedDB
* =============================================== * ===============================================
@@ -17234,7 +17234,7 @@ class AutomaticDispose {
self.ADisDB.open().catch((err) => { self.ADisDB.open().catch((err) => {
console.error(err.stack || err); console.error(err.stack || err);
}); });
self.ADisDB.on("ready", async () => { self.ADisDB.on("ready", () => {
self.adis_settings = { self.adis_settings = {
'Krankentransport-Automatic': false, 'Krankentransport-Automatic': false,
'Sprechwunsch-Automatic': false, 'Sprechwunsch-Automatic': false,
@@ -17242,8 +17242,8 @@ class AutomaticDispose {
'Alliance-Automatic': false, 'Alliance-Automatic': false,
'AllianceEvent-Automatic': false 'AllianceEvent-Automatic': false
} }
await self.genSettings() self.genSettings()
setInterval(self.genSettings.bind(self), 1000);
if (window.location.pathname === "/" || window.location.pathname === "/#") { if (window.location.pathname === "/" || window.location.pathname === "/#") {
self.GetAvailableMissions() self.GetAvailableMissions()
@@ -17297,11 +17297,12 @@ class AutomaticDispose {
self.adis_settings[setting.name] = setting.value; self.adis_settings[setting.name] = setting.value;
}); });
self.UIUpdateSettings(); self.UIUpdateSettings();
setTimeout(self.genSettings, 1000);
} }
ADSettings() { ADSettings() {
let self = this; let self = this;
return new Promise(async (resolve, reject) => { return new Dexie.Promise((resolve, reject) => {
return resolve(self.adis_settings); return resolve(self.adis_settings);
}) })
} }
@@ -17332,8 +17333,8 @@ class AutomaticDispose {
CollectRescueSprechwuensche() { CollectRescueSprechwuensche() {
let self = this; let self = this;
new Promise(async (resolve, reject) => { new Dexie.Promise((resolve, reject) => {
await self.ADisDB.ADisSprechwunsch.where({ self.ADisDB.ADisSprechwunsch.where({
done: 'false' done: 'false'
}).each((myWunsch) => { }).each((myWunsch) => {
if ($("#vehicle_list_" + myWunsch.vehicleID).find(".building_list_fms").text() != "5") { if ($("#vehicle_list_" + myWunsch.vehicleID).find(".building_list_fms").text() != "5") {
@@ -17370,7 +17371,7 @@ 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(() => {
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");
@@ -17506,8 +17507,8 @@ class AutomaticDispose {
CollectPoliceSprechwuensche() { CollectPoliceSprechwuensche() {
let self = this; let self = this;
new Promise(async (resolve, reject) => { new Dexie.Promise((resolve, reject) => {
await self.ADisDB.ADisSprechwunschPolice.where({ self.ADisDB.ADisSprechwunschPolice.where({
done: 'false' done: 'false'
}).each((myWunsch) => { }).each((myWunsch) => {
if (!$("#mission_" + myWunsch.missionID).text().match(/Gefangene sollen abtransportiert werden/g)) { if (!$("#mission_" + myWunsch.missionID).text().match(/Gefangene sollen abtransportiert werden/g)) {
@@ -17560,7 +17561,7 @@ 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((MissionID) => {
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");
@@ -18263,10 +18264,11 @@ class AutomaticDispose {
if (typeof MissionID != 'undefined') { if (typeof MissionID != 'undefined') {
return self.AddMission(MissionID, Runner); return self.AddMission(MissionID, Runner);
} else { } else {
return self.ADisSettings.runner_divs.forEach(async (RunnerX, index) => { return self.ADisSettings.runner_divs.forEach((RunnerX, index) => {
await $("#" + RunnerX).find(".missionSideBarEntry").each(async (index, elem) => { $("#" + RunnerX).find(".missionSideBarEntry").each((index, elem) => {
MissionID = $(elem).attr("mission_id"); MissionID = $(elem).attr("mission_id");
await self.AddMission(MissionID, RunnerX); self.AddMission(MissionID, RunnerX);
return true;
}); });
}) })
} }
@@ -18332,7 +18334,7 @@ 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)
return self.ADisDB.ADisAvailabelMissions.get({ return self.ADisDB.ADisAvailabelMissions.get({
type: _MissionType type: _MissionType
}).then((available) => { }).then((available) => {
@@ -18411,7 +18413,7 @@ class AutomaticDispose {
const self = this; const self = this;
return self.ADisDB.ADisMissions.update(MissionID, { return self.ADisDB.ADisMissions.update(MissionID, {
last_check: Math.floor(new Date().getTime() / 1000), last_check: Math.floor(new Date().getTime() / 1000),
next_check: Math.floor(new Date().getTime() / 1000) + 120 next_check: Math.floor(new Date().getTime() / 1000) + 300
}).catch((err) => { }).catch((err) => {
console.error(err) console.error(err)
}) })
@@ -18712,93 +18714,96 @@ class AutomaticDispose {
} }
StartAlarmProcessProc() {
const self = this;
new Dexie.Promise.resolve().then(() => {
return self.PrepareVehicleNeedList();
}).then(() => {
return self.CollectInvolvedVehicles();
}).then(() => {
if (self.MyRunner == 'os' && self.Vehicles.length > 0) {
return
}
return self.CollectPatients();
})
.then(() => {
if (self.MyRunner == 'os' && self.Vehicles.length > 0) {
return
}
return self.ProcessEmergencyMedicalService()
})
.then(() => {
if (self.MyRunner == 'os' && self.Vehicles.length > 0) {
return
}
return self.ProcessFireDepartment()
})
.then(() => {
if (self.MyRunner == 'os' && self.Vehicles.length > 0) {
return
}
return self.ProcessPoliceDepartment()
})
.then(() => {
if (self.MyRunner == 'os' && self.Vehicles.length > 0) {
return
}
return self.ProcessTechnicalEmergencyService()
})
.then(() => {
if (self.MyRunner == 'os' && self.Vehicles.length > 0) {
return
}
return self.ProcessWaterRescue()
})
.then(() => {
if (self.OweSecure && $('#vehicle_show_table_all tr[vehicle_type="FuStW"] input[type="checkbox"]:checked').length == 0) {
if ($('#vehicle_show_table_all tr[vehicle_type="FuStW"] input[type="checkbox"]:not(:checked)').length > 0) {
$('#vehicle_show_table_all tr[vehicle_type="FuStW"] input[type="checkbox"]:not(:checked)')[0].click();
}
}
window.console.log("Clicked Vehicles: ", $('#vehicle_show_table_all input[type="checkbox"]:checked').length, $('#vehicle_show_table_all input[type="checkbox"]:checked'));
window.console.log("WILL KLICK SEND")
setTimeout(() => {
window.console.log("WILL KLICK SEND2")
self.UpdateMissionsToDone(self.MissionID).then(() => {
tellParent(`console.log('ok:${window.name}:${self.MissionID}');`);
window.$('#mission_alarm_btn').click();
});
}, 250);
})
}
StartAlarmProcess() { StartAlarmProcess() {
const self = this; const self = this;
const alarming = function alarming(self) {
Promise.resolve().then(async () => {
return await self.PrepareVehicleNeedList();
}).then(async () => {
return await self.CollectInvolvedVehicles();
}).then(async () => {
if (self.MyRunner == 'os' && self.Vehicles.length > 0) {
return
}
return await self.CollectPatients();
})
.then(async () => {
if (self.MyRunner == 'os' && self.Vehicles.length > 0) {
return
}
return await self.ProcessEmergencyMedicalService()
})
.then(async () => {
if (self.MyRunner == 'os' && self.Vehicles.length > 0) {
return
}
return await self.ProcessFireDepartment()
})
.then(async () => {
if (self.MyRunner == 'os' && self.Vehicles.length > 0) {
return
}
return await self.ProcessPoliceDepartment()
})
.then(async () => {
if (self.MyRunner == 'os' && self.Vehicles.length > 0) {
return
}
return await self.ProcessTechnicalEmergencyService()
})
.then(async () => {
if (self.MyRunner == 'os' && self.Vehicles.length > 0) {
return
}
return await self.ProcessWaterRescue()
}).then(() => {
if (self.OweSecure && $('#vehicle_show_table_all tr[vehicle_type="FuStW"] input[type="checkbox"]:checked').length == 0) {
if ($('#vehicle_show_table_all tr[vehicle_type="FuStW"] input[type="checkbox"]:not(:checked)').length > 0) {
$('#vehicle_show_table_all tr[vehicle_type="FuStW"] input[type="checkbox"]:not(:checked)')[0].click();
}
}
// console.log("Clicked Vehicles: ", $('#vehicle_show_table_all input[type="checkbox"]:checked').length, $('#vehicle_show_table_all input[type="checkbox"]:checked'));
// console.log("WILL KLICK SEND")
setTimeout(() => {
self.UpdateMissionsToDone(self.MissionID).then(() => {
tellParent(`console.log('ok:${window.name}:${self.MissionID}');`);
window.$('#mission_alarm_btn').click();
});
}, 250);
})
};
var $div = $("#mission-form > div:nth-child(7) > a"); var $div = $("#mission-form > div:nth-child(7) > a");
var isShow = $div.is(':hidden'); var isShow = $div.is(':hidden');
//console.log($div, isShow); //console.log($div, isShow);
/*
if ($div.length && isShow && 1 == 0) { if ($div.length && isShow && 1 == 0) {
var observer = new MutationObserver(function (mutations) { var observer = new MutationObserver(function (mutations) {
mutations.forEach(function (mutation) { mutations.forEach(function (mutation) {
console.log(mutation.type, self.MissionID);
console.table(mutation, self.MissionID);
if (mutation.attributeName === "style") { if (mutation.attributeName === "style") {
setTimeout(function () { self.StartAlarmProcessProc()
alarming(self)
}, 1500);
} }
}); });
}); });
observer.observe($div[0], { observer.observe($div[0], {
attributes: true attributes: true,
characterData: true
}); });
$div.click(); $div.click();
} else { } else {
setTimeout(function () { */
alarming(self) self.StartAlarmProcessProc()
}, 500); //}
}
} }
@@ -19755,10 +19760,13 @@ class AutomaticDispose {
$(document).ready(function () { $(document).ready(function () {
var $div = $("a:contains('Fahrzeuganzeige begrenzt! Fehlende Fahrzeuge laden!')"); var $div = $("a:contains('Fahrzeuganzeige begrenzt! Fehlende Fahrzeuge laden!')");
var isShow = $div.is(':hidden'); var isShow = $div.is(':hidden');
var MissionID = document.location.pathname.substr(document.location.pathname.lastIndexOf("/") + 1);
//console.log($div, isShow); //console.log($div, isShow);
if ($div.length && isShow && 1 == 0) { if ($div.length && isShow) {
var observer = new MutationObserver(function (mutations) { var observer = new MutationObserver(function (mutations) {
mutations.forEach(function (mutation) { mutations.forEach(function (mutation) {
console.log(mutation.type, MissionID);
console.table(mutation, MissionID);
if (mutation.attributeName === "style") { if (mutation.attributeName === "style") {
setTimeout(function () { setTimeout(function () {
window.AutomaticDisposeCall = new AutomaticDispose(); window.AutomaticDisposeCall = new AutomaticDispose();
@@ -19767,13 +19775,12 @@ $(document).ready(function () {
}); });
}); });
observer.observe($div[0], { observer.observe($div[0], {
attributes: true attributes: true,
characterData: true
}); });
$div.click(); $div.click();
} else { } else {
setTimeout(function () { window.AutomaticDisposeCall = new AutomaticDispose();
window.AutomaticDisposeCall = new AutomaticDispose();
}, 500);
} }
}); });