Update author's template effect token usage live

This commit is contained in:
somebody
2022-08-11 18:38:29 -05:00
parent c21c1e3dc0
commit 6ac970b1c0
2 changed files with 15 additions and 5 deletions

View File

@ -2151,7 +2151,13 @@ function interpolateRGB(color0, color1, t) {
}
function updateInputBudget(inputElement) {
socket.send({"cmd": "getfieldbudget", "data": {"unencoded": inputElement.value, "field": inputElement.id}});
let data = {"unencoded": inputElement.value, "field": inputElement.id};
if (inputElement.id === "anoteinput") {
data["anotetemplate"] = $("#anotetemplate").val();
}
socket.send({"cmd": "getfieldbudget", "data": data});
}
function registerTokenCounters() {
@ -3430,6 +3436,10 @@ $(document).ready(function(){
if (handled) ev.preventDefault();
});
$("#anotetemplate").on("input", function() {
updateInputBudget(anote_input[0]);
})
registerTokenCounters();
updateInputBudget(input_text[0]);