-
Notifications
You must be signed in to change notification settings - Fork 443
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/starter-kit' into v9
# Conflicts: # Gemfile.lock
- Loading branch information
Showing
3 changed files
with
4 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +0,0 @@ | ||
<!-- | ||
Code used for embedding Gumroad on the Hydejack Site. | ||
Left here for reference, feel free to delete. | ||
--> | ||
<link rel="dns-prefetch" href="https://assets.gumroad.com"> | ||
<script defer data-domain="hydejack.com" src="https://plausible.io/js/plausible.js"></script> | ||
<script type="module"> | ||
const ppiData = window._ppiData = fetch('https://hydejack-ppi.qwtel.workers.dev', { mode: 'cors'}).then(res => res.json()).catch(() => ({})); | ||
const promisify = f => x => new Promise(r => f(x).addEventListener('load', r)); | ||
const loadJS = promisify(window.loadJS); | ||
{ | ||
let p; | ||
document.querySelector('hy-push-state').addEventListener('load', () => { | ||
const io = new IntersectionObserver(async (entries) => { | ||
if (entries.some(x => x.isIntersecting)) { | ||
p = p || loadJS('https://gumroad.com/js/gumroad-embed.js'); | ||
const [{ code }] = await Promise.all([ppiData, p]); | ||
document.querySelectorAll('.gumroad-product-embed').forEach(el => { | ||
if (!el.dataset.gumroadParams) { | ||
el.dataset.gumroadParams = 'offer_code=' + (code || 'qr0tw8m'); | ||
} | ||
}); | ||
if (!window.GumroadEmbed) { | ||
await new Promise(function check1(res) { | ||
if ('createGumroadEmbed' in window) res(window.createGumroadEmbed()); | ||
else setTimeout(() => check1(res), 200); | ||
}); | ||
} | ||
await new Promise(function check2(res) { | ||
if ('GumroadEmbed' in window) res(GumroadEmbed.reload()); | ||
else setTimeout(() => check2(res), 200); | ||
}); | ||
} | ||
}, { rootMargin: '1440px' }); | ||
document.querySelectorAll('.gumroad-product-embed').forEach(el => io.observe(el)); | ||
}); | ||
} | ||
{ | ||
let p; | ||
document.querySelector('hy-push-state').addEventListener('load', () => { | ||
const io = new IntersectionObserver(async (entries) => { | ||
if (entries.some(x => x.isIntersecting)) { | ||
p = p || loadJS('https://gumroad.com/js/gumroad.js'); | ||
const [{ code }] = await Promise.all([ppiData, p]); | ||
if (code) { | ||
document.querySelectorAll('.gumroad-button').forEach(el => { | ||
if (!el.href.endsWith(code)) { | ||
el.href = el.href + '/' + (code || 'qr0tw8m'); | ||
} | ||
}); | ||
} | ||
if (!window.GumroadOverlay) { | ||
await new Promise(function check(res) { | ||
if ('createGumroadOverlay' in window) res(window.createGumroadOverlay()); | ||
else setTimeout(() => check(res), 200); | ||
}); | ||
} | ||
} | ||
}, { rootMargin: '300px' }); | ||
document.querySelectorAll('.gumroad-button').forEach(el => io.observe(el)); | ||
}); | ||
} | ||
</script> | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters