Skip to content

Instantly share code, notes, and snippets.

@biiont
Created January 17, 2016 12:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save biiont/bc4e3579c58de61c6663 to your computer and use it in GitHub Desktop.
Save biiont/bc4e3579c58de61c6663 to your computer and use it in GitHub Desktop.
Add search links to alternative engines. To be able to continue to search other search engines if Yacy does not give you the answer.
// Go to "Administration > Portal Configuration"
// Replace donation box at "'About' Column" with:
<div style="padding:8px;"><a id="googlesearchlink" href="https://google.com/">Google</a></div>
<div style="padding:8px;"><a id="yandexsearchlink" href="https://yandex.ru/">Yandex</a></div>
<div style="padding:8px;"><a id="wikisearchlink" href="https://wikipedia.org/">Wikipedia</a></div>
<script>
function updateSearchLink(elid, hrefPref, captionPref, srch) {
var searchlink = document.getElementById(elid);
searchlink.href = hrefPref + srch;
searchlink.innerHTML = captionPref + srch;
}
function updateSearchLinks() {
var srch = document.getElementById("search").value;
updateSearchLink("googlesearchlink", "https://google.com/search?q=", "Google: ", srch);
updateSearchLink("yandexsearchlink", "https://yandex.ru/search?text=", "Yandex: ", srch);
updateSearchLink("wikisearchlink", "https://www.wikipedia.org/search-redirect.php?search=", "Wikipedia: ", srch);
return true;
}
window.addEventListener("load", function(){
document.getElementById("search").addEventListener("keypress", updateSearchLinks);
//document.getElementById("search").addEventListener("change", updateSearchLinks);
//document.getElementById("Enter").addEventListener("click", updateSearchLinks, true);
updateSearchLinks();
}, false);
</script>
// And update configuration by pressing "Change Search Page" button.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment