dolt 0.23.0 → 0.24.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. data/.gitignore +2 -0
  2. data/.travis.yml +0 -1
  3. data/Gemfile +4 -0
  4. data/Gemfile.lock +13 -1
  5. data/Rakefile +10 -0
  6. data/dolt.gemspec +1 -1
  7. data/test/test_helper.rb +5 -0
  8. data/vendor/ui/.gitmodules +9 -0
  9. data/vendor/ui/Makefile +46 -0
  10. data/vendor/ui/buster.js +8 -3
  11. data/vendor/ui/css/gitorious.css +26 -1
  12. data/vendor/ui/dist/gitorious3-capillary.min.js +12 -0
  13. data/vendor/ui/dist/gitorious3.min.css +1 -1
  14. data/vendor/ui/dist/gitorious3.min.js +3 -3
  15. data/vendor/ui/js/src/cache.js +27 -0
  16. data/vendor/ui/js/src/capillary.js +7 -0
  17. data/vendor/ui/js/src/components/blob.js +1 -1
  18. data/vendor/ui/js/src/components/capillary.js +51 -0
  19. data/vendor/ui/js/src/components/clone-name-suggestion.js +38 -0
  20. data/vendor/ui/js/src/components/clone-url-selection.js +25 -15
  21. data/vendor/ui/js/src/components/collapse.js +17 -0
  22. data/vendor/ui/js/src/components/comments.js +111 -0
  23. data/vendor/ui/js/src/components/dropdown.js +4 -2
  24. data/vendor/ui/js/src/components/loading.js +33 -0
  25. data/vendor/ui/js/src/components/oid-ref-interpolator.js +9 -0
  26. data/vendor/ui/js/src/components/profile-menu.js +2 -0
  27. data/vendor/ui/js/src/components/rails-links.js +24 -0
  28. data/vendor/ui/js/src/components/ref-selector.js +3 -1
  29. data/vendor/ui/js/src/components/repository.js +161 -0
  30. data/vendor/ui/js/src/components/timeago.js +38 -0
  31. data/vendor/ui/js/src/components/url.js +1 -1
  32. data/vendor/ui/js/src/gitorious.js +75 -7
  33. data/vendor/ui/js/src/json-request.js +6 -0
  34. data/vendor/ui/js/src/spacer.js +5 -0
  35. data/vendor/ui/js/test/cache-test.js +47 -0
  36. data/vendor/ui/js/test/components/blob-test.js +4 -4
  37. data/vendor/ui/js/test/components/clone-name-suggestion-test.js +37 -0
  38. data/vendor/ui/js/test/components/clone-url-selection-test.js +10 -10
  39. data/vendor/ui/js/test/components/comments-test.js +139 -0
  40. data/vendor/ui/js/test/components/repository-admin-test.js +35 -0
  41. data/vendor/ui/js/test/components/repository-watching-test.js +74 -0
  42. data/vendor/ui/js/test/components/timeago-test.js +74 -0
  43. data/vendor/ui/js/test/test-helper.js +2 -0
  44. metadata +25 -3
  45. data/vendor/ui/build +0 -51
@@ -1,3 +1,3 @@
1
- var cull=function(e){"use strict";function r(e){return!!e&&typeof e=="object"&&typeof e.length=="number"&&!e.tagName}function i(e){return n.call(e)==="[object Array]"?e:n.call(e)==="[object Arguments]"?t.call(e):typeof e=="undefined"||e===null?[]:t.call(arguments)}function s(e,t){var n,r;for(n=0,r=t.length;n<r;++n)e(t[n],n,t);return t}function o(e){return typeof e=="function"}function u(e,t,n){var r=0,i,s=n,o=t;arguments.length===2&&(s=t,o=s[0],r=1),typeof s=="string"&&(s=s.split(""));for(i=s.length;r<i;++r)o=e(o,s[r]);return o}function a(e,t){var n,r;for(n=0,r=t.length;n<r;++n)if(!e(t[n]))return!1;return!0}function f(e,t){var n,r;for(n=0,r=t.length;n<r;++n)if(e(t[n]))return!0;return!1}function l(e,t){var n,r,i,s;for(n=0,r=t.length;n<r;++n){e(t[n])?i=!0:s=!0;if(i&&s)return!0}return!1}function c(e){return e.trim&&e.trim()||e.replace(/^\s+|\s+$/,"")}function h(e){return e}function p(e){return typeof e!="undefined"&&e!==null}function d(e){return function(t){return e.call(this,t)}}function v(e){return function(t){return t[e]}}function m(e,t){return function(n){return n[e].apply(n,i(t))}}function g(e){return function(t){return e===t}}function b(e,t){var n=i(e);return function(){var e=n.length,r=arguments;while(e--)r=[n[e].apply(t||this,r)];return r[0]}}function w(){var e=arguments;return function(t){return t.apply(this,e)}}function E(e){var n=t.call(arguments,1);return function(){return e.apply(this,n.concat(t.call(arguments)))}}function S(e,n){var r=typeof n=="string"?e[n]:n,i=t.call(arguments,2);return function(){return r.apply(e,i.concat(t.call(arguments)))}}function x(e){var t=[],n,i;for(n=0,i=e.length;n<i;n++)t=t.concat(r(e[n])?x(e[n]):e[n]);return t}function T(e,t){var n,r;for(n=0,r=t.length;n<r;++n)if(e===t[n])return n;return-1}function N(e){var t=[],n,r;for(n=0,r=e.length;n<r;++n)T(e[n],t)<0&&t.push(e[n]);return t}function C(e,t){var n,r;for(n=0,r=t.length;n<r;++n)if(e(t[n]))return t[n]}function k(e,t){var n=[],r,i;for(r=0,i=t.length;r<i;++r)e(t[r])&&n.push(t[r]);return n}function L(e,t){return k(function(e){return T(e,t)<0},e)}function A(e){var t,n=[];for(t in e)e.hasOwnProperty(t)&&n.push(t);return n}function O(e){var t,n=[];for(t in e)e.hasOwnProperty(t)&&n.push(e[t]);return n}function _(e,t){var n=[],r,i;for(r=0,i=t.length;r<i;r++)n.push(e(t[r]));return n}function D(e){return function(){return!e.apply(this,arguments)}}function P(e,t){return k(D(e),t)}function H(e,t){return i(e).concat(i(t))}function B(e,t){var n=[],r,i;for(r=0,i=t.length;r<i;r+=e)n.push(t.slice(r,r+e));return n}function j(e,t){return M(_(e,M(t)))}function F(e,t){return u(H,_(e,t))}function I(e,t){var n=[],r,i;for(r=0,i=t.length;r<i;r+=1)n.push(t[r]),r<i-1&&n.push(e);return n}function q(e,n,r){var i=e[n];e[n]=function(){var e=i.apply(this,arguments),n=r.apply(this,[e].concat(t.call(arguments)));return typeof n!="undefined"?n:e}}function R(e,t,n){var r=e[t];e[t]=function(){return n.apply(this,arguments),r.apply(this,arguments)}}function U(e,t,n){var r=E(n,e[t]);e[t]=function(){return r.apply(this,arguments)}}var t=Array.prototype.slice,n=Object.prototype.toString,y="compose takes func|[funcs] and optional thisp object",M=E(k,p);return{trim:c,doall:s,reduce:u,all:a,some:f,onlySome:l,isFunction:o,isList:r,toList:i,identity:h,defined:p,unary:d,prop:v,func:m,eq:g,compose:b,callWith:w,partial:E,bind:S,keys:A,values:O,concat:H,flatten:x,uniq:N,first:C,select:k,negate:D,reject:P,seldef:M,map:_,mapdef:j,mapcat:F,partition:B,difference:L,interpose:I,indexOf:T,after:q,before:R,around:U}}(this);typeof require=="function"&&typeof module!="undefined"&&(module.exports=cull);var dome=function(e){function t(n){if(e.isList(n))return e.flatten(e.map(t,n));var r=[],i=n.firstChild;while(i)i.nodeType===1&&r.push(i),i=i.nextSibling;return r}function n(e){return document.getElementById(e)}function r(e,t){var n=t||document;if(n.getElementsByClassName)return n.getElementsByClassName(e);var r=n.getElementsByTagName("*"),i,s,o=[],u=new RegExp("(^|\\s)"+e+"(\\s|$)");for(i=0,s=r.length;i<s;++i)u.test(r[i].className)&&o.push(r[i]);return o}function i(e){e.parentNode.removeChild(e)}function s(e,t){var n=new RegExp("(^|\\s)"+e+"(\\s|$)");return n.test(t.className)}function o(t,n){if(e.isList(n))return e.doall(e.partial(o,t),n);if(s(t,n))return;n.className=e.trim(n.className+" "+t)}function u(t,n){if(e.isList(n))return e.doall(e.partial(u,t),n);if(!s(t,n))return;var r=new RegExp("\\b"+t+"\\b","g");n.className=e.trim(n.className.replace(r,""))}function a(e){var t=e.nodeType;if(t===1||t===9||t===11){if(typeof e.textContent=="string")return e.textContent;var n="";for(e=e.firstChild;e;e=e.nextSibling)n+=a(e);return n}return t===3||t===4?e.nodeValue:""}function f(t){var n=document.createDocumentFragment();return e.doall(e.bind(n,"appendChild"),e.toList(t)),n}function c(e){return e?(typeof e._dome_uuid!="number"&&(e._dome_uuid=l++),e._dome_uuid):null}function p(e,t){if(!t||!e)return!1;var n=c(e);h[n]||(h[n]={});if(h[n][c(t)])return!0;var r=[];while(t&&t!==e)r.push(c(t)),t=t.parentNode;var i=!!t;for(var s=0,o=r.length;s<o;s++)h[n][r[s]]=i;return i}function m(e,t){var n;e=e||{};for(n in e)e.hasOwnProperty(n)&&(t.setAttribute("data-"+n,e[n]),t["data-"+n]=e[n])}function g(e,t){return t.getAttribute("data-"+e)}function b(e,t){var n,r;e=e||{};for(n in e)e.hasOwnProperty(n)&&(r=y[n],r?r(t,e[n]):t[n]=e[n])}function w(t,n){t=e.toList(t);var r,i;for(r=0,i=t.length;r<i;++r)typeof t[r]=="string"?n.appendChild(document.createTextNode(t[r])):n.appendChild(t[r])}function E(e,t){t.innerHTML="",w(e,t)}var l=0,h={},d,v=function(t){return t!==null&&typeof t!="undefined"&&(typeof t.nodeType!="undefined"||typeof t=="string"||e.isList(t))},y={style:function(e,t){var n;for(n in t)t.hasOwnProperty(n)&&(e.style[n]=t[n])},data:function(e,t){m(t,e)}};return d=function(e,t,n){if(!n&&v(t))return d(e,{},t);var r=document.createElement(e);return b(t,r),w(n||[],r),r},d.toString=function(){return"dome.el()"},e.doall(function(t){d[t]=e.partial(d,t)},["a","br","div","fieldset","form","h2","h3","h4","h5","img","input","label","li","p","span","strong","textarea","ul","span","select","option","ol","iframe","table","tr","td","pre","button","i"]),{propmap:y,el:d,setProp:b,append:w,setContent:E,children:t,id:n,byClass:r,remove:i,frag:f,text:a,data:{get:g,set:m},cn:{has:s,add:o,rm:u},uuid:c,contains:p}}(this.cull);(function(e,t){function n(e,t){return/^(?:function|object|unknown)$/.test(typeof e[t])}function a(e,t){return function(n){t.call(i[e],n||window.event)}}function f(e,t){return{handler:t,wrappedHandler:a(e,t)}}function c(e,t,n,r){s(t,n,function(t){e(t.target,n,t)&&r.call(t.target,t)})}var r=function(){if(typeof document.documentElement.uniqueID!="undefined")return function(e){return e.uniqueID};var e=0;return function(t){return t.__uniqueID||(t.__uniqueID="uniqueID__"+e,e+=1),t.__uniqueID}}(),i={},s,o,u=document.documentElement;if(n(u,"addEventListener")&&n(u,"removeEventListener")&&n(window,"addEventListener")&&n(window,"removeEventListener"))s=function(e,t,n){return e.addEventListener(t,n,!1),{cancel:function(){o(e,t,n)}}},o=function(e,t,n){e.removeEventListener(t,n,!1)};else if(n(u,"attachEvent")&&n(u,"detachEvent")&&n(window,"attachEvent")&&n("detachEvent")){var l={};s=function(e,t,n){var s=r(e);i[s]=e,l[s]||(l[s]={}),l[s][t]||(l[s][t]=[]);var u=f(s,n);return l[s][t].push(u),e.attachEvent("on"+t,u.wrappedHandler),{cancel:function(){o(e,t,n)}}},o=function(t,n,i){var s=r(t);if(!l[s]||!l[s][n])return;l[s][n]=e.select(function(e){if(e.handler!==i)return!0;t.detachEvent("on"+n,e.wrappedHandler)},l[s][n])}}c.bycn=function(n,r,i,s){c(e.partial(t.cn.has,n),r,i,s)},dome.events={mouseenter:function(e,t){var n=null,r=s(e,"mouseover",function(r){n!==e&&(t.call(e,r),n=e)}),i=s(e,"mouseout",function(t){var r=t.relatedTarget||t.toElement;try{r&&!r.nodeName&&(r=r.parentNode)}catch(t){return}e!==r&&!dome.contains(e,r)&&(n=null)});return{cancel:function(){r.cancel(),i.cancel()}}},mouseleave:function(e,t){return s(e,"mouseout",function(n){!dome.contains(e,n.relatedTarget)&&e!==n.relatedTarget&&t.call(e,n)})}},dome.on=function(e,t,n){return dome.events[t]?dome.events[t](e,n):s(e,t,n)},dome.off=o,dome.delegate=c,dome.propmap.events=function(t,n){e.doall(function(e){s(t,e,n[e])},e.keys(n))}})(cull,dome),!function(e,t,n){function o(e,n){var r=t.createElement(e||"div"),i;for(i in n)r[i]=n[i];return r}function u(e){for(var t=1,n=arguments.length;t<n;t++)e.appendChild(arguments[t]);return e}function f(e,t,n,r){var o=["opacity",t,~~(e*100),n,r].join("-"),u=.01+n/r*100,f=Math.max(1-(1-e)/t*(100-u),e),l=s.substring(0,s.indexOf("Animation")).toLowerCase(),c=l&&"-"+l+"-"||"";return i[o]||(a.insertRule("@"+c+"keyframes "+o+"{"+"0%{opacity:"+f+"}"+u+"%{opacity:"+e+"}"+(u+.01)+"%{opacity:1}"+(u+t)%100+"%{opacity:"+e+"}"+"100%{opacity:"+f+"}"+"}",a.cssRules.length),i[o]=1),o}function l(e,t){var i=e.style,s,o;if(i[t]!==n)return t;t=t.charAt(0).toUpperCase()+t.slice(1);for(o=0;o<r.length;o++){s=r[o]+t;if(i[s]!==n)return s}}function c(e,t){for(var n in t)e.style[l(e,n)||n]=t[n];return e}function h(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var i in r)e[i]===n&&(e[i]=r[i])}return e}function p(e){var t={x:e.offsetLeft,y:e.offsetTop};while(e=e.offsetParent)t.x+=e.offsetLeft,t.y+=e.offsetTop;return t}function v(e){if(!this.spin)return new v(e);this.opts=h(e||{},v.defaults,d)}var r=["webkit","Moz","ms","O"],i={},s,a=function(){var e=o("style",{type:"text/css"});return u(t.getElementsByTagName("head")[0],e),e.sheet||e.styleSheet}(),d={lines:12,length:7,width:5,radius:10,rotate:0,corners:1,color:"#000",speed:1,trail:100,opacity:.25,fps:20,zIndex:2e9,className:"spinner",top:"auto",left:"auto",position:"relative"};v.defaults={},h(v.prototype,{spin:function(e){this.stop();var t=this,n=t.opts,r=t.el=c(o(0,{className:n.className}),{position:n.position,width:0,zIndex:n.zIndex}),i=n.radius+n.length+n.width,u,a;e&&(e.insertBefore(r,e.firstChild||null),a=p(e),u=p(r),c(r,{left:(n.left=="auto"?a.x-u.x+(e.offsetWidth>>1):parseInt(n.left,10)+i)+"px",top:(n.top=="auto"?a.y-u.y+(e.offsetHeight>>1):parseInt(n.top,10)+i)+"px"})),r.setAttribute("aria-role","progressbar"),t.lines(r,t.opts);if(!s){var f=0,l=n.fps,h=l/n.speed,d=(1-n.opacity)/(h*n.trail/100),v=h/n.lines;(function m(){f++;for(var e=n.lines;e;e--){var i=Math.max(1-(f+e*v)%h*d,n.opacity);t.opacity(r,n.lines-e,i,n)}t.timeout=t.el&&setTimeout(m,~~(1e3/l))})()}return t},stop:function(){var e=this.el;return e&&(clearTimeout(this.timeout),e.parentNode&&e.parentNode.removeChild(e),this.el=n),this},lines:function(e,t){function i(e,r){return c(o(),{position:"absolute",width:t.length+t.width+"px",height:t.width+"px",background:e,boxShadow:r,transformOrigin:"left",transform:"rotate("+~~(360/t.lines*n+t.rotate)+"deg) translate("+t.radius+"px"+",0)",borderRadius:(t.corners*t.width>>1)+"px"})}var n=0,r;for(;n<t.lines;n++)r=c(o(),{position:"absolute",top:1+~(t.width/2)+"px",transform:t.hwaccel?"translate3d(0,0,0)":"",opacity:t.opacity,animation:s&&f(t.opacity,t.trail,n,t.lines)+" "+1/t.speed+"s linear infinite"}),t.shadow&&u(r,c(i("#000","0 0 4px #000"),{top:"2px"})),u(e,u(r,i(t.color,"0 0 1px rgba(0,0,0,.1)")));return e},opacity:function(e,t,n){t<e.childNodes.length&&(e.childNodes[t].style.opacity=n)}}),function(){function e(e,t){return o("<"+e+' xmlns="urn:schemas-microsoft.com:vml" class="spin-vml">',t)}var t=c(o("group"),{behavior:"url(#default#VML)"});!l(t,"transform")&&t.adj?(a.addRule(".spin-vml","behavior:url(#default#VML)"),v.prototype.lines=function(t,n){function s(){return c(e("group",{coordsize:i+" "+i,coordorigin:-r+" "+ -r}),{width:i,height:i})}function l(t,i,o){u(a,u(c(s(),{rotation:360/n.lines*t+"deg",left:~~i}),u(c(e("roundrect",{arcsize:n.corners}),{width:r,height:n.width,left:n.radius,top:-n.width>>1,filter:o}),e("fill",{color:n.color,opacity:n.opacity}),e("stroke",{opacity:0}))))}var r=n.length+n.width,i=2*r,o=-(n.width+n.length)*2+"px",a=c(s(),{position:"absolute",top:o,left:o}),f;if(n.shadow)for(f=1;f<=n.lines;f++)l(f,-2,"progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)");for(f=1;f<=n.lines;f++)l(f);return u(t,a)},v.prototype.opacity=function(e,t,n,r){var i=e.firstChild;r=r.shadow&&r.lines||0,i&&t+r<i.childNodes.length&&(i=i.childNodes[t+r],i=i&&i.firstChild,i=i&&i.firstChild,i&&(i.opacity=n))}):s=l(t,"animation")}(),typeof define=="function"&&define.amd?define(function(){return v}):e.Spinner=v}(window,document),function(e){"use strict";e(function(){function r(e,t,n,r){return i(e).then(t,n,r)}function i(e){var t,n;return e instanceof o?t=e:l(e)?(n=f(),e.then(function(e){n.resolve(e)},function(e){n.reject(e)},function(e){n.progress(e)}),t=n.promise):t=u(e),t}function s(e){return r(e,a)}function o(e){this.then=e}function u(e){var t=new o(function(t){try{return i(typeof t=="function"?t(e):e)}catch(n){return a(n)}});return t}function a(e){var t=new o(function(t,n){try{return i(typeof n=="function"?n(e):a(e))}catch(r){return a(r)}});return t}function f(){function h(e,t,n){return u(e,t,n)}function p(e){return c(i(e))}function d(e){return c(a(e))}function v(e){return l(e)}var e,t,r,s,u,l,c;return t=new o(h),e={then:h,resolve:p,reject:d,progress:v,promise:t,resolver:{resolve:p,reject:d,progress:v}},r=[],s=[],u=function(e,t,n){var i,o;return i=f(),o=typeof n=="function"?function(e){try{i.progress(n(e))}catch(t){i.progress(t)}}:function(e){i.progress(e)},r.push(function(n){n.then(e,t).then(i.resolve,i.reject,o)}),s.push(o),i.promise},l=function(e){return y(s,e),e},c=function(e){return u=e.then,c=i,l=E,y(r,e),s=r=n,e},e}function l(e){return e&&typeof e.then=="function"}function c(e,t,n,i,s){return b(2,arguments),r(e,function(e){function g(e){p(e)}function y(e){h(e)}var o,u,a,l,c,h,p,d,v,m;v=e.length>>>0,o=Math.max(0,Math.min(t,v)),a=[],u=v-o+1,l=[],c=f();if(!o)c.resolve(a);else{d=c.progress,p=function(e){l.push(e),--u||(h=p=w,c.reject(l))},h=function(e){a.push(e),--o||(h=p=w,c.resolve(a))};for(m=0;m<v;++m)m in e&&r(e[m],y,g,d)}return c.promise.then(n,i,s)})}function h(e,t,n,r){function i(e){return t?t(e[0]):e[0]}return c(e,1,i,n,r)}function p(e,t,n,r){return b(1,arguments),v(e,E).then(t,n,r)}function d(){return v(arguments,E)}function v(e,t){return r(e,function(e){var n,i,s,o,u,a;s=i=e.length>>>0,n=[],a=f();if(!s)a.resolve(n);else{o=function(i,o){r(i,t).then(function(e){n[o]=e,--s||a.resolve(n)},a.reject)};for(u=0;u<i;u++)u in e?o(e[u],u):--s}return a.promise})}function m(n,i){var s=t.call(arguments,1);return r(n,function(t){var n;return n=t.length,s[0]=function(e,t,s){return r(e,function(e){return r(t,function(t){return i(e,t,s,n)})})},e.apply(t,s)})}function g(e,t,n){var i=arguments.length>2;return r(e,function(e){return e=i?n:e,t.resolve(e),e},function(e){return t.reject(e),a(e)},t.progress)}function y(e,t){var n,r=0;while(n=e[r++])n(t)}function b(e,t){var n,r=t.length;while(r>e){n=t[--r];if(n!=null&&typeof n!="function")throw new Error("arg "+r+" must be a function")}}function w(){}function E(e){return e}var e,t,n;return r.defer=f,r.resolve=i,r.reject=s,r.join=d,r.all=p,r.map=v,r.reduce=m,r.any=h,r.some=c,r.chain=g,r.isPromise=l,o.prototype={always:function(e,t){return this.then(e,e,t)},otherwise:function(e){return this.then(n,e)},yield:function(e){return this.then(function(){return e})},spread:function(e){return this.then(function(t){return p(t,function(t){return e.apply(n,t)})})}},t=[].slice,e=[].reduce||function(e){var t,n,r,i,s;s=0,t=Object(this),i=t.length>>>0,n=arguments;if(n.length<=1)for(;;){if(s in t){r=t[s++];break}if(++s>=i)throw new TypeError}else r=n[1];for(;s<i;++s)s in t&&(r=e(r,t[s],s,t));return r},r})}(typeof define=="function"&&define.amd?define:function(e){typeof exports=="object"?module.exports=e():this.when=e()}),(typeof define=="function"&&define.amd&&function(e){define(e)}||typeof module=="object"&&function(e){module.exports=e()}||function(e){this.bane=e()})(function(){"use strict";function t(e,t,n){var r,i=n.length;if(i>0){for(r=0;r<i;++r)n[r](e,t);return}setTimeout(function(){throw t.message=e+" listener threw error: "+t.message,t},0)}function n(e){if(typeof e!="function")throw new TypeError("Listener is not function");return e}function r(e){return e.supervisors||(e.supervisors=[]),e.supervisors}function i(e,t){return e.listeners||(e.listeners={}),t&&!e.listeners[t]&&(e.listeners[t]=[]),t?e.listeners[t]:e.listeners}function s(e){return e.errbacks||(e.errbacks=[]),e.errbacks}function o(o){function u(e,n,r){try{n.listener.apply(n.thisp||o,r)}catch(i){t(e,i,s(o))}}return o=o||{},o.on=function(e,t,s){if(typeof e=="function")return r(this).push({listener:e,thisp:t});i(this,e).push({listener:n(t),thisp:s})},o.off=function(e,t){var n,o,u,a;if(!e){n=r(this),n.splice(0,n.length),o=i(this);for(u in o)o.hasOwnProperty(u)&&(n=i(this,u),n.splice(0,n.length));n=s(this),n.splice(0,n.length);return}typeof e=="function"?(n=r(this),t=e):n=i(this,e);if(!t){n.splice(0,n.length);return}for(u=0,a=n.length;u<a;++u)if(n[u].listener===t){n.splice(u,1);return}},o.once=function(e,t,n){var r=function(){o.off(e,r),t.apply(this,arguments)};o.on(e,r,n)},o.bind=function(e,t){var n,r,i;if(!t)for(n in e)typeof e[n]=="function"&&this.on(n,e[n],e);else for(r=0,i=t.length;r<i;++r){if(typeof e[t[r]]!="function")throw new Error("No such method "+t[r]);this.on(t[r],e[t[r]],e)}return e},o.emit=function(t){var n=r(this),s=e.call(arguments),o,a;for(o=0,a=n.length;o<a;++o)u(t,n[o],s);n=i(this,t).slice(),s=e.call(arguments,1);for(o=0,a=n.length;o<a;++o)u(t,n[o],s)},o.errback=function(e){this.errbacks||(this.errbacks=[]),this.errbacks.push(n(e))},o}var e=Array.prototype.slice;return{createEventEmitter:o}}),function(e,t,n){typeof module!="undefined"&&module.exports?module.exports=n():typeof define=="function"&&define.amd?define(n):t[e]=n()}("reqwest",this,function(){function handleReadyState(e,t,n){return function(){e&&e[readyState]==4&&(e.onreadystatechange=noop,twoHundo.test(e.status)?t(e):n(e))}}function setHeaders(e,t){var n=t.headers||{},r;n.Accept=n.Accept||defaultHeaders.accept[t.type]||defaultHeaders.accept["*"],!t.crossOrigin&&!n[requestedWith]&&(n[requestedWith]=defaultHeaders.requestedWith),n[contentType]||(n[contentType]=t.contentType||defaultHeaders.contentType);for(r in n)n.hasOwnProperty(r)&&e.setRequestHeader(r,n[r])}function setCredentials(e,t){typeof t.withCredentials!="undefined"&&typeof e.withCredentials!="undefined"&&(e.withCredentials=!!t.withCredentials)}function generalCallback(e){lastValue=e}function urlappend(e,t){return e+(/\?/.test(e)?"&":"?")+t}function handleJsonp(e,t,n,r){var i=uniqid++,s=e.jsonpCallback||"callback",o=e.jsonpCallbackName||reqwest.getcallbackPrefix(i),u=new RegExp("((^|\\?|&)"+s+")=([^&]+)"),a=r.match(u),f=doc.createElement("script"),l=0,c=navigator.userAgent.indexOf("MSIE 10.0")!==-1;a?a[3]==="?"?r=r.replace(u,"$1="+o):o=a[3]:r=urlappend(r,s+"="+o),win[o]=generalCallback,f.type="text/javascript",f.src=r,f.async=!0,typeof f.onreadystatechange!="undefined"&&!c&&(f.event="onclick",f.htmlFor=f.id="_reqwest_"+i),f.onload=f.onreadystatechange=function(){if(f[readyState]&&f[readyState]!=="complete"&&f[readyState]!=="loaded"||l)return!1;f.onload=f.onreadystatechange=null,f.onclick&&f.onclick(),e.success&&e.success(lastValue),lastValue=undefined,head.removeChild(f),l=1},head.appendChild(f)}function getRequest(e,t,n){var r=(e.method||"GET").toUpperCase(),i=typeof e=="string"?e:e.url,s=e.processData!==!1&&e.data&&typeof e.data!="string"?reqwest.toQueryString(e.data):e.data||null,o;return(e.type=="jsonp"||r=="GET")&&s&&(i=urlappend(i,s),s=null),e.type=="jsonp"?handleJsonp(e,t,n,i):(o=xhr(),o.open(r,i,!0),setHeaders(o,e),setCredentials(o,e),o.onreadystatechange=handleReadyState(o,t,n),e.before&&e.before(o),o.send(s),o)}function Reqwest(e,t){this.o=e,this.fn=t,init.apply(this,arguments)}function setType(e){var t=e.match(/\.(json|jsonp|html|xml)(\?|$)/);return t?t[1]:"js"}function init(o,fn){function complete(e){o.timeout&&clearTimeout(self.timeout),self.timeout=null;while(self._completeHandlers.length>0)self._completeHandlers.shift()(e)}function success(resp){var r=resp.responseText;if(r)switch(type){case"json":try{resp=win.JSON?win.JSON.parse(r):eval("("+r+")")}catch(err){return error(resp,"Could not parse JSON in response",err)}break;case"js":resp=eval(r);break;case"html":resp=r;break;case"xml":resp=resp.responseXML}self._responseArgs.resp=resp,self._fulfilled=!0,fn(resp);while(self._fulfillmentHandlers.length>0)self._fulfillmentHandlers.shift()(resp);complete(resp)}function error(e,t,n){self._responseArgs.resp=e,self._responseArgs.msg=t,self._responseArgs.t=n,self._erred=!0;while(self._errorHandlers.length>0)self._errorHandlers.shift()(e,t,n);complete(e)}this.url=typeof o=="string"?o:o.url,this.timeout=null,this._fulfilled=!1,this._fulfillmentHandlers=[],this._errorHandlers=[],this._completeHandlers=[],this._erred=!1,this._responseArgs={};var self=this,type=o.type||setType(this.url);fn=fn||function(){},o.timeout&&(this.timeout=setTimeout(function(){self.abort()},o.timeout)),o.success&&this._fulfillmentHandlers.push(function(){o.success.apply(o,arguments)}),o.error&&this._errorHandlers.push(function(){o.error.apply(o,arguments)}),o.complete&&this._completeHandlers.push(function(){o.complete.apply(o,arguments)}),this.request=getRequest(o,success,error)}function reqwest(e,t){return new Reqwest(e,t)}function normalize(e){return e?e.replace(/\r?\n/g,"\r\n"):""}function serial(e,t){var n=e.name,r=e.tagName.toLowerCase(),i=function(e){e&&!e.disabled&&t(n,normalize(e.attributes.value&&e.attributes.value.specified?e.value:e.text))};if(e.disabled||!n)return;switch(r){case"input":if(!/reset|button|image|file/i.test(e.type)){var s=/checkbox/i.test(e.type),o=/radio/i.test(e.type),u=e.value;(!s&&!o||e.checked)&&t(n,normalize(s&&u===""?"on":u))}break;case"textarea":t(n,normalize(e.value));break;case"select":if(e.type.toLowerCase()==="select-one")i(e.selectedIndex>=0?e.options[e.selectedIndex]:null);else for(var a=0;e.length&&a<e.length;a++)e.options[a].selected&&i(e.options[a])}}function eachFormElement(){var e=this,t,n,r,i=function(t,n){for(var i=0;i<n.length;i++){var s=t[byTag](n[i]);for(r=0;r<s.length;r++)serial(s[r],e)}};for(n=0;n<arguments.length;n++)t=arguments[n],/input|select|textarea/i.test(t.tagName)&&serial(t,e),i(t,["input","select","textarea"])}function serializeQueryString(){return reqwest.toQueryString(reqwest.serializeArray.apply(null,arguments))}function serializeHash(){var e={};return eachFormElement.apply(function(t,n){t in e?(e[t]&&!isArray(e[t])&&(e[t]=[e[t]]),e[t].push(n)):e[t]=n},arguments),e}var win=window,doc=document,twoHundo=/^20\d$/,byTag="getElementsByTagName",readyState="readyState",contentType="Content-Type",requestedWith="X-Requested-With",head=doc[byTag]("head")[0],uniqid=0,callbackPrefix="reqwest_"+ +(new Date),lastValue,xmlHttpRequest="XMLHttpRequest",noop=function(){},isArray=typeof Array.isArray=="function"?Array.isArray:function(e){return e instanceof Array},defaultHeaders={contentType:"application/x-www-form-urlencoded",requestedWith:xmlHttpRequest,accept:{"*":"text/javascript, text/html, application/xml, text/xml, */*",xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript",js:"application/javascript, text/javascript"}},xhr=win[xmlHttpRequest]?function(){return new XMLHttpRequest}:function(){return new ActiveXObject("Microsoft.XMLHTTP")};return Reqwest.prototype={abort:function(){this.request.abort()},retry:function(){init.call(this,this.o,this.fn)},then:function(e,t){return this._fulfilled?e(this._responseArgs.resp):this._erred?t(this._responseArgs.resp,this._responseArgs.msg,this._responseArgs.t):(this._fulfillmentHandlers.push(e),this._errorHandlers.push(t)),this},always:function(e){return this._fulfilled||this._erred?e(this._responseArgs.resp):this._completeHandlers.push(e),this},fail:function(e){return this._erred?e(this._responseArgs.resp,this._responseArgs.msg,this._responseArgs.t):this._errorHandlers.push(e),this}},reqwest.serializeArray=function(){var e=[];return eachFormElement.apply(function(t,n){e.push({name:t,value:n})},arguments),e},reqwest.serialize=function(){if(arguments.length===0)return"";var e,t,n=Array.prototype.slice.call(arguments,0);return e=n.pop(),e&&e.nodeType&&n.push(e)&&(e=null),e&&(e=e.type),e=="map"?t=serializeHash:e=="array"?t=reqwest.serializeArray:t=serializeQueryString,t.apply(null,n)},reqwest.toQueryString=function(e){var t="",n,r=encodeURIComponent,i=function(e,n){t+=r(e)+"="+r(n)+"&"};if(isArray(e))for(n=0;e&&n<e.length;n++)i(e[n].name,e[n].value);else for(var s in e){if(!Object.hasOwnProperty.call(e,s))continue;var o=e[s];if(isArray(o))for(n=0;n<o.length;n++)i(s,o[n]);else i(s,e[s])}return t.replace(/&$/,"").replace(/%20/g,"+")},reqwest.getcallbackPrefix=function(e){return callbackPrefix},reqwest.compat=function(e,t){return e&&(e.type&&(e.method=e.type)&&delete e.type,e.dataType&&(e.type=e.dataType),e.jsonpCallback&&(e.jsonpCallbackName=e.jsonpCallback)&&delete e.jsonpCallback,e.jsonp&&(e.jsonpCallback=e.jsonp)),new Reqwest(e,t)},reqwest}),this.uinit=function(){function t(t,n){return e.reduce(function(e,n){return e&&t[n]&&t[n].loaded},!0,n.depends||[])}function n(t,n){return e.map(function(e){return t[e].result},n)}function r(e,t){r.cache[e.name]=t}function i(e,t){var n=r.cache[e.name];if(!n)return!1;for(var i=0,s=t.length;i<s;++i)if(!uinit.areEqual(t[i],n[i]))return!1;return!0}function s(e,t,s,o){s.reloading?e.emit("reloading",s):e.emit("loading",s);var u=n(t,s.depends||[]),a=when.defer();return when.all(u).then(function(t){var n=(o?[o]:[]).concat(t),u=s.serializeArgs.apply(s,n);if(s.reloading&&i(s,u))return e.emit("skip",s),a.resolve();r(s,u);try{var f=s.action.apply(null,n);if(f||s.nullable)s.loaded=!0,s.result=f,e.emit("loaded",s,f)}catch(l){e.emit("error",s,l)}a.resolve()},function(t){e.emit("error",s,t),a.resolve()}),a.promise}function o(t,n){var r=e.partial(s,t,t.features,n);return n.elements?when.all(e.map(r,dome.byClass(n.elements,t.context))):r()}function u(e,n){return!n.lazy&&!n.loaded&&n.action&&t(e,n)}function a(e){return e&&e.lazy&&!e.loaded}function f(t,n){var r=function(e){return t[e]};return e.uniq(e.reduce(function(t,n){return t.concat(e.select(a,e.map(r,n.depends||[])))},[],n))}function l(t,n){return e.doall(function(t){e.doall(function(e){t[e]=n[e]},e.keys(n))},t)}function c(e){return l(e,{lazy:!1,wasLazy:!0})}function h(t){e.doall(function(e){e.action&&(e.loaded=!1,delete e.reloading),e.wasLazy&&(delete e.wasLazy,e.lazy=!0)},t)}function p(t,n){if(!t.listeners||!t.listeners.pending)return;e.doall(e.bind(t,"emit","pending"),e.select(function(e){return!e.ready&&!e.loaded&&!e.reloading},n))}function d(t,n,r){function l(){var i=e.first(s,a);if(!i)return p(t,n),typeof r=="function"?r():null;o(t,i).then(function(){if(!i.loaded){var t=e.indexOf(i,a);a=a.slice(0,t).concat(a.slice(t+1))}l()})}var i=c(f(t.features,n)),s=e.partial(u,t.features),a=e.uniq(i.concat(n));l()}function v(e,t){if(e[t])throw new Error("Cannot add duplicate "+t)}function g(){return e.map(function(e){return m.features[e]||{name:e,type:"Unknown"}},this.depends||[])}function y(t,n){n.hasOwnProperty("nullable")||(n.nullable=!0),n.hasOwnProperty("serializeArgs")||(n.serializeArgs=function(){return e.map(function(e){return e&&e.tagName&&e.appendChild?dome.uuid(e):e},arguments)}),n.dependencies=g,t.features[n.name]=n,t.tryPending()}function b(t,n){var r=[],i,s=e.values(n);do i=r.length,cull.doall(function(t){r=r.concat(e.select(function(n){return e.indexOf(t,n.depends||[])>=0},s))},t),r=e.uniq(r),t=e.map(e.prop("name"),r);while(i!==r.length);return r}function w(e,t,n){typeof e=="function"&&(n=t,t=e,e=t.name);if(!e)throw new Error("Name cannot be blank");var r=n||{};return r.name=e,r.action=t,r}function E(t,n){var r=b([n],t.features);h(r),e.doall(function(e){e.reloading=!0},r),d(t,r)}var e=cull;r.cache={};var m;return m=bane.createEventEmitter({features:{},env:function(e,t){if(t===null||t===undefined)return;this.nullableEnv(e,t)},nullableEnv:function(e,t){var n=!!this.env[e];n||v(this.features,e);var r=t!==this.env[e];this.env[e]=t,y(this,{name:e,result:t,loaded:!0}),n&&this.loaded&&r&&E(this,e)},data:function(e,t,n){var r=w(e,t,n);return v(this.features,r.name),typeof r.lazy!="boolean"&&(r.lazy=!0),typeof r.nullable!="boolean"&&(r.nullable=!1),y(this,r)},feature:function(e,t,n){var r=w(e,t,n);v(this.features,r.name);if(typeof r.action!="function")throw new Error("Cannot add feature "+r.name+", action is not a function ("+typeof r.action+")");y(this,r)},scanEnvAttrs:function(e,t){var n=e.getElementsByTagName("*"),r=[e].concat([].slice.call(n,0)),i,s,o,u;for(var a=0,f=r.length;a<f;++a){s=r[a].attributes;for(o=0,u=s.length;o<u;++o)i=s.item(o),i.nodeName.indexOf(t)===0&&this.env(i.nodeName.slice(t.length),i.nodeValue)}},load:function(t){this.loaded&&h(e.values(this.features)),this.loaded=!0,this.context=t,this.tryPending()},tryPending:function(){if(!this.loaded)return;this.emit("init"),d(this,e.values(this.features))}}),m},this.uinit.areEqual=function(e,t){return e===t};var Showdown={extensions:{}},forEach=Showdown.forEach=function(e,t){if(typeof e.forEach=="function")e.forEach(t);else{var n,r=e.length;for(n=0;n<r;n++)t(e[n],n,e)}},stdExtName=function(e){return e.replace(/[_-]||\s/g,"").toLowerCase()};Showdown.converter=function(e){var t,n,r,i=0,s=[],o=[];if(typeof module!="undefind"&&typeof exports!="undefined"&&typeof require!="undefind"){var u=require("fs");if(u){var a=u.readdirSync((__dirname||".")+"/extensions").filter(function(e){return~e.indexOf(".js")}).map(function(e){return e.replace(/\.js$/,"")});Showdown.forEach(a,function(e){var t=stdExtName(e);Showdown.extensions[t]=require("./extensions/"+e)})}}this.makeHtml=function(e){return t={},n={},r=[],e=e.replace(/~/g,"~T"),e=e.replace(/\$/g,"~D"),e=e.replace(/\r\n/g,"\n"),e=e.replace(/\r/g,"\n"),e="\n\n"+e+"\n\n",e=F(e),e=e.replace(/^[ \t]+$/mg,""),Showdown.forEach(s,function(t){e=l(t,e)}),e=N(e),e=h(e),e=c(e),e=d(e),e=B(e),e=e.replace(/~D/g,"$$"),e=e.replace(/~T/g,"~"),Showdown.forEach(o,function(t){e=l(t,e)}),e};if(e&&e.extensions){var f=this;Showdown.forEach(e.extensions,function(e){typeof e=="string"&&(e=Showdown.extensions[stdExtName(e)]);if(typeof e!="function")throw"Extension '"+e+"' could not be loaded. It was either not found or is not a valid extension.";Showdown.forEach(e(f),function(e){e.type?e.type==="language"||e.type==="lang"?s.push(e):(e.type==="output"||e.type==="html")&&o.push(e):o.push(e)})})}var l=function(e,t){if(e.regex){var n=new RegExp(e.regex,"g");return t.replace(n,e.replace)}if(e.filter)return e.filter(t)},c=function(e){return e+="~0",e=e.replace(/^[ ]{0,3}\[(.+)\]:[ \t]*\n?[ \t]*<?(\S+?)>?[ \t]*\n?[ \t]*(?:(\n*)["(](.+?)[")][ \t]*)?(?:\n+|(?=~0))/gm,function(e,r,i,s,o){return r=r.toLowerCase(),t[r]=_(i),s?s+o:(o&&(n[r]=o.replace(/"/g,"&quot;")),"")}),e=e.replace(/~0/,""),e},h=function(e){e=e.replace(/\n/g,"\n\n");var t="p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del|style|section|header|footer|nav|article|aside",n="p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|style|section|header|footer|nav|article|aside";return e=e.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del)\b[^\r]*?\n<\/\2>[ \t]*(?=\n+))/gm,p),e=e.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|style|section|header|footer|nav|article|aside)\b[^\r]*?<\/\2>[ \t]*(?=\n+)\n)/gm,p),e=e.replace(/(\n[ ]{0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g,p),e=e.replace(/(\n\n[ ]{0,3}<!(--[^\r]*?--\s*)+>[ \t]*(?=\n{2,}))/g,p),e=e.replace(/(?:\n\n)([ ]{0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,p),e=e.replace(/\n\n/g,"\n"),e},p=function(e,t){var n=t;return n=n.replace(/\n\n/g,"\n"),n=n.replace(/^\n/,""),n=n.replace(/\n+$/g,""),n="\n\n~K"+(r.push(n)-1)+"K\n\n",n},d=function(e){e=E(e);var t=C("<hr />");return e=e.replace(/^[ ]{0,2}([ ]?\*[ ]?){3,}[ \t]*$/gm,t),e=e.replace(/^[ ]{0,2}([ ]?\-[ ]?){3,}[ \t]*$/gm,t),e=e.replace(/^[ ]{0,2}([ ]?\_[ ]?){3,}[ \t]*$/gm,t),e=x(e),e=T(e),e=O(e),e=h(e),e=M(e),e},v=function(e){return e=k(e),e=m(e),e=D(e),e=b(e),e=g(e),e=P(e),e=_(e),e=A(e),e=e.replace(/ +\n/g," <br />\n"),e},m=function(e){var t=/(<[a-z\/!$]("[^"]*"|'[^']*'|[^'">])*>|<!(--.*?--\s*)+>)/gi;return e=e.replace(t,function(e){var t=e.replace(/(.)<\/?code>(?=.)/g,"$1`");return t=I(t,"\\`*_"),t}),e},g=function(e){return e=e.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g,y),e=e.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\]\([ \t]*()<?(.*?(?:\(.*?\).*?)?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,y),e=e.replace(/(\[([^\[\]]+)\])()()()()()/g,y),e},y=function(e,r,i,s,o,u,a,f){f==undefined&&(f="");var l=r,c=i,h=s.toLowerCase(),p=o,d=f;if(p==""){h==""&&(h=
2
- c.toLowerCase().replace(/ ?\n/g," ")),p="#"+h;if(t[h]!=undefined)p=t[h],n[h]!=undefined&&(d=n[h]);else{if(!(l.search(/\(\s*\)$/m)>-1))return l;p=""}}p=I(p,"*_");var v='<a href="'+p+'"';return d!=""&&(d=d.replace(/"/g,"&quot;"),d=I(d,"*_"),v+=' title="'+d+'"'),v+=">"+c+"</a>",v},b=function(e){return e=e.replace(/(!\[(.*?)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g,w),e=e.replace(/(!\[(.*?)\]\s?\([ \t]*()<?(\S+?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,w),e},w=function(e,r,i,s,o,u,a,f){var l=r,c=i,h=s.toLowerCase(),p=o,d=f;d||(d="");if(p==""){h==""&&(h=c.toLowerCase().replace(/ ?\n/g," ")),p="#"+h;if(t[h]==undefined)return l;p=t[h],n[h]!=undefined&&(d=n[h])}c=c.replace(/"/g,"&quot;"),p=I(p,"*_");var v='<img src="'+p+'" alt="'+c+'"';return d=d.replace(/"/g,"&quot;"),d=I(d,"*_"),v+=' title="'+d+'"',v+=" />",v},E=function(e){function t(e){return e.replace(/[^\w]/g,"").toLowerCase()}return e=e.replace(/^(.+)[ \t]*\n=+[ \t]*\n+/gm,function(e,n){return C('<h1 id="'+t(n)+'">'+v(n)+"</h1>")}),e=e.replace(/^(.+)[ \t]*\n-+[ \t]*\n+/gm,function(e,n){return C('<h2 id="'+t(n)+'">'+v(n)+"</h2>")}),e=e.replace(/^(\#{1,6})[ \t]*(.+?)[ \t]*\#*\n+/gm,function(e,n,r){var i=n.length;return C("<h"+i+' id="'+t(r)+'">'+v(r)+"</h"+i+">")}),e},S,x=function(e){e+="~0";var t=/^(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm;return i?e=e.replace(t,function(e,t,n){var r=t,i=n.search(/[*+-]/g)>-1?"ul":"ol";r=r.replace(/\n{2,}/g,"\n\n\n");var s=S(r);return s=s.replace(/\s+$/,""),s="<"+i+">"+s+"</"+i+">\n",s}):(t=/(\n\n|^\n?)(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/g,e=e.replace(t,function(e,t,n,r){var i=t,s=n,o=r.search(/[*+-]/g)>-1?"ul":"ol",s=s.replace(/\n{2,}/g,"\n\n\n"),u=S(s);return u=i+"<"+o+">\n"+u+"</"+o+">\n",u})),e=e.replace(/~0/,""),e};S=function(e){return i++,e=e.replace(/\n{2,}$/,"\n"),e+="~0",e=e.replace(/(\n)?(^[ \t]*)([*+-]|\d+[.])[ \t]+([^\r]+?(\n{1,2}))(?=\n*(~0|\2([*+-]|\d+[.])[ \t]+))/gm,function(e,t,n,r,i){var s=i,o=t,u=n;return o||s.search(/\n{2,}/)>-1?s=d(j(s)):(s=x(j(s)),s=s.replace(/\n$/,""),s=v(s)),"<li>"+s+"</li>\n"}),e=e.replace(/~0/g,""),i--,e};var T=function(e){return e+="~0",e=e.replace(/(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=~0))/g,function(e,t,n){var r=t,i=n;return r=L(j(r)),r=F(r),r=r.replace(/^\n+/g,""),r=r.replace(/\n+$/g,""),r="<pre><code>"+r+"\n</code></pre>",C(r)+i}),e=e.replace(/~0/,""),e},N=function(e){return e+="~0",e=e.replace(/(?:^|\n)```(.*)\n([\s\S]*?)\n```/g,function(e,t,n){var r=t,i=n;return i=L(i),i=F(i),i=i.replace(/^\n+/g,""),i=i.replace(/\n+$/g,""),i="<pre><code"+(r?' class="'+r+'"':"")+">"+i+"\n</code></pre>",C(i)}),e=e.replace(/~0/,""),e},C=function(e){return e=e.replace(/(^\n+|\n+$)/g,""),"\n\n~K"+(r.push(e)-1)+"K\n\n"},k=function(e){return e=e.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,function(e,t,n,r,i){var s=r;return s=s.replace(/^([ \t]*)/g,""),s=s.replace(/[ \t]*$/g,""),s=L(s),t+"<code>"+s+"</code>"}),e},L=function(e){return e=e.replace(/&/g,"&amp;"),e=e.replace(/</g,"&lt;"),e=e.replace(/>/g,"&gt;"),e=I(e,"*_{}[]\\",!1),e},A=function(e){return e=e.replace(/(\*\*|__)(?=\S)([^\r]*?\S[*_]*)\1/g,"<strong>$2</strong>"),e=e.replace(/(\*|_)(?=\S)([^\r]*?\S)\1/g,"<em>$2</em>"),e},O=function(e){return e=e.replace(/((^[ \t]*>[ \t]?.+\n(.+\n)*\n*)+)/gm,function(e,t){var n=t;return n=n.replace(/^[ \t]*>[ \t]?/gm,"~0"),n=n.replace(/~0/g,""),n=n.replace(/^[ \t]+$/gm,""),n=d(n),n=n.replace(/(^|\n)/g,"$1 "),n=n.replace(/(\s*<pre>[^\r]+?<\/pre>)/gm,function(e,t){var n=t;return n=n.replace(/^ /mg,"~0"),n=n.replace(/~0/g,""),n}),C("<blockquote>\n"+n+"\n</blockquote>")}),e},M=function(e){e=e.replace(/^\n+/g,""),e=e.replace(/\n+$/g,"");var t=e.split(/\n{2,}/g),n=[],i=t.length;for(var s=0;s<i;s++){var o=t[s];o.search(/~K(\d+)K/g)>=0?n.push(o):o.search(/\S/)>=0&&(o=v(o),o=o.replace(/^([ \t]*)/g,"<p>"),o+="</p>",n.push(o))}i=n.length;for(var s=0;s<i;s++)while(n[s].search(/~K(\d+)K/)>=0){var u=r[RegExp.$1];u=u.replace(/\$/g,"$$$$"),n[s]=n[s].replace(/~K\d+K/,u)}return n.join("\n\n")},_=function(e){return e=e.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g,"&amp;"),e=e.replace(/<(?![a-z\/?\$!])/gi,"&lt;"),e},D=function(e){return e=e.replace(/\\(\\)/g,q),e=e.replace(/\\([`*_{}\[\]()>#+-.!])/g,q),e},P=function(e){return e=e.replace(/<((https?|ftp|dict):[^'">\s]+)>/gi,'<a href="$1">$1</a>'),e=e.replace(/<(?:mailto:)?([-.\w]+\@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi,function(e,t){return H(B(t))}),e},H=function(e){var t=[function(e){return"&#"+e.charCodeAt(0)+";"},function(e){return"&#x"+e.charCodeAt(0).toString(16)+";"},function(e){return e}];return e="mailto:"+e,e=e.replace(/./g,function(e){if(e=="@")e=t[Math.floor(Math.random()*2)](e);else if(e!=":"){var n=Math.random();e=n>.9?t[2](e):n>.45?t[1](e):t[0](e)}return e}),e='<a href="'+e+'">'+e+"</a>",e=e.replace(/">.+:/g,'">'),e},B=function(e){return e=e.replace(/~E(\d+)E/g,function(e,t){var n=parseInt(t);return String.fromCharCode(n)}),e},j=function(e){return e=e.replace(/^(\t|[ ]{1,4})/gm,"~0"),e=e.replace(/~0/g,""),e},F=function(e){return e=e.replace(/\t(?=\t)/g," "),e=e.replace(/\t/g,"~A~B"),e=e.replace(/~B(.+?)~A/g,function(e,t,n){var r=t,i=4-r.length%4;for(var s=0;s<i;s++)r+=" ";return r}),e=e.replace(/~A/g," "),e=e.replace(/~B/g,""),e},I=function(e,t,n){var r="(["+t.replace(/([\[\]\\])/g,"\\$1")+"])";n&&(r="\\\\"+r);var i=new RegExp(r,"g");return e=e.replace(i,q),e},q=function(e,t){var n=t.charCodeAt(0);return"~E"+n+"E"}},typeof module!="undefined"&&(module.exports=Showdown),typeof define=="function"&&define.amd&&define("showdown",function(){return Showdown});// Set up a global, shared app instance
3
- this.gts=this.gts||{},this.gts.app=this.uinit(),function(){var e=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"};this.uinit.areEqual=function t(n,r){if(n===r)return!0;if(e(n)||!e(r))return n.length!==r.length;var i,s;for(i=0,s=n.length;i<s;++i)if(!t(n[i],r[i]))return!1;return!0}}(),this.gts.dropdown=function(e){return function(n){function s(){r&&(r.parentNode.removeChild(r),r=null),e.cn.rm("open",n),i=!1}function o(t){if(i)return s();document.documentElement.hasOwnProperty("ontouchstart")&&(r=e.el("div",{className:"dropdown-backdrop",events:{click:s}}),t.insertBefore(r,t)),e.cn.add("open",t),i=!0}var r,i=!1;e.on(n,"click",function(e){o(this),e.preventDefault(),e.stopPropagation()}),e.on(document.documentElement,"click",s),e.on(document.documentElement,"keydown",function(e){if(e.keyCode!==27)return;s(),e.preventDefault(),e.stopPropagation()})}}(dome);var gts=this.gts||{};gts.googleAnalytics=function(e,t){window._gaq=window._gaq||[],window._gaq.push(["_setAccount",e]),t&&window._gaq.push(["_setDomainName",t]),window._gaq.push(["_trackPageview"]);var n=document.createElement("script");n.type="text/javascript",n.async=!0,n.src=("https:"===document.location.protocol?"https://ssl":"http://www")+".google-analytics.com/ga.js",(document.getElementsByTagName("head")[0]||document.getElementsByTagName("body")[0]).appendChild(n)},this.gts=this.gts||{},this.gts.abbrev=function(e,t,n){return e.length<=t?e:(n=n||"",cull.reduce(function(e,r){return e.join(" ").length+r.length+n.length<=t&&e.push(r),e},[],e.split(" ")).join(" ")+n)},this.gts=this.gts||{},this.gts.url=function(){function e(e){var t=e.split("/");return t.shift(),t.shift(),t.shift(),"/"+t.join("/")}function t(t,n){return cull.reduce(function(e,t){return e.replace(new RegExp(n[t],"g"),"#{"+t+"}")},e(t),cull.keys(n))}function n(e,t){return cull.reduce(function(e,n){return e.replace(new RegExp("#{"+n+"}","g"),t[n])},e,cull.keys(t))}function r(e){var t=/(blame|blob|tree|history|raw|source|readme)\//,n=e.split(t)[2];return n&&n.split(":")[0]||null}return{templatize:t,render:n,currentRef:r}}(),this.gts=this.gts||{},this.gts.refSelector=function(e){function t(e,t){return(e||"#{ref}").replace(/#\{ref\}/g,t)}function n(e,t,n){return cull.select(function(e){return e[0]===t||e[1]===t},n[e]||[])[0]}function r(t,r){var i=n("heads",r,t),s="branch";return i||(i=n("tags",r,t),s="tag"),i||(s="ref"),e.a({href:"#",className:"dropdown-toggle",innerHTML:'<span class="caret"></span> <em>'+s+":</em> "+(i&&i[0]||r)})}function i(n){var r=e.input({type:"text",className:"gts-ref-input"}),i=e.form({className:"gts-ref-input",events:{submit:function(e){e.preventDefault(),window.location=t(n,r.value)}}},[r]);return e.li({className:"gts-dropdown-input",events:{click:function(e){e.stopPropagation()}}},[e.strong(["Enter ref: ",i])])}function s(n,r,i){var s=[e.li({className:"dropdown-label"},[e.strong(n)])];return cull.reduce(function(n,r){var s=t(i,r[1]);return n.push(e.li(e.a({href:s},r[0]))),n},s,r.sort())}function o(t,n){return e.ul({className:"dropdown-menu"},[i(n)].concat(s("Branches",t.heads||[],n)).concat(s("Tags",t.tags||[],n)))}function u(t,n,i){return e.div({className:"dropdown gts-branch-selector pull-right"},[r(t,n),o(t,i)])}function a(e,t,n,r){var i=u(t,n,r);e.appendChild(i),this.gts.dropdown(i)}return a.build=u,a}(dome.el),this.gts=this.gts||{},this.gts.treeHistory=function(e,t){function n(e,t){return e.getElementsByTagName(t)}function s(t,n){return e.select(function(e){return e.name===t},n)[0]}function o(e){if(!Date.parse)return"";var t=new Date(Date.parse(e));return i[t.getMonth()]+" "+t.getDate()+" "+t.getFullYear()}function u(e){var t,n;for(t=0,n=e.length;t<n;++t)if(dome.cn.has("gts-name",e[t]))return t;return t}function a(e){return(e&&dome.text(e)||"").trim()}var r=function(e,t){var i=n(n(e,"tbody")[0],"td")[2],s=(new Spinner({lines:13,length:1,width:2,radius:6,corners:1,rotate:0,color:"#000",speed:1,trail:60,shadow:!1,hwaccel:!0,className:"spinner",zIndex:2e9,top:"auto",left:"auto"})).spin(i);reqwest({url:t,type:"json",success:function(t){s.stop(),r.annotate(e,t)}})},i=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dev"];return r.annotateRow=function(e,t){var r=n(t,"td"),i=u(r),f=s(a(r[i]),e);if(!f)return;var l=f.history[0];r[i+1].innerHTML=o(l.date),dome.data.set({"gts-commit-oid":l.oid},r[i+2]),r[i+2].innerHTML="#"+l.oid.slice(0,7);var c=l.summary.trim();r[i+3].innerHTML=gts.abbrev(c,50," [...]")+" ("+l.author.name+")"},r.annotate=function(t,i){e.doall(e.partial(function(e,t){r.annotateRow(e,t)},i),n(n(t,"tbody")[0],"tr"))},r}(cull);var gts=this.gts||{};(function(e,t){gts.commitLinker=function(e,n,r){t.cn.add("gts-commit-linker",e),t.delegate.bycn("gts-commit-oid",e,"click",function(e){r(gts.url.render(n,{oid:dome.data.get("gts-commit-oid",this)}))})}})(cull.partial,dome),this.gts.userRepoViewState=function(e){return reqwest({url:e,type:"json"})};var gts=this.gts||{};(function(e,t){function n(e,n,r){var i=r?[t.i({className:"icon-"+r}),e]:[e];return t.li(t.a({href:n},i))}gts.profileMenu=function(r,i){if(!i)return;e.setContent([t.a({className:"btn btn-inverse",href:i.dashboardPath},[t.i({className:"icon-user icon-white"}),i.login]),t.a({className:"btn btn-inverse dropdown-toggle",href:"#",data:{toggle:"dropdown"}},t.span({className:"caret"}," ")),t.ul({className:"dropdown-menu"},[n("Edit",i.editPath,"pencil"),n("Messages",i.messagesPath,"envelope"),t.li({className:"divider"}),n("Dashboard",i.dashboardPath),n("Public profile",i.profilePath),n("Log out",i.logoutPath)])],r)}})(dome,dome.el),this.gts=this.gts||{},this.gts.cloneUrlSelection=function(t){var n=t.getElementsByTagName("input")[0];n&&dome.on(n,"focus",function(e){this.select()}),dome.delegate.bycn("gts-repo-url",t,"click",function(e){e.preventDefault();var n=dome.byClass("gts-repo-url",t);cull.doall(cull.partial(dome.cn.rm,"active"),n);if(e.target){dome.cn.add("active",e.target);var r=dome.byClass("gts-current-repo-url")[0];r.value=e.target.href,r.focus()}})},this.gts=this.gts||{},this.gts.blob=function(){function e(e,t){var n=t[0]-1,r=t[1]-1,i=e.getElementsByTagName("li");cull.doall(function(e,t){var i=n<=t&&t<=r;dome.cn[i?"add":"rm"]("region",e)},e.getElementsByTagName("li"))}function t(e){while(e&&e.tagName!=="LI")e=e.parentNode;var t=e&&e.className.match(/L(\d+)/)[1];if(!t)return;return parseInt(t,10)+1}function n(t,n,r){var i=n[0];i+=n[1]!==n[0]?"-"+n[1]:"",r("#L"+i),e(t,n)}function r(e,t){return t=typeof t=="number"?t:e,[Math.min(e,t),Math.max(e,t)]}function i(e,i){var s=!1,o,u=[];dome.on(document.body,"keydown",function(e){s=e.which===16}),dome.on(document.body,"keyup",function(e){s=e.which!==16}),dome.on(e,"click",function(u){var a,f=t(u.target);if(!s||!o)o=u.target;o&&s?(a=r(t(o),f),u.preventDefault()):a=[f,f],n(e,a,i)})}function s(e,t){var n=function(){dome.cn.add("focus",this)},r=function(){dome.cn.rm("focus",this)};cull.doall(function(e){dome.on(e,"mouseenter",n),dome.on(e,"mouseleave",r)},e.getElementsByTagName("li")),i(e,t)}function o(e){var t=e.match(/\#l(\d+)(?:-(\d+))?/i);if(!t)return;return r(t[1],t[2]&&Number(t[2]))}return{trackFocus:s,regionFromUrl:o,highlightRegion:e}}(),this.gts.liveMarkdownPreview=function(t){function u(e){r.style.display=e?"block":"none",r.getElementsByTagName("div")[0].innerHTML=e}function a(){o=t.value,o!==s&&(s=o,u(i.makeHtml(o))),setTimeout(a,20)}var n=t.getAttribute("data-gts-preview-target"),r=document.getElementById(n);if(!r||typeof Showdown=="undefined")return;var i=new Showdown.converter,s,o;a()},gts.app.env("url",window.location.href),gts.app.env("redirect",function(e){window.location=e}),window.hasOwnProperty("onpopstate")&&(window.onpopstate=function(e){gts.app.env("url",window.location.href)}),gts.app.data("ref-url-template",function(e,t){return gts.url.templatize(e,{ref:t})},{depends:["url","current-ref"],serializeArgs:function(e,t){return[e.split("#")[0],t]}}),gts.app.data("repository-refs",function(e){return reqwest({url:e,type:"json"})},{depends:["repository-refs-url"]}),gts.app.data("current-ref",gts.url.currentRef,{depends:["url"]}),gts.app.data("user-repo-view-state",gts.userRepoViewState,{depends:["user-repository-path"]}),gts.app.data("current-user",cull.prop("user"),{depends:["user-repo-view-state"]}),gts.app.data("blob-region",gts.blob.regionFromUrl,{depends:["url"]}),gts.app.feature("google-analytics",gts.googleAnalytics,{depends:["analytics-account","analytics-domain-name"]}),gts.app.feature("ref-selector",gts.refSelector,{elements:["gts-ref-selector-ph"],depends:["repository-refs","current-ref","ref-url-template"]}),gts.app.feature("tree-history",gts.treeHistory,{elements:["gts-tree-explorer"],depends:["tree-history-url"]}),gts.app.feature("commit-linker",gts.commitLinker,{elements:["gts-body"],depends:["commit-url-template","redirect"]}),gts.app.feature("profile-menu",gts.profileMenu,{elements:["login_button"],depends:["current-user"]}),gts.app.feature("clone-url-selection",gts.cloneUrlSelection,{elements:["gts-repo-urls"]}),gts.app.feature("highlight-region",gts.blob.highlightRegion,{elements:["gts-lines"],depends:["blob-region"]}),gts.app.feature("track-blob-focus",gts.blob.trackFocus,{elements:["gts-lines"],depends:["redirect"]}),gts.app.feature("live-markdown-preview",gts.liveMarkdownPreview,{elements:["gts-live-markdown-preview"]}),setTimeout(function(){gts.app.scanEnvAttrs(document.body,"data-gts-env-"),gts.app.load(document.body)},10);
1
+ var cull=function(e){"use strict";function r(e){return!!e&&typeof e=="object"&&typeof e.length=="number"&&!e.tagName}function i(e){return n.call(e)==="[object Array]"?e:n.call(e)==="[object Arguments]"?t.call(e):typeof e=="undefined"||e===null?[]:t.call(arguments)}function s(e,t){var n,r;for(n=0,r=t.length;n<r;++n)e(t[n],n,t);return t}function o(e){return typeof e=="function"}function u(e,t,n){var r=0,i,s=n,o=t;arguments.length===2&&(s=t,o=s[0],r=1),typeof s=="string"&&(s=s.split(""));for(i=s.length;r<i;++r)o=e(o,s[r]);return o}function a(e,t){var n,r;for(n=0,r=t.length;n<r;++n)if(!e(t[n]))return!1;return!0}function f(e,t){var n,r;for(n=0,r=t.length;n<r;++n)if(e(t[n]))return!0;return!1}function l(e,t){var n,r,i,s;for(n=0,r=t.length;n<r;++n){e(t[n])?i=!0:s=!0;if(i&&s)return!0}return!1}function c(e){return e.trim&&e.trim()||e.replace(/^\s+|\s+$/,"")}function h(e){return e}function p(e){return typeof e!="undefined"&&e!==null}function d(e){return function(t){return e.call(this,t)}}function v(e){return function(t){return t[e]}}function m(e,t){return function(n){return n[e].apply(n,i(t))}}function g(e){return function(t){return e===t}}function b(e,t){var n=i(e);return function(){var e=n.length,r=arguments;while(e--)r=[n[e].apply(t||this,r)];return r[0]}}function w(){var e=arguments;return function(t){return t.apply(this,e)}}function E(e){var n=t.call(arguments,1);return function(){return e.apply(this,n.concat(t.call(arguments)))}}function S(e,n){var r=typeof n=="string"?e[n]:n,i=t.call(arguments,2);return function(){return r.apply(e,i.concat(t.call(arguments)))}}function x(e){var t=[],n,i;for(n=0,i=e.length;n<i;n++)t=t.concat(r(e[n])?x(e[n]):e[n]);return t}function T(e,t){var n,r;for(n=0,r=t.length;n<r;++n)if(e===t[n])return n;return-1}function N(e){var t=[],n,r;for(n=0,r=e.length;n<r;++n)T(e[n],t)<0&&t.push(e[n]);return t}function C(e,t){var n,r;for(n=0,r=t.length;n<r;++n)if(e(t[n]))return t[n]}function k(e,t){var n=[],r,i;for(r=0,i=t.length;r<i;++r)e(t[r])&&n.push(t[r]);return n}function L(e,t){return k(function(e){return T(e,t)<0},e)}function A(e){var t,n=[];for(t in e)e.hasOwnProperty(t)&&n.push(t);return n}function O(e){var t,n=[];for(t in e)e.hasOwnProperty(t)&&n.push(e[t]);return n}function _(e,t){var n=[],r,i;for(r=0,i=t.length;r<i;r++)n.push(e(t[r]));return n}function D(e){return function(){return!e.apply(this,arguments)}}function P(e,t){return k(D(e),t)}function H(e,t){return i(e).concat(i(t))}function B(e,t){var n=[],r,i;for(r=0,i=t.length;r<i;r+=e)n.push(t.slice(r,r+e));return n}function j(e,t){return M(_(e,M(t)))}function F(e,t){return u(H,_(e,t))}function I(e,t){var n=[],r,i;for(r=0,i=t.length;r<i;r+=1)n.push(t[r]),r<i-1&&n.push(e);return n}function q(e,n,r){var i=e[n];e[n]=function(){var e=i.apply(this,arguments),n=r.apply(this,[e].concat(t.call(arguments)));return typeof n!="undefined"?n:e}}function R(e,t,n){var r=e[t];e[t]=function(){return n.apply(this,arguments),r.apply(this,arguments)}}function U(e,t,n){var r=E(n,e[t]);e[t]=function(){return r.apply(this,arguments)}}var t=Array.prototype.slice,n=Object.prototype.toString,y="compose takes func|[funcs] and optional thisp object",M=E(k,p);return{trim:c,doall:s,reduce:u,all:a,some:f,onlySome:l,isFunction:o,isList:r,toList:i,identity:h,defined:p,unary:d,prop:v,func:m,eq:g,compose:b,callWith:w,partial:E,bind:S,keys:A,values:O,concat:H,flatten:x,uniq:N,first:C,select:k,negate:D,reject:P,seldef:M,map:_,mapdef:j,mapcat:F,partition:B,difference:L,interpose:I,indexOf:T,after:q,before:R,around:U}}(this);typeof require=="function"&&typeof module!="undefined"&&(module.exports=cull);var dome=function(e){function t(n){if(e.isList(n))return e.flatten(e.map(t,n));var r=[],i=n.firstChild;while(i)i.nodeType===1&&r.push(i),i=i.nextSibling;return r}function n(e){return document.getElementById(e)}function r(e,t){var n=t||document;if(n.getElementsByClassName)return n.getElementsByClassName(e);var r=n.getElementsByTagName("*"),i,s,o=[],u=new RegExp("(^|\\s)"+e+"(\\s|$)");for(i=0,s=r.length;i<s;++i)u.test(r[i].className)&&o.push(r[i]);return o}function i(e){e.parentNode.removeChild(e)}function s(e,t){if(!e.parentNode)return;e.parentNode.insertBefore(t,e),e.parentNode.removeChild(e)}function o(e,t){var n=new RegExp("(^|\\s)"+e+"(\\s|$)");return n.test(t.className)}function u(t,n){if(e.isList(n))return e.doall(e.partial(u,t),n);if(o(t,n))return;n.className=e.trim(n.className+" "+t)}function a(t,n){if(e.isList(n))return e.doall(e.partial(a,t),n);if(!o(t,n))return;var r=new RegExp("\\b"+t+"\\b","g");n.className=e.trim(n.className.replace(r,""))}function f(e){var t=e.nodeType;if(t===1||t===9||t===11){if(typeof e.textContent=="string")return e.textContent;var n="";for(e=e.firstChild;e;e=e.nextSibling)n+=f(e);return n}return t===3||t===4?e.nodeValue:""}function l(t){var n=document.createDocumentFragment();return e.doall(e.bind(n,"appendChild"),e.toList(t)),n}function h(e){return e?(typeof e._dome_uuid!="number"&&(e._dome_uuid=c++),e._dome_uuid):null}function d(e,t){if(!t||!e)return!1;var n=h(e);p[n]||(p[n]={});if(p[n][h(t)])return!0;var r=[];while(t&&t!==e)r.push(h(t)),t=t.parentNode;var i=!!t;for(var s=0,o=r.length;s<o;s++)p[n][r[s]]=i;return i}function g(e,t){var n;e=e||{};for(n in e)e.hasOwnProperty(n)&&(t.setAttribute("data-"+n,e[n]),t["data-"+n]=e[n])}function y(e,t){return t.getAttribute("data-"+e)}function w(e,t){var n,r;e=e||{};for(n in e)e.hasOwnProperty(n)&&(r=b[n],r?r(t,e[n]):t[n]=e[n])}function E(t,n){t=e.toList(t);var r,i;for(r=0,i=t.length;r<i;++r)typeof t[r]=="string"?n.appendChild(document.createTextNode(t[r])):n.appendChild(t[r])}function S(e,t){t.innerHTML="",E(e,t)}var c=0,p={},v,m=function(t){return t!==null&&typeof t!="undefined"&&(typeof t.nodeType!="undefined"||typeof t=="string"||e.isList(t))},b={style:function(e,t){var n;for(n in t)t.hasOwnProperty(n)&&(e.style[n]=t[n])},data:function(e,t){g(t,e)}};return v=function(e,t,n){if(!n&&m(t))return v(e,{},t);var r=document.createElement(e);return w(t,r),E(n||[],r),r},v.toString=function(){return"dome.el()"},e.doall(function(t){v[t]=e.partial(v,t)},["a","br","div","fieldset","form","h2","h3","h4","h5","img","input","label","li","p","span","strong","textarea","ul","span","select","option","ol","iframe","table","tr","td","pre","button","i"]),{propmap:b,el:v,setProp:w,append:E,setContent:S,children:t,id:n,byClass:r,remove:i,replace:s,frag:l,text:f,data:{get:y,set:g},cn:{has:o,add:u,rm:a},uuid:h,contains:d}}(this.cull);(function(e,t){function n(e,t){return/^(?:function|object|unknown)$/.test(typeof e[t])}function a(e,t){return function(n){t.call(i[e],n||window.event)}}function f(e,t){return{handler:t,wrappedHandler:a(e,t)}}function c(e,t,n,r){s(t,n,function(t){e(t.target,n,t)&&r.call(t.target,t)})}var r=function(){if(typeof document.documentElement.uniqueID!="undefined")return function(e){return e.uniqueID};var e=0;return function(t){return t.__uniqueID||(t.__uniqueID="uniqueID__"+e,e+=1),t.__uniqueID}}(),i={},s,o,u=document.documentElement;if(n(u,"addEventListener")&&n(u,"removeEventListener")&&n(window,"addEventListener")&&n(window,"removeEventListener"))s=function(e,t,n){return e.addEventListener(t,n,!1),{cancel:function(){o(e,t,n)}}},o=function(e,t,n){e.removeEventListener(t,n,!1)};else if(n(u,"attachEvent")&&n(u,"detachEvent")&&n(window,"attachEvent")&&n("detachEvent")){var l={};s=function(e,t,n){var s=r(e);i[s]=e,l[s]||(l[s]={}),l[s][t]||(l[s][t]=[]);var u=f(s,n);return l[s][t].push(u),e.attachEvent("on"+t,u.wrappedHandler),{cancel:function(){o(e,t,n)}}},o=function(t,n,i){var s=r(t);if(!l[s]||!l[s][n])return;l[s][n]=e.select(function(e){if(e.handler!==i)return!0;t.detachEvent("on"+n,e.wrappedHandler)},l[s][n])}}c.bycn=function(n,r,i,s){c(e.partial(t.cn.has,n),r,i,s)},dome.events={mouseenter:function(e,t){var n=null,r=s(e,"mouseover",function(r){n!==e&&(t.call(e,r),n=e)}),i=s(e,"mouseout",function(t){var r=t.relatedTarget||t.toElement;try{r&&!r.nodeName&&(r=r.parentNode)}catch(t){return}e!==r&&!dome.contains(e,r)&&(n=null)});return{cancel:function(){r.cancel(),i.cancel()}}},mouseleave:function(e,t){return s(e,"mouseout",function(n){!dome.contains(e,n.relatedTarget)&&e!==n.relatedTarget&&t.call(e,n)})}},dome.on=function(e,t,n){return dome.events[t]?dome.events[t](e,n):s(e,t,n)},dome.off=o,dome.delegate=c,dome.propmap.events=function(t,n){e.doall(function(e){s(t,e,n[e])},e.keys(n))}})(cull,dome),!function(e,t,n){function o(e,n){var r=t.createElement(e||"div"),i;for(i in n)r[i]=n[i];return r}function u(e){for(var t=1,n=arguments.length;t<n;t++)e.appendChild(arguments[t]);return e}function f(e,t,n,r){var o=["opacity",t,~~(e*100),n,r].join("-"),u=.01+n/r*100,f=Math.max(1-(1-e)/t*(100-u),e),l=s.substring(0,s.indexOf("Animation")).toLowerCase(),c=l&&"-"+l+"-"||"";return i[o]||(a.insertRule("@"+c+"keyframes "+o+"{"+"0%{opacity:"+f+"}"+u+"%{opacity:"+e+"}"+(u+.01)+"%{opacity:1}"+(u+t)%100+"%{opacity:"+e+"}"+"100%{opacity:"+f+"}"+"}",a.cssRules.length),i[o]=1),o}function l(e,t){var i=e.style,s,o;if(i[t]!==n)return t;t=t.charAt(0).toUpperCase()+t.slice(1);for(o=0;o<r.length;o++){s=r[o]+t;if(i[s]!==n)return s}}function c(e,t){for(var n in t)e.style[l(e,n)||n]=t[n];return e}function h(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var i in r)e[i]===n&&(e[i]=r[i])}return e}function p(e){var t={x:e.offsetLeft,y:e.offsetTop};while(e=e.offsetParent)t.x+=e.offsetLeft,t.y+=e.offsetTop;return t}function v(e){if(!this.spin)return new v(e);this.opts=h(e||{},v.defaults,d)}var r=["webkit","Moz","ms","O"],i={},s,a=function(){var e=o("style",{type:"text/css"});return u(t.getElementsByTagName("head")[0],e),e.sheet||e.styleSheet}(),d={lines:12,length:7,width:5,radius:10,rotate:0,corners:1,color:"#000",speed:1,trail:100,opacity:.25,fps:20,zIndex:2e9,className:"spinner",top:"auto",left:"auto",position:"relative"};v.defaults={},h(v.prototype,{spin:function(e){this.stop();var t=this,n=t.opts,r=t.el=c(o(0,{className:n.className}),{position:n.position,width:0,zIndex:n.zIndex}),i=n.radius+n.length+n.width,u,a;e&&(e.insertBefore(r,e.firstChild||null),a=p(e),u=p(r),c(r,{left:(n.left=="auto"?a.x-u.x+(e.offsetWidth>>1):parseInt(n.left,10)+i)+"px",top:(n.top=="auto"?a.y-u.y+(e.offsetHeight>>1):parseInt(n.top,10)+i)+"px"})),r.setAttribute("aria-role","progressbar"),t.lines(r,t.opts);if(!s){var f=0,l=n.fps,h=l/n.speed,d=(1-n.opacity)/(h*n.trail/100),v=h/n.lines;(function m(){f++;for(var e=n.lines;e;e--){var i=Math.max(1-(f+e*v)%h*d,n.opacity);t.opacity(r,n.lines-e,i,n)}t.timeout=t.el&&setTimeout(m,~~(1e3/l))})()}return t},stop:function(){var e=this.el;return e&&(clearTimeout(this.timeout),e.parentNode&&e.parentNode.removeChild(e),this.el=n),this},lines:function(e,t){function i(e,r){return c(o(),{position:"absolute",width:t.length+t.width+"px",height:t.width+"px",background:e,boxShadow:r,transformOrigin:"left",transform:"rotate("+~~(360/t.lines*n+t.rotate)+"deg) translate("+t.radius+"px"+",0)",borderRadius:(t.corners*t.width>>1)+"px"})}var n=0,r;for(;n<t.lines;n++)r=c(o(),{position:"absolute",top:1+~(t.width/2)+"px",transform:t.hwaccel?"translate3d(0,0,0)":"",opacity:t.opacity,animation:s&&f(t.opacity,t.trail,n,t.lines)+" "+1/t.speed+"s linear infinite"}),t.shadow&&u(r,c(i("#000","0 0 4px #000"),{top:"2px"})),u(e,u(r,i(t.color,"0 0 1px rgba(0,0,0,.1)")));return e},opacity:function(e,t,n){t<e.childNodes.length&&(e.childNodes[t].style.opacity=n)}}),function(){function e(e,t){return o("<"+e+' xmlns="urn:schemas-microsoft.com:vml" class="spin-vml">',t)}var t=c(o("group"),{behavior:"url(#default#VML)"});!l(t,"transform")&&t.adj?(a.addRule(".spin-vml","behavior:url(#default#VML)"),v.prototype.lines=function(t,n){function s(){return c(e("group",{coordsize:i+" "+i,coordorigin:-r+" "+ -r}),{width:i,height:i})}function l(t,i,o){u(a,u(c(s(),{rotation:360/n.lines*t+"deg",left:~~i}),u(c(e("roundrect",{arcsize:n.corners}),{width:r,height:n.width,left:n.radius,top:-n.width>>1,filter:o}),e("fill",{color:n.color,opacity:n.opacity}),e("stroke",{opacity:0}))))}var r=n.length+n.width,i=2*r,o=-(n.width+n.length)*2+"px",a=c(s(),{position:"absolute",top:o,left:o}),f;if(n.shadow)for(f=1;f<=n.lines;f++)l(f,-2,"progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)");for(f=1;f<=n.lines;f++)l(f);return u(t,a)},v.prototype.opacity=function(e,t,n,r){var i=e.firstChild;r=r.shadow&&r.lines||0,i&&t+r<i.childNodes.length&&(i=i.childNodes[t+r],i=i&&i.firstChild,i=i&&i.firstChild,i&&(i.opacity=n))}):s=l(t,"animation")}(),typeof define=="function"&&define.amd?define(function(){return v}):e.Spinner=v}(window,document),function(e){"use strict";e(function(){function r(e,t,n,r){return i(e).then(t,n,r)}function i(e){var t,n;return e instanceof o?t=e:l(e)?(n=f(),e.then(function(e){n.resolve(e)},function(e){n.reject(e)},function(e){n.progress(e)}),t=n.promise):t=u(e),t}function s(e){return r(e,a)}function o(e){this.then=e}function u(e){var t=new o(function(t){try{return i(typeof t=="function"?t(e):e)}catch(n){return a(n)}});return t}function a(e){var t=new o(function(t,n){try{return i(typeof n=="function"?n(e):a(e))}catch(r){return a(r)}});return t}function f(){function h(e,t,n){return u(e,t,n)}function p(e){return c(i(e))}function d(e){return c(a(e))}function v(e){return l(e)}var e,t,r,s,u,l,c;return t=new o(h),e={then:h,resolve:p,reject:d,progress:v,promise:t,resolver:{resolve:p,reject:d,progress:v}},r=[],s=[],u=function(e,t,n){var i,o;return i=f(),o=typeof n=="function"?function(e){try{i.progress(n(e))}catch(t){i.progress(t)}}:function(e){i.progress(e)},r.push(function(n){n.then(e,t).then(i.resolve,i.reject,o)}),s.push(o),i.promise},l=function(e){return y(s,e),e},c=function(e){return u=e.then,c=i,l=E,y(r,e),s=r=n,e},e}function l(e){return e&&typeof e.then=="function"}function c(e,t,n,i,s){return b(2,arguments),r(e,function(e){function g(e){p(e)}function y(e){h(e)}var o,u,a,l,c,h,p,d,v,m;v=e.length>>>0,o=Math.max(0,Math.min(t,v)),a=[],u=v-o+1,l=[],c=f();if(!o)c.resolve(a);else{d=c.progress,p=function(e){l.push(e),--u||(h=p=w,c.reject(l))},h=function(e){a.push(e),--o||(h=p=w,c.resolve(a))};for(m=0;m<v;++m)m in e&&r(e[m],y,g,d)}return c.promise.then(n,i,s)})}function h(e,t,n,r){function i(e){return t?t(e[0]):e[0]}return c(e,1,i,n,r)}function p(e,t,n,r){return b(1,arguments),v(e,E).then(t,n,r)}function d(){return v(arguments,E)}function v(e,t){return r(e,function(e){var n,i,s,o,u,a;s=i=e.length>>>0,n=[],a=f();if(!s)a.resolve(n);else{o=function(i,o){r(i,t).then(function(e){n[o]=e,--s||a.resolve(n)},a.reject)};for(u=0;u<i;u++)u in e?o(e[u],u):--s}return a.promise})}function m(n,i){var s=t.call(arguments,1);return r(n,function(t){var n;return n=t.length,s[0]=function(e,t,s){return r(e,function(e){return r(t,function(t){return i(e,t,s,n)})})},e.apply(t,s)})}function g(e,t,n){var i=arguments.length>2;return r(e,function(e){return e=i?n:e,t.resolve(e),e},function(e){return t.reject(e),a(e)},t.progress)}function y(e,t){var n,r=0;while(n=e[r++])n(t)}function b(e,t){var n,r=t.length;while(r>e){n=t[--r];if(n!=null&&typeof n!="function")throw new Error("arg "+r+" must be a function")}}function w(){}function E(e){return e}var e,t,n;return r.defer=f,r.resolve=i,r.reject=s,r.join=d,r.all=p,r.map=v,r.reduce=m,r.any=h,r.some=c,r.chain=g,r.isPromise=l,o.prototype={always:function(e,t){return this.then(e,e,t)},otherwise:function(e){return this.then(n,e)},yield:function(e){return this.then(function(){return e})},spread:function(e){return this.then(function(t){return p(t,function(t){return e.apply(n,t)})})}},t=[].slice,e=[].reduce||function(e){var t,n,r,i,s;s=0,t=Object(this),i=t.length>>>0,n=arguments;if(n.length<=1)for(;;){if(s in t){r=t[s++];break}if(++s>=i)throw new TypeError}else r=n[1];for(;s<i;++s)s in t&&(r=e(r,t[s],s,t));return r},r})}(typeof define=="function"&&define.amd?define:function(e){typeof exports=="object"?module.exports=e():this.when=e()}),(typeof define=="function"&&define.amd&&function(e){define(e)}||typeof module=="object"&&function(e){module.exports=e()}||function(e){this.bane=e()})(function(){"use strict";function t(e,t,n){var r,i=n.length;if(i>0){for(r=0;r<i;++r)n[r](e,t);return}setTimeout(function(){throw t.message=e+" listener threw error: "+t.message,t},0)}function n(e){if(typeof e!="function")throw new TypeError("Listener is not function");return e}function r(e){return e.supervisors||(e.supervisors=[]),e.supervisors}function i(e,t){return e.listeners||(e.listeners={}),t&&!e.listeners[t]&&(e.listeners[t]=[]),t?e.listeners[t]:e.listeners}function s(e){return e.errbacks||(e.errbacks=[]),e.errbacks}function o(o){function u(e,n,r){try{n.listener.apply(n.thisp||o,r)}catch(i){t(e,i,s(o))}}return o=o||{},o.on=function(e,t,s){if(typeof e=="function")return r(this).push({listener:e,thisp:t});i(this,e).push({listener:n(t),thisp:s})},o.off=function(e,t){var n,o,u,a;if(!e){n=r(this),n.splice(0,n.length),o=i(this);for(u in o)o.hasOwnProperty(u)&&(n=i(this,u),n.splice(0,n.length));n=s(this),n.splice(0,n.length);return}typeof e=="function"?(n=r(this),t=e):n=i(this,e);if(!t){n.splice(0,n.length);return}for(u=0,a=n.length;u<a;++u)if(n[u].listener===t){n.splice(u,1);return}},o.once=function(e,t,n){var r=function(){o.off(e,r),t.apply(this,arguments)};o.on(e,r,n)},o.bind=function(e,t){var n,r,i;if(!t)for(n in e)typeof e[n]=="function"&&this.on(n,e[n],e);else for(r=0,i=t.length;r<i;++r){if(typeof e[t[r]]!="function")throw new Error("No such method "+t[r]);this.on(t[r],e[t[r]],e)}return e},o.emit=function(t){var n=r(this),s=e.call(arguments),o,a;for(o=0,a=n.length;o<a;++o)u(t,n[o],s);n=i(this,t).slice(),s=e.call(arguments,1);for(o=0,a=n.length;o<a;++o)u(t,n[o],s)},o.errback=function(e){this.errbacks||(this.errbacks=[]),this.errbacks.push(n(e))},o}var e=Array.prototype.slice;return{createEventEmitter:o}}),function(e,t,n){typeof module!="undefined"&&module.exports?module.exports=n():typeof define=="function"&&define.amd?define(n):t[e]=n()}("reqwest",this,function(){function handleReadyState(e,t,n){return function(){e&&e[readyState]==4&&(e.onreadystatechange=noop,twoHundo.test(e.status)?t(e):n(e))}}function setHeaders(e,t){var n=t.headers||{},r;n.Accept=n.Accept||defaultHeaders.accept[t.type]||defaultHeaders.accept["*"],!t.crossOrigin&&!n[requestedWith]&&(n[requestedWith]=defaultHeaders.requestedWith),n[contentType]||(n[contentType]=t.contentType||defaultHeaders.contentType);for(r in n)n.hasOwnProperty(r)&&e.setRequestHeader(r,n[r])}function setCredentials(e,t){typeof t.withCredentials!="undefined"&&typeof e.withCredentials!="undefined"&&(e.withCredentials=!!t.withCredentials)}function generalCallback(e){lastValue=e}function urlappend(e,t){return e+(/\?/.test(e)?"&":"?")+t}function handleJsonp(e,t,n,r){var i=uniqid++,s=e.jsonpCallback||"callback",o=e.jsonpCallbackName||reqwest.getcallbackPrefix(i),u=new RegExp("((^|\\?|&)"+s+")=([^&]+)"),a=r.match(u),f=doc.createElement("script"),l=0,c=navigator.userAgent.indexOf("MSIE 10.0")!==-1;a?a[3]==="?"?r=r.replace(u,"$1="+o):o=a[3]:r=urlappend(r,s+"="+o),win[o]=generalCallback,f.type="text/javascript",f.src=r,f.async=!0,typeof f.onreadystatechange!="undefined"&&!c&&(f.event="onclick",f.htmlFor=f.id="_reqwest_"+i),f.onload=f.onreadystatechange=function(){if(f[readyState]&&f[readyState]!=="complete"&&f[readyState]!=="loaded"||l)return!1;f.onload=f.onreadystatechange=null,f.onclick&&f.onclick(),e.success&&e.success(lastValue),lastValue=undefined,head.removeChild(f),l=1},head.appendChild(f)}function getRequest(e,t,n){var r=(e.method||"GET").toUpperCase(),i=typeof e=="string"?e:e.url,s=e.processData!==!1&&e.data&&typeof e.data!="string"?reqwest.toQueryString(e.data):e.data||null,o;return(e.type=="jsonp"||r=="GET")&&s&&(i=urlappend(i,s),s=null),e.type=="jsonp"?handleJsonp(e,t,n,i):(o=xhr(),o.open(r,i,!0),setHeaders(o,e),setCredentials(o,e),o.onreadystatechange=handleReadyState(o,t,n),e.before&&e.before(o),o.send(s),o)}function Reqwest(e,t){this.o=e,this.fn=t,init.apply(this,arguments)}function setType(e){var t=e.match(/\.(json|jsonp|html|xml)(\?|$)/);return t?t[1]:"js"}function init(o,fn){function complete(e){o.timeout&&clearTimeout(self.timeout),self.timeout=null;while(self._completeHandlers.length>0)self._completeHandlers.shift()(e)}function success(resp){var r=resp.responseText;if(r)switch(type){case"json":try{resp=win.JSON?win.JSON.parse(r):eval("("+r+")")}catch(err){return error(resp,"Could not parse JSON in response",err)}break;case"js":resp=eval(r);break;case"html":resp=r;break;case"xml":resp=resp.responseXML}self._responseArgs.resp=resp,self._fulfilled=!0,fn(resp);while(self._fulfillmentHandlers.length>0)self._fulfillmentHandlers.shift()(resp);complete(resp)}function error(e,t,n){self._responseArgs.resp=e,self._responseArgs.msg=t,self._responseArgs.t=n,self._erred=!0;while(self._errorHandlers.length>0)self._errorHandlers.shift()(e,t,n);complete(e)}this.url=typeof o=="string"?o:o.url,this.timeout=null,this._fulfilled=!1,this._fulfillmentHandlers=[],this._errorHandlers=[],this._completeHandlers=[],this._erred=!1,this._responseArgs={};var self=this,type=o.type||setType(this.url);fn=fn||function(){},o.timeout&&(this.timeout=setTimeout(function(){self.abort()},o.timeout)),o.success&&this._fulfillmentHandlers.push(function(){o.success.apply(o,arguments)}),o.error&&this._errorHandlers.push(function(){o.error.apply(o,arguments)}),o.complete&&this._completeHandlers.push(function(){o.complete.apply(o,arguments)}),this.request=getRequest(o,success,error)}function reqwest(e,t){return new Reqwest(e,t)}function normalize(e){return e?e.replace(/\r?\n/g,"\r\n"):""}function serial(e,t){var n=e.name,r=e.tagName.toLowerCase(),i=function(e){e&&!e.disabled&&t(n,normalize(e.attributes.value&&e.attributes.value.specified?e.value:e.text))};if(e.disabled||!n)return;switch(r){case"input":if(!/reset|button|image|file/i.test(e.type)){var s=/checkbox/i.test(e.type),o=/radio/i.test(e.type),u=e.value;(!s&&!o||e.checked)&&t(n,normalize(s&&u===""?"on":u))}break;case"textarea":t(n,normalize(e.value));break;case"select":if(e.type.toLowerCase()==="select-one")i(e.selectedIndex>=0?e.options[e.selectedIndex]:null);else for(var a=0;e.length&&a<e.length;a++)e.options[a].selected&&i(e.options[a])}}function eachFormElement(){var e=this,t,n,r,i=function(t,n){for(var i=0;i<n.length;i++){var s=t[byTag](n[i]);for(r=0;r<s.length;r++)serial(s[r],e)}};for(n=0;n<arguments.length;n++)t=arguments[n],/input|select|textarea/i.test(t.tagName)&&serial(t,e),i(t,["input","select","textarea"])}function serializeQueryString(){return reqwest.toQueryString(reqwest.serializeArray.apply(null,arguments))}function serializeHash(){var e={};return eachFormElement.apply(function(t,n){t in e?(e[t]&&!isArray(e[t])&&(e[t]=[e[t]]),e[t].push(n)):e[t]=n},arguments),e}var win=window,doc=document,twoHundo=/^20\d$/,byTag="getElementsByTagName",readyState="readyState",contentType="Content-Type",requestedWith="X-Requested-With",head=doc[byTag]("head")[0],uniqid=0,callbackPrefix="reqwest_"+ +(new Date),lastValue,xmlHttpRequest="XMLHttpRequest",noop=function(){},isArray=typeof Array.isArray=="function"?Array.isArray:function(e){return e instanceof Array},defaultHeaders={contentType:"application/x-www-form-urlencoded",requestedWith:xmlHttpRequest,accept:{"*":"text/javascript, text/html, application/xml, text/xml, */*",xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript",js:"application/javascript, text/javascript"}},xhr=win[xmlHttpRequest]?function(){return new XMLHttpRequest}:function(){return new ActiveXObject("Microsoft.XMLHTTP")};return Reqwest.prototype={abort:function(){this.request.abort()},retry:function(){init.call(this,this.o,this.fn)},then:function(e,t){return this._fulfilled?e(this._responseArgs.resp):this._erred?t(this._responseArgs.resp,this._responseArgs.msg,this._responseArgs.t):(this._fulfillmentHandlers.push(e),this._errorHandlers.push(t)),this},always:function(e){return this._fulfilled||this._erred?e(this._responseArgs.resp):this._completeHandlers.push(e),this},fail:function(e){return this._erred?e(this._responseArgs.resp,this._responseArgs.msg,this._responseArgs.t):this._errorHandlers.push(e),this}},reqwest.serializeArray=function(){var e=[];return eachFormElement.apply(function(t,n){e.push({name:t,value:n})},arguments),e},reqwest.serialize=function(){if(arguments.length===0)return"";var e,t,n=Array.prototype.slice.call(arguments,0);return e=n.pop(),e&&e.nodeType&&n.push(e)&&(e=null),e&&(e=e.type),e=="map"?t=serializeHash:e=="array"?t=reqwest.serializeArray:t=serializeQueryString,t.apply(null,n)},reqwest.toQueryString=function(e){var t="",n,r=encodeURIComponent,i=function(e,n){t+=r(e)+"="+r(n)+"&"};if(isArray(e))for(n=0;e&&n<e.length;n++)i(e[n].name,e[n].value);else for(var s in e){if(!Object.hasOwnProperty.call(e,s))continue;var o=e[s];if(isArray(o))for(n=0;n<o.length;n++)i(s,o[n]);else i(s,e[s])}return t.replace(/&$/,"").replace(/%20/g,"+")},reqwest.getcallbackPrefix=function(e){return callbackPrefix},reqwest.compat=function(e,t){return e&&(e.type&&(e.method=e.type)&&delete e.type,e.dataType&&(e.type=e.dataType),e.jsonpCallback&&(e.jsonpCallbackName=e.jsonpCallback)&&delete e.jsonpCallback,e.jsonp&&(e.jsonpCallback=e.jsonp)),new Reqwest(e,t)},reqwest}),this.uinit=function(){function t(t,n){return e.reduce(function(e,n){return e&&t[n]&&t[n].loaded},!0,n.depends||[])}function n(t,n){return e.map(function(e){return t[e].result},n)}function r(e,t){r.cache[e.name]=t}function i(e,t){var n=r.cache[e.name];if(!n)return!1;for(var i=0,s=t.length;i<s;++i)if(!uinit.areEqual(t[i],n[i]))return!1;return!0}function s(e,t,s,o){s.reloading?e.emit("reloading",s):e.emit("loading",s);var u=n(t,s.depends||[]),a=when.defer();return when.all(u).then(function(t){var n=(o?[o]:[]).concat(t),u=s.serializeArgs.apply(s,n);if(s.reloading&&i(s,u))return e.emit("skip",s),a.resolve();r(s,u);try{var f=s.action.apply(null,n);if(f||s.nullable)s.loaded=!0,s.result=f,e.emit("loaded",s,f)}catch(l){e.emit("error",s,l)}a.resolve()},function(t){e.emit("error",s,t),a.resolve()}),a.promise}function o(t,n){var r=e.partial(s,t,t.features,n);return n.elements?when.all(e.map(r,dome.byClass(n.elements,t.context))):r()}function u(e,n){return!n.lazy&&!n.loaded&&n.action&&t(e,n)}function a(e){return e&&e.lazy&&!e.loaded}function f(t,n){var r=function(e){return t[e]};return e.uniq(e.reduce(function(t,n){return t.concat(e.select(a,e.map(r,n.depends||[])))},[],n))}function l(t,n){return e.doall(function(t){e.doall(function(e){t[e]=n[e]},e.keys(n))},t)}function c(e){return l(e,{lazy:!1,wasLazy:!0})}function h(t){e.doall(function(e){e.action&&(e.loaded=!1,delete e.reloading),e.wasLazy&&(delete e.wasLazy,e.lazy=!0)},t)}function p(t,n){if(!t.listeners||!t.listeners.pending)return;e.doall(e.bind(t,"emit","pending"),e.select(function(e){return!e.ready&&!e.loaded&&!e.reloading},n))}function d(t,n,r){function l(){var i=e.first(s,a);if(!i)return p(t,n),typeof r=="function"?r():null;o(t,i).then(function(){if(!i.loaded){var t=e.indexOf(i,a);a=a.slice(0,t).concat(a.slice(t+1))}l()})}var i=c(f(t.features,n)),s=e.partial(u,t.features),a=e.uniq(i.concat(n));l()}function v(e,t){if(e[t])throw new Error("Cannot add duplicate "+t)}function g(){return e.map(function(e){return m.features[e]||{name:e,type:"Unknown"}},this.depends||[])}function y(t,n){n.hasOwnProperty("nullable")||(n.nullable=!0),n.hasOwnProperty("serializeArgs")||(n.serializeArgs=function(){return e.map(function(e){return e&&e.tagName&&e.appendChild?dome.uuid(e):e},arguments)}),n.dependencies=g,t.features[n.name]=n,t.tryPending()}function b(t,n){var r=[],i,s=e.values(n);do i=r.length,cull.doall(function(t){r=r.concat(e.select(function(n){return e.indexOf(t,n.depends||[])>=0},s))},t),r=e.uniq(r),t=e.map(e.prop("name"),r);while(i!==r.length);return r}function w(e,t,n){typeof e=="function"&&(n=t,t=e,e=t.name);if(!e)throw new Error("Name cannot be blank");var r=n||{};return r.name=e,r.action=t,r}function E(t,n){var r=b([n],t.features);h(r),e.doall(function(e){e.reloading=!0},r),d(t,r)}var e=cull;r.cache={};var m;return m=bane.createEventEmitter({features:{},env:function(e,t){if(t===null||t===undefined)return;this.nullableEnv(e,t)},nullableEnv:function(e,t){var n=!!this.env[e];n||v(this.features,e);var r=t!==this.env[e];this.env[e]=t,y(this,{name:e,result:t,loaded:!0}),n&&this.loaded&&r&&E(this,e)},data:function(e,t,n){var r=w(e,t,n);return v(this.features,r.name),typeof r.lazy!="boolean"&&(r.lazy=!0),typeof r.nullable!="boolean"&&(r.nullable=!1),y(this,r)},feature:function(e,t,n){var r=w(e,t,n);v(this.features,r.name);if(typeof r.action!="function")throw new Error("Cannot add feature "+r.name+", action is not a function ("+typeof r.action+")");y(this,r)},scanEnvAttrs:function(e,t){var n=e.getElementsByTagName("*"),r=[e].concat([].slice.call(n,0)),i,s,o,u;for(var a=0,f=r.length;a<f;++a){s=r[a].attributes;for(o=0,u=s.length;o<u;++o)i=s.item(o),i.nodeName.indexOf(t)===0&&this.env(i.nodeName.slice(t.length),i.nodeValue)}},load:function(t){this.loaded&&h(e.values(this.features)),this.loaded=!0,this.context=t,this.tryPending()},tryPending:function(){if(!this.loaded)return;this.emit("init"),d(this,e.values(this.features))}}),m},this.uinit.areEqual=function(e,t){return e===t};var Showdown={extensions:{}},forEach=Showdown.forEach=function(e,t){if(typeof e.forEach=="function")e.forEach(t);else{var n,r=e.length;for(n=0;n<r;n++)t(e[n],n,e)}},stdExtName=function(e){return e.replace(/[_-]||\s/g,"").toLowerCase()};Showdown.converter=function(e){var t,n,r,i=0,s=[],o=[];if(typeof module!="undefind"&&typeof exports!="undefined"&&typeof require!="undefind"){var u=require("fs");if(u){var a=u.readdirSync((__dirname||".")+"/extensions").filter(function(e){return~e.indexOf(".js")}).map(function(e){return e.replace(/\.js$/,"")});Showdown.forEach(a,function(e){var t=stdExtName(e);Showdown.extensions[t]=require("./extensions/"+e)})}}this.makeHtml=function(e){return t={},n={},r=[],e=e.replace(/~/g,"~T"),e=e.replace(/\$/g,"~D"),e=e.replace(/\r\n/g,"\n"),e=e.replace(/\r/g,"\n"),e="\n\n"+e+"\n\n",e=F(e),e=e.replace(/^[ \t]+$/mg,""),Showdown.forEach(s,function(t){e=l(t,e)}),e=N(e),e=h(e),e=c(e),e=d(e),e=B(e),e=e.replace(/~D/g,"$$"),e=e.replace(/~T/g,"~"),Showdown.forEach(o,function(t){e=l(t,e)}),e};if(e&&e.extensions){var f=this;Showdown.forEach(e.extensions,function(e){typeof e=="string"&&(e=Showdown.extensions[stdExtName(e)]);if(typeof e!="function")throw"Extension '"+e+"' could not be loaded. It was either not found or is not a valid extension.";Showdown.forEach(e(f),function(e){e.type?e.type==="language"||e.type==="lang"?s.push(e):(e.type==="output"||e.type==="html")&&o.push(e):o.push(e)})})}var l=function(e,t){if(e.regex){var n=new RegExp(e.regex,"g");return t.replace(n,e.replace)}if(e.filter)return e.filter(t)},c=function(e){return e+="~0",e=e.replace(/^[ ]{0,3}\[(.+)\]:[ \t]*\n?[ \t]*<?(\S+?)>?[ \t]*\n?[ \t]*(?:(\n*)["(](.+?)[")][ \t]*)?(?:\n+|(?=~0))/gm,function(e,r,i,s,o){return r=r.toLowerCase(),t[r]=_(i),s?s+o:(o&&(n[r]=o.replace(/"/g,"&quot;")),"")}),e=e.replace(/~0/,""),e},h=function(e){e=e.replace(/\n/g,"\n\n");var t="p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del|style|section|header|footer|nav|article|aside",n="p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|style|section|header|footer|nav|article|aside";return e=e.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del)\b[^\r]*?\n<\/\2>[ \t]*(?=\n+))/gm,p),e=e.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|style|section|header|footer|nav|article|aside)\b[^\r]*?<\/\2>[ \t]*(?=\n+)\n)/gm,p),e=e.replace(/(\n[ ]{0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g,p),e=e.replace(/(\n\n[ ]{0,3}<!(--[^\r]*?--\s*)+>[ \t]*(?=\n{2,}))/g,p),e=e.replace(/(?:\n\n)([ ]{0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,p),e=e.replace(/\n\n/g,"\n"),e},p=function(e,t){var n=t;return n=n.replace(/\n\n/g,"\n"),n=n.replace(/^\n/,""),n=n.replace(/\n+$/g,""),n="\n\n~K"+(r.push(n)-1)+"K\n\n",n},d=function(e){e=E(e);var t=C("<hr />");return e=e.replace(/^[ ]{0,2}([ ]?\*[ ]?){3,}[ \t]*$/gm,t),e=e.replace(/^[ ]{0,2}([ ]?\-[ ]?){3,}[ \t]*$/gm,t),e=e.replace(/^[ ]{0,2}([ ]?\_[ ]?){3,}[ \t]*$/gm,t),e=x(e),e=T(e),e=O(e),e=h(e),e=M(e),e},v=function(e){return e=k(e),e=m(e),e=D(e),e=b(e),e=g(e),e=P(e),e=_(e),e=A(e),e=e.replace(/ +\n/g," <br />\n"),e},m=function(e){var t=/(<[a-z\/!$]("[^"]*"|'[^']*'|[^'">])*>|<!(--.*?--\s*)+>)/gi;return e=e.replace(t,function(e){var t=e.replace(/(.)<\/?code>(?=.)/g,"$1`");return t=I(t,"\\`*_"),t}),e},g=function(e){return e=e.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g,y),e=e.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\]\([ \t]*()<?(.*?(?:\(.*?\).*?)?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,y),e=e.replace(/(\[([^\[\]]+)\])()()()()()/g,y),e
2
+ },y=function(e,r,i,s,o,u,a,f){f==undefined&&(f="");var l=r,c=i,h=s.toLowerCase(),p=o,d=f;if(p==""){h==""&&(h=c.toLowerCase().replace(/ ?\n/g," ")),p="#"+h;if(t[h]!=undefined)p=t[h],n[h]!=undefined&&(d=n[h]);else{if(!(l.search(/\(\s*\)$/m)>-1))return l;p=""}}p=I(p,"*_");var v='<a href="'+p+'"';return d!=""&&(d=d.replace(/"/g,"&quot;"),d=I(d,"*_"),v+=' title="'+d+'"'),v+=">"+c+"</a>",v},b=function(e){return e=e.replace(/(!\[(.*?)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g,w),e=e.replace(/(!\[(.*?)\]\s?\([ \t]*()<?(\S+?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,w),e},w=function(e,r,i,s,o,u,a,f){var l=r,c=i,h=s.toLowerCase(),p=o,d=f;d||(d="");if(p==""){h==""&&(h=c.toLowerCase().replace(/ ?\n/g," ")),p="#"+h;if(t[h]==undefined)return l;p=t[h],n[h]!=undefined&&(d=n[h])}c=c.replace(/"/g,"&quot;"),p=I(p,"*_");var v='<img src="'+p+'" alt="'+c+'"';return d=d.replace(/"/g,"&quot;"),d=I(d,"*_"),v+=' title="'+d+'"',v+=" />",v},E=function(e){function t(e){return e.replace(/[^\w]/g,"").toLowerCase()}return e=e.replace(/^(.+)[ \t]*\n=+[ \t]*\n+/gm,function(e,n){return C('<h1 id="'+t(n)+'">'+v(n)+"</h1>")}),e=e.replace(/^(.+)[ \t]*\n-+[ \t]*\n+/gm,function(e,n){return C('<h2 id="'+t(n)+'">'+v(n)+"</h2>")}),e=e.replace(/^(\#{1,6})[ \t]*(.+?)[ \t]*\#*\n+/gm,function(e,n,r){var i=n.length;return C("<h"+i+' id="'+t(r)+'">'+v(r)+"</h"+i+">")}),e},S,x=function(e){e+="~0";var t=/^(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm;return i?e=e.replace(t,function(e,t,n){var r=t,i=n.search(/[*+-]/g)>-1?"ul":"ol";r=r.replace(/\n{2,}/g,"\n\n\n");var s=S(r);return s=s.replace(/\s+$/,""),s="<"+i+">"+s+"</"+i+">\n",s}):(t=/(\n\n|^\n?)(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/g,e=e.replace(t,function(e,t,n,r){var i=t,s=n,o=r.search(/[*+-]/g)>-1?"ul":"ol",s=s.replace(/\n{2,}/g,"\n\n\n"),u=S(s);return u=i+"<"+o+">\n"+u+"</"+o+">\n",u})),e=e.replace(/~0/,""),e};S=function(e){return i++,e=e.replace(/\n{2,}$/,"\n"),e+="~0",e=e.replace(/(\n)?(^[ \t]*)([*+-]|\d+[.])[ \t]+([^\r]+?(\n{1,2}))(?=\n*(~0|\2([*+-]|\d+[.])[ \t]+))/gm,function(e,t,n,r,i){var s=i,o=t,u=n;return o||s.search(/\n{2,}/)>-1?s=d(j(s)):(s=x(j(s)),s=s.replace(/\n$/,""),s=v(s)),"<li>"+s+"</li>\n"}),e=e.replace(/~0/g,""),i--,e};var T=function(e){return e+="~0",e=e.replace(/(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=~0))/g,function(e,t,n){var r=t,i=n;return r=L(j(r)),r=F(r),r=r.replace(/^\n+/g,""),r=r.replace(/\n+$/g,""),r="<pre><code>"+r+"\n</code></pre>",C(r)+i}),e=e.replace(/~0/,""),e},N=function(e){return e+="~0",e=e.replace(/(?:^|\n)```(.*)\n([\s\S]*?)\n```/g,function(e,t,n){var r=t,i=n;return i=L(i),i=F(i),i=i.replace(/^\n+/g,""),i=i.replace(/\n+$/g,""),i="<pre><code"+(r?' class="'+r+'"':"")+">"+i+"\n</code></pre>",C(i)}),e=e.replace(/~0/,""),e},C=function(e){return e=e.replace(/(^\n+|\n+$)/g,""),"\n\n~K"+(r.push(e)-1)+"K\n\n"},k=function(e){return e=e.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,function(e,t,n,r,i){var s=r;return s=s.replace(/^([ \t]*)/g,""),s=s.replace(/[ \t]*$/g,""),s=L(s),t+"<code>"+s+"</code>"}),e},L=function(e){return e=e.replace(/&/g,"&amp;"),e=e.replace(/</g,"&lt;"),e=e.replace(/>/g,"&gt;"),e=I(e,"*_{}[]\\",!1),e},A=function(e){return e=e.replace(/(\*\*|__)(?=\S)([^\r]*?\S[*_]*)\1/g,"<strong>$2</strong>"),e=e.replace(/(\*|_)(?=\S)([^\r]*?\S)\1/g,"<em>$2</em>"),e},O=function(e){return e=e.replace(/((^[ \t]*>[ \t]?.+\n(.+\n)*\n*)+)/gm,function(e,t){var n=t;return n=n.replace(/^[ \t]*>[ \t]?/gm,"~0"),n=n.replace(/~0/g,""),n=n.replace(/^[ \t]+$/gm,""),n=d(n),n=n.replace(/(^|\n)/g,"$1 "),n=n.replace(/(\s*<pre>[^\r]+?<\/pre>)/gm,function(e,t){var n=t;return n=n.replace(/^ /mg,"~0"),n=n.replace(/~0/g,""),n}),C("<blockquote>\n"+n+"\n</blockquote>")}),e},M=function(e){e=e.replace(/^\n+/g,""),e=e.replace(/\n+$/g,"");var t=e.split(/\n{2,}/g),n=[],i=t.length;for(var s=0;s<i;s++){var o=t[s];o.search(/~K(\d+)K/g)>=0?n.push(o):o.search(/\S/)>=0&&(o=v(o),o=o.replace(/^([ \t]*)/g,"<p>"),o+="</p>",n.push(o))}i=n.length;for(var s=0;s<i;s++)while(n[s].search(/~K(\d+)K/)>=0){var u=r[RegExp.$1];u=u.replace(/\$/g,"$$$$"),n[s]=n[s].replace(/~K\d+K/,u)}return n.join("\n\n")},_=function(e){return e=e.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g,"&amp;"),e=e.replace(/<(?![a-z\/?\$!])/gi,"&lt;"),e},D=function(e){return e=e.replace(/\\(\\)/g,q),e=e.replace(/\\([`*_{}\[\]()>#+-.!])/g,q),e},P=function(e){return e=e.replace(/<((https?|ftp|dict):[^'">\s]+)>/gi,'<a href="$1">$1</a>'),e=e.replace(/<(?:mailto:)?([-.\w]+\@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi,function(e,t){return H(B(t))}),e},H=function(e){var t=[function(e){return"&#"+e.charCodeAt(0)+";"},function(e){return"&#x"+e.charCodeAt(0).toString(16)+";"},function(e){return e}];return e="mailto:"+e,e=e.replace(/./g,function(e){if(e=="@")e=t[Math.floor(Math.random()*2)](e);else if(e!=":"){var n=Math.random();e=n>.9?t[2](e):n>.45?t[1](e):t[0](e)}return e}),e='<a href="'+e+'">'+e+"</a>",e=e.replace(/">.+:/g,'">'),e},B=function(e){return e=e.replace(/~E(\d+)E/g,function(e,t){var n=parseInt(t);return String.fromCharCode(n)}),e},j=function(e){return e=e.replace(/^(\t|[ ]{1,4})/gm,"~0"),e=e.replace(/~0/g,""),e},F=function(e){return e=e.replace(/\t(?=\t)/g," "),e=e.replace(/\t/g,"~A~B"),e=e.replace(/~B(.+?)~A/g,function(e,t,n){var r=t,i=4-r.length%4;for(var s=0;s<i;s++)r+=" ";return r}),e=e.replace(/~A/g," "),e=e.replace(/~B/g,""),e},I=function(e,t,n){var r="(["+t.replace(/([\[\]\\])/g,"\\$1")+"])";n&&(r="\\\\"+r);var i=new RegExp(r,"g");return e=e.replace(i,q),e},q=function(e,t){var n=t.charCodeAt(0);return"~E"+n+"E"}},typeof module!="undefined"&&(module.exports=Showdown),typeof define=="function"&&define.amd&&define("showdown",function(){return Showdown}),function(e){typeof define=="function"&&define.amd?define([],e):this.timeago=e()}(function(){function t(e,t,n,r){var i=typeof t=="function"?t(r,n):t,s=e.numbers&&e.numbers[r]||r;return i.replace(/%d/i,s)}function n(e){return e.replace(/^\s+/,"").replace(/\s+$/,"")}function i(e){this.locale=e;for(var t in r)typeof this.locale[t]=="undefined"&&(this.locale[t]=r[t])}var e,r={prefixAgo:null,prefixFromNow:null,suffixAgo:"ago",suffixFromNow:"from now",seconds:"less than a minute",minute:"about a minute",minutes:"%d minutes",hour:"about an hour",hours:"about %d hours",day:"a day",days:"%d days",month:"about a month",months:"%d months",year:"about a year",years:"%d years",wordSeparator:" ",numbers:[]};return i.prototype=e={locale:r,locales:{en:r},configure:function(t){var n=new i(t||e.locales.en);return n},relative:function(e){return this.inWords((new Date).getTime()-e.getTime())},inWords:function(e){var r=this.locale,i=r.prefixAgo,s=r.suffixAgo;e<0&&(i=r.prefixFromNow,s=r.suffixFromNow);var o=Math.abs(e)/1e3,u=o/60,a=u/60,f=a/24,l=f/365,c=o<45&&t(r,r.seconds,e,Math.round(o))||o<90&&t(r,r.minute,e,1)||u<45&&t(r,r.minutes,e,Math.round(u))||u<90&&t(r,r.hour,e,1)||a<24&&t(r,r.hours,e,Math.round(a))||a<42&&t(r,r.day,e,1)||f<30&&t(r,r.days,e,Math.round(f))||f<45&&t(r,r.month,e,1)||f<365&&t(r,r.months,e,Math.round(f/30))||l<1.5&&t(r,r.year,e,1)||t(r,r.years,e,Math.round(l));return c=[i,c,s].join(typeof r.wordSeparator=="string"?r.wordSeparator:""),n(c)},parse:function(e){var t=n(e);return t=t.replace(/\.\d+/,""),t=t.replace(/-/,"/").replace(/-/,"/"),t=t.replace(/T/," ").replace(/Z/," UTC"),t=t.replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2"),new Date(t)}},e});// Set up a global, shared app instance
3
+ this.gts=this.gts||{},this.gts.app=this.uinit(),function(){var e=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"};this.uinit.areEqual=function t(n,r){if(n===r)return!0;if(e(n)||!e(r))return n.length!==r.length;var i,s;for(i=0,s=n.length;i<s;++i)if(!t(n[i],r[i]))return!1;return!0}}(),this.gts=this.gts||{},this.gts.cache=function(e){function n(e,t){if(e.length!==t.length)return!1;for(var n=0,r=e.length;n<r;++n)if(e[n]!==t[n])return!1;return!0}var t=[];return function(){var r=[].slice.call(arguments),i,s,o,u,a;for(i=0,s=t.length;i<s;++i)if(n(t[i].args,r))return t[i].result;return a=e.apply(self,r),t.push({args:r,result:a}),a}},this.gts=this.gts||{},this.gts.jsonRequest=function(e){return reqwest({url:e,type:"json"})},this.gts.dropdown=function(e){return function(n){function s(){r&&(r.parentNode.removeChild(r),r=null),e.cn.rm("open",n),i=!1}function o(t){if(i)return s();document.documentElement.hasOwnProperty("ontouchstart")&&(r=e.el("div",{className:"dropdown-backdrop",events:{click:s}}),t.insertBefore(r,t)),e.cn.add("open",t),i=!0}var r,i=!1;e.on(n,"click",function(e){var t=e.target.tagName==="A"?e.target:e.target.parentNode;if(!dome.cn.has("dropdown-toggle",t))return;o(this),e.preventDefault(),e.stopPropagation()}),e.on(document.body,"click",s),e.on(document.body,"keydown",function(e){if(e.keyCode!==27)return;s(),e.preventDefault(),e.stopPropagation()})}}(dome);var gts=this.gts||{};gts.googleAnalytics=function(e,t){window._gaq=window._gaq||[],window._gaq.push(["_setAccount",e]),t&&window._gaq.push(["_setDomainName",t]),window._gaq.push(["_trackPageview"]);var n=document.createElement("script");n.type="text/javascript",n.async=!0,n.src=("https:"===document.location.protocol?"https://ssl":"http://www")+".google-analytics.com/ga.js",(document.getElementsByTagName("head")[0]||document.getElementsByTagName("body")[0]).appendChild(n)},this.gts=this.gts||{},this.gts.abbrev=function(e,t,n){return e.length<=t?e:(n=n||"",cull.reduce(function(e,r){return e.join(" ").length+r.length+n.length<=t&&e.push(r),e},[],e.split(" ")).join(" ")+n)},this.gts=this.gts||{},this.gts.url=function(){function e(e){var t=e.split("/");return t.shift(),t.shift(),t.shift(),"/"+t.join("/")}function t(t,n){return cull.reduce(function(e,t){return e.replace(new RegExp(n[t],"g"),"#{"+t+"}")},e(t),cull.keys(n))}function n(e,t){return cull.reduce(function(e,n){return e.replace(new RegExp("#{"+n+"}","g"),t[n])},e,cull.keys(t))}function r(e){var t=/(blame|blob|tree|history|raw|source|readme|commits)\//,n=e.split(t)[2];return n&&n.split(":")[0]||null}return{templatize:t,render:n,currentRef:r}}(),this.gts=this.gts||{},this.gts.refSelector=function(e){function t(e,t){return(e||"#{ref}").replace(/#\{ref\}/g,t)}function n(e,t,n){return cull.select(function(e){return e[0]===t||e[1]===t},n[e]||[])[0]}function r(t,r){var i=n("heads",r,t),s="branch";return i||(i=n("tags",r,t),s="tag"),i||(s="ref"),e.a({href:"#",className:"dropdown-toggle",innerHTML:'<span class="caret"></span> <em>'+s+":</em> "+(i&&i[0]||r)})}function i(n){var r=e.input({type:"text",className:"gts-ref-input"}),i=e.form({className:"gts-ref-input",events:{submit:function(e){e.preventDefault(),window.location=t(n,r.value)}}},[r]);return e.li({className:"gts-dropdown-input",events:{click:function(e){e.stopPropagation()}}},[e.strong(["Enter ref: ",i])])}function s(n,r,i){var s=[e.li({className:"dropdown-label"},[e.strong(n)])];return cull.reduce(function(n,r){var s=t(i,r[1]);return n.push(e.li(e.a({href:s},r[0]))),n},s,r.sort())}function o(t,n){return e.ul({className:"dropdown-menu"},[i(n)].concat(s("Branches",t.heads||[],n)).concat(s("Tags",t.tags||[],n)))}function u(t,n,i){return e.div({className:"dropdown gts-branch-selector pull-right"},[r(t,n),o(t,i)])}function a(e,t,n,r){var i=u(t,n,r);e.parentNode.insertBefore(i,e),e.parentNode.removeChild(e),this.gts.dropdown(i)}return a.build=u,a.getCurrentRef=n,a}(dome.el),this.gts=this.gts||{},this.gts.treeHistory=function(e,t){function n(e,t){return e.getElementsByTagName(t)}function s(t,n){return e.select(function(e){return e.name===t},n)[0]}function o(e){if(!Date.parse)return"";var t=new Date(Date.parse(e));return i[t.getMonth()]+" "+t.getDate()+" "+t.getFullYear()}function u(e){var t,n;for(t=0,n=e.length;t<n;++t)if(dome.cn.has("gts-name",e[t]))return t;return t}function a(e){return(e&&dome.text(e)||"").trim()}var r=function(e,t){var i=n(n(e,"tbody")[0],"td")[2],s=(new Spinner({lines:13,length:1,width:2,radius:6,corners:1,rotate:0,color:"#000",speed:1,trail:60,shadow:!1,hwaccel:!0,className:"spinner",zIndex:2e9,top:"auto",left:"auto"})).spin(i);reqwest({url:t,type:"json",success:function(t){s.stop(),r.annotate(e,t)}})},i=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dev"];return r.annotateRow=function(e,t){var r=n(t,"td"),i=u(r),f=s(a(r[i]),e);if(!f)return;var l=f.history[0];r[i+1].innerHTML=o(l.date),dome.data.set({"gts-commit-oid":l.oid},r[i+2]),r[i+2].innerHTML="#"+l.oid.slice(0,7);var c=l.summary.trim();r[i+3].innerHTML=gts.abbrev(c,50," [...]")+" ("+l.author.name+")"},r.annotate=function(t,i){e.doall(e.partial(function(e,t){r.annotateRow(e,t)},i),n(n(t,"tbody")[0],"tr"))},r}(cull);var gts=this.gts||{};(function(e,t){gts.commitLinker=function(e,n,r){t.cn.add("gts-commit-linker",e),t.delegate.bycn("gts-commit-oid",e,"click",function(e){r(gts.url.render(n,{oid:dome.data.get("gts-commit-oid",this)}))})}})(cull.partial,dome),this.gts.userRepoViewState=function(e){return reqwest({url:e,type:"json"})};var gts=this.gts||{};(function(e,t){function n(e,n,r){e=" "+e;var i=r?[t.i({className:"icon-"+r}),e]:[e];return t.li(t.a({href:n},i))}gts.profileMenu=function(r,i){if(!i)return;e.setContent([t.a({className:"btn btn-inverse",href:i.dashboardPath},[t.i({className:"icon-user icon-white"}),i.login]),t.a({className:"btn btn-inverse dropdown-toggle",href:"#",data:{toggle:"dropdown"}},t.span({className:"caret"}," ")),t.ul({className:"dropdown-menu"},[n("Edit",i.editPath,"pencil"),n("Messages",i.messagesPath,"envelope"),t.li({className:"divider"}),n("Dashboard",i.dashboardPath),n("Public profile",i.profilePath),n("Log out",i.logoutPath)])],r),gts.dropdown(r)}})(dome,dome.el),this.gts=this.gts||{},this.gts.cloneUrlSelection=function(){function e(e,t){var n=dome.byClass("gts-repo-url",e);cull.doall(cull.partial(dome.cn.rm,"active"),n);if(t){dome.cn.add("active",t);var r=dome.byClass("gts-current-repo-url",e)[0];r.value=t.getAttribute("href").replace("ssh://",""),r.focus()}}function t(t){var n=t.getElementsByTagName("input")[0];n&&dome.on(n,"focus",function(e){this.select()}),dome.delegate.bycn("gts-repo-url",t,"click",function(n){n.preventDefault(),n.stopPropagation(),e(t,n.target)})}return t.select=e,t}(),this.gts=this.gts||{},this.gts.blob=function(){function e(e,t){var n=t[0]-1,r=t[1]-1,i=e.getElementsByTagName("li");cull.doall(function(e,t){var i=n<=t&&t<=r;dome.cn[i?"add":"rm"]("region",e)},e.getElementsByTagName("li"))}function t(e){while(e&&e.tagName!=="LI")e=e.parentNode;var t=e&&e.className.match(/L(\d+)/)[1];if(!t)return;return parseInt(t,10)}function n(t,n,r){var i=n[0];i+=n[1]!==n[0]?"-"+n[1]:"",r("#L"+i),e(t,n)}function r(e,t){return t=typeof t=="number"?t:e,[Math.min(e,t),Math.max(e,t)]}function i(e,i){var s=!1,o,u=[];dome.on(document.body,"keydown",function(e){s=e.which===16}),dome.on(document.body,"keyup",function(e){s=e.which!==16}),dome.on(e,"click",function(u){var a,f=t(u.target);if(!s||!o)o=u.target;o&&s?(a=r(t(o),f),u.preventDefault()):a=[f,f],n(e,a,i)})}function s(e,t){var n=function(){dome.cn.add("focus",this)},r=function(){dome.cn.rm("focus",this)};cull.doall(function(e){dome.on(e,"mouseenter",n),dome.on(e,"mouseleave",r)},e.getElementsByTagName("li")),i(e,t)}function o(e){var t=e.match(/\#l(\d+)(?:-(\d+))?/i);if(!t)return;return r(t[1],t[2]&&Number(t[2]))}return{trackFocus:s,regionFromUrl:o,highlightRegion:e}}(),this.gts.liveMarkdownPreview=function(t){function u(e){r.style.display=e?"block":"none",r.getElementsByTagName("div")[0].innerHTML=e}function a(){o=t.value,o!==s&&(s=o,u(i.makeHtml(o))),setTimeout(a,20)}var n=t.getAttribute("data-gts-preview-target"),r=document.getElementById(n);if(!r||typeof Showdown=="undefined")return;var i=new Showdown.converter,s,o;a()},this.gts=this.gts||{},this.gts.timeago=function(e){function t(t,n){var r=e.parse(n||t.title);if(isNaN(r.getTime()))return t;var i=t.innerHTML.trim()||t.title;return t.innerHTML=e.relative(r),t.title=i,t}var n={};return t.periodic=function(e){return n[e]||(n[e]=[],setInterval(function(){for(var t=0,r=n[e].length,i;t<r;++t)i=n[e][t],gts.timeago(i.element,i.time)},e)),function(r){return n[e].push({element:r,time:r.title}),t(r,r.title)}},t}(timeago),this.gts.collapse=function(){dome.on(document.body,"click",function(e){if(dome.data.get("toggle",e.target)!=="collapse")return;var t=dome.id(dome.data.get("target",e.target).slice(1));if(!t)return;dome.cn[dome.cn.has("in",t)?"rm":"add"]("in",t),e.preventDefault(),e.stopPropagation()})},this.gts=this.gts||{},this.gts.repository=function(e){function t(t,n){return[e.i({className:t})," "+n]}function n(n,r,i){return e.a({href:n},t(r,i))}function r(r,i){return e[i||"li"]({className:"pull-right dropdown"},[e.a({href:"#","data-toggle":"dropdown",className:"dropdown-toggle"},t("icon-cog","Admin")),e.ul({className:"dropdown-menu"},[e.li(n(r.editPath,"icon-pencil","Edit repository")),e.li(n(r.destroyPath,"icon-trash","Delete repository")),e.li({className:"divider"}),e.li(n(r.ownershipPath,"i","Transfer ownership")),e.li(n(r.committershipsPath,"i","Manage collaborators"))])])}function i(e,t){var n=r(t,e.tagName.toLowerCase());dome.replace(e,n),this.gts.dropdown(n),dome.data.get("gts-active",n.parentNode)==="admin"&&dome.cn.add("active",n)}function s(e,t){t.watching?(e.innerHTML='<i class="icon icon-star"></i> Unwatch',e.href=t.unwatchPath):(e.innerHTML='<i class="icon icon-star-empty"></i> Watch',e.href=t.watchPath)}function o(e,t){gts.request({url:t.unwatchPath,method:"delete",type:"js",headers:{Accept:"application/javascript, text/javascript"},success:function(n){t.watching=!1,s(e,t)},error:function(){e.innerHTML="Failed, try watching again"}})}function u(e,t){gts.request({url:t.watchPath,method:"post",type:"text",headers:{Accept:"application/javascript, text/javascript"},success:function(n){t.watching=!0,t.unwatchPath=n.getResponseHeader("location"),s(e,t)},error:function(){e.innerHTML="Failed, try unwatching again"}})}function a(e,t){gts.loading(e),t.watching?o(e,t):u(e,t)}function f(e,t){var n=dome.el("a",{className:"btn"});dome.replace(e,n),s(n,t),dome.on(n,"click",function(e){e.preventDefault(),e.stopPropagation(),a(n,t)})}function l(e,t){if(!t.clonePath)return;dome.replace(e,dome.el("a",{href:t.clonePath,className:"btn"},"Clone"))}function c(e,t){if(!t.requestMergePath)return;dome.replace(e,dome.el("li",{className:"pull-right"},[dome.el("a",{href:t.requestMergePath},[dome.el("i",{className:"icon icon-random"})," Request merge"])]))}return i.build=r,f.watch=u,f.unwatch=o,f.toggleState=a,f.render=s,{admin:i,watching:f,cloning:l,mergeRequest:c}}(dome.el),this.gts=this.gts||{},this.gts.railsLinks=function(e,t){dome.on(document.body,"click",function(n){var r=dome.data.get("method",n.target);if(!r||r==="get")return!0;n.preventDefault(),n.stopPropagation();var i=n.target.href,s=dome.el("form",{method:"post",action:i,style:{display:"none"}},[dome.el("input",{name:"_method",value:r,type:"hidden"}),dome.el("input",{name:e,value:t,type:"hidden"})]);document.body.appendChild(s),s.submit()})},this.gts=this.gts||{},this.gts.cloneNameSuggestion=function(){function e(e,t){var n=/s$/.test(e)?e:e+"s";return n+"-"+t}return function(n){function f(){if(u.value&&cull.indexOf(u.value,a)<0)return;if(i.checked){u.value=a[0];return}if(s.checked){var t=o.options[o.selectedIndex];u.value=e(t.innerHTML,r)}}var r=dome.data.get("gts-repository-to-clone",n),i=dome.id("repository_owner_type_user"),s=dome.id("repository_owner_type_group"),o=dome.id("repository_owner_id_group_select"),u=dome.id("repository_name"),a=cull.reduce(function(t,n){return t.concat(e(n.innerHTML,r))},[e(dome.data.get("gts-cloning-user",i),r)],o.options);dome.on(i,"click",f),dome.on(s,"click",f),dome.on(o,"change",f),f()}}(),this.gts=this.gts||{},this.gts.loading=function(e,t){dome.cn.add("loading",e),e.innerHTML="",t=t||{};var n=(new Spinner({lines:t.hasOwnProperty("lines")?t.lines:8,length:t.hasOwnProperty("length")?t.length:2,width:t.hasOwnProperty("width")?t.width:2,radius:t.hasOwnProperty("radius")?t.radius:3,color:t.color||"#000",speed:t.hasOwnProperty("speed")?t.speed:1,trail:t.hasOwnProperty("trail")?t.trail:100,shadow:t.hasOwnProperty("shadow")?t.shadow:!1})).spin();n.el.style.top=t.topPos||"10px",e.appendChild(n.el);var r=t.hasOwnProperty("text")?t.text:"Loading...";if(r){var i=document.createElement("span");i.innerHTML=r,e.appendChild(i)}},this.gts=this.gts||{},this.gts.oidRefInterpolator=function(e,t,n){var r=this.gts.refSelector.getCurrentRef("heads",e.innerHTML,t);r&&(e.title=r[1],e.innerHTML=r[0])},this.gts=this.gts||{},this.gts.comments=function(e){function t(t){var n=this.gts.timeago(e.span({title:t.createdAt}));return t.createdAt===t.updatedAt?n:e.span([n,"(edited ",this.gts.timeago(e.span({title:t.updatedAt})),")"])}function n(e){console.log("Edit")}function r(t){if(!t.editPath)return"";var r=e.a({href:t.editPath,events:{click:function(e){e.preventDefault(),e.stopPropagation(),n(r.parentNode.parentNode)}}},"Edit comment");return r}function i(n){var i=n.author;return e.div({className:"gts-comment"},[e.p({innerHTML:n.body}),e.p([e.img({src:i.avatarPath}),e.a({href:i.profilePath},i.name),t(n),r(n)])])}function s(e,t){if(e.length===0)return;t.style.display="block";var n=document.createElement("div");t.appendChild(n),dome.setContent(cull.map(i,e),n)}function o(e){return e<10?"0"+e:e}function u(t,n){n.style.display="block";var r=dome.byClass("gts-comment-author-ph",n)[0];if(!r)return r;var i=new Date;return dome.replace(r,e.p([e.img({src:t.avatarPath}),e.a({href:t.profilePath},t.name)," "+o(i.getHours())+":"+o(i.getMinutes())]))}return{renderComments:s,renderComment:i,personalizeForm:u}}(dome.el),gts.app.env("url",window.location.href),gts.app.env("redirect",function(e){window.location=e}),window.hasOwnProperty("onpopstate")&&(window.onpopstate=function(e){gts.app.env("url",window.location.href)}),cull.doall(function(e){e.name==="csrf-param"&&gts.app.env("csrf-param",e.content),e.name==="csrf-token"&&gts.app.env("csrf-token",e.content)},document.getElementsByTagName("meta")),gts.request=function(e){e.headers=e.headers||{},e.headers["X-CSRF-Token"]=gts.app.env["csrf-token"],reqwest(e)},gts.app.data("ref-url-template",function(e,t){return gts.url.templatize(e,{ref:t})},{depends:["url","current-ref"],serializeArgs:function(e,t){return[e.split("#")[0],t]}}),gts.app.data("repository-refs",this.gts.jsonRequest,{depends:["repository-refs-url"]}),gts.app.data("current-ref",gts.url.currentRef,{depends:["url"]}),gts.app.data("user-repo-view-state",gts.cache(gts.userRepoViewState),{depends:["user-repository-path"]}),gts.app.data("current-user",cull.prop("user"),{depends:["user-repo-view-state"]}),gts.app.data("current-repository",cull.prop("repository"),{depends:["user-repo-view-state"]}),gts.app.data("repository-watch",cull.prop("watch"),{depends:["current-repository"]}),gts.app.data("repository-admin",cull.prop("admin"),{depends:["current-repository"]}),gts.app.data("blob-region",gts.blob.regionFromUrl,{depends:["url"]}),gts.app.feature("google-analytics",gts.googleAnalytics,{depends:["analytics-account","analytics-domain-name"]}),gts.app.feature("dropdown",gts.dropdown,{elements:["dropdown"]}),gts.app.feature("ref-selector",gts.refSelector,{elements:["gts-ref-selector-ph"],depends:["repository-refs","current-ref","ref-url-template"]}),gts.app.feature("oid-ref-interpolator",gts.oidRefInterpolator,{elements:["gts-oid"],depends:["repository-refs","ref-url-template"]}),gts.app.feature("tree-history",gts.treeHistory,{elements:["gts-tree-explorer"],depends:["tree-history-url"]}),gts.app.feature("commit-linker",gts.commitLinker,{elements:["gts-body"],depends:["commit-url-template","redirect"]}),gts.app.feature("profile-menu",gts.profileMenu,{elements:["login_button"],depends:["current-user"]}),gts.app.feature("clone-url-selection",gts.cloneUrlSelection,{elements:["gts-repo-urls"]}),gts.app.feature("highlight-region",gts.blob.highlightRegion,{elements:["gts-lines"],depends:["blob-region"]}),gts.app.feature("track-blob-focus",gts.blob.trackFocus,{elements:["gts-lines"],depends:["redirect"]}),gts.app.feature("live-markdown-preview",gts.liveMarkdownPreview,{elements:["gts-live-markdown-preview"]}),gts.app.feature("timeago",gts.timeago.periodic(6e4),{elements:["timeago"]}),gts.app.feature("collapse",gts.collapse),gts.app.feature("clone-name-suggestion",gts.cloneNameSuggestion,{elements:["clone-repository-form"]}),gts.app.feature("loading",gts.loading,{elements:["loading"]}),gts.app.feature("rails-links",gts.railsLinks,{depends:["csrf-param","csrf-token"]}),gts.app.feature("repository-admin-menu",gts.repository.admin,{elements:["gts-repository-admin-ph"],depends:["repository-admin"]}),gts.app.feature("repository-watching",gts.repository.watching,{elements:["gts-watch-repository-ph"],depends:["repository-watch"]}),gts.app.feature("repository-cloning",gts.repository.cloning,{elements:["gts-clone-repository-ph"],depends:["current-repository"]}),gts.app.feature("repository-merge-request",gts.repository.mergeRequest,{elements:["gts-request-merge-ph"],depends:["current-repository"]}),setTimeout(function(){gts.app.scanEnvAttrs(document.body,"data-gts-env-"),gts.app.load(document.documentElement)},10);
@@ -0,0 +1,27 @@
1
+ this.gts = this.gts || {};
2
+
3
+ this.gts.cache = function (fn) {
4
+ var cache = [];
5
+
6
+ function equal(arr1, arr2) {
7
+ if (arr1.length !== arr2.length) { return false; }
8
+ for (var i = 0, l = arr1.length; i < l; ++i) {
9
+ if (arr1[i] !== arr2[i]) { return false; }
10
+ }
11
+ return true;
12
+ }
13
+
14
+ return function () {
15
+ var args = [].slice.call(arguments);
16
+ var i, l, j, k, result;
17
+ for (i = 0, l = cache.length; i < l; ++i) {
18
+ if (equal(cache[i].args, args)) {
19
+ return cache[i].result;
20
+ }
21
+ }
22
+
23
+ result = fn.apply(self, args);
24
+ cache.push({ args: args, result: result });
25
+ return result;
26
+ };
27
+ };
@@ -0,0 +1,7 @@
1
+ /*global gts*/
2
+ gts.app.data("capillary-data", this.gts.jsonRequest, { depends: ["capillary-url"] });
3
+
4
+ gts.app.feature("capillary", gts.capillary, {
5
+ elements: ["capillary-graph"],
6
+ depends: ["capillary-data", "capillary-message-url", "capillary-id-url"]
7
+ });
@@ -51,7 +51,7 @@ this.gts.blob = (function () {
51
51
  }
52
52
  var lineNum = element && element.className.match(/L(\d+)/)[1];
53
53
  if (!lineNum) { return; }
54
- return parseInt(lineNum, 10) + 1;
54
+ return parseInt(lineNum, 10);
55
55
  }
56
56
 
57
57
  /**
@@ -0,0 +1,51 @@
1
+ /*global cull, dome, capillary, Raphael*/
2
+ this.gts = this.gts || {};
3
+
4
+ this.gts.capillary = function (element, data, messageUrl, idUrl) {
5
+ dome.cn.rm("loading", element);
6
+ element.innerHTML = "";
7
+ element.style.position = "relative";
8
+
9
+ var scale = 25;
10
+ var i, j, k, l, commits = 0, used = {};
11
+
12
+ for (i = 0, l = data.length; i < l; ++i) {
13
+ for (j = 0, k = data[i].length; j < k; ++j) {
14
+ if (!used[data[i][j].id]) {
15
+ commits += 1;
16
+ used[data[i][j].id] = true;
17
+ }
18
+ }
19
+ }
20
+
21
+ var F = capillary.formatters;
22
+ var graph = capillary.graph.create();
23
+ var canvas = new Raphael(element, (data.length + 1) * scale, commits * scale);
24
+
25
+ var dotRadius = 6;
26
+ var colors = ["#3d4250", "#5ea861", "#d36c6d", "#5b82d2", "#ccc62e", "#d28e23",
27
+ "#917549", "#9198aa", "#5bbad2", "#65ccab", "#92de2f", "#8a2c2c",
28
+ "#855bd2", "#c157c8"];
29
+
30
+ var scaled = F.scale.bindGraph(graph, {
31
+ scale: scale,
32
+ offset: { x: 30, y: 10 }
33
+ });
34
+
35
+ F.raphael.bindGraph(F.svgData.bindGraph(scaled), {
36
+ dotRadius: dotRadius,
37
+ canvas: canvas,
38
+ dotColors: colors
39
+ /*,lineColors: colors*/
40
+ });
41
+
42
+ F.messageMarkup.bindGraph(scaled, {
43
+ offset: [0, -(dotRadius + 2)],
44
+ root: element,
45
+ idUrl: idUrl,
46
+ messageUrl: messageUrl
47
+ /*,renderRefTypes: ["tags", "heads"]*/
48
+ });
49
+
50
+ graph.graphBranches(capillary.branch.fromArray(data));
51
+ };
@@ -0,0 +1,38 @@
1
+ /*global cull, dome*/
2
+ this.gts = this.gts || {};
3
+
4
+ this.gts.cloneNameSuggestion = (function () {
5
+ function repoName(name, repo) {
6
+ var prefix = /s$/.test(name) ? name : name + "s";
7
+ return prefix + "-" + repo;
8
+ }
9
+
10
+ return function cloneNameSuggestion(form) {
11
+ var repo = dome.data.get("gts-repository-to-clone", form);
12
+ var userInput = dome.id("repository_owner_type_user");
13
+ var groupInput = dome.id("repository_owner_type_group");
14
+ var groupSelect = dome.id("repository_owner_id_group_select");
15
+ var nameInput = dome.id("repository_name");
16
+
17
+ var names = cull.reduce(function (memo, option) {
18
+ return memo.concat(repoName(option.innerHTML, repo));
19
+ }, [repoName(dome.data.get("gts-cloning-user", userInput), repo)], groupSelect.options);
20
+
21
+ function setSuggestion() {
22
+ if (nameInput.value && cull.indexOf(nameInput.value, names) < 0) { return; }
23
+ if (userInput.checked) {
24
+ nameInput.value = names[0];
25
+ return;
26
+ }
27
+ if (groupInput.checked) {
28
+ var option = groupSelect.options[groupSelect.selectedIndex];
29
+ nameInput.value = repoName(option.innerHTML, repo);
30
+ }
31
+ }
32
+
33
+ dome.on(userInput, "click", setSuggestion);
34
+ dome.on(groupInput, "click", setSuggestion);
35
+ dome.on(groupSelect, "change", setSuggestion);
36
+ setSuggestion();
37
+ };
38
+ }());
@@ -4,22 +4,32 @@ this.gts = this.gts || {};
4
4
  /**
5
5
  * When clicking clone URLs, copy them to the related input field.
6
6
  */
7
- this.gts.cloneUrlSelection = function cloneUrlSelection(element) {
8
- var input = element.getElementsByTagName("input")[0];
9
-
10
- if (input) {
11
- dome.on(input, "focus", function (e) { this.select(); });
12
- }
13
-
14
- dome.delegate.bycn("gts-repo-url", element, "click", function (e) {
15
- e.preventDefault();
7
+ this.gts.cloneUrlSelection = (function () {
8
+ function selectCloneUrl(element, selected) {
16
9
  var links = dome.byClass("gts-repo-url", element);
17
10
  cull.doall(cull.partial(dome.cn.rm, "active"), links);
18
- if (e.target) {
19
- dome.cn.add("active", e.target);
20
- var input = dome.byClass("gts-current-repo-url")[0];
21
- input.value = e.target.href;
11
+ if (selected) {
12
+ dome.cn.add("active", selected);
13
+ var input = dome.byClass("gts-current-repo-url", element)[0];
14
+ input.value = selected.getAttribute("href").replace("ssh://", "");
22
15
  input.focus();
23
16
  }
24
- });
25
- };
17
+ }
18
+
19
+ function cloneUrlSelection(element) {
20
+ var input = element.getElementsByTagName("input")[0];
21
+
22
+ if (input) {
23
+ dome.on(input, "focus", function (e) { this.select(); });
24
+ }
25
+
26
+ dome.delegate.bycn("gts-repo-url", element, "click", function (e) {
27
+ e.preventDefault();
28
+ e.stopPropagation();
29
+ selectCloneUrl(element, e.target);
30
+ });
31
+ }
32
+
33
+ cloneUrlSelection.select = selectCloneUrl;
34
+ return cloneUrlSelection;
35
+ }());
@@ -0,0 +1,17 @@
1
+ /*global dome, gts*/
2
+
3
+ /**
4
+ * A very simplified version of bootstrap's collapse - toggles the "in" class on
5
+ * "collapse" elements when the associated trigger is clicked. Attaches a single
6
+ * click listener to the body.
7
+ */
8
+ this.gts.collapse = function () {
9
+ dome.on(document.body, "click", function (e) {
10
+ if (dome.data.get("toggle", e.target) !== "collapse") { return; }
11
+ var target = dome.id(dome.data.get("target", e.target).slice(1));
12
+ if (!target) { return; }
13
+ dome.cn[dome.cn.has("in", target) ? "rm" : "add"]("in", target);
14
+ e.preventDefault();
15
+ e.stopPropagation();
16
+ });
17
+ };
@@ -0,0 +1,111 @@
1
+ /*global cull, dome, gts*/
2
+ this.gts = this.gts || {};
3
+
4
+ /**
5
+ * Create, display and edit comments.
6
+ */
7
+ this.gts.comments = (function (el) {
8
+ function renderCommentDate(comment) {
9
+ var created = this.gts.timeago(el.span({ title: comment.createdAt }));
10
+ if (comment.createdAt === comment.updatedAt) { return created; }
11
+ return el.span([
12
+ created,
13
+ "(edited ",
14
+ this.gts.timeago(el.span({ title: comment.updatedAt })),
15
+ ")"
16
+ ]);
17
+ }
18
+
19
+ function renderEditForm(comment) {
20
+ console.log("Edit");
21
+ }
22
+
23
+ function renderEditLink(comment) {
24
+ if (!comment.editPath) { return ""; }
25
+ var link = el.a({
26
+ href: comment.editPath,
27
+ events: {
28
+ click: function (e) {
29
+ e.preventDefault();
30
+ e.stopPropagation();
31
+ renderEditForm(link.parentNode.parentNode);
32
+ }
33
+ }
34
+ }, "Edit comment");
35
+
36
+ return link;
37
+ }
38
+
39
+ /**
40
+ * Renders a comment object:
41
+ * {
42
+ * body: "string",
43
+ * createdAt: "YYYY-MM-DDTHH:MM:SS+HH:00",
44
+ * updatedAt: "YYYY-MM-DDTHH:MM:SS+HH:00",
45
+ * author: {
46
+ * avatarPath: "/some/path.png",
47
+ * profilePath: "/~user",
48
+ * name: "string",
49
+ * login: "string"
50
+ * },
51
+ * editPath: "/if/available/to/current/user"
52
+ * }
53
+ */
54
+ function renderComment(comment) {
55
+ var author = comment.author;
56
+ return el.div({ className: "gts-comment" }, [
57
+ el.p({ innerHTML: comment.body }),
58
+ el.p([
59
+ el.img({ src: author.avatarPath }),
60
+ el.a({ href: author.profilePath }, author.name),
61
+ renderCommentDate(comment),
62
+ renderEditLink(comment)
63
+ ])
64
+ ]);
65
+ }
66
+
67
+ function renderComments(comments, container) {
68
+ if (comments.length === 0) { return; }
69
+ container.style.display = "block";
70
+ var inner = document.createElement("div");
71
+ container.appendChild(inner);
72
+ dome.setContent(cull.map(renderComment, comments), inner);
73
+ }
74
+
75
+ function zeroPad(num) {
76
+ return num < 10 ? "0" + num : num;
77
+ }
78
+
79
+ /**
80
+ * Personalizes an existing form with a user.
81
+ * {
82
+ * name: "Christian Johansen",
83
+ * login: "christian",
84
+ * unreadMessageCount: 5,
85
+ * dashboardPath: "/",
86
+ * profilePath: "/~christian",
87
+ * editPath: "/~christian/edit",
88
+ * messagesPath: "/messages",
89
+ * logoutPath: "/logout",
90
+ * avatarPath: "/some/avatar.png"
91
+ * }
92
+ */
93
+ function personalizeForm(user, form) {
94
+ form.style.display = "block";
95
+ var ph = dome.byClass("gts-comment-author-ph", form)[0];
96
+ if (!ph) { return ph; }
97
+ var now = new Date();
98
+
99
+ return dome.replace(ph, el.p([
100
+ el.img({ src: user.avatarPath }),
101
+ el.a({ href: user.profilePath }, user.name),
102
+ " " + zeroPad(now.getHours()) + ":" + zeroPad(now.getMinutes())
103
+ ]));
104
+ }
105
+
106
+ return {
107
+ renderComments: renderComments,
108
+ renderComment: renderComment,
109
+ personalizeForm: personalizeForm
110
+ };
111
+ }(dome.el));
@@ -56,13 +56,15 @@ this.gts.dropdown = (function (D) {
56
56
  }
57
57
 
58
58
  D.on(element, "click", function (e) {
59
+ var target = e.target.tagName === "A" ? e.target : e.target.parentNode;
60
+ if (!dome.cn.has("dropdown-toggle", target)) { return; }
59
61
  toggle(this);
60
62
  e.preventDefault();
61
63
  e.stopPropagation();
62
64
  });
63
65
 
64
- D.on(document.documentElement, "click", close);
65
- D.on(document.documentElement, "keydown", function (e) {
66
+ D.on(document.body, "click", close);
67
+ D.on(document.body, "keydown", function (e) {
66
68
  if (e.keyCode !== 27) { return; }
67
69
  close();
68
70
  e.preventDefault();