let startYear = 2014;
let endYear = 2025;
let total = 0;
const today = new Date();
const todayYear = today.getFullYear();
const todayMonth = String(today.getMonth() + 1).padStart(2, '0');
const todayDate = String(today.getDate()).padStart(2, '0');
const endDateFormatted = `${todayYear}.${todayMonth}.${todayDate}`;
async function fetchAmountsForYear(year) {
let yearTotal = 0;
let page = 1;
let hasNextPage = true;
while (hasNextPage) {
const startDate = `${year}.01.01`;
const endDate = year === todayYear ? endDateFormatted : `${year}.12.31`;
const baseUrl = `?startDate=${startDate}&endDate=${endDate}&Page=${page}`;
const response = await fetch(baseUrl);
const text = await response.text();
const parser = new DOMParser();
const doc = parser.parseFromString(text, 'text/html');
var emptyMessageCell = doc.querySelector('td.empty');
if (emptyMessageCell && emptyMessageCell.textContent.trim() === '해당이력이 없습니다.') {
return null;
}
const amounts = doc.querySelectorAll('td.amount');
amounts.forEach(amount => {
const value = parseInt(amount.textContent.replace(/,/g, ''), 10);
if (value > 0) {
yearTotal += value;
}
});
const nextButton = doc.querySelector('a.btn_arrow.next');
hasNextPage = nextButton !== null;
page++;
}
return yearTotal;
}
async function fetchAllAmounts() {
for (let year = startYear; year <= endYear; year++) {
const yearTotal = await fetchAmountsForYear(year);
if (yearTotal !== null) {
total += yearTotal;
}
}
const formattedTotal = total.toLocaleString();
// 🔒 결과만 보여주는 새 창 열기
const win = window.open("", "_blank");
win.document.write(`
<html>
<head>
<title>총 결제 금액</title>
<style>
body { font-family: sans-serif; text-align: center; padding-top: 50px; }
.amount { font-size: 32px; color: #333; }
</style>
</head>
<body>
<h1>지금까지 사용한 총 금액</h1>
<div class="amount">${formattedTotal}원</div>
</body>
</html>
`);
win.document.close();
}
fetchAllAmounts();
코드 사용법은 엣지에서 검은사막 홈페이지에 가세요.
로그인 후 계정 정보로 가세요.
그 후에 구매 사용 내역으로 가시고, f12를 눌러 콘솔 창을 누르신 후 해당 코드를 입력합니다.