Skip to content

Commit

Permalink
testing for mac
Browse files Browse the repository at this point in the history
  • Loading branch information
on committed Aug 6, 2025
1 parent 479a682 commit a3bbff8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
10 changes: 5 additions & 5 deletions bas-search.user.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// ==UserScript==
// @name BAS Quick Search
// @namespace http://tampermonkey.net/
// @version 1.7.2
// @description Quick search using `Ctrl` + `Shift` + `F` hotkey, group search with "g:" prefix. Navigate tabs with Ctrl+ Left/Right keys. Navigate search results with up and down keys.
// @version 1.7.3
// @description Quick search using `Ctrl` + `Shift` + `F` hotkey, group search with "g:" prefix. Navigate tabs with Ctrl + Left/Right keys. Navigate search results with up and down keys. On Mac, use MetaKey instead of Ctrl.
// @author Øyvind Nilsen (on@ntnu.no)
// @match https://bas.ntnu.no/*
// @grant none
Expand Down Expand Up @@ -267,9 +267,9 @@
}, 500);

// Global keyboard event handlers
document.addEventListener('keydown', function(event) {
document.addEventListener('keydown', function(event) {
// Show search box on Ctrl+Shift+F
if (event.ctrlKey && event.shiftKey && event.code === 'KeyF') {
if (((event.ctrlKey) || (event.metaKey)) && event.shiftKey && event.code === 'KeyF') {
event.preventDefault();
showSearchInterface();
return;
Expand Down Expand Up @@ -308,7 +308,7 @@
}

// Tab navigation with Ctrl + Arrow keys (when search is not visible)
if (event.ctrlKey && !event.altKey && !event.shiftKey && searchContainer.style.display === 'none') {
if (((event.ctrlKey) || (event.metaKey)) && !event.altKey && !event.shiftKey && searchContainer.style.display === 'none') {
if (event.code === 'ArrowRight') {
event.preventDefault();
navigateTab('next');
Expand Down
8 changes: 5 additions & 3 deletions doc/bas-search.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#### Feaures:
- Press `Ctrl` + `Alt` + `F` to open the search box/menu. Use `` and `` to navigate. And press `Enter` to select.
- For group search, use the prefix `g:` followed by the group name (e.g., `g:groupname`)
- In the search result pages, use `` and `` to navigate through the results. And press `Enter` to open the selected result.
- Press `Ctrl` + `` / `` to navigate to the next/previous tab.

#### Video
![Search0 GIF](bas-search-lowres.gif)
- On the login page, the username field is automatically focused.

#### Video:
![Search GIF](bas-search-lowres.gif)

0 comments on commit a3bbff8

Please sign in to comment.