Skip to content

Commit

Permalink
[BUGFIX] Fix highlighting for words 5.x (#1397)
Browse files Browse the repository at this point in the history
Co-authored-by: Sebastian Meyer <sebastian.meyer@opencultureconsulting.com>
  • Loading branch information
beatrycze-volk and sebastian-meyer committed Dec 18, 2024
1 parent dd6af24 commit 37e6746
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions Resources/Public/JavaScript/PageView/Utility.js
Original file line number Diff line number Diff line change
Expand Up @@ -575,20 +575,20 @@ dlfUtils.parseDataDic = function (element) {
* @param {string} name The key of the value
* @param {?} value The value to save
* @param {string} samesite Sets the SameSite attribute: lax, strict or none
*
*
*/
dlfUtils.setCookie = function (name, value, samesite) {
switch(samesite) {
case "lax":
case "strict":
case "strict":
break;
case "none":
samesite+= ";secure"
break;
default:
samesite = "lax"
}

document.cookie = name + "=" + decodeURI(value) + "; path=/" + "; SameSite=" + samesite;
};

Expand Down Expand Up @@ -647,16 +647,16 @@ dlfUtils.scaleToImageSize = function (features, imageObj, width, height, optOffs
};

/**
* Search a feature collection for a feature with the given coordinates
* Search a feature collection for a feature with the given word in its fulltext
* @param {Array.<ol.Feature>} featureCollection
* @param {string} coordinates
* @return {Array.<ol.Feature>|undefined}
* @param {string} word for highlighting
* @returns {Array.<ol.Feature>|undefined}
*/
dlfUtils.searchFeatureCollectionForCoordinates = function (featureCollection, coordinates) {
dlfUtils.searchFeatureCollectionForCoordinates = function (featureCollection, word) {
var features = [];
featureCollection.forEach(function (ft) {
if (ft.values_.fulltext !== undefined) {
if (ft.values_.fulltext.includes(coordinates)) {
if (ft.values_.fulltext.toLowerCase().includes(word.toLowerCase())) {
features.push(ft);
}
}
Expand Down

0 comments on commit 37e6746

Please sign in to comment.