commit f42ed696c5cc55ba566cbcf7d62202cab71166cc
parent 15b29dd0653d4220058bbd40ac74588bbe13fecc
Author: Katja (ctucx) <git@ctu.cx>
Date: Sun, 26 Jan 2025 22:08:22 +0100
parent 15b29dd0653d4220058bbd40ac74588bbe13fecc
Author: Katja (ctucx) <git@ctu.cx>
Date: Sun, 26 Jan 2025 22:08:22 +0100
searchView: add option for direct-connections
3 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/src/languages.js b/src/languages.js @@ -68,6 +68,7 @@ export const languages = { 'loyaltyCard': 'Ermäßigungskarte', 'loyaltyCardNone': 'keine Ermäßigungskarte', 'class': 'Klasse', + 'titleNoTransfers': 'keine Umstiege zulassen', }, 'nl': { @@ -210,5 +211,6 @@ export const languages = { 'loyaltyCard': 'Discount Card', 'loyaltyCardNone': 'No discount card', 'class': 'Class', + 'titleNoTransfers': 'only direct connections' } };
diff --git a/src/searchView.js b/src/searchView.js @@ -12,6 +12,7 @@ import { client } from './hafas_client'; const viewState = { currDate: new Date(), numEnter: 0, + noTransfers: false, isArrival: false, dateValue: '', timeValue: '', @@ -128,6 +129,10 @@ const searchTemplate = (journeysHistory) => html` <input type="checkbox" id="bikeFriendly" name="bikeFriendly" ?checked=${settings.bikeFriendly}> <label class="icon-bike" for="bikeFriendly" title="${t('titleBikeFriendly')}"></label> </div> + <div class="selector rectangular"> + <input type="checkbox" id="noTransfers" name="noTransfers" ?checked=${viewState.noTransfers}> + <label class="icon-seat" for="noTransfers" title="${t('titleNoTransfers')}"></label> + </div> <div class="filler"></div> @@ -225,6 +230,7 @@ const submitForm = async (event) => { viewState.timeValue = ElementById('time').value.trim(); viewState.dateTimeValue = ElementById('datetime').value.trim(); viewState.isArrival = ElementById('arrival').checked; + viewState.noTransfers = ElementById('noTransfers').checked; // check if From or To empty @@ -329,9 +335,12 @@ const submitForm = async (event) => { loyaltyCard: loyaltyCardFromString(settings.loyaltyCard), }; - if (via) params.via = via; - if (!viewState.isArrival) params.departure = timestamp * 1000; - else params.arrival = timestamp * 1000; + if (via) params.via = via; + + if (viewState.noTransfers) params.transfers = 0; + + if (!viewState.isArrival) params.departure = timestamp * 1000; + else params.arrival = timestamp * 1000; showLoader();
diff --git a/static/style.css b/static/style.css @@ -849,6 +849,10 @@ button.color:hover, .button.color:hover { content: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" height="24" width="24"><path d="M5 20.5A3.5 3.5 0 0 1 1.5 17 3.5 3.5 0 0 1 5 13.5 3.5 3.5 0 0 1 8.5 17 3.5 3.5 0 0 1 5 20.5M5 12a5 5 0 0 0-5 5 5 5 0 0 0 5 5 5 5 0 0 0 5-5 5 5 0 0 0-5-5m9.8-2H19V8.2h-3.2l-1.94-3.27c-.29-.5-.86-.83-1.46-.83-.47 0-.9.19-1.2.5L7.5 8.29C7.19 8.6 7 9 7 9.5c0 .63.33 1.16.85 1.47L11.2 13v5H13v-6.5l-2.25-1.65 2.32-2.35m5.93 13a3.5 3.5 0 0 1-3.5-3.5 3.5 3.5 0 0 1 3.5-3.5 3.5 3.5 0 0 1 3.5 3.5 3.5 3.5 0 0 1-3.5 3.5m0-8.5a5 5 0 0 0-5 5 5 5 0 0 0 5 5 5 5 0 0 0 5-5 5 5 0 0 0-5-5m-3-7.2c1 0 1.8-.8 1.8-1.8S17 1.2 16 1.2 14.2 2 14.2 3 15 4.8 16 4.8"/></svg>'); } +.icon-seat { + content: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" height="24" width="24"><path d="M9 19h6v2H9c-2.76 0-5-2.24-5-5V7h2v9c0 1.66 1.34 3 3 3m1.42-13.59c.78-.78.78-2.05 0-2.83s-2.05-.78-2.83 0-.78 2.05 0 2.83c.78.79 2.04.79 2.83 0M11.5 9c0-1.1-.9-2-2-2H9c-1.1 0-2 .9-2 2v6c0 1.66 1.34 3 3 3h5.07l3.5 3.5L20 20.07 14.93 15H11.5z"/></svg>'); +} + .icon-table { content: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" height="24" width="24"><path d="M3 9h14V7H3zm0 4h14v-2H3zm0 4h14v-2H3zm16 0h2v-2h-2zm0-10v2h2V7zm0 6h2v-2h-2z" fill="white" /></svg>'); }