From ed6578499898898798742bec29ff08b1622f66ab Mon Sep 17 00:00:00 2001 From: task-bot <106601941+task-bot@users.noreply.github.com> Date: Sat, 17 Sep 2022 14:12:17 +0000 Subject: [PATCH] deploy: 8f0893b5f7106215662c7c2f2723d9f0ca500418 --- js/carbon.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/js/carbon.js b/js/carbon.js index e0fa2871..f18744a2 100644 --- a/js/carbon.js +++ b/js/carbon.js @@ -1,6 +1,6 @@ (function () { function attachAd() { - const el = document.createElement('script'); + var el = document.createElement('script'); el.setAttribute('type', 'text/javascript'); el.setAttribute('id', '_carbonads_js'); el.setAttribute( @@ -9,7 +9,7 @@ ); el.setAttribute('async', 'async'); - const wrapper = document.getElementById('sidebar-ads'); + var wrapper = document.getElementById('sidebar-ads'); wrapper.innerHTML = ''; wrapper.appendChild(el); } @@ -17,8 +17,13 @@ setTimeout(function () { attachAd(); - window.addEventListener('popstate', function () { - attachAd(); - }); + var currentPath = window.location.pathname; + + setInterval(function () { + if (currentPath !== window.location.pathname) { + currentPath = window.location.pathname; + attachAd(); + } + }, 1000); }, 1000); })();