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
  • Loading branch information
chmod77 committed Dec 13, 2024
1 parent d770918 commit cf64fbf
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 cf64fbf

Please sign in to comment.