Skip to content
Snippets Groups Projects
Commit 8bbe0c4b authored by 2deep4real's avatar 2deep4real
Browse files

added filter on destination

width of linenumber, time and delay dynamically tested with linenumber
[00000]; time [00:00] and delay [+00] -> widths removed from style
parent c12e406d
No related branches found
No related tags found
No related merge requests found
......@@ -78,6 +78,7 @@
echo "<div error><h1>NAME ERROR!</h1>$stop<br/>Not a propper stop name. Usage: city:stop[;city:stop]*</div>";
// get departures
ob_start();
$plain = file_get_contents("http://vrrf.finalrewind.org/$stopsplit[0]/$stopsplit[1].json?frontend=json");
$data = json_decode($plain, true);
// version
......@@ -115,6 +116,11 @@
continue;
}
}
if (isset($options['filter']['bl']['destination']) ) {
if (in_array($entry['destination'], $options['filter']['bl']['destination'])) {
continue;
}
}
}
if (isset($options['filter']['wl'])) {
if (isset($options['filter']['wl']['line']) ) {
......@@ -132,6 +138,11 @@
continue;
}
}
if (isset($options['filter']['wl']['destination']) ) {
if (!in_array($entry['destination'], $options['filter']['wl']['destination'])) {
continue;
}
}
}
// !filter
......
......@@ -122,7 +122,7 @@ var update = function(config, fields) {
} else {
$(actDep.self).css("display", "");
$(actDep.line).html(strDep.line.toUpperCase());
$(actDep.name).html(strDep.destination);
$(actDep.name).html(strDep.destination.replace("Dortmund ", ""));
for (var j = 0; j < 3; ++j) {
var
actStn = actDep.sttn[j],
......@@ -135,7 +135,7 @@ var update = function(config, fields) {
} else {
$(actStn.self).css("display", "");
$(actStn.time).html(strStn.time);
$(actStn.name).html(strStn.name);
$(actStn.name).html(strStn.name.replace("Dortmund - ", ""));
if (strStn.cancel == 1) {
$(actStn.name).css("text-decoration", "outline");
} else {
......@@ -163,6 +163,8 @@ var resize = function(panel, config, cont) {
lineStp = $(cont).find('[data-stop]'),
infoTtl = $(cont).find('[data-title]'),
infoMsg = $(cont).find('[data-message]'),
stopTme = $(lineStp).find('[data-time]'),
stopDly = $(lineStp).find('[data-delay]'),
// setze größen der schriften mit scale * n wobei n in prozent von panelhöhe
lineHedH = scale * 5, // überschriften der linien
lineStpH = scale * 4, // haltestellen der linien
......@@ -172,13 +174,17 @@ var resize = function(panel, config, cont) {
$(lineHed).css('height', lineHedH + 'px');
$(lineHed).css('fontSize', (lineHedH-2) + 'px');
$(lineHed).css('lineHeight', lineHedH + 'px');
$(lineLin).css('width', lineHedH * 2);
$(lineLin).css('width', getStringWidth((lineHedH-2), "00000"));
// setze linien haltestellen größe
$(lineStp).css('height', lineStpH + 'px');
$(lineStp).css('fontSize', (lineStpH-2) + 'px');
$(lineStp).css('lineHeight', lineStpH + 'px');
// setze zeit und delay breite
$(stopTme).css('width', getStringWidth((lineStpH-2), "00:00") + 'px');
$(stopDly).css('width', getStringWidth((lineStpH-2), "+00") + 'px');
// setze info überschriften größe
$(infoTtl).css('height', infoTtlH + 'px');
$(infoTtl).css('fontSize', (infoTtlH-2) + 'px');
......@@ -190,6 +196,16 @@ var resize = function(panel, config, cont) {
$(infoMsg).css('lineHeight', infoMsgH + 'px');
}
var getStringWidth = function(fontSize, string) {
var
o = $('<div>' + string + '</div>')
.css({'position': 'absolute', 'float': 'left', 'white-space': 'nowrap', 'visibility': 'hidden', 'font-family': 'display', 'fontSize': fontSize + 'px'})
.appendTo($('body')),
w = o.width();
o.remove();
return w;
}
var generate = function(config, stations, departs, tplDeparture, tplStop, tplMsg) {
console.log("departures: generating structure [" + config + "]");
var
......
......@@ -9,7 +9,6 @@
box-sizing: border-box;
overflow: hidden;
font-family: display;
/* font-weight: bold */
[data-departure] {
position: relative;
......@@ -33,7 +32,7 @@
display: inline-table;
background-color: #FFFFFF;
color: #0000A0;
width: 10%;
/*width: 10%;*/
height: 100%;
text-align: right;
padding: 0px 5px;
......@@ -63,7 +62,6 @@
[data-time] {
position: relative;
flex: 2;
height: 100%;
overflow: hidden;
text-align: right;
......@@ -71,7 +69,6 @@
}
[data-delay] {
position: relative;
flex: 1;
height: 100%;
overflow: hidden;
text-align: right;
......@@ -82,7 +79,7 @@
[data-name] {
position: relative;
flex: 16;
flex: 1;
height: 100%;
overflow: hidden;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment