function debug(s) { console.log(s); } Number.prototype.number_format = function (round_decimal) { return this.toFixed(round_decimal).replace(/(\d)(?=(\d{3})+$)/g, "$1,"); }; function 자리수시세가격포맷팅(n, a) { // return Number(n).toFixed(6).replace(/(\d)(?=(\d{3})+$)/g, "$1,"); return Math.floor(n).number_format(0) + 소수점아래자리수만구하기(n, a); // return Number(n).number_format(6); } function 시세가격포맷팅(n) { // return Number(n).toFixed(6).replace(/(\d)(?=(\d{3})+$)/g, "$1,"); return Math.floor(n).number_format(0) + 소수점아래자리수만구하기(n, 4); // return Number(n).number_format(6); } function 수수료포맷팅(n) { // return Number(n).toFixed(6).replace(/(\d)(?=(\d{3})+$)/g, "$1,"); return Math.floor(n).number_format(0) + 소수점아래자리수만구하기(n, 3); // return Number(n).number_format(6); } function pad(n, width, z) { z = z || '0'; n = n + ''; return n.length >= width ? n : new Array(width - n.length + 1).join(z) + n; } function 소수점아래자리수만구하기(num, d) { var t = Number(num).toFixed(d).split("."); var i = 0; if (t[1] == undefined) { return ""; } return "." + t[1]; } function 소수점아래자리수하기(num) { var t = num.split("."); var i = 0; if (t[1] == undefined) { return 0; } while (t[1][i]) { i++; } return i; } function copyText(id) { /* Get the text field */ var copyText = document.getElementById(id); /* Select the text field */ copyText.select(); /* Copy the text inside the text field */ document.execCommand("copy"); /* Alert the copied text */ alert("Copied the Wallet Address"); } function go_change_language_dic(obj) { setCookie('dic_lang', obj.value, 90); location.reload(true); } function setCookie(cookie_name, value, days) { var exdate = new Date(); exdate.setDate(exdate.getDate() + days); // 설정 일수만큼 현재시간에 만료값으로 지정 var cookie_value = escape(value) + ((days == null) ? '' : '; expires=' + exdate.toUTCString()); document.cookie = cookie_name + '=' + cookie_value; } function getCookie(cookie_name) { var x, y; var val = document.cookie.split(';'); for (var i = 0; i < val.length; i++) { x = val[i].substr(0, val[i].indexOf('=')); y = val[i].substr(val[i].indexOf('=') + 1); x = x.replace(/^\s+|\s+$/g, ''); // 앞과 뒤의 공백 제거하기 if (x == cookie_name) { return unescape(y); // unescape로 디코딩 후 값 리턴 } } } function deleteAllCookies() { document.cookie.split(";").forEach(function (c) { document.cookie = c.replace(/^ +/, "").replace(/=.*/, "=;expires=" + new Date().toUTCString() + ";path=/"); }); if (window.AndroidApp != undefined) { window.AndroidApp.removeAllCookie(); } } function deleteCookie(name) { setCookie(name, "", -1); } function send_sms_infobip(nation, hp) { $.post("/_PROGRAM_inc/send_sms_infobip.php", {nation: nation, hp: hp}).done(function (data) { }); } function send_sms_infobip_findpassword(nation, hp) { $.post("/_PROGRAM_inc/send_sms_find_password_infobip.php", {nation: nation, hp: hp}).done(function (data) { if ($.trim(data) == "NO_MEMBER") { alert('일치하는 회원정보가 없습니다.'); } }); } // 숫자 타입에서 쓸 수 있도록 format() 함수 추가 Number.prototype.format = function () { if (this == 0) return 0; var reg = /(^[+-]?\d+)(\d{3})/; var n = (this + ''); while (reg.test(n)) n = n.replace(reg, '$1' + ',' + '$2'); return n; }; // 문자열 타입에서 쓸 수 있도록 format() 함수 추가 String.prototype.format = function () { var num = parseFloat(this); if (isNaN(num)) return "0"; return num.format(); }; function copyToClipboard(element) { var $temp = $(""); $("body").append($temp); $temp.val($(element).text()).select(); document.execCommand("copy"); $temp.remove(); } document.domain = 'dabangoo.com'; window.name = 'openers'; function kakao_login() { // alert('카카오 로그인을 진행합니다.'); //location.href = 'https://kauth.kakao.com/oauth/authorize?client_id=eee6e22951a886eff5a6fd9737d28501&&redirect_uri=https://dabangoo.com/main/redirect_kakao.php&response_type=code'; //location.href = 'https://kauth.kakao.com/oauth/authorize?client_id=6a6eb0c3b58ae0164db27b2ca9cdccd3&&redirect_uri=https://dabangoo.com/main/redirect_kakao.php&response_type=code'; // TODO - REAL location.href = 'https://kauth.kakao.com/oauth/authorize?client_id=da02524bdbf16eb4adcde5bf394d4954&&redirect_uri=https://dabangoo.com/main/redirect_kakao.php&response_type=code'; /* let win = popup({ url: url, target: "kakaoLogin", width: 630, height: 560, resizable: "no", scrollbars: "no" }); win.focus(); */ } function popup(options) { if (!options.width) options.width = 500; if (!options.height) options.height = 415; var status = new Array(); $.each(options, function (i, v) { if ($.inArray(i, ['url', 'target']) == '-1') { status.push(i + '=' + v); } }); var status = status.join(','); var win = window.open(options.url, options.target, status); return win; } $(function () { get_fcm_token(); }); function get_fcm_token() { } function set_fcm_token(val) { $("#app_id").val(val); } function checkInputLength(input, maxLength) { //const maxLength = 100; let value = input.value; let length = 0; for (let i = 0; i < value.length; i++) { const charCode = value.charCodeAt(i); // 한글일 경우 2로 계산, 그 외에는 1로 계산 if (charCode >= 0xAC00 && charCode <= 0xD7A3) { length += 2; } else { length += 1; } // 최대 길이를 초과하면 잘라내기 if (length > maxLength) { input.value = value.substring(0, i); break; } } //console.log(length); if (length > maxLength) { alert(maxLength + '자 이내로 입력해주세요.'); } document.getElementById('charCount').textContent = `${length} / ${maxLength}`; } function generateUniqueNumber() { const timestamp = Date.now(); // 현재 시간을 밀리초 단위로 가져옴 const randomNum = Math.floor(Math.random() * 1000000); // 0부터 999999까지의 랜덤한 숫자 생성 return timestamp + randomNum; } Date.prototype.addDays = function (days) { var date = new Date(this.valueOf()); date.setDate(date.getDate() + days); return date; } Date.prototype.addMonths = function (months) { var date = new Date(this.valueOf()); date.setMonth(date.getMonth() + months); return date; } function select_terms(pTerm) { var today = new Date(); var cur_year = today.getFullYear(); var cur_month = ('0' + (today.getMonth() + 1)).slice(-2); var cur_day = ('0' + today.getDate()).slice(-2); var cur_DT = cur_year + '-' + cur_month + '-' + cur_day; if (pTerm == "TODAY") { t_DT = cur_DT; } else if (pTerm == "7DAYS") { var target_date = today.addDays(-7); var t_year = target_date.getFullYear(); var t_month = ('0' + (target_date.getMonth() + 1)).slice(-2); var t_day = ('0' + target_date.getDate()).slice(-2); var t_DT = t_year + '-' + t_month + '-' + t_day; } else if (pTerm == "1MONTH") { var target_date = today.addMonths(-1); var t_year = target_date.getFullYear(); var t_month = ('0' + (target_date.getMonth() + 1)).slice(-2); var t_day = ('0' + target_date.getDate()).slice(-2); var t_DT = t_year + '-' + t_month + '-' + t_day; } else if (pTerm == "3MONTHS") { var target_date = today.addMonths(-3); var t_year = target_date.getFullYear(); var t_month = ('0' + (target_date.getMonth() + 1)).slice(-2); var t_day = ('0' + target_date.getDate()).slice(-2); var t_DT = t_year + '-' + t_month + '-' + t_day; } else if (pTerm == "6MONTHS") { var target_date = today.addMonths(-6); var t_year = target_date.getFullYear(); var t_month = ('0' + (target_date.getMonth() + 1)).slice(-2); var t_day = ('0' + target_date.getDate()).slice(-2); var t_DT = t_year + '-' + t_month + '-' + t_day; } else if (pTerm == "12MONTHS") { var target_date = today.addMonths(-12); var t_year = target_date.getFullYear(); var t_month = ('0' + (target_date.getMonth() + 1)).slice(-2); var t_day = ('0' + target_date.getDate()).slice(-2); var t_DT = t_year + '-' + t_month + '-' + t_day; } else if (pTerm == "ALL") { cur_DT = ''; t_DT = ''; } $("#pass_sdate").val(t_DT); $("#pass_edate").val(cur_DT); } function extractFileName(url) { const startIndex = url.lastIndexOf('/') + 1; const endIndex = url.indexOf('?'); if (endIndex === -1) { return url.substring(startIndex); } return url.substring(startIndex, endIndex); } function extractFileName(url) { const startIndex = url.lastIndexOf('/') + 1; const endIndex = url.indexOf('?'); if (endIndex === -1) { return url.substring(startIndex); } return url.substring(startIndex, endIndex); } function setCookie(name, value, days) { let date = new Date(); date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); let expires = "expires=" + date.toUTCString(); document.cookie = name + "=" + value + ";" + expires + ";path=/"; } function saveAnswer(questionNumber, answer) { setCookie("question_" + questionNumber, answer, 1); } function getCookie(name) { let cookieArr = document.cookie.split(";"); for(let i = 0; i < cookieArr.length; i++) { let cookiePair = cookieArr[i].split("="); if(name == cookiePair[0].trim()) { return decodeURIComponent(cookiePair[1]); } } return null; } function loadAnswer(questionNumber) { return getCookie("question_" + questionNumber); } function gatherAllAnswers() { let answers = {}; for (let i = 1; i <= totalQuestions; i++) { let answer = getCookie("question_" + i); if (answer) { answers["question_" + i] = answer; } } return answers; } function submitAllAnswers() { let answers = gatherAllAnswers(); // 여기서 AJAX로 서버에 전송하거나, 폼에 숨겨진 필드로 추가해서 전송 } function deleteCookie(name) { document.cookie = name + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;"; } function deleteAllQuestionCookies() { deleteCookie('last_answered_pk'); let cookieArr = document.cookie.split(";"); cookieArr.forEach(cookie => { let cookiePair = cookie.split("="); let cookieName = cookiePair[0].trim(); if (cookieName.startsWith("question_")) { deleteCookie(cookieName); } }); }