forked from tjy-gitnub/win12
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdesktop.js
4174 lines (4100 loc) · 220 KB
/
desktop.js
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
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// 后端服务器
const server = 'http://win12server.freehk.svipss.top/';
const pages = {
'get-title': '', // 获取标题
};
document.querySelectorAll(`list.focs`).forEach(li => {
li.addEventListener('click', e => {
let _ = li.querySelector('span.focs'), la = li.querySelector('a.check'),
las = li.querySelectorAll('a');
$(_).addClass('cl');
$(_).css('top', la.offsetTop - las[las.length - 1].offsetTop);
$(_).css('left', la.offsetLeft - li.offsetLeft);
setTimeout(() => {
$(_).removeClass('cl');
}, 500);
})
});
// 禁止拖拽图片
$('img').on('dragstart', () => {
return false;
});
// 右键菜单
$('html').on('contextmenu', () => {
return false;
});
function stop(e) {
e.stopPropagation();
return false;
}
$('input,textarea,*[contenteditable=true]').on('contextmenu', (e) => {
stop(e);
return true;
});
function addMenu() {
var parentDiv = document.getElementById('desktop');
var childDivs = parentDiv.getElementsByTagName('div');
for (var i = 0; i < childDivs.length; i++) {
if (i <= 4) {//win12内置的5个图标不添加
continue;
}
var div = childDivs[i];
div.setAttribute('iconIndex', i - 5);
console.log(i - 5, div.getAttribute('appname'))
div.addEventListener('contextmenu', (event) => {
if (div.getAttribute('appname') != undefined) {
return showcm(event, 'desktop.icon', [div.getAttribute('appname'), div.getAttribute('iconIndex')]);
}
return false;
}, useCapture = true);
}
}
var run_cmd = '';
let nomax = { 'calc': 0 /* 其实,计算器是可以最大化的...*/, 'notepad-fonts': 0, 'camera-notice': 0, 'winver': 0, 'run': 0 , 'wsa':0};
let nomin = { 'notepad-fonts': 0, 'camera-notice': 0, 'run': 0};
var topmost=[];
var sys_setting = [1,1,1,0,0,1];
var use_music = true;
let cms = {
'titbar': [
function (arg) {
if (arg in nomax) {
return 'null';
}
if ($('.window.' + arg).hasClass("max")) {
return ['<i class="bi bi-window-stack"></i> 还原', `maxwin('${arg}')`];
}
else {
return ['<i class="bi bi-window-fullscreen"></i> 最大化', `maxwin('${arg}')`];
}
},
function (arg) {
if (arg in nomin) {
return 'null';
}
else {
return ['<i class="bi bi-window-dash"></i> 最小化', `minwin('${arg}')`];
}
},
function (arg) {
if (arg in nomin) {
return ['<i class="bi bi-window-x"></i> 关闭', `hidewin('${arg}', 'configs')`];
}
else {
return ['<i class="bi bi-window-x"></i> 关闭', `hidewin('${arg}')`];
}
},
],
'taskbar': [
function (arg) {
return ['<i class="bi bi-window-x"></i> 关闭', `hidewin('${arg}')`];
}
],
'desktop': [
['<i class="bi bi-arrow-clockwise"></i> 刷新', `$('#desktop').css('opacity','0');setTimeout(()=>{$('#desktop').css('opacity','1');},100);setIcon();`],
['<i class="bi bi-circle-square"></i> 切换主题', 'toggletheme()'],
`<a onmousedown="window.open('https://github.com/tjy-gitnub/win12','_blank');" win12_title="https://github.com/tjy-gitnub/win12" onmouseenter="showdescp(event)" onmouseleave="hidedescp(event)"><i class="bi bi-github"></i> 在 Github 中查看此项目</a>`,
function (arg) {
if (edit_mode) {
return ['<i class="bi bi-pencil"></i> 退出编辑模式', 'editMode();'];
}
else if (!edit_mode) {
return ['<i class="bi bi-pencil"></i> 进入编辑模式', 'editMode();'];
}
},
['<i class="bi bi-info-circle"></i> 关于 Win12 网页版', `$('#win-about>.about').addClass('show');$('#win-about>.update').removeClass('show');openapp('about');if($('.window.about').hasClass('min'))minwin('about');`],
['<i class="bi bi-brush"></i> 个性化', `openapp('setting');$('#win-setting > div.menu > list > a.enable.appearance')[0].click()`]
],
'desktop.icon':[
function (arg){
return ['<i class="bi bi-folder2-open"></i> 打开','openapp(`' + arg[0] + '`)']
},
function (arg) {
if (arg[1] >= 0) {
return ['<i class="bi bi-trash3"></i> 删除', 'desktopItem.splice(' + (arg[1] - 1) + ', 1);saveDesktop();setIcon();addMenu();'];
} else {
return ['<i class="bi bi-wrench-adjustable"></i> 属性', 'null'];
}
}
],
'winx': [
function (arg) {
if ($('#start-menu').hasClass("show")) {
return ['<i class="bi bi-box-arrow-in-down"></i> 关闭开始菜单', `hide_startmenu()`];
}
else {
return ['<i class="bi bi-box-arrow-in-up"></i> 打开开始菜单', `$('#start-btn').addClass('show');
if($('#search-win').hasClass('show')){$('#search-btn').removeClass('show');
$('#search-win').removeClass('show');setTimeout(() => {$('#search-win').removeClass('show-begin');
}, 200);}$('#start-menu').addClass('show-begin');setTimeout(() => {$('#start-menu').addClass('show');
}, 0);`];
}
},
'<hr>',
['<i class="bi bi-gear"></i> 设置', `openapp('setting')`],
['<i class="bi bi-terminal"></i> 运行', `openapp('run')`],
['<i class="bi bi-folder2-open"></i> 文件资源管理器', `openapp('explorer')`],
['<i class="bi bi-search"></i> 搜索', `$('#search-btn').addClass('show');hide_startmenu();
$('#search-win').addClass('show-begin');setTimeout(() => {$('#search-win').addClass('show');
$('#search-input').focus();}, 0);`],
'<hr>',
['<i class="bi bi-power"></i> 关机', `window.location='shutdown.html'`],
['<i class="bi bi-arrow-counterclockwise"></i> 重启', `window.location='reload.html'`],
],
'smapp': [
function (arg) {
return ['<i class="bi bi-window"></i> 打开', `openapp('${arg[0]}');hide_startmenu();`];
},
function (arg) {
return ['<i class="bi bi-link-45deg"></i> 在桌面创建链接', "var s=`<div class='b' ondblclick=openapp('" + arg[0] + "') ontouchstart=openapp('" + arg[0] + "') appname='" + arg[0] + "'><img src='icon/" + geticon(arg[0]) + "'><p>" + arg[1] + "</p></div>`;$('#desktop').append(s);desktopItem[desktopItem.length]=s;addMenu();saveDesktop();"];
},
function (arg) {
return ['<i class="bi bi-x"></i> 取消固定', `$('#s-m-r>.pinned>.apps>.sm-app.${arg[0]}').remove()`];
}
],
'smlapp': [
function (arg) {
return ['<i class="bi bi-window"></i> 打开', `openapp('${arg[0]}');hide_startmenu();`];
},
function (arg) {
return ['<i class="bi bi-link-45deg"></i> 在桌面创建链接', "var s=`<div class='b' ondblclick=openapp('" + arg[0] + "') ontouchstart=openapp('" + arg[0] + "') appname='" + arg[0] + "'><img src='icon/" + geticon(arg[0]) + "'><p>" + arg[1] + "</p></div>`;$('#desktop').append(s);desktopItem[desktopItem.length]=s;addMenu();saveDesktop();"];
},
function (arg) {
return ['<i class="bi bi-pin-angle"></i> 固定到开始菜单', "pinapp('" + arg[0] + "', '" + arg[1] + "', 'openapp("" + arg[0] + "");hide_startmenu();')"];
}
],
'msgupdate': [
['<i class="bi bi-layout-text-window-reverse"></i> 查看详细', `openapp('about');if($('.window.about').hasClass('min'))
minwin('about');$('#win-about>.about').removeClass('show');$('#win-about>.update').addClass('show');
$('#win-about>.update>div>details:first-child').attr('open','open')`],
['<i class="bi bi-box-arrow-right"></i> 关闭', `$('.msg.update').removeClass('show')`]
],
'explorer.folder': [
arg => {
return ['<i class="bi bi-folder2-open"></i> 打开', `apps.explorer.goto('${arg}')`];
},
arg => {
return ['<i class="bi bi-arrow-up-right-square"></i> 在新标签页中打开', `apps.explorer.newtab('${arg}');`];
},
arg => {
if ($('#win-explorer>.path>.tit>.path>div.text').length > 1)
return ['<i class="bi bi-trash3"></i> 删除', `apps.explorer.del('${arg}')`];
return 'null';
},
arg => {
if ($('#win-explorer>.path>.tit>.path>div.text').length > 1)
return ['<i class="bi bi-files"></i> 复制', `apps.explorer.copy_or_cut('${arg}','copy')`];
return 'null';
},
arg => {
if ($('#win-explorer>.path>.tit>.path>div.text').length > 1)
return ['<i class="bi bi-scissors"></i> 剪切', `apps.explorer.copy_or_cut('${arg}','cut')`];
return 'null';
},
arg => {
if ($('#win-explorer>.path>.tit>.path>div.text').length > 1)
return ['<i class="bi bi-input-cursor-text"></i> 重命名', `apps.explorer.rename('${arg}')`];
return 'null';
}
],
'explorer.file': [
arg => {
return ['<i class="bi bi-folder2-open"></i> 打开(目前毛用没有)', ``];
},
arg => {
if ($('#win-explorer>.path>.tit>.path>div.text').length > 1)
return ['<i class="bi bi-trash3"></i> 删除', `apps.explorer.del('${arg}')`];
return 'null';
},
arg => {
if ($('#win-explorer>.path>.tit>.path>div.text')[0].innerHTML != "此电脑")
return ['<i class="bi bi-files"></i> 复制', `apps.explorer.copy_or_cut('${arg}','copy')`];
return 'null';
},
arg => {
if ($('#win-explorer>.path>.tit>.path>div.text').length > 1)
return ['<i class="bi bi-scissors"></i> 剪切', `apps.explorer.copy_or_cut('${arg}','cut')`];
},
arg => {
if ($('#win-explorer>.path>.tit>.path>div.text').length > 1)
return ['<i class="bi bi-input-cursor-text"></i> 重命名', `apps.explorer.rename('${arg}')`];
return 'null';
}
],
'explorer.content': [
arg => {
if ($('#win-explorer>.path>.tit>.path>div.text').length > 1)
return ['<i class="bi bi-file-earmark-plus"></i> 新建文件', `apps.explorer.add($('#win-explorer>.path>.tit')[0].dataset.path,'新建文本文档.txt')`];
return 'null';
},
arg => {
if ($('#win-explorer>.path>.tit>.path>div.text').length > 1)
return ['<i class="bi bi-folder-plus"></i> 新建文件夹', `apps.explorer.add($('#win-explorer>.path>.tit')[0].dataset.path,'新建文件夹',type='files')`];
return 'null';
},
arg => {
if ($('#win-explorer>.path>.tit>.path>div.text').length > 1)
return ['<i class="bi bi-file-earmark-arrow-down"></i> 粘贴', `apps.explorer.paste($('#win-explorer>.path>.tit')[0].dataset.path,'新建文件夹',type='files')`];
return 'null';
},
arg => {
if ($('#win-explorer>.path>.tit>.path>div.text').length > 1)
return ['<i class="bi bi-arrow-clockwise"></i> 刷新', `apps.explorer.goto($('#win-explorer>.path>.tit')[0].dataset.path, false)`];
return ['<i class="bi bi-arrow-clockwise"></i> 刷新', `apps.explorer.reset()`];
}
],
'explorer.tab': [
arg => {
return ['<i class="bi bi-x"></i> 关闭标签页', `m_tab.close('explorer',${arg})`];
}
],
'edge.tab': [
arg => {
return ['<i class="bi bi-pencil-square"></i> 命名标签页', `apps.edge.c_rename(${arg})`];
},
arg => {
return ['<i class="bi bi-x"></i> 关闭标签页', `m_tab.close('edge',${arg})`];
}
],
'taskmgr.processes': [
arg => {
return ['<i class="bi bi-x"></i> 结束任务', `apps.taskmgr.taskkill('${arg}')`]
}
]
}
window.onkeydown=function(event){
if(event.keyCode==116/*F5被按下(刷新)*/){
event.preventDefault();/*取消默认刷新行为*/
$('#desktop').css('opacity','0');setTimeout(()=>{$('#desktop').css('opacity','1');},100);setIcon();
}
}
function showcm(e, cl, arg) {
if ($('#cm').hasClass('show-begin')) {
setTimeout(() => {
$('#cm').css('left', e.clientX);
$('#cm').css('top', e.clientY);
let h = '';
cms[cl].forEach(item => {
if (typeof (item) == 'function') {
arg.event = e;
ret = item(arg);
if (ret == 'null') return true;
h += `<a class="a" onmousedown="${ret[1]}">${ret[0]}</a>\n`;
}
else if (typeof (item) == 'string') {
h += item + '\n';
}
else {
h += `<a class="a" onmousedown="${item[1]}">${item[0]}</a>\n`;
}
})
$('#cm>list')[0].innerHTML = h;
$('#cm').addClass('show-begin');
$('#cm>.foc').focus();
// 这个.foc是用来模拟焦点的,这句是将焦点放在右键菜单上,注释掉后果不堪设想 >u-)o
// 噢 可是如果设置焦点的话在移动设备上会显示虚拟键盘啊 QAQ (By: User782Tec)
// (By: tjy-gitnub)
setTimeout(() => {
$('#cm').addClass('show');
}, 0);
setTimeout(() => {
if (e.clientY + $('#cm')[0].offsetHeight > $('html')[0].offsetHeight) {
$('#cm').css('top', e.clientY - $('#cm')[0].offsetHeight);
}
if (e.clientX + $('#cm')[0].offsetWidth > $('html')[0].offsetWidth) {
$('#cm').css('left', $('html')[0].offsetWidth - $('#cm')[0].offsetWidth - 5);
}
}, 200);
}, 200);
return;
}
$('#cm').css('left', e.clientX);
$('#cm').css('top', e.clientY);
let h = '';
cms[cl].forEach(item => {
if (typeof (item) == 'function') {
ret = item(arg);
console.log(arg, ret);
if (ret == 'null') {
return true;
}
h += `<a class="a" onmousedown="${ret[1]}">${ret[0]}</a>\n`;
} else if (typeof (item) == 'string') {
h += item + '\n';
} else {
h += `<a class="a" onmousedown="${item[1]}">${item[0]}</a>\n`;
}
})
$('#cm>list')[0].innerHTML = h;
$('#cm').addClass('show-begin');
$('#cm>.foc').focus();
setTimeout(() => {
$('#cm').addClass('show');
}, 0);
setTimeout(() => {
if (e.clientY + $('#cm')[0].offsetHeight > $('html')[0].offsetHeight) {
$('#cm').css('top', e.clientY - $('#cm')[0].offsetHeight);
}
if (e.clientX + $('#cm')[0].offsetWidth > $('html')[0].offsetWidth) {
$('#cm').css('left', $('html')[0].offsetWidth - $('#cm')[0].offsetWidth - 5);
}
}, 200);
}
$('#cm>.foc').blur(() => {
let x = event.target.parentNode;
$(x).removeClass('show');
setTimeout(() => {
$(x).removeClass('show-begin');
}, 200);
});
let font_window = false;
// 下拉菜单
dps = {
'notepad.file': [
['<i class="bi bi-file-earmark-plus"></i> 新建', `hidedp(true);$('#win-notepad>.text-box').addClass('down');
setTimeout(()=>{$('#win-notepad>.text-box').val('');$('#win-notepad>.text-box').removeClass('down')},200);`],
['<i class="bi bi-box-arrow-right"></i> 另存为', `hidedp(true);$('#win-notepad>.save').attr('href', window.URL.createObjectURL(new Blob([$('#win-notepad>.text-box').html()])));
$('#win-notepad>.save')[0].click();`],
'<hr>',
['<i class="bi bi-x"></i> 退出', `isOnDp=false;hidedp(true);hidewin('notepad')`],
],
'notepad.edit': [
['<i class="bi bi-files"></i> 复制 <info>Ctrl+C</info>', 'document.execCommand(\'copy\')'],
['<i class="bi bi-clipboard"></i> 粘贴 <info>Ctrl+V</info>', `document.execCommand(\'paste\')`],
['<i class="bi bi-scissors"></i> 剪切 <info>Ctrl+X</info>', 'document.execCommand(\'cut\')'],
'<hr>',
['<i class="bi bi-arrow-return-left"></i> 撤销 <info>Ctrl+Z</info>', 'document.execCommand(\'undo\')'],
['<i class="bi bi-arrow-clockwise"></i> 重做 <info>Ctrl+Y</info>', 'document.execCommand(\'redo\')'],
],
'notepad.view': [
['<i class="bi bi-type"></i> 插入正常字块', 'hidedp(true);$(\'#win-notepad>.text-box\')[0].innerHTML+=\'<p>T</p>\''],
['<i class="bi bi-type-h1"></i> 插入主标题', 'hidedp(true);$(\'#win-notepad>.text-box\')[0].innerHTML+=\'<h1>H1</h1>\''],
['<i class="bi bi-type-h2"></i> 插入次标题', 'hidedp(true);$(\'#win-notepad>.text-box\')[0].innerHTML+=\'<h2>H2</h2>\''],
['<i class="bi bi-type-h3"></i> 插入副标题', 'hidedp(true);$(\'#win-notepad>.text-box\')[0].innerHTML+=\'<h3>H3</h3>\''],
['<i class="bi bi-type-underline"></i> 插入下划线', 'hidedp(true);$(\'#win-notepad>.text-box\')[0].innerHTML+=\'<u>U</u>\''],
['<i class="bi bi-type-strikethrough"></i> 插入删除线', 'hidedp(true);$(\'#win-notepad>.text-box\')[0].innerHTML+=\'<s>S</s>\''],
['<i class="bi bi-type-italic"></i> 插入斜体字', 'hidedp(true);$(\'#win-notepad>.text-box\')[0].innerHTML+=\'<i>I</i>\''],
['<i class="bi bi-type-bold"></i> 插入加粗字', 'hidedp(true);$(\'#win-notepad>.text-box\')[0].innerHTML+=\'<b>B</b>\''],
'<hr>',
['<i class="bi bi-fonts"></i> 字体', 'font_window=true;hidedp(true);showwin(\'notepad-fonts\');apps.notepadFonts.reset();'],
]
}
function playWindowsBackground() {
var audio = new Audio("./media/Windows Background.wav")
audio.play()
}
let dpt = null, isOnDp = false;
$('#dp')[0].onmouseover = () => { isOnDp = true };
$('#dp')[0].onmouseleave = () => { isOnDp = false; hidedp() };
function showdp(e, cl, arg) {
if ($('#dp').hasClass('show-begin')) {
$('#dp').removeClass('show');
setTimeout(() => {
$('#dp').removeClass('show-begin');
}, 200);
if (e != dpt) {
setTimeout(() => {
showdp(e, cl, arg);
}, 400);
}
return;
}
// dpt = e;
let off = $(e).offset();
$('#dp').css('left', off.left);
$('#dp').css('top', off.top + e.offsetHeight);
let h = '';
dps[cl].forEach(item => {
if (typeof (item) == 'function') {
ret = item(arg);
if (ret == 'null') {
return true;
}
h += `<a class="a" onclick="${ret[1]}">${ret[0]}</a>\n`;
} else if (typeof (item) == 'string') {
h += item + '\n';
} else {
h += `<a class="a" onclick="${item[1]}">${item[0]}</a>\n`;
}
})
$('#dp>list')[0].innerHTML = h;
$('#dp').addClass('show-begin');
setTimeout(() => {
$('#dp').addClass('show');
}, 0);
setTimeout(() => {
if (off.top + e.offsetHeight + $('#dp')[0].offsetHeight > $('html')[0].offsetHeight) {
$('#dp').css('top', off.top - $('#dp')[0].offsetHeight);
}
if (off.left + $('#dp')[0].offsetWidth > $('html')[0].offsetWidth) {
$('#dp').css('left', $('html')[0].offsetWidth - $('#dp')[0].offsetWidth - 5);
}
}, 200);
}
function hidedp(force = false) {
setTimeout(() => {
if (isOnDp && !force) {
return;
}
$('#dp').removeClass('show');
setTimeout(() => {
$('#dp').removeClass('show-begin');
}, 200);
}, 100);
}
// 悬停提示
document.querySelectorAll('*[win12_title]:not(.notip)').forEach(a => {
a.addEventListener('mouseenter', showdescp);
a.addEventListener('mouseleave', hidedescp);
})
function showdescp(e) {
$(e.target).attr('data-descp', 'waiting');
setTimeout(() => {
if ($(e.target).attr('data-descp') == 'hide') {
return;
}
$(e.target).attr('data-descp', 'show');
$('#descp').css('left', e.clientX + 15);
$('#descp').css('top', e.clientY + 20);
$('#descp').text($(e.target).attr('win12_title'));
$('#descp').addClass('show-begin');
setTimeout(() => {
if (e.clientY + $('#descp')[0].offsetHeight + 20 >= $('html')[0].offsetHeight) {
$('#descp').css('top', e.clientY - $('#descp')[0].offsetHeight - 10);
}
if (e.clientX + $('#descp')[0].offsetWidth + 15 >= $('html')[0].offsetWidth) {
$('#descp').css('left', e.clientX - $('#descp')[0].offsetWidth - 10);
}
$('#descp').addClass('show');
}, 100);
}, 500);
}
function hidedescp(e) {
$('#descp').removeClass('show');
$(e.target).attr('data-descp', 'hide');
setTimeout(() => {
$('#descp').removeClass('show-begin');
}, 100);
}
// 提示
let nts = {
'about': {
cnt: `<p class="tit">Windows 12 网页版</p>
<p>Windows 12 网页版是一个开放源项目,<br />
希望让用户在网络上预先体验 Windows 12,<br />
内容可能与 Windows 12 正式版本不一致。<br />
使用标准网络技术,例如 HTML, CSS 和 JS<br />
此项目绝不附属于微软,且不应与微软操作系统或产品混淆,<br />
这也不是 Windows365 cloud PC<br />
本项目中微软、Windows和其他示范产品是微软公司的商标<br />
本项目中谷歌、Android和其他示范产品是谷歌公司的商标</p>`,
btn: [
{ type: 'main', text: '关闭', js: 'closenotice();' },
{ type: 'detail', text: '更多', js: "closenotice();openapp('about');if($('.window.about').hasClass('min'))minwin('about');$('.dock.about').removeClass('show')" },
]
},
'feedback': {
cnt: `<p class="tit">反馈</p>
<p>我们非常注重用户的体验与反馈</p>
<list class="new">
<a class="a" onclick="window.open('https://github.com/tjy-gitnub/win12/issues','_blank');" win12_title="在浏览器新窗口打开链接" onmouseenter="showdescp(event)" onmouseleave="hidedescp(event)">在github上提交issue(需要github账户,会得到更高重视)</a>
<a class="a" onclick="window.open('https://forms.office.com/Pages/ResponsePage.aspx?id=DQSIkWdsW0yxEjajBLZtrQAAAAAAAAAAAAO__SDw7SZURjUzOUo0VEVXU1pMWlFTSUVGWDNYWU1EWS4u','_blank');" win12_title="在浏览器新窗口打开链接" onmouseenter="showdescp(event)" onmouseleave="hidedescp(event)">在Microsoft Forms上发送反馈(不需要账户,也会重视)</a>
</list>`,
btn: [
{ type: 'main', text: '关闭', js: 'closenotice();' },
]
},
'widgets': {
cnt: `
<p class="tit">添加小组件</p>
<list class="new">
<a class="a" onclick="closenotice(); widgets.widgets.add('calc');">计算器</a>
<a class="a" onclick="closenotice(); widgets.widgets.add('weather');">天气</a>
<a class="a" onclick="closenotice(); widgets.widgets.add('monitor');">系统性能监视器</a>
</list>`,
btn: [
{ type: 'cancel', text: '取消', js: 'closenotice();' }
]
},
'ZeroDivision': {//计算器报错窗口
cnt: `<p class="tit">错误</p>
<p>除数不得等于0</p>`,
btn: [
{ type: 'main', text: '确定', js: 'closenotice();' },
]
},
'Can-not-open-file': {
cnt: `<p class="tit">` + run_cmd + `</p>
<p>Windows 找不到文件 '` + run_cmd + `'。请确定文件名是否正确后,再试一次。</p> `,
btn: [
{ type: 'main', text: '确定', js: 'closenotice();' },
{ type: 'detail', text: '在 Micrsoft Edge 中搜索', js: 'closenotice();openapp(\'edge\');window.setTimeout(() => {apps.edge.newtab();apps.edge.goto(' + run_cmd + ');}, 300);' }
]
},
'widgets.monitor': {
cnt: `
<p class="tit">切换监视器类型</p>
<list class="new">
<a class="a" onclick="closenotice(); widgets.monitor.type = 'cpu';">CPU利用率</a>
<a class="a" onclick="closenotice(); widgets.monitor.type = 'memory';">内存使用率</a>
<a class="a" onclick="closenotice(); widgets.monitor.type = 'disk';">磁盘活动时间</a>
<a class="a" onclick="closenotice(); widgets.monitor.type = 'wifi-receive';">网络吞吐量-接收</a>
<a class="a" onclick="closenotice(); widgets.monitor.type = 'wifi-send';">网络吞吐量-发送</a>
<a class="a" onclick="closenotice(); widgets.monitor.type = 'gpu';">GPU利用率</a>
</list>`,
btn: [
{ type: 'cancel', text: '取消', js: 'closenotice();' }
]
},
'widgets.desktop': {
cnt: `
<p class="tit">添加桌面小组件</p>
<list class="new">
<a class="a" onclick="closenotice(); widgets.widgets.add('calc'); widgets.widgets.addToDesktop('calc');">计算器</a>
<a class="a" onclick="closenotice(); widgets.widgets.add('weather'); widgets.widgets.addToDesktop('weather');">天气</a>
<a class="a" onclick="closenotice(); widgets.widgets.add('monitor'); widgets.widgets.addToDesktop('monitor');">系统性能监视器</a>
</list>`,
btn: [
{ type: 'cancel', text: '取消', js: 'closenotice();' }
]
},
'duplication file name': {
cnt: `
<p class="tit">错误</p>
<p>文件名重复</p>`,
btn: [
{ type: 'cancel', text: '取消', js: 'closenotice();' }
]
},
'about-copilot': {
cnt: `
<p class="tit">关于 Windows 12 Copilot</p>
<p>你可以使用此AI助手帮助你更快地完成工作 (有人用win12工作?)<br>
由于chatgpt3.5理解力较差,所以间歇性正常工作。<br>
有任何关于本ai的反馈请让ai帮你打开copilot反馈界面<br>
因为chatgpt是白嫖来的,所以请适量使用不要太猖狂。<br>
也请适当使用,不要谈论敏感、违规话题,号被封了所有人都没,<br>请有身为一个人类最基本的道德底线。<br>
小项目难免会有bug,见谅,后端由 github@NB-Bgroup 提供</p>`,
btn: [
{ type: 'main', text: '确定', js: 'closenotice();' },
]
},
'feedback-copilot': {
cnt: `<p class="tit">反馈 Windows 12 Copilot</p>
<p>我们非常注重用户的体验与反馈,非常感谢对AI Copilot的建议</p>
<list class="new">
<a class="a" onclick="window.open('https://github.com/tjy-gitnub/win12/issues','_blank');" win12_title="在浏览器新窗口打开链接" onmouseenter="showdescp(event)" onmouseleave="hidedescp(event)">在github上提交issue (需要github账户,会得到更高重视)</a>
<a class="a" onclick="window.open('https://forms.office.com/Pages/ResponsePage.aspx?id=DQSIkWdsW0yxEjajBLZtrQAAAAAAAAAAAAO__SDw7SZURjUzOUo0VEVXU1pMWlFTSUVGWDNYWU1EWS4u','_blank');" win12_title="在浏览器新窗口打开链接" onmouseenter="showdescp(event)" onmouseleave="hidedescp(event)">在Microsoft Forms上发送反馈(不需要账户,也会重视)</a>
</list>
`,
btn: [
{ type: 'main', text: '关闭', js: 'closenotice();' }
]
},
'shutdown': {
cnt: `
<p class="tit">即将注销你的登录</p>
<p>Windows 将在 114514 分钟后关闭。</p>`,
btn: [
{ type: 'main', text: '关闭', js: 'closenotice();' }
]
},
'setting.update': {
cnt: `
<p class="tit">更新已就绪</p>
<p>请重启电脑以应用更新</p>
`,
btn: [
{ type: 'main', text: '立即重启', js: 'location.href = `./reload.html`;' },
{ type: 'detail', text: '稍后重启', js: 'closenotice();'}
]
}
}
function shownotice(name) {
$('#notice>.cnt').html(nts[name].cnt);
let tmp = '';
nts[name].btn.forEach(btn => {
tmp += `<a class="a btn ${btn.type}" onclick="${btn.js}">${btn.text}</a>`
});
$('#notice>.btns').html(tmp);
$('#notice-back').addClass('show');
setTimeout(() => {
$('#notice').addClass('show');
}, 200);
}
function closenotice() {
$('#notice').removeClass('show');
setTimeout(() => {
$('#notice-back').removeClass('show');
}, 200);
}
var shutdown_task = []; //关机任务,储存在这个数组里
// 应用
let apps = {
setting: {
init: () => {
$('#win-setting>.menu>list>a.system')[0].click();
$('#win-setting>.page>.cnt.update>.setting-list>div:last-child>.alr>a.checkbox')[localStorage.getItem('autoUpdate') == 'true' ? 'addClass' : 'removeClass']('checked');
apps.setting.checkUpdate();
},
page: (name) => {
$('#win-setting>.page>.cnt.' + name).scrollTop(0);
$('#win-setting>.page>.cnt.show').removeClass('show');
$('#win-setting>.page>.cnt.' + name).addClass('show');
$('#win-setting>.menu>list>a.check').removeClass('check');
$('#win-setting>.menu>list>a.' + name).addClass('check');
},
theme_get: () => {
$('#set-theme').html(`<loading><svg width="30px" height="30px" viewBox="0 0 16 16">
<circle cx="8px" cy="8px" r="7px" style="stroke:#7f7f7f50;fill:none;stroke-width:3px;"></circle>
<circle cx="8px" cy="8px" r="7px" style="stroke:#2983cc;stroke-width:3px;"></circle></svg></loading>`)
// 实时获取主题
$.get('https://api.github.com/repos/tjy-gitnub/win12-theme/contents').then(cs => {
cs.forEach(c => {
if (c.type == 'dir') {
$.get(c.url).then(cnt => {
$('#set-theme').html('');
cnt.forEach(cn => {
if (cn.name == 'theme.json') {
$.getJSON('https://tjy-gitnub.github.io/win12-theme/' + cn.path).then(inf => {
infjs = inf;
if ($('#set-theme>loading').length)
$('#set-theme').html('');
$('#set-theme').append(`<a class="a act" onclick="apps.setting.theme_set('${c.name}')" style="background-image:url('https://tjy-gitnub.github.io/win12-theme/${c.name}/view.jpg')">${c.name}</a>`);
})
}
})
})
}
});
});
},
theme_set: (infp) => {
$.get('https://api.github.com/repos/tjy-gitnub/win12-theme/contents/' + infp).then(cnt => {
console.log('https://api.github.com/repos/tjy-gitnub/win12-theme/contents/' + infp);
cnt.forEach(cn => {
if (cn.name == 'theme.json') {
$.getJSON('https://tjy-gitnub.github.io/win12-theme/' + cn.path).then(inf => {
infjs = inf;
cnt.forEach(fbg => {
console.log(fbg, infjs);
if (fbg.name == infjs.bg) {
$(':root').css('--bgul', `url('https://tjy-gitnub.github.io/win12-theme/${fbg.path}')`);
$(':root').css('--theme-1', infjs.color1);
$(':root').css('--theme-2', infjs.color2);
$(':root').css('--href', infjs.href);
// $('#set-theme').append(`<a class="a act" onclick="apps.setting.theme_set(\`(${inf})\`)" style="background-image:url('https://tjy-gitnub.github.io/win12-theme/${fbg.path}')">${c.name}</a>`);
}
})
})
}
})
})
},
checkUpdate: () => {
$('#win-setting>.page>.cnt.update>.lo>.update-main .notice')[0].innerText = '正在检查更新...';
$('#win-setting>.page>.cnt.update>.lo>.update-main .detail')[0].innerHTML = ' ';
$('#win-setting>.page>.cnt.update>.setting-list>.update-now').addClass('disabled');
$('#win-setting>.page>.cnt.update>.setting-list>.update-now>div>p:first-child')[0].innerText = '正在检查更新...';
$('#win-setting>.page>.cnt.update>.setting-list>.update-now>div>p:last-child')[0].innerHTML = ' ';
$('#win-setting>.page>.cnt.update>.lo>.update-main>div:last-child').addClass('disabled');
fetch('https://api.github.com/repos/tjy-gitnub/win12/commits').then(res => {
res.json().then(json => {
const sha = localStorage.getItem('sha');
if (sha != json[0].sha) {
let msg = json[0].commit.message.split('\n\n')[0];
if (msg.match(/v[0-9]*\.[0-9]*\.[0-9]*/)) {
msg = msg.match(/v[0-9]*\.[0-9]*\.[0-9]*/)[0];
window.setTimeout(() => {
$('#win-setting>.page>.cnt.update>.lo>.update-main .notice')[0].innerText = 'Windows 12 有更新可用';
$('#win-setting>.page>.cnt.update>.lo>.update-main .detail')[0].innerText = `目前最新版本: ${msg}`;
$('#win-setting>.page>.cnt.update>.lo>.update-main>div:last-child').removeClass('disabled');
$('#win-setting>.page>.cnt.update>.setting-list>.update-now>div>p:first-child')[0].innerText = '更新已就绪';
$('#win-setting>.page>.cnt.update>.setting-list>.update-now>div>p:last-child')[0].innerText = msg;
$('#win-setting>.page>.cnt.update>.setting-list>.update-now').removeClass('disabled');
}, 6000);
}
else {
window.setTimeout(() => {
let da = new Date();
$('#win-setting>.page>.cnt.update>.lo>.update-main .notice')[0].innerText = 'Windows 12 目前是最新版本';
$('#win-setting>.page>.cnt.update>.lo>.update-main .detail')[0].innerText = `上次检查时间: ${da.getFullYear()}年${da.getMonth() + 1}月${da.getDate()}日,${da.getHours()}: ${da.getMinutes()}`;
$('#win-setting>.page>.cnt.update>.lo>.update-main>div:last-child').removeClass('disabled');
$('#win-setting>.page>.cnt.update>.setting-list>.update-now>div>p:first-child')[0].innerText = '无更新可用';
$('#win-setting>.page>.cnt.update>.setting-list>.update-now>div>p:last-child')[0].innerText = 'Windows 12 目前是最新版本';
}, 6000)
}
}
});
});
}
},
run: {
init: () => {
$('#win-run>.open>input').val(run_cmd); //在windows中,运行输入的内容会被保留
window.setTimeout(() => {
$('#win-run>.open>input').focus();
$('#win-run>.open>input').select();
}, 300);
},
run: (cmd) => {
if (cmd == 'cmd' || cmd == 'cmd.exe') {
run_cmd = cmd;
openapp('terminal');
}
else if (cmd.includes("shutdown")) {//关机指令
run_cmd = cmd
var cmds = cmd.split(' ');
if (cmds.includes("shutdown") || cmds.includes("shutdown.exe")) { //帮助
if (cmds.length == 1) {
openapp('terminal');
$('#win-terminal').html(`用法: shutdown [/i | /l | /s | /sg | /r | /g | /a | /p | /h | /e | /o] [/hybrid] [/soft] [/fw] [/f]<br />
[/m \\computer][/t xxx][/d [p|u:]xx:yy [/c "comment"]]<br />
<br />
没有参数 显示帮助。这与键入 /? 是一样的。<br />
/? 显示帮助。这与不键入任何选项是一样的。<br />
/i 显示图形用户界面(GUI)。<br />
这必须是第一个选项。<br />
/l 注销。这不能与 /m 或 /d 选项一起使用。<br />
/s 关闭计算机。<br />
/sg 关闭计算机。在下一次启动时,如果启用了<br />
自动重启登录,则将自动登录并锁定上次交互用户。<br />
登录后,重启任何已注册的应用程序。<br />
/r 完全关闭并重启计算机。<br />
/g 完全关闭并重启计算机。重新启动系统后,<br />
如果启用了自动重启登录,则将自动登录并<br />
锁定上次交互用户。<br />
登录后,重启任何已注册的应用程序。<br />
/a 中止系统关闭。<br />
这只能在超时期间使用。<br />
与 /fw 结合使用,以清除任何未完成的至固件的引导。<br />
/p 关闭本地计算机,没有超时或警告。<br />
可以与 /d 和 /f 选项一起使用。<br />
/h 休眠本地计算机。<br />
可以与 /f 选项一起使用。<br />
/hybrid 执行计算机关闭并进行准备以快速启动。<br />
必须与 /s 选项一起使用。<br />
/fw 与关闭选项结合使用,使下次启动转到<br />
固件用户界面。<br />
/e 记录计算机意外关闭的原因。<br />
/o 转到高级启动选项菜单并重新启动计算机。<br />
必须与 /r 选项一起使用。<br />
/m \\computer 指定目标计算机。<br />
/t xxx 将关闭前的超时时间设置为 xxx 秒。<br />
有效范围是 0-315360000 (10 年),默认值为 30。<br />
如果超时期限大于 0,则 /f 参数为<br />
/f 参数。<br />
/c "comment" 注释重启或关闭的原因。<br />
最多允许 512 个字符。<br />
/f 强制关闭正在运行的应用程序而不事先警告用户。<br />
当大于 0 的值为<br />
时,隐含 /f 参数 则默示为 /f 参数。<br />
/d [p|u:]xx:yy 提供重新启动或关闭的原因。<br />
p 指示重启或关闭是计划内的。<br />
u 指示原因是用户定义的。<br />
如果未指定 p 和 u,则<br />
重新启动或关闭 是计划外的。<br />
xx 是主要原因编号(小于 256 的正整数)。<br />
yy 是次要原因编号(小于 65536 的正整数)。<br />
<br />
此计算机上的原因:<br />
(E = 预期 U = 意外 P = 计划内,C = 自定义)<br />
类别 主要 次要 标题<br />
<br />
U 0 0 其他(计划外)<br />
E 0 0 其他(计划外)<br />
E P 0 0 其他(计划内)<br />
U 0 5 其他故障: 系统没有反应<br />
E 1 1 硬件: 维护(计划外)<br />
E P 1 1 硬件: 维护(计划内)<br />
E 1 2 硬件: 安装(计划外)<br />
E P 1 2 硬件: 安装(计划内)<br />
E 2 2 操作系统: 恢复(计划外)<br />
E P 2 2 操作系统: 恢复(计划内)<br />
P 2 3 操作系统: 升级(计划内)<br />
E 2 4 操作系统: 重新配置(计划外)<br />
E P 2 4 操作系统: 重新配置(计划内)<br />
P 2 16 操作系统: Service Pack (计划内)<br />
2 17 操作系统: 热修补(计划外)<br />
P 2 17 操作系统: 热修补(计划内)<br />
2 18 操作系统: 安全修补(计划外)<br />
P 2 18 操作系统: 安全修补(计划内)<br />
E 4 1 应用程序: 维护(计划外)<br />
E P 4 1 应用程序: 维护(计划内)<br />
E P 4 2 应用程序: 安装(计划内)<br />
E 4 5 应用程序: 没有反应<br />
E 4 6 应用程序: 不稳定<br />
U 5 15 系统故障: 停止错误<br />
U 5 19 安全问题(计划外)<br />
E 5 19 安全问题(计划外)<br />
E P 5 19 安全问题(计划内)<br />
E 5 20 网络连接丢失(计划外)<br />
U 6 11 电源故障: 电线被拔掉<br />
U 6 12 电源故障: 环境<br />
P 7 0 旧版 API 关机<br />
<br />
提示:大多数功能可能有点困难,看看就好<br />
<br />
<pre>请按任意键继续. . .<input type="text" onkeydown="hidewin('terminal')"></input></pre>`); //Q:为什么文字这么多呢?A:shutdown的帮助本来就多,为了能显示空格,就把空格用 代替了 User782Tec: 是不是有一种东西叫做innerText?
$('#win-terminal>pre>input').focus()
} else if (cmds.includes("-s") || cmds.includes("/s")) {//关机
if ((cmds.indexOf("-t") != -1 && cmd.length/*判断是否-t后有其他参数*/ >= cmds.indexOf("-t") + 2/*先加一,获取当下标是从1开始的时候的下标索引;再加一,获取下一项。配合数组.length使用*/) || (cmds.indexOf("/t") != -1 && cmd.length/*判断是否-t后有其他参数*/ >= cmds.indexOf("/t") + 2)) {
str = "";
if (cmds.includes("-t")) { str = "-t"; }
if (cmds.includes("/t")) { str = "/t"; }
if (!isNaN(cmds[cmds.indexOf(str) + 1]/*这里只加一是因为下标是从0开始的*/)) {
num = parseInt(cmds[cmds.indexOf(str) + 1])
nts['shutdown'] = {
cnt: `
<p class="tit">即将注销你的登录</p>
<p>Windows 将在 ` + num / 60 + ` 分钟后关闭。</p>`,
btn: [
{ type: 'main', text: '关闭', js: 'closenotice();' },
]
};
shutdown_task[shutdown_task.length] = setTimeout("window.location.href = './shutdown.html'", num * 1000);
if (!(cmds.includes("/f") || cmds.includes("-f"))) {
shownotice('shutdown');
}
}
}
} else if (cmds.includes("-r") || cmds.includes("/r")) {//重启
if ((cmds.indexOf("-t") != -1 && cmd.length >= cmds.indexOf("-t") + 2) || (cmds.indexOf("/t") != -1 && cmd.length >= cmds.indexOf("/t") + 2)) {/*详见上面的注释*/
str = "";
if (cmds.includes("-t")) { str = "-t"; }
if (cmds.includes("/t")) { str = "/t"; }
if (!isNaN(cmds[cmds.indexOf(str) + 1])) {
num = parseInt(cmds[cmds.indexOf(str) + 1])
nts['shutdown'] = {
cnt: `
<p class="tit">即将注销你的登录</p>
<p>Windows 将在 ` + num / 60 + ` 分钟后关闭。</p>`,
btn: [
{ type: 'main', text: '关闭', js: 'closenotice();' },
]
};
shutdown_task[shutdown_task.length] = setTimeout("window.location.href = './reload.html'", num * 1000);
if (!(cmds.includes("/f") || cmds.includes("-f"))) {
shownotice('shutdown');
}
}
}
} else if (cmds.includes("-a") || cmds.includes("/a")) {//取消电源操作
if (shutdown_task.length > 0) {
for (var i = 0; i < shutdown_task.length; i++) {
if (shutdown_task[i] != null) {
try {
clearTimeout(shutdown_task[i]);
} catch (err) { console.log(err); }
shutdown_task[i] = null;
}
}
nts['shutdown'] = {
cnt: `
<p class="tit">注销已取消</p>
<p>计划的关闭已取消。</p>`,
btn: [
{ type: 'main', text: '关闭', js: 'closenotice();' },
]
};
shownotice('shutdown');
}
}
}
}
else if (cmd != '') {
try {
cmd = cmd.replace(/\/$/, '');
var pathl = cmd.split('/');
let tmp = apps.explorer.path;
let valid = true;
pathl.forEach(name => {
if (tmp['folder'].hasOwnProperty(name)) {
tmp = tmp['folder'][name];
}
else {
valid = false;
return false;
}
});
if (valid == true) {
run_cmd = cmd;
openapp('explorer');
window.setTimeout(() => {
apps.explorer.goto(cmd);
}, 300);
}
else {
var have_exe = false;
if (cmd.substring(cmd.length - 4, cmd.length) == '.exe') {//如果有“.exe”,就去掉“.exe”,再判断
cmd = cmd.substring(0, cmd.length - 4);
have_exe = true;
}
if ($('.window.' + cmd)[0] && !$('.window.' + cmd).hasClass('configs') && (cmd != "EasterEgg" && cmd != "EasterEgg.exe"/*细节:彩蛋只能通过设置打开!*/)) {
openapp(cmd);
cmd += have_exe ? '.exe' : ''
run_cmd = cmd;
}
else {
cmd += have_exe ? '.exe' : '';//把裁剪出来的加回去
nts['Can-not-open-file'] = {
cnt: `<p class="tit">` + cmd + `</p>
<p>Windows 找不到文件 '` + cmd + `'。请确定文件名是否正确后,再试一次。</p> `,
btn: [
{ type: 'main', text: '确定', js: "closenotice();showwin('run');$('#win-run>.open>input').select();" },
{ type: 'cancel', text: '在 Micrsoft Edge 中搜索', js: "closenotice();openapp(\'edge\');window.setTimeout(() => {apps.edge.newtab();apps.edge.goto('https://www.bing.com/search?q=" + encodeURIComponent(cmd) + "');}, 300);" }
]
}
shownotice('Can-not-open-file');
}
}
}
catch {
nts['Can-not-open-file'] = {
cnt: `<p class="tit">` + cmd + `</p>
<p>Windows 找不到文件 '` + cmd + `'。请确定文件名是否正确后,再试一次。</p> `,
btn: [
{ type: 'main', text: '确定', js: "closenotice();showwin('run');$('#win-run>.open>input').select();" },
{ type: 'cancel', text: '在 Micrsoft Edge 中搜索', js: "closenotice();openapp(\'edge\');window.setTimeout(() => {apps.edge.newtab();apps.edge.goto('https://www.bing.com/search?q=" + encodeURIComponent(cmd) + "');}, 300);" }
]
}
shownotice('Can-not-open-file');
}
}
}
},
taskmgr: {
sortType: 'cpu',
sortOrder: 'up-down',
tasks: structuredClone(taskmgrTasks),
cpu: 0,
cpuCtx: null,
cpuCanvas: null,
cpuLastPos: [0, 0],
cpuBgCanvas: null,
cpuBgCtx: null,
cpuRunningTime: 0,
memory: 0,
memoryCtx: null,
memoryCanvas: null,
memoryLastPos: [0, 0],
memoryBgCanvas: null,
memoryBgCtx: null,
memoryCanvas2: null,
memoryCtx2: null,
disk: 0,
diskSpeed: {
read: 0,
write: 0
},
diskCanvas: null,
diskCtx: null,
diskLastPos: [0, 0],
diskBgCanvas: null,