(function (a) { a.fn.hovercard = function (b) { var c = { width: 300, openOnLeft: false, openOnTop: false, cardImgSrc: "", detailsHTML: "", twitterScreenName: "", showTwitterCard: false, facebookUserName: "", showFacebookCard: false, showCustomCard: false, customCardJSON: {}, customDataUrl: "", background: "#ffffff", delay: 0, autoAdjust: true, onHoverIn: function () { }, onHoverOut: function () { } }; var b = a.extend(c, b); if (a("#css-hovercard").length <= 0) { var d = '")'; a(d).appendTo("head") } return this.each(function () { function g(c, d, e, g) { var h, i, j, k, l; switch (c) { case "twitter": { i = "http://api.twitter.com/1/users/lookup.json?screen_name=" + d; h = function (a) { a = a[0]; return '
' + (a.profile_image_url ? '' : "") + (a.name ? '" : "") + (a.screen_name ? '(@' + a.screen_name + ")
" : "") + (a.location ? '" : "") + (a.description ? '

' + a.description + "

" : "") + (a.url ? '' + a.url + "
" : "") + '" + "
" }; k = "Contacting Twitter..."; l = "Invalid username or you have exceeded Twitter request limit.
Please note, Twitter only allows 150 requests per hour."; j = function () { }; if (a("#t-follow-script").length <= 0) { var m = document.createElement("script"); m.type = "text/javascript"; m.src = "//platform.twitter.com/widgets.js"; m.id = "t-follow-script"; a("body").append(m) } e.append('Follow') } break; case "facebook": { i = "https://graph.facebook.com/" + d, h = function (a) { return '
' + '' + '
" + (a.link ? '' + a.link + "
" : "") + (a.likes ? '
" : "") + (a.description ? '

' + a.description + "

" : "") + (a.start_time ? '

Start Time:
' + a.start_time + "

" : "") + (a.end_time ? '

End Time:
' + a.end_time + "

" : "") + (a.founded ? '

Founded:
' + a.founded + "

" : "") + (a.mission ? '

Mission:
' + a.mission + "

" : "") + (a.company_overview ? '

Overview:
' + a.company_overview + "

" : "") + (a.products ? '

Products:
' + a.products + "

" : "") + (a.website ? '

Web:
' + a.website + "

" : "") + (a.email ? '

Email:
' + a.email + "

" : "") + "
" }; k = "Contacting Facebook..."; l = "The requested user, page, or event could not be found. Please try a different one."; j = function (b) { if (a("#fb-like-script").length <= 0) { var c = document.createElement("script"); c.type = "text/javascript"; c.text = "(function(d, s, id) {" + "var js, fjs = d.getElementsByTagName(s)[0];" + "if (d.getElementById(id)) {return;}" + "js = d.createElement(s); js.id = id;" + 'js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=140270912730552";' + "fjs.parentNode.insertBefore(js, fjs);" + '}(document, "script", "facebook-jssdk"));'; c.id = "fb-like-script"; a("body").prepend(c); a("body").prepend('
') } e.append('
') } } break; case "custom": { i = d, h = function (a) { return '
' + (a.image ? '' + a.name + "
" : "") + (a.link ? '' + a.link + "
" : "") + (a.bio ? '

' + a.bio + "

" : "") + (a.website ? '

Web:
' + a.website + "

" : "") + (a.email ? '

Email:
' + a.email + "

" : "") + "
" }; k = "Loading..."; l = "Sorry, no data found."; j = function () { } } break; default: { } break } if (a.isEmptyObject(g)) { a.ajax({ url: i, type: "GET", dataType: "jsonp", timeout: 4e3, beforeSend: function () { e.find(".s-message").remove(); e.append('

' + k + "

") }, success: function (a) { if (a.length <= 0) { e.find(".s-message").html(l) } else { e.find(".s-message").remove(); e.prepend(h(a)); f(e.closest(".hc-preview")); e.stop(true, true).delay(b.delay).fadeIn(); j(a) } }, error: function (a, b, c) { e.find(".s-message").html(l) } }) } else { e.prepend(h(g)) } } function f(a) { var c = a.find(".hc-details").eq(0); var d = a[0].getBoundingClientRect(); var e = d.top - 20; var f = d.left + 35 + c.width(); var g = d.top + 35 + c.height(); var h = d.top - 10; if (b.openOnLeft || b.autoAdjust && f > window.innerWidth) { c.addClass("hc-details-open-left") } else { c.removeClass("hc-details-open-left") } if (b.openOnTop || b.autoAdjust && g > window.innerHeight) { c.addClass("hc-details-open-top") } else { c.removeClass("hc-details-open-top") } } var c = a(this); c.wrap('
'); c.addClass("hc-name"); var d = ""; if (b.cardImgSrc.length > 0) { d = '' } var e = '
' + d + b.detailsHTML + "
"; c.after(e); c.siblings(".hc-details").eq(0).css({ width: b.width, background: b.background }); c.closest(".hc-preview").hover(function () { var d = a(this); f(d); d.css("zIndex", "200"); c.css("zIndex", "100").find(".hc-details").css("zIndex", "50"); var e = d.find(".hc-details").eq(0); e.stop(true, true).delay(b.delay).fadeIn(); if (typeof b.onHoverIn == "function") { if (b.showCustomCard && e.find(".s-card").length <= 0) { var h = b.customDataUrl; if (typeof c.attr("data-hovercard") == "undefined") { } else if (c.attr("data-hovercard").length > 0) { h = c.attr("data-hovercard") } g("custom", h, e, b.customCardJSON) } if (b.showTwitterCard && e.find(".s-card").length <= 0) { var i = b.twitterScreenName.length > 0 ? b.twitterScreenName : c.text(); if (typeof c.attr("data-hovercard") == "undefined") { } else if (c.attr("data-hovercard").length > 0) { i = c.attr("data-hovercard") } g("twitter", i, e) } if (b.showFacebookCard && e.find(".s-card").length <= 0) { var j = b.facebookUserName.length > 0 ? b.facebookUserName : c.text(); if (typeof c.attr("data-hovercard") == "undefined") { } else if (c.attr("data-hovercard").length > 0) { j = c.attr("data-hovercard") } g("facebook", j, e) } b.onHoverIn.call(this) } }, function () { $this = a(this); $this.find(".hc-details").eq(0).stop(true, true).fadeOut(300, function () { $this.css("zIndex", "0"); c.css("zIndex", "0").find(".hc-details").css("zIndex", "0"); if (typeof b.onHoverOut == "function") { b.onHoverOut.call(this) } }) }); }) } })(jQuery)