-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerator-zh.html
634 lines (634 loc) · 32.3 KB
/
generator-zh.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
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>世界时钟生成器</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{
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-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="时区列表" name="tzlist">
<table>
<thead>
<td>序号</td>
<td style="min-width:200px"><a href="https://data.iana.org/time-zones/tzdb/zone1970.tab" title="请从链接中选择IANA标准时区" target="_blank">IANA标准时区</a></td>
<td style="min-width:200px">显示地名</td>
<td style="min-width:140px">操作</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="编辑" @click="editMe(index)"></el-button>
<el-button type="success" icon="el-icon-plus" circle size="mini" title="添加" @click="addMe(index)"></el-button>
<el-button type="primary" icon="el-icon-top" circle size="mini" title="上移" @click="moveUp(index)"></el-button>
<el-button type="primary" icon="el-icon-bottom" circle size="mini" title="下移" @click="moveDown(index)"></el-button>
<el-button type="danger" icon="el-icon-delete" circle size="mini" title="删除" @click="deleteMe(index)"></el-button>
</el-button-group>
</td>
</tr>
</tbody>
</table>
</el-tab-pane>
<el-tab-pane label="其他设置" name="color">
<h2>日期与时间格式</h2>
<el-row>
<el-col :span="12">时间格式:
<el-select size="mini" v-model="timeFormat">
<el-option label="23:59:59" value="timeFormat21"></el-option>
<el-option label="23:59" value="timeFormat22"></el-option>
<el-option label="下午11:59:59" value="timeFormat23"></el-option>
<el-option label="下午11:59" value="timeFormat24"></el-option>
</el-select>
</el-col>
<el-col :span="12">日期格式:
<el-select size="mini" v-model="dateFormat">
<el-option label="2025年12月31日星期三" value="dateFormat21"></el-option>
<el-option label="2025年12月31日" value="dateFormat22"></el-option>
<el-option label="12月31日星期三" value="dateFormat23"></el-option>
<el-option label="12月31日" value="dateFormat24"></el-option>
<el-option label="2025/12/31" value="dateFormat25"></el-option>
<el-option label="12/31" value="dateFormat26"></el-option>
</el-select>
</el-col>
</el-row>
<h2>尺寸</h2>
<el-row>
<el-col :span="12">总宽度: <el-slider size="mini" v-model="totalWidth0" :show-tooltip="false"></el-slider></el-col>
<el-col :span="12">地点字号: <el-slider size="mini" v-model="fontSizePlace0" :show-tooltip="false"></el-slider></el-slider></el-col>
</el-row>
<el-row>
<el-col :span="12">时间字号: <el-slider size="mini" v-model="fontSizeTime0" :show-tooltip="false"></el-slider></el-slider></el-col>
<el-col :span="12">日期字号: <el-slider size="mini" v-model="fontSizeDate0" :show-tooltip="false"></el-slider></el-slider></el-col>
</el-row>
<h2>颜色与字体</h2>
<el-row>
<el-col :span="8">背景颜色: <el-color-picker size="mini" v-model="backgroundColor" :predefine="predefineColors"></el-color-picker></el-col>
<el-col :span="8">边框颜色: <el-color-picker size="mini" v-model="borderColor" :predefine="predefineColors"></el-color-picker></el-col>
<el-col :span="8">文字颜色: <el-color-picker size="mini" v-model="textColor" :predefine="predefineColors"></el-color-picker></el-col>
</el-row>
<el-row>
<el-col :span="8">字重:
<el-select size="mini" v-model="fontWeight">
<el-option label="加粗" value="bold"></el-option>
<el-option label="常规" value="normal"></el-option>
<el-option label="更细" value="lighter"></el-option>
</el-select>
</el-col>
<el-col :span="16">字体:
<el-input size="mini" v-model="fontType"></el-input>
<el-tooltip content="请确保字体已安装在你的电脑上,本框可以留空。" placement="top-end">
<el-button icon="el-icon-warning-outline" circle size="mini"></el-button>
</el-tooltip>
</el-col>
</el-row>
<h2>形状与行为</h2>
<el-row>
<el-col :span="8">阴影:
<el-select size="mini" v-model="shadow">
<el-option label="开" value="true"></el-option>
<el-option label="关" value="false"></el-option>
</el-select>
</el-col>
<el-col :span="8">圆角:
<el-select size="mini" v-model="roundCorner">
<el-option label="开" value="true"></el-option>
<el-option label="关" value="false"></el-option>
</el-select>
</el-col>
<el-col :span="8">动画:
<el-select size="mini" v-model="animation">
<el-option label="开" value="true"></el-option>
<el-option label="关" value="false"></el-option>
</el-select>
</el-col>
</el-row>
<el-row>
<el-col :span="8">透明背景:
<el-select size="mini" v-model="transparent">
<el-option label="开" value="true"></el-option>
<el-option label="关" value="false"></el-option>
</el-select>
</el-col>
<el-col :span="16">地点变换间隔(秒):
<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="关于" name="about">
<h1>世界时钟生成器</h1>
<p>本网页用于生成世界时钟小组件,该组件可依次展示世界各地的当地时间,并能自动处理夏令时。</p>
<p>该组件适用于观众遍布全球各地的网络主播使用。</p>
<p><a href="generator-en.html">English</a> <a href="generator-ja.html">日本語</a></p>
<h2>作者信息</h2>
<p>本项目的作者为颜姬。</p>
<p><a href="https://github.com/yanjisheng/world-clock" target="_blank">Github仓库</a> <a href="https://space.bilibili.com/31719231" target="_blank">B站</a> <a href="https://twitter.com/yanji_channel" target="_blank">Twitter</a></p>
<h2>使用方法</h2>
<p>1. 在第一个标签页选择你打算展示的时区。你可以编辑各时区的展示地名,删除不需要的项,也可以增加想要的时区。请记得使用<a href="https://data.iana.org/time-zones/tzdb/zone1970.tab" target="_blank">IANA标准时区</a>,否则会报错。</p>
<p>2. 在第二个标签页调整大小,颜色,日期与时间格式,以及其他设置。你可在页面右侧(页面较窄时在下部)查看预览。</p>
<p>3. 完成调整之后,点击预览窗口下方的“保存”按钮,然后保存导出的“worldclock.html”文件。如果你掌握了HTML、CSS和Javascript的知识,你也可以编辑导出的文件,从而实现更多复杂的功能。</p>
<p>4. 最后,在OBS Studio中,添加“来源”-“浏览器”,勾选“本地文件”,然后选择上一步中导出的文件即可。</p>
<h2>许可证</h2>
<p>本项目使用MIT许可证。</p>
</el-tab-pane>
</el-tabs>
<div id="previewBox">
<h2>预览</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()">保存</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="确认" 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="取消" 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="编辑" 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="添加" 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="上移" 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="下移" 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="删除" 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: "澳大利亚,悉尼", ianaTimezone: "Australia/Sydney"},
{showLocation: "日本,东京", ianaTimezone: "Asia/Tokyo"},
{showLocation: "中国,北京", ianaTimezone: "Asia/Shanghai"},
{showLocation: "泰国,曼谷", ianaTimezone: "Asia/Bangkok"},
{showLocation: "印度,新德里", ianaTimezone: "Asia/Kolkata"},
{showLocation: "阿联酋,迪拜", ianaTimezone: "Asia/Dubai"},
{showLocation: "希腊,雅典", ianaTimezone: "Europe/Athens"},
{showLocation: "法国,巴黎", ianaTimezone: "Europe/Paris"},
{showLocation: "英国,伦敦", ianaTimezone: "Europe/London"},
{showLocation: "巴西,圣保罗", ianaTimezone: "America/Sao_Paulo"},
{showLocation: "美国,纽约", ianaTimezone: "America/New_York"},
{showLocation: "美国,芝加哥", ianaTimezone: "America/Chicago"},
{showLocation: "美国,洛杉矶", ianaTimezone: "America/Los_Angeles"},
],
backgroundColor: "#ffcccc",
borderColor: "#ff9999",
textColor: "#ffffff",
totalWidth: 220,
fontSizePlace: 28,
fontSizeTime: 50,
fontSizeDate: 20,
shadow: "true",
roundCorner: "true",
fontWeight: "bold",
fontType: "",
animation: "true",
dateFormat: "dateFormat21",
timeFormat: "timeFormat21",
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 == "timeFormat21"){
return "23:59:59";
}else if(this.timeFormat == "timeFormat22"){
return "23:59";
}else if(this.timeFormat == "timeFormat23"){
return "下午11:59:59";
}else if(this.timeFormat == "timeFormat24"){
return "下午11:59";
}
return "";
},
dateFormatPreview: function() {
if(this.dateFormat == "dateFormat21"){
return "2025年12月31日星期三";
}else if(this.dateFormat == "dateFormat22"){
return "2025年12月31日";
}else if(this.dateFormat == "dateFormat23"){
return "12月31日星期三";
}else if(this.dateFormat == "dateFormat24"){
return "12月31日";
}else if(this.dateFormat == "dateFormat25"){
return "2025/12/31";
}else if(this.dateFormat == "dateFormat26"){
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:"请先完成当前的编辑,再进行新的操作。"});
},
showEmptyMessage: function(){
vue.$message({type:"warning", message:"空白输入被忽略了。"});
},
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="zh-CN">\n';
result += '<head>\n';
result += '<meta charset="UTF-8">\n';
result += '<meta name="author" value="yanjisheng">\n';
result += '<title>世界时钟小组件 - 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 = "无效时区";\n';
result += 'let dateString = "请检查IANA时区是否正确。";\n';
result += 'try{\n';
if(this.timeFormat == "timeFormat21"){
result += ' timeString = now.toLocaleTimeString("zh-CN", {timeZone: timezone, hour12: false, second: "2-digit", minute: "2-digit", hour: "2-digit"});\n';
}else if(this.timeFormat == "timeFormat22"){
result += ' timeString = now.toLocaleTimeString("zh-CN", {timeZone: timezone, hour12: false, minute: "2-digit", hour: "2-digit"});\n';
}else if(this.timeFormat == "timeFormat23"){
result += ' timeString = now.toLocaleTimeString("zh-CN", {timeZone: timezone, hour12: true, second: "2-digit", minute: "2-digit", hour: "2-digit"});\n';
}else if(this.timeFormat == "timeFormat24"){
result += ' timeString = now.toLocaleTimeString("zh-CN", {timeZone: timezone, hour12: true, minute: "2-digit", hour: "2-digit"});\n';
}
if(this.dateFormat == "dateFormat21"){
result += ' dateString = now.toLocaleDateString("zh-CN", {timeZone: timezone, year: "numeric", month: "long", day: "numeric", weekday: "long"});\n';
}else if(this.dateFormat == "dateFormat22"){
result += ' dateString = now.toLocaleDateString("zh-CN", {timeZone: timezone, year: "numeric", month: "long", day: "numeric"});\n';
}else if(this.dateFormat == "dateFormat23"){
result += ' dateString = now.toLocaleDateString("zh-CN", {timeZone: timezone, month: "long", day: "numeric", weekday: "long"});\n';
}else if(this.dateFormat == "dateFormat24"){
result += ' dateString = now.toLocaleDateString("zh-CN", {timeZone: timezone, month: "long", day: "numeric"});\n';
}else if(this.dateFormat == "dateFormat25"){
result += ' dateString = now.toLocaleDateString("zh-CN", {timeZone: timezone, year: "numeric", month: "2-digit", day: "2-digit"});\n';
}else if(this.dateFormat == "dateFormat26"){
result += ' dateString = now.toLocaleDateString("zh-CN", {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>