//this is the code for english language
// English Language
setupLanguage('english', 'tab-call-to-action-english', 'CTA_ctaTranslationEn');
// German Language
setupLanguage('german', 'tab-call-to-action-german', 'CTA_ctaTranslationDe');
});
function setupLanguage(language, mainDivId, prefix) {
var
if (!mainDiv) return;
var
if (!rowDiv) return;
var secondChild = rowDiv.
if (rowDiv){
var secondchild=rowDiv.
secondChild.classList.
secondchild.
secondChild.style.
// var paragraph=document.createElement('p');
// paragraph.textContent="Preview Page";
// paragraph.
secondChild.style.
// secondchild.appendChild(paragraph);
var
var
var descriptionLabel = document.getElementById(`${prefix}_description`);
var buttonLabel = document.getElementById(`${prefix}_button_label`);
var buttonLink = document.getElementById(`${prefix}_button_link`);
if (imageInput) {
var outputImage = document.createElement('img');
secondchild.appendChild(output);
ctaImage.onchange=evt=>{
const [file] =
output.
outputImage.src = URL.
output.
outputImage.style.height = '300px';
};
secondChild.appendChild(outputImage);
}
if (titleLabel) {
var titleResult = createAndAppendElement(secondChild, 'h4');
titleResult.style.color = 'black';
titleResult.style.textAlign = 'center';
titleLabel.addEventListener('input', function(e) {
titleResult.innerText = e.target.value;
});
if (titleLabel.value) {
titleResult.innerText = titleLabel.value;
}
if
output.src='uploads/'+ctaImage.placeholder;
output.
var descriptionResult = createAndAppendElement(secondChild, 'p');
descriptionResult.style.
output.style.width="600px";
}
const source = document.getElementById('CTA_ctaTranslationEn_title');
const result =document.createElement('h4');
result.style.color='black';
result.style.textAlign="center";
const inputHandler =
descriptionLabel.addEventListener('input', function(e) {
});
if (descriptionLabel.value) {
descriptionResult.innerText = descriptionLabel.value;
}
if
result.innerText=source.
var buttonResult = createAndAppendElement(secondChild, 'a');
buttonLabel.addEventListener('input', function(e) {
buttonResult.innerText = e.target.value;
applyButtonStyles(buttonResult);
});
buttonLink.addEventListener('input', function(e) {
buttonResult.href = e.target.value;
});
if (buttonLabel.value) {
buttonResult.innerText = buttonLabel.value;
applyButtonStyles(buttonResult);
}
secondchild.appendChild(result);
const sourceDesc = document.getElementById('CTA_ctaTranslationEn_description');
const resultDesc =document.createElement('p');
resultDesc.innerText=sourceDesc.
buttonResult.href = buttonLink.value;
}
function createAndAppendElement(parent, tagName) {
var
var rowDivDe=maindivDe.querySelector(".row");
if (rowDivDe){
var secondchildDe=rowDivDe.children[1];
secondchildDe.classList.add('col-md-5');
secondchildDe.
parent.appendChild(element);
return element;
}
function applyButtonStyles(button) {
button.style.
secondchildDe.
button.style.
var ctaImageDe
var outputDe=document.createElement('img');
// img.src = 'https://media.geeksforgeeks.org/wp-content/uploads/20190529122828/bs21.png';
ctaImageDe.onchange=evt=>{
const [file] = ctaImageDe.files
outputDe.src = URL.createObjectURL(file)
outputDe.
button.style.
outputDe.
button.style.
}
secondchildDe.appendChild(outputDe);
const sourceDe
const resultDe =document.createElement('h4');
resultDe.
button.style.
resultDe.
button.style.
const inputHandlerDe
resultDe.innerText = e.target.value;
}
sourceDe.addEventListener('input', inputHandlerDe);
secondchildDe.appendChild(resultDe);
const sourceDescDe = document.getElementById('CTA_ctaTranslationDe_description');
const resultDescDe =document.createElement('p');
resultDescDe.style.color='black';
const inputHandlerDescDe = function(e) {
resultDescDe.innerText = e.target.value;
}
sourceDescDe.addEventListener('input', inputHandlerDescDe);
secondchildDe.appendChild(resultDescDe);
const sourceLabelDe = document.getElementById('CTA_ctaTranslationDe_button_label');
const resultLabelDe =document.createElement('a');
const sourceLinkDe=document.getElementById("CTA_ctaTranslationDe_button_link");
const inputHandlerLabelDe = function(e) {
resultLabelDe.innerText = e.target.value;
resultLabelDe.style.display="inline-block";
resultLabelDe.style.color="white";
resultLabelDe.style.width="200px";
resultLabelDe.style.height="50px";
resultLabelDe.style.textAlign="center";
resultLabelDe.style.backgroundColor="black";
}
const inputHandLinkDe=function (e){
resultLabelDe.href=e.target.value;
}
sourceLabelDe.addEventListener('input', inputHandlerLabelDe);
sourceLinkDe.addEventListener('input',inputHandLinkDe);
secondchildDe.appendChild(resultLabelDe);
}
});
}