document.write("(function(){ var ad_set = { adTarget: document.querySelectorAll('#ad_right_view_top'), adName: 'enter_0Etx', adIdx: [0] }; var adRes, adTag; function fixedPos(adName,idx) { adTag = document.querySelector('#'+adName+'_'+idx); var posLeft, posTop; posLeft = 0; posTop = 0; adTag.style.position = 'absolute'; adTag.style.right = posLeft+'px'; adTag.style.top = posTop+'px'; }; function runAd(idx) { console.log(\"start runAd \" + idx); var adId = ad_set.adName+'_'+idx; console.log(\"start adId \" + adId); var btnClose; adRes = ''; adRes += '
'; adRes += '';/* adRes += ''; */ adRes += '
'; document.body.insertAdjacentHTML('beforeend',adRes); /* btnClose = document.querySelector('#'+adId).querySelector('.ad_close'); btnClose.addEventListener('click',function(){ closeAd(adId, idx); }); */ adTag = document.querySelector('#'+ad_set.adName+'_'+idx); var adRightViewTop = ad_set.adTarget[idx]; adRightViewTop.appendChild(adTag); fixedPos(ad_set.adName,idx); /* ad_set['interval'+idx] = setInterval(function(){ fixedPos(ad_set.adName,idx); },500); */ }; function closeAd(adId,adIdx) { document.querySelector('#'+adId).remove(); clearInterval(ad_set['interval'+adIdx]); }; for(var i of ad_set.adIdx) { runAd(i); };})();
")