ctucx.git: oeffisearch

[nimlang] fast and simple tripplanner

commit e319569b2c56b0b5e08fa8c8c4da66d3165c5b43
parent 706854de38a78834b0967cf57f6a26da061a104c
Author: ctucx <c@ctu.cx>
Date: Sat, 8 Feb 2020 00:36:44 +0100

[client] travelynx checkin
6 files changed, 103 insertions(+), 5 deletions(-)
M
client/css/style.css
|
8
++++++++
A
client/img/travelynx.svg
|
79
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
M
client/js/app_functions.js
|
3
++-
M
client/js/journeyView.js
|
4
+++-
M
client/js/languages.js
|
9
+++++++--
M
client/js/settingsView.js
|
5
++++-
diff --git a/client/css/style.css b/client/css/style.css
@@ -678,3 +678,10 @@ input:focus{
 /*.showremarks:hover+.remarks {
 	display: inline-block;
 }*/
+
+
+.travelynx {
+	vertical-align: bottom;
+	cursor: pointer;
+	content: url("../img/travelynx.svg");
+}+
\ No newline at end of file
diff --git a/client/img/travelynx.svg b/client/img/travelynx.svg
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="24"
+   height="24"
+   viewBox="0 0 24 24"
+   version="1.1"
+   id="svg6"
+   sodipodi:docname="travelynx.svg"
+   inkscape:version="0.92.4 (5da689c313, 2019-01-14)">
+  <metadata
+     id="metadata12">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title />
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <defs
+     id="defs10" />
+  <sodipodi:namedview
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1"
+     objecttolerance="10"
+     gridtolerance="10"
+     guidetolerance="10"
+     inkscape:pageopacity="0"
+     inkscape:pageshadow="2"
+     inkscape:window-width="1918"
+     inkscape:window-height="2131"
+     id="namedview8"
+     showgrid="false"
+     inkscape:zoom="19.666667"
+     inkscape:cx="0.25717638"
+     inkscape:cy="10.252251"
+     inkscape:window-x="0"
+     inkscape:window-y="0"
+     inkscape:window-maximized="0"
+     inkscape:current-layer="g4573" />
+  <g
+     id="g4573">
+    <rect
+       y="3.40678"
+       x="3.1271186"
+       height="9.5338984"
+       width="10.550848"
+       id="rect4564"
+       style="fill:#ffffff;fill-opacity:1;stroke-width:1.44797695" />
+    <g
+       id="g4562">
+      <path
+         d="m 8.4266298,1.3049637 c -3.0613961,0 -6.1227924,0.3826745 -6.1227924,3.0613962 v 7.2708161 c 0,1.477124 1.2015981,2.678722 2.6787217,2.678722 l -1.1480235,1.148023 v 0.382675 H 5.5412639 L 7.071962,14.315898 h 2.8853658 l 1.5306982,1.530698 h 1.530698 V 15.463921 L 11.8707,14.315898 c 1.477124,0 2.678722,-1.201598 2.678722,-2.678722 V 4.3663599 c 0,-2.6787217 -2.73995,-3.0613962 -6.1227922,-3.0613962 z M 4.9825591,12.7852 c -0.6352397,0 -1.1480235,-0.512784 -1.1480235,-1.148024 0,-0.63524 0.5127838,-1.148024 1.1480235,-1.148024 0.6352397,0 1.1480236,0.512784 1.1480236,1.148024 0,0.63524 -0.5127839,1.148024 -1.1480236,1.148024 z M 7.6612808,7.427756 H 3.8345356 V 4.3663599 h 3.8267452 z m 1.5306982,0 V 4.3663599 h 3.826745 V 7.427756 Z M 11.8707,12.7852 c -0.635239,0 -1.148023,-0.512784 -1.148023,-1.148024 0,-0.63524 0.512784,-1.148024 1.148023,-1.148024 0.63524,0 1.148024,0.512784 1.148024,1.148024 0,0.63524 -0.512784,1.148024 -1.148024,1.148024 z"
+         id="path14"
+         inkscape:connector-curvature="0"
+         style="stroke-width:0.76534903" />
+      <path
+         style="fill:none"
+         inkscape:connector-curvature="0"
+         d="M 0,0 H 24 V 24 H 0 Z"
+         id="path16" />
+      <path
+         inkscape:connector-curvature="0"
+         d="M 13.208696,20.997167 9.6183022,17.406774 8.3956743,18.620792 13.208696,23.433813 23.540763,13.101746 22.326745,11.887728 Z"
+         id="path16-3"
+         style="stroke-width:0.8610056" />
+    </g>
+  </g>
+</svg>
diff --git a/client/js/app_functions.js b/client/js/app_functions.js
@@ -208,7 +208,8 @@ export const restoreDataStorage  = () => {
 				showRIL100Names: false,
 				writeDebugLog: false,
 				enableCanvas: false,
-				language: language
+				language: language,
+				travelynx: fase
 			}
 		}
 
diff --git a/client/js/journeyView.js b/client/js/journeyView.js
@@ -1,5 +1,6 @@
 'use strict';
 
+import { dataStorage } from './app.js';
 import { showDiv, hideDiv, ElementById, parseDateTime, formatDuration } from './helpers.js';
 import { getCache, addCache, ConsoleLog, parseName, ds100Names, t } from './app_functions.js';
 import { showModal } from './overlays.js';

@@ -21,7 +22,7 @@ const remarksModalTemplate = (type, remarks) => html`
 `;
 
 const showRemarksModal = (type, remarks) => {
-	showModal("Remarks", remarksModalTemplate(type, remarks));
+	showModal(t('remarks'), remarksModalTemplate(type, remarks));
 };
 const remarksTemplate = ([type, remarks]) => !!remarks.length ? html`
 	<a class="showremarks ${type}" @click=${() => showRemarksModal(type, remarks)}></a>

@@ -49,6 +50,7 @@ const legTemplate = (element) => {
 						<td colspan="4">
 							${element.line.name} ${element.line.additionalName ? '('+element.line.additionalName+')' : ''} → ${element.direction} ${element.cancelled ? html`<b style="color:red;">${t('cancelled-ride')}</b>` : ''}
 							${Object.entries(remarks).map(remarksTemplate)}
+							${dataStorage.settings.travelynx && element.line.mode == 'Train' ? html`<a class="travelynx" href="https://travelynx.de/s/${element.departure.point.stop.id}?train=${element.line.additionalName}"></a>` : ''}
 						</td>
 					</tr>
 					<tr>
diff --git a/client/js/languages.js b/client/js/languages.js
@@ -45,8 +45,11 @@ export const languages = {
 		'language':           'Sprache',
 		'de':                 'Deutsch',
 		'en':                 'Englisch',
-		'cancelled-ride':     'Fahrt entfällt!'
+		'cancelled-ride':     'Fahrt entfällt!',
+		'remarks':            'Hinweise',
+		'travelynx-checkin':  'Travelynx checkin anzeigen?'
 	},
+
 	'en': {
 		'arrival':           'Arrival',
 		'departure':         'Departure',

@@ -93,6 +96,8 @@ export const languages = {
 		'language':          'Language',
 		'de':                'German',
 		'en':                'English',
-		'cancelled-ride':    'Cancelled!'
+		'cancelled-ride':    'Cancelled!',
+		'remarks':           'Remarks',
+		'travelynx-checkin': 'show travelynx checkin?'
 	}
 }
diff --git a/client/js/settingsView.js b/client/js/settingsView.js
@@ -26,6 +26,7 @@ const settingsTemplate = () => html`
 		<label><input type="checkbox" ?checked=${dataStorage.settings.writeDebugLog} id="debug-messages"> ${t('showdebug')}</label><br>
 		<label><input type="checkbox" ?checked=${dataStorage.settings.enableCanvas} id="enable-canvas"> ${t('graphical')} <b>BETA</b></label><br>
 		<label><input type="checkbox" ?checked=${dataStorage.settings.fancyCanvas} id="fancy-canvas"> ${t('fancy')}<label><br>
+		<label><input type="checkbox" ?checked=${dataStorage.settings.travelynx} id="travelynx"> ${t('travelynx-checkin')}<label><br>
 		<br>
 		<b>${t('language')}:</b><br>
 		<label><input type="radio" name="language" ?checked=${dataStorage.settings.language === "de"} value="de"> ${t('de')}</label><br>

@@ -52,7 +53,8 @@ const saveSettings  = async () => {
 	const show_ril100   = ElementById('ril100').checked;
 	const write_debug   = ElementById('debug-messages').checked;
 	const enable_canvas = ElementById('enable-canvas').checked;
-	const fancy_canvas = ElementById('fancy-canvas').checked;
+	const fancy_canvas  = ElementById('fancy-canvas').checked;
+	const travelynx     = ElementById('travelynx').checked;
 
 	if (provider !== dataStorage.settings.provider) {
 		dataStorage.journeysHistory = [];

@@ -65,6 +67,7 @@ const saveSettings  = async () => {
 	dataStorage.settings.enableCanvas    = enable_canvas;
 	dataStorage.settings.fancyCanvas     = fancy_canvas;
 	dataStorage.settings.language        = language;
+	dataStorage.settings.travelynx       = travelynx;
 
 	saveDataStorage();
 	if (show_ril100) await loadDS100();