Commercial Gym Equipment Financing
const click = 'onClick=window.open("https://www.clicklease.com/partner/buy-and-sell-fitness/");'
setTimeout(function () {
start();
}, 1000);
function start() {
var place = document.querySelector(".product-price");
var ifplace = document.querySelector('.top-menu ul');
var isplace = document.querySelector('.footer-nav');
var xhttp = new XMLHttpRequest();
if (!document.querySelector('.clicktab')) {
render(ifplace,isplace);
}
if(window.location.href.indexOf("products") > -1) {
if (!document.querySelector('.ClickleaseButton')) {
button(place, click, xhttp);
}
}
}
function button(place, click, xhttp) {
price = document.querySelector(".product-price");
amount = Number(price.innerText.replace(/[^0-9||\.]+/g, ''));
xhttp.onreadystatechange = function (event) {
if (this.readyState == 4 && this.status == 200) {
var divContainer = document.createElement('div');
divContainer.className = 'ClickleaseButton';
divContainer.setAttribute("style", "width: 90%;margin-left: 20px;margin-top: -10px;margin-bottom: -65px;");
place.appendChild(divContainer);
divContainer.innerHTML = '
';
}
}
validation(amount, xhttp);
}
function render(ifplace,isplace) {
var li = document.createElement('li');
li.className = 'from-top-menu clicktab';
li.setAttribute("style", "cursor:pointer;");
ifplace.appendChild(li);
li.innerHTML = `
Clicklease Financing`;
var li2 = document.createElement('li');
li2.className = 'footer-nav clicktab';
li2.setAttribute("style", "cursor:pointer;");
isplace.appendChild(li2);
li2.innerHTML = `
Clicklease Financing`;
}
function validation(amount, xhttp) {
if (amount >= 500 && amount <= 20000) {
xhttp.open('GET', 'https://app.clicklease.com/api/estimatedPaymentAmount/' + amount, true);
xhttp.send();
}
}