-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerator-en.html
745 lines (745 loc) · 40.9 KB
/
generator-en.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
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>World Clock Widget Generator</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/element-ui/2.15.14/theme-chalk/index.min.css" integrity="sha512-cTraKrkPq3y0mm73JlMTDOugmX/NwJ/WCitAFxMdS/l+P/qMIUzGkbg3oCx9e8suEU2rurxP+5aIidz0ZjKdpw==" crossorigin="anonymous" referrerpolicy="no-referrer">
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.7.14/vue.min.js" integrity="sha512-BAMfk70VjqBkBIyo9UTRLl3TBJ3M0c6uyy2VMUrq370bWs7kchLNN9j1WiJQus9JAJVqcriIUX859JOm12LWtw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/element-ui/2.15.14/index.min.js" integrity="sha512-UFrGse168I/Fki88TZky6wKSHCJykXJBpzmqwBzbIHzsadjMPpch2HULCuAQLewK19bXUf8PqkEjGSWPiUJ3qQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<style>
body{
font-family: sans-serif;
text-align: center;
vertical-align: middle;
overflow-y: scroll;
}
table thead{
height: 30px;
background-color: #333333;
color: #ffffff;
}
table thead a{
color: #ffffff;
}
tbody tr:hover{
background-color: #dadada;
}
.el-input__inner{
padding: 3px;
}
.el-tabs{
width: 605px;
display: inline-block;
}
.el-row{
text-align: right;
min-height: 45px;
}
.el-col>div.el-slider{
display: inline-block;
width: 120px;
padding: 0 12px;
}
.el-col-8>div.el-select, .el-col-24>div.el-select{
width: 70px;
}
.el-col-12>div.el-select{
width: 150px;
}
.el-col-16>div.el-input{
width: 250px;
}
.el-col>div.el-input-number{
width: 120px;
}
.el-color-dropdown__link-btn{
display: none;
}
.el-color-dropdown__btn span::before{
content: "OK";
font-size: 12px;
}
.el-color-dropdown__btn span{
font-size: 0px;
}
.el-tab-pane p, .el-tab-pane h2{
text-align: justify;
}
h2{
margin: 10px;
}
p{
margin: 5px;
}
#previewBox{
display: inline-block;
vertical-align: top;
width: 560px;
}
#preview{
background-image: url(bg.png);
padding: 10px;
}
#saveButton{
margin: 15px;
}
</style>
</head>
<body>
<div id="vue">
<el-tabs value="about">
<el-tab-pane label="Timezone List" name="tzlist">
<table>
<thead>
<td>Index</td>
<td style="min-width:200px"><a href="https://data.iana.org/time-zones/tzdb/zone1970.tab" title="Choose the standard IANA timezones in the link." target="_blank">IANA Timezone</a></td>
<td style="min-width:200px">Showing Location Name</td>
<td style="min-width:140px">Operations</td>
</thead>
<tbody id="tableContent">
<tr v-for="(t, index) in timezoneList" :key="index">
<td>{{index}}</td>
<td>{{t.ianaTimezone}}</td>
<td>{{t.showLocation}}</td>
<td>
<el-button-group>
<el-button type="warning" icon="el-icon-edit" circle size="mini" title="Edit" @click="editMe(index)"></el-button>
<el-button type="success" icon="el-icon-plus" circle size="mini" title="Add" @click="addMe(index)"></el-button>
<el-button type="primary" icon="el-icon-top" circle size="mini" title="Move Up" @click="moveUp(index)"></el-button>
<el-button type="primary" icon="el-icon-bottom" circle size="mini" title="Move Down" @click="moveDown(index)"></el-button>
<el-button type="danger" icon="el-icon-delete" circle size="mini" title="Delete" @click="deleteMe(index)"></el-button>
</el-button-group>
</td>
</tr>
</tbody>
</table>
</el-tab-pane>
<el-tab-pane label="Other settings" name="color">
<h2>Date & Time Format</h2>
<el-row>
<el-col :span="12">Time format:
<el-select size="mini" v-model="timeFormat">
<el-option label="23:59:59" value="timeFormat1"></el-option>
<el-option label="23:59" value="timeFormat2"></el-option>
<el-option label="11:59:59 pm" value="timeFormat3"></el-option>
<el-option label="11:59 pm" value="timeFormat4"></el-option>
</el-select>
</el-col>
<el-col :span="12">Date format:
<el-select size="mini" v-model="dateFormat">
<el-option-group label="British(date, month, year)">
<el-option label="Wednesday, 31 December 2025" value="dateFormat1"></el-option>
<el-option label="Wed, 31 Dec 2025" value="dateFormat2"></el-option>
<el-option label="Wednesday, 31 December" value="dateFormat3"></el-option>
<el-option label="Wed, 31 Dec" value="dateFormat4"></el-option>
<el-option label="31 December 2025" value="dateFormat5"></el-option>
<el-option label="31 Dec" value="dateFormat6"></el-option>
<el-option label="Wednesday, 31/12/2025" value="dateFormat7"></el-option>
<el-option label="Wed, 31/12/2025" value="dateFormat8"></el-option>
<el-option label="Wed, 31/12" value="dateFormat9"></el-option>
<el-option label="31/12/2025" value="dateFormat10"></el-option>
<el-option label="31/12" value="dateFormat11"></el-option>
</el-option-group>
<el-option-group label="American(month, date, year)">
<el-option label="Wednesday, December 31, 2025" value="dateFormat12"></el-option>
<el-option label="Wed, Dec 31, 2025" value="dateFormat13"></el-option>
<el-option label="Wednesday, December 31" value="dateFormat14"></el-option>
<el-option label="Wed, Dec 31" value="dateFormat15"></el-option>
<el-option label="December 31, 2025" value="dateFormat16"></el-option>
<el-option label="Dec 31" value="dateFormat17"></el-option>
<el-option label="Wednesday, 12/31/2025" value="dateFormat18"></el-option>
<el-option label="Wed, 12/31/2025" value="dateFormat19"></el-option>
<el-option label="Wed, 12/31" value="dateFormat20"></el-option>
<el-option label="12/31/2025" value="dateFormat21"></el-option>
<el-option label="12/31" value="dateFormat22"></el-option>
</el-option-group>
</el-select>
</el-col>
</el-row>
<h2>Sizes</h2>
<el-row>
<el-col :span="12">Total width: <el-slider size="mini" v-model="totalWidth0" :show-tooltip="false"></el-slider></el-col>
<el-col :span="12">Font size for place: <el-slider size="mini" v-model="fontSizePlace0" :show-tooltip="false"></el-slider></el-slider></el-col>
</el-row>
<el-row>
<el-col :span="12">Font size for time: <el-slider size="mini" v-model="fontSizeTime0" :show-tooltip="false"></el-slider></el-slider></el-col>
<el-col :span="12">Font size for date: <el-slider size="mini" v-model="fontSizeDate0" :show-tooltip="false"></el-slider></el-slider></el-col>
</el-row>
<h2>Colors & Fonts</h2>
<el-row>
<el-col :span="8">Background color: <el-color-picker size="mini" v-model="backgroundColor" :predefine="predefineColors"></el-color-picker></el-col>
<el-col :span="8">Border color: <el-color-picker size="mini" v-model="borderColor" :predefine="predefineColors"></el-color-picker></el-col>
<el-col :span="8">Text color: <el-color-picker size="mini" v-model="textColor" :predefine="predefineColors"></el-color-picker></el-col>
</el-row>
<el-row>
<el-col :span="8">Font weight:
<el-select size="mini" v-model="fontWeight">
<el-option label="Bold" value="bold"></el-option>
<el-option label="Normal" value="normal"></el-option>
<el-option label="Light" value="lighter"></el-option>
</el-select>
</el-col>
<el-col :span="16">Font type:
<el-input size="mini" v-model="fontType"></el-input>
<el-tooltip content="Please make sure the font is installed on your computer, or simply leave it blank." placement="top-end">
<el-button icon="el-icon-warning-outline" circle size="mini"></el-button>
</el-tooltip>
</el-col>
</el-row>
<h2>Shapes & Behaviors</h2>
<el-row>
<el-col :span="8">Shadow:
<el-select size="mini" v-model="shadow">
<el-option label="On" value="true"></el-option>
<el-option label="Off" value="false"></el-option>
</el-select>
</el-col>
<el-col :span="8">Round corner:
<el-select size="mini" v-model="roundCorner">
<el-option label="On" value="true"></el-option>
<el-option label="Off" value="false"></el-option>
</el-select>
</el-col>
<el-col :span="8">Animation:
<el-select size="mini" v-model="animation">
<el-option label="On" value="true"></el-option>
<el-option label="Off" value="false"></el-option>
</el-select>
</el-col>
</el-row>
<el-row>
<el-col :span="24">Transparent background:
<el-select size="mini" v-model="transparent">
<el-option label="On" value="true"></el-option>
<el-option label="Off" value="false"></el-option>
</el-select>
</el-col>
</el-row>
<el-row>
<el-col :span="24">Location switch interval (seconds):
<el-input-number size="mini" v-model="switchTime" :min="1" :max="100000"></el-input-number>
</el-col>
</el-row>
</el-tab-pane>
<el-tab-pane label="About" name="about">
<h1>World Clock Widget Generator</h1>
<p>This webpage is used to generate the World Clock Widget, which can show local times of different places one by one, and handle Daylight Saving Time (DST) automatically.</p>
<p>This widget is suitable for live-streamers whose audiences are from all over the world.</p>
<p><a href="generator-zh.html">中文</a> <a href="generator-ja.html">日本語</a></p>
<h2>Author Information</h2>
<p>The author of this project is Yanji(颜姬).</p>
<p><a href="https://github.com/yanjisheng/world-clock" target="_blank">Github repository</a> <a href="https://space.bilibili.com/31719231" target="_blank">BiliBili</a> <a href="https://twitter.com/yanji_channel" target="_blank">Twitter</a></p>
<h2>How to Use</h2>
<p>1. Go to the first tab panel, and choose timezones which you need to show on your widget. Edit every item's displaying name, delete items you don't need, arrange the sort, or add items if necessary. Remember to use the <a href="https://data.iana.org/time-zones/tzdb/zone1970.tab" target="_blank">standard IANA timezones</a>, otherwise an error would occur.</p>
<p>2. Go to the second tab panel, and adjust the sizes, colors, fonts, date and time formats, and other settings you need. You can see the preview on the right, or on the bottom if your browser window is narrow.</p>
<p>3. When you finish adjusting, click the "Save" button below the preview window, and save the exported "worldclock.html" file. You can edit this file to achieve more complicated functions if you understand HTML, CSS and Javascript.</p>
<p>4. Finally, in your OBS Studio, add "source" - "browser", choose "local file", and find the file exported above.</p>
<h2>License</h2>
<p>This project is issued under MIT license.</p>
</el-tab-pane>
</el-tabs>
<div id="previewBox">
<h2>Preview</h2>
<div id="preview">
<div :style="previewStyle">
<div id="place" :style="locationStyle">{{locationPreview}}</div>
<div id="time" :style="timeStyle">{{timeFormatPreview}}</div>
<div id="date" :style="dateStyle">{{dateFormatPreview}}</div>
</div>
</div>
<el-button id="saveButton" @click="exportFile()">Save</el-button>
</div>
</div>
<script>
function editLine(option, text1, text2){
return '<tr><td></td><td><div class="el-input el-input--mini">'
+'<input class="el-input__inner" value="'+text1+'" type="text" autocomplete="off" id="input1"></div></td>'
+'<td><div class="el-input el-input--mini">'
+'<input class="el-input__inner" value="'+text2+'" type="text" autocomplete="off" id="input2"></div></td>'
+'<td><div class="el-button-group">'
+'<button class="el-button el-button--success el-button--mini is-circle" type="button" title="Done" onclick="vue.'+option+'Done()"><i class="el-icon-check"></i></button>'
+'<button class="el-button el-button--danger el-button--mini is-circle" type="button" title="Cancel" onclick="vue.'+option+'Cancel()"><i class="el-icon-close"></i></button></div></td></tr>';
}
function tableLine(rowNo, text1, text2){
return '<td>'+rowNo+'</td><td>'+text1+'</td><td>'+text2+'</td><td><div class="el-button-group">'
+'<button class="el-button el-button--warning el-button--mini is-circle" type="button" title="Edit" onclick="vue.editMe('+rowNo+')"><i class="el-icon-edit"></i></button>'
+'<button class="el-button el-button--success el-button--mini is-circle" type="button" title="Add" onclick="vue.addMe('+rowNo+')"><i class="el-icon-plus"></i></button>'
+'<button class="el-button el-button--primary el-button--mini is-circle" type="button" title="Move Up" onclick="vue.moveUp('+rowNo+')"><i class="el-icon-top"></i></button>'
+'<button class="el-button el-button--primary el-button--mini is-circle" type="button" title="Move Down" onclick="vue.moveDown('+rowNo+')"><i class="el-icon-bottom"></i></button>'
+'<button class="el-button el-button--danger el-button--mini is-circle" type="button" title="Delete" onclick="vue.deleteMe('+rowNo+')"><i class="el-icon-delete"></i></button></div></td>';
}
var vue = new Vue({
el: "#vue",
data: {
editingRowNo: -1,
editedRowNos: [],
predefineColors: ["#ffffff", "#ff7777", "#ff0000", "#770000", "#ffbb77", "#ff7700", "#773300", "#ffff77", "#ffff00", "#777700", "#77ff77", "#00ff00", "#007700",
"#77ffff", "#00ffff", "#007777", "#7777ff", "#0000ff", "#000077", "#ff77ff", "#ff00ff", "#770077", "#bbbbbb", "#777777", "#333333", "#000000"],
timezoneList: [
{showLocation: "Auckland, New Zealand", ianaTimezone: "Pacific/Auckland"},
{showLocation: "Sydney, Australia", ianaTimezone: "Australia/Sydney"},
{showLocation: "Brisbane, Australia", ianaTimezone: "Australia/Brisbane"},
{showLocation: "Adelaide, Australia", ianaTimezone: "Australia/Adelaide"},
{showLocation: "Darwin, Australia", ianaTimezone: "Australia/Darwin"},
{showLocation: "Perth, Australia", ianaTimezone: "Australia/Perth"},
{showLocation: "Tokyo, Japan", ianaTimezone: "Asia/Tokyo"},
{showLocation: "Beijing, China", ianaTimezone: "Asia/Shanghai"},
{showLocation: "Bangkok, Thailand", ianaTimezone: "Asia/Bangkok"},
{showLocation: "Dhaka, Bangladesh", ianaTimezone: "Asia/Dhaka"},
{showLocation: "New Delhi, India", ianaTimezone: "Asia/Kolkata"},
{showLocation: "Karachi, Pakistan", ianaTimezone: "Asia/Karachi"},
{showLocation: "Dubai, UAE", ianaTimezone: "Asia/Dubai"},
{showLocation: "Nairobi, Kenya", ianaTimezone: "Africa/Nairobi"},
{showLocation: "Athens, Greece", ianaTimezone: "Europe/Athens"},
{showLocation: "Cape Town, South Africa", ianaTimezone: "Africa/Johannesburg"},
{showLocation: "Paris, France", ianaTimezone: "Europe/Paris"},
{showLocation: "Lagos, Nigeria", ianaTimezone: "Africa/Lagos"},
{showLocation: "London, United Kingdom", ianaTimezone: "Europe/London"},
{showLocation: "Abidjan, Côte d'Ivoire", ianaTimezone: "Africa/Abidjan"},
{showLocation: "São Paulo, Brazil", ianaTimezone: "America/Sao_Paulo"},
{showLocation: "Santiago, Chile", ianaTimezone: "America/Santiago"},
{showLocation: "Caracas, Venezuela", ianaTimezone: "America/Caracas"},
{showLocation: "Lima, Peru", ianaTimezone: "America/Lima"},
{showLocation: "Mexico City, Mexico", ianaTimezone: "America/Mexico_City"},
{showLocation: "New York, USA", ianaTimezone: "America/New_York"},
{showLocation: "Chicago, USA", ianaTimezone: "America/Chicago"},
{showLocation: "Denver, USA", ianaTimezone: "America/Denver"},
{showLocation: "Los Angeles, USA", ianaTimezone: "America/Los_Angeles"},
{showLocation: "Anchorage, USA", ianaTimezone: "America/Anchorage"},
{showLocation: "Honolulu, USA", ianaTimezone: "Pacific/Honolulu"},
],
backgroundColor: "#ffcccc",
borderColor: "#ff9999",
textColor: "#ffffff",
totalWidth: 220,
fontSizePlace: 20,
fontSizeTime: 50,
fontSizeDate: 25,
shadow: "true",
roundCorner: "true",
fontWeight: "bold",
fontType: "",
animation: "true",
dateFormat: "dateFormat2",
timeFormat: "timeFormat1",
switchTime: 10,
transparent: "false",
},
computed: {
totalWidth0: {
get: function (){
return (this.totalWidth - 5) / 5;
},
set: function (v){
this.totalWidth = v * 5 + 5;
}
},
fontSizePlace0: {
get: function (){
return this.fontSizePlace - 5;
},
set: function (v){
this.fontSizePlace = v + 5;
}
},
fontSizeTime0: {
get: function (){
return this.fontSizeTime - 5;
},
set: function (v){
this.fontSizeTime = v + 5;
}
},
fontSizeDate0: {
get: function (){
return this.fontSizeDate - 5;
},
set: function (v){
this.fontSizeDate = v + 5;
}
},
locationPreview: function() {
let t = this.timezoneList;
return t[0].showLocation;
},
timeFormatPreview: function() {
if(this.timeFormat == "timeFormat1"){
return "23:59:59";
}else if(this.timeFormat == "timeFormat2"){
return "23:59";
}else if(this.timeFormat == "timeFormat3"){
return "11:59:59 pm";
}else if(this.timeFormat == "timeFormat4"){
return "11:59 pm";
}
return "";
},
dateFormatPreview: function() {
if(this.dateFormat == "dateFormat1"){
return "Wednesday, 31 December 2025";
}else if(this.dateFormat == "dateFormat2"){
return "Wed, 31 Dec 2025";
}else if(this.dateFormat == "dateFormat3"){
return "Wednesday, 31 December";
}else if(this.dateFormat == "dateFormat4"){
return "Wed, 31 Dec";
}else if(this.dateFormat == "dateFormat5"){
return "31 December 2025";
}else if(this.dateFormat == "dateFormat6"){
return "31 Dec";
}else if(this.dateFormat == "dateFormat7"){
return "Wednesday, 31/12/2025";
}else if(this.dateFormat == "dateFormat8"){
return "Wed, 31/12/2025";
}else if(this.dateFormat == "dateFormat9"){
return "Wed, 31/12";
}else if(this.dateFormat == "dateFormat10"){
return "31/12/2025";
}else if(this.dateFormat == "dateFormat11"){
return "31/12";
}else if(this.dateFormat == "dateFormat12"){
return "Wednesday, December 31, 2025";
}else if(this.dateFormat == "dateFormat13"){
return "Wed, Dec 31, 2025";
}else if(this.dateFormat == "dateFormat14"){
return "Wednesday, December 31";
}else if(this.dateFormat == "dateFormat15"){
return "Wed, Dec 31";
}else if(this.dateFormat == "dateFormat16"){
return "December 31, 2025";
}else if(this.dateFormat == "dateFormat17"){
return "Dec 31";
}else if(this.dateFormat == "dateFormat18"){
return "Wednesday, 12/31/2025";
}else if(this.dateFormat == "dateFormat19"){
return "Wed, 12/31/2025";
}else if(this.dateFormat == "dateFormat20"){
return "Wed, 12/31";
}else if(this.dateFormat == "dateFormat21"){
return "12/31/2025";
}else if(this.dateFormat == "dateFormat22"){
return "12/31";
}
return "";
},
previewStyle: function() {
if(this.transparent == "true"){
return "position: relative; width: "+this.totalWidth+"px; padding: 10px; margin: 15px; "+(this.roundCorner=="true"?"border-radius: 20px; ":"")
+"text-align: center; font-family: "+(this.fontType==""?"":(this.fontType+","))+"sans-serif; "
+"color: "+this.textColor+
"; font-weight: "+this.fontWeight+"; "+(this.shadow=="true"?"-webkit-text-stroke: 0.3px #999999; text-shadow: 0px 0px 5px #666666;":"")
}
return "position: relative; width: "+this.totalWidth+"px; padding: 10px; margin: 10px; border: 5px solid; "+(this.roundCorner=="true"?"border-radius: 20px; ":"")
+"text-align: center; font-family: "+(this.fontType==""?"":(this.fontType+","))+"sans-serif; "
+"background-color: "+this.backgroundColor+"; border-color: "+this.borderColor+"; color: "+this.textColor+
"; font-weight: "+this.fontWeight+"; "+(this.shadow=="true"?"-webkit-text-stroke: 0.3px #999999; text-shadow: 0px 0px 5px #666666; box-shadow: 0px 0px 10px #666666;":"")
},
locationStyle: function() {
return "font-size: "+ this.fontSizePlace + "px";
},
timeStyle: function() {
return "font-size: "+ this.fontSizeTime + "px";
},
dateStyle: function() {
return "font-size: "+ this.fontSizeDate + "px";
},
},
methods: {
showEditingMessage: function(){
vue.$message({type:"error", message:"Finish editing before further operations."});
},
showEmptyMessage: function(){
vue.$message({type:"warning", message:"Blank inputs are ignored."});
},
myForceUpdate: function(){
vue.$forceUpdate();
for(let i=0; i<vue.editedRowNos.length; i++){
let t=vue.editedRowNos[i];
document.getElementById("tableContent").children[t].innerHTML
=tableLine(t,vue.timezoneList[t].ianaTimezone,vue.timezoneList[t].showLocation);
}
},
moveUp: function(rowNo){
if(vue.editingRowNo != -1){
vue.showEditingMessage();
return;
}
if(rowNo>0){
let t1 = vue.timezoneList[rowNo].ianaTimezone;
let t2 = vue.timezoneList[rowNo].showLocation;
vue.timezoneList[rowNo].ianaTimezone = vue.timezoneList[rowNo-1].ianaTimezone;
vue.timezoneList[rowNo].showLocation = vue.timezoneList[rowNo-1].showLocation;
vue.timezoneList[rowNo-1].ianaTimezone = t1;
vue.timezoneList[rowNo-1].showLocation = t2;
}
vue.myForceUpdate();
},
moveDown: function(rowNo){
if(vue.editingRowNo != -1){
vue.showEditingMessage();
return;
}
if(rowNo<vue.timezoneList.length-1){
let t1 = vue.timezoneList[rowNo].ianaTimezone;
let t2 = vue.timezoneList[rowNo].showLocation;
vue.timezoneList[rowNo].ianaTimezone = vue.timezoneList[rowNo+1].ianaTimezone;
vue.timezoneList[rowNo].showLocation = vue.timezoneList[rowNo+1].showLocation;
vue.timezoneList[rowNo+1].ianaTimezone = t1;
vue.timezoneList[rowNo+1].showLocation = t2;
}
vue.myForceUpdate();
},
deleteMe: function(rowNo){
if(vue.editingRowNo != -1){
vue.showEditingMessage();
return;
}
for(let i=rowNo; i<vue.timezoneList.length; i++){
vue.timezoneList[i]= vue.timezoneList[i+1];
}
vue.timezoneList.pop();
vue.myForceUpdate();
},
editMe: function(rowNo){
if(vue.editingRowNo != -1){
vue.showEditingMessage();
return;
}
document.getElementById("tableContent").children[rowNo].insertAdjacentHTML("afterend",
editLine("edit",vue.timezoneList[rowNo].ianaTimezone,vue.timezoneList[rowNo].showLocation));
document.getElementById("tableContent").children[rowNo].remove();
vue.editingRowNo = rowNo;
},
addMe: function(rowNo){
if(vue.editingRowNo != -1){
vue.showEditingMessage();
return;
}
document.getElementById("tableContent").children[rowNo].insertAdjacentHTML("afterend", editLine("add","",""));
vue.editingRowNo = rowNo + 1;
},
addDone: function(){
if(vue.isInputEmpty()){
vue.addCancel();
return;
}
vue.timezoneList.push({showLocation: "", ianaTimezone: ""});
for(let i=vue.timezoneList.length-1; i>vue.editingRowNo;i--){
vue.timezoneList[i] = vue.timezoneList[i-1];
}
vue.timezoneList[vue.editingRowNo] = {ianaTimezone: document.getElementById("input1").value, showLocation: document.getElementById("input2").value};
vue.addCancel();
},
addCancel: function(){
document.getElementById("tableContent").children[vue.editingRowNo].remove();
vue.myForceUpdate();
vue.editingRowNo = -1;
},
editDone: function(){
if(vue.isInputEmpty()){
vue.editCancel();
return;
}
vue.timezoneList[vue.editingRowNo].ianaTimezone = document.getElementById("input1").value;
vue.timezoneList[vue.editingRowNo].showLocation = document.getElementById("input2").value;
vue.editCancel();
},
editCancel: function(){
document.getElementById("tableContent").children[vue.editingRowNo].insertAdjacentHTML("afterend",
"<tr>"+tableLine(vue.editingRowNo,vue.timezoneList[vue.editingRowNo].ianaTimezone,vue.timezoneList[vue.editingRowNo].showLocation)+"</tr>");
document.getElementById("tableContent").children[vue.editingRowNo].remove();
vue.editedRowNos.push(vue.editingRowNo);
vue.myForceUpdate();
vue.editingRowNo = -1;
},
isInputEmpty: function(){
if(document.getElementById("input1").value == "" || document.getElementById("input2").value == ""){
vue.showEmptyMessage();
return true;
}
return false;
},
exportFile: function(){
let result = "";
result += '<!DOCTYPE html>\n';
result += '<html lang="en">\n';
result += '<head>\n';
result += '<meta charset="UTF-8">\n';
result += '<meta name="author" value="yanjisheng">\n';
result += '<title>World Clock Widget - Made by yanjisheng, published under MIT license.</title>\n';
result += '<style>\n';
result += 'body{\n';
result += ' margin: 0px;\n';
result += '}\n';
result += '.out{\n';
result += ' position: relative;\n';
result += ' width: '+vue.totalWidth+'px;\n';
result += ' padding: 10px;\n';
result += ' text-align: center;\n';
result += ' color: '+this.textColor+';\n';
result += ' font-weight: '+this.fontWeight+';\n';
if(vue.fontType != ""){
result += ' font-family: '+this.fontType+', sans-serif;\n';
}else{
result += ' font-family: sans-serif;\n';
}
if(vue.transparent == "true"){
result += ' margin: 15px;\n';
if(this.shadow == "true"){
result += ' -webkit-text-stroke: 0.3px #999999;\n';
result += ' text-shadow: 0px 0px 5px #666666;\n';
}
}else{
result += ' margin: 10px;\n';
result += ' border: 5px solid;\n';
if(vue.roundCorner == "true"){
result += ' border-radius: 20px;\n';
}
result += ' background-color: '+this.backgroundColor+';\n';
result += ' border-color: '+this.borderColor+';\n';
if(this.shadow == "true"){
result += ' -webkit-text-stroke: 0.3px #999999;\n';
result += ' text-shadow: 0px 0px 5px #666666;\n';
result += ' box-shadow: 0px 0px 10px #666666;\n';
}
}
result += '}\n';
result += '.line{\n';
result += ' position: relative;\n';
result += ' top: 0px;\n';
if(this.animation == "true"){
result += ' animation-name: appear;\n';
result += ' animation-duration: 0.5s;\n';
result += ' animation-fill-mode: both;\n';
result += '}\n';
result += '@keyframes appear{\n';
result += ' from {\n';
result += ' top: -10px;\n';
result += ' opacity: 0;\n';
result += ' }\n';
result += ' to {\n';
result += ' top: 0px;\n';
result += ' opacity: 1;\n';
result += ' }\n';
}
result += '}\n';
result += '.time{\n';
result += ' font-size: '+this.fontSizeTime+'px;\n';
result += ' animation-delay: 0.2s;\n';
result += '}\n';
result += '.date{\n';
result += ' font-size: '+this.fontSizeDate+'px;\n';
result += ' animation-delay: 0.4s;\n';
result += '}\n';
result += '.place{\n';
result += ' font-size: '+this.fontSizePlace+'px;\n';
result += ' animation-delay: 0s;\n';
result += '}\n';
result += '</style>\n';
result += '</head>\n';
result += '<body>\n';
result += '<div class="out" title="Made by yanjisheng">\n';
result += '<div id="place" class="place line" title="Made by yanjisheng">City, Country</div>\n';
result += '<div id="time" class="time line" title="Made by yanjisheng">18:00:00</div>\n';
result += '<div id="date" class="date line" title="Made by yanjisheng">2023/12/31</div>\n';
result += '</div>\n';
result += '<script>\n';
result += 'var timezoneList = [\n';
for(let i=0; i<this.timezoneList.length; i++){
result += '{showLocation: "'+this.timezoneList[i].showLocation+'", ianaTimezone: "'+this.timezoneList[i].ianaTimezone+'"}, \n';
}
result += '];\n';
result += 'var url = location.href;\n';
result += 'if(url.indexOf("?") < 0){\n';
result += 'location.replace(url+"?0");\n';
result += '}\n';
result += 'var serialNo = url.substring(url.indexOf("?")+1);\n';
result += 'var index = serialNo % timezoneList.length;\n';
result += 'var place = timezoneList[index].showLocation;\n';
result += 'var timezone = timezoneList[index].ianaTimezone;\n';
result += 'document.getElementById("place").innerText=place;\n';
result += 'function showDateTimePerSecond(){\n';
result += 'let now = new Date();\n';
result += 'let timeString = "Invalid Timezone";\n';
result += 'let dateString = "Please check the IANA timezone is correct.";\n';
result += 'try{\n';
if(this.timeFormat == "timeFormat1"){
result += ' timeString = now.toLocaleTimeString("en-GB", {timeZone: timezone, hour12: false, second: "2-digit", minute: "2-digit", hour: "2-digit"});\n';
}else if(this.timeFormat == "timeFormat2"){
result += ' timeString = now.toLocaleTimeString("en-GB", {timeZone: timezone, hour12: false, minute: "2-digit", hour: "2-digit"});\n';
}else if(this.timeFormat == "timeFormat3"){
result += ' timeString = now.toLocaleTimeString("en-GB", {timeZone: timezone, hour12: true, second: "2-digit", minute: "2-digit", hour: "2-digit"});\n';
}else if(this.timeFormat == "timeFormat4"){
result += ' timeString = now.toLocaleTimeString("en-GB", {timeZone: timezone, hour12: true, minute: "2-digit", hour: "2-digit"});\n';
}
if(this.dateFormat == "dateFormat1"){
result += ' dateString = now.toLocaleDateString("en-GB", {timeZone: timezone, year: "numeric", month: "long", day: "2-digit", weekday: "long"});\n';
}else if(this.dateFormat == "dateFormat2"){
result += ' dateString = now.toLocaleDateString("en-GB", {timeZone: timezone, year: "numeric", month: "short", day: "2-digit", weekday: "short"});\n';
}else if(this.dateFormat == "dateFormat3"){
result += ' dateString = now.toLocaleDateString("en-GB", {timeZone: timezone, month: "long", day: "2-digit", weekday: "long"});\n';
}else if(this.dateFormat == "dateFormat4"){
result += ' dateString = now.toLocaleDateString("en-GB", {timeZone: timezone, month: "short", day: "2-digit", weekday: "short"});\n';
}else if(this.dateFormat == "dateFormat5"){
result += ' dateString = now.toLocaleDateString("en-GB", {timeZone: timezone, year: "numeric", month: "long", day: "2-digit"});\n';
}else if(this.dateFormat == "dateFormat6"){
result += ' dateString = now.toLocaleDateString("en-GB", {timeZone: timezone, month: "short", day: "2-digit"});\n';
}else if(this.dateFormat == "dateFormat7"){
result += ' dateString = now.toLocaleDateString("en-GB", {timeZone: timezone, year: "numeric", month: "2-digit", day: "2-digit", weekday: "long"});\n';
}else if(this.dateFormat == "dateFormat8"){
result += ' dateString = now.toLocaleDateString("en-GB", {timeZone: timezone, year: "numeric", month: "2-digit", day: "2-digit", weekday: "short"});\n';
}else if(this.dateFormat == "dateFormat9"){
result += ' dateString = now.toLocaleDateString("en-GB", {timeZone: timezone, month: "2-digit", day: "2-digit", weekday: "short"});\n';
}else if(this.dateFormat == "dateFormat10"){
result += ' dateString = now.toLocaleDateString("en-GB", {timeZone: timezone, year: "numeric", month: "2-digit", day: "2-digit"});\n';
}else if(this.dateFormat == "dateFormat11"){
result += ' dateString = now.toLocaleDateString("en-GB", {timeZone: timezone, month: "2-digit", day: "2-digit"});\n';
}else if(this.dateFormat == "dateFormat12"){
result += ' dateString = now.toLocaleDateString("en-US", {timeZone: timezone, year: "numeric", month: "long", day: "2-digit", weekday: "long"});\n';
}else if(this.dateFormat == "dateFormat13"){
result += ' dateString = now.toLocaleDateString("en-US", {timeZone: timezone, year: "numeric", month: "short", day: "2-digit", weekday: "short"});\n';
}else if(this.dateFormat == "dateFormat14"){
result += ' dateString = now.toLocaleDateString("en-US", {timeZone: timezone, month: "long", day: "2-digit", weekday: "long"});\n';
}else if(this.dateFormat == "dateFormat15"){
result += ' dateString = now.toLocaleDateString("en-US", {timeZone: timezone, month: "short", day: "2-digit", weekday: "short"});\n';
}else if(this.dateFormat == "dateFormat16"){
result += ' dateString = now.toLocaleDateString("en-US", {timeZone: timezone, year: "numeric", month: "long", day: "2-digit"});\n';
}else if(this.dateFormat == "dateFormat17"){
result += ' dateString = now.toLocaleDateString("en-US", {timeZone: timezone, month: "short", day: "2-digit"});\n';
}else if(this.dateFormat == "dateFormat18"){
result += ' dateString = now.toLocaleDateString("en-US", {timeZone: timezone, year: "numeric", month: "2-digit", day: "2-digit", weekday: "long"});\n';
}else if(this.dateFormat == "dateFormat19"){
result += ' dateString = now.toLocaleDateString("en-US", {timeZone: timezone, year: "numeric", month: "2-digit", day: "2-digit", weekday: "short"});\n';
}else if(this.dateFormat == "dateFormat20"){
result += ' dateString = now.toLocaleDateString("en-US", {timeZone: timezone, month: "2-digit", day: "2-digit", weekday: "short"});\n';
}else if(this.dateFormat == "dateFormat21"){
result += ' dateString = now.toLocaleDateString("en-US", {timeZone: timezone, year: "numeric", month: "2-digit", day: "2-digit"});\n';
}else if(this.dateFormat == "dateFormat22"){
result += ' dateString = now.toLocaleDateString("en-US", {timeZone: timezone, month: "2-digit", day: "2-digit"});\n';
}
result += '}catch{}\n';
result += 'document.getElementById("time").innerText=timeString;\n';
result += 'document.getElementById("date").innerText=dateString;\n';
result += '}\n';
result += 'showDateTimePerSecond();\n';
result += 'setInterval(showDateTimePerSecond,1000);\n';
result += 'setTimeout(function(){location.replace(url.substring(0,url.indexOf("?")+1)+(index+1))}, '+this.switchTime+' * 1000);\n';
result += '<\/script>\n';
result += '<\/body>\n';
result += '<\/html>\n';
console.log(result);
let blob = new Blob([result], {type: "text/plain;charset=UTF-8"});
let url = URL.createObjectURL(blob);
let link = document.createElement("a");
link.href = url;
link.setAttribute("download", "worldclock.html");
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
URL.revokeObjectURL(url);
}
}
});
</script>
</body>
</html>