(el, options)
| 115 | // options.prepend - If the element should prepend |
| 116 | // all other messages (default = false) |
| 117 | const addMessageElement = (el, options) => { |
| 118 | const $el = $(el); |
| 119 | // Setup default options |
| 120 | if (!options) { |
| 121 | options = {}; |
| 122 | } |
| 123 | if (typeof options.fade === 'undefined') { |
| 124 | options.fade = true; |
| 125 | } |
| 126 | if (typeof options.prepend === 'undefined') { |
| 127 | options.prepend = false; |
| 128 | } |
| 129 | |
| 130 | // Apply options |
| 131 | if (options.fade) { |
| 132 | $el.hide().fadeIn(FADE_TIME); |
| 133 | } |
| 134 | if (options.prepend) { |
| 135 | $messages.prepend($el); |
| 136 | } else { |
| 137 | $messages.append($el); |
| 138 | } |
| 139 | |
| 140 | $messages[0].scrollTop = $messages[0].scrollHeight; |
| 141 | } |
| 142 | |
| 143 | // Prevents input from having injected markup |
| 144 | const cleanInput = (input) => { |
no test coverage detected