Created
July 7, 2023 11:57
-
-
Save goeko/3894f300940bd313acf02046ab09f31b to your computer and use it in GitHub Desktop.
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
javascript:(function() { | |
var searchEngines = [ | |
{ url: 'https://duckduckgo.com/?q=', param: 'q' }, | |
{ url: 'https://www.google.de/search?q=', param: 'q' }, | |
{ url: 'https://www.bing.com/search?q=', param: 'q' }, | |
{ url: 'https://search.yahoo.com/search?p=', param: 'p' }, | |
{ url: 'https://www.ecosia.org/search?q=', param: 'q' }, | |
{ url: 'https://www.qwant.com/?q=', param: 'q' }, | |
{ url: 'https://www.startpage.com/do/dsearch?query=', param: 'query' }, | |
{ url: 'https://metager.de/meta/meta.ger3?eingabe=', param: 'eingabe' }, | |
{ url: 'https://yandex.com/search/?text=', param: 'text' } | |
]; | |
var currentEngine = searchEngines.find(engine => window.location.href.startsWith(engine.url)); | |
if (currentEngine) { | |
var searchParams = new URLSearchParams(window.location.search); | |
var q = searchParams.get(currentEngine.param); | |
if (q !== null) { | |
var screenWidth = window.screen.availWidth; | |
var screenHeight = window.screen.availHeight; | |
var windowWidth = Math.floor(screenWidth / 3); | |
var windowHeight = Math.floor(screenHeight / 3); | |
searchEngines.forEach(function(engine, i) { | |
var newUrl = engine.url + encodeURIComponent(q); | |
var left = windowWidth * (i % 3); | |
var top = windowHeight * Math.floor(i / 3); | |
window.open(newUrl, '_blank', 'width=' + windowWidth + ',height=' + windowHeight + ',left=' + left + ',top=' + top); | |
}); | |
} else { | |
alert('Kein "' + currentEngine.param + '" Parameter in der aktuellen URL gefunden.'); | |
} | |
} else { | |
alert('Die aktuelle Seite ist keine bekannte Suchmaschine.'); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment