corollari / ankiTab

Browser extension that replaces the new tab page with Anki flashcards
https://ankitab.com
The Unlicense
187 stars 16 forks source link

Add option/button to 'suspend' a flashcard #1

Closed mirandae closed 6 years ago

mirandae commented 6 years ago

It'd be nice to be able to suspend flashcards, if the Anki API allows for it

mirandae commented 6 years ago

^ I started taking a look at this but got stuck on the minified JS code -- do you have a link for the unminified versions of extension/app/index_files/tether.js & app.js? Thank you!

corollari commented 6 years ago

On the suspend button, I'll look into that right now and report back in a few hours.

About those minified files, I've taken them from ankiweb.net so I don't have the source. tether.js: This file just holds a copy of the tether.js library (which is used for Bootstrap tooltips), which is totally unnecessary so it can be safely deleted and the extension will work perfectly. I didn't delete it because of Chesterton's fence, the idea was to check more thoroughly if this library (and Boostrap.js) is used at any point and remove them if they are not. app.js: This file, which holds most of the business logic of the extension, is a slightly modified version of the file found on ankiweb. I've monkey-patched it in extended.js and applied the other patches just straight into the minified code. If you have any question about it, just ask freely.

By the way, sorry for the delay in my response, I hadn't setup github to notify me on new issues.

corollari commented 6 years ago

I haven't been able to find any API call on ankiweb that would allow the suspension of a card, so I'll have to take a different approach: As a temporary measure I will create a build for you with that feature added using AnkiConnect (an anki addon). I'm aware this isn't a good solution as it requires the user to have anki & the addon installed and running while inheriting the drawbacks of the ankiweb approach, thus this is the worst of both worlds. To remedy that there's two possible solutions:

mirandae commented 6 years ago

No worries at all! Thanks for the quick response - this was just a 'nice to have' request and I was planning on trying to add it myself otherwise :) You really don't have to make a special build for me -- I'm sure you have better things to do! I also appreciate the explanation for the minified stuff! My javascript is very basic so I got stuck pretty fast.

corollari commented 6 years ago

Not a problem, this is the first issue someone has ever opened in one of my repos, so I'm over the moon about it. About that build I told you about, you can find it on the suspend branch of this repo. To install it just load the extension unpacked into your browser and add the AnkiConnect addon to your anki installation. If you've got any other questions about the code or the ankiweb API (creating this extension involved a lot of reverse engineering that API, as it is undocumented) just open an issue or email me at me@albert.sh

corollari commented 6 years ago

Closing this issue as suspend buttons have been merged into master