strong all
This commit is contained in:
@@ -153,6 +153,37 @@
|
||||
<body>
|
||||
|
||||
<!-- Modals HTML Structure -->
|
||||
<div id="modal-confirm" class="modal-overlay">
|
||||
<div class="modal-content" style="width: 400px; padding: 20px;">
|
||||
<div class="modal-header">
|
||||
<span>操作确认</span>
|
||||
<span class="modal-close" onclick="closeModal('modal-confirm')">×</span>
|
||||
</div>
|
||||
<div style="margin-bottom: 20px;" id="confirm-message">
|
||||
确定执行此操作?
|
||||
</div>
|
||||
<div style="text-align:right;">
|
||||
<button onclick="closeModal('modal-confirm')" style="padding:8px 20px; cursor:pointer;">取消</button>
|
||||
<button id="confirm-btn-action" style="background:var(--primary); color:white; border:none; padding:8px 20px; cursor:pointer; border-radius:4px; margin-left: 10px;">确定</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="modal-alert" class="modal-overlay">
|
||||
<div class="modal-content" style="width: 400px; padding: 20px;">
|
||||
<div class="modal-header">
|
||||
<span>提示</span>
|
||||
<span class="modal-close" onclick="closeModal('modal-alert')">×</span>
|
||||
</div>
|
||||
<div style="margin-bottom: 20px;" id="alert-message">
|
||||
提示信息
|
||||
</div>
|
||||
<div style="text-align:right;">
|
||||
<button onclick="closeModal('modal-alert')" style="background:var(--primary); color:white; border:none; padding:8px 20px; cursor:pointer; border-radius:4px;">知道了</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="modal-citation" class="modal-overlay">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
@@ -227,7 +258,7 @@
|
||||
<p class="header-info">
|
||||
<span>欢迎, <strong>Student_2024</strong> (借阅证状态: <span style="color:#aeffae">正常</span>)</span>
|
||||
<span>
|
||||
<a href="javascript:void(0)" onclick="openShelf()">我的书架 <span id="shelf-count" style="background:#b3a369; color:black; padding:0 4px; border-radius:10px; font-size:10px;">0</span></a> | <a href="#">借阅历史</a> | <a href="#" onclick="alert('注销成功')">注销</a>
|
||||
<a href="javascript:void(0)" onclick="openShelf()">我的书架 <span id="shelf-count" style="background:#b3a369; color:black; padding:0 4px; border-radius:10px; font-size:10px;">0</span></a> | <a href="#">借阅历史</a> | <a href="#" onclick="showCustomAlert('注销成功')">注销</a>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
@@ -352,6 +383,34 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// --- Custom Alert/Confirm Logic ---
|
||||
let onConfirmCallback = null;
|
||||
|
||||
function showCustomAlert(msg) {
|
||||
// Handle newlines
|
||||
document.getElementById('alert-message').innerText = msg;
|
||||
openModal('modal-alert');
|
||||
}
|
||||
|
||||
function showCustomConfirm(msg, callback) {
|
||||
document.getElementById('confirm-message').innerText = msg;
|
||||
onConfirmCallback = callback;
|
||||
openModal('modal-confirm');
|
||||
}
|
||||
|
||||
// Initialize confirm button
|
||||
window.addEventListener('DOMContentLoaded', () => {
|
||||
const btn = document.getElementById('confirm-btn-action');
|
||||
if (btn) {
|
||||
btn.addEventListener('click', () => {
|
||||
if (typeof onConfirmCallback === 'function') {
|
||||
onConfirmCallback();
|
||||
}
|
||||
closeModal('modal-confirm');
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// --- State Management ---
|
||||
const STATE = {
|
||||
view: 'list', // list, detail
|
||||
@@ -868,7 +927,7 @@
|
||||
|
||||
function copyText(text) {
|
||||
navigator.clipboard.writeText(text).then(() => {
|
||||
alert('已复制到剪贴板');
|
||||
showCustomAlert('已复制到剪贴板');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -959,7 +1018,7 @@
|
||||
ids: new Set(),
|
||||
add: function(id) {
|
||||
if (this.ids.has(id)) {
|
||||
alert('该资源已在书架中!');
|
||||
showCustomAlert('该资源已在书架中!');
|
||||
return;
|
||||
}
|
||||
this.ids.add(id);
|
||||
@@ -1134,8 +1193,8 @@
|
||||
|
||||
<div style="margin-top:30px; display:flex; gap:15px; border-top:1px solid #ddd; padding-top:20px;">
|
||||
${item.hasPdf
|
||||
? `<button style="background:var(--primary); color:white; border:none; padding:10px 25px; border-radius:4px; cursor:pointer;" onclick="alert('开始下载 ${item.title}.pdf')">下载全文 (PDF)</button>`
|
||||
: `<button style="background:#ccc; color:white; border:none; padding:10px 25px; border-radius:4px; cursor:not-allowed;">PDF 未授权</button> <button style="background:white; color:#333; border:1px solid #ccc; padding:10px 25px; border-radius:4px; cursor:pointer;" onclick="alert('申请文献传递...')">申请文献传递</button>`
|
||||
? `<button style="background:var(--primary); color:white; border:none; padding:10px 25px; border-radius:4px; cursor:pointer;" onclick="showCustomAlert('开始下载 ${item.title}.pdf')">下载全文 (PDF)</button>`
|
||||
: `<button style="background:#ccc; color:white; border:none; padding:10px 25px; border-radius:4px; cursor:not-allowed;">PDF 未授权</button> <button style="background:white; color:#333; border:1px solid #ccc; padding:10px 25px; border-radius:4px; cursor:pointer;" onclick="showCustomAlert('申请文献传递...')">申请文献传递</button>`
|
||||
}
|
||||
<button style="background:white; color:var(--text-main); border:1px solid #ccc; padding:10px 25px; border-radius:4px; cursor:pointer;" onclick="showExportCitation(${item.id})">获取引用格式</button>
|
||||
<button style="background:white; color:var(--text-main); border:1px solid #ccc; padding:10px 25px; border-radius:4px; cursor:pointer;" onclick="addToShelf(${item.id})">加入书架</button>
|
||||
@@ -1165,7 +1224,7 @@
|
||||
const mla = `${title}. ${year}.`;
|
||||
const bibtex = `@article{cite_${year}, title={${title}}, year={${year}}}`;
|
||||
|
||||
alert(`引用格式生成:\n\n[APA]: ${apa}\n[MLA]: ${mla}\n[BibTeX]: ${bibtex}`);
|
||||
showCustomAlert(`引用格式生成:\n\n[APA]: ${apa}\n[MLA]: ${mla}\n[BibTeX]: ${bibtex}`);
|
||||
}
|
||||
|
||||
// Initialize
|
||||
|
||||
Reference in New Issue
Block a user