add permalink feature

This commit is contained in:
Stefan Breunig
2013-02-10 23:49:01 +01:00
parent e1c3c9e73b
commit e92a9e13b1
3 changed files with 13 additions and 1 deletions

View File

@ -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);
}

View File

@ -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>';

View File

@ -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 */