NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name highlight_search_results // @description highligt global search results with the search query // @version 1.2 // @require https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js // @include /^https://.*-des\.f.v..d\.com// // @license MIT // ==/UserScript== // ==OpenUserJS== // @author dlupu // @collaborator clambert // @collaborator ford.lambert // ==/OpenUserJS== (function(jQuery) { 'use strict'; jQuery.noConflict(); // do not use $ because it's also used by Prototype var searchField = document.getElementById('global_search_field'); var resultBox = document.getElementById('gs_results'); var searchForm = document.getElementById('gs_form'); function updateResultsFromFilter() { setTimeout(function() { var results = resultBox.getElementsByTagName('li'); for(var i = 0; i < results.length; i++) { var resultLink = results[i].getElementsByTagName('a')[0]; var resultLinkContent = resultLink.innerHTML; if(resultLinkContent.includes(searchField.value)) { var newText = resultLinkContent.replace(searchField.value, '<span style="width: auto; color: white !important; cursor: pointer; background-color: purple !important;">' + searchField.value + '</span>'); resultLink.innerHTML = newText; } } }, 800); } if (searchField) { searchField.addEventListener('change', updateResultsFromFilter); searchField.addEventListener('input', updateResultsFromFilter); } })(jQuery);