// ==UserScript== // @name Enhanced Ankiweb // @namespace Violentmonkey Scripts // @match https://ankiuser.net/study/ // @version 1.0 // @author ankiwanker // @grant GM_setValue // @grant GM_getValue // @grant GM_addStyle // @license MIT // @description Userscript that enhances the study page of Ankiweb with features and stuff // @downloadURL none // ==/UserScript== (() => { let zenMode = false class PsuedoAudioPlayer { constructor() { this.playing = false this.index = 0 this.audioElements = [] this.currentAudioElement = null } reset() { this.index = 0 this.audioElements = [] this.currentAudioElement = null } play() { this.playing = true this.setupListener() this.currentAudioElement.play() } playNext() { if (this.audioElements.length > this.index) { this.currentAudioElement = this.audioElements[this.index] this.index++ this.play() } } setupListener() { this.currentAudioElement.addEventListener("ended", () => { this.playing = false this.playNext() }, { once: true }) } } function log(...args) { console.log("[Enhanced Ankiweb]", ...args) } function showSettingsDialog() { // Create the dialog container const dialogContainer = document.createElement("div"); dialogContainer.style.position = "fixed"; dialogContainer.style.top = "50%"; dialogContainer.style.left = "50%"; dialogContainer.style.transform = "translate(-50%, -50%)"; dialogContainer.style.backgroundColor = "white"; dialogContainer.style.padding = "20px"; dialogContainer.style.border = "1px solid black"; dialogContainer.style.zIndex = "9999"; // Create the "Show only 'Again' and 'Good' buttons" option const showButtonsOption = document.createElement("div"); const showButtonsCheckbox = document.createElement("input"); showButtonsCheckbox.type = "checkbox"; showButtonsCheckbox.id = "showButtonsCheckbox"; showButtonsCheckbox.style = "margin-right: 5px;" showButtonsCheckbox.checked = GM_getValue("onlyAgainGoodButtons", true) const showButtonsLabel = document.createElement("label"); showButtonsLabel.innerText = "Show only 'Again' and 'Good' buttons ('Good' will be shown as 'Pass')"; showButtonsLabel.htmlFor = "showButtonsCheckbox"; showButtonsOption.appendChild(showButtonsCheckbox); showButtonsOption.appendChild(showButtonsLabel); // Create the "Bind keyboard keys to answer buttons" option const bindKeysOption = document.createElement("div"); const bindKeysCheckbox = document.createElement("input"); bindKeysCheckbox.type = "checkbox"; bindKeysCheckbox.id = "bindKeysCheckbox"; bindKeysCheckbox.style = "margin-right: 5px;" bindKeysCheckbox.checked = GM_getValue("bindKeyboardKeys", true) const bindKeysLabel = document.createElement("label"); bindKeysLabel.innerText = "Bind keyboard keys to answer buttons"; bindKeysLabel.htmlFor = "bindKeysCheckbox"; bindKeysOption.appendChild(bindKeysCheckbox); bindKeysOption.appendChild(bindKeysLabel); // Create the "Make