Skip to content

Commit

Permalink
temp workaround for old titles
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroen committed Jun 7, 2024
1 parent 0be9ec6 commit 73cfa35
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
5 changes: 2 additions & 3 deletions views/article-iframe.pug
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ extends layout

block content
.pl-3.pt-1
h1.title.text-center.display-6 #{article.title}
h1#article-title.title.text-center.display-6 #{article.title}
p.text-end
| Authored by:
if article.author
Expand All @@ -29,10 +29,9 @@ block content

block before_scripts
script
| document.getElementById('viewerframe').onload=function(){document.getElementById('article-placeholder').remove()}
include includes/article-iframe-inline.js

block after_scripts
script(src="https://cdnjs.cloudflare.com/ajax/libs/iframe-resizer/4.3.1/iframeResizer.min.js")
script
| iFrameResize({ log: false, checkOrigin: false, warningTimeout: 0 }, '#viewerframe');

8 changes: 8 additions & 0 deletions views/includes/article-iframe-inline.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const innerframe = document.getElementById('viewerframe');
innerframe.onload=function(){
document.getElementById('article-placeholder').remove();
if(innerframe.contentDocument && innerframe.contentDocument.title){
document.title = innerframe.contentDocument.title;
document.getElementById('article-title').innerText = innerframe.contentDocument.title;
}
}

0 comments on commit 73cfa35

Please sign in to comment.