jekyll-lenciel-theme 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/_layouts/home.html +22 -0
- data/_sass/_base.scss +5 -0
- data/_sass/_partials.scss +8 -0
- data/_sass/base/_layout.scss +192 -0
- data/_sass/base/_solarized.scss +46 -0
- data/_sass/base/_theme.scss +86 -0
- data/_sass/base/_typography.scss +162 -0
- data/_sass/base/_utilities.scss +28 -0
- data/_sass/custom/_article.scss +88 -0
- data/_sass/custom/_background.scss +3 -0
- data/_sass/custom/_colors.scss +48 -0
- data/_sass/custom/_fonts.scss +16 -0
- data/_sass/custom/_footer.scss +68 -0
- data/_sass/custom/_footnotes.scss +4 -0
- data/_sass/custom/_header.scss +11 -0
- data/_sass/custom/_icomoon.scss +204 -0
- data/_sass/custom/_layout.scss +21 -0
- data/_sass/custom/_navigation.scss +50 -0
- data/_sass/custom/_styles.scss +81 -0
- data/_sass/custom/_tablestyle.scss +37 -0
- data/_sass/partials/_archive.scss +72 -0
- data/_sass/partials/_blog.scss +157 -0
- data/_sass/partials/_footer.scss +19 -0
- data/_sass/partials/_header.scss +18 -0
- data/_sass/partials/_navigation.scss +137 -0
- data/_sass/partials/_sharing.scss +8 -0
- data/_sass/partials/_sidebar.scss +5 -0
- data/_sass/partials/_syntax.scss +278 -0
- data/_sass/partials/sidebar/_base.scss +106 -0
- data/_sass/partials/sidebar/_delicious.scss +4 -0
- data/_sass/partials/sidebar/_googleplus.scss +26 -0
- data/_sass/partials/sidebar/_pinboard.scss +12 -0
- data/_sass/partials/sidebar/_twitter.scss +34 -0
- data/_sass/screen.scss +10 -0
- data/blog/archives/index.html +18 -0
- data/fonts/0XxGQsSc1g4rdRdjJKZrNAzyDMXhdD8sAj6OAJTFsBI.woff2 +0 -0
- data/fonts/7dSh6BcuqDLzS2qAASIeuoX0hVgzZQUfRDuZrPvH3D8.woff2 +0 -0
- data/fonts/BJVWev7_auVaQ__OU8Qih1KPGs1ZzpMvnHX-7fPOuAc.woff2 +0 -0
- data/fonts/CWlc_g68BGYDSGdpJvpktgLUuEpTyoUstqEm5AMlJo4.woff2 +0 -0
- data/fonts/DVKQJxMmC9WF_oplMzlQqYX0hVgzZQUfRDuZrPvH3D8.woff2 +0 -0
- data/fonts/GpWpM_6S4VQLPNAQ3iWvVYX0hVgzZQUfRDuZrPvH3D8.woff2 +0 -0
- data/fonts/IcoMoon.eot +0 -0
- data/fonts/IcoMoon.svg +69 -0
- data/fonts/IcoMoon.ttf +0 -0
- data/fonts/IcoMoon.woff +0 -0
- data/fonts/PIPMHY90P7jtyjpXuZ2cLJBw1xU1rKptJj_0jans920.woff2 +0 -0
- data/fonts/PTSans-Bold.woff +0 -0
- data/fonts/PTSans-BoldItalic.woff +0 -0
- data/fonts/PTSans-Italic.woff +0 -0
- data/fonts/PTSans-Regular.woff +0 -0
- data/fonts/PatuaOne-Regular.woff +0 -0
- data/fonts/YDAoLskQQ5MOAgvHUQCcLWjF_m7mVnhXExjNED3rUtY.woff2 +0 -0
- data/fonts/YDAoLskQQ5MOAgvHUQCcLaa0P60JZGaCMFbL3N9v4H0.woff2 +0 -0
- data/fonts/YanoneKaffeesatz-Regular.woff +0 -0
- data/fonts/fhNmDCnjccoUYyU4ZASaLVKPGs1ZzpMvnHX-7fPOuAc.woff2 +0 -0
- data/fonts/g46X4VH_KHOWAAa-HpnGPgsYbbCjybiHxArTLjt7FRU.woff2 +0 -0
- data/fonts/hpORcvLZtemlH8gI-1S-7gsYbbCjybiHxArTLjt7FRU.woff2 +0 -0
- data/fonts/kTYfCWJhlldPf5LnG4ZnHAsYbbCjybiHxArTLjt7FRU.woff2 +0 -0
- data/fonts/lILlYDvubYemzYzN7GbLkA7aC6SjiAOpAWOKfJDfVRY.woff2 +0 -0
- data/fonts/lILlYDvubYemzYzN7GbLkBampu5_7CjHW5spxoeN3Vs.woff2 +0 -0
- data/fonts/lILlYDvubYemzYzN7GbLkBdwxCXfZpKo5kWAx_74bHs.woff2 +0 -0
- data/fonts/lILlYDvubYemzYzN7GbLkIjoYw3YTyktCCer_ilOlhE.woff2 +0 -0
- data/fonts/oysROHFTu1eTZ74Hcf8V-VKPGs1ZzpMvnHX-7fPOuAc.woff2 +0 -0
- data/fonts/yAXhog6uK3bd3OwBILv_SJBw1xU1rKptJj_0jans920.woff2 +0 -0
- data/images/bird_32_gray.png +0 -0
- data/images/bird_32_gray_fail.png +0 -0
- data/images/code_bg.png +0 -0
- data/images/construction.png +0 -0
- data/images/divider.png +0 -0
- data/images/dotted-border.png +0 -0
- data/images/email.png +0 -0
- data/images/gradback.png +0 -0
- data/images/gradhead.png +0 -0
- data/images/gradhover.png +0 -0
- data/images/line-tile.png +0 -0
- data/images/noise.png +0 -0
- data/images/rss.png +0 -0
- data/images/search.png +0 -0
- data/images/sorry.gif +0 -0
- data/javascripts/ender.js +45 -0
- data/javascripts/github.js +32 -0
- data/javascripts/libs/jXHR.js +85 -0
- data/javascripts/libs/jquery.min.js +5 -0
- data/javascripts/libs/modernizr.custom.55630.js +4 -0
- data/javascripts/libs/swfobject-dynamic.js +298 -0
- data/javascripts/modernizr-2.0.js +5 -0
- data/javascripts/octopress.js +151 -0
- data/javascripts/pinboard.js +56 -0
- data/javascripts/twitter.js +78 -0
- metadata +90 -1
@@ -0,0 +1,298 @@
|
|
1
|
+
/*! SWFObject v2.2 <http://code.google.com/p/swfobject/>
|
2
|
+
is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
|
3
|
+
*/
|
4
|
+
|
5
|
+
var swfobject = function() {
|
6
|
+
|
7
|
+
var UNDEF = "undefined",
|
8
|
+
OBJECT = "object",
|
9
|
+
SHOCKWAVE_FLASH = "Shockwave Flash",
|
10
|
+
SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
|
11
|
+
FLASH_MIME_TYPE = "application/x-shockwave-flash",
|
12
|
+
EXPRESS_INSTALL_ID = "SWFObjectExprInst",
|
13
|
+
|
14
|
+
win = window,
|
15
|
+
doc = document,
|
16
|
+
nav = navigator,
|
17
|
+
|
18
|
+
plugin = false,
|
19
|
+
regObjArr = [],
|
20
|
+
objIdArr = [],
|
21
|
+
storedAltContent,
|
22
|
+
storedAltContentId,
|
23
|
+
storedCallbackFn,
|
24
|
+
storedCallbackObj,
|
25
|
+
autoHideShow = true,
|
26
|
+
|
27
|
+
/* Centralized function for browser feature detection
|
28
|
+
- User agent string detection is only used when no good alternative is possible
|
29
|
+
- Is executed directly for optimal performance
|
30
|
+
*/
|
31
|
+
ua = function() {
|
32
|
+
var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
|
33
|
+
u = nav.userAgent.toLowerCase(),
|
34
|
+
p = nav.platform.toLowerCase(),
|
35
|
+
windows = p ? /win/.test(p) : /win/.test(u),
|
36
|
+
mac = p ? /mac/.test(p) : /mac/.test(u),
|
37
|
+
webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
|
38
|
+
ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html
|
39
|
+
playerVersion = [0,0,0],
|
40
|
+
d = null;
|
41
|
+
if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
|
42
|
+
d = nav.plugins[SHOCKWAVE_FLASH].description;
|
43
|
+
if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+
|
44
|
+
plugin = true;
|
45
|
+
ie = false; // cascaded feature detection for Internet Explorer
|
46
|
+
d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
|
47
|
+
playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
|
48
|
+
playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
|
49
|
+
playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;
|
50
|
+
}
|
51
|
+
}
|
52
|
+
else if (typeof win.ActiveXObject != UNDEF) {
|
53
|
+
try {
|
54
|
+
var a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
|
55
|
+
if (a) { // a will return null when ActiveX is disabled
|
56
|
+
d = a.GetVariable("$version");
|
57
|
+
if (d) {
|
58
|
+
ie = true; // cascaded feature detection for Internet Explorer
|
59
|
+
d = d.split(" ")[1].split(",");
|
60
|
+
playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
|
61
|
+
}
|
62
|
+
}
|
63
|
+
}
|
64
|
+
catch(e) {}
|
65
|
+
}
|
66
|
+
return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac };
|
67
|
+
}()
|
68
|
+
|
69
|
+
|
70
|
+
/* Main function
|
71
|
+
- Will preferably execute onDomLoad, otherwise onload (as a fallback)
|
72
|
+
*/
|
73
|
+
function main() {
|
74
|
+
if (plugin) { testPlayerVersion(); }
|
75
|
+
else { matchVersions(); }
|
76
|
+
}
|
77
|
+
|
78
|
+
/* Detect the Flash Player version for non-Internet Explorer browsers
|
79
|
+
- Detecting the plug-in version via the object element is more precise than using the plugins collection item's description:
|
80
|
+
a. Both release and build numbers can be detected
|
81
|
+
b. Avoid wrong descriptions by corrupt installers provided by Adobe
|
82
|
+
c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports
|
83
|
+
- Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available
|
84
|
+
*/
|
85
|
+
function testPlayerVersion() {
|
86
|
+
var b = doc.getElementsByTagName("body")[0];
|
87
|
+
var o = createElement(OBJECT);
|
88
|
+
o.setAttribute("type", FLASH_MIME_TYPE);
|
89
|
+
var t = b.appendChild(o);
|
90
|
+
if (t) {
|
91
|
+
var counter = 0;
|
92
|
+
(function(){
|
93
|
+
if (typeof t.GetVariable != UNDEF) {
|
94
|
+
var d = t.GetVariable("$version");
|
95
|
+
if (d) {
|
96
|
+
d = d.split(" ")[1].split(",");
|
97
|
+
ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
|
98
|
+
}
|
99
|
+
}
|
100
|
+
else if (counter < 10) {
|
101
|
+
counter++;
|
102
|
+
setTimeout(arguments.callee, 10);
|
103
|
+
return;
|
104
|
+
}
|
105
|
+
b.removeChild(o);
|
106
|
+
t = null;
|
107
|
+
matchVersions();
|
108
|
+
})();
|
109
|
+
}
|
110
|
+
else {
|
111
|
+
matchVersions();
|
112
|
+
}
|
113
|
+
}
|
114
|
+
|
115
|
+
|
116
|
+
/* Cross-browser dynamic SWF creation
|
117
|
+
*/
|
118
|
+
function createSWF(attObj, parObj, id) {
|
119
|
+
var r, el = getElementById(id);
|
120
|
+
if (ua.wk && ua.wk < 312) { return r; }
|
121
|
+
if (el) {
|
122
|
+
if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
|
123
|
+
attObj.id = id;
|
124
|
+
}
|
125
|
+
if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML
|
126
|
+
var att = "";
|
127
|
+
for (var i in attObj) {
|
128
|
+
if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries
|
129
|
+
if (i.toLowerCase() == "data") {
|
130
|
+
parObj.movie = attObj[i];
|
131
|
+
}
|
132
|
+
else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
|
133
|
+
att += ' class="' + attObj[i] + '"';
|
134
|
+
}
|
135
|
+
else if (i.toLowerCase() != "classid") {
|
136
|
+
att += ' ' + i + '="' + attObj[i] + '"';
|
137
|
+
}
|
138
|
+
}
|
139
|
+
}
|
140
|
+
var par = "";
|
141
|
+
for (var j in parObj) {
|
142
|
+
if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries
|
143
|
+
par += '<param name="' + j + '" value="' + parObj[j] + '" />';
|
144
|
+
}
|
145
|
+
}
|
146
|
+
el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';
|
147
|
+
objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only)
|
148
|
+
r = getElementById(attObj.id);
|
149
|
+
}
|
150
|
+
else { // well-behaving browsers
|
151
|
+
var o = createElement(OBJECT);
|
152
|
+
o.setAttribute("type", FLASH_MIME_TYPE);
|
153
|
+
for (var m in attObj) {
|
154
|
+
if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries
|
155
|
+
if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
|
156
|
+
o.setAttribute("class", attObj[m]);
|
157
|
+
}
|
158
|
+
else if (m.toLowerCase() != "classid") { // filter out IE specific attribute
|
159
|
+
o.setAttribute(m, attObj[m]);
|
160
|
+
}
|
161
|
+
}
|
162
|
+
}
|
163
|
+
for (var n in parObj) {
|
164
|
+
if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element
|
165
|
+
createObjParam(o, n, parObj[n]);
|
166
|
+
}
|
167
|
+
}
|
168
|
+
el.parentNode.replaceChild(o, el);
|
169
|
+
r = o;
|
170
|
+
}
|
171
|
+
}
|
172
|
+
return r;
|
173
|
+
}
|
174
|
+
|
175
|
+
function createObjParam(el, pName, pValue) {
|
176
|
+
var p = createElement("param");
|
177
|
+
p.setAttribute("name", pName);
|
178
|
+
p.setAttribute("value", pValue);
|
179
|
+
el.appendChild(p);
|
180
|
+
}
|
181
|
+
|
182
|
+
/* Cross-browser SWF removal
|
183
|
+
- Especially needed to safely and completely remove a SWF in Internet Explorer
|
184
|
+
*/
|
185
|
+
/* Functions to optimize JavaScript compression
|
186
|
+
*/
|
187
|
+
function getElementById(id) {
|
188
|
+
var el = null;
|
189
|
+
try {
|
190
|
+
el = doc.getElementById(id);
|
191
|
+
}
|
192
|
+
catch (e) {}
|
193
|
+
return el;
|
194
|
+
}
|
195
|
+
|
196
|
+
function createElement(el) {
|
197
|
+
return doc.createElement(el);
|
198
|
+
}
|
199
|
+
|
200
|
+
/* Flash Player and SWF content version matching
|
201
|
+
*/
|
202
|
+
function hasPlayerVersion(rv) {
|
203
|
+
var pv = ua.pv, v = rv.split(".");
|
204
|
+
v[0] = parseInt(v[0], 10);
|
205
|
+
v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0"
|
206
|
+
v[2] = parseInt(v[2], 10) || 0;
|
207
|
+
return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
|
208
|
+
}
|
209
|
+
|
210
|
+
|
211
|
+
/* Filter to avoid XSS attacks
|
212
|
+
*/
|
213
|
+
function urlEncodeIfNecessary(s) {
|
214
|
+
var regex = /[\\\"<>\.;]/;
|
215
|
+
var hasBadChars = regex.exec(s) != null;
|
216
|
+
return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s;
|
217
|
+
}
|
218
|
+
|
219
|
+
return {
|
220
|
+
/* Public API
|
221
|
+
- Reference: http://code.google.com/p/swfobject/wiki/documentation
|
222
|
+
*/
|
223
|
+
|
224
|
+
embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, flashvarsObj, parObj, attObj, callbackFn) {
|
225
|
+
var callbackObj = {success:false, id:replaceElemIdStr};
|
226
|
+
if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) {
|
227
|
+
widthStr += ""; // auto-convert to string
|
228
|
+
heightStr += "";
|
229
|
+
var att = {};
|
230
|
+
if (attObj && typeof attObj === OBJECT) {
|
231
|
+
for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs
|
232
|
+
att[i] = attObj[i];
|
233
|
+
}
|
234
|
+
}
|
235
|
+
att.data = swfUrlStr;
|
236
|
+
att.width = widthStr;
|
237
|
+
att.height = heightStr;
|
238
|
+
var par = {};
|
239
|
+
if (parObj && typeof parObj === OBJECT) {
|
240
|
+
for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs
|
241
|
+
par[j] = parObj[j];
|
242
|
+
}
|
243
|
+
}
|
244
|
+
if (flashvarsObj && typeof flashvarsObj === OBJECT) {
|
245
|
+
for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs
|
246
|
+
if (typeof par.flashvars != UNDEF) {
|
247
|
+
par.flashvars += "&" + k + "=" + flashvarsObj[k];
|
248
|
+
}
|
249
|
+
else {
|
250
|
+
par.flashvars = k + "=" + flashvarsObj[k];
|
251
|
+
}
|
252
|
+
}
|
253
|
+
}
|
254
|
+
if (hasPlayerVersion(swfVersionStr)) { // create SWF
|
255
|
+
var obj = createSWF(att, par, replaceElemIdStr);
|
256
|
+
callbackObj.success = true;
|
257
|
+
callbackObj.ref = obj;
|
258
|
+
}
|
259
|
+
if (callbackFn) { callbackFn(callbackObj); }
|
260
|
+
}
|
261
|
+
else if (callbackFn) { callbackFn(callbackObj); }
|
262
|
+
},
|
263
|
+
|
264
|
+
ua: ua,
|
265
|
+
|
266
|
+
getFlashPlayerVersion: function() {
|
267
|
+
return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
|
268
|
+
},
|
269
|
+
|
270
|
+
hasFlashPlayerVersion: hasPlayerVersion,
|
271
|
+
|
272
|
+
createSWF: function(attObj, parObj, replaceElemIdStr) {
|
273
|
+
if (ua.w3) {
|
274
|
+
return createSWF(attObj, parObj, replaceElemIdStr);
|
275
|
+
}
|
276
|
+
else {
|
277
|
+
return undefined;
|
278
|
+
}
|
279
|
+
},
|
280
|
+
|
281
|
+
getQueryParamValue: function(param) {
|
282
|
+
var q = doc.location.search || doc.location.hash;
|
283
|
+
if (q) {
|
284
|
+
if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark
|
285
|
+
if (param == null) {
|
286
|
+
return urlEncodeIfNecessary(q);
|
287
|
+
}
|
288
|
+
var pairs = q.split("&");
|
289
|
+
for (var i = 0; i < pairs.length; i++) {
|
290
|
+
if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
|
291
|
+
return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)));
|
292
|
+
}
|
293
|
+
}
|
294
|
+
}
|
295
|
+
return "";
|
296
|
+
}
|
297
|
+
};
|
298
|
+
}();
|
@@ -0,0 +1,5 @@
|
|
1
|
+
/* Modernizr 2.6.2 (Custom Build) | MIT & BSD
|
2
|
+
* Build: http://modernizr.com/download/#-video-mq-cssclasses-teststyles-testprop-testallprops-prefixes-domprefixes-load
|
3
|
+
*/
|
4
|
+
;window.Modernizr=function(a,b,c){function A(a){j.cssText=a}function B(a,b){return A(m.join(a+";")+(b||""))}function C(a,b){return typeof a===b}function D(a,b){return!!~(""+a).indexOf(b)}function E(a,b){for(var d in a){var e=a[d];if(!D(e,"-")&&j[e]!==c)return b=="pfx"?e:!0}return!1}function F(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:C(f,"function")?f.bind(d||b):f}return!1}function G(a,b,c){var d=a.charAt(0).toUpperCase()+a.slice(1),e=(a+" "+o.join(d+" ")+d).split(" ");return C(b,"string")||C(b,"undefined")?E(e,b):(e=(a+" "+p.join(d+" ")+d).split(" "),F(e,b,c))}var d="2.6.2",e={},f=!0,g=b.documentElement,h="modernizr",i=b.createElement(h),j=i.style,k,l={}.toString,m=" -webkit- -moz- -o- -ms- ".split(" "),n="Webkit Moz O ms",o=n.split(" "),p=n.toLowerCase().split(" "),q={},r={},s={},t=[],u=t.slice,v,w=function(a,c,d,e){var f,i,j,k,l=b.createElement("div"),m=b.body,n=m||b.createElement("body");if(parseInt(d,10))while(d--)j=b.createElement("div"),j.id=e?e[d]:h+(d+1),l.appendChild(j);return f=["­",'<style id="s',h,'">',a,"</style>"].join(""),l.id=h,(m?l:n).innerHTML+=f,n.appendChild(l),m||(n.style.background="",n.style.overflow="hidden",k=g.style.overflow,g.style.overflow="hidden",g.appendChild(n)),i=c(l,a),m?l.parentNode.removeChild(l):(n.parentNode.removeChild(n),g.style.overflow=k),!!i},x=function(b){var c=a.matchMedia||a.msMatchMedia;if(c)return c(b).matches;var d;return w("@media "+b+" { #"+h+" { position: absolute; } }",function(b){d=(a.getComputedStyle?getComputedStyle(b,null):b.currentStyle)["position"]=="absolute"}),d},y={}.hasOwnProperty,z;!C(y,"undefined")&&!C(y.call,"undefined")?z=function(a,b){return y.call(a,b)}:z=function(a,b){return b in a&&C(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=u.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(u.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(u.call(arguments)))};return e}),q.video=function(){var a=b.createElement("video"),c=!1;try{if(c=!!a.canPlayType)c=new Boolean(c),c.ogg=a.canPlayType('video/ogg; codecs="theora"').replace(/^no$/,""),c.h264=a.canPlayType('video/mp4; codecs="avc1.42E01E"').replace(/^no$/,""),c.webm=a.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,"")}catch(d){}return c};for(var H in q)z(q,H)&&(v=H.toLowerCase(),e[v]=q[H](),t.push((e[v]?"":"no-")+v));return e.addTest=function(a,b){if(typeof a=="object")for(var d in a)z(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,typeof f!="undefined"&&f&&(g.className+=" "+(b?"":"no-")+a),e[a]=b}return e},A(""),i=k=null,e._version=d,e._prefixes=m,e._domPrefixes=p,e._cssomPrefixes=o,e.mq=x,e.testProp=function(a){return E([a])},e.testAllProps=G,e.testStyles=w,g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(f?" js "+t.join(" "):""),e}(this,this.document),function(a,b,c){function d(a){return"[object Function]"==o.call(a)}function e(a){return"string"==typeof a}function f(){}function g(a){return!a||"loaded"==a||"complete"==a||"uninitialized"==a}function h(){var a=p.shift();q=1,a?a.t?m(function(){("c"==a.t?B.injectCss:B.injectJs)(a.s,0,a.a,a.x,a.e,1)},0):(a(),h()):q=0}function i(a,c,d,e,f,i,j){function k(b){if(!o&&g(l.readyState)&&(u.r=o=1,!q&&h(),l.onload=l.onreadystatechange=null,b)){"img"!=a&&m(function(){t.removeChild(l)},50);for(var d in y[c])y[c].hasOwnProperty(d)&&y[c][d].onload()}}var j=j||B.errorTimeout,l=b.createElement(a),o=0,r=0,u={t:d,s:c,e:f,a:i,x:j};1===y[c]&&(r=1,y[c]=[]),"object"==a?l.data=c:(l.src=c,l.type=a),l.width=l.height="0",l.onerror=l.onload=l.onreadystatechange=function(){k.call(this,r)},p.splice(e,0,u),"img"!=a&&(r||2===y[c]?(t.insertBefore(l,s?null:n),m(k,j)):y[c].push(l))}function j(a,b,c,d,f){return q=0,b=b||"j",e(a)?i("c"==b?v:u,a,b,this.i++,c,d,f):(p.splice(this.i++,0,a),1==p.length&&h()),this}function k(){var a=B;return a.loader={load:j,i:0},a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=s?l:n.parentNode,l=a.opera&&"[object Opera]"==o.call(a.opera),l=!!b.attachEvent&&!l,u=r?"object":l?"script":"img",v=l?"script":u,w=Array.isArray||function(a){return"[object Array]"==o.call(a)},x=[],y={},z={timeout:function(a,b){return b.length&&(a.timeout=b[0]),a}},A,B;B=function(a){function b(a){var a=a.split("!"),b=x.length,c=a.pop(),d=a.length,c={url:c,origUrl:c,prefixes:a},e,f,g;for(f=0;f<d;f++)g=a[f].split("="),(e=z[g.shift()])&&(c=e(c,g));for(f=0;f<b;f++)c=x[f](c);return c}function g(a,e,f,g,h){var i=b(a),j=i.autoCallback;i.url.split(".").pop().split("?").shift(),i.bypass||(e&&(e=d(e)?e:e[a]||e[g]||e[a.split("/").pop().split("?")[0]]),i.instead?i.instead(a,e,f,g,h):(y[i.url]?i.noexec=!0:y[i.url]=1,f.load(i.url,i.forceCSS||!i.forceJS&&"css"==i.url.split(".").pop().split("?").shift()?"c":c,i.noexec,i.attrs,i.timeout),(d(e)||d(j))&&f.load(function(){k(),e&&e(i.origUrl,h,g),j&&j(i.origUrl,h,g),y[i.url]=2})))}function h(a,b){function c(a,c){if(a){if(e(a))c||(j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}),g(a,j,b,0,h);else if(Object(a)===a)for(n in m=function(){var b=0,c;for(c in a)a.hasOwnProperty(c)&&b++;return b}(),a)a.hasOwnProperty(n)&&(!c&&!--m&&(d(j)?j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}:j[n]=function(a){return function(){var b=[].slice.call(arguments);a&&a.apply(this,b),l()}}(k[n])),g(a[n],j,b,n,h))}else!c&&l()}var h=!!a.test,i=a.load||a.both,j=a.callback||f,k=j,l=a.complete||f,m,n;c(h?a.yep:a.nope,!!i),i&&c(i)}var i,j,l=this.yepnope.loader;if(e(a))g(a,0,l,0);else if(w(a))for(i=0;i<a.length;i++)j=a[i],e(j)?g(j,0,l,0):w(j)?B(j):Object(j)===j&&h(j,l);else Object(a)===a&&h(a,l)},B.addPrefix=function(a,b){z[a]=b},B.addFilter=function(a){x.push(a)},B.errorTimeout=1e4,null==b.readyState&&b.addEventListener&&(b.readyState="loading",b.addEventListener("DOMContentLoaded",A=function(){b.removeEventListener("DOMContentLoaded",A,0),b.readyState="complete"},0)),a.yepnope=k(),a.yepnope.executeStack=h,a.yepnope.injectJs=function(a,c,d,e,i,j){var k=b.createElement("script"),l,o,e=e||B.errorTimeout;k.src=a;for(o in d)k.setAttribute(o,d[o]);c=j?h:c||f,k.onreadystatechange=k.onload=function(){!l&&g(k.readyState)&&(l=1,c(),k.onload=k.onreadystatechange=null)},m(function(){l||(l=1,c(1))},e),i?k.onload():n.parentNode.insertBefore(k,n)},a.yepnope.injectCss=function(a,c,d,e,g,i){var e=b.createElement("link"),j,c=i?h:c||f;e.href=a,e.rel="stylesheet",e.type="text/css";for(j in d)e.setAttribute(j,d[j]);g||(n.parentNode.insertBefore(e,n),m(c,0))}}(this,document),Modernizr.load=function(){yepnope.apply(window,[].slice.call(arguments,0))};
|
5
|
+
|
@@ -0,0 +1,151 @@
|
|
1
|
+
function getNav() {
|
2
|
+
var mainNav = $('ul.main-navigation, ul[role=main-navigation]').before('<fieldset class="mobile-nav">')
|
3
|
+
var mobileNav = $('fieldset.mobile-nav').append('<select>');
|
4
|
+
mobileNav.find('select').append('<option value="">Navigate…</option>');
|
5
|
+
var addOption = function(i, option) {
|
6
|
+
mobileNav.find('select').append('<option value="' + this.href + '">» ' + $(this).text() + '</option>');
|
7
|
+
}
|
8
|
+
mainNav.find('a').each(addOption);
|
9
|
+
$('ul.subscription a').each(addOption);
|
10
|
+
mobileNav.find('select').bind('change', function(event) {
|
11
|
+
if (event.target.value) { window.location.href = event.target.value; }
|
12
|
+
});
|
13
|
+
}
|
14
|
+
|
15
|
+
function addSidebarToggler() {
|
16
|
+
if(!$('body').hasClass('sidebar-footer')) {
|
17
|
+
$('#content').append('<span class="toggle-sidebar"></span>');
|
18
|
+
$('.toggle-sidebar').bind('click', function(e) {
|
19
|
+
e.preventDefault();
|
20
|
+
$('body').toggleClass('collapse-sidebar');
|
21
|
+
});
|
22
|
+
}
|
23
|
+
var sections = $('aside.sidebar > section');
|
24
|
+
if (sections.length > 1) {
|
25
|
+
sections.each(function(index, section){
|
26
|
+
if ((sections.length >= 3) && index % 3 === 0) {
|
27
|
+
$(section).addClass("first");
|
28
|
+
}
|
29
|
+
var count = ((index +1) % 2) ? "odd" : "even";
|
30
|
+
$(section).addClass(count);
|
31
|
+
});
|
32
|
+
}
|
33
|
+
if (sections.length >= 3){ $('aside.sidebar').addClass('thirds'); }
|
34
|
+
}
|
35
|
+
|
36
|
+
function testFeatures() {
|
37
|
+
var features = ['maskImage'];
|
38
|
+
$(features).map(function(i, feature) {
|
39
|
+
if (Modernizr.testAllProps(feature)) {
|
40
|
+
$('html').addClass(feature);
|
41
|
+
} else {
|
42
|
+
$('html').addClass('no-'+feature);
|
43
|
+
}
|
44
|
+
});
|
45
|
+
if ("placeholder" in document.createElement("input")) {
|
46
|
+
$('html').addClass('placeholder');
|
47
|
+
} else {
|
48
|
+
$('html').addClass('no-placeholder');
|
49
|
+
}
|
50
|
+
}
|
51
|
+
|
52
|
+
function addCodeLineNumbers() {
|
53
|
+
if (navigator.appName === 'Microsoft Internet Explorer') { return; }
|
54
|
+
$('div.gist-highlight').each(function(code) {
|
55
|
+
var tableStart = '<table><tbody><tr><td class="gutter">',
|
56
|
+
lineNumbers = '<pre class="line-numbers">',
|
57
|
+
tableMiddle = '</pre></td><td class="code">',
|
58
|
+
tableEnd = '</td></tr></tbody></table>',
|
59
|
+
count = $('.line', code).length;
|
60
|
+
for (var i=1;i<=count; i++) {
|
61
|
+
lineNumbers += '<span class="line-number">'+i+'</span>\n';
|
62
|
+
}
|
63
|
+
var table = tableStart + lineNumbers + tableMiddle + '<pre>'+$('pre', code).html()+'</pre>' + tableEnd;
|
64
|
+
$(code).html(table);
|
65
|
+
});
|
66
|
+
}
|
67
|
+
|
68
|
+
function flashVideoFallback(){
|
69
|
+
var flashplayerlocation = "/assets/jwplayer/player.swf",
|
70
|
+
flashplayerskin = "/assets/jwplayer/glow/glow.xml";
|
71
|
+
$('video').each(function(i, video){
|
72
|
+
video = $(video);
|
73
|
+
if (!Modernizr.video.h264 && swfobject.getFlashPlayerVersion() || window.location.hash.indexOf("flash-test") !== -1){
|
74
|
+
video.children('source[src$=mp4]').first().map(i, function(source){
|
75
|
+
var src = $(source).attr('src'),
|
76
|
+
id = 'video_'+Math.round(1 + Math.random()*(100000)),
|
77
|
+
width = video.attr('width'),
|
78
|
+
height = parseInt(video.attr('height'), 10) + 30;
|
79
|
+
video.after('<div class="flash-video"><div><div id='+id+'>');
|
80
|
+
swfobject.embedSWF(flashplayerlocation, id, width, height + 30, "9.0.0",
|
81
|
+
{ file : src, image : video.attr('poster'), skin : flashplayerskin } ,
|
82
|
+
{ movie : src, wmode : "opaque", allowfullscreen : "true" }
|
83
|
+
);
|
84
|
+
});
|
85
|
+
video.remove();
|
86
|
+
}
|
87
|
+
});
|
88
|
+
}
|
89
|
+
|
90
|
+
function wrapFlashVideos() {
|
91
|
+
$('object').each(function(i, object) {
|
92
|
+
if( $(object).find('param[name=movie]').length ){
|
93
|
+
$(object).wrap('<div class="flash-video">')
|
94
|
+
}
|
95
|
+
});
|
96
|
+
$('iframe[src*=vimeo],iframe[src*=youtube]').wrap('<div class="flash-video">')
|
97
|
+
}
|
98
|
+
|
99
|
+
function renderDeliciousLinks(items) {
|
100
|
+
var output = "<ul>";
|
101
|
+
for (var i=0,l=items.length; i<l; i++) {
|
102
|
+
output += '<li><a href="' + items[i].u + '" title="Tags: ' + (items[i].t == "" ? "" : items[i].t.join(', ')) + '">' + items[i].d + '</a></li>';
|
103
|
+
}
|
104
|
+
output += "</ul>";
|
105
|
+
$('#delicious').html(output);
|
106
|
+
}
|
107
|
+
|
108
|
+
$('document').ready(function() {
|
109
|
+
testFeatures();
|
110
|
+
wrapFlashVideos();
|
111
|
+
flashVideoFallback();
|
112
|
+
addCodeLineNumbers();
|
113
|
+
getNav();
|
114
|
+
addSidebarToggler();
|
115
|
+
});
|
116
|
+
|
117
|
+
// iOS scaling bug fix
|
118
|
+
// Rewritten version
|
119
|
+
// By @mathias, @cheeaun and @jdalton
|
120
|
+
// Source url: https://gist.github.com/901295
|
121
|
+
(function(doc) {
|
122
|
+
var addEvent = 'addEventListener',
|
123
|
+
type = 'gesturestart',
|
124
|
+
qsa = 'querySelectorAll',
|
125
|
+
scales = [1, 1],
|
126
|
+
meta = qsa in doc ? doc[qsa]('meta[name=viewport]') : [];
|
127
|
+
function fix() {
|
128
|
+
meta.content = 'width=device-width,minimum-scale=' + scales[0] + ',maximum-scale=' + scales[1];
|
129
|
+
doc.removeEventListener(type, fix, true);
|
130
|
+
}
|
131
|
+
if ((meta = meta[meta.length - 1]) && addEvent in doc) {
|
132
|
+
fix();
|
133
|
+
scales = [0.25, 1.6];
|
134
|
+
doc[addEvent](type, fix, true);
|
135
|
+
}
|
136
|
+
}(document));
|
137
|
+
|
138
|
+
/*! SWFObject v2.2 modified by Brandon Mathis to contain only what is necessary to dynamically embed flash objects
|
139
|
+
* Uncompressed source in javascripts/libs/swfobject-dynamic.js
|
140
|
+
* <http://code.google.com/p/swfobject/>
|
141
|
+
released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
|
142
|
+
*/
|
143
|
+
var swfobject=function(){function s(a,b,d){var q,k=n(d);if(g.wk&&g.wk<312)return q;if(k){if(typeof a.id==l)a.id=d;if(g.ie&&g.win){var e="",c;for(c in a)if(a[c]!=Object.prototype[c])c.toLowerCase()=="data"?b.movie=a[c]:c.toLowerCase()=="styleclass"?e+=' class="'+a[c]+'"':c.toLowerCase()!="classid"&&(e+=" "+c+'="'+a[c]+'"');c="";for(var f in b)b[f]!=Object.prototype[f]&&(c+='<param name="'+f+'" value="'+b[f]+'" />');k.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+e+">"+c+
|
144
|
+
"</object>";q=n(a.id)}else{f=i.createElement(o);f.setAttribute("type",m);for(var h in a)a[h]!=Object.prototype[h]&&(h.toLowerCase()=="styleclass"?f.setAttribute("class",a[h]):h.toLowerCase()!="classid"&&f.setAttribute(h,a[h]));for(e in b)b[e]!=Object.prototype[e]&&e.toLowerCase()!="movie"&&(a=f,c=e,h=b[e],d=i.createElement("param"),d.setAttribute("name",c),d.setAttribute("value",h),a.appendChild(d));k.parentNode.replaceChild(f,k);q=f}}return q}function n(a){var b=null;try{b=i.getElementById(a)}catch(d){}return b}
|
145
|
+
function t(a){var b=g.pv,a=a.split(".");a[0]=parseInt(a[0],10);a[1]=parseInt(a[1],10)||0;a[2]=parseInt(a[2],10)||0;return b[0]>a[0]||b[0]==a[0]&&b[1]>a[1]||b[0]==a[0]&&b[1]==a[1]&&b[2]>=a[2]?!0:!1}function u(a){return/[\\\"<>\.;]/.exec(a)!=null&&typeof encodeURIComponent!=l?encodeURIComponent(a):a}var l="undefined",o="object",m="application/x-shockwave-flash",v=window,i=document,j=navigator,g=function(){var a=typeof i.getElementById!=l&&typeof i.getElementsByTagName!=l&&typeof i.createElement!=l,
|
146
|
+
b=j.userAgent.toLowerCase(),d=j.platform.toLowerCase(),g=d?/win/.test(d):/win/.test(b),d=d?/mac/.test(d):/mac/.test(b),b=/webkit/.test(b)?parseFloat(b.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):!1,k=!+"\u000b1",e=[0,0,0],c=null;if(typeof j.plugins!=l&&typeof j.plugins["Shockwave Flash"]==o){if((c=j.plugins["Shockwave Flash"].description)&&!(typeof j.mimeTypes!=l&&j.mimeTypes[m]&&!j.mimeTypes[m].enabledPlugin))k=!1,c=c.replace(/^.*\s+(\S+\s+\S+$)/,"$1"),e[0]=parseInt(c.replace(/^(.*)\..*$/,"$1"),
|
147
|
+
10),e[1]=parseInt(c.replace(/^.*\.(.*)\s.*$/,"$1"),10),e[2]=/[a-zA-Z]/.test(c)?parseInt(c.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}else if(typeof v.ActiveXObject!=l)try{var f=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");if(f&&(c=f.GetVariable("$version")))k=!0,c=c.split(" ")[1].split(","),e=[parseInt(c[0],10),parseInt(c[1],10),parseInt(c[2],10)]}catch(h){}return{w3:a,pv:e,wk:b,ie:k,win:g,mac:d}}();return{embedSWF:function(a,b,d,i,k,e,c,f,h){var j={success:!1,id:b};if(g.w3&&!(g.wk&&g.wk<312)&&
|
148
|
+
a&&b&&d&&i&&k){d+="";i+="";var p={};if(f&&typeof f===o)for(var m in f)p[m]=f[m];p.data=a;p.width=d;p.height=i;a={};if(c&&typeof c===o)for(var n in c)a[n]=c[n];if(e&&typeof e===o)for(var r in e)typeof a.flashvars!=l?a.flashvars+="&"+r+"="+e[r]:a.flashvars=r+"="+e[r];if(t(k))b=s(p,a,b),j.success=!0,j.ref=b}h&&h(j)},ua:g,getFlashPlayerVersion:function(){return{major:g.pv[0],minor:g.pv[1],release:g.pv[2]}},hasFlashPlayerVersion:t,createSWF:function(a,b,d){if(g.w3)return s(a,b,d)},getQueryParamValue:function(a){var b=
|
149
|
+
i.location.search||i.location.hash;if(b){/\?/.test(b)&&(b=b.split("?")[1]);if(a==null)return u(b);for(var b=b.split("&"),d=0;d<b.length;d++)if(b[d].substring(0,b[d].indexOf("="))==a)return u(b[d].substring(b[d].indexOf("=")+1))}return""}}}();
|
150
|
+
|
151
|
+
|
@@ -0,0 +1,56 @@
|
|
1
|
+
function pinboardNS_fetch_script(url) {
|
2
|
+
//document.writeln('<s'+'cript type="text/javascript" src="' + url + '"></s'+'cript>');
|
3
|
+
(function(){
|
4
|
+
var pinboardLinkroll = document.createElement('script');
|
5
|
+
pinboardLinkroll.type = 'text/javascript';
|
6
|
+
pinboardLinkroll.async = true;
|
7
|
+
pinboardLinkroll.src = url;
|
8
|
+
document.getElementsByTagName('head')[0].appendChild(pinboardLinkroll);
|
9
|
+
})();
|
10
|
+
}
|
11
|
+
|
12
|
+
function pinboardNS_show_bmarks(r) {
|
13
|
+
var lr = new Pinboard_Linkroll();
|
14
|
+
lr.set_items(r);
|
15
|
+
lr.show_bmarks();
|
16
|
+
}
|
17
|
+
|
18
|
+
function Pinboard_Linkroll() {
|
19
|
+
var items;
|
20
|
+
|
21
|
+
this.set_items = function(i) {
|
22
|
+
this.items = i;
|
23
|
+
}
|
24
|
+
this.show_bmarks = function() {
|
25
|
+
var lines = [];
|
26
|
+
for (var i = 0; i < this.items.length; i++) {
|
27
|
+
var item = this.items[i];
|
28
|
+
var str = this.format_item(item);
|
29
|
+
lines.push(str);
|
30
|
+
}
|
31
|
+
document.getElementById(linkroll).innerHTML = lines.join("\n");
|
32
|
+
}
|
33
|
+
this.cook = function(v) {
|
34
|
+
return v.replace('<', '<').replace('>', '>>');
|
35
|
+
}
|
36
|
+
|
37
|
+
this.format_item = function(it) {
|
38
|
+
var str = "<li class=\"pin-item\">";
|
39
|
+
if (!it.d) { return; }
|
40
|
+
str += "<p><a class=\"pin-title\" href=\"" + this.cook(it.u) + "\">" + this.cook(it.d) + "</a>";
|
41
|
+
if (it.n) {
|
42
|
+
str += "<span class=\"pin-description\">" + this.cook(it.n) + "</span>\n";
|
43
|
+
}
|
44
|
+
if (it.t.length > 0) {
|
45
|
+
for (var i = 0; i < it.t.length; i++) {
|
46
|
+
var tag = it.t[i];
|
47
|
+
str += " <a class=\"pin-tag\" href=\"https://pinboard.in/u:"+ this.cook(it.a) + "/t:" + this.cook(tag) + "\">" + this.cook(tag).replace(/^\s+|\s+$/g, '') + "</a> ";
|
48
|
+
}
|
49
|
+
}
|
50
|
+
str += "</p></li>\n";
|
51
|
+
return str;
|
52
|
+
}
|
53
|
+
}
|
54
|
+
Pinboard_Linkroll.prototype = new Pinboard_Linkroll();
|
55
|
+
pinboardNS_fetch_script("https://feeds.pinboard.in/json/v1/u:"+pinboard_user+"/?cb=pinboardNS_show_bmarks\&count="+pinboard_count);
|
56
|
+
|
@@ -0,0 +1,78 @@
|
|
1
|
+
// JSON-P Twitter fetcher for Octopress
|
2
|
+
// (c) Brandon Mathis // MIT License
|
3
|
+
|
4
|
+
/* Sky Slavin, Ludopoli. MIT license. * based on JavaScript Pretty Date * Copyright (c) 2008 John Resig (jquery.com) * Licensed under the MIT license. */
|
5
|
+
function prettyDate(time) {
|
6
|
+
if (navigator.appName === 'Microsoft Internet Explorer') {
|
7
|
+
return "<span>∞</span>"; // because IE date parsing isn't fun.
|
8
|
+
}
|
9
|
+
var say = {
|
10
|
+
just_now: " now",
|
11
|
+
minute_ago: "1m",
|
12
|
+
minutes_ago: "m",
|
13
|
+
hour_ago: "1h",
|
14
|
+
hours_ago: "h",
|
15
|
+
yesterday: "1d",
|
16
|
+
days_ago: "d",
|
17
|
+
last_week: "1w",
|
18
|
+
weeks_ago: "w"
|
19
|
+
};
|
20
|
+
|
21
|
+
var current_date = new Date(),
|
22
|
+
current_date_time = current_date.getTime(),
|
23
|
+
current_date_full = current_date_time + (1 * 60000),
|
24
|
+
date = new Date(time),
|
25
|
+
diff = ((current_date_full - date.getTime()) / 1000),
|
26
|
+
day_diff = Math.floor(diff / 86400);
|
27
|
+
|
28
|
+
if (isNaN(day_diff) || day_diff < 0) { return "<span>∞</span>"; }
|
29
|
+
|
30
|
+
return day_diff === 0 && (
|
31
|
+
diff < 60 && say.just_now ||
|
32
|
+
diff < 120 && say.minute_ago ||
|
33
|
+
diff < 3600 && Math.floor(diff / 60) + say.minutes_ago ||
|
34
|
+
diff < 7200 && say.hour_ago ||
|
35
|
+
diff < 86400 && Math.floor(diff / 3600) + say.hours_ago) ||
|
36
|
+
day_diff === 1 && say.yesterday ||
|
37
|
+
day_diff < 7 && day_diff + say.days_ago ||
|
38
|
+
day_diff === 7 && say.last_week ||
|
39
|
+
day_diff > 7 && Math.ceil(day_diff / 7) + say.weeks_ago;
|
40
|
+
}
|
41
|
+
|
42
|
+
function linkifyTweet(text, url) {
|
43
|
+
// Linkify urls, usernames, hashtags
|
44
|
+
text = text.replace(/(https?:\/\/)([\w\-:;?&=+.%#\/]+)/gi, '<a href="$1$2">$2</a>')
|
45
|
+
.replace(/(^|\W)@(\w+)/g, '$1<a href="https://twitter.com/$2">@$2</a>')
|
46
|
+
.replace(/(^|\W)#(\w+)/g, '$1<a href="https://search.twitter.com/search?q=%23$2">#$2</a>');
|
47
|
+
|
48
|
+
// Use twitter's api to replace t.co shortened urls with expanded ones.
|
49
|
+
for (var u in url) {
|
50
|
+
if(url[u].expanded_url != null){
|
51
|
+
var shortUrl = new RegExp(url[u].url, 'g');
|
52
|
+
text = text.replace(shortUrl, url[u].expanded_url);
|
53
|
+
var shortUrl = new RegExp(">"+(url[u].url.replace(/https?:\/\//, '')), 'g');
|
54
|
+
text = text.replace(shortUrl, ">"+url[u].display_url);
|
55
|
+
}
|
56
|
+
}
|
57
|
+
return text
|
58
|
+
}
|
59
|
+
|
60
|
+
function showTwitterFeed(tweets, twitter_user) {
|
61
|
+
var timeline = document.getElementById('tweets'),
|
62
|
+
content = '';
|
63
|
+
|
64
|
+
for (var t in tweets) {
|
65
|
+
content += '<li>'+'<p>'+'<a href="https://twitter.com/'+twitter_user+'/status/'+tweets[t].id_str+'">'+prettyDate(tweets[t].created_at)+'</a>'+linkifyTweet(tweets[t].text.replace(/\n/g, '<br>'), tweets[t].entities.urls)+'</p>'+'</li>';
|
66
|
+
}
|
67
|
+
timeline.innerHTML = content;
|
68
|
+
}
|
69
|
+
|
70
|
+
function getTwitterFeed(user, count, replies) {
|
71
|
+
count = parseInt(count, 10);
|
72
|
+
$.ajax({
|
73
|
+
url: "https://api.twitter.com/1/statuses/user_timeline/" + user + ".json?trim_user=true&count=" + (count + 20) + "&include_entities=1&exclude_replies=" + (replies ? "0" : "1") + "&callback=?"
|
74
|
+
, type: 'jsonp'
|
75
|
+
, error: function (err) { $('#tweets li.loading').addClass('error').text("Twitter's busted"); }
|
76
|
+
, success: function(data) { showTwitterFeed(data.slice(0, count), user); }
|
77
|
+
})
|
78
|
+
}
|