diff --git a/dist/autoloader.js b/dist/autoloader.js index cbc43c6..511abe6 100755 --- a/dist/autoloader.js +++ b/dist/autoloader.js @@ -1,4 +1,4 @@ -/*Generated on:Wed Nov 28 2018 21:11:48 GMT+0100 (CET)*/ +/*Generated on:Wed Nov 28 2018 21:15:37 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 e67fca0..121db3f 100644 --- a/dist/autoloaderV2.js +++ b/dist/autoloaderV2.js @@ -1,4 +1,4 @@ -/*Generated on:Wed Nov 28 2018 21:11:48 GMT+0100 (CET)*/ +/*Generated on:Wed Nov 28 2018 21:15:37 GMT+0100 (CET)*/ /* * Dexie.js - a minimalistic wrapper for IndexedDB * =============================================== @@ -4749,6 +4749,8 @@ class AutomaticDispose { // Krankenhaus auswählen Collect_Hospitals() { + let that = this; + that.Hospitals = []; if ($("h4:contains('Eigene Krankenhäuser')").length > 0) { $("h4:contains('Eigene Krankenhäuser')").next("table").find("tbody").find("tr").each(function () { var HospitalHref = $(this).find("a:contains('Anfahren')").attr("href"); @@ -4763,7 +4765,7 @@ class AutomaticDispose { } if (HospitalFreeBeds > 0) { - Hospitals.push({ + that.Hospitals.push({ "id": HospitalID, "value": HospitalValue, "distance": HospitalDistance, @@ -4803,7 +4805,7 @@ class AutomaticDispose { } if (HospitalFreeBeds > 0 && HospitalSpecialDepartment) { - Hospitals.push({ + that.Hospitals.push({ "id": HospitalID, "value": HospitalValue, "taxes": HospitalTaxes, @@ -4814,18 +4816,18 @@ class AutomaticDispose { }); } - Hospitals.sort(function (a, b) { + that.Hospitals.sort(function (a, b) { return a.value - b.value; }); - Hospitals.reverse(); + that.Hospitals.reverse(); this.Send_Vehicle_To_Hospital() } // Krankenhaus einlieferung Send_Vehicle_To_Hospital() { //var HospitalID = Hospitals[0].id; - var HospitalHref = Hospitals[0].href; + var HospitalHref = this.Hospitals[0].href; // TODO: tellParent("ADisMissionDone(" + window.name + "," + MissionID + ");"); document.location.href = document.location.origin + HospitalHref; @@ -4936,6 +4938,8 @@ class AutomaticDispose { // Gefängnis auswählen Collect_Jails() { + let that = this; + that.Jails = []; var CountGefangene = Number(parseInt($('#h2_prisoners').text())); var parentNode = $('#mission_vehicle_at_mission tr > td:nth-child(5) > a:contains("Jomaar")').parent().parent(); var GefKw = parentNode.find('td:nth-child(2) > a[vehicle_type_id="52"]'); @@ -4991,7 +4995,7 @@ class AutomaticDispose { } if (JailFreeBeds >= 5) { - Jails.push({ + that.Jails.push({ "id": JailID, "value": JailValue + 1000, "text": JailText, @@ -4999,7 +5003,7 @@ class AutomaticDispose { "href": JailHref }); } else if (JailFreeBeds >= 1) { - Jails.push({ + that.Jails.push({ "id": JailID, "value": JailValue, "text": JailText, @@ -5055,7 +5059,7 @@ class AutomaticDispose { } if (JailFreeBeds >= CountGefangene) { - Jails.push({ + that.Jails.push({ "id": JailID, "value": JailValue + 1000, "text": JailText, @@ -5063,7 +5067,7 @@ class AutomaticDispose { "href": JailHref }); } else if (JailFreeBeds >= 1) { - Jails.push({ + that.Jails.push({ "id": JailID, "value": JailValue, "text": JailText, @@ -5073,11 +5077,11 @@ class AutomaticDispose { } }); - Jails.sort(function (a, b) { + that.Jails.sort(function (a, b) { return a.value - b.value; }); - Jails.reverse(); + that.Jails.reverse(); if (Jails.length > 0) { this.Send_Vehicle_To_Jail() } else { @@ -5114,7 +5118,7 @@ class AutomaticDispose { // Gefängnis einlieferung Send_Vehicle_To_Jail() { - var JailHref = Jails[0].href + var JailHref = that.Jails[0].href document.location.href = document.location.origin + JailHref; } diff --git a/src/autoloaderV2.js b/src/autoloaderV2.js index b9f169e..00d8db3 100644 --- a/src/autoloaderV2.js +++ b/src/autoloaderV2.js @@ -274,6 +274,8 @@ class AutomaticDispose { // Krankenhaus auswählen Collect_Hospitals() { + let that = this; + that.Hospitals = []; if ($("h4:contains('Eigene Krankenhäuser')").length > 0) { $("h4:contains('Eigene Krankenhäuser')").next("table").find("tbody").find("tr").each(function () { var HospitalHref = $(this).find("a:contains('Anfahren')").attr("href"); @@ -288,7 +290,7 @@ class AutomaticDispose { } if (HospitalFreeBeds > 0) { - Hospitals.push({ + that.Hospitals.push({ "id": HospitalID, "value": HospitalValue, "distance": HospitalDistance, @@ -328,7 +330,7 @@ class AutomaticDispose { } if (HospitalFreeBeds > 0 && HospitalSpecialDepartment) { - Hospitals.push({ + that.Hospitals.push({ "id": HospitalID, "value": HospitalValue, "taxes": HospitalTaxes, @@ -339,18 +341,18 @@ class AutomaticDispose { }); } - Hospitals.sort(function (a, b) { + that.Hospitals.sort(function (a, b) { return a.value - b.value; }); - Hospitals.reverse(); + that.Hospitals.reverse(); this.Send_Vehicle_To_Hospital() } // Krankenhaus einlieferung Send_Vehicle_To_Hospital() { //var HospitalID = Hospitals[0].id; - var HospitalHref = Hospitals[0].href; + var HospitalHref = this.Hospitals[0].href; // TODO: tellParent("ADisMissionDone(" + window.name + "," + MissionID + ");"); document.location.href = document.location.origin + HospitalHref; @@ -461,6 +463,8 @@ class AutomaticDispose { // Gefängnis auswählen Collect_Jails() { + let that = this; + that.Jails = []; var CountGefangene = Number(parseInt($('#h2_prisoners').text())); var parentNode = $('#mission_vehicle_at_mission tr > td:nth-child(5) > a:contains("Jomaar")').parent().parent(); var GefKw = parentNode.find('td:nth-child(2) > a[vehicle_type_id="52"]'); @@ -516,7 +520,7 @@ class AutomaticDispose { } if (JailFreeBeds >= 5) { - Jails.push({ + that.Jails.push({ "id": JailID, "value": JailValue + 1000, "text": JailText, @@ -524,7 +528,7 @@ class AutomaticDispose { "href": JailHref }); } else if (JailFreeBeds >= 1) { - Jails.push({ + that.Jails.push({ "id": JailID, "value": JailValue, "text": JailText, @@ -580,7 +584,7 @@ class AutomaticDispose { } if (JailFreeBeds >= CountGefangene) { - Jails.push({ + that.Jails.push({ "id": JailID, "value": JailValue + 1000, "text": JailText, @@ -588,7 +592,7 @@ class AutomaticDispose { "href": JailHref }); } else if (JailFreeBeds >= 1) { - Jails.push({ + that.Jails.push({ "id": JailID, "value": JailValue, "text": JailText, @@ -598,11 +602,11 @@ class AutomaticDispose { } }); - Jails.sort(function (a, b) { + that.Jails.sort(function (a, b) { return a.value - b.value; }); - Jails.reverse(); + that.Jails.reverse(); if (Jails.length > 0) { this.Send_Vehicle_To_Jail() } else { @@ -639,7 +643,7 @@ class AutomaticDispose { // Gefängnis einlieferung Send_Vehicle_To_Jail() { - var JailHref = Jails[0].href + var JailHref = that.Jails[0].href document.location.href = document.location.origin + JailHref; }