Forked from
pregmodfan / fc-pregmod
23432 commits behind the upstream repository.
textboxJS.js 771 B
/* Nicked off greyelf, works for replace textboxes */
window.setReplaceTextboxMaxLength = function(storyVarName, maxLength) {
const textboxId = `#textbox-${Util.slugify(storyVarName)}`;
$(textboxId)
.attr("maxlength", maxLength)
.css({
"min-width": "initial",
"width": `${maxLength}em`,
"padding": "3px 2px"
});
};
/* Nicked off TheMadExile, works for non-replace textboxes */
window.setTextboxMaxLength = function(storyVarName, maxLength) {
const textboxId = `#textbox-${Util.slugify(storyVarName)}`;
postdisplay[`${textboxId}-maxlength`] = function(taskName) {
delete postdisplay[taskName];
$(textboxId)
.attr("maxlength", maxLength)
.css({
"min-width": "initial",
"width": `${maxLength}em`,
"padding": "3px 2px"
});
};
};