Created
January 17, 2016 12:18
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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