Skip to content

Instantly share code, notes, and snippets.

@navinpai
Last active August 29, 2015 14:27
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 navinpai/840bbad0ef0a3e238273 to your computer and use it in GitHub Desktop.
Save navinpai/840bbad0ef0a3e238273 to your computer and use it in GitHub Desktop.
Look Outside
//Script which takes the current APOD photo and shows it in an svg along with a #LookOutside reminder
$.get( "https://api.nasa.gov/planetary/apod?api_key=NNKOjkoul8n1CH18TWA9gwngW1s1SmjESPjNoUFo", function(data) {
var url = data.url;
var bg = document.createElementNS('http://www.w3.org/2000/svg','image');
bg.setAttributeNS(null,'height','450');
bg.setAttributeNS(null,'width','600');
bg.setAttributeNS('http://www.w3.org/1999/xlink','href',url);
bg.setAttributeNS(null, 'visibility', 'visible');
$('#lookoutside').append(bg);
var fg = document.createElementNS('http://www.w3.org/2000/svg','image');
fg.setAttributeNS(null,'height','250');
fg.setAttributeNS(null,'width','250');
fg.setAttributeNS('http://www.w3.org/1999/xlink','href','http://i.imgur.com/ImNlxrm.png');
fg.setAttributeNS(null,'x','0');
fg.setAttributeNS(null,'y','200');
fg.setAttributeNS(null, 'visibility', 'visible');
$('#lookoutside').append(fg);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment