|
|
@@ -1,7 +1,7 @@
|
|
|
|
|
|
/* eslint-env es2015 */
|
|
|
-
|
|
|
/* eslint-disable no-var */
|
|
|
+/* eslint-disable prefer-template */
|
|
|
|
|
|
if (window.location.hostname.endsWith('.github.io')) {
|
|
|
window.location.replace('https://netron.app');
|
|
|
@@ -10,11 +10,11 @@ if (window.location.hostname.endsWith('.github.io')) {
|
|
|
window.exports = {};
|
|
|
|
|
|
window.exports.require = function(id, callback) {
|
|
|
- var url = new URL(`${id}.js`, window.location.href).href;
|
|
|
+ var url = window.location.href + id + '.js';
|
|
|
var scripts = document.head.getElementsByTagName('script');
|
|
|
for (var i = 0; i < scripts.length; i++) {
|
|
|
if (url === scripts[i].getAttribute('src')) {
|
|
|
- throw new Error(`Duplicate import of '${url}'.`);
|
|
|
+ throw new Error("Duplicate import of '" + url + "'.");
|
|
|
}
|
|
|
}
|
|
|
var script = document.createElement('script');
|
|
|
@@ -29,7 +29,7 @@ window.exports.require = function(id, callback) {
|
|
|
var errorHandler = function(e) {
|
|
|
script.removeEventListener('load', loadHandler);
|
|
|
script.removeEventListener('error', errorHandler);
|
|
|
- callback(null, new Error(`The script '${e.target.src}' failed to load.`));
|
|
|
+ callback(null, new Error("The script '" + e.target.src + "' failed to load."));
|
|
|
};
|
|
|
/* eslint-enable no-use-before-define */
|
|
|
script.addEventListener('load', loadHandler, false);
|
|
|
@@ -40,9 +40,9 @@ window.exports.require = function(id, callback) {
|
|
|
|
|
|
window.exports.preload = function(callback) {
|
|
|
var modules = [
|
|
|
- [ './view' ],
|
|
|
- [ './json', './xml', './protobuf', './hdf5', './grapher', './browser' ],
|
|
|
- [ './base', './text', './flatbuffers', './flexbuffers', './zip', './tar', './python', './dagre' ]
|
|
|
+ [ 'view' ],
|
|
|
+ [ 'json', 'xml', 'protobuf', 'hdf5', 'grapher', 'browser' ],
|
|
|
+ [ 'base', 'text', 'flatbuffers', 'flexbuffers', 'zip', 'tar', 'python', 'dagre' ]
|
|
|
];
|
|
|
var next = function() {
|
|
|
if (modules.length === 0) {
|
|
|
@@ -97,7 +97,8 @@ window.addEventListener('error', function (event) {
|
|
|
});
|
|
|
|
|
|
window.addEventListener('load', function() {
|
|
|
- if (!Symbol || !Symbol.asyncIterator || !DataView.prototype.getBigInt64 || !DataView.prototype.getBigUint64) {
|
|
|
+ if (typeof Symbol !== 'function' || typeof Symbol.asyncIterator !== 'symbol' ||
|
|
|
+ typeof BigInt !== 'function' || typeof BigInt.asIntN !== 'function' || typeof BigInt.asUintN !== 'function') {
|
|
|
throw new Error('Your browser is not supported.');
|
|
|
}
|
|
|
window.exports.preload(function(value, error) {
|