summaryrefslogtreecommitdiffstats
path: root/core/js/jquery.avatar.js
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2014-03-02 22:30:24 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2014-03-02 22:30:24 +0100
commit1291303c5a312fad9f01fbaf22cc21e3b9b3675d (patch)
treec1e46efc7589c3101a8c3806ecc3112c8f3e2849 /core/js/jquery.avatar.js
parent88c9ae129e7dcc0e10aee682c8d4fa31b93b614c (diff)
downloadnextcloud-server-1291303c5a312fad9f01fbaf22cc21e3b9b3675d.tar.gz
nextcloud-server-1291303c5a312fad9f01fbaf22cc21e3b9b3675d.zip
Replace OC.Router.generate() with OC.generateUrl()
Diffstat (limited to 'core/js/jquery.avatar.js')
-rw-r--r--core/js/jquery.avatar.js41
1 files changed, 21 insertions, 20 deletions
diff --git a/core/js/jquery.avatar.js b/core/js/jquery.avatar.js
index 02a40c088b4..381c42d9dbb 100644
--- a/core/js/jquery.avatar.js
+++ b/core/js/jquery.avatar.js
@@ -75,31 +75,32 @@
var $div = this;
- OC.Router.registerLoadedCallback(function() {
- var url = OC.Router.generate('core_avatar_get', {user: user, size: size})+'?requesttoken='+oc_requesttoken;
- $.get(url, function(result) {
- if (typeof(result) === 'object') {
- if (!hidedefault) {
- if (result.data && result.data.displayname) {
- $div.imageplaceholder(user, result.data.displayname);
- } else {
- $div.imageplaceholder(user);
- }
+ var url = OC.generateUrl(
+ '/avatar/{user}/{size}?requesttoken={requesttoken}',
+ {user: user, size: size, requesttoken: oc_requesttoken});
+
+ $.get(url, function(result) {
+ if (typeof(result) === 'object') {
+ if (!hidedefault) {
+ if (result.data && result.data.displayname) {
+ $div.imageplaceholder(user, result.data.displayname);
} else {
- $div.hide();
+ $div.imageplaceholder(user);
}
} else {
- $div.show();
- if (ie8fix === true) {
- $div.html('<img src="'+url+'#'+Math.floor(Math.random()*1000)+'">');
- } else {
- $div.html('<img src="'+url+'">');
- }
+ $div.hide();
}
- if(typeof callback === 'function') {
- callback();
+ } else {
+ $div.show();
+ if (ie8fix === true) {
+ $div.html('<img src="'+url+'#'+Math.floor(Math.random()*1000)+'">');
+ } else {
+ $div.html('<img src="'+url+'">');
}
- });
+ }
+ if(typeof callback === 'function') {
+ callback();
+ }
});
};
}(jQuery));