This addresses issue #2437 by: - Adding a new script that dynamically sets the search keyboard shortcut by checking what platform the user is currently using - Loading this script in `default.liquid` <img width="1150" alt="SCR-20240529-cdfe" src="https://github.com/alshedivat/al-folio/assets/16251412/7c4125fc-5028-422f-97d5-0df729e30fa7">
12 lines
493 B
JavaScript
12 lines
493 B
JavaScript
// Check if the user is on a Mac and update the shortcut key for search accordingly
|
|
document.onreadystatechange = () => {
|
|
if (document.readyState === "interactive") {
|
|
let isMac = navigator.platform.toUpperCase().indexOf("MAC") >= 0;
|
|
let shortcutKeyElement = document.querySelector("#search-toggle .nav-link");
|
|
if (shortcutKeyElement && isMac) {
|
|
// use the unicode for command key
|
|
shortcutKeyElement.innerHTML = '⌘ k <i class="ti ti-search"></i>';
|
|
}
|
|
}
|
|
};
|