Advertisement
Guest User

Untitled

a guest
Apr 21st, 2015
78
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 1.10 KB | None
  1. d.updateUserContainer = function(users, exports) {
  2.   var i = "undefined" != typeof exports ? exports : users.data("user");
  3.   return i && 0 != i.toString().length ? d.get(i).done(function(user) {
  4.     var dom = users.find(".username");
  5.     dom.each(function() {
  6.       var $btn = $(this);
  7.       if (0 != $btn.closest(".tiny-signature").length) {
  8.         $btn.html(lineBreakBeforeHyphen(user.name));
  9.       } else {
  10.         $btn.html(lineBreakAfterHyphen(user.name));
  11.       }
  12.     });
  13.     /** @type {boolean} */
  14.     var cssClass = !!user.is_moderator;
  15.     dom.toggleClass("moderator", cssClass);
  16.     dom.toggleClass("owner", !!user.is_owner && !cssClass);
  17.     users.find(".userlink,a.signature").attr("href", "/users/" + user.id + "/" + urlFriendly(user.name));
  18.     users.find(".avatar > img").each(function() {
  19.       $(this).attr("src", gravatarUrl(i, user.email_hash, $(this).attr("width"))).attr("alt", user.name).attr("title", user.name);
  20.     });
  21.     if (i > 0) {
  22.       users.find(".flair").text(repNumber(user.reputation)).attr("title", user.reputation);
  23.     }
  24.   }) : $.Deferred().reject().promise();
  25. };
Advertisement
RAW Paste Data Copied
Advertisement