【9月5回】つながる×ひろがる~「コトコト」「Kinari」

2021年9月13日

window.addEventListener('load',function() { const links = document.getElementsByTagName('a'); const listener = function(e) { const xdomain = ['pal-system.co.jp', 'pal-system.coop', 'pal.or.jp', 'info.pal-system.co.jp']; if (typeof URLSearchParams === 'undefined') return; if (!e.target.href) return; if (!xdomain.some(function(value) { return e.target.hostname.indexOf(value) !== -1})) return ; const params = new URLSearchParams((new URL(window.location)).search.slice(1)); const yclid = params.get('yclid'); if (yclid) { let lurl = new URL(e.target.href); let lparam = new URLSearchParams(lurl.search.slice(1)); lparam.set('yclid', yclid); lurl.search = lparam.toString(); e.target.href = lurl.toString(); } }; for (let i = 0; i< links.length; i++) links[i].addEventListener('click', listener); });