49 Commits

Author SHA1 Message Date
Jomaar 1f03ad6cc3 v2 trans 2018-12-19 18:06:36 +01:00
Jomaar 88b26a7f91 v2 transact 2018-12-19 17:49:39 +01:00
Jomaar d52137df95 v2 transaction 2018-12-19 17:48:10 +01:00
Jomaar 7852149694 v2 transact 2018-12-19 17:42:57 +01:00
Jomaar 3bce16eff7 v2 transact 2018-12-19 17:40:16 +01:00
Jomaar 1817977520 v2 transact 2018-12-19 17:34:08 +01:00
Jomaar e48b0a7bdd v2 transact 2018-12-19 17:28:31 +01:00
Jomaar efd95eacab v2 transaction 2018-12-19 17:27:30 +01:00
Jomaar fdffe19a11 v2 up transact 2018-12-19 17:18:58 +01:00
Jomaar cb049224dd v2 trans 2018-12-19 17:16:34 +01:00
Jomaar b33313eed9 v2 fix transact 2018-12-19 17:12:10 +01:00
Jomaar b4fb131c9b v2 fix transact 2018-12-19 17:09:30 +01:00
Jomaar 98002ae853 v2 transactions 2018-12-19 17:06:30 +01:00
Jomaar 31f147ee6d v2 transactions 2018-12-19 17:03:17 +01:00
Jomaar 18acbc9a01 v2 transaction 2018-12-19 16:49:47 +01:00
Jomaar 0a1fb871ed v2 up af9ia transaction 2018-12-19 16:46:20 +01:00
Jomaar 78b72223f8 v2 transaction 2018-12-19 16:40:49 +01:00
Jomaar b7067520bc transact 2018-12-19 16:38:19 +01:00
Jomaar f142e57e18 transactions 2018-12-19 16:35:01 +01:00
Jomaar 4ae5c26754 transactions 2018-12-19 16:32:46 +01:00
Jomaar 01acb126a4 transactions 2018-12-19 16:28:51 +01:00
Jomaar 4b691b54c8 ijox 2018-12-19 16:24:02 +01:00
Jomaar 9ca42c9210 v2 uaüpf9u 2018-12-19 16:18:58 +01:00
Jomaar 25397f17eb v2 up aigu09agfpo 2018-12-19 16:17:21 +01:00
Jomaar 4e591be16b v2 up aof8auoj 2018-12-19 16:13:49 +01:00
Jomaar 16838dae86 v2 uagf98oi 2018-12-19 16:12:05 +01:00
Jomaar 72d3566254 v2 uaof0 2018-12-19 16:08:19 +01:00
Jomaar c137f47e4a v2 uahg9 2018-12-19 16:05:37 +01:00
Jomaar 579facabbc v2 upa09 2018-12-19 16:02:18 +01:00
Jomaar 5c619f622c xx 2018-12-19 15:57:00 +01:00
Jomaar a6e68ebb82 v2 update 2018-12-19 15:53:49 +01:00
Jomaar f95f4a6483 xxx 2018-12-18 02:47:49 +01:00
Jomaar 6bbb9cc5cb xx 2018-12-18 02:35:47 +01:00
Jomaar b6532cbf27 x 2018-12-18 02:34:19 +01:00
Jomaar a3f604579d v2 update check why missions not send 2018-12-18 01:35:33 +01:00
Jomaar a1b3e1a310 v2 planned events remove due to not finished work 2018-12-18 00:44:24 +01:00
Jomaar e4ccac9966 v2 autoremove finisched alerts 2018-12-18 00:38:26 +01:00
Jomaar 31116a7cae v2 update debugger 2018-12-18 00:29:41 +01:00
Jomaar 6f3c8361a1 v2 up check why missions new added not triggered 2018-12-18 00:25:57 +01:00
Jomaar e2324e640e v2 update planned events 2018-12-18 00:03:26 +01:00
Jomaar 645dc73d5a v2 update v1111 2018-12-17 23:55:27 +01:00
Jomaar eb8982e17b v2 up date mission adding 2018-12-17 23:41:01 +01:00
Jomaar 832c067f14 v2 update - plannedevents 2018-12-17 23:31:50 +01:00
Jomaar a09497e7d5 v2 update mission update.. 2018-12-17 23:28:04 +01:00
Jomaar 1cfda9fbf8 v2 update bla bla 2018-12-17 23:18:23 +01:00
Jomaar aaa439a134 v2 up a9gfua09gu93oihgiu 2018-12-17 23:07:05 +01:00
Jomaar a4659dc6fe v2 up auoago 2018-12-17 21:56:49 +01:00
Jomaar 4d4cb85484 v2 up af90u9 2018-12-17 21:20:08 +01:00
Jomaar eeccee2184 v2 up 2018-12-17 21:14:23 +01:00
20 changed files with 1683 additions and 2782 deletions
+67 -486
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
File diff suppressed because one or more lines are too long
+68 -487
View File
File diff suppressed because it is too large Load Diff
+656 -1005
View File
File diff suppressed because it is too large Load Diff
+3 -11
View File
@@ -131,11 +131,11 @@ function emsDepartment($data)
}
if ($key == "Benötigte GW-San") {
$pd["use_SEG_FULL"] = true;
} elseif ($key == "Benötigte RTW" || $key == "Wahrscheinlichkeit, dass ein Patient transportiert werden muss") {
} elseif ($key == "Benötigte RTW" || ($key == "Wahrscheinlichkeit, dass ein Patient transportiert werden muss" && $value > 40)) {
$pd["use_RTW"] = true;
} elseif ($key == "NEF Anforderungswahrscheinlichkeit") {
} elseif ($key == "NEF Anforderungswahrscheinlichkeit" && $value > 40) {
$pd["use_NEF"] = true;
} elseif ($key == "RTH Anforderungswahrscheinlichkeit") {
} elseif ($key == "RTH Anforderungswahrscheinlichkeit" && $value > 30) {
$pd["use_RTH"] = true;
}
}
@@ -295,14 +295,6 @@ foreach (glob("*.json") as $filename) {
$mission['id'] = $mission_id;
$mission['type'] = $mission_id;
$mission['name'] = $data['Name'];
//$mission['share'] = isset($data['Tritt nur ab dem Datum auf']) ? true : false;
$mission['share'] = false;
if (isset($data['Credits im Durchschnitt']) && intval($data['Credits im Durchschnitt']) >= 7000 && $mission['share'] == false) {
$mission['share'] = true;
}
$fd = fireDepartment($data);
if (array_sum($fd) > 0) {
$mission['fire_department'] = $fd;
+1 -1
View File
@@ -1,6 +1,6 @@
#!/bin/bash
for i in $(seq 421 423); do
for i in $(seq 420 424); do
curl -s -o "./missions/$i.html" "https://www.leitstellenspiel.de/einsaetze/$i"
html2text -utf8 -style pretty -width 100 -o "./missions/$i.text" "./missions/$i.html"
lynx --dump "./missions/$i.html" > "./missions/$i.txt"
+2 -2
View File
@@ -10,9 +10,9 @@
<title>LEITSTELLENSPIEL.DE - baue deine eigene Leitstelle, in deiner Stadt!</title>
<meta content="authenticity_token" name="csrf-param" />
<meta content="kX8RZLCcfKMXHlpuSdVA2uWEC3a0nLeBv2TPQyUDg/A=" name="csrf-token" />
<meta content="CptcsOLVZDZ8aMSG8FWeOHL84iwqScWrX26fREfMTtI=" name="csrf-token" />
<script src="/assets/application-6dae189568c355807e28f829cc25cb33.js" type="text/javascript"></script>
<script src="/assets/application-a789289a71061d030b76a864e1d16075.js" type="text/javascript"></script>
<!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
<!--[if lt IE 9]>
+1 -1
View File
@@ -10,7 +10,7 @@
<title>LEITSTELLENSPIEL.DE - baue deine eigene Leitstelle, in deiner Stadt!</title>
<meta content="authenticity_token" name="csrf-param" />
<meta content="TjGsiG+tPyL8SPR51dhx6sasfS4wF1Rh9n4qtzZ+rMw=" name="csrf-token" />
<meta content="sW5qrZx5GA4BBZD98qyG7pPTzGq1WjeNCnIDfiSzzK4=" name="csrf-token" />
<script src="/assets/application-a789289a71061d030b76a864e1d16075.js" type="text/javascript"></script>
+1 -1
View File
@@ -10,7 +10,7 @@
<title>LEITSTELLENSPIEL.DE - baue deine eigene Leitstelle, in deiner Stadt!</title>
<meta content="authenticity_token" name="csrf-param" />
<meta content="hJglNqkHsn0i29Jl1jR6BKjpRCfjK8cVTvRYHW9X3mQ=" name="csrf-token" />
<meta content="BNB0VEetMlMDcjHizS6YvWvA7A6QyjqezPsrd/hf17Y=" name="csrf-token" />
<script src="/assets/application-a789289a71061d030b76a864e1d16075.js" type="text/javascript"></script>
+1 -1
View File
@@ -10,7 +10,7 @@
<title>LEITSTELLENSPIEL.DE - baue deine eigene Leitstelle, in deiner Stadt!</title>
<meta content="authenticity_token" name="csrf-param" />
<meta content="A7oqOPApiZ55rSDeWfOI6Tk/D0I8Dd/wMWOGGAJr+xw=" name="csrf-token" />
<meta content="E/Anxv+qaHmWs1MWTFdBAsP34DrrQnvotX6q4tyZVIQ=" name="csrf-token" />
<script src="/assets/application-a789289a71061d030b76a864e1d16075.js" type="text/javascript"></script>
+25
View File
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<html>
<head>
<title>We're sorry, but something went wrong (500)</title>
<style type="text/css">
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
div.dialog {
width: 25em;
padding: 0 4em;
margin: 4em auto 0 auto;
border: 1px solid #ccc;
border-right-color: #999;
border-bottom-color: #999;
}
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
</style>
</head>
<body>
<!-- This file lives in public/500.html -->
<div id="500_hype_container" style="margin:auto;position:relative;width:600px;height:200px;overflow:hidden;">
<script type="text/javascript" charset="utf-8" src="/500.hyperesources/500_hype_generated_script.js?47359"></script>
</div>
</body>
</html>
+1
View File
@@ -0,0 +1 @@
{"Name":null}
View File
+1
View File
@@ -0,0 +1 @@
+2 -1
View File
@@ -1382,7 +1382,8 @@ alertFhz(elw2, 1, 'ELW2', false);
alertFhz(dl, 1, 'DL', false);
RTW();
//alertFhz(rtw, 20, 'RTW', false);
} else if ([43].indexOf(help) != -1 && !(isVerband)) {
} else if ([424].indexOf(help) != -1 && !(isVerband)) {
} else if ([43].indexOf(help) != -1 && !(isVerband)) {
alertFhz(ruest, 5, 'RÜST', false);
alertFhz(oel, 2, 'GW-ÖL', false);
alertFhz(lf, 10, 'LF', false);
+588 -518
View File
File diff suppressed because it is too large Load Diff
+239
View File
@@ -0,0 +1,239 @@
CollectPatients() {
const self = this;
let PatientCounter = 0;
$(".mission_patient").each(function (_, elem) {
var PatientName = $(elem).text();
var PatientNeedRTW = false;
var PatientNeedNEF = false;
var PatientNeedRTH = false;
var PatientNeedLNA = false;
var PatientNeedOrgL = false;
var PatientNeedSEGKTWB = false;
var PatientNeedTragehilfe = false;
// Wir benötigen einen RTW oder KTW Typ B.
if ($(elem).find(".alert-danger").length > 0 && $(elem).find(".alert-danger").text().indexOf("Wir benötigen einen RTW oder KTW Typ B") != -1) {
PatientNeedSEGKTWB = true;
}
// Wir benötigen einen RTW.
if ($(elem).find(".alert-danger").length > 0 && $(elem).find(".alert-danger").text().indexOf("Wir benötigen ein RTW") != -1) {
PatientNeedRTW = true;
}
// Wir benötigen einen NEF.
if ($(elem).find(".alert-danger").length > 0 && $(elem).find(".alert-danger").text().indexOf("Wir benötigen ein NEF") != -1) {
PatientNeedNEF = true;
}
// Wir benötigen einen RTH.
if ($(elem).find(".alert-danger").length > 0 && $(elem).find(".alert-danger").text().indexOf("Wir benötigen ein RTH") != -1) {
PatientNeedRTH = true;
}
// Wir benötigen einen LNA.
if ($(elem).find(".alert-danger").length > 0 && $(elem).find(".alert-danger").text().indexOf("Wir benötigen einen LNA") != -1) {
PatientNeedLNA = true;
}
// Wir benötigen einen OrgL.
if ($(elem).find(".alert-danger").length > 0 && $(elem).find(".alert-danger").text().indexOf("Wir benötigen einen OrgL") != -1) {
PatientNeedOrgL = true;
}
// Wir benötigen eine Tragehilfe (z.B. durch ein LF).
if ($(elem).find(".alert-danger").length > 0 && $(elem).find(".alert-danger").text().indexOf("Wir benötigen eine Tragehilfe") != -1) {
PatientNeedTragehilfe = true;
}
self.Patients[PatientCounter] = {
"name": PatientName,
"need_RTW": PatientNeedRTW,
"need_NEF": PatientNeedNEF,
"need_RTH": PatientNeedRTH,
"need_LNA": PatientNeedLNA,
"need_OrgL": PatientNeedOrgL,
"need_SEG_KTWB": PatientNeedSEGKTWB,
"need_Tragehilfe": PatientNeedTragehilfe
}
PatientCounter++;
});
return self.Patients;
}
// - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
// -
// - Process Emergency_Medical_Service
// -
// - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
ProcessEmergencyMedicalService() {
const self = this;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// -
// - Emergency Medical Service: Vehicles
// -
// - 38: KTW
// - 28: RTW
// - 29: NEF
// - 74: NAW
// - 73: GRTW
// - 31: RTH
// - 55: LNA
// - 56: OrgL
// -
// - 58: (SEG) KTW Typ B
// - 59: (SEG) ELW 1
// - 60: (SEG) GW-San
// -
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if (typeof self.MissionConfig.emergency_medical_service == "object") // Wenn der EMS-Block in der Config definiert ist
{
if (Object.keys(self.Patients).length >= 5) { // need LNA
self._ADisVehiclesNeed["55"] = 1;
}
if (Object.keys(self.Patients).length >= 10) { // need OrgL
self._ADisVehiclesNeed["56"] = 1;
}
if (Object.keys(self.Patients).length == 0) {
if (self.MissionConfig.emergency_medical_service.use_RTW == true) {
self._ADisVehiclesNeed["28"]++;
}
if (self.MissionConfig.emergency_medical_service.use_NEF == true) {
self._ADisVehiclesNeed["29"]++;
}
if (self.MissionConfig.emergency_medical_service.use_RTH == true) {
self._ADisVehiclesNeed["31"]++;
}
} else {
for (var Key in self.Patients) {
var Patient = self.Patients[Key];
if (self.MissionConfig.emergency_medical_service.use_KTW == true) {
if (!Patient.need_RTW && !Patient.need_NEF && !Patient.need_RTH) {
self._ADisVehiclesNeed["38"]++;
}
}
if (Patient.need_LNA && self._ADisVehiclesNeed["55"] < 1) {
self._ADisVehiclesNeed["55"]++;
}
if (Patient.need_OrgL && self._ADisVehiclesNeed["56"] < 1) {
self._ADisVehiclesNeed["56"]++;
}
if (Patient.need_Tragehilfe == true) {
self._ADisVehiclesNeed["0"]++;
}
if (self.MissionConfig.emergency_medical_service.use_RTW == true || Patient.need_RTW == true) {
self._ADisVehiclesNeed["28"]++;
}
if (self.MissionConfig.emergency_medical_service.use_NEF == true || Patient.need_NEF == true) {
self._ADisVehiclesNeed["29"]++;
}
if (self.MissionConfig.emergency_medical_service.use_RTH == true || Patient.need_RTH == true) {
self._ADisVehiclesNeed["31"]++;
}
};
}
// TODO: need to be refactored to make sure first KTW Typ B before RTW.
if (self.MissionConfig.emergency_medical_service.use_SEG_ELW1_Only == "true") {
self._ADisVehiclesNeed["59"]++;
} else if (self.MissionConfig.emergency_medical_service.use_SEG_FULL == "true" || Object.keys(self.Patients).length >= 3) {
self._ADisVehiclesNeed["58"]++;
self._ADisVehiclesNeed["58"]++; // 3x KTW Type B
self._ADisVehiclesNeed["58"]++;
self._ADisVehiclesNeed["59"]++;
self._ADisVehiclesNeed["60"]++;
}
var VehicleTable;
if ($("#vehicle_show_table_body_all").length > 0) {
VehicleTable = $("#vehicle_show_table_body_all");
} else {
VehicleTable = $("#vehicle_show_table_body_rett");
}
VehicleTable.find(".vehicle_select_table_tr").each(function (_, elem) {
var VehicleID = $(elem).attr("id").replace("vehicle_element_content_", "");
// var VehicleDistanceTime = $("#vehicle_sort_" + VehicleID).attr("sortvalue");
var VehicleType = $(elem).attr("vehicle_type");
if ($("#vehicle_checkbox_" + VehicleID + ":enabled").length === 0) {
return;
}
if (VehicleType == "KTW" && self._ADisVehiclesNeed["38"] > 0) {
// console.log(" Automatic Dispose: Fahrzeug " + VehicleID + " " + VehicleType + " markiert");
$("#vehicle_checkbox_" + VehicleID).click();
self._ADisVehiclesNeed["38"]--;
} else if ((VehicleType == "LF 20" || VehicleType == "LF 10" ||
VehicleType == "LF 8/6" || VehicleType == "LF 20/16" ||
VehicleType == "LF 10/6" || VehicleType == "LF 16-TS" ||
VehicleType == "HLF 20" || VehicleType == "TSF-W" ||
VehicleType == "TLF 2000" || VehicleType == "TLF 3000" ||
VehicleType == "TLF 8/8" || VehicleType == "TLF 8/18" ||
VehicleType == "TLF 16/24-Tr" || VehicleType == "TLF 16/25" ||
VehicleType == "TLF 16/45" || VehicleType == "TLF 20/40" ||
VehicleType == "TLF 20/40-SL" || VehicleType == "TLF 16") &&
self._ADisVehiclesNeed["0"] + self._ADisVehiclesNeed["1"] + self._ADisVehiclesNeed["6"] + self._ADisVehiclesNeed["7"] +
self._ADisVehiclesNeed["8"] + self._ADisVehiclesNeed["9"] + self._ADisVehiclesNeed["30"] + self._ADisVehiclesNeed["37"] +
self._ADisVehiclesNeed["17"] + self._ADisVehiclesNeed["18"] + self._ADisVehiclesNeed["19"] + self._ADisVehiclesNeed["20"] +
self._ADisVehiclesNeed["21"] + self._ADisVehiclesNeed["22"] + self._ADisVehiclesNeed["23"] + self._ADisVehiclesNeed["24"] +
self._ADisVehiclesNeed["25"] + self._ADisVehiclesNeed["26"] > 0) { // LF acts as 'Tragehilfe'
$("#vehicle_checkbox_" + VehicleID).click();
self._ADisVehiclesNeed["0"]--;
} else if (VehicleType == "NAW" && self._ADisVehiclesNeed["28"] > 0 && self._ADisVehiclesNeed["29"] > 0) {
$("#vehicle_checkbox_" + VehicleID).click();
self._ADisVehiclesNeed["74"]--;
self._ADisVehiclesNeed["28"]--;
self._ADisVehiclesNeed["29"]--;
} else if (VehicleType == "GRTW" && self._ADisVehiclesNeed["73"] > 0) {
$("#vehicle_checkbox_" + VehicleID).click();
self._ADisVehiclesNeed["73"]--;
} else if (VehicleType == "RTW" && self._ADisVehiclesNeed["28"] > 0) {
$("#vehicle_checkbox_" + VehicleID).click();
self._ADisVehiclesNeed["28"]--;
} else if (VehicleType == "NEF" && self._ADisVehiclesNeed["29"] > 0) {
$("#vehicle_checkbox_" + VehicleID).click();
self._ADisVehiclesNeed["29"]--;
} else if (VehicleType == "RTH" && self._ADisVehiclesNeed["31"] > 0) {
$("#vehicle_checkbox_" + VehicleID).click();
self._ADisVehiclesNeed["31"]--;
} else if (VehicleType == "KdoW-LNA" && self._ADisVehiclesNeed["55"] > 0) {
$("#vehicle_checkbox_" + VehicleID).click();
self._ADisVehiclesNeed["55"]--;
} else if (VehicleType == "KdoW-OrgL" && self._ADisVehiclesNeed["56"] > 0) {
$("#vehicle_checkbox_" + VehicleID).click();
self._ADisVehiclesNeed["56"]--;
} else if (VehicleType == "KTW Typ B" && self._ADisVehiclesNeed["58"] > 0) {
$("#vehicle_checkbox_" + VehicleID).click();
self._ADisVehiclesNeed["58"]--;
self._ADisVehiclesNeed["28"]--; // no need for RTW if KTW Type B is called
} else if (VehicleType == "ELW 1 (SEG)" && self._ADisVehiclesNeed["59"] > 0) {
$("#vehicle_checkbox_" + VehicleID).click();
self._ADisVehiclesNeed["59"]--;
} else if (VehicleType == "GW-San" && self._ADisVehiclesNeed["60"] > 0) {
$("#vehicle_checkbox_" + VehicleID).click();
self._ADisVehiclesNeed["60"]--;
self._ADisVehiclesNeed["29"]--; // no need for NEF if GW-SAN is called
}
});
return true;
}
return false;
}
+26
View File
@@ -0,0 +1,26 @@
const AutomaticDispose = function () {
let self = this;
self.MaxVehicleID = 86
self.MissionType = null
self.MissionID = null
self.MyRunner = null
self.MyRunnerSettings = null
self.OweSecure = false
self._ADisVehiclesNeed = {}
self.MissionConfig = {}
self.Vehicles = {}
self.Patients = {}
self.ADis_MyHead = document.getElementsByTagName('head')[0];
self.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;
};
-19
View File
@@ -1,19 +0,0 @@
(() => {
let msis = (async () => {
return await AutomaticDisposeCall.ADisDB.ADisMissions.where({
runner: 'om',
available: 'true',
done: 'false'
}).and(function (item) {
return item.next_check <= Math.floor(new Date().getTime() / 1000)
}).toArray()
})();
msis.then((result) => {
result.sort((a, b) => {
return a.next_check > b.next_check;
});
return result;
}).then((sortedResult) => {
console.table(sortedResult);
});
})();
-248
View File
@@ -1,248 +0,0 @@
// ==UserScript==
// @name Mission Watcher
// @version 1.0.0
// @run-at document-end
// @require https://cdnjs.cloudflare.com/ajax/libs/dexie/2.0.4/dexie.min.js
// ==/UserScript==
class WatchMissions {
constructor() {
let self = this;
self.DB = new Dexie('LSS_WatchMissions');
self.DB.version(1).stores({
/**
* Missions to Watch
* - missionID - Mission ID that should be watched.
* - limit - If the Mission turns green more than 6 times, no more requests will be sent.
* - data - {name, datetime, onsite{ username:{ cars: [ {name, type} ] } } }
*/
Missions: "++missionID"
});
self.DB.open().catch((err) => {
console.error(err.stack || err);
});
self.DB.on("ready", async () => {
// index page
if (window.location.pathname === "/" || window.location.pathname === "/#" || window.location.pathname === "/#_=_") {
self.RegisterIndexPage();
}
// mission page
else if (window.location.pathname.indexOf("/missions/") !== -1 && window.name == 'watchMission') {
self.RegisterMissionPage();
}
})
}
get RandomTime() {
const max = 6;
const min = 1;
return Math.floor((Math.random() * (max - min + 1) + min) * 1000);
}
RegisterIndexPage() {
let self = this;
// -
// - Google Font
// -
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);
// -
// - FontAwesome 5
// -
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);
// -
// - Navbar Dashboard
// -
var styleElement = document.createElement("link");
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);
// Create Dashboard
$('#news_li').before('<li id="adis-nav-item"></li>');
$('#adis-nav-item').html(`/***ADis_Navbar***/0`)
$("#adis-dashboard").css({
display: "none",
opacity: "0"
});
}
// Generate HTML Table
// Builds the HTML Table out of myList json data from Ivy restful service.
buildHtmlTable() {
const self = this;
self.addTable(myList, $("#excelDataTable"));
}
addTable(list, appendObj) {
const self = this;
appendObj.html('');
var columns = self.addAllColumnHeaders(list, appendObj);
for (var i = 0; i < list.length; i++) {
var row$ = $('<tr/>');
for (var colIndex = 0; colIndex < columns.length; colIndex++) {
var cellValue = list[i][columns[colIndex]];
if (cellValue == null) {
cellValue = "";
}
if (cellValue.constructor === Array) {
$a = $('<td/>');
row$.append($a);
self.addTable(cellValue, $a);
} else if (cellValue.constructor === Object) {
var array = $.map(cellValue, function (value, index) {
return [value];
});
$a = $('<td/>');
row$.append($a);
self.addObject(array, $a);
} else {
row$.append($('<td/>').html(cellValue));
}
}
appendObj.append(row$);
}
}
addObject(list, appendObj) {
const self = this;
for (var i = 0; i < list.length; i++) {
var row$ = $('<tr/>');
var cellValue = list[i];
if (cellValue == null) {
cellValue = "";
}
if (cellValue.constructor === Array) {
$a = $('<td/>');
row$.append($a);
self.addTable(cellValue, $a);
} else if (cellValue.constructor === Object) {
var array = $.map(cellValue, function (value, index) {
return [value];
});
$a = $('<td/>');
row$.append($a);
self.addObject(array, $a);
} else {
row$.append($('<td/>').html(cellValue));
}
appendObj.append(row$);
}
}
// Adds a header row to the table and returns the set of columns.
// Need to do union of keys from all records as some records may not contain
// all records
addAllColumnHeaders(list, appendObj) {
var columnSet = [];
var headerTr$ = $('<tr/>');
for (var i = 0; i < list.length; i++) {
var rowHash = list[i];
for (var key in rowHash) {
if ($.inArray(key, columnSet) == -1) {
columnSet.push(key);
headerTr$.append($('<th/>').html(key));
}
}
}
appendObj.append(headerTr$);
return columnSet;
}
// Mission Page
RegisterMissionPage() {
let MissionType = null;
let MissionID = document.location.pathname.substr(document.location.pathname.lastIndexOf("/") + 1);
let help_el = $('a#mission_help');
if (help_el.length > 0) {
MissionType = help_el[0].href.split("?")[0];
var re = /\d+$/i;
var found = MissionType.match(re);
MissionType = Number(found[0]);
}
var myRows = [];
var $headers = $("table#mission_vehicle_driving th");
var $rows = $("table#mission_vehicle_driving tbody tr").each(function (index) {
$cells = $(this).find("td");
myRows[index] = {};
$cells.each(function (cellIndex) {
let mcoai = '';
if (cellIndex == 1) {
mcoai = ($($(this).find("a")[0]).text().trim() + ' ' + $($(this).find("small")[0]).text().trim()).replace(/(\r\n\t|\n|\r\t|\s{2,})/gm, "");
} else {
mcoai = ($(this).text().trim()).replace(/(\r\n\t|\n|\r\t|\s{2,})/gm, "");
}
console.log(cellIndex, mcoai, $($headers[cellIndex]).text().trim());
if ($($headers[cellIndex]).text().trim() != '') {
myRows[index][$($headers[cellIndex]).text().trim()] = mcoai
}
});
});
// Let's put this in the object like you want and convert to JSON (Note: jQuery will also do this for you on the Ajax request)
var myObj = {};
myObj.Anfahrt = myRows.filter(value => Object.keys(value).length !== 0);
myRows = [];
$headers = $("table#mission_vehicle_at_mission th");
$rows = $("table#mission_vehicle_at_mission tbody tr").each(function (index) {
$cells = $(this).find("td");
myRows[index] = {};
$cells.each(function (cellIndex) {
let mcoai = '';
if (cellIndex == 1) {
mcoai = ($($(this).find("a")[0]).text().trim() + ' ' + $($(this).find("small")[0]).text().trim()).replace(/(\r\n\t|\n|\r\t|\s{2,})/gm, "");
} else {
mcoai = ($(this).text().trim()).replace(/(\r\n\t|\n|\r\t|\s{2,})/gm, "");
}
console.log(cellIndex, mcoai, $($headers[cellIndex]).text().trim());
if ($($headers[cellIndex]).text().trim() != '') {
myRows[index][$($headers[cellIndex]).text().trim()] = mcoai
}
});
});
// Let's put this in the object like you want and convert to JSON (Note: jQuery will also do this for you on the Ajax request)
myObj.VorOrt = myRows.filter(value => Object.keys(value).length !== 0);
console.log(myObj);
}
}
(() => {
'use strict';
new WatchMissions();
})()