From 07d8c864f4d2d26f2ac63ddd477fafbfb3a6a3a1 Mon Sep 17 00:00:00 2001 From: zombieFox Date: Sun, 14 Jun 2020 16:57:04 +0100 Subject: [PATCH] [refactor] better modal heading string handling --- src/js/modal.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/js/modal.js b/src/js/modal.js index d58f39ce..e4fd862b 100644 --- a/src/js/modal.js +++ b/src/js/modal.js @@ -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,