sr-npm 1.7.274 → 1.7.276

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sr-npm",
3
- "version": "1.7.274",
3
+ "version": "1.7.276",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -18,6 +18,7 @@ const {
18
18
  let queryKeyWordVar;
19
19
  let queryDepartmentVar;
20
20
  let queryLocationVar;
21
+ let searchInputIsUsed=false;
21
22
  async function careersPageOnReady(_$w,thisObject,queryParams) {
22
23
  console.log("queryParams: ", queryParams);
23
24
  const { page, keyWord, department, location } = queryParams;
@@ -160,8 +161,10 @@ async function bind(_$w) {
160
161
  }
161
162
 
162
163
  function init(_$w) {
163
-
164
- _$w('#searchInput').onInput(onchangeSearchInput);
164
+ const debouncedSearch = debounce(()=>applyFilters(_$w), 400,thisObjectVar);
165
+ _$w('#searchInput').onInput(debouncedSearch);
166
+ _$w('#searchInput').onFocus(()=>searchInputIsUsed=true);
167
+ _$w('#searchInput').onBlur(()=>searchInputIsUsed=false);
165
168
  _$w('#dropdownDepartment, #dropdownLocation, #dropdownJobType').onChange(()=>applyFilters(_$w));
166
169
  _$w('#resetFiltersButton, #clearSearch').onClick(()=>resetFilters(_$w));
167
170
 
@@ -179,6 +182,10 @@ function onchangeSearchInput(_$w){
179
182
  const debouncedSearch = debounce(()=>applyFilters(_$w), 400,thisObjectVar);
180
183
  debouncedSearch();
181
184
  _$w('#searchInput').focus();
185
+
186
+
187
+ console.log("onchangeSearchInput");
188
+ searchInputIsUsed=true;
182
189
  }
183
190
 
184
191
  async function applyFilters(_$w, skipUrlUpdate = false) {
@@ -255,6 +262,11 @@ async function applyFilters(_$w, skipUrlUpdate = false) {
255
262
  // Update reset button state
256
263
  const hasActiveFilters = filters.length > 0;
257
264
  hasActiveFilters? _$w('#resetFiltersButton').enable() : _$w('#resetFiltersButton').disable();
265
+ if(searchInputIsUsed){
266
+ console.log("focusing search input");
267
+ _$w('#searchInput').focus();
268
+ console.log("search input focused");
269
+ }
258
270
 
259
271
 
260
272
  }