From bc44ea348c682f7cefcbb5302d1d5f43af80371b Mon Sep 17 00:00:00 2001 From: Pepper Date: Sat, 8 Oct 2016 04:52:44 -0400 Subject: ok cool --- share/frontend/imgradient/css/style.css | 13 +++++++++++++ share/frontend/imgradient/index.html | 3 ++- share/frontend/imgradient/js/main.js | 33 +++++++++++++++++++++++++++++++-- 3 files changed, 46 insertions(+), 3 deletions(-) (limited to 'share/frontend/imgradient') diff --git a/share/frontend/imgradient/css/style.css b/share/frontend/imgradient/css/style.css index 9012be3..55b60a9 100644 --- a/share/frontend/imgradient/css/style.css +++ b/share/frontend/imgradient/css/style.css @@ -51,6 +51,19 @@ h1 display: none; position: fixed; } +#colorswitcheroo + { + width: 19px; + height:38px; + display: inline-block; + position: absolute; + background-image: url(http://i.asdf.us/im/7e/user_convo_1353562627_1355449919.png); + //background-image: url( http://i.asdf.us/im/7b/user_convo_1353562627.png); + background-repeat:no-repeat; + background-position: 3px 10px; + cursor: pointer; + } + #instructions { position: absolute; diff --git a/share/frontend/imgradient/index.html b/share/frontend/imgradient/index.html index 75310c3..de355b3 100755 --- a/share/frontend/imgradient/index.html +++ b/share/frontend/imgradient/index.html @@ -68,6 +68,7 @@  color list +

@@ -197,7 +198,7 @@
- →
+

diff --git a/share/frontend/imgradient/js/main.js b/share/frontend/imgradient/js/main.js index 1862de3..a81c6ac 100644 --- a/share/frontend/imgradient/js/main.js +++ b/share/frontend/imgradient/js/main.js @@ -87,20 +87,44 @@ var Main = if (data.name.length > 0){ document.cookie = "imname="+data.name+";path=/;domain=.asdf.us;max-age=1086400" } - $.post("/im/api/imgradient", data, Main.callback) + $.ajax({ + url: '/im/api/imgradient', + type: 'post', + dataType: 'json', + data: data, + success: function(data){ Main.callback(data) }, + error: function(data){ + switch(data.status){ + case 500: + Main.error("Problem with server") + console.log(data) + break; + case 410: + Main.error(JSON.parse(data.responseText).message) + break; + default: + Main.error("Something went wrong") + console.log(data) + } + Main.generating = false + } + }); $("#controls").css('margin',"") }, error: function (s) { $("#output-cmd").html("ERROR: " + s + "").show() + $("#result-arrow").hide() $("#output-url").hide() $("#output-img").hide() }, callback: function (data) { + console.log(data) if (data.error){ return Main.error(data.error) } + $("#result-arrow").show() $("#output-cmd").html("size: "+Main.filesize(data.size)+"
"+data.height + " x " + data.width) $("#output-url").val(data.url) $("#output-img").hide().attr("src", data.url).fadeIn(700) @@ -145,7 +169,12 @@ $(document).ready(function(){ $('form').submit(function() { return false; }); - $(document).keydown(Main.enter) + $("#colorswitcheroo").click(function() { + a = $("#img-color1").val(); + b = $("#img-color2").val(); + $("#img-color1").val(b); + $("#img-color2").val(a); + }); $("#img-generate").click(Main.go) document.getElementById("reset").reset() }) -- cgit v1.2.3-70-g09d2