//템플릿로드 function loadTemplate(url, func) { var xhr = (window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP")); xhr.onreadystatechange = function () { if (xhr.readyState == 4 && xhr.status == 200) { if (typeof func === 'function') func(xhr.responseText); } } xhr.open("GET", url, true); xhr.send(); } //퀵메뉴 $(function () { $(window).scroll(function () { var windowH = $(window).height(), scrollY = $(window).scrollTop(); $('.quick').each(function () { var elPosition = $(this).offset().top; if (scrollY > elPosition - windowH) { $('.quick>div').addClass('actives') } else { $('.quick>div').removeClass('actives') } }) }); }); //팝업 닫기 function popUpClose(id, location, func) { location = typeof location !== 'undefined' ? location : 'reload'; func = typeof func !== 'undefined' ? func : ''; $('#' + id).css('display', 'none'); if (location == 'reload') { window.location.reload(); } else if (location == 'referrer') { history.back(); } else if (location == 'N') { if (typeof func === 'function') func(response); } else { window.location.href = location; } } //맨위로 버튼 $(function () { $(window).scroll(function () { if ($(this).scrollTop() > 500) { $('.go-top').fadeIn(); } else { $('.go-top').fadeOut(); } }); $(".go-top").click(function () { $('html, body').animate({ scrollTop: 0 }, 400); return false; }); }); //page copy $('*[data-event="copy_page"]').click(function () { var tempElem = document.createElement('textarea'); var html = ''; var target = $(this).attr('data-target'); if (target != undefined && target != '') { html = $('#' + target).clone(); } else { html = $(this).clone(); } if (html.length > 0) { html = html[0].outerHTML; html = html.replace('data-event="copy_code"', ''); html = html.replace('id="' + target + '"', ''); html = formatFactory(html) tempElem.value = html; document.body.appendChild(tempElem); tempElem.select(); document.execCommand("copy"); document.body.removeChild(tempElem); alert('Success copy this code.'); } else { alert('Html code is empty.') } }); //html code copy $('*[data-event="copy_code"]').click(function () { var tempElem = document.createElement('textarea'); var html = ''; var target = $(this).attr('data-target'); if (target != undefined && target != '') { html = $('#' + target).clone(); } else { html = $(this).clone(); } if (html.length > 0) { html = html[0].outerHTML; html = html.replace('data-event="copy_code"', ''); html = html.replace('id="' + target + '"', ''); html = formatFactory(html) tempElem.value = html; document.body.appendChild(tempElem); tempElem.select(); document.execCommand("copy"); document.body.removeChild(tempElem); alert('Success copy this code.'); } else { alert('Html code is empty.') } }); //code copy $('*[data-event="copy_clipboard"]').click(function () { //data-clipboard-text var tempElem = document.createElement('textarea'); var code = ''; var target = $(this).attr('data-target'); var currentText = $(this).html(); //attr data-clipboard-text 복사할 텍스트 에서 가져온다 code = $(this).attr('data-clipboard-text'); // Create a temporary element to copy the code to clipboard tempElem.value = code; document.body.appendChild(tempElem); tempElem.select(); document.execCommand("copy"); document.body.removeChild(tempElem); // Show tooltip var tooltipElem = $('