Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
HTML source for titlebar-only display of new Twitter (very infrequent) http://twitter.com/boblet
<!DOCTYPE html>
<html >
<head>
<title>Twitter</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta charset="utf-8" />
<script type="text/javascript" charset="utf-8">
document.domain = 'twitter.com';
// this will be copied to twttr.appStartTime once our JS has started up
document.startTime = new Date().getTime();
var twttr = {};
twttr.versionName = 'phoenix';
if (!window.console) {
(function() {
var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
"group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
window.console = {};
for (var i = 0; i < names.length; ++i) {
window.console[names[i]] = function() {};
}
}());
}
</script>
<script type="text/javascript">(function () {
// patch some IE things
window.setTimeout = window.setTimeout;
window.setInterval = window.setInterval;
window.WATCH = function (label, block) {
if (typeof block === 'undefined') {
block = label;
label = undefined;
}
if (typeof label === 'string') {
WATCH._didExecute[label] = true;
}
WATCH._attempt(this, block);
};
WATCH._didExecute = {};
WATCH._reportCount = 0;
WATCH._reportLimit = 25;
WATCH._reportInterval = 60 * 1000;
WATCH._active = false;
WATCH.activate = function (setting) {
if (typeof setting === 'undefined'){
setting = true;
}
WATCH._active = setting;
extend(WATCH, WATCH._active ? WATCH.actives : WATCH.inactives)
};
WATCH.actives = {};
WATCH.inactives = {};
var extend = function(destination, source){
for (var key in source){
destination[key] = source[key];
}
}
var noop = function(){};
WATCH._attempt = function(that, block) {
if (arguments.length < 2) {
block = that;
that = window;
}
if (WATCH._active) {
try {
block.apply(that);
} catch (error) {
WATCH._triggerError(error);
}
} else {
block.apply(that);
}
};
WATCH.inactives.end = noop;
WATCH.actives.end = function (label) {
if (typeof label === 'undefined') {
throw new Error('WATCH.end() requires a label');
}
if (WATCH._didExecute[label]) {
WATCH._didExecute[label] = false;
} else if (WATCH._active) {
WATCH._triggerError(new Error('WATCH.end("'+label+'") called without successful call to WATCH("'+label+'", fn(){...}) - a SyntaxError probably just happened'));
}
WATCH._didExecute[label] = false;
};
/**
* Given a function, return a version of that function that is wrapped by the WATCH function.
*/
WATCH.inactives.callback = function(that, callback){
// pass the callback through
return typeof callback === 'undefined' ? that : callback;
};
WATCH.actives.callback = function (that, callback) {
if (arguments.length === 1) {
callback = that;
that = this;
}
if (typeof callback === 'string') {
callback = (function (stringVersion) {
return function () {
eval(stringVersion);
};
}(callback));
}
var watchedCallback = function () {
var that = this,
args = arguments,
result;
WATCH._attempt(function () {
result = callback.apply(that, args);
});
return result;
};
watchedCallback.isWatched = true;
return watchedCallback;
};
WATCH._onErrorCallbacks = {};
WATCH.inactives._addOnError = noop;
WATCH.actives._addOnError = function (callback) {
var unique = WATCH._unique();
WATCH._onErrorCallbacks[unique] = callback;
return unique;
};
WATCH.inactives._removeOnError = noop;
WATCH.actives._removeOnError = function (id) {
delete WATCH._onErrorCallbacks[id];
};
WATCH._lastUnique = -1;
WATCH._unique = function () {
return ++WATCH._lastUnique;
};
WATCH.inactives.jQuery = noop;
WATCH.actives.jQuery = function () {
// Wrap jQuery's event binding code so all event handlers are wrapped
WATCH._originalJQueryEventAdd = WATCH._originalJQueryEventAdd || jQuery.event.add;
jQuery.event.add = function () {
var newArgs = Array.prototype.slice.call(arguments);
if (typeof newArgs[2] === 'function') {
newArgs[2] = WATCH.callback(newArgs[2]);
} else if (newArgs && typeof newArgs[2] === 'object' && newArgs[2].handler) {
newArgs[2].handler = WATCH.callback(newArgs[2].handler);
}
return WATCH._originalJQueryEventAdd.apply(this, newArgs);
};
WATCH._originalJQueryAjax = WATCH._originalJQueryAjax || jQuery.ajax;
jQuery.ajax = function (options) {
jQuery.each(['complete', 'error', 'success'], function (which, key) {
if (!options[key]) {
return;
}
options[key] = WATCH.callback(options[key]);
});
return WATCH._originalJQueryAjax.apply(this, arguments);
};
};
WATCH.inactives.undoJQuery = noop;
WATCH.actives.undoJQuery = function() {
jQuery.event.add = WATCH._originalJQueryEventAdd;
jQuery.ajax = WATCH._originalJQueryAjax;
};
WATCH._previousErrors = {};
var escapeDoubleQuotes = function (string) {
return string.toString().replace('"', '\\"');
};
var stringifyLite = function (object) {
var result = '{', hasProperty = false;
for (var key in object) {
if(typeof object[key] === 'undefined' || object[key] === null){
continue;
}
result += (hasProperty ? ',"' : '"') + escapeDoubleQuotes(key) + '":"' + escapeDoubleQuotes(object[key]) + '"';
hasProperty = true;
}
return result + '}';
};
WATCH._scribeError = function(report) {
if(WATCH._previousErrors[report.error] && (new Date()) - WATCH._previousErrors[report.error] < WATCH._reportInterval) {
// We've recently logged this; don't log it again
return false;
}
if(WATCH.reportLimit <= WATCH.reportCount){
return;
}
WATCH.reportCount++;
if ( ! document.location.hostname.match(/(^(www|api)\.)?twitter\.com$/) ) {
return;
}
WATCH._previousErrors[report.error] = new Date();
report.product_name = 'webclient';
report.type = 'js_error';
report.url = window.location.href;
report.event_name = "test";
var isProduction = document.location.hostname.match(/(^(www|api|staging\d+.local)\.)twitter\.com$/) != null;
var scribeHost = isProduction ? 'scribe.twitter.com' : window.location.host;
var scribeUrl = (window.location.protocol.match(/s\:$/) ? 'https' : 'http') + '://' + scribeHost;
scribeUrl += isProduction ? '/' : '/scribe';
scribeUrl += '?category=client_watch_error&log=' + encodeURIComponent(stringifyLite(report)) + '&ts=' + (new Date()).getTime();
(new Image()).src = scribeUrl;
};
WATCH._triggerError = function(error) {
var reraise = true;
var report = {
error: error
};
for (var key in WATCH._onErrorCallbacks) {
try {
if (WATCH._onErrorCallbacks[key](report) === false) {
reraise = false;
}
} catch (callbackError) {
report.callbackFailure = true;
}
}
WATCH._scribeError(report);
if(reraise){
throw error;
}
};
/**
* Wrap built-in functions with versions that WATCH for errors as appropriate.
*/
WATCH.inactives.natives = noop;
WATCH.actives.natives = function () {
window.setInterval = WATCH._watchedSetInterval;
window.setTimeout = WATCH._watchedSetTimeout;
};
WATCH.inactives.undoNatives = noop;
WATCH.actives.undoNatives = function () {
window.setInterval = WATCH._originalSetInterval;
window.setTimeout = WATCH._originalSetTimeout;
};
WATCH._originalSetInterval = window.setInterval;
WATCH._originalSetTimeout = window.setTimeout;
// Wrap setInterval and setTimeout, which run code asyncronously and therefore allow it
// to escape any existing try/catch blocks.
// Rebind window.setInterval and .setTimeout
WATCH._watchedSetInterval = function (callback, timeout) {
// in IE, native functions have no .call().
// we have to bind to a local var in order to get them to run in the context of window
var setInterval = WATCH._originalSetInterval;
return setInterval(WATCH.callback(callback), timeout);
};
WATCH._watchedSetTimeout = function (callback, timeout) {
// in IE, native functions have no .call().
// we have to bind to a local var in order to get them to run in the context of window
var setTimeout = WATCH._originalSetTimeout;
return setTimeout(WATCH.callback(callback), timeout);
};
WATCH.activate(false);
}());
</script>
<script type="text/javascript">
</script>
<script>
function bust () {
document.write = "";
window.top.location = window.self.location;
setTimeout(function() {
document.body.innerHTML = '';
}, 0);
window.self.onload = function(evt) {
document.body.innerHTML = '';
};
}
if (window.top !== window.self) { // are you trying to put self in an iframe?
try {
if (window.top.location.host) { // this is illegal to access unless you share a non-spoofable document domain
// fun times
} else {
bust(); // chrome executes this
}
} catch (ex) {
bust(); // everyone executes this
}
}
</script>
<link href="/phoenix/favicon.ico" rel="shortcut icon" type="image/x-icon" />
<link rel="stylesheet" href="http://a2.twimg.com/a/1304464034/phoenix/css/phoenix.bundle.css" type="text/css" media="screen" />
<!-- basic RSS hoopla -->
<link rel="http://oexchange.org/spec/0.8/rel/related-target" href="http://twitter.com/oexchange.xrd" type="application/xrd+xml" />
<link rel="alternate" href="http://twitter.com/favorites/9159232.rss" title="Your Twitter Favorites" type="application/rss+xml" />
<noscript>
<meta http-equiv=refresh content="0; URL=/?_twitter_noscript=1" />
</noscript>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-30775-6']);
_gaq.push(
['_trackPageview'],
['_setDomainName', 'twitter.com']
);
(function() {
var ga = document.createElement('script');
ga.type = 'text/javascript';
ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s);
}());
twttr.trackPageView = function(pathName) {
var event = ['_trackPageview'];
if (pathName) {
event.push(pathName);
}
_gaq.push(event);
};
</script>
</head>
<body class="user-style-twttr loading-body ">
<div id="doc">
<div id="top-stuff">
<div id="banners" style="clear:both;"></div>
<div id="top-bar-outer">
<div id="top-bar-bg"></div>
<div id="top-bar">
<div class="top-bar-inside">
<div class="static-links">
<div id="logo">
<a href="/">Twitter</a>
</div>
<form id="search-form" action="/search" method="GET">
<span class="glass"><i></i></span>
<input value="" placeholder="Search" name="q" id="search-query" type="text" />
</form>
<div id="global-nav">
<ul>
<li id="global-nav-home"><a href="/">Home</a></li>
<li id="global-nav-profile"><a href="/boblet">Profile</a></li>
<li id="global-nav-messages"><a href="/messages">Messages</a></li>
<li id="global-nav-whotofollow"><a href="/#!/who_to_follow">Who To Follow</a></li>
</ul>
</div>
<div id="sections"></div>
</div>
<div class="active-links">
<a id="new-tweet" title="New Tweet">
<span>New Tweet</span></a><span class="vr">
</span><span id="session" class="loggedin">
<a class="profile-links" href="#">
<img src="http://a1.twimg.com/profile_images/1180983738/scramble_normal.jpg" />
</a>
<span id="screen-name">
boblet
</span>&nbsp;<span id="screen-name-dropdown">&nbsp;</span>
<div class="dropdown">
<ul class="user-dropdown">
<li><a href="/settings/account">Settings</a></li>
<li><a href="http://support.twitter.com">Help</a></li>
<li>
<form method="post" action="/account/use_phx" class="turn-phx-off-form">
<input type="hidden" name="setting" value="false">
<input type="hidden" name="format" value="html">
<input type='hidden' value='' name='authenticity_token'>
<button type="submit" class="turn-phx-off-button">Switch to Old Twitter</button>
</form>
</li>
<li>
<form id="signout-form" class="signout-form" action="/logout" method="POST">
<a class="signout-button" href="#">Sign out</a>
<input type='hidden' value='' name='authenticity_token' id='authenticity_token' />
</form>
</li>
</ul>
</div>
</span>
</div>
</div>
</div>
<div id="message-drawer"></div>
</div>
</div>
<div id="page-outer">
<div id="page-container" class="">
<div>
<div class="main-content">
</div>
<div class="dashboard">
</div>
<div id="details-pane-outer">
<div class="details-pane-shell">
<div class="details-pane">
</div>
</div>
</div>
</div>
</div>
</div>
<div id="message-notifications"></div>
</div>
<div id="flash-message-storage" style="display:none"></div>
<script type="text/javascript">
</script>
<script type="text/javascript">WATCH('loadrunner', function() {
(function loadrunner(E){var V=E.document;var H=V.getElementsByTagName("script"),M,J;var b={},I={},U;for(var Y=0,R;R=H[Y];Y++){if(R.src.match(/loadrunner\.js(\?|#|$)/)){M=R;break}}function C(e){if(e.length>0){return e.replace(/\/$/,"")+"/"}return""}function N(e){return Array.prototype.slice.call(e)}function B(e,f){for(var g=0,h;h=e[g];g++){if(f==h){return g}}return -1}function S(e){return !!e.match(/^(([a-zA-Z0-9\-_]+)\/)*[a-zA-Z0-9\-_]+$/)||!Z(e)}function O(e){return !!e.match(/^(([a-zA-Z0-9\-_]+)\/)*[a-zA-Z0-9\-_]+$/)}function Z(e){return !e.match(/^>/)}function Q(e){return[C(X.path),e,".js"].join("")}function D(e){if(e.match(/^(https?)?:?\/\//)){return e}if(e.match(/^\/[^\/]/)){return C(X.docRoot)+e}if(e.match(/^\$/)){return C(X.path)+e.replace(/^\$/,"")}return e}function P(f){var e;if(e=I[f]){return e}else{return f}}function F(){}F.prototype.addCallback=function(e){if(this.completed){e.apply(this,this.results)}else{this.callbacks=this.callbacks||[];this.callbacks.push(e)}};F.prototype.complete=function(){if(!this.completed){this.results=N(arguments);this.completed=true;if(this.callbacks){for(var f=0,e;e=this.callbacks[f];f++){e.apply(window,this.results)}}}};function d(f,e){this.id=f;var h=this;function g(i){h.exports=i;h.complete(h.exports)}if(typeof e=="function"){e(g)}else{this.exports=e;this.complete(this.exports)}X.loaded.push(f)}d.prototype=new F;var A={};function L(h,j){var i;if(!A[h]){i=new F;A[h]=i;var g=function(){delete A[h];X.loaded.push(h);i.complete(h)};if(Z(h)){var e=V.createElement("script");e.type="text/javascript";e.async=true;e.onload=g;e.onerror=function(){throw h+" not loaded"};e.onreadystatechange=function(){if(this.readyState=="loaded"||this.readyState=="complete"){this.onreadystatechange=null;g()}};e.src=h;var f=V.getElementsByTagName("head")[0];if(!f){f=V.createElement("head");V.documentElement.appendChild(f)}f.insertBefore(e,f.firstChild)}else{i.onManualLoad=i.onManualLoad||[];i.onManualLoad.push(g)}}else{i=A[h]}if(j){i.addCallback(j)}return i}function T(f,e){e=[].concat(e);for(var g=0,h;h=e[g];g++){I[unescape(h)]=unescape(f)}}function X(){var f=new F,e=N(arguments),k=0,q=[];for(var n=0;n<e.length;n++){if(typeof e[n].length==="number"&&e[n].splice){e=e.slice(0,n).concat(e[n]).concat(e.slice(n+1))}}function j(){k++;if(k==e.length){var s;var v=[],u={},p;for(var t=0,r;r=q[t];t++){p=b[r].exports;v.push(p);u[r]=p}f.complete.apply(f,v)}}function g(i,p){return function(){if(!b[i]){throw new Error("File "+p+" does not provide module "+i)}b[i].addCallback(function(){j()})}}if(typeof e[e.length-1]=="function"){f.addCallback(e.pop())}if(!e.length){setTimeout(function(){f.complete()},0)}for(var l=0,h;h=e[l];l++){if(S(h)){var m=P(h);var o;if(O(h)){o=Q(m)}else{o=m}q.push(h);if(B(X.loaded,h)>-1){g(h)()}else{X.load(D(o),g(h,o))}}else{if(B(X.loaded,h)>-1){j()}else{X.load(D(P(h)),j)}}}return f}X.loaded=[];X.path="";if(M){X.path=M.getAttribute("data-path")||M.src.split(/loadrunner\.js/)[0]||"";if(U=M.getAttribute("data-alias")||window.__lralias){for(var Y=0,W,c=U.split("&");W=c[Y]&&c[Y].split("=");Y++){var K=W[0],G=W[1].split(",");T(K,G)}}}X.docRoot=X.cwd="";X.reset=function(){X.loaded=[];b={}};function a(g,f){b[g]=new d(g,f);var j=A[g];if(j&&j.onManualLoad){for(var h=0,e=j.onManualLoad.length;h<e;++h){j.onManualLoad[h]()}delete j.onManualLoad}return b[g]}E.using=X;E.using.load=L;E.using.alias=T;E.provide=a;if(J=(M&&M.getAttribute("data-main"))){X.apply(E,J.split(/\s*,\s*/))}})(this);
});
</script>
<script>WATCH.end('loadrunner');</script>
<script type="text/javascript">WATCH('javascript_includes', function() {
(function loadrunner(E){var V=E.document;var H=V.getElementsByTagName("script"),M,J;var b={},I={},U;for(var Y=0,R;R=H[Y];Y++){if(R.src.match(/loadrunner\.js(\?|#|$)/)){M=R;break}}function C(e){if(e.length>0){return e.replace(/\/$/,"")+"/"}return""}function N(e){return Array.prototype.slice.call(e)}function B(e,f){for(var g=0,h;h=e[g];g++){if(f==h){return g}}return -1}function S(e){return !!e.match(/^(([a-zA-Z0-9\-_]+)\/)*[a-zA-Z0-9\-_]+$/)||!Z(e)}function O(e){return !!e.match(/^(([a-zA-Z0-9\-_]+)\/)*[a-zA-Z0-9\-_]+$/)}function Z(e){return !e.match(/^>/)}function Q(e){return[C(X.path),e,".js"].join("")}function D(e){if(e.match(/^(https?)?:?\/\//)){return e}if(e.match(/^\/[^\/]/)){return C(X.docRoot)+e}if(e.match(/^\$/)){return C(X.path)+e.replace(/^\$/,"")}return e}function P(f){var e;if(e=I[f]){return e}else{return f}}function F(){}F.prototype.addCallback=function(e){if(this.completed){e.apply(this,this.results)}else{this.callbacks=this.callbacks||[];this.callbacks.push(e)}};F.prototype.complete=function(){if(!this.completed){this.results=N(arguments);this.completed=true;if(this.callbacks){for(var f=0,e;e=this.callbacks[f];f++){e.apply(window,this.results)}}}};function d(f,e){this.id=f;var h=this;function g(i){h.exports=i;h.complete(h.exports)}if(typeof e=="function"){e(g)}else{this.exports=e;this.complete(this.exports)}X.loaded.push(f)}d.prototype=new F;var A={};function L(h,j){var i;if(!A[h]){i=new F;A[h]=i;var g=function(){delete A[h];X.loaded.push(h);i.complete(h)};if(Z(h)){var e=V.createElement("script");e.type="text/javascript";e.async=true;e.onload=g;e.onerror=function(){throw h+" not loaded"};e.onreadystatechange=function(){if(this.readyState=="loaded"||this.readyState=="complete"){this.onreadystatechange=null;g()}};e.src=h;var f=V.getElementsByTagName("head")[0];if(!f){f=V.createElement("head");V.documentElement.appendChild(f)}f.insertBefore(e,f.firstChild)}else{i.onManualLoad=i.onManualLoad||[];i.onManualLoad.push(g)}}else{i=A[h]}if(j){i.addCallback(j)}return i}function T(f,e){e=[].concat(e);for(var g=0,h;h=e[g];g++){I[unescape(h)]=unescape(f)}}function X(){var f=new F,e=N(arguments),k=0,q=[];for(var n=0;n<e.length;n++){if(typeof e[n].length==="number"&&e[n].splice){e=e.slice(0,n).concat(e[n]).concat(e.slice(n+1))}}function j(){k++;if(k==e.length){var s;var v=[],u={},p;for(var t=0,r;r=q[t];t++){p=b[r].exports;v.push(p);u[r]=p}f.complete.apply(f,v)}}function g(i,p){return function(){if(!b[i]){throw new Error("File "+p+" does not provide module "+i)}b[i].addCallback(function(){j()})}}if(typeof e[e.length-1]=="function"){f.addCallback(e.pop())}if(!e.length){setTimeout(function(){f.complete()},0)}for(var l=0,h;h=e[l];l++){if(S(h)){var m=P(h);var o;if(O(h)){o=Q(m)}else{o=m}q.push(h);if(B(X.loaded,h)>-1){g(h)()}else{X.load(D(o),g(h,o))}}else{if(B(X.loaded,h)>-1){j()}else{X.load(D(P(h)),j)}}}return f}X.loaded=[];X.path="";if(M){X.path=M.getAttribute("data-path")||M.src.split(/loadrunner\.js/)[0]||"";if(U=M.getAttribute("data-alias")||window.__lralias){for(var Y=0,W,c=U.split("&");W=c[Y]&&c[Y].split("=");Y++){var K=W[0],G=W[1].split(",");T(K,G)}}}X.docRoot=X.cwd="";X.reset=function(){X.loaded=[];b={}};function a(g,f){b[g]=new d(g,f);var j=A[g];if(j&&j.onManualLoad){for(var h=0,e=j.onManualLoad.length;h<e;++h){j.onManualLoad[h]()}delete j.onManualLoad}return b[g]}E.using=X;E.using.load=L;E.using.alias=T;E.provide=a;if(J=(M&&M.getAttribute("data-main"))){X.apply(E,J.split(/\s*,\s*/))}})(this);
twttr.session = twttr.session || {};
twttr.loggedIn = true;
twttr.appStartTime = document.startTime; // set in phoenix.mustache
// Give our session a unique impression id for profiling purposes
twttr.session.impressionId = twttr.appStartTime + Math.random();
twttr.remoteIP = '222.144.241.28';
twttr.requestFullCity = 'jp,32,osaka';
twttr.geo = twttr.geo || {};
twttr.bundles = {"phoenix_plugins":"http:\/\/a2.twimg.com\/a\/1304464034\/javascripts\/phoenix_plugins.bundle.js","phxie6":"http:\/\/a2.twimg.com\/a\/1304464034\/javascripts\/phxie6.bundle.js","admin":"http:\/\/a1.twimg.com\/a\/1304464034\/javascripts\/admin.bundle.js","griffin":"http:\/\/a1.twimg.com\/a\/1304464034\/javascripts\/griffin.bundle.js","base":"http:\/\/a0.twimg.com\/sticky\/base.18.bundle.js","api":"http:\/\/a2.twimg.com\/a\/1304464034\/javascripts\/api.bundle.js","phoenix":"http:\/\/a0.twimg.com\/a\/1304464034\/javascripts\/phoenix.bundle.js"};
using(
'>allCurrentUserDataLoaded',
'>request_cache_seeded',
'>base_bundle_evaled',
'>phoenix_plugins_bundle_evaled',
'>phoenix_bundle_evaled',
'>languageData',
function () {
// Manually trigger ready event, avoiding race condition where it never fires due to iframe thingy
// This should be safe based on how our script loading is done
jQuery.ready();
twttr.setup();
}
);
/* -------------------- Autocomplete place data from CDN -------------------- */
twttr.placeDataPrefix = "http://geo.l3.twitter.com/places/autocomplete_places-";
/* -------------------- Initialize API Method -------------------- */
function initAPI() {
twttr.anywhere.api.initialize();
twttr.API = {};
twttr.aug(twttr.API, twttr.anywhere.api.models);
twttr.aug(twttr.API, {
globalEvents: twttr.anywhere.api.globalEvents
});
twttr.API.setConfig = twttr.anywhere.api.updateConfig;
twttr.API.getConfig = function () {
return twttr.anywhere.api.config;
};
if (!twttr.API.util) {
twttr.API.util = {};
}
twttr.aug(twttr.API.util, twttr.anywhere.api.util);
if (!twttr.API._requestCache) {
twttr.API._requestCache = twttr.anywhere.api.cache;
}
twttr.API.setConfig({
cacheObjects: true,
includeEntities: true
});
twttr.extendAPI();
}
/* -------------------- Init CurrentUser Method -------------------- */
function initCurrentUser() {
if (twttr.loggedIn) {
using('>bootstrap_data', '>request_cache_seeded', function (bootstrapData) {
twttr.API.User.current({
error: function() {
// Not logged in anymore; refresh the page
window.location.reload(true);
},
success: function(currentUser) {
twttr.currentUser = currentUser;
for (var propName in bootstrapData.userProperties) {
twttr.currentUser.sync(propName, bootstrapData.userProperties[propName] || false);
}
provide('>allCurrentUserDataLoaded');
}
});
});
} else {
provide('>allCurrentUserDataLoaded');
}
};
/* -------------------- Setting up Domains -------------------- */
twttr.proto = window.location.protocol.match(/s\:$/) ? 'https' : 'http';
twttr.isSSL = function () {
return twttr.proto === 'https';
};
twttr.domains = {
local: 'twitter.com',
remote: 'api.twitter.com'
};
var match = window.location.hostname.match(/^(staging\d+\.[a-zA-Z0-9_]*?)\.twitter\.com$/i);
if (match) {
twttr.domains.local = match[1] + '.twitter.com';
twttr.domains.remote = 'api-' + match[1] + '.twitter.com';
}
if (document.location.hostname === "localhost.twitter.com") {
twttr.domains.local = 'localhost.twitter.com:3000';
twttr.domains.remote = 'api.localhost.twitter.com:3000';
}
twttr.hosts = {
local: twttr.proto + "://" + twttr.domains.local,
remote: twttr.proto + "://" + twttr.domains.remote
};
var pReceiverURL = twttr.hosts.remote + '/receiver.html';
twttr.jsonpSandboxURL = 'http://a3.twimg.com/a/1304464034/jsonp_sandbox.html#scripts=http://a0.twimg.com/sticky/base.18.bundle.js';
/* -------------------- Iframe Creator Method -------------------- */
function createIFrame(complete) {
var frag = document.createElement('div');
frag.innerHTML = '<iframe tabindex="-1" role="presentation" style="position:absolute;top:-9999px;" src="' + pReceiverURL + '"></iframe>';
var iframe = frag.firstChild;
var fnComplete = function() {
complete.apply(iframe, arguments);
};
iframe.addEventListener ? iframe.addEventListener('load', fnComplete, false) : iframe.attachEvent('onload', fnComplete);
// Avoid "operation aborted" error in IE that can be caused by
// appending a new element to the body via body.appendChild
// by a script that is not a direct descendant of the <body>.
document.body.insertBefore(iframe, document.body.firstChild);
return iframe;
}
/*------------------- Local Assets --------------------*/
/*------------------- CDN Assets --------------------*/
/*------------------- fetch base --------------------*/
(function() {
var bundleFetchStartTime = new Date();
using(twttr.bundles.base, function() {
provide('>base_bundle_evaled');
});
using('>base_bundle_evaled',
twttr.bundles.api,
twttr.bundles.phoenix_plugins,
twttr.bundles.phoenix,
function() {
var bundleFetchEndTime = new Date();
provide('>allCodeLoaded');
using('>bootstrap_data', function() {
twttr.util.Profiler.logPreviousEvent('twttr.bundles fetched', bundleFetchStartTime, bundleFetchEndTime);
});
}
);
})();
/*------------------- fetch bootstrap data --------------------*/
(function() {
var xhr;
if(window.XMLHttpRequest) {
xhr = new window.XMLHttpRequest();
} else {
try {
xhr = new window.ActiveXObject("Microsoft.XMLHTTP");
} catch(e) {
// Eep
}
}
xhr.onreadystatechange = function() {
if(xhr.readyState == 4) {
if(xhr.responseText.charAt(0) === '{') {
provide('>bootstrap_data', function(exports) {
exports(JSON.parse(xhr.responseText));
});
} else {
eval(xhr.responseText);
}
}
};
// Note: we include window.location.search here so any query string parameters given to load the page are passed
// along to /account/bootstrap_data.js. In particular, we want things like ?lang=ja to propogate through to the
// request for bootstrap data.
xhr.open('GET', '/account/bootstrap_data' + (window.location.search ? (window.location.search + '&') : '?') + 'r=' + Math.random(), true);
xhr.send(null);
})();
using('>base_bundle_evaled', '>api_bundle_evaled', function() {
twttr.anywhere.remote = {};
provide('>api_ready', function(exports) {
initAPI();
exports();
});
using('>request_cache_seeded', function() {
initCurrentUser();
});
});
using('>bootstrap_data', function(data) {
twttr.payload = data.payload;
provide('>payload');
twttr.remoteIP = data.remoteIP;
twttr.requestFullCity = data.requestFullCity;
twttr.recentPlaces = data.recentPlaces;
twttr.cdnBase = data.cdnBase;
if(data.currentUser) {
twttr.currentUserScreenName = data.currentUserScreenName;
}
if (data.frontSuggestedUsers) {
twttr.frontSuggestedUsers = data.frontSuggestedUsers;
}
if(data.griffinConfig) {
twttr.griffinConfig = data.griffinConfig;
provide('>griffin_config');
}
if (data.isAdmin) {
twttr.rights = data.adminRights
twttr.isAdmin = true;
}
if (data.isNarrow) {
twttr.isNarrow = true;
}
if(data.pageLocale) {
twttr.pageLocale = data.pageLocale;
}
if(data.pageLocaleJS) {
// Need to load language data
using(data.pageLocaleJS, function() {
provide('>languageData');
});
} else {
provide('>languageData');
}
if(data.pageLocaleClass) {
using('>base_bundle_evaled', function() {
$(function() {
$(document.body).addClass(data.pageLocaleClass);
});
});
}
if(data.languages) {
twttr.languages = data.languages;
}
using('>defaultViews', function() {
if(data.showWelcomeBanner) {
(new twttr.views.WelcomeToPhoenixBanner()).render($('#banners'), 'append');
}
if (data.flashNotice) {
$('#flash-message-storage').html(data.flashNotice).show();
}
});
using('>decider', function() {
twttr.decider._updateFeatures(data.deciderFeatures);
});
using('>ab_decider', function() {
twttr.abdecider._updateExperiments(data.abBuckets);
});
using('>api_ready', function() {
twttr.API.setConfig({ postAuthenticityToken: data.postAuthenticityToken });
$('#authenticity_token').val(data.postAuthenticityToken);
provide('>request_cache_seeded', function(exports) {
var seedData = data.requestCacheSeedData;
for (var i = 0, len = seedData.length; i < len; ++i) {
var seedItem = seedData[i];
twttr.API._requestCache.inject(seedItem.api_request_name, seedItem.options, seedItem.json, 1);
}
exports();
});
if(data.homeTimelineFetchSize) {
twttr.API.homeTimelineFetchSize = data.homeTimelineFetchSize;
}
});
});
createIFrame(function() {
var that = this;
using('>base_bundle_evaled', '>api_bundle_evaled', function() {
twttr.anywhere.remote.server = that;
twttr.anywhere.api.util.RemoteRequest.flush();
});
});
});</script>
<script>WATCH.end('javascript_includes');</script>
<!--[if lte IE 6]>
<script src="http://a2.twimg.com/a/1304464034/javascripts/phxie6.bundle.js"></script>
<![endif]-->
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.