-
Notifications
You must be signed in to change notification settings - Fork 550
/
Copy pathindex.html
910 lines (839 loc) · 51.3 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
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
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
<!DOCTYPE HTML>
<html>
<head>
<title>朋友圈转发截图生成工具</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<meta http-equiv="Cache-Control" content="no-transform" />
<!--<link rel="stylesheet" href="mdui.min.css">-->
<!--<link rel="stylesheet" href="https://cdn.bootcss.com/mdui/0.4.2/css/mdui.min.css">-->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/mdui@0.4.2/dist/css/mdui.min.css">
<style>
body {
margin: 0 0 0 0;
}
#fakeWechatMoment {
background-color: #ffffff;
/*display: none;*/
position: fixed;
display: block;
left: 100%;
top: 0;
}
.topBar {
width: calc(100% - 32px);
height: 72px;
background-color: #303030;
font-size: 34px;
font-weight: 500;
color: #ffffff;
display: flex;
justify-content: space-between;
align-items: Center;
padding-left: 16px;
padding-right: 16px;
}
.header {
width: 100%;
height: 132px;
background-color: #303030;
font-size: 48px;
color: #ffffff;
display: flex;
align-items: Center;
}
.main {
margin-left: 33px;
margin-right: 33px;
}
.footer {
width: calc(100% - 64px);
height: 132px;
border-top: 2px solid #d8d8d8;
position: relative;
display: flex;
align-items: Center;
justify-content: center;
padding-left: 32px;
padding-right: 32px;
background-color: #f5f5f5;
}
.avatarOut {
display: inline-block;
background-color: #f1f1f1;
width: 116px;
height: 116px;
vertical-align: top;
}
.avatarIn {
position: relative;
left: 6px;
top: 6px;
width: 104px;
height: 104px;
}
.content {
position: relative;
display: inline-block;
width: calc(100% - 143px);
left: 22px;
vertical-align: top;
}
.name {
color: #576b95;
font-size: 40px;
}
.text {
font-size: 36px;
line-height: 1.25em;
}
.article {
background-color: #ececec;
margin-top: 36px;
height: 170px;
display: flex;
align-items: Center;
}
.articleIcon {
position: relative;
left: 16px;
width: 138px;
height: 138px;
}
.articleTitle {
position: relative;
left: 32px;
width: calc(100% - 170px);
font-size: 36px;
max-width: 700px;
/* html2canvas不支持文本截断 */
/* https://github.com/niklasvh/html2canvas/issues/324 */
/*text-overflow: ellipsis;*/
/*white-space: nowrap;*/
overflow: hidden;
}
.singleImage {
margin-top: 28px;
}
.multiImage {
margin-top: 28px;
}
.image {
max-width: 550px;
max-height: 550px;
}
.multiImageBox {
width: 265px;
height: 265px;
margin: 0 8px 8px 0;
display: inline-block;
}
.info {
display: inline-block;
color: #808080;
font-size: 32px;
width: calc(100% - 65px);
}
.like {
width: 100%;
background-color: #eeeeee;
font-size: 0;
}
.likeAvatarList {
position: relative;
display: inline-block;
width: calc(100% - 92px);
left: 60px;
vertical-align: top;
}
.likeAvatar {
width: 88px;
height: 88px;
margin: 17px 17px 0 0;
display: inline-block;
}
#generatedPopup {
text-align: center;
}
#generated {
width: auto;
height: 400px;
display: inline-block;
}
.squareImage {
background-size: cover;
background-position: center center;
background-repeat: no-repeat;
}
.emoticon {
width: 1.25em;
height: 1.25em;
display: inline-block;
vertical-align: text-top;
}
.topBarIcon {
height: 36px;
width: auto;
margin-left: 2px;
margin-right: 2px;
}
#topBarAppIcons{
height: 36px;
}
.heimu{
background-color: #000000;
color: #000000;
transition: color .2s ease;
}
.heimu:hover{
color: #ffffff;
}
</style>
</head>
<body class="mdui-theme-primary-indigo mdui-theme-accent-pink mdui-appbar-with-toolbar">
<header class="mdui-appbar mdui-appbar-fixed">
<div class="mdui-toolbar mdui-color-theme">
<span class="mdui-typo-title">朋友圈转发截图生成工具</span>
<div class="mdui-toolbar-spacer"></div>
<a class="mdui-btn mdui-btn-icon" mdui-dialog="{target: '#about'}" mdui-tooltip="{content: '关于'}"><i class="mdui-icon material-icons">info_outline</i></a>
<a href="https://github.com/TransparentLC/WechatMomentScreenshot" class="mdui-btn mdui-btn-icon mdui-ripple mdui-ripple-white" mdui-tooltip="{content: '查看 GitHub'}">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 36 36" enable-background="new 0 0 36 36" xml:space="preserve" class="mdui-icon" style="width: 24px;height:24px;">
<path fill-rule="evenodd" clip-rule="evenodd" fill="#ffffff" d="M18,1.4C9,1.4,1.7,8.7,1.7,17.7c0,7.2,4.7,13.3,11.1,15.5
c0.8,0.1,1.1-0.4,1.1-0.8c0-0.4,0-1.4,0-2.8c-4.5,1-5.5-2.2-5.5-2.2c-0.7-1.9-1.8-2.4-1.8-2.4c-1.5-1,0.1-1,0.1-1
c1.6,0.1,2.5,1.7,2.5,1.7c1.5,2.5,3.8,1.8,4.7,1.4c0.1-1.1,0.6-1.8,1-2.2c-3.6-0.4-7.4-1.8-7.4-8.1c0-1.8,0.6-3.2,1.7-4.4
c-0.2-0.4-0.7-2.1,0.2-4.3c0,0,1.4-0.4,4.5,1.7c1.3-0.4,2.7-0.5,4.1-0.5c1.4,0,2.8,0.2,4.1,0.5c3.1-2.1,4.5-1.7,4.5-1.7
c0.9,2.2,0.3,3.9,0.2,4.3c1,1.1,1.7,2.6,1.7,4.4c0,6.3-3.8,7.6-7.4,8c0.6,0.5,1.1,1.5,1.1,3c0,2.2,0,3.9,0,4.5
c0,0.4,0.3,0.9,1.1,0.8c6.5-2.2,11.1-8.3,11.1-15.5C34.3,8.7,27,1.4,18,1.4z" />
</svg>
</a>
</div>
</header>
<div class="mdui-container">
<div class="mdui-row">
<div class="mdui-col-xs-8 mdui-col-sm-10">
<div class="mdui-textfield">
<label class="mdui-textfield-label">名字</label>
<input id="configName" class="mdui-textfield-input" type="text" value="A 营销号免费广告姬" />
</div>
</div>
<div class="mdui-col-xs-4 mdui-col-sm-2">
<div class="mdui-textfield">
<label class="mdui-textfield-label"> </label>
<button class="mdui-btn mdui-ripple mdui-btn-block mdui-text-color-theme-accent" onclick="javascript: document.getElementById('configAvatar').click();">上传头像</button>
<input id="configAvatar" type="file" style="display: none;" />
</div>
</div>
</div>
<div class="mdui-textfield">
<label class="mdui-textfield-label">正文</label>
<textarea id="configText" class="mdui-textfield-input">很实用的教程[微笑] 需要收集五个赞 谢谢大家啦~( ^ω^)</textarea>
</div>
<div class="mdui-textfield">
<label class="mdui-textfield-label">截图类型</label>
</div>
<div class="mdui-row">
<div class="mdui-col-xs-6">
<label class="mdui-radio">
<input id="configTypeText" type="radio" name="group" checked />
<i class="mdui-radio-icon"></i>纯文字
</label>
</div>
<div class="mdui-col-xs-6">
<label class="mdui-radio">
<input id="configTypeWebsite" type="radio" name="group" />
<i class="mdui-radio-icon"></i>分享网页
</label>
</div>
<div class="mdui-col-xs-6">
<label class="mdui-radio">
<input id="configTypeSingleImage" type="radio" name="group" />
<i class="mdui-radio-icon"></i>图片(单张)
</label>
</div>
<div class="mdui-col-xs-6">
<label class="mdui-radio">
<input id="configTypeMultiImage" type="radio" name="group" />
<i class="mdui-radio-icon"></i>图片(九宫格)
</label>
</div>
</div>
<div id="configWebsite" style="display: none;">
<div class="mdui-textfield">
<label class="mdui-textfield-label">网页标题</label>
<input id="configArticleTitle" class="mdui-textfield-input" type="text" value="还不会用Google的你,就要被时代淘汰了" />
</div>
<div class="mdui-row">
<div class="mdui-col-xs-6">
<button class="mdui-btn mdui-ripplet mdui-btn-block mdui-text-color-theme-accent" onclick="javascript: document.getElementById('configArticleIcon').click();">上传网页图标</button>
<input id="configArticleIcon" type="file" style="display: none;" />
</div>
<div class="mdui-col-xs-6">
<button class="mdui-btn mdui-ripple mdui-btn-block mdui-text-color-theme-accent" onclick="javascript: getArticleInfo();">自动获取公众号文章标题/封面图</button>
</div>
</div>
<div class="mdui-textfield">
<label class="mdui-textfield-label">转发出处</label>
<input id="configApp" class="mdui-textfield-input" type="text" value="" />
</div>
</div>
<div id="configSingleImage" style="display: none;">
<button class="mdui-btn mdui-ripple mdui-btn-block mdui-text-color-theme-accent" onclick="javascript: document.getElementById('configSetSingleImage').click();">上传图片</button>
<input id="configSetSingleImage" type="file" style="display: none;" />
</div>
<div id="configMultiImage" style="display: none;">
<div class="mdui-m-y-1">请按图片 1 - 9 的顺序添加图片~<br />如果只需要显示一张图片,建议选择“图片(单张)”。</div>
<div class="mdui-row">
<div class="mdui-col-xs-4">
<button class="mdui-btn mdui-ripple mdui-btn-block mdui-text-color-theme-accent" onclick="javascript: document.getElementById('configSetMultiImage1').click();">上传图片 1</button>
<input id="configSetMultiImage1" type="file" style="display: none;" />
</div>
<div class="mdui-col-xs-4">
<button class="mdui-btn mdui-ripple mdui-btn-block mdui-text-color-theme-accent" onclick="javascript: document.getElementById('configSetMultiImage2').click();">上传图片 2</button>
<input id="configSetMultiImage2" type="file" style="display: none;" />
</div>
<div class="mdui-col-xs-4">
<button class="mdui-btn mdui-ripple mdui-btn-block mdui-text-color-theme-accent" onclick="javascript: document.getElementById('configSetMultiImage3').click();">上传图片 3</button>
<input id="configSetMultiImage3" type="file" style="display: none;" />
</div>
<div class="mdui-col-xs-4">
<button class="mdui-btn mdui-ripple mdui-btn-block mdui-text-color-theme-accent" onclick="javascript: document.getElementById('configSetMultiImage4').click();">上传图片 4</button>
<input id="configSetMultiImage4" type="file" style="display: none;" />
</div>
<div class="mdui-col-xs-4">
<button class="mdui-btn mdui-ripple mdui-btn-block mdui-text-color-theme-accent" onclick="javascript: document.getElementById('configSetMultiImage5').click();">上传图片 5</button>
<input id="configSetMultiImage5" type="file" style="display: none;" />
</div>
<div class="mdui-col-xs-4">
<button class="mdui-btn mdui-ripple mdui-btn-block mdui-text-color-theme-accent" onclick="javascript: document.getElementById('configSetMultiImage6').click();">上传图片 6</button>
<input id="configSetMultiImage6" type="file" style="display: none;" />
</div>
<div class="mdui-col-xs-4">
<button class="mdui-btn mdui-ripple mdui-btn-block mdui-text-color-theme-accent" onclick="javascript: document.getElementById('configSetMultiImage7').click();">上传图片 7</button>
<input id="configSetMultiImage7" type="file" style="display: none;" />
</div>
<div class="mdui-col-xs-4">
<button class="mdui-btn mdui-ripple mdui-btn-block mdui-text-color-theme-accent" onclick="javascript: document.getElementById('configSetMultiImage8').click();">上传图片 8</button>
<input id="configSetMultiImage8" type="file" style="display: none;" />
</div>
<div class="mdui-col-xs-4">
<button class="mdui-btn mdui-ripple mdui-btn-block mdui-text-color-theme-accent" onclick="javascript: document.getElementById('configSetMultiImage9').click();">上传图片 9</button>
<input id="configSetMultiImage9" type="file" style="display: none;" />
</div>
<div class="mdui-col-xs-12">
<button class="mdui-btn mdui-ripple mdui-btn-block mdui-text-color-theme-accent" onclick="javascript: clearMultiImage();">清空所有图片</button>
</div>
</div>
</div>
<div class="mdui-textfield">
<label class="mdui-textfield-label">定位</label>
<input id="configLocation" class="mdui-textfield-input" type="text" value="" />
</div>
<div class="mdui-row">
<div class="mdui-textfield mdui-col-xs-6">
<label class="mdui-textfield-label">发表日期</label>
<input id="configPostDate" class="mdui-textfield-input" type="date" />
</div>
<div class="mdui-textfield mdui-col-xs-3">
<label class="mdui-textfield-label">发表时间</label>
<input id="configPostTimeHour" class="mdui-textfield-input" type="number" min="0" max="23" />
</div>
<div class="mdui-textfield mdui-col-xs-3">
<label class="mdui-textfield-label"> </label>
<input id="configPostTimeMinute" class="mdui-textfield-input" type="number" min="0" max="59" />
</div>
<div class="mdui-textfield mdui-col-xs-6">
<label class="mdui-textfield-label">截图日期</label>
<input id="configScreenshotDate" class="mdui-textfield-input" type="date" />
</div>
<div class="mdui-textfield mdui-col-xs-3">
<label class="mdui-textfield-label">截图时间</label>
<input id="configScreenshotTimeHour" class="mdui-textfield-input" type="number" min="0" max="23" />
</div>
<div class="mdui-textfield mdui-col-xs-3">
<label class="mdui-textfield-label"> </label>
<input id="configScreenshotTimeMinute" class="mdui-textfield-input" type="number" min="0" max="59" />
</div>
<div class="mdui-textfield mdui-col-xs-4 mdui-col-sm-6">
<label class="mdui-textfield-label">点赞数</label>
<input id="configLike" class="mdui-textfield-input" type="number" min="0" />
</div>
<div class="mdui-col-xs-4 mdui-col-sm-3">
<div class="mdui-textfield">
<label class="mdui-textfield-label">图片长度</label>
<input id="configHeight" class="mdui-textfield-input" type="number" value="1920" min="1920" />
</div>
</div>
<div class="mdui-col-xs-4 mdui-col-sm-3">
<div class="mdui-textfield">
<label class="mdui-textfield-label"> </label>
<button class="mdui-btn mdui-ripple mdui-btn-block mdui-text-color-theme-accent" mdui-tooltip="{content: '图片宽度默认为 1080 像素,长度根据设备长宽比确定计算,可能和实际存在偏差'}" onclick="javascript: document.getElementById('configHeight').value = Math.round(document.body.clientHeight / document.body.clientWidth * 1080);">自动设定</button>
</div>
</div>
</div>
<div class="mdui-textfield">
<label class="mdui-textfield-label">通知栏</label>
</div>
<div class="mdui-row">
<div class="mdui-col-xs-6">
<label class="mdui-checkbox">
<input id="configTopBarAppIcons" type="checkbox" name="configTopBarAppIcons" />
<i class="mdui-checkbox-icon"></i>
显示 APP 图标
</label>
</div>
<div class="mdui-col-xs-6">
<label class="mdui-checkbox">
<input id="configTopBarStatusIcons" type="checkbox" name="configTopBarStatusIcons" checked />
<i class="mdui-checkbox-icon"></i>
随机信号和电量
</label>
</div>
、 </div>
<button id="generate" class="mdui-btn mdui-ripple mdui-color-theme-accent mdui-btn-block mdui-m-t-2">生成</button>
<button class="mdui-btn mdui-ripple mdui-btn-block mdui-text-color-theme-accent mdui-m-t-1" mdui-dialog="{target: '#donate'}">请小透明喝一瓶肥宅快乐水~(*´∀`)</button>
<button class="mdui-btn mdui-ripple mdui-btn-block mdui-text-color-theme-accent mdui-m-t-1" onclick="javascript: var r = document.createRange(); r.selectNodeContents(document.getElementById('gitLink')); var s = document.getSelection(); s.removeAllRanges(); s.addRange(r); document.execCommand('Copy'); s.removeAllRanges(); mdui.snackbar({message: '已复制~(=゚ω゚)='});">复制链接,分享给有需要的人~(`ヮ´ )<div id="gitLink" style="text-transform: initial;">https://git.io/WMS</div></button>
<div id="fakeWechatMoment">
<div id="topBar" class="topBar">
<div id="topBarAppIcons"></div>
<div style="flex-grow: 1;"></div>
<img id="topBarIconWifi" class="topBarIcon" />
<img id="topBarIconSignal" class="topBarIcon" />
<img id="topBarIconBattery" class="topBarIcon" />
<span id="topBarTime"></span>
</div>
<div id="header" class="header">
<div style="width: 40px;"></div>
<img src="back.svg" style="width: auto; height: 48px;" />
<div style="width: 40px;"></div>
详情
</div>
<div id="main" class="main">
<div style="height: 30px;"></div>
<div class="avatarOut">
<div id="avatar" class="avatarIn squareImage" style="background-image: url(https://ae01.alicdn.com/kf/HTB1yE4fMmzqK1RjSZFp761kSXXal.png);"></div>
</div>
<div class="content">
<div id="name" class="name"></div>
<div style="height: 11px;"></div>
<div id="text" class="text"></div>
<div id="article" class="article" style="display: none;">
<div id="articleIcon" class="articleIcon squareImage" style="background-image: url(https://ae01.alicdn.com/kf/HTB1ci0Da5zxK1RjSspjq6AS.pXaD.jpg);"></div>
<div id="articleTitle" class="articleTitle"></div>
</div>
<div id="singleImage" class="singleImage" style="display: none;">
<img id="image" class="image" src="https://ae01.alicdn.com/kf/HTB13rXuJCzqK1RjSZPxq6A4tVXae.jpg" />
</div>
<div id="multiImage" class="multiImage" style="display: none;">
<div id="image1" class="multiImageBox squareImage"></div>
<div id="image2" class="multiImageBox squareImage"></div>
<div id="image3" class="multiImageBox squareImage"></div>
<div id="image4" class="multiImageBox squareImage"></div>
<div id="image5" class="multiImageBox squareImage"></div>
<div id="image6" class="multiImageBox squareImage"></div>
<div id="image7" class="multiImageBox squareImage"></div>
<div id="image8" class="multiImageBox squareImage"></div>
<div id="image9" class="multiImageBox squareImage"></div>
</div>
<div style="height: 20px;"></div>
<div class="info">
<span id="location" style="color: #576b95;"></span>
<div style="height: 20px;"></div>
<span id="time"></span> <span style="color: #576b95">删除</span>
</div>
<img src="comment.svg" style="position: relative; display: inline-block; width: auto; height: 42px; top: 9px;" />
</div>
<div style="height: 50px;"></div>
<img id="triangle" src="triangle.svg" width="40" height="16" style="position: relative; left: 25px; top: 5px;" />
<div id="like" class="like">
<img src="like.svg" width="32" height="32" style="position: relative; left: 30px; top: 40px; display: inline-block; vertical-align: top;" />
<div id="likeAvatarList" class="likeAvatarList"></div>
<div style="height: 17px;"></div>
</div>
</div>
<div id="footer" class="footer">
<div style="border: none; border-bottom: 2px solid #5ec838; font-size: 40px; color: #bbbbbb; width:760px; height: 88px; padding-left: 24px; padding-right: 24px; display: flex; align-items: center;">评论</div>
<div style="width: 22px; display: inline-block;"></div>
<img src="emoticon.svg" width="88" height="88" />
<div style="width: 40px; display: inline-block;"></div>
<div style="border: 2px solid #dcdcdc; border-radius: 7px; font-size: 36px; color: #dcdcdc; width: 122px; height: 88px; display: flex; align-items: center; justify-content: center; ">发送</div>
</div>
</div>
<div class="mdui-m-y-2" style="text-align: center; line-height: 1.5em;">
<a href="https://github.com/TransparentLC/WechatMomentScreenshot" target="_blank" style="text-decoration: none;"><img src="https://img.shields.io/github/stars/TransparentLC/WechatMomentScreenshot.svg?style=social" /> <img src="http://hits.dwyl.io/TransparentLC/WechatMomentScreenshot.svg" style="border-radius: 2px;" /></a>
<br />
<span class="mdui-typo-caption-opacity">© 2019 ✨小透明・宸✨</span>
</div>
<div id="generatedPopup" class="mdui-dialog">
<div class="mdui-dialog-title">生成完毕| ω・`)</div>
<img id="generated" />
<div class="mdui-typo-caption-opacity mdui-m-y-2">
如果点击“保存”没有反应
<br />
请尝试长按/右键图片进行另存为操作( ゚ 3゚)
</div>
<div class="mdui-dialog-actions">
<a id="save" class="mdui-btn mdui-ripple">保存</a>
<button class="mdui-btn mdui-ripple" mdui-dialog-close>关闭</button>
</div>
</div>
<div id="about" class="mdui-dialog">
<div class="mdui-dialog-title">关于</div>
<div class="mdui-dialog-content mdui-typo">
<h4>这个小工具是什么?</h4>
一个因为不喜欢也不想往朋友圈发某些不得不发的废文而做出来的摸鱼产物。
<h4>为什么生成的截图不是iOS版/7.x版微信的界面样式?</h4>
因为手上只有猴机,以及并不想用7.x版的微信。
<h4>能不能生成纯文字/转发图片的截图?</h4>
<del>懒得写样式,心情好<span class="heimu">有了萌妹子</span>的时候再加上~(*´ω`*)</del>
<br />
已经可以生成啦~但是小透明有<span class="heimu">萌妹子</span>了吗?
<br />
<strong>还没有。</strong>
<h4>生成图片后点击“保存”没有反应?</h4>
也可以试试长按图片手动另存为呢( ゚ 3゚)
<h4>开源就是好</h4>
<ul>
<li>
<a href="https://html2canvas.hertzen.com">html2canvas</a> 开源许可:<a href="https://github.com/niklasvh/html2canvas/blob/master/LICENSE">The MIT License</a>
</li>
<li>
<a href="https://www.mdui.org">MDUI</a> 开源许可:<a href="https://github.com/zdhxiong/mdui/blob/master/LICENSE">The MIT License</a>
</li>
<li>
<a href="https://github.com/google/material-design-icons">Material Design icons</a> 开源许可:<a href="https://github.com/google/material-design-icons/blob/master/LICENSE">Apache License 2.0</a>
</li>
<li>
<a href="https://www.iconfont.cn">Iconfont 阿里巴巴矢量图标库</a>
</li>
</ul>
</div>
<div class="mdui-dialog-actions">
<button class="mdui-btn mdui-ripple" mdui-dialog-close>OK</button>
</div>
</div>
<div id="request" class="mdui-dialog">
<div id="requestResult" class="mdui-dialog-title"></div>
<div id="requestResultContent" class="mdui-dialog-content mdui-typo"></div>
<div class="mdui-dialog-actions">
<button id="requestAction" class="mdui-btn mdui-ripple" mdui-dialog-close>OK</button>
</div>
</div>
<div id="donate" class="mdui-dialog">
<div class="mdui-dialog-title">请小透明喝一瓶肥宅快乐水~(*´∀`)</div>
<div class="mdui-dialog-content mdui-typo">
<div style="text-align: center;">
<div>
<img style="width: 50%;" src="https://ae01.alicdn.com/kf/HTB1DpS1VMHqK1RjSZFE763GMXXac.png" /><img style="width: 50%;" src="https://ae01.alicdn.com/kf/HTB1.nuUVHvpK1RjSZPi762mwXXat.png" />
</div>
<span class="mdui-typo-caption-opacity">扫一扫(`ε´ )<br />左:微信 右:支付宝</span>
</div>
</div>
<div class="mdui-dialog-actions">
<button class="mdui-btn mdui-ripple" mdui-dialog-close>OK</button>
</div>
</div>
</div>
<!--<script src="mdui.min.js"></script>-->
<!--<script src="https://cdn.bootcss.com/mdui/0.4.2/js/mdui.min.js"></script>-->
<!--<script src="https://cdn.jsdelivr.net/npm/mdui@0.4.2/dist/js/mdui.min.js"></script>-->
<!-- 因为jsDelivr对JS的压缩有问题导致对话框不能正常使用? https://github.com/zdhxiong/mdui/issues/190 -->
<script src="https://cdn.jsdelivr.net/npm/mdui@0.4.2/dist/js/mdui.js"></script>
<!--<script src="html2canvas.min.js"></script>-->
<!--<script src="https://html2canvas.hertzen.com/dist/html2canvas.min.js"></script>-->
<script src="https://cdn.jsdelivr.net/npm/html2canvas@1.0.0-alpha.12/dist/html2canvas.min.js"></script>
<script src="avatarURL.js"></script>
<script src="emoticon.js"></script>
<script src="fuckWechat.js"></script>
<script>
//mdui.alert('<span class="mdui-typo">本工具已获得微信官方“绿色网站”认证(滑稽),请不要尝试在微信中使用本工具。<br /><br />作者坚决反对破坏自由(而不是所谓“绿色”)上网环境的<a href="https://www.zhihu.com/question/318459753/answer/641027942" target="_blank">作恶行为</a>。<br /><br />请支持 996.icu 项目:</span><a href="https://996.icu" target="_blank"><img src="https://img.shields.io/badge/link-996.icu-red.svg" alt="996.icu" /></a>');
//输入微信文章的链接,通过后端自动获取文章标题和文章封面
function getArticleInfo() {
var requestDialog = new mdui.Dialog('#request');
mdui.prompt('公众号文章链接', function (value) {
var xhr = new XMLHttpRequest;
xhr.open('GET', 'https://lit-inlet-66876.herokuapp.com/get_article_info.php?url=' + encodeURIComponent(value)); //获取标题和封面的服务器
xhr.onreadystatechange = function () {
if (xhr.readyState == 4) {
var result = JSON.parse(xhr.responseText);
document.getElementById('requestAction').innerText = 'OK';
if (requestDialog.getState() == 'opening' || requestDialog.getState() == 'opened') {
if (typeof(result) != 'undefined' && result.success) {
document.getElementById('configArticleTitle').value = result.title;
document.getElementById('articleTitle').innerText = result.title;
document.getElementById('articleIcon').style.backgroundImage = 'url(\"' + result.cover + '\")';
document.getElementById('requestResult').innerText = '获取成功!(ゝ∀・)';
document.getElementById('requestResultContent').innerHTML = '标题:' + result.title + '<br />封面:<a target="_blank" href="' + result.cover + '">点此查看</a>';
} else {
document.getElementById('requestResult').innerText = '获取失败!( ´_っ`)';
document.getElementById('requestResultContent').innerHTML = '输入的链接是否为微信公众号文章?<br />(链接通常以 <code>https://mp.weixin.qq.com/</code> 作为开头)';
}
}
}
requestDialog.handleUpdate();
}
xhr.send();
document.getElementById('requestResult').innerText = '';
document.getElementById('requestAction').innerText = 'CANCEL';
document.getElementById('requestResultContent').innerHTML = '<div class="mdui-valign"><div class="mdui-spinner"></div><span class="mdui-m-l-2">获取中…… (o゚ω゚o)</span></div>';
mdui.updateSpinners();
requestDialog.open();
}, function () { });
}
function clearMultiImage() {
for (var i = 1; i <= 9; i++) {
document.getElementById('image' + i).style.backgroundImage = '';
}
}
//设置界面显示
document.getElementById('configTypeText').onclick = function () {
document.getElementById('configWebsite').style.display = 'none';
document.getElementById('configSingleImage').style.display = 'none';
document.getElementById('configMultiImage').style.display = 'none';
document.getElementById('article').style.display = 'none';
document.getElementById('singleImage').style.display = 'none';
document.getElementById('multiImage').style.display = 'none';
}
document.getElementById('configTypeWebsite').onclick = function () {
document.getElementById('configWebsite').style.display = 'block';
document.getElementById('configSingleImage').style.display = 'none';
document.getElementById('configMultiImage').style.display = 'none';
document.getElementById('article').style.display = 'flex';
document.getElementById('singleImage').style.display = 'none';
document.getElementById('multiImage').style.display = 'none';
}
document.getElementById('configTypeSingleImage').onclick = function () {
document.getElementById('configWebsite').style.display = 'none';
document.getElementById('configSingleImage').style.display = 'block';
document.getElementById('configMultiImage').style.display = 'none';
document.getElementById('article').style.display = 'none';
document.getElementById('singleImage').style.display = 'block';
document.getElementById('multiImage').style.display = 'none';
}
document.getElementById('configTypeMultiImage').onclick = function () {
document.getElementById('configWebsite').style.display = 'none';
document.getElementById('configSingleImage').style.display = 'none';
document.getElementById('configMultiImage').style.display = 'block';
document.getElementById('article').style.display = 'none';
document.getElementById('singleImage').style.display = 'none';
document.getElementById('multiImage').style.display = 'block';
}
//设初始值
var date = new Date();
document.getElementById('configScreenshotDate').valueAsDate = date;
document.getElementById('configScreenshotTimeHour').value = date.getHours();
document.getElementById('configScreenshotTimeMinute').value = date.getMinutes();
document.getElementById('configPostDate').valueAsDate = date;
document.getElementById('configPostTimeHour').value = date.getHours();
document.getElementById('configPostTimeMinute').value = date.getMinutes();
document.getElementById('configLike').value = Math.floor(20 * Math.random());
//检验数值是否合法
document.getElementById('configPostTimeHour').addEventListener('input', function () {
if (document.getElementById('configPostTimeHour').value > 23) {
document.getElementById('configPostTimeHour').value = 23;
} else if (document.getElementById('configPostTimeHour').value < 0) {
document.getElementById('configPostTimeHour').value = 0;
}
})
document.getElementById('configPostTimeMinute').addEventListener('input', function () {
if (document.getElementById('configPostTimeMinute').value > 59) {
document.getElementById('configPostTimeMinute').value = 59;
} else if (document.getElementById('configPostTimeMinute').value < 0) {
document.getElementById('configPostTimeMinute').value = 0;
}
})
document.getElementById('configScreenshotTimeHour').addEventListener('input', function () {
if (document.getElementById('configScreenshotTimeHour').value > 23) {
document.getElementById('configScreenshotTimeHour').value = 23;
} else if (document.getElementById('configScreenshotTimeHour').value < 0) {
document.getElementById('configScreenshotTimeHour').value = 0;
}
})
document.getElementById('configScreenshotTimeMinute').addEventListener('input', function () {
if (document.getElementById('configScreenshotTimeMinute').value > 59) {
document.getElementById('configScreenshotTimeMinute').value = 59;
} else if (document.getElementById('configScreenshotTimeMinute').value < 0) {
document.getElementById('configScreenshotTimeMinute').value = 0;
}
})
document.getElementById('configLike').addEventListener('input', function () {
if (document.getElementById('configLike').value < 0) {
document.getElementById('configLike').value = 0;
}
})
//上传图片
document.getElementById('configAvatar').addEventListener('change', function () {
document.getElementById('avatar').style.backgroundImage = 'url(\"' + window.URL.createObjectURL(this.files[0]) + '\")';
});
document.getElementById('configArticleIcon').addEventListener('change', function () {
document.getElementById('articleIcon').style.backgroundImage = 'url(\"' + window.URL.createObjectURL(this.files[0]) + '\")';
});
document.getElementById('configSetSingleImage').addEventListener('change', function () {
var reader = new FileReader;
reader.readAsDataURL(this.files[0]);
reader.onload = function () {
document.getElementById('image').src = this.result;
}
});
document.getElementById('configSetMultiImage1').addEventListener('change', function () {
document.getElementById('image1').style.backgroundImage = 'url(\"' + window.URL.createObjectURL(this.files[0]) + '\")';
});
document.getElementById('configSetMultiImage2').addEventListener('change', function () {
document.getElementById('image2').style.backgroundImage = 'url(\"' + window.URL.createObjectURL(this.files[0]) + '\")';
});
document.getElementById('configSetMultiImage3').addEventListener('change', function () {
document.getElementById('image3').style.backgroundImage = 'url(\"' + window.URL.createObjectURL(this.files[0]) + '\")';
});
document.getElementById('configSetMultiImage4').addEventListener('change', function () {
document.getElementById('image4').style.backgroundImage = 'url(\"' + window.URL.createObjectURL(this.files[0]) + '\")';
});
document.getElementById('configSetMultiImage5').addEventListener('change', function () {
document.getElementById('image5').style.backgroundImage = 'url(\"' + window.URL.createObjectURL(this.files[0]) + '\")';
});
document.getElementById('configSetMultiImage6').addEventListener('change', function () {
document.getElementById('image6').style.backgroundImage = 'url(\"' + window.URL.createObjectURL(this.files[0]) + '\")';
});
document.getElementById('configSetMultiImage7').addEventListener('change', function () {
document.getElementById('image7').style.backgroundImage = 'url(\"' + window.URL.createObjectURL(this.files[0]) + '\")';
});
document.getElementById('configSetMultiImage8').addEventListener('change', function () {
document.getElementById('image8').style.backgroundImage = 'url(\"' + window.URL.createObjectURL(this.files[0]) + '\")';
});
document.getElementById('configSetMultiImage9').addEventListener('change', function () {
document.getElementById('image9').style.backgroundImage = 'url(\"' + window.URL.createObjectURL(this.files[0]) + '\")';
});
document.getElementById('generate').addEventListener('click', function () {
//设置生成的图片上的各种属性
document.getElementById('name').innerText = document.getElementById('configName').value;
document.getElementById('text').innerText = document.getElementById('configText').value;
document.getElementById('articleTitle').innerText = document.getElementById('configArticleTitle').value;
if (document.getElementById('configLocation').value == '') {
document.getElementById('location').style.display = 'none';
} else {
document.getElementById('location').style.display = 'inline';
document.getElementById('location').innerText = document.getElementById('configLocation').value;
}
//表情替换
document.getElementById('text').innerText = document.getElementById('text').innerText.replace(/\r\n/g, '<br />');
document.getElementById('text').innerText = document.getElementById('text').innerText.replace(/\n/g, '<br />');
for (var i = 0; i < emoticon.length; i++) {
document.getElementById('text').innerText = document.getElementById('text').innerText.replace(new RegExp(emoticon[i].name, 'g'), '<img class="emoticon" src="' + emoticon[i].URL + '" />');
}
document.getElementById('text').innerHTML = document.getElementById('text').innerText;
//九宫格模式设定
if (document.getElementById('configTypeMultiImage').checked) {
for (var i = 1; i <= 9; i++) {
document.getElementById('image' + i).style.display = 'inline-block';
}
var multiImageCount = 0;
for (multiImageCount = 9; multiImageCount >= 1; multiImageCount--) {
if (document.getElementById('image' + multiImageCount).style.backgroundImage != '') {
break;
}
}
//四张图的修正
if (multiImageCount == 4) {
document.getElementById('image5').style.backgroundImage = document.getElementById('image4').style.backgroundImage;
document.getElementById('image4').style.backgroundImage = document.getElementById('image3').style.backgroundImage;
document.getElementById('image3').style.backgroundImage = '';
multiImageCount = 5;
}
for (var i = multiImageCount + 1; i <= 9; i++) {
document.getElementById('image' + i).style.display = 'none';
}
}
//设置顶栏图标
var iconWifi = [4, 4, 4, 4, 4, 3, 3, 3, 3, 2, 2, 2, 2, 1, 1, 1, 0];
var iconSignal = [4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 2, 2, 2, 2, 1, 1, 0];
var iconBattery = [20, 30, 50, 60, 80, 90, 'full'];
if (document.getElementById('configTopBarStatusIcons').checked) {
document.getElementById('topBarIconWifi').src = 'mdicons/ic_signal_wifi_' + iconWifi[Math.floor(Math.random() * iconWifi.length)] + '_bar_48px.svg';
document.getElementById('topBarIconSignal').src = 'mdicons/ic_signal_cellular_' + iconWifi[Math.floor(Math.random() * iconSignal.length)] + '_bar_48px.svg';
document.getElementById('topBarIconBattery').src = 'mdicons/ic_battery_' + ((Math.random() > 0.75) ? 'charging_' : '') + iconBattery[Math.floor(Math.random() * iconBattery.length)] + '_48px.svg';
} else {
document.getElementById('topBarIconWifi').src = 'mdicons/ic_signal_wifi_4_bar_48px.svg';
document.getElementById('topBarIconSignal').src = 'mdicons/ic_signal_cellular_4_bar_48px.svg';
document.getElementById('topBarIconBattery').src = 'mdicons/ic_battery_full_48px.svg';
}
var iconApp = [['qq', .5], ['wechat', .5], ['cloudmusic', .25], ['coolapk', .15], ['tieba', .15], ['acfun', .15]];
iconApp.sort(function () { return (Math.random() > .5) ? 1 : -1 });
document.getElementById('topBarAppIcons').innerHTML = '';
if (document.getElementById('configTopBarAppIcons').checked) {
for (var i = 0; i < iconApp.length; i++) {
if (Math.random() < iconApp[i][1]) {
document.getElementById('topBarAppIcons').innerHTML += '<img class="topBarIcon" src="mdicons/app_' + iconApp[i][0] +'.svg">';
}
}
}
//设置时间
var configPostDate = document.getElementById('configPostDate').valueAsDate;
configPostDate.setHours(document.getElementById('configPostTimeHour').value);
configPostDate.setMinutes(document.getElementById('configPostTimeMinute').value);
var configScreenshotDate = document.getElementById('configScreenshotDate').valueAsDate;
configScreenshotDate.setHours(document.getElementById('configScreenshotTimeHour').value);
configScreenshotDate.setMinutes(document.getElementById('configScreenshotTimeMinute').value);
if (document.getElementById('configScreenshotDate').valueAsDate.getTime() == document.getElementById('configPostDate').valueAsDate.getTime()) {
document.getElementById('time').innerText = ((configPostDate.getHours() < 10) ? ('0' + configPostDate.getHours()) : configPostDate.getHours()) + ':' + ((configPostDate.getMinutes() < 10) ? ('0' + configPostDate.getMinutes()) : configPostDate.getMinutes());
} else if (document.getElementById('configScreenshotDate').valueAsDate.getTime() - document.getElementById('configPostDate').valueAsDate.getTime() == 60 * 60 * 24 * 1000) {
document.getElementById('time').innerText = '昨天 ' + ((configPostDate.getHours() < 10) ? ('0' + configPostDate.getHours()) : configPostDate.getHours()) + ':' + ((configPostDate.getMinutes() < 10) ? ('0' + configPostDate.getMinutes()) : configPostDate.getMinutes());
} else {
document.getElementById('time').innerText = configPostDate.getFullYear() + '年' + (configPostDate.getMonth() + 1) + '月' + configPostDate.getDate() + '日 ' + ((configPostDate.getHours() < 10) ? ('0' + configPostDate.getHours()) : configPostDate.getHours()) + ':' + ((configPostDate.getMinutes() < 10) ? ('0' + configPostDate.getMinutes()) : configPostDate.getMinutes());
}
document.getElementById('topBarTime').innerText = ((document.getElementById('configScreenshotTimeHour').value < 10) ? ('0' + document.getElementById('configScreenshotTimeHour').value) : document.getElementById('configScreenshotTimeHour').value) + ':' + ((document.getElementById('configScreenshotTimeMinute').value < 10) ? ('0' + document.getElementById('configScreenshotTimeMinute').value) : document.getElementById('configScreenshotTimeMinute').value);
if (document.getElementById('configApp') != '') {
document.getElementById('time').innerText += ' ' + document.getElementById('configApp').value;
}
//加入点赞头像
var avatar = document.getElementsByClassName('likeAvatar');
var avatarSource = avatarURL.concat();
var avatarUsedIndex = 0;
document.getElementById('likeAvatarList').innerHTML = '';
for (var i = 0; i < document.getElementById('configLike').value; i++) {
if (avatarSource.length <= 0) {
avatarSource = avatarURL.concat();
}
avatarUsedIndex = Math.floor(Math.random() * avatarSource.length);
var div = document.createElement('div');
div.setAttribute('class', 'likeAvatar squareImage');
div.setAttribute('style', 'background-image: url(\"' + avatarSource[avatarUsedIndex] + '\");');
document.getElementById('likeAvatarList').appendChild(div);
avatarSource.splice(avatarUsedIndex, 1)
}
//显示用于生成图片的div
var height = Number(document.getElementById('configHeight').value);
document.getElementById('fakeWechatMoment').style.display = 'block';
document.getElementById('fakeWechatMoment').style.width = '1080px';
document.getElementById('fakeWechatMoment').style.height = '';
document.getElementById('fakeWechatMoment').style.height = ((window.getComputedStyle(document.getElementById('fakeWechatMoment')).height.replace('px', '') > height) ? window.getComputedStyle(document.getElementById('fakeWechatMoment')).height.replace('px', '') : height) + 'px';
//点赞数为0时隐藏点赞区
if (document.getElementById('configLike').value <= 0) {
document.getElementById('triangle').style.display = 'none';
document.getElementById('like').style.display = 'none';
} else {
document.getElementById('triangle').style.display = 'block';
document.getElementById('like').style.display = 'block';
}
//修正底部位置
var offset = Number(window.getComputedStyle(document.getElementById('topBar')).height.replace('px', '')) + Number(window.getComputedStyle(document.getElementById('header')).height.replace('px', '')) + Number(window.getComputedStyle(document.getElementById('main')).height.replace('px', ''));
document.getElementById('footer').style.bottom = ((offset < height - Number(window.getComputedStyle(document.getElementById('footer')).height.replace('px', ''))) ? (-height + Number(window.getComputedStyle(document.getElementById('footer')).height.replace('px', '')) + offset) : 0) + 'px';
//按钮上的提示
document.getElementById('generate').setAttribute('disabled', '');
document.getElementById('generate').innerText = '生成中...';
var option = {
useCORS: true,
scale: 1
}
html2canvas(document.getElementById('fakeWechatMoment'), option).then(function (canvas) {
var dURL = canvas.toDataURL();
document.getElementById('generated').src = dURL;
document.getElementById('save').setAttribute('href', dURL);
document.getElementById('save').setAttribute('download', (new Date()).getTime() + '.png');
(new mdui.Dialog(document.getElementById('generatedPopup'))).open();
//document.getElementById('fakeWechatMoment').style.display = 'none';
document.getElementById('generate').removeAttribute('disabled');
document.getElementById('generate').innerText = '生成'
});
});
</script>
</body>
</html>