@@ -119,6 +119,12 @@ <h2 class="phpdocumentor-content__title">
119
119
< section class ="phpdocumentor-description "> </ section >
120
120
121
121
122
+ < h5 class ="phpdocumentor-tag-list__heading " id ="tags ">
123
+ Tags
124
+ < a href ="#tags " class ="headerlink "> < i class ="fas fa-link "> </ i > </ a >
125
+ </ h5 >
126
+ < dl class ="phpdocumentor-tag-list ">
127
+ </ dl >
122
128
123
129
124
130
@@ -223,6 +229,12 @@ <h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
223
229
</ dl >
224
230
225
231
232
+ < h5 class ="phpdocumentor-tag-list__heading " id ="tags ">
233
+ Tags
234
+ < a href ="#tags " class ="headerlink "> < i class ="fas fa-link "> </ i > </ a >
235
+ </ h5 >
236
+ < dl class ="phpdocumentor-tag-list ">
237
+ </ dl >
226
238
227
239
< h5 class ="phpdocumentor-return-value__heading "> Return values</ h5 >
228
240
< span class ="phpdocumentor-signature__response_type "> object</ span >
@@ -266,6 +278,12 @@ <h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
266
278
</ dl >
267
279
268
280
281
+ < h5 class ="phpdocumentor-tag-list__heading " id ="tags ">
282
+ Tags
283
+ < a href ="#tags " class ="headerlink "> < i class ="fas fa-link "> </ i > </ a >
284
+ </ h5 >
285
+ < dl class ="phpdocumentor-tag-list ">
286
+ </ dl >
269
287
270
288
< h5 class ="phpdocumentor-return-value__heading "> Return values</ h5 >
271
289
< span class ="phpdocumentor-signature__response_type "> object</ span >
@@ -310,6 +328,12 @@ <h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
310
328
</ dl >
311
329
312
330
331
+ < h5 class ="phpdocumentor-tag-list__heading " id ="tags ">
332
+ Tags
333
+ < a href ="#tags " class ="headerlink "> < i class ="fas fa-link "> </ i > </ a >
334
+ </ h5 >
335
+ < dl class ="phpdocumentor-tag-list ">
336
+ </ dl >
313
337
314
338
< h5 class ="phpdocumentor-return-value__heading "> Return values</ h5 >
315
339
< span class ="phpdocumentor-signature__response_type "> mixed</ span >
@@ -353,6 +377,12 @@ <h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
353
377
</ dl >
354
378
355
379
380
+ < h5 class ="phpdocumentor-tag-list__heading " id ="tags ">
381
+ Tags
382
+ < a href ="#tags " class ="headerlink "> < i class ="fas fa-link "> </ i > </ a >
383
+ </ h5 >
384
+ < dl class ="phpdocumentor-tag-list ">
385
+ </ dl >
356
386
357
387
< h5 class ="phpdocumentor-return-value__heading "> Return values</ h5 >
358
388
< span class ="phpdocumentor-signature__response_type "> object</ span >
@@ -397,6 +427,12 @@ <h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
397
427
</ dl >
398
428
399
429
430
+ < h5 class ="phpdocumentor-tag-list__heading " id ="tags ">
431
+ Tags
432
+ < a href ="#tags " class ="headerlink "> < i class ="fas fa-link "> </ i > </ a >
433
+ </ h5 >
434
+ < dl class ="phpdocumentor-tag-list ">
435
+ </ dl >
400
436
401
437
< h5 class ="phpdocumentor-return-value__heading "> Return values</ h5 >
402
438
< span class ="phpdocumentor-signature__response_type "> object</ span >
@@ -441,6 +477,12 @@ <h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
441
477
</ dl >
442
478
443
479
480
+ < h5 class ="phpdocumentor-tag-list__heading " id ="tags ">
481
+ Tags
482
+ < a href ="#tags " class ="headerlink "> < i class ="fas fa-link "> </ i > </ a >
483
+ </ h5 >
484
+ < dl class ="phpdocumentor-tag-list ">
485
+ </ dl >
444
486
445
487
< h5 class ="phpdocumentor-return-value__heading "> Return values</ h5 >
446
488
< span class ="phpdocumentor-signature__response_type "> object</ span >
@@ -450,66 +492,96 @@ <h5 class="phpdocumentor-return-value__heading">Return values</h5>
450
492
</ article >
451
493
</ section >
452
494
453
-
454
- < script type ="text/javascript ">
455
- function loadExternalCodeSnippets ( line ) {
456
- Array . prototype . slice . call ( document . querySelectorAll ( 'pre[data-src]' ) ) . forEach ( ( pre ) => {
457
- var src = pre . getAttribute ( 'data-src' ) . replace ( / \\ / g, '/' ) ;
458
- var extension = ( src . match ( / \. ( \w + ) $ / ) || [ , '' ] ) [ 1 ] ;
459
- var language = 'php' ;
460
-
461
- var code = document . createElement ( 'code' ) ;
462
- code . className = 'language-' + language ;
463
-
464
- pre . textContent = '' ;
465
-
466
- pre . setAttribute ( 'data-line' , line )
467
- code . textContent = 'Loading…' ;
468
-
469
- pre . appendChild ( code ) ;
470
-
471
- var xhr = new XMLHttpRequest ( ) ;
472
-
473
- xhr . open ( 'GET' , src , true ) ;
495
+ < div class ="phpdocumentor-modal " id ="source-view ">
496
+ < div class ="phpdocumentor-modal-bg " data-exit-button > </ div >
497
+ < div class ="phpdocumentor-modal-container ">
498
+ < div class ="phpdocumentor-modal-content ">
499
+ < pre style ="max-height: 500px; overflow-y: scroll " data-src ="files/lib/TikTokPrivate/Transform.php.txt " class ="language-php line-numbers linkable-line-numbers "> </ pre >
500
+ </ div >
501
+ < button data-exit-button class ="phpdocumentor-modal__close "> ×</ button >
502
+ </ div >
503
+ </ div >
474
504
475
- xhr . onreadystatechange = function ( ) {
476
- if ( xhr . readyState == 4 ) {
505
+ < script type ="text/javascript ">
506
+ ( function ( ) {
507
+ function loadExternalCodeSnippet ( el , url , line ) {
508
+ Array . prototype . slice . call ( el . querySelectorAll ( 'pre[data-src]' ) ) . forEach ( ( pre ) => {
509
+ const src = url || pre . getAttribute ( 'data-src' ) . replace ( / \\ / g, '/' ) ;
510
+ const language = 'php' ;
511
+
512
+ const code = document . createElement ( 'code' ) ;
513
+ code . className = 'language-' + language ;
514
+ pre . textContent = '' ;
515
+ pre . setAttribute ( 'data-line' , line )
516
+ code . textContent = 'Loading…' ;
517
+ pre . appendChild ( code ) ;
518
+
519
+ var xhr = new XMLHttpRequest ( ) ;
520
+
521
+ xhr . open ( 'GET' , src , true ) ;
522
+
523
+ xhr . onreadystatechange = function ( ) {
524
+ if ( xhr . readyState !== 4 ) {
525
+ return ;
526
+ }
477
527
478
528
if ( xhr . status < 400 && xhr . responseText ) {
479
529
code . textContent = xhr . responseText ;
480
-
481
530
Prism . highlightElement ( code ) ;
531
+ return ;
482
532
}
483
- else if ( xhr . status >= 400 ) {
484
- code . textContent = '✖ Error ' + xhr . status + ' while fetching file: ' + xhr . statusText ;
533
+
534
+ if ( xhr . status === 404 ) {
535
+ code . textContent = '✖ Error: File could not be found' ;
536
+ return ;
485
537
}
486
- else {
487
- code . textContent = '✖ Error: File does not exist, is empty or trying to view from localhost' ;
538
+
539
+ if ( xhr . status >= 400 ) {
540
+ code . textContent = '✖ Error ' + xhr . status + ' while fetching file: ' + xhr . statusText ;
541
+ return ;
488
542
}
489
- }
490
- } ;
491
543
492
- xhr . send ( null ) ;
493
- } ) ;
494
- }
495
-
496
- var modals = document . querySelectorAll ( "[data-modal]" ) ;
497
-
498
- modals . forEach ( function ( trigger ) {
499
- trigger . addEventListener ( "click" , function ( event ) {
500
- //event.preventDefault();
501
- const modal = document . getElementById ( trigger . dataset . modal ) ;
502
- modal . classList . add ( "phpdocumentor-modal__open" ) ;
503
- loadExternalCodeSnippets ( trigger . dataset . line )
504
- const exits = modal . querySelectorAll ( "[data-exit-button]" ) ;
505
- exits . forEach ( function ( exit ) {
506
- exit . addEventListener ( "click" , function ( event ) {
507
- event . preventDefault ( ) ;
508
- modal . classList . remove ( "phpdocumentor-modal__open" ) ;
544
+ code . textContent = '✖ Error: An unknown error occurred' ;
545
+ } ;
546
+
547
+ xhr . send ( null ) ;
548
+ } ) ;
549
+ }
550
+
551
+ const modalButtons = document . querySelectorAll ( "[data-modal]" ) ;
552
+ const openedAsLocalFile = window . location . protocol === 'file:' ;
553
+ if ( modalButtons . length > 0 && openedAsLocalFile ) {
554
+ console . warn (
555
+ 'Viewing the source code is unavailable because you are opening this page from the file:// scheme; ' +
556
+ 'browsers block XHR requests when a page is opened this way'
557
+ ) ;
558
+ }
559
+
560
+ modalButtons . forEach ( function ( trigger ) {
561
+ if ( openedAsLocalFile ) {
562
+ trigger . setAttribute ( "hidden" , "hidden" ) ;
563
+ }
564
+
565
+ trigger . addEventListener ( "click" , function ( event ) {
566
+ event . preventDefault ( ) ;
567
+ const modal = document . getElementById ( trigger . dataset . modal ) ;
568
+ if ( ! modal ) {
569
+ console . error ( `Modal with id "${ trigger . dataset . modal } " could not be found` ) ;
570
+ return ;
571
+ }
572
+ modal . classList . add ( "phpdocumentor-modal__open" ) ;
573
+
574
+ loadExternalCodeSnippet ( modal , trigger . dataset . src || null , trigger . dataset . line )
575
+ const exits = modal . querySelectorAll ( "[data-exit-button]" ) ;
576
+ exits . forEach ( function ( exit ) {
577
+ exit . addEventListener ( "click" , function ( event ) {
578
+ event . preventDefault ( ) ;
579
+ modal . classList . remove ( "phpdocumentor-modal__open" ) ;
580
+ } ) ;
509
581
} ) ;
510
582
} ) ;
511
583
} ) ;
512
- } ) ;
584
+ } ) ( ) ;
513
585
</ script >
514
586
515
587
</ article >
0 commit comments