Merge branch 'united' into mkultra
This commit is contained in:
commit
1e9f0e68a0
|
@ -3855,7 +3855,6 @@ def get_message(msg):
|
|||
emit(
|
||||
'from_server',
|
||||
{'cmd': 'showfieldbudget', 'data': {"length": None, "max": None, "field": field}},
|
||||
broadcast=True
|
||||
)
|
||||
return
|
||||
|
||||
|
|
|
@ -274,6 +274,17 @@ gensettingstf = [
|
|||
"default": 0,
|
||||
"tooltip": "Shows token selection probabilities. Does not work with more than one gens per action."
|
||||
},
|
||||
{
|
||||
"uitype": "toggle",
|
||||
"unit": "bool",
|
||||
"label": "Show Field Budget",
|
||||
"id": "setshowbudget",
|
||||
"min": 0,
|
||||
"max": 1,
|
||||
"step": 1,
|
||||
"default": 0,
|
||||
"tooltip": "Shows token usage when typing in relevant text boxes. <b>May lag slower devices.</b>"
|
||||
},
|
||||
]
|
||||
|
||||
gensettingsik =[{
|
||||
|
|
|
@ -241,8 +241,27 @@ function addSetting(ob) {
|
|||
if(ob.id == "setadventure"){
|
||||
setadventure($(this).prop('checked'));
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
if (ob.id === "setshowbudget") {
|
||||
$("#setshowbudget").on("change", function () {
|
||||
for (const el of document.getElementsByClassName("input-token-usage")) {
|
||||
if (this.checked) {
|
||||
el.classList.remove("hidden");
|
||||
} else {
|
||||
el.classList.add("hidden");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (!$("#input-token-usage")[0].checked) {
|
||||
for (const el of document.getElementsByClassName("input-token-usage")) {
|
||||
el.classList.add("hidden");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function refreshTitle() {
|
||||
|
@ -2165,6 +2184,9 @@ function interpolateRGB(color0, color1, t) {
|
|||
}
|
||||
|
||||
function updateInputBudget(inputElement) {
|
||||
let budgetElement = document.getElementById("setshowbudget");
|
||||
if (budgetElement && !budgetElement.checked) return;
|
||||
|
||||
let data = {"unencoded": inputElement.value, "field": inputElement.id};
|
||||
|
||||
if (inputElement.id === "anoteinput") {
|
||||
|
@ -2182,7 +2204,6 @@ function registerTokenCounters() {
|
|||
|
||||
let span = document.createElement("span");
|
||||
span.classList.add("input-token-usage");
|
||||
span.innerText = "?/? Tokens";
|
||||
el.appendChild(span);
|
||||
|
||||
let inputElement = el.querySelector("input, textarea");
|
||||
|
|
Loading…
Reference in New Issue