diff --git a/src/autoloaderV2.js b/src/autoloaderV2.js index 2d712b9..b66aa1f 100644 --- a/src/autoloaderV2.js +++ b/src/autoloaderV2.js @@ -213,14 +213,15 @@ class AutomaticDispose { CollectRescueSprechwuensche() { let self = this; - new Promise((resolve, reject) => { - return self.ADisDB.ADisSprechwunsch.where({ + new Dexie.Promise((resolve, reject) => { + self.ADisDB.ADisSprechwunsch.where({ done: 'false' }).each((myWunsch) => { if ($("#vehicle_list_" + myWunsch.vehicleID).find(".building_list_fms").text() != "5") { self.RemoveRescueSprechwunschFromQueue(myWunsch.vehicleID); } }) + return resolve(); }).then(() => { $("#building_list").find(".building_list_vehicle_element").each((_, elem) => { var VehicleStatus = $(elem).find(".building_list_fms").text(); @@ -386,8 +387,8 @@ class AutomaticDispose { CollectPoliceSprechwuensche() { let self = this; - new Promise((resolve, reject) => { - return self.ADisDB.ADisSprechwunschPolice.where({ + new Dexie.Promise((resolve, reject) => { + self.ADisDB.ADisSprechwunschPolice.where({ done: 'false' }).each((myWunsch) => { if (!$("#mission_" + myWunsch.missionID).text().match(/Gefangene sollen abtransportiert werden/g)) { @@ -395,6 +396,7 @@ class AutomaticDispose { return self.RemovePoliceSprechwunschFromQueue(myWunsch.missionID); } }) + return resolve(); }).then(() => { var MOIODOS = $('div#mission_list div.missionSideBarEntry:visible'); return MOIODOS.each((_, elem) => { @@ -1427,6 +1429,7 @@ class AutomaticDispose { 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) { @@ -1444,8 +1447,9 @@ class AutomaticDispose { $div.click(); } else { + */ self.StartAlarmProcessProc() - } + //} } @@ -2402,10 +2406,13 @@ class AutomaticDispose { $(document).ready(function () { var $div = $("a:contains('Fahrzeuganzeige begrenzt! Fehlende Fahrzeuge laden!')"); var isShow = $div.is(':hidden'); + var MissionID = document.location.pathname.substr(document.location.pathname.lastIndexOf("/") + 1); //console.log($div, isShow); - if ($div.length && isShow && 1 == 0) { + if ($div.length && isShow) { var observer = new MutationObserver(function (mutations) { mutations.forEach(function (mutation) { + console.log(mutation.type, MissionID); + console.table(mutation, MissionID); if (mutation.attributeName === "style") { setTimeout(function () { window.AutomaticDisposeCall = new AutomaticDispose(); @@ -2414,13 +2421,12 @@ $(document).ready(function () { }); }); observer.observe($div[0], { - attributes: true + attributes: true, + characterData: true }); $div.click(); } else { - setTimeout(function () { - window.AutomaticDisposeCall = new AutomaticDispose(); - }, 500); + window.AutomaticDisposeCall = new AutomaticDispose(); } }); \ No newline at end of file