var A4W = 595; var A4H = 842; var collectionPathFile = "/inc/collection.htm"; if(!IsMobile()){ A4W *= (1 - 0.1); A4H *= (1 - 0.1); } function OverlayScreen(md){ var ob = parent.document; if(md == undefined || md == 1){ if(!$('#overlay_screen').length){ var newDiv = $('
', { id: 'overlay_screen' }); newDiv.css({ 'display':'none', 'position':'fixed', 'top':'0', 'left':'0', 'width':'100%', 'height':'100%', 'background-color': 'rgba(0, 0, 0, 0.7)', 'justify-content': 'center', 'align-items': 'center', 'z-index':'95' }); newDiv.on('click',function(){ if($('#letter-paper').is(':visible') && confirm('ÆíÁýâÀ» ´ÝÀ¸½Ã°Ú½À´Ï±î?')){ CloseEditor(); } if($('#see_big_sample').is(':visible')){ $('#see_big_sample').click(); } }); $(ob.body).append(newDiv); } $('#overlay_screen',ob).css('height','100%'); $('#overlay_screen',ob).css('display','flex'); }else{ $('#overlay_screen',ob).css('display','none'); } } function SetCommonBox(name, comment, loc){ var ob = $('#' + name); if(!ob.length){ var ob = $('
', { id: name }); ob.css({ 'display': 'none', 'color': '#FFF', 'position': 'absolute', 'width':'auto', 'height':'auto', 'padding': '20px', 'border-radius': '5px', 'width': '300px', 'box-shadow': '0 4px 6px rgba(0, 0, 0, 0.3)', 'background-color': 'rgba(0, 0, 0, 0.5)', 'z-index':'97' }); $(document.body).append(ob); } switch(loc){ case 1: // top_left ob.css({ 'top': '10px', 'left': '10px', 'transform': 'none' }); break; case 2: // top_center ob.css({ 'top': '10px', 'left': '50%', 'transform': 'translateX(-50%)' }); break; case 3: // top_right ob.css({ 'top': '10px', 'right': '10px', 'transform': 'none' }); break; case 4: // bottom_left ob.css({ 'botto': '10px', 'left': '10px', 'transform': 'none' }); break; case 5: // bottom_right": ob.css({ 'bottom': '10px', 'right': '10px', 'transform': 'none' }); break; default: ob.css({ 'top': '50%', 'left': '50%', 'transform': 'translate(-50%, -50%)' }); } if(comment) ob.html(comment); ob.show(); } function Loading(div,border){ var ob = $("#" + div); var guideText = "


"; ob.css('text-align', "center"); ob.css('width', ob.width()); ob.css('height', ob.height()); ob.html(""); if(border > 0){ ob.css('border-style', 'solid'); ob.css('border-color', '#F7F7F7'); } ob.html(guideText); } function PutPage(div, url, param, fm){ if(url == "") return false; var method = "GET"; var ret; var ob = null; if(div) ob = $("#" + div); if(fm){ method = "POST"; if(param) param = param + "&" + $(fm).serialize(); else param = $(fm).serialize(); } if(ob != null && ob.width() != 0) Loading(div); $.ajax({ url : url, dataType : "html", type : method, data : param, async : false, success : function(result){ if(ob != null){ ob.html(result); ob.css('border-style', 'none'); ob.css('width', 'auto'); ob.css('height', 'auto'); }else{ ret = result; } }, error : function(error){} }); if(ret) return ret; } function SmartEdit(num, key, row){ if(!num) return; window.open('/smart_editor.htm?num=' + num + '&key=' + key,'rich_editor','width=100%,height=100%,scrollbars=yes'); } function RichEdit(num, key, row){ if(!num) return; if(!IsMobile()){ var maxLocY = $('#letter-paper').css('top'); $('#letter-paper').remove(); $.get('rich_editor.htm?num=' + num + '&key=' + key, function(data){ $(document.body).append(data); OverlayScreen(); $('#letter-paper').fadeIn(200); }); }else{ window.open('/rich_editor_window.htm?num=' + num + '&key=' + key,'rich_editor_window','width=100%,height=100%,scrollbars=yes'); } } function NameEdit(num, key){ if(!num) return; if(!IsMobile()){ var maxLocY = $('#letter-paper').css('top'); $('#letter-paper').remove(); $.get('name_editor.htm?num=' + num + '&key=' + key, function(data){ $(document.body).append(data); OverlayScreen(); $('#letter-paper').fadeIn(200); }); }else{ window.open('/name_editor_window.htm?num=' + num + '&key=' + key,'name_editor_window','width=100%,height=100%,scrollbars=yes'); } } function CloseEditor(){ if(!window.opener){ $('#letter-paper').remove(); OverlayScreen(0); }else{ self.close(); } } function SampleMovePage(cate, param){ if(!cate) cate = 0; if(!param) param = "&page=1"; var fileName = "sample.htm"; if(cate == 2) fileName = "smart_sample.htm"; console.log(cate, param); if($('#sample_tab_1').length && $('#sample_tab_2').length){ if(cate == 1){ $('#sample_tab_1').attr('src','/img/sample_tab_name_on.jpg'); $('#sample_tab_2').attr('src','/img/sample_tab_rich_off.jpg'); }else if(cate == 2){ var userIp = "216.73.216.103"; if (userIp === "175.196.17.21") fileName = "smart_sample.htm"; $('#sample_tab_1').attr('src','/img/sample_tab_name_off.jpg'); $('#sample_tab_2').attr('src','/img/sample_tab_rich_on.jpg'); }else{ $('#sample_tab_1').attr('src','/img/sample_tab_name_on.jpg'); $('#sample_tab_2').attr('src','/img/sample_tab_rich_on.jpg'); } } PutPage('sample-list', '/' + fileName,'&sample=' + cate + param); } function Rgb2Hex(rgb){ var rgbArray = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/); var hex = '#' + ('0' + parseInt(rgbArray[1], 10).toString(16)).slice(-2) + ('0' + parseInt(rgbArray[2], 10).toString(16)).slice(-2) + ('0' + parseInt(rgbArray[3], 10).toString(16)).slice(-2); return hex.toUpperCase(); } function Hex2Rgba(hex, alpha) { // 16Áø¼ö »ö»ó Äڵ忡¼­ RGB °ª ÃßÃâ var r = parseInt(hex.substring(1, 3), 16); // »¡°£»ö (Red) var g = parseInt(hex.substring(3, 5), 16); // ÃÊ·Ï»ö (Green) var b = parseInt(hex.substring(5, 7), 16); // ÆÄ¶õ»ö (Blue) return `rgba(${r}, ${g}, ${b}, ${alpha})`; // rgba Çü½ÄÀ¸·Î ¹Ýȯ } function MoveScrollObject(_ob, _offset) { if(!_offset) _offset = 0; if($('#' + _ob).length){ $("html, body").animate({ scrollTop: $('#' + _ob).offset().top + _offset }, 800); } } function PassByNum(str) { if(!str) return; else return str.replace(/[^0-9]/g,""); } function Trim(string) { return string.replace(/\s+/g, ''); } function SetCookie(name, value, days) { const date = new Date(); date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); const expires = "expires=" + date.toUTCString(); document.cookie = `${name}=${value}; ${expires}; path=/`; } function GetCookie(name) { const cookies = document.cookie.split("; "); for (let i = 0; i < cookies.length; i++) { const [key, value] = cookies[i].split("="); if (key === name) { return value; } } return null; // ÇØ´ç À̸§ÀÇ Äí۰¡ ¾øÀ» ¶§ } function DeleteCookie(name) { setCookie(name, "", -1); } function IsMobile() { const userAgent = navigator.userAgent || navigator.vendor || window.opera; return /android|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent.toLowerCase()); } function IsIphone() { return /iPhone|iPad|iPod/i.test(navigator.userAgent); } function CheckAccessCode(num){ if (num == "12345") return true; else return false; } function SetChart(id, labels, datasets){ if(!id || !labels || !datasets) return; if(typeof labels === "string") labels = JSON.parse(labels); if(typeof datasets === "string") datasets = JSON.parse(datasets); let canvas = document.getElementById(id); if(!canvas) { canvas = document.createElement("canvas"); canvas.id = id; document.body.appendChild(canvas); } const ctx = canvas.getContext('2d'); new Chart(ctx, { type: 'bar', // ±×·¡ÇÁ ŸÀÔ (bar, line, pie, radar, doughnut, polarArea, bubble, scatter µî) data: { labels: labels, datasets: datasets }, options: { responsive: true, scales: { y: { beginAtZero: true } } } }); } // Base64 ¡æ Blob º¯È¯ function Base64ToBlob(base64, mime) { const byteString = atob(base64.split(',')[1]); const arrayBuffer = new ArrayBuffer(byteString.length); const uint8Array = new Uint8Array(arrayBuffer); for (let i = 0; i < byteString.length; i++) { uint8Array[i] = byteString.charCodeAt(i); } return new Blob([uint8Array], { type: mime }); } function AddBookmark() { const url = window.location.href; const title = document.title; if (window.sidebar && window.sidebar.addPanel) { // Firefox (±¸¹öÀü) window.sidebar.addPanel(title, url, ""); } else if (window.external && ('AddFavorite' in window.external)) { // Internet Explorer window.external.AddFavorite(url, title); } else if (window.opera && window.print) { // Opera var elem = document.createElement('a'); elem.setAttribute('href', url); elem.setAttribute('title', title); elem.setAttribute('rel', 'sidebar'); elem.click(); } else { // ÃֽŠºê¶ó¿ìÀú´Â ¼öµ¿ Ãß°¡ ¾È³» alert("Ctrl+D (Windows) ¶Ç´Â Command+D (Mac)¸¦ ´­·¯ Áñ°Üã±â¿¡ Ãß°¡Çϼ¼¿ä."); } } function GetMegabyte(size){ return Math.ceil(size / 1024 / 1024 * 100) / 100; }