Skip to content

Commit

Permalink
issue #9284 Clicking external link within search results with EXT_LIN…
Browse files Browse the repository at this point in the history
…KS_IN_WINDOW=YES opens the link in the search results box

Analogous to the normal page handling (see `util.cpp`, function `externalLinkTarget`) in case of `EXT_LINKS_IN_WINDOW` is set switch relevant search output to new window.
  • Loading branch information
albert-github committed Apr 20, 2022
1 parent 7707407 commit de8648a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/searchindex_js.cpp
Expand Up @@ -466,6 +466,7 @@ void writeJavaScriptSearchIndex()
// searchData[x][1][y+1] = info for child y
// searchData[x][1][y+1][0] = url
// searchData[x][1][y+1][1] = 1 => target="_parent"
// searchData[x][1][y+1][1] = 0 => target="_blank"
// searchData[x][1][y+1][2] = scope

ti << "[\n";
Expand Down
8 changes: 8 additions & 0 deletions templates/html/search.js
Expand Up @@ -745,6 +745,10 @@ function createResults()
{
srLink.setAttribute('target','_parent');
}
else
{
srLink.setAttribute('target','_blank');
}
var srScope = document.createElement('span');
setClassAttr(srScope,'SRScope');
srScope.innerHTML = searchData[e][1][1][2];
Expand All @@ -767,6 +771,10 @@ function createResults()
{
srChild.setAttribute('target','_parent');
}
else
{
srChild.setAttribute('target','_blank');
}
srChild.innerHTML = searchData[e][1][c+1][2];
srChildren.appendChild(srChild);
}
Expand Down

0 comments on commit de8648a

Please sign in to comment.