Skip to content

Commit

Permalink
Merge branch 'PGATOUR:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark-M-Ensemble authored May 6, 2024
2 parents 389df94 + dbad560 commit fb86260
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions blocks/embed/embed.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ function buildTwitterEmbed(url) {
return `<blockquote class="twitter-tweet embed-twitter-wrapper"><a href="${url}"></a></blockquote>`;
}

function buildXEmbed(url) {
const newUrl = new URL(url);
newUrl.hostname = 'twitter.com';
return buildTwitterEmbed(newUrl);
}

function buildInstagramEmbed(url) {
const endingSlash = url.pathname.endsWith('/') ? '' : '/';
const location = window.location.href.endsWith('.html') ? window.location.href : `${window.location.href}.html`;
Expand Down Expand Up @@ -85,6 +91,8 @@ function loadEmbed(block) {
a.outerHTML = buildYoutubeEmbed(url);
} else if (hostname.includes('twitter')) {
a.outerHTML = buildTwitterEmbed(url);
} else if (hostname === ('x.com')) {
a.outerHTML = buildXEmbed(url);
} else if (hostname.includes('instagram')) {
a.outerHTML = buildInstagramEmbed(url);
} else if (hostname.includes('facebook')) {
Expand Down

0 comments on commit fb86260

Please sign in to comment.