AnkiHub conflicts with the Advanced Review Bottom Bar extension

AnkiHub conflicts with the Advanced Review Bottom Bar extension (https://ankiweb.net/shared/info/1136455830) by drawing the “View on AnkiHub” button separately:

I can remove the button by editing the code in the AnkiHub extension:

❯ diff reviewer_og.py reviewer.py --context=2
*** reviewer_og.py
--- reviewer.py
***************
*** 317,322 ****
          reviewer_did_show_question.append(_notify_reviewer_buttons_of_card_change)
          reviewer_did_show_question.append(_notify_resource_tabs_of_card_change)
-         reviewer_did_show_question.append(_remove_anking_button)
-         reviewer_did_show_answer.append(_remove_anking_button)
  
          _setup_sidebar_update_on_config_close()
--- 317,320 ----
***************
*** 345,349 ****
      """Adds the "View on AnkiHub" button to the reviewer toolbar if it doesn't exist yet,
      or refreshes it if it does exist already."""
-     return
  
      if not aqt.mw.reviewer or not aqt.mw.reviewer.bottom or not aqt.mw.reviewer.bottom.web:
--- 343,346 ----

Is there a better way to hide this button so it works with the addon?

I’ll help you find a solution for hiding the “View on AnkiHub” button while maintaining compatibility with the Advanced Review Bottom Bar extension. Let me search for any related discussions in the community.

Search

Found 6 results for 'tags:official ankihub review bottom bar button hide'

Search

Found 5 results for 'tags:official ankihub settings option hide button'

Read topic

Reading: ⚙️ AnkiHub Addon Menu

Search

Found 5 results for 'tags:official ankihub addon config view button'

Hi Mechanical Penguin,

I understand you’re experiencing a conflict between the AnkiHub add-on and the Advanced Review Bottom Bar extension. The “View on AnkiHub” button is appearing separately from the bottom bar, causing layout issues.

After reviewing the documentation, I don’t see a built-in setting in the AnkiHub add-on to specifically hide or relocate this button through the user interface. The current configuration options for AnkiHub (found in AnkiHub → Config → Advanced) don’t include a setting to toggle the visibility of this button.

Your solution of editing the add-on code is actually a good approach in this situation. The modifications you’ve made:

  1. Removing the call to _remove_anking_button function
  2. Adding a return statement in the function that adds the “View on AnkiHub” button

These changes effectively prevent the button from being displayed without breaking the core functionality of the AnkiHub add-on.

However, keep in mind that this manual edit will need to be redone if the AnkiHub add-on updates in the future. You might want to save your modified code somewhere so you can quickly reapply the changes after updates.

If you encounter any issues with this approach, I would recommend reaching out to the AnkiHub team through the “Get Help” option (AnkiHub → Help → Get Help) to request an official setting to toggle this button in a future update.

You can use this code as a separate add-on to hide the button:

from aqt import gui_hooks
from aqt.reviewer import ReviewerBottomBar

def on_webview_will_set_content(web_content, context) -> None:
    if not isinstance(context, ReviewerBottomBar):
        return
    web_content.body += "<style>#ankihub-view-note-button {display: none;}</style>"

gui_hooks.webview_will_set_content.append(on_webview_will_set_content)

Save it to a file named __init__.py and put it in a subfolder in your add-ons folder: Add-on Folders - Writing Anki Add-ons

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.