Ticket #11420: 11420_cache_search_results.diff
| File 11420_cache_search_results.diff, 1.3 KB (added by , 15 years ago) |
|---|
-
wp-includes/js/tinymce/plugins/wplink/js/wplink.dev.js
187 187 this.element = element; 188 188 this.ul = element.children('ul'); 189 189 this.waiting = element.find('.river-waiting'); 190 this.cache = {} 190 191 191 192 this.change( search ); 192 193 … … 198 199 var self = this, 199 200 delay = this.query.page == 1 ? 0 : wpLink.minRiverAJAXDuration, 200 201 response = wpLink.delayedCallback( function( results, params ) { 202 // Cache the results 203 if( ! self.cache[self._search] ) { 204 self.cache[self._search] = { 205 results: results, 206 params: params 207 } 208 } 201 209 self.process( results, params ); 202 210 if ( callback ) 203 211 callback( results, params ); 204 212 }, delay ); 205 213 206 this.query.ajax( response ); 214 // If the search results are already cached, we can avoid an AJAX call 215 if( this.cache[this._search] ) 216 response( this.cache[this._search]['results'], this.cache[this._search]['params'] ); 217 else 218 this.query.ajax( response ); 207 219 }, 208 220 change: function( search ) { 209 221 if ( this.query && this._search == search )