Skip to content

Commit

Permalink
Add BetterSearch Function
Browse files Browse the repository at this point in the history
  • Loading branch information
ejunga authored Nov 12, 2024
1 parent 7240301 commit fb834fb
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions tdx-enhanced.js
Original file line number Diff line number Diff line change
@@ -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/*
Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -658,6 +669,11 @@
injectOtherStyles(frame)
});
}

let searchButton = document.getElementById("btnSearch");
if (searchButton) {
searchButton.onclick = betterSearch;
}
});
});

Expand Down Expand Up @@ -2244,4 +2260,4 @@ div.feed-entry {
`

GM.addStyle(customStyles)
})();
})();

0 comments on commit fb834fb

Please sign in to comment.