generated from adobe/aem-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
df48d2b
commit 43754f8
Showing
4 changed files
with
135 additions
and
22 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"cSpell.words": [ | ||
"removeptag" | ||
] | ||
} |
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,29 +1,33 @@ | ||
import { createOptimizedPicture } from '../../scripts/lib-franklin.js'; | ||
|
||
|
||
export default function decorate(block) { | ||
console.log(block); | ||
const element = document.createElement('div'); | ||
element.innerHTML = ` | ||
<script async charset="utf-8" type="text/javascript" src="https://js.hsforms.net/forms/embed/v2.js"></script> | ||
<script async> | ||
|
||
function loadHubSpotFormScript() { | ||
var script = document.createElement('script'); | ||
script.type = 'text/javascript'; | ||
script.src = '//js.hsforms.net/forms/embed/v2.js'; | ||
script.charset = 'utf-8'; | ||
|
||
// Define a callback function to create the form after the script loads | ||
script.onload = function () { | ||
hbspt.forms.create({ | ||
region: "na1", | ||
portalId: "1769030", | ||
formId: "828820d8-9902-4b4e-8ff4-169076195288" | ||
region: "na1", | ||
portalId: "1769030", | ||
formId: "828820d8-9902-4b4e-8ff4-169076195288", | ||
target: '#myFormContainer' // Specify the container where the form should be rendered | ||
}); | ||
</script>`; | ||
}; | ||
|
||
// Append the script to the document's head | ||
document.head.appendChild(script); | ||
} | ||
|
||
// Call the function to load the HubSpot form script | ||
loadHubSpotFormScript(); | ||
|
||
console.log(block); | ||
const element = document.createElement('div'); | ||
element.id="myFormContainer"; | ||
block.append(element); | ||
// const ul = document.createElement('ul'); | ||
// [...block.children].forEach((row) => { | ||
// const li = document.createElement('li'); | ||
// while (row.firstElementChild) li.append(row.firstElementChild); | ||
// [...li.children].forEach((div) => { | ||
// if (div.children.length === 1 && div.querySelector('picture')) div.className = 'cards-card-image'; | ||
// else div.className = 'cards-card-body'; | ||
// }); | ||
// ul.append(li); | ||
// }); | ||
// ul.querySelectorAll('img').forEach((img) => img.closest('picture').replaceWith(createOptimizedPicture(img.src, img.alt, false, [{ width: '750' }]))); | ||
// block.textContent = ''; | ||
// block.append(ul); | ||
} |
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