-
Notifications
You must be signed in to change notification settings - Fork 665
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Remove the default search dialog if it exists (on CMD + K)
Signed-off-by: chmod77 <[email protected]>
- Loading branch information
Showing
1 changed file
with
15 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,17 @@ | ||
window.addEventListener("DOMContentLoaded", function() { | ||
// Select all <a> elements with class "external" | ||
var externalLinks = document.querySelectorAll("a.external"); | ||
window.addEventListener("DOMContentLoaded", function () { | ||
// Select all <a> elements with class "external" | ||
var externalLinks = document.querySelectorAll("a.external"); | ||
|
||
// Loop through each <a> element with class "external" | ||
externalLinks.forEach(function(link) { | ||
// Set the target attribute to "_blank" | ||
link.setAttribute("target", "_blank"); | ||
}); | ||
// Loop through each <a> element with class "external" | ||
externalLinks.forEach(function (link) { | ||
// Set the target attribute to "_blank" | ||
link.setAttribute("target", "_blank"); | ||
}); | ||
|
||
// Remove the default search dialog if it exists (on CMD + K) | ||
// This collides with Algolia's search dialog | ||
const searchDialog = document.getElementById("pst-search-dialog"); | ||
if (searchDialog) { | ||
searchDialog.remove(); | ||
} | ||
}); |