`;
495 | const columnNames = ["mime", "method", "url", "type"];
496 | let first = true;
497 | for (const cacheName in cacheContents) {
498 | if (!cacheContents.hasOwnProperty(cacheName)) {
499 | continue;
500 | }
501 | html += `
502 |
503 | Cache
504 | "${cacheName}
"
505 |
506 |
507 |
508 |
509 | ${columnNames
510 | .map((columnName) => {
511 | return `
512 | ${
513 | columnName === "url" || columnName === "mime"
514 | ? columnName.toUpperCase()
515 | : columnName.charAt(0).toUpperCase() +
516 | columnName.slice(1)
517 | }
518 | | `;
519 | })
520 | .join("\n")}
521 |
522 |
523 | ${cacheContents[cacheName]
524 | .sort((a, b) => {
525 | if (a.mime < b.mime) {
526 | return -1;
527 | }
528 | if (a.mime > b.mime) {
529 | return 1;
530 | }
531 | return 0;
532 | })
533 | .map((cacheEntry) => {
534 | const url = cacheEntry.url;
535 | const contentType = cacheEntry.mime;
536 | return `
537 |
538 | ${columnNames
539 | .map((columnName) => {
540 | if (columnName === "url") {
541 | return `
542 |
543 | ${url}
544 | | `;
545 | } else if (columnName === "mime") {
546 | if (/^image\//.test(contentType)) {
547 | return `
548 |
549 |
550 |
553 |
554 | | `;
555 | } else if (/^text\/css$/.test(contentType)) {
556 | return `
557 |
558 | 🖌
559 | | `;
560 | } else if (/^audio\//.test(contentType)) {
561 | return `
562 |
563 | 🔈
564 | | `;
565 | } else if (/^video\//.test(contentType)) {
566 | return `
567 |
568 | 📹
569 | | `;
570 | } else if (/\/.*?javascript/.test(contentType)) {
571 | return `
572 |
573 | 📝
574 | | `;
575 | } else if (/^text\/html/.test(contentType)) {
576 | return `
577 |
578 | 📄
579 | | `;
580 | } else if (
581 | /^application\/.*?font/.test(contentType)
582 | ) {
583 | return `
584 |
585 | 🔡
586 | | `;
587 | } else if (/\/json/.test(contentType)) {
588 | return `
589 |
590 | 🔖
591 | | `;
592 | } else if (
593 | /application\/manifest\+json/.test(contentType)
594 | ) {
595 | return `
596 |
597 | 📃
598 | | `;
599 | } else {
600 | return `
601 |
602 | ❓
603 | | `;
604 | }
605 | } else {
606 | return `
607 |
608 | ${cacheEntry[columnName]}
609 | | `;
610 | }
611 | })
612 | .join("\n")}
613 |
`;
614 | })
615 | .join("\n")}
616 |
617 |
618 |
619 | `;
620 | first = false;
621 | }
622 | html += `
623 |
624 |