Skip to content

Commit

Permalink
Updated XenForo iframe
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshyPHP committed Mar 13, 2024
1 parent 439a7ac commit 9dd7a57
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
15 changes: 8 additions & 7 deletions iframe/2/xenforo.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
((document) =>
{
const contentTypes = [
['post', /^#(https:\/\/[-.\/\w]+?\/)threads\/\d+\/post-(\d+)/ ],
['profile_post', /^#(https:\/\/[-.\/\w]+?\/)profile-posts\/(\d+)/ ],
['resource', /^#(https:\/\/[-.\/\w]+?\/)resources\/(\d+)/ ],
['thread', /^#(https:\/\/[-.\/\w]+?\/)threads\/(?:[-\w]+\.)?(\d+)/],
['xfmg_album', /^#(https:\/\/[-.\/\w]+?\/)media\/albums\/(\d+)/ ]
['post-', /^#(https:\/\/[-.\/\w]+?\/)threads\/\d+\/post-(\d+)/ ],
['profile_post-', /^#(https:\/\/[-.\/\w]+?\/)profile-posts\/(\d+)/ ],
['resource-', /^#(https:\/\/[-.\/\w]+?\/)resources\/(\d+)/ ],
['thread-', /^#(https:\/\/[-.\/\w]+?\/)threads\/(?:[-\w]+\.)?(\d+)/ ],
['xfmg_album-', /^#(https:\/\/[-.\/\w]+?\/)media\/albums\/(\d+)/ ],
['', /^#(https:\/\/[-.\/\w]+?\/)embed\.php\?content=([-\w]+)/]
];

const iframe = /** @type {!HTMLIFrameElement} */ (document.createElement('iframe'));
Expand All @@ -31,12 +32,12 @@
{
port = e.ports[0];

for (const [type, regexp] of contentTypes)
for (const [prefix, regexp] of contentTypes)
{
const m = regexp.exec(location.hash);
if (m)
{
iframe.src = m[1] + 'embed.php?content=' + type + '-' + m[2];
iframe.src = m[1] + 'embed.php?content=' + prefix + m[2];
document.body.appendChild(iframe);

return;
Expand Down
2 changes: 1 addition & 1 deletion iframe/2/xenforo.min.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!DOCTYPE html><title>Content from XenForo</title><style>body{margin:0}iframe{border:0;height:100vh;width:100%}</style><script>(d=>{const e=[['post',/^#(https:\/\/[-.\/\w]+?\/)threads\/\d+\/post-(\d+)/],['profile_post',/^#(https:\/\/[-.\/\w]+?\/)profile-posts\/(\d+)/],['resource',/^#(https:\/\/[-.\/\w]+?\/)resources\/(\d+)/],['thread',/^#(https:\/\/[-.\/\w]+?\/)threads\/(?:[-\w]+\.)?(\d+)/],['xfmg_album',/^#(https:\/\/[-.\/\w]+?\/)media\/albums\/(\d+)/]],b=d.createElement('iframe');b.allow='allow-scripts allow-top-navigation-by-user-activation';b.scrolling='no';b.onload=()=>b.contentWindow.postMessage({id:0,type:'getHeight'},'*');let c;window.onmessage=a=>{a.stopImmediatePropagation();if('s9e:init'!==a.data||c)a.source===b.contentWindow&&a.data.height&&c.postMessage(+a.data.height);else{c=a.ports[0];for(const [f,g]of e)if(a=g.exec(location.hash)){b.src=a[1]+'embed.php?content='+f+'-'+a[2];d.body.appendChild(b);break}}}})(document)</script>
<!DOCTYPE html><title>Content from XenForo</title><style>body{margin:0}iframe{border:0;height:100vh;width:100%}</style><script>(d=>{const e=[['post-',/^#(https:\/\/[-.\/\w]+?\/)threads\/\d+\/post-(\d+)/],['profile_post-',/^#(https:\/\/[-.\/\w]+?\/)profile-posts\/(\d+)/],['resource-',/^#(https:\/\/[-.\/\w]+?\/)resources\/(\d+)/],['thread-',/^#(https:\/\/[-.\/\w]+?\/)threads\/(?:[-\w]+\.)?(\d+)/],['xfmg_album-',/^#(https:\/\/[-.\/\w]+?\/)media\/albums\/(\d+)/],['',/^#(https:\/\/[-.\/\w]+?\/)embed\.php\?content=([-\w]+)/]],b=d.createElement('iframe');b.allow='allow-scripts allow-top-navigation-by-user-activation';b.scrolling='no';b.onload=()=>b.contentWindow.postMessage({id:0,type:'getHeight'},'*');let c;window.onmessage=a=>{a.stopImmediatePropagation();if('s9e:init'!==a.data||c)a.source===b.contentWindow&&a.data.height&&c.postMessage(+a.data.height);else{c=a.ports[0];for(const [f,g]of e)if(a=g.exec(location.hash)){b.src=a[1]+'embed.php?content='+f+a[2];d.body.appendChild(b);break}}}})(document)</script>

0 comments on commit 9dd7a57

Please sign in to comment.