`; document.querySelector('#carousel-column-one .feature-column-carousel__inner').appendChild(divInner).innerHTML = html; }); document.querySelectorAll("#carousel-column-one .feature-column-carousel__item").forEach(item => { var url = item.querySelector(".image--main-loaded").getAttribute("data-link"); loginEvent(item.querySelector(".feature-column-carousel__figure"), url); loginEvent(item.querySelector(".feature-column-carousel__title"), url); }) } function formatDate(value) { try { let d = new Date(value); let ye = new Intl.DateTimeFormat('en', { year: 'numeric' }).format(d); let mo = new Intl.DateTimeFormat('en', { month: 'short' }).format(d); let da = new Intl.DateTimeFormat('en', { day: '2-digit' }).format(d); return da + ' ' + mo + ' ' + ye; } catch (e) { return value; } } function loginEvent(cta, url = "",type = "a") { var path = type=="a" ? url != "" ? url : cta.href.indexOf("javascript") >= 0 || cta.href.indexOf("#") ? null : cta.href : ""; cta.addEventListener("click", function () { removeCookie("redirect_to"); var now = new Date(); now.setTime(now.getTime() + 560000); document.cookie = 'redirect_to=' + path + ';expires=' + now.toUTCString() + ';path=/'; ss.Auth.callSaSignInGate(); }); cta.href = "javaScript:void(0);"; } function removeCookie(name) { document.cookie = name + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;"; } function getCookie(search) { var allcookies = document.cookie; cookiearray = allcookies.split(';'); for (var i = 0; i < cookiearray.length; i++) { cookie_name = cookiearray[i].split('=')[0]; value = cookiearray[i].split('=')[1]; if (cookie_name.trim() == search.trim()) { return value; } } } function request(url, callback, credentials = "false", type = 'GET') { const xhr = new XMLHttpRequest(); if (credentials) {xhr.withCredentials = true;} xhr.onreadystatechange = function (e) { if (xhr.readyState === 4) { if (xhr.status === 200) { callback(null, JSON.parse(xhr.response)) } else { callback(xhr.status, null) } } } xhr.ontimeout = function () {console.log('Timeout')} xhr.open(type, url, true); xhr.send(); } });