Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
dariah
search-commons-webresources
Commits
01197d81
Commit
01197d81
authored
Feb 27, 2019
by
Gradl, Tobias
Browse files
891: Highlighting von Treffen in der Suchausgabe
Task-Url:
https://pm.winseda.de/issues/891
parent
3ff50988
Changes
2
Hide whitespace changes
Inline
Side-by-side
js/_common/util.js
View file @
01197d81
...
@@ -87,11 +87,20 @@ var Util = function() {
...
@@ -87,11 +87,20 @@ var Util = function() {
};
};
var
__util
=
new
Util
();
var
__util
=
new
Util
();
Util
.
prototype
.
escapeHtml
=
function
(
string
)
{
Util
.
prototype
.
escapeHtml
=
function
(
a
,
obj
)
{
var
_this
=
this
;
for
(
var
i
=
0
;
i
<
a
.
length
;
i
++
)
{
return
String
(
string
).
replace
(
/
[
&<>"'
\/]
/g
,
function
(
s
)
{
if
(
a
[
i
]
===
obj
)
{
return
_this
.
entityMap
[
s
];
return
true
;
});
}
}
return
false
;
};
Util
.
prototype
.
contains
=
function
(
string
)
{
var
_this
=
this
;
return
String
(
string
).
replace
(
/
[
&<>"'
\/]
/g
,
function
(
s
)
{
return
_this
.
entityMap
[
s
];
});
};
};
Util
.
prototype
.
showLoginNote
=
function
()
{
Util
.
prototype
.
showLoginNote
=
function
()
{
...
...
js/search/search.js
View file @
01197d81
...
@@ -606,6 +606,25 @@ QueryHandler.prototype.processResponseResources = function(isShowMore, resultEle
...
@@ -606,6 +606,25 @@ QueryHandler.prototype.processResponseResources = function(isShowMore, resultEle
}
}
if
(
resultElements
[
i
].
fieldHighlights
!==
undefined
)
{
var
highlights
=
[];
for
(
var
j
=
0
;
j
<
resultElements
[
i
].
fieldHighlights
.
length
;
j
++
)
{
for
(
var
k
=
0
;
k
<
resultElements
[
i
].
fieldHighlights
[
j
].
highlightTexts
.
length
;
k
++
)
{
//if (!__util.contains(highlights, resultElements[i].fieldHighlights[j].highlightTexts[k])) {
highlights
.
push
(
resultElements
[
i
].
fieldHighlights
[
j
].
highlightTexts
[
k
]);
//}
}
}
var
strHighlight
=
""
;
for
(
var
j
=
0
;
j
<
highlights
.
length
;
j
++
)
{
strHighlight
+=
"
<li>
"
+
highlights
[
j
]
+
"
</li>
"
;
}
content
.
push
([
"
highlights
"
,
strHighlight
]);
}
/*if (resultElements[i].presentation.Presentation.Images!==undefined && resultElements[i].presentation.Presentation.Images.Resource!==undefined) {
/*if (resultElements[i].presentation.Presentation.Images!==undefined && resultElements[i].presentation.Presentation.Images.Resource!==undefined) {
...
@@ -628,6 +647,10 @@ QueryHandler.prototype.processResponseResources = function(isShowMore, resultEle
...
@@ -628,6 +647,10 @@ QueryHandler.prototype.processResponseResources = function(isShowMore, resultEle
if
(
resultElements
[
i
].
presentation
.
Presentation
.
Objects
!==
undefined
)
{
if
(
resultElements
[
i
].
presentation
.
Presentation
.
Objects
!==
undefined
)
{
this
.
handleObjects
(
resultElements
[
i
].
presentation
.
Presentation
.
Objects
,
i
);
this
.
handleObjects
(
resultElements
[
i
].
presentation
.
Presentation
.
Objects
,
i
);
}
}
//highlights
}
else
{
}
else
{
content
.
push
([
"
title
"
,
"
<em>
"
+
__translator
.
translate
(
"
~eu.dariah.de.minfba.search.view.result.no_title
"
)
+
"
</em>
"
]);
content
.
push
([
"
title
"
,
"
<em>
"
+
__translator
.
translate
(
"
~eu.dariah.de.minfba.search.view.result.no_title
"
)
+
"
</em>
"
]);
content
.
push
([
"
link
"
,
""
]);
content
.
push
([
"
link
"
,
""
]);
...
@@ -876,6 +899,7 @@ QueryHandler.prototype.renderResultItem = function(item, content, hideElements)
...
@@ -876,6 +899,7 @@ QueryHandler.prototype.renderResultItem = function(item, content, hideElements)
}
else
{
}
else
{
result
=
this
.
renderValue
(
content
[
i
][
1
],
content
[
i
][
2
]);
result
=
this
.
renderValue
(
content
[
i
][
1
],
content
[
i
][
2
]);
}
}
item
=
item
.
split
(
"
~{
"
+
content
[
i
][
0
]
+
"
}
"
).
join
(
result
);
item
=
item
.
split
(
"
~{
"
+
content
[
i
][
0
]
+
"
}
"
).
join
(
result
);
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment