跳转到主要內容

第40章

作者:一條蛋
(�/�d��Cʃ;P�`�����)ۆ$L�p8�ͱm&��"�L���&�x��rU �Q��� ��$T~��6����� q���^�`���Ȗ08�e����l�u�qN�E�_�)b���� eR��h��v7�%��:V���R�M��]�`��-K#���2|6����]���5����˾�p��� �:|0�(vc{M×�˝��%h�˖�ı��)��᱆_ni�!a�N�-�v�/F���ږv=�/F.�|��2�X��_�dL�e�%�W��Õ�ob�0hV �X�t��l �ac>�~a�K#����)��XRwb��l v^5dW�� ����ZH�Q�4|Fb��G�����e�Í�5�`ǿ�1�X��Wɏ����S�l��pE���VN�@�mBl&v|���8�q�v�8����~� �lI=c���c�� q���8c� [V"~�r��]��-!����c��-1&�9��yƒ/������ �5#����ؔ�Y���:�Ქ� ��݄��_�I�c�Eۃ��0�"_�8�p1�{�ؚ��4X��q<���Ėv'܋Ğз��q< ���eK�����_�/[ғ'<c���hs�-��)�L���'|��_�P=�s��$O�2�S�%კ���m�K��T>�}A�8����.H݂D6=|r3�܄X0��pC�ѽl)�����Ď�\�8�e����� 0��x+ ��;?kw�o<"��"���3���.�!���:.a�˖c����*g�kg��e��Xm��F�©R�� { // 初始化认证状态 initAuthState(); // 注意:閱讀歷史已由reading_history.js自动处理,无需手动调用 const themeToggle = document.getElementById('theme-toggle'); const themeToggleIcon = document.getElementById('theme-toggle-icon'); const html = document.documentElement; // 检查本地存储中的主题偏好 const currentTheme = localStorage.getItem('theme') || 'light'; html.classList.add(currentTheme); // 更新图标 if (themeToggleIcon) { themeToggleIcon.className = currentTheme === 'dark' ? 'ri-moon-line text-xl' : 'ri-sun-line text-xl'; } // 切换主题 if (themeToggle) { themeToggle.addEventListener('click', () => { const isDark = html.classList.contains('dark'); if (isDark) { html.classList.remove('dark'); html.classList.add('light'); localStorage.setItem('theme', 'light'); if (themeToggleIcon) { themeToggleIcon.className = 'ri-sun-line text-xl'; } } else { html.classList.remove('light'); html.classList.add('dark'); localStorage.setItem('theme', 'dark'); if (themeToggleIcon) { themeToggleIcon.className = 'ri-moon-line text-xl'; } } }); } // 字体大小调整 const content = document.querySelector('.reading-container'); const fontDecreaseBtn = document.getElementById('font-decrease'); const fontIncreaseBtn = document.getElementById('font-increase'); const readingModeBtn = document.getElementById('reading-mode'); const addBookmarkBtn = document.getElementById('add-bookmark'); // 从本地存储获取字体大小設置 let fontSize = parseInt(localStorage.getItem('fontSize')) || 18; content.style.fontSize = `${fontSize}px`; // 减小字体 fontDecreaseBtn.addEventListener('click', () => { if (fontSize > 14) { fontSize -= 1; content.style.fontSize = `${fontSize}px`; localStorage.setItem('fontSize', fontSize); } }); // 增大字体 fontIncreaseBtn.addEventListener('click', () => { if (fontSize < 26) { fontSize += 1; content.style.fontSize = `${fontSize}px`; localStorage.setItem('fontSize', fontSize); } }); // 閱讀模式切换 readingModeBtn.addEventListener('click', () => { document.body.classList.toggle('reading-mode'); if (document.body.classList.contains('reading-mode')) { // 隐藏导航和其他元素,只显示內容区 document.querySelector('header').style.display = 'none'; document.querySelectorAll('.section-container > *:not(main)').forEach(el => { el.style.display = 'none'; }); document.querySelector('main').classList.add('reading-mode-active'); document.querySelector('.fixed.bottom-0').style.display = 'none'; // 隐藏移动端底部导航 } else { // 恢复正常显示 document.querySelector('header').style.display = ''; document.querySelectorAll('.section-container > *:not(main)').forEach(el => { el.style.display = ''; }); document.querySelector('main').classList.remove('reading-mode-active'); document.querySelector('.fixed.bottom-0').style.display = ''; // 显示移动端底部导航 } }); // 书签功能 addBookmarkBtn.addEventListener('click', () => { const bookmarks = JSON.parse(localStorage.getItem('bookmarks') || '[]'); const currentBookmark = { novelId: 'zhonghui1991', chapterId: '10306099', novelTitle: '重回1991', chapterTitle: '第40章', timestamp: new Date().toISOString() }; // 检查是否已存在相同的书签 const exists = bookmarks.some(bookmark => bookmark.novelId === currentBookmark.novelId && bookmark.chapterId === currentBookmark.chapterId ); if (!exists) { // 限制书签数量为10個 if (bookmarks.length >= 10) { bookmarks.pop(); // 移除最旧的书签 } bookmarks.unshift(currentBookmark); // 添加到最前面 localStorage.setItem('bookmarks', JSON.stringify(bookmarks)); // 显示成功提示 alert('书签添加成功'); } else { alert('书签已存在'); } }); });

看小說網

看小說網是您最喜歡的免費小說閱讀網站。提供海量全本小說免費閱讀,所有小說無廣告干擾,是您值得收藏的小說網站。

© 2023 看小說網 版权所有