1
0

gprofiles.js 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643
  1. function hex_md5(a) {
  2. return binl2hex(core_md5(str2binl(a), a.length * chrsz))
  3. }
  4. function b64_md5(a) {
  5. return binl2b64(core_md5(str2binl(a), a.length * chrsz))
  6. }
  7. function str_md5(a) {
  8. return binl2str(core_md5(str2binl(a), a.length * chrsz))
  9. }
  10. function hex_hmac_md5(a, t) {
  11. return binl2hex(core_hmac_md5(a, t))
  12. }
  13. function b64_hmac_md5(a, t) {
  14. return binl2b64(core_hmac_md5(a, t))
  15. }
  16. function str_hmac_md5(a, t) {
  17. return binl2str(core_hmac_md5(a, t))
  18. }
  19. function md5_vm_test() {
  20. return "900150983cd24fb0d6963f7d28e17f72" == hex_md5("abc")
  21. }
  22. function core_md5(a, t) {
  23. a[t >> 5] |= 128 << t % 32,
  24. a[(t + 64 >>> 9 << 4) + 14] = t;
  25. for (var r = 1732584193, e = -271733879, i = -1732584194, s = 271733878, o = 0; o < a.length; o += 16) {
  26. var n = r
  27. , c = e
  28. , h = i
  29. , l = s;
  30. r = md5_ff(r, e, i, s, a[o + 0], 7, -680876936),
  31. s = md5_ff(s, r, e, i, a[o + 1], 12, -389564586),
  32. i = md5_ff(i, s, r, e, a[o + 2], 17, 606105819),
  33. e = md5_ff(e, i, s, r, a[o + 3], 22, -1044525330),
  34. r = md5_ff(r, e, i, s, a[o + 4], 7, -176418897),
  35. s = md5_ff(s, r, e, i, a[o + 5], 12, 1200080426),
  36. i = md5_ff(i, s, r, e, a[o + 6], 17, -1473231341),
  37. e = md5_ff(e, i, s, r, a[o + 7], 22, -45705983),
  38. r = md5_ff(r, e, i, s, a[o + 8], 7, 1770035416),
  39. s = md5_ff(s, r, e, i, a[o + 9], 12, -1958414417),
  40. i = md5_ff(i, s, r, e, a[o + 10], 17, -42063),
  41. e = md5_ff(e, i, s, r, a[o + 11], 22, -1990404162),
  42. r = md5_ff(r, e, i, s, a[o + 12], 7, 1804603682),
  43. s = md5_ff(s, r, e, i, a[o + 13], 12, -40341101),
  44. i = md5_ff(i, s, r, e, a[o + 14], 17, -1502002290),
  45. e = md5_ff(e, i, s, r, a[o + 15], 22, 1236535329),
  46. r = md5_gg(r, e, i, s, a[o + 1], 5, -165796510),
  47. s = md5_gg(s, r, e, i, a[o + 6], 9, -1069501632),
  48. i = md5_gg(i, s, r, e, a[o + 11], 14, 643717713),
  49. e = md5_gg(e, i, s, r, a[o + 0], 20, -373897302),
  50. r = md5_gg(r, e, i, s, a[o + 5], 5, -701558691),
  51. s = md5_gg(s, r, e, i, a[o + 10], 9, 38016083),
  52. i = md5_gg(i, s, r, e, a[o + 15], 14, -660478335),
  53. e = md5_gg(e, i, s, r, a[o + 4], 20, -405537848),
  54. r = md5_gg(r, e, i, s, a[o + 9], 5, 568446438),
  55. s = md5_gg(s, r, e, i, a[o + 14], 9, -1019803690),
  56. i = md5_gg(i, s, r, e, a[o + 3], 14, -187363961),
  57. e = md5_gg(e, i, s, r, a[o + 8], 20, 1163531501),
  58. r = md5_gg(r, e, i, s, a[o + 13], 5, -1444681467),
  59. s = md5_gg(s, r, e, i, a[o + 2], 9, -51403784),
  60. i = md5_gg(i, s, r, e, a[o + 7], 14, 1735328473),
  61. e = md5_gg(e, i, s, r, a[o + 12], 20, -1926607734),
  62. r = md5_hh(r, e, i, s, a[o + 5], 4, -378558),
  63. s = md5_hh(s, r, e, i, a[o + 8], 11, -2022574463),
  64. i = md5_hh(i, s, r, e, a[o + 11], 16, 1839030562),
  65. e = md5_hh(e, i, s, r, a[o + 14], 23, -35309556),
  66. r = md5_hh(r, e, i, s, a[o + 1], 4, -1530992060),
  67. s = md5_hh(s, r, e, i, a[o + 4], 11, 1272893353),
  68. i = md5_hh(i, s, r, e, a[o + 7], 16, -155497632),
  69. e = md5_hh(e, i, s, r, a[o + 10], 23, -1094730640),
  70. r = md5_hh(r, e, i, s, a[o + 13], 4, 681279174),
  71. s = md5_hh(s, r, e, i, a[o + 0], 11, -358537222),
  72. i = md5_hh(i, s, r, e, a[o + 3], 16, -722521979),
  73. e = md5_hh(e, i, s, r, a[o + 6], 23, 76029189),
  74. r = md5_hh(r, e, i, s, a[o + 9], 4, -640364487),
  75. s = md5_hh(s, r, e, i, a[o + 12], 11, -421815835),
  76. i = md5_hh(i, s, r, e, a[o + 15], 16, 530742520),
  77. e = md5_hh(e, i, s, r, a[o + 2], 23, -995338651),
  78. r = md5_ii(r, e, i, s, a[o + 0], 6, -198630844),
  79. s = md5_ii(s, r, e, i, a[o + 7], 10, 1126891415),
  80. i = md5_ii(i, s, r, e, a[o + 14], 15, -1416354905),
  81. e = md5_ii(e, i, s, r, a[o + 5], 21, -57434055),
  82. r = md5_ii(r, e, i, s, a[o + 12], 6, 1700485571),
  83. s = md5_ii(s, r, e, i, a[o + 3], 10, -1894986606),
  84. i = md5_ii(i, s, r, e, a[o + 10], 15, -1051523),
  85. e = md5_ii(e, i, s, r, a[o + 1], 21, -2054922799),
  86. r = md5_ii(r, e, i, s, a[o + 8], 6, 1873313359),
  87. s = md5_ii(s, r, e, i, a[o + 15], 10, -30611744),
  88. i = md5_ii(i, s, r, e, a[o + 6], 15, -1560198380),
  89. e = md5_ii(e, i, s, r, a[o + 13], 21, 1309151649),
  90. r = md5_ii(r, e, i, s, a[o + 4], 6, -145523070),
  91. s = md5_ii(s, r, e, i, a[o + 11], 10, -1120210379),
  92. i = md5_ii(i, s, r, e, a[o + 2], 15, 718787259),
  93. e = md5_ii(e, i, s, r, a[o + 9], 21, -343485551),
  94. r = safe_add(r, n),
  95. e = safe_add(e, c),
  96. i = safe_add(i, h),
  97. s = safe_add(s, l)
  98. }
  99. return Array(r, e, i, s)
  100. }
  101. function md5_cmn(a, t, r, e, i, s) {
  102. return safe_add(bit_rol(safe_add(safe_add(t, a), safe_add(e, s)), i), r)
  103. }
  104. function md5_ff(a, t, r, e, i, s, o) {
  105. return md5_cmn(t & r | ~t & e, a, t, i, s, o)
  106. }
  107. function md5_gg(a, t, r, e, i, s, o) {
  108. return md5_cmn(t & e | r & ~e, a, t, i, s, o)
  109. }
  110. function md5_hh(a, t, r, e, i, s, o) {
  111. return md5_cmn(t ^ r ^ e, a, t, i, s, o)
  112. }
  113. function md5_ii(a, t, r, e, i, s, o) {
  114. return md5_cmn(r ^ (t | ~e), a, t, i, s, o)
  115. }
  116. function core_hmac_md5(a, t) {
  117. var r = str2binl(a);
  118. r.length > 16 && (r = core_md5(r, a.length * chrsz));
  119. for (var e = Array(16), i = Array(16), s = 0; 16 > s; s++)
  120. e[s] = 909522486 ^ r[s],
  121. i[s] = 1549556828 ^ r[s];
  122. var o = core_md5(e.concat(str2binl(t)), 512 + t.length * chrsz);
  123. return core_md5(i.concat(o), 640)
  124. }
  125. function safe_add(a, t) {
  126. var r = (65535 & a) + (65535 & t)
  127. , e = (a >> 16) + (t >> 16) + (r >> 16);
  128. return e << 16 | 65535 & r
  129. }
  130. function bit_rol(a, t) {
  131. return a << t | a >>> 32 - t
  132. }
  133. function str2binl(a) {
  134. for (var t = Array(), r = (1 << chrsz) - 1, e = 0; e < a.length * chrsz; e += chrsz)
  135. t[e >> 5] |= (a.charCodeAt(e / chrsz) & r) << e % 32;
  136. return t
  137. }
  138. function binl2str(a) {
  139. for (var t = "", r = (1 << chrsz) - 1, e = 0; e < 32 * a.length; e += chrsz)
  140. t += String.fromCharCode(a[e >> 5] >>> e % 32 & r);
  141. return t
  142. }
  143. function binl2hex(a) {
  144. for (var t = hexcase ? "0123456789ABCDEF" : "0123456789abcdef", r = "", e = 0; e < 4 * a.length; e++)
  145. r += t.charAt(a[e >> 2] >> e % 4 * 8 + 4 & 15) + t.charAt(a[e >> 2] >> e % 4 * 8 & 15);
  146. return r
  147. }
  148. function binl2b64(a) {
  149. for (var t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", r = "", e = 0; e < 4 * a.length; e += 3)
  150. for (var i = (a[e >> 2] >> 8 * (e % 4) & 255) << 16 | (a[e + 1 >> 2] >> 8 * ((e + 1) % 4) & 255) << 8 | a[e + 2 >> 2] >> 8 * ((e + 2) % 4) & 255, s = 0; 4 > s; s++)
  151. r += 8 * e + 6 * s > 32 * a.length ? b64pad : t.charAt(i >> 6 * (3 - s) & 63);
  152. return r
  153. }
  154. "undefined" == typeof console && (console = {
  155. log: function(a) {},
  156. debug: function(a) {}
  157. });
  158. var Gravatar = {
  159. profile_stack: {},
  160. profile_map: {},
  161. overTimeout: !1,
  162. outTimeout: !1,
  163. stopOver: !1,
  164. active_grav: !1,
  165. active_hash: !1,
  166. active_id: !1,
  167. active_grav_clone: !1,
  168. profile_cb: null,
  169. stats_queue: [],
  170. throbber: null,
  171. has_bg: !1,
  172. disabled: !1,
  173. url_prefix: "http://en",
  174. disable: function() {
  175. Gravatar.disabled = !0,
  176. Gravatar.hide_card();
  177. var a = new Date(2100,1,1,1,1,1);
  178. Gravatar.stat("disable"),
  179. -1 == window.location.host.search(/wordpress.com/i) ? document.cookie = "nohovercard=1; expires=" + a.toUTCString() + ";" : document.cookie = "nohovercard=1; expires=" + a.toUTCString() + "; domain=.wordpress.com; path=/"
  180. },
  181. mouseOut: function(a) {
  182. a.stopImmediatePropagation(),
  183. Gravatar.stopOver = !0,
  184. Gravatar.outTimeout = setTimeout(function() {
  185. Gravatar.hide_card()
  186. }, 300)
  187. },
  188. init: function(a, t) {
  189. var r, e, i = document.cookie.split(";");
  190. for (r = 0; r < i.length; r++) {
  191. for (e = i[r]; " " == e.charAt(0); )
  192. e = e.substring(1, e.length);
  193. if (0 == e.indexOf("nohovercard=1"))
  194. return
  195. }
  196. "https:" == window.location.protocol && (this.url_prefix = "https://secure"),
  197. this.attach_profiles(a, t),
  198. this.add_card_css(),
  199. jQuery("body").on("mouseenter.gravatar mouseleave.gravatar", "img.grav-hashed", function(a) {
  200. if (!Gravatar.disabled) {
  201. if (a.preventDefault(),
  202. a.stopPropagation(),
  203. "mouseleave" == a.type || "mouseout" == a.type)
  204. return Gravatar.mouseOut.call(this, a);
  205. Gravatar.stopOver = !1,
  206. Gravatar.active_id = jQuery(this).attr("id"),
  207. Gravatar.active_hash = Gravatar.active_id.split("-")[1],
  208. Gravatar.untilt_gravatar(),
  209. clearTimeout(Gravatar.overTimeout),
  210. !1 !== Gravatar.profile_map["g" + Gravatar.active_hash] && (Gravatar.stat("hover"),
  211. clearTimeout(Gravatar.outTimeout),
  212. Gravatar.tilt_gravatar(),
  213. Gravatar.fetch_profile_by_hash(Gravatar.active_hash, Gravatar.active_id),
  214. Gravatar.overTimeout = setTimeout(function() {
  215. Gravatar.show_card()
  216. }, 600))
  217. }
  218. }),
  219. jQuery("body").on("mouseenter.gravatar mouseleave.gravatar", "div.gcard, img.grav-clone", function(a) {
  220. Gravatar.disabled || (a.preventDefault(),
  221. a.stopPropagation(),
  222. "mouseenter" == a.type || "mouseover" == a.type ? (Gravatar.stopOver = !1,
  223. clearTimeout(Gravatar.outTimeout)) : Gravatar.mouseOut.call(this, a))
  224. }),
  225. jQuery(window).bind("scroll", function() {
  226. Gravatar.active_hash.length && Gravatar.hide_card()
  227. })
  228. },
  229. attach_profiles: function(a, t) {
  230. setInterval(Gravatar.send_stats, 3e3),
  231. a = "undefined" == typeof a ? "body" : a,
  232. t && "string" == typeof t && jQuery(t).addClass("no-grav"),
  233. jQuery(a + ' img[src*="gravatar.com/avatar"]').not(".no-grav, .no-grav img").each(function() {
  234. if (hash = Gravatar.extract_hash(this),
  235. uniq = 0,
  236. jQuery("#grav-" + hash + "-" + uniq).length)
  237. for (; jQuery("#grav-" + hash + "-" + uniq).length; )
  238. uniq++;
  239. var a = jQuery(this).attr("id", "grav-" + hash + "-" + uniq).attr("title", "").removeAttr("title");
  240. a.parent("a").length && a.parent("a").attr("title", "").removeAttr("title"),
  241. a.addClass("grav-hashed"),
  242. (a.parents("#comments, .comments, #commentlist, .commentlist, .grav-hijack").length || !a.parents("a:first").length) && a.addClass("grav-hijack")
  243. })
  244. },
  245. show_card: function() {
  246. if (!Gravatar.stopOver) {
  247. if (dom_id = this.profile_map["g" + Gravatar.active_hash],
  248. jQuery(".gcard").hide(),
  249. "fetching" == this.profile_stack["g" + Gravatar.active_hash])
  250. return Gravatar.show_throbber(),
  251. this.listen(Gravatar.active_hash, "show_card"),
  252. void Gravatar.stat("wait");
  253. if ("undefined" == typeof this.profile_stack["g" + Gravatar.active_hash])
  254. return Gravatar.show_throbber(),
  255. this.listen(Gravatar.active_hash, "show_card"),
  256. void this.fetch_profile_by_hash(Gravatar.active_hash, dom_id);
  257. Gravatar.stat("show"),
  258. Gravatar.hide_throbber(),
  259. jQuery("#profile-" + this.active_hash).length || this.build_card(this.active_hash, this.profile_stack["g" + this.active_hash]),
  260. this.render_card(this.active_grav, "profile-" + this.active_hash)
  261. }
  262. },
  263. hide_card: function() {
  264. clearTimeout(Gravatar.overTimeout),
  265. this.untilt_gravatar(),
  266. jQuery("div.gcard").filter("#profile-" + this.active_hash).fadeOut(120, function() {
  267. jQuery("img.grav-large").stop().remove()
  268. }).end().not("#profile-" + this.active_hash).hide()
  269. },
  270. render_card: function(a, t) {
  271. var r = jQuery("#" + t).stop()
  272. , e = a
  273. , i = e.offset();
  274. if (null != i) {
  275. var s = e.width()
  276. , o = e.height()
  277. , n = 5 + .4 * s
  278. , c = r.width()
  279. , h = r.height();
  280. c == jQuery(window).width() && (c = 400,
  281. h = 200);
  282. var l = i.left - 17
  283. , d = i.top - 7
  284. , f = "pos-right";
  285. i.left + s + n + c > jQuery(window).width() + jQuery(window).scrollLeft() && (l = i.left - c + s + 17,
  286. f = "pos-left");
  287. var v = .25 * o;
  288. jQuery("#" + t).removeClass("pos-right pos-left").addClass(f).css({
  289. top: d - v + "px",
  290. left: l + "px"
  291. });
  292. var u = o / 2;
  293. u > h && (u = h / 2),
  294. u > h / 2 - 6 && (u = h / 2 - 6),
  295. u > 53 && (u = 53),
  296. this.has_bg && (u -= 8),
  297. 0 > u && (u = 0);
  298. var g = {
  299. height: 2 * o + v + "px"
  300. };
  301. "pos-right" == f ? (g.right = "auto",
  302. g.left = "-7px",
  303. g["background-position"] = "0px " + u + "px") : (g.right = "-10px",
  304. g.left = "auto",
  305. g["background-position"] = "0px " + u + "px"),
  306. jQuery("#" + t + " .grav-cardarrow").css(g)
  307. }
  308. r.stop().css({
  309. opacity: 0
  310. }).show().animate({
  311. opacity: 1
  312. }, 150, "linear", function() {
  313. jQuery(this).css({
  314. opacity: "auto"
  315. }),
  316. jQuery(this).stop()
  317. })
  318. },
  319. build_card: function(a, t) {
  320. Object.size = function(a) {
  321. var t, r = 0;
  322. for (t in a)
  323. a.hasOwnProperty(t) && r++;
  324. return r
  325. }
  326. ,
  327. GProfile.init(t);
  328. var r = GProfile.get("urls")
  329. , e = (GProfile.get("photos"),
  330. GProfile.get("accounts"))
  331. , i = 100;
  332. i += Object.size(r) > 3 ? 90 : 10 + 20 * Object.size(r),
  333. Object.size(e) > 0 && (i += 30);
  334. var s = GProfile.get("aboutMe");
  335. s = s.replace(/<[^>]+>/gi, ""),
  336. s = s.toString().substr(0, i),
  337. i == s.length && (s += '<a href="' + GProfile.get("profileUrl") + '" target="_blank">&#8230;</a>');
  338. var o = "grav-inner";
  339. Gravatar.my_hash && a == Gravatar.my_hash && (o += " grav-is-user",
  340. s.length || (s = "<p>Want a better profile? <a class='grav-edit-profile' href='http://gravatar.com/profiles/edit/?noclose' target='_blank'>Click here</a>.</p>")),
  341. s.length && (o += " gcard-about"),
  342. name = GProfile.get("displayName"),
  343. name.length || (name = GProfile.get("preferredUsername"));
  344. var n = '<div id="profile-' + a + '" class="gcard grofile"> <div class="grav-inner"> <div class="grav-grav"> <a href="' + GProfile.get("profileUrl") + '" target="_blank"> <img src="' + GProfile.get("thumbnailUrl") + '?s=100&r=pg&d=mm" width="100" height="100" /> </a> </div> <div class="grav-info"> <h4><a href="' + GProfile.get("profileUrl") + '" target="_blank">' + name + '</a></h4> <p class="grav-loc">' + GProfile.get("currentLocation") + '</p> <p class="grav-about">' + s + '</p> <div class="grav-view-complete-button"> <a href="' + GProfile.get("profileUrl") + '" target="_blank" class="grav-view-complete">View Complete Profile</a> </div> <p class="grav-disable"><a href="#" onclick="Gravatar.disable(); return false">Turn off hovercards</a></p> </div> <div style="clear:both"></div> </div> <div class="grav-cardarrow"></div> <div class="grav-tag"><a href="http://gravatar.com/" title="Powered by Gravatar.com" target="_blank">&nbsp;</a></div> </div>';
  345. jQuery("body").append(jQuery(n)),
  346. jQuery("#profile-" + a + " .grav-inner").addClass(o),
  347. this.has_bg = !1;
  348. var c = GProfile.get("profileBackground");
  349. if (Object.size(c)) {
  350. this.has_bg = !0;
  351. var h = {
  352. padding: "8px 0"
  353. };
  354. c.color && (h["background-color"] = c.color),
  355. c.url && (h["background-image"] = "url(" + c.url + ")"),
  356. c.position && (h["background-position"] = c.position),
  357. c.repeat && (h["background-repeat"] = c.repeat),
  358. jQuery("#profile-" + a).css(h),
  359. jQuery("#profile-" + a + " .grav-tag").css("top", "8px")
  360. }
  361. jQuery("#profile-" + a + " .gcard-links").length || jQuery("#profile-" + a + " .gcard-services").length || jQuery("#profile-" + a + " .grav-rightcol").css({
  362. width: "auto"
  363. }),
  364. jQuery("#profile-" + a + " .gcard-about").length || jQuery("#profile-" + a + " .grav-leftcol").css({
  365. width: "auto"
  366. }),
  367. jQuery.isFunction(Gravatar.profile_cb) && Gravatar.loaded_js(a, "profile-" + a),
  368. jQuery("#profile-" + a + " a.grav-extra-comments").click(function(a) {
  369. return Gravatar.stat("click_comment", a)
  370. }),
  371. jQuery("#profile-" + a + " a.grav-extra-likes").click(function(a) {
  372. return Gravatar.stat("click_like", a)
  373. }),
  374. jQuery("#profile-" + a + " .grav-links a").click(function(a) {
  375. return Gravatar.stat("click_link", a)
  376. }),
  377. jQuery("#profile-" + a + " .grav-services a").click(function(a) {
  378. return Gravatar.stat("click_service", a)
  379. }),
  380. jQuery("#profile-" + a + " h4 a, #profile-" + a + " .grav-view-complete, #profile-" + a + " .grav-grav a").click(function(a) {
  381. return Gravatar.stat("to_profile", a)
  382. }),
  383. jQuery("#profile-" + a + " .grav-tag a").click(function(a) {
  384. return 3 == a.which || 2 == a.button || a.altKey || a.metaKey || a.ctrlKey ? (a.preventDefault(),
  385. a.stopImmediatePropagation(),
  386. Gravatar.stat("egg"),
  387. Gravatar.whee()) : Gravatar.stat("to_gravatar", a)
  388. }).bind("contextmenu", function(a) {
  389. return a.preventDefault(),
  390. a.stopImmediatePropagation(),
  391. Gravatar.stat("egg"),
  392. Gravatar.whee()
  393. }),
  394. jQuery("#profile-" + a + " a.grav-edit-profile").click(function(a) {
  395. return Gravatar.stat("click_edit_profile", a)
  396. })
  397. },
  398. tilt_gravatar: function() {
  399. if (this.active_grav = jQuery("img#" + this.active_id),
  400. !jQuery("img#grav-clone-" + this.active_hash).length) {
  401. this.active_grav_clone = this.active_grav.clone().attr("id", "grav-clone-" + this.active_hash).addClass("grav-clone");
  402. var a = this.active_grav.offset().top + parseInt(this.active_grav.css("padding-top"), 10)
  403. , t = this.active_grav.offset().left + parseInt(this.active_grav.css("padding-left"), 10)
  404. , r = {
  405. "-webkit-box-shadow": "0 0 4px rgba(0,0,0,.4)",
  406. "-moz-box-shadow": "0 0 4px rgba(0,0,0,.4)",
  407. "box-shadow": "0 0 4px rgba(0,0,0,.4)",
  408. "border-width": "2px 2px " + this.active_grav.height() / 5 + "px 2px",
  409. "border-color": "#fff",
  410. "border-style": "solid",
  411. padding: "0px",
  412. margin: "-2px 0 0 -2px"
  413. };
  414. if (this.active_grav.hasClass("grav-hijack"))
  415. var e = '<a href="http://gravatar.com/' + this.active_hash + '" class="grav-clone-a" target="_blank"></a>';
  416. else
  417. var e = this.active_grav.parents("a:first").clone(!0).empty();
  418. var i = this.active_grav_clone.css(r).wrap(e).parent().css({
  419. position: "absolute",
  420. top: a + "px",
  421. left: t + "px",
  422. "z-index": 15,
  423. border: "none",
  424. "text-decoration": "none"
  425. });
  426. jQuery("body").append(i),
  427. this.active_grav_clone.removeClass("grav-hashed")
  428. }
  429. },
  430. untilt_gravatar: function() {
  431. jQuery("img.grav-clone, a.grav-clone-a").remove(),
  432. Gravatar.hide_throbber()
  433. },
  434. show_throbber: function() {
  435. Gravatar.throbber || (Gravatar.throbber = jQuery('<div id="grav-throbber" style="position: absolute; z-index: 16"><img src="' + this.url_prefix + '.gravatar.com/images/throbber.gif" alt="." width="15" height="15" /></div>')),
  436. jQuery("body").append(Gravatar.throbber);
  437. var a = jQuery("#" + Gravatar.active_id).offset();
  438. Gravatar.throbber.css({
  439. top: a.top + 2 + "px",
  440. left: a.left + 1 + "px"
  441. })
  442. },
  443. hide_throbber: function() {
  444. Gravatar.throbber && Gravatar.throbber.remove()
  445. },
  446. fetch_profile_by_email: function(a) {
  447. return this.fetch_profile_by_hash(this.md5(a.toString().toLowerCase()))
  448. },
  449. fetch_profile_by_hash: function(a, t) {
  450. return this.profile_map["g" + a] = t,
  451. this.profile_stack["g" + a] && "object" == typeof this.profile_stack["g" + a] ? this.profile_stack["g" + a] : (this.profile_stack["g" + a] = "fetching",
  452. Gravatar.stat("fetch"),
  453. void this.load_js(this.url_prefix + ".gravatar.com/" + a + ".json?callback=Gravatar.fetch_profile_callback", function() {
  454. Gravatar.fetch_profile_error(a, t)
  455. }))
  456. },
  457. fetch_profile_callback: function(a) {
  458. a && "object" == typeof a && (this.profile_stack["g" + a.entry[0].hash] = a,
  459. this.notify(a.entry[0].hash))
  460. },
  461. fetch_profile_error: function(a, t) {
  462. Gravatar.stat("profile_404"),
  463. Gravatar.profile_map["g" + a] = !1;
  464. var r = jQuery("#" + t);
  465. r.parent('a[href="http://gravatar.com/' + a + '"]').length && r.unwrap(),
  466. t == Gravatar.active_id && Gravatar.hide_card()
  467. },
  468. listen: function(t, r) {
  469. for (this.notify_stack || (this.notify_stack = {}),
  470. t = "g" + t,
  471. this.notify_stack[t] || (this.notify_stack[t] = []),
  472. a = 0; a < this.notify_stack[t].length; a++)
  473. if (r == this.notify_stack[t][a])
  474. return;
  475. this.notify_stack[t][this.notify_stack[t].length] = r
  476. },
  477. notify: function(t) {
  478. for (this.notify_stack || (this.notify_stack = {}),
  479. t = "g" + t,
  480. this.notify_stack[t] || (this.notify_stack[t] = []),
  481. a = 0; a < this.notify_stack[t].length; a++)
  482. 0 != this.notify_stack[t][a] && "undefined" != typeof this.notify_stack[t][a] && (Gravatar[this.notify_stack[t][a]](t.substr(1)),
  483. this.notify_stack[t][a] = !1)
  484. },
  485. extract_hash: function(a) {
  486. if (hash = /gravatar.com\/avatar\/([0-9a-f]{32})/.exec(jQuery(a).attr("src")),
  487. null != hash && "object" == typeof hash && 2 == hash.length)
  488. hash = hash[1];
  489. else {
  490. if (hash = /gravatar_id\=([0-9a-f]{32})/.exec(jQuery(a).attr("src")),
  491. null === hash || "object" != typeof hash || 2 != hash.length)
  492. return !1;
  493. hash = hash[1]
  494. }
  495. return hash
  496. },
  497. load_js: function(a, t) {
  498. if (this.loaded_scripts || (this.loaded_scripts = []),
  499. !this.loaded_scripts[a]) {
  500. this.loaded_scripts[a] = !0;
  501. var r = document.createElement("script");
  502. r.src = a,
  503. r.type = "text/javascript",
  504. jQuery.isFunction(t) && (r.onerror = t),
  505. document.getElementsByTagName("head")[0].appendChild(r)
  506. }
  507. },
  508. loaded_js: function(a, t) {
  509. Gravatar.profile_cb(a, t)
  510. },
  511. add_card_css: function() {
  512. if (!jQuery("#gravatar-card-css").length) {
  513. var a, t = jQuery('script[src*="/js/gprofiles."]').attr("src") || !1, r = !1;
  514. if (t ? (a = t.replace(/\/js\/gprofiles(?:\.dev)?\.js.*$/, ""),
  515. r = t.split("?")[1] || !1) : a = "//s.gravatar.com",
  516. !r)
  517. var e = new Date
  518. , i = new Date(e.getFullYear(),0,1)
  519. , r = Math.ceil(((e - i) / 864e5 + i.getDay() + 1) / 7)
  520. , r = "ver=" + e.getFullYear().toString() + r.toString();
  521. a = a.replace(/^(https?\:)?\/\//, ""),
  522. a = window.location.protocol + "//" + a,
  523. new_css = "<link rel='stylesheet' type='text/css' id='gravatar-card-css' href='" + a + "/css/hovercard.css?" + r + "' />",
  524. jQuery("#gravatar-card-services-css").length || (new_css += "<link rel='stylesheet' type='text/css' id='gravatar-card-services-css' href='" + a + "/css/services.css?" + r + "' />"),
  525. jQuery("head").append(new_css)
  526. }
  527. },
  528. md5: function(a) {
  529. return hex_md5(a)
  530. },
  531. autofill: function(a, t) {
  532. a.length && -1 != a.indexOf("@") && (this.autofill_map = t,
  533. hash = this.md5(a.toString().toLowerCase()),
  534. "undefined" == typeof this.profile_stack["g" + hash] ? (this.listen(hash, "autofill_data"),
  535. this.fetch_profile_by_hash(hash)) : this.autofill_data(hash))
  536. },
  537. autofill_data: function(a) {
  538. GProfile.init(this.profile_stack["g" + a]);
  539. for (var t in this.autofill_map)
  540. switch (t) {
  541. case "url":
  542. link = GProfile.get("urls"),
  543. url = "undefined" != typeof link[0] ? link[0].value : GProfile.get("profileUrl"),
  544. jQuery("#" + this.autofill_map[t]).val(url);
  545. break;
  546. case "urls":
  547. for (links = GProfile.get("urls"),
  548. links_str = "",
  549. l = 0; l < links.length; l++)
  550. links_str += links[l].value + "\n";
  551. jQuery("#" + this.autofill_map[t]).val(links_str);
  552. break;
  553. default:
  554. if (parts = t.split(/\./),
  555. parts[1]) {
  556. switch (val = GProfile.get(t),
  557. parts[0]) {
  558. case "ims":
  559. case "phoneNumbers":
  560. val = val.value;
  561. break;
  562. case "emails":
  563. val = val[0].value;
  564. case "accounts":
  565. val = val.url
  566. }
  567. jQuery("#" + this.autofill_map[t]).val(val)
  568. } else
  569. jQuery("#" + this.autofill_map[t]).val(GProfile.get(t))
  570. }
  571. },
  572. whee: function() {
  573. if (!Gravatar.whee.didWhee) {
  574. Gravatar.whee.didWhee = !0,
  575. document.styleSheets[0].addRule ? document.styleSheets[0].addRule(".grav-tag a", "background-position: 22px 100% !important") : jQuery(".grav-tag a").css("background-position", "22px 100%"),
  576. jQuery('img[src*="gravatar.com/"]').addClass("grav-whee").css({
  577. "-webkit-box-shadow": "1px 1px 3px #aaa",
  578. "-moz-box-shadow": "1px 1px 3px #aaa",
  579. "box-shadow": "1px 1px 3px #aaa",
  580. border: "2px white solid"
  581. });
  582. var a = 0;
  583. return setInterval(function() {
  584. jQuery(".grav-whee").css({
  585. "-webkit-transform": "rotate(-" + a + "deg) scale(1.3)",
  586. "-moz-transform": "rotate(-" + a + "deg) scale(1.3)",
  587. transform: "rotate(-" + a + "deg) scale(1.3)"
  588. }),
  589. a++,
  590. 360 == a && (a = 0)
  591. }, 6),
  592. !1
  593. }
  594. },
  595. stat: function(a, t) {
  596. if (Gravatar.stats_queue.push(a),
  597. t) {
  598. var r = t.metaKey || "_blank" == jQuery(t.currentTarget).attr("target");
  599. return Gravatar.send_stats(function() {
  600. r || (document.location = t.currentTarget.href)
  601. }),
  602. r
  603. }
  604. Gravatar.stats_queue.length > 10 && Gravatar.send_stats()
  605. },
  606. send_stats: function(a) {
  607. if (document.images) {
  608. var t = Gravatar.stats_queue;
  609. if (t.length) {
  610. var r = new Date;
  611. Gravatar.stats_queue = [];
  612. var e = "https://pixel.wp.com/g.gif?v=wpcom2&x_grav-hover=" + t.join(",") + "&rand=" + Math.random().toString() + "-" + r.getTime()
  613. , i = new Image(1,1);
  614. jQuery.isFunction(a) && (i.onload = a),
  615. i.src = e
  616. }
  617. }
  618. }
  619. }
  620. , GProfile = {
  621. data: {},
  622. init: function(a) {
  623. return "fetching" == a ? !1 : "undefined" == typeof a.entry[0] ? !1 : void (GProfile.data = a.entry[0])
  624. },
  625. get: function(a) {
  626. if (-1 != a.indexOf(".")) {
  627. if (parts = a.split(/\./),
  628. GProfile.data[parts[0]]) {
  629. if (GProfile.data[parts[0]][parts[1]])
  630. return GProfile.data[parts[0]][parts[1]];
  631. for (i = 0,
  632. s = GProfile.data[parts[0]].length; i < s; i++)
  633. if (GProfile.data[parts[0]][i].type && parts[1] == GProfile.data[parts[0]][i].type || GProfile.data[parts[0]][i].shortname && parts[1] == GProfile.data[parts[0]][i].shortname || GProfile.data[parts[0]][i].primary && "primary" == parts[1])
  634. return GProfile.data[parts[0]][i]
  635. }
  636. return ""
  637. }
  638. return GProfile.data[a] ? GProfile.data[a] : "url" == a && GProfile.data.urls.length ? GProfile.data.urls[0].value : ""
  639. }
  640. }
  641. , hexcase = 0
  642. , b64pad = ""
  643. , chrsz = 8;