1<!doctype html>
2<html lang="en">
3<head>
4<style type="text/css">
5 #author_name {
6 font-weight: bold;
7 }
8 body {
9 padding-top: 1px;
10 }
11 #brand {
12 background-color: #fbfbfb;
13 color: #bbb;
14 font-family: helvetica neue, arial, sans-serif;
15 font-size: 8pt;
16 left: 0px;
17 padding-left: 0.5em;
18 padding-right: 0.5em;
19 position: absolute;
20 top: 0px;
21 }
22 #brand a {
23 color: #aaa;
24 text-decoration: none;
25 }
26</style>
27</head>
28<body>
29 <span id="brand">
30 <a href="https://twitframe.com/?ref=t" target="_blank">Twitframe</a>
31 </span>
32 <blockquote class="twitter-tweet" id="t">
33 <span id="author_name"></span>
34 <span id="author_username"></span>
35 <p>
36 <span id="tweet"></span>
37 </p>
38 <a id="date"></a>
39 </blockquote>
40</body>
41<script>
42
43var params = {};
44location.search.substr(1).split("&").forEach(function(part) {
45 var item = part.split("=");
46 params[item[0]] = decodeURIComponent(item[1]).replace(/\+/g, " ");
47});
48
49var url = params["url"] || "";
50var datetime = (params["datetime"] || 0);
51var tweet = (params["tweet"] ? params["tweet"] : "Loading tweet...");
52var author_name = (params["author_name"] ? params["author_name"] : "");
53var author_username = (params["author_username"] ? params["author_username"] : "");
54var align = params["align"];
55var link_color = params["link_color"];
56var theme = params["theme"];
57var formatted_date = "Unknown date";
58
59var m;
60if (m = url.match(/^(https?:)?\/\/(www\.)?twitter\.com\/([^\/]+)\//)) {
61 if (!author_username)
62 author_username = m[3];
63}
64
65if (author_username && author_username.substr(0, 1) != "@")
66 author_username = "@" + author_username;
67
68if (author_username == "@jcs")
69 document.getElementById("sponsor").style.display = "none";
70
71if (datetime) {
72 var d = new Date(datetime * 1000);
73 formatted_date = d.toDateString();
74}
75
76var t = document.getElementById("t");
77if (align)
78 t.align = align;
79if (link_color)
80 t.data["link-color"] = link_color;
81if (theme)
82 t.data["theme"] = theme;
83
84var h = "";
85if (author_name)
86 document.getElementById("author_name").innerText = author_name;
87if (author_username)
88 document.getElementById("author_username").innerText = author_username;
89
90document.getElementById("tweet").innerText = tweet;
91
92document.getElementById("date").href = url;
93document.getElementById("date").innerText = formatted_date;
94
95if (!params["force_fail"]) {
96 var s = document.createElement("script");
97 s.src = "https://platform.twitter.com/widgets.js";
98 document.body.appendChild(s);
99}
100
101var caller, _timer, loaded = false;
102var saveCaller = function(e) {
103 if (e.data.element) {
104 caller = e;
105 if (loaded)
106 sendResponse();
107 }
108};
109if (window.addEventListener)
110 window.addEventListener("message", saveCaller, false);
111else
112 window.attachEvent("onmessage", saveCaller);
113
114function onload() {
115 if (arguments.callee.done)
116 return;
117 arguments.callee.done = true;
118
119 if (_timer)
120 clearInterval(_timer);
121
122 loaded = true;
123 if (caller)
124 sendResponse();
125}
126
127if (document.addEventListener)
128 document.addEventListener("DOMContentLoaded", onload, false);
129else if (/WebKit/i.test(navigator.userAgent)) {
130 _timer = setInterval(function() {
131 if (/loaded|complete/.test(document.readyState))
132 onload();
133 }, 10);
134}
135else
136 window.onload = onload;
137
138function sendResponse() {
139 if (caller.data.query == "height") {
140 setTimeout(function() {
141 caller.source.postMessage({ element: caller.data.element,
142 height: document.body.scrollHeight + 20 }, caller.origin);
143 }, 500);
144 }
145};
146</script>
147</html>