Xem Mục Lục
Đăng nhập để bình luận và ủng hộ tác giả Đăng nhập ngay
Dieuthi
Cuối cùng cũng ènd, tui quên cả cốt truyện dù sao cũng cảm ơn bà tác
15:55 24/07
Màu nền
Font chữ
Cỡ chữ & giãn dòng
Truyện liên quan
18px
1.8dòng
Căn lề
Thiết lập được lưu tự động cho lần đọc sau
Số dư: 0 Sóng
`; GIFT_LIST.forEach(g => { html += `
${g.name} ${g.price.toLocaleString()} `; }); container.innerHTML = html; } function pickGift(el, price, name) { document.querySelectorAll('.gift-item').forEach(i => i.classList.remove('selected')); el.classList.add('selected'); document.getElementById('selected-gift-price').value = price; document.getElementById('selected-gift-name').value = name; const btn = document.querySelector('.btn-gift-select'); const label = document.getElementById('gift-label'); if (price > 0) { label.innerText = `Tặng: ${name} (${price})`; btn.classList.add('active'); } else { label.innerText = "Tặng quà"; btn.classList.remove('active'); } setTimeout(() => document.getElementById('modalGift').classList.remove('show'), 200); } function unlockChapter(chapterId) { Swal.fire({ title: 'Mở khóa chương?', text: "Hệ thống sẽ trừ Sóng trong ví của bạn.", icon: 'question', showCancelButton: true, confirmButtonColor: '#2563eb', cancelButtonColor: '#d33', confirmButtonText: 'Đồng ý' }).then((result) => { if (result.isConfirmed) { fetch(APP_URL + 'php/api_unlock.php', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ chapter_id: chapterId }) }).then(res => res.json()).then(data => { if (data.status === 'success') { Swal.fire('Thành công', 'Đã mở khóa, chúc bạn đọc truyện vui vẻ!', 'success').then(() => location.reload()); } else { Swal.fire('Lỗi', data.message, 'error'); } }); } }) } // buyCombo đã gỡ bỏ function number_format(n) { if (!n) return '0'; return n.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ','); } function openReply(cmtId, name) { if (USER_ID === 0) { Swal.fire('Thông báo', 'Đăng nhập để trả lời!', 'warning'); return; } document.querySelectorAll('.reply-box').forEach(e => e.classList.add('hidden')); document.getElementById('reply-box-' + cmtId).classList.remove('hidden'); document.getElementById('reply-input-' + cmtId).placeholder = 'Trả lời ' + name + '...'; } function closeReply(cmtId) { document.getElementById('reply-box-' + cmtId).classList.add('hidden'); } function postData(content, parentId = 0, giftPrice = 0, giftType = null) { if (!content && giftPrice === 0) { Swal.fire('Thông báo', 'Vui lòng nhập nội dung!', 'warning'); return; } let btn; if (parentId === 0) { btn = document.querySelector('.btn-send'); btn.innerText = 'Gửi...'; btn.disabled = true; } fetch(APP_URL + 'php/api_comment.php', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ novel_id: NOVEL_ID, content: content, parent_id: parentId, gift_type: giftType, gift_price: giftPrice }) }) .then(res => res.json()) .then(data => { if (data.status === 'success') { Swal.fire({ icon: 'success', title: 'Thành công!', text: giftPrice > 0 ? 'Cảm ơn sếp đã ủng hộ tác giả!' : 'Đã gửi!', timer: 1000, showConfirmButton: false }) .then(() => location.reload()); } else { Swal.fire('Lỗi', data.message, 'error'); if (btn) { btn.innerText = 'Gửi'; btn.disabled = false; } } }); } function sendMainComment() { const content = document.getElementById('txtComment').value; const giftPrice = parseInt(document.getElementById('selected-gift-price').value); const giftName = document.getElementById('selected-gift-name').value; postData(content, 0, giftPrice, giftName); } function sendReply(cmtId) { const content = document.getElementById('reply-input-' + cmtId).value; postData(content, cmtId, 0, null); } function toggleLike(cmtId) { if (USER_ID === 0) { Swal.fire('Thông báo', 'Đăng nhập để thả tim!', 'warning'); return; } const btn = document.querySelector(`#cmt-${cmtId} .btn-like`); const icon = btn.querySelector('i'); const countSpan = btn.querySelector('.count'); let count = parseInt(countSpan.innerText); let isLiked = btn.classList.contains('liked'); if (isLiked) { btn.classList.remove('liked'); icon.className = 'ri-heart-3-line'; countSpan.innerText = Math.max(0, count - 1); } else { btn.classList.add('liked'); icon.className = 'ri-heart-3-fill'; countSpan.innerText = count + 1; } fetch(APP_URL + 'php/api_comment.php', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ action: 'like', comment_id: cmtId }) }).then(res => res.json()).then(data => { if (data.status === 'success') countSpan.innerText = data.new_count; }); }
Bình Luận Chương
Đăng nhập để bình luậnChưa có bình luận cho chương này.