my eye

Fix script load/injection order

Committed 4dee4f

--- a/canopy/static/enliven.js
+++ b/canopy/static/enliven.js

   tag.href = href
   document.getElementsByTagName('head')[0].appendChild(tag)
 }
+window.injectScript = injectScript
+window.injectStylesheet = injectStylesheet
 
 let mode = 'site'
 const konamiCode = [38, 38, 40, 40, 37, 39, 37, 39, 66, 65, 13]
 
 let btclient
 
-// injectScript('/assets/js-cookie-3.0.5.js')
-
 // TODO $.load(...)
 document.addEventListener('DOMContentLoaded', ev => {
   let currentColorMode = Cookies.get('colormode')
   history.pushState({ scroll: 0 }, 'title', window.location)
   window.go = go
 
-  DragDrop('body', (files, pos, fileList, directories) => {
-    console.log(files[0])
-    btclient.seed(files, torrent => {
-      console.log(`Client is seeding at:\n${torrent.magnetURI}`)
-    })
-  })
-
   if (Cookies.get('rhythm') === 'on') {
     document.querySelector('body').style.backgroundImage = 'url(/static/measure.png)'
   }
   }, false)
 
   injectScript('/assets/webtorrent-2.1.30.js')
-  injectScript('/assets/drag-drop-7.2.0.js')
 
   btclient = new WebTorrent()
+
+  injectScript('/assets/drag-drop-7.2.0.js')
+
+  DragDrop('body', (files, pos, fileList, directories) => {
+    console.log(files[0])
+    btclient.seed(files, torrent => {
+      console.log(`Client is seeding at:\n${torrent.magnetURI}`)
+    })
+  })
 })
 
 const em = parseFloat(getComputedStyle(document.documentElement).fontSize)

--- a/canopy/templates/template.html
+++ b/canopy/templates/template.html

 let userName = '$username'
 let ownerGivenName = '$owner["name"][0].split()[0]'
 </script>
-</head>
-
 <script type=module src=/static/enliven.js></script>
+</head>
 
 <body
 $if "body_classes" in resource: