TWTR = window.TWTR || {}; if (!Array.forEach) { Array.prototype.filter = function (E, F) { var D = F || window; var A = []; for (var C = 0, B = this.length; C < B; ++C) { if (!E.call(D, this[C], C, this)) { continue } A.push(this[C]) } return A }; Array.prototype.indexOf = function (B, C) { var C = C || 0; for (var A = 0; A < this.length; ++A) { if (this[A] === B) { return A } } return -1 } } (function () { if (TWTR && TWTR.Widget) { return } function F(J, M, I) { for (var L = 0, K = J.length; L < K; ++L) { M.call(I || window, J[L], L, J) } } function B(I, K, J) { this.el = I; this.prop = K; this.from = J.from; this.to = J.to; this.time = J.time; this.callback = J.callback; this.animDiff = this.to - this.from } B.canTransition = function () { var I = document.createElement("twitter"); I.style.cssText = "-webkit-transition: all .5s linear;"; return !!I.style.webkitTransitionProperty } (); B.prototype._setStyle = function (I) { switch (this.prop) { case "opacity": this.el.style[this.prop] = I; this.el.style.filter = "alpha(opacity=" + I * 100 + ")"; break; default: this.el.style[this.prop] = I + "px"; break } }; B.prototype._animate = function () { var I = this; this.now = new Date(); this.diff = this.now - this.startTime; if (this.diff > this.time) { this._setStyle(this.to); if (this.callback) { this.callback.call(this) } clearInterval(this.timer); return } this.percentage = (Math.floor((this.diff / this.time) * 100) / 100); this.val = (this.animDiff * this.percentage) + this.from; this._setStyle(this.val) }; B.prototype.start = function () { var I = this; this.startTime = new Date(); this.timer = setInterval(function () { I._animate.call(I) }, 15) }; TWTR.Widget = function (I) { this.init(I) }; (function () { var X = {}; var U = location.protocol.match(/https/); var W = /^.+\/profile_images/; var c = "https://s3.amazonaws.com/twitter_production/profile_images"; var d = function (n) { return U ? n.replace(W, c) : n }; var m = {}; var k = function (o) { var n = m[o]; if (!n) { n = new RegExp("(?:^|\\s+)" + o + "(?:\\s+|$)"); m[o] = n } return n }; var J = function (r, v, s, t) { var v = v || "*"; var s = s || document; var o = [], n = s.getElementsByTagName(v), u = k(r); for (var p = 0, q = n.length; p < q; ++p) { if (u.test(n[p].className)) { o[o.length] = n[p]; if (t) { t.call(n[p], n[p]) } } } return o }; var l = function () { var n = navigator.userAgent; return { ie: n.match(/MSIE\s([^;]*)/)} } (); var N = function (n) { if (typeof n == "string") { return document.getElementById(n) } return n }; var f = function (n) { return n.replace(/^\s+|\s+$/g, "") }; var b = function () { var n = self.innerHeight; var o = document.compatMode; if ((o || l.ie)) { n = (o == "CSS1Compat") ? document.documentElement.clientHeight : document.body.clientHeight } return n }; var j = function (p, n) { var o = p.target || p.srcElement; return n(o) }; var Z = function (o) { try { if (o && 3 == o.nodeType) { return o.parentNode } else { return o } } catch (n) { } }; var a = function (o) { var n = o.relatedTarget; if (!n) { if (o.type == "mouseout") { n = o.toElement } else { if (o.type == "mouseover") { n = o.fromElement } } } return Z(n) }; var g = function (o, n) { n.parentNode.insertBefore(o, n.nextSibling) }; var h = function (o) { try { o.parentNode.removeChild(o) } catch (n) { } }; var e = function (n) { return n.firstChild }; var I = function (p) { var o = a(p); while (o && o != this) { try { o = o.parentNode } catch (n) { o = this } } if (o != this) { return true } return false }; var M = function () { if (document.defaultView && document.defaultView.getComputedStyle) { return function (o, r) { var q = null; var p = document.defaultView.getComputedStyle(o, ""); if (p) { q = p[r] } var n = o.style[r] || q; return n } } else { if (document.documentElement.currentStyle && l.ie) { return function (n, p) { var o = n.currentStyle ? n.currentStyle[p] : null; return (n.style[p] || o) } } } } (); var i = { has: function (n, o) { return new RegExp("(^|\\s)" + o + "(\\s|$)").test(N(n).className) }, add: function (n, o) { if (!this.has(n, o)) { N(n).className = f(N(n).className) + " " + o } }, remove: function (n, o) { if (this.has(n, o)) { N(n).className = N(n).className.replace(new RegExp("(^|\\s)" + o + "(\\s|$)", "g"), "") } } }; var K = { add: function (p, o, n) { if (p.addEventListener) { p.addEventListener(o, n, false) } else { p.attachEvent("on" + o, function () { n.call(p, window.event) }) } }, remove: function (p, o, n) { if (p.removeEventListener) { p.removeEventListener(o, n, false) } else { p.detachEvent("on" + o, n) } } }; var T = function () { function o(q) { return parseInt((q).substring(0, 2), 16) } function n(q) { return parseInt((q).substring(2, 4), 16) } function p(q) { return parseInt((q).substring(4, 6), 16) } return function (q) { return [o(q), n(q), p(q)] } } (); var O = { bool: function (n) { return typeof n === "boolean" }, def: function (n) { return !(typeof n === "undefined") }, number: function (o) { return typeof o === "number" && isFinite(o) }, string: function (n) { return typeof n === "string" }, fn: function (n) { return typeof n === "function" }, array: function (n) { if (n) { return O.number(n.length) && O.fn(n.splice) } return false } }; var S = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; var Y = function (q) { var u = new Date(q); if (l.ie) { u = Date.parse(q.replace(/( \+)/, " UTC$1")) } var o = ""; var n = function () { var s = u.getHours(); if (s > 0 && s < 13) { o = "am"; return s } else { if (s < 1) { o = "am"; return 12 } else { o = "pm"; return s - 12 } } } (); var p = u.getMinutes(); var t = u.getSeconds(); function r() { var s = new Date(); if (s.getDate() != u.getDate() || s.getYear() != u.getYear() || s.getMonth() != u.getMonth()) { return " - " + S[u.getMonth()] + " " + u.getDate() + ", " + u.getFullYear() } else { return "" } } return n + ":" + p + o + r() }; var Q = function (t) { var v = new Date(); var r = new Date(t); if (l.ie) { r = Date.parse(t.replace(/( \+)/, " UTC$1")) } var u = v - r; var o = 1000, p = o * 60, q = p * 60, s = q * 24, n = s * 7; if (isNaN(u) || u < 0) { return "" } if (u < o * 2) { return "right now" } if (u < p) { return Math.floor(u / o) + " seconds ago" } if (u < p * 2) { return "about 1 minute ago" } if (u < q) { return Math.floor(u / p) + " minutes ago" } if (u < q * 2) { return "about 1 hour ago" } if (u < s) { return Math.floor(u / q) + " hours ago" } if (u > s && u < s * 2) { return "yesterday" } if (u < s * 365) { return Math.floor(u / s) + " days ago" } else { return "over a year ago" } }; var L = { link: function (n) { return n.replace(/\b(((https*\:\/\/)|www\.)[^\"\']+?)(([!?,.\)]+)?(\s|$))/g, function (t, s, q, p, o) { var r = q.match(/w/) ? "http://" : ""; return '<a class="twtr-hyperlink" target="_blank" href="' + r + s + '">' + ((s.length > 25) ? s.substr(0, 24) + "..." : s) + "</a>" + o }) }, at: function (n) { return n.replace(/\B[@＠]([a-zA-Z0-9_]{1,20})/g, function (o, p) { return '@<a target="_blank" class="twtr-atreply" href="http://twitter.com/intent/user?screen_name=' + p + '">' + p + "</a>" }) }, list: function (n) { return n.replace(/\B[@＠]([a-zA-Z0-9_]{1,20}\/\w+)/g, function (o, p) { return '@<a target="_blank" class="twtr-atreply" href="http://twitter.com/' + p + '">' + p + "</a>" }) }, hash: function (n) { return n.replace(/(^|\s+)#(\w+)/gi, function (o, p, q) { return p + '<a target="_blank" class="twtr-hashtag" href="http://twitter.com/search?q=%23' + q + '">#' + q + "</a>" }) }, clean: function (n) { return this.hash(this.at(this.list(this.link(n)))) } }; function V(o, p, n) { this.job = o; this.decayFn = p; this.interval = n; this.decayRate = 1; this.decayMultiplier = 1.25; this.maxDecayTime = 3 * 60 * 1000 } V.prototype = { start: function () { this.stop().run(); return this }, stop: function () { if (this.worker) { window.clearTimeout(this.worker) } return this }, run: function () { var n = this; this.job(function () { n.decayRate = n.decayFn() ? Math.max(1, n.decayRate / n.decayMultiplier) : n.decayRate * n.decayMultiplier; var o = n.interval * n.decayRate; o = (o >= n.maxDecayTime) ? n.maxDecayTime : o; o = Math.floor(o); n.worker = window.setTimeout(function () { n.run.call(n) }, o) }) }, destroy: function () { this.stop(); this.decayRate = 1; return this } }; function P(o, n, p) { this.time = o || 6000; this.loop = n || false; this.repeated = 0; this.callback = p; this.haystack = [] } P.prototype = { set: function (n) { this.haystack = n }, add: function (n) { this.haystack.unshift(n) }, start: function () { if (this.timer) { return this } this._job(); var n = this; this.timer = setInterval(function () { n._job.call(n) }, this.time); return this }, stop: function () { if (this.timer) { window.clearInterval(this.timer); this.timer = null } return this }, _next: function () { var n = this.haystack.shift(); if (n && this.loop) { this.haystack.push(n) } return n || null }, _job: function () { var n = this._next(); if (n) { this.callback(n) } return this } }; function R(p) { function n() { if (p.needle.metadata && p.needle.metadata.result_type && p.needle.metadata.result_type == "popular") { return '<span class="twtr-popular">' + p.needle.metadata.recent_retweets + "+ recent retweets</span>" } else { return "" } } var o = '<div class="twtr-tweet-wrap">         <div class="twtr-avatar">           <div class="twtr-img"><a target="_blank" href="http://twitter.com/intent/user?screen_name=' + p.user + '"><img alt="' + p.user + ' profile" src="' + d(p.avatar) + '"></a></div>         </div>         <div class="twtr-tweet-text">           <p>             <a target="_blank" href="http://twitter.com/intent/user?screen_name=' + p.user + '" class="twtr-user">' + p.user + "</a> " + p.tweet + '             <em>            <a target="_blank" class="twtr-timestamp" time="' + p.timestamp + '" href="http://twitter.com/' + p.user + "/status/" + p.id + '">' + p.created_at + '</a> &middot;            <a target="_blank" class="twtr-reply" href="http://twitter.com/intent/tweet?in_reply_to=' + p.id + '">reply</a> &middot;             <a target="_blank" class="twtr-rt" href="http://twitter.com/intent/retweet?tweet_id=' + p.id + '">retweet</a> &middot;             <a target="_blank" class="twtr-fav" href="http://twitter.com/intent/favorite?tweet_id=' + p.id + '">favorite</a>             </em> ' + n() + "           </p>         </div>       </div>"; var q = document.createElement("div"); q.id = "tweet-id-" + ++R._tweetCount; q.className = "twtr-tweet"; q.innerHTML = o; this.element = q } R._tweetCount = 0; X.loadStyleSheet = function (p, o) { if (!TWTR.Widget.loadingStyleSheet) { TWTR.Widget.loadingStyleSheet = true; var n = document.createElement("link"); n.href = p; n.rel = "stylesheet"; n.type = "text/css"; document.getElementsByTagName("head")[0].appendChild(n); var q = setInterval(function () { var r = M(o, "position"); if (r == "relative") { clearInterval(q); q = null; TWTR.Widget.hasLoadedStyleSheet = true } }, 50) } }; (function () { var n = false; X.css = function (q) { var p = document.createElement("style"); p.type = "text/css"; if (l.ie) { p.styleSheet.cssText = q } else { var r = document.createDocumentFragment(); r.appendChild(document.createTextNode(q)); p.appendChild(r) } function o() { document.getElementsByTagName("head")[0].appendChild(p) } if (!l.ie || n) { o() } else { window.attachEvent("onload", function () { n = true; o() }) } } })(); TWTR.Widget.isLoaded = false; TWTR.Widget.loadingStyleSheet = false; TWTR.Widget.hasLoadedStyleSheet = false; TWTR.Widget.WIDGET_NUMBER = 0; TWTR.Widget.REFRESH_MIN = 6000; TWTR.Widget.matches = { mentions: /^@[a-zA-Z0-9_]{1,20}\b/, any_mentions: /\b@[a-zA-Z0-9_]{1,20}\b/ }; TWTR.Widget.jsonP = function (o, q) { var n = document.createElement("script"); var p = document.getElementsByTagName("head")[0]; n.type = "text/javascript"; n.src = o; p.insertBefore(n, p.firstChild); q(n); return n }; TWTR.Widget.prototype = function () { var q = U ? "https://" : "http://"; var t = window.location.hostname.match(/twitter\.com/) ? (window.location.hostname + ":" + window.location.port) : "twitter.com"; var s = q + "search." + t + "/search."; var u = q + "api." + t + "/1/statuses/user_timeline."; var p = q + t + "/favorites/"; var r = q + "api." + t + "/1/"; var o = 25000; var n = U ? "https://twitter-widgets.s3.amazonaws.com/j/1/default.gif" : "http://widgets.twimg.com/j/1/default.gif"; return { init: function (w) { var v = this; this._widgetNumber = ++TWTR.Widget.WIDGET_NUMBER; TWTR.Widget["receiveCallback_" + this._widgetNumber] = function (x) { v._prePlay.call(v, x) }; this._cb = "TWTR.Widget.receiveCallback_" + this._widgetNumber; this.opts = w; this._base = s; this._isRunning = false; this._hasOfficiallyStarted = false; this._hasNewSearchResults = false; this._rendered = false; this._profileImage = false; this._isCreator = !!w.creator; this._setWidgetType(w.type); this.timesRequested = 0; this.runOnce = false; this.newResults = false; this.results = []; this.jsonMaxRequestTimeOut = 19000; this.showedResults = []; this.sinceId = 1; this.source = "TWITTERINC_WIDGET"; this.id = w.id || "twtr-widget-" + this._widgetNumber; this.tweets = 0; this.setDimensions(w.width, w.height); this.interval = w.interval ? Math.max(w.interval, TWTR.Widget.REFRESH_MIN) : TWTR.Widget.REFRESH_MIN; this.format = "json"; this.rpp = w.rpp || 50; this.subject = w.subject || ""; this.title = w.title || ""; this.setFooterText(w.footer); this.setSearch(w.search); this._setUrl(); this.theme = w.theme ? w.theme : this._getDefaultTheme(); if (!w.id) { document.write('<div class="twtr-widget" id="' + this.id + '"></div>') } this.widgetEl = N(this.id); if (w.id) { i.add(this.widgetEl, "twtr-widget") } if (w.version >= 2 && !TWTR.Widget.hasLoadedStyleSheet) { if (U) { X.loadStyleSheet("../css/widget.css", this.widgetEl) } else { if (w.creator) { X.loadStyleSheet("/stylesheets/widgets/widget.css", this.widgetEl) } else { X.loadStyleSheet("http://www.consense.co.uk/library/css/twitter-widget.css", this.widgetEl) } } } this.occasionalJob = new V(function (x) { v.decay = x; v._getResults.call(v) }, function () { return v._decayDecider.call(v) }, o); this._ready = O.fn(w.ready) ? w.ready : function () { }; this._isRelativeTime = true; this._tweetFilter = false; this._avatars = true; this._isFullScreen = false; this._isLive = true; this._isScroll = false; this._loop = true; this._showTopTweets = (this._isSearchWidget) ? true : false; this._behavior = "default"; this.setFeatures(this.opts.features); this.intervalJob = new P(this.interval, this._loop, function (x) { v._normalizeTweet(x) }); return this }, setDimensions: function (v, x) { this.wh = (v && x) ? [v, x] : [250, 300]; if (v == "auto" || v == "100%") { this.wh[0] = "100%" } else { this.wh[0] = ((this.wh[0] < 150) ? 150 : this.wh[0]) + "px" } this.wh[1] = ((this.wh[1] < 100) ? 100 : this.wh[1]) + "px"; return this }, setRpp: function (v) { var v = parseInt(v); this.rpp = (O.number(v) && (v > 0 && v <= 100)) ? v : 30; return this }, _setWidgetType: function (v) { this._isSearchWidget = false, this._isProfileWidget = false, this._isFavsWidget = false, this._isListWidget = false; switch (v) { case "profile": this._isProfileWidget = true; break; case "search": this._isSearchWidget = true, this.search = this.opts.search; break; case "faves": case "favs": this._isFavsWidget = true; break; case "list": case "lists": this._isListWidget = true; break } return this }, setFeatures: function (w) { if (w) { if (O.def(w.filters)) { this._tweetFilter = w.filters } if (O.def(w.dateformat)) { this._isRelativeTime = !!(w.dateformat !== "absolute") } if (O.def(w.fullscreen) && O.bool(w.fullscreen)) { if (w.fullscreen) { this._isFullScreen = true; this.wh[0] = "100%"; this.wh[1] = (b() - 90) + "px"; var x = this; K.add(window, "resize", function (AA) { x.wh[1] = b(); x._fullScreenResize() }) } } if (O.def(w.loop) && O.bool(w.loop)) { this._loop = w.loop } if (O.def(w.behavior) && O.string(w.behavior)) { switch (w.behavior) { case "all": this._behavior = "all"; break; case "preloaded": this._behavior = "preloaded"; break; default: this._behavior = "default"; break } } if (O.def(w.toptweets) && O.bool(w.toptweets)) { this._showTopTweets = w.toptweets; var v = (this._showTopTweets) ? "inline-block" : "none"; X.css("#" + this.id + " .twtr-popular { display: " + v + "; }") } if (!O.def(w.toptweets)) { this._showTopTweets = true; var v = (this._showTopTweets) ? "inline-block" : "none"; X.css("#" + this.id + " .twtr-popular { display: " + v + "; }") } if (O.def(w.avatars) && O.bool(w.avatars)) { if (!w.avatars) { X.css("#" + this.id + " .twtr-avatar, #" + this.id + " .twtr-user { display: none; } #" + this.id + " .twtr-tweet-text { margin-left: 0; }"); this._avatars = false } else { var y = (this._isFullScreen) ? "90px" : "40px"; X.css("#" + this.id + " .twtr-avatar { display: block; } #" + this.id + " .twtr-user { display: inline; } #" + this.id + " .twtr-tweet-text { margin-left: " + y + "; }"); this._avatars = true } } else { if (this._isProfileWidget) { this.setFeatures({ avatars: false }); this._avatars = false } else { this.setFeatures({ avatars: true }); this._avatars = true } } if (O.def(w.hashtags) && O.bool(w.hashtags)) { (!w.hashtags) ? X.css("#" + this.id + " a.twtr-hashtag { display: none; }") : "" } if (O.def(w.timestamp) && O.bool(w.timestamp)) { var z = w.timestamp ? "block" : "none"; X.css("#" + this.id + " em { display: " + z + "; }") } if (O.def(w.live) && O.bool(w.live)) { this._isLive = w.live } if (O.def(w.scrollbar) && O.bool(w.scrollbar)) { this._isScroll = w.scrollbar } } else { if (this._isProfileWidget) { this.setFeatures({ avatars: false }); this._avatars = false } if (this._isProfileWidget || this._isFavsWidget) { this.setFeatures({ behavior: "all" }) } } return this }, _fullScreenResize: function () { var v = J("twtr-timeline", "div", document.body, function (w) { w.style.height = (b() - 90) + "px" }) }, setTweetInterval: function (v) { this.interval = v; return this }, setBase: function (v) { this._base = v; return this }, setUser: function (w, v) { this.username = w; this.realname = v || " "; if (this._isFavsWidget) { this.setBase(p + w + ".") } else { if (this._isProfileWidget) { this.setBase(u + this.format + "?screen_name=" + w) } } this.setSearch(" "); return this }, setList: function (w, v) { this.listslug = v.replace(/ /g, "-").toLowerCase(); this.username = w; this.setBase(r + w + "/lists/" + this.listslug + "/statuses."); this.setSearch(" "); return this }, setProfileImage: function (v) { this._profileImage = v; this.byClass("twtr-profile-img", "img").src = d(v); this.byClass("twtr-profile-img-anchor", "a").href = "http://twitter.com/intent/user?screen_name=" + this.username; return this }, setTitle: function (v) { this.title = v; this.widgetEl.getElementsByTagName("h3")[0].innerHTML = this.title; return this }, setCaption: function (v) { this.subject = v; this.widgetEl.getElementsByTagName("h4")[0].innerHTML = this.subject; return this }, setFooterText: function (v) { this.footerText = (O.def(v) && O.string(v)) ? v : "Join the conversation"; if (this._rendered) { this.byClass("twtr-join-conv", "a").innerHTML = this.footerText } return this }, setSearch: function (w) { this.searchString = w || ""; this.search = encodeURIComponent(this.searchString); this._setUrl(); if (this._rendered) { var v = this.byClass("twtr-join-conv", "a"); v.href = "http://twitter.com/" + this._getWidgetPath() } return this }, _getWidgetPath: function () { if (this._isProfileWidget) { return this.username } else { if (this._isFavsWidget) { return this.username + "/favorites" } else { if (this._isListWidget) { return this.username + "/lists/" + this.listslug } else { return "#search?q=" + this.search } } } }, _setUrl: function () { var w = this; function v() { return "&" + (+new Date) + "=cachebust" } function x() { return (w.sinceId == 1) ? "" : "&since_id=" + w.sinceId + "&refresh=true" } if (this._isProfileWidget) { this.url = this._base + "&callback=" + this._cb + "&include_rts=true&count=" + this.rpp + x() + "&clientsource=" + this.source } else { if (this._isFavsWidget || this._isListWidget) { this.url = this._base + this.format + "?callback=" + this._cb + x() + "&clientsource=" + this.source } else { this.url = this._base + this.format + "?q=" + this.search + "&include_rts=true&callback=" + this._cb + "&rpp=" + this.rpp + x() + "&clientsource=" + this.source; if (!this.runOnce) { this.url += "&result_type=recent" } } } this.url += v(); return this }, _getRGB: function (v) { return T(v.substring(1, 7)) }, setTheme: function (AA, v) { var y = this; var w = " "; var z = ((window.location.hostname.match(/twitter\.com/)) && (window.location.pathname.match(/goodies/))); if (v || z) { w = "" } this.theme = { shell: { background: function () { return AA.shell.background || y._getDefaultTheme().shell.background } (), color: function () { return AA.shell.color || y._getDefaultTheme().shell.color } () }, tweets: { background: function () { return AA.tweets.background || y._getDefaultTheme().tweets.background } (), color: function () { return AA.tweets.color || y._getDefaultTheme().tweets.color } (), links: function () { return AA.tweets.links || y._getDefaultTheme().tweets.links } ()} }; var x = "#" + this.id + " .twtr-doc,                      #" + this.id + " .twtr-hd a,                      #" + this.id + " h3,                      #" + this.id + " h4,                      #" + this.id + " .twtr-popular {            background-color: " + this.theme.shell.background + w + ";            color: " + this.theme.shell.color + w + ";          }          #" + this.id + " .twtr-popular {            color: " + this.theme.tweets.color + w + ";            background-color: rgba(" + this._getRGB(this.theme.shell.background) + ", .3)" + w + ";          }          #" + this.id + " .twtr-tweet a {            color: " + this.theme.tweets.links + w + ";          }          #" + this.id + " .twtr-bd, #" + this.id + " .twtr-timeline i a,           #" + this.id + " .twtr-bd p {            color: " + this.theme.tweets.color + w + ";          }          #" + this.id + " .twtr-new-results,           #" + this.id + " .twtr-results-inner,           #" + this.id + " .twtr-timeline {            background: " + this.theme.tweets.background + w + ";          }"; if (l.ie) { x += "#" + this.id + " .twtr-tweet { background: " + this.theme.tweets.background + w + "; }" } X.css(x); return this }, byClass: function (y, v, w) { var x = J(y, v, N(this.id)); return (w) ? x : x[0] }, render: function () { var x = this; if (!TWTR.Widget.hasLoadedStyleSheet) { window.setTimeout(function () { x.render.call(x) }, 50); return this } this.setTheme(this.theme, this._isCreator); if (this._isProfileWidget) { i.add(this.widgetEl, "twtr-widget-profile") } if (this._isScroll) { i.add(this.widgetEl, "twtr-scroll") } if (!this._isLive && !this._isScroll) { this.wh[1] = "auto" } if (this._isSearchWidget && this._isFullScreen) { document.title = "Twitter search: " + escape(this.searchString) } this.widgetEl.innerHTML = this._getWidgetHtml(); var w = this.byClass("twtr-timeline", "div"); if (this._isLive && !this._isFullScreen) { var y = function (z) { if (x._behavior === "all") { return } if (I.call(this, z)) { x.pause.call(x) } }; var v = function (z) { if (x._behavior === "all") { return } if (I.call(this, z)) { x.resume.call(x) } }; this.removeEvents = function () { K.remove(w, "mouseover", y); K.remove(w, "mouseout", v) }; K.add(w, "mouseover", y); K.add(w, "mouseout", v) } this._rendered = true; this._ready(); return this }, removeEvents: function () { }, _getDefaultTheme: function () { return { shell: { background: "#8ec1da", color: "#ffffff" }, tweets: { background: "#ffffff", color: "#444444", links: "#1985b5"}} }, _getWidgetHtml: function () { var x = this; function z() { if (x._isProfileWidget) { return '<a target="_blank" href="http://twitter.com/" class="twtr-profile-img-anchor"><img alt="profile" class="twtr-profile-img" src="' + n + '"></a>                      <h3></h3>                      <h4></h4>' } else { return "<h3>" + x.title + "</h3><h4>" + x.subject + "</h4>" } } function w() { return x._isFullScreen ? " twtr-fullscreen" : "" } var y = U ? "https://twitter-widgets.s3.amazonaws.com/i/widget-logo.png" : "http://widgets.twimg.com/i/widget-logo.png"; if (this._isFullScreen) { y = "https://twitter-widgets.s3.amazonaws.com/i/widget-logo-fullscreen.png" } var v = '<div class="twtr-doc' + w() + '" style="width: ' + this.wh[0] + ';">            <div class="twtr-hd">' + z() + '             </div>            <div class="twtr-bd">              <div class="twtr-timeline" style="height: ' + this.wh[1] + ';">                <div class="twtr-tweets">                  <div class="twtr-reference-tweet"></div>                  <!-- tweets show here -->                </div>              </div>            </div>            <div class="twtr-ft">              <div><a target="_blank" href="http://twitter.com"><img alt="" src="' + y + '"></a>                <span><a target="_blank" class="twtr-join-conv" style="color:' + this.theme.shell.color + '" href="http://twitter.com/' + this._getWidgetPath() + '">' + this.footerText + "</a></span>              </div>            </div>          </div>"; return v }, _appendTweet: function (v) { this._insertNewResultsNumber(); g(v, this.byClass("twtr-reference-tweet", "div")); return this }, _slide: function (w) { var x = this; var v = e(w).offsetHeight; if (this.runOnce) { new B(w, "height", { from: 0, to: v, time: 500, callback: function () { x._fade.call(x, w) } }).start() } return this }, _fade: function (v) { var w = this; if (B.canTransition) { v.style.webkitTransition = "opacity 0.5s ease-out"; v.style.opacity = 1; return this } new B(v, "opacity", { from: 0, to: 1, time: 500 }).start(); return this }, _chop: function () { if (this._isScroll) { return this } var AA = this.byClass("twtr-tweet", "div", true); var AB = this.byClass("twtr-new-results", "div", true); if (AA.length) { for (var x = AA.length - 1; x >= 0; x--) { var z = AA[x]; var y = parseInt(z.offsetTop); if (y > parseInt(this.wh[1])) { h(z) } else { break } } if (AB.length > 0) { var v = AB[AB.length - 1]; var w = parseInt(v.offsetTop); if (w > parseInt(this.wh[1])) { h(v) } } } return this }, _appendSlideFade: function (w) { var v = w || this.tweet.element; this._chop()._appendTweet(v)._slide(v); return this }, _createTweet: function (v) { v.timestamp = v.created_at; v.created_at = this._isRelativeTime ? Q(v.created_at) : Y(v.created_at); this.tweet = new R(v); if (this._isLive && this.runOnce) { this.tweet.element.style.opacity = 0; this.tweet.element.style.filter = "alpha(opacity:0)"; this.tweet.element.style.height = "0" } return this }, _getResults: function () { var v = this; this.timesRequested++; this.jsonRequestRunning = true; this.jsonRequestTimer = window.setTimeout(function () { if (v.jsonRequestRunning) { clearTimeout(v.jsonRequestTimer); v.jsonRequestTimer = null } v.jsonRequestRunning = false; h(v.scriptElement); v.newResults = false; v.decay() }, this.jsonMaxRequestTimeOut); TWTR.Widget.jsonP(v.url, function (w) { v.scriptElement = w }) }, clear: function () { var w = this.byClass("twtr-tweet", "div", true); var v = this.byClass("twtr-new-results", "div", true); w = w.concat(v); F(w, function (x) { h(x) }); return this }, _sortByMagic: function (v) { var w = this; if (this._tweetFilter) { if (this._tweetFilter.negatives) { v = v.filter(function (x) { if (!w._tweetFilter.negatives.test(x.text)) { return x } }) } if (this._tweetFilter.positives) { v = v.filter(function (x) { if (w._tweetFilter.positives.test(x.text)) { return x } }) } } switch (this._behavior) { case "all": this._sortByLatest(v); break; case "preloaded": default: this._sortByDefault(v); break } if (this._isLive && this._behavior !== "all") { this.intervalJob.set(this.results); this.intervalJob.start() } return this }, _loadTopTweetsAtTop: function (x) { var y = [], z = [], w = []; F(x, function (AA) { if (AA.metadata && AA.metadata.result_type && AA.metadata.result_type == "popular") { z.push(AA) } else { y.push(AA) } }); var v = z.concat(y); return v }, _sortByLatest: function (v) { this.results = v; this.results = this.results.slice(0, this.rpp); this.results = this._loadTopTweetsAtTop(this.results); this.results.reverse(); return this }, _sortByDefault: function (w) { var x = this; var v = function (z) { return new Date(z).getTime() }; this.results.unshift.apply(this.results, w); F(this.results, function (z) { if (!z.views) { z.views = 0 } }); this.results.sort(function (AA, z) { if (v(AA.created_at) > v(z.created_at)) { return -1 } else { if (v(AA.created_at) < v(z.created_at)) { return 1 } else { return 0 } } }); this.results = this.results.slice(0, this.rpp); this.results = this._loadTopTweetsAtTop(this.results); var y = this.results; this.results = this.results.sort(function (AA, z) { if (AA.views < z.views) { return -1 } else { if (AA.views > z.views) { return 1 } } return 0 }); if (!this._isLive) { this.results.reverse() } }, _prePlay: function (w) { if (this.jsonRequestTimer) { clearTimeout(this.jsonRequestTimer); this.jsonRequestTimer = null } if (!l.ie) { h(this.scriptElement) } if (w.error) { this.newResults = false } else { if (w.results && w.results.length > 0) { this.response = w; this.newResults = true; this.sinceId = w.max_id_str; this._sortByMagic(w.results); if (this.isRunning()) { this._play() } } else { if ((this._isProfileWidget || this._isFavsWidget || this._isListWidget) && O.array(w) && w.length) { this.newResults = true; if (!this._profileImage && this._isProfileWidget) { var v = w[0].user.screen_name; this.setProfileImage(w[0].user.profile_image_url); this.setTitle(w[0].user.name); this.setCaption('<a target="_blank" href="http://twitter.com/intent/user?screen_name=' + v + '">' + v + "</a>") } this.sinceId = w[0].id_str; this._sortByMagic(w); if (this.isRunning()) { this._play() } } else { this.newResults = false } } } this._setUrl(); if (this._isLive) { this.decay() } }, _play: function () { var v = this; if (this.runOnce) { this._hasNewSearchResults = true } if (this._avatars) { this._preloadImages(this.results) } if (this._isRelativeTime && (this._behavior == "all" || this._behavior == "preloaded")) { F(this.byClass("twtr-timestamp", "a", true), function (w) { w.innerHTML = Q(w.getAttribute("time")) }) } if (!this._isLive || this._behavior == "all" || this._behavior == "preloaded") { F(this.results, function (x) { if (x.retweeted_status) { x = x.retweeted_status } if (v._isProfileWidget) { x.from_user = x.user.screen_name; x.profile_image_url = x.user.profile_image_url } if (v._isFavsWidget || v._isListWidget) { x.from_user = x.user.screen_name; x.profile_image_url = x.user.profile_image_url } x.id = x.id_str; v._createTweet({ id: x.id, user: x.from_user, tweet: L.clean(x.text), avatar: x.profile_image_url, created_at: x.created_at, needle: x }); var w = v.tweet.element; (v._behavior == "all") ? v._appendSlideFade(w) : v._appendTweet(w) }); if (this._behavior != "preloaded") { return this } } return this }, _normalizeTweet: function (w) { var v = this; w.views++; if (this._isProfileWidget) { w.from_user = v.username; w.profile_image_url = w.user.profile_image_url } if (this._isFavsWidget || this._isListWidget) { w.from_user = w.user.screen_name; w.profile_image_url = w.user.profile_image_url } if (this._isFullScreen) { w.profile_image_url = w.profile_image_url.replace(/_normal\./, "_bigger.") } w.id = w.id_str; this._createTweet({ id: w.id, user: w.from_user, tweet: L.clean(w.text), avatar: w.profile_image_url, created_at: w.created_at, needle: w })._appendSlideFade() }, _insertNewResultsNumber: function () { if (!this._hasNewSearchResults) { this._hasNewSearchResults = false; return } if (this.runOnce && this._isSearchWidget) { var y = this.response.total > this.rpp ? this.response.total : this.response.results.length; var v = y > 1 ? "s" : ""; var x = (this.response.warning && this.response.warning.match(/adjusted since_id/)) ? "more than" : ""; var w = document.createElement("div"); i.add(w, "twtr-new-results"); w.innerHTML = '<div class="twtr-results-inner"> &nbsp; </div><div class="twtr-results-hr"> &nbsp; </div><span>' + x + " <strong>" + y + "</strong> new tweet" + v + "</span>"; g(w, this.byClass("twtr-reference-tweet", "div")); this._hasNewSearchResults = false } }, _preloadImages: function (v) { if (this._isProfileWidget || this._isFavsWidget || this._isListWidget) { F(v, function (x) { var w = new Image(); w.src = d(x.user.profile_image_url) }) } else { F(v, function (w) { (new Image()).src = d(w.profile_image_url) }) } }, _decayDecider: function () { var v = false; if (!this.runOnce) { this.runOnce = true; v = true } else { if (this.newResults) { v = true } } return v }, start: function () { var v = this; if (!this._rendered) { setTimeout(function () { v.start.call(v) }, 50); return this } if (!this._isLive) { this._getResults() } else { this.occasionalJob.start() } this._isRunning = true; this._hasOfficiallyStarted = true; return this }, stop: function () { this.occasionalJob.stop(); if (this.intervalJob) { this.intervalJob.stop() } this._isRunning = false; return this }, pause: function () { if (this.isRunning() && this.intervalJob) { this.intervalJob.stop(); i.add(this.widgetEl, "twtr-paused"); this._isRunning = false } if (this._resumeTimer) { clearTimeout(this._resumeTimer); this._resumeTimer = null } return this }, resume: function () { var v = this; if (!this.isRunning() && this._hasOfficiallyStarted && this.intervalJob) { this._resumeTimer = window.setTimeout(function () { v.intervalJob.start(); v._isRunning = true; i.remove(v.widgetEl, "twtr-paused") }, 2000) } return this }, isRunning: function () { return this._isRunning }, destroy: function () { this.stop(); this.clear(); this.runOnce = false; this._hasOfficiallyStarted = false; this._profileImage = false; this._isLive = true; this._tweetFilter = false; this._isScroll = false; this.newResults = false; this._isRunning = false; this.sinceId = 1; this.results = []; this.showedResults = []; this.occasionalJob.destroy(); if (this.jsonRequestRunning) { clearTimeout(this.jsonRequestTimer) } i.remove(this.widgetEl, "twtr-scroll"); this.removeEvents(); return this } } } () })(); var E = /twitter\.com(\:\d{2,4})?\/intent\/(\w+)/, H = { tweet: true, retweet: true, favorite: true }, G = "scrollbars=yes,resizable=yes,toolbar=no,location=yes", D = screen.height, C = screen.width; function A(O) { O = O || window.event; var N = O.target || O.srcElement, J, K, I, M, L; while (N && N.nodeName.toLowerCase() !== "a") { N = N.parentNode } if (N && N.nodeName.toLowerCase() === "a" && N.href) { J = N.href.match(E); if (J) { K = 550; I = (J[2] in H) ? 420 : 560; M = Math.round((C / 2) - (K / 2)); L = 0; if (D > I) { L = Math.round((D / 2) - (I / 2)) } window.open(N.href, "intent", G + ",width=" + K + ",height=" + I + ",left=" + M + ",top=" + L); O.returnValue = false; O.preventDefault && O.preventDefault() } } } if (document.addEventListener) { document.addEventListener("click", A, false) } else { if (document.attachEvent) { document.attachEvent("onclick", A) } } })();
