您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Supercharges AnkiWeb. Currently Supported Functionality - Show card total, done and remaining count per session - Dark Mode
当前为
// ==UserScript== // @name Super Anki // @version 3 // @grant none // @match https://*.ankiuser.net/study // @description Supercharges AnkiWeb. Currently Supported Functionality - Show card total, done and remaining count per session - Dark Mode // @namespace asleepysamurai.com // @license BSD Zero Clause License // ==/UserScript== function formatCounts(total, remaining){ const done = total - remaining return `${remaining} Left + ${done} Done = ${total}` } function addTotalCount(){ const counts = Array.from(document.querySelectorAll('.count')) const equals = document.createTextNode(' = ') const totalCards = counts.reduce((total, thisCount) => total + parseInt(thisCount.innerText), 0) const totalCount = counts[0].cloneNode(true) totalCount.innerText = formatCounts(totalCards, totalCards) totalCount.classList.remove('active', 'new', 'learn', 'review') const countParent = counts[0].parentElement countParent.appendChild(equals) countParent.appendChild(totalCount) const observer = new MutationObserver(() => { const restCards = counts.reduce((total, thisCount) => total + parseInt(thisCount.innerText), 0) totalCount.innerText = formatCounts(totalCards, restCards) }) counts.forEach(countNode => observer.observe(countNode, { characterData: true, attributes: false, childList: true, subtree: true })); } function setupObserver(){ try{ init() }catch(err){ setTimeout(() => { setupObserver() }, 100) } } function enableDarkMode(){ const style = document.documentElement.getAttribute('style') document.documentElement.setAttribute('style', `${style || ''}; filter: invert(0.9);`) } function updateBranding(){ document.querySelector('.navbar-brand > span').innerHTML = 'SuperAnki <small><small>v3</small></small>' } function init(){ updateBranding() enableDarkMode() addTotalCount() } setupObserver()