forked from opening-hours/opening_hours.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
259 lines (244 loc) · 16.5 KB
/
index.html
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
<!DOCTYPE html>
<html>
<head><!-- {{{ -->
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<meta name="referrer" content="no-referrer">
<meta name="viewport" content="width=device-width">
<title>opening_hours evaluation tool</title>
<link rel="icon" type="image/png" href="img/favicon.png">
<link rel="stylesheet" href="css/main.css"/>
<link rel="stylesheet" href="css/table.css"/>
<!-- Javascript {{{ -->
<script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha384-rY/jv8mMhqDabXSo+UCggqKtdmBfd3qC2/KvyTDNQ6PcUJXaxK1tMepoQda4g5vB" crossorigin="anonymous"></script>
<script src="opening_hours+deps.min.js"></script>
<script src="node_modules/i18next-client/i18next.min.js"></script>
<script src="node_modules/moment/min/moment-with-locales.min.js"></script>
<script src="js/i18n-resources.js"></script>
<script src="js/opening_hours_table.js"></script>
<script src="js/helpers.js"></script>
<script src="js/countryToLanguageMapping.js"></script>
<script>
var YoHours = function() {};
// Needed by YoHours modul.js
</script>
<script src="js/yohours_model.js"></script>
<script>
var YoHoursChecker = new YoHoursChecker();
if (document.title !== i18n.t('texts.title')) {
document.title = i18n.t('texts.title');
}
// default values {{{
var default_lat = 48.7769;
var default_lon = 9.1844;
var repo_url = 'https://github.com/opening-hours/opening_hours.js';
var specification_url = 'https://wiki.openstreetmap.org/wiki/'
+ (i18n.lng() === 'de' ? 'DE:' : '')
+ 'Key:opening_hours/specification';
// }}}
</script>
<!-- }}} -->
</head> <!-- }}} -->
<body><!-- {{{ -->
<noscript>You don‘t have JavaScript enabled and that is a good thing but this tool makes heavy use of JavaScript so you need to enable it in order to use this tool. If you don’t trust the code that is going to be executed that is good as well. I encourage you to read all the source code on <a href="https://github.com/opening-hours/opening_hours.js">GitHub</a>. Also note that every commit and all releases are GPG signed. You might want to check this out as well :) Stay safe.</noscript>
<script>
document.write('<h1>' + i18n.t('texts.title') + '</h1>');
document.write(getUserSelectTranslateHTMLCode());
</script>
<div id="user"><!-- {{{ -->
<form id="check" action="#">
<!-- User input {{{ -->
<p>
<script>
document.write('<span class="hd">' + i18n.t('words.date') + ' ' + i18n.t('words.and') + ' ' + i18n.t('words.time.time') + ':</span>');
document.write('<input type="number" step="1" min="1" max="31" id="dd" size="3" name="dd" value="02" onblur="Evaluate()"/>.');
document.write('<select id="mm" name="mm" onchange="Evaluate()">');
for (var i = 0; i < moment.monthsShort().length; i++) {
document.write('<option value="monthNumber' + i + '">' + moment.monthsShort(i) + '</option>');
}
document.write('</select>');
</script>
<input type="number" step="1" class="input__year" id="yyyy" name="yyyy" value="2013" onblur="Evaluate()" />
 
<input type="number" step="1" min="0" max="23" name="HH" value="22" onblur="Evaluate()" />:<input type="number" step="1" min="0" max="59" name="MM" value="21" onblur="Evaluate()" />
 
<input size="10" name="wday" readonly="readonly" />
<input size="3" name="week" readonly="readonly" />
</p>
<p><script>
var buttons = [
[ 3600 * 24 * 365, 1, 'words.time.year' ],
[ 3600 * 24 , 1, 'words.time.day' ],
[ 3600 , 1, 'words.time.hour' ],
[ 60 , 1, 'words.time.minute' ],
[ 0 , 0, 'words.time.now' ],
];
for (var i = 0; i < buttons.length; i++) {
if (buttons[i][1] !== 0) {
for (var x = -1; x <= 1; x += 2) {
var step = x * buttons[i][1]
document.write('<button type="button" onclick="Evaluate(' + buttons[i][0] * step
+ ')">' + (step > 0 ? '+' : '') + step + ' ' + i18n.t(buttons[i][2]) + '</button>'
+ (x === 1 ? ' ' : ''));
}
} else {
document.write('<button type="button" onclick="Evaluate(0, true'
+ ')">' + i18n.t(buttons[i][2]) + '</button>');
}
}
</script>
</p>
<p>
<script>
document.write('<span class="hd">' + i18n.t('words.position') + ':</span>');
document.write(i18n.t('words.lat') + ': <input type="number" class="input__coordinate" id="lat" value="' + default_lat + '" onblur="Evaluate()" /> ');
document.write(i18n.t('words.lon') + ': <input type="number" class="input__coordinate" id="lon" value="' + default_lon + '" onblur="Evaluate()" /> ');
document.write(i18n.t('words.country') + ': <input size="3" id="cc" readonly="readonly" /> ');
document.write(i18n.t('words.state') + ': <input size="20" id="state" readonly="readonly" /><br />');
// document.write('<button type="button" onclick="setCurrentPosition()">' + i18n.t('texts.get my position') + '</button>');
</script>
</p>
<p>
<script>
document.write('<span class="hd">' + i18n.t('words.mode') + ': </span><select id="mode" name="mode" onchange="Evaluate()" style="max-width:100%;">');
for (var i = 0; i <= 2; i++) {
document.write('<option value="' + i + '">' + i18n.t('texts.mode ' + i) + '</option>');
}
document.write('</select>');
</script>
</p>
<div id="permalink" class="permalink">
<a href="#" onclick="permalink();return false">permalink</a>,
</div>
<p>
<script>
document.write('<span class="hd">' + i18n.t('texts.value for') + ' <q>opening_hours</q>:'
+ '</span>');
</script>
<input id="expression"
onKeyUp="return submitenter(this,event)"
name="expression"
value="Mo-Fr 10:00-20:00; PH off"
onblur="Evaluate()"
/>
<script>
document.write('<span class="hd">' + i18n.t('texts.value to compare') + ':</span>');
</script>
<input
id="diff_value"
type="text"
onKeyUp="return submitenter(this,event)"
onblur="Evaluate()"
/>
</p>
<!-- }}} -->
<div id="show_warnings_or_errors">
</div>
<div id="show_time_table">
</div>
<div id="show_results">
</div>
</form>
<hr /><!-- Examples {{{ -->
<script>document.write('<a href="javascript:toggle(\'user_examples\')"><h2 id="examples">'
+ i18n.t('words.examples') + ':</h2></a>');
</script>
<div id="user_examples"><!-- {{{ -->
<ol>
<li><a href="#check" onclick="EX(this)">Mo-Fr 10:00-20:00; PH off</a></li>
<li><a href="#check" onclick="EX(this)">Mo,Tu,Th,Fr 12:00-18:00; Sa,PH 12:00-17:00; Th[3],Th[-1] off</a></li>
<li><a href="#check" onclick="EX(this)">00:00-24:00; Tu-Su,PH 08:30-09:00 off; Tu-Su 14:00-14:30 off; Mo 08:00-13:00 off</a></li>
<li><a href="#check" onclick="EX(this)">Fr-Sa 18:00-06:00; PH off</a></li>
<li><a href="#check" onclick="EX(this)">Mo 10:00-12:00,12:30-15:00</a></li>
<li><a href="#check" onclick="EX(this)">Mo 10:00-12:00,12:30-15:00; Tu-Fr 08:00-12:00,12:30-15:00; Sa 08:00-12:00</a></li>
<li><a href="#check" onclick="EX(this)">24/7</a></li>
<li><a href="#check" onclick="EX(this)">"only after registration"; PH off</a></li>
<li><a href="#check" onclick="EX(this)">22:00-23:00; PH off</a></li>
<li><a href="#check" onclick="EX(this)">08:00-11:00; PH off</a></li>
<li><a href="#check" onclick="EX(this)">open; Mo 15:00-16:00 off; PH off</a></li>
<li><a href="#check" onclick="EX(this)">Mo-Su 22:00-23:00; We,PH off</a></li>
<li><a href="#check" onclick="EX(this)">We-Fr 10:00-24:00 open "it is open" || "please call"; PH off</a></li>
<li><a href="#check" onclick="EX(this)">Mo-Fr 08:00-11:00 || Tu-Th,PH open "Emergency only"</a></li>
<li><a href="#check" onclick="EX(this)">Tu-Th,We 22:00-23:00 open "Hot meals"; PH off</a></li>
<li><a href="#check" onclick="EX(this)">Mo 12:00-14:00 open "female only", Mo 14:00-16:00 open "male only"; PH off</a></li>
<li><a href="#check" onclick="EX(this)">Apr: 22:00-23:00; PH off</a></li>
<li><a href="#check" onclick="EX(this)">Jul-Jan: 22:00-23:00; PH off</a></li>
<li><a href="#check" onclick="EX(this)">Jan-Jul: 22:00-23:00; PH off</a></li>
<li><a href="#check" onclick="EX(this)">Jul 23-Jan 3: "needs reservation by phone"; PH off</a></li>
<li><a href="#check" onclick="EX(this)">Jul 23-Jan 3: 22:00-23:00 "Please make a reservation by phone."; PH off</a></li>
<li><a href="#check" onclick="EX(this)">Jul 23-Jan 3: 08:00-11:00 "Please make a reservation by phone."; PH off</a></li>
<li><a href="#check" onclick="EX(this)">Jan 23-Jul 3: 22:00-23:00 "Please make a reservation by phone."; PH off</a></li>
<li><a href="#check" onclick="EX(this)">Mar Su[-1]-Dec Su[1] -2 days: 22:00-23:00; PH off</a></li>
<!-- <li><a href="#check" onclick="EX(this)">Mar Su[-1] - Dec 25-Su-28 days: 22:00-23:00; PH off</a></li> -->
<!-- <li><a href="#check" onclick="EX(this)">Dec 25-Su-28 days - Mar Su[-1]: 22:00-23:00; PH off</a></li> -->
<!-- Currently used around 6 times: /\d\s*-\s*(mo|tu|we|th|fr|sa|su)\b/ -->
<li><a href="#check" onclick="EX(this)">Sa[1],Sa[1] +1 day 10:00-12:00 open "first weekend in the month"; PH off</a></li>
<li><a href="#check" onclick="EX(this)">Sa[-1],Sa[-1] +1 day 10:00-12:00 open "last weekend in the month"; PH off</a></li>
<li><a href="#check" onclick="EX(this)">Sa-Su 00:00-24:00; PH off</a></li>
<li><a href="#check" onclick="EX(this)">Mo-Fr 00:00-24:00; PH off</a></li>
<li><a href="#check" onclick="EX(this)">sunrise-sunset open "Beware of sunburn!"; PH off</a></li>
<li><a href="#check" onclick="EX(this)">sunset-sunrise open "Beware of vampires!"; PH off</a></li>
<li><a href="#check" onclick="EX(this)">(sunset+01:00)-24:00 || closed "No drink before sunset!"; PH off</a></li>
<li><a href="#check" onclick="EX(this)">22:00+; PH off</a></li>
<!-- <li><a href="#check" onclick="EX(this)">-23:00; PH off</a></li> -->
<li><a href="#check" onclick="EX(this)">Tu,PH 23:59-22:59</a></li>
<li><a href="#check" onclick="EX(this)">We-Mo,PH 23:59-22:59</a></li>
<li><a href="#check" onclick="EX(this)">week 2-52/2 We 00:00-24:00; week 1-53/2 Sa 00:00-24:00; PH off</a></li>
<li><a href="#check" onclick="EX(this)">week 4-16 We 00:00-24:00; week 38-42 Sa 00:00-24:00; PH off</a></li>
<li><a href="#check" onclick="EX(this)">2012 easter -2 days-2012 easter +2 days: open "Around easter"; PH off</a></li>
<li><a href="#check" onclick="EX(this)">24/7 closed "always closed"</a></li>
<li>
<a href="#check" onclick="EX(this)">2013,2015,2050-2053,2055/2,2020-2029/3,2060+ Jan 1</a>,
<script>
document.write('<a href="' + repo_url + '/tree/master#year-ranges" target="_blank">' + i18n.t('words.docu') + '</a>');
</script>
</li>
<li><a href="#check" onclick="EX(this)">Jan 23-Feb 11,Feb 12 00:00-24:00; PH off</a></li>
<li><a href="#check" onclick="EX(this)">Apr-Oct Su[2] 14:00-18:00; Aug Su[-1] -1 day 10:00-18:00; Aug Su[-1] 10:00-18:00; PH off</a></li>
<li><a href="#check" onclick="EX(this)">Mo-Fr 08:00-12:00, We 14:00-18:00; Su,PH off</a></li>
<li><a href="#check" onclick="EX(this)">00:00-24:00 week 6 Mo-Su Feb; PH off</a>,
<script>
document.write('(' + i18n.t('texts.check out error correction, prettify') + ')');
</script>
</li>
<li><a href="#check" onclick="EX(this)"> monday, Tu, wE, TH 12:00 - 20:00 ; 14:00-16:00 Off ; closed public Holiday</a>,
<script>
document.write('(' + i18n.t('texts.check out error correction, prettify') + ')');
</script>
</li>
</ol>
<ol>
<li><a href="#check" onclick="EX(this)">We; PH off</a></li>
<li><a href="#check" onclick="EX(this)">PH</a></li>
<li><a href="#check" onclick="EX(this)">PH Mo-Fr</a>
<script>
document.write('(' + i18n.t('texts.if PH is between Mo and Fr') + ')');
</script>
</li>
<li><a href="#check" onclick="EX(this)">PH -1 day</a></li>
<li><a href="#check" onclick="EX(this)">SH</a></li>
<li><a href="#check" onclick="EX(this)">SH,PH</a></li>
<li><a href="#check" onclick="EX(this)">PH,SH</a>
<script>
document.write('(' + i18n.t('texts.SH,PH or PH,SH') + ')');
</script>
</li>
<li><a href="#check" onclick="EX(this)">We[1-3]</a></li>
<li><a href="#check" onclick="EX(this)">We[3-5]</a></li>
<li><a href="#check" onclick="EX(this)">Sa</a></li>
<li><a href="#check" onclick="EX(this)">Sa[1]</a></li>
<li><a href="#check" onclick="EX(this)">Sa[1-3]</a></li>
<li><a href="#check" onclick="EX(this)">Tu-Th</a></li>
<li><a href="#check" onclick="EX(this)">Fr-Mo</a></li>
<li><a href="#check" onclick="EX(this)">Mo-Su; We "only after registration"</a></li>
<li><a href="#check" onclick="EX(this)">Oct: We[1]</a></li>
</ol> <!-- }}} -->
</div><!-- }}} -->
<script>
document.write(i18n.t('texts.more information',
{ href: 'href="https://wiki.openstreetmap.org/wiki/Key:opening_hours" target="_blank"' }) + '<br />');
document.write(i18n.t('texts.this website', { url: repo_url, hoster: 'GitHub' }));
</script>
</div><!-- }}} -->
<iframe style="visibility:hidden;display:none" name='hiddenframe'></iframe>
</body><!-- }}} -->
</html>