Browse Source

Hide iframes since they aren't archived

`iframe`s aren't archived, making it reasonable to hide them to avoid
non-archived content. Their links were not handled correctly, so this
also fixes resulting error messages.
2xB 1 year ago
parent
commit
0e83f891a8
1 changed files with 5 additions and 1 deletions
  1. 5 1
      viewer/archive/archiveviewer.js

+ 5 - 1
viewer/archive/archiveviewer.js

@@ -33,6 +33,10 @@ function replace_urls(text, url_before, url_after) {
     return text
 }
 
+function hide_iframes(text) {
+    return text.replaceAll("<iframe", "<!-- ").replaceAll("/iframe>", " -->")
+}
+
 function date_to_iso(value) {
     console.log(value)
     if ((value + "").includes("-")) {
@@ -300,7 +304,7 @@ class ArchiveView {
         fetch(url)
         .then(response => response.text())
         .then(text => {
-            var cleaned_text = replace_urls(text, url_before, url_after)
+            var cleaned_text = hide_iframes(replace_urls(text, url_before, url_after))
             
             const blobContent = new Blob([cleaned_text], {type: "text/html"})
             this.content.src = URL.createObjectURL(blobContent)