From ea349cdfbfa4d42110099e49a8ff23f7213cd5b6 Mon Sep 17 00:00:00 2001 From: Brandon Mathis Date: Wed, 29 Jun 2011 14:01:06 -0400 Subject: Moved themes to .themes to get it out of the way. Updated Rakefile to support .themes dir and remove duplication. Improved deploy task. Renamed init_deploy to cofig_deploy and rewrote it to update configurations in the Rakefile for easier deploy use --- .themes/classic/source/javascripts/ender.js | 2 + .themes/classic/source/javascripts/libs/ender.js | 1497 ++++++++++++++++++++ .themes/classic/source/javascripts/libs/jXHR.js | 85 ++ .../source/javascripts/libs/swfobject-dynamic.js | 298 ++++ .../classic/source/javascripts/modernizr-2.0.js | 5 + .themes/classic/source/javascripts/octopress.js | 143 ++ .themes/classic/source/javascripts/pinboard.js | 56 + .themes/classic/source/javascripts/twitter.js | 80 ++ 8 files changed, 2166 insertions(+) create mode 100644 .themes/classic/source/javascripts/ender.js create mode 100644 .themes/classic/source/javascripts/libs/ender.js create mode 100644 .themes/classic/source/javascripts/libs/jXHR.js create mode 100644 .themes/classic/source/javascripts/libs/swfobject-dynamic.js create mode 100644 .themes/classic/source/javascripts/modernizr-2.0.js create mode 100644 .themes/classic/source/javascripts/octopress.js create mode 100644 .themes/classic/source/javascripts/pinboard.js create mode 100644 .themes/classic/source/javascripts/twitter.js (limited to '.themes/classic/source/javascripts') diff --git a/.themes/classic/source/javascripts/ender.js b/.themes/classic/source/javascripts/ender.js new file mode 100644 index 00000000..9958885a --- /dev/null +++ b/.themes/classic/source/javascripts/ender.js @@ -0,0 +1,2 @@ +eval(function(p,a,c,k,e,d){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('!5(O){5 2j(o,42){F(u k Y 42){k!=\'28\'&&k!=\'4T\'&&(o[k]=42[k])}7 o}5 2P(s,r){u R;B(X.4E&&N s==\'1p\'||s.4R||s.E&&\'3g\'Y s||s==1O){R=X.4E(s,r);R.H=s}1h{R=5F(s.E)?s:[s]}7 2j(R,2P)}5 X(s,r){7 2P(s,r)}2j(X,{4T:\'0.2.0\',X:5(o,4Z){2j(4Z?2P:X,o)}});2j(2P,{6E:5(D,1Z){F(u i=0,l=8.E;i.+?<\\\\/"+t+">","g"));K(5Y,5(m){m=m.1g(/<(.+)>(.+?)<\\/\\1>/,\'$2\');u 4l=I.3e(t);4l.2m(I.7Y(m));6.2m(4l)})}1h{6.4j=G}u 4Q=6.4y;6=6.1C;R.13(6);1d(6=6.25){(6.1j==1)&&R.13(6)}7 R}():4k(G)?[G.66(19)]:[]};U.I=5(){u w=W.6s,h=W.6v,4s=8.63();7{1N:65.62(w,4s.1N),1I:65.62(h,4s.1I)}};U.1C=5(6){F(u c=6.4y,i=0,j=(c&&c.E)||0,e;i\\{\\}\\$\\*\\^\'"]*\\])/,5X=/([.*+?\\^=!:${}()|\\[\\]\\/\\\\])/g,4W=/^([a-6J-9]+)?(?:([\\.\\#]+[\\w\\-\\.#]+)?)/,3y=/\\[([\\w\\-]+)(?:([\\|\\^\\$\\*\\~]?\\=)[\'"]?([ \\w\\-\\/\\?\\&\\=\\:\\.\\(\\)\\!,@#%<>\\{\\}\\$\\*\\^]+)["\']?)?\\]/,6g=1a 1E(4W.6l+\'(\'+3y.6l+\')?\');5 1R(Q){r=[];F(i=0,3W=Q.E;i<3W;i++){r[i]=Q[i]}7 r}u 2o=5(){8.c={}};2o.2g={g:5(k){7 8.c[k]||1w},s:5(k,v){8.c[k]=v;7 v}};u 30=1a 2o(),4i=1a 2o(),1x=1a 2o(),3Q=1a 2o();5 q(2n){7 2n.1c(6g)}5 3H(6y,1n,2Z,4t,4n,60,1l){u m,c,k;B(1n&&8.3T.6f()!==1n){7 1i}B(2Z&&(m=2Z.1c(2i))&&m[1]!==8.2i){7 1i}B(2Z&&(3x=2Z.1c(6j))){F(i=3x.E;i--;){c=3x[i].3u(1);B(!(30.g(c)||30.s(c,1a 1E(\'(^|\\\\s+)\'+c+\'(\\\\s+|$)\'))).12(8.1q)){7 1i}}}B(4t&&!1l){o=8.6T;F(k Y o){B(6O.2g.1T.11(o,k)&&(o[k].73||k)==4n){7 8}}}B(4t&&!5W(60,8.1S(4n)||\'\',1l)){7 1i}7 8}5 64(1s){u r=[],4B=1s.81(),4G=q(4B),1n=4G[1]||\'*\',i,l,R,V=1s.E&&(m=1s[0].1c(4a))?I.47(m[1]):I;B(!V){7 r}R=V.3o(1n);F(i=0,l=R.E;i.+?<\\/" + t + ">", "g")); + each(bitches, function (m) { + m = m.replace(/<(.+)>(.+?)<\/\1>/, '$2'); + var bah = doc.createElement(t); + bah.appendChild(doc.createDocumentFragment(m)); + el.appendChild(bah); + }); + } else { + el.innerHTML = node; + } + var nodes = el.childNodes; + el = el.firstChild; + els.push(el); + while (el = el.nextSibling) { + (el.nodeType == 1) && els.push(el); + } + return els; + + }() : is(node) ? [node.cloneNode(true)] : []; + }; + + bonzo.doc = function () { + var w = html.scrollWidth, + h = html.scrollHeight, + vp = this.viewport(); + return { + width: Math.max(w, vp.width), + height: Math.max(h, vp.height) + }; + }; + + bonzo.firstChild = function (el) { + for (var c = el.childNodes, i = 0, j = (c && c.length) || 0, e; i < j; i++) { + if (c[i].nodeType === 1) { + e = c[j = i]; + } + } + return e; + }; + + bonzo.viewport = function () { + var h = self.innerHeight, + w = self.innerWidth; + ie && (h = html.clientHeight) && (w = html.clientWidth); + return { + width: w, + height: h + }; + }; + + bonzo.isAncestor = 'compareDocumentPosition' in html ? + function (container, element) { + return (container.compareDocumentPosition(element) & 16) == 16; + } : 'contains' in html ? + function (container, element) { + return container !== element && container.contains(element); + } : + function (container, element) { + while (element = element.parentNode) { + if (element === container) { + return true; + } + } + return false; + }; + + var old = context.bonzo; + bonzo.noConflict = function () { + context.bonzo = old; + return this; + }; + context['bonzo'] = bonzo; + +}(this);!function ($) { + + var b = bonzo; + b.setQueryEngine($); + $.ender(b); + $.ender(b(), true); + $.ender({ + create: function (node) { + return $(b.create(node)); + } + }); + + $.id = function (id) { + return $([document.getElementById(id)]); + }; + + function indexOf(ar, val) { + for (var i = 0; i < ar.length; i++) { + if (ar[i] === val) { + return i; + } + } + return -1; + } + + function uniq(ar) { + var a = [], i, j; + label: + for (i = 0; i < ar.length; i++) { + for (j = 0; j < a.length; j++) { + if (a[j] == ar[i]) { + continue label; + } + } + a[a.length] = ar[i]; + } + return a; + } + + $.ender({ + parents: function (selector, closest) { + var collection = $(selector), j, k, p, r = []; + for (j = 0, k = this.length; j < k; j++) { + p = this[j]; + while (p = p.parentNode) { + if (indexOf(collection, p) !== -1) { + r.push(p); + if (closest) break; + } + } + } + return $(uniq(r)); + }, + + closest: function (selector) { + return this.parents(selector, true); + }, + + first: function () { + return $(this[0]); + }, + + last: function () { + return $(this[this.length - 1]); + }, + + next: function () { + return $(b(this).next()); + }, + + previous: function () { + return $(b(this).previous()); + }, + + appendTo: function (t) { + return b(this.selector).appendTo(t, this); + }, + + prependTo: function (t) { + return b(this.selector).prependTo(t, this); + }, + + insertAfter: function (t) { + return b(this.selector).insertAfter(t, this); + }, + + insertBefore: function (t) { + return b(this.selector).insertBefore(t, this); + }, + + siblings: function () { + var i, l, p, r = []; + for (i = 0, l = this.length; i < l; i++) { + p = this[i]; + while (p = p.previousSibling) { + p.nodeType == 1 && r.push(p); + } + p = this[i]; + while (p = p.nextSibling) { + p.nodeType == 1 && r.push(p); + } + } + return $(r); + }, + + children: function () { + var el, r = []; + for (i = 0, l = this.length; i < l; i++) { + if (!(el = b.firstChild(this[i]))) { + continue; + } + r.push(el); + while (el = el.nextSibling) { + el.nodeType == 1 && r.push(el); + } + } + return $(uniq(r)); + }, + + height: function (v) { + return v ? this.css('height', v) : parseInt(this.css('height'), 10); + }, + + width: function (v) { + return v ? this.css('width', v) : parseInt(this.css('width'), 10); + } + }, true); + +}(ender || $); + +!function () { var exports = {}, module = { exports: exports }; !function (doc) { + var loaded = 0, fns = [], ol, f = false, + testEl = doc.createElement('a'), + domContentLoaded = 'DOMContentLoaded', + addEventListener = 'addEventListener', + onreadystatechange = 'onreadystatechange'; + + /^loade|c/.test(doc.readyState) && (loaded = 1); + + function flush() { + loaded = 1; + for (var i = 0, l = fns.length; i < l; i++) { + fns[i](); + } + } + doc[addEventListener] && doc[addEventListener](domContentLoaded, function fn() { + doc.removeEventListener(domContentLoaded, fn, f); + flush(); + }, f); + + + testEl.doScroll && doc.attachEvent(onreadystatechange, (ol = function ol() { + if (/^c/.test(doc.readyState)) { + doc.detachEvent(onreadystatechange, ol); + flush(); + } + })); + + var domReady = testEl.doScroll ? + function (fn) { + self != top ? + !loaded ? + fns.push(fn) : + fn() : + !function () { + try { + testEl.doScroll('left'); + } catch (e) { + return setTimeout(function() { + domReady(fn); + }, 50); + } + fn(); + }(); + } : + function (fn) { + loaded ? fn() : fns.push(fn); + }; + + (typeof module !== 'undefined') && module.exports ? + (module.exports = {domReady: domReady}) : + (window.domReady = domReady); + +}(document); $.ender(module.exports); }.call($); +/*! + * qwery.js - copyright @dedfat + * https://github.com/ded/qwery + * Follow our software http://twitter.com/dedfat + * MIT License + */ + +!function (context, doc) { + + var c, i, j, k, l, m, o, p, r, v, + el, node, len, found, classes, item, items, token, + id = /#([\w\-]+)/, + clas = /\.[\w\-]+/g, + idOnly = /^#([\w\-]+$)/, + classOnly = /^\.([\w\-]+)$/, + tagOnly = /^([\w\-]+)$/, + tagAndOrClass = /^([\w]+)?\.([\w\-]+)$/, + html = doc.documentElement, + tokenizr = /\s(?![\s\w\-\/\?\&\=\:\.\(\)\!,@#%<>\{\}\$\*\^'"]*\])/, + specialChars = /([.*+?\^=!:${}()|\[\]\/\\])/g, + simple = /^([a-z0-9]+)?(?:([\.\#]+[\w\-\.#]+)?)/, + attr = /\[([\w\-]+)(?:([\|\^\$\*\~]?\=)['"]?([ \w\-\/\?\&\=\:\.\(\)\!,@#%<>\{\}\$\*\^]+)["']?)?\]/, + chunker = new RegExp(simple.source + '(' + attr.source + ')?'); + + function array(ar) { + r = []; + for (i = 0, len = ar.length; i < len; i++) { + r[i] = ar[i]; + } + return r; + } + + var cache = function () { + this.c = {}; + }; + cache.prototype = { + g: function (k) { + return this.c[k] || undefined; + }, + s: function (k, v) { + this.c[k] = v; + return v; + } + }; + + var classCache = new cache(), + cleanCache = new cache(), + attrCache = new cache(), + tokenCache = new cache(); + + function q(query) { + return query.match(chunker); + } + + function interpret(whole, tag, idsAndClasses, wholeAttribute, attribute, qualifier, value) { + var m, c, k; + if (tag && this.tagName.toLowerCase() !== tag) { + return false; + } + if (idsAndClasses && (m = idsAndClasses.match(id)) && m[1] !== this.id) { + return false; + } + if (idsAndClasses && (classes = idsAndClasses.match(clas))) { + for (i = classes.length; i--;) { + c = classes[i].slice(1); + if (!(classCache.g(c) || classCache.s(c, new RegExp('(^|\\s+)' + c + '(\\s+|$)'))).test(this.className)) { + return false; + } + } + } + if (wholeAttribute && !value) { + o = this.attributes; + for (k in o) { + if (Object.prototype.hasOwnProperty.call(o, k) && (o[k].name || k) == attribute) { + return this; + } + } + } + if (wholeAttribute && !checkAttr(qualifier, this.getAttribute(attribute) || '', value)) { + return false; + } + return this; + } + + function loopAll(tokens) { + var r = [], token = tokens.pop(), intr = q(token), tag = intr[1] || '*', i, l, els, + root = tokens.length && (m = tokens[0].match(idOnly)) ? doc.getElementById(m[1]) : doc; + if (!root) { + return r; + } + els = root.getElementsByTagName(tag); + for (i = 0, l = els.length; i < l; i++) { + el = els[i]; + if (item = interpret.apply(el, intr)) { + r.push(item); + } + } + return r; + } + + function clean(s) { + return cleanCache.g(s) || cleanCache.s(s, s.replace(specialChars, '\\$1')); + } + + function checkAttr(qualify, actual, val) { + switch (qualify) { + case '=': + return actual == val; + case '^=': + return actual.match(attrCache.g('^=' + val) || attrCache.s('^=' + val, new RegExp('^' + clean(val)))); + case '$=': + return actual.match(attrCache.g('$=' + val) || attrCache.s('$=' + val, new RegExp(clean(val) + '$'))); + case '*=': + return actual.match(attrCache.g(val) || attrCache.s(val, new RegExp(clean(val)))); + case '~=': + return actual.match(attrCache.g('~=' + val) || attrCache.s('~=' + val, new RegExp('(?:^|\\s+)' + clean(val) + '(?:\\s+|$)'))); + case '|=': + return actual.match(attrCache.g('|=' + val) || attrCache.s('|=' + val, new RegExp('^' + clean(val) + '(-|$)'))); + } + return false; + } + + function _qwery(selector) { + var r = [], ret = [], i, l, + tokens = tokenCache.g(selector) || tokenCache.s(selector, selector.split(tokenizr)); + tokens = tokens.slice(0); + if (!tokens.length) { + return r; + } + r = loopAll(tokens); + if (!tokens.length) { + return r; + } + // loop through all descendent tokens + for (j = 0, l = r.length, k = 0; j < l; j++) { + node = r[j]; + p = node; + // loop through each token + for (i = tokens.length; i--;) { + z: // loop through parent nodes + while (p !== html && (p = p.parentNode)) { + if (found = interpret.apply(p, q(tokens[i]))) { + break z; + } + } + } + found && (ret[k++] = node); + } + return ret; + } + + function boilerPlate(selector, _root, fn) { + var root = (typeof _root == 'string') ? fn(_root)[0] : (_root || doc); + if (selector === window || isNode(selector)) { + return !_root || (selector !== window && isNode(root) && isAncestor(selector, root)) ? [selector] : []; + } + if (selector && typeof selector === 'object' && isFinite(selector.length)) { + return array(selector); + } + if (m = selector.match(idOnly)) { + return (el = doc.getElementById(m[1])) ? [el] : []; + } + if (m = selector.match(tagOnly)) { + return array(root.getElementsByTagName(m[1])); + } + return false; + } + + function isNode(el) { + return (el && el.nodeType && (el.nodeType == 1 || el.nodeType == 9)); + } + + function uniq(ar) { + var a = [], i, j; + label: + for (i = 0; i < ar.length; i++) { + for (j = 0; j < a.length; j++) { + if (a[j] == ar[i]) { + continue label; + } + } + a[a.length] = ar[i]; + } + return a; + } + + function qwery(selector, _root) { + var root = (typeof _root == 'string') ? qwery(_root)[0] : (_root || doc); + if (!root || !selector) { + return []; + } + if (m = boilerPlate(selector, _root, qwery)) { + return m; + } + return select(selector, root); + } + + var isAncestor = 'compareDocumentPosition' in html ? + function (element, container) { + return (container.compareDocumentPosition(element) & 16) == 16; + } : 'contains' in html ? + function (element, container) { + container = container == doc || container == window ? html : container; + return container !== element && container.contains(element); + } : + function (element, container) { + while (element = element.parentNode) { + if (element === container) { + return 1; + } + } + return 0; + }, + + select = (doc.querySelector && doc.querySelectorAll) ? + function (selector, root) { + if (doc.getElementsByClassName && (m = selector.match(classOnly))) { + return array((root).getElementsByClassName(m[1])); + } + return array((root).querySelectorAll(selector)); + } : + function (selector, root) { + var result = [], collection, collections = [], i; + if (m = selector.match(tagAndOrClass)) { + items = root.getElementsByTagName(m[1] || '*'); + r = classCache.g(m[2]) || classCache.s(m[2], new RegExp('(^|\\s+)' + m[2] + '(\\s+|$)')); + for (i = 0, l = items.length, j = 0; i < l; i++) { + r.test(items[i].className) && (result[j++] = items[i]); + } + return result; + } + for (i = 0, items = selector.split(','), l = items.length; i < l; i++) { + collections[i] = _qwery(items[i]); + } + for (i = 0, l = collections.length; i < l && (collection = collections[i]); i++) { + var ret = collection; + if (root !== doc) { + ret = []; + for (j = 0, m = collection.length; j < m && (element = collection[j]); j++) { + // make sure element is a descendent of root + isAncestor(element, root) && ret.push(element); + } + } + result = result.concat(ret); + } + return uniq(result); + }; + + qwery.uniq = uniq; + var oldQwery = context.qwery; + qwery.noConflict = function () { + context.qwery = oldQwery; + return this; + }; + context['qwery'] = qwery; + +}(this, document);!function (doc) { + var q = qwery.noConflict(); + function create(node, root) { + var el = (root || doc).createElement('div'), els = []; + el.innerHTML = node; + var nodes = el.childNodes; + el = el.firstChild; + els.push(el); + while (el = el.nextSibling) { + (el.nodeType == 1) && els.push(el); + } + return els; + }; + $._select = function (s, r) { + return /^\s* + is released under the MIT License +*/ + +var swfobject = function() { + + var UNDEF = "undefined", + OBJECT = "object", + SHOCKWAVE_FLASH = "Shockwave Flash", + SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash", + FLASH_MIME_TYPE = "application/x-shockwave-flash", + EXPRESS_INSTALL_ID = "SWFObjectExprInst", + + win = window, + doc = document, + nav = navigator, + + plugin = false, + regObjArr = [], + objIdArr = [], + storedAltContent, + storedAltContentId, + storedCallbackFn, + storedCallbackObj, + autoHideShow = true, + + /* Centralized function for browser feature detection + - User agent string detection is only used when no good alternative is possible + - Is executed directly for optimal performance + */ + ua = function() { + var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF, + u = nav.userAgent.toLowerCase(), + p = nav.platform.toLowerCase(), + windows = p ? /win/.test(p) : /win/.test(u), + mac = p ? /mac/.test(p) : /mac/.test(u), + webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit + 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 + playerVersion = [0,0,0], + d = null; + if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) { + d = nav.plugins[SHOCKWAVE_FLASH].description; + 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+ + plugin = true; + ie = false; // cascaded feature detection for Internet Explorer + d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1"); + playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10); + playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10); + playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0; + } + } + else if (typeof win.ActiveXObject != UNDEF) { + try { + var a = new ActiveXObject(SHOCKWAVE_FLASH_AX); + if (a) { // a will return null when ActiveX is disabled + d = a.GetVariable("$version"); + if (d) { + ie = true; // cascaded feature detection for Internet Explorer + d = d.split(" ")[1].split(","); + playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)]; + } + } + } + catch(e) {} + } + return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac }; + }() + + + /* Main function + - Will preferably execute onDomLoad, otherwise onload (as a fallback) + */ + function main() { + if (plugin) { testPlayerVersion(); } + else { matchVersions(); } + } + + /* Detect the Flash Player version for non-Internet Explorer browsers + - Detecting the plug-in version via the object element is more precise than using the plugins collection item's description: + a. Both release and build numbers can be detected + b. Avoid wrong descriptions by corrupt installers provided by Adobe + c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports + - Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available + */ + function testPlayerVersion() { + var b = doc.getElementsByTagName("body")[0]; + var o = createElement(OBJECT); + o.setAttribute("type", FLASH_MIME_TYPE); + var t = b.appendChild(o); + if (t) { + var counter = 0; + (function(){ + if (typeof t.GetVariable != UNDEF) { + var d = t.GetVariable("$version"); + if (d) { + d = d.split(" ")[1].split(","); + ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)]; + } + } + else if (counter < 10) { + counter++; + setTimeout(arguments.callee, 10); + return; + } + b.removeChild(o); + t = null; + matchVersions(); + })(); + } + else { + matchVersions(); + } + } + + + /* Cross-browser dynamic SWF creation + */ + function createSWF(attObj, parObj, id) { + var r, el = getElementById(id); + if (ua.wk && ua.wk < 312) { return r; } + if (el) { + if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content + attObj.id = id; + } + if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML + var att = ""; + for (var i in attObj) { + if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries + if (i.toLowerCase() == "data") { + parObj.movie = attObj[i]; + } + else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword + att += ' class="' + attObj[i] + '"'; + } + else if (i.toLowerCase() != "classid") { + att += ' ' + i + '="' + attObj[i] + '"'; + } + } + } + var par = ""; + for (var j in parObj) { + if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries + par += ''; + } + } + el.outerHTML = '' + par + ''; + objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only) + r = getElementById(attObj.id); + } + else { // well-behaving browsers + var o = createElement(OBJECT); + o.setAttribute("type", FLASH_MIME_TYPE); + for (var m in attObj) { + if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries + if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword + o.setAttribute("class", attObj[m]); + } + else if (m.toLowerCase() != "classid") { // filter out IE specific attribute + o.setAttribute(m, attObj[m]); + } + } + } + for (var n in parObj) { + if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element + createObjParam(o, n, parObj[n]); + } + } + el.parentNode.replaceChild(o, el); + r = o; + } + } + return r; + } + + function createObjParam(el, pName, pValue) { + var p = createElement("param"); + p.setAttribute("name", pName); + p.setAttribute("value", pValue); + el.appendChild(p); + } + + /* Cross-browser SWF removal + - Especially needed to safely and completely remove a SWF in Internet Explorer + */ + /* Functions to optimize JavaScript compression + */ + function getElementById(id) { + var el = null; + try { + el = doc.getElementById(id); + } + catch (e) {} + return el; + } + + function createElement(el) { + return doc.createElement(el); + } + + /* Flash Player and SWF content version matching + */ + function hasPlayerVersion(rv) { + var pv = ua.pv, v = rv.split("."); + v[0] = parseInt(v[0], 10); + v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0" + v[2] = parseInt(v[2], 10) || 0; + 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; + } + + + /* Filter to avoid XSS attacks + */ + function urlEncodeIfNecessary(s) { + var regex = /[\\\"<>\.;]/; + var hasBadChars = regex.exec(s) != null; + return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s; + } + + return { + /* Public API + - Reference: http://code.google.com/p/swfobject/wiki/documentation + */ + + embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, flashvarsObj, parObj, attObj, callbackFn) { + var callbackObj = {success:false, id:replaceElemIdStr}; + if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) { + widthStr += ""; // auto-convert to string + heightStr += ""; + var att = {}; + if (attObj && typeof attObj === OBJECT) { + for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs + att[i] = attObj[i]; + } + } + att.data = swfUrlStr; + att.width = widthStr; + att.height = heightStr; + var par = {}; + if (parObj && typeof parObj === OBJECT) { + for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs + par[j] = parObj[j]; + } + } + if (flashvarsObj && typeof flashvarsObj === OBJECT) { + for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs + if (typeof par.flashvars != UNDEF) { + par.flashvars += "&" + k + "=" + flashvarsObj[k]; + } + else { + par.flashvars = k + "=" + flashvarsObj[k]; + } + } + } + if (hasPlayerVersion(swfVersionStr)) { // create SWF + var obj = createSWF(att, par, replaceElemIdStr); + callbackObj.success = true; + callbackObj.ref = obj; + } + if (callbackFn) { callbackFn(callbackObj); } + } + else if (callbackFn) { callbackFn(callbackObj); } + }, + + ua: ua, + + getFlashPlayerVersion: function() { + return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] }; + }, + + hasFlashPlayerVersion: hasPlayerVersion, + + createSWF: function(attObj, parObj, replaceElemIdStr) { + if (ua.w3) { + return createSWF(attObj, parObj, replaceElemIdStr); + } + else { + return undefined; + } + }, + + getQueryParamValue: function(param) { + var q = doc.location.search || doc.location.hash; + if (q) { + if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark + if (param == null) { + return urlEncodeIfNecessary(q); + } + var pairs = q.split("&"); + for (var i = 0; i < pairs.length; i++) { + if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) { + return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1))); + } + } + } + return ""; + } + }; +}(); diff --git a/.themes/classic/source/javascripts/modernizr-2.0.js b/.themes/classic/source/javascripts/modernizr-2.0.js new file mode 100644 index 00000000..b9846c4b --- /dev/null +++ b/.themes/classic/source/javascripts/modernizr-2.0.js @@ -0,0 +1,5 @@ +/* Modernizr 2.0.4 (Custom Build) | MIT & BSD + * Contains: video | iepp | respond | mq | cssclasses | teststyles | testprop | testallprops | prefixes | domprefixes | load + * Build URL: http://j.mp/m1H1Y1 + */ +;window.Modernizr=function(a,b,c){function D(a,b){var c=a.charAt(0).toUpperCase()+a.substr(1),d=(a+" "+o.join(c+" ")+c).split(" ");return C(d,b)}function C(a,b){for(var d in a)if(k[a[d]]!==c)return b=="pfx"?a[d]:!0;return!1}function B(a,b){return!!~(""+a).indexOf(b)}function A(a,b){return typeof a===b}function z(a,b){return y(n.join(a+";")+(b||""))}function y(a){k.cssText=a}var d="2.0.4",e={},f=!0,g=b.documentElement,h=b.head||b.getElementsByTagName("head")[0],i="modernizr",j=b.createElement(i),k=j.style,l,m=Object.prototype.toString,n=" -webkit- -moz- -o- -ms- -khtml- ".split(" "),o="Webkit Moz O ms Khtml".split(" "),p={},q={},r={},s=[],t=function(a,c,d,e){var f,h,j,k=b.createElement("div");if(parseInt(d,10))while(d--)j=b.createElement("div"),j.id=e?e[d]:i+(d+1),k.appendChild(j);f=["­",""].join(""),k.id=i,k.innerHTML+=f,g.appendChild(k),h=c(k,a),k.parentNode.removeChild(k);return!!h},u=function(b){if(a.matchMedia)return matchMedia(b).matches;var c;t("@media "+b+" { #"+i+" { position: absolute; } }",function(b){c=(a.getComputedStyle?getComputedStyle(b,null):b.currentStyle).position=="absolute"});return c},v,w={}.hasOwnProperty,x;!A(w,c)&&!A(w.call,c)?x=function(a,b){return w.call(a,b)}:x=function(a,b){return b in a&&A(a.constructor.prototype[b],c)},p.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"');var d='video/mp4; codecs="avc1.42E01E';c.h264=a.canPlayType(d+'"')||a.canPlayType(d+', mp4a.40.2"'),c.webm=a.canPlayType('video/webm; codecs="vp8, vorbis"')}}catch(e){}return c};for(var E in p)x(p,E)&&(v=E.toLowerCase(),e[v]=p[E](),s.push((e[v]?"":"no-")+v));y(""),j=l=null,a.attachEvent&&function(){var a=b.createElement("div");a.innerHTML="";return a.childNodes.length!==1}()&&function(a,b){function s(a){var b=-1;while(++b=u.minw)&&(!u.maxw||u.maxw&&l<=u.maxw))m[u.media]||(m[u.media]=[]),m[u.media].push(f[u.rules])}for(var t in g)g[t]&&g[t].parentNode===j&&j.removeChild(g[t]);for(var t in m){var v=c.createElement("style"),w=m[t].join("\n");v.type="text/css",v.media=t,v.styleSheet?v.styleSheet.cssText=w:v.appendChild(c.createTextNode(w)),n.appendChild(v),g.push(v)}j.insertBefore(n,o.nextSibling)}},s=function(a,b){var c=t();if(!!c){c.open("GET",a,!0),c.onreadystatechange=function(){c.readyState==4&&(c.status==200||c.status==304)&&b(c.responseText)};if(c.readyState==4)return;c.send()}},t=function(){var a=!1,b=[function(){return new ActiveXObject("Microsoft.XMLHTTP")},function(){return new XMLHttpRequest}],c=b.length;while(c--){try{a=b[c]()}catch(d){continue}break}return function(){return a}}();m(),respond.update=m,a.addEventListener?a.addEventListener("resize",u,!1):a.attachEvent&&a.attachEvent("onresize",u)}}(this,Modernizr.mq("only all")),function(a,b,c){function k(a){return!a||a=="loaded"||a=="complete"}function j(){var a=1,b=-1;while(p.length- ++b)if(p[b].s&&!(a=p[b].r))break;a&&g()}function i(a){var c=b.createElement("script"),d;c.src=a.s,c.onreadystatechange=c.onload=function(){!d&&k(c.readyState)&&(d=1,j(),c.onload=c.onreadystatechange=null)},m(function(){d||(d=1,j())},H.errorTimeout),a.e?c.onload():n.parentNode.insertBefore(c,n)}function h(a){var c=b.createElement("link"),d;c.href=a.s,c.rel="stylesheet",c.type="text/css",!a.e&&(w||r)?function a(b){m(function(){if(!d)try{b.sheet.cssRules.length?(d=1,j()):a(b)}catch(c){c.code==1e3||c.message=="security"||c.message=="denied"?(d=1,m(function(){j()},0)):a(b)}},0)}(c):(c.onload=function(){d||(d=1,m(function(){j()},0))},a.e&&c.onload()),m(function(){d||(d=1,j())},H.errorTimeout),!a.e&&n.parentNode.insertBefore(c,n)}function g(){var a=p.shift();q=1,a?a.t?m(function(){a.t=="c"?h(a):i(a)},0):(a(),j()):q=0}function f(a,c,d,e,f,h){function i(){!o&&k(l.readyState)&&(r.r=o=1,!q&&j(),l.onload=l.onreadystatechange=null,m(function(){u.removeChild(l)},0))}var l=b.createElement(a),o=0,r={t:d,s:c,e:h};l.src=l.data=c,!s&&(l.style.display="none"),l.width=l.height="0",a!="object"&&(l.type=d),l.onload=l.onreadystatechange=i,a=="img"?l.onerror=i:a=="script"&&(l.onerror=function(){r.e=r.r=1,g()}),p.splice(e,0,r),u.insertBefore(l,s?null:n),m(function(){o||(u.removeChild(l),r.r=r.e=o=1,j())},H.errorTimeout)}function e(a,b,c){var d=b=="c"?z:y;q=0,b=b||"j",C(a)?f(d,a,b,this.i++,l,c):(p.splice(this.i++,0,a),p.length==1&&g());return this}function d(){var a=H;a.loader={load:e,i:0};return 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=r&&!s,u=s?l:n.parentNode,v=a.opera&&o.call(a.opera)=="[object Opera]",w="webkitAppearance"in l.style,x=w&&"async"in b.createElement("script"),y=r?"object":v||x?"img":"script",z=w?"img":y,A=Array.isArray||function(a){return o.call(a)=="[object Array]"},B=function(a){return typeof a=="object"},C=function(a){return typeof a=="string"},D=function(a){return o.call(a)=="[object Function]"},E=[],F={},G,H;H=function(a){function f(a){var b=a.split("!"),c=E.length,d=b.pop(),e=b.length,f={url:d,origUrl:d,prefixes:b},g,h;for(h=0;h nav fieldset[role=site-search]').after('
').next().append(''); + mobileNav.children('select').append(''); + $($('body > nav ul[role=main-nav] a')).each(function(link) { + mobileNav.children('select').append('') + }); + mobileNav.children('select').bind('change', function(event){ + if (event.target.value) window.location.href = event.target.value; + }); +} +function addSidebarToggler() { + $('#articles').before('»').previous().bind('click', function(e){ + e.preventDefault(); + if($('body').hasClass('collapse-sidebar')){ + $('body').removeClass('collapse-sidebar'); + e.target.innerHTML = '»'; + } else { + $('body').addClass('collapse-sidebar'); + e.target.innerHTML = '«'; + } + }); +} +function testFeatures() { + var features = ['maskImage']; + $(features).map(function(feature){ + if (Modernizr.testAllProps(feature)) { + $('html').addClass(feature); + } else { + $('html').addClass('no-'+feature); + } + }); + if ("placeholder" in document.createElement("input")) { + $('html').addClass('placeholder'); + } else { + $('html').addClass('no-placeholder'); + } +} + +function addCodeLineNumbers(){ + if (navigator.appName == 'Microsoft Internet Explorer') { return } + $('div.highlight pre code').each(function(el){ addDivLines(el); }); + $('div.highlight, div.gist-highlight').each(function(code){ + var tableStart = '
'; + var lineNumbers = '
';
+    var tableMiddle = '
'; + var tableEnd = '
'; + var count = $('div.line', code).length; + for (i=1;i<=count; i++){ + lineNumbers += ''+i+'\n'; + } + table = tableStart + lineNumbers + tableMiddle + '
'+$('pre', code).html()+'
' + tableEnd; + $(code).html(table); + }); +} +function addDivLines(el){ + var content = $(el).html(); + var lines = content.replace(/\s*$/g, '').split(/\n/); + var count = lines.length; + $(lines).each(function(line, index){ + if(line == '') line = ' '; + lines[index] = '
' + line + '
'; + }); + $(el).html(lines.join('')); +} + +function flashVideoFallback(){ + var flashplayerlocation = "/assets/jwplayer/player.swf", + flashplayerskin = "/assets/jwplayer/glow/glow.xml"; + $('video').each(function(video){ + video = $(video); + if(!Modernizr.video.h264 && swfobject.getFlashPlayerVersion() || window.location.hash.indexOf("flash-test") != -1){ + video.children('source[src$=mp4]').first().map(function(source){; + var src = $(source).attr('src'), + id = 'video_'+Math.round(1 + Math.random()*(100000)), + width = video.attr('width'), + height = parseInt(video.attr('height')) + 30; + video.after('
'); + swfobject.embedSWF(flashplayerlocation, id, width, height + 30, "9.0.0", + { file : src, image : video.attr('poster'), skin : flashplayerskin } , + { movie : src, wmode : "opaque", allowfullscreen : "true" }); + }); + video.remove(); + } + }); +} + +function wrapFlashVideos(){ + $('object').each(function(object){ + object = $(object); + if(object.children('param[name=movie]')){ + var wrapper = object.before('
').previous(); + $(wrapper).children().append(object); + } + }); + $('iframe[src*=vimeo],iframe[src*=youtube]').each(function(iframe){ + iframe = $(iframe); + var wrapper = iframe.before('
').previous(); + $(wrapper).children().append(iframe); + }); +} + +$.domReady(function(){ + testFeatures(); + wrapFlashVideos(); + flashVideoFallback(); + addCodeLineNumbers(); + getNav(); + addSidebarToggler(); +}); + +// iOS scaling bug fix +// Rewritten version +// By @mathias, @cheeaun and @jdalton +// Source url: https://gist.github.com/901295 +(function(doc) { + var addEvent = 'addEventListener', + type = 'gesturestart', + qsa = 'querySelectorAll', + scales = [1, 1], + meta = qsa in doc ? doc[qsa]('meta[name=viewport]') : []; + function fix() { + meta.content = 'width=device-width,minimum-scale=' + scales[0] + ',maximum-scale=' + scales[1]; + doc.removeEventListener(type, fix, true); + } + if ((meta = meta[meta.length - 1]) && addEvent in doc) { + fix(); + scales = [.25, 1.6]; + doc[addEvent](type, fix, true); + } +}(document)); + +/*! SWFObject v2.2 modified by Brandon Mathis to contain only what is necessary to dynamically embed flash objects + * Uncompressed source in javascripts/libs/swfobject-dynamic.js + * + released under the MIT License +*/ +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+='');k.outerHTML='"+c+ +"";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} +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, +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"), +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)&& +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= +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'); + (function(){ + var pinboardLinkroll = document.createElement('script'); + pinboardLinkroll.type = 'text/javascript'; + pinboardLinkroll.async = true; + pinboardLinkroll.src = url; + document.getElementsByTagName('head')[0].appendChild(pinboardLinkroll); + })(); +} + +function pinboardNS_show_bmarks(r) { + var lr = new Pinboard_Linkroll(); + lr.set_items(r); + lr.show_bmarks(); +} + +function Pinboard_Linkroll() { + var items; + + this.set_items = function(i) { + this.items = i; + } + this.show_bmarks = function() { + var lines = []; + for (var i = 0; i < this.items.length; i++) { + var item = this.items[i]; + var str = this.format_item(item); + lines.push(str); + } + document.getElementById(linkroll).innerHTML = lines.join("\n"); + } + this.cook = function(v) { + return v.replace('<', '<').replace('>', '>>'); + } + + this.format_item = function(it) { + var str = "
  • "; + if (!it.d) { return; } + str += "

    " + this.cook(it.d) + ""; + if (it.n) { + str += "" + this.cook(it.n) + "\n"; + } + if (it.t.length > 0) { + for (var i = 0; i < it.t.length; i++) { + var tag = it.t[i]; + str += " " + this.cook(tag).replace(/^\s+|\s+$/g, '') + " "; + } + } + str += "

  • \n"; + return str; + } +} +Pinboard_Linkroll.prototype = new Pinboard_Linkroll(); +pinboardNS_fetch_script("http://feeds.pinboard.in/json/v1/u:"+pinboard_user+"/?cb=pinboardNS_show_bmarks\&count="+pinboard_count); + diff --git a/.themes/classic/source/javascripts/twitter.js b/.themes/classic/source/javascripts/twitter.js new file mode 100644 index 00000000..676619e1 --- /dev/null +++ b/.themes/classic/source/javascripts/twitter.js @@ -0,0 +1,80 @@ +// JSON-P Twitter fetcher for Octopress +// (c) Brandon Mathis // MIT Lisence +function getTwitterFeed(user, count, replies) { + feed = new jXHR(); + feed.onerror = function (msg,url) { + $('#tweets li.loading').addClass('error').text("Twitter's busted"); + } + feed.onreadystatechange = function(data){ + if (feed.readyState === 4) { + var tweets = new Array(); + for (i in data){ + if(tweets.length < count){ + if(replies || data[i].in_reply_to_user_id == null){ + tweets.push(data[i]); + } + } + } + showTwitterFeed(tweets, user); + } + }; + feed.open("GET","http://twitter.com/statuses/user_timeline/"+user+".json?trim_user=true&count="+(parseInt(count)+60)+"&callback=?"); + feed.send(); +} + +function showTwitterFeed(tweets, twitter_user){ + var timeline = document.getElementById('tweets'); + timeline.innerHTML=''; + for (t in tweets){ + timeline.innerHTML+='
  • '+'

    '+''+prettyDate(tweets[t].created_at)+''+linkifyTweet(tweets[t].text.replace(/\n/g, '
    '))+'

    '+'
  • '; + } +} +function linkifyTweet(text){ + return text.replace(/(https?:\/\/)([\w\-:;?&=+.%#\/]+)/gi, '$2') + .replace(/(^|\W)@(\w+)/g, '$1@$2') + .replace(/(^|\W)#(\w+)/g, '$1#$2'); +} + + + +// jXHR.js (JSON-P XHR) | v0.1 (c) Kyle Simpson | MIT License | http://mulletxhr.com/ +// uncompressed version available in source/javascripts/libs/jXHR.js +(function(c){var b=c.setTimeout,d=c.document,a=0;c.jXHR=function(){var e,g,n,h,m=null;function l(){try{h.parentNode.removeChild(h)}catch(o){}}function k(){g=false;e="";l();h=null;i(0)}function f(p){try{m.onerror.call(m,p,e)}catch(o){throw new Error(p)}}function j(){if((this.readyState&&this.readyState!=="complete"&&this.readyState!=="loaded")||g){return}this.onload=this.onreadystatechange=null;g=true;if(m.readyState!==4){f("Script failed to load ["+e+"].")}l()}function i(o,p){p=p||[];m.readyState=o;if(typeof m.onreadystatechange==="function"){m.onreadystatechange.apply(m,p)}}m={onerror:null,onreadystatechange:null,readyState:0,open:function(p,o){k();internal_callback="cb"+(a++);(function(q){c.jXHR[q]=function(){try{i.call(m,4,arguments)}catch(r){m.readyState=-1;f("Script failed to run ["+e+"].")}c.jXHR[q]=null}})(internal_callback);e=o.replace(/=\?/,"=jXHR."+internal_callback);i(1)},send:function(){b(function(){h=d.createElement("script");h.setAttribute("type","text/javascript");h.onload=h.onreadystatechange=function(){j.call(h)};h.setAttribute("src",e);d.getElementsByTagName("head")[0].appendChild(h)},0);i(2)},setRequestHeader:function(){},getResponseHeader:function(){return""},getAllResponseHeaders:function(){return[]}};k();return m}})(window); + + +/* Sky Slavin, Ludopoli. MIT license. * based on JavaScript Pretty Date * Copyright (c) 2008 John Resig (jquery.com) * Licensed under the MIT license. */ + +function prettyDate(time) { + if (navigator.appName == 'Microsoft Internet Explorer') { + return ""; // because IE date parsing isn't fun. + }; + + var say = {}; + say.just_now = " now", + say.minute_ago = "1m", + say.minutes_ago = "m", + say.hour_ago = "1h", + say.hours_ago = "h", + say.yesterday = "1d", + say.days_ago = "d", + say.weeks_ago = "w" + + var current_date = new Date(); + current_date_time = current_date.getTime(); + current_date_full = current_date_time + (1 * 60000); + var date = new Date(time); + var diff = ((current_date_full - date.getTime()) / 1000); + var day_diff = Math.floor(diff / 86400); + + if (isNaN(day_diff) || day_diff < 0 || day_diff >= 31) return; + + return day_diff == 0 && ( + diff < 60 && say.just_now || + diff < 120 && say.minute_ago || + diff < 3600 && Math.floor(diff / 60) + say.minutes_ago || + diff < 7200 && say.hour_ago || + diff < 86400 && Math.floor(diff / 3600) + say.hours_ago) || + day_diff == 1 && say.yesterday || + day_diff < 7 && day_diff + say.days_ago || + day_diff < 31 && Math.ceil(day_diff / 7) + say.weeks_ago; +} -- cgit v1.2.1