sr-npm 1.7.956 → 1.7.958
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/positionPage.js +5 -13
- package/public/utils.js +13 -12
package/package.json
CHANGED
package/pages/positionPage.js
CHANGED
|
@@ -56,7 +56,10 @@ async function getCategoryValue(customValues) {
|
|
|
56
56
|
|
|
57
57
|
const multiRefField=await getPositionWithMultiRefField(item._id);
|
|
58
58
|
const categoryValue=await getCategoryValue(multiRefField);
|
|
59
|
-
|
|
59
|
+
|
|
60
|
+
if(isElementExistOnPage(_$w('#jobCategory'))) {
|
|
61
|
+
_$w('#jobCategory').text = categoryValue.title;
|
|
62
|
+
}
|
|
60
63
|
|
|
61
64
|
const relatedJobs = await getRelatedJobs({ categoryValueId:categoryValue._id, itemId: item._id ,limit:5});
|
|
62
65
|
_$w('#relatedJobsRepNoDepartment').onItemReady(($item, itemData) => {
|
|
@@ -88,18 +91,7 @@ async function getCategoryValue(customValues) {
|
|
|
88
91
|
}
|
|
89
92
|
|
|
90
93
|
}
|
|
91
|
-
|
|
92
|
-
if(isElementExistOnPage(_$w('#jobLocation'))) {
|
|
93
|
-
_$w('#jobLocation').text = item.location.fullLocation;
|
|
94
|
-
}
|
|
95
|
-
if(isElementExistOnPage(_$w('#jobCategory'))) {
|
|
96
|
-
_$w('#jobCategory').text = categoryValue.title;
|
|
97
|
-
}
|
|
98
|
-
if(isElementExistOnPage(_$w('#jobEmploymentTime'))) {
|
|
99
|
-
_$w('#jobEmploymentTime').text = item.employmentType;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
}
|
|
94
|
+
|
|
103
95
|
function handleReferFriendButton(_$w,item) {
|
|
104
96
|
if(!item.referFriendLink && isElementExistOnPage(_$w('#referFriendButton'))){
|
|
105
97
|
_$w('#referFriendButton').hide();
|
package/public/utils.js
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
|
|
2
2
|
function htmlToText(html) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
textarea.innerHTML = html;
|
|
8
|
-
console.log("textarea.innerHTML: ",textarea.innerHTML);
|
|
9
|
-
let decoded = textarea.value;
|
|
10
|
-
console.log("decoded: ",decoded);
|
|
11
|
-
// Now clean up the HTML tags and formatting
|
|
12
|
-
let text = decoded
|
|
3
|
+
if (!html) return '';
|
|
4
|
+
|
|
5
|
+
// Remove HTML tags and decode entities
|
|
6
|
+
let text = html
|
|
13
7
|
.replace(/<br\s*\/?>/gi, '\n')
|
|
14
8
|
.replace(/<\/?(p|div|h[1-6])\s*\/?>/gi, '\n')
|
|
15
9
|
.replace(/<li[^>]*>/gi, '• ')
|
|
16
10
|
.replace(/<\/li>/gi, '\n')
|
|
17
|
-
.replace(/<[^>]*>/g, '')
|
|
18
|
-
|
|
11
|
+
.replace(/<[^>]*>/g, '')
|
|
12
|
+
.replace(/&/g, '&')
|
|
13
|
+
.replace(/</g, '<')
|
|
14
|
+
.replace(/>/g, '>')
|
|
15
|
+
.replace(/"/g, '"')
|
|
16
|
+
.replace(/'/g, "'")
|
|
17
|
+
.replace(/ /g, ' ')
|
|
18
|
+
.replace(/ /gi, ' ');
|
|
19
|
+
|
|
19
20
|
// Clean up whitespace
|
|
20
21
|
return text.replace(/\n\s*\n+/g, '\n\n').replace(/[ \t]+\n/g, '\n').trim();
|
|
21
22
|
}
|