var link = document.location.href.split('.'); let student_mode = "student"; if (link[1] == 'irontrain') { var realserver = ''; } else if (link[0].split("//")[1] == "dev" && link[1] == "tabstudy") { var realserver = 'https://dev.tabstudy.co.kr'; student_mode = "student_test" } else { var realserver = 'https://api.tabstudy.co.kr'; } $('#sidebarCollapse').on('click', function() { if ($('#sidebar').hasClass('active')) { $('#sidebar').removeClass('active'); $('.overlay').fadeOut(); } else { $('#sidebar').addClass('active'); $('.overlay').fadeIn(); } }); function sidebarremove() { $('#sidebar').removeClass('active'); } $('.overlay').on('click', function() { $('#sidebar').removeClass('active'); $('.overlay').fadeOut(); }); // 페이지 넘겼을 때 해당 페이지 버튼 활성화. $('.choose').each(function() { var pathname = window.location.pathname; var choosetag = $(this).attr('href'); if (choosetag == '.' + pathname || realserver + choosetag.split('.')[1] == pathname.split('.')[0]) { $(this).addClass('selected'); $(this).bind('click', false); } }); // 헤더 밑에 그림자. 생겻다 사라지게 하기 // $(document).ready(function() { // $('header').css('box-shadow', '5px 5px 30px var(--border-color)'); // var scrollTop = Math.max(window.pageYOffset, document.documentElement.scrollTop, document.body.scrollTop) // if (scrollTop <= 20) { // $('header').css('box-shadow', '5px 5px 30px var(--border-color)'); // } else { // $('header').css('box-shadow', 'none'); // } // $('html,body').on('touchend', function(e) { // setTimeout(function() { // scrollTop =scrollTop = Math.max(window.pageYOffset, document.documentElement.scrollTop, document.body.scrollTop); // if (scrollTop <= 20) { // $('header').css('box-shadow', '5px 5px 30px var(--border-color)'); // } else { // $('header').css('box-shadow', 'none'); // } // }, 500); // }); // $('html,body').on('mousewheel', function(e) { // setTimeout(function() { // scrollTop =scrollTop = Math.max(window.pageYOffset, document.documentElement.scrollTop, document.body.scrollTop); // if (scrollTop <= 20) { // $('header').css('box-shadow', '5px 5px 30px var(--border-color)'); // } else { // $('header').css('box-shadow', 'none'); // } // }, 300); // }); // }); function popup(url) { var width = window.screen.width || window.outerWidth; var height = window.screen.height || window.outerHeight; var params = 'width=' + width + ', height=' + height; params += ', fullscreen=yes'; params += ', directories=no'; params += ', location=no'; params += ', menubar=no'; params += ', resizable=0'; params += ', scrollbars=no'; params += ', status=no'; params += ', toolbar=no'; newwin = window.open(url, 'windowname5', params); if (window.focus) { newwin.focus(); } var limit_width = 720; var limit_height = 542; $(newwin).resize(function(evt) { var nw = this.outerWidth, nh = this.outerHeight, chk = false; if (nw < limit_width) { nw = limit_width; chk = true; } if (nh < limit_height) { nh = limit_height; chk = true; } if (chk) { var self = this; if (window.timeout1) clearTimeout(window.timeout1); window.timeout1 = setTimeout(function() { self.resizeTo(nw,nh); self = null; }, 100); } }); return false; } //학생앱 실행 안드로이드 구분 function checkMobile() { var varUA = navigator.userAgent.toLowerCase(); //userAgent 값 얻기 var studentApp = document.getElementById('studentApp'); var adminApp = document.getElementById('adminApp'); var studentAppAttr = {}; var adminAppAttr = {}; var os = ""; var ismobile = false; var studentclickfunc = function() { } var adminclickfunc = function() { } if (varUA.indexOf('android') > -1) { //안드로이드 $('#checkb').css('display', 'none'); studentApp = document.getElementById('studentMobileApp'); studentAppAttr = {"href":"https://url.kr/wE8elj", "target":"_self"}; adminApp = document.getElementById('adminMobileApp'); adminAppAttr = {"href":"https://url.kr/ISNtGT", "target":"_self"}; os = "android"; ismobile = true; studentclickfunc = function() { //학생앱 Mobile gtag('event', 'conversion', {'send_to': 'AW-404534271/ND2jCMm6kvwBEP_n8sAB'}); } adminclickfunc = function() { //관리자앱 Mobile gtag('event', 'conversion', {'send_to': 'AW-404534271/SZhaCJjJk_wBEP_n8sAB'}); } } else if (varUA.indexOf('iphone') > -1 || varUA.indexOf('ipad') > -1 || varUA.indexOf('ipod') > -1) { //IOS $('#checkb').css('display', 'none'); studentApp = document.getElementById('studentMobileApp'); studentAppAttr = {'href':'https://url.kr/e6KzfV', 'onclick':"sidebarremove()"}; adminApp = document.getElementById('adminMobileApp'); adminAppAttr = { 'data-toggle':"modal", 'data-target':"#modalandroid", 'onclick':"sidebarremove()" }; os = "ios"; ismobile = true; studentclickfunc = function() { //학생앱 Mobile gtag('event', 'conversion', {'send_to': 'AW-404534271/ND2jCMm6kvwBEP_n8sAB'}); } adminclickfunc = function() { //관리자앱 Mobile gtag('event', 'conversion', {'send_to': 'AW-404534271/SZhaCJjJk_wBEP_n8sAB'}); } } else if(navigator.userAgent.toLowerCase().indexOf('chrome') > -1) { studentApp = document.getElementById('studentApp'); studentAppAttr = {}; adminApp = document.getElementById('adminApp'); adminAppAttr = { 'href': "./admin/#/login", 'target':'_blank' }; studentclickfunc = function() { //학생앱 PC gtag('event', 'conversion', {'send_to': 'AW-404534271/zs5xCIa_8_sBEP_n8sAB'}); popup(`./${student_mode}`); } adminclickfunc = function() { //관리자앱 PC gtag('event', 'conversion', {'send_to': 'AW-404534271/QWywCJXJiPwBEP_n8sAB'}); } os = "chrome"; } else { $('#checkb').css('display', 'block'); $('header #sidebar').css('top', '120px'); $('header #sidebar').css('padding-bottom', '40px'); studentApp = document.getElementById('studentApp'); studentAppAttr = { 'data-toggle':"modal", 'data-target':"#modalchrome"}; adminApp = document.getElementById('adminApp'); adminAppAttr = { 'data-toggle':"modal", 'data-target':"#modalchrome"}; os = "etc"; studentclickfunc = function() { //학생앱 PC gtag('event', 'conversion', {'send_to': 'AW-404534271/zs5xCIa_8_sBEP_n8sAB'}); } adminclickfunc = function() { //관리자앱 PC gtag('event', 'conversion', {'send_to': 'AW-404534271/QWywCJXJiPwBEP_n8sAB'}); } } studentApp.setAttributes(studentAppAttr); adminApp.setAttributes(adminAppAttr); studentApp.addEventListener("click", function() { studentclickfunc(); }); adminApp.addEventListener("click", function() { adminclickfunc(); }); return os; } //실시간 문의 function icontranform() { if ($('#collapseside').hasClass('show')) { // if (localStorage.getItem('rtstatus') != 'noshow') { // localStorage.setItem('rtstatus', 'noshow'); $('.left-down').addClass('fa-rotate-180'); } else { // localStorage.removeItem('rtstatus'); $('.left-down').removeClass('fa-rotate-180'); } } Element.prototype.setAttributes = function (attrs) { for (var idx in attrs) { if ((idx === 'styles' || idx === 'style') && typeof attrs[idx] === 'object') { for (var prop in attrs[idx]){this.style[prop] = attrs[idx][prop];} } else if (idx === 'html') { this.innerHTML = attrs[idx]; } else { this.setAttribute(idx, attrs[idx]); } } }; $(document).ready(function() { var device = checkMobile(); var bookmarkBar_student = document.getElementById('bookmarkBar_student'); var bookmarkBar_admin = document.getElementById('bookmarkBar_admin'); if(device == 'chrome') { bookmarkBar_student.setAttribute('onclick', 'popup("./student")') bookmarkBar_admin.setAttributes({'href':'./admin/#/login', 'target':'_blank'}) } else if(device == 'android') { bookmarkBar_student.setAttribute('href', 'https://url.kr/wE8elj') bookmarkBar_admin.setAttribute('href', 'https://url.kr/ISNtGT') } else if(device == 'ios') { bookmarkBar_student.setAttribute('href', 'https://url.kr/e6KzfV') bookmarkBar_admin.setAttributes({'data-toggle':"modal", 'data-target':"#modalandroid"}) } else if(device == 'etc') { bookmarkBar_student.setAttributes({'data-toggle':"modal", 'data-target':"#modalchrome"}) bookmarkBar_admin.setAttributes({'data-toggle':"modal", 'data-target':"#modalchrome"}) } // if (window.innerWidth > 768 && localStorage.getItem('rtstatus') != 'noshow') { if (window.innerWidth > 768) { $('#collapseside').addClass('show'); } else { $('#collapseside').removeClass('show'); $('.left-down').addClass('fa-rotate-180'); } $('#cell2, #cell3').on('keyup', function() { $(this).val( $(this) .val() .replace(/[^0-9]/g, '') ); }); }); // function browseropopup() { // if (navigator.userAgent.toLowerCase().indexOf('chrome') > -1) { // checkMobile(); // } else { // $('#checkb').css('display', 'block'); // $('header #sidebar').css('top', '120px'); // $('header #sidebar').css('padding-bottom', '40px'); // $('.nochrome').css('display', 'block'); // } // } document.addEventListener('DOMContentLoaded', function() { controllSideMenu() }) window.addEventListener('scroll', function(e) { controllSideMenu() }) window.addEventListener('resize', function (e) { controllSideMenu() }) function controllSideMenu() { var windowWidth = window.innerWidth; if(windowWidth < 769){ var bannerHeight = ''; var mobileMenuHeight = document.getElementById("mobilebar"); if(windowWidth > 568) { bannerHeight = document.getElementsByClassName("pctopbanner")[0]; } else if(windowWidth <= 568) { bannerHeight = document.getElementsByClassName("mobiletopbanner")[0]; } if(bannerHeight === undefined){ bannerHeight = 0; } else { bannerHeight = bannerHeight.offsetHeight; } var sidebar = document.getElementById("sidebar"); if(window.scrollY > bannerHeight){ sidebar.style.top = 80 +'px'; mobileMenuHeight.style.height = "calc(100% - "+80+"px)"; } else { sidebar.style.top = bannerHeight - scrollY + 80 +'px'; mobileMenuHeight.style.height = "calc(100% - "+(bannerHeight - scrollY + 80) +"px)"; } } } $(document).ready(function() { $("#bookmark").click(function(e) { var bookmarkURL = window.location.href; var bookmarkTitle = document.title; var triggerDefault = false; if (window.sidebar && window.sidebar.addPanel) { // Firefox version < 23 window.sidebar.addPanel(bookmarkTitle, bookmarkURL, ''); } else if ((window.sidebar && /Firefox/i.test(navigator.userAgent) && !Object.fromEntries) || (window.opera && window.print)) { // Firefox version >= 23 and Opera Hotlist console.log('add') var $this = $(this); $this.attr('rel', 'sidebar'); $this.attr('href', bookmarkURL); $this.attr('title', bookmarkTitle); $this.off(e); triggerDefault = true; } else if (window.external && ('AddFavorite' in window.external)) { // IE Favorite window.external.AddFavorite(bookmarkURL, bookmarkTitle); } else { // WebKit - Safari/Chrome alert('이용하시는 브라우저에서는 기능이 지원되지 않습니다.\r\n'+ (navigator.userAgent.toLowerCase().indexOf('mac') != -1 ? 'Cmd' : 'Ctrl') + '+D 키를 눌러 즐겨찾기에 등록하실 수 있습니다.'); } return triggerDefault; });; });