| | @@ -176,16 +176,18 @@ |
| 176 | 176 | activeUser: undefined, |
| 177 | 177 | match: function(uname){ |
| 178 | 178 | return this.activeUser===uname || !this.activeUser; |
| 179 | 179 | } |
| 180 | 180 | }, |
| 181 | | - /** Gets (no args) or sets (1 arg) the current input text field |
| 182 | | - value, taking into account single- vs multi-line input. The |
| 183 | | - getter returns a string and the setter returns this |
| 184 | | - object. As a special case, if arguments[0] is a boolean |
| 185 | | - value, it behaves like a getter and, if arguments[0]===true |
| 186 | | - it clears the input field before returning. */ |
| 181 | + /** |
| 182 | + Gets (no args) or sets (1 arg) the current input text field |
| 183 | + value, taking into account single- vs multi-line input. The |
| 184 | + getter returns a trim()'d string and the setter returns this |
| 185 | + object. As a special case, if arguments[0] is a boolean |
| 186 | + value, it behaves like a getter and, if arguments[0]===true |
| 187 | + it clears the input field before returning. |
| 188 | + */ |
| 187 | 189 | inputValue: function(/*string newValue | bool clearInputField*/){ |
| 188 | 190 | const e = this.inputElement(); |
| 189 | 191 | if(arguments.length && 'boolean'!==typeof arguments[0]){ |
| 190 | 192 | if(e.isContentEditable) e.innerText = arguments[0]; |
| 191 | 193 | else e.value = arguments[0]; |
| | @@ -194,11 +196,11 @@ |
| 194 | 196 | const rc = e.isContentEditable ? e.innerText : e.value; |
| 195 | 197 | if( true===arguments[0] ){ |
| 196 | 198 | if(e.isContentEditable) e.innerText = ''; |
| 197 | 199 | else e.value = ''; |
| 198 | 200 | } |
| 199 | | - return rc; |
| 201 | + return rc && rc.trim(); |
| 200 | 202 | }, |
| 201 | 203 | /** Asks the current user input field to take focus. Returns this. */ |
| 202 | 204 | inputFocus: function(){ |
| 203 | 205 | this.inputElement().focus(); |
| 204 | 206 | return this; |
| | @@ -2378,11 +2380,12 @@ |
| 2378 | 2380 | result elements. |
| 2379 | 2381 | */ |
| 2380 | 2382 | Chat.clearSearch = function(addInstructions=false){ |
| 2381 | 2383 | const e = D.clearElement( this.e.searchContent ); |
| 2382 | 2384 | if(addInstructions){ |
| 2383 | | - D.append(e, "Enter search terms in the message field."); |
| 2385 | + D.append(e, "Enter search terms in the message field. "+ |
| 2386 | + "Use #NNNNN to search for the message with ID NNNNN."); |
| 2384 | 2387 | } |
| 2385 | 2388 | return e; |
| 2386 | 2389 | }; |
| 2387 | 2390 | Chat.clearSearch(true); |
| 2388 | 2391 | /** |
| | @@ -2392,13 +2395,15 @@ |
| 2392 | 2395 | Chat.submitSearch = function(){ |
| 2393 | 2396 | const term = this.inputValue(true); |
| 2394 | 2397 | const eMsgTgt = this.clearSearch(true); |
| 2395 | 2398 | if( !term ) return; |
| 2396 | 2399 | D.append( eMsgTgt, "Searching for ",term," ..."); |
| 2400 | + const fd = new FormData(); |
| 2401 | + fd.set('q', term); |
| 2397 | 2402 | F.fetch( |
| 2398 | 2403 | "chat-query", { |
| 2399 | | - urlParams: {q: term}, |
| 2404 | + payload: fd, |
| 2400 | 2405 | responseType: 'json', |
| 2401 | 2406 | onload:function(jx){ |
| 2402 | 2407 | let previd = 0; |
| 2403 | 2408 | D.clearElement(eMsgTgt); |
| 2404 | 2409 | jx.msgs.forEach((m)=>{ |
| 2405 | 2410 | |