6 0
Contact Author Sign in to rate

Asset Manager

0.43MB. Updated 2021-04-06. Only supports Anki 2.1.x.
The author has shared 13 other item(s).

Description

Asset Manager makes it easier for you to manage scripts on your note templates. Features You can use Asset Manager in two different ways:
  1. Manage JavaScript associated with a note type, and easily insert it into card types, or link against it. This will be the case if you do not enable the HTML Template functionality, but you do enable the JavaScript insertion. This will only add a segment to your card types, but not delete / remove anything. By disabling the Script Insertion, you can easily remove this segment again.
  2. Manage the complete card templates with it. This allows you to define HTML elements in your card templates in a component-wise structure. This will be the case if you do enable the HTML Template, in this case you should also enable the JavaScript Insertion. This will overwrite your templates, if carelessly executed, so be cautious when enabling it for the first time. It is very helpful, if you have many card types which are written in a formulaic way, and a change in one card type means you must also edit another card type.
Functionalites Script Tab Script Config Insert Stub: Exchanges the Div Element with an HTML stub. This makes it is easier to edit the card types, without having to scroll through all the JavaScript, but Asset Manager will still the remember the position in the document for the scripts to insert. Label (not depicted): Used to merge multiple code snippets into one script "unit", this takes effect for insertion positions "Into template", and "As External Script". The resulting script will adopt the name, version, and conditions from the uppermost snippet in the list. Insertion Positions: Insertion Conditions: HTML Tab HTML Config Labels: Labels identify your HTML "snippets", or "fragments". Insertion begins with the "Front" label for the frontside of the card, and "Back" for the backside of the card. When using a label like {{%MyLabel}} in the template, it will be replaced with a fragment with a label "MyLabel". Special Labels: There are multiple special labels defined, which you can use. These always start with a small letter: Insertion Conditions: Same as above. This way you can make a label {{%MyLabel}} be replaced with a different code snippet depending on the side of the card, or the card type name. For Developers Asset Manager offers a hook for you to insert your own JavaScript snippet via your own add-on. That way you can easily offer your script, give it a name, version it, and update it through the AnkiWeb platform, without making users have to care about pasting the JavaScript to their templates, copy the code to the media folder, etc. Examples include: Updates 2020-12-22: * Fix insertion as external file * Add support for syntax check * Add support for minified insertion * Add support for extra button "Assets..." in editor (can be turned on in the add-on settings) 2021-03-11: * Fix minification on Anki 2.1.41+ Support If you like my add-ons, you can consider supporting me. My add-ons will always be freely available for everybody, but what I can offer you is my sincere thanks, and first-hand technical support, if you have any questions/issues with my add-ons. At the same time it allows me to put more time and focus into developing these and making them as powerful and user-friendly as they are. Thanks for considering! ko-fi.com/hgiesel patreon.com/hgiesel

Download

As add-ons are programs downloaded from the internet, they are potentially malicious. You should only download add-ons you trust.

Supported Anki versions:

To download this add-on, please copy and paste the following code into Anki 2.1:

656021484

If you were linked to this page from the internet, please open Anki on your computer, go to the Tools menu and then Add-ons>Browse & Install to paste in the code.

All Anki 2.1.x Add-Ons Contact Author

Reviews

on 1606429221
Is there a way to add a script so that it can be activated on all other notes? because it would be interesting to add a script just once. Congratulations on the addon!
Comment from author
At the moment, the asset manager only works per note type. However it is a very common request to have this kind of feature. I will think about a way to implement this.
on 1605792255
Amazing!
on 1601133752
Sounds great!
on 1600947210
This is good thanks but I am struggling to work out the conditions, I want to add a script to just the second note type. Is this documented?
edit: I figured it out in the end.


Update: I shared a script for this addon as I here https://ankiweb.net/shared/info/1206316746
you have to follow a few instructions but it works.
Comment from author before post was edited
Hi. Great that you figured out yourself. I agree I need to add more documentation for the conditions section.
For anybody wondering the same: You could configure it like so: ["card", "=", "Card 2"] and it would only be inserted for the card type called "Card 2".
on 1600442838
It works and it is useful, though poorly documented, but the support from the author is great.
Regards,
https://forums.ankiweb.net/u/andr
on 1594481535
Working perfectly!!! Save a hell lot of time. ^^;
:]