remove avatar preview in postbox
This commit is contained in:
parent
8cf9ea348e
commit
0211322915
@ -183,22 +183,9 @@ define(["app/lib/promise", "app/globals"], function(Q, globals) {
|
|||||||
return deferred.promise;
|
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 {
|
return {
|
||||||
endpoint: endpoint,
|
endpoint: endpoint,
|
||||||
salt: salt,
|
salt: salt,
|
||||||
remote_addr: remote_addr,
|
|
||||||
|
|
||||||
create: create,
|
create: create,
|
||||||
modify: modify,
|
modify: modify,
|
||||||
|
@ -9,38 +9,6 @@ define(["app/dom", "app/utils", "app/config", "app/api", "app/jade", "app/i18n",
|
|||||||
|
|
||||||
var el = $.htmlify(jade.render("postbox"));
|
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)
|
// callback on success (e.g. to toggle the reply button)
|
||||||
el.onsuccess = function() {};
|
el.onsuccess = function() {};
|
||||||
|
|
||||||
|
@ -1,7 +1,4 @@
|
|||||||
div(class='postbox')
|
div(class='postbox')
|
||||||
if conf.avatar
|
|
||||||
div(class='avatar')
|
|
||||||
svg(class='blank' data-hash='')
|
|
||||||
div(class='form-wrapper')
|
div(class='form-wrapper')
|
||||||
div(class='textarea-wrapper')
|
div(class='textarea-wrapper')
|
||||||
div(class='textarea placeholder' contenteditable='true')
|
div(class='textarea placeholder' contenteditable='true')
|
||||||
|
Loading…
Reference in New Issue
Block a user