Skip to content

Instantly share code, notes, and snippets.

@dangerous
Created October 10, 2012 01:45
Show Gist options
  • Save dangerous/3862654 to your computer and use it in GitHub Desktop.
Save dangerous/3862654 to your computer and use it in GitHub Desktop.
(function(){var a,b,c,d;if(typeof $=="undefined"||$===null)return;d=!1,b=function(){d=!0},a=function(){d=!1},"onpagehide"in window?($(window).on("pageshow",a),$(window).on("pagehide",b)):($(window).on("load",a),$(window).on("beforeunload",b),$(window).on("unload",b)),c=function(){return $.browser!=null&&($.browser.webkit||$.browser.opera||$.browser.msie&&parseInt($.browser.version)>=8||$.browser.mozilla&&parseInt($.browser.version)>=4)&&$.browser.version!=null&&$.browser.version!=="0"}();if(!c)return;window.onerror=function(a,b,c){var e,f;if(d||!c)return;if(b!=null?!b.match(/assets.github.com|github.dev/):!void 0)return;e={message:a,filename:b,lineno:c,url:window.location.href,readyState:document.readyState,referrer:document.referrer,browser:$.browser},$.ajax({type:"POST",url:"/errors",data:{error:e}}),(f=window.errors)==null&&(window.errors=[]),window.errors.push(e)},window.location.hash==="#b00m"&&b00m()}).call(this),function(){var a,b,c;b=function(){function a(a){this.namespace=a,this.stats=[],this.flushTimer=null}return a.prototype.increment=function(a,b){return b==null&&(b=1),this.namespace&&(a=""+this.namespace+"."+a),this.stats.push({metric:a,type:"increment",count:b}),this.queueFlush()},a.prototype.timing=function(a,b){if(b<0)return;return this.namespace&&(a=""+this.namespace+"."+a),this.stats.push({metric:a,type:"timing",ms:b}),this.queueFlush()},a.prototype.gauge=function(a,b){return this.namespace&&(a=""+this.namespace+"."+a),this.stats.push({metric:a,type:"gauge",value:b}),this.queueFlush()},a.prototype.queueFlush=function(){var a=this;return this.flushTimer&&clearTimeout(this.flushTimer),this.flushTimer=setTimeout(function(){return a.flush()},2e3)},a.prototype.flush=function(){var a,b;a=$(document.body);if(this.stats.length&&a.hasClass("env-production")&&!a.hasClass("enterprise"))return b=this.stats,this.stats=[],$.ajax({url:"/_stats",type:"POST",data:JSON.stringify(b),contentType:"application/json; charset=utf-8",dataType:"json"})},a}(),a=new b("github.browser"),typeof window!="undefined"&&window!==null&&(window.$stats=a);if(typeof $=="undefined"||$===null)return;window.performance||(c="onpagehide"in window?"pagehide":"unload",$(window).on(c,function(){window.name=JSON.stringify((new Date).getTime())})),$(function(){var b,c;if(window.performance)return b=window.performance.timing,b.navigationStart&&a.timing("performance.navigation",(new Date).getTime()-b.navigationStart),b.secureConnectionStart&&b.connectStart&&a.timing("performance.ssl",b.secureConnectionStart-b.connectStart),b.connectEnd&&b.connectStart&&(b.secureConnectionStart?a.timing("performance.tcp",b.connectEnd-b.secureConnectionStart):a.timing("performance.tcp",b.connectEnd-b.connectStart)),b.domainLookupStart!==b.domainLookupEnd&&a.timing("performance.dns",b.domainLookupEnd-b.domainLookupStart),b.requestStart&&b.responseStart&&b.responseEnd&&(a.timing("performance.request",b.responseStart-b.requestStart),a.timing("performance.response",b.responseEnd-b.responseStart)),$(window).bind("load",function(){b.domContentLoadedEventEnd&&b.domLoading&&a.timing("performance.DOMContentLoaded",b.domContentLoadedEventEnd-b.domLoading),b.domComplete&&b.domLoading&&a.timing("performance.load",b.domComplete-b.domLoading);if(b.domInteractive&&b.domLoading)return a.timing("performance.interactive",b.domInteractive-b.domLoading)});if(window.name&&window.name.match(/^\d+$/)){try{c=JSON.parse(window.name),a.timing("pageload",(new Date).getTime()-c)}catch(d){}return window.name=""}})}.call(this),function(){if(navigator.userAgent.match("Propane"))return;top!=window&&(alert("For security reasons, framing is not allowed."),top.location.replace(document.location))}.call(this),function(){}.call(this),function(){(typeof Zepto=="undefined"||Zepto===null)&&$.ajaxSetup({beforeSend:function(a,b){var c,d;if(!b.global)return;return c=b.context||document,d=$.Event("ajaxBeforeSend"),$(c).trigger(d,[a,b]),d.isDefaultPrevented()?!1:d.result}})}.call(this),function(){var a,b,c,d,e;typeof Zepto!="undefined"&&Zepto!==null?(a=function(a){var b,c,d,e;c=document.createEvent("Events");for(d in a)e=a[d],c[d]=e;return c.initEvent(""+a.type+":prepare",!0,!0),b=function(b,d){return function(){return b.apply(a),d.apply(c)}},c.preventDefault=b(a.preventDefault,c.preventDefault),c.stopPropagation=b(a.stopPropagation,c.stopPropagation),c.stopImmediatePropagation=b(a.stopImmediatePropagation,c.stopImmediatePropagation),a.target.dispatchEvent(c),c.result},window.addEventListener("click",a,!0),window.addEventListener("submit",a,!0)):(b=null,c=function(a){var c;a.timeStamp!==b&&(c=a.type,a.type=""+c+":prepare",$.event.trigger(a,[],a.target,!1),a.type=c,b=a.timeStamp)},d=function(a){return function(){$(this).on(""+a+".prepare",function(){})}},e=function(a){return function(){$(this).off(""+a+".prepare",function(){})}},$.event.special.click={preDispatch:c},$.event.special.submit={preDispatch:c},$.event.special["click:prepare"]={setup:d("click"),teardown:e("click")},$.event.special["submit:pr...||0,j=a.milliseconds||a.ms||0;this._milliseconds=j+i*1e3+h*6e4+g*36e5,this._days=f+e*7,this._months=d+c*12,b.milliseconds=j%1e3,i+=I(j/1e3),b.seconds=i%60,h+=I(i/60),b.minutes=h%60,g+=I(h/60),b.hours=g%24,f+=I(g/24),f+=e*7,b.days=f%30,d+=I(f/30),b.months=d%12,c+=I(d/12),b.years=c,this._lang=!1}function I(a){return a<0?Math.ceil(a):Math.floor(a)}function J(a,b){var c=a+"";while(c.length<b)c="0"+c;return c}function K(a,b,c){var d=b._milliseconds,e=b._days,f=b._months,g;d&&a._d.setTime(+a+d*c),e&&a.date(a.date()+e*c),f&&(g=a.date(),a.date(1).month(a.month()+f*c).date(Math.min(g,a.daysInMonth())))}function L(a){return Object.prototype.toString.call(a)==="[object Array]"}function M(a,b){var c=Math.min(a.length,b.length),d=Math.abs(a.length-b.length),e=0,f;for(f=0;f<c;f++)~~a[f]!==~~b[f]&&e++;return e+d}function N(b,c){var d,e;for(d=1;d<7;d++)b[d]=b[d]==null?d===2?1:0:b[d];return b[7]=c,e=new a(0),c?(e.setUTCFullYear(b[0],b[1],b[2]),e.setUTCHours(b[3],b[4],b[5],b[6])):(e.setFullYear(b[0],b[1],b[2]),e.setHours(b[3],b[4],b[5],b[6])),e._a=b,e}function O(a,b){var d,e,f=[];!b&&i&&(b=require("./lang/"+a));for(d=0;d<j.length;d++)b[j[d]]=b[j[d]]||g.en[j[d]];for(d=0;d<12;d++)e=c([2e3,d]),f[d]=new RegExp("^"+(b.months[d]||b.months(e,""))+"|^"+(b.monthsShort[d]||b.monthsShort(e,"")).replace(".",""),"i");return b.monthsParse=b.monthsParse||f,g[a]=b,b}function P(a){var b=typeof a=="string"&&a||a&&a._lang||null;return b?g[b]||O(b):c}function Q(a){return D[a]?"'+("+D[a]+")+'":a.replace(n,"").replace(/\\?'/g,"\\'")}function R(a){return P().longDateFormat[a]||a}function S(a){var b="var a,b;return '"+a.replace(l,Q)+"';",c=Function;return new c("t","v","o","p","m",b)}function T(a){return C[a]||(C[a]=S(a)),C[a]}function U(a,b){function d(d,e){return c[d].call?c[d](a,b):c[d][e]}var c=P(a);while(m.test(b))b=b.replace(m,R);return C[b]||(C[b]=S(b)),C[b](a,d,c.ordinal,J,c.meridiem)}function V(a){switch(a){case"DDDD":return r;case"YYYY":return s;case"S":case"SS":case"SSS":case"DDD":return q;case"MMM":case"MMMM":case"dd":case"ddd":case"dddd":case"a":case"A":return t;case"Z":case"ZZ":return u;case"T":return v;case"MM":case"DD":case"YY":case"HH":case"hh":case"mm":case"ss":case"M":case"D":case"d":case"H":case"h":case"m":case"s":return p;default:return new RegExp(a.replace("\\",""))}}function W(a,b,c,d){var e;switch(a){case"M":case"MM":c[1]=b==null?0:~~b-1;break;case"MMM":case"MMMM":for(e=0;e<12;e++)if(P().monthsParse[e].test(b)){c[1]=e;break}break;case"D":case"DD":case"DDD":case"DDDD":b!=null&&(c[2]=~~b);break;case"YY":b=~~b,c[0]=b+(b>70?1900:2e3);break;case"YYYY":c[0]=~~Math.abs(b);break;case"a":case"A":d.isPm=(b+"").toLowerCase()==="pm";break;case"H":case"HH":case"h":case"hh":c[3]=~~b;break;case"m":case"mm":c[4]=~~b;break;case"s":case"ss":c[5]=~~b;break;case"S":case"SS":case"SSS":c[6]=~~(("0."+b)*1e3);break;case"Z":case"ZZ":d.isUTC=!0,e=(b+"").match(z),e&&e[1]&&(d.tzh=~~e[1]),e&&e[2]&&(d.tzm=~~e[2]),e&&e[0]==="+"&&(d.tzh=-d.tzh,d.tzm=-d.tzm)}}function X(a,b){var c=[0,0,1,0,0,0,0],d={tzh:0,tzm:0},e=b.match(l),f,g;for(f=0;f<e.length;f++)g=(V(e[f]).exec(a)||[])[0],a=a.replace(V(e[f]),""),W(e[f],g,c,d);return d.isPm&&c[3]<12&&(c[3]+=12),d.isPm===!1&&c[3]===12&&(c[3]=0),c[3]+=d.tzh,c[4]+=d.tzm,N(c,d.isUTC)}function Y(a,b){var c,d=a.match(o)||[],e,f=99,g,h,i;for(g=0;g<b.length;g++)h=X(a,b[g]),e=U(new G(h),b[g]).match(o)||[],i=M(d,e),i<f&&(f=i,c=h);return c}function Z(b){var c="YYYY-MM-DDT",d;if(w.exec(b)){for(d=0;d<4;d++)if(y[d][1].exec(b)){c+=y[d][0];break}return u.exec(b)?X(b,c+" Z"):X(b,c)}return new a(b)}function $(a,b,c,d,e){var f=e.relativeTime[a];return typeof f=="function"?f(b||1,!!c,a,d):f.replace(/%d/i,b||1)}function _(a,b,c){var d=e(Math.abs(a)/1e3),f=e(d/60),g=e(f/60),h=e(g/24),i=e(h/365),j=d<45&&["s",d]||f===1&&["m"]||f<45&&["mm",f]||g===1&&["h"]||g<22&&["hh",g]||h===1&&["d"]||h<=25&&["dd",h]||h<=45&&["M"]||h<345&&["MM",e(h/30)]||i===1&&["y"]||["yy",i];return j[2]=b,j[3]=a>0,j[4]=c,$.apply({},j)}function ab(a,b){c.fn[a]=function(a){var c=this._isUTC?"UTC":"";return a!=null?(this._d["set"+c+b](a),this):this._d["get"+c+b]()}}function bb(a){c.duration.fn[a]=function(){return this._data[a]}}function cb(a,b){c.duration.fn["as"+a]=function(){return+this/b}}var c,d="1.7.0",e=Math.round,f,g={},h="en",i=typeof module!="undefined"&&module.exports,j="months|monthsShort|weekdays|weekdaysShort|weekdaysMin|longDateFormat|calendar|relativeTime|ordinal|meridiem".split("|"),k=/^\/?Date\((\-?\d+)/i,l=/(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|YYYY|YY|a|A|hh?|HH?|mm?|ss?|SS?S?|zz?|ZZ?)/g,m=/(LT|LL?L?L?)/g,n=/(^\[)|(\\)|\]$/g,o=/([0-9a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+)/gi,p=/\d\d?/,q=/\d{1,3}/,r=/\d{3}/,s=/\d{1,4}/,t=/[0-9a-z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+/i,u=/Z|[\+\-]\d\d:?\d\d/i,v=/T/i,w=/^\s*\d{4}-\d\d-\d\d(T(\d\d(:\d\d(:\d\d(\.\d\d?\d?)?)?)?)?([\+\-]\d\d:?\d\d)?)?/,x="YYYY-MM-DDTHH:mm:ssZ",y=[["HH:mm:ss.S",/T\d\d:\d\d:\d\d\.\d{1,3}/],["HH:mm:ss",/T\d\d:\d\d:\d\d/],["HH:mm",/T\d\d:\d\d/],["HH",/T\d\d/
]],z=/([\+\-]|\d\d)/gi,A="Month|Date|Hours|Minutes|Seconds|Milliseconds".split("|"),B={Milliseconds:1,Seconds:1e3,Minutes:6e4,Hours:36e5,Days:864e5,Months:2592e6,Years:31536e6},C={},D={M:"(a=t.month()+1)",MMM:'v("monthsShort",t.month())',MMMM:'v("months",t.month())',D:"(a=t.date())",DDD:"(a=new Date(t.year(),t.month(),t.date()),b=new Date(t.year(),0,1),a=~~(((a-b)/864e5)+1.5))",d:"(a=t.day())",dd:'v("weekdaysMin",t.day())',ddd:'v("weekdaysShort",t.day())',dddd:'v("weekdays",t.day())',w:"(a=new Date(t.year(),t.month(),t.date()-t.day()+5),b=new Date(a.getFullYear(),0,4),a=~~((a-b)/864e5/7+1.5))",YY:"p(t.year()%100,2)",YYYY:"p(t.year(),4)",a:"m(t.hours(),t.minutes(),!0)",A:"m(t.hours(),t.minutes(),!1)",H:"t.hours()",h:"t.hours()%12||12",m:"t.minutes()",s:"t.seconds()",S:"~~(t.milliseconds()/100)",SS:"p(~~(t.milliseconds()/10),2)",SSS:"p(t.milliseconds(),3)",Z:'((a=-t.zone())<0?((a=-a),"-"):"+")+p(~~(a/60),2)+":"+p(~~a%60,2)',ZZ:'((a=-t.zone())<0?((a=-a),"-"):"+")+p(~~(10*a/6),4)'},E="DDD w M D d".split(" "),F="M D H h m s w".split(" ");while(E.length)f=E.pop(),D[f+"o"]=D[f]+"+o(a)";while(F.length)f=F.pop(),D[f+f]="p("+D[f]+",2)";D.DDDD="p("+D.DDD+",3)",c=function(d,e){if(d===null||d==="")return null;var f,g;return c.isMoment(d)?new G(new a(+d._d),d._isUTC,d._lang):(e?L(e)?f=Y(d,e):f=X(d,e):(g=k.exec(d),f=d===b?new a:g?new a(+g[1]):d instanceof a?d:L(d)?N(d):typeof d=="string"?Z(d):new a(d)),new G(f))},c.utc=function(a,b){return L(a)?new G(N(a,!0),!0):(typeof a=="string"&&!u.exec(a)&&(a+=" +0000",b&&(b+=" Z")),c(a,b).utc())},c.unix=function(a){return c(a*1e3)},c.duration=function(a,b){var d=c.isDuration(a),e=typeof a=="number",f=d?a._data:e?{}:a,g;return e&&(b?f[b]=a:f.milliseconds=a),g=new H(f),d&&(g._lang=a._lang),g},c.humanizeDuration=function(a,b,d){return c.duration(a,b===!0?null:b).humanize(b===!0?!0:d)},c.version=d,c.defaultFormat=x,c.lang=function(a,b){var d;if(!a)return h;(b||!g[a])&&O(a,b);if(g[a]){for(d=0;d<j.length;d++)c[j[d]]=g[a][j[d]];c.monthsParse=g[a].monthsParse,h=a}},c.langData=P,c.isMoment=function(a){return a instanceof G},c.isDuration=function(a){return a instanceof H},c.lang("en",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D YYYY",LLL:"MMMM D YYYY LT",LLLL:"dddd, MMMM D YYYY LT"},meridiem:function(a,b,c){return a>11?c?"pm":"PM":c?"am":"AM"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},ordinal:function(a){var b=a%10;return~~(a%100/10)===1?"th":b===1?"st":b===2?"nd":b===3?"rd":"th"}}),c.fn=G.prototype={clone:function(){return c(this)},valueOf:function(){return+this._d},unix:function(){return Math.floor(+this._d/1e3)},toString:function(){return this._d.toString()},toDate:function(){return this._d},toArray:function(){var a=this;return[a.year(),a.month(),a.date(),a.hours(),a.minutes(),a.seconds(),a.milliseconds(),!!this._isUTC]},isValid:function(){return this._a?!M(this._a,(this._a[7]?c.utc(this):this).toArray()):!isNaN(this._d.getTime())},utc:function(){return this._isUTC=!0,this},local:function(){return this._isUTC=!1,this},format:function(a){return U(this,a?a:c.defaultFormat)},add:function(a,b){var d=b?c.duration(+b,a):c.duration(a);return K(this,d,1),this},subtract:function(a,b){var d=b?c.duration(+b,a):c.duration(a);return K(this,d,-1),this},diff:function(a,b,d){var f=this._isUTC?c(a).utc():c(a).local(),g=(this.zone()-f.zone())*6e4,h=this._d-f._d-g,i=this.year()-f.year(),j=this.month()-f.month(),k=this.date()-f.date(),l;return b==="months"?l=i*12+j+k/30:b==="years"?l=i+(j+k/30)/12:l=b==="seconds"?h/1e3:b==="minutes"?h/6e4:b==="hours"?h/36e5:b==="days"?h/864e5:b==="weeks"?h/6048e5:h,d?l:e(l)},from:function(a,b){return c.duration(this.diff(a)).lang(this._lang).humanize(!b)},fromNow:function(a){return this.from(c(),a)},calendar:function(){var a=this.diff(c().sod(),"days",!0),b=this.lang().calendar,d=b.sameElse,e=a<-6?d:a<-1?b.lastWeek:a<0?b.lastDay:a<1?b.sameDay:a<2?b.nextDay:a<7?b.nextWeek:d;return this.format(typeof e=="function"?e.apply(this):e)},isLeapYear:function(){var a=this.year();return a%4===0&&a%100!==0||a%400===0},isDST:function(){return this.zone()<c([this.year()]).zone()||this.zone()<c([this.year(),5]).zone()},day:function(a){var b=this._isUTC?this._d.getUTCDay():this._d.getDay();return a==null?b:this.add({d:a-b})},startOf:function(a){switch(a.replace(/s$/,"")){case"year":this.month(0);case"month":this.date(1);case"....find(".repo_filter").click(function(){var c=a(this);return b.find(".repo_filterer a").removeClass("filter_selected"),c.addClass("filter_selected"),i=c.attr("rel"),h?k():e.click(),!1});var l="placeholder"in document.createElement("input"),m=function(){l||(f.val()==""?f.addClass("placeholder"):f.removeClass("placeholder"))};f.bind("keyup blur click",function(){if(this.value==g)return;g=this.value,h?k():e.click(),m()}),m()})},a.fn.repoList.defaults={selector:"#repo_listing",ajaxUrl:"/dashboard/ajax_your_repos"}}(jQuery),$.fn.selectableList=function(a,b){return $(this).each(function(){var c=$(this),d=$.extend({toggleClassName:"selected",wrapperSelector:"a",mutuallyExclusive:!1,itemParentSelector:"li",enableShiftSelect:!1,ignoreLinks:!1},b);return c.delegate(a+" "+d.itemParentSelector+" "+d.wrapperSelector,"click",function(b){if(b.which>1||b.metaKey||d.ignoreLinks&&$(b.target).closest("a").length)return!0;var e=$(this),f=e.find(":checkbox, :radio"),g=c.find(a+" ."+d.toggleClassName),h=c.find(a+" *[data-last]");!e.is(":checkbox, :radio")&&b.target!=f[0]&&(f.attr("checked")&&!f.is(":radio")?f.attr("checked",!1):f.attr("checked",!0)),d.mutuallyExclusive&&g.removeClass(d.toggleClassName),e.toggleClass(d.toggleClassName),f.change();if(d.enableShiftSelect&&b.shiftKey&&g.length>0&&h.length>0){var i=h.offset().top,j=e.offset().top,k="#"+e.attr("id"),l=$,m=$,n=$;i>j?l=h.prevUntil(k):i<j&&(l=h.nextUntil(k)),m=l.find(":checkbox"),n=l.find(":checked"),n.length==m.length?(l.removeClass(d.toggleClassName),m.attr("checked",!1)):(l.addClass(d.toggleClassName),m.attr("checked",!0))}h.removeAttr("data-last"),e.attr("data-last",!0)}),c.delegate(a+" li :checkbox,"+a+" li :radio","change",function(b){var e=$(this),f=e.closest(d.wrapperSelector);d.mutuallyExclusive&&c.find(a+" ."+d.toggleClassName).removeClass(d.toggleClassName),$(this).attr("checked")?f.addClass(d.toggleClassName):f.removeClass(d.toggleClassName)}),c.find(a)})},function(a){a.fn.hardTabs=function(b){var c=a.extend({},a.fn.hardTabs.defaults,b);a(this).hasClass("js-large-data-tabs")&&(c.optimizeLargeContents=!0);var d=function(b){return c.optimizeLargeContents?b[0]==null?a():(b.is(":visible")&&!b[0].style.width&&b.css({width:b.width()+"px"}),b.css({position:"absolute",left:"-9999px"})):b.hide()},e=function(b){return c.optimizeLargeContents?b[0]==null?a():(b.is(":visible")||b.show(),b.css({position:"",left:""})):b.show()};return this.each(function(){var b=a(this),c=a(),f=a();b.find("a.selected").length==0&&a(b.find("a")[0]).addClass("selected"),b.find("a").each(function(){var g=a(this),h=a.fn.hardTabs.findLastPathSegment(g.attr("href")),i=g.attr("data-container-id")?g.attr("data-container-id"):h,j=a("#"+i);d(j);var k=function(h){return h.which==2||h.metaKey?!0:(j=a("#"+i),j.length==0?!0:(d(f),c.removeClass("selected"),f=e(j),c=g.addClass("selected"),"replaceState"in window.history&&h!="stop-url-change"&&window.history.replaceState(null,document.title,g.attr("href")),b.trigger("tabChanged",{link:g}),!1))};g.click(k),a('.js-secondary-hard-link[href="'+g.attr("href")+'"]').click(k),g.hasClass("selected")&&k("stop-url-change")})})},a.fn.hardTabs.defaults={optimizeLargeContents:!1},a.fn.hardTabs.findLastPathSegment=function(a){a==null&&(a=document.location.pathname),a=a.replace(/\?.+|#.+/,"");var b=a.match(/[^\/]+\/?$/);return b.length==0&&alert("Invalid tab link!"),b[0].replace("/","")}}(jQuery),function(){var a;a={},$(document).bind("keydown",function(b){var c;if($(b.target).is(":input"))return;if(c=a[b.hotkey])return c.apply(this,arguments)}),$.hotkeys=function(a){var b,c;for(b in a)c=a[b],$.hotkey(b,c);return this},$.hotkey=function(b,c){return a[b]=c,this}}.call(this),function(a){function b(a,b){var c=a.find("a");if(c.length>1){var d=c.filter(".selected"),e=c.get().indexOf(d.get(0));return e+=b,e>=c.length?e=0:e<0&&(e=c.length-1),d.removeClass("selected"),c.eq(e).addClass("selected"),!0}}a.fn.quicksearch=function(c){var d=a.extend({url:null,delay:150,spinner:null,insertSpinner:null,loading:a(".quicksearch-loading")},c);d.insertSpinner&&!d.spinner&&(d.spinner=a('<img src="'+GitHub.Ajax.spinner+'" alt="" class="spinner" />'));var e=function(a){return d.results.html(a).show()};return d.results.delegate("a","mouseover",function(b){var c=a(this);c.hasClass("selected")||(d.results.find("a.selected").removeClass("selected"),c.addClass("selected"))}),this.each(function(){function f(){d.insertSpinner&&(d.spinner.parent().length||d.insertSpinner.call(c,d.spinner),d.spinner.show()),c.trigger("quicksearch.loading"),d.loading&&e(d.loading.html())}function g(){d.insertSpinner&&d.spinner.hide(),c.trigger("quicksearch.loaded")}var c=a(this);c.autocompleteField({url:d.url||c.attr("data-url"),dataType:d.dataType,delay:d.delay,useCache:!0,minLength:2}).bind("keyup",function(a){a.which!=13&&c.val().length>=2&&d.results.is(":empty")&&f()}).bind("autocomplete:beforesend",function(a,b){f()}).bind("autocomplete:finish",function(a,b){e(b||{}),g(),$stats.increment("ui.quicksearch.results")})
.bind("autocomplete:clear",function(a){d.results.html("").hide(),g()}).bind("focus",function(a){c.val()&&c.trigger("keyup")}).bind("blur",function(a){setTimeout(function(){c.trigger("autocomplete:clear")},150)}).bind("keydown",function(c){switch(c.hotkey){case"up":if(b(d.results,-1))return!1;break;case"down":if(b(d.results,1))return!1;break;case"esc":return a(this).blur(),!1;case"enter":var e,f=d.results.find("a.selected");if(f.length)return a(this).blur(),f.hasClass("initial")?f.closest("form").submit():window.location=f.attr("href"),!1;a(this).trigger("autocomplete:clear")}})})}}(jQuery),function(a){function b(a,b){return typeof a=="function"?a.call(b):a}function c(a){while(a=a.parentNode)if(a==document)return!0;return!1}function d(b,c){this.$element=a(b),this.options=c,this.enabled=!0,this.fixTitle()}d.prototype={show:function(){var c=this.getTitle();if(c&&this.enabled){var d=this.tip();d.find(".tipsy-inner")[this.options.html?"html":"text"](c),d[0].className="tipsy",d.remove().css({top:0,left:0,visibility:"hidden",display:"block"}).prependTo(document.body);var e=a.extend({},this.$element.offset(),{width:this.$element[0].offsetWidth,height:this.$element[0].offsetHeight}),f=d[0].offsetWidth,g=d[0].offsetHeight,h=b(this.options.gravity,this.$element[0]),i;switch(h.charAt(0)){case"n":i={top:e.top+e.height+this.options.offset,left:e.left+e.width/2-f/2};break;case"s":i={top:e.top-g-this.options.offset,left:e.left+e.width/2-f/2};break;case"e":i={top:e.top+e.height/2-g/2,left:e.left-f-this.options.offset};break;case"w":i={top:e.top+e.height/2-g/2,left:e.left+e.width+this.options.offset}}h.length==2&&(h.charAt(1)=="w"?i.left=e.left+e.width/2-15:i.left=e.left+e.width/2-f+15),d.css(i).addClass("tipsy-"+h),d.find(".tipsy-arrow")[0].className="tipsy-arrow tipsy-arrow-"+h.charAt(0),this.options.className&&d.addClass(b(this.options.className,this.$element[0])),this.options.fade?d.stop().css({opacity:0,display:"block",visibility:"visible"}).animate({opacity:this.options.opacity}):d.css({visibility:"visible",opacity:this.options.opacity})}},hide:function(){this.options.fade?this.tip().stop().fadeOut(function(){a(this).remove()}):this.tip().remove()},fixTitle:function(){var a=this.$element;(a.attr("title")||typeof a.attr("original-title")!="string")&&a.attr("original-title",a.attr("title")||"").removeAttr("title")},getTitle:function(){var a,b=this.$element,c=this.options;this.fixTitle();var a,c=this.options;return typeof c.title=="string"?a=b.attr(c.title=="title"?"original-title":c.title):typeof c.title=="function"&&(a=c.title.call(b[0])),a=(""+a).replace(/(^\s*|\s*$)/,""),a||c.fallback},tip:function(){return this.$tip||(this.$tip=a('<div class="tipsy"></div>').html('<div class="tipsy-arrow"></div><div class="tipsy-inner"></div>'),this.$tip.data("tipsy-pointee",this.$element[0])),this.$tip},validate:function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},toggleEnabled:function(){this.enabled=!this.enabled}},a.fn.tipsy=function(b){function e(c){var e=a.data(c,"tipsy");return e||(e=new d(c,a.fn.tipsy.elementOptions(c,b)),a.data(c,"tipsy",e)),e}function f(){var a=e(this);a.hoverState="in",b.delayIn==0?a.show():(a.fixTitle(),setTimeout(function(){a.hoverState=="in"&&a.show()},b.delayIn))}function g(){var a=e(this);a.hoverState="out",b.delayOut==0?a.hide():setTimeout(function(){a.hoverState=="out"&&a.hide()},b.delayOut)}if(b===!0)return this.data("tipsy");if(typeof b=="string"){var c=this.data("tipsy");return c&&c[b](),this}b=a.extend({},a.fn.tipsy.defaults,b),b.live||this.each(function(){e(this)});if(b.trigger!="manual"){var h=b.live?"live":"bind",i=b.trigger=="hover"?"mouseenter":"focus",j=b.trigger=="hover"?"mouseleave":"blur";this[h](i,f)[h](j,g)}return this},a.fn.tipsy.defaults={className:null,delayIn:0,delayOut:0,fade:!1,fallback:"",gravity:"n",html:!1,live:!1,offset:0,opacity:.8,title:"title",trigger:"hover"},a.fn.tipsy.revalidate=function(){a(".tipsy").each(function(){var b=a.data(this,"tipsy-pointee");(!b||!c(b))&&a(this).remove()})},a.fn.tipsy.elementOptions=function(b,c){return a.metadata?a.extend({},c,a(b).metadata()):c},a.fn.tipsy.autoNS=function(){return a(this).offset().top>a(document).scrollTop()+a(window).height()/2?"s":"n"},a.fn.tipsy.autoWE=function(){return a(this).offset().left>a(document).scrollLeft()+a(window).width()/2?"e":"w"},a.fn.tipsy.autoBounds=function(b,c){return function(){var d={ns:c[0],ew:c.length>1?c[1]:!1},e=a(document).scrollTop()+b,f=a(document).scrollLeft()+b,g=a(this);return g.offset().top<e&&(d.ns="n"),g.offset().left<f&&(d.ew="w"),a(window).width()+a(document).scrollLeft()-g.offset().left<b&&(d.ew="e"),a(window).height()+a(document).scrollTop()-g.offset().top<b&&(d.ns="s"),d.ns+(d.ew?d.ew:"")}}}(jQuery),function(a){function e(a){return"tagName"in a?a:a.parentNode}try{window.document.createEvent("TouchEvent")}catch(b){return!1}var c={},d;a(document).ready(function(){a(document....$(document).on("click",".js-selectable-list .js-selectable-item",function(a){if(!a.isDefaultPrevented())return;return $(this).closest(".js-selectable-list").find(".js-selectable-item.selected").removeClass("selected"),$(this).toggleClass("selected")})}.call(this),function(){var a;if(window.getSelection==null)return;a=function(b,c){var d,e,f,g;if(b===c)return!0;g=b.childNodes;for(e=0,f=g.length;e<f;e++){d=g[e];if(a(d,c))return!0}return!1},$(document).on("click",".js-selectable-text",function(){var b,c;c=window.getSelection(),c.rangeCount&&(b=c.getRangeAt(0).commonAncestorContainer,a(this,b)||c.selectAllChildren(this))})}.call(this),function(){var a,b=function(a,b){return function(){return a.apply(b,arguments)}};a=function(){function c(){this.onMouseMove=b(this.onMouseMove,this),this.onMouseUp=b(this.onMouseUp,this),this.onMouseDown=b(this.onMouseDown,this),$(document).on("mousedown",".js-sortable-container .js-sortable-target",this.onMouseDown)}var a;return a=$("<li />").addClass("js-sortable-placeholder sortable-placeholder"),c.prototype.onMouseDown=function(b){return $(b.currentTarget).addClass("js-sorting").fadeTo(0,.5).css({"z-index":10,position:"absolute",top:$(b.currentTarget).position().top,left:$(b.currentTarget).position().left}).after(a),$(document).on("mousemove.sortable",this.onMouseMove),$(document).on("mouseup",this.onMouseUp),!1},c.prototype.onMouseUp=function(a){return $(".js-sorting").removeClass("js-sorting").fadeTo(0,1).css({"z-index":"",position:"",top:"",left:""}),$(".js-sortable-placeholder").remove(),$(document).off("mousemove.sortable",this.onMouseMove),$(document).off("mouseup",this.onMouseUp),!1},c.prototype.onMouseMove=function(a){var b,c,d;return b=$(".js-sorting"),d=a.pageY-b.parent().offset().top,c=$(".js-sorting").height(),d<0+c/2?$(".js-sorting").css({top:0}):d>b.parent().height()-c/2?$(".js-sorting").css({top:b.parent().height()-b.height()}):$(".js-sorting").css({top:d-c/2}),$(".js-sorting").index()<b.parent().find(".js-sortable-target").length&&$(".js-sorting").index()>=0&&($(".js-sorting").position().top>$(".js-sortable-placeholder").position().top+c*.8?($(".js-sortable-placeholder").insertAfter($(".js-sortable-placeholder").next()),$(".js-sorting").insertBefore($(".js-sortable-placeholder"))):$(".js-sorting").position().top<$(".js-sortable-placeholder").position().top-c*.8&&($(".js-sortable-placeholder").insertBefore($(".js-sortable-placeholder").prev().prev()),$(".js-sorting").insertBefore($(".js-sortable-placeholder")))),!1},c}(),new a}.call(this),function(){$.support.pjax&&$(document).on("click",".js-sortable-header",function(a){var b;if(!a.isDefaultPrevented())return;return b=$(this).closest("li"),b.is(".asc, .desc")?b.toggleClass("asc desc"):(b.siblings(".asc, .desc").removeClass("asc desc"),b.addClass("desc"))})}.call(this),function(){var a,b=function(a,b){return function(){return a.apply(b,arguments)}};a=function(){function a(){this.onToggle=b(this.onToggle,this),this.onError=b(this.onError,this),this.onSuccess=b(this.onSuccess,this),this.onComplete=b(this.onComplete,this),this.onBeforeSend=b(this.onBeforeSend,this),this.onClick=b(this.onClick,this),$(document).on("click",".js-toggler-container .js-toggler-target",this.onClick),$(document).on("ajaxBeforeSend",".js-toggler-container",this.onBeforeSend),$(document).on("ajaxComplete",".js-toggler-container",this.onComplete),$(document).on("ajaxSuccess",".js-toggler-container",this.onSuccess),$(document).on("ajaxError",".js-toggler-container",this.onError),$(document).on("toggler:toggle",".js-toggler-container",this.onToggle)}return a.prototype.onClick=function(a){return $(a.target).trigger("toggler:toggle"),!1},a.prototype.onBeforeSend=function(a){var b;return b=a.currentTarget,$(b).removeClass("success error"),$(b).addClass("loading")},a.prototype.onComplete=function(a){return $(a.currentTarget).removeClass("loading")},a.prototype.onSuccess=function(a){return $(a.currentTarget).addClass("success")},a.prototype.onError=function(a){return $(a.currentTarget).addClass("error")},a.prototype.onToggle=function(a){var b;return b=a.currentTarget,$(b).toggleClass("on")},a}(),new a}.call(this),function(){var a;a=function(b){var c,d,e,f,g;c=$(b);if(c.is("form")){g=b.elements;for(e=0,f=g.length;e<f;e++){d=g[e];if(!a(d))return!1}return!0}return c.is("input[required], textarea[required]")&&$.trim(c.val())===""?!1:!0},$(document).on("focusin","input[required], textarea[required]",function(){var b,c;return c=a(this),b=function(b){var d;d=a(this),d!==c&&$(this).trigger("validation:field:change",[d]),c=d},$(this).on("textchange",b),$(this).on("blur",function(){return $(this).off("textchange",b)})}),$(document).on("validation:field:change","form",function(b){var c;return c=a(this),$(this).trigger("validation:change",[c])}),$(function(){var b,c,d,e;e=$("input[required], textarea[required]");for(c=0,d=e.length;c<d;c++)b=e[c],$(b).trigger("validation:field:change",[a(b)])}),$(document).on("validation:change","form",function(a,b){return $
(this).find("button[data-disable-invalid]").prop("disabled",!b)})}.call(this);if(typeof console=="undefined"||typeof console.log=="undefined")window.console={log:function(){}};window.debug=function(){},$.ajaxPoll.version="2",$.fn.spin=function(){return this.after('<img src="'+GitHub.Ajax.spinner+'" id="spinner"/>')},$.fn.stopSpin=function(){return $("#spinner").remove(),this},GitHub.Ajax={spinner:"http://github.oarsdev/images/spinners/octocat-spinner-16px.gif",error:"http://github.oarsdev/images/modules/ajax/error.png"},$(function(){function b(){$("#facebox .shortcuts:visible").length?$.facebox.close():($(document).one("reveal.facebox",function(){$(".js-see-all-keyboard-shortcuts").click(function(){return $(this).remove(),$("#facebox .js-hidden-pane").show(),!1})}),$.facebox({div:"#keyboard_shortcuts_pane"},"shortcuts"))}function c(){$("#facebox .cheatsheet:visible").length?$.facebox.close():$.facebox({div:"#markdown-help"},"cheatsheet")}var a=new Image;a.src=GitHub.Ajax.spinner,$(".cards_select").cardsSelect(),$(document).bind("reveal.facebox",function(){$(".cards_select").cardsSelect(),$("#facebox .content").fire("pageUpdate")}),$(".flash .close").click(function(){$(this).closest(".flash").fadeOut(300,function(){$(this).remove(),$(".flash-messages .close").length==0&&$(".flash-messages").remove()})}),$(".js-date-input").date_input(),$(document).on("keypress",function(a){if($(a.target).is(":input"))return;if(a.which===63)return b(),!1}),$(document).on("keydown",function(a){if(a.hotkey!=="m"||$(a.target).is(":input"))return;return c(),!1}),$(".gfm-help").click(function(a){a.preventDefault(),c()}),$(".js-hard-tabs").hardTabs(),$("button.classy, a.button.classy").mousedown(function(){$(this).addClass("mousedown")}).bind("mouseup mouseleave",function(){$(this).removeClass("mousedown")})}),$.pageUpdate(function(){$(this).find("a[rel*=facebox]").each(function(){if($(this).data("facebox-installed"))return;$(this).facebox(),$(this).data("facebox-installed",!0)}),$(this).find(".js-entice").each(function(){$(this).enticeToAction({title:$(this).attr("data-entice")})}),$(this).find(".tooltipped").each(function(){var a=$(this),b=a.hasClass("downwards")?"n":"s";b=a.hasClass("rightwards")?"w":b,b=a.hasClass("leftwards")?"e":b,a.tipsy({gravity:b})})}),$.extend($.facebox.settings,{loadingImage:"http://github.oarsdev/images/spinners/octocat-spinner-32.gif",closeHTML:'<span class="mini-icon mini-icon-remove-close"></span>',closeImage:""}),function(){$.pageUpdate(function(){var a,b,c;if(!$("#menu-about").length)return;a=$(".js-github-jobs");if(!a.length)return;return $(".js-github-jobs").hasClass("loading")||(a.addClass("loading"),$.getJSON(a.data("url"),function(a){var d,e,f,g;if(a.length===0)return c();g=[];for(e=0,f=a.length;e<f;e++)d=a[e],g.push(b(d));return g}).error(function(a,b,c){return $(".js-github-jobs .jobs").html("Had a problem pulling in our jobs. Sorry!")})),b=function(a){var b;return b=a.description.split("\n")[0],$(".js-github-jobs .jobs").append(' <li> <h3><a href="'+a.url+'">'+a.title+"</a></h3> <p>"+b+"</p> <hr /> </li> ")},c=function(){return $(".js-github-jobs .jobs").html("<p>We haven't posted any jobs lately. Check back later, though!</p>")}})}.call(this),function(){$(function(){var a;return $(document).on("click",".section-head",function(b){var c;return c=$(b.currentTarget).next(".section-nav"),a.expand(c)}),a={collapse:function(a){return a.slideUp(200),a.addClass("collapsed")},expand:function(b){var c,d,e,f;d=$(".section-nav");for(e=0,f=d.length;e<f;e++)c=d[e],a.collapse($(c));return b.slideDown(200),b.removeClass("collapsed")}}})}.call(this),function(){}.call(this),GitHub.Blob||(GitHub.Blob={}),GitHub.Blob.highlightLines=function(a){$(".line, .line-data").css("background-color",""),a?(target=$(this).attr("rel"),a.shiftKey&&(target=window.location.hash.replace(/-\d+/,"")+"-"+target.replace(/\D/g,"")),window.location.hash=target):target=window.location.hash;if(lines=target.match(/#?(?:L|l|-)(\d+)/g)){lines=$.map(lines,function(a){return parseInt(a.replace(/\D/g,""))});if(lines.length==1)return $("#LC"+lines[0]).css("background-color","#ffc");for(var b=lines[0];b<=lines[1];b++)$("#LC"+b).css("background-color","#ffc");$("#LC"+lines[0]).scrollTo()}return!1},GitHub.Blob.scrollToHilightedLine=function(){var a,b=window.location.hash;if(a=b.match(/^#?(?:L|-)(\d+)$/g))a=$.map(a,function(a){return parseInt(a.replace(/\D/g,""))}),$("#LC"+a[0]).scrollTo()},GitHub.Blob.show=function(){$(".file-edit-link").hide(),$(".frame-center .file-edit-link").show(),$.hotkeys({l:function(){return $(document).one("reveal.facebox",function(){var a=$("#facebox").find(":text");a.focus(),$("#facebox form").submit(function(){var b="#L"+parseInt(a.val(),10);return window.location=b,GitHub.Blob.highlightLines(),$(b).length||GitHub.Blob.scrollToHilightedLine(),a.blur(),$(document).trigger("close.facebox"),!1})}).one("close.facebox",function(){$(document.activeElement).blur()}),$.facebox({div:"#jump...("#teams form").submit(function(){var a=$(this).find("select"),b=a.val(),c=function(a){a!=null?$("#push_pull_collabs .error").text(a).show():$("#push_pull_collabs .error").hide()};return b==""?(c("You must select a team"),!1):(c(),$.ajax({url:this.action,data:{team:b},type:"POST",dataType:"json",success:function(b){a.val(""),b.error?c(b.error):$("#teams ul.teams").append(b.html)},error:function(){c("An unidentfied error occurred, try again?")}}),!1)}),$("#teams .remove-team").live("click",function(){return $.ajax({type:"DELETE",url:this.href}),$(this).closest("li").remove(),!1}),$(".site").is(".vis-public")?$(".private-only").hide():$(".public-only").hide(),$("#custom_tabs .remove-tab").live("click",function(){return $.ajax({type:"DELETE",url:this.href}),$(this).closest("li").remove(),!1}),$(document).bind("reveal.facebox",function(){$("#facebox .renaming_to_field").val($("#rename_field").val())})}}),function(){$(function(){var a;a=$(".js-enterprise-notice-dismiss");if(!a[0])return;return a.click(function(){return $.ajax({type:"POST",url:a.attr("href"),dataType:"json",success:function(b){return a.closest("div").fadeOut()},error:function(a){return alert("Failed to dismiss license expiration notice. Sorry!")}}),!1})})}.call(this),function(){$(function(){document.getElementById("error_502")&&($stats.increment("errors.all"),$stats.increment("errors.502"));if(document.getElementById("error_500"))return $stats.increment("errors.all"),$stats.increment("errors.500")})}.call(this),function(a){typeof define=="function"&&define.amd?define(["jquery"],a):a(jQuery)}(function(a){function f(){a(this).closest(".expandingText").find("div").text(this.value+" ")}a.expandingTextarea=a.extend({autoInitialize:!0,initialSelector:"textarea.expanding"},a.expandingTextarea||{});var b=["lineHeight","textDecoration","letterSpacing","fontSize","fontFamily","fontStyle","fontWeight","textTransform","textAlign","direction","wordSpacing","fontSizeAdjust","wordWrap","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth","paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom","boxSizing","webkitBoxSizing","mozBoxSizing","msBoxSizing"],c={position:"absolute",height:"100%",resize:"none"},d={visibility:"hidden",border:"0 solid",whiteSpace:"pre-wrap"},e={position:"relative"};a.fn.expandingTextarea=function(g){return g==="resize"?this.trigger("input.expanding"):g==="destroy"?(this.filter(".expanding-init").each(function(){var b=a(this).removeClass("expanding-init"),c=b.closest(".expandingText");c.before(b).remove(),b.attr("style",b.data("expanding-styles")||"").removeData("expanding-styles")}),this):(this.filter("textarea").not(".expanding-init").each(function(){var g=a(this).addClass("expanding-init");g.wrap("<div class='expandingText'></div>"),g.after("<pre class='textareaClone'><div></div></pre>");var h=g.parent().css(e),i=h.find("pre").css(d);g.data("expanding-styles",g.attr("style")),g.css(c),a.each(b,function(a,b){var c=g.css(b);i.css(b)!==c&&i.css(b,c)}),g.bind("input.expanding propertychange.expanding",f),f.apply(this)}),this)},a(function(){a.expandingTextarea.autoInitialize&&a(a.expandingTextarea.initialSelector).expandingTextarea()})}),$(function(){var a=$(".community .bigcount"),b=function(){var b=a.outerWidth();a.css("margin-left",-(b/2)+"px"),a.fadeIn()};a.length>0&&setTimeout(b,500);var c=$(".js-slidy-highlight");if(c.length>0){var d=c.find("li.highlight"),e=d.width()/2;e+=-1;var f=function(a){var b=a.closest("li"),c=b.position(),d=c.left+b.width()/2-e;return d+=parseInt(b.css("margin-left")),d};c.bind("tabChanged",function(a,b){var c=f(b.link);d.animate({left:c},300)});var g=f(c.find(".selected"));d.css({left:g})}}),GitHub.FileEditForkPoller=function(){var a=$(document).find(".check-for-fork");if(!a.length)return;var b=$(document).find("#submit-file");b.attr("disabled","disabled"),a.show(),$.ajaxPoll({interval:2,url:a.data("check-url"),error:function(b){b.status==404?this.resume():a.html('<img src="/images/modules/ajax/error.png"> Something went wrong. Please fork the project, then edit this file.')},success:function(){a.hide(),b.removeAttr("disabled")}})},$(function(){GitHub.FileEditForkPoller()}),function(){$(document).on("click",".email-hidden-toggle > a",function(){return $(this).parent().siblings(".email-hidden-reply").toggle(),!1})}.call(this),$(function(){Modernizr.canvas&&$("#impact_graph").length>0&&GitHub.ImpactGraph.drawImpactGraph()}),GitHub.ImpactGraph={colors:null,data:null,chunkVerticalSpace:2,initColors:function(a){var b=[[241,127,73],[29,179,79],[165,29,179],[215,55,35],[215,153,35],[200,210,34],[29,127,179]];this.colors=[];var c=0;for(var d in a){var e=b[c%7];c>6&&(e=[this.randColorValue(e[0]),this.randColorValue(e[1]),this.randColorValue(e[2])]),this.colors.push(e),c+=1}},drawImpactGraph:function(){var a=this,b={},c=$("#impact_graph"),d=function(d){a.initColors(d.authors);var e=a.createCanvas(d);d=a.padChunks(d),a.data=d,$.each(d.buckets
,function(c,d){a.drawBucket(b,d,c)});var f=$("<p />").addClass("meta").text(Object.keys(d.authors).length+" authors over "+d.buckets.length+" weeks");$("#impact_legend h3").append(f),a.drawAll(e,d,b),c.animate({scrollLeft:c.find("canvas").attr("width")},"slow")};GitHub.loadGraph(c,d)},createCanvas:function(a){var b=a.buckets.length*50*2-50,c=0,d,e;for(d=0;d<a.buckets.length;d++){var f=a.buckets[d],g=0;for(e=0;e<f.i.length;e++){var h=f.i[e];g+=this.normalizeImpact(h[1])+this.chunkVerticalSpace}g>c&&(c=g)}$("#impact_graph div").remove();var i=$("#impact_graph");$("#caption").show(),i.append('<canvas width="'+b+'" height="'+(c+30)+'"></canvas>');var j=$("#impact_graph canvas")[0];return j.getContext("2d")},padChunks:function(a){for(var b in a.authors){var c=this.findFirst(b,a),d=this.findLast(b,a);for(var e=c+1;e<d;e++)this.bucketHasAuthor(a.buckets[e],b)||a.buckets[e].i.push([b,0])}return a},bucketHasAuthor:function(a,b){for(var c=0;c<a.i.length;c++)if(a.i[c][0]==parseInt(b,10))return!0;return!1},findFirst:function(a,b){for(var c=0;c<b.buckets.length;c++)if(this.bucketHasAuthor(b.buckets[c],a))return c},findLast:function(a,b){for(var c=b.buckets.length-1;c>=0;c--)if(this.bucketHasAuthor(b.buckets[c],a))return c},colorFor:function(a){var b=this.colors[a];return"rgb("+b[0]+","+b[1]+","+b[2]+")"},randColorValue:function(a){var b=Math.round(Math.random()*100)-50,c=a+b;return c>255&&(c=255),c<0&&(c=0),c},drawBucket:function(a,b,c){var d=0,e=this;$.each(b.i,function(b,f){var g=f[0],h=e.normalizeImpact(f[1]);a[g]||(a[g]=[]),a[g].push([c*100,d,50,h,f[1]]),d=d+h+e.chunkVerticalSpace})},normalizeImpact:function(a){return a<=9?a+1:a<=5e3?Math.round(10+a/50):Math.round(100+Math.log(a)*10)},drawAll:function(a,b,c){this.drawStreams(a,c,null),this.drawDates(b)},drawStreams:function(a,b,c){a.clearRect(0,0,1e4,500),$(".activator").remove();for(var d in b)d!=c&&this.drawStream(d,b,a,!0);c!==null&&this.drawStream(c,b,a,!1)},drawStream:function(a,b,c,d){c.fillStyle=this.colorFor(a);var e=b[a];for(var f=0;f<e.length;f++){var g=e[f];c.fillRect(g[0],g[1],g[2],g[3]),d&&this.placeActivator(a,b,c,g[0],g[1],g[2],g[3],g[4]),f!==0&&(c.beginPath(),c.moveTo(previousChunk[0]+50,previousChunk[1]),c.bezierCurveTo(previousChunk[0]+75,previousChunk[1],g[0]-25,g[1],g[0],g[1]),c.lineTo(g[0],g[1]+g[3]),c.bezierCurveTo(g[0]-25,g[1]+g[3],previousChunk[0]+75,previousChunk[1]+previousChunk[3],previousChunk[0]+50,previousChunk[1]+previousChunk[3]),c.fill()),previousChunk=g}},drawStats:function(a,b){var c=b[a];for(var d=0;d<c.length;d++){var e=c[d],f=e[4];f>10&&this.drawStat(f,e[0],e[1]+e[3]/2)}},drawStat:function(a,b,c){c-=5;var d="";d+="position: absolute;",d+="left: "+b+"px;",d+="top: "+c+"px;",d+="width: 50px;",d+="text-align: center;",d+="color: #fff;",d+="font-size: 9px;",d+="z-index: 0;",$("#impact_graph").append('<p class="stat" style="'+d+'">'+$.commafy(a)+"</p>")},drawDate:function(a,b,c){var d=$("<p />").addClass("idate").css({top:c+"px",left:b+"px",position:"absolute"}).text(a);$("#impact_graph").append(d)},placeActivator:function(a,b,c,d,e,f,g,h){var i="";i+="position: absolute;",i+="left: "+d+"px;",i+="top: "+e+"px;",i+="width: "+f+"px;",i+="height: "+g+"px;",i+="z-index: 100;",i+="cursor: pointer;";var j="a"+d+"-"+e;$("#impact_graph").append('<div class="activator" id="'+j+'" style="'+i+'">&nbsp;</div>');var k=this;$("#"+j).mouseover(function(a){$(a.target).css("background-color","black").css("opacity","0.08")}).mouseout(function(a){$(a.target).css("background-color","transparent")}).mousedown(function(){$stats.increment("graphs.impact.clickblock"),$(".stat").remove(),k.drawStreams(c,b,a),k.drawStats(a,b),k.drawSelectedAuthor(a)})},drawDates:function(a){var b=this;$.each(a.buckets,function(a,c){var d=0,e=new Date;$.each(c.i,function(a,c){d+=b.normalizeImpact(c[1])+1}),e.setTime(c.d*1e3),b.drawDate(moment(e).format("MMM DD 'YY"),a*100,d+7)})},authorText:function(a,b,c){var d=$("<p />").attr("id","author_text").addClass("person").html(a);$("#impact_legend").html(d)},drawSelectedAuthor:function(a){this.clearSelectedAuthor();var b=this.data.authors[a],c=b.n,d=b.c,e=b.a,f=b.d,g='<span class="cmt"><a href="../commits?author='+c+'">'+$.commafy(d)+" commits</a></span> / ";g+='<span class="a">'+$.commafy(e)+"++</span> / ",g+='<span class="d">'+$.commafy(f)+"--</span>",this.authorText('<h3><a href="/'+c+'">'+c+"</a>"+'<span class="ameta">'+g+"</span>",20,0)},clearAuthor:function(){$("#author_text").remove()},clearSelectedAuthor:function(){$("#author_text").remove()}},function(){var a;$(document).on("click",".add-bubble[data-remote]",function(){var b,c;return $(this).hasClass("loading")?!1:($(this).closest(".file").addClass("show-inline-notes"),c=$(this).closest("tr"),b=c.next("tr.inline-comments"),b.length?a(b):$.ajax({context:this,url:$(this).attr("data-remote"),success:function(b){return c.after(b),a(c.next("tr.inline-comments"))}}))}),a=function(a){return a.find(".js-preview-tabs .write-tab").click(),a.addClass("show-inline-comment-form").find...r").hide()})}.call(this),$(function(){var a=$("#organization-transforming");a.length&&$.ajaxPoll({url:a.data("url"),success:function(a,b,c){c.status==201&&(window.location="/login")}})}),$(function(){$("#js-coupon-click-onload").click(),$(".selected .choose_plan").click(),$(".js-show-credit-card-form")[0]&&($.facebox({div:"#credit_card_form"}),$(document).unbind("close.facebox").bind("close.facebox",function(){window.location="/account/billing"}))}),$(document).on("click",".js-add-cc",function(){return $(document).one("reveal.facebox",function(){$("#facebox .js-thanks, #facebox .rule:first").hide()}),$.facebox({div:this.href}),!1}),$(document).on("click",".js-close-facebox",function(){$(document).trigger("close.facebox")}),$(document).on("click",".js-plan-change",function(a){var b=$(this).closest("tr").attr("data-name");$.facebox({div:this.hash});var c=$("#facebox");return c.find(".js-new-plan-name-val").val(b),c.find(".js-new-plan-name").text(b),c.find(".js-new-plan-card-on-file").toggle(b!=="free"),c.find(".js-new-plan-free").toggle(b=="free"),a.stopImmediatePropagation(),!1}),$(document).on("ajaxSuccess","#facebox .js-coupon-form",function(a,b){$("#facebox .content").html(b.responseText),$(document).one("close.facebox",function(){window.location.reload()})}).on("ajaxError","#facebox .js-coupon-form",function(a,b){return $("#facebox .content").html(b.responseText),!1}),$(function(){if(!$("body").hasClass("page-compare"))return!1;var a=$("#compare").data("base"),b=$("#compare").data("head"),c=null;$(".compare-range .commit-ref.to").click(function(){return c="end",$.facebox({div:"#compare_chooser"}),!1}),$(".compare-range .commit-ref.from").click(function(){return c="start",$.facebox({div:"#compare_chooser"}),!1});var d=function(){var d=$("#facebox .ref-autocompleter"),e=$("#facebox button.choose-end"),f=$("#facebox button.refresh");d.val(c=="start"?a:b),$("#facebox .mode-upper").text($.capitalize(c)),$("#facebox .mode-lower").text(c),c=="start"?e.show():e.hide()},e=function(){var e=$("#facebox .ref-autocompleter");if(e.length==0)return;var f=$("#facebox .commit-preview-holder"),g=$("#facebox button.refresh"),h=$(".compare-range").attr("url-base");d(),g.click(function(){return c=="start"?a=e.val():b=e.val(),$(document).trigger("close.facebox"),document.location=h+a+"..."+b,!1}),e.click(function(){return this.focus(),this.select(),!1});var i=!1,j=null,k=function(){i&&j.abort(),i=!0,j=$.get(f.attr("url_base")+e.val(),null,function(a){a.length>0&&(f.html(a),f.find("a").attr("target","_blank"),f.pageUpdate()),i=!1})};k();var l=e.val(),m=null,n=function(){if(l!=e.val()||m==e.val()){l=e.val();return}k(),m=e.val()};e.keyup(function(){l=this.value,setTimeout(n,1e3)}),e.click()};$(document).bind("reveal.facebox",e),a==b&&$(".compare-range .commit-ref.from").click();var f=window.location.hash.substr(1);(/^diff-/.test(f)||/^L\d+/.test(f))&&$("li a[href='#files_bucket']").click()}),function(){$(function(){var a;if($(".js-leaving-form")[0])return a=function(){var a;return a=new WufooForm,a.initialize({userName:"github",formHash:"q7x4a9",autoResize:!0,height:"504",ssl:!0}),$(".js-leaving-form").html(a.generateFrameMarkup())},function(){var b,c;return b=document.location.protocol==="https:"?"https://secure.":"http://",c=""+b+"wufoo.com/scripts/embed/form.js",$.getScript(c,a)}()})}.call(this),function(){var a,b;$(document).on("click",".js-new-pull-tab",function(){return $(this).closest(".pull-tabs").find("a").removeClass("selected"),$(this).addClass("selected"),$("#preview_discussion_bucket, #commits_bucket, #files_bucket").hide(),$(this.hash).show(),!1}),a=function(a){var b,c,d,e;e=a.elements;for(c=0,d=e.length;c<d;c++){b=e[c];if(!b.name||b.defaultValue==null)continue;if(b.value!==b.defaultValue)return!0}return!1},b=function(a){return $(a.relatedTarget).is(".js-pull-range-target")},$(document).on("pjax:beforeSend","#js-repo-pjax-container",function(c){var d,e;if(b(c)){e=c.relatedTarget,$(e).menu("deactivate"),d=$(this).find("form")[0];if(d&&a(d))return d.action=e.href,d.noValidate=!0,$(d).submit(),!1}}),$(document).on("pjax:send","#js-repo-pjax-container",function(a){if(b(a))return $(this).find(".pull-heading").addClass("loading")}),$(document).on("pjax:timeout","#js-repo-pjax-container",function(a){if(b(a))return!1})}.call(this),function(){var a,b=function(a,b){return function(){return a.apply(b,arguments)}};a=function(){function a(){this.validate=b(this.validate,this),this.updateUpsell=b(this.updateUpsell,this),this.selectedPrivacyToggleElement=b(this.selectedPrivacyToggleElement,this),this.handlePrivacyChange=b(this.handlePrivacyChange,this),this.handleOwnerChange=b(this.handleOwnerChange,this);var a=this;this.elements={ownerContainer:$(".js-owner-container"),upgradeUpsell:$("#js-upgrade-container").hide(),upgradeConfirmationCheckbox:$(".js-confirm-upgrade"),upsells:$(".js-upgrade"),privacyToggles:$(".js-privacy-toggle"),privateRadio:$(".js-privacy-toggle[value=false]"),publicRadio:$(".js-privacy-toggle[value=true]"
),repoNameField:$("input[type=text].js-repo-name"),form:$("#new_repository"),ignoreContainer:$(".js-ignore-container"),autoInitCheckbox:$(".js-auto-init-checkbox"),teamBoxes:$(".js-team-select")},this.current_login=$("input[name=owner]:checked").prop("value"),this.privateRepo=!1,this.autocheckURL=this.elements.repoNameField.attr("data-autocheck-url"),this.changedPrivacyManually=!1,this.elements.teamBoxes.hide(),this.elements.ignoreContainer.on("change","input[type=radio]",function(){return $(".js-auto-init-checkbox").prop("checked",!0)}),this.elements.ownerContainer.on("change","input[type=radio]",this.handleOwnerChange),this.elements.privacyToggles.on("change",function(b){return a.handlePrivacyChange(b.targetElement,b)}),this.elements.repoNameField.on("textchange",function(b){return $(b.target).removeClass("autocheck-successful"),a.validate()}),this.elements.upgradeUpsell.on("change textchange","input",this.validate),this.elements.form.on("repoform:validate",this.validate),this.handleOwnerChange(),this.updateUpsell(),this.validate()}return a.prototype.handleOwnerChange=function(){var a,b,c;return this.current_login=$("input[name=owner]:checked").prop("value"),b=""+this.autocheckURL+"?owner="+encodeURIComponent(this.current_login),this.elements.repoNameField.attr("data-autocheck-url",b),this.elements.repoNameField.trigger("focusout"),c=this.elements.ownerContainer.find(".selector-item.selected"),this.elements.teamBoxes.hide().find("input, select").prop("disabled",!0),a=this.elements.teamBoxes.filter("[data-login="+this.current_login+"]"),a.show().find("input, select").prop("disabled",!1),this.changedPrivacyManually||(c.attr("data-default")==="private"?this.elements.privateRadio.attr("checked","checked").change():this.elements.publicRadio.attr("checked","checked").change()),this.handlePrivacyChange(),c.attr("data-permission")==="yes"?($(".with-permission-fields").show(),$(".without-permission-fields").hide()):($(".with-permission-fields").hide(),$(".without-permission-fields").show()),this.updateUpsell()},a.prototype.handlePrivacyChange=function(a,b){return a==null&&(a=this.selectedPrivacyToggleElement()),b==null&&(b=null),b&&!b.isTrigger&&(this.changedPrivacyManually=!0),a.val()==="false"?(this.privateRepo=!0,this.elements.upgradeUpsell.show(),this.elements.upgradeUpsell.find("input[type=checkbox]").attr("checked","checked"),this.elements.upgradeUpsell.find(".js-cc-upgrade").length?this.elements.form.attr("action",this.elements.form.attr("data-tr-url")):this.elements.form.attr("action",this.elements.form.attr("data-url"))):(this.privateRepo=!1,this.elements.upgradeUpsell.hide(),this.elements.upgradeUpsell.find("input[type=checkbox]").attr("checked",null),this.elements.form.attr("action",this.elements.form.attr("data-url"))),this.validate()},a.prototype.selectedPrivacyToggleElement=function(){return this.elements.privateRadio.is(":checked")?this.elements.privateRadio:this.elements.publicRadio},a.prototype.updateUpsell=function(){var a;return a=this.elements.upsells.filter("[data-login="+this.current_login+"]"),this.elements.upgradeUpsell.html(a),this.elements.upgradeUpsell.find(".js-cc-upgrade").length&&this.elements.privateRadio.is(":checked")?this.elements.form.attr("action",this.elements.form.attr("data-tr-url")):this.elements.form.attr("action",this.elements.form.attr("data-url"))},a.prototype.validate=function(){var a,b,c;return a=this.elements.form,c=!0,this.elements.repoNameField.is(".autocheck-successful")||(c=!1),a.find("dl.form.errored").length&&(c=!1),a.find(".autocheck-loading").length&&(c=!1),b=this.elements.upgradeUpsell.find("input[type=checkbox]"),this.privateRepo&&b.length&&!b.is(":checked")&&(c=!1),$("button.primary").prop("disabled",!c)},a}(),$(function(){if(!$(".page-new-repo").length)return;return new a}),$(document).on("autocheck:send","#repository_name",function(){return $(this).trigger("repoform:validate")}),$(document).on("autocheck:complete","#repository_name",function(){return $(this).trigger("repoform:validate")}),$(document).on("autocheck:success","#repository_name",function(a,b){var c,d,e;d=$(this).val();if(d&&d!==b.name)return c=$(this).closest("dl.form"),c.addClass("warn"),e=$("<dd>").addClass("warning").text("Will be created as "+b.name),c.append(e)}),$(".js-ignore-container").on("menu:activated",function(){var a,b,c,d;a=$(this).find(".js-menu-content").css({marginTop:0,height:"auto"}),c=a.offset().top-$("body").scrollTop(),b=a.outerHeight(),d=$(window).height();if(c+b>d)return a.css({marginTop:-b+(d-c)-10,height:a.height()})})}.call(this),$(function(){if(!$("body").hasClass("page-pullrequest"))return!1;var a=$(".discussion-timeline");a.find(".assignee-context").on("change","input[type=radio]",function(){$(this).closest("form").submit()}),a.find(".js-filterable-milestones").milestoneSelector(),$(document).on("ajaxSuccess",".js-inline-comment-form",function(){$(this).closest("#discussion_bucket").length?$("#files_bucket").remove():$("#discussion_bucket").remove()}),$(".js-ad...$(this).attr("href");if(!c){$(this).attr("rel","nofollow");return}var d=a.replace(/[0-9a-f]{40}/,c),e=new RegExp("/tree/"+b+"$");d=d.replace(e,""),d!=a&&$(this).attr("href",d)}),$("#slider").on("slid",function(){$(".recently-touched-branches-wrapper").hide()})}),GitHub.CachedCommitDataPoller=function(a,b){var c=$(b||document).find(".js-loading-commit-data");if(c.length==0)return;var d=$("#slider .frame-center"),e=d.data("path").replace(/\/$/,"");$.ajaxPoll({interval:a||2,url:d.data("cached-commit-url"),error:function(a){c.html('<img src="/images/modules/ajax/error.png"> Something went wrong.')},success:function(a,c,e){debug("success: %s",this.url);var f=d.data("cached-commit-url").replace(/\/cache\/.+/,"/commit/");for(var g in a){if($("#"+g).length==0)continue;var h=$("#"+g).parents("tr:first");h.find(".age").html('<time class="js-relative-date" datetime="'+moment(a[g].date).format("YYYY-MM-DDTHH:mm:ssZ")+'" title="'+moment(a[g].date).format("YYYY-MM-DD HH:mm:ss")+'">'+a[g].date+"</time>");var i;a[g].login?i='<a href="/'+a[g].login+'">'+a[g].login+"</a>":i=a[g].author,h.find(".message").html('<a href="'+f+a[g].commit+'" class="message">'+a[g].message+"</a>"+" ["+i+"]")}$(b||document.body).pageUpdate()}})},$.pageUpdate(function(){$("#slider .frame-center #readme").length>0?$("#read_more").show():$("#read_more").hide()}),$(function(){$(".tabnav").delegate(".js-commitish-button","click",function(a){a.preventDefault()}),$(".pagehead .tabnav")[0]&&$(".pagehead .tabnav a[data-name]").live("mousedown",function(){if(GitHub.actionName!="show")return;var a=$(this).attr("data-name"),b="/"+GitHub.nameWithOwner+"/"+GitHub.controllerName+"/"+a;GitHub.currentPath!=""&&(b+="/"+GitHub.currentPath),b!=$(this).attr("href")&&$(this).attr("href",b)}),GitHub.CachedCommitDataPoller()}),GitHub.TreeFinder=function(){if($("#slider").length==0)return;var a=this;$.hotkeys({t:function(){return a.show(),!1}})},GitHub.TreeFinder.prototype={fileList:null,recentFiles:[],currentFinder:null,currentInput:null,currentQuery:null,show:function(){if(this.currentFinder)return;var a=this,b;a.currentFinder=$(".tree-finder").clone().show(),a.currentInput=a.currentFinder.find("input"),a.currentQuery=null,GitHub.slider.slideForwardToLoading(),b=a.currentFinder.find(".breadcrumb").detach().addClass("js-tree-finder-breadcrumb"),$("#slider .breadcrumb:visible").hide().after(b),$("#slider").bind("slid",function(){$("#slider .frame-center").is(":not(.tree-finder)")&&a.hide()}),a.attachBehaviors()},hide:function(){if(!this.currentFinder)return;var a=this;a.currentInput.blur(),a.currentFinder.remove(),$(".js-tree-finder-breadcrumb").remove(),a.currentFinder=a.currentInput=null,$("#slider").unbind("slid")},attachBehaviors:function(){var a=this,b=null,c=null;a.loadFileList(),$(".js-dismiss-tree-list-help").live("click",function(){return $.post(this.getAttribute("href")),$(this).closest(".octotip").fadeOut(function(){$(".tree-finder .octotip").remove()}),a.currentInput.focus(),!1}),a.currentFinder.find(".js-results-list").delegate("a","click",function(){var b=$(this).text(),c=$.inArray(b,a.recentFiles);c>-1&&a.recentFiles.splice(c,1),a.recentFiles.unshift(b),a.currentInput.blur(),$(document).unbind("keydown.treeFinder");if(GitHub.slider.enabled)return!0;document.location=$(this).attr("href")}),$("tr td.icon",a.currentFinder).live("click",function(){$(this).parents("tr:first").find("td a").click()}),$(document).bind("keydown.treeFinder",function(a){if(a.keyCode==27)return!GitHub.slider.sliding&&$("#slider .frame-center").is(".tree-finder")&&(GitHub.slider.slideBackTo(location.pathname),$(document).unbind("keydown.treeFinder")),!1}),a.currentFinder.on("navigation:open","tr",function(a){a.modifierKey?(window.open($(this).find("a")[0].href,"_blank"),window.focus()):$(this).find("a").click()}),a.currentInput.focus().keyup(function(){b&&clearTimeout(b),b=setTimeout(function(){b=null},250)}).keydown(function(){c&&clearTimeout(c),c=setTimeout(function(){c=null,a.updateResults()},100)})},loadFileList:function(){var a=this,b=function(){a.loadedFileList()};a.fileList?b():$.ajax({url:$("#slider .frame-center").data("tree-list-url"),error:function(c){a.currentFinder&&(a.fileList=[],a.currentFinder.find(".js-no-results th").text("Something went wrong"),b())},success:function(c,d,e){c?a.fileList=$.trim(c).split("\n"):a.fileList=[],b()}})},loadedFileList:function(){var a=this;if(!a.currentFinder)return;$("#slider .frame-center").replaceWith(a.currentFinder),a.updateResults()},updateResults:function(){var a=this;if(a.currentFinder&&a.fileList){var b=a.currentInput.val(),c=[],d=a.currentFinder.find(".js-results-list"),e="",f=0;if(this.currentQuery==b)return;this.currentQuery=b,b?c=a.findMatchingFiles(b):a.recentFiles.length?(c=a.recentFiles.slice(1,6),c.length<20&&(c=c.concat(a.fileList.slice(0,20-c.length)))):c=a.fileList;if(c.length<=0)d.html(""),a.currentFinder.find(".js-no-results").show(),a.currentFinder.find(".js-header").hide();else{a.currentFinder.find(".js-no-results"
).hide(),a.currentFinder.find(".js-header").show(),c=c.slice(0,50);var g,h=this.regexpForQuery(b),i=function(a,b){return b%2==1?"<b>"+a+"</b>":a};for(f=0;f<c.length;f++){g=(c[f].match(h)||[]).slice(1).map(i).join("");var j=$("#slider .frame-center").data("blob-url-prefix")+"/"+c[f];e+='<tr class="js-navigation-item"><td class="icon"><span class="mini-icon mini-icon-text-file"></span></td><td><a class="js-slide-to js-rewrite-sha" href="'+j+'">'+g+"</a></td></tr>"}d.html(e),d.pageUpdate(),d.navigation("focus")}}},findMatchingFiles:function(a){if(!a)return[];var b=this,c=[],d=0,e,f,g,h;a=a.toLowerCase(),e=this.regexpForQuery(a);for(d=0;d<b.fileList.length;d++){f=b.fileList[d],g=f.toLowerCase();if(f.match(/^vendor\/(cache|rails|gems)/))continue;if(f.match(/(dot_git|\.git\/)/))continue;g.match(e)&&(h=g.score(a),h>0&&(a.match("/")||(g.match("/")?h+=g.replace(/^.*\//,"").score(a):h*=2),c.push([h,f])))}return $.map(c.sort(function(a,b){return b[0]-a[0]}),function(a){return a[1]})},regexpForQuery:function(a){var b="+.*?[]{}()^$|\\".replace(/(.)/g,"\\$1"),c=new RegExp("\\((["+b+"])\\)","g");return new RegExp("(.*)"+a.toLowerCase().replace(/(.)/g,"($1)(.*?)").replace(c,"(\\$1)")+"$","i")}},$(function(){new GitHub.TreeFinder}),GitHub.TreeSlider=function(){if(!Modernizr.history)return;if($("#slider").length==0)return;if(navigator.userAgent.match(/(iPod|iPhone|iPad)/))return;var a=this;a.enabled=!0,$("#slider a.js-slide-to, .breadcrumb a").live("click",function(b){return a.clickHandler(b)}),$(window).bind("popstate",function(b){a.popStateHandler(b.originalEvent)})},GitHub.TreeSlider.prototype={enabled:!1,sliding:!1,slideSpeed:400,frameForPath:function(a){return $(".frame").filter(function(){return $(this).attr("data-path")===a})},frameForURL:function(a){return this.frameForPath(this.pathFromURL(a))},pathFromURL:function(a){if(!a)return;var b=$(" .repo-tree").attr("data-ref"),c=new RegExp("/(tree|blob)/"+(b||"[^/]+")+"/"),d=a.split(c)[2]||"/";return d.slice(d.length-1,d.length)!="/"&&(d+="/"),unescape(d)},scrollToBreadcrumb:function(){this.visibleInBrowser(".breadcrumb:visible")||$(".breadcrumb:visible").scrollTo({duration:50})},visibleInBrowser:function(a){var b=$(window).scrollTop(),c=b+$(window).height(),d=$(a).offset().top,e=d+$(a).height();return e>=b&&d<=c},clickHandler:function(a){if(a.which==2||a.metaKey||a.ctrlKey)return!0;if(this.sliding)return!1;var b=a.currentTarget.href,c=this.pathFromURL(b);return window.history.pushState({path:c},"",b),typeof _gaq!="undefined"&&_gaq.push(["_trackPageview"]),this.slideTo(b),!1},popStateHandler:function(a){this.slideTo(location.pathname)},doneSliding:function(){if(!this.sliding)return;this.sliding=!1,$("#slider .frame-center").nextAll(".frame").hide(),$("#slider .frame-center").prevAll(".frame").css("visibility","hidden");var a=$(".frame-loading:visible");a.length?a.removeClass("frame-loading"):$("#slider").trigger("slid")},slideTo:function(a){var b=this.pathFromURL(a),c=this.frameForPath(b),d=$("#slider .frame-center").attr("data-path")||"";c.is(".frame-center")||(d=="/"||b.split("/").length>d.split("/").length?this.slideForwardTo(a):this.slideBackTo(a))},slideForwardTo:function(a){debug("Sliding forward to %s",a);var b=this.frameForURL(a);if(b.length)this.slideForwardToFrame(b);else{var c=this.slideForwardToLoading();this.loadFrame(a,function(a){c.replaceWith(a.find(".frame-center"))})}},slideForwardToFrame:function(a){if(this.sliding)return;this.sliding=!0;var b=this;$("#slider .frame-center").after(a.css("marginLeft",0)).addClass("frame").removeClass("frame-center").animate({marginLeft:"-1200px"},this.slideSpeed,function(){b.doneSliding()}),this.makeCenterFrame(a),this.setFrameTitle(a),this.setFrameCanonicalURL(a)},slideForwardToLoading:function(){var a=$(".frame-loading").clone();return a.find("img").hide(),setTimeout(function(){a.find("img").show()},500),$(".frames").append(a),this.slideForwardToFrame(a),a},slideBackTo:function(a){debug("Sliding back to %s",a);var b=this.frameForURL(a);if(b.length)this.slideBackToFrame(b);else{var c=this.slideBackToLoading(),d=this.pathFromURL(a);this.loadFrame(a,function(a){c.replaceWith(a.find(".frame-center"))})}},slideBackToFrame:function(a){if(this.sliding)return;this.sliding=!0;var b=this;$("#slider .frame-center").before(a.css("marginLeft","-1200px")).addClass("frame").removeClass("frame-center"),a.animate({marginLeft:"0"},this.slideSpeed,function(){b.doneSliding()}),this.makeCenterFrame(a),this.setFrameTitle(a),this.setFrameCanonicalURL(a)},slideBackToLoading:function(){var a=$(".frame-loading").clone();return a.find("img").hide(),setTimeout(function(){a.find("img").show()},350),$(".frames").prepend(a.show()),this.slideBackToFrame(a),a},makeCenterFrame:function(a){a.css("visibility","visible").show().addClass("frame-center"),this.scrollToBreadcrumb(),$(".file-history-tease:visible").hide();var b=$('.file-history-tease[data-path="'+a.attr("data-path")+'"]');b.length>0&&b.show(),a.attr("data-path")=="/"?($(".last-commit, .commit...s({left:g});var i=Math.round(g/(parseInt(f.find(".swipe-frame").css("width"))-15)*1e4)/1e4;f.find(".swipe .swipe-shell").css("width",D-D*i),c[d].pct=i*100,c[d].changed=!0}),$(document).on("mouseup.swipe",function(){$(document).off(".swipe"),$("body").css({cursor:"auto"}),I()})});var E=1;e>b-12&&(E=(b-12)/e),q.attr({width:B.width*E,height:B.height*E}),r.attr({width:C.width*E,height:C.height*E}),i.find(".deleted-frame").css({margin:B.marginVert*E+"px "+B.marginHoriz*E+"px",width:B.width*E+2,height:B.height*E+2}),i.find(".added-frame").css({margin:C.marginVert*E+"px "+C.marginHoriz*E+"px",width:C.width*E+2,height:C.height*E+2}),i.find(".onion-skin-frame").css({width:e*E+4+"px",height:k*E+30+"px"}),f.find(".dragger").css("left",x*262+"px"),f.find(".onion-skin .added-frame").css("opacity",x),f.find(".onion-skin .added-frame img").css("opacity",x),f.find(".dragger").on("mousedown",function(a){var b=$(this),e=$(this).parent(),g=0,h=e.width()-b.width();a.preventDefault(),$("body").css({cursor:"pointer"}),$(document).on("mousemove.dragger",function(a){a.preventDefault();var g=a.clientX-e.offset().left;g<0&&(g=0),g>h&&(g=h),b.css({left:g});var i=Math.round(g/262*100)/100;f.find(".onion-skin .added-frame").css("opacity",i),f.find(".onion-skin .added-frame img").css("opacity",i),c[d].pct=i*100,c[d].changed=!0}),$(document).on("mouseup.dragger",function(){$(document).off(".dragger"),$("body").css({cursor:"auto"}),I()})});var G=1;e>b-4&&(G=(b-4)/e),Modernizr.canvas&&(s.attr({width:e*G,height:k*G}),t.attr({width:e*G,height:k*G}),j.find(".added-frame").css({width:e*G+2,height:k*G+2}),j.find(".deleted-frame").css({width:e*G+2,height:k*G+2}),u.drawImage(B,B.marginHoriz*G,B.marginVert*G,B.width*G,B.height*G),v.drawImage(C,C.marginHoriz*G,C.marginVert*G,C.width*G,C.height*G),a(v,u)),g.css("height",k*z+30),h.css("height",k*A+30),i.css("height",k*A+30),j.css("height",k*A+30),w.children().removeClass("disabled"),F(y)}function H(){var a=A/z*100+"%";f.find(".progress-bar").animate({width:a},250,"swing")}function I(){var a="?";$.each(c,function(b,c){c["changed"]==1&&(b!=0&&(a+="&"),a+="diff-"+b+"="+c.view+"-"+Math.round(c.pct))}),Modernizr.history&&window.history.replaceState({},"",a)}var f=b.eq(d),g=f.find(".two-up").eq(0),h=f.find(".swipe").eq(0),i=f.find(".onion-skin").eq(0),j=f.find(".difference").eq(0),k=f.find(".deleted"),l=f.find(".added"),m=k.eq(0),n=l.eq(0),o=k.eq(1),p=l.eq(1),q=k.eq(2),r=l.eq(2),s=f.find("canvas.deleted").eq(0),t=f.find("canvas.added").eq(0),u,v,w=f.find("ul.view-modes-menu"),x=f.find(".view"),y=0,z=f.find(".asset").length,A=0,B=new Image,C=new Image;c.push({name:f.attr("id"),view:0,pct:0,changed:!1}),Modernizr.canvas?(u=s[0].getContext("2d"),v=t[0].getContext("2d")):w.children().eq(3).addClass("hidden"),f.find(".two-up").hide(),f.find(".two-up p").removeClass("hidden"),f.find(".progress").removeClass("hidden"),f.find(".view-modes").removeClass("hidden"),B.src=f.find(".deleted").first().attr("src"),C.src=f.find(".added").first().attr("src"),m.attr("src",B.src).load(function(){E()}),n.attr("src",C.src).load(function(){E()}),o.attr("src",B.src).load(function(){E()}),p.attr("src",C.src).load(function(){E()}),q.attr("src",B.src).load(function(){E()}),r.attr("src",C.src).load(function(){E()}),$stats.increment("ui.slider.loaded");var D=!0;w.children("li").click(function(){var a=$(this).index();(a==1||a==2)&&D&&($stats.increment("ui.slider."+(a==1?"swipe":"onion-skin")),D=!1),F(a),c[d].view=a,c[d].changed=!0,I()}),$.extend({getUrlVars:function(){var a=[],b,c=window.location.href.slice(window.location.href.indexOf("?")+1).split("&");for(var d=0;d<c.length;d++)b=c[d].split("="),b[1]&&(b[1]=b[1].split("-")),a.push(b[0]),a[b[0]]=b[1];return a},getUrlVar:function(a){return $.getUrlVars()[a]}})})}}),$(function(){function b(){var c=$("#current-version").val();c&&$.get("_current",function(d){c==d?setTimeout(b,5e3):a||($("#gollum-error-message").text("Someone has edited the wiki since you started. Please reload this page and re-apply your changes."),$("#gollum-error-message").show(),$("#gollum-editor-submit").attr("disabled","disabled"),$("#gollum-editor-submit").attr("value","Cannot Save, Someone Else Has Edited"))})}$("#see-more-elsewhere").click(function(){return $(".seen-elsewhere").show(),$(this).remove(),!1});var a=!1;$("#gollum-editor-body").each(b),$("#gollum-editor-submit").click(function(){a=!0});var c=[];$("form#history input[type=submit]").attr("disabled",!0),$("form#history input[type=checkbox]").change(function(){var a=$(this).val(),b=$.inArray(a,c);if(b>-1)c.splice(b,1);else{c.push(a);if(c.length>2){var d=c.shift();$("input[value="+d+"]").attr("checked",!1)}}$("form#history tr.commit").removeClass("selected"),$("form#history input[type=submit]").attr("disabled",!0);if(c.length==2){$("form#history input[type=submit]").attr("disabled",!1);var e=!1;$("form#history tr.commit").each(function(){e&&$(this).addClass("selected"),$(this).find("input:checked").length>0&&(e=!e),e&&$(this).addClass("selected")})}})});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment