diff options
author | kondou <kondou@ts.unde.re> | 2013-09-01 16:04:39 +0200 |
---|---|---|
committer | kondou <kondou@ts.unde.re> | 2013-09-01 16:04:39 +0200 |
commit | f44cd944e07cdd908d54f0bc3251e7e9be2ad7f8 (patch) | |
tree | b3dcdc2a4f10d1e5d9aac18e51a2e6b29e289975 /core/js | |
parent | 8de9e3d85ede3b9b6abf166a89c501624d634adc (diff) | |
download | nextcloud-server-f44cd944e07cdd908d54f0bc3251e7e9be2ad7f8.tar.gz nextcloud-server-f44cd944e07cdd908d54f0bc3251e7e9be2ad7f8.zip |
Better naming than "ava" & "data", cache timeout, use OC.Router.registerLoadedCallback()
Diffstat (limited to 'core/js')
-rw-r--r-- | core/js/avatar.js | 4 | ||||
-rw-r--r-- | core/js/jquery.avatar.js | 16 |
2 files changed, 11 insertions, 9 deletions
diff --git a/core/js/avatar.js b/core/js/avatar.js index 15c268af663..a731519244a 100644 --- a/core/js/avatar.js +++ b/core/js/avatar.js @@ -3,7 +3,7 @@ $(document).ready(function(){ // Personal settings $('#avatar .avatardiv').avatar(OC.currentUser, 128); // User settings - $.each($('td.avatar .avatardiv'), function(i, data) { - $(data).avatar($(data).parent().parent().data('uid'), 32); + $.each($('td.avatar .avatardiv'), function(i, element) { + $(element).avatar($(element).parent().parent().data('uid'), 32); }); }); diff --git a/core/js/jquery.avatar.js b/core/js/jquery.avatar.js index 055ca457205..dc73d8f0d91 100644 --- a/core/js/jquery.avatar.js +++ b/core/js/jquery.avatar.js @@ -61,13 +61,15 @@ var $div = this; - var url = OC.router_base_url+'/avatar/'+user+'/'+size // FIXME routes aren't loaded yet, so OC.Router.generate() doesn't work - $.get(url, function(result) { - if (typeof(result) === 'object') { - $div.placeholder(result.user); - } else { - $div.html('<img src="'+url+'">'); - } + OC.Router.registerLoadedCallback(function() { + var url = OC.Router.generate('core_avatar_get', {user: user, size: size}); + $.get(url, function(result) { + if (typeof(result) === 'object') { + $div.placeholder(result.user); + } else { + $div.html('<img src="'+url+'">'); + } + }); }); }; }(jQuery)); |