Skip to content

Instantly share code, notes, and snippets.

@amirhp-com
Last active July 9, 2024 05:58
Show Gist options
  • Save amirhp-com/1f30132afbb54970930690d06dc9a764 to your computer and use it in GitHub Desktop.
Save amirhp-com/1f30132afbb54970930690d06dc9a764 to your computer and use it in GitHub Desktop.
Remove Google Map "FOR DEVELOPMENT PURPOSES ONLY" Watermark !
/*
📝 Remove "For Development Only" Watermark on GOOGLE MAP 😁
👤 SCRIPT BY AmirhpCom ( https://amirhp.com/) 👑
➕ Add this code on your project and edit langID,mapCanvas variables
*/
var langID = "en-US", mapCanvas = "#map-canvas", $ = jQuery;
setInterval(function () {googlemap_remap();}, 10);
function googlemap_remap() {
$(`${mapCanvas}>div:last-of-type`).hide(); //hide top message says this is for dev only
var gimg = $(`img[src*="maps.googleapis.com/maps/vt?"]:not(.gmf)`);
$.each(gimg, function(i,x){
var imgurl = $(x).attr("src");
var urlarray = imgurl.split('!');
var newurl = ""; var newc = 0;
for (i = 0; i < 1000; i++) {if (urlarray[i] == "2s"+langID){newc = i-3;break;}}
for (i = 0; i < newc+1; i++) {newurl += urlarray[i] + "!";}
$(x).attr("src",newurl).addClass("gmf");
});
}
@bryanjaybodino
Copy link

this is the message showing up

image

@amirhp-com
Copy link
Author

Hi, thanks for reaching out. Yes, this message was displayed before, it's because we manipulate the structure of the map and there's no way to get rid of it. But it's worth using the trick, isn't it?

@bryanjaybodino
Copy link

I see but thanks for this code. I think it is ok even if it has that kind of error message since I am using the API for free.
by the way it this is a nice trick

@robotelro
Copy link

It only works for the street layer, not for the terrain one

@tus512
Copy link

tus512 commented Dec 9, 2023

this is the message showing up

image

You can turn off this alert by adding this javascript code:

var buttons = document.querySelectorAll(".dismissButton");
buttons.forEach(function (button) {
      button.click();
});

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