1
0
mirror of https://github.com/minio/docs.git synced 2025-07-30 07:03:26 +03:00

UI Enhancements: URLs, Web-font path and CSS fixes (#661)

- Only the external links are set to open in new windows/tab
- Fixed incorrect web-font paths being called for preload. 
- Minor CSS transition fixes.
- Conditionally called the search modal's keyboard events.
This commit is contained in:
Rushan
2022-12-07 19:47:23 +04:00
committed by GitHub
parent 9db99342d4
commit b7f0c07ec5
5 changed files with 39 additions and 13 deletions

View File

@ -123,13 +123,6 @@ window.addEventListener("DOMContentLoaded", () => {
clearRefinements();
}
// Clear the filters on x click
document
.querySelector(".search__reset")
.addEventListener("click", () => {
clearRefinements("btn");
});
// Fire the search
search(query);
},
@ -271,7 +264,7 @@ window.addEventListener("DOMContentLoaded", () => {
return false;
}
return `<a target="_blank" href="${docUrl}">
return `<a target="_blank" rel="noreferrer noopener" href="${docUrl}">
${returnString}
</a>`;
},
@ -325,13 +318,31 @@ window.addEventListener("DOMContentLoaded", () => {
});
});
// Clear the filters on x click
document.addEventListener("click", (e) => {
if(e.target.classList.contains("search__reset")) {
clearRefinements("btn");
}
}, false);
// Close the search modal on outside click
document.addEventListener("pointerdown", function (e) {
if (e.target.id === "search") {
closeSearchModal();
}
})
// Keyboard events
document.addEventListener(
"keydown",
(e) => {
// Close the search on esc key press
if (e.key === "Escape") {
closeSearchModal();
if(searchModalEl.classList.contains("search--focused")
|| searchModalEl.classList.contains("search--active")) {
closeSearchModal();
}
}
// Focus the search input on "Meta + K" key press

View File

@ -361,4 +361,18 @@ window.addEventListener("DOMContentLoaded", (event) => {
});
}
})();
// --------------------------------------------------
// Handle internal and external links
// --------------------------------------------------
(function () {
const links = document.querySelectorAll(".content__main a.external");
if(links.length > 0) {
links.forEach((item) => {
item.setAttribute("target", "_blank");
item.setAttribute("rel", "noopener");
item.setAttribute("rel", "noreferrer");
});
}
})();
});