-
Notifications
You must be signed in to change notification settings - Fork 7
/
jquery.vvsstation.settings.ts
143 lines (128 loc) · 3.77 KB
/
jquery.vvsstation.settings.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
/// <reference path="class.vvs.settings.ts" />
'use strict';
class VVSStationDefaultSettings extends VVSDefaultSettings {
/**
* Station id number
* @type {number}
*/
station: number;
/**
* Uptime time (in minutes)
* @type {number}
*/
updateTime: number = 60 * 1000;
/**
* Use of local cache (if possible)
* @type {boolean}
*/
localCache: boolean = true;
/**
* Enable time toggle (in seconds)
*
* Toggles time between realtive and absolute time
*
* @type {number}
*/
timeToggle: number = 0;
/**
* Intelligent time threshold to switch from minutes to absolute time (in minutes)
* @type {number}
*/
intelligentTimeThreshold: number = 60;
/**
* Loading indicator (in html)
* @type {string}
*/
loadingIndicator: string = '<div class="loader"><svg class="circular" viewBox="25 25 50 50"><circle class="path" cx="50" cy="50" r="20" fill="none" stroke-width="10" stroke-miterlimit="10"/></svg></div>';
/**
* Type for showing departure times
*
* relative: in minutes
* absolute: show time
* intelligent: based on intelligentTimeThreshold show relative and absolute times
* @type {string}
*/
departureType: string = 'relative';
/**
* Ajax handling url
* @type {string}
*/
requestUrl: string = 'https://efa-api.asw.io/api/v1/station/{station}/departures/';
/**
* Translation array
*
* @type {{noData: string; minute: string; from: string}}
*/
translations: any = {
noData: 'Keine Abfahrtszeiten vorhanden',
minute: 'min',
from: 'ab',
departureCanceld: 'Zug fällt aus'
};
/**
* Main template (in html)
*
* @type {string}
*/
templateMain: string = `
<div class="sticky"><h3>{{title}}<i class="departure-minimum-desc">{{departureTitle}}</i></h3></div>
{{&content}}
`;
/**
* Title template (in html)
*
* @type {string}
*/
templateTitle: string = `{{stationName}}`;
/**
* Template for the timetable (in html)
*
* @type {string}
*/
templateTimetable: string = `
<ul class="">
{{#timetable}}
<li class="{{line.delayClass}}">
<div class="overall-box">
<div class="departure-box">
<div class="line-symbol" data-line="{{line.numberType}}" data-line="{{line.number}}">{{line.number}}</div>
<div class="direction">{{line.direction}}</div>
</div>
<div class="time-box">
<div class="label label-danger delay" data-delay="{{delay.type}}">{{delay.value}}</div>
<div class="departure" data-departure-type="{{departure.type}}">
<span class="time absolute">{{&departure.absolute}}</span>
<span class="time relative">{{&departure.relative}}</span>
</div>
</div>
</div>
</li>
{{/timetable}}
</ul>
`;
/**
* Template if there is no schedule data (in html)
* @type {string}
*/
templateNoData: string = '<div class="alert alert-warning" role="alert">{{settings.translations.noData}}</div>';
/**
* Array with different delay classes
* @type {Array}
*/
delayClasses: Array<any> = [{
delay: -1,
className: 'info'
},{
delay: 1,
className: 'warning'
},{
delay: 3,
className: 'danger'
},{
delay: 9999,
className: 'danger canceled'
},{
delay: -9999,
className: 'danger canceled'
}];
}