mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-15 06:35:20 -07:00
Use subscribe embed on eleventy templates
This commit is contained in:
parent
d0148a7f78
commit
a4c3f750c3
1 changed files with 12 additions and 0 deletions
|
|
@ -176,6 +176,18 @@ class DefaultLayout {
|
|||
// Set page content
|
||||
document.querySelector('.app-main').innerHTML = content
|
||||
|
||||
// Convert subscribe to iframe embed
|
||||
Array.from(document.querySelectorAll('form.all-updates-subscribe')).forEach( domNode => {
|
||||
const subscribeEmbed = document.createElement('iframe')
|
||||
subscribeEmbed.setAttribute('src', '/embed-subscribe')
|
||||
// https://web.dev/iframe-lazy-loading/
|
||||
subscribeEmbed.setAttribute('loading', 'lazy')
|
||||
subscribeEmbed.style.width = '350px'
|
||||
subscribeEmbed.style.height = '150px'
|
||||
|
||||
domNode.parentNode.replaceChild(subscribeEmbed, domNode)
|
||||
})
|
||||
|
||||
// Set js before end of body
|
||||
document.querySelector('body').insertAdjacentHTML('beforeend', `<script>${ this.getJs() }</script>` )
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue