Changeset 3817489
- Timestamp:
- 11/23/2026 05:26:51 AM (less than one hour ago)
- Location:
- searchjet-instant-search
- Files:
-
- 8 edited
- 1 copied
-
tags/2.0.10 (copied) (copied from searchjet-instant-search/trunk )
-
tags/2.0.10/assets/js/searchjet-autocomplete.js (modified) (4 diffs)
-
tags/2.0.10/assets/js/searchjet-federated.js (modified) (1 diff)
-
tags/2.0.10/readme.txt (modified) (2 diffs)
-
tags/2.0.10/searchjet.php (modified) (2 diffs)
-
trunk/assets/js/searchjet-autocomplete.js (modified) (4 diffs)
-
trunk/assets/js/searchjet-federated.js (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/searchjet.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
searchjet-instant-search/tags/2.0.10/assets/js/searchjet-autocomplete.js
r3644704 r3817489 69 69 }); 70 70 71 // Typing timings. A reply can come back with 0 hits for a half-typed word ("hoddi") just before the 72 // full word ("hoddie") matches, so "No results found" waits until typing has paused. 73 const DEBOUNCE_MS = 150; 74 const EMPTY_STATE_DELAY_MS = 300; 75 let lastInputAt = 0; 76 let emptyTimer = null; 77 71 78 // Add custom search widget that uses existing input 72 79 search.addWidget({ … … 78 85 const query = this.value.trim(); 79 86 clearTimeout(debounceTimer); 87 clearTimeout(emptyTimer); 88 lastInputAt = Date.now(); 80 89 81 90 if (!query) { … … 92 101 debounceTimer = setTimeout(() => { 93 102 helper.setQuery(query).search(); 94 }, 100);103 }, DEBOUNCE_MS); 95 104 } 96 105 }); 97 },98 render({ results }) {99 // Show/hide results container based on query100 const hasQuery = results && results.query && results.query.trim();101 resultsContainer.style.display = hasQuery ? 'block' : 'none';102 106 } 103 107 }); 104 108 109 // Only draw a reply that is for what is in the box now. Replies can arrive out of order, and a late 110 // reply must not reopen the dropdown after the box was cleared. An empty reply is drawn only once 111 // typing has paused; until then the last results stay on screen. 112 function withReplyGuard(hitsWidget) { 113 const renderHits = hitsWidget.render.bind(hitsWidget); 114 hitsWidget.render = function (args) { 115 const results = args && args.results; 116 const query = results && typeof results.query === 'string' ? results.query.trim() : ''; 117 if (!query || query !== input.value.trim()) { 118 return; 119 } 120 clearTimeout(emptyTimer); 121 122 const show = () => { 123 renderHits(args); 124 resultsContainer.style.display = 'block'; 125 }; 126 if (results.hits && results.hits.length) { 127 show(); 128 return; 129 } 130 const wait = lastInputAt + EMPTY_STATE_DELAY_MS - Date.now(); 131 if (wait <= 0) { 132 show(); 133 return; 134 } 135 emptyTimer = setTimeout(() => { 136 if (query === input.value.trim()) { 137 show(); 138 } 139 }, wait); 140 }; 141 return hitsWidget; 142 } 143 105 144 // Add hits widget 106 145 search.addWidget( 107 SearchJet.widgets.hits({146 withReplyGuard(SearchJet.widgets.hits({ 108 147 container: '#searchjet-results', 109 148 templates: { … … 135 174 return grouped; 136 175 } 137 }) 176 })) 138 177 ); 139 178 -
searchjet-instant-search/tags/2.0.10/assets/js/searchjet-federated.js
r3816833 r3817489 109 109 search.addWidget({ 110 110 render({ results }) { 111 if (!results || !results.query) { 111 // Ignore a reply for a query that is no longer in the box (late or out-of-order reply, 112 // or the box was cleared). 113 if (!results || !results.query || results.query !== input.value.trim()) { 112 114 return; 113 115 } -
searchjet-instant-search/tags/2.0.10/readme.txt
r3816903 r3817489 5 5 Tested up to: 7.1 6 6 Requires PHP: 7.4 7 Stable tag: 2.0. 97 Stable tag: 2.0.10 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 118 118 119 119 == Changelog == 120 121 = 2.0.10 = 122 * Fix: the search dropdown no longer flashes "No results found" while you type (for example on the way to a typo like "hoddie"), and a slow reply for an earlier keystroke can no longer replace newer results or reopen a cleared search box. 120 123 121 124 = 2.0.9 = -
searchjet-instant-search/tags/2.0.10/searchjet.php
r3816833 r3817489 4 4 * Plugin URI: https://searchjetengine.com/ 5 5 * Description: AI-powered instant search for WooCommerce & WordPress. Supports SKUs, smart filters, typo-tolerance & GA4 tracking. 6 * Version: 2.0. 96 * Version: 2.0.10 7 7 * Author: Maidul 8 8 * Author URI: https://searchjetengine.com/ … … 24 24 } 25 25 // Define plugin constants 26 define('SEARCHJET_VERSION', '2.0. 9');27 define('SEARCHJET_PLUGIN_VERSION', '2.0. 9');26 define('SEARCHJET_VERSION', '2.0.10'); 27 define('SEARCHJET_PLUGIN_VERSION', '2.0.10'); 28 28 define('SEARCHJET_PLUGIN_FILE', __FILE__); 29 29 define('SEARCHJET_PLUGIN_DIR', plugin_dir_path(__FILE__)); -
searchjet-instant-search/trunk/assets/js/searchjet-autocomplete.js
r3644704 r3817489 69 69 }); 70 70 71 // Typing timings. A reply can come back with 0 hits for a half-typed word ("hoddi") just before the 72 // full word ("hoddie") matches, so "No results found" waits until typing has paused. 73 const DEBOUNCE_MS = 150; 74 const EMPTY_STATE_DELAY_MS = 300; 75 let lastInputAt = 0; 76 let emptyTimer = null; 77 71 78 // Add custom search widget that uses existing input 72 79 search.addWidget({ … … 78 85 const query = this.value.trim(); 79 86 clearTimeout(debounceTimer); 87 clearTimeout(emptyTimer); 88 lastInputAt = Date.now(); 80 89 81 90 if (!query) { … … 92 101 debounceTimer = setTimeout(() => { 93 102 helper.setQuery(query).search(); 94 }, 100);103 }, DEBOUNCE_MS); 95 104 } 96 105 }); 97 },98 render({ results }) {99 // Show/hide results container based on query100 const hasQuery = results && results.query && results.query.trim();101 resultsContainer.style.display = hasQuery ? 'block' : 'none';102 106 } 103 107 }); 104 108 109 // Only draw a reply that is for what is in the box now. Replies can arrive out of order, and a late 110 // reply must not reopen the dropdown after the box was cleared. An empty reply is drawn only once 111 // typing has paused; until then the last results stay on screen. 112 function withReplyGuard(hitsWidget) { 113 const renderHits = hitsWidget.render.bind(hitsWidget); 114 hitsWidget.render = function (args) { 115 const results = args && args.results; 116 const query = results && typeof results.query === 'string' ? results.query.trim() : ''; 117 if (!query || query !== input.value.trim()) { 118 return; 119 } 120 clearTimeout(emptyTimer); 121 122 const show = () => { 123 renderHits(args); 124 resultsContainer.style.display = 'block'; 125 }; 126 if (results.hits && results.hits.length) { 127 show(); 128 return; 129 } 130 const wait = lastInputAt + EMPTY_STATE_DELAY_MS - Date.now(); 131 if (wait <= 0) { 132 show(); 133 return; 134 } 135 emptyTimer = setTimeout(() => { 136 if (query === input.value.trim()) { 137 show(); 138 } 139 }, wait); 140 }; 141 return hitsWidget; 142 } 143 105 144 // Add hits widget 106 145 search.addWidget( 107 SearchJet.widgets.hits({146 withReplyGuard(SearchJet.widgets.hits({ 108 147 container: '#searchjet-results', 109 148 templates: { … … 135 174 return grouped; 136 175 } 137 }) 176 })) 138 177 ); 139 178 -
searchjet-instant-search/trunk/assets/js/searchjet-federated.js
r3816833 r3817489 109 109 search.addWidget({ 110 110 render({ results }) { 111 if (!results || !results.query) { 111 // Ignore a reply for a query that is no longer in the box (late or out-of-order reply, 112 // or the box was cleared). 113 if (!results || !results.query || results.query !== input.value.trim()) { 112 114 return; 113 115 } -
searchjet-instant-search/trunk/readme.txt
r3816903 r3817489 5 5 Tested up to: 7.1 6 6 Requires PHP: 7.4 7 Stable tag: 2.0. 97 Stable tag: 2.0.10 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 118 118 119 119 == Changelog == 120 121 = 2.0.10 = 122 * Fix: the search dropdown no longer flashes "No results found" while you type (for example on the way to a typo like "hoddie"), and a slow reply for an earlier keystroke can no longer replace newer results or reopen a cleared search box. 120 123 121 124 = 2.0.9 = -
searchjet-instant-search/trunk/searchjet.php
r3816833 r3817489 4 4 * Plugin URI: https://searchjetengine.com/ 5 5 * Description: AI-powered instant search for WooCommerce & WordPress. Supports SKUs, smart filters, typo-tolerance & GA4 tracking. 6 * Version: 2.0. 96 * Version: 2.0.10 7 7 * Author: Maidul 8 8 * Author URI: https://searchjetengine.com/ … … 24 24 } 25 25 // Define plugin constants 26 define('SEARCHJET_VERSION', '2.0. 9');27 define('SEARCHJET_PLUGIN_VERSION', '2.0. 9');26 define('SEARCHJET_VERSION', '2.0.10'); 27 define('SEARCHJET_PLUGIN_VERSION', '2.0.10'); 28 28 define('SEARCHJET_PLUGIN_FILE', __FILE__); 29 29 define('SEARCHJET_PLUGIN_DIR', plugin_dir_path(__FILE__));
Note:
See TracChangeset
for help on using the changeset viewer.