Skip to content

Commit

Permalink
feat: Remove the default search dialog if it exists (on CMD + K)
Browse files Browse the repository at this point in the history
Signed-off-by: chmod77 <[email protected]>
  • Loading branch information
chmod77 committed Dec 13, 2024
1 parent d770918 commit 152e332
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions docs/_static/custom.js
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();
}
});

0 comments on commit 152e332

Please sign in to comment.