Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

contact us initial code #44

Merged
merged 9 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions blocks/contactus/contactus.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* Only comments */
27 changes: 27 additions & 0 deletions blocks/contactus/contactus.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
export default function decorate() {
const contactUsClass = document.getElementsByClassName('contactus block');
contactUsClass[0].setAttribute('id', 'section-support');
contactUsClass[0].children[0].setAttribute('class', 'outer');
contactUsClass[0].children[0].children[0].setAttribute('class', 'text');
const contactUsDiv = contactUsClass[0].children[0].children[0];
const pTags = contactUsDiv.getElementsByTagName('p');
let innerElements = '';
let phone = '';
for (let i = 0; i < pTags.length; i += 1) {
if (i === 0) {
const ContactUsTitle = pTags[i].outerHTML.replace(/<p>/g, '<h2>');
innerElements += ContactUsTitle.replace(/<\/p>/g, '</h2>');
} else if (i === 1) {
innerElements += pTags[i].outerHTML;
} else if (i === 3) {
phone = pTags[2].outerHTML.replace(/<p>/g, `<a class='phone' href="tel:' ${pTags[2].innerHTML.trim()} '">`);
phone.replace(/<\/p>/g, '</a>');
pTags[i].innerHTML = `<div class="buttons">' ${
phone + pTags[i].innerHTML
} '</div>`;
const button = pTags[i].outerHTML.replace(/<p>/g, '');
innerElements += button.replace(/<\/p>/g, '');
}
}
contactUsDiv.innerHTML = innerElements;
}