Skip to content

Runtime Options

Runtime options are card options that are applied globally to all JPMN cards. This differs from binary fields, as binary options are options that only affects the one note.


Accessing & Editing

To access the runtime options, navigate to your profile's media folder, and open the _jpmn-options.js file as a text file.

The contents of the file should look something like the following:

var JPMNOpts = (function (my) {
  my.settings = {
    // ... (a bunch of settings)
  }
  return my;
}(JPMNOpts || {}));

Note

To open the file as a text file on Windows, right click the file and select Edit. Do not double-click the file.

TODO add demo for windows to opening the file & editing


Special Option Values

New in version 0.11.0.0 (latest version: 0.11.0.4)

All runtime options can take special values, which are always formatted as the following:

{
  "type": "IDENTIFIER_STRING",
  // other options ...
},

For example, take any key-value pair, such as:

"enabled": true,

This can be changed to:

"enabled": {
  "type": "..."
  // other options...
},


pc-mobile Type

New in version 0.11.0.0 (latest version: 0.11.0.4)

The pc-mobile type allows you to specify different values depending if you are using Anki on a mobile device, or PC (non-mobile).

This is formatted as the following:

{
  "type": "pc-mobile",
  "pc": VALUE_FOR_PC,
  "mobile": VALUE_FOR_MOBILE
},
Example (click here)

Take a sample key-value pair:

"enabled": true,

The value can be changed to be true for PC, and false for mobile.

"enabled": {
  "type": "pc-mobile",
  "pc": true,
  "mobile": false
},


viewport-width-is Type

New in version 0.11.0.0 (latest version: 0.11.0.4)

The viewport-width-is type allows you to specify different values depending on the screen width. Note that the viewport width is read for each card flip. This means that viewport width changes after resizing a window will not be detected, and will only be updated when you flip the side or go to a new card.

This is formatted as the following:

{
  "type": "viewport-width-is",
  "value": AN_INTEGER, // measured in pixels
  "greater": VALUE_FOR_GREATER, // the value used if the current width is greater than "value"
  "lesser": VALUE_FOR_LESSER // the value used if the current width is lesser than (or equal to) "value"
},
Example (click here)

This will enable pa-indicator-color-quotes on screens that have a viewport width of 1300 pixels or less.

"pa-indicator-color-quotes": {
  "type": "viewport-width-is",
  "value": 1300,
  "greater": false,
  "lesser": true
},

Troubleshooting

TODO record specific errors

If you have any error, or an option is simply not working, please check the following:

  1. There are commas and double-quotes in the correct places.

    Example (click here)
    "add-image-if-contains-tags": [
      {
        "tags": ["sample_tag"], // <-- HERE
        "file-name": "_sample_image.png"
      }, // <-- HERE
      {
        "tags": ["something", "something2"], // <-- HERE
        "file-name": "_contains_both_tags.png"
      }
    ], // <-- HERE
    
    // ...
    
  2. If a runtime option is not working, ensure that the runtime options file is updated. The option may have been renamed or repositioned.

  3. If an error is saying that an option doesn't exist, just like for the above, ensure that the runtime options file is updated.


Last update: November 23, 2022