From 3f36129ec17fd0de2091b1a883ac6466a641de77 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Tue, 15 Nov 2016 17:44:43 -0500 Subject: message watcher api --- public/assets/js/lib/views/PhotoView.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'public/assets/js/lib') diff --git a/public/assets/js/lib/views/PhotoView.js b/public/assets/js/lib/views/PhotoView.js index ea77e01..f7e3c22 100644 --- a/public/assets/js/lib/views/PhotoView.js +++ b/public/assets/js/lib/views/PhotoView.js @@ -18,6 +18,7 @@ var PhotoView = (function(){ "change #palette_el": "updatePalette", "change #nn_el": "updateNN", "click .post-btn": "post", + "click .upload-btn": "upload", "click .close-btn": "hide", }, @@ -34,6 +35,10 @@ var PhotoView = (function(){ hsl[2] = clamp(hsl[2] + lum, 0.0, 1.0) return hsl2rgb.apply(this, hsl) }) + + this.$uploadBtn = this.$(".upload-btn") + this.$postBtn = this.$(".post-btn") + this.$closeBtn = this.$(".close-btn") this.$width = this.$("#width_el") this.$widthSpan = this.$("#width_span") @@ -66,9 +71,12 @@ var PhotoView = (function(){ var url if (typeof f == "string") { url = f + this.$uploadBtn.hide() } else { - url = URL.createObjectURL(file) + this.file = file + url = URL.createObjectURL(file) + this.$uploadBtn.show() } this.img.src = url console.log("load", url) @@ -162,7 +170,12 @@ var PhotoView = (function(){ }, success: function(){ - + console.log("posted colorcode") + this.hide() + }, + + upload: function(){ + this.camera.upload(this.file) }, }) -- cgit v1.2.3-70-g09d2