From efd95eacabdf6d5151ecfba396188d66f178637c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20Fr=C3=B6hle?= Date: Wed, 19 Dec 2018 17:27:30 +0100 Subject: [PATCH] v2 transaction --- dist/autoloader.js | 2 +- dist/autoloaderV2.js | 42 +++++++++++++++++++++--------------------- src/autoloaderV2.js | 40 ++++++++++++++++++++-------------------- 3 files changed, 42 insertions(+), 42 deletions(-) diff --git a/dist/autoloader.js b/dist/autoloader.js index 817e786..9c2b53a 100755 --- a/dist/autoloader.js +++ b/dist/autoloader.js @@ -1,4 +1,4 @@ -/*Generated on:Wed Dec 19 2018 17:18:57 GMT+0100 (CET)*/ +/*Generated on:Wed Dec 19 2018 17:27:29 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(); diff --git a/dist/autoloaderV2.js b/dist/autoloaderV2.js index 9ffb54d..cddf513 100644 --- a/dist/autoloaderV2.js +++ b/dist/autoloaderV2.js @@ -1,4 +1,4 @@ -/*Generated on:Wed Dec 19 2018 17:18:57 GMT+0100 (CET)*/ +/*Generated on:Wed Dec 19 2018 17:27:29 GMT+0100 (CET)*/ /* * Dexie.js - a minimalistic wrapper for IndexedDB * =============================================== @@ -17203,7 +17203,7 @@ class AutomaticDispose { RemovePoliceSprechwunschFromQueue(WunschID) { let self = this; return self.ADisDB.transaction('rw', [self.ADisDB.ADisSprechwunschPolice], async () => { - return this.ADisDB.ADisSprechwunschPolice.where({ + return await this.ADisDB.ADisSprechwunschPolice.where({ missionID: WunschID }).delete(); @@ -17214,7 +17214,7 @@ class AutomaticDispose { RemoveRescueSprechwunschFromQueue(WunschID) { let self = this; return self.ADisDB.transaction('rw', [self.ADisDB.ADisSprechwunsch], async () => { - return this.ADisDB.ADisSprechwunsch.where({ + return await this.ADisDB.ADisSprechwunsch.where({ vehicleID: WunschID }).delete(); @@ -17258,8 +17258,8 @@ class AutomaticDispose { OpenNextRescueSprechwunsch() { let self = this; - return self.ADisDB.transaction('rw', [self.ADisDB.ADisSprechwunsch], async () => { - this.ADSettings().then((setting) => { + return await self.ADisDB.transaction('rw', [self.ADisDB.ADisSprechwunsch], async () => { + return await this.ADSettings().then((setting) => { if (setting['Sprechwunsch-Automatic'] == 'true') { return self.ADisDB.ADisSprechwunsch.where({ done: 'false' @@ -17267,9 +17267,9 @@ class AutomaticDispose { } }).then((Wunsch) => { if (Wunsch !== undefined) { - Wunsch.each((myWunsch) => { + Wunsch.each(async (myWunsch) => { let VehicleID = myWunsch.vehicleID; - self.UpdateRescueSprechwunschToDone(VehicleID).then(() => { + await 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); @@ -17294,7 +17294,7 @@ class AutomaticDispose { AddRescueSprechwunschToQueue(WunschID) { let self = this return self.ADisDB.transaction('rw', [self.ADisDB.ADisSprechwunsch], async () => { - return self.ADisDB.ADisSprechwunsch.put({ + return await self.ADisDB.ADisSprechwunsch.put({ vehicleID: WunschID, done: 'false' }) @@ -17307,7 +17307,7 @@ class AutomaticDispose { UpdateRescueSprechwunschToDone(WunschID) { let self = this return self.ADisDB.transaction('rw', [self.ADisDB.ADisSprechwunsch], async () => { - return self.ADisDB.ADisSprechwunsch.put({ + return await self.ADisDB.ADisSprechwunsch.put({ vehicleID: WunschID, done: 'true' }) @@ -17425,7 +17425,7 @@ class AutomaticDispose { CollectPoliceSprechwuensche() { let self = this; return self.ADisDB.transaction('rw', [self.ADisDB.ADisSprechwunschPolice], async () => { - new Promise(async (resolve, reject) => { + await new Promise(async (resolve, reject) => { await self.ADisDB.ADisSprechwunschPolice.where({ done: 'false' }).each((myWunsch) => { @@ -17437,14 +17437,14 @@ class AutomaticDispose { return resolve(); }).then(() => { var MOIODOS = $('div#mission_list div.missionSideBarEntry:visible'); - return MOIODOS.each((_, elem) => { + return MOIODOS.each(async (_, elem) => { if ($(elem).text().match(/Gefangene sollen abtransportiert werden/g)) { var MissionID = $(elem).attr("mission_id"); - self.AddPoliceSprechwunschToQueue(MissionID); + await self.AddPoliceSprechwunschToQueue(MissionID); } }); }).then(() => { - $("#building_list").find(".building_list_vehicle_element").each((_, elem) => { + $("#building_list").find(".building_list_vehicle_element").each(async (_, 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"); @@ -17454,7 +17454,7 @@ class AutomaticDispose { var _meap = String(map2.attr('href')); var MissionID = _meap.substr(_meap.lastIndexOf("/") + 1); if (MissionID) { - self.AddPoliceSprechwunschToQueue(MissionID); + await self.AddPoliceSprechwunschToQueue(MissionID); } } } @@ -17468,7 +17468,7 @@ class AutomaticDispose { OpenNextPoliceSprechwunsch() { let self = this; return self.ADisDB.transaction('rw', [self.ADisDB.ADisSprechwunschPolice], async () => { - return this.ADSettings().then((setting) => { + return await self.ADSettings().then((setting) => { if (setting['Sprechwunsch-Automatic'] == 'true') { return self.ADisDB.ADisSprechwunschPolice.where({ done: 'false' @@ -17476,16 +17476,16 @@ class AutomaticDispose { } }).then((Wunsch) => { if (Wunsch !== undefined) { - Wunsch.each((myWunsch) => { + Wunsch.each(async (myWunsch) => { let MissionID = myWunsch.missionID; - self.UpdatePoliceSprechwunschToDone(MissionID).then(() => { + await 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; - self.RemovePoliceSprechwunschFromQueue(MissionID).then((deleteCount) => { + await self.RemovePoliceSprechwunschFromQueue(MissionID).then((deleteCount) => { $("#adis-sprechwunsch-police-frame").attr("src", ""); $("#adis-sprechwunsch-police-frame").attr("mission_id", "empty"); }); @@ -17503,7 +17503,7 @@ class AutomaticDispose { AddPoliceSprechwunschToQueue(WunschID) { let self = this; return self.ADisDB.transaction('rw', [self.ADisDB.ADisSprechwunschPolice], async () => { - return this.ADisDB.ADisSprechwunschPolice.put({ + return await self.ADisDB.ADisSprechwunschPolice.put({ missionID: WunschID, done: 'false' }) @@ -17515,7 +17515,7 @@ class AutomaticDispose { UpdatePoliceSprechwunschToDone(WunschID) { let self = this; return self.ADisDB.transaction('rw', [self.ADisDB.ADisSprechwunschPolice], async () => { - return self.ADisDB.ADisSprechwunschPolice.put({ + return await self.ADisDB.ADisSprechwunschPolice.put({ missionID: WunschID, done: 'true' }) @@ -17685,7 +17685,7 @@ class AutomaticDispose { self.Jails.reverse(); if (self.Jails.length > 0) { - this.Send_Vehicle_To_Jail() + self.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")); diff --git a/src/autoloaderV2.js b/src/autoloaderV2.js index d5195a0..69cf798 100644 --- a/src/autoloaderV2.js +++ b/src/autoloaderV2.js @@ -196,7 +196,7 @@ class AutomaticDispose { RemovePoliceSprechwunschFromQueue(WunschID) { let self = this; return self.ADisDB.transaction('rw', [self.ADisDB.ADisSprechwunschPolice], async () => { - return this.ADisDB.ADisSprechwunschPolice.where({ + return await this.ADisDB.ADisSprechwunschPolice.where({ missionID: WunschID }).delete(); @@ -207,7 +207,7 @@ class AutomaticDispose { RemoveRescueSprechwunschFromQueue(WunschID) { let self = this; return self.ADisDB.transaction('rw', [self.ADisDB.ADisSprechwunsch], async () => { - return this.ADisDB.ADisSprechwunsch.where({ + return await this.ADisDB.ADisSprechwunsch.where({ vehicleID: WunschID }).delete(); @@ -251,8 +251,8 @@ class AutomaticDispose { OpenNextRescueSprechwunsch() { let self = this; - return self.ADisDB.transaction('rw', [self.ADisDB.ADisSprechwunsch], async () => { - this.ADSettings().then((setting) => { + return await self.ADisDB.transaction('rw', [self.ADisDB.ADisSprechwunsch], async () => { + return await this.ADSettings().then((setting) => { if (setting['Sprechwunsch-Automatic'] == 'true') { return self.ADisDB.ADisSprechwunsch.where({ done: 'false' @@ -260,9 +260,9 @@ class AutomaticDispose { } }).then((Wunsch) => { if (Wunsch !== undefined) { - Wunsch.each((myWunsch) => { + Wunsch.each(async (myWunsch) => { let VehicleID = myWunsch.vehicleID; - self.UpdateRescueSprechwunschToDone(VehicleID).then(() => { + await 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); @@ -287,7 +287,7 @@ class AutomaticDispose { AddRescueSprechwunschToQueue(WunschID) { let self = this return self.ADisDB.transaction('rw', [self.ADisDB.ADisSprechwunsch], async () => { - return self.ADisDB.ADisSprechwunsch.put({ + return await self.ADisDB.ADisSprechwunsch.put({ vehicleID: WunschID, done: 'false' }) @@ -300,7 +300,7 @@ class AutomaticDispose { UpdateRescueSprechwunschToDone(WunschID) { let self = this return self.ADisDB.transaction('rw', [self.ADisDB.ADisSprechwunsch], async () => { - return self.ADisDB.ADisSprechwunsch.put({ + return await self.ADisDB.ADisSprechwunsch.put({ vehicleID: WunschID, done: 'true' }) @@ -418,7 +418,7 @@ class AutomaticDispose { CollectPoliceSprechwuensche() { let self = this; return self.ADisDB.transaction('rw', [self.ADisDB.ADisSprechwunschPolice], async () => { - new Promise(async (resolve, reject) => { + await new Promise(async (resolve, reject) => { await self.ADisDB.ADisSprechwunschPolice.where({ done: 'false' }).each((myWunsch) => { @@ -430,14 +430,14 @@ class AutomaticDispose { return resolve(); }).then(() => { var MOIODOS = $('div#mission_list div.missionSideBarEntry:visible'); - return MOIODOS.each((_, elem) => { + return MOIODOS.each(async (_, elem) => { if ($(elem).text().match(/Gefangene sollen abtransportiert werden/g)) { var MissionID = $(elem).attr("mission_id"); - self.AddPoliceSprechwunschToQueue(MissionID); + await self.AddPoliceSprechwunschToQueue(MissionID); } }); }).then(() => { - $("#building_list").find(".building_list_vehicle_element").each((_, elem) => { + $("#building_list").find(".building_list_vehicle_element").each(async (_, 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"); @@ -447,7 +447,7 @@ class AutomaticDispose { var _meap = String(map2.attr('href')); var MissionID = _meap.substr(_meap.lastIndexOf("/") + 1); if (MissionID) { - self.AddPoliceSprechwunschToQueue(MissionID); + await self.AddPoliceSprechwunschToQueue(MissionID); } } } @@ -461,7 +461,7 @@ class AutomaticDispose { OpenNextPoliceSprechwunsch() { let self = this; return self.ADisDB.transaction('rw', [self.ADisDB.ADisSprechwunschPolice], async () => { - return this.ADSettings().then((setting) => { + return await self.ADSettings().then((setting) => { if (setting['Sprechwunsch-Automatic'] == 'true') { return self.ADisDB.ADisSprechwunschPolice.where({ done: 'false' @@ -469,16 +469,16 @@ class AutomaticDispose { } }).then((Wunsch) => { if (Wunsch !== undefined) { - Wunsch.each((myWunsch) => { + Wunsch.each(async (myWunsch) => { let MissionID = myWunsch.missionID; - self.UpdatePoliceSprechwunschToDone(MissionID).then(() => { + await 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; - self.RemovePoliceSprechwunschFromQueue(MissionID).then((deleteCount) => { + await self.RemovePoliceSprechwunschFromQueue(MissionID).then((deleteCount) => { $("#adis-sprechwunsch-police-frame").attr("src", ""); $("#adis-sprechwunsch-police-frame").attr("mission_id", "empty"); }); @@ -496,7 +496,7 @@ class AutomaticDispose { AddPoliceSprechwunschToQueue(WunschID) { let self = this; return self.ADisDB.transaction('rw', [self.ADisDB.ADisSprechwunschPolice], async () => { - return this.ADisDB.ADisSprechwunschPolice.put({ + return await self.ADisDB.ADisSprechwunschPolice.put({ missionID: WunschID, done: 'false' }) @@ -508,7 +508,7 @@ class AutomaticDispose { UpdatePoliceSprechwunschToDone(WunschID) { let self = this; return self.ADisDB.transaction('rw', [self.ADisDB.ADisSprechwunschPolice], async () => { - return self.ADisDB.ADisSprechwunschPolice.put({ + return await self.ADisDB.ADisSprechwunschPolice.put({ missionID: WunschID, done: 'true' }) @@ -678,7 +678,7 @@ class AutomaticDispose { self.Jails.reverse(); if (self.Jails.length > 0) { - this.Send_Vehicle_To_Jail() + self.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"));