Due to ingress.com/intel now force-redirecting to the HTTPS version,
loading dependencies just got a lot harder. External JS and CSS files are now included directly in the file while building. This does not yet work for plugins. I will make an emergency release soon, so at least main works.
This commit is contained in:
27
code/boot.js
27
code/boot.js
@ -291,28 +291,17 @@ function boot() {
|
||||
// Copyright (c) 2010 Chris O'Hara <cohara87@gmail.com>. MIT Licensed
|
||||
function asyncLoadScript(a){return function(b,c){var d=document.createElement("script");d.type="text/javascript",d.src=a,d.onload=b,d.onerror=c,d.onreadystatechange=function(){var a=this.readyState;if(a==="loaded"||a==="complete")d.onreadystatechange=null,b()},head.insertBefore(d,head.firstChild)}}(function(a){a=a||{};var b={},c,d;c=function(a,d,e){var f=a.halt=!1;a.error=function(a){throw a},a.next=function(c){c&&(f=!1);if(!a.halt&&d&&d.length){var e=d.shift(),g=e.shift();f=!0;try{b[g].apply(a,[e,e.length,g])}catch(h){a.error(h)}}return a};for(var g in b){if(typeof a[g]=="function")continue;(function(e){a[e]=function(){var g=Array.prototype.slice.call(arguments);if(e==="onError"){if(d)return b.onError.apply(a,[g,g.length]),a;var h={};return b.onError.apply(h,[g,g.length]),c(h,null,"onError")}return g.unshift(e),d?(a.then=a[e],d.push(g),f?a:a.next()):c({},[g],e)}})(g)}return e&&(a.then=a[e]),a.call=function(b,c){c.unshift(b),d.unshift(c),a.next(!0)},a.next()},d=a.addMethod=function(d){var e=Array.prototype.slice.call(arguments),f=e.pop();for(var g=0,h=e.length;g<h;g++)typeof e[g]=="string"&&(b[e[g]]=f);--h||(b["then"+d.substr(0,1).toUpperCase()+d.substr(1)]=f),c(a)},d("chain",function(a){var b=this,c=function(){if(!b.halt){if(!a.length)return b.next(!0);try{null!=a.shift().call(b,c,b.error)&&c()}catch(d){b.error(d)}}};c()}),d("run",function(a,b){var c=this,d=function(){c.halt||--b||c.next(!0)},e=function(a){c.error(a)};for(var f=0,g=b;!c.halt&&f<g;f++)null!=a[f].call(c,d,e)&&d()}),d("defer",function(a){var b=this;setTimeout(function(){b.next(!0)},a.shift())}),d("onError",function(a,b){var c=this;this.error=function(d){c.halt=!0;for(var e=0;e<b;e++)a[e].call(c,d)}})})(this);var head=document.getElementsByTagName("head")[0]||document.documentElement;addMethod("load",function(a,b){for(var c=[],d=0;d<b;d++)(function(b){c.push(asyncLoadScript(a[b]))})(d);this.call("run",c)})
|
||||
|
||||
|
||||
try { console.log('Loading included JS now'); } catch(e) {}
|
||||
@@INCLUDERAW:external/leaflet.js@@
|
||||
// modified version of https://github.com/shramov/leaflet-plugins. Also
|
||||
// contains the default Ingress map style.
|
||||
var LEAFLETGOOGLE = 'https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/dist/leaflet_google.js';
|
||||
@@INCLUDERAW:external/leaflet_google.js@@
|
||||
@@INCLUDERAW:external/autolink.js@@
|
||||
@@INCLUDERAW:external/jquery.qrcode.min.js@@
|
||||
try { console.log('done loading included JS'); } catch(e) {}
|
||||
|
||||
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';
|
||||
var JQUERYQRCODE = 'https://raw.github.com/jeromeetienne/jquery-qrcode/master/jquery.qrcode.min.js';
|
||||
var LEAFLET = 'http://cdn.leafletjs.com/leaflet-0.5/leaflet.js';
|
||||
var AUTOLINK = 'https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/dist/autolink.js';
|
||||
var EMPTY = 'data:text/javascript;base64,';
|
||||
|
||||
// don’t download resources which have been injected already
|
||||
var ir = window && window.internalResources ? window.internalResources : [];
|
||||
if(ir.indexOf('jquery') !== -1) JQUERY = EMPTY;
|
||||
if(ir.indexOf('jqueryui') !== -1) JQUERYUI = EMPTY;
|
||||
if(ir.indexOf('jqueryqrcode') !== -1) JQUERYQRCODE = EMPTY;
|
||||
if(ir.indexOf('leaflet') !== -1) LEAFLET = EMPTY;
|
||||
if(ir.indexOf('autolink') !== -1) AUTOLINK = EMPTY;
|
||||
if(ir.indexOf('leafletgoogle') !== -1) LEAFLETGOOGLE = EMPTY;
|
||||
|
||||
|
||||
// after all scripts have loaded, boot the actual app
|
||||
load(JQUERY, LEAFLET, AUTOLINK).then(LEAFLETGOOGLE, JQUERYUI, JQUERYQRCODE).onError(function (err) {
|
||||
alert('Could not all resources, the script likely won’t work.\n\nIf this happend the first time for you, it’s probably a temporary issue. Just wait a bit and try again.\n\nIf you installed the script for the first time and this happens:\n– try disabling NoScript if you have it installed\n– press CTRL+SHIFT+K in Firefox or CTRL+SHIFT+I in Chrome/Opera and reload the page. Additional info may be available in the console.\n– Open an issue at https://github.com/breunigs/ingress-intel-total-conversion/issues');
|
||||
}).thenRun(boot);
|
||||
load(JQUERY).then(JQUERYUI).thenRun(boot);
|
||||
|
Reference in New Issue
Block a user