├── .github
└── workflows
│ └── main.yml
├── .gitignore
├── LICENCE
├── README.md
├── assets
├── css
│ └── style.css
├── data
│ ├── data.json
│ └── rawdata.json
├── fonts
│ └── material-design-icons
│ │ ├── .gitignore
│ │ ├── LICENSE
│ │ ├── README.md
│ │ └── font
│ │ ├── MaterialIcons-Regular.codepoints
│ │ ├── MaterialIcons-Regular.ttf
│ │ ├── MaterialIconsOutlined-Regular.codepoints
│ │ ├── MaterialIconsOutlined-Regular.otf
│ │ ├── MaterialIconsRound-Regular.codepoints
│ │ ├── MaterialIconsRound-Regular.otf
│ │ ├── MaterialIconsSharp-Regular.codepoints
│ │ ├── MaterialIconsSharp-Regular.otf
│ │ ├── MaterialIconsTwoTone-Regular.codepoints
│ │ ├── MaterialIconsTwoTone-Regular.otf
│ │ └── README.md
├── frameworks
│ └── materialize
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── css
│ │ ├── materialize.css
│ │ └── materialize.min.css
│ │ └── js
│ │ ├── materialize.js
│ │ └── materialize.min.js
├── images
│ ├── icons
│ │ ├── Icon-100.png
│ │ ├── Icon-1024.png
│ │ ├── Icon-114.png
│ │ ├── Icon-120.png
│ │ ├── Icon-128.png
│ │ ├── Icon-144.png
│ │ ├── Icon-152.png
│ │ ├── Icon-16.png
│ │ ├── Icon-167.png
│ │ ├── Icon-172.png
│ │ ├── Icon-180.png
│ │ ├── Icon-196.png
│ │ ├── Icon-20.png
│ │ ├── Icon-256.png
│ │ ├── Icon-29.png
│ │ ├── Icon-32.png
│ │ ├── Icon-40.png
│ │ ├── Icon-48.png
│ │ ├── Icon-50.png
│ │ ├── Icon-512.png
│ │ ├── Icon-55.png
│ │ ├── Icon-57.png
│ │ ├── Icon-58.png
│ │ ├── Icon-60.png
│ │ ├── Icon-64.png
│ │ ├── Icon-72.png
│ │ ├── Icon-76.png
│ │ ├── Icon-80.png
│ │ ├── Icon-87.png
│ │ └── Icon-88.png
│ └── linkpreview.jpg
└── js
│ ├── rawdata.js
│ ├── script.js
│ ├── script.js.map
│ └── serviceWorkerInstaller.js
├── dsgvo.html
├── index.html
├── manifest.json
├── other
├── linkpreview.afdesign
├── logo.afdesign
└── logo.png
├── service-worker.js
├── src
├── DVBHandler.ts
├── dataHandler.ts
├── distanceHandler.ts
├── general.ts
├── generators.ts
├── geoData.ts
├── httpFunctions.ts
├── refreshHandler.ts
└── searchHandler.ts
├── tools
├── simpleconverter.html
└── stationsNumberLokup.html
└── tsconfig.json
/.github/workflows/main.yml:
--------------------------------------------------------------------------------
1 | name: github pages
2 |
3 | on:
4 | push:
5 | branches:
6 | - main # Set a branch name to trigger deployment
7 |
8 | jobs:
9 | deploy:
10 | runs-on: ubuntu-18.04
11 | steps:
12 | - uses: actions/checkout@v2
13 | with:
14 | submodules: true
15 | fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
16 |
17 | - name: Deploy
18 | uses: peaceiris/actions-gh-pages@v3
19 | with:
20 | deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
21 | publish_dir: ./
22 | external_repository: dvbfast/dvbfast.github.io
23 | publish_branch: gh-pages
24 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | # Created by https://www.toptal.com/developers/gitignore/api/macos,node,windows,reactnative
3 | # Edit at https://www.toptal.com/developers/gitignore?templates=macos,node,windows,reactnative
4 |
5 | ### macOS ###
6 | # General
7 | .DS_Store
8 | .AppleDouble
9 | .LSOverride
10 |
11 | # Icon must end with two \r
12 | Icon
13 |
14 |
15 | # Thumbnails
16 | ._*
17 |
18 | # Files that might appear in the root of a volume
19 | .DocumentRevisions-V100
20 | .fseventsd
21 | .Spotlight-V100
22 | .TemporaryItems
23 | .Trashes
24 | .VolumeIcon.icns
25 | .com.apple.timemachine.donotpresent
26 |
27 | # Directories potentially created on remote AFP share
28 | .AppleDB
29 | .AppleDesktop
30 | Network Trash Folder
31 | Temporary Items
32 | .apdisk
33 |
34 | ### Node ###
35 | # Logs
36 | logs
37 | *.log
38 | npm-debug.log*
39 | yarn-debug.log*
40 | yarn-error.log*
41 | lerna-debug.log*
42 |
43 | # Diagnostic reports (https://nodejs.org/api/report.html)
44 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
45 |
46 | # Runtime data
47 | pids
48 | *.pid
49 | *.seed
50 | *.pid.lock
51 |
52 | # Directory for instrumented libs generated by jscoverage/JSCover
53 | lib-cov
54 |
55 | # Coverage directory used by tools like istanbul
56 | coverage
57 | *.lcov
58 |
59 | # nyc test coverage
60 | .nyc_output
61 |
62 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
63 | .grunt
64 |
65 | # Bower dependency directory (https://bower.io/)
66 | bower_components
67 |
68 | # node-waf configuration
69 | .lock-wscript
70 |
71 | # Compiled binary addons (https://nodejs.org/api/addons.html)
72 | build/Release
73 |
74 | # Dependency directories
75 | node_modules/
76 | jspm_packages/
77 |
78 | # TypeScript v1 declaration files
79 | typings/
80 |
81 | # TypeScript cache
82 | *.tsbuildinfo
83 |
84 | # Optional npm cache directory
85 | .npm
86 |
87 | # Optional eslint cache
88 | .eslintcache
89 |
90 | # Microbundle cache
91 | .rpt2_cache/
92 | .rts2_cache_cjs/
93 | .rts2_cache_es/
94 | .rts2_cache_umd/
95 |
96 | # Optional REPL history
97 | .node_repl_history
98 |
99 | # Output of 'npm pack'
100 | *.tgz
101 |
102 | # Yarn Integrity file
103 | .yarn-integrity
104 |
105 | # dotenv environment variables file
106 | .env
107 | .env.test
108 | .env*.local
109 |
110 | # parcel-bundler cache (https://parceljs.org/)
111 | .cache
112 | .parcel-cache
113 |
114 | # Next.js build output
115 | .next
116 |
117 | # Nuxt.js build / generate output
118 | .nuxt
119 | dist
120 |
121 | # Gatsby files
122 | .cache/
123 | # Comment in the public line in if your project uses Gatsby and not Next.js
124 | # https://nextjs.org/blog/next-9-1#public-directory-support
125 | # public
126 |
127 | # vuepress build output
128 | .vuepress/dist
129 |
130 | # Serverless directories
131 | .serverless/
132 |
133 | # FuseBox cache
134 | .fusebox/
135 |
136 | # DynamoDB Local files
137 | .dynamodb/
138 |
139 | # TernJS port file
140 | .tern-port
141 |
142 | # Stores VSCode versions used for testing VSCode extensions
143 | .vscode-test
144 |
145 | ### ReactNative ###
146 | # React Native Stack Base
147 |
148 | .expo
149 | __generated__
150 |
151 | ### ReactNative.Android Stack ###
152 | # Built application files
153 | *.apk
154 | *.aar
155 | *.ap_
156 | *.aab
157 |
158 | # Files for the ART/Dalvik VM
159 | *.dex
160 |
161 | # Java class files
162 | *.class
163 |
164 | # Generated files
165 | bin/
166 | gen/
167 | out/
168 | # Uncomment the following line in case you need and you don't have the release build type files in your app
169 | # release/
170 |
171 | # Gradle files
172 | .gradle/
173 | build/
174 |
175 | # Local configuration file (sdk path, etc)
176 | local.properties
177 |
178 | # Proguard folder generated by Eclipse
179 | proguard/
180 |
181 | # Log Files
182 |
183 | # Android Studio Navigation editor temp files
184 | .navigation/
185 |
186 | # Android Studio captures folder
187 | captures/
188 |
189 | # IntelliJ
190 | *.iml
191 | .idea/workspace.xml
192 | .idea/tasks.xml
193 | .idea/gradle.xml
194 | .idea/assetWizardSettings.xml
195 | .idea/dictionaries
196 | .idea/libraries
197 | # Android Studio 3 in .gitignore file.
198 | .idea/caches
199 | .idea/modules.xml
200 | # Comment next line if keeping position of elements in Navigation Editor is relevant for you
201 | .idea/navEditor.xml
202 |
203 | # Keystore files
204 | # Uncomment the following lines if you do not want to check your keystore files in.
205 | #*.jks
206 | #*.keystore
207 |
208 | # External native build folder generated in Android Studio 2.2 and later
209 | .externalNativeBuild
210 | .cxx/
211 |
212 | # Google Services (e.g. APIs or Firebase)
213 | # google-services.json
214 |
215 | # Freeline
216 | freeline.py
217 | freeline/
218 | freeline_project_description.json
219 |
220 | # fastlane
221 | fastlane/report.xml
222 | fastlane/Preview.html
223 | fastlane/screenshots
224 | fastlane/test_output
225 | fastlane/readme.md
226 |
227 | # Version control
228 | vcs.xml
229 |
230 | # lint
231 | lint/intermediates/
232 | lint/generated/
233 | lint/outputs/
234 | lint/tmp/
235 | # lint/reports/
236 |
237 | ### ReactNative.Buck Stack ###
238 | buck-out/
239 | .buckconfig.local
240 | .buckd/
241 | .buckversion
242 | .fakebuckversion
243 |
244 | ### ReactNative.Gradle Stack ###
245 | .gradle
246 |
247 | # Ignore Gradle GUI config
248 | gradle-app.setting
249 |
250 | # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
251 | !gradle-wrapper.jar
252 |
253 | # Cache of project
254 | .gradletasknamecache
255 |
256 | # # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
257 | # gradle/wrapper/gradle-wrapper.properties
258 |
259 | ### ReactNative.Linux Stack ###
260 | *~
261 |
262 | # temporary files which can be created if a process still has a handle open of a deleted file
263 | .fuse_hidden*
264 |
265 | # KDE directory preferences
266 | .directory
267 |
268 | # Linux trash folder which might appear on any partition or disk
269 | .Trash-*
270 |
271 | # .nfs files are created when an open file is removed but is still being accessed
272 | .nfs*
273 |
274 | ### ReactNative.Node Stack ###
275 | # Logs
276 |
277 | # Diagnostic reports (https://nodejs.org/api/report.html)
278 |
279 | # Runtime data
280 |
281 | # Directory for instrumented libs generated by jscoverage/JSCover
282 |
283 | # Coverage directory used by tools like istanbul
284 |
285 | # nyc test coverage
286 |
287 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
288 |
289 | # Bower dependency directory (https://bower.io/)
290 |
291 | # node-waf configuration
292 |
293 | # Compiled binary addons (https://nodejs.org/api/addons.html)
294 |
295 | # Dependency directories
296 |
297 | # TypeScript v1 declaration files
298 |
299 | # TypeScript cache
300 |
301 | # Optional npm cache directory
302 |
303 | # Optional eslint cache
304 |
305 | # Microbundle cache
306 |
307 | # Optional REPL history
308 |
309 | # Output of 'npm pack'
310 |
311 | # Yarn Integrity file
312 |
313 | # dotenv environment variables file
314 |
315 | # parcel-bundler cache (https://parceljs.org/)
316 |
317 | # Next.js build output
318 |
319 | # Nuxt.js build / generate output
320 |
321 | # Gatsby files
322 | # Comment in the public line in if your project uses Gatsby and not Next.js
323 | # https://nextjs.org/blog/next-9-1#public-directory-support
324 | # public
325 |
326 | # vuepress build output
327 |
328 | # Serverless directories
329 |
330 | # FuseBox cache
331 |
332 | # DynamoDB Local files
333 |
334 | # TernJS port file
335 |
336 | # Stores VSCode versions used for testing VSCode extensions
337 |
338 | ### ReactNative.Xcode Stack ###
339 | # Xcode
340 | #
341 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
342 |
343 | ## User settings
344 | xcuserdata/
345 |
346 | ## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
347 | *.xcscmblueprint
348 | *.xccheckout
349 |
350 | ## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4)
351 | DerivedData/
352 | *.moved-aside
353 | *.pbxuser
354 | !default.pbxuser
355 | *.mode1v3
356 | !default.mode1v3
357 | *.mode2v3
358 | !default.mode2v3
359 | *.perspectivev3
360 | !default.perspectivev3
361 |
362 | ## Gcc Patch
363 | /*.gcno
364 |
365 | ### ReactNative.macOS Stack ###
366 | # General
367 |
368 | # Icon must end with two \r
369 |
370 | # Thumbnails
371 |
372 | # Files that might appear in the root of a volume
373 |
374 | # Directories potentially created on remote AFP share
375 |
376 | ### Windows ###
377 | # Windows thumbnail cache files
378 | Thumbs.db
379 | Thumbs.db:encryptable
380 | ehthumbs.db
381 | ehthumbs_vista.db
382 |
383 | # Dump file
384 | *.stackdump
385 |
386 | # Folder config file
387 | [Dd]esktop.ini
388 |
389 | # Recycle Bin used on file shares
390 | $RECYCLE.BIN/
391 |
392 | # Windows Installer files
393 | *.cab
394 | *.msi
395 | *.msix
396 | *.msm
397 | *.msp
398 |
399 | # Windows shortcuts
400 | *.lnk
401 |
402 | # End of https://www.toptal.com/developers/gitignore/api/macos,node,windows,reactnative
403 |
--------------------------------------------------------------------------------
/LICENCE:
--------------------------------------------------------------------------------
1 | Attribution-NonCommercial-ShareAlike 4.0 International
2 |
3 | =======================================================================
4 |
5 | Creative Commons Corporation ("Creative Commons") is not a law firm and
6 | does not provide legal services or legal advice. Distribution of
7 | Creative Commons public licenses does not create a lawyer-client or
8 | other relationship. Creative Commons makes its licenses and related
9 | information available on an "as-is" basis. Creative Commons gives no
10 | warranties regarding its licenses, any material licensed under their
11 | terms and conditions, or any related information. Creative Commons
12 | disclaims all liability for damages resulting from their use to the
13 | fullest extent possible.
14 |
15 | Using Creative Commons Public Licenses
16 |
17 | Creative Commons public licenses provide a standard set of terms and
18 | conditions that creators and other rights holders may use to share
19 | original works of authorship and other material subject to copyright
20 | and certain other rights specified in the public license below. The
21 | following considerations are for informational purposes only, are not
22 | exhaustive, and do not form part of our licenses.
23 |
24 | Considerations for licensors: Our public licenses are
25 | intended for use by those authorized to give the public
26 | permission to use material in ways otherwise restricted by
27 | copyright and certain other rights. Our licenses are
28 | irrevocable. Licensors should read and understand the terms
29 | and conditions of the license they choose before applying it.
30 | Licensors should also secure all rights necessary before
31 | applying our licenses so that the public can reuse the
32 | material as expected. Licensors should clearly mark any
33 | material not subject to the license. This includes other CC-
34 | licensed material, or material used under an exception or
35 | limitation to copyright. More considerations for licensors:
36 | wiki.creativecommons.org/Considerations_for_licensors
37 |
38 | Considerations for the public: By using one of our public
39 | licenses, a licensor grants the public permission to use the
40 | licensed material under specified terms and conditions. If
41 | the licensor's permission is not necessary for any reason--for
42 | example, because of any applicable exception or limitation to
43 | copyright--then that use is not regulated by the license. Our
44 | licenses grant only permissions under copyright and certain
45 | other rights that a licensor has authority to grant. Use of
46 | the licensed material may still be restricted for other
47 | reasons, including because others have copyright or other
48 | rights in the material. A licensor may make special requests,
49 | such as asking that all changes be marked or described.
50 | Although not required by our licenses, you are encouraged to
51 | respect those requests where reasonable. More_considerations
52 | for the public:
53 | wiki.creativecommons.org/Considerations_for_licensees
54 |
55 | =======================================================================
56 |
57 | Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International
58 | Public License
59 |
60 | By exercising the Licensed Rights (defined below), You accept and agree
61 | to be bound by the terms and conditions of this Creative Commons
62 | Attribution-NonCommercial-ShareAlike 4.0 International Public License
63 | ("Public License"). To the extent this Public License may be
64 | interpreted as a contract, You are granted the Licensed Rights in
65 | consideration of Your acceptance of these terms and conditions, and the
66 | Licensor grants You such rights in consideration of benefits the
67 | Licensor receives from making the Licensed Material available under
68 | these terms and conditions.
69 |
70 |
71 | Section 1 -- Definitions.
72 |
73 | a. Adapted Material means material subject to Copyright and Similar
74 | Rights that is derived from or based upon the Licensed Material
75 | and in which the Licensed Material is translated, altered,
76 | arranged, transformed, or otherwise modified in a manner requiring
77 | permission under the Copyright and Similar Rights held by the
78 | Licensor. For purposes of this Public License, where the Licensed
79 | Material is a musical work, performance, or sound recording,
80 | Adapted Material is always produced where the Licensed Material is
81 | synched in timed relation with a moving image.
82 |
83 | b. Adapter's License means the license You apply to Your Copyright
84 | and Similar Rights in Your contributions to Adapted Material in
85 | accordance with the terms and conditions of this Public License.
86 |
87 | c. BY-NC-SA Compatible License means a license listed at
88 | creativecommons.org/compatiblelicenses, approved by Creative
89 | Commons as essentially the equivalent of this Public License.
90 |
91 | d. Copyright and Similar Rights means copyright and/or similar rights
92 | closely related to copyright including, without limitation,
93 | performance, broadcast, sound recording, and Sui Generis Database
94 | Rights, without regard to how the rights are labeled or
95 | categorized. For purposes of this Public License, the rights
96 | specified in Section 2(b)(1)-(2) are not Copyright and Similar
97 | Rights.
98 |
99 | e. Effective Technological Measures means those measures that, in the
100 | absence of proper authority, may not be circumvented under laws
101 | fulfilling obligations under Article 11 of the WIPO Copyright
102 | Treaty adopted on December 20, 1996, and/or similar international
103 | agreements.
104 |
105 | f. Exceptions and Limitations means fair use, fair dealing, and/or
106 | any other exception or limitation to Copyright and Similar Rights
107 | that applies to Your use of the Licensed Material.
108 |
109 | g. License Elements means the license attributes listed in the name
110 | of a Creative Commons Public License. The License Elements of this
111 | Public License are Attribution, NonCommercial, and ShareAlike.
112 |
113 | h. Licensed Material means the artistic or literary work, database,
114 | or other material to which the Licensor applied this Public
115 | License.
116 |
117 | i. Licensed Rights means the rights granted to You subject to the
118 | terms and conditions of this Public License, which are limited to
119 | all Copyright and Similar Rights that apply to Your use of the
120 | Licensed Material and that the Licensor has authority to license.
121 |
122 | j. Licensor means the individual(s) or entity(ies) granting rights
123 | under this Public License.
124 |
125 | k. NonCommercial means not primarily intended for or directed towards
126 | commercial advantage or monetary compensation. For purposes of
127 | this Public License, the exchange of the Licensed Material for
128 | other material subject to Copyright and Similar Rights by digital
129 | file-sharing or similar means is NonCommercial provided there is
130 | no payment of monetary compensation in connection with the
131 | exchange.
132 |
133 | l. Share means to provide material to the public by any means or
134 | process that requires permission under the Licensed Rights, such
135 | as reproduction, public display, public performance, distribution,
136 | dissemination, communication, or importation, and to make material
137 | available to the public including in ways that members of the
138 | public may access the material from a place and at a time
139 | individually chosen by them.
140 |
141 | m. Sui Generis Database Rights means rights other than copyright
142 | resulting from Directive 96/9/EC of the European Parliament and of
143 | the Council of 11 March 1996 on the legal protection of databases,
144 | as amended and/or succeeded, as well as other essentially
145 | equivalent rights anywhere in the world.
146 |
147 | n. You means the individual or entity exercising the Licensed Rights
148 | under this Public License. Your has a corresponding meaning.
149 |
150 |
151 | Section 2 -- Scope.
152 |
153 | a. License grant.
154 |
155 | 1. Subject to the terms and conditions of this Public License,
156 | the Licensor hereby grants You a worldwide, royalty-free,
157 | non-sublicensable, non-exclusive, irrevocable license to
158 | exercise the Licensed Rights in the Licensed Material to:
159 |
160 | a. reproduce and Share the Licensed Material, in whole or
161 | in part, for NonCommercial purposes only; and
162 |
163 | b. produce, reproduce, and Share Adapted Material for
164 | NonCommercial purposes only.
165 |
166 | 2. Exceptions and Limitations. For the avoidance of doubt, where
167 | Exceptions and Limitations apply to Your use, this Public
168 | License does not apply, and You do not need to comply with
169 | its terms and conditions.
170 |
171 | 3. Term. The term of this Public License is specified in Section
172 | 6(a).
173 |
174 | 4. Media and formats; technical modifications allowed. The
175 | Licensor authorizes You to exercise the Licensed Rights in
176 | all media and formats whether now known or hereafter created,
177 | and to make technical modifications necessary to do so. The
178 | Licensor waives and/or agrees not to assert any right or
179 | authority to forbid You from making technical modifications
180 | necessary to exercise the Licensed Rights, including
181 | technical modifications necessary to circumvent Effective
182 | Technological Measures. For purposes of this Public License,
183 | simply making modifications authorized by this Section 2(a)
184 | (4) never produces Adapted Material.
185 |
186 | 5. Downstream recipients.
187 |
188 | a. Offer from the Licensor -- Licensed Material. Every
189 | recipient of the Licensed Material automatically
190 | receives an offer from the Licensor to exercise the
191 | Licensed Rights under the terms and conditions of this
192 | Public License.
193 |
194 | b. Additional offer from the Licensor -- Adapted Material.
195 | Every recipient of Adapted Material from You
196 | automatically receives an offer from the Licensor to
197 | exercise the Licensed Rights in the Adapted Material
198 | under the conditions of the Adapter's License You apply.
199 |
200 | c. No downstream restrictions. You may not offer or impose
201 | any additional or different terms or conditions on, or
202 | apply any Effective Technological Measures to, the
203 | Licensed Material if doing so restricts exercise of the
204 | Licensed Rights by any recipient of the Licensed
205 | Material.
206 |
207 | 6. No endorsement. Nothing in this Public License constitutes or
208 | may be construed as permission to assert or imply that You
209 | are, or that Your use of the Licensed Material is, connected
210 | with, or sponsored, endorsed, or granted official status by,
211 | the Licensor or others designated to receive attribution as
212 | provided in Section 3(a)(1)(A)(i).
213 |
214 | b. Other rights.
215 |
216 | 1. Moral rights, such as the right of integrity, are not
217 | licensed under this Public License, nor are publicity,
218 | privacy, and/or other similar personality rights; however, to
219 | the extent possible, the Licensor waives and/or agrees not to
220 | assert any such rights held by the Licensor to the limited
221 | extent necessary to allow You to exercise the Licensed
222 | Rights, but not otherwise.
223 |
224 | 2. Patent and trademark rights are not licensed under this
225 | Public License.
226 |
227 | 3. To the extent possible, the Licensor waives any right to
228 | collect royalties from You for the exercise of the Licensed
229 | Rights, whether directly or through a collecting society
230 | under any voluntary or waivable statutory or compulsory
231 | licensing scheme. In all other cases the Licensor expressly
232 | reserves any right to collect such royalties, including when
233 | the Licensed Material is used other than for NonCommercial
234 | purposes.
235 |
236 |
237 | Section 3 -- License Conditions.
238 |
239 | Your exercise of the Licensed Rights is expressly made subject to the
240 | following conditions.
241 |
242 | a. Attribution.
243 |
244 | 1. If You Share the Licensed Material (including in modified
245 | form), You must:
246 |
247 | a. retain the following if it is supplied by the Licensor
248 | with the Licensed Material:
249 |
250 | i. identification of the creator(s) of the Licensed
251 | Material and any others designated to receive
252 | attribution, in any reasonable manner requested by
253 | the Licensor (including by pseudonym if
254 | designated);
255 |
256 | ii. a copyright notice;
257 |
258 | iii. a notice that refers to this Public License;
259 |
260 | iv. a notice that refers to the disclaimer of
261 | warranties;
262 |
263 | v. a URI or hyperlink to the Licensed Material to the
264 | extent reasonably practicable;
265 |
266 | b. indicate if You modified the Licensed Material and
267 | retain an indication of any previous modifications; and
268 |
269 | c. indicate the Licensed Material is licensed under this
270 | Public License, and include the text of, or the URI or
271 | hyperlink to, this Public License.
272 |
273 | 2. You may satisfy the conditions in Section 3(a)(1) in any
274 | reasonable manner based on the medium, means, and context in
275 | which You Share the Licensed Material. For example, it may be
276 | reasonable to satisfy the conditions by providing a URI or
277 | hyperlink to a resource that includes the required
278 | information.
279 | 3. If requested by the Licensor, You must remove any of the
280 | information required by Section 3(a)(1)(A) to the extent
281 | reasonably practicable.
282 |
283 | b. ShareAlike.
284 |
285 | In addition to the conditions in Section 3(a), if You Share
286 | Adapted Material You produce, the following conditions also apply.
287 |
288 | 1. The Adapter's License You apply must be a Creative Commons
289 | license with the same License Elements, this version or
290 | later, or a BY-NC-SA Compatible License.
291 |
292 | 2. You must include the text of, or the URI or hyperlink to, the
293 | Adapter's License You apply. You may satisfy this condition
294 | in any reasonable manner based on the medium, means, and
295 | context in which You Share Adapted Material.
296 |
297 | 3. You may not offer or impose any additional or different terms
298 | or conditions on, or apply any Effective Technological
299 | Measures to, Adapted Material that restrict exercise of the
300 | rights granted under the Adapter's License You apply.
301 |
302 |
303 | Section 4 -- Sui Generis Database Rights.
304 |
305 | Where the Licensed Rights include Sui Generis Database Rights that
306 | apply to Your use of the Licensed Material:
307 |
308 | a. for the avoidance of doubt, Section 2(a)(1) grants You the right
309 | to extract, reuse, reproduce, and Share all or a substantial
310 | portion of the contents of the database for NonCommercial purposes
311 | only;
312 |
313 | b. if You include all or a substantial portion of the database
314 | contents in a database in which You have Sui Generis Database
315 | Rights, then the database in which You have Sui Generis Database
316 | Rights (but not its individual contents) is Adapted Material,
317 | including for purposes of Section 3(b); and
318 |
319 | c. You must comply with the conditions in Section 3(a) if You Share
320 | all or a substantial portion of the contents of the database.
321 |
322 | For the avoidance of doubt, this Section 4 supplements and does not
323 | replace Your obligations under this Public License where the Licensed
324 | Rights include other Copyright and Similar Rights.
325 |
326 |
327 | Section 5 -- Disclaimer of Warranties and Limitation of Liability.
328 |
329 | a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
330 | EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
331 | AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
332 | ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
333 | IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
334 | WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
335 | PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
336 | ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
337 | KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
338 | ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
339 |
340 | b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
341 | TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
342 | NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
343 | INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
344 | COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
345 | USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
346 | ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
347 | DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
348 | IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
349 |
350 | c. The disclaimer of warranties and limitation of liability provided
351 | above shall be interpreted in a manner that, to the extent
352 | possible, most closely approximates an absolute disclaimer and
353 | waiver of all liability.
354 |
355 |
356 | Section 6 -- Term and Termination.
357 |
358 | a. This Public License applies for the term of the Copyright and
359 | Similar Rights licensed here. However, if You fail to comply with
360 | this Public License, then Your rights under this Public License
361 | terminate automatically.
362 |
363 | b. Where Your right to use the Licensed Material has terminated under
364 | Section 6(a), it reinstates:
365 |
366 | 1. automatically as of the date the violation is cured, provided
367 | it is cured within 30 days of Your discovery of the
368 | violation; or
369 |
370 | 2. upon express reinstatement by the Licensor.
371 |
372 | For the avoidance of doubt, this Section 6(b) does not affect any
373 | right the Licensor may have to seek remedies for Your violations
374 | of this Public License.
375 |
376 | c. For the avoidance of doubt, the Licensor may also offer the
377 | Licensed Material under separate terms or conditions or stop
378 | distributing the Licensed Material at any time; however, doing so
379 | will not terminate this Public License.
380 |
381 | d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
382 | License.
383 |
384 |
385 | Section 7 -- Other Terms and Conditions.
386 |
387 | a. The Licensor shall not be bound by any additional or different
388 | terms or conditions communicated by You unless expressly agreed.
389 |
390 | b. Any arrangements, understandings, or agreements regarding the
391 | Licensed Material not stated herein are separate from and
392 | independent of the terms and conditions of this Public License.
393 |
394 |
395 | Section 8 -- Interpretation.
396 |
397 | a. For the avoidance of doubt, this Public License does not, and
398 | shall not be interpreted to, reduce, limit, restrict, or impose
399 | conditions on any use of the Licensed Material that could lawfully
400 | be made without permission under this Public License.
401 |
402 | b. To the extent possible, if any provision of this Public License is
403 | deemed unenforceable, it shall be automatically reformed to the
404 | minimum extent necessary to make it enforceable. If the provision
405 | cannot be reformed, it shall be severed from this Public License
406 | without affecting the enforceability of the remaining terms and
407 | conditions.
408 |
409 | c. No term or condition of this Public License will be waived and no
410 | failure to comply consented to unless expressly agreed to by the
411 | Licensor.
412 |
413 | d. Nothing in this Public License constitutes or may be interpreted
414 | as a limitation upon, or waiver of, any privileges and immunities
415 | that apply to the Licensor or You, including from the legal
416 | processes of any jurisdiction or authority.
417 |
418 | =======================================================================
419 |
420 | Creative Commons is not a party to its public
421 | licenses. Notwithstanding, Creative Commons may elect to apply one of
422 | its public licenses to material it publishes and in those instances
423 | will be considered the “Licensor.” The text of the Creative Commons
424 | public licenses is dedicated to the public domain under the CC0 Public
425 | Domain Dedication. Except for the limited purpose of indicating that
426 | material is shared under a Creative Commons public license or as
427 | otherwise permitted by the Creative Commons policies published at
428 | creativecommons.org/policies, Creative Commons does not authorize the
429 | use of the trademark "Creative Commons" or any other trademark or logo
430 | of Creative Commons without its prior written consent including,
431 | without limitation, in connection with any unauthorized modifications
432 | to any of its public licenses or any other arrangements,
433 | understandings, or agreements concerning use of licensed material. For
434 | the avoidance of doubt, this paragraph does not form part of the
435 | public licenses.
436 |
437 | Creative Commons may be contacted at creativecommons.org.
438 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | # DVBfast
5 | Die schnellste Möglichkeit, Abfahrtsinformationen in Dresden zu erhalten.
6 |
7 | *The fastest way to get your departure infos in Dresden*
8 |
9 |
Löschung Ihrer bei uns gespeicherten Daten (Art. 17 DSGVO),
33 |
Einschränkung der Datenverarbeitung, sofern wir Ihre Daten aufgrund gesetzlicher Pflichten noch nicht löschen dürfen (Art. 18 DSGVO),
34 |
Widerspruch gegen die Verarbeitung Ihrer Daten bei uns (Art. 21 DSGVO) und
35 |
Datenübertragbarkeit, sofern Sie in die Datenverarbeitung eingewilligt haben oder einen Vertrag mit uns abgeschlossen haben (Art. 20 DSGVO).
36 |
37 |
Sofern Sie uns eine Einwilligung erteilt haben, können Sie diese jederzeit mit Wirkung für die Zukunft widerrufen.
38 |
Sie können sich jederzeit mit einer Beschwerde an eine Aufsichtsbehörde wenden, z. B. an die zuständige Aufsichtsbehörde des Bundeslands Ihres Wohnsitzes oder an die für uns als verantwortliche Stelle zuständige Behörde.
Wie viele andere Webseiten verwenden wir auch so genannte „Cookies“. Bei Cookies handelt es sich um kleine Textdateien, die auf Ihrem Endgerät (Laptop, Tablet, Smartphone o.ä.) gespeichert werden, wenn Sie unsere Webseite besuchen.
42 |
Sie können Sie einzelne Cookies oder den gesamten Cookie-Bestand löschen. Darüber hinaus erhalten Sie Informationen und Anleitungen, wie diese Cookies gelöscht oder deren Speicherung vorab blockiert werden können. Je nach Anbieter Ihres Browsers finden Sie die notwendigen Informationen unter den nachfolgenden Links:
Soweit Sie uns durch Ihre Browsereinstellungen oder Zustimmung die Verwendung von Cookies erlauben, können folgende Cookies auf unseren Webseiten zum Einsatz kommen:
52 |
Cookies werden ausschließlich als local storage cache verwendet. Diese Daten werden bei erneuten Besuch überschrieben und beinhalten keinerlei personenbezogene Daten.
53 |
54 |
55 |
56 |
Technisch notwendige Cookies
57 |
Art und Zweck der Verarbeitung:
58 |
Wir setzen Cookies ein, um unsere Website nutzerfreundlicher zu gestalten. Einige Elemente unserer Internetseite erfordern es, dass der aufrufende Browser auch nach einem Seitenwechsel identifiziert werden kann.
59 |
Der Zweck der Verwendung technisch notwendiger Cookies ist, die Nutzung von Websites für die Nutzer zu vereinfachen. Einige Funktionen unserer Internetseite können ohne den Einsatz von Cookies nicht angeboten werden. Für diese ist es erforderlich, dass der Browser auch nach einem Seitenwechsel wiedererkannt wird.
60 |
Für folgende Anwendungen benötigen wir Cookies:
61 |
Rechtsgrundlage und berechtigtes Interesse:
62 |
Die Verarbeitung erfolgt gemäß Art. 6 Abs. 1 lit. f DSGVO auf Basis unseres berechtigten Interesses an einer nutzerfreundlichen Gestaltung unserer Website.
63 |
Empfänger:
64 |
Empfänger der Daten sind ggf. technische Dienstleister, die für den Betrieb und die Wartung unserer Website als Auftragsverarbeiter tätig werden.
65 |
Bereitstellung vorgeschrieben oder erforderlich:
66 |
Die Bereitstellung der vorgenannten personenbezogenen Daten ist weder gesetzlich noch vertraglich vorgeschrieben. Ohne diese Daten ist jedoch der Dienst und die Funktionsfähigkeit unserer Website nicht gewährleistet. Zudem können einzelne Dienste und Services nicht verfügbar oder eingeschränkt sein.
67 |
Widerspruch
68 |
Lesen Sie dazu die Informationen über Ihr Widerspruchsrecht nach Art. 21 DSGVO weiter unten.
69 |
SSL-Verschlüsselung
70 |
Um die Sicherheit Ihrer Daten bei der Übertragung zu schützen, verwenden wir dem aktuellen Stand der Technik entsprechende Verschlüsselungsverfahren (z. B. SSL) über HTTPS.
71 |
72 |
Information über Ihr Widerspruchsrecht nach Art. 21 DSGVO
73 |
Einzelfallbezogenes Widerspruchsrecht
74 |
Sie haben das Recht, aus Gründen, die sich aus Ihrer besonderen Situation ergeben, jederzeit gegen die Verarbeitung Sie betreffender personenbezogener Daten, die aufgrund Art. 6 Abs. 1 lit. f DSGVO (Datenverarbeitung auf der Grundlage einer Interessenabwägung) erfolgt, Widerspruch einzulegen; dies gilt auch für ein auf diese Bestimmung gestütztes Profiling im Sinne von Art. 4 Nr. 4 DSGVO.
75 |
Legen Sie Widerspruch ein, werden wir Ihre personenbezogenen Daten nicht mehr verarbeiten, es sei denn, wir können zwingende schutzwürdige Gründe für die Verarbeitung nachweisen, die Ihre Interessen, Rechte und Freiheiten überwiegen, oder die Verarbeitung dient der Geltendmachung, Ausübung oder Verteidigung von Rechtsansprüchen.
76 |
Empfänger eines Widerspruchs
77 |
Lucas Vogel
78 | web (at) lucas-vogel.de
79 |
80 |
Änderung unserer Datenschutzbestimmungen
81 |
Wir behalten uns vor, diese Datenschutzerklärung anzupassen, damit sie stets den aktuellen rechtlichen Anforderungen entspricht oder um Änderungen unserer Leistungen in der Datenschutzerklärung umzusetzen, z.B. bei der Einführung neuer Services. Für Ihren erneuten Besuch gilt dann die neue Datenschutzerklärung.
82 |
Fragen an den Datenschutzbeauftragten
83 |
Wenn Sie Fragen zum Datenschutz haben, schreiben Sie uns bitte eine E-Mail oder wenden Sie sich direkt an die für den Datenschutz verantwortliche Person in unserer Organisation:
84 |
Die Datenschutzerklärung wurde mithilfe der activeMind AG erstellt, den Experten für externe Datenschutzbeauftragte (Version #2020-09-30).
Diese Open Source Anwendung ist dafür gedacht, schnell Informationen über umliegende Haltestellen in Dresden
139 | abzufragen - ohne Nutzereingabe!
140 |
Hinweis: Dies ist KEINE offizielle Anwendung der Dresdner Verkehrsbetriebe oder der VVO.
141 | Der Quellcode ist öffentlich auf GitHub einsehbar.
142 | Keinerlei Daten werden erhoben: Alle Daten liegen auf den GitHub-Servern, und die Schnittstelle der VVO wird
143 | ohne Proxy angesprochen. Die Positionsdaten werden ausschließlich lokal verarbeitet.
144 |
145 | Alle Angaben sind ohne Gewähr.
146 |
147 |
148 |
149 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
Installationsanleitung
159 |
Die Webseite muss nach Plattform unterschiedlich installiert werden.
160 | iOS
161 |
162 |
Die Webseite in Safari Öffnen
163 |
Auf "Teilen" gehen
164 |
Nach unten scrollen, und "Zum Home-Bildschirm" auswählen
165 |
Mit "Hinzufügen" Bestätigen
166 |
167 | Android
168 |
169 |
Die Webseite in Chrome Öffnen
170 |
Menü aufrufen
171 |
"Zum Home-Bildschirm hinzufügen" auswählen
172 |
Eventuell Hinzufügen Bestätigen
173 |
174 | Eventuell direkt auf den "Installieren"-Banner klicken falls dieser auftaucht (siehe Chrome Updates)
176 |
177 |
264 |
265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 |
276 |
--------------------------------------------------------------------------------
/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "DVBFast",
3 | "short_name": "DVBFast",
4 | "lang": "de",
5 | "start_url": "/",
6 | "display": "standalone",
7 | "description": "Eine standortbasierte Abfahrtsanzeige.",
8 | "orientation": "portrait",
9 | "theme_color": "#ffc107",
10 | "background_color": "#ffc107",
11 | "icons": [
12 | {
13 | "src": "assets/images/icons/Icon-72.png",
14 | "sizes": "72x72",
15 | "type": "image/png"
16 | },
17 | {
18 | "src": "assets/images/icons/Icon-96.png",
19 | "sizes": "96x96",
20 | "type": "image/png"
21 | },
22 | {
23 | "src": "assets/images/icons/Icon-128.png",
24 | "sizes": "128x128",
25 | "type": "image/png"
26 | },
27 | {
28 | "src": "assets/images/icons/Icon-144.png",
29 | "sizes": "144x144",
30 | "type": "image/png"
31 | },
32 | {
33 | "src": "assets/images/icons/Icon-152.png",
34 | "sizes": "152x152",
35 | "type": "image/png"
36 | },
37 | {
38 | "src": "assets/images/icons/Icon-192.png",
39 | "sizes": "192x192",
40 | "type": "image/png"
41 | },
42 | {
43 | "src": "assets/images/icons/Icon-384.png",
44 | "sizes": "384x384",
45 | "type": "image/png"
46 | },
47 | {
48 | "src": "assets/images/icons/Icon-512.png",
49 | "sizes": "512x512",
50 | "type": "image/png"
51 | }
52 | ]
53 | }
--------------------------------------------------------------------------------
/other/linkpreview.afdesign:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lucasvog/dvbfast/f0d070a3e580a2d8594258238c8a2e9be4a0ca15/other/linkpreview.afdesign
--------------------------------------------------------------------------------
/other/logo.afdesign:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lucasvog/dvbfast/f0d070a3e580a2d8594258238c8a2e9be4a0ca15/other/logo.afdesign
--------------------------------------------------------------------------------
/other/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lucasvog/dvbfast/f0d070a3e580a2d8594258238c8a2e9be4a0ca15/other/logo.png
--------------------------------------------------------------------------------
/service-worker.js:
--------------------------------------------------------------------------------
1 | // this.addEventListener('install', function(event) {
2 | // event.waitUntil(
3 | // caches.open('v2').then(function(cache) {
4 | // return cache.addAll([
5 | // '/assets/css/style.css',
6 | // '/assets/js/data.js',
7 | // '/assets/js/script.js',
8 | // '/index.html',
9 | // '/assets/fonts/material-design-icons/font/MaterialIcons-Regular.ttf',
10 | // '/assets/frameworks/materialize/css/materialize.min.css',
11 | // '/assets/frameworks/materialize/js/materialize.min.js',
12 | // ]);
13 | // })
14 | // );
15 | // });
16 |
17 |
18 | // self.addEventListener('fetch', function(event) {
19 | // event.respondWith(
20 | // caches.match(event.request).then(function(response) {
21 | // return response || fetch(event.request);
22 | // })
23 | // );
24 | // });
25 |
--------------------------------------------------------------------------------
/src/DVBHandler.ts:
--------------------------------------------------------------------------------
1 |
2 | const departureEndpoint:string = 'https://webapi.vvo-online.de/dm';
3 |
4 | interface DepartureContainer {
5 | Departures: Departure[],
6 | ExpirationTime: string,
7 | Name: string,
8 | Place: string,
9 | Status: { Code: string },
10 |
11 | }
12 | /**
13 | * Not a full interface, but the relevant data from each departure
14 | */
15 | interface Departure {
16 | Direction: string,
17 | LineName: string,
18 | Mot: string,
19 | Platform?: { Name: string, Type: string },
20 | RealTime: string,
21 | ScheduledTime: string,
22 | State: string
23 | }
24 |
25 | /**
26 | * Finds the next departures from a given station
27 | * @param station an element from the stations json
28 | */
29 | async function getDeparturesOfStation(station: rawDataStationElement): Promise {
30 | return new Promise(async (resolve, reject) => {
31 | const stationNumber = station.num;
32 | try {
33 | const departures: DepartureContainer = await post(departureEndpoint, { stopid: stationNumber, lim: 5 })
34 | resolve(departures);
35 | } catch (e) {
36 | showPush("Fehler beim Abfragen der Informationen über eine Station.")
37 | reject(e);
38 | }
39 |
40 | });
41 | }
42 |
--------------------------------------------------------------------------------
/src/dataHandler.ts:
--------------------------------------------------------------------------------
1 | interface dataElement{
2 | na: string,
3 | num: string,
4 | lat: string,
5 | lon: string,
6 | l: string,
7 | distance?:number
8 | }
9 |
10 | let data:dataElement[] = []
11 |
12 | /**
13 | * asynchtonously fetches local storage, if necessary, fills and updates it
14 | */
15 | async function initStationsData(){
16 | return new Promise(async (resolve,reject)=>{
17 | let localData:dataElement[] = readStorage("data",true);
18 | if(localData==undefined||localData==null){
19 | const cacheResult = await asynchronouslyUpdateCache();
20 | resolve(cacheResult);
21 | return;
22 | }else{
23 | data = localData;
24 | asynchronouslyUpdateCache(); //without await, processing in the background
25 | resolve(true);
26 | return;
27 | }
28 | })
29 | }
30 |
31 |
32 | /**
33 | * asynchronously fetches json of stations
34 | */
35 | async function asynchronouslyUpdateCache() {
36 | return new Promise(async (resolve,reject)=>{
37 | let thisData:dataElement[] = await get("./assets/data/data.json");
38 | if(thisData==undefined||thisData==null){
39 | showPush("Es ist ein Fehler beim Laden der Haltestellen aufgetreten.");
40 | resolve(false);
41 | return;
42 | }
43 | data = thisData;
44 | setStorage("data",thisData,true);
45 | resolve(true);
46 | return;
47 | })
48 | }
49 |
50 | /**
51 | * sets item to local storage
52 | * @param key key of storage item
53 | * @param value value of storage item
54 | * @param isJSON if value is json, the value will be stringified
55 | */
56 | function setStorage(key:string,value:any,isJSON=false){
57 | if(isJSON){
58 | value = JSON.stringify(value);
59 | }
60 | localStorage.setItem(key, value);
61 | }
62 |
63 | /**
64 | * gets an item from local storage
65 | * @param key key of item
66 | * @param isJSON if value is json, the value will be parsed
67 | */
68 | function readStorage(key:string,isJSON=false):any{
69 | try{
70 | let value = localStorage.getItem(key);
71 | if(isJSON==true){
72 | value = JSON.parse(value);
73 | }
74 | return value;
75 | }catch(e){
76 | return null;
77 | }
78 | }
--------------------------------------------------------------------------------
/src/distanceHandler.ts:
--------------------------------------------------------------------------------
1 |
2 |
3 | /**
4 | * Finds the closest stations to a radius in km
5 | * @param {float} lat1 Latitude in decimal degrees
6 | * @param {float} long1 Longitude in decimal degrees
7 | * @param {number} radius in km to search
8 | */
9 | function findCloseStations(lat1: number, long1: number, radius = 0.4): rawDataStationElement[] {
10 | let results: rawDataStationElement[] = [];
11 | for (const elementKey in data) {
12 |
13 | let element = data[elementKey];
14 | const distance = findDistance(lat1, long1, parseFloat(element.lat), parseFloat(element.lon));
15 | if (distance < radius) {
16 | element.distance = distance;
17 | results.push(element);
18 | }
19 | }
20 | const sortedResults = sortLocationsByDistance(results);
21 | return sortedResults;
22 | }
23 |
24 |
25 | /**
26 | * Sorts an Array of stations by distance
27 | * @param {array} elements Array of station elements. Needs "distance" attribute per object in List
28 | */
29 | function sortLocationsByDistance(elements: rawDataStationElement[]) {
30 | try {
31 | let returnElements = elements.sort(function (a, b) { return a.distance - b.distance });
32 | return returnElements;
33 | } catch (e) {
34 | return elements;
35 | }
36 | }
37 |
38 |
39 | const Rk = 6373; // the earths radius in km at ca 39 degrees from the equator. Wikipedia says otherwise.
40 |
41 | /**
42 | * Finds the distance between two points in decimal degree format
43 | * @param {*} latitude1 Latitude of first point
44 | * @param {*} longitude1 Longitude of first point
45 | * @param {*} latitude2 Latitude of second point
46 | * @param {*} longitude2 Longitude of second point
47 | * @returns Distance in KM
48 | */
49 | function findDistance(latitude1: number, longitude1: number, latitude2: number, longitude2: number) {
50 | // convert coordinates to rad
51 | const lat1 = degree2rad(latitude1);
52 | const lon1 = degree2rad(longitude1);
53 | const lat2 = degree2rad(latitude2);
54 | const lon2 = degree2rad(longitude2);
55 |
56 | // get differences
57 | const dlat = lat2 - lat1;
58 | const dlon = lon2 - lon1;
59 |
60 | //using the Haversine Formula to calculate distances on a round surface. Works well on short distances
61 | let a = Math.pow(Math.sin(dlat / 2), 2) + Math.cos(lat1) * Math.cos(lat2) * Math.pow(Math.sin(dlon / 2), 2);
62 | let c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); // great circle distance in rad
63 | let dk = c * Rk; // great circle distance in km
64 | return dk;
65 | }
66 |
67 |
68 | /**
69 | * convert degrees to radians
70 | * @param deg Degree
71 | * @returns radiant
72 | */
73 | function degree2rad(deg: number) {
74 | const rad = deg * Math.PI / 180; // radians = degrees * pi/180
75 | return rad;
76 | }
77 |
--------------------------------------------------------------------------------
/src/general.ts:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | * Entry point, inits Materialize CSS and first round of Data
4 | */
5 | async function init() {
6 | setAutoRefreshSwitchState("off")
7 | //@ts-ignore
8 | M.AutoInit();
9 | await initStationsData();
10 | initSearch();
11 | await initData();
12 | setAutoRefreshSwitchState("on");
13 | initialLoad = false;
14 | }
15 | init();
16 |
17 | //"cache" of close Stations.
18 | let closeStations: rawDataStationElement[] = [];
19 |
20 | /**
21 | * inits all data, by retrieving the closest stations and updating the HTML of the document
22 | */
23 | async function initData(): Promise {
24 | return new Promise(async (resolve, reject) => {
25 | closeStations = await getCloseStations()
26 | await updateHTMLWithDepartures();
27 | resolve(true);
28 | });
29 | }
30 |
31 | /**
32 | * Get the closest Stations. No parameter required. Retrieves the GPS-Data itself by calling getPosition();
33 | */
34 | async function getCloseStations(): Promise {
35 | return new Promise(async (resolve, reject) => {
36 | let position: any = null;
37 | try {
38 | position = await getPosition();
39 | } catch (e) {
40 | console.log(e);
41 | if(e.code==1){
42 | showPush("Fehler: Berechtigung nicht erteilt. Bitte lassen Sie die Standorterkennung zu, damit Stationen in der Nähe erkannt werden können. ", 10000);
43 | return;
44 | }
45 | if(e.code==2){
46 | showPush("Fehler: Positionserkennung aktuell nicht verfügbar.", 10000);
47 | return;
48 | }
49 | if(e.code!==3){
50 | showPush("Fehler: "+e.code, 5000);
51 | }
52 |
53 | return;
54 | }
55 | if (position == null) {
56 | showPush("Standort kann nicht bestimmt werden.");
57 | return;
58 | }
59 | const closeStations: rawDataStationElement[] = findCloseStations(position.coords.latitude, position.coords.longitude);
60 | //const closeStations:rawDataStationElement[] = findCloseStations(51.053533, 13.816152); //Seilbahnen testen
61 | //const closeStations:rawDataStationElement[] = findCloseStations(51.039867, 13.733739); Hauptbahnhof
62 | if (closeStations == undefined || closeStations == null) {
63 | showPush("Stationen in der konntent nicht gefunden werden.");
64 | return;
65 | }
66 | if (closeStations.length <= 0) {
67 | showPush("Keine Stationen in dem Radius gefunden.");
68 | return;
69 | }
70 | resolve(closeStations);
71 | });
72 | }
73 |
74 | /**
75 | * Updates the HTML with the departures boxes
76 | */
77 | async function updateHTMLWithDepartures() {
78 | return new Promise(async (resolve, reject) => {
79 | let html = "";
80 | for (const station of closeStations) {
81 | const departures = await getDeparturesOfStation(station);
82 | if (departures == undefined || departures == null) {
83 | showPush("Fehler beim Laden der nächsten Verbindungen.");
84 | resolve(false);
85 | return;
86 | }
87 | html += generateBox(station, departures);
88 |
89 | }
90 | let target = document.getElementById("boxcontainer");
91 | if (target == null) {
92 | showPush("Interner Fehler.");
93 | resolve(false);
94 | return;
95 | }
96 | target.innerHTML = html;
97 | resolve(true);
98 | });
99 | }
100 |
101 | /**
102 | * Shows a notofication
103 | * @param message Message to display as push notification
104 | */
105 | function showPush(message: string, displayLength = 4000) {
106 | //@ts-ignore
107 | M.toast({ html: message, displayLength: displayLength })
108 | }
--------------------------------------------------------------------------------
/src/generators.ts:
--------------------------------------------------------------------------------
1 | const departureLimit:number = 6;
2 |
3 | /**
4 | * Generates the HTML for a station including the departures
5 | * @param station station for the box
6 | * @param departuresContainer departure-element from the VVO API
7 | * @param isSearchResult if this is a search result, some data will be shown different
8 | * @returns HTML
9 | */
10 | function generateBox(station: rawDataStationElement, departuresContainer: DepartureContainer,isSearchResult=false): string {
11 | const title = generateTitleHTML(station,isSearchResult);
12 | let departuresHTML = "";
13 | let departures = departuresContainer.Departures;
14 | let thisDepartureLimit = 0;
15 | let moreDeparturesHTML ="";
16 | console.log(departuresContainer);
17 | if(departures===undefined){
18 | return "";
19 | }
20 | for (const departure of departures) {
21 | if (thisDepartureLimit < departureLimit) {
22 | departuresHTML += generateDepartureHTML(departure);
23 | }else{
24 | moreDeparturesHTML+=generateDepartureHTML(departure);
25 | }
26 | thisDepartureLimit += 1;
27 | }
28 | let html = `
29 |
30 |
31 | ${title}
32 | ${departuresHTML}
33 |
34 |
`
35 | return html;
36 | }
37 |
38 |
39 | /**
40 | * Generates the title HTML of a station
41 | * @param station station to generate html from
42 | * @param isSearchResult if this is a search result
43 | * @returns html
44 | */
45 | function generateTitleHTML(station: rawDataStationElement,isSearchResult=false) {
46 | const title = station.na;
47 | const distance = generateDistanceString(station.distance) || "unbekannt";
48 |
49 | let html = `
50 |