summaryrefslogtreecommitdiffstats
path: root/core/js
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2013-10-04 12:30:49 +0200
committerBjoern Schiessle <schiessle@owncloud.com>2013-10-04 12:30:49 +0200
commit51295e9a6b9cd8e351132e988858b5d4bd223968 (patch)
tree7d2da02957552a8ac49eb6f2f3bd6b08e1049406 /core/js
parenta223cf769a670c1c8926baf4ded445af300d056d (diff)
parent514d7a884a5211fe246487421ea8103202d004d7 (diff)
downloadnextcloud-server-51295e9a6b9cd8e351132e988858b5d4bd223968.tar.gz
nextcloud-server-51295e9a6b9cd8e351132e988858b5d4bd223968.zip
Merge branch 'master' into sharing_mail_notification_master
Conflicts: apps/files/index.php apps/files/templates/index.php
Diffstat (limited to 'core/js')
-rw-r--r--core/js/avatar.js2
-rw-r--r--core/js/jquery.avatar.js20
2 files changed, 16 insertions, 6 deletions
diff --git a/core/js/avatar.js b/core/js/avatar.js
index 57e6daa0930..c54c4068768 100644
--- a/core/js/avatar.js
+++ b/core/js/avatar.js
@@ -1,6 +1,6 @@
$(document).ready(function(){
if (OC.currentUser) {
- $('#header .avatardiv').avatar(OC.currentUser, 32);
+ $('#header .avatardiv').avatar(OC.currentUser, 32, undefined, true);
// Personal settings
$('#avatar .avatardiv').avatar(OC.currentUser, 128);
}
diff --git a/core/js/jquery.avatar.js b/core/js/jquery.avatar.js
index 88a4c25d1ee..00068101726 100644
--- a/core/js/jquery.avatar.js
+++ b/core/js/jquery.avatar.js
@@ -15,7 +15,7 @@
* You may use this on any <div></div>
* Here I'm using <div class="avatardiv"></div> as an example.
*
- * There are 4 ways to call this:
+ * There are 5 ways to call this:
*
* 1. $('.avatardiv').avatar('jdoe', 128);
* This will make the div to jdoe's fitting avatar, with a size of 128px.
@@ -34,10 +34,15 @@
* 4. $('.avatardiv').avatar('jdoe', 128, true);
* This will behave like the first example, except it will also append random
* hashes to the custom avatar images, to force image reloading in IE8.
+ *
+ * 5. $('.avatardiv').avatar('jdoe', 128, undefined, true);
+ * This will behave like the first example, but it will hide the avatardiv, if
+ * it will display the default placeholder. undefined is the ie8fix from
+ * example 4 and can be either true, or false/undefined, to be ignored.
*/
(function ($) {
- $.fn.avatar = function(user, size, ie8fix) {
+ $.fn.avatar = function(user, size, ie8fix, hidedefault) {
if (typeof(size) === 'undefined') {
if (this.height() > 0) {
size = this.height();
@@ -69,12 +74,17 @@
var url = OC.Router.generate('core_avatar_get', {user: user, size: size})+'?requesttoken='+oc_requesttoken;
$.get(url, function(result) {
if (typeof(result) === 'object') {
- if (result.data && result.data.displayname) {
- $div.placeholder(user, result.data.displayname);
+ if (!hidedefault) {
+ if (result.data && result.data.displayname) {
+ $div.placeholder(user, result.data.displayname);
+ } else {
+ $div.placeholder(user);
+ }
} else {
- $div.placeholder(user);
+ $div.hide();
}
} else {
+ $div.show();
if (ie8fix === true) {
$div.html('<img src="'+url+'#'+Math.floor(Math.random()*1000)+'">');
} else {