Skip to content

Instantly share code, notes, and snippets.

@nevan
Created September 6, 2011 12:44
Show Gist options
  • Select an option

  • Save nevan/1197447 to your computer and use it in GitHub Desktop.

Select an option

Save nevan/1197447 to your computer and use it in GitHub Desktop.

Revisions

  1. nevan revised this gist Sep 6, 2011. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion instagram_map_link.user.js
    Original file line number Diff line number Diff line change
    @@ -12,11 +12,12 @@ var regex = /center=(\-?\d+\.\d+),(\-?\d+\.\d+)/ig;
    var match = regex.exec(text);
    var lat = match[1];
    var lon = match[2];
    var latlon = lat + "," + lon;

    var mapDiv = document.createElement('div');
    mapDiv.id = "mapLink";
    mapDiv.style.width = "395px";

    mapDiv.style.height = "30px";
    mapDiv.innerHTML = "<a class=\"promo\" href=\"http://google.com/maps/?q=" + lat + "," + lon + "\">Google Maps Link</a>";
    mapDiv.innerHTML = "<a class=\"promo\" href=\"http://google.com/maps/?q=" + latlon + "&ll=" + latlon + "\">Google Maps Link</a>";
    document.getElementById('map-container').parentNode.appendChild(mapDiv, document.getElementById('map-container'));
  2. nevan revised this gist Sep 6, 2011. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion instagram_map_link.user.js
    Original file line number Diff line number Diff line change
    @@ -18,5 +18,5 @@ mapDiv.id = "mapLink";
    mapDiv.style.width = "395px";

    mapDiv.style.height = "30px";
    mapDiv.innerHTML = "<a class=\"promo\" href=\"http://google.com/maps/?q=" + lat + "," + lon + "\">Google Map Link</a>";
    mapDiv.innerHTML = "<a class=\"promo\" href=\"http://google.com/maps/?q=" + lat + "," + lon + "\">Google Maps Link</a>";
    document.getElementById('map-container').parentNode.appendChild(mapDiv, document.getElementById('map-container'));
  3. nevan created this gist Sep 6, 2011.
    22 changes: 22 additions & 0 deletions instagram_map_link.user.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    // ==UserScript==
    // @name Instagram Map Link
    // @namespace net.nevan
    // @description Add a link to Google Maps to an Instagram page
    // @include http://instagr.am/p/*
    // @include https://instagr.am/p/*
    // ==/UserScript==
    // Code borrowed from here: https://www.userscripts.org/scripts/review/103487

    var text = document.getElementById('map').src;
    var regex = /center=(\-?\d+\.\d+),(\-?\d+\.\d+)/ig;
    var match = regex.exec(text);
    var lat = match[1];
    var lon = match[2];

    var mapDiv = document.createElement('div');
    mapDiv.id = "mapLink";
    mapDiv.style.width = "395px";

    mapDiv.style.height = "30px";
    mapDiv.innerHTML = "<a class=\"promo\" href=\"http://google.com/maps/?q=" + lat + "," + lon + "\">Google Map Link</a>";
    document.getElementById('map-container').parentNode.appendChild(mapDiv, document.getElementById('map-container'));