Skip to content

Instantly share code, notes, and snippets.

@bernikr
Created February 7, 2022 09:51
Show Gist options
  • Save bernikr/49f82288d252982b7e87e18ee501f32c to your computer and use it in GitHub Desktop.
Save bernikr/49f82288d252982b7e87e18ee501f32c to your computer and use it in GitHub Desktop.
DDG Maps to google maps
// ==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});
@damoos3
Copy link

damoos3 commented Feb 10, 2022

I used greasemonkey and your script but when i search an address into ddg search. it only shows the default apple maps can you tell me how you did it?

@bernikr
Copy link
Author

bernikr commented Feb 15, 2022

whats the url after you search?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment