als-document 1.1.2 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/browser-tests/data/html1.js +2579 -0
  2. package/browser-tests/data/html2.js +1124 -0
  3. package/browser-tests/data/svg.js +66 -0
  4. package/{tests → browser-tests}/index.html +1 -1
  5. package/browser-tests/utils.js +37 -0
  6. package/build-readme.js +8 -0
  7. package/{src/build.js → build.js} +4 -4
  8. package/docs/#.md +52 -0
  9. package/docs/1.parseHTML.md +39 -0
  10. package/docs/2.node.md +25 -0
  11. package/docs/3.singleNode.md +3 -0
  12. package/docs/4.tTextNode.md +3 -0
  13. package/docs/5. Document.md +28 -0
  14. package/docs/6.Query.md +110 -0
  15. package/docs/7.cache.md +14 -0
  16. package/document.js +6 -4
  17. package/index.js +6 -4
  18. package/index.mjs +6 -4
  19. package/{src/node/root.js → lib/node/document.js} +3 -2
  20. package/{src → lib}/node/node.js +6 -3
  21. package/lib/node/root.js +6 -0
  22. package/{src → lib}/node/single-node.js +22 -4
  23. package/package.json +6 -4
  24. package/readme.md +21 -14
  25. package/tests/cache.test.js +23 -0
  26. package/tests/node.test.js +411 -0
  27. package/tests/parser.test.js +353 -0
  28. package/tests/query.test.js +65 -0
  29. package/tests/single-node.test.js +88 -0
  30. package/tests/utils.js +2 -0
  31. /package/{tests → browser-tests}/cache.js +0 -0
  32. /package/{tests → browser-tests}/node.js +0 -0
  33. /package/{tests → browser-tests}/parse-real.js +0 -0
  34. /package/{tests → browser-tests}/parser.js +0 -0
  35. /package/{tests → browser-tests}/query.js +0 -0
  36. /package/{tests/test.js → browser-tests/simple-test.js} +0 -0
  37. /package/{src → lib}/node/class-list.js +0 -0
  38. /package/{src → lib}/node/dataset.js +0 -0
  39. /package/{src → lib}/node/find.js +0 -0
  40. /package/{src → lib}/node/style.js +0 -0
  41. /package/{src → lib}/node/text-node.js +0 -0
  42. /package/{src → lib}/parse/cache.js +0 -0
  43. /package/{src → lib}/parse/parse-atts.js +0 -0
  44. /package/{src → lib}/parse/parser.js +0 -0
  45. /package/{src → lib}/parse/void-tags.js +0 -0
  46. /package/{src → lib}/query/check-element.js +0 -0
  47. /package/{src → lib}/query/query.js +0 -0
@@ -0,0 +1,1124 @@
1
+ let html1 = /*html*/`
2
+ <html lang="en-US"><head>
3
+ <title>W3Schools Tryit Editor</title>
4
+ <meta name="viewport" content="width=device-width">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <meta property="og:image" content="https://www.w3schools.com/images/w3schools_logo_436_2.png">
7
+ <meta property="og:image:type" content="image/png">
8
+ <meta property="og:image:width" content="436">
9
+ <meta property="og:image:height" content="228">
10
+ <meta property="og:title" content="W3Schools online HTML editor">
11
+ <meta property="og:description" content="The W3Schools online code editor allows you to edit code and view the result in your browser">
12
+ <link rel="stylesheet" href="/lib/w3schools30.css">
13
+ <link rel="stylesheet" href="/lib/codemirror.css">
14
+ <script async="" src="//cdn.confiant-integrations.net/prebid/202211281516/wrap.js"></script><script type="text/javascript" src="https://cdn.confiant-integrations.net/t_Qv_vWzcBDsyn934F1E0MWBb1c/prebid/config.js" async=""></script><script type="text/javascript" async="" src="https://www.google-analytics.com/analytics.js"></script><script async="" src="https://www.googletagmanager.com/gtm.js?id=GTM-KTCFC3S"></script><script src="/lib/codemirror.js"></script>
15
+ <script src="/lib/codemirror_jsx.js"></script>
16
+
17
+ <!-- Google Tag Manager -->
18
+ <script>
19
+ (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
20
+ new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
21
+ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
22
+ 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
23
+ })(window,document,'script','dataLayer','GTM-KTCFC3S');
24
+ var subjectFolder = location.pathname;
25
+ subjectFolder = subjectFolder.replace("/", "");
26
+ subjectFolder = subjectFolder.substr(0, subjectFolder.indexOf("/"));
27
+ </script>
28
+ <!-- End Google Tag Manager -->
29
+
30
+ <script src="/lib/uic.js?v=1.0.5"></script>
31
+ <script data-cfasync="false" type="text/javascript">
32
+ var k42 = false;
33
+
34
+ // GPT slots
35
+ var gptAdSlots = [];
36
+ window.googletag = window.googletag || { cmd: [] };
37
+ googletag.cmd.push(function() {
38
+ var leaderMapping = googletag.sizeMapping().
39
+ // Mobile ad
40
+ addSize([0, 0], [320, 50]).
41
+ // Vertical Tablet ad
42
+ addSize([468, 0], [468, 60]).
43
+ // Horizontal Tablet
44
+ addSize([728, 0], [728, 90]).
45
+ // Desktop and bigger ad
46
+ addSize([970, 0], [[728, 90], [970, 90]]).build();
47
+ // addSize([970, 0], [728, 90]).build();
48
+ gptAdSlots[0] = googletag.defineSlot('/16833175/TryitLeaderboard', [[728, 90], [970, 90]], 'div-gpt-ad-1428407818244-0').
49
+ // gptAdSlots[0] = googletag.defineSlot('/16833175/TryitLeaderboard', [728, 90], 'div-gpt-ad-1428407818244-0').
50
+ defineSizeMapping(leaderMapping).addService(googletag.pubads());
51
+ googletag.pubads().setTargeting("content","try" + (function () {
52
+ var folder = location.pathname;
53
+ folder = folder.replace("/", "");
54
+ folder = folder.substr(0, folder.indexOf("/"));
55
+ return folder;
56
+ })());
57
+ });
58
+
59
+ </script>
60
+ <script data-cfasync="false" type="text/javascript">
61
+ window.snigelPubConf = {
62
+ "adengine": {
63
+
64
+ "activeAdUnits": [],
65
+ "additionalGptAdSlotIds": ["div-gpt-ad-1428407818244-0"]
66
+
67
+ }
68
+ }
69
+ uic_r_a()
70
+ </script>
71
+ <script async="" data-cfasync="false" src="https://cdn.snigelweb.com/adengine/w3schools.com/loader.js" type="text/javascript"></script>
72
+ <script>
73
+ if (window.addEventListener) {
74
+ window.addEventListener("resize", browserResize);
75
+ } else if (window.attachEvent) {
76
+ window.attachEvent("onresize", browserResize);
77
+ }
78
+ var xbeforeResize = window.innerWidth;
79
+
80
+ function browserResize() {
81
+ var afterResize = window.innerWidth;
82
+ if ((xbeforeResize < (970) && afterResize >= (970)) || (xbeforeResize >= (970) && afterResize < (970)) ||
83
+ (xbeforeResize < (728) && afterResize >= (728)) || (xbeforeResize >= (728) && afterResize < (728)) ||
84
+ (xbeforeResize < (468) && afterResize >= (468)) ||(xbeforeResize >= (468) && afterResize < (468))) {
85
+ xbeforeResize = afterResize;
86
+
87
+ uic_r_m();
88
+
89
+ }
90
+ if (window.screen.availWidth <= 768) {
91
+ restack(window.innerHeight > window.innerWidth);
92
+ }
93
+ fixDragBtn();
94
+ showFrameSize();
95
+
96
+
97
+ }
98
+ var fileID = "";
99
+ </script>
100
+ <style>
101
+ * {
102
+ -webkit-box-sizing: border-box;
103
+ -moz-box-sizing: border-box;
104
+ box-sizing: border-box;
105
+ }
106
+ body {
107
+ color:#000000;
108
+ margin:0px;
109
+ font-size:100%;
110
+ }
111
+ .trytopnav {
112
+ height:48px;
113
+ overflow:hidden;
114
+ min-width:380px;
115
+ position:absolute;
116
+ width:100%;
117
+ top:99px;
118
+
119
+ background-color:#E7E9EB;
120
+ }
121
+ .topnav-icons {
122
+ margin-right:8px;
123
+ }
124
+ .trytopnav a,.trytopnav button {
125
+ color:#999999;
126
+ }
127
+ .w3-bar .w3-bar-item:hover {
128
+ color:#757575 !important;
129
+ }
130
+ a.w3schoolslink {
131
+ padding:0 !important;
132
+ display:inline !important;
133
+ }
134
+ a.w3schoolslink:hover,a.w3schoolslink:active {
135
+ text-decoration:underline !important;
136
+ background-color:transparent !important;
137
+ }
138
+ #dragbar{
139
+ position:absolute;
140
+ cursor: col-resize;
141
+ z-index:3;
142
+ padding:5px;
143
+ }
144
+ #shield {
145
+ display:none;
146
+ top:0;
147
+ left:0;
148
+ width:100%;
149
+ position:absolute;
150
+ height:100%;
151
+ z-index:4;
152
+ }
153
+ #framesize {
154
+ font-family: 'Montserrat', 'Source Sans Pro', sans-serif;
155
+ font-size: 14px;
156
+ }
157
+ #container {
158
+ background-color:#E7E9EB;
159
+ width:100%;
160
+ overflow:auto;
161
+ position:absolute;
162
+ top:144px;
163
+
164
+ bottom:0;
165
+ height:auto;
166
+ }
167
+ #textareacontainer, #iframecontainer {
168
+ float:left;
169
+ height:100%;
170
+ width:50%;
171
+ }
172
+
173
+ #textarea, #textarea2, #iframe {
174
+ height:100%;
175
+ width:100%;
176
+ padding-bottom:10px;
177
+ padding-top:1px;
178
+ }
179
+ #textarea {
180
+ padding-left:10px;
181
+ padding-right:5px;
182
+ }
183
+ #iframe {
184
+ padding-left:5px;
185
+ padding-right:10px;
186
+ position:relative;
187
+
188
+ }
189
+ #textareawrapper {
190
+ width:100%;
191
+ height:100%;
192
+
193
+ overflow:auto;
194
+
195
+ background-color: #ffffff;
196
+ position:relative;
197
+
198
+ box-shadow:0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
199
+
200
+ }
201
+ #iframewrapper {
202
+ width:100%;
203
+ height:100%;
204
+ -webkit-overflow-scrolling: touch;
205
+ background-color: #ffffff;
206
+
207
+ box-shadow:0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
208
+
209
+ }
210
+ #textareaCode, #textareaCode2 {
211
+ background-color: #ffffff;
212
+ font-family: consolas,Menlo,"courier new",monospace;
213
+ font-size:15px;
214
+ height:100%;
215
+ width:100%;
216
+ padding:8px;
217
+ resize: none;
218
+ border:none;
219
+ line-height:normal;
220
+ }
221
+ /*
222
+ .localhostcontainer {
223
+ position:absolute;
224
+ width:auto;
225
+ right:0;
226
+ left:0;
227
+ z-index:2;
228
+ padding:4px 12px;
229
+ border-bottom:1px solid #d9d9d9;
230
+ background-color:#E7E9EB;
231
+ }
232
+ .localhostdiv {
233
+ overflow:hidden;
234
+ font-family:arial;
235
+ border:1px solid #d9d9d9;
236
+ background-color:#fff;
237
+ font-size:14px;
238
+ padding-left:10px;
239
+ }
240
+ */
241
+
242
+ .localhostoutercontainer {
243
+ position: absolute;
244
+ width: auto;
245
+ left:5px;
246
+ right:10px;
247
+ background-color: #E7E9EB;
248
+ height: 30px;
249
+ z-index: 9;
250
+ }
251
+ .localhostoutercontainer.horizontal {
252
+ left:10px;
253
+ }
254
+ .localhostcontainer {
255
+ position:relative;
256
+ width:auto;
257
+ right:0;
258
+ left:0;
259
+ z-index:2;
260
+ xpadding:6px 12px;
261
+ xxborder-bottom:1px solid #d9d9d9;
262
+ background-color:#F1F1F1;
263
+ background-color:#38444d;
264
+ border-top-right-radius:10px;
265
+ border-top-left-radius:10px;
266
+ overflow:hidden;
267
+ padding-top:4px;
268
+ }
269
+ .localhostdiv {
270
+ overflow:hidden;
271
+ font-family:arial;
272
+ color:#000;
273
+ background-color:#fff;
274
+ font-size:15px;
275
+ padding-left:10px;
276
+ border-radius:20px;
277
+ width:60%;
278
+ float:left;
279
+ font-family: consolas,Menlo,"courier new",monospace;
280
+ }
281
+ .localhostbuttoncontainer {
282
+ width:20%;
283
+ min-width:100px;
284
+ color:#ffc107;
285
+ float:left;
286
+ font-size:16px;
287
+ overflow:auto;
288
+ }
289
+ div.localhostbuttoncontainer span{
290
+ display:inline-block;
291
+ color:#ffc107;
292
+ position:relative;
293
+ padding-bottom:4px;
294
+ padding-left:2px;
295
+ }
296
+
297
+ div.localhostbuttoncontainer span:first-child{
298
+ color:#dc3545;
299
+ padding-left:12px;
300
+
301
+ }
302
+ div.localhostbuttoncontainer span:last-child{
303
+ color:#04AA6D;
304
+ padding-left:2px;
305
+ }
306
+
307
+ body.darktheme .localhostoutercontainer {
308
+ background-color: #38444d;
309
+ }
310
+ body.darktheme .localhostcontainer {
311
+ background-color:rgb(21,32,43)
312
+ }
313
+
314
+ body.darktheme .localhostdiv {
315
+ border:1px solid #595959;
316
+ background-color:#ffffff;
317
+ }
318
+
319
+ /**/
320
+
321
+
322
+ #filenamecontainer {
323
+ position:absolute;
324
+ text-align:center;
325
+ z-index:4;
326
+ width:100%;
327
+ }
328
+ #filenamecontainer span {
329
+ opacity:0.9;
330
+ padding:1px 6px;
331
+ font-family:Consolas;
332
+ background-color:#E7E9EB;
333
+ font-size:16px;
334
+ }
335
+ body.darktheme #filenamecontainer span {
336
+ background-color:#555555;
337
+ color:#E7E9EB;
338
+ }
339
+
340
+ .CodeMirror.cm-s-default {
341
+ line-height:normal;
342
+ padding: 4px;
343
+
344
+ height:100%;
345
+ width:100%;
346
+ }
347
+
348
+ #iframeResult, #iframeSource {
349
+ background-color: #ffffff;
350
+
351
+
352
+ height:100%;
353
+ width:100%;
354
+ }
355
+
356
+ #stackV {background-color:#999999;}
357
+ #stackV:hover {background-color:#BBBBBB !important;}
358
+ #stackV.horizontal {background-color:transparent;}
359
+ #stackV.horizontal:hover {background-color:#BBBBBB !important;}
360
+ #stackH.horizontal {background-color:#999999;}
361
+ #stackH.horizontal:hover {background-color:#999999 !important;}
362
+ #textareacontainer.horizontal,#iframecontainer.horizontal{
363
+ height:50%;
364
+ float:none;
365
+ width:100%;
366
+ }
367
+
368
+
369
+ #textarea.horizontal{
370
+ height:100%;
371
+ padding-left:10px;
372
+ padding-right:10px;
373
+ }
374
+ #iframe.horizontal{
375
+ height:100%;
376
+ padding-right:10px;
377
+ padding-bottom:10px;
378
+ padding-left:10px;
379
+ }
380
+ #container.horizontal{
381
+ min-height:200px;
382
+ margin-left:0;
383
+ }
384
+ #tryitLeaderboard {
385
+ overflow:hidden;
386
+ text-align:center;
387
+ margin-top:5px;
388
+ height:90px;
389
+ }
390
+ .w3-dropdown-content {width:350px}
391
+
392
+ #breadcrumb ul {
393
+ font-family:'Montserrat', 'Source Sans Pro', sans-serif;
394
+ list-style: none;
395
+ display: inline-table;
396
+ padding-inline-start: 1px;
397
+ font-size: 12px;
398
+ margin-block-start: 6px;
399
+ margin-block-end: 6px;
400
+ }
401
+ #breadcrumb li {
402
+ display: inline;
403
+ }
404
+ #breadcrumb a {
405
+ float: left;
406
+ background: #E7E9EB;
407
+ padding: 3px 10px 3px 20px;
408
+ position: relative;
409
+ margin: 0 5px 0 0;
410
+ text-decoration: none;
411
+ color: #555;
412
+ }
413
+ #breadcrumb a:after {
414
+ content: "";
415
+ border-top: 12px solid transparent;
416
+ border-bottom: 12px solid transparent;
417
+ border-left: 12px solid #E7E9EB;
418
+ position: absolute;
419
+ right: -12px;
420
+ top: 0;
421
+ z-index: 1;
422
+ }
423
+ #breadcrumb a:before {
424
+ content: "";
425
+ border-top: 12px solid transparent;
426
+ border-bottom: 12px solid transparent;
427
+ border-left: 12px solid #fff;
428
+ position: absolute;
429
+ left: 0;
430
+ top: 0;
431
+ }
432
+ #breadcrumb ul li:first-child a:before {
433
+ display: none;
434
+ }
435
+ #breadcrumb ul:last-child li{
436
+ padding-right: 5px;
437
+ }
438
+ #breadcrumb ul li a:hover {
439
+ background: #04AA6D;
440
+ color:#fff;
441
+ }
442
+ #breadcrumb ul li a:hover:after {
443
+ border-left-color: #04AA6D;
444
+ color:#fff;
445
+ }
446
+ #breadcrumb li:last-child {
447
+ display: inline-block!important;
448
+ margin-top: 3px!important;
449
+ }
450
+ #runbtn {
451
+ background-color:#04AA6D;
452
+ color:white;
453
+ font-family: 'Source Sans Pro', sans-serif;
454
+ font-size:18px;
455
+ padding:6px 25px;
456
+ margin-top:4px;
457
+ border-radius:5px;
458
+ word-spacing:10px;
459
+ }
460
+ #runbtn:hover {
461
+ background-color: #059862 !important;
462
+ color:white!important;
463
+ }
464
+ #getwebsitebtn {
465
+ background-color:#04AA6D;
466
+ font-family: 'Source Sans Pro', sans-serif;
467
+ color: white;
468
+ font-size: 18px;
469
+ padding:6px 15px;
470
+ margin-top:4px;
471
+ margin-right: 10px;
472
+ display: block;
473
+ float: right;
474
+ border-radius: 5px;
475
+ }
476
+ #getwebsitebtn:hover {
477
+ background-color: #059862 !important;
478
+ color:white!important;
479
+ }
480
+
481
+ @media screen and (max-width: 727px) {
482
+ .trytopnav {top:70px;}
483
+ #container {top:116px;}
484
+ #breadcrumb {display:none;}
485
+ #tryhome {display:block;}
486
+ }
487
+ @media screen and (max-width: 467px) {
488
+ .trytopnav {top:60px;}
489
+ #container {top:106px;}
490
+ .w3-dropdown-content {width:100%}
491
+ }
492
+ @media only screen and (max-device-width: 768px) {
493
+ #iframewrapper {overflow: auto;}
494
+ #container {min-width:310px;}
495
+ .stack {display:none;}
496
+ #tryhome {display:block;}
497
+ .trytopnav {min-width:310px;}
498
+ }
499
+
500
+ #iframewrapper {
501
+
502
+ }
503
+
504
+ /*
505
+ .tabs-container {
506
+ height:100%;
507
+ overflow:auto;
508
+ }
509
+ .tabs {
510
+ list-style-type: none;
511
+ padding: 0;
512
+ margin: 0;
513
+ background-color:#E7E9EB;
514
+
515
+ }
516
+ .tab {
517
+ padding: 5px 10px;
518
+ background: #ddd;
519
+ width: fit-content;
520
+ display: inline-block;
521
+ border-top-left-radius: 10px;
522
+ border-top-right-radius: 10px;
523
+
524
+ }
525
+ .tab.active {
526
+ background: #fff;
527
+ }
528
+
529
+ .tab-pane {
530
+ display: none;
531
+ }
532
+ .tab-pane.active {
533
+ display: block;
534
+ }
535
+ */
536
+
537
+ .tabitem, #resttab {
538
+ position:absolute;
539
+ z-index:2;
540
+ font-family:arial;
541
+ padding:4px 12px;
542
+ width:70px;
543
+ cursor:pointer;
544
+ }
545
+
546
+ /*
547
+ #progqcstab {
548
+ width:120px;
549
+ left:0;
550
+ }
551
+ #prog2qcstab {
552
+ width:100px;
553
+ left:120px;
554
+ }
555
+ #childtemplatetab {
556
+ width:150px;
557
+ left:220px;
558
+ }
559
+ */
560
+ .tabitem {
561
+ background-color:#38444d;
562
+ color:#ddd;
563
+ border-top-left-radius:10px;
564
+ border-top-right-radius:10px;
565
+ opacity:0.5;
566
+ }
567
+ #resttab {
568
+ cursor:default;
569
+
570
+ z-index:1;
571
+ background-color:#E7E9EB;
572
+ width:100%;
573
+ left:0px;
574
+ }
575
+
576
+
577
+ .tabitem.tabselected{
578
+ opacity:1;
579
+ }
580
+
581
+ .darktheme .tabitem {
582
+ background-color:rgb(21,32,43)
583
+ }
584
+ .darktheme #resttab {
585
+ background-color:#38444d;
586
+ }
587
+
588
+ /**/
589
+ .fa {
590
+ padding: 10px 10px!important;
591
+ }
592
+ a.topnav-icons, a.topnav-icons.fa-home, a.topnav-icons.fa-menu, button.topnav-icons.fa-adjust {
593
+ font-size: 28px!important;
594
+ }
595
+ .darktheme #breadcrumb li {
596
+ color:#fff;
597
+ }
598
+ .darktheme #breadcrumb a {
599
+ background:#616161;
600
+ background-color:#38444d;
601
+ color: #ddd;
602
+ }
603
+ .darktheme #breadcrumb a:after {
604
+ border-left: 12px solid #616161;
605
+ border-left: 12px solid #38444d;
606
+ }
607
+ .darktheme #breadcrumb a:before {
608
+ border-left: 12px solid rgb(40, 44, 52);
609
+ border-left: 12px solid #1d2a35;
610
+ }
611
+ .darktheme .currentcrumb {
612
+ color:#ddd;
613
+ }
614
+
615
+ body.darktheme {
616
+ background-color:rgb(40, 44, 52);
617
+ background-color:#1d2a35;
618
+ }
619
+ body.darktheme #tryitLeaderboard{
620
+ background-color:rgb(40, 44, 52);
621
+ background-color:#1d2a35;
622
+ }
623
+ body.darktheme .trytopnav{
624
+ background-color:#616161;
625
+ background-color:#38444d;
626
+ color:#dddddd;
627
+ }
628
+ body.darktheme #container {
629
+ background-color:#616161;
630
+ background-color:#38444d;
631
+ }
632
+ body.darktheme .trytopnav a {
633
+ color:#dddddd;
634
+ }
635
+ body.darktheme #textareaCode {
636
+ background-color:rgb(40, 44, 52);
637
+ color:#fff;
638
+ }
639
+
640
+ body.darktheme #textareawrapper {
641
+ background-color:rgb(21,32,43);
642
+ }
643
+ body.darktheme .tabs {
644
+ background-color:#38444d;
645
+ }
646
+ body.darktheme .tab {
647
+ background: rgb(21,32,43);
648
+ color:#fff;
649
+ opacity:0.5;
650
+ }
651
+ body.darktheme .tab.active {
652
+ background: rgb(21,32,43);
653
+ color:#fff;
654
+ opacity:1;
655
+ }
656
+
657
+ body.darktheme ::-webkit-scrollbar {width:12px;height:3px;}
658
+ body.darktheme ::-webkit-scrollbar-track-piece {background-color:#000;}
659
+ body.darktheme ::-webkit-scrollbar-thumb {height:50px;background-color: #616161; background-color:#38444d;}
660
+ body.darktheme ::-webkit-scrollbar-thumb:hover {background-color: #aaaaaa;background-color: #4b5b68}
661
+
662
+
663
+ /*
664
+ #file1filetab, #resttab {
665
+ position:absolute;
666
+ z-index:2;
667
+ font-family:arial;
668
+ padding:4px 12px;
669
+ }
670
+ #file1filetab {
671
+ width:auto;
672
+ left:0;
673
+ border-top-left-radius: 10px;
674
+ border-top-right-radius: 10px;
675
+ }
676
+ #resttab {
677
+ z-index:1;
678
+ background-color:#E7E9EB;
679
+ width:100%;
680
+ left:0px;
681
+ }
682
+ .tabitem {
683
+ background-color:#eaeaea;
684
+ }
685
+ .tabitem.tabselected{
686
+ background-color:#fff;
687
+ }
688
+ .darktheme .tabitem {
689
+ background-color:#444;
690
+ }
691
+ .darktheme .tabitem.tabselected{
692
+ background-color:rgb(21,32,43);
693
+ }
694
+ .darktheme #resttab {
695
+ background-color:#38444d;
696
+ }
697
+ */
698
+ .darktheme #file1filetab {
699
+ border-right:1px solid rgb(21,32,43);
700
+ }
701
+
702
+ </style>
703
+ <!--[if lt IE 8]>
704
+ <style>
705
+ #textareacontainer, #iframecontainer {width:48%;}
706
+ #container {height:500px;}
707
+ #textarea, #iframe {width:90%;height:450px;}
708
+ #textareaCode, #textareaCode2, #iframeResult, .codewindow {height:450px;}
709
+ .stack {display:none;}
710
+ </style>
711
+ <![endif]-->
712
+ <script type="text/javascript" async="" src="//cdn.snigelweb.com/prebid/7.17.0/prebid.js?v=5601-1670254759780"></script><script type="text/javascript" async="" src="//c.amazon-adsystem.com/aax2/apstag.js"></script><script type="text/javascript" async="" src="//securepubads.g.doubleclick.net/tag/js/gpt.js"></script><script type="text/javascript" async="" src="//adengine.snigelweb.com/w3schools.com/5601-1670254759780/adngin.js"></script><script type="text/javascript" async="" src="//cdn.snigelweb.com/argus/argus.js"></script><meta http-equiv="origin-trial" content="Az6AfRvI8mo7yiW5fLfj04W21t0ig6aMsGYpIqMTaX60H+b0DkO1uDr+7BrzMcimWzv/X7SXR8jI+uvbV0IJlwYAAACFeyJvcmlnaW4iOiJodHRwczovL2RvdWJsZWNsaWNrLm5ldDo0NDMiLCJmZWF0dXJlIjoiUHJpdmFjeVNhbmRib3hBZHNBUElzIiwiZXhwaXJ5IjoxNjgwNjUyNzk5LCJpc1N1YmRvbWFpbiI6dHJ1ZSwiaXNUaGlyZFBhcnR5Ijp0cnVlfQ=="><meta http-equiv="origin-trial" content="A+USTya+tNvDPaxUgJooz+LaVk5hPoAxpLvSxjogX4Mk8awCTQ9iop6zJ9d5ldgU7WmHqBlnQB41LHHRFxoaBwoAAACLeyJvcmlnaW4iOiJodHRwczovL2dvb2dsZXN5bmRpY2F0aW9uLmNvbTo0NDMiLCJmZWF0dXJlIjoiUHJpdmFjeVNhbmRib3hBZHNBUElzIiwiZXhwaXJ5IjoxNjgwNjUyNzk5LCJpc1N1YmRvbWFpbiI6dHJ1ZSwiaXNUaGlyZFBhcnR5Ijp0cnVlfQ=="><meta http-equiv="origin-trial" content="A7FovoGr67TUBYbnY+Z0IKoJbbmRmB8fCyirUGHavNDtD91CiGyHHSA2hDG9r9T3NjUKFi6egL3RbgTwhhcVDwUAAACLeyJvcmlnaW4iOiJodHRwczovL2dvb2dsZXRhZ3NlcnZpY2VzLmNvbTo0NDMiLCJmZWF0dXJlIjoiUHJpdmFjeVNhbmRib3hBZHNBUElzIiwiZXhwaXJ5IjoxNjgwNjUyNzk5LCJpc1N1YmRvbWFpbiI6dHJ1ZSwiaXNUaGlyZFBhcnR5Ijp0cnVlfQ=="><script src="https://securepubads.g.doubleclick.net/gpt/pubads_impl_2022120501.js" async=""></script><argprec0></argprec0><argprec1></argprec1><style type="text/css">.snigel-cmp-framework .sn-inner {background-color:#fffefe!important;}.snigel-cmp-framework .sn-b-def {border-color:#04aa6d!important;color:#04aa6d!important;}.snigel-cmp-framework .sn-b-def.sn-blue {color:#ffffff!important;background-color:#04aa6d!important;border-color:#04aa6d!important;}.snigel-cmp-framework .sn-selector ul li {color:#04aa6d!important;}.snigel-cmp-framework .sn-selector ul li:after {background-color:#04aa6d!important;}.snigel-cmp-framework .sn-footer-tab .sn-privacy a {color:#04aa6d!important;}.snigel-cmp-framework .sn-arrow:after,.snigel-cmp-framework .sn-arrow:before {background-color:#04aa6d!important;}.snigel-cmp-framework .sn-switch input:checked + span::before {background-color:#04aa6d!important;}#adconsent-usp-link {border: 1px solid #04aa6d!important;color:#04aa6d!important;}#adconsent-usp-banner-optout input:checked + .adconsent-usp-slider {background-color:#04aa6d!important;}#adconsent-usp-banner-btn {color:#ffffff;border: solid 1px #04aa6d!important;background-color:#04aa6d!important; }</style><style type="text/css">.sn_ad_label{height:unset !important}</style><script src="//secure.cdn.fastclick.net/js/pubcid/latest/pubcid.min.js"></script><script src="//cdn.id5-sync.com/api/1.0/id5-api.js"></script><link rel="preload" href="https://adservice.google.co.il/adsid/integrator.js?domain=www.w3schools.com" as="script"><script type="text/javascript" src="https://adservice.google.co.il/adsid/integrator.js?domain=www.w3schools.com"></script><link rel="preload" href="https://adservice.google.com/adsid/integrator.js?domain=www.w3schools.com" as="script"><script type="text/javascript" src="https://adservice.google.com/adsid/integrator.js?domain=www.w3schools.com"></script><iframe name="cnftComm" style="display: none;"></iframe></head>
713
+ <body>
714
+ <!-- Google Tag Manager (noscript) -->
715
+ <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-KTCFC3S"
716
+ height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
717
+ <!-- End Google Tag Manager (noscript) -->
718
+
719
+ <div id="tryitLeaderboard">
720
+ <!-- TryitLeaderboard -->
721
+
722
+ <div id="div-gpt-ad-1428407818244-0" data-google-query-id="COb9kaud7fsCFfhoFQgdD3AAew">
723
+
724
+ <div id="google_ads_iframe_/16833175/TryitLeaderboard_0__container__" style="border: 0pt none; display: inline-block; width: 728px; height: 90px;"><iframe frameborder="0" src="https://348800e6e5d15f33b8ad612a77114f28.safeframe.googlesyndication.com/safeframe/1-0-40/html/container.html" id="google_ads_iframe_/16833175/TryitLeaderboard_0" title="3rd party ad content" name="" scrolling="no" marginwidth="0" marginheight="0" width="728" height="90" data-is-safeframe="true" sandbox="allow-forms allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-top-navigation-by-user-activation" role="region" aria-label="Advertisement" tabindex="0" data-google-container-id="1" style="border: 0px; vertical-align: bottom;" data-load-complete="true"></iframe></div></div>
725
+
726
+ </div>
727
+
728
+ <div class="trytopnav">
729
+ <div class="w3-bar" style="overflow:auto">
730
+ <a id="tryhome" href="https://www.w3schools.com" target="_blank" title="w3schools.com Home" class="w3-button w3-bar-item topnav-icons fa fa-home" style="margin-top:-2px;"></a>
731
+ <a href="javascript:void(0);" onclick="openMenu()" id="menuButton" title="Open Menu" class="w3-dropdown-click w3-button w3-bar-item topnav-icons fa fa-menu" style="margin-top:-2px;"></a>
732
+
733
+ <a href="javascript:void(0);" onclick="spaceIt.showDialog()" title="Save code" class="w3-button w3-bar-item topnav-icons fa fa-save" style="margin-top:-2px;"></a>
734
+
735
+ <a href="javascript:void(0);" onclick="restack(currentStack)" title="Change Orientation" class="w3-button w3-bar-item w3-hide-small topnav-icons fa fa-rotate" style="margin-top:-2px;"></a>
736
+ <a href="javascript:void(0);" onclick="retheme()" title="Change Theme" class="w3-button w3-bar-item topnav-icons fa fa-adjust" style="margin-top:-2px;"></a>
737
+
738
+ <button id="runbtn" class="w3-button w3-bar-item w3-hover-white w3-hover-text-green" onclick="submitTryit(1);">Run ❯</button>
739
+
740
+ <a id="getwebsitebtn" class="w3-button w3-bar-item w3-hover-white w3-hover-text-green w3-hide-small" href="https://www.w3schools.com/spaces/" target="_blank">Get your<span class="w3-hide-medium"> own</span> website</a>
741
+ <!--<span class="w3-right w3-hide-small xxw3-hide-medium" style="padding:8px 8px 8px 8px;display:block"></span>-->
742
+ <span class="w3-right w3-hide-small" style="padding:8px 16px 8px 0;display:block;float:right;font-size:16px;margin-top:4px"><span id="framesize">Result Size: <span>595 x 741</span></span></span>
743
+ </div>
744
+
745
+ </div>
746
+
747
+ <div id="shield" style="display: none;"></div>
748
+
749
+ <a href="javascript:void(0)" id="dragbar" style="width: 5px; top: 144px; left: 605px; height: 741px; cursor: col-resize;"></a>
750
+ <div id="container">
751
+ <div id="navbarDropMenu" class="w3-dropdown-content w3-bar-block w3-border" style="z-index:5">
752
+ <span onclick="openMenu()" class="w3-button w3-display-topright w3-transparent ws-hover-black" title="Close Menu" style="font-weight:bold;padding-top:10px;padding-bottom:11px;">×</span>
753
+ <div class="w3-bar-block">
754
+ <a class="w3-bar-item w3-button" href="javascript:void(0);" title="Change Orientaton" onclick="openMenu();restack(currentStack)"><i class="fa fa-rotate" style="font-size:26px;margin-left:-4px;margin-right:8px"></i><span style="position:relative;top:-4px;left:2px;">Change Orientation</span></a>
755
+
756
+ <a class="w3-bar-item w3-button" href="javascript:void(0);" title="Save" onclick="openMenu();spaceIt.showDialog()"><i class="fa fa-save" style="font-size:26px;margin-right:10px;"></i><span style="position:relative;top:-4px;left:2px;">Save Code</span></a>
757
+
758
+ <a class="w3-bar-item w3-button" href="javascript:void(0);" title="Change Theme" onclick="openMenu();retheme()"><i class="fa fa-adjust" style="font-size:26px;margin-right:8px"></i><span style="position:relative;top:-4px;left:2px;">Change Theme, Dark/Light</span></a>
759
+ <a class="w3-bar-item w3-button" style="height: 62px;padding-top: 18px;" href="https://spaces.w3schools.com" target="_blank" title="Go to Spaces"><img style="margin-left:9px;margin-right:15px;margin-bottom: 8px;" src="/images/spaces-icon-tryit.svg"><span style="position:relative;top:-4px;left:2px;">Go to Spaces</span></a>
760
+ </div>
761
+ <footer class="w3-container w3-small ws-grey">
762
+ <p>
763
+ <a style="display:inline;padding:0;" href="/about/about_privacy.asp" target="_blank" onclick="openMenu();" class="w3-hover-none ws-hover-text-green">Privacy policy</a> and
764
+ <a style="display:inline;padding:0;" href="/about/about_copyright.asp" target="_blank" onclick="openMenu();" class="w3-hover-none ws-hover-text-green">Copyright 1999-2022</a>
765
+ </p>
766
+ </footer>
767
+ </div>
768
+ <div id="menuOverlay" class="w3-overlay w3-transparent" style="cursor:pointer;z-index:4"></div>
769
+ <div id="textareacontainer">
770
+ <div id="textarea">
771
+ <div id="textareawrapper">
772
+
773
+ <textarea autocomplete="off" id="textareaCode" wrap="logical" spellcheck="false" style="display: none;">&lt;!DOCTYPE html&gt;
774
+ &lt;html&gt;
775
+ &lt;body&gt;
776
+
777
+ &lt;h2&gt;JavaScript Array Methods&lt;/h2&gt;
778
+ &lt;h2&gt;slice()&lt;/h2&gt;
779
+
780
+ &lt;p&gt;Array.slice() returns selected array elements as a new array:&lt;/p&gt;
781
+
782
+ &lt;p id="demo"&gt;&lt;/p&gt;
783
+
784
+ &lt;script&gt;
785
+ const fruits = ["Banana", "Orange", "Lemon", "Apple", "Mango"];
786
+ const myBest = fruits.slice(-3, -1);
787
+
788
+ document.getElementById("demo").innerHTML = myBest;
789
+ &lt;/script&gt;
790
+
791
+ &lt;/body&gt;
792
+ &lt;/html&gt;
793
+ </textarea><div class="CodeMirror cm-s-default CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 80px; left: 280.188px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;" tabindex="0"></textarea></div><div class="CodeMirror-vscrollbar" cm-not-content="true"><div style="min-width: 1px; height: 0px;"></div></div><div class="CodeMirror-hscrollbar" cm-not-content="true"><div style="height: 100%; min-height: 1px; width: 0px;"></div></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; margin-bottom: -17px; border-right-width: 13px; min-height: 386px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines"><div style="position: relative; outline: none;"><div class="CodeMirror-measure"></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-cursors" style="visibility: hidden;"><div class="CodeMirror-cursor" style="left: 276.188px; top: 72px; height: 18px;">&nbsp;</div></div><div class="CodeMirror-code" style=""><pre class=" CodeMirror-line "><span style="padding-right: 0.1px;"><span class="cm-m-xml cm-meta">&lt;!DOCTYPE html&gt;</span></span></pre><pre class=" CodeMirror-line "><span style="padding-right: 0.1px;"><span class="cm-m-xml cm-tag cm-bracket">&lt;</span><span class="cm-m-xml cm-tag">html</span><span class="cm-m-xml cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line "><span style="padding-right: 0.1px;"><span class="cm-m-xml cm-tag cm-bracket">&lt;</span><span class="cm-m-xml cm-tag">body</span><span class="cm-m-xml cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line "><span style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line "><span style="padding-right: 0.1px;"><span class="cm-m-xml cm-tag cm-bracket">&lt;</span><span class="cm-m-xml cm-tag">h2</span><span class="cm-m-xml cm-tag cm-bracket">&gt;</span><span class="cm-m-xml">JavaScript Array Methods</span><span class="cm-m-xml cm-tag cm-bracket">&lt;/</span><span class="cm-m-xml cm-tag">h2</span><span class="cm-m-xml cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line "><span style="padding-right: 0.1px;"><span class="cm-m-xml cm-tag cm-bracket">&lt;</span><span class="cm-m-xml cm-tag">h2</span><span class="cm-m-xml cm-tag cm-bracket">&gt;</span><span class="cm-m-xml">slice()</span><span class="cm-m-xml cm-tag cm-bracket">&lt;/</span><span class="cm-m-xml cm-tag">h2</span><span class="cm-m-xml cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line "><span style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line "><span style="padding-right: 0.1px;"><span class="cm-m-xml cm-tag cm-bracket">&lt;</span><span class="cm-m-xml cm-tag">p</span><span class="cm-m-xml cm-tag cm-bracket">&gt;</span><span class="cm-m-xml">Array.slice() returns selected array elements as a new array:</span><span class="cm-m-xml cm-tag cm-bracket">&lt;/</span><span class="cm-m-xml cm-tag">p</span><span class="cm-m-xml cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line "><span style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line "><span style="padding-right: 0.1px;"><span class="cm-m-xml cm-tag cm-bracket">&lt;</span><span class="cm-m-xml cm-tag">p</span><span class="cm-m-xml"> </span><span class="cm-m-xml cm-attribute">id</span><span class="cm-m-xml">=</span><span class="cm-m-xml cm-string">"demo"</span><span class="cm-m-xml cm-tag cm-bracket">&gt;&lt;/</span><span class="cm-m-xml cm-tag">p</span><span class="cm-m-xml cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line "><span style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line "><span style="padding-right: 0.1px;"><span class="cm-m-xml cm-tag cm-bracket">&lt;</span><span class="cm-m-xml cm-tag">script</span><span class="cm-m-xml cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line "><span style="padding-right: 0.1px;"><span class="cm-m-javascript cm-keyword">const</span><span class="cm-m-javascript"> </span><span class="cm-m-javascript cm-def">fruits</span><span class="cm-m-javascript"> </span><span class="cm-m-javascript cm-operator">=</span><span class="cm-m-javascript"> [</span><span class="cm-m-javascript cm-string">"Banana"</span><span class="cm-m-javascript">, </span><span class="cm-m-javascript cm-string">"Orange"</span><span class="cm-m-javascript">, </span><span class="cm-m-javascript cm-string">"Lemon"</span><span class="cm-m-javascript">, </span><span class="cm-m-javascript cm-string">"Apple"</span><span class="cm-m-javascript">, </span><span class="cm-m-javascript cm-string">"Mango"</span><span class="cm-m-javascript">];</span></span></pre><pre class=" CodeMirror-line "><span style="padding-right: 0.1px;"><span class="cm-m-javascript cm-keyword">const</span><span class="cm-m-javascript"> </span><span class="cm-m-javascript cm-def">myBest</span><span class="cm-m-javascript"> </span><span class="cm-m-javascript cm-operator">=</span><span class="cm-m-javascript"> </span><span class="cm-m-javascript cm-variable">fruits</span><span class="cm-m-javascript">.</span><span class="cm-m-javascript cm-property">slice</span><span class="cm-m-javascript">(</span><span class="cm-m-javascript cm-number">1</span><span class="cm-m-javascript">, </span><span class="cm-m-javascript cm-number">2</span><span class="cm-m-javascript">);</span></span></pre><pre class=" CodeMirror-line "><span style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line "><span style="padding-right: 0.1px;"><span class="cm-m-javascript cm-variable">document</span><span class="cm-m-javascript">.</span><span class="cm-m-javascript cm-property">getElementById</span><span class="cm-m-javascript">(</span><span class="cm-m-javascript cm-string">"demo"</span><span class="cm-m-javascript">).</span><span class="cm-m-javascript cm-property">innerHTML</span><span class="cm-m-javascript"> </span><span class="cm-m-javascript cm-operator">=</span><span class="cm-m-javascript"> </span><span class="cm-m-javascript cm-variable">myBest</span><span class="cm-m-javascript">;</span></span></pre><pre class=" CodeMirror-line "><span style="padding-right: 0.1px;"><span class="cm-m-xml cm-tag cm-bracket">&lt;/</span><span class="cm-m-xml cm-tag">script</span><span class="cm-m-xml cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line "><span style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line "><span style="padding-right: 0.1px;"><span class="cm-m-xml cm-tag cm-bracket">&lt;/</span><span class="cm-m-xml cm-tag">body</span><span class="cm-m-xml cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line "><span style="padding-right: 0.1px;"><span class="cm-m-xml cm-tag cm-bracket">&lt;/</span><span class="cm-m-xml cm-tag">html</span><span class="cm-m-xml cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line "><span style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre></div></div></div></div></div><div style="position: absolute; height: 13px; width: 1px; border-bottom: 0px solid transparent; top: 386px;"></div><div class="CodeMirror-gutters" style="display: none; height: 399px;"></div></div></div>
794
+ <form id="codeForm" autocomplete="off" style="margin:0px;display:none;">
795
+ <input type="hidden" name="code" id="code">
796
+ </form>
797
+
798
+ </div>
799
+ </div>
800
+ </div>
801
+ <div id="iframecontainer">
802
+ <div id="iframe">
803
+
804
+
805
+ <div id="iframewrapper"><iframe frameborder="0" id="iframeResult" name="iframeResult" allowfullscreen="true"></iframe></div>
806
+ </div>
807
+ </div>
808
+
809
+ </div>
810
+ <script>
811
+ submitTryit()
812
+ function submitTryit(n) {
813
+
814
+ if (window.editor) {
815
+ window.editor.save();
816
+ }
817
+
818
+ var text = document.getElementById("textareaCode").value;
819
+
820
+ var ifr = document.createElement("iframe");
821
+ ifr.setAttribute("frameborder", "0");
822
+ ifr.setAttribute("id", "iframeResult");
823
+ ifr.setAttribute("name", "iframeResult");
824
+
825
+ ifr.setAttribute("allowfullscreen", "true");
826
+
827
+ document.getElementById("iframewrapper").innerHTML = "";
828
+ document.getElementById("iframewrapper").appendChild(ifr);
829
+
830
+ var ifrw = (ifr.contentWindow) ? ifr.contentWindow : (ifr.contentDocument.document) ? ifr.contentDocument.document : ifr.contentDocument;
831
+ ifrw.document.open();
832
+ ifrw.document.write(text);
833
+ ifrw.document.close();
834
+ //23.02.2016: contentEditable is set to true, to fix text-selection (bug) in firefox.
835
+ //(and back to false to prevent the content from being editable)
836
+ //(To reproduce the error: Select text in the result window with, and without, the contentEditable statements below.)
837
+ if (ifrw.document.body && !ifrw.document.body.isContentEditable) {
838
+ ifrw.document.body.contentEditable = true;
839
+ ifrw.document.body.contentEditable = false;
840
+ }
841
+
842
+ }
843
+
844
+ function hideSpinner() {
845
+ document.getElementById("runloadercontainer").style.display = "none";
846
+ }
847
+ function displaySpinner() {
848
+ var i, c, w, h, r, top;
849
+ i = document.getElementById("iframeResult");
850
+ w = w3_getStyleValue(i, "width");
851
+ h = w3_getStyleValue(i, "height");
852
+ c = document.getElementById("runloadercontainer");
853
+ c.style.width = w;
854
+ c.style.height = h;
855
+ c.style.display = "block";
856
+ w = Number(w.replace("px", "")) / 5;
857
+ r = document.getElementById("runloader");
858
+ r.style.width = w + "px";
859
+ r.style.height = w + "px";
860
+ h = w3_getStyleValue(r, "height");
861
+ h = Number(h.replace("px", "")) / 2;
862
+ top = w3_getStyleValue(c, "height");
863
+ top = Number(top.replace("px", "")) / 2;
864
+ top = top - h
865
+ r.style.top = top + "px";
866
+ }
867
+
868
+ var currentStack=true;
869
+ if ((window.screen.availWidth <= 768 && window.innerHeight > window.innerWidth) || "" == " horizontal") {restack(true);}
870
+ function restack(horizontal) {
871
+ var tc, ic, t, i, c, f, sv, sh, d, b, height, flt, width;
872
+ tc = document.getElementById("textareacontainer");
873
+ ic = document.getElementById("iframecontainer");
874
+ t = document.getElementById("textarea");
875
+ i = document.getElementById("iframe");
876
+ c = document.getElementById("container");
877
+ sv = document.getElementById("stackV");
878
+ sh = document.getElementById("stackH");
879
+ b = document.getElementsByClassName("localhostoutercontainer");
880
+ tc.className = tc.className.replace("horizontal", "");
881
+ ic.className = ic.className.replace("horizontal", "");
882
+ t.className = t.className.replace("horizontal", "");
883
+ i.className = i.className.replace("horizontal", "");
884
+ c.className = c.className.replace("horizontal", "");
885
+ if (b[0]) {b[0].className = b[0].className.replace("horizontal", "")};
886
+ if (sv) {sv.className = sv.className.replace("horizontal", "")};
887
+ if (sv) {sh.className = sh.className.replace("horizontal", "")};
888
+ stack = "";
889
+ if (horizontal) {
890
+ tc.className = tc.className + " horizontal";
891
+ ic.className = ic.className + " horizontal";
892
+ t.className = t.className + " horizontal";
893
+ i.className = i.className + " horizontal";
894
+ c.className = c.className + " horizontal";
895
+ if (sv) {sv.className = sv.className + " horizontal"};
896
+ if (sv) {sh.className = sh.className + " horizontal"};
897
+ if (b[0]) {b[0].className = b[0].className + " horizontal"};
898
+ stack = " horizontal";
899
+ document.getElementById("textareacontainer").style.height = "50%";
900
+ document.getElementById("iframecontainer").style.height = "50%";
901
+ document.getElementById("textareacontainer").style.width = "100%";
902
+ document.getElementById("iframecontainer").style.width = "100%";
903
+ currentStack=false;
904
+ } else {
905
+ document.getElementById("textareacontainer").style.height = "100%";
906
+ document.getElementById("iframecontainer").style.height = "100%";
907
+ document.getElementById("textareacontainer").style.width = "50%";
908
+ document.getElementById("iframecontainer").style.width = "50%";
909
+ currentStack=true;
910
+ }
911
+ fixDragBtn();
912
+ showFrameSize();
913
+
914
+ }
915
+ function showFrameSize() {
916
+ var t;
917
+ var width, height;
918
+ width = Number(w3_getStyleValue(document.getElementById("iframeResult"), "width").replace("px", "")).toFixed();
919
+ height = Number(w3_getStyleValue(document.getElementById("iframeResult"), "height").replace("px", "")).toFixed();
920
+ document.getElementById("framesize").innerHTML = "Result Size: <span>" + width + " x " + height + "</span>";
921
+ }
922
+ var dragging = false;
923
+ var stack;
924
+ function fixDragBtn() {
925
+ var textareawidth, leftpadding, dragleft, containertop, buttonwidth
926
+ var containertop = Number(w3_getStyleValue(document.getElementById("container"), "top").replace("px", ""));
927
+ if (stack != " horizontal") {
928
+ document.getElementById("dragbar").style.width = "5px";
929
+ textareasize = Number(w3_getStyleValue(document.getElementById("textareawrapper"), "width").replace("px", ""));
930
+ leftpadding = Number(w3_getStyleValue(document.getElementById("textarea"), "padding-left").replace("px", ""));
931
+ buttonwidth = Number(w3_getStyleValue(document.getElementById("dragbar"), "width").replace("px", ""));
932
+ textareaheight = w3_getStyleValue(document.getElementById("textareawrapper"), "height");
933
+ dragleft = textareasize + leftpadding + (leftpadding / 2) - (buttonwidth / 2);
934
+ document.getElementById("dragbar").style.top = containertop + "px";
935
+ document.getElementById("dragbar").style.left = dragleft + "px";
936
+ document.getElementById("dragbar").style.height = textareaheight;
937
+ document.getElementById("dragbar").style.cursor = "col-resize";
938
+
939
+ } else {
940
+ document.getElementById("dragbar").style.height = "5px";
941
+ if (window.getComputedStyle) {
942
+ textareawidth = window.getComputedStyle(document.getElementById("textareawrapper"),null).getPropertyValue("height");
943
+ textareaheight = window.getComputedStyle(document.getElementById("textareawrapper"),null).getPropertyValue("width");
944
+ leftpadding = window.getComputedStyle(document.getElementById("textarea"),null).getPropertyValue("padding-top");
945
+ buttonwidth = window.getComputedStyle(document.getElementById("dragbar"),null).getPropertyValue("height");
946
+ } else {
947
+ dragleft = document.getElementById("textareawrapper").currentStyle["width"];
948
+ }
949
+ textareawidth = Number(textareawidth.replace("px", ""));
950
+ leftpadding = Number(leftpadding .replace("px", ""));
951
+ buttonwidth = Number(buttonwidth .replace("px", ""));
952
+ dragleft = containertop + textareawidth + leftpadding + (leftpadding / 2);
953
+ document.getElementById("dragbar").style.top = dragleft + "px";
954
+ document.getElementById("dragbar").style.left = "5px";
955
+ document.getElementById("dragbar").style.width = textareaheight;
956
+ document.getElementById("dragbar").style.cursor = "row-resize";
957
+ }
958
+ }
959
+ function dragstart(e) {
960
+ e.preventDefault();
961
+ dragging = true;
962
+ var main = document.getElementById("iframecontainer");
963
+ }
964
+ function dragmove(e) {
965
+ if (dragging)
966
+ {
967
+ document.getElementById("shield").style.display = "block";
968
+ if (stack != " horizontal") {
969
+ var percentage = (e.pageX / window.innerWidth) * 100;
970
+ if (percentage > 5 && percentage < 98) {
971
+ var mainPercentage = 100-percentage;
972
+ document.getElementById("textareacontainer").style.width = percentage + "%";
973
+ document.getElementById("iframecontainer").style.width = mainPercentage + "%";
974
+ fixDragBtn();
975
+ }
976
+ } else {
977
+ var containertop = Number(w3_getStyleValue(document.getElementById("container"), "top").replace("px", ""));
978
+ var percentage = ((e.pageY - containertop + 20) / (window.innerHeight - containertop + 20)) * 100;
979
+ if (percentage > 5 && percentage < 98) {
980
+ var mainPercentage = 100-percentage;
981
+ document.getElementById("textareacontainer").style.height = percentage + "%";
982
+ document.getElementById("iframecontainer").style.height = mainPercentage + "%";
983
+ fixDragBtn();
984
+ }
985
+ }
986
+ showFrameSize();
987
+
988
+
989
+ }
990
+ }
991
+ function dragend() {
992
+ document.getElementById("shield").style.display = "none";
993
+ dragging = false;
994
+ var vend = navigator.vendor;
995
+ if (window.editor && vend.indexOf("Apple") == -1) {
996
+ window.editor.refresh();
997
+ }
998
+ }
999
+ if (window.addEventListener) {
1000
+ document.getElementById("dragbar").addEventListener("mousedown", function(e) {dragstart(e);});
1001
+ document.getElementById("dragbar").addEventListener("touchstart", function(e) {dragstart(e);});
1002
+ window.addEventListener("mousemove", function(e) {dragmove(e);});
1003
+ window.addEventListener("touchmove", function(e) {dragmove(e);});
1004
+ window.addEventListener("mouseup", dragend);
1005
+ window.addEventListener("touchend", dragend);
1006
+ window.addEventListener("load", fixDragBtn);
1007
+ window.addEventListener("load", showFrameSize);
1008
+
1009
+ }
1010
+
1011
+ function retheme() {
1012
+ var cc = document.body.className;
1013
+ if (cc.indexOf("darktheme") > -1) {
1014
+ document.body.className = cc.replace("darktheme", "");
1015
+ if (opener) {opener.document.body.className = cc.replace("darktheme", "");}
1016
+ localStorage.setItem("preferredmode", "light");
1017
+ } else {
1018
+ document.body.className += " darktheme";
1019
+ if (opener) {opener.document.body.className += " darktheme";}
1020
+ localStorage.setItem("preferredmode", "dark");
1021
+ }
1022
+ }
1023
+ (
1024
+ function setThemeMode() {
1025
+ var x = localStorage.getItem("preferredmode");
1026
+ if (x == "dark") {
1027
+ document.body.className += " darktheme";
1028
+ }
1029
+ })();
1030
+ function colorcoding() {
1031
+ var ua = navigator.userAgent;
1032
+ //Opera Mini refreshes the page when trying to edit the textarea.
1033
+ if (ua && ua.toUpperCase().indexOf("OPERA MINI") > -1) { return false; }
1034
+ window.editor = CodeMirror.fromTextArea(document.getElementById("textareaCode"), {
1035
+ mode: "text/html",
1036
+ lineWrapping: true,
1037
+ smartIndent: false,
1038
+ htmlMode: true,
1039
+ autocorrect: false,
1040
+ addModeClass: true,
1041
+
1042
+
1043
+ //mode: "text/html",
1044
+ //htmlMode: true,
1045
+ //lineWrapping: true,
1046
+ //smartIndent: false,
1047
+ //addModeClass: true
1048
+
1049
+ });
1050
+ // window.editor.on("change", function () {window.editor.save();});
1051
+ }
1052
+
1053
+ colorcoding();
1054
+
1055
+
1056
+ function clickTab(x) {
1057
+
1058
+ return false;
1059
+
1060
+ }
1061
+
1062
+ function w3_getStyleValue(elmnt,style) {
1063
+ if (window.getComputedStyle) {
1064
+ return window.getComputedStyle(elmnt,null).getPropertyValue(style);
1065
+ } else {
1066
+ return elmnt.currentStyle[style];
1067
+ }
1068
+ }
1069
+
1070
+ function openMenu() {
1071
+ var x = document.getElementById("navbarDropMenu");
1072
+ var y = document.getElementById("menuOverlay");
1073
+ var z = document.getElementById("menuButton");
1074
+ if (z.className.indexOf("w3-text-gray") == -1) {
1075
+ z.className += " w3-text-gray";
1076
+ } else {
1077
+ z.className = z.className.replace(" w3-text-gray", "");
1078
+ }
1079
+ if (z.className.indexOf("w3-gray") == -1) {
1080
+ z.className += " w3-gray";
1081
+ } else {
1082
+ z.className = z.className.replace(" w3-gray", "");
1083
+ }
1084
+ if (x.className.indexOf("w3-show") == -1) {
1085
+ x.className += " w3-show";
1086
+ } else {
1087
+ x.className = x.className.replace(" w3-show", "");
1088
+ }
1089
+ if (y.className.indexOf("w3-show") == -1) {
1090
+ y.className += " w3-show";
1091
+ } else {
1092
+ y.className = y.className.replace(" w3-show", "");
1093
+ }
1094
+
1095
+ }
1096
+ // When the user clicks anywhere outside of the modal, close it
1097
+ window.onclick = function(event) {
1098
+ if (event.target == document.getElementById("menuOverlay")) {
1099
+ openMenu();
1100
+ }
1101
+ }
1102
+ function setCodewindowHeight() {
1103
+ var i;
1104
+ var txw = document.getElementById("textareawrapper");
1105
+ var txwh = w3_getStyleValue(txw,"height");
1106
+
1107
+ var qwsa = document.getElementsByClassName("codewindow");
1108
+ for (i = 0; i < qwsa.length; i++) {
1109
+ qwsa[i].style.height = txwh;
1110
+ qwsa[i].style.setProperty("overflow", "auto", "important");
1111
+ }
1112
+ }
1113
+
1114
+ uic_r_e()
1115
+ </script>
1116
+
1117
+ <script src="/lib/common-deps.js?v=1.0.0"></script>
1118
+ <script src="/lib/user-session.js?v=1.0.2"></script>
1119
+ <script src="/lib/spaceit.js?v=1.0.3"></script><iframe src="https://348800e6e5d15f33b8ad612a77114f28.safeframe.googlesyndication.com/safeframe/1-0-40/html/container.html" style="visibility: hidden; display: none;"></iframe>
1120
+ <link rel="stylesheet" type="text/css" href="/lib/spaceit.css">
1121
+
1122
+
1123
+ <iframe name="__tcfapiLocator" style="display: none;"></iframe><iframe name="__uspapiLocator" style="display: none;"></iframe><iframe src="https://www.google.com/recaptcha/api2/aframe" width="0" height="0" style="display: none;"></iframe></body></html>
1124
+ `