2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
|
/**
Submits a history search using the main input field's current
text. It is assumed that Chat.e.viewSearch===Chat.e.currentView.
*/
Chat.submitSearch = function(){
const term = this.inputValue(true);
const eMWC = D.clearElement(
this.e.viewSearch.querySelector('.message-widget-content')
);
if( !term ) return;
D.append(eMWC, "TODO: search term = ", term);
};
const afterFetch = function f(){
if(true===f.isFirstCall){
f.isFirstCall = false;
Chat.ajaxEnd();
Chat.e.viewMessages.classList.remove('loading');
|
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
|
/**
Submits a history search using the main input field's current
text. It is assumed that Chat.e.viewSearch===Chat.e.currentView.
*/
Chat.submitSearch = function(){
const term = this.inputValue(true);
const eMsgTgt = D.clearElement(
this.e.viewSearch.querySelector('.message-widget-content')
);
if( !term ) return;
D.append(eMsgTgt, "TODO: search term = ", term);
F.fetch(
"chat-query", {
urlParams: {q: term},
responseType: 'json',
onload:function(jx){
let prevId = 0;
console.log("jx =",jx);
D.clearElement(eMsgTgt);
jx.msgs.forEach((m)=>{
const mw = new Chat.MessageWidget(m);
D.append( eMsgTgt, mw.e.body );
prevId = m.msgid;
});
if( jx.msgs.length ){
// TODO: MessageSpacer
}else{
D.append( D.clearElement(eMsgTgt),
'No results matching the search term: ',
term );
}
}
}
);
};
const afterFetch = function f(){
if(true===f.isFirstCall){
f.isFirstCall = false;
Chat.ajaxEnd();
Chat.e.viewMessages.classList.remove('loading');
|