//공통 자바스크립트 함수 function isEmpty (arg) { if (arg == null || arg == undefined || arg == '') { return true; } else { return false; } } //Alert('로그인에 성공했습니다', (res) => location.href='') function Alert(msg, callback) { if (isEmpty(msg)) { console.error('msg parameter please'); return; } swal(msg, { icon: 'success', buttons: { yes: { text: '확인', value: 'continue' }, } }).then((value) => { if (value === 'continue') { callback?.(true); } }); } //AlertError('로그인에 실패했습니다', (res) => location.href='') function AlertError(msg, callback) { if (isEmpty(msg)) { console.error('msg parameter please'); return; } swal(msg, { icon: 'error', buttons: { yes: { text: '확인', value: 'continue' }, } }).then((value) => { if (value === 'continue') { callback?.(true); } }); } //AlertInfo('30일 연속 출석체크 중입니다.', (res) => location.href='') function AlertInfo(msg, callback) { if (isEmpty(msg)) { console.error('msg parameter please'); return; } swal(msg, { // icon: 'info', buttons: { yes: { text: '확인', value: 'continue' }, } }).then((value) => { if (value === 'continue') { callback?.(true); } }); } //Confirm('정말 삭제하시겠습니까?', function(res){}, function(res2){}) function Confirm(msg, callbackCaseTrue, callbackCaseFalse) { if (isEmpty(msg)) { console.error('msg parameter please'); return; } swal(msg, { icon: 'warning', buttons: { no: { text: '취소', value: null }, yes: { text: '네, 진행하겠습니다', value: 'continue' }, } }).then((value) => { if (value === 'continue') { callbackCaseTrue?.(true); } else { callbackCaseFalse?.(false); } }); } function handleFinancialWork() { AlertInfo('디스코드에서 확인하세요.'); } function setCookie(name, value, daysToExpire, path, domain) { const date = new Date(); date.setTime(date.getTime() + (daysToExpire * 24 * 60 * 60 * 1000)); const expires = "expires=" + date.toUTCString(); const cookieValue = name + "=" + value + ";" + expires + ";path=" + path + ";domain=" + domain; document.cookie = cookieValue; } function getCookie(cookieName) { const name = cookieName + "="; const decodedCookie = decodeURIComponent(document.cookie); const cookieArray = decodedCookie.split(';'); for (let i = 0; i < cookieArray.length; i++) { let cookie = cookieArray[i]; while (cookie.charAt(0) === ' ') { cookie = cookie.substring(1); } if (cookie.indexOf(name) === 0) { return cookie.substring(name.length, cookie.length); } } return null; } function parseIntInput(arg) { if (isEmpty(arg)) return; return parseInt(arg.replace(/\D/g, ""), 10); } function parseFloatInput(arg) { if (isEmpty(arg)) return; if (arg.indexOf('.') > 0) { if ((arg.match(/\./g) || []).length >= 2) { return arg.slice(0, -1); } return arg; } return parseFloat(arg.replace(/[^\d.]/g, '')); } function jsonToQs(obj) { const params = new URLSearchParams(); for (const key in obj) { if (obj.hasOwnProperty(key)) { params.append(key, obj[key]); } } return params.toString(); }