Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Commit 07d8c86

Browse files
committed
[refactor] better modal heading string handling
1 parent b7c80d1 commit 07d8c86

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/js/modal.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ var modal = (function() {
22

33
var _previousModal = null;
44

5+
var _maxHeadingLength = 50;
6+
57
var mod = {};
68

79
mod.open = function() {
@@ -108,6 +110,9 @@ var modal = (function() {
108110
modalControls.appendChild(cancelButton);
109111
modalControls.appendChild(actionButton);
110112
if (options.heading != null) {
113+
if (options.heading.length > _maxHeadingLength) {
114+
options.heading = options.heading.substring(0, _maxHeadingLength) + "...";
115+
};
111116
var modalHeading = helper.makeNode({
112117
tag: "h1",
113118
text: options.heading,

0 commit comments

Comments
 (0)