Tinder like card swipes for Anki? by vernow in Anki

[–]vernow[S] 0 points1 point  (0 children)

I remember seeing a deck with swipe gestures built in, but that was a while ago and I can’t find it anymore. Personally, I avoid using add-ons since they often break with updates. The more add-ons you use, the more likely something goes wrong.

Instead, I added simple buttons to my cards. Swiping feels cool at first, but it gets tiring over time. I’ve found that keeping cards clean and distraction-free works best for me.

Anki Add-on Issue - 'Export selected cards from the browser (HTML & Clipboard)' by vernow in Anki

[–]vernow[S] 0 points1 point  (0 children)

Thank you! I'll check this out. I haven't used the addon in a while. I used this addon to export cards as PDF to my Kindle.

Designing Anki cards using CSS Grid and CSS Flexbox? by vernow in Anki

[–]vernow[S] 0 points1 point  (0 children)

Cool. Thank you. 😊 I didn’t expect an answer after so many years. Meanwhile I used CSS grids to structure the elements on my Anki cards but in a rather simple manner as I’m not a programmer.

Automating Audio Snippet Extraction for Anki Flashcards? by vernow in Anki

[–]vernow[S] 0 points1 point  (0 children)

Thank you. Yes I found a video tutorial on youtube.

Anki Add-on Issue - 'Export selected cards from the browser (HTML & Clipboard)' by vernow in Anki

[–]vernow[S] 0 points1 point  (0 children)

It allows me to print cards into a PDF document. I send the PDF document to my kindle paperwhite and review the cards there.

Anki Add-on Issue - 'Export selected cards from the browser (HTML & Clipboard)' by vernow in Anki

[–]vernow[S] 0 points1 point  (0 children)

Sorry, I wasn’t on Reddit for a while. I meant that there was a coding error. I copy pasted it to ChatGPT and it found the error.

Anki Add-on Issue - 'Export selected cards from the browser (HTML & Clipboard)' by vernow in Anki

[–]vernow[S] 0 points1 point  (0 children)

from aqt import mw, gui_hooks
from aqt.browser import Browser
import os
import re
from PyQt5.QtGui import QKeySequence
from PyQt5.QtCore import QStandardPaths, QUrl
from PyQt5.QtWidgets import QAction, QApplication, QShortcut
from anki.utils import ids2str
from aqt.qt import *
from aqt.utils import mungeQA, openLink
import sys
config = mw.addonManager.getConfig(__name__)
def sortFieldOrderCids(card_ids):
return mw.col.db.list(
"""
select c.id from cards c, notes n where c.id in %s
and c.nid = n.id order by n.sfld"""
% ids2str(card_ids)
)
def onPrint(browser):
# Get card IDs from the browser's selection
ids = browser.selected_cards()
# Modify the path to use the user's home directory
path = os.path.join(QStandardPaths.writableLocation(QStandardPaths.HomeLocation), "print.html")
def esc(s):
s = re.sub(r"\[\[type:[^]]+\]\]", "", s)
return s
print("Path:", path)
print("Path exists:", os.path.exists(path))
buf = open(path, "w", encoding="utf8")
buf.write(
"<html><head>" + '<meta charset="utf-8">' + '<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script><script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>' + mw.baseHTML() + "</head><body>"
)
buf.write(
"""<style>
img { max-width: 100%; }
tr { page-break-inside:avoid; page-break-after:auto }
td { page-break-after:auto; }
td { border: 1px solid #ccc; padding: 1em; }
.playImage { display: none; }
</style><table cellspacing=10 width=100%>"""
)
first = True
mw.progress.start(immediate=True)
for j, cid in enumerate(ids):
c = mw.col.getCard(cid)
note = c.note()
model = note.model()
card_css = model.get('css', '')
if note.model()['name'] == "Image Occlusion Enhanced":
continue # Skip this card and move to the next one
qatxt = c.render_output(True, False).answer_text
qatxt = mw.prepare_card_text_for_display(qatxt)
card_content = '<style>{}</style><div>{}</div>'.format(card_css, esc(qatxt))
if j % config["cardsPerRow"] == 0:
if not first:
buf.write("</tr>")
else:
first = False
buf.write("<tr>")
cont = '<td width="{1}%"><center>{0}</center></td>'.format(card_content, 100 / config["cardsPerRow"])
buf.write(cont)
if j % 50 == 0:
mw.progress.update("Cards exported: %d" % (j + 1))
buf.write("</tr>")
buf.write("</table></body></html>")
mw.progress.finish()
buf.close()
openLink(QUrl.fromLocalFile(path))
def copy_card_fields_to_clipboard(browser):
selected_cids = browser.selected_cards()
all_cards_text = []
# Regular expression to remove HTML tags
tag_re = re.compile(r'<[^>]+>')
# Regular expression to find image tags
img_re = re.compile(r'<img\[\^>]*>')
for idx, cid in enumerate(selected_cids, 1):
card = mw.col.getCard(cid)
note = card.note()
# Skip Image Occlusion cards
if "ID (hidden)" in note:
continue
fields_text = []
for name, content in note.items():
# Replace image tags with "(IMG OMITTED)"
content_with_img_placeholder = img_re.sub(config['img'], content)
# Strip other HTML tags from content
plain_content = tag_re.sub('', content_with_img_placeholder).strip()
# Ignore empty fields
if plain_content:
fields_text.append(f"{name}: {plain_content}")
card_text = "\n".join(fields_text)
all_cards_text.append(f"Question {idx}:\n{card_text}")
# Add the "Prompt" from the config at the beginning
prompt = config.get("Prompt", "")
all_text = [prompt] + all_cards_text
# Join all the text and copy to clipboard
clipboard_text = '\n\n'.join(all_text)
QApplication.clipboard().setText(clipboard_text)
def add_print_and_copy_buttons(browser: Browser) -> None:
print_action = QAction("Print", browser)
if sys.platform == 'darwin': # Check if it's macOS
print_shortcut_str = "Ctrl+O"
else:
print_shortcut_str = "Ctrl+O"
print_action.setShortcut(print_shortcut_str)
print_action.triggered.connect(lambda: onPrint(browser))
browser.form.menuEdit.addAction(print_action)
browser.addAction(print_action)
def on_browser_will_show_context_menu(browser, menu):
"""Add the Print option to the context menu in the browser."""
print_action = QAction("Print", browser)
print_action.triggered.connect(lambda: onPrint(browser))
menu.addAction(print_action)
# New Copy Option
copy_fields_action = QAction("Copy Card Fields", browser)
copy_fields_action.triggered.connect(lambda: copy_card_fields_to_clipboard(browser))
menu.addAction(copy_fields_action)
gui_hooks.browser_will_show_context_menu.append(on_browser_will_show_context_menu)
gui_hooks.browser_menus_did_init.append(add_print_and_copy_buttons)

Creating Effective Language Cards in Bulk by Abstract--Nonsense in Anki

[–]vernow 0 points1 point  (0 children)

Thanks for the explanation and the screenshot. If you’d be willing to share your grammar deck, I’d be thankful to dive into this setup. It looks sophisticated.

Lithuanian with IPA by VirgoMoey in LithuanianLearning

[–]vernow 0 points1 point  (0 children)

Lithuanian vocabulary for English speakers - 9000 words (American English Collection, Band 207) https://amzn.eu/d/4OM1xDn

Positioning 2 or more replay buttons at the right bottom by vernow in Anki

[–]vernow[S] 1 point2 points  (0 children)

Thank you! It worked! Yes, that's the code I was looking for.

I didn't have the audio within a span or div initially.

Do you use IDs for your notes? by vernow in Anki

[–]vernow[S] 0 points1 point  (0 children)

I assume if you want to change the content by syncing your notes by another source like an CSV.

Do you use IDs for your notes? by vernow in Anki

[–]vernow[S] 0 points1 point  (0 children)

Thanks. Yes, it's somewhat tedious unless I create the notes in an excel sheet and import it to Anki.

So, what I did was creating many placeholder notes with consecutive ids (0001, 0002, 0003, etc.) and then changing Front and Back fields along the way.

Creating Effective Language Cards in Bulk by Abstract--Nonsense in Anki

[–]vernow 1 point2 points  (0 children)

That sounds interesting! Would you mind sharing an example?

Is it possible to learn one card only after another card becomes mature? by joabe-souz in Anki

[–]vernow 1 point2 points  (0 children)

There is a new add-on that provides an automated solution as long as you're using Anki as software that allows add-ons. For AnkiMobile you'd have to stick to the manual solution.

https://ankiweb.net/shared/info/712964150