Files
Gainsight/Custom_Templates/customer_templates/WoodMac Learn/_head.html.liquid

82 lines
2.7 KiB
Plaintext

{% styles default %}
{% styles colors %}
{% styles custom %}
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Manrope:wght@200..800&family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap" rel="stylesheet">
<script>
function changeEventRegisterBtnText() {
const buttons = document.querySelectorAll('.register-btn');
buttons.forEach((button) => {
if (button.innerText == "Register") {
button.innerText = 'Add to my dashboard'
} else if (button.innerText == "Unregister") {
button.innerText = 'Remove from my dashboard'
}
})
}
function changeBackBtnUrl() {
const backBtn = document.getElementsByClassName('back-button')[0];
const previousUrl = document.referrer;
let currentUrl = window.location.href;
let newUrl = ''
if (previousUrl.includes('activities')) {
newUrl = '/app/dashboard'
} else if (currentUrl === previousUrl || previousUrl.includes('summary')) {
newUrl = '/app/dashboard'
}
else {
newUrl = previousUrl;
}
if (backBtn) {
backBtn.href = newUrl;
}
}
function limitLpDescription() {
const elements = document.querySelectorAll(".lp-desc");
elements.forEach(element => {
const originalText = element.textContent.trim();
if (originalText.length > 250) {
const shortenedText = originalText.slice(0, 250) + "...";
element.textContent = shortenedText;
}
});
}
function changeTextTransform() {
const eventType = document.querySelectorAll('.event-type');
const startContentBtn = document.querySelector('.lp-big-btn');
const startContentBtnCourse = document.querySelector('.course-big-btn');
if (startContentBtn && startContentBtn.innerText === 'Start Path') {
startContentBtn.innerText = 'Start path';
}
if (startContentBtnCourse && startContentBtnCourse.innerText === 'Start Course') {
startContentBtnCourse.innerText = 'Start course';
}
eventType.forEach((event) => {
if (event.innerText === 'Online Event') {
event.innerText = 'Online event'
}
})
}
document.addEventListener("DOMContentLoaded", (event) => {
changeBackBtnUrl();
limitLpDescription();
changeEventRegisterBtnText();
changeTextTransform();
});
</script>