function getCookie(name) { var matches = document.cookie.match(new RegExp( "(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)" )); return matches ? decodeURIComponent(matches[1]) : undefined; } var ss = getCookie('analizer'); if(ss){ window.addEventListener("load", function(event) { var elements = document.getElementsByClassName("analizer"); for (var i = 0, len = elements.length; i < len; i++) { var elLink = elements[i].getAttribute('data-link'); var elText = elements[i].getAttribute('data-text'); var elClasses = elements[i].getAttribute('data-classes'); var redirectLink = document.createElement('a'); redirectLink.href= elLink; redirectLink.target = '_blank'; redirectLink.rel = 'nofollow'; if(null !== elClasses ){ redirectLink.className += " "+elClasses; } redirectLink.innerHTML = elText; let btns = elements[i].querySelectorAll('.sd-btn'); if(btns !== undefined && btns !== null) { btns.forEach(function(btn){ btn.remove(); }) } let newElHtml = redirectLink.outerHTML; elements[i].insertAdjacentHTML('afterbegin', newElHtml); } }); }