sr-npm 1.7.273 → 1.7.274
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 +1 -1
- package/pages/careersPage.js +11 -17
- package/pages/homePage.js +2 -1
- package/public/utils.js +18 -1
package/package.json
CHANGED
package/pages/careersPage.js
CHANGED
|
@@ -7,7 +7,7 @@ const {
|
|
|
7
7
|
debounce,
|
|
8
8
|
getFilter,
|
|
9
9
|
} = require('../public/filterUtils');
|
|
10
|
-
|
|
10
|
+
const { filterBrokenMarkers } = require('../public/utils');
|
|
11
11
|
let currentLoadedItems =100;
|
|
12
12
|
const itemsPerPage = 100;
|
|
13
13
|
let allJobs=[]
|
|
@@ -160,9 +160,8 @@ async function bind(_$w) {
|
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
function init(_$w) {
|
|
163
|
-
const debouncedSearch = debounce(()=>applyFilters(_$w), 400,thisObjectVar);
|
|
164
163
|
|
|
165
|
-
_$w('#searchInput').onInput(
|
|
164
|
+
_$w('#searchInput').onInput(onchangeSearchInput);
|
|
166
165
|
_$w('#dropdownDepartment, #dropdownLocation, #dropdownJobType').onChange(()=>applyFilters(_$w));
|
|
167
166
|
_$w('#resetFiltersButton, #clearSearch').onClick(()=>resetFilters(_$w));
|
|
168
167
|
|
|
@@ -176,6 +175,12 @@ function init(_$w) {
|
|
|
176
175
|
|
|
177
176
|
}
|
|
178
177
|
|
|
178
|
+
function onchangeSearchInput(_$w){
|
|
179
|
+
const debouncedSearch = debounce(()=>applyFilters(_$w), 400,thisObjectVar);
|
|
180
|
+
debouncedSearch();
|
|
181
|
+
_$w('#searchInput').focus();
|
|
182
|
+
}
|
|
183
|
+
|
|
179
184
|
async function applyFilters(_$w, skipUrlUpdate = false) {
|
|
180
185
|
console.log("applying filters");
|
|
181
186
|
const dropdownFiltersMapping = [
|
|
@@ -250,6 +255,8 @@ async function applyFilters(_$w, skipUrlUpdate = false) {
|
|
|
250
255
|
// Update reset button state
|
|
251
256
|
const hasActiveFilters = filters.length > 0;
|
|
252
257
|
hasActiveFilters? _$w('#resetFiltersButton').enable() : _$w('#resetFiltersButton').disable();
|
|
258
|
+
|
|
259
|
+
|
|
253
260
|
}
|
|
254
261
|
|
|
255
262
|
async function resetFilters(_$w) {
|
|
@@ -349,20 +356,7 @@ async function handleLocationParam(_$w,location) {
|
|
|
349
356
|
async function updateMapMarkers(_$w){
|
|
350
357
|
const numOfItems = await _$w('#jobsDataset').getTotalCount();
|
|
351
358
|
const items = await _$w('#jobsDataset').getItems(0, numOfItems);
|
|
352
|
-
const markers = items.items
|
|
353
|
-
.filter(item => {
|
|
354
|
-
const locationAddress = item.locationAddress;
|
|
355
|
-
const location = locationAddress && locationAddress.location;
|
|
356
|
-
return (
|
|
357
|
-
location !== undefined &&
|
|
358
|
-
location !== null &&
|
|
359
|
-
location.latitude !== undefined &&
|
|
360
|
-
location.latitude !== null &&
|
|
361
|
-
location.longitude !== undefined &&
|
|
362
|
-
location.longitude !== null
|
|
363
|
-
);
|
|
364
|
-
})
|
|
365
|
-
.map(item => {
|
|
359
|
+
const markers = filterBrokenMarkers(items.items).map(item => {
|
|
366
360
|
const location = item.locationAddress.location;
|
|
367
361
|
return {
|
|
368
362
|
location: {
|
package/pages/homePage.js
CHANGED
|
@@ -3,6 +3,7 @@ const {
|
|
|
3
3
|
getFilter,
|
|
4
4
|
} = require('../public/filterUtils');
|
|
5
5
|
const { handleOnLocationClick } = require('../public/mapUtils');
|
|
6
|
+
const { filterBrokenMarkers } = require('../public/utils');
|
|
6
7
|
const { location } = require('@wix/site-location');
|
|
7
8
|
let thisObjectVar;
|
|
8
9
|
async function homePageOnReady(_$w,thisObject) {
|
|
@@ -25,7 +26,7 @@ async function homePageOnReady(_$w,thisObject) {
|
|
|
25
26
|
const numOfItems = await _$w('#citiesDataset').getTotalCount();
|
|
26
27
|
const items = await _$w('#citiesDataset').getItems(0, numOfItems);
|
|
27
28
|
let baseUrl = await location.baseUrl();
|
|
28
|
-
const markers = items.items.map(item => {
|
|
29
|
+
const markers = filterBrokenMarkers(items.items).map(item => {
|
|
29
30
|
const location = item.locationAddress.location;
|
|
30
31
|
const cityName = encodeURIComponent(item.title); // Use the city name from the item
|
|
31
32
|
const cityLinkUrl = `${baseUrl}/positions?location=${cityName}`; // Add city as search parameter
|
package/public/utils.js
CHANGED
|
@@ -22,7 +22,24 @@ function htmlToText(html) {
|
|
|
22
22
|
return text.replace(/\n\s*\n+/g, '\n\n').replace(/[ \t]+\n/g, '\n').trim();
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
function filterBrokenMarkers(items) {
|
|
26
|
+
return items
|
|
27
|
+
.filter(item => {
|
|
28
|
+
const locationAddress = item.locationAddress;
|
|
29
|
+
const location = locationAddress && locationAddress.location;
|
|
30
|
+
return (
|
|
31
|
+
location !== undefined &&
|
|
32
|
+
location !== null &&
|
|
33
|
+
location.latitude !== undefined &&
|
|
34
|
+
location.latitude !== null &&
|
|
35
|
+
location.longitude !== undefined &&
|
|
36
|
+
location.longitude !== null
|
|
37
|
+
);
|
|
38
|
+
})
|
|
39
|
+
}
|
|
40
|
+
|
|
25
41
|
|
|
26
42
|
module.exports = {
|
|
27
|
-
htmlToText
|
|
43
|
+
htmlToText,
|
|
44
|
+
filterBrokenMarkers
|
|
28
45
|
};
|