Nils Diewald | 19ccee9 | 2014-12-08 11:30:08 +0000 | [diff] [blame] | 1 | /** |
Nils Diewald | 5c5a747 | 2015-04-02 22:13:38 +0000 | [diff] [blame] | 2 | * Hint menu for Kalamar. |
Nils Diewald | 47f366b | 2015-04-15 20:06:35 +0000 | [diff] [blame] | 3 | * Based on menu object. |
Nils Diewald | 19ccee9 | 2014-12-08 11:30:08 +0000 | [diff] [blame] | 4 | * |
| 5 | * @author Nils Diewald |
| 6 | */ |
Akron | 308db38 | 2016-05-30 22:34:07 +0200 | [diff] [blame] | 7 | /* |
Akron | 65c7435 | 2016-09-02 17:23:39 +0200 | [diff] [blame] | 8 | * TODO: Check for cnx/syn= |
Akron | 308db38 | 2016-05-30 22:34:07 +0200 | [diff] [blame] | 9 | * TODO: List can be shown when prefix is like 'base/s=pcorenlp/' |
| 10 | * TODO: Sometimes the drop-down box down vanish when list is shown |
| 11 | * TODO: Create should expect an input text field |
| 12 | * TODO: Embed only one single menu (not multiple) |
Akron | 02360e4 | 2016-06-07 13:41:12 +0200 | [diff] [blame] | 13 | * By holding the current menu in _active |
| 14 | * TODO: show() should accept a context field (especially for no-context fields, |
| 15 | * like fragments) |
| 16 | * TODO: Improve context analyzer from hint! |
| 17 | * TODO: Marked annotations should be addable to "fragments" |
Akron | 308db38 | 2016-05-30 22:34:07 +0200 | [diff] [blame] | 18 | */ |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 19 | define([ |
| 20 | 'hint/input', |
| 21 | 'hint/menu', |
| 22 | 'hint/contextanalyzer', |
Akron | 00cd4d1 | 2016-05-31 21:01:11 +0200 | [diff] [blame] | 23 | 'hint/alert', |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 24 | 'util' |
| 25 | ], function (inputClass, |
Akron | 00cd4d1 | 2016-05-31 21:01:11 +0200 | [diff] [blame] | 26 | menuClass, |
| 27 | analyzerClass, |
| 28 | alertClass) { |
Nils Diewald | 19ccee9 | 2014-12-08 11:30:08 +0000 | [diff] [blame] | 29 | "use strict"; |
| 30 | |
Nils Diewald | 19ccee9 | 2014-12-08 11:30:08 +0000 | [diff] [blame] | 31 | /** |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 32 | * Return keycode based on event |
| 33 | */ |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 34 | |
| 35 | // Initialize hint array |
Nils Diewald | 5c5a747 | 2015-04-02 22:13:38 +0000 | [diff] [blame] | 36 | |
| 37 | /** |
| 38 | * KorAP.Hint.create({ |
| 39 | * inputField : node, |
| 40 | * context : context regex |
| 41 | * }); |
| 42 | */ |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 43 | return { |
Nils Diewald | 5c5a747 | 2015-04-02 22:13:38 +0000 | [diff] [blame] | 44 | |
| 45 | // Some variables |
| 46 | // _firstTry : true, |
Akron | 00cd4d1 | 2016-05-31 21:01:11 +0200 | [diff] [blame] | 47 | // active : false, |
Nils Diewald | 5c5a747 | 2015-04-02 22:13:38 +0000 | [diff] [blame] | 48 | |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 49 | /** |
| 50 | * Create new hint helper. |
| 51 | */ |
Nils Diewald | 5c5a747 | 2015-04-02 22:13:38 +0000 | [diff] [blame] | 52 | create : function (param) { |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 53 | return Object.create(this)._init(param); |
Nils Diewald | 5c5a747 | 2015-04-02 22:13:38 +0000 | [diff] [blame] | 54 | }, |
| 55 | |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 56 | // Initialize hint helper |
Nils Diewald | 5c5a747 | 2015-04-02 22:13:38 +0000 | [diff] [blame] | 57 | _init : function (param) { |
| 58 | param = param || {}; |
| 59 | |
| 60 | // Holds all menus per prefix context |
Akron | 00cd4d1 | 2016-05-31 21:01:11 +0200 | [diff] [blame] | 61 | this._menu = {}; |
| 62 | this._alert = alertClass.create(); |
Akron | 02360e4 | 2016-06-07 13:41:12 +0200 | [diff] [blame] | 63 | this._active = null; |
Nils Diewald | 5c5a747 | 2015-04-02 22:13:38 +0000 | [diff] [blame] | 64 | |
Akron | 8005599 | 2017-12-20 16:30:52 +0100 | [diff] [blame] | 65 | // No annotation helper available |
| 66 | if (!KorAP.annotationHelper) { |
| 67 | console.log("No annotationhelper defined"); |
| 68 | return; |
| 69 | }; |
Akron | fac1647 | 2018-07-26 16:47:21 +0200 | [diff] [blame] | 70 | |
| 71 | /** |
| 72 | * @define {regex} Regular expression for context |
| 73 | */ |
| 74 | KorAP.context = KorAP.context || |
| 75 | "(?:^|[^-_a-zA-Z0-9])" + // Anchor |
| 76 | "((?:[-_a-zA-Z0-9]+?)\/" + // Foundry |
| 77 | "(?:" + |
| 78 | "(?:[-_a-zA-Z0-9]+?)=" + // Layer |
| 79 | "(?:"+ |
| 80 | "(?:[^:=\/ ]+?):|" + // Key |
| 81 | "(?:[^-=\/ ]+?)-" + // Node |
| 82 | ")?" + |
| 83 | ")?" + |
| 84 | ")$"; |
Akron | 8005599 | 2017-12-20 16:30:52 +0100 | [diff] [blame] | 85 | |
Nils Diewald | 5c5a747 | 2015-04-02 22:13:38 +0000 | [diff] [blame] | 86 | // Get input field |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 87 | var qfield = param["inputField"] || document.getElementById("q-field"); |
| 88 | if (!qfield) |
Akron | 8eaeb2e | 2016-08-29 18:26:28 +0200 | [diff] [blame] | 89 | return null; |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 90 | |
Akron | 00cd4d1 | 2016-05-31 21:01:11 +0200 | [diff] [blame] | 91 | // Create input field |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 92 | this._inputField = inputClass.create(qfield); |
Nils Diewald | 5c5a747 | 2015-04-02 22:13:38 +0000 | [diff] [blame] | 93 | |
| 94 | var inputFieldElement = this._inputField.element(); |
| 95 | |
Akron | 00cd4d1 | 2016-05-31 21:01:11 +0200 | [diff] [blame] | 96 | var c = this._inputField.container(); |
Nils Diewald | 5c5a747 | 2015-04-02 22:13:38 +0000 | [diff] [blame] | 97 | |
Akron | 00cd4d1 | 2016-05-31 21:01:11 +0200 | [diff] [blame] | 98 | // create alert |
| 99 | c.appendChild(this._alert.element()); |
| 100 | |
Akron | 00cd4d1 | 2016-05-31 21:01:11 +0200 | [diff] [blame] | 101 | var that = this; |
Nils Diewald | 5c5a747 | 2015-04-02 22:13:38 +0000 | [diff] [blame] | 102 | |
Nils Diewald | 47f366b | 2015-04-15 20:06:35 +0000 | [diff] [blame] | 103 | this._inputField.container().addEventListener('click', function (e) { |
Akron | 8eaeb2e | 2016-08-29 18:26:28 +0200 | [diff] [blame] | 104 | if (!this.classList.contains('active')) { |
| 105 | that.show(false); |
| 106 | }; |
Nils Diewald | 47f366b | 2015-04-15 20:06:35 +0000 | [diff] [blame] | 107 | }); |
| 108 | |
Akron | 00cd4d1 | 2016-05-31 21:01:11 +0200 | [diff] [blame] | 109 | var _down = function (e) { |
Akron | 8eaeb2e | 2016-08-29 18:26:28 +0200 | [diff] [blame] | 110 | var code = _codeFromEvent(e); |
| 111 | if (code === 40) { |
| 112 | this.show(false); |
| 113 | e.halt(); |
| 114 | }; |
Nils Diewald | 47f366b | 2015-04-15 20:06:35 +0000 | [diff] [blame] | 115 | }; |
Akron | 8eaeb2e | 2016-08-29 18:26:28 +0200 | [diff] [blame] | 116 | |
Nils Diewald | 47f366b | 2015-04-15 20:06:35 +0000 | [diff] [blame] | 117 | // Move infobox |
Akron | 00cd4d1 | 2016-05-31 21:01:11 +0200 | [diff] [blame] | 118 | inputFieldElement.addEventListener("keyup", this.update.bind(this)); |
| 119 | inputFieldElement.addEventListener("click", this.update.bind(this)); |
| 120 | |
| 121 | // Add event listener for key pressed down |
| 122 | inputFieldElement.addEventListener( |
Akron | 8eaeb2e | 2016-08-29 18:26:28 +0200 | [diff] [blame] | 123 | "keydown", _down.bind(this), false |
Akron | 00cd4d1 | 2016-05-31 21:01:11 +0200 | [diff] [blame] | 124 | ); |
Nils Diewald | 5c5a747 | 2015-04-02 22:13:38 +0000 | [diff] [blame] | 125 | |
| 126 | // Set Analyzer for context |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 127 | this._analyzer = analyzerClass.create( |
Akron | 8eaeb2e | 2016-08-29 18:26:28 +0200 | [diff] [blame] | 128 | param["context"] || KorAP.context |
Nils Diewald | 5c5a747 | 2015-04-02 22:13:38 +0000 | [diff] [blame] | 129 | ); |
Nils Diewald | 19ccee9 | 2014-12-08 11:30:08 +0000 | [diff] [blame] | 130 | return this; |
| 131 | }, |
| 132 | |
Akron | 308db38 | 2016-05-30 22:34:07 +0200 | [diff] [blame] | 133 | |
| 134 | /** |
| 135 | * Return the input field attached to the hint helper. |
| 136 | */ |
Nils Diewald | 5c5a747 | 2015-04-02 22:13:38 +0000 | [diff] [blame] | 137 | inputField : function () { |
| 138 | return this._inputField; |
| 139 | }, |
Nils Diewald | 19ccee9 | 2014-12-08 11:30:08 +0000 | [diff] [blame] | 140 | |
Akron | 308db38 | 2016-05-30 22:34:07 +0200 | [diff] [blame] | 141 | |
| 142 | /** |
| 143 | * Altert at a specific character position. |
| 144 | */ |
Akron | 00cd4d1 | 2016-05-31 21:01:11 +0200 | [diff] [blame] | 145 | alert : function (charPos, msg) { |
| 146 | |
| 147 | if (arguments.length === 0) |
Akron | 8eaeb2e | 2016-08-29 18:26:28 +0200 | [diff] [blame] | 148 | return this._alert; |
Akron | 00cd4d1 | 2016-05-31 21:01:11 +0200 | [diff] [blame] | 149 | |
| 150 | // Do not alert if already alerted! |
| 151 | if (this._alert.active) |
Akron | 8eaeb2e | 2016-08-29 18:26:28 +0200 | [diff] [blame] | 152 | return false; |
Akron | 00cd4d1 | 2016-05-31 21:01:11 +0200 | [diff] [blame] | 153 | |
| 154 | // Move to the correct position |
Akron | 308db38 | 2016-05-30 22:34:07 +0200 | [diff] [blame] | 155 | this._inputField.moveto(charPos); |
Akron | 00cd4d1 | 2016-05-31 21:01:11 +0200 | [diff] [blame] | 156 | |
| 157 | // Set container to active (aka hide the hint helper button) |
| 158 | |
| 159 | this._alert.show(msg); |
Akron | 02360e4 | 2016-06-07 13:41:12 +0200 | [diff] [blame] | 160 | this.active(this._alert); |
Akron | 00cd4d1 | 2016-05-31 21:01:11 +0200 | [diff] [blame] | 161 | return true; |
Akron | 308db38 | 2016-05-30 22:34:07 +0200 | [diff] [blame] | 162 | }, |
Akron | 8eaeb2e | 2016-08-29 18:26:28 +0200 | [diff] [blame] | 163 | |
Akron | 00cd4d1 | 2016-05-31 21:01:11 +0200 | [diff] [blame] | 164 | _unshowAlert : function () { |
Akron | 02360e4 | 2016-06-07 13:41:12 +0200 | [diff] [blame] | 165 | this._alert.hide(); |
| 166 | this.active(null); |
Akron | 00cd4d1 | 2016-05-31 21:01:11 +0200 | [diff] [blame] | 167 | }, |
| 168 | |
| 169 | update : function () { |
| 170 | this._inputField.update(); |
Akron | 02360e4 | 2016-06-07 13:41:12 +0200 | [diff] [blame] | 171 | if (this._alert.hide()) |
Akron | 8eaeb2e | 2016-08-29 18:26:28 +0200 | [diff] [blame] | 172 | this.active(null); |
Akron | 00cd4d1 | 2016-05-31 21:01:11 +0200 | [diff] [blame] | 173 | }, |
| 174 | |
| 175 | |
Nils Diewald | 5c5a747 | 2015-04-02 22:13:38 +0000 | [diff] [blame] | 176 | /** |
Nils Diewald | 5c5a747 | 2015-04-02 22:13:38 +0000 | [diff] [blame] | 177 | * Return hint menu and probably init based on an action |
| 178 | */ |
| 179 | menu : function (action) { |
Nils Diewald | 5c5a747 | 2015-04-02 22:13:38 +0000 | [diff] [blame] | 180 | if (this._menu[action] === undefined) { |
| 181 | |
Akron | 8eaeb2e | 2016-08-29 18:26:28 +0200 | [diff] [blame] | 182 | // No matching hint menu |
Akron | e91da78 | 2017-12-15 17:17:50 +0100 | [diff] [blame] | 183 | if (KorAP.annotationHelper[action] === undefined) |
Akron | 8eaeb2e | 2016-08-29 18:26:28 +0200 | [diff] [blame] | 184 | return; |
Nils Diewald | 5c5a747 | 2015-04-02 22:13:38 +0000 | [diff] [blame] | 185 | |
Akron | 8eaeb2e | 2016-08-29 18:26:28 +0200 | [diff] [blame] | 186 | // Create matching hint menu |
| 187 | this._menu[action] = menuClass.create( |
Akron | e91da78 | 2017-12-15 17:17:50 +0100 | [diff] [blame] | 188 | this, action, KorAP.annotationHelper[action] |
Akron | 8eaeb2e | 2016-08-29 18:26:28 +0200 | [diff] [blame] | 189 | ); |
Nils Diewald | 5c5a747 | 2015-04-02 22:13:38 +0000 | [diff] [blame] | 190 | }; |
| 191 | |
| 192 | // Return matching hint menu |
| 193 | return this._menu[action]; |
| 194 | }, |
| 195 | |
| 196 | /** |
| 197 | * Get the correct menu based on the context |
| 198 | */ |
| 199 | contextMenu : function (ifContext) { |
Akron | 1a5a587 | 2016-09-05 20:17:14 +0200 | [diff] [blame] | 200 | |
Akron | 02360e4 | 2016-06-07 13:41:12 +0200 | [diff] [blame] | 201 | // Get context (aka left text) |
Nils Diewald | 5c5a747 | 2015-04-02 22:13:38 +0000 | [diff] [blame] | 202 | var context = this._inputField.context(); |
Akron | ee9ef4a | 2016-06-03 12:50:08 +0200 | [diff] [blame] | 203 | |
Akron | 65c7435 | 2016-09-02 17:23:39 +0200 | [diff] [blame] | 204 | if (context === undefined || context.length === 0) { |
Akron | 1a5a587 | 2016-09-05 20:17:14 +0200 | [diff] [blame] | 205 | return ifContext ? undefined : this.menu("-"); |
Akron | 65c7435 | 2016-09-02 17:23:39 +0200 | [diff] [blame] | 206 | }; |
Nils Diewald | 5c5a747 | 2015-04-02 22:13:38 +0000 | [diff] [blame] | 207 | |
Akron | 02360e4 | 2016-06-07 13:41:12 +0200 | [diff] [blame] | 208 | // Get context (aka left text matching regex) |
Nils Diewald | 5c5a747 | 2015-04-02 22:13:38 +0000 | [diff] [blame] | 209 | context = this._analyzer.test(context); |
Akron | ee9ef4a | 2016-06-03 12:50:08 +0200 | [diff] [blame] | 210 | |
Akron | 1a5a587 | 2016-09-05 20:17:14 +0200 | [diff] [blame] | 211 | if (context === undefined || context.length == 0) { |
Akron | 8eaeb2e | 2016-08-29 18:26:28 +0200 | [diff] [blame] | 212 | return ifContext ? undefined : this.menu("-"); |
Akron | 1a5a587 | 2016-09-05 20:17:14 +0200 | [diff] [blame] | 213 | }; |
Nils Diewald | 5c5a747 | 2015-04-02 22:13:38 +0000 | [diff] [blame] | 214 | |
Akron | 1a5a587 | 2016-09-05 20:17:14 +0200 | [diff] [blame] | 215 | return this.menu(context) || (ifContext ? undefined : this.menu('-')); |
Nils Diewald | 5c5a747 | 2015-04-02 22:13:38 +0000 | [diff] [blame] | 216 | }, |
| 217 | |
Akron | 8eaeb2e | 2016-08-29 18:26:28 +0200 | [diff] [blame] | 218 | /** |
| 219 | * Activate a certain menu. |
| 220 | * If a menu is passed, the menu will be activated. |
| 221 | * If null is passed, the active menu will be deactivated. |
| 222 | * If nothing is passed, returns the active menu. |
| 223 | */ |
Akron | 02360e4 | 2016-06-07 13:41:12 +0200 | [diff] [blame] | 224 | active : function (obj) { |
Akron | 8eaeb2e | 2016-08-29 18:26:28 +0200 | [diff] [blame] | 225 | |
| 226 | // A menu or null was passed |
Akron | 00cd4d1 | 2016-05-31 21:01:11 +0200 | [diff] [blame] | 227 | if (arguments.length === 1) { |
Akron | 8eaeb2e | 2016-08-29 18:26:28 +0200 | [diff] [blame] | 228 | var c = this._inputField.container(); |
| 229 | |
| 230 | // Make the menu active |
| 231 | if (obj !== null) { |
| 232 | c.classList.add('active'); |
| 233 | this._active = obj; |
| 234 | } |
| 235 | |
| 236 | // Make the menu inactive |
| 237 | else { |
| 238 | c.classList.remove('active'); |
| 239 | this._active = null; |
| 240 | } |
Akron | 00cd4d1 | 2016-05-31 21:01:11 +0200 | [diff] [blame] | 241 | }; |
Akron | 8eaeb2e | 2016-08-29 18:26:28 +0200 | [diff] [blame] | 242 | |
| 243 | // Return |
Akron | 00cd4d1 | 2016-05-31 21:01:11 +0200 | [diff] [blame] | 244 | return this._active; |
| 245 | }, |
| 246 | |
Nils Diewald | 5c5a747 | 2015-04-02 22:13:38 +0000 | [diff] [blame] | 247 | |
| 248 | /** |
Akron | 308db38 | 2016-05-30 22:34:07 +0200 | [diff] [blame] | 249 | * Show the menu. |
Akron | 65c7435 | 2016-09-02 17:23:39 +0200 | [diff] [blame] | 250 | * Remove all old menus. |
Akron | 02360e4 | 2016-06-07 13:41:12 +0200 | [diff] [blame] | 251 | * |
| 252 | * @param {boolean} Boolean value to indicate if context |
| 253 | * is necessary (true) or if the main context should |
| 254 | * be shown if context fails. |
| 255 | * |
Nils Diewald | 5c5a747 | 2015-04-02 22:13:38 +0000 | [diff] [blame] | 256 | */ |
| 257 | show : function (ifContext) { |
| 258 | |
Akron | 1a5a587 | 2016-09-05 20:17:14 +0200 | [diff] [blame] | 259 | // Remove the active object |
| 260 | this._unshow(); |
Akron | e39cc86 | 2018-04-25 15:16:11 +0200 | [diff] [blame] | 261 | |
Nils Diewald | 5c5a747 | 2015-04-02 22:13:38 +0000 | [diff] [blame] | 262 | // Get the menu |
| 263 | var menu; |
| 264 | if (menu = this.contextMenu(ifContext)) { |
Akron | 8eaeb2e | 2016-08-29 18:26:28 +0200 | [diff] [blame] | 265 | this.active(menu); |
Akron | 02360e4 | 2016-06-07 13:41:12 +0200 | [diff] [blame] | 266 | |
Akron | 1a5a587 | 2016-09-05 20:17:14 +0200 | [diff] [blame] | 267 | var c = this._inputField.container(); |
Akron | 8eaeb2e | 2016-08-29 18:26:28 +0200 | [diff] [blame] | 268 | c.appendChild(menu.element()); |
| 269 | menu.show(); |
| 270 | menu.focus(); |
| 271 | // Focus on input field |
| 272 | // this.inputField.element.focus(); |
Akron | 65c7435 | 2016-09-02 17:23:39 +0200 | [diff] [blame] | 273 | } |
| 274 | else { |
| 275 | this._inputField.element().focus(); |
Nils Diewald | 19ccee9 | 2014-12-08 11:30:08 +0000 | [diff] [blame] | 276 | }; |
Akron | 00cd4d1 | 2016-05-31 21:01:11 +0200 | [diff] [blame] | 277 | }, |
Akron | 8eaeb2e | 2016-08-29 18:26:28 +0200 | [diff] [blame] | 278 | |
Akron | 02360e4 | 2016-06-07 13:41:12 +0200 | [diff] [blame] | 279 | // This will get the context of the field |
| 280 | getContext : function () {}, |
| 281 | |
Akron | 8eaeb2e | 2016-08-29 18:26:28 +0200 | [diff] [blame] | 282 | /** |
| 283 | * Deactivate the current menu and focus on the input field. |
| 284 | */ |
Akron | 65c7435 | 2016-09-02 17:23:39 +0200 | [diff] [blame] | 285 | unshow_old : function () { |
Akron | 02360e4 | 2016-06-07 13:41:12 +0200 | [diff] [blame] | 286 | this.active(null); |
Akron | 00cd4d1 | 2016-05-31 21:01:11 +0200 | [diff] [blame] | 287 | this.inputField().element().focus(); |
Akron | 65c7435 | 2016-09-02 17:23:39 +0200 | [diff] [blame] | 288 | }, |
| 289 | |
| 290 | /** |
| 291 | * Deactivate the current menu and focus on the input field. |
| 292 | */ |
| 293 | unshow : function () { |
Akron | 1a5a587 | 2016-09-05 20:17:14 +0200 | [diff] [blame] | 294 | this._unshow(); |
| 295 | this._inputField.element().focus(); |
| 296 | }, |
Akron | 65c7435 | 2016-09-02 17:23:39 +0200 | [diff] [blame] | 297 | |
Akron | 1a5a587 | 2016-09-05 20:17:14 +0200 | [diff] [blame] | 298 | |
| 299 | _unshow : function () { |
Akron | 65c7435 | 2016-09-02 17:23:39 +0200 | [diff] [blame] | 300 | if (this.active() !== null) { |
Akron | 1a5a587 | 2016-09-05 20:17:14 +0200 | [diff] [blame] | 301 | // var act = this.active(); |
Akron | e39cc86 | 2018-04-25 15:16:11 +0200 | [diff] [blame] | 302 | |
Akron | 65c7435 | 2016-09-02 17:23:39 +0200 | [diff] [blame] | 303 | // This does not work for alert currently! |
Akron | 1a5a587 | 2016-09-05 20:17:14 +0200 | [diff] [blame] | 304 | //if (act._type !== 'alert') { |
| 305 | if (!this._alert.active) { |
| 306 | var c = this._inputField.container(); |
Akron | e39cc86 | 2018-04-25 15:16:11 +0200 | [diff] [blame] | 307 | c.removeChild(this._active.element()); |
Akron | 1a5a587 | 2016-09-05 20:17:14 +0200 | [diff] [blame] | 308 | } |
| 309 | else { |
| 310 | this._unshowAlert(); |
| 311 | }; |
| 312 | |
Akron | 65c7435 | 2016-09-02 17:23:39 +0200 | [diff] [blame] | 313 | // this._active.hide(); |
| 314 | this.active(null); |
| 315 | }; |
Nils Diewald | 19ccee9 | 2014-12-08 11:30:08 +0000 | [diff] [blame] | 316 | } |
| 317 | }; |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 318 | }); |