From 4428728e3cbfeb21cf454b3910c1d192ffd4e2d5 Mon Sep 17 00:00:00 2001 From: Gowtami Date: Mon, 23 Oct 2023 18:36:23 +0530 Subject: [PATCH] contact us initial code --- blocks/columns/columns.js | 40 ++++++++++++++++++++++++++++++++++ blocks/contactus/contactus.css | 0 blocks/contactus/contactus.js | 25 +++++++++++++++++++++ 3 files changed, 65 insertions(+) create mode 100644 blocks/contactus/contactus.css create mode 100644 blocks/contactus/contactus.js diff --git a/blocks/columns/columns.js b/blocks/columns/columns.js index 9b78c812..228d1631 100644 --- a/blocks/columns/columns.js +++ b/blocks/columns/columns.js @@ -5,6 +5,10 @@ export default function decorate(block) { // setup image columns [...block.children].forEach((row) => { [...row.children].forEach((col) => { + /*row.children[0].setAttribute('class', 'col recent-posts'); + row.children[1].setAttribute('class', 'col recent-posts'); + let colPTags = col.querySelector('p');*/ + const pic = col.querySelector('picture'); if (pic) { const picWrapper = pic.closest('div'); @@ -15,4 +19,40 @@ export default function decorate(block) { } }); }); + + const section = document.getElementsByClassName('section columns-container'); + const html = section[0].innerHTML; + section[0].setAttribute('class','section columns-container outer'); + const column = document.getElementsByClassName('columns-wrapper'); + for(let i = 0; i < column.length; i++) { + if(column[i].children[0].classList.contains('columns-2-cols') && !column[i].children[0].classList.contains('posts')){ + column[i].children[0].setAttribute('class','columns block columns-2-cols posts'); + const post = column[i].children[0].children; + console.log(post); + for(let j = 0; j < post.length; j++) { + post[j].setAttribute('class','post'); + //console.log(post[j].children); + const divtag = post[j].children; + for(let l = 0; l < divtag.length; l++){ + const postFirstChild = divtag[l].getElementsByTagName('p'); + + for(let k = 0; k < postFirstChild.length; k++) { + if(k==0){ + postFirstChild[1].children[1].outerHTML='

'+postFirstChild[1].children[1].outerHTML+'

'; + //console.log(postFirstChild[1].children[1]); + postFirstChild[1].outerHTML= '
'+postFirstChild[1].innerHTML +'

'+postFirstChild[2].innerHTML+'

'+'
' + postFirstChild[2].innerHTML=''; + postFirstChild[0].outerHTML='

'+postFirstChild[0].innerHTML+'

'; + } + } + } + +} + + + column[i].setAttribute('class','col recent-posts'); + //console.log('col>'+col); + } + } + } diff --git a/blocks/contactus/contactus.css b/blocks/contactus/contactus.css new file mode 100644 index 00000000..e69de29b diff --git a/blocks/contactus/contactus.js b/blocks/contactus/contactus.js new file mode 100644 index 00000000..d3eb2803 --- /dev/null +++ b/blocks/contactus/contactus.js @@ -0,0 +1,25 @@ +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(/

/g, '

'); + innerElements += ContactUsTitle.replace(/<\/p>/g, '

'); + }else if(i==1){ + innerElements +=pTags[i].outerHTML; + }else if(i==3){ + phone = pTags[2].outerHTML.replace(/

/g, '') + phone.replace(/<\/p>/g, ''); + pTags[i].innerHTML = '

' + phone+pTags[i].innerHTML +'
'; + const button = pTags[i].outerHTML.replace(/

/g, '') + innerElements += button.replace(/<\/p>/g, ''); + } + } + contactUsDiv.innerHTML = innerElements; +} \ No newline at end of file