[refactor] better modal heading string handling

This commit is contained in:
zombieFox 2020-06-14 16:57:04 +01:00
parent b7c80d12aa
commit 07d8c864f4
1 changed files with 5 additions and 0 deletions

View File

@ -2,6 +2,8 @@ var modal = (function() {
var _previousModal = null;
var _maxHeadingLength = 50;
var mod = {};
mod.open = function() {
@ -108,6 +110,9 @@ var modal = (function() {
modalControls.appendChild(cancelButton);
modalControls.appendChild(actionButton);
if (options.heading != null) {
if (options.heading.length > _maxHeadingLength) {
options.heading = options.heading.substring(0, _maxHeadingLength) + "...";
};
var modalHeading = helper.makeNode({
tag: "h1",
text: options.heading,