<script>
if(window.innerWidth >= 991) {
function setNextActive() {
// replace class and create active state
let activeItem = $('.modal-collection-item.active');
if (!activeItem.length) {
// replace class
$('.modal-collection-item').first().addClass('active');
} else {
// set the _next_ item to be active
activeItem.next().addClass('active');
activeItem.removeClass('active');
}
}
setInterval(setNextActive, 2 * 2000);
$(".modal-collection-item").click(function() {
var listItems = $(".modal-collection-item");
for (let i = 0; i < listItems.length; i++) {
listItems[i].classList.remove("active");
}
this.classList.add("active");
});
}
</script>
<script>
if(window.innerWidth >= 991) {
$(document).ready(function() {
var x = document.getElementById('savings-container');
x.querySelector('.savings-collection-item').click();
});
}
$(".savings-collection-item").click(function() {
var listItems = $(".savings-collection-item");
for (let i = 0; i < listItems.length; i++) {
listItems[i].classList.remove("active");
}
this.classList.add("active");
});
</script>
// if window width is less than a certain width user must CLICK through each item
<input type="text" name="share-link" id="slug">
<script>
// set custom url in input
document.getElementById('insertYourFormID').addEventListener("submit", myStrangeFunction);
function myStrangeFunction(){
url = document.getElementById('uniqueId').value;
url = "insertBaseURL" + url;
document.getElementById("slug").value = url;
}
</script>
// you will need to generate a UniqueID or code to attach to the URL
<button href="" class="button" id="sms"> Share via SMS </button>
<script>
document.getElementById('sms').addEventListener("click", sendSMS);
function sendSMS(){
url = document.getElementById("slug").value;
body = "You can join me or learn more here: " + url + " , or just shoot me a text if you'd like to talk.";
location.href = "sms:?&body=" + body;
};
</script>
// adds link to SMS as well
<script>
document.getElementById('sendEmail').addEventListener("click", sendEmail);
function sendEmail() {
url = document.getElementById("slug").value;
email = '';
subject = "insertSubject";
emailBody = "insertEmailBody" + url;
document.location = "mailto:" + email + "?subject=" + subject + "&body=" + emailBody;
}
</script>
// works with custom URL + SMS
<script>
$(document).ready(function(){
var maxLength = 300; //max character count - change to what you want
$(".show-read-more").each(function(){
//insert your class here
var myStr = $(this).text();
if($.trim(myStr).length > maxLength){
var newStr = myStr.substring(0, maxLength);
var removedStr = myStr.substring(maxLength, $.trim(myStr).length);
$(this).empty().html(newStr);
$(this).append(' <a href="javascript:void(0);" class="read-more">read more...</a>');
$(this).append('<span class="more-text">' + removedStr + '</span>');
}
});
$(".read-more").click(function(){
$(this).siblings(".more-text").contents().unwrap();
$(this).remove();
});
});
</script>
<style>
.show-read-more .more-text{
display: none;
}
</style>
<!-- article summary shorten script -->
<script>
document.addEventListener("DOMContentLoaded", () => {
const maxCharacters = 140, // whatever max charachter you like to display
targets = document.getElementsByClassName("text-truncate");
Array.from(targets).forEach((target) => {
const text = target.textContent,
truncate = text.substring(0, maxCharacters);
target.textContent = `${truncate}...`;
});
});
</script>
<script>
document.getElementById('Creator-Name-2').addEventListener('input', myStrangeFunction);
function myStrangeFunction(){
slug = document.getElementById("Creator-Name-2").value;
slug = slug.replace(/\s/g, '');
url = slug + Date.now() + Math.floor(Math.random());
document.getElementById('uniqueId').value = url;
};
</script>
// can be used with custom URLS
<script>
function setEqualHeight() {
let slides = document.querySelectorAll('.slide_reviews');
let maxHeight = 0;
slides.forEach(slide => {
slide.style.height = '';
if (slide.offsetHeight > maxHeight) {
maxHeight = slide.offsetHeight;
}
});
slides.forEach(slide => {
slide.style.height = maxHeight + 'px';
});
}
setEqualHeight();
window.addEventListener('resize', setEqualHeight);
</script>
<script async>
var navbar = document.getElementById('navBar');
window.onscroll = function () {
if (window.pageYOffset > 180) {
navbar.classList.add('active');
} else {
navbar.classList.remove('active');
}
}
</script>