diff index.html @ 3:6875be47fb24

Now with less jquery
author nanaya <me@myconan.net>
date Sun, 15 Jan 2017 19:17:27 +0900
parents f27dbbc6e978
children cc0a5142a56f
line wrap: on
line diff
--- a/index.html	Sun Jan 15 19:13:30 2017 +0900
+++ b/index.html	Sun Jan 15 19:17:27 2017 +0900
@@ -79,16 +79,16 @@
         </div>
     </div>
 
-    <script src="jquery.min.js"></script>
     <script src="qrcode.min.js"></script>
     <script src="lodash.min.js"></script>
 
     <script>
+        var inputDom = document.getElementsByClassName("js-qr-input")[0]
         var outputDom = document.getElementsByClassName("js-qr-output")[0]
         var qr = new QRCode(outputDom)
 
-        var refreshCode = function(e) {
-            var text = e.target.value
+        var refreshCode = function() {
+            var text = inputDom.value
 
             if (text !== "") {
                 qr.makeCode(text)
@@ -98,6 +98,7 @@
             }
         }
 
-        $(".js-qr-input").on("input", _.debounce(refreshCode, 100))
+        inputDom.addEventListener('input', _.debounce(refreshCode, 100))
+        refreshCode()
     </script>
 </body>