let winScroll = 0; let modal = ''; let rand_list = []; $(window).bind('load scroll resize', function () { winScroll = $(this).scrollTop(); }); // 사이드 열기 공통 function side_open(modalName) { modal = $(modalName); $('body').addClass('modalFix').css('top', -winScroll); $(modal).stop().fadeIn(150); if (modalName.toString() === '#loginWrap') { // 모달 띄우기 설정 if (localStorage.getItem('modal_gameangel') <= Date.now()) { modal_open('#modalGameangelLogin'); } } } // 사이드 닫기 공통 function side_close(modalName) { modal = $(modalName); modal.fadeOut(100); let bodyWrap = $('body'); let winTop = Math.abs(parseInt(bodyWrap.css('top'))); bodyWrap.removeClass('modalFix').css('top', ''); $(window).scrollTop(winTop); } // 모달/사이드 공통 별칭 var modal_open = side_open; var modal_close = side_close; // 랜덤 게임 공용 function fnRandGame() { if (!rand_list.length) { $('a').each(function () { href = $(this).attr('href'); if (href !== undefined && href.startsWith('/game')) { rand_list.push(href); } }); } location.href = rand_list[Math.floor(Math.random() * rand_list.length)];; }