From 19d343c251619b87411c6de5d80fab41aee51de1 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 14 Aug 2021 18:08:21 -0700 Subject: Switch to local dependencies --- .gitignore | 1 + package.json | 8 ++++++++ web/load.js | 36 +++++++++++------------------------- 3 files changed, 20 insertions(+), 25 deletions(-) diff --git a/.gitignore b/.gitignore index 2082430..a9a9198 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ nbproject/ web/app.min.js web/modern +web/lib sencha-error-* node_modules package-lock.json diff --git a/package.json b/package.json index 9e31857..52fab48 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,17 @@ { "name": "traccar-web", + "dependencies": { + "extjs-gpl": "^6.2.0", + "ol": "^6.6.1", + "ol-layerswitcher": "^3.8.3", + "openlayers-dist": "^6.6.1", + "proj4": "^2.7.5" + }, "devDependencies": { "eslint": "^4.4.1" }, "scripts": { + "postinstall": "mkdir -p web/lib/{ol,ol-layerswitcher,proj4,extjs} && cp ./node_modules/openlayers-dist/{ol.js,ol.css} web/lib/ol/ && cp ./node_modules/ol-layerswitcher/dist/{ol-layerswitcher.js,ol-layerswitcher.css} web/lib/ol-layerswitcher/ && cp ./node_modules/proj4/dist/proj4.js web/lib/proj4/ && cp ./node_modules/extjs-gpl/build/ext-all.js web/lib/extjs/ && mkdir -p web/lib/extjs/classic && cp -r ./node_modules/extjs-gpl/build/classic/locale web/lib/extjs/classic/locale && cp -r ./node_modules/extjs-gpl/build/classic/theme-triton web/lib/extjs/classic/theme-triton && mkdir -p web/lib/extjs/packages/charts && cp -r ./node_modules/extjs-gpl/build/packages/charts/classic web/lib/extjs/packages/charts/classic", "lint": "./node_modules/.bin/eslint web/." } } diff --git a/web/load.js b/web/load.js index 26a651c..9e9cd8f 100644 --- a/web/load.js +++ b/web/load.js @@ -156,36 +156,22 @@ navigator.__defineGetter__('userAgent', function () { return __originalUserAgent.replace(/\/OPR[^)]*/g, ''); }); } - extjsVersion = '6.2.0'; - olVersion = '6.5.0'; - olLayerSwitcherVersion = '3.8.3'; - proj4jsVersion = '2.6.0'; - - if (debugMode) { - addScriptFile('https://cdn.traccar.com/js/extjs/' + extjsVersion + '/ext-all-debug.js'); - addScriptFile('https://cdn.traccar.com/js/extjs/' + extjsVersion + '/packages/charts/classic/charts-debug.js'); - } else { - addScriptFile('https://cdn.traccar.com/js/extjs/' + extjsVersion + '/ext-all.js'); - addScriptFile('https://cdn.traccar.com/js/extjs/' + extjsVersion + '/packages/charts/classic/charts.js'); - } - addScriptFile('https://cdn.traccar.com/js/extjs/' + extjsVersion + '/classic/locale/locale-' + locale.languages[locale.language].code + '.js'); + addScriptFile('lib/extjs/ext-all.js'); + addScriptFile('lib/extjs/classic/locale/locale-' + locale.languages[locale.language].code + '.js'); - addStyleFile('https://cdn.traccar.com/js/extjs/' + extjsVersion + '/classic/theme-triton/resources/theme-triton-all.css'); - addScriptFile('https://cdn.traccar.com/js/extjs/' + extjsVersion + '/classic/theme-triton/theme-triton.js'); + addStyleFile('lib/extjs/classic/theme-triton/resources/theme-triton-all.css'); + addScriptFile('lib/extjs/classic/theme-triton/theme-triton.js'); - addStyleFile('https://cdn.traccar.com/js/extjs/' + extjsVersion + '/packages/charts/classic/triton/resources/charts-all.css'); + addScriptFile('lib/extjs/packages/charts/classic/charts.js'); + addStyleFile('lib/extjs/packages/charts/classic/triton/resources/charts-all.css'); - addStyleFile('https://cdn.traccar.com/js/ol/' + olVersion + '/ol.css'); - addScriptFile('https://cdn.traccar.com/js/ol/' + olVersion + '/ol.js'); + addStyleFile('lib/ol/ol.css'); + addScriptFile('lib/ol/ol.js'); - addStyleFile('https://cdn.traccar.com/js/ol-layerswitcher/' + olLayerSwitcherVersion + '/ol-layerswitcher.css'); - addScriptFile('https://cdn.traccar.com/js/ol-layerswitcher/' + olLayerSwitcherVersion + '/ol-layerswitcher.js'); + addStyleFile('lib/ol-layerswitcher/ol-layerswitcher.css'); + addScriptFile('lib/ol-layerswitcher/ol-layerswitcher.js'); - if (debugMode) { - addScriptFile('https://cdn.traccar.com/js/proj4js/' + proj4jsVersion + '/proj4-src.js'); - } else { - addScriptFile('https://cdn.traccar.com/js/proj4js/' + proj4jsVersion + '/proj4.js'); - } + addScriptFile('lib/proj4/proj4.js'); window.Images = ['arrow', 'default', 'animal', 'bicycle', 'boat', 'bus', 'car', 'crane', 'helicopter', 'motorcycle', 'offroad', 'person', 'pickup', 'plane', 'ship', 'tractor', 'train', 'tram', 'trolleybus', 'truck', 'van', 'scooter']; -- cgit v1.2.3