add permalink feature
This commit is contained in:
@ -198,3 +198,11 @@ if (typeof String.prototype.startsWith !== 'function') {
|
|||||||
window.prettyEnergy = function(nrg) {
|
window.prettyEnergy = function(nrg) {
|
||||||
return nrg> 1000 ? Math.round(nrg/1000) + ' k': nrg;
|
return nrg> 1000 ? Math.round(nrg/1000) + ' k': nrg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window.setPermaLink = function(elm) {
|
||||||
|
var c = map.getCenter();
|
||||||
|
var lat = Math.round(c.lat*1E6);
|
||||||
|
var lng = Math.round(c.lng*1E6);
|
||||||
|
var qry = 'latE6='+lat+'&lngE6='+lng+'&z=' + map.getZoom();
|
||||||
|
$(elm).attr('href', 'http://www.ingress.com/intel?' + qry);
|
||||||
|
}
|
||||||
|
2
main.js
2
main.js
@ -78,7 +78,7 @@ document.getElementsByTagName('body')[0].innerHTML = ''
|
|||||||
+ ' <input id="geosearch" placeholder="Search location…" type="text"/>'
|
+ ' <input id="geosearch" placeholder="Search location…" type="text"/>'
|
||||||
+ ' <div id="portaldetails"></div>'
|
+ ' <div id="portaldetails"></div>'
|
||||||
+ ' <input id="redeem" placeholder="Redeem code…" type="text"/>'
|
+ ' <input id="redeem" placeholder="Redeem code…" type="text"/>'
|
||||||
+ ' <div id="toolbox"></div>'
|
+ ' <div id="toolbox"><a onmouseover="setPermaLink(this)">permalink</a></div>'
|
||||||
+ ' <div id="spacer"></div>'
|
+ ' <div id="spacer"></div>'
|
||||||
+ ' <div id="updatestatus"></div>'
|
+ ' <div id="updatestatus"></div>'
|
||||||
+ ' </div>';
|
+ ' </div>';
|
||||||
|
@ -519,6 +519,10 @@ aside:nth-child(odd) span {
|
|||||||
font-size:90%;
|
font-size:90%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#toolbox > a {
|
||||||
|
padding: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
#spacer {
|
#spacer {
|
||||||
/* cheap hack to prevent sidebar content being overlayed by the map
|
/* cheap hack to prevent sidebar content being overlayed by the map
|
||||||
* status box */
|
* status box */
|
||||||
|
Reference in New Issue
Block a user