fix protocol-related error for http + https support

This commit is contained in:
Jon Atkins 2013-03-16 20:21:05 +00:00
parent 38f22989d6
commit bc5939818c
2 changed files with 6 additions and 11 deletions

View File

@ -62,7 +62,7 @@ window.postAjax = function(action, data, success, error) {
// use full URL to avoid issues depending on how people set their // use full URL to avoid issues depending on how people set their
// slash. See: // slash. See:
// https://github.com/breunigs/ingress-intel-total-conversion/issues/56 // https://github.com/breunigs/ingress-intel-total-conversion/issues/56
url: 'https://www.ingress.com/rpc/dashboard.'+action, url: window.location.protocol + '//www.ingress.com/rpc/dashboard.'+action,
type: 'POST', type: 'POST',
data: data, data: data,
dataType: 'json', dataType: 'json',
@ -108,7 +108,7 @@ window.rangeLinkClick = function() {
window.showPortalPosLinks = function(lat, lng) { window.showPortalPosLinks = function(lat, lng) {
if (typeof android !== 'undefined' && android && android.intentPosLink) { if (typeof android !== 'undefined' && android && android.intentPosLink) {
android.intentPosLink('https://maps.google.com/?q='+lat+','+lng); android.intentPosLink(window.location.protocol + '//maps.google.com/?q='+lat+','+lng);
} else { } else {
var qrcode = '<div id="qrcode"></div>'; var qrcode = '<div id="qrcode"></div>';
var script = '<script>$(\'#qrcode\').qrcode({text:\'GEO:'+lat+','+lng+'\'});</script>'; var script = '<script>$(\'#qrcode\').qrcode({text:\'GEO:'+lat+','+lng+'\'});</script>';

View File

@ -1,7 +1,7 @@
// ==UserScript== // ==UserScript==
// @id ingress-intel-total-conversion@jonatkins // @id ingress-intel-total-conversion@jonatkins
// @name intel map total conversion // @name intel map total conversion
// @version 0.8.2-2013-03-16-194450-jonatkins // @version 0.9.0-2013-03-16-200744-jonatkins
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion // @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @updateURL http://iitc.jonatkins.com/dist/total-conversion-build.user.js // @updateURL http://iitc.jonatkins.com/dist/total-conversion-build.user.js
// @downloadURL http://iitc.jonatkins.com/dist/total-conversion-build.user.js // @downloadURL http://iitc.jonatkins.com/dist/total-conversion-build.user.js
@ -16,16 +16,11 @@
// REPLACE ORIG SITE /////////////////////////////////////////////////// // REPLACE ORIG SITE ///////////////////////////////////////////////////
if(document.getElementsByTagName('html')[0].getAttribute('itemscope') != null) if(document.getElementsByTagName('html')[0].getAttribute('itemscope') != null)
throw('Ingress Intel Website is down, not a userscript issue.'); throw('Ingress Intel Website is down, not a userscript issue.');
window.iitcBuildDate = '2013-03-16-194450'; window.iitcBuildDate = '2013-03-16-200744';
// disable vanilla JS // disable vanilla JS
window.onload = function() {}; window.onload = function() {};
if(window.location.protocol !== 'https:') {
var redir = window.location.href.replace(/^http:/, 'https:');
window.location = redir;
throw('Need to load HTTPS version.');
}
// rescue user data from original page // rescue user data from original page
var scr = document.getElementsByTagName('script'); var scr = document.getElementsByTagName('script');
@ -1658,12 +1653,12 @@ d+"px").css("background-color",a.isDark(e,i)?h.foreground:h.background).appendTo
function boot() { function boot() {
window.debug.console.overwriteNativeIfRequired(); window.debug.console.overwriteNativeIfRequired();
console.log('loading done, booting. Built: 2013-03-16-194450'); console.log('loading done, booting. Built: 2013-03-16-200744');
if(window.deviceID) console.log('Your device ID: ' + window.deviceID); if(window.deviceID) console.log('Your device ID: ' + window.deviceID);
window.runOnSmartphonesBeforeBoot(); window.runOnSmartphonesBeforeBoot();
// overwrite default Leaflet Marker icon to be a neutral color // overwrite default Leaflet Marker icon to be a neutral color
var base = 'https://iitc.jonatkins.com/dist/images'; var base = 'http://iitc.jonatkins.com/dist/images';
L.Icon.Default.imagePath = base; L.Icon.Default.imagePath = base;
window.iconEnl = L.Icon.Default.extend({options: { iconUrl: base + '/marker-green.png' } }); window.iconEnl = L.Icon.Default.extend({options: { iconUrl: base + '/marker-green.png' } });