Untitled
unknown
plain_text
2 years ago
5.7 kB
8
Indexable
(function () {
try {
/* main variables */
var debug = 0;
var variation_name = "";
var $;
/* all Pure helper functions */
function waitForElement(selector, trigger, delayInterval, delayTimeout) {
var interval = setInterval(function () {
if (
document &&
document.querySelector(selector) &&
document.querySelectorAll(selector).length > 0
) {
clearInterval(interval);
trigger();
}
}, delayInterval);
setTimeout(function () {
clearInterval(interval);
}, delayTimeout);
}
waitForSlick = function (trigger) {
var interval = setInterval(function () {
if (window.jQuery.fn.slick != undefined) {
clearInterval(interval);
trigger();
}
}, 50);
setTimeout(function () {
clearInterval(interval);
}, 15000)
}
waitForjQuery = function (trigger) {
var interval = setInterval(function () {
if (window.jQuery != undefined) {
clearInterval(interval);
trigger();
}
}, 50);
setTimeout(function () {
clearInterval(interval);
}, 15000)
}
addScript = function () {
var cssScript = '' +
"<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick.css'/>";
document.querySelector('head').insertAdjacentHTML('beforeend', cssScript);
var swiperScript = document.createElement('script');
swiperScript.src = 'https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick.min.js';
document.getElementsByTagName('head')[0].appendChild(swiperScript);
}
var sliderdata = {
"data": [
{
"title": "Wendy F.",
"content": "Good job! Fast efficient, clean, and nice."
},
{
"title": "Tershia D..",
"content": "Another great experience with this terrific company!"
},
{
"title": "Avadana G.",
"content": "They were very helpful and professional since the start."
},
]
}
/* Variation Init */
function init() {
var generatedHtml = '';
sliderdata.data.forEach(function (item) {
generatedHtml += `
<div class="eg-slide">
<div class="eg-rating">
<i class="fas fa-star fa-fw"></i><i class="fas fa-star fa-fw"></i><i class="fas fa-star fa-fw"></i><i
class="fas fa-star fa-fw"></i><i class="fas fa-star fa-fw"></i>
</div>
<div class="eg-content">
<p>${item.content}</p>
</div>
<div class="eg-title">
${item.title}
</div>
</div>`;
});
var newHtml = `
<div class="eg-hero-reviews_banner">
<div class="eg-new-review_container">
${generatedHtml}
</div>
</div>`;
if (!document.querySelector('.eg-hero-reviews_banner')) {
document.querySelector('html body #hero > .concave_curve').insertAdjacentHTML("beforeend", newHtml)
}
}
function slider() {
waitForjQuery(function () {
$ = window.jQuery;
addScript();
waitForSlick(function () {
$('.eg-new-review_container').slick({
speed: 4000,
autoplay: true,
autoplaySpeed: 200,
centerMode: true,
slidesToShow: 1,
easing: 'easeOutElastic',
slidesToScroll: 1,
variableWidth: true,
infinite: true,
initialSlide: 1,
arrows: false,
buttons: false
});
});
});
}
/* Initialize variation */
waitForElement('html body #hero > .concave_curve', init, 50, 15000);
if (window.innerWidth < 1200) {
waitForElement('html body #hero > .concave_curve', slider, 50, 15000);
}
} catch (e) {
if (debug) console.log(e, "error in Test" + variation_name);
}
})();
html body .eg-new-review_container {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
grid-gap: 20px !important;
}
html body #hero {
margin-bottom: 20px !important;
}
html body #hero>.concave_curve {
height: 140px !important;
display: flex;
justify-content: center;
align-items: center;
background-color: #e5edef !important;
padding-top: 20px;
}
html body .eg-new-review_container .eg-content p {
font-size: 16px !important;
line-height: 1.3125em;
font-weight: 600;
color: #333333;
margin-bottom: 0px !important;
}
html body .eg-new-review_container .eg-rating {
color: #f47421 !important;
}
html body .eg-new-review_container .eg-rating>i {
font-weight: 900;
font-family: "Font Awesome 5 Free";
text-align: center;
width: 1.25em;
}
html body .eg-new-review_container .eg-title {
color: #5c909b;
font-weight: 600;
font-size: 16px;
text-align: left !important;
}
#hero #hero_right form {
margin-bottom: 60px;
}
@media only screen and (max-width:1200px) {
html body .eg-new-review_container .slick-track {
grid-gap: 30px !important;
display: flex;
}
}
@media only screen and (max-width:767px) {
#hero>#hero_content>#hero_left {
margin-bottom: 60px;
}
}
#hero #hero_right form {
margin-bottom: 60px !important;
}Editor is loading...
Leave a Comment