Fixes für geändertes Format vom DB-Abfrageergebnis

This commit is contained in:
fkuepper
2016-12-15 15:57:37 +01:00
parent 473fe88bc1
commit 9d65404922
2 changed files with 19 additions and 34 deletions
+2 -26
View File
@@ -64,11 +64,6 @@ static void prv_create_default_settings() {
settings.default_products.ast = true;
int i = -1;
i++;
strcpy(settings.stations[i].ibnr, "8006596");
strcpy(settings.stations[i].title, "Wpt. Barmen");
settings.stations[i].is_enabled = true;
settings.stations[i].use_default_products = true;
i++;
strcpy(settings.stations[i].ibnr, "8003368");
@@ -137,30 +132,11 @@ static void prv_create_default_settings() {
settings.connections[i].allowed_products.ubahn = true;
settings.connections[i].allowed_products.tram = true;
settings.connections[i].allowed_products.ast = true;
i++;
strcpy(settings.connections[i].start_ibnr, "8000266");
strcpy(settings.connections[i].dest_ibnr, "8006596");
strcpy(settings.connections[i].title, "Wpt. Hbf");
strcpy(settings.connections[i].subtitle, "->Wpt. Barmen");
settings.connections[i].is_enabled = true;
settings.connections[i].use_default_products = false;
settings.connections[i].allowed_products.allow_all = false;
settings.connections[i].allowed_products.ice = false;
settings.connections[i].allowed_products.ic = false;
settings.connections[i].allowed_products.ir = false;
settings.connections[i].allowed_products.zug = true;
settings.connections[i].allowed_products.sbahn = true;
settings.connections[i].allowed_products.bus = true;
settings.connections[i].allowed_products.schiff = true;
settings.connections[i].allowed_products.ubahn = true;
settings.connections[i].allowed_products.tram = true;
settings.connections[i].allowed_products.ast = true;
i++;
strcpy(settings.connections[i].start_ibnr, "8006596");
strcpy(settings.connections[i].start_ibnr, "8000266");
strcpy(settings.connections[i].dest_ibnr, "8003368");
strcpy(settings.connections[i].title, "Wpt. Barmen");
strcpy(settings.connections[i].title, "Wpt. Hbf");
strcpy(settings.connections[i].subtitle, "->Köln Messe/Deutz");
settings.connections[i].is_enabled = true;
settings.connections[i].use_default_products = false;
+17 -8
View File
@@ -5,7 +5,13 @@ function xhrRequest(url, type, callback) {
var async = callback ? true : false;
if (async) {
xhr.onreadystatechange = function () {
if (!this.readyState) {
return;
}
if (this.readyState === 4) {
if (!this.status) {
callback(null);
}
if (this.status >= 200 && this.status < 300) {
callback(this.responseText);
} else {
@@ -38,12 +44,12 @@ function extractConnectionResultInfos(text) {
}
var detailLinkExp = /a href="([^"]*)"/;
var zeitExp = /span class="bold">(\d*:\d*)</g;
var vmExp = /<td class="overview iphonepfeil">([^<]*)</;
var umstiegeUndDauerExp = /<td class="overview">(\d*) *<br *.>(\d*:\d*)/;
var delaysExp = /<td class="overview tprt"> *<span[^>]*>(.\d*)<.*<span[^>]*>(.\d*)</;
var nurStartDelayExp = /<td class="overview tprt"> *<span[^>]*>(.\d*)</;
var nurZielDelayExp = /<td class="overview tprt"> *&nbsp.*<span[^>]*>(.\d*)</;
var zeitExp = /span class="bold" *>(\d*:\d*)</g;
var vmExp = /<td class="overview iphonepfeil" *>([^<]*)</;
var umstiegeUndDauerExp = /<td class="overview" *>(\d*) *<br *.>(\d*:\d*)/;
var delaysExp = /<td class="overview tprt" *> *<span[^>]*>(.\d*)<.*<span[^>]*>(.\d*)</;
var nurStartDelayExp = /<td class="overview tprt" *> *<span[^>]*>(.\d*)</;
var nurZielDelayExp = /<td class="overview tprt" *> *&nbsp.*<span[^>]*>(.\d*)</;
var achtungExp = /achtung_17x19_mitschatten.png/;
var ausfallExp = /Icon_Zug_faellt_aus_mit_Schatten_17x19.png/;
var frueherExp = /(http:\/\/reiseauskunft\.bahn\.de\/bin\/query2\.exe\/dox\?[^"]*amp;e=2[^"]*)"/;
@@ -73,8 +79,11 @@ function extractConnectionResultInfos(text) {
zeitExp.lastIndex = 0;
result.von = zeitExp.exec(connectionInfo)[1];
result.bis = zeitExp.exec(connectionInfo)[1];
result.vm = connectionInfo.match(vmExp)[1].trim();
var vm = connectionInfo.match(vmExp);
if (vm) {
result.vm = vm[1].trim();
}
var umstiegeUndDauer = connectionInfo.match(umstiegeUndDauerExp);
if (umstiegeUndDauer) {