Last active
December 10, 2015 03:29
-
-
Save rviscomi/4374919 to your computer and use it in GitHub Desktop.
Produces a permalink in the Ingress Intel Map comm chat so that others can go directly to a map centered on your current coordinates and zoom level.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function ($) { | |
function getURL(center, zoom) { | |
var lt = Math.round(center.lat() * 1e6), | |
ln = Math.round(center.lng() * 1e6); | |
return '?latE6=' + lt + '&lngE6=' + ln + '&z=' + zoom; | |
} | |
var m = Z.d().h, | |
url = getURL(m.getCenter(), m.getZoom()), | |
d = new Date(), | |
h = d.getHours(), | |
a = h < 12 ? 'AM' : 'PM', | |
h = h%12 ? h%12 : 12, | |
m = d.getMinutes(), | |
m = m < 10 ? '0' + m : m, | |
t = h + ':' + m + a; | |
$('#plexts').append('<div class=\'plext\'><div class=\'pl_timestamp\'>' + t + '</div><div class=\'pl_content pl_narrow\'><a href=\'' + url + '\' target=\'_blank\' class=\'pl_narrow pl_portal_name\'>Permalink to this map</a></div></div>'); | |
})(jQuery) |
I took out all of the date-related logic and this works nicely as a bookmarklet. Just set your t variable to some identifiable value (I used "LINK") instead of the time....
bcj19 - thanks, the bookmarklet works great!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
would also love tosee this as a bookmarklet!