Skip to content

Commit

Permalink
add link of visualizer and sponsor
Browse files Browse the repository at this point in the history
  • Loading branch information
L-M-Sherlock committed Jun 22, 2024
1 parent 0d51871 commit b7d4588
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
18 changes: 18 additions & 0 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,21 @@ def rate_on_ankiweb(did=None):

menu_rate = build_action(rate_on_ankiweb, "Rate Add-on on AnkiWeb")


def visualize_schedule(did=None):
openLink("https://open-spaced-repetition.github.io/anki_fsrs_visualizer/")


menu_visualize = build_action(visualize_schedule, "Visualize Your FSRS Schedule")


def sponsor(did=None):
openLink("https://github.com/sponsors/L-M-Sherlock")
config.has_sponsored = True


menu_sponsor = build_action(sponsor, "Sponsor the Author")

menu_for_helper = mw.form.menuTools.addMenu("FSRS4Anki Helper")
menu_for_helper.addAction(menu_auto_reschedule_after_sync)
menu_for_helper.addAction(menu_auto_disperse_after_sync)
Expand All @@ -181,8 +196,11 @@ def rate_on_ankiweb(did=None):
menu_for_helper.addAction(menu_disperse_siblings)
menu_for_helper.addSeparator()
menu_for_helper.addAction(menu_contact)
menu_for_helper.addAction(menu_visualize)
if not config.has_rated:
menu_for_helper.addAction(menu_rate)
if not config.has_sponsored:
menu_for_helper.addAction(menu_sponsor)


menu_apply_easy_days = build_action(easy_days, "Apply easy days now")
Expand Down
3 changes: 2 additions & 1 deletion config.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@
"fsrs_stats": true,
"display_memory_state": false,
"auto_easy_days": false,
"has_rated": false
"has_rated": false,
"has_sponsored": false
}
10 changes: 10 additions & 0 deletions configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
DISPLAY_MEMORY_STATE = "display_memory_state"
AUTO_EASY_DAYS = "auto_easy_days"
HAS_RATED = "has_rated"
HAS_SPONSORED = "has_sponsored"


def load_config():
Expand Down Expand Up @@ -177,3 +178,12 @@ def has_rated(self):
def has_rated(self, value):
self.data[HAS_RATED] = value
self.save()

@property
def has_sponsored(self):
return self.data[HAS_SPONSORED]

@has_sponsored.setter
def has_sponsored(self, value):
self.data[HAS_SPONSORED] = value
self.save()

0 comments on commit b7d4588

Please sign in to comment.