diff --git a/tdx-enhanced.js b/tdx-enhanced.js index 3a5c419..4aefa4e 100644 --- a/tdx-enhanced.js +++ b/tdx-enhanced.js @@ -1,7 +1,7 @@ // ==UserScript== // @name tdx-enhanced-student // @namespace ecn -// @version 2024-10-24-dev03 +// @version 2024-11-12-dev01 // @description enhanced tdx coloring & formatting. follows system color scheme. // @author Purdue STEM IT - it@purdue.edu // @match https://service.purdue.edu/TDNext/* @@ -131,6 +131,17 @@ highlightReportHeadings(); } + function betterSearch() { + var searchText = document.querySelector('#txtItemIDLookup').value.trim(); + var isInteger = /^\d*$/.test(searchText); + if (isInteger && searchText.length > 0) { + window.open('/TDNext/Apps/Search/LookupItem?searchText=' + encodeURIComponent(searchText), '_blank'); + } else if (false === false){ + TeamDynamix.osjs.openApp('appSearch', 'Search', '/TDNext/Apps/Shared/Global/Search?searchText=' + encodeURIComponent(searchText)); + $('#txtItemIDLookup').val('') + } + } + let colorScheme /* BEGIN FUNCTIONS */ @@ -658,6 +669,11 @@ injectOtherStyles(frame) }); } + + let searchButton = document.getElementById("btnSearch"); + if (searchButton) { + searchButton.onclick = betterSearch; + } }); }); @@ -2244,4 +2260,4 @@ div.feed-entry { ` GM.addStyle(customStyles) -})(); \ No newline at end of file +})();