remove unnecessary absolute URLs. site-relative are used where possible (e.g. permalinks, rpc calls) - and a couple of protocol-relative one for automatic http/https matching

This commit is contained in:
Jon Atkins 2013-04-08 05:09:01 +01:00
parent f48aca8864
commit baaaf3e3f1
7 changed files with 11 additions and 13 deletions

View File

@ -231,7 +231,7 @@ window.setupPlayerStat = function() {
+ '<h2 title="'+t+'">'+level+'&nbsp;'
+ '<div id="name">'
+ '<span class="'+cls+'">'+PLAYER.nickname+'</span>'
+ '<a href="https://www.ingress.com/_ah/logout?continue=https://www.google.com/accounts/Logout%3Fcontinue%3Dhttps://appengine.google.com/_ah/logout%253Fcontinue%253Dhttps://www.ingress.com/intel%26service%3Dah" id="signout">sign out</a>'
+ '<a href="/_ah/logout?continue=https://www.google.com/accounts/Logout%3Fcontinue%3Dhttps://appengine.google.com/_ah/logout%253Fcontinue%253Dhttps://www.ingress.com/intel%26service%3Dah" id="signout">sign out</a>'
+ '</div>'
+ '<div id="stats">'
+ '<sup>XM: '+xmRatio+'%</sup>'
@ -386,6 +386,7 @@ try { console.log('Loading included JS now'); } catch(e) {}
try { console.log('done loading included JS'); } catch(e) {}
//note: no protocol - so uses http or https as used on the current page
var JQUERY = 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js';
var JQUERYUI = 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.0/jquery-ui.min.js';

View File

@ -292,7 +292,7 @@ window.chat.writeDataToHash = function(newData, storageHash, isPublicChannel) {
case 'PORTAL':
var latlng = [markup[1].latE6/1E6, markup[1].lngE6/1E6];
var perma = 'https://ingress.com/intel?latE6='+markup[1].latE6+'&lngE6='+markup[1].lngE6+'&z=17&pguid='+markup[1].guid;
var perma = '/intel?latE6='+markup[1].latE6+'&lngE6='+markup[1].lngE6+'&z=17&pguid='+markup[1].guid;
var js = 'window.zoomToAndShowPortal(\''+markup[1].guid+'\', ['+latlng[0]+', '+latlng[1]+']);return false';
msg += '<a onclick="'+js+'"'

View File

@ -50,7 +50,7 @@ window.renderPortalDetails = function(guid) {
var lat = d.locationE6.latE6;
var lng = d.locationE6.lngE6;
var perma = 'https://ingress.com/intel?latE6='+lat+'&lngE6='+lng+'&z=17&pguid='+guid;
var perma = '/intel?latE6='+lat+'&lngE6='+lng+'&z=17&pguid='+guid;
var imgTitle = 'title="'+getPortalDescriptionFromDetails(d)+'\n\nClick to show full image."';
var poslinks = 'window.showPortalPosLinks('+lat/1E6+','+lng/1E6+',\'' + d.portalV2.descriptiveText.TITLE + '\')';
var postcard = 'Send in a postcard. Will put it online after receiving. Address:\\n\\nStefan Breunig\\nINF 305 R045\\n69120 Heidelberg\\nGermany';

View File

@ -59,10 +59,7 @@ window.postAjax = function(action, data, success, error) {
var remove = function(data, textStatus, jqXHR) { window.requests.remove(jqXHR); };
var errCnt = function(jqXHR) { window.failedRequestCount++; window.requests.remove(jqXHR); };
var result = $.ajax({
// use full URL to avoid issues depending on how people set their
// slash. See:
// https://github.com/breunigs/ingress-intel-total-conversion/issues/56
url: window.location.protocol + '//www.ingress.com/rpc/dashboard.'+action,
url: '/rpc/dashboard.'+action,
type: 'POST',
data: data,
dataType: 'json',
@ -261,7 +258,7 @@ window.setPermaLink = function(elm) {
var lat = Math.round(c.lat*1E6);
var lng = Math.round(c.lng*1E6);
var qry = 'latE6='+lat+'&lngE6='+lng+'&z=' + (map.getZoom()-1);
$(elm).attr('href', 'https://www.ingress.com/intel?' + qry);
$(elm).attr('href', '/intel?' + qry);
}
window.uniqueArray = function(arr) {

View File

@ -61,7 +61,7 @@ document.getElementsByTagName('head')[0].innerHTML = ''
+ '<style>@@INCLUDESTRING:style.css@@</style>'
+ '<style>@@INCLUDESTRING:external/leaflet.css@@</style>'
//note: smartphone.css injection moved into code/smartphone.js
+ '<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Coda"/>';
+ '<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Coda"/>';
document.getElementsByTagName('body')[0].innerHTML = ''
+ '<div id="map">Loading, please wait</div>'
@ -168,7 +168,7 @@ window.RANGE_INDICATOR_COLOR = 'red'
window.PORTAL_RADIUS_ENLARGE_MOBILE = 5;
window.DEFAULT_PORTAL_IMG = 'https://commondatastorage.googleapis.com/ingress/img/default-portal-image.png';
window.DEFAULT_PORTAL_IMG = '//commondatastorage.googleapis.com/ingress/img/default-portal-image.png';
window.NOMINATIM = 'http://nominatim.openstreetmap.org/search?format=json&limit=1&q=';
// INGRESS CONSTANTS /////////////////////////////////////////////////

View File

@ -200,7 +200,7 @@ window.plugin.apList.getPortalLink = function(portal) {
var latlng = [portal.locationE6.latE6/1E6, portal.locationE6.lngE6/1E6].join();
var jsSingleClick = 'window.plugin.apList.selectPortal(\''+portal.guid+'\');return false';
var jsDoubleClick = 'window.zoomToAndShowPortal(\''+portal.guid+'\', ['+latlng+']);return false';
var perma = 'https://ingress.com/intel?latE6='+portal.locationE6.latE6
var perma = '/intel?latE6='+portal.locationE6.latE6
+'&lngE6='+portal.locationE6.lngE6+'&z=17&pguid='+portal.guid;
//Use Jquery to create the link, which escape characters in TITLE and ADDRESS of portal
var a = $('<a>',{

View File

@ -353,7 +353,7 @@ window.plugin.portalslist.exportKML = function(){
// description contain picture of the portal, address and link to the Intel map
var description = '<![CDATA['
+ '<div><table><tr><td><img style="width:100px" src="' + portal.img + '"></td><td>' + portal.address
+ '<br><a href="https://ingress.com/intel?latE6=' + portal.lat*1E6 + '&lngE6=' + portal.lng*1E6 + '&z=17">Link to Intel Map</a></td></tr></table>'
+ '<br><a href="https://www.ingress.com/intel?latE6=' + portal.lat*1E6 + '&lngE6=' + portal.lng*1E6 + '&z=17">Link to Intel Map</a></td></tr></table>'
+ ']]>';
kml += '<Placemark><name>L' + Math.floor(portal.level) + ' - ' + portal.name + '</name>'
@ -387,7 +387,7 @@ window.plugin.portalslist.getPortalLink = function(portal,guid) {
var latlng = [portal.locationE6.latE6/1E6, portal.locationE6.lngE6/1E6].join();
var jsSingleClick = 'window.renderPortalDetails(\''+guid+'\');return false';
var jsDoubleClick = 'window.zoomToAndShowPortal(\''+guid+'\', ['+latlng+']);return false';
var perma = 'https://ingress.com/intel?latE6='+portal.locationE6.latE6+'&lngE6='+portal.locationE6.lngE6+'&z=17&pguid='+guid;
var perma = '/intel?latE6='+portal.locationE6.latE6+'&lngE6='+portal.locationE6.lngE6+'&z=17&pguid='+guid;
//Use Jquery to create the link, which escape characters in TITLE and ADDRESS of portal
var a = $('<a>',{