var setCookie = function(name, value, exp) { var date = new Date(); date.setTime(date.getTime() + exp*60*60*1000); document.cookie = name + '=' + value + ';expires=' + date.toUTCString() + ';path=/'; }; var getCookie = function(name) { var value = document.cookie.match('(^|;) ?' + name + '=([^;]*)(;|$)'); return value? value[2] : null; }; var rand = Math.floor(Math.random() * 6); var randC = Math.floor(Math.random() * 2); switch(rand) { //[프로모션] Microsoft 신제품 PC 커미션 상향 프로모션 (~10/31) case 0: var coupangUrl = "https://link.coupang.com/a/bNDxdJ"; var coupangImage = "https://image.inews24.com/v1/d2085ee59c8ad8.jpg"; break; //주방용품, 주방용품 신상 PICK (~10/27) case 1: var coupangUrl = "https://link.coupang.com/a/bVc7KV"; var coupangImage = "https://image.inews24.com/v1/de47ed35c5f645.png"; break; //홈인테리어, 공간별 인테리어 추천 case 2: var coupangUrl = "https://link.coupang.com/a/bLIPa5"; var coupangImage = "https://image.inews24.com/v1/f47d64ec926ff2.png"; break; //가전디지털, 하이센스 기획전 (~12/31) case 3: var coupangUrl = "https://link.coupang.com/a/bVc7qM"; var coupangImage = "https://image.inews24.com/v1/0c7c0999798541.png"; break; //도서/문구, 노벨문학상 case 4: var coupangUrl = "https://link.coupang.com/a/bWJiGS"; var coupangImage = "https://image.inews24.com/v1/abf12e6909c1ff.png"; break; //가전디지털, 파워풀위크 (~10/20) default: var coupangUrl = "https://link.coupang.com/a/bVc61h"; var coupangImage = "https://image.inews24.com/v1/18c30692315d9e.png"; } function lpadLocation() { setCookie("expendss", "true", 2); } function jpad() { setCookie("expendss", "true", 6); document.getElementById("coupangAD").style.display="none"; document.getElementById("cpad2").style.display="none";} var is_expendss = getCookie("expendss"); if(is_expendss != 'true') { var coupanGProa = document.createElement('a'); coupanGProa.id = "coupangi"; coupanGProa.target = "_blank"; var coupanGProimg = document.createElement('img'); var coupanGPromain = document.createElement('div'); var coupanGProcoverr = document.createElement('div'); var coupanGProcovera = document.createElement('a'); var coupanGProcoverimg = document.createElement('img'); coupanGProa.href = coupangUrl; coupanGProimg.src = coupangImage; coupanGProimg.alt = "coupang"; coupanGProimg.style.width = "100%"; coupanGProimg.className = "coupang"; coupanGProimg.id = "coupangImg"; coupanGPromain.id = "coupangMain"; coupanGProcoverr.id = "coupangCoverr"; coupanGProcovera.id = "coupangCovera"; coupanGProcoverimg.id = "coupangCoverimg"; document.getElementById("coupangAD").appendChild(coupanGPromain); document.getElementById("coupangMain").appendChild(coupanGProcoverr); document.getElementById("coupangCoverr").appendChild(coupanGProcovera); document.getElementById("coupangCovera").appendChild(coupanGProcoverimg); document.getElementById("coupangMain").appendChild(coupanGProa); document.getElementById("coupangi").appendChild(coupanGProimg); document.getElementById("coupangCoverr").style.position = "absolute"; //document.getElementById("coupangCoverr").style.top = "50%"; document.getElementById("coupangCoverr").style.left = "50%"; document.getElementById("coupangCoverr").style.zIndex = "9"; document.getElementById("coupangCoverr").style.width = "50px"; document.getElementById("coupangCoverr").style.marginLeft = "-100px"; document.getElementById("coupangCoverr").classList.add('coupangCover'); document.getElementById("coupangCovera").href = coupangUrl; document.getElementById("coupangCoverimg").src = "https://iframe.inews24.com/images/20240507-3.gif"; document.getElementById("coupangCoverimg").style.height = "300px"; document.getElementById("coupangMain").style.position = "relative"; document.getElementById("coupangMain").style.width = "100%"; document.getElementById("coupangMain").style.textAlign = "center"; document.getElementById("coupangMain").style.display = "inline-block"; document.getElementById("coupangAD").style.width = "100%"; document.getElementById("coupangAD").style.backgroundColor = "#ddd"; //document.getElementById("coupangAD").style.height = "300px"; document.getElementById("coupangAD").style.overflow = "hidden"; document.getElementById("coupangAD").style.textAlign = "center"; document.getElementById("coupangAD").style.margin = "0px 0px 10px 0px"; document.getElementById("coupangAD").style.marginLeft = "-15px"; document.getElementById("coupangAD").style.paddingRight = "30px"; //coupanGProimg.style.boxShadow = "0px 0px 90px 30px #333"; coupanGProimg.style.border = "2px solid #ddd"; coupanGProimg.style.width = "300px"; document.getElementById("cpad2").style.display="block"; document.getElementById("cpad2").style.marginTop="10px"; document.getElementById("cpad2").style.marginLeft="-140px"; document.getElementById("cpad2").style.backgroundPositionX="center"; document.getElementById("cpad2").style.backgroundRepeat="no-repeat"; document.getElementById("cpad2").style.backgroundColor="#fff"; document.getElementById("cpad2").style.zIndex="12"; document.getElementById("cpad2").style.left="50%"; //document.getElementById("cpad2").style.width="100%"; //document.getElementById("cclose3").style.marginLeft="-10px"; document.getElementById("cclose3").style.display="none"; document.getElementById("coupangCoverr").style.top = "3px"; document.getElementById("coupangCoverr").addEventListener("touchstart", initTouchH); document.getElementById("coupangCoverr").addEventListener("touchmove", swipeDirectionN); } let initialXX = null, initialYY = null; function initTouchH(e) { initialXX = `${e.touches ? e.touches[0].clientX : e.clientX}`; initialYY = `${e.touches ? e.touches[0].clientY : e.clientY}`; }; function swipeDirectionN(e) { if (initialXX !== null && initialYY !== null) { const currentXX = `${e.touches ? e.touches[0].clientX : e.clientX}`, currentYY = `${e.touches ? e.touches[0].clientY : e.clientY}`; let diffXX = initialXX - currentXX, diffYY = initialYY - currentYY; //console.log(diffXX); Math.abs(diffXX) > Math.abs(diffYY) ? ( (-10 > diffXX ) ? coupangCoverr(diffXX) : null) : ( null ) initialXX = null; initialYX = null; } } function coupangCoverr(e) { document.getElementById("coupangCoverr").style.animationName = "compareslide"; document.getElementById("coupangCoverr").style.animationDuration = "0.3s"; setTimeout(function() { document.getElementById("coupangCoverr").style.animationPlayState = "paused"; document.getElementById("coupangCoverr").style.display ='none' location.href = 'https://link.coupang.com/a/bLITnI'; } , 300); }