BookMakerAdder/web/index.html

143 lines
5.6 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>북마크 추가 앱 (Eel 버전)</title>
<script type="text/javascript" src="/eel.js"></script>
<style>
body { font-family: Arial, sans-serif; margin: 20px; }
.log { white-space: pre-wrap; background: #f0f0f0; padding: 10px; height: 200px; overflow: auto; }
</style>
</head>
<body>
<h1>북마크 추가 앱 (Eel 버전)</h1>
<!-- 비밀번호 입력 -->
<div>
<label for="password">비밀번호:</label>
<input type="password" id="password">
<button onclick="checkPassword()">확인</button>
</div>
<hr>
<!-- 메인 콘텐츠 (비밀번호가 일치할 때 보임) -->
<div id="main-content" style="display:none;">
<h2>DB 입력</h2>
<input type="text" id="excelPath" placeholder="엑셀 파일 경로">
<input type="checkbox" id="removeExistingDB"> 기존 DB 제거
<button onclick="loadExcel()">엑셀 로드</button>
<br><br>
<button onclick="viewData()">데이터 보기</button>
<button onclick="resetExtractCount()">추출 횟수 초기화</button>
<hr>
<h2>북마크 추가 옵션</h2>
<div>
<label>국가:</label>
<select id="country">
<option>미국</option>
<option>유럽</option>
<option selected>중국</option>
<option>일본</option>
<option>한국</option>
<option>기타</option>
<option>랜덤</option>
</select>
<label>등급:</label>
<select id="grade">
<option>일반</option>
<option>파워</option>
<option>빅파워</option>
<option selected>랜덤</option>
</select>
<label>갯수:</label>
<input type="number" id="count" value="1000">
</div>
<div>
<input type="checkbox" id="removeExistingBookmarks">
<label>기존 북마크 제거</label>
<input type="checkbox" id="extractBased">
<label>추출 횟수 기반 추출</label>
<label>최대 추출 횟수:</label>
<input type="number" id="maxExtract" value="1">
</div>
<div>
<label>브라우저 선택:</label>
<select id="browserChoice">
<option>크롬</option>
<option>웨일</option>
</select>
<br>
<label>크롬 경로:</label>
<input type="text" id="chromePath" placeholder="크롬 실행 파일 경로">
<br>
<label>웨일 경로:</label>
<input type="text" id="whalePath" placeholder="웨일 실행 파일 경로">
</div>
<button onclick="runTask()">실행</button>
<hr>
<h2>로그</h2>
<div class="log" id="log"></div>
<div>
<label>진행률:</label>
<progress id="progressBar" value="0" max="100"></progress>
</div>
</div>
<!-- 데이터 보기 결과 (간단한 팝업) -->
<div id="dataDialog" style="display:none; border:1px solid #ccc; padding:10px;"></div>
<script>
function checkPassword() {
let pwd = document.getElementById("password").value;
if(pwd !== "365") {
alert("비밀번호가 일치하지 않습니다. 프로그램을 종료합니다.");
window.close();
} else {
document.getElementById("main-content").style.display = "block";
}
}
function loadExcel() {
let path = document.getElementById("excelPath").value;
let removeExisting = document.getElementById("removeExistingDB").checked;
eel.load_excel(path, removeExisting);
}
function viewData() {
eel.view_data();
}
eel.expose(show_data);
function show_data(htmlData) {
let dlg = document.getElementById("dataDialog");
dlg.innerHTML = htmlData;
dlg.style.display = "block";
setTimeout(()=>{ dlg.style.display = "none"; }, 5000);
}
function resetExtractCount() {
eel.reset_extract_count();
}
function runTask() {
let country = document.getElementById("country").value;
let grade = document.getElementById("grade").value;
let count = document.getElementById("count").value;
let removeExisting = document.getElementById("removeExistingBookmarks").checked;
let extractBased = document.getElementById("extractBased").checked;
let maxExtract = document.getElementById("maxExtract").value;
let browserChoice = document.getElementById("browserChoice").value;
let chromePath = document.getElementById("chromePath").value;
let whalePath = document.getElementById("whalePath").value;
eel.run_task(country, grade, count, removeExisting, extractBased, maxExtract, browserChoice, chromePath, whalePath);
}
eel.expose(log);
function log(msg) {
let logDiv = document.getElementById("log");
logDiv.innerText += msg + "\n";
}
eel.expose(update_progress);
function update_progress(val) {
document.getElementById("progressBar").value = val;
}
eel.expose(task_completed);
function task_completed() {
alert("작업이 완료되었습니다!");
}
</script>
</body>
</html>