dolt 0.16.0 → 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dolt (0.15.0)
4
+ dolt (0.17.0)
5
5
  json (~> 1.5)
6
- libdolt (~> 0.19)
6
+ libdolt (~> 0.20)
7
7
  main (~> 5.2)
8
8
  sinatra (~> 1.0)
9
9
  thin (~> 1.4)
@@ -20,7 +20,7 @@ GEM
20
20
  github-markup (0.7.5)
21
21
  htmlentities (4.3.1)
22
22
  json (1.8.0)
23
- libdolt (0.19.0)
23
+ libdolt (0.20.0)
24
24
  htmlentities (~> 4.3)
25
25
  json (~> 1.7)
26
26
  makeup (~> 0.2)
@@ -11,7 +11,7 @@ end
11
11
 
12
12
  Gem::Specification.new do |s|
13
13
  s.name = "dolt"
14
- s.version = "0.16.0"
14
+ s.version = "0.17.0"
15
15
  s.authors = ["Christian Johansen"]
16
16
  s.email = ["christian@gitorious.org"]
17
17
  s.homepage = "http://gitorious.org/gitorious/dolt"
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
20
20
 
21
21
  s.rubyforge_project = "dolt"
22
22
 
23
- s.add_dependency "libdolt", "~>0.19"
23
+ s.add_dependency "libdolt", "~>0.20"
24
24
  s.add_dependency "thin", "~>1.4"
25
25
  s.add_dependency "sinatra", "~>1.0"
26
26
  s.add_dependency "tiltout", "~>1.4"
@@ -19,3 +19,9 @@
19
19
  [submodule "js/lib/when"]
20
20
  path = js/lib/when
21
21
  url = https://github.com/cujojs/when.git
22
+ [submodule "js/lib/showdown"]
23
+ path = js/lib/showdown
24
+ url = https://github.com/coreyti/showdown.git
25
+ [submodule "js/lib/uinit"]
26
+ path = js/lib/uinit
27
+ url = https://git.gitorious.org/gitorious/uinit.git
@@ -4,24 +4,48 @@ mkdir -p dist
4
4
  # Minified and stripped CullJS production build
5
5
  cd js/lib/culljs
6
6
  npm install
7
- node build -m -s -n
8
- mv dist/cull.min.js ../../../dist/cull.min.js
7
+ node build -s -n
9
8
  cd ../../..
10
9
 
11
10
  # Minified and stripped Dome production build
12
11
  cd js/lib/dome
13
12
  npm install
14
- node build -m -s -n
15
- mv dist/dome.min.js ../../../dist/dome.min.js
13
+ node build -s -n
16
14
  cd ../../..
17
15
 
18
- # Spin.JS
19
- cp js/lib/spin.js/dist/spin.min.js dist/spin.min.js
16
+ # Combine 'em all
17
+ cat \
18
+ js/lib/culljs/dist/cull.js \
19
+ js/lib/dome/dist/dome.js \
20
+ js/lib/spin.js/spin.js \
21
+ js/lib/when/when.js \
22
+ js/lib/bane/lib/bane.js \
23
+ js/lib/reqwest/reqwest.js \
24
+ js/lib/uinit/lib/uinit.js \
25
+ js/lib/showdown/src/showdown.js | ./node_modules/.bin/uglifyjs > dist/gitorious3-dependencies.min.js
26
+
27
+ du -sh dist/gitorious3-dependencies.min.js
28
+
29
+ cat \
30
+ js/src/app.js \
31
+ js/src/components/dropdown.js \
32
+ js/src/components/ganalytics.js \
33
+ js/src/components/abbrev.js \
34
+ js/src/components/url.js \
35
+ js/src/components/ref-selector.js \
36
+ js/src/components/tree-history.js \
37
+ js/src/components/commit-linker.js \
38
+ js/src/components/user-repo-view-state.js \
39
+ js/src/components/profile-menu.js \
40
+ js/src/components/clone-url-selection.js \
41
+ js/src/components/blob.js \
42
+ js/src/components/live-markdown-preview.js \
43
+ js/src/gitorious.js | ./node_modules/.bin/uglifyjs > dist/gitorious3-modules.min.js
44
+
45
+ du -sh dist/gitorious3-modules.min.js
20
46
 
21
- # Combine it all
22
47
  cat \
23
- dist/cull.min.js \
24
- dist/dome.min.js \
25
- dist/spin.min.js > dist/gts-ui-deps.js
48
+ dist/gitorious3-dependencies.min.js \
49
+ dist/gitorious3-modules.min.js > dist/gitorious3.min.js
26
50
 
27
- du -sh dist/gts-ui-deps.js
51
+ du -sh dist/gitorious3.min.js
@@ -1,4 +1,4 @@
1
- @import "pygments.css";
1
+ @import "syntax-highlight.css";
2
2
 
3
3
  /**
4
4
  * Bootstrap tweaks
@@ -36,7 +36,7 @@ body .gts-masthead {
36
36
 
37
37
  .gts-logo {
38
38
  float: left;
39
- margin: 10px 10px 10px 0;
39
+ margin: -4px 20px 6px 0;
40
40
  }
41
41
 
42
42
  .gts-clone-source {
@@ -221,6 +221,11 @@ ul.gts-blob-view li {
221
221
  margin-top: -8px;
222
222
  }
223
223
 
224
+ /* Allocate as much space as possible to the commit column */
225
+ .gts-tree-explorer .gts-col-commit {
226
+ width: 80%;
227
+ }
228
+
224
229
  .gts-tree-explorer .icon {
225
230
  padding-right: 6px;
226
231
  }
@@ -259,6 +264,7 @@ ul.gts-blob-view li {
259
264
  }
260
265
 
261
266
  input[type=url].gts-current-repo-url {
267
+ float: left;
262
268
  left: -2px;
263
269
  padding-left: 6px;
264
270
  position: relative;
@@ -559,10 +565,6 @@ input[type=url].gts-current-repo-url {
559
565
  margin: -20px 0 27px;
560
566
  }
561
567
 
562
- .gts-col-commit {
563
- width: 50em;
564
- }
565
-
566
568
  .gts-ref-input,
567
569
  input[type=text].gts-ref-input {
568
570
  border: none;
@@ -119,11 +119,18 @@ ol.linenums li {
119
119
  .nl { color: #a0a000; } /* Name.Label */
120
120
  .w { color: #bbb; } /* Text.Whitespace */
121
121
 
122
+ /* Regions marked over the URL */
123
+ ol.linenums li.region .line {
124
+ background: #ffd;
125
+ }
126
+
122
127
  /* Mouseover */
123
128
  ol.linenums li.focus {
124
129
  color: #48484e;
130
+ border-right: 1px solid #e1e1e8;
125
131
  }
126
132
 
133
+ .linenums li.region .line,
127
134
  ol.linenums li.focus .line {
128
135
  background: #ffc;
129
136
  margin-left: -60px;
@@ -0,0 +1 @@
1
+ .prettyprint{background-color:#f7f7f9;border:1px solid #e1e1e8;padding:8px}.gts-file .prettyprint{background:#fefefe}.prettyprint.linenums{box-shadow:47px 0 0 #fbfbfc inset,48px 0 0 #ececf0 inset}ol.linenums{margin:0 0 0 40px}ol.linenums li{color:#bebec5;line-height:18px;padding-left:12px;text-shadow:0 1px 0 #fff}.linenums .line{display:block;min-height:18px}.c,.cm,.c1,.cs{color:#93a1a1}.k,.kc,.kd,.kn,.kr,.kp,.nb,.sx,.bp{color:#1e347b}.nc,.nn,.nf,.no{color:#dc322f}.s,.sb,.sc,.sd,.s2,.sh,.s1,.se,.si{color:#d14}.nt,.m,.mf,.mh,.mi,.mo,.il,.vi,.ow,.na,.n,.nx,.p,.line{color:#48484c}.vc,.vg,.nv{color:#a74e4c}.ss,.sr,.cp{color:#bc7a00}.sd{font-style:italic}.vi,.k,.kc,.kd,.kn,.kr,.nt,.nc,.nn,.no,.nb,.nf,.ow,.si{font-weight:bold}.html-erb .cp{color:#48484c}.common-lisp .nv{color:#48484c}.hll{background-color:#ffc}.err{border:1px solid #f00}.o{color:#666}.gd{color:#a00000}.ge{font-style:italic}.gr{color:#f00}.gh{color:#000080;font-weight:bold}.gi{color:#00a000}.go{color:#888}.gp{color:#000080;font-weight:bold}.gs{font-weight:bold}.gu{color:#800080;font-weight:bold}.gt{color:#04d}.kt{color:#b00040}.nd{color:#a2f}.ni{color:#999;font-weight:bold}.ne{color:#d2413a;font-weight:bold}.nl{color:#a0a000}.w{color:#bbb}ol.linenums li.region .line{background:#ffd}ol.linenums li.focus{color:#48484e;border-right:1px solid #e1e1e8}.linenums li.region .line,ol.linenums li.focus .line{background:#ffc;margin-left:-60px;padding-left:60px;margin-right:-8px;padding-right:8px}.container,.navbar-fixed-top .container,.navbar-fixed-bottom .container{max-width:940px}body h1{margin-bottom:.25em}body .gts-masthead{margin-bottom:0}.gts-masthead .navbar-inner{border-radius:0;background-image:-moz-linear-gradient(center top,#201e1e,#222);background-color:#201e1e}.gts-masthead .container{padding-bottom:8px;padding-top:20px}.gts-logo{float:left;margin:-4px 20px 6px 0}.gts-clone-source{margin-left:30px}.gts-masthead .navbar-inner .btn-group{padding-right:0}.gts-repo-header{background:#f5f5f5;border-bottom:1px solid #ddd;margin-bottom:20px;padding:20px 0 0}tt{font-family:Menlo,Monaco,Consolas,"Courier New",monospace}.gts-private .gts-repo-header{background:url(../images/f5f5f5-980x1.png?jcb=1349199357) repeat-y 50% 0 #222;border-bottom:0}.gts-new-repo{padding-bottom:40px}.gts-repo-header+.footer{margin-top:-21px}.gts-notification{background:#fff;border-bottom:1px solid #ddd;padding:20px 0 0}.gts-repo-header .nav-tabs{margin-bottom:-1px}.nav-tabs .dropdown-menu{margin-top:-1px}.dropdown-label{border-radius:5px 5px 0 0;-moz-border-radius:5px 5px 0 0;margin-top:-5px;overflow:hidden}.dropdown-label strong{background:#f5f5f5;border-bottom:1px solid #ccc;border-top:1px solid #ccc;display:block;padding:3px 15px}li+.dropdown-label{border-radius:0;margin-top:12px}.dropdown-toggle em{font-style:normal;color:#48484c}.open .dropdown-toggle em{color:#000}.gts-repo-header .row,.gts-description{margin-bottom:10px}.gts-repo-header .gts-help{clear:both;margin-bottom:0}.gts-repo-header .gts-branch-selector+.gts-branch-selector{padding-left:0}.gts-branch-selector .disabled{color:#999}.gts-branch-selector{margin:0 12px 12px 0;position:relative;z-index:1}.gts-browser .gts-branch-selector{margin-top:8px}.gts-file{margin-bottom:12px}.gts-file h1{margin:12px 0}.gts-download{padding-right:12px}.gts-file .breadcrumb{margin:0 0 -2px;position:relative}.gts-inline{display:inline-block;line-height:1;padding-right:12px;vertical-align:middle}.gts-markup{font-size:1.1em;line-height:1.5}.gts-markup h1{margin-top:1em}.gts-markup h1,.gts-markup h2,.gts-markup h3,.gts-markup h4,.gts-markup h5,.gts-markup h6{margin-bottom:.25em}.gts-markup p,.gts-markup ul,.gts-markup ol,.gts-markup pre{margin-bottom:1em}.prettyprint ol.linenums{margin-bottom:0}.table td ul{margin-left:15px}.gts-blob-view{margin-right:12px;margin-top:8px;min-height:21px;position:relative;z-index:1}ul.gts-blob-view li{display:inline-block;padding:0 6px}.gts-tree-explorer{margin-top:-8px}.gts-tree-explorer .gts-col-commit{width:80%}.gts-tree-explorer .icon{padding-right:6px}.gts-tree-explorer .gts-name{white-space:nowrap}.gts-tree-explorer .gts-commit-oid{padding-right:0}.gts-private{background:url(../images/white-980x1.png?jcb=1349199357) repeat-y 50% 0 #222}.gts-private .gts-repo-header .container{background-image:url(../iconic/lock_stroke.svg?jcb=1349199357);background-repeat:no-repeat;background-position:100% 0}.gts-repo-url{position:relative;z-index:1}.gts-repo-url .url{display:none}input[type=url].gts-current-repo-url{float:left;left:-2px;padding-left:6px;position:relative;z-index:0}.gts-repo-urls button.gts-repo-url-help{float:right;margin-left:-4px}.gts-body{margin-bottom:35px}.gts-date-heading{background-color:#f7f7f9;border-bottom:1px solid #e1e1e8;clear:both;font-weight:bold}.gts-date-heading-inner{background-color:#f7f7f9;border-bottom:1px solid #fff;color:#333;display:block;padding:4px 8px;text-shadow:0 1px 0 #fff}.gts-avatar{margin:0 6px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.gts-comment-summary{color:#48484c;padding-left:10px}.gts-log-message{font-size:1.2em}.gts-commit{padding:6px 6px 8px}.gts-commit+.gts-commit{border-top:1px solid #e1e1e8;padding-top:12px}.gts-commit .gts-avatar{margin-left:0}.gts-commit-linker .gts-commit-oid{color:#08c;cursor:pointer}.gts-commit-linker .gts-commit-oid:hover{color:#005580;text-decoration:underline}.footer{border-top:1px solid #e5e5e5;margin-top:45px}.footer .container{padding:20px 0}.gts-private .footer{border-color:#222}.gts-footer-blurb{border-top:1px solid #f5f5f5;margin-top:12px;padding-top:12px}.capillary p{white-space:normal}.capillary li{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.capillary .ref-name{background:#ddd;color:#4e4e4e;border-radius:4px;display:inline-block;margin:0 5px 0 0;padding:0 5px}.capillary .ref-type-tag{background:#eeb}.capillary a.ref-name:hover{text-decoration:underline}.capillary li .msg{color:#48484c}.capillary li a:hover{text-decoration:underline}.capillary{margin-left:-10px}.gts-code-listing{border:1px solid #e1e1e8;position:relative;top:-5px;width:100%}.gts-code-listing tr:first-child td{padding-top:6px}.gts-code-listing tr:last-child td{padding-bottom:6px}.gts-code-listing td{padding:0;vertical-align:top}.gts-code-listing .gts-code{background:#fefefe}.gts-code-listing code{background:transparent;border:0;color:#48484c;display:block;line-height:18px;min-height:18px;padding:0 0 0 12px;white-space:pre-wrap}.gts-code-listing .linenum{background-color:#f7f7f9;border:1px solid #e1e1e8;color:#bebec5;padding:0 12px;text-align:right;text-shadow:0 1px 0 #fff;width:10px}.gts-code-listing .gts-commit-oid{font-family:Menlo,Monaco,Consolas,"Courier New",monospace}.gts-code-listing .gts-annotated{border-top:1px solid #e1e1e8}.gts-code-listing .gts-blame-annotation{white-space:nowrap;background:#f0f0f0;padding-left:12px;padding-right:12px}.gts-code-listing .line{white-space:nowrap}.gts-code-listing .gts-diff-rm .gts-code{background:#fdd}.gts-code-listing del{background:#f2acad;text-decoration:none}.gts-diff-summary .gts-diff-rm{color:#9d261d}.gts-code-listing .gts-diff-add .gts-code{background:#dfd}.gts-code-listing ins{background:#bafbad;text-decoration:none}.gts-diff-summary .gts-diff-add{color:#46a546}.gts-diff-summary .gts-diff-rm,.gts-diff-summary .gts-diff-add{font-weight:bold}.gts-diffs h1{margin-bottom:18px}.gts-commit blockquote p{margin-bottom:12px}.gts-commit-sha1{float:left;font-size:13px;line-height:18px}.gts-commit-parent{float:right}.gts-commit h1{clear:both}.gts-side-by-side .gts-code{width:50%}.gts-commit-summary{margin-bottom:12px}.gts-comment{padding-top:8px;margin-bottom:12px}.gts-comment+.gts-comment{border-top:1px solid #e5e5e5}.gts-bordered-row{background:#f5f5f5;border-bottom:1px solid #e5e5e5;border-top:1px solid #e5e5e5;padding:8px}.form-horizontal div.gts-markdown-preview{margin:-12px 160px 24px}.gts-help .table{width:auto}.gts-item-author,.gts-item-status,.gts-item-age{white-space:nowrap}.form-horizontal legend+p{margin:-20px 0 27px}.gts-ref-input,input[type=text].gts-ref-input{border:0;border-radius:0;-moz-border-radius:0;box-shadow:0;display:inline;height:18px;margin:0;padding:1px 4px 3px;position:relative;top:0;width:10em}.gts-branch-selector .dropdown-menu{min-width:246px}.gts-dropdown-input{border-radius:5px 5px 0 0;-moz-border-radius:5px 5px 0 0;margin-top:-5px;overflow:hidden}.gts-dropdown-input strong{background:#f5f5f5;border-bottom:1px solid #ccc;border-top:1px solid #ccc;display:block;padding:0 15px}.gts-dropdown-input+.dropdown-label{margin-top:-1px}.gts-commit-date{white-space:nowrap}.table td.gts-commit-oid{width:1em}.gts-markup code{border:0;color:inherit;font-size:.9em;padding:2px}.gts-markup pre code{font-size:inherit}.gts-readme{background-color:#fff;border:1px solid #e3e3e3;border-radius:4px 4px 4px 4px;box-shadow:0 1px 1px rgba(0,0,0,0.05) inset;margin-bottom:20px;min-height:20px;padding:19px}.gts-readme .gts-page-header{background-color:#f5f5f5;border-radius:4px 0 0 4px;margin:-19px -19px 10px -19px;padding:10px 20px 10px 20px}
@@ -0,0 +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,i){e.emit("loading",r);var s=n(t,r.depends||[]),o=when.defer();return when.all(s).then(function(t){var n=(i?[i]:[]).concat(t);try{var s=r.action.apply(null,n);if(s||r.nullable)r.loaded=!0,r.result=s,e.emit("loaded",r,s)}catch(u){e.emit("error",r,u)}o.resolve()},function(t){e.emit("error",r,t),o.resolve()}),o.promise}function i(t,n){var i=e.partial(r,t,t.features,n);return n.elements?when.all(e.map(i,dome.byClass(n.elements,t.context))):i()}function s(e,n){return!n.lazy&&!n.loaded&&n.action&&t(e,n)}function o(e){return e&&e.lazy&&!e.loaded}function u(t,n){var r=function(e){return t[e]};return e.uniq(e.reduce(function(t,n){return t.concat(e.select(o,e.map(r,n.depends||[])))},[],n))}function a(t,n){return e.doall(function(t){e.doall(function(e){t[e]=n[e]},e.keys(n))},t)}function f(e){return a(e,{lazy:!1,wasLazy:!0})}function l(t){e.doall(function(e){e.action&&(e.loaded=!1),e.wasLazy&&(delete e.wasLazy,e.lazy=!0)},t)}function c(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},n))}function h(t,n){function l(){var r=e.first(o,a);if(!r)return c(t,n);i(t,r).then(function(){if(!r.loaded){var t=e.indexOf(r,a);a=a.slice(0,t).concat(a.slice(t+1))}l()})}var r=f(u(t.features,n)),o=e.partial(s,t.features),a=e.uniq(r.concat(n));l()}function p(e,t){if(e[t])throw new Error("Cannot add duplicate "+t)}function v(){return e.map(function(e){return d.features[e]||{name:e,type:"Unknown"}},this.depends||[])}function m(e,t){t.hasOwnProperty("nullable")||(t.nullable=!0),t.dependencies=v,e.features[t.name]=t,e.tryPending()}function g(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 y(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}var e=cull,d;return d=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||p(this.features,e),this.env[e]=t,m(this,{name:e,result:t,loaded:!0});if(n&&this.loaded){var r=g([e],this.features);l(r),h(this,r)}},data:function(e,t,n){var r=y(e,t,n);return p(this.features,r.name),typeof r.lazy!="boolean"&&(r.lazy=!0),typeof r.nullable!="boolean"&&(r.nullable=!1),m(this,r)},feature:function(e,t,n){var r=y(e,t,n);p(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+")");m(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&&l(e.values(this.features)),this.loaded=!0,this.context=t,this.tryPending()},tryPending:function(){if(!this.loaded)return;this.emit("init"),h(this,e.values(this.features))}}),d};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=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=
2
+ 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
+ function refUrlTpl(e,t){return gts.url.templatize(e,{ref:t})}this.gts=this.gts||{},this.gts.app=this.uinit(),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();"ontouchstart"in document.documentElement&&(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)};var gts=this.gts||{};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){return n.push(e.li(e.a({href:t(i,r[1])},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){for(var 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.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.blob=function(){function e(e,t,n){var r=function(){dome.cn.add("focus",this)},i=function(){dome.cn.rm("focus",this)};cull.doall(function(e){dome.on(e,"mouseenter",r),dome.on(e,"mouseleave",i)},e.getElementsByTagName("li"))}function t(e){var t=e.match(/\#l(\d+)(?:-(\d+))?/i);if(!t)return;var n=Math.min(t[2]||t[1],t[1]),r=Math.max(t[2]||t[1],t[1]);return[n,r]}function n(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"))}return{highlightLineOnFocus:e,regionFromUrl:t,highlightRegion:n}}(),this.gts.liveMarkdownPreview=function(t){function u(e){return e<10?"0"+e:e}function a(){var e=new Date;return'<p><img width="24" height="24" class="gts-avatar" alt="avatar" src="http://cageme.herokuapp.com/24/24?'+o+'">'+'<a href="/~zmalltalker">Marius Mathiesen</a>'+u(e.getHours())+":"+u(e.getMinutes())+'. <a href="#">Edit comment</a></p>'}function f(e){n.style.display=e?"block":"none",n.getElementsByTagName("div")[0].innerHTML=e}function l(){s=t.value,s!==i&&(i=s,f(r.makeHtml(s))),setTimeout(l,20)}var n=document.getElementById(t.getAttribute("data-gts-preview-target"));if(!n||typeof Showdown=="undefined")return;var r=new Showdown.converter,i,s,o=(new Date).getTime();l()},this.gts.loadRefs=function(e){return reqwest({url:e,type:"json"})},gts.app.env("url",window.location.href),gts.app.env("redirect",function(e){window.location=e}),"onpopstate"in window&&(window.onpopstate=function(e){gts.app.env("url",window.location.href)}),gts.app.data("current-ref",gts.url.currentRef,{depends:["url"]}),gts.app.data("ref-url-template",refUrlTpl,{depends:["url","current-ref"]}),gts.app.data("repository-refs",gts.loadRefs,{depends:["repository-refs-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("highlight-line-mouseover",gts.blob.highlightLineOnFocus,{elements:["gts-lines"]}),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,345 +1,3 @@
1
- /*global gts, dome, cull, bane, when*/
1
+ // Set up a global, shared app instance
2
2
  this.gts = this.gts || {};
3
-
4
- /**
5
- * An "app" is a mechanism for configuring "features"/UI components that should
6
- * launch on page load and possibly also at later times. A "feature" is simply a
7
- * function that may depend on an element, some data from the network and/or
8
- * local variables. The app defines an API for adding such features, and
9
- * provides a simple mechanism for them to declaratively state their
10
- * dependencies.
11
- *
12
- * The app also has a mechanism for processing errors, logging debug information
13
- * and reloading the features if e.g. parts of the page has been
14
- * modified/reloaded.
15
- *
16
- * Environment variables
17
- *
18
- * Environment variables can be set by anyone at any time. This is typically
19
- * useful whenever a server-side HTML template needs to inject some data into
20
- * the client-side scripts, e.g.:
21
- *
22
- * <script>appInstance.env("ip_addr", "192.168.0.1");</script>
23
- *
24
- * Features can list environment variables as dependencies.
25
- *
26
- * Data
27
- *
28
- * Some features may require access to data that is not immediately present in
29
- * the page. The typical example is data fetched via XMLHttpRequest, but 'data'
30
- * is by no means restricted to that.
31
- *
32
- * Data is registered with a name and a function. The function will only ever be
33
- * called if a task depends on it via its name. The function may either return
34
- * some data directly, or return a promise. If it throws an error, or the
35
- * returned promise rejects, the error will be passed on to the app's failure
36
- * listeners. When the returned promise resolves, the result is passed to any
37
- * features waiting for the data. Data may also have dependencies (e.g. on
38
- * certain variables or other, see "Feature" below).
39
- *
40
- * Feature
41
- *
42
- * A "feature" is a function to be called on page load, and possibly also at a
43
- * later point (e.g. if parts of the page has been rebuilt). Features may
44
- * depend on specific elements to be available, data and environment variables.
45
- * A feature may also have additional data provided as input for when it is
46
- * called (if dependencies are resolved).
47
- *
48
- * Events
49
- *
50
- * The app emits the following events:
51
- *
52
- * "loading" (name)
53
- *
54
- * When a feature's dependencies are satiesfied, it is scheduled for loading. At
55
- * this point some of the feature's input may still be unresolved (if any of it
56
- * is the result of asynchronous operations). At this point, the feature may
57
- * still fail to load, if asynchronous dependencies fail to materialize.
58
- *
59
- * "loaded" (name[, args...])
60
- *
61
- * When a feature has successfully materialized (i.e. the returned promise
62
- * resolved, or it didn't return a promise). If a feature depends on multiple
63
- * elements, this event will be emitted once per element.
64
- *
65
- * "pending" (name)
66
- *
67
- * A feature's dependencies were not satiesfied, thus it was not loaded. To
68
- * investigate why the feature did not load, use the app object:
69
- *
70
- * app.on("pending", function (name) {
71
- * app.dependencies(name); // [{ name: "A", loaded: false }, ...]
72
- * });
73
- *
74
- * "error" (error)
75
- *
76
- * When errors occur, or promises are rejected as the app is loading features.
77
- */
78
- this.gts.app = function () {
79
- var C = cull;
80
-
81
- /**
82
- * Check if `feature` has all its dependencies satiesfied in the `features`
83
- * object (which uses feature/dependency names as keys, feature descriptions
84
- * as values).
85
- */
86
- function dependenciesSatiesfied(features, feature) {
87
- return C.reduce(function (satiesfied, dep) {
88
- return satiesfied && features[dep] && features[dep].loaded;
89
- }, true, feature.depends || []);
90
- }
91
-
92
- /**
93
- * Return an array of "results" (return-values and/or resolved values from
94
- * returned promises) of the features listed in `dependencies`.
95
- */
96
- function dependencyResults(features, deps) {
97
- return C.map(function (dep) { return features[dep].result; }, deps);
98
- }
99
-
100
- /**
101
- * Mark the feature as loaded and load it when all arguments have
102
- * materialized.
103
- */
104
- function loadFeature(features, feature, element) {
105
- var args = dependencyResults(features, feature.depends || []);
106
- feature.loaded = true;
107
- var deferred = when.defer();
108
- feature.result = deferred.promise;
109
- when.all(args).then(function (materialized) {
110
- var allArgs = (element ? [element] : []).concat(materialized);
111
- deferred.resolve(feature.action.apply(null, allArgs));
112
- });
113
- }
114
-
115
- /**
116
- * Attempt to load a feature in a given context. If the feature depends on
117
- * elements, it will not be load if the provided context does not contain any
118
- * matching elements.
119
- */
120
- function tryFeatureInContext(features, feature, context) {
121
- var load = C.partial(loadFeature, features, feature);
122
- if (feature.elements) {
123
- C.doall(load, dome.byClass(feature.elements, context));
124
- } else {
125
- load();
126
- }
127
- }
128
-
129
- /**
130
- * When trying to load features, this function is used to determine if a
131
- * feature is ready to be proactively loaded (and has not already been
132
- * loaded).
133
- */
134
- function isReady(features, feature) {
135
- return !feature.lazy &&
136
- !feature.loaded &&
137
- feature.action &&
138
- dependenciesSatiesfied(features, feature);
139
- }
140
-
141
- /** Returns true if the feature is both pending (not loaded) and lazy */
142
- function pendingLazy(feature) {
143
- return feature && feature.lazy && !feature.loaded;
144
- };
145
-
146
- /**
147
- * For all the features in `featureArr`, find the unique set of dependencies
148
- * that are both pending and lazy.
149
- */
150
- function lazyDependencies(features, featureArr) {
151
- var getDep = function (dep) { return features[dep]; };
152
- return C.uniq(C.reduce(function (lazy, feature) {
153
- return lazy.concat(C.select(
154
- pendingLazy,
155
- C.map(getDep, feature.depends || [])
156
- ));
157
- }, [], featureArr));
158
- }
159
-
160
- /** Set properties on all objects in the collection */
161
- function setAll(objects, props) {
162
- return C.doall(function (object) {
163
- C.doall(function (prop) {
164
- object[prop] = props[prop];
165
- }, C.keys(props));
166
- }, objects);
167
- }
168
-
169
- /** Temporarily mark a set of features as eager (i.e. not lazy) */
170
- function makeEager(features) {
171
- return setAll(features, { lazy: false, wasLazy: true });
172
- }
173
-
174
- /**
175
- * Reset the state of features: Revert temporarily eager ones, and mark
176
- * loaded features as not loaded so they can be considered for loading again
177
- * (used for consecutive calls to load()).
178
- */
179
- function reset(features) {
180
- C.doall(function (feature) {
181
- // Environment variables don't have actions, they're always loaded
182
- if (feature.action) { feature.loaded = false; }
183
- if (feature.wasLazy) {
184
- delete feature.wasLazy;
185
- feature.lazy = true;
186
- }
187
- }, C.values(features));
188
- }
189
-
190
- /**
191
- * Keep trying to load features until there are no more features ready to
192
- * load. When one feature is enabled we start from the top again as that
193
- * may have enabled features that were previously not ready.
194
- */
195
- function tryFeatures(app, features, context) {
196
- var idx, feature, featureArr = C.values(features);
197
- var deps = makeEager(lazyDependencies(features, featureArr));
198
- var isReadyToLoad = C.partial(isReady, features);
199
- var toTry = deps.concat(featureArr);
200
-
201
- while ((feature = C.first(isReadyToLoad, toTry))) {
202
- app.emit("loading", feature);
203
- tryFeatureInContext(features, feature, context);
204
- // If the feature is not loaded after trying, it's depending on
205
- // elements, but no matching elements were found. Ignore this
206
- // feature for now, re-evaluate during the next pass.
207
- if (!feature.loaded) {
208
- idx = C.indexOf(feature, toTry);
209
- toTry = toTry.slice(0, idx).concat(toTry.slice(idx + 1));
210
- }
211
- }
212
- }
213
-
214
- function ensureUnique(features, name) {
215
- if (features[name]) {
216
- throw new Error("Cannot add duplicate " + name);
217
- }
218
- }
219
-
220
- var appInstance;
221
-
222
- function getDependencies() {
223
- return cull.map(function (depName) {
224
- return appInstance.features[depName] || {
225
- name: depName,
226
- type: "Unknown"
227
- };
228
- }, this.depends || []);
229
- }
230
-
231
- appInstance = bane.createEventEmitter({
232
- features: {},
233
-
234
- /**
235
- * Set environment data. Values are not specially treated and can be
236
- * anything. If the app has been loaded, setting an environment variable
237
- * will result in trying to load pending features.
238
- */
239
- env: function (name, value) {
240
- // ensureUnique(this.features, name);
241
- this.env[name] = value;
242
- this.feature(name, undefined, { result: value, loaded: true });
243
- // this.features[name] = createFeature({ result: value, loaded: true });
244
- // this.tryPending();
245
- },
246
-
247
- /**
248
- * The data function may return a promise. If there are no tasks that
249
- * depend on this piece of data, the function will never be called. It
250
- * is possible to express dependencies for data - see lazy features
251
- * below.
252
- */
253
- data: function (name, fn, opt) {
254
- var options = opt || {};
255
- if (typeof options.lazy !== "boolean") {
256
- options.lazy = true;
257
- }
258
- return this.feature(name, fn, options);
259
- },
260
-
261
- /**
262
- * Register a feature. Features may depend on environment variables,
263
- * data, and even other features. Additionally, features may depend on
264
- * DOM elements. DOM elements can only be selected by a single class
265
- * name. If the class name matches no elements, the feature will not be
266
- * called. Otherwise, the feature is called once for each element, like
267
- * so:
268
- *
269
- * feature(element[, dependencies][, options]);
270
- *
271
- * Given the following feature:
272
- *
273
- * appInstance.feature("tweetui", loadTweets, {
274
- * elements: "tweet-placeholder",
275
- * depends: ["account", "tweets"]
276
- * });
277
- *
278
- * Where "account" is an environment variable and "tweets" is a data
279
- * event, the function will eventually be called like this:
280
- *
281
- * loadTweets(element1, accountValue, tweetsData);
282
- * loadTweets(element2, accountValue, tweetsData);
283
- * // ...
284
- *
285
- * If depending on another feature, its return-value will be the input.
286
- * If the feature in question returned a promise, the resolution will be
287
- * passed as input (after that feature has resolved).
288
- *
289
- * A feature may be "lazy", in which case it is only loaded if another
290
- * feature depends on it. Data events are just lazy features, e.g.:
291
- *
292
- * appInstance.feature("tweets", function () {
293
- * return reqwest({ url: "/tweets" });
294
- * }, { lazy: true });
295
- *
296
- * Is equivalent to:
297
- *
298
- * appInstance.data("tweets", function () {
299
- * return reqwest({ url: "/tweets" });
300
- * });
301
- *
302
- * The `name` can be any string.
303
- */
304
- feature: function (name, fn, opt) {
305
- ensureUnique(this.features, name);
306
- var feature = opt || {};
307
- feature.name = name;
308
- feature.action = fn;
309
- this.features[name] = feature;
310
- this.features[name].dependencies = getDependencies;
311
- this.tryPending();
312
- },
313
-
314
- /**
315
- * Load the app. This function may be called multiple times. It
316
- * optionally accepts a DOM element to use as its root. If it is not
317
- * provided, the document itself is used as the root.
318
- */
319
- load: function (context) {
320
- if (this.loaded) { reset(this.features); }
321
- this.loaded = true;
322
- this.context = context;
323
- this.tryPending();
324
- },
325
-
326
- /**
327
- * After loading the app, some features may still not be loaded if the
328
- * elements they depend on are not available. `tryPending` retries all
329
- * those features. If you call app.load(context) and then modify the DOM
330
- * within the context element you may want to call this to ensure your
331
- * modified elements are considered for pending features.
332
- *
333
- * If you want already loaded features to reload for newly added
334
- * elements/changed DOM structure you need to call load() over again.
335
- *
336
- * If app is not loaded, this method does nothing.
337
- */
338
- tryPending: function () {
339
- if (!this.loaded) { return; }
340
- tryFeatures(this, this.features, this.context);
341
- }
342
- });
343
-
344
- return appInstance;
345
- };
3
+ this.gts.app = this.uinit();