Update app.py
Browse files
app.py
CHANGED
|
@@ -1569,7 +1569,7 @@ HTML = """
|
|
| 1569 |
</div>
|
| 1570 |
</section>
|
| 1571 |
|
| 1572 |
-
|
| 1573 |
let projects=[], fb=null;
|
| 1574 |
const grid=document.getElementById('grid'), viewer=document.getElementById('viewer');
|
| 1575 |
pdfjsLib.GlobalWorkerOptions.workerSrc='/static/pdf.worker.js';
|
|
@@ -1584,20 +1584,114 @@ HTML = """
|
|
| 1584 |
// ํ์ฌ ์ด๋ฆฐ PDF์ ID
|
| 1585 |
let currentPdfId = null;
|
| 1586 |
|
| 1587 |
-
/
|
| 1588 |
-
|
| 1589 |
-
|
| 1590 |
-
|
| 1591 |
-
|
| 1592 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1593 |
|
| 1594 |
/* โโ ์ ํธ โโ */
|
| 1595 |
function $id(id){return document.getElementById(id)}
|
| 1596 |
|
| 1597 |
-
//
|
| 1598 |
-
document.addEventListener(
|
| 1599 |
console.log("DOM ๋ก๋ ์๋ฃ, ์ด๋ฒคํธ ์ค์ ์์");
|
| 1600 |
|
|
|
|
|
|
|
|
|
|
| 1601 |
// PDF ์
๋ก๋ ๋ฒํผ
|
| 1602 |
const pdfBtn = document.getElementById('pdfUploadBtn');
|
| 1603 |
const pdfInput = document.getElementById('pdfInput');
|
|
@@ -1632,6 +1726,28 @@ HTML = """
|
|
| 1632 |
|
| 1633 |
// ๊ด๋ฆฌ์ ๋ฒํผ ์ด๋ฒคํธ ์ค์
|
| 1634 |
setupAdminFunctions();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1635 |
});
|
| 1636 |
|
| 1637 |
// ์๋ฒ์ PDF ์
๋ก๋ ํจ์
|
|
@@ -1668,46 +1784,44 @@ HTML = """
|
|
| 1668 |
}
|
| 1669 |
}
|
| 1670 |
|
| 1671 |
-
function addCard(i, thumb, title, isCached = false, pdfId = null) {
|
| 1672 |
-
|
| 1673 |
-
|
| 1674 |
-
|
| 1675 |
-
|
| 1676 |
-
|
| 1677 |
-
|
| 1678 |
-
|
| 1679 |
-
|
| 1680 |
-
|
| 1681 |
-
|
| 1682 |
-
|
| 1683 |
-
|
| 1684 |
-
|
| 1685 |
-
|
| 1686 |
-
|
| 1687 |
-
|
| 1688 |
-
|
| 1689 |
-
|
| 1690 |
-
|
| 1691 |
-
|
| 1692 |
-
|
| 1693 |
-
|
| 1694 |
-
|
| 1695 |
-
|
| 1696 |
-
|
| 1697 |
-
|
| 1698 |
-
|
| 1699 |
-
|
| 1700 |
-
|
| 1701 |
-
|
| 1702 |
-
|
| 1703 |
-
|
| 1704 |
-
|
| 1705 |
-
|
| 1706 |
-
|
| 1707 |
-
|
| 1708 |
-
}
|
| 1709 |
-
|
| 1710 |
-
|
| 1711 |
|
| 1712 |
/* โโ ํ๋ก์ ํธ ์ ์ฅ โโ */
|
| 1713 |
function save(pages, title, isCached = false, pdfId = null) {
|
|
@@ -1868,6 +1982,9 @@ function addCard(i, thumb, title, isCached = false, pdfId = null) {
|
|
| 1868 |
/* โโ PDF ID๋ก PDF ์ด๊ธฐ โโ */
|
| 1869 |
async function openPdfById(pdfId, pdfPath, isCached = false) {
|
| 1870 |
try {
|
|
|
|
|
|
|
|
|
|
| 1871 |
// ๋จผ์ ํ ํ๋ฉด์์ ์นด๋๋ฅผ ์ฐพ์์ ํด๋ฆญํ๋ ๋ฐฉ๋ฒ ์๋
|
| 1872 |
let foundCard = false;
|
| 1873 |
const cards = document.querySelectorAll('.card');
|
|
@@ -2215,6 +2332,13 @@ function addCard(i, thumb, title, isCached = false, pdfId = null) {
|
|
| 2215 |
viewer.style.width = size.width + 'px';
|
| 2216 |
viewer.style.height = size.height + 'px';
|
| 2217 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2218 |
// ํ์ด์ง ๋ฐ์ดํฐ ์ ์ (๋น ํ์ด์ง ์ฒ๋ฆฌ)
|
| 2219 |
const validPages = pages.map(page => {
|
| 2220 |
// src๊ฐ ์๋ ํ์ด์ง๋ ๋ก๋ฉ ์ค ์ด๋ฏธ์ง๋ก ๋์ฒด
|
|
@@ -2235,7 +2359,7 @@ function addCard(i, thumb, title, isCached = false, pdfId = null) {
|
|
| 2235 |
backgroundColor: '#fff',
|
| 2236 |
/* ๐ ๋ด์ฅ ์ฌ์ด๋ */
|
| 2237 |
sound: true,
|
| 2238 |
-
assets: {flipMp3: 'static/turnPage2.mp3', hardFlipMp3: 'static/turnPage2.mp3'},
|
| 2239 |
controlsProps: {
|
| 2240 |
enableFullscreen: true,
|
| 2241 |
enableToc: true,
|
|
@@ -2300,24 +2424,6 @@ function addCard(i, thumb, title, isCached = false, pdfId = null) {
|
|
| 2300 |
}
|
| 2301 |
|
| 2302 |
/* โโ ๋ค๋น๊ฒ์ด์
โโ */
|
| 2303 |
-
$id('homeButton').onclick=()=>{
|
| 2304 |
-
if(fb) {
|
| 2305 |
-
fb.destroy();
|
| 2306 |
-
viewer.innerHTML = '';
|
| 2307 |
-
fb = null;
|
| 2308 |
-
}
|
| 2309 |
-
toggle(true);
|
| 2310 |
-
|
| 2311 |
-
// ๋ก๋ฉ ์ธ๋์ผ์ดํฐ ์ ๋ฆฌ
|
| 2312 |
-
if (pageLoadingInterval) {
|
| 2313 |
-
clearInterval(pageLoadingInterval);
|
| 2314 |
-
pageLoadingInterval = null;
|
| 2315 |
-
}
|
| 2316 |
-
$id('loadingPages').style.display = 'none';
|
| 2317 |
-
currentLoadingPdfPath = null;
|
| 2318 |
-
currentPdfId = null;
|
| 2319 |
-
};
|
| 2320 |
-
|
| 2321 |
function toggle(showHome){
|
| 2322 |
$id('home').style.display=showHome?'block':'none';
|
| 2323 |
$id('viewerPage').style.display=showHome?'none':'block';
|
|
@@ -2335,63 +2441,90 @@ function addCard(i, thumb, title, isCached = false, pdfId = null) {
|
|
| 2335 |
/* -- ๊ด๋ฆฌ์ ๊ธฐ๋ฅ -- */
|
| 2336 |
function setupAdminFunctions() {
|
| 2337 |
// ๊ด๋ฆฌ์ ๋ฒํผ ํด๋ฆญ - ๋ชจ๋ฌ ํ์
|
| 2338 |
-
|
| 2339 |
-
|
| 2340 |
-
|
| 2341 |
-
|
| 2342 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2343 |
|
| 2344 |
// ๋ชจ๋ฌ ๋ซ๊ธฐ ๋ฒํผ
|
| 2345 |
-
|
| 2346 |
-
|
| 2347 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2348 |
|
| 2349 |
// ์ํฐ ํค๋ก ๋ก๊ทธ์ธ
|
| 2350 |
-
|
| 2351 |
-
|
| 2352 |
-
|
| 2353 |
-
|
| 2354 |
-
|
|
|
|
|
|
|
| 2355 |
|
| 2356 |
// ๋ก๊ทธ์ธ ๋ฒํผ
|
| 2357 |
-
|
| 2358 |
-
|
| 2359 |
-
|
| 2360 |
-
try {
|
| 2361 |
-
showLoading("๋ก๊ทธ์ธ ์ค...");
|
| 2362 |
|
| 2363 |
-
const
|
| 2364 |
-
formData.append('password', password);
|
| 2365 |
|
| 2366 |
-
|
| 2367 |
-
|
| 2368 |
-
|
| 2369 |
-
|
| 2370 |
-
|
| 2371 |
-
|
| 2372 |
-
|
| 2373 |
-
|
| 2374 |
-
|
| 2375 |
-
|
| 2376 |
-
|
| 2377 |
-
|
| 2378 |
-
|
| 2379 |
-
|
| 2380 |
-
|
| 2381 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2382 |
}
|
| 2383 |
-
}
|
| 2384 |
-
|
| 2385 |
-
hideLoading();
|
| 2386 |
-
showError("๋ก๊ทธ์ธ ์ฒ๋ฆฌ ์ค ์ค๋ฅ๊ฐ ๋ฐ์ํ์ต๋๋ค.");
|
| 2387 |
-
}
|
| 2388 |
-
});
|
| 2389 |
|
| 2390 |
// ๊ด๋ฆฌ์ ํ์ด์ง ๋ค๋ก๊ฐ๊ธฐ
|
| 2391 |
-
|
| 2392 |
-
|
| 2393 |
-
|
| 2394 |
-
|
|
|
|
|
|
|
| 2395 |
}
|
| 2396 |
|
| 2397 |
// ๊ด๋ฆฌ์ ํ์ด์ง ํ์
|
|
|
|
| 1569 |
</div>
|
| 1570 |
</section>
|
| 1571 |
|
| 1572 |
+
<script>
|
| 1573 |
let projects=[], fb=null;
|
| 1574 |
const grid=document.getElementById('grid'), viewer=document.getElementById('viewer');
|
| 1575 |
pdfjsLib.GlobalWorkerOptions.workerSrc='/static/pdf.worker.js';
|
|
|
|
| 1584 |
// ํ์ฌ ์ด๋ฆฐ PDF์ ID
|
| 1585 |
let currentPdfId = null;
|
| 1586 |
|
| 1587 |
+
// ์ค๋์ค ์ปจํ
์คํธ์ ์ด๊ธฐํ ์ํ ๊ด๋ฆฌ
|
| 1588 |
+
let audioInitialized = false;
|
| 1589 |
+
let audioContext = null;
|
| 1590 |
+
|
| 1591 |
+
// ์ค๋์ค ์ด๊ธฐํ ํจ์
|
| 1592 |
+
function initializeAudio() {
|
| 1593 |
+
if (audioInitialized) return Promise.resolve();
|
| 1594 |
+
|
| 1595 |
+
return new Promise((resolve) => {
|
| 1596 |
+
// ์ค๋์ค ์ปจํ
์คํธ ์์ฑ (์ฌ์ฉ์ ์ํธ์์ฉ์ด ํ์ ์๋ ์ด๊ธฐํ)
|
| 1597 |
+
audioContext = new (window.AudioContext || window.webkitAudioContext)();
|
| 1598 |
+
|
| 1599 |
+
// MP3 ๋ก๋ ๋ฐ ์ด๊ธฐํ
|
| 1600 |
+
const audio = new Audio('/static/turnPage2.mp3');
|
| 1601 |
+
audio.volume = 0.01; // ์ต์ ๋ณผ๋ฅจ์ผ๋ก ์ค์
|
| 1602 |
+
|
| 1603 |
+
// ๋ก๋๋ ์ค๋์ค ์ฌ์ ์๋ (์ฌ์ฉ์ ์ํธ์์ฉ ์๊ตฌ๋ ์ ์์)
|
| 1604 |
+
const playPromise = audio.play();
|
| 1605 |
+
|
| 1606 |
+
if (playPromise !== undefined) {
|
| 1607 |
+
playPromise
|
| 1608 |
+
.then(() => {
|
| 1609 |
+
// ์ฑ๊ณต์ ์ผ๋ก ์ฌ์๋จ - ์ฆ์ ์ผ์์ ์ง
|
| 1610 |
+
audio.pause();
|
| 1611 |
+
audioInitialized = true;
|
| 1612 |
+
console.log('์ค๋์ค ์ด๊ธฐํ ์ฑ๊ณต');
|
| 1613 |
+
resolve();
|
| 1614 |
+
})
|
| 1615 |
+
.catch((error) => {
|
| 1616 |
+
console.log('์๋ ์ค๋์ค ์ด๊ธฐํ ์คํจ, ์ฌ์ฉ์ ์ํธ์์ฉ ํ์:', error);
|
| 1617 |
+
|
| 1618 |
+
// ์ฌ์ฉ์ ์ํธ์์ฉ์ด ํ์ํ ๊ฒฝ์ฐ, ์ด๋ฒคํธ ๋ฆฌ์ค๋ ์ถ๊ฐ
|
| 1619 |
+
const initOnUserAction = function() {
|
| 1620 |
+
const tempAudio = new Audio('/static/turnPage2.mp3');
|
| 1621 |
+
tempAudio.volume = 0.01;
|
| 1622 |
+
tempAudio.play()
|
| 1623 |
+
.then(() => {
|
| 1624 |
+
tempAudio.pause();
|
| 1625 |
+
audioInitialized = true;
|
| 1626 |
+
console.log('์ฌ์ฉ์ ์ํธ์์ฉ์ผ๋ก ์ค๋์ค ์ด๊ธฐํ ์ฑ๊ณต');
|
| 1627 |
+
resolve();
|
| 1628 |
+
|
| 1629 |
+
// ์ด๋ฒคํธ ๋ฆฌ์ค๋ ์ ๊ฑฐ
|
| 1630 |
+
['click', 'touchstart', 'keydown'].forEach(event => {
|
| 1631 |
+
document.removeEventListener(event, initOnUserAction, { capture: true });
|
| 1632 |
+
});
|
| 1633 |
+
})
|
| 1634 |
+
.catch(e => console.error('์ค๋์ค ์ด๊ธฐํ ์คํจ:', e));
|
| 1635 |
+
};
|
| 1636 |
+
|
| 1637 |
+
// ์ฌ์ฉ์ ์ํธ์์ฉ ์ด๋ฒคํธ์ ๋ฆฌ์ค๋ ์ถ๊ฐ
|
| 1638 |
+
['click', 'touchstart', 'keydown'].forEach(event => {
|
| 1639 |
+
document.addEventListener(event, initOnUserAction, { once: true, capture: true });
|
| 1640 |
+
});
|
| 1641 |
+
|
| 1642 |
+
// ํ์ด์ง ๋ก๋ ์งํ ์ฌ์ฉ์์๊ฒ ์ค๋์ค ํ์ฑํ ์์ฒญ
|
| 1643 |
+
if (window.location.pathname.startsWith('/view/')) {
|
| 1644 |
+
// ์ค๋์ค ํ์ฑํ ์๋ด ๋ฉ์์ง ํ์ (๋ฐ๋ก๊ฐ๊ธฐ ๋งํฌ๋ก ์ ์ํ ๊ฒฝ์ฐ)
|
| 1645 |
+
setTimeout(() => {
|
| 1646 |
+
const audioPrompt = document.createElement('div');
|
| 1647 |
+
audioPrompt.style.position = 'fixed';
|
| 1648 |
+
audioPrompt.style.bottom = '80px';
|
| 1649 |
+
audioPrompt.style.left = '50%';
|
| 1650 |
+
audioPrompt.style.transform = 'translateX(-50%)';
|
| 1651 |
+
audioPrompt.style.backgroundColor = 'rgba(0,0,0,0.7)';
|
| 1652 |
+
audioPrompt.style.color = 'white';
|
| 1653 |
+
audioPrompt.style.padding = '10px 20px';
|
| 1654 |
+
audioPrompt.style.borderRadius = '20px';
|
| 1655 |
+
audioPrompt.style.zIndex = '10000';
|
| 1656 |
+
audioPrompt.style.cursor = 'pointer';
|
| 1657 |
+
audioPrompt.innerHTML = 'ํ์ด์ง ์ด๋๋ ํด๋ฆญํ์ฌ ์๋ฆฌ ํจ๊ณผ ํ์ฑํ <i class="fas fa-volume-up"></i>';
|
| 1658 |
+
audioPrompt.id = 'audioPrompt';
|
| 1659 |
+
|
| 1660 |
+
// ํด๋ฆญ ์ ์๋ฆฌ ํ์ฑํ ๋ฐ ๋ฉ์์ง ์ ๊ฑฐ
|
| 1661 |
+
audioPrompt.addEventListener('click', function() {
|
| 1662 |
+
initOnUserAction();
|
| 1663 |
+
audioPrompt.remove();
|
| 1664 |
+
});
|
| 1665 |
+
|
| 1666 |
+
document.body.appendChild(audioPrompt);
|
| 1667 |
+
|
| 1668 |
+
// 10์ด ํ ์๋์ผ๋ก ์จ๊น
|
| 1669 |
+
setTimeout(() => {
|
| 1670 |
+
if (document.getElementById('audioPrompt')) {
|
| 1671 |
+
document.getElementById('audioPrompt').remove();
|
| 1672 |
+
}
|
| 1673 |
+
}, 10000);
|
| 1674 |
+
}, 2000);
|
| 1675 |
+
}
|
| 1676 |
+
});
|
| 1677 |
+
} else {
|
| 1678 |
+
// ๋ธ๋ผ๏ฟฝ๏ฟฝ๏ฟฝ์ ๊ฐ Promise ๊ธฐ๋ฐ ์ฌ์์ ์ง์ํ์ง ์๋ ๊ฒฝ์ฐ
|
| 1679 |
+
audioInitialized = true;
|
| 1680 |
+
resolve();
|
| 1681 |
+
}
|
| 1682 |
+
});
|
| 1683 |
+
}
|
| 1684 |
|
| 1685 |
/* โโ ์ ํธ โโ */
|
| 1686 |
function $id(id){return document.getElementById(id)}
|
| 1687 |
|
| 1688 |
+
// DOM์ด ๋ก๋๋๋ฉด ์คํ
|
| 1689 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 1690 |
console.log("DOM ๋ก๋ ์๋ฃ, ์ด๋ฒคํธ ์ค์ ์์");
|
| 1691 |
|
| 1692 |
+
// ์ค๋์ค ์ด๊ธฐํ ์๋
|
| 1693 |
+
initializeAudio().catch(e => console.warn('์ค๋์ค ์ด๊ธฐํ ์คํจ:', e));
|
| 1694 |
+
|
| 1695 |
// PDF ์
๋ก๋ ๋ฒํผ
|
| 1696 |
const pdfBtn = document.getElementById('pdfUploadBtn');
|
| 1697 |
const pdfInput = document.getElementById('pdfInput');
|
|
|
|
| 1726 |
|
| 1727 |
// ๊ด๋ฆฌ์ ๋ฒํผ ์ด๋ฒคํธ ์ค์
|
| 1728 |
setupAdminFunctions();
|
| 1729 |
+
|
| 1730 |
+
// ํ ๋ฒํผ ์ด๋ฒคํธ ์ค์
|
| 1731 |
+
const homeButton = document.getElementById('homeButton');
|
| 1732 |
+
if (homeButton) {
|
| 1733 |
+
homeButton.addEventListener('click', function() {
|
| 1734 |
+
if(fb) {
|
| 1735 |
+
fb.destroy();
|
| 1736 |
+
viewer.innerHTML = '';
|
| 1737 |
+
fb = null;
|
| 1738 |
+
}
|
| 1739 |
+
toggle(true);
|
| 1740 |
+
|
| 1741 |
+
// ๋ก๋ฉ ์ธ๋์ผ์ดํฐ ์ ๋ฆฌ
|
| 1742 |
+
if (pageLoadingInterval) {
|
| 1743 |
+
clearInterval(pageLoadingInterval);
|
| 1744 |
+
pageLoadingInterval = null;
|
| 1745 |
+
}
|
| 1746 |
+
$id('loadingPages').style.display = 'none';
|
| 1747 |
+
currentLoadingPdfPath = null;
|
| 1748 |
+
currentPdfId = null;
|
| 1749 |
+
});
|
| 1750 |
+
}
|
| 1751 |
});
|
| 1752 |
|
| 1753 |
// ์๋ฒ์ PDF ์
๋ก๋ ํจ์
|
|
|
|
| 1784 |
}
|
| 1785 |
}
|
| 1786 |
|
| 1787 |
+
function addCard(i, thumb, title, isCached = false, pdfId = null) {
|
| 1788 |
+
const d = document.createElement('div');
|
| 1789 |
+
d.className = 'card fade-in';
|
| 1790 |
+
d.onclick = () => open(i);
|
| 1791 |
+
|
| 1792 |
+
// PDF ID๊ฐ ์์ผ๋ฉด ๋ฐ์ดํฐ ์์ฑ์ผ๋ก ์ ์ฅ
|
| 1793 |
+
if (pdfId) {
|
| 1794 |
+
d.dataset.pdfId = pdfId;
|
| 1795 |
+
}
|
| 1796 |
+
|
| 1797 |
+
// ์ ๋ชฉ ์ฒ๋ฆฌ
|
| 1798 |
+
const displayTitle = title ?
|
| 1799 |
+
(title.length > 15 ? title.substring(0, 15) + '...' : title) :
|
| 1800 |
+
'ํ๋ก์ ํธ ' + (i+1);
|
| 1801 |
+
|
| 1802 |
+
// ์บ์ ์ํ ๋ฑ์ง ์ถ๊ฐ
|
| 1803 |
+
const cachedBadge = isCached ?
|
| 1804 |
+
'<div class="cached-status">์บ์๋จ</div>' : '';
|
| 1805 |
+
|
| 1806 |
+
// ๋ฐ๋ก๊ฐ๊ธฐ ๋งํฌ ์ถ๊ฐ (PDF ID๊ฐ ์๋ ๊ฒฝ์ฐ์๋ง)
|
| 1807 |
+
const linkHtml = pdfId ?
|
| 1808 |
+
`<div style="position: absolute; bottom: 55px; left: 50%; transform: translateX(-50%); z-index:5;">
|
| 1809 |
+
<a href="/view/${pdfId}" target="_blank" style="color:#4a6ee0; font-size:11px;">Share Link</a>
|
| 1810 |
+
</div>` : '';
|
| 1811 |
+
|
| 1812 |
+
d.innerHTML = `
|
| 1813 |
+
<div class="card-inner">
|
| 1814 |
+
${cachedBadge}
|
| 1815 |
+
<img src="${thumb}" alt="${displayTitle}" loading="lazy">
|
| 1816 |
+
${linkHtml}
|
| 1817 |
+
<p title="${title || 'ํ๋ก์ ํธ ' + (i+1)}">${displayTitle}</p>
|
| 1818 |
+
</div>
|
| 1819 |
+
`;
|
| 1820 |
+
grid.appendChild(d);
|
| 1821 |
+
|
| 1822 |
+
// ํ๋ก์ ํธ๊ฐ ์์ผ๋ฉด 'ํ๋ก์ ํธ ์์' ๋ฉ์์ง ์จ๊ธฐ๊ธฐ
|
| 1823 |
+
$id('noProjects').style.display = 'none';
|
| 1824 |
+
}
|
|
|
|
|
|
|
| 1825 |
|
| 1826 |
/* โโ ํ๋ก์ ํธ ์ ์ฅ โโ */
|
| 1827 |
function save(pages, title, isCached = false, pdfId = null) {
|
|
|
|
| 1982 |
/* โโ PDF ID๋ก PDF ์ด๊ธฐ โโ */
|
| 1983 |
async function openPdfById(pdfId, pdfPath, isCached = false) {
|
| 1984 |
try {
|
| 1985 |
+
// ์ค๋์ค ์ด๊ธฐํ ์๋
|
| 1986 |
+
await initializeAudio().catch(e => console.warn('PDF ์ด๊ธฐ ์ ์ค๋์ค ์ด๊ธฐํ ์คํจ:', e));
|
| 1987 |
+
|
| 1988 |
// ๋จผ์ ํ ํ๋ฉด์์ ์นด๋๋ฅผ ์ฐพ์์ ํด๋ฆญํ๋ ๋ฐฉ๋ฒ ์๋
|
| 1989 |
let foundCard = false;
|
| 1990 |
const cards = document.querySelectorAll('.card');
|
|
|
|
| 2332 |
viewer.style.width = size.width + 'px';
|
| 2333 |
viewer.style.height = size.height + 'px';
|
| 2334 |
|
| 2335 |
+
// ์ฌ์ด๋ ์ด๊ธฐํ ์ฌ๋ถ ํ์ธ
|
| 2336 |
+
if (!audioInitialized) {
|
| 2337 |
+
initializeAudio()
|
| 2338 |
+
.then(() => console.log('FlipBook ์์ฑ ์ ์ค๋์ค ์ด๊ธฐํ ์๋ฃ'))
|
| 2339 |
+
.catch(e => console.warn('FlipBook ์์ฑ ์ ์ค๋์ค ์ด๊ธฐํ ์คํจ:', e));
|
| 2340 |
+
}
|
| 2341 |
+
|
| 2342 |
// ํ์ด์ง ๋ฐ์ดํฐ ์ ์ (๋น ํ์ด์ง ์ฒ๋ฆฌ)
|
| 2343 |
const validPages = pages.map(page => {
|
| 2344 |
// src๊ฐ ์๋ ํ์ด์ง๋ ๋ก๋ฉ ์ค ์ด๋ฏธ์ง๋ก ๋์ฒด
|
|
|
|
| 2359 |
backgroundColor: '#fff',
|
| 2360 |
/* ๐ ๋ด์ฅ ์ฌ์ด๋ */
|
| 2361 |
sound: true,
|
| 2362 |
+
assets: {flipMp3: '/static/turnPage2.mp3', hardFlipMp3: '/static/turnPage2.mp3'}, // ์ ๋ ๊ฒฝ๋ก๋ก ์์
|
| 2363 |
controlsProps: {
|
| 2364 |
enableFullscreen: true,
|
| 2365 |
enableToc: true,
|
|
|
|
| 2424 |
}
|
| 2425 |
|
| 2426 |
/* โโ ๋ค๋น๊ฒ์ด์
โโ */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2427 |
function toggle(showHome){
|
| 2428 |
$id('home').style.display=showHome?'block':'none';
|
| 2429 |
$id('viewerPage').style.display=showHome?'none':'block';
|
|
|
|
| 2441 |
/* -- ๊ด๋ฆฌ์ ๊ธฐ๋ฅ -- */
|
| 2442 |
function setupAdminFunctions() {
|
| 2443 |
// ๊ด๋ฆฌ์ ๋ฒํผ ํด๋ฆญ - ๋ชจ๋ฌ ํ์
|
| 2444 |
+
const adminButton = document.getElementById('adminButton');
|
| 2445 |
+
const adminLoginModal = document.getElementById('adminLoginModal');
|
| 2446 |
+
const adminLoginClose = document.getElementById('adminLoginClose');
|
| 2447 |
+
const adminLoginButton = document.getElementById('adminLoginButton');
|
| 2448 |
+
const adminPasswordInput = document.getElementById('adminPasswordInput');
|
| 2449 |
+
const adminBackButton = document.getElementById('adminBackButton');
|
| 2450 |
+
|
| 2451 |
+
if (adminButton) {
|
| 2452 |
+
adminButton.addEventListener('click', function() {
|
| 2453 |
+
if (adminLoginModal) {
|
| 2454 |
+
adminLoginModal.style.display = 'flex';
|
| 2455 |
+
if (adminPasswordInput) {
|
| 2456 |
+
adminPasswordInput.value = '';
|
| 2457 |
+
adminPasswordInput.focus();
|
| 2458 |
+
}
|
| 2459 |
+
}
|
| 2460 |
+
});
|
| 2461 |
+
}
|
| 2462 |
|
| 2463 |
// ๋ชจ๋ฌ ๋ซ๊ธฐ ๋ฒํผ
|
| 2464 |
+
if (adminLoginClose) {
|
| 2465 |
+
adminLoginClose.addEventListener('click', function() {
|
| 2466 |
+
if (adminLoginModal) {
|
| 2467 |
+
adminLoginModal.style.display = 'none';
|
| 2468 |
+
}
|
| 2469 |
+
});
|
| 2470 |
+
}
|
| 2471 |
|
| 2472 |
// ์ํฐ ํค๋ก ๋ก๊ทธ์ธ
|
| 2473 |
+
if (adminPasswordInput) {
|
| 2474 |
+
adminPasswordInput.addEventListener('keyup', function(e) {
|
| 2475 |
+
if (e.key === 'Enter' && adminLoginButton) {
|
| 2476 |
+
adminLoginButton.click();
|
| 2477 |
+
}
|
| 2478 |
+
});
|
| 2479 |
+
}
|
| 2480 |
|
| 2481 |
// ๋ก๊ทธ์ธ ๋ฒํผ
|
| 2482 |
+
if (adminLoginButton) {
|
| 2483 |
+
adminLoginButton.addEventListener('click', async function() {
|
| 2484 |
+
if (!adminPasswordInput) return;
|
|
|
|
|
|
|
| 2485 |
|
| 2486 |
+
const password = adminPasswordInput.value;
|
|
|
|
| 2487 |
|
| 2488 |
+
try {
|
| 2489 |
+
showLoading("๋ก๊ทธ์ธ ์ค...");
|
| 2490 |
+
|
| 2491 |
+
const formData = new FormData();
|
| 2492 |
+
formData.append('password', password);
|
| 2493 |
+
|
| 2494 |
+
const response = await fetch('/api/admin-login', {
|
| 2495 |
+
method: 'POST',
|
| 2496 |
+
body: formData
|
| 2497 |
+
});
|
| 2498 |
+
|
| 2499 |
+
const data = await response.json();
|
| 2500 |
+
|
| 2501 |
+
hideLoading();
|
| 2502 |
+
|
| 2503 |
+
if (data.success) {
|
| 2504 |
+
// ๋ก๊ทธ์ธ ์ฑ๊ณต - ๊ด๋ฆฌ์ ํ์ด์ง ํ์
|
| 2505 |
+
if (adminLoginModal) {
|
| 2506 |
+
adminLoginModal.style.display = 'none';
|
| 2507 |
+
}
|
| 2508 |
+
showAdminPage();
|
| 2509 |
+
} else {
|
| 2510 |
+
// ๋ก๊ทธ์ธ ์คํจ
|
| 2511 |
+
showError("๊ด๋ฆฌ์ ์ธ์ฆ ์คํจ: ๋น๋ฐ๋ฒํธ๊ฐ ์ผ์นํ์ง ์์ต๋๋ค.");
|
| 2512 |
+
}
|
| 2513 |
+
} catch (error) {
|
| 2514 |
+
console.error("๊ด๋ฆฌ์ ๋ก๊ทธ์ธ ์ค๋ฅ:", error);
|
| 2515 |
+
hideLoading();
|
| 2516 |
+
showError("๋ก๊ทธ์ธ ์ฒ๋ฆฌ ์ค ์ค๋ฅ๊ฐ ๋ฐ์ํ์ต๋๋ค.");
|
| 2517 |
}
|
| 2518 |
+
});
|
| 2519 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2520 |
|
| 2521 |
// ๊ด๋ฆฌ์ ํ์ด์ง ๋ค๋ก๊ฐ๊ธฐ
|
| 2522 |
+
if (adminBackButton) {
|
| 2523 |
+
adminBackButton.addEventListener('click', function() {
|
| 2524 |
+
document.getElementById('adminPage').style.display = 'none';
|
| 2525 |
+
document.getElementById('home').style.display = 'block';
|
| 2526 |
+
});
|
| 2527 |
+
}
|
| 2528 |
}
|
| 2529 |
|
| 2530 |
// ๊ด๋ฆฌ์ ํ์ด์ง ํ์
|