Created
February 7, 2022 09:51
-
-
Save bernikr/49f82288d252982b7e87e18ee501f32c to your computer and use it in GitHub Desktop.
DDG Maps to google maps
This file contains 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
// ==UserScript== | |
// @name DDG Maps to google maps | |
// @description Redirect you from DDG Maps to Google Maps | |
// @version 0.1 | |
// @match *://*duckduckgo.com/* | |
// @author @bernikr | |
// @grant none | |
// @run-at document-start | |
// ==/UserScript== | |
function checkurl(){ | |
var currentURL = window.document.location.toString(); | |
if(currentURL.includes("iaxm=")) { | |
var newURL = currentURL.replace("://duckduckgo.com","://maps.google.com"); | |
window.document.location.replace(newURL); | |
} | |
} | |
var previousUrl = ''; | |
var observer = new MutationObserver(function(mutations) { | |
if (location.href !== previousUrl) { | |
previousUrl = location.href; | |
checkurl(); | |
} | |
}); | |
observer.observe(document, {attributes: true, childList: true, subtree: true}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
whats the url after you search?