|
@@ -192,32 +192,36 @@
|
|
|
<script src="https://releases.transloadit.com/uppy/v2.4.1/uppy.legacy.min.js" nomodule></script>
|
|
|
|
|
|
<script>
|
|
|
- var TUS_ENDPOINT = 'https://tusd.tusdemo.net/files/'
|
|
|
- var COMPANION_ENDPOINT = 'http://localhost:3020'
|
|
|
- if (location.hostname === 'uppy.io') {
|
|
|
- COMPANION_ENDPOINT = '//companion.uppy.io'
|
|
|
- }
|
|
|
-
|
|
|
- var uppy = new Uppy.Core({ debug: true })
|
|
|
- .use(Uppy.Dashboard, {
|
|
|
- target: '#demo',
|
|
|
- inline: true,
|
|
|
- metaFields: [
|
|
|
- { id: 'license', name: 'License', placeholder: 'specify license' },
|
|
|
- { id: 'caption', name: 'Caption', placeholder: 'describe what the image is about' }
|
|
|
- ]
|
|
|
+ window.addEventListener('DOMContentLoaded', function() {
|
|
|
+ 'use strict'
|
|
|
+ var TUS_ENDPOINT = 'https://tusd.tusdemo.net/files/'
|
|
|
+ var COMPANION_ENDPOINT = 'http://localhost:3020'
|
|
|
+ if (location.hostname === 'uppy.io') {
|
|
|
+ COMPANION_ENDPOINT = '//companion.uppy.io'
|
|
|
+ }
|
|
|
+
|
|
|
+ var uppy = new Uppy.Core({ debug: true })
|
|
|
+ .use(Uppy.Dashboard, {
|
|
|
+ target: '#demo',
|
|
|
+ inline: true,
|
|
|
+ metaFields: [
|
|
|
+ { id: 'license', name: 'License', placeholder: 'specify license' },
|
|
|
+ { id: 'caption', name: 'Caption', placeholder: 'describe what the image is about' }
|
|
|
+ ]
|
|
|
+ })
|
|
|
+ .use(Uppy.GoogleDrive, { target: Uppy.Dashboard, companionUrl: COMPANION_ENDPOINT })
|
|
|
+ .use(Uppy.Instagram, { target: Uppy.Dashboard, companionUrl: COMPANION_ENDPOINT })
|
|
|
+ .use(Uppy.Dropbox, { target: Uppy.Dashboard, companionUrl: COMPANION_ENDPOINT })
|
|
|
+ // .use(Uppy.Box, { target: Uppy.Dashboard, companionUrl: COMPANION_ENDPOINT })
|
|
|
+ .use(Uppy.Facebook, { target: Uppy.Dashboard, companionUrl: COMPANION_ENDPOINT })
|
|
|
+ .use(Uppy.OneDrive, { target: Uppy.Dashboard, companionUrl: COMPANION_ENDPOINT })
|
|
|
+ .use(Uppy.Webcam, { target: Uppy.Dashboard })
|
|
|
+ .use(Uppy.Url, { target: Uppy.Dashboard, companionUrl: COMPANION_ENDPOINT })
|
|
|
+ .use(Uppy.Tus, { endpoint: TUS_ENDPOINT})
|
|
|
+
|
|
|
+ uppy.on('success', function (files) {
|
|
|
+ console.log('Upload complete! We’ve uploaded these files:', files)
|
|
|
})
|
|
|
- .use(Uppy.GoogleDrive, { target: Uppy.Dashboard, companionUrl: COMPANION_ENDPOINT })
|
|
|
- .use(Uppy.Instagram, { target: Uppy.Dashboard, companionUrl: COMPANION_ENDPOINT })
|
|
|
- .use(Uppy.Dropbox, { target: Uppy.Dashboard, companionUrl: COMPANION_ENDPOINT })
|
|
|
- // .use(Uppy.Box, { target: Uppy.Dashboard, companionUrl: COMPANION_ENDPOINT })
|
|
|
- .use(Uppy.Facebook, { target: Uppy.Dashboard, companionUrl: COMPANION_ENDPOINT })
|
|
|
- .use(Uppy.OneDrive, { target: Uppy.Dashboard, companionUrl: COMPANION_ENDPOINT })
|
|
|
- .use(Uppy.Webcam, { target: Uppy.Dashboard })
|
|
|
- .use(Uppy.Url, { target: Uppy.Dashboard, companionUrl: COMPANION_ENDPOINT })
|
|
|
- .use(Uppy.Tus, { endpoint: TUS_ENDPOINT})
|
|
|
-
|
|
|
- uppy.on('success', function (files) {
|
|
|
- console.log('Upload complete! We’ve uploaded these files:', files)
|
|
|
+ window.uppy = uppy
|
|
|
})
|
|
|
</script>
|