I’m just going to list what I’ve learned from reading the above:
- The “Custom scheduling” javascript is a monkey patch, while it runs the
states
object exists, butstates
is not accessible from the normal card design. - If we want to expose
states
, it can be injected directly into the HTML. (shown later) - I’m assuming
states
is not exposed on purpose to avoid API surface increase.
Custom scheduling:
// expose states
e = document.createElement("script")
e.text='var states='+JSON.stringify(states)
document.body.appendChild(e)
// add ankiState_* to body class, e.g. ankiState_new
ankiState = Object.keys(states.current.normal).shift()
document.body.classList.add('ankiState_'+ankiState)
Card template styling (untested):
body.ankiState_new .notifier::before {
content: 'NEW! ';
color: blue;
font-size: 60%;
white-space: pre;
}