From 0211322915bee0b8af9920280f2779addbf2bc72 Mon Sep 17 00:00:00 2001 From: Martin Zimmermann Date: Tue, 27 May 2014 13:56:03 +0200 Subject: [PATCH] remove avatar preview in postbox --- isso/js/app/api.js | 13 ------------- isso/js/app/isso.js | 32 -------------------------------- isso/js/app/text/postbox.jade | 3 --- 3 files changed, 48 deletions(-) diff --git a/isso/js/app/api.js b/isso/js/app/api.js index 1108c0a..573a327 100644 --- a/isso/js/app/api.js +++ b/isso/js/app/api.js @@ -183,22 +183,9 @@ define(["app/lib/promise", "app/globals"], function(Q, globals) { return deferred.promise; }; - var remote_addr = function() { - var deferred = Q.defer(); - curl("GET", endpoint + "/check-ip", null, function(rv) { - if (rv.status === 200) { - deferred.resolve(rv.body); - } else { - deferred.reject(rv.body); - } - }); - return deferred.promise; - }; - return { endpoint: endpoint, salt: salt, - remote_addr: remote_addr, create: create, modify: modify, diff --git a/isso/js/app/isso.js b/isso/js/app/isso.js index e3ca1b9..517fa10 100644 --- a/isso/js/app/isso.js +++ b/isso/js/app/isso.js @@ -9,38 +9,6 @@ define(["app/dom", "app/utils", "app/config", "app/api", "app/jade", "app/i18n", var el = $.htmlify(jade.render("postbox")); - if (config["avatar"]) { - // add a default identicon to not waste CPU cycles - $(".avatar > svg", el).replace(lib.identicons.blank(4, 48)); - - // on text area focus, generate identicon from IP address - $(".textarea-wrapper > .textarea", el).on("focus", function() { - if ($(".avatar svg", el).getAttribute("className") === "blank") { - $(".avatar svg", el).replace( - lib.identicons.generate(lib.pbkdf2(api.remote_addr(), api.salt, 1000, 6), 4, 48)); - } - }); - - // update identicon on email input. Listens on keyup, after 200ms the - // new identicon is generated. - var active; - $(".input-wrapper > [type=email]", el).on("keyup", function() { - if (active) { - clearTimeout(active); - } - active = setTimeout(function() { - lib.pbkdf2($(".input-wrapper > [type=email]", el).value || api.remote_addr(), api.salt, 1000, 6) - .then(function(rv) { - $(".avatar svg", el).replace(lib.identicons.generate(rv, 4, 48)); - }); - }, 200); - }, false); - - $(".input-wrapper > [type=email]", el).on("keydown", function() { - clearTimeout(active); - }, false); - } - // callback on success (e.g. to toggle the reply button) el.onsuccess = function() {}; diff --git a/isso/js/app/text/postbox.jade b/isso/js/app/text/postbox.jade index 5740da0..bb4c2e8 100644 --- a/isso/js/app/text/postbox.jade +++ b/isso/js/app/text/postbox.jade @@ -1,7 +1,4 @@ div(class='postbox') - if conf.avatar - div(class='avatar') - svg(class='blank' data-hash='') div(class='form-wrapper') div(class='textarea-wrapper') div(class='textarea placeholder' contenteditable='true')