#123 Added script imports for JS libraries no longer webpacked

master
Keith Irwin 2018-03-08 21:26:41 +00:00
parent fbbc290798
commit 9b7a428c97
No known key found for this signature in database
GPG Key ID: 378933C743E2BBC0
5 changed files with 8 additions and 24 deletions

10
package-lock.json generated
View File

@ -3850,11 +3850,6 @@
"handlebars": "4.0.11" "handlebars": "4.0.11"
} }
}, },
"jquery": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/jquery/-/jquery-3.2.1.tgz",
"integrity": "sha1-XE2d5lKvbNCncBVKYxu6ErAVx4c="
},
"js-tokens": { "js-tokens": {
"version": "3.0.2", "version": "3.0.2",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz",
@ -4022,11 +4017,6 @@
"type-check": "0.3.2" "type-check": "0.3.2"
} }
}, },
"load-google-maps-api": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/load-google-maps-api/-/load-google-maps-api-1.0.1.tgz",
"integrity": "sha512-sRpeyQEaf2WehASD4F8poa4iHWU3qCrw2qvUX4tDWBK0BqpXpkE2TVMeke73YiEZghFo8nUqcxtpC7N/93EqIQ=="
},
"load-json-file": { "load-json-file": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz",

View File

@ -15,8 +15,6 @@
"express-request-limit": "^1.0.2", "express-request-limit": "^1.0.2",
"helmet": "^3.12.0", "helmet": "^3.12.0",
"helmet-csp": "^2.7.0", "helmet-csp": "^2.7.0",
"jquery": "^3.2.1",
"load-google-maps-api": "^1.0.0",
"minifier": "^0.8.1", "minifier": "^0.8.1",
"moment": "^2.18.1", "moment": "^2.18.1",
"mongo-sanitize": "^1.0.0", "mongo-sanitize": "^1.0.0",
@ -35,7 +33,6 @@
"request": "^2.82.0", "request": "^2.82.0",
"slug": "^0.9.1", "slug": "^0.9.1",
"socket.io": "^2.0.3", "socket.io": "^2.0.3",
"socket.io-client": "^2.0.3",
"xss": "^0.3.4", "xss": "^0.3.4",
"zxcvbn": "^4.4.2" "zxcvbn": "^4.4.2"
}, },

View File

@ -65,6 +65,7 @@ let ready_promise_list = []
'script-src': ["'self'", 'script-src': ["'self'",
"'unsafe-inline'", // TODO: Get rid of this "'unsafe-inline'", // TODO: Get rid of this
'https://code.jquery.com', 'https://code.jquery.com',
'https://cdnjs.cloudflare.com/ajax/libs/socket.io/*',
'https://cdnjs.cloudflare.com/ajax/libs/moment.js/*', 'https://cdnjs.cloudflare.com/ajax/libs/moment.js/*',
'https://www.google.com/recaptcha', 'https://www.google.com/recaptcha',
'https://www.google-analytics.com', 'https://www.google-analytics.com',

View File

@ -1,5 +1,5 @@
'use strict' 'use strict'
/* global alert io $ loadGoogleMapsAPI mapuser userid disp noHeader mapKey navigator token */ /* global alert io $ mapuser userid disp noHeader mapKey navigator token */
// Variables // Variables
@ -199,8 +199,7 @@ $(function () {
}) })
// Load google maps API // Load google maps API
loadGoogleMapsAPI({ key: mapKey }) function initMap(googlemaps) {
.then(function (googlemaps) {
// Create map // Create map
if (disp !== '1') { if (disp !== '1') {
@ -458,6 +457,4 @@ loadGoogleMapsAPI({ key: mapKey })
} }
// Error loading gmaps API // Error loading gmaps API
}).catch(function (err) { }
console.error(err.stack)
})

View File

@ -107,17 +107,16 @@
<!-- TODO: Move to own script file, maybe with https://github.com/brooklynDev/JShare --> <!-- TODO: Move to own script file, maybe with https://github.com/brooklynDev/JShare -->
<script> <script>
const mapuser = JSON.parse('{{mapuser |dump|safe}}'), const mapuser = JSON.parse('{{mapuser |dump|safe}}'),
mapKey = "{{mapApi |safe}}",
noHeader = "{{noHeader |safe}}", noHeader = "{{noHeader |safe}}",
disp = "{{disp |safe}}", // 0=map, 1=streetview, 2=both disp = "{{disp |safe}}", // 0=map, 1=streetview, 2=both
userid = "{{user._id |safe}}", userid = "{{user._id |safe}}",
token = "{{user.sk32 |safe}}"; token = "{{user.sk32 |safe}}";
</script> </script>
<!-- Webpacked bundles --> <!-- Imports -->
<script type="application/javascript" src="https://maps.googleapis.com/maps/api/js?key={{mapApi|safe}}&callback=initMap"
async defer></script>
<script type="application/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.0.4/socket.io.slim.js" integrity="sha256-jniDwC1PC9OmGoyPxA9VpGvgwDYyxsMqu5Q4OrF5wNY=" crossorigin="anonymous"></script>
<script type="application/javascript" src="/static/js/.map.bun.js"></script> <script type="application/javascript" src="/static/js/.map.bun.js"></script>
<!--{% if user.id == mapuser.id %}-->
<!--<script type="application/javascript" src="/static/js/.controls.bun.js"></script>-->
<!--{% endif %}-->
{% endblock %} {% endblock %}