Files
Gainsight/Custom_Templates/customer_templates/Pipedrive Learn - Public/_head.html.liquid

132 lines
5.0 KiB
Plaintext

{% styles default %}
{% styles colors %}
{% styles custom %}
<script type="text/javascript" async src="https://play.vidyard.com/embed/v4.js"></script>
<!-- fontawesome inclusion -->
<script src="https://kit.fontawesome.com/41a3aee3ad.js" crossorigin="anonymous"></script>
<!-- clamping text to given number of lines -->
<script src="https://s3.amazonaws.com/static.northpass.com/JS+scripts/clamp.js" type="module"></script>
<!-- JavaScript Bundle with Popper -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.14.7/dist/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.3.1/dist/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
{% include "cookie_banner" %}
{% comment %}
Hiding language feature
<!-- language scripts -->
<script>
// changing language
function changeLanguage(newLanguage, sendRequest=true) {
document.querySelector(".languages-dropdown").classList.remove('show');
if (!window.current_language || window.current_language !== newLanguage) {
window.current_language = newLanguage
} else {
console.log('language already selected')
return null
}
document.querySelectorAll('.current-lang').forEach(activeElement => {
activeElement.classList.remove('current-lang');
});
document.querySelectorAll(`[data-lang="${newLanguage}"]`).forEach(newLanguageElement => {
newLanguageElement.classList.add('current-lang');
});
{% if current_person.signed_in? %}
if (sendRequest) {
let xhr = new XMLHttpRequest();
{% if current_school.sso_active? %}
var url = "https://www.workato.com/webhooks/rest/bd1a1eb7-7e79-4208-a1db-8e9c7440bcc9/pipedrive-sso-change-user-language";
{% else %}
var url = "https://www.workato.com/webhooks/rest/bd1a1eb7-7e79-4208-a1db-8e9c7440bcc9/pipedrive-open-change-user-language";
{% endif %}
xhr.open("POST", url, true);
xhr.send(JSON.stringify({
user_id: '{{ current_person.id }}',
language: newLanguage
}));
}
{% endif %}
window.localStorage.setItem('academy-language', newLanguage);
document.querySelector('body').className = `lang-${newLanguage}`;
}
// setup body class based on property or cookies
function setupInitialLanguage() {
let userStorageLanguage = window.localStorage.getItem('academy-language');
{% if current_person.signed_in? and current_person.properties.user_language contains 'missing property' %}
{% assign property_missing = true %}
{% else %}
{% assign property_missing = false %}
{% endif %}
{% if current_person.signed_in? and current_person.properties.user_language != 'NULL' and property_missing == false %}
var selectedLanguage = "{{ current_person.properties.user_language }}";
{% else %}
var selectedLanguage = userStorageLanguage || "en";
{% endif %}
if (['en', 'de', 'es', 'fr', 'br'].includes(selectedLanguage)) {
changeLanguage(selectedLanguage, false);
} else {
changeLanguage('en', false);
console.log('wrong language initialized', selectedLanguage);
window.current_language = 'en';
}
}
addEventListener('DOMContentLoaded', () => {
setupInitialLanguage();
});
</script>
{% endcomment %}
<!-- on SSO school redirect new users to setup their name -->
{% if current_person.signed_in? and current_school.sso_active? %}
{% unless current_person.first_name %}
<script>
if ("{{ current_person.email }}".includes('+preview-') === false &&
window.location.pathname !== "/app/profile-settings" &&
!window.sessionStorage.getItem('nameSetup'))
{
window.location.replace('/app/profile-settings')
}
</script>
{% endunless %}
{% endif %}
<!-- clear last video filter when leaving video tutorials pages -->
<script>
if (window.location.pathname !== '/app/video-tutorials' &&
!window.location.pathname.includes('/app/courses/'))
{
window.sessionStorage.removeItem('last-selected-video-filter')
}
</script>
{% include 'seo_logo' %}
{% if current_school.sso_active? and current_person.signed_in? == false %}
{% include 'sso_login_widget' %}
{% endif %}
{% if current_school.sso_active? %}
{% if current_person.signed_in? %}
<script>
if (window.location.pathname === '/app' && window.sessionStorage.sso_last_page) {
let new_url = window.sessionStorage.sso_last_page;
window.sessionStorage.sso_last_page = ''
window.location.replace(new_url);
}
</script>
{% else %}
<script>
window.sessionStorage.sso_last_page = window.location.pathname;
</script>
{% endif %}
{% endif %}