From d970e3c6e9ca457fe8091d29b238d267cd7c54ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Andreas=20Nilsen?= Date: Thu, 4 Sep 2025 14:51:47 +0200 Subject: [PATCH] added date search for person --- bas-search.user.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/bas-search.user.js b/bas-search.user.js index 2d613a4..2066531 100644 --- a/bas-search.user.js +++ b/bas-search.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name BAS Quick Search // @namespace http://tampermonkey.net/ -// @version 1.7.7 +// @version 1.7.8 // @description Quick search using `Ctrl` + `Shift` + `F` hotkey, group search with "g:" and person search with "p:" prefix. Navigate tabs with Ctrl + Left/Right keys. Navigate search results with up and down keys. // @author Øyvind Nilsen (on@ntnu.no) // @match https://bas.ntnu.no/* @@ -448,7 +448,14 @@ url = `https://bas.ntnu.no/group/search/?name=${encodeURIComponent(groupName)}`; } else if (searchQuery.toLowerCase().startsWith('p:')) { const personName = searchQuery.substring(2).trim(); - url = `https://bas.ntnu.no/person/search/?name=${encodeURIComponent(personName)}`; + + // Check if personName matches ISO date format (YYYY-MM-DD) + const isoDateRegex = /^\d{4}-\d{2}-\d{2}$/; + if (isoDateRegex.test(personName)) { + url = `https://bas.ntnu.no/person/search/?birth_date=${encodeURIComponent(personName)}`; + } else { + url = `https://bas.ntnu.no/person/search/?name=${encodeURIComponent(personName)}`; + } } else { const accountName = searchQuery.toLowerCase().startsWith('a:') ? searchQuery.substring(2).trim() : searchQuery; url = `https://bas.ntnu.no/account/search/?name=${encodeURIComponent(accountName)}`;