diff --git a/panels/departure/departures.php b/panels/departure/departures.php index e08149fe5fd2ceb53fd7aec20513212de58d163f..97868a541adf0a63cf7fd0c16112236d3a5b9d13 100644 --- a/panels/departure/departures.php +++ b/panels/departure/departures.php @@ -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 diff --git a/panels/departure/script.js b/panels/departure/script.js index ab8405ecdc75749486ab810fe48c52409a382113..167826aa2785c75dcf75b18214921287c50a5350 100755 --- a/panels/departure/script.js +++ b/panels/departure/script.js @@ -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 diff --git a/panels/departure/style.less b/panels/departure/style.less index 35817e3945a5a842f1a83475e61e9f71117cd62e..690ddae3c47e1288093e58762cfca59fd5ebe70c 100755 --- a/panels/departure/style.less +++ b/panels/departure/style.less @@ -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; }