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