Skip to content

Instantly share code, notes, and snippets.

@RadGH
Last active August 29, 2015 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RadGH/f992407fc42a41e696ce to your computer and use it in GitHub Desktop.
Save RadGH/f992407fc42a41e696ce to your computer and use it in GitHub Desktop.
Download images from "Earth View from Google Maps"
// Allows downloading the background image from the "Earth View from Google Maps" extension for Chrome:
// https://chrome.google.com/webstore/detail/earth-view-from-google-ma/bhloflhklmhfpedakmangadcdofhnnoh
//
// HOW TO USE:
// 1. Open a new tab to see your earth view, preferably something you want to download.
// 2. Open the javascript console (Ctrl+Shift+J). Note that the regular inspector may freeze due to the large data-uri, so you must go straight to the javascript console.
// 3. Paste the following code to the console, which will create a download link above the earth icon in the corner:
// 4. Image will open in a new tab when you click the link. You can then save it.
var link = document.createElement('a');
link.appendChild( document.createTextNode( "Open Image" ) );
link.href = $('.background').style["background-image"].replace(/(^url\(|\)\;?$)/g, '');
link.target = "_blank";
link.setAttribute('style', 'position: absolute; right: 20px; bottom: 110px');
document.getElementsByClassName('content')[0].appendChild( link );
@RadGH
Copy link
Author

RadGH commented May 10, 2015

Bookmarklet version:

javascript:(function()%7Bvar%20link%20%3D%20document.createElement('a')%3Blink.appendChild(%20document.createTextNode(%20%22Open%20Image%22%20)%20)%3Blink.href%20%3D%20%24('.background').style%5B%22background-image%22%5D.replace(%2F(%5Eurl%5C(%7C%5C)%5C%3B%3F%24)%2Fg%2C%20'')%3Blink.target%20%3D%20%22_blank%22%3Blink.setAttribute('style'%2C%20'position%3A%20absolute%3B%20right%3A%2020px%3B%20bottom%3A%20110px')%3Bdocument.getElementsByClassName('content')%5B0%5D.appendChild(%20link%20)%7D)()

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