scripts.js 158 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840
  1. // ========================== ALL SCRIPTS TOC =============================== //
  2. // ========== https://github.com/tuupola/jquery_lazyload ==================== //
  3. // ====== https://github.com/ixisio/bootstrap-touch-carousel ================ //
  4. // ============ https://github.com/Formstone/Wallpaper ====================== //
  5. // ========== https://github.com/ccampbell/rainbow ========================== //
  6. // ============ https://github.com/morr/jquery.appear ======================= //
  7. // ============ https://github.com/callmenick/Draw-Fill-SVG ================= //
  8. // ============ https://github.com/mattboldt/typed.js/ ====================== //
  9. // ============ https://github.com/balupton/jquery-scrollto ================= //
  10. // ==============https://github.com/matthieua/WOW =========================== //
  11. // ============ https://github.com/miguel-perez/jquery.smoothState.js ======= //
  12. // ============ https://github.com/carhartl/jquery-cookie =================== //
  13. // ======== https://github.com/imakewebthings/jquery-waypoints ============== //
  14. // ============= https://github.com/kirbysayshi/ghembedder ================= //
  15. // ============== https://github.com/js-cookie/js-cookie ==================== //
  16. // --------------------- Lazy Load 1.9.7 ---------------------------------- //
  17. // ========== https://github.com/tuupola/jquery_lazyload =================== //
  18. // ------------------------------------------------------------------------- //
  19. !function(a,b,c,d){var e=a(b);a.fn.lazyload=function(f){function g(){var b=0;i.each(function(){var c=a(this);if(!j.skip_invisible||c.is(":visible"))if(a.abovethetop(this,j)||a.leftofbegin(this,j));else if(a.belowthefold(this,j)||a.rightoffold(this,j)){if(++b>j.failure_limit)return!1}else c.trigger("appear"),b=0})}var h,i=this,j={threshold:0,failure_limit:0,event:"scroll",effect:"show",container:b,data_attribute:"original",skip_invisible:!1,appear:null,load:null,placeholder:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB/AAffA0nNPuCLAAAAAElFTkSuQmCC"};return f&&(d!==f.failurelimit&&(f.failure_limit=f.failurelimit,delete f.failurelimit),d!==f.effectspeed&&(f.effect_speed=f.effectspeed,delete f.effectspeed),a.extend(j,f)),h=j.container===d||j.container===b?e:a(j.container),0===j.event.indexOf("scroll")&&h.bind(j.event,function(){return g()}),this.each(function(){var b=this,c=a(b);b.loaded=!1,(c.attr("src")===d||c.attr("src")===!1)&&c.is("img")&&c.attr("src",j.placeholder),c.one("appear",function(){if(!this.loaded){if(j.appear){var d=i.length;j.appear.call(b,d,j)}a("<img />").bind("load",function(){var d=c.attr("data-"+j.data_attribute);c.hide(),c.is("img")?c.attr("src",d):c.css("background-image","url('"+d+"')"),c[j.effect](j.effect_speed),b.loaded=!0;var e=a.grep(i,function(a){return!a.loaded});if(i=a(e),j.load){var f=i.length;j.load.call(b,f,j)}}).attr("src",c.attr("data-"+j.data_attribute))}}),0!==j.event.indexOf("scroll")&&c.bind(j.event,function(){b.loaded||c.trigger("appear")})}),e.bind("resize",function(){g()}),/(?:iphone|ipod|ipad).*os 5/gi.test(navigator.appVersion)&&e.bind("pageshow",function(b){b.originalEvent&&b.originalEvent.persisted&&i.each(function(){a(this).trigger("appear")})}),a(c).ready(function(){g()}),this},a.belowthefold=function(c,f){var g;return g=f.container===d||f.container===b?(b.innerHeight?b.innerHeight:e.height())+e.scrollTop():a(f.container).offset().top+a(f.container).height(),g<=a(c).offset().top-f.threshold},a.rightoffold=function(c,f){var g;return g=f.container===d||f.container===b?e.width()+e.scrollLeft():a(f.container).offset().left+a(f.container).width(),g<=a(c).offset().left-f.threshold},a.abovethetop=function(c,f){var g;return g=f.container===d||f.container===b?e.scrollTop():a(f.container).offset().top,g>=a(c).offset().top+f.threshold+a(c).height()},a.leftofbegin=function(c,f){var g;return g=f.container===d||f.container===b?e.scrollLeft():a(f.container).offset().left,g>=a(c).offset().left+f.threshold+a(c).width()},a.inviewport=function(b,c){return!(a.rightoffold(b,c)||a.leftofbegin(b,c)||a.belowthefold(b,c)||a.abovethetop(b,c))},a.extend(a.expr[":"],{"below-the-fold":function(b){return a.belowthefold(b,{threshold:0})},"above-the-top":function(b){return!a.belowthefold(b,{threshold:0})},"right-of-screen":function(b){return a.rightoffold(b,{threshold:0})},"left-of-screen":function(b){return!a.rightoffold(b,{threshold:0})},"in-viewport":function(b){return a.inviewport(b,{threshold:0})},"above-the-fold":function(b){return!a.belowthefold(b,{threshold:0})},"right-of-fold":function(b){return a.rightoffold(b,{threshold:0})},"left-of-fold":function(b){return!a.rightoffold(b,{threshold:0})}})}(jQuery,window,document);
  20. // ------------- Touch Carousel Hammer.js ---------------------------------- //
  21. // ====== https://github.com/ixisio/bootstrap-touch-carousel =============== //
  22. // ------------------------------------------------------------------------- //
  23. +function(a){"use strict";function b(a,b){var c=document.createElement("div").style;for(var d in a)if(void 0!==c[a[d]])return"pfx"==b?a[d]:!0;return!1}function c(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]}}function d(){var a=["transformProperty","WebkitTransform","MozTransform","msTransform"];return!!b(a)}function e(){return"WebKitCSSMatrix"in window&&"m11"in new WebKitCSSMatrix}if(!("ontouchstart"in window||navigator.msMaxTouchPoints))return!1;a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one(a.support.transition.end,function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=c(),a.support.csstransforms=d(),a.support.csstransforms3d=e()});var f="touch-carousel",g=function(b,c){return this.$element=a(b),this.$itemsWrapper=this.$element.find(".carousel-inner"),this.$items=this.$element.find(".item"),this.$indicators=this.$element.find(".carousel-indicators"),this.pane_width=this.pane_count=this.current_pane=0,this.onGesture=!1,this.options=c,this._setPaneDimensions(),this.$items.length<=1?this.disable():(this._regTouchGestures(),void a(window).on("orientationchange resize",a.proxy(this._setPaneDimensions,this)))};g.DEFAULTS={interval:!1,toughness:.25},g.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},g.prototype.to=function(a){return a>this.$items.length-1||0>a?void 0:this._showPane(a)},g.prototype.pause=function(a){return a||(this.paused=!0),clearInterval(this.interval),this.interval=null,this},g.prototype._regTouchGestures=function(){this.$itemsWrapper.add(this.$indicators).hammer({drag_lock_to_axis:!0,preventDefault:!0}).on("release dragleft dragright swipeleft swiperight",a.proxy(this._handleGestures,this))},g.prototype._setPaneDimensions=function(){this.pane_width=this.$element.width(),this.pane_count=this.$items.length,this.$itemsWrapper.width(this.pane_width*this.pane_count),this.$items.width(this.pane_width)},g.prototype._showPane=function(a){this.$items.eq(this.current_pane).toggleClass("active"),a>=this.pane_count&&this.pause(),a=Math.max(0,Math.min(a,this.pane_count-1));this.$items.eq(a).toggleClass("active");this.current_pane=a;var b=-(100/this.pane_count*this.current_pane);return this._setContainerOffset(b,!0,a),this},g.prototype._setContainerOffset=function(b,c,d){var e=this;if(this.$itemsWrapper.removeClass("animate"),c&&this.$itemsWrapper.addClass("animate"),a.support.csstransforms3d)this.onGesture=!0,this.$itemsWrapper.css("transform","translate3d("+b+"%,0,0) scale3d(1,1,1)");else if(a.support.csstransforms)this.onGesture=!0,this.$itemsWrapper.css("transform","translate("+b+"%,0)");else{var f=this.pane_width*this.pane_count/100*b;this.$itemsWrapper.css("left",f+"px")}a.support.transition?this.$itemsWrapper.one(a.support.transition.end,function(){e.$itemsWrapper.removeClass("animate"),e.onGesture=!1,e._updateIndicators(d)}):(this.$itemsWrapper.removeClass("animate"),this.onGesture=!1,this._updateIndicators(d))},g.prototype.next=function(){return this._showPane(this.current_pane+1)},g.prototype.prev=function(){return this._showPane(this.current_pane-1)},g.prototype._handleGestures=function(a){if(!this.sliding)switch(this.pause(),a.type){case"dragright":case"dragleft":var b=-(100/this.pane_count)*this.current_pane,c=100/this.pane_width*a.gesture.deltaX/this.pane_count;(0===this.current_pane&&a.gesture.direction==Hammer.DIRECTION_RIGHT||this.current_pane==this.pane_count-1&&a.gesture.direction==Hammer.DIRECTION_LEFT)&&(c*=this.options.toughness),this._setContainerOffset(c+b);break;case"swipeleft":this.next(),a.gesture.stopDetect();break;case"swiperight":this.prev(),a.gesture.stopDetect();break;case"release":Math.abs(a.gesture.deltaX)>this.pane_width/2?"right"==a.gesture.direction?this.prev():this.next():this._showPane(this.current_pane,!0)}},g.prototype.disable=function(){return this.$indicators.hide(),this.$element.removeData(f),!1},g.prototype._updateIndicators=function(a){return this.$indicators.length&&(this.$indicators.find(".active").removeClass("active"),this.$indicators.children().eq(a).addClass("active")),this.$element.trigger("slid.bs.carousel"),this};var h=a.fn.carousel;a.fn.carousel=function(b){return this.each(function(){var c=a(this),d=c.data(f),e=a.extend({},g.DEFAULTS,c.data(),"object"==typeof b&&b),h="string"==typeof b?b:e.slide;d||c.data(f,d=new g(this,e)).addClass(f),"number"==typeof b?d.to(b):h?d[h]():e.interval&&d.pause().cycle()})},a.fn.carousel.Constructor=g,a.fn.carousel.noConflict=function(){return a.fn.carousel=h,this},a(document).off("click.bs.carousel").on("click.bs.carousel.data-api","[data-slide], [data-slide-to]",function(b){var c,d=a(this),e=a(d.attr("data-target")||(c=d.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"")),g=a.extend({},e.data(),d.data()),h=d.attr("data-slide-to");h&&(g.interval=!1),e.carousel(g),(h=d.attr("data-slide-to"))&&e.data(f).to(h),b.preventDefault()})}(window.jQuery),function(a,b){"use strict";function c(){if(!d.READY){d.event.determineEventTypes();for(var a in d.gestures)d.gestures.hasOwnProperty(a)&&d.detection.register(d.gestures[a]);d.event.onTouch(d.DOCUMENT,d.EVENT_MOVE,d.detection.detect),d.event.onTouch(d.DOCUMENT,d.EVENT_END,d.detection.detect),d.READY=!0}}var d=function(a,b){return new d.Instance(a,b||{})};d.defaults={stop_browser_behavior:{userSelect:"none",touchAction:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}},d.HAS_POINTEREVENTS=a.navigator.pointerEnabled||a.navigator.msPointerEnabled,d.HAS_TOUCHEVENTS="ontouchstart"in a,d.MOBILE_REGEX=/mobile|tablet|ip(ad|hone|od)|android|silk/i,d.NO_MOUSEEVENTS=d.HAS_TOUCHEVENTS&&a.navigator.userAgent.match(d.MOBILE_REGEX),d.EVENT_TYPES={},d.DIRECTION_DOWN="down",d.DIRECTION_LEFT="left",d.DIRECTION_UP="up",d.DIRECTION_RIGHT="right",d.POINTER_MOUSE="mouse",d.POINTER_TOUCH="touch",d.POINTER_PEN="pen",d.EVENT_START="start",d.EVENT_MOVE="move",d.EVENT_END="end",d.DOCUMENT=a.document,d.plugins={},d.READY=!1,d.Instance=function(a,b){var e=this;return c(),this.element=a,this.enabled=!0,this.options=d.utils.extend(d.utils.extend({},d.defaults),b||{}),this.options.stop_browser_behavior&&d.utils.stopDefaultBrowserBehavior(this.element,this.options.stop_browser_behavior),d.event.onTouch(a,d.EVENT_START,function(a){e.enabled&&d.detection.startDetect(e,a)}),this},d.Instance.prototype={on:function(a,b){for(var c=a.split(" "),d=0;d<c.length;d++)this.element.addEventListener(c[d],b,!1);return this},off:function(a,b){for(var c=a.split(" "),d=0;d<c.length;d++)this.element.removeEventListener(c[d],b,!1);return this},trigger:function(a,b){b||(b={});var c=d.DOCUMENT.createEvent("Event");c.initEvent(a,!0,!0),c.gesture=b;var e=this.element;return d.utils.hasParent(b.target,e)&&(e=b.target),e.dispatchEvent(c),this},enable:function(a){return this.enabled=a,this}};var e=null,f=!1,g=!1;d.event={bindDom:function(a,b,c){for(var d=b.split(" "),e=0;e<d.length;e++)a.addEventListener(d[e],c,!1)},onTouch:function(a,b,c){var h=this;this.bindDom(a,d.EVENT_TYPES[b],function(i){var j=i.type.toLowerCase();if(!j.match(/mouse/)||!g){j.match(/touch/)||j.match(/pointerdown/)||j.match(/mouse/)&&1===i.which?f=!0:j.match(/mouse/)&&1!==i.which&&(f=!1),j.match(/touch|pointer/)&&(g=!0);var k=0;f&&(d.HAS_POINTEREVENTS&&b!=d.EVENT_END?k=d.PointerEvent.updatePointer(b,i):j.match(/touch/)?k=i.touches.length:g||(k=j.match(/up/)?0:1),k>0&&b==d.EVENT_END?b=d.EVENT_MOVE:k||(b=d.EVENT_END),(k||null===e)&&(e=i),c.call(d.detection,h.collectEventData(a,b,h.getTouchList(e,b),i)),d.HAS_POINTEREVENTS&&b==d.EVENT_END&&(k=d.PointerEvent.updatePointer(b,i))),k||(e=null,f=!1,g=!1,d.PointerEvent.reset())}})},determineEventTypes:function(){var a;a=d.HAS_POINTEREVENTS?d.PointerEvent.getEvents():d.NO_MOUSEEVENTS?["touchstart","touchmove","touchend touchcancel"]:["touchstart mousedown","touchmove mousemove","touchend touchcancel mouseup"],d.EVENT_TYPES[d.EVENT_START]=a[0],d.EVENT_TYPES[d.EVENT_MOVE]=a[1],d.EVENT_TYPES[d.EVENT_END]=a[2]},getTouchList:function(a){return d.HAS_POINTEREVENTS?d.PointerEvent.getTouchList():a.touches?a.touches:(a.indentifier=1,[a])},collectEventData:function(a,b,c,e){var f=d.POINTER_TOUCH;return(e.type.match(/mouse/)||d.PointerEvent.matchType(d.POINTER_MOUSE,e))&&(f=d.POINTER_MOUSE),{center:d.utils.getCenter(c),timeStamp:(new Date).getTime(),target:e.target,touches:c,eventType:b,pointerType:f,srcEvent:e,preventDefault:function(){this.srcEvent.preventManipulation&&this.srcEvent.preventManipulation(),this.srcEvent.preventDefault&&this.srcEvent.preventDefault()},stopPropagation:function(){this.srcEvent.stopPropagation()},stopDetect:function(){return d.detection.stopDetect()}}}},d.PointerEvent={pointers:{},getTouchList:function(){var a=this,b=[];return Object.keys(a.pointers).sort().forEach(function(c){b.push(a.pointers[c])}),b},updatePointer:function(a,b){return a==d.EVENT_END?this.pointers={}:(b.identifier=b.pointerId,this.pointers[b.pointerId]=b),Object.keys(this.pointers).length},matchType:function(a,b){if(!b.pointerType)return!1;var c={};return c[d.POINTER_MOUSE]=b.pointerType==b.MSPOINTER_TYPE_MOUSE||b.pointerType==d.POINTER_MOUSE,c[d.POINTER_TOUCH]=b.pointerType==b.MSPOINTER_TYPE_TOUCH||b.pointerType==d.POINTER_TOUCH,c[d.POINTER_PEN]=b.pointerType==b.MSPOINTER_TYPE_PEN||b.pointerType==d.POINTER_PEN,c[a]},getEvents:function(){return["pointerdown MSPointerDown","pointermove MSPointerMove","pointerup pointercancel MSPointerUp MSPointerCancel"]},reset:function(){this.pointers={}}},d.utils={extend:function(a,c,d){for(var e in c)a[e]!==b&&d||(a[e]=c[e]);return a},hasParent:function(a,b){for(;a;){if(a==b)return!0;a=a.parentNode}return!1},getCenter:function(a){for(var b=[],c=[],d=0,e=a.length;e>d;d++)b.push(a[d].pageX),c.push(a[d].pageY);return{pageX:(Math.min.apply(Math,b)+Math.max.apply(Math,b))/2,pageY:(Math.min.apply(Math,c)+Math.max.apply(Math,c))/2}},getVelocity:function(a,b,c){return{x:Math.abs(b/a)||0,y:Math.abs(c/a)||0}},getAngle:function(a,b){var c=b.pageY-a.pageY,d=b.pageX-a.pageX;return 180*Math.atan2(c,d)/Math.PI},getDirection:function(a,b){var c=Math.abs(a.pageX-b.pageX),e=Math.abs(a.pageY-b.pageY);return c>=e?a.pageX-b.pageX>0?d.DIRECTION_LEFT:d.DIRECTION_RIGHT:a.pageY-b.pageY>0?d.DIRECTION_UP:d.DIRECTION_DOWN},getDistance:function(a,b){var c=b.pageX-a.pageX,d=b.pageY-a.pageY;return Math.sqrt(c*c+d*d)},getScale:function(a,b){return a.length>=2&&b.length>=2?this.getDistance(b[0],b[1])/this.getDistance(a[0],a[1]):1},getRotation:function(a,b){return a.length>=2&&b.length>=2?this.getAngle(b[1],b[0])-this.getAngle(a[1],a[0]):0},isVertical:function(a){return a==d.DIRECTION_UP||a==d.DIRECTION_DOWN},stopDefaultBrowserBehavior:function(a,b){var c,d=["webkit","khtml","moz","Moz","ms","o",""];if(b&&a.style){for(var e=0;e<d.length;e++)for(var f in b)b.hasOwnProperty(f)&&(c=f,d[e]&&(c=d[e]+c.substring(0,1).toUpperCase()+c.substring(1)),a.style[c]=b[f]);"none"==b.userSelect&&(a.onselectstart=function(){return!1}),"none"==b.userDrag&&(a.ondragstart=function(){return!1})}}},d.detection={gestures:[],current:null,previous:null,stopped:!1,startDetect:function(a,b){this.current||(this.stopped=!1,this.current={inst:a,startEvent:d.utils.extend({},b),lastEvent:!1,name:""},this.detect(b))},detect:function(a){if(this.current&&!this.stopped){a=this.extendEventData(a);for(var b=this.current.inst.options,c=0,e=this.gestures.length;e>c;c++){var f=this.gestures[c];if(!this.stopped&&b[f.name]!==!1&&f.handler.call(f,a,this.current.inst)===!1){this.stopDetect();break}}return this.current&&(this.current.lastEvent=a),a.eventType==d.EVENT_END&&!a.touches.length-1&&this.stopDetect(),a}},stopDetect:function(){this.previous=d.utils.extend({},this.current),this.current=null,this.stopped=!0},extendEventData:function(a){var b=this.current.startEvent;if(b&&(a.touches.length!=b.touches.length||a.touches===b.touches)){b.touches=[];for(var c=0,e=a.touches.length;e>c;c++)b.touches.push(d.utils.extend({},a.touches[c]))}var f=a.timeStamp-b.timeStamp,g=a.center.pageX-b.center.pageX,h=a.center.pageY-b.center.pageY,i=d.utils.getVelocity(f,g,h);return d.utils.extend(a,{deltaTime:f,deltaX:g,deltaY:h,velocityX:i.x,velocityY:i.y,distance:d.utils.getDistance(b.center,a.center),angle:d.utils.getAngle(b.center,a.center),interimAngle:this.current.lastEvent&&d.utils.getAngle(this.current.lastEvent.center,a.center),direction:d.utils.getDirection(b.center,a.center),interimDirection:this.current.lastEvent&&d.utils.getDirection(this.current.lastEvent.center,a.center),scale:d.utils.getScale(b.touches,a.touches),rotation:d.utils.getRotation(b.touches,a.touches),startEvent:b}),a},register:function(a){var c=a.defaults||{};return c[a.name]===b&&(c[a.name]=!0),d.utils.extend(d.defaults,c,!0),a.index=a.index||1e3,this.gestures.push(a),this.gestures.sort(function(a,b){return a.index<b.index?-1:a.index>b.index?1:0}),this.gestures}},d.gestures=d.gestures||{},d.gestures.Hold={name:"hold",index:10,defaults:{hold_timeout:500,hold_threshold:1},timer:null,handler:function(a,b){switch(a.eventType){case d.EVENT_START:clearTimeout(this.timer),d.detection.current.name=this.name,this.timer=setTimeout(function(){"hold"==d.detection.current.name&&b.trigger("hold",a)},b.options.hold_timeout);break;case d.EVENT_MOVE:a.distance>b.options.hold_threshold&&clearTimeout(this.timer);break;case d.EVENT_END:clearTimeout(this.timer)}}},d.gestures.Tap={name:"tap",index:100,defaults:{tap_max_touchtime:250,tap_max_distance:10,tap_always:!0,doubletap_distance:20,doubletap_interval:300},handler:function(a,b){if(a.eventType==d.EVENT_END&&"touchcancel"!=a.srcEvent.type){var c=d.detection.previous,e=!1;if(a.deltaTime>b.options.tap_max_touchtime||a.distance>b.options.tap_max_distance)return;c&&"tap"==c.name&&a.timeStamp-c.lastEvent.timeStamp<b.options.doubletap_interval&&a.distance<b.options.doubletap_distance&&(b.trigger("doubletap",a),e=!0),(!e||b.options.tap_always)&&(d.detection.current.name="tap",b.trigger(d.detection.current.name,a))}}},d.gestures.Swipe={name:"swipe",index:40,defaults:{swipe_max_touches:1,swipe_velocity:.7},handler:function(a,b){if(a.eventType==d.EVENT_END){if(b.options.swipe_max_touches>0&&a.touches.length>b.options.swipe_max_touches)return;(a.velocityX>b.options.swipe_velocity||a.velocityY>b.options.swipe_velocity)&&(b.trigger(this.name,a),b.trigger(this.name+a.direction,a))}}},d.gestures.Drag={name:"drag",index:50,defaults:{drag_min_distance:10,correct_for_drag_min_distance:!0,drag_max_touches:1,drag_block_horizontal:!1,drag_block_vertical:!1,drag_lock_to_axis:!1,drag_lock_min_distance:25},triggered:!1,handler:function(a,b){if(d.detection.current.name!=this.name&&this.triggered)return b.trigger(this.name+"end",a),void(this.triggered=!1);if(!(b.options.drag_max_touches>0&&a.touches.length>b.options.drag_max_touches))switch(a.eventType){case d.EVENT_START:this.triggered=!1;break;case d.EVENT_MOVE:if(a.distance<b.options.drag_min_distance&&d.detection.current.name!=this.name)return;if(d.detection.current.name!=this.name&&(d.detection.current.name=this.name,b.options.correct_for_drag_min_distance)){var c=Math.abs(b.options.drag_min_distance/a.distance);d.detection.current.startEvent.center.pageX+=a.deltaX*c,d.detection.current.startEvent.center.pageY+=a.deltaY*c,a=d.detection.extendEventData(a)}(d.detection.current.lastEvent.drag_locked_to_axis||b.options.drag_lock_to_axis&&b.options.drag_lock_min_distance<=a.distance)&&(a.drag_locked_to_axis=!0);var e=d.detection.current.lastEvent.direction;a.drag_locked_to_axis&&e!==a.direction&&(a.direction=d.utils.isVertical(e)?a.deltaY<0?d.DIRECTION_UP:d.DIRECTION_DOWN:a.deltaX<0?d.DIRECTION_LEFT:d.DIRECTION_RIGHT),this.triggered||(b.trigger(this.name+"start",a),this.triggered=!0),b.trigger(this.name,a),b.trigger(this.name+a.direction,a),(b.options.drag_block_vertical&&d.utils.isVertical(a.direction)||b.options.drag_block_horizontal&&!d.utils.isVertical(a.direction))&&a.preventDefault();break;case d.EVENT_END:this.triggered&&b.trigger(this.name+"end",a),this.triggered=!1}}},d.gestures.Transform={name:"transform",index:45,defaults:{transform_min_scale:.01,transform_min_rotation:1,transform_always_block:!1},triggered:!1,handler:function(a,b){if(d.detection.current.name!=this.name&&this.triggered)return b.trigger(this.name+"end",a),void(this.triggered=!1);if(!(a.touches.length<2))switch(b.options.transform_always_block&&a.preventDefault(),a.eventType){case d.EVENT_START:this.triggered=!1;break;case d.EVENT_MOVE:var c=Math.abs(1-a.scale),e=Math.abs(a.rotation);if(c<b.options.transform_min_scale&&e<b.options.transform_min_rotation)return;d.detection.current.name=this.name,this.triggered||(b.trigger(this.name+"start",a),this.triggered=!0),b.trigger(this.name,a),e>b.options.transform_min_rotation&&b.trigger("rotate",a),c>b.options.transform_min_scale&&(b.trigger("pinch",a),b.trigger("pinch"+(a.scale<1?"in":"out"),a));break;case d.EVENT_END:this.triggered&&b.trigger(this.name+"end",a),this.triggered=!1}}},d.gestures.Touch={name:"touch",index:-1/0,defaults:{prevent_default:!1,prevent_mouseevents:!1},handler:function(a,b){return b.options.prevent_mouseevents&&a.pointerType==d.POINTER_MOUSE?void a.stopDetect():(b.options.prevent_default&&a.preventDefault(),void(a.eventType==d.EVENT_START&&b.trigger(this.name,a)))}},d.gestures.Release={name:"release",index:1/0,handler:function(a,b){a.eventType==d.EVENT_END&&b.trigger(this.name,a)}},"function"==typeof define&&"object"==typeof define.amd&&define.amd?define(function(){return d}):"object"==typeof module&&"object"==typeof module.exports?module.exports=d:a.Hammer=d}(this),function(a){"use strict";var b=function(b,c){return c===a?b:(b.event.bindDom=function(b,d,e){c(b).on(d,function(b){var c=b.originalEvent||b;c.pageX===a&&(c.pageX=b.pageX,c.pageY=b.pageY),c.target||(c.target=b.target),c.which===a&&(c.which=c.button),c.preventDefault||(c.preventDefault=b.preventDefault),c.stopPropagation||(c.stopPropagation=b.stopPropagation),e.call(this,c)})},b.Instance.prototype.on=function(a,b){return c(this.element).on(a,b)},b.Instance.prototype.off=function(a,b){return c(this.element).off(a,b)},b.Instance.prototype.trigger=function(a,b){var d=c(this.element);return d.has(b.target).length&&(d=c(b.target)),d.trigger({type:a,gesture:b})},c.fn.hammer=function(a){return this.each(function(){var d=c(this),e=d.data("hammer");e?e&&a&&b.utils.extend(e.options,a):d.data("hammer",new b(this,a||{}))})},b)};"function"==typeof define&&"object"==typeof define.amd&&define.amd?define("hammer-jquery",["hammer","jquery"],b):b(window.Hammer,window.jQuery||window.Zepto)}();
  24. // ------------- JQUERY Wallpaper------------------------------------------- //
  25. // ============ https://github.com/Formstone/Wallpaper ===================== //
  26. // ------------------------------------------------------------------------- //
  27. !function(a,b){"use strict";function c(b){var c=a.extend({},F,b);t=a("body"),u=s(),v=u!==!1,v||(u="transitionend.wallpaper");for(var e=a(this),f=0,g=e.length;g>f;f++)d.apply(e.eq(f),[a.extend({},c)]);return t.hasClass("wallpaper-inititalized")||(t.addClass("wallpaper-inititalized"),x.on("resize.wallpaper",c,l)),e}function d(b){var c=a(this);if(!c.hasClass("wallpaper")){a.extend(b,c.data("wallpaper-options")),c.addClass("wallpaper").append('<div class="wallpaper-container"></div>'),b.guid="wallpaper-"+A++,b.youTubeGuid=0,b.$target=c,b.$container=b.$target.find(".wallpaper-container"),b.$target.data("wallpaper",b).on("resize.wallpaper",b,k);var d=b.source;b.source=null,e(d,b,!0),b.onReady.call()}}function e(a,c,d){if(a!==c.source){if(c.source=a,c.isYouTube=!1,"object"==typeof a&&"string"==typeof a.video){var e=a.video.match(/(?:youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu\.be\/)([^"&?\/ ]{11})/i);e&&e.length>=1&&(c.isYouTube=!0,c.videoId=e[1])}if(c.isYouTube)c.playing=!1,c.playerReady=!1,c.posterLoaded=!1,h(a,c,d);else if("object"!=typeof a||a.hasOwnProperty("fallback")){if(c.responsiveSource)for(var i in c.responsiveSource)c.responsiveSource.hasOwnProperty(i)&&c.responsiveSource[i].mq.removeListener(m);if(c.responsive=!1,c.responsiveSource=null,"object"==typeof a){var j,k=[];for(var l in a)if(a.hasOwnProperty(l)){var n="fallback"===l?"(min-width: 0px)":l;if(n){var o=b.matchMedia(n.replace(1/0,"100000px"));o.addListener(m),k.push({mq:o,source:a[l]}),o.matches&&(j=a[l])}}c.responsive=!0,c.responsiveSource=k,a=j}f(a,c,!1,d)}else g(a,c,d)}else c.$target.trigger("wallpaper.loaded"),c.onLoad.call(c.$target)}function f(b,c,d,e){var f=a('<div class="wallpaper-media wallpaper-image'+(e!==!0?" animated":"")+'"><img /></div>'),g=f.find("img"),h=b;g.one("load.wallpaper",function(){z&&f.addClass("native").css({backgroundImage:"url('"+h+"')"}),f.on(u,function(b){r(b),a(b.target).is(f)&&(f.off(u),d||i(c))}),setTimeout(function(){f.css({opacity:1}),c.responsive&&e&&i(c)},0),k({data:c}),(!d||e)&&(c.$target.trigger("wallpaper.loaded"),c.onLoad.call(c.$target)),y=a(".wallpaper-responsive")}).attr("src",h),c.responsive&&f.addClass("wallpaper-responsive"),c.$container.append(f),(g[0].complete||4===g[0].readyState)&&g.trigger("load.wallpaper")}function g(b,c,d){if(c.source.poster&&(f(c.source.poster,c,!0,!0),d=!1),!E){var e='<div class="wallpaper-media wallpaper-video'+(d!==!0?" animated":"")+'">';e+="<video",c.loop&&(e+=" loop"),c.mute&&(e+=" muted"),e+=">",c.source.webm&&(e+='<source src="'+c.source.webm+'" type="video/webm" />'),c.source.mp4&&(e+='<source src="'+c.source.mp4+'" type="video/mp4" />'),c.source.ogg&&(e+='<source src="'+c.source.ogg+'" type="video/ogg" />'),e+="</video>",e+="</div>";var g=a(e),h=g.find("video");h.one("loadedmetadata.wallpaper",function(){g.on(u,function(b){r(b),a(b.target).is(g)&&(g.off(u),i(c))}),setTimeout(function(){g.css({opacity:1})},0),k({data:c}),c.$target.trigger("wallpaper.loaded"),c.onLoad.call(c.$target),c.hoverPlay?c.$target.on("mouseover.boxer",G.play).on("mouseout.boxer",G.pause):c.autoPlay&&this.play()}),c.$container.append(g)}}function h(c,d,e){if(!d.videoId){var g=c.match(/^.*(?:youtu.be\/|v\/|e\/|u\/\w+\/|embed\/|v=)([^#\&\?]*).*/);d.videoId=g[1]}if(d.posterLoaded||(d.source.poster||(d.source.poster="http://img.youtube.com/vi/"+d.videoId+"/0.jpg"),d.posterLoaded=!0,f(d.source.poster,d,!0,e),e=!1),!E)if(a("script[src*='youtube.com/iframe_api']").length||a("head").append('<script src="//www.youtube.com/iframe_api"></script>'),B){var h=d.guid+"_"+d.youTubeGuid++,j="";j+='<div class="wallpaper-media wallpaper-embed'+(e!==!0?" animated":"")+'">',j+='<div id="'+h+'"></div>',j+="</div>";var l=a(j);d.$container.append(l),d.player&&(d.oldPlayer=d.player,d.player=null),d.player=new b.YT.Player(h,{videoId:d.videoId,playerVars:{controls:0,rel:0,showinfo:0,wmode:"transparent",enablejsapi:1,version:3,playerapiid:h,loop:d.loop?1:0,autoplay:1,origin:b.location.protocol+"//"+b.location.host},events:{onReady:function(){d.playerReady=!0,d.mute&&d.player.mute(),d.hoverPlay?d.$target.on("mouseover.boxer",G.play).on("mouseout.boxer",G.pause):d.autoPlay&&d.player.playVideo()},onStateChange:function(c){d.playing||c.data!==b.YT.PlayerState.PLAYING?d.loop&&d.playing&&c.data===b.YT.PlayerState.ENDED&&d.player.playVideo():(d.playing=!0,(d.hoverPlay||!d.autoPlay)&&d.player.pauseVideo(),d.$target.trigger("wallpaper.loaded"),d.onLoad.call(d.$target),l.on(u,function(b){r(b),a(b.target).is(l)&&(l.off(u),i(d))}),l.css({opacity:1})),d.$target.find(".wallpaper-embed").addClass("ready")},onPlaybackQualityChange:function(){},onPlaybackRateChange:function(){},onError:function(){},onApiChange:function(){}}}),k({data:d})}else C.push({source:c,data:d})}function i(b){var c=b.$container.find(".wallpaper-media");c.length>=1&&(c.not(":last").remove(),b.oldPlayer=null),y=a(".wallpaper-responsive")}function j(b){var c=b.$container.find(".wallpaper-media");c.length>=1&&c.on(u,function(d){r(d),a(d.target).is(c)&&(a(this).remove(),delete b.source)}).css({opacity:0})}function k(a){r(a);for(var b=a.data,c=b.$container.find(".wallpaper-media"),d=0,e=c.length;e>d;d++){var f=c.eq(d),g=b.isYouTube?"iframe":f.find("video").length?"video":"img",h=f.find(g);if(h.length&&("img"!==g||!b.nativeSupport)){var i=b.$target.outerWidth(),j=b.$target.outerHeight(),k=q(b,h);b.width=k.naturalWidth,b.height=k.naturalHeight,b.left=0,b.top=0;var l=b.isYouTube?b.embedRatio:b.width/b.height;b.height=j,b.width=b.height*l,b.width<i&&(b.width=i,b.height=b.width/l),b.left=-(b.width-i)/2,b.top=-(b.height-j)/2,f.css({height:b.height,width:b.width,left:b.left,top:b.top})}}}function l(){a(".wallpaper").each(function(){var b=a(this).data("wallpaper");k({data:b})})}function m(){w=o(w,5,n)}function n(){p(w),y.each(function(){for(var b=a(this),c=(b.find("img"),b.parents(".wallpaper").data("wallpaper")),d=c.responsiveSource,e=0,g=0,h=d.length;h>g;g++)if(d.hasOwnProperty(g)){var i=d[g].mq;i&&i.matches&&(e=g)}f(d[e].source,c,!1,!0),b.trigger("change.wallpaper")})}function o(a,b,c,d){return p(a,d),setTimeout(c,b)}function p(a){null!==a&&(clearInterval(a),a=null)}function q(a,b){if(a.isYouTube)return{naturalHeight:500,naturalWidth:500/a.embedRatio};if(b.is("img")){var c=b[0];if("undefined"!=typeof c.naturalHeight)return{naturalHeight:c.naturalHeight,naturalWidth:c.naturalWidth};var d=new Image;return d.src=c.src,{naturalHeight:d.height,naturalWidth:d.width}}return{naturalHeight:b[0].videoHeight,naturalWidth:b[0].videoWidth}}function r(a){a.preventDefault&&(a.stopPropagation(),a.preventDefault())}function s(){var a={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd",transition:"transitionend"},b=document.createElement("div");for(var c in a)if(a.hasOwnProperty(c)&&c in b.style)return a[c]+".wallpaper";return!1}var t,u,v,w,x=a(b),y=null,z="backgroundSize"in document.documentElement.style,A=0,B=!1,C=[],D=b.navigator.userAgent||b.navigator.vendor||b.opera,E=/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(D),F=(D.toLowerCase().indexOf("safari")>=0&&D.toLowerCase().indexOf("chrome")<0,{autoPlay:!0,embedRatio:1.777777,hoverPlay:!1,loop:!0,mute:!0,onLoad:a.noop,onReady:a.noop,source:null}),G={defaults:function(b){return F=a.extend(F,b||{}),"object"==typeof this?a(this):!0},destroy:function(){var b=a(this).each(function(){var b=a(this).data("wallpaper");b&&(b.$container.remove(),b.$target.removeClass("wallpaper").off(".boxer").data("wallpaper",null))});return"undefined"!=typeof t&&"undefined"!=typeof x&&a(".wallpaper").length<1&&(t.removeClass("wallpaper-inititalized"),x.off(".wallpaper")),b},load:function(b){return a(this).each(function(){var c=a(this).data("wallpaper");c&&e(b,c)})},pause:function(){return a(this).each(function(){var b=a(this).data("wallpaper");if(b)if(b.isYouTube&&b.playerReady)b.player.pauseVideo();else{var c=b.$container.find("video");c.length&&c[0].pause()}})},play:function(){return a(this).each(function(){var b=a(this).data("wallpaper");if(b)if(b.isYouTube&&b.playerReady)b.player.playVideo();else{var c=b.$container.find("video");c.length&&c[0].play()}})},stop:function(){G.pause.apply(this)},unload:function(){return a(this).each(function(){var b=a(this).data("wallpaper");b&&j(b)})}};b.onYouTubeIframeAPIReady=function(){B=!0;for(var a in C)C.hasOwnProperty(a)&&h(C[a].source,C[a].data);C=[]},a.fn.wallpaper=function(a){return G[a]?G[a].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof a&&a?this:c.apply(this,arguments)},a.wallpaper=function(a){"defaults"===a&&G.defaults.apply(this,Array.prototype.slice.call(arguments,1))}}(jQuery,window);
  28. // ------------- Rainbow Syntax Highligher ---------------------------------- //
  29. // ========== https://github.com/ccampbell/rainbow ========================== //
  30. // -------------------------------------------------------------------------- //
  31. /* Rainbow v1.2 rainbowco.de | included languages: c, scheme, java, d, lua, generic, javascript, r, html, python, coffeescript, haskell, smalltalk, csharp, go, shell, php, ruby, css */
  32. window.Rainbow=function(){function f(a){var b,c=a.getAttribute&&a.getAttribute("data-language")||0;if(!c)for(a=a.attributes,b=0;b<a.length;++b)if("data-language"===a[b].nodeName)return a[b].nodeValue;return c}function n(a){var b=f(a)||f(a.parentNode);if(!b){var c=/\blang(?:uage)?-(\w+)/;(a=a.className.match(c)||a.parentNode.className.match(c))&&(b=a[1])}return b}function p(a,b){for(var c in l[d]){c=parseInt(c,10);var e=l[d][c];if(a==c&&b==e?0:a<=c&&b>=e)delete l[d][c],delete m[d][c];e=l[d][c];if(a>=
  33. c&&a<e||b>c&&b<e)return!0}return!1}function w(a,b){return'<span class="'+a.replace(/\./g," ")+(s?" "+s:"")+'">'+b+"</span>"}function x(a,b,c,e){if("undefined"===typeof a||null===a)e();else{var h=a.exec(c);if(h){++y;b.name||"string"!=typeof b.matches[0]||(b.name=b.matches[0],delete b.matches[0]);var r=h[0],g=h.index,f=h[0].length+g,k=function(){function h(){x(a,b,c,e)}0<y%100?h():setTimeout(h,0)};if(p(g,f))k();else{var q=z(b.matches),n=function(a,c,e){if(a>=c.length)e(r);else{var d=h[c[a]];if(d){var g=
  34. b.matches[c[a]],f=g.language,k=g.name&&g.matches?g.matches:g,l=function(b,d,g){var f;f=0;var k;for(k=1;k<c[a];++k)h[k]&&(f+=h[k].length);d=g?w(g,d):d;r=r.substr(0,f)+r.substr(f).replace(b,d);n(++a,c,e)};f?t(d,f,function(a){l(d,a)}):"string"===typeof g?l(d,d,g):A(d,k.length?k:[k],function(a){l(d,a,g.matches?g.name:0)})}else n(++a,c,e)}};n(0,q,function(a){b.name&&(a=w(b.name,a));m[d]||(m[d]={},l[d]={});m[d][g]={replace:h[0],"with":a};l[d][g]=f;k()})}}else e()}}function z(a){var b=[],c;for(c in a)a.hasOwnProperty(c)&&
  35. b.push(c);return b.sort(function(a,b){return b-a})}function A(a,b,c){function e(b,f){f<b.length?x(b[f].pattern,b[f],a,function(){e(b,++f)}):F(a,function(a){delete m[d];delete l[d];--d;c(a)})}++d;e(b,0)}function F(a,b){function c(a,b,e,f){if(e<b.length){++B;var k=b[e],l=m[d][k];a=a.substr(0,k)+a.substr(k).replace(l.replace,l["with"]);k=function(){c(a,b,++e,f)};0<B%250?k():setTimeout(k,0)}else f(a)}var e=z(m[d]);c(a,e,0,b)}function t(a,b,c){var e=q[b]||[],h=q[C]||[];b=D[b]?e:e.concat(h);A(a.replace(/</g,
  36. "&lt;").replace(/>/g,"&gt;").replace(/&(?![\w\#]+;)/g,"&amp;"),b,c)}function u(a,b,c){if(b<a.length){var e=a[b],h=n(e);return-1<(" "+e.className+" ").indexOf(" rainbow ")||!h?u(a,++b,c):(h=h.toLowerCase(),e.className+=e.className?" rainbow":"rainbow",t(e.innerHTML,h,function(d){e.innerHTML=d;m={};l={};v&&v(e,h);setTimeout(function(){u(a,++b,c)},0)}))}c&&c()}function E(a,b){a=a&&"function"==typeof a.getElementsByTagName?a:document;var c=a.getElementsByTagName("pre"),e=a.getElementsByTagName("code"),
  37. d,f=[],g=[];for(d=0;d<c.length;++d)c[d].getElementsByTagName("code").length?c[d].innerHTML=c[d].innerHTML.replace(/^\s+/,"").replace(/\s+$/,""):f.push(c[d]);for(d=0;d<e.length;++d)g.push(e[d]);u(g.concat(f),0,b)}var m={},l={},q={},D={},d=0,C=0,y=0,B=0,s,v;return{extend:function(a,b,c){1==arguments.length&&(b=a,a=C);D[a]=c;q[a]=b.concat(q[a]||[])},b:function(a){v=a},a:function(a){s=a},color:function(a,b,c){if("string"==typeof a)return t(a,b,c);if("function"==typeof a)return E(0,a);E(a,b)}}}();
  38. (function(){var f=[];document.onreadystatechange&&f.push(document.onreadystatechange);document.onreadystatechange=function(n){for(var p=0;p<f.length;p++)f[p].call&&f[p].call(this,n);"complete"===document.readyState&&Rainbow.color()}})();Rainbow.onHighlight=Rainbow.b;Rainbow.addClass=Rainbow.a;Rainbow.extend("c",[{name:"meta.preprocessor",matches:{1:[{matches:{1:"keyword.define",2:"entity.name"},pattern:/(\w+)\s(\w+)\b/g},{name:"keyword.define",pattern:/endif/g},{name:"constant.numeric",pattern:/\d+/g},{matches:{1:"keyword.include",2:"string"},pattern:/(include)\s(.*?)$/g}]},pattern:/\#([\S\s]*?)$/gm},{name:"keyword",pattern:/\b(do|goto|typedef)\b/g},{name:"entity.label",pattern:/\w+:/g},{matches:{1:"storage.type",3:"storage.type",4:"entity.name.function"},pattern:/\b((un)?signed|const)? ?(void|char|short|int|long|float|double)\*? +((\w+)(?= ?\())?/g},
  39. {matches:{2:"entity.name.function"},pattern:/(\w|\*) +((\w+)(?= ?\())/g},{name:"storage.modifier",pattern:/\b(static|extern|auto|register|volatile|inline)\b/g},{name:"support.type",pattern:/\b(struct|union|enum)\b/g}]);Rainbow.extend("scheme",[{name:"plain",pattern:/&gt;|&lt;/g},{name:"comment",pattern:/;.*$/gm},{name:"constant.language",pattern:/#t|#f|'\(\)/g},{name:"constant.symbol",pattern:/'[^()\s#]+/g},{name:"constant.number",pattern:/\b\d+(?:\.\d*)?\b/g},{name:"string",pattern:/".+?"/g},{matches:{1:"storage.function",2:"variable"},pattern:/\(\s*(define)\s+\(?(\S+)/g},{matches:{1:"keyword"},pattern:/\(\s*(begin|define\-syntax|if|lambda|quasiquote|quote|set!|syntax\-rules|and|and\-let\*|case|cond|delay|do|else|or|let|let\*|let\-syntax|letrec|letrec\-syntax)(?=[\]()\s#])/g},
  40. {matches:{1:"entity.function"},pattern:/\(\s*(eqv\?|eq\?|equal\?|number\?|complex\?|real\?|rational\?|integer\?|exact\?|inexact\?|=|<|>|<=|>=|zero\?|positive\?|negative\?|odd\?|even\?|max|min|\+|\-|\*|\/|abs|quotient|remainder|modulo|gcd|lcm|numerator|denominator|floor|ceiling|truncate|round|rationalize|exp|log|sin|cos|tan|asin|acos|atan|sqrt|expt|make\-rectangular|make\-polar|real\-part|imag\-part|magnitude|angle|exact\->inexact|inexact\->exact|number\->string|string\->number|not|boolean\?|pair\?|cons|car|cdr|set\-car!|set\-cdr!|caar|cadr|cdar|cddr|caaar|caadr|cadar|caddr|cdaar|cdadr|cddar|cdddr|caaaar|caaadr|caadar|caaddr|cadaar|cadadr|caddar|cadddr|cdaaar|cdaadr|cdadar|cdaddr|cddaar|cddadr|cdddar|cddddr|null\?|list\?|list|length|append|reverse|list\-tail|list\-ref|memq|memv|member|assq|assv|assoc|symbol\?|symbol\->string|string\->symbol|char\?|char=\?|char<\?|char>\?|char<=\?|char>=\?|char\-ci=\?|char\-ci<\?|char\-ci>\?|char\-ci<=\?|char\-ci>=\?|char\-alphabetic\?|char\-numeric\?|char\-whitespace\?|char\-upper\-case\?|char\-lower\-case\?|char\->integer|integer\->char|char\-upcase|char\-downcase|string\?|make\-string|string|string\-length|string\-ref|string\-set!|string=\?|string\-ci=\?|string<\?|string>\?|string<=\?|string>=\?|string\-ci<\?|string\-ci>\?|string\-ci<=\?|string\-ci>=\?|substring|string\-append|string\->list|list\->string|string\-copy|string\-fill!|vector\?|make\-vector|vector|vector\-length|vector\-ref|vector\-set!|vector\->list|list\->vector|vector\-fill!|procedure\?|apply|map|for\-each|force|call\-with\-current\-continuation|call\/cc|values|call\-with\-values|dynamic\-wind|eval|scheme\-report\-environment|null\-environment|interaction\-environment|call\-with\-input\-file|call\-with\-output\-file|input\-port\?|output\-port\?|current\-input\-port|current\-output\-port|with\-input\-from\-file|with\-output\-to\-file|open\-input\-file|open\-output\-file|close\-input\-port|close\-output\-port|read|read\-char|peek\-char|eof\-object\?|char\-ready\?|write|display|newline|write\-char|load|transcript\-on|transcript\-off)(?=[\]()\s#])/g}],
  41. !0);Rainbow.extend("java",[{name:"constant",pattern:/\b(false|null|true|[A-Z_]+)\b/g},{matches:{1:"keyword",2:"support.namespace"},pattern:/(import|package)\s(.+)/g},{name:"keyword",pattern:/\b(abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|native|new|package|private|protected|public|return|short|static|strictfp|super|switch|synchronized|this|throw|throws|transient|try|void|volatile|while)\b/g},
  42. {name:"string",pattern:/(".*?")/g},{name:"char",pattern:/(')(.|\\.|\\u[\dA-Fa-f]{4})\1/g},{name:"integer",pattern:/\b(0x[\da-f]+|\d+)L?\b/g},{name:"comment",pattern:/\/\*[\s\S]*?\*\/|(\/\/).*?$/gm},{name:"support.annotation",pattern:/@\w+/g},{matches:{1:"entity.function"},pattern:/([^@\.\s]+)\(/g},{name:"entity.class",pattern:/\b([A-Z]\w*)\b/g},{name:"operator",pattern:/(\+{1,2}|-{1,2}|~|!|\*|\/|%|(?:&lt;){1,2}|(?:&gt;){1,3}|instanceof|(?:&amp;){1,2}|\^|\|{1,2}|\?|:|(?:=|!|\+|-|\*|\/|%|\^|\||(?:&lt;){1,2}|(?:&gt;){1,3})?=)/g}],
  43. !0);Rainbow.extend("d",[{name:"constant",pattern:/\b(false|null|true)\b/gm},{name:"keyword",pattern:/\b(abstract|alias|align|asm|assert|auto|body|bool|break|byte|case|cast|catch|cdouble|cent|cfloat|char|class|const|continue|creal|dchar|debug|default|delegate|delete|deprecated|do|double|else|enum|export|extern|final|finally|float|for|foreach|foreach_reverse|function|goto|idouble|if|ifloat|immutable|import|in|inout|int|interface|invariant|ireal|is|lazy|long|macro|mixin|module|new|nothrow|null|out|override|package|pragma|private|protected|public|pure|real|ref|return|scope|shared|short|size_t|static|string|struct|super|switch|synchronized|template|this|throw|try|typedef|typeid|typeof|ubyte|ucent|uint|ulong|union|unittest|ushort|version|void|volatile|wchar|while|with|__FILE__|__LINE__|__gshared|__traits|__vector|__parameters)\b/gm},
  44. {matches:{1:"keyword",2:{name:"support.class",pattern:/\w+/gm}},pattern:/(typeof)\s([^\$].*?)(\)|;)/gm},{matches:{1:"keyword.namespace",2:{name:"support.namespace",pattern:/\w+/gm}},pattern:/\b(namespace)\s(.*?);/gm},{matches:{1:"storage.modifier",2:"storage.class",3:"entity.name.class",4:"storage.modifier.extends",5:"entity.other.inherited-class"},pattern:/\b(abstract|sealed)?\s?(class)\s(\w+)(\sextends\s)?([\w\\]*)?\s?\{?(\n|\})/gm},{name:"keyword.static",pattern:/\b(static)\b/gm},{matches:{1:"keyword.new",
  45. 2:{name:"support.class",pattern:/\w+/gm}},pattern:/\b(new)\s([^\$].*?)(?=\)|\(|;|&)/gm},{name:"string",pattern:/("|')(.*?)\1/gm},{name:"integer",pattern:/\b(0x[\da-f]+|\d+)\b/gm},{name:"comment",pattern:/\/\*[\s\S]*?\*\/|\/\+[\s\S]*?\+\/|(\/\/)[\s\S]*?$/gm},{name:"operator",pattern:/(\/|\/=|&amp;=|&amp;&amp;|&amp;|\|=|\|\|\||\-=|\-\-|\-|\+=|\+\+|\+|&lt;=|&lt;&lt;|&lt;|&lt;&lt;=|&lt;&gt;=|&lt;&gt;|&gt;|&gt;&gt;&gt;=|&gt;&gt;=|&gt;=|&gt;&gt;|&gt;&gt;&gt;|!=|!&lt;&gt;=|!&lt;&gt;|!&lt;=|!&lt;|!&gt;=|!&gt;|!|[|]|\$|==|=|\*=|\*|%=|%|\^\^=|\^=|\^\^|\^|~=|~|@|=&gt;|\:)/gm}],
  46. !0);Rainbow.extend("lua",[{matches:{1:{name:"keyword.operator",pattern:/\=/g},2:{name:"string",matches:{name:"constant.character.escape",pattern:/\\('|"){1}/g}}},pattern:/(\(|\s|\[|\=)(('|")([^\\\1]|\\.)*?(\3))/gm},{name:"comment",pattern:/\-{2}\[{2}\-{2}[\s\S]*?\-{2}\]{2}\-{2}|(\-{2})[\s\S]*?$/gm},{name:"constant.numeric",pattern:/\b(\d+(\.\d+)?(e(\+|\-)?\d+)?(f|d)?|0x[\da-f]+)\b/gi},{matches:{1:"keyword"},pattern:/\b((a|e)nd|in|repeat|break|local|return|do|for|then|else(if)?|function|not|if|or|until|while)(?=\(|\b)/gi},
  47. {name:"constant.language",pattern:/true|false|nil/g},{name:"keyword.operator",pattern:/\+|\!|\-|&(gt|lt|amp);|\||\*|\=|#|\.{2}/g},{matches:{1:"storage.function",2:"entity.name.function"},pattern:/(function)\s+(\w+[\:|\.]?\w+?)(?=\()/g},{matches:{1:"support.function"},pattern:/\b(print|require|module|\w+\.\w+)(?=\()/g}],!0);Rainbow.extend([{matches:{1:[{name:"keyword.operator",pattern:/\=|\+/g},{name:"keyword.dot",pattern:/\./g}],2:{name:"string",matches:{name:"constant.character.escape",pattern:/\\('|"){1}/g}}},pattern:/(\(|\s|\[|\=|:|\+|\.)(('|")([^\\\1]|\\.)*?(\3))/gm},{name:"comment",pattern:/\/\*[\s\S]*?\*\/|(\/\/|\#)[\s\S]*?$/gm},{name:"constant.numeric",pattern:/\b(\d+(\.\d+)?(e(\+|\-)?\d+)?(f|d)?|0x[\da-f]+)\b/gi},{matches:{1:"keyword"},pattern:/\b(and|array|as|b(ool(ean)?|reak)|c(ase|atch|har|lass|on(st|tinue))|d(ef|elete|o(uble)?)|e(cho|lse(if)?|xit|xtends|xcept)|f(inally|loat|or(each)?|unction)|global|if|import|int(eger)?|long|new|object|or|pr(int|ivate|otected)|public|return|self|st(ring|ruct|atic)|switch|th(en|is|row)|try|(un)?signed|var|void|while)(?=\(|\b)/gi},
  48. {name:"constant.language",pattern:/true|false|null/g},{name:"keyword.operator",pattern:/\+|\!|\-|&(gt|lt|amp);|\||\*|\=/g},{matches:{1:"function.call"},pattern:/(\w+?)(?=\()/g},{matches:{1:"storage.function",2:"entity.name.function"},pattern:/(function)\s(.*?)(?=\()/g}]);Rainbow.extend("javascript",[{name:"selector",pattern:/(\s|^)\$(?=\.|\()/g},{name:"support",pattern:/\b(window|document)\b/g},{matches:{1:"support.property"},pattern:/\.(length|node(Name|Value))\b/g},{matches:{1:"support.function"},pattern:/(setTimeout|setInterval)(?=\()/g},{matches:{1:"support.method"},pattern:/\.(getAttribute|push|getElementById|getElementsByClassName|log|setTimeout|setInterval)(?=\()/g},{name:"string.regexp",matches:{1:"string.regexp.open",2:{name:"constant.regexp.escape",pattern:/\\(.){1}/g},
  49. 3:"string.regexp.close",4:"string.regexp.modifier"},pattern:/(\/)(?!\*)(.+)(\/)([igm]{0,3})/g},{matches:{1:"storage",3:"entity.function"},pattern:/(var)?(\s|^)(\S*)(?=\s?=\s?function\()/g},{matches:{1:"keyword",2:"entity.function"},pattern:/(new)\s+(.*)(?=\()/g},{name:"entity.function",pattern:/(\w+)(?=:\s{0,}function)/g}]);Rainbow.extend("r",[{matches:{1:{name:"keyword.operator",pattern:/\=|<\-|&lt;-/g},2:{name:"string",matches:{name:"constant.character.escape",pattern:/\\('|"){1}/g}}},pattern:/(\(|\s|\[|\=|:)(('|")([^\\\1]|\\.)*?(\3))/gm},{matches:{1:"constant.language"},pattern:/\b(NULL|NA|TRUE|FALSE|T|F|NaN|Inf|NA_integer_|NA_real_|NA_complex_|NA_character_)\b/g},{matches:{1:"constant.symbol"},pattern:/[^0-9a-zA-Z\._](LETTERS|letters|month\.(abb|name)|pi)/g},{name:"keyword.operator",pattern:/&lt;-|<-|-|==|&lt;=|<=|&gt;>|>=|<|>|&amp;&amp;|&&|&amp;|&|!=|\|\|?|\*|\+|\^|\/|%%|%\/%|\=|%in%|%\*%|%o%|%x%|\$|:|~|\[{1,2}|\]{1,2}/g},
  50. {matches:{1:"storage",3:"entity.function"},pattern:/(\s|^)(.*)(?=\s?=\s?function\s\()/g},{matches:{1:"storage.function"},pattern:/[^a-zA-Z0-9._](function)(?=\s*\()/g},{matches:{1:"namespace",2:"keyword.operator",3:"function.call"},pattern:/([a-zA-Z][a-zA-Z0-9._]+)([:]{2,3})([.a-zA-Z][a-zA-Z0-9._]*(?=\s*\())\b/g},{name:"support.function",pattern:/(^|[^0-9a-zA-Z\._])(array|character|complex|data\.frame|double|integer|list|logical|matrix|numeric|vector)(?=\s*\()/g}]);Rainbow.extend("html",[{name:"source.php.embedded",matches:{2:{language:"php"}},pattern:/&lt;\?=?(?!xml)(php)?([\s\S]*?)(\?&gt;)/gm},{name:"source.css.embedded",matches:{1:{matches:{1:"support.tag.style",2:[{name:"entity.tag.style",pattern:/^style/g},{name:"string",pattern:/('|")(.*?)(\1)/g},{name:"entity.tag.style.attribute",pattern:/(\w+)/g}],3:"support.tag.style"},pattern:/(&lt;\/?)(style.*?)(&gt;)/g},2:{language:"css"},3:"support.tag.style",4:"entity.tag.style",5:"support.tag.style"},pattern:/(&lt;style.*?&gt;)([\s\S]*?)(&lt;\/)(style)(&gt;)/gm},
  51. {name:"source.js.embedded",matches:{1:{matches:{1:"support.tag.script",2:[{name:"entity.tag.script",pattern:/^script/g},{name:"string",pattern:/('|")(.*?)(\1)/g},{name:"entity.tag.script.attribute",pattern:/(\w+)/g}],3:"support.tag.script"},pattern:/(&lt;\/?)(script.*?)(&gt;)/g},2:{language:"javascript"},3:"support.tag.script",4:"entity.tag.script",5:"support.tag.script"},pattern:/(&lt;script(?! src).*?&gt;)([\s\S]*?)(&lt;\/)(script)(&gt;)/gm},{name:"comment.html",pattern:/&lt;\!--[\S\s]*?--&gt;/g},
  52. {matches:{1:"support.tag.open",2:"support.tag.close"},pattern:/(&lt;)|(\/?\??&gt;)/g},{name:"support.tag",matches:{1:"support.tag",2:"support.tag.special",3:"support.tag-name"},pattern:/(&lt;\??)(\/|\!?)(\w+)/g},{matches:{1:"support.attribute"},pattern:/([a-z-]+)(?=\=)/gi},{matches:{1:"support.operator",2:"string.quote",3:"string.value",4:"string.quote"},pattern:/(=)('|")(.*?)(\2)/g},{matches:{1:"support.operator",2:"support.value"},pattern:/(=)([a-zA-Z\-0-9]*)\b/g},{matches:{1:"support.attribute"},
  53. pattern:/\s(\w+)(?=\s|&gt;)(?![\s\S]*&lt;)/g}],!0);Rainbow.extend("python",[{name:"variable.self",pattern:/self/g},{name:"constant.language",pattern:/None|True|False|NotImplemented|\.\.\./g},{name:"support.object",pattern:/object/g},{name:"support.function.python",pattern:/\b(bs|divmod|input|open|staticmethod|all|enumerate|int|ord|str|any|eval|isinstance|pow|sum|basestring|execfile|issubclass|print|super|bin|file|iter|property|tuple|bool|filter|len|range|type|bytearray|float|list|raw_input|unichr|callable|format|locals|reduce|unicode|chr|frozenset|long|reload|vars|classmethod|getattr|map|repr|xrange|cmp|globals|max|reversed|zip|compile|hasattr|memoryview|round|__import__|complex|hash|min|set|apply|delattr|help|next|setattr|buffer|dict|hex|object|slice|coerce|dir|id|oct|sorted|intern)(?=\()/g},
  54. {matches:{1:"keyword"},pattern:/\b(pass|lambda|with|is|not|in|from|elif|raise|del)(?=\(|\b)/g},{matches:{1:"storage.class",2:"entity.name.class",3:"entity.other.inherited-class"},pattern:/(class)\s+(\w+)\((\w+?)\)/g},{matches:{1:"storage.function",2:"support.magic"},pattern:/(def)\s+(__\w+)(?=\()/g},{name:"support.magic",pattern:/__(name)__/g},{matches:{1:"keyword.control",2:"support.exception.type"},pattern:/(except) (\w+):/g},{matches:{1:"storage.function",2:"entity.name.function"},pattern:/(def)\s+(\w+)(?=\()/g},
  55. {name:"entity.name.function.decorator",pattern:/@([\w\.]+)/g},{name:"comment.docstring",pattern:/('{3}|"{3})[\s\S]*?\1/gm}]);Rainbow.extend("coffeescript",[{name:"comment.block",pattern:/(\#{3})[\s\S]*\1/gm},{name:"string.block",pattern:/('{3}|"{3})[\s\S]*\1/gm},{name:"string.regex",matches:{2:{name:"comment",pattern:/\#(.*?)\n/g}},pattern:/(\/{3})([\s\S]*)\1/gm},{matches:{1:"keyword"},pattern:/\b(in|when|is|isnt|of|not|unless|until|super)(?=\b)/gi},{name:"keyword.operator",pattern:/\?/g},{name:"constant.language",pattern:/\b(undefined|yes|on|no|off)\b/g},{name:"keyword.variable.coffee",pattern:/@(\w+)/gi},{name:"reset",
  56. pattern:/object|class|print/gi},{matches:{1:"entity.name.function",2:"keyword.operator",3:{name:"function.argument.coffee",pattern:/([\@\w]+)/g},4:"keyword.function"},pattern:/(\w+)\s{0,}(=|:)\s{0,}\((.*?)((-|=)&gt;)/gi},{matches:{1:{name:"function.argument.coffee",pattern:/([\@\w]+)/g},2:"keyword.function"},pattern:/\s\((.*?)\)\s{0,}((-|=)&gt;)/gi},{matches:{1:"entity.name.function",2:"keyword.operator",3:"keyword.function"},pattern:/(\w+)\s{0,}(=|:)\s{0,}((-|=)&gt;)/gi},{matches:{1:"storage.class",
  57. 2:"entity.name.class",3:"storage.modifier.extends",4:"entity.other.inherited-class"},pattern:/\b(class)\s(\w+)(\sextends\s)?([\w\\]*)?\b/g},{matches:{1:"keyword.new",2:{name:"support.class",pattern:/\w+/g}},pattern:/\b(new)\s(.*?)(?=\s)/g}]);Rainbow.extend("haskell",[{name:"comment",pattern:/\{\-\-[\s\S(\w+)]+[\-\-][\}$]/gm},{name:"comment",pattern:/\-\-(.*)/g},{matches:{1:"keyword",2:"support.namespace"},pattern:/\b(module)\s(\w+)\s[\(]?(\w+)?[\)?]\swhere/g},{name:"keyword.operator",pattern:/\+|\!|\-|&(gt|lt|amp);|\/\=|\||\@|\:|\.|\+{2}|\:|\*|\=|#|\.{2}|(\\)[a-zA-Z_]/g},{name:"keyword",pattern:/\b(case|class|foreign|hiding|qualified|data|family|default|deriving|do|else|if|import|in|infix|infixl|infixr|instance|let|in|otherwise|module|newtype|of|then|type|where)\b/g},
  58. {name:"keyword",pattern:/[\`][a-zA-Z_']*?[\`]/g},{matches:{1:"keyword",2:"keyword.operator"},pattern:/\b(infix|infixr|infixl)+\s\d+\s(\w+)*/g},{name:"entity.class",pattern:/\b([A-Z][A-Za-z0-9_']*)/g},{name:"meta.preprocessor",matches:{1:[{matches:{1:"keyword.define",2:"entity.name"},pattern:/(\w+)\s(\w+)\b/g},{name:"keyword.define",pattern:/endif/g},{name:"constant.numeric",pattern:/\d+/g},{matches:{1:"keyword.include",2:"string"},pattern:/(include)\s(.*?)$/g}]},pattern:/^\#([\S\s]*?)$/gm}]);Rainbow.extend("smalltalk",[{name:"keyword.pseudovariable",pattern:/self|thisContext/g},{name:"keyword.constant",pattern:/false|nil|true/g},{name:"string",pattern:/'([^']|'')*'/g},{name:"string.symbol",pattern:/#\w+|#'([^']|'')*'/g},{name:"string.character",pattern:/\$\w+/g},{name:"comment",pattern:/"([^"]|"")*"/g},{name:"constant.numeric",pattern:/-?\d+(\.\d+)?((r-?|s)[A-Za-z0-9]+|e-?[0-9]+)?/g},{name:"entity.name.class",pattern:/\b[A-Z]\w*/g},{name:"entity.name.function",pattern:/\b[a-z]\w*:?/g},
  59. {name:"entity.name.binary",pattern:/(&lt;|&gt;|&amp;|[=~\|\\\/!@*\-_+])+/g},{name:"operator.delimiter",pattern:/;[\(\)\[\]\{\}]|#\[|#\(^\./g}],!0);Rainbow.extend("csharp",[{name:"constant",pattern:/\b(false|null|true)\b/g},{name:"keyword",pattern:/\b(abstract|add|alias|ascending|as|base|bool|break|byte|case|catch|char|checked|class|const|continue|decimal|default|delegate|descending|double|do|dynamic|else|enum|event|explicit|extern|false|finally|fixed|float|foreach|for|from|get|global|goto|group|if|implicit|int|interface|internal|into|in|is|join|let|lock|long|namespace|new|object|operator|orderby|out|override|params|partial|private|protected|public|readonly|ref|remove|return|sbyte|sealed|select|set|short|sizeof|stackalloc|static|string|struct|switch|this|throw|try|typeof|uint|unchecked|ulong|unsafe|ushort|using|value|var|virtual|void|volatile|where|while|yield)\b/g},
  60. {matches:{1:"keyword",2:{name:"support.class",pattern:/\w+/g}},pattern:/(typeof)\s([^\$].*?)(\)|;)/g},{matches:{1:"keyword.namespace",2:{name:"support.namespace",pattern:/\w+/g}},pattern:/\b(namespace)\s(.*?);/g},{matches:{1:"storage.modifier",2:"storage.class",3:"entity.name.class",4:"storage.modifier.extends",5:"entity.other.inherited-class"},pattern:/\b(abstract|sealed)?\s?(class)\s(\w+)(\sextends\s)?([\w\\]*)?\s?\{?(\n|\})/g},{name:"keyword.static",pattern:/\b(static)\b/g},{matches:{1:"keyword.new",
  61. 2:{name:"support.class",pattern:/\w+/g}},pattern:/\b(new)\s([^\$].*?)(?=\)|\(|;|&)/g},{name:"string",pattern:/(")(.*?)\1/g},{name:"integer",pattern:/\b(0x[\da-f]+|\d+)\b/g},{name:"comment",pattern:/\/\*[\s\S]*?\*\/|(\/\/)[\s\S]*?$/gm},{name:"operator",pattern:/(\+\+|\+=|\+|--|-=|-|&lt;&lt;=|&lt;&lt;|&lt;=|=&gt;|&gt;&gt;=|&gt;&gt;|&gt;=|!=|!|~|\^|\|\||&amp;&amp;|&amp;=|&amp;|\?\?|::|:|\*=|\*|\/=|%=|\|=|==|=)/g},{name:"preprocessor",pattern:/(\#if|\#else|\#elif|\#endif|\#define|\#undef|\#warning|\#error|\#line|\#region|\#endregion|\#pragma)[\s\S]*?$/gm}],
  62. !0);Rainbow.extend("go",[{matches:{1:{name:"keyword.operator",pattern:/\=/g},2:{name:"string",matches:{name:"constant.character.escape",pattern:/\\(`|"){1}/g}}},pattern:/(\(|\s|\[|\=|:)((`|")([^\\\1]|\\.)*?(\3))/gm},{name:"comment",pattern:/\/\*[\s\S]*?\*\/|(\/\/)[\s\S]*?$/gm},{name:"constant.numeric",pattern:/\b(\d+(\.\d+)?(e(\+|\-)?\d+)?(f|d)?|0x[\da-f]+)\b/gi},{matches:{1:"keyword"},pattern:/\b(break|c(ase|onst|ontinue)|d(efault|efer)|else|fallthrough|for|go(to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)(?=\(|\b)/gi},
  63. {name:"constant.language",pattern:/true|false|null|string|byte|rune|u?int(8|16|32|64)?|float(32|64)|complex(64|128)/g},{name:"keyword.operator",pattern:/\+|\!|\-|&(gt|lt|amp);|\||\*|\:?=/g},{matches:{1:"function.call"},pattern:/(\w+?)(?=\()/g},{matches:{1:"storage.function",2:"entity.name.function"},pattern:/(func)\s(.*?)(?=\()/g}]);Rainbow.extend("shell",[{name:"shell",matches:{1:{language:"shell"}},pattern:/\$\(([\s\S]*?)\)/gm},{matches:{2:"string"},pattern:/(\(|\s|\[|\=)(('|")[\s\S]*?(\3))/gm},{name:"keyword.operator",pattern:/&lt;|&gt;|&amp;/g},{name:"comment",pattern:/\#[\s\S]*?$/gm},{name:"storage.function",pattern:/(.+?)(?=\(\)\s{0,}\{)/g},{name:"support.command",pattern:/\b(echo|rm|ls|(mk|rm)dir|cd|find|cp|exit|pwd|exec|trap|source|shift|unset)/g},{matches:{1:"keyword"},pattern:/\b(break|case|continue|do|done|elif|else|esac|eval|export|fi|for|function|if|in|local|return|set|then|unset|until|while)(?=\(|\b)/g}],
  64. !0);Rainbow.extend("php",[{name:"support",pattern:/\becho\b/g},{matches:{1:"variable.dollar-sign",2:"variable"},pattern:/(\$)(\w+)\b/g},{name:"constant.language",pattern:/true|false|null/ig},{name:"constant",pattern:/\b[A-Z0-9_]{2,}\b/g},{name:"keyword.dot",pattern:/\./g},{name:"keyword",pattern:/\b(die|end(for(each)?|switch|if)|case|require(_once)?|include(_once)?)(?=\(|\b)/g},{matches:{1:"keyword",2:{name:"support.class",pattern:/\w+/g}},pattern:/(instanceof)\s([^\$].*?)(\)|;)/g},{matches:{1:"support.function"},
  65. pattern:/\b(array(_key_exists|_merge|_keys|_shift)?|isset|count|empty|unset|printf|is_(array|string|numeric|object)|sprintf|each|date|time|substr|pos|str(len|pos|tolower|_replace|totime)?|ord|trim|in_array|implode|end|preg_match|explode|fmod|define|link|list|get_class|serialize|file|sort|mail|dir|idate|log|intval|header|chr|function_exists|dirname|preg_replace|file_exists)(?=\()/g},{name:"variable.language.php-tag",pattern:/(&lt;\?(php)?|\?&gt;)/g},{matches:{1:"keyword.namespace",2:{name:"support.namespace",
  66. pattern:/\w+/g}},pattern:/\b(namespace|use)\s(.*?);/g},{matches:{1:"storage.modifier",2:"storage.class",3:"entity.name.class",4:"storage.modifier.extends",5:"entity.other.inherited-class",6:"storage.modifier.extends",7:"entity.other.inherited-class"},pattern:/\b(abstract|final)?\s?(class|interface|trait)\s(\w+)(\sextends\s)?([\w\\]*)?(\simplements\s)?([\w\\]*)?\s?\{?(\n|\})/g},{name:"keyword.static",pattern:/self::|static::/g},{matches:{1:"storage.function",2:"support.magic"},pattern:/(function)\s(__.*?)(?=\()/g},
  67. {matches:{1:"keyword.new",2:{name:"support.class",pattern:/\w+/g}},pattern:/\b(new)\s([^\$].*?)(?=\)|\(|;)/g},{matches:{1:{name:"support.class",pattern:/\w+/g},2:"keyword.static"},pattern:/([\w\\]*?)(::)(?=\b|\$)/g},{matches:{2:{name:"support.class",pattern:/\w+/g}},pattern:/(\(|,\s?)([\w\\]*?)(?=\s\$)/g}]);Rainbow.extend("ruby",[{matches:{1:"variable.language",2:{language:null}},pattern:/^(__END__)\n((?:.*\n)*)/gm},{name:"string",matches:{1:"string.open",2:[{name:"string.interpolation",matches:{1:"string.open",2:{language:"ruby"},3:"string.close"},pattern:/(\#\{)(.*?)(\})/g}],3:"string.close"},pattern:/("|`)(.*?[^\\\1])?(\1)/g},{name:"string",pattern:/('|"|`)([^\\\1\n]|\\.)*?\1/g},{name:"string",pattern:/%[qQ](?=(\(|\[|\{|&lt;|.)(.*?)(?:'|\)|\]|\}|&gt;|\1))(?:\(\2\)|\[\2\]|\{\2\}|\&lt;\2&gt;|\1\2\1)/g},
  68. {matches:{1:"string",2:"string",3:"string"},pattern:/(&lt;&lt;)(\w+).*?$([\s\S]*?^\2)/gm},{matches:{1:"string",2:"string",3:"string"},pattern:/(&lt;&lt;\-)(\w+).*?$([\s\S]*?\2)/gm},{name:"string.regexp",matches:{1:"string.regexp",2:{name:"string.regexp",pattern:/\\(.){1}/g},3:"string.regexp",4:"string.regexp"},pattern:/(\/)(.*?)(\/)([a-z]*)/g},{name:"string.regexp",matches:{1:"string.regexp",2:{name:"string.regexp",pattern:/\\(.){1}/g},3:"string.regexp",4:"string.regexp"},pattern:/%r(?=(\(|\[|\{|&lt;|.)(.*?)('|\)|\]|\}|&gt;|\1))(?:\(\2\)|\[\2\]|\{\2\}|\&lt;\2&gt;|\1\2\1)([a-z]*)/g},
  69. {name:"comment",pattern:/#.*$/gm},{name:"comment",pattern:/^\=begin[\s\S]*?\=end$/gm},{matches:{1:"constant"},pattern:/(\w+:)[^:]/g},{matches:{1:"constant.symbol"},pattern:/[^:](:(?:\w+|(?=['"](.*?)['"])(?:"\2"|'\2')))/g},{name:"constant.numeric",pattern:/\b(0x[\da-f]+|\d+)\b/g},{name:"support.class",pattern:/\b[A-Z]\w*(?=((\.|::)[A-Za-z]|\[))/g},{name:"constant",pattern:/\b[A-Z]\w*\b/g},{matches:{1:"storage.class",2:"entity.name.class",3:"entity.other.inherited-class"},pattern:/\s*(class)\s+((?:(?:::)?[A-Z]\w*)+)(?:\s+&lt;\s+((?:(?:::)?[A-Z]\w*)+))?/g},
  70. {matches:{1:"storage.module",2:"entity.name.class"},pattern:/\s*(module)\s+((?:(?:::)?[A-Z]\w*)+)/g},{name:"variable.global",pattern:/\$([a-zA-Z_]\w*)\b/g},{name:"variable.class",pattern:/@@([a-zA-Z_]\w*)\b/g},{name:"variable.instance",pattern:/@([a-zA-Z_]\w*)\b/g},{matches:{1:"keyword.control"},pattern:/[^\.]\b(BEGIN|begin|case|class|do|else|elsif|END|end|ensure|for|if|in|module|rescue|then|unless|until|when|while)\b(?![?!])/g},{matches:{1:"keyword.control.pseudo-method"},pattern:/[^\.]\b(alias|alias_method|break|next|redo|retry|return|super|undef|yield)\b(?![?!])|\bdefined\?|\bblock_given\?/g},
  71. {matches:{1:"constant.language"},pattern:/\b(nil|true|false)\b(?![?!])/g},{matches:{1:"variable.language"},pattern:/\b(__(FILE|LINE)__|self)\b(?![?!])/g},{matches:{1:"keyword.special-method"},pattern:/\b(require|gem|initialize|new|loop|include|extend|raise|attr_reader|attr_writer|attr_accessor|attr|catch|throw|private|module_function|public|protected)\b(?![?!])/g},{name:"keyword.operator",pattern:/\s\?\s|=|&lt;&lt;|&lt;&lt;=|%=|&=|\*=|\*\*=|\+=|\-=|\^=|\|{1,2}=|&lt;&lt;|&lt;=&gt;|&lt;(?!&lt;|=)|&gt;(?!&lt;|=|&gt;)|&lt;=|&gt;=|===|==|=~|!=|!~|%|&amp;|\*\*|\*|\+|\-|\/|\||~|&gt;&gt;/g},
  72. {matches:{1:"keyword.operator.logical"},pattern:/[^\.]\b(and|not|or)\b/g},{matches:{1:"storage.function",2:"entity.name.function"},pattern:/(def)\s(.*?)(?=(\s|\())/g}],!0);Rainbow.extend("css",[{name:"comment",pattern:/\/\*[\s\S]*?\*\//gm},{name:"constant.hex-color",pattern:/#([a-f0-9]{3}|[a-f0-9]{6})(?=;|\s|,|\))/gi},{matches:{1:"constant.numeric",2:"keyword.unit"},pattern:/(\d+)(px|em|cm|s|%)?/g},{name:"string",pattern:/('|")(.*?)\1/g},{name:"support.css-property",matches:{1:"support.vendor-prefix"},pattern:/(-o-|-moz-|-webkit-|-ms-)?[\w-]+(?=\s?:)(?!.*\{)/g},{matches:{1:[{name:"entity.name.sass",pattern:/&amp;/g},{name:"direct-descendant",pattern:/&gt;/g},{name:"entity.name.class",
  73. pattern:/\.[\w\-_]+/g},{name:"entity.name.id",pattern:/\#[\w\-_]+/g},{name:"entity.name.pseudo",pattern:/:[\w\-_]+/g},{name:"entity.name.tag",pattern:/\w+/g}]},pattern:/([\w\ ,\n:\.\#\&\;\-_]+)(?=.*\{)/g},{matches:{2:"support.vendor-prefix",3:"support.css-value"},pattern:/(:|,)\s*(-o-|-moz-|-webkit-|-ms-)?([a-zA-Z-]*)(?=\b)(?!.*\{)/g}],!0);
  74. // ------------- JQUERY APPEAR ---------------------------------------------- //
  75. // ============ https://github.com/morr/jquery.appear ====================== //
  76. // -------------------------------------------------------------------------- //
  77. (function($) {
  78. var selectors = [];
  79. var check_binded = false;
  80. var check_lock = false;
  81. var defaults = {
  82. interval: 250,
  83. force_process: false
  84. }
  85. var $window = $(window);
  86. var $prior_appeared;
  87. function process() {
  88. check_lock = false;
  89. for (var index = 0, selectorsLength = selectors.length; index < selectorsLength; index++) {
  90. var $appeared = $(selectors[index]).filter(function() {
  91. return $(this).is(':appeared');
  92. });
  93. $appeared.trigger('appear', [$appeared]);
  94. if ($prior_appeared) {
  95. var $disappeared = $prior_appeared.not($appeared);
  96. $disappeared.trigger('disappear', [$disappeared]);
  97. }
  98. $prior_appeared = $appeared;
  99. }
  100. }
  101. // "appeared" custom filter
  102. $.expr[':']['appeared'] = function(element) {
  103. var $element = $(element);
  104. if (!$element.is(':visible')) {
  105. return false;
  106. }
  107. var window_left = $window.scrollLeft();
  108. var window_top = $window.scrollTop();
  109. var offset = $element.offset();
  110. var left = offset.left;
  111. var top = offset.top;
  112. if (top + $element.height() >= window_top &&
  113. top - ($element.data('appear-top-offset') || 0) <= window_top + $window.height() &&
  114. left + $element.width() >= window_left &&
  115. left - ($element.data('appear-left-offset') || 0) <= window_left + $window.width()) {
  116. return true;
  117. } else {
  118. return false;
  119. }
  120. }
  121. $.fn.extend({
  122. // watching for element's appearance in browser viewport
  123. appear: function(options) {
  124. var opts = $.extend({}, defaults, options || {});
  125. var selector = this.selector || this;
  126. if (!check_binded) {
  127. var on_check = function() {
  128. if (check_lock) {
  129. return;
  130. }
  131. check_lock = true;
  132. setTimeout(process, opts.interval);
  133. };
  134. $(window).scroll(on_check).resize(on_check);
  135. check_binded = true;
  136. }
  137. if (opts.force_process) {
  138. setTimeout(process, opts.interval);
  139. }
  140. selectors.push(selector);
  141. return $(selector);
  142. }
  143. });
  144. $.extend({
  145. // force elements's appearance check
  146. force_appear: function() {
  147. if (check_binded) {
  148. process();
  149. return true;
  150. };
  151. return false;
  152. }
  153. });
  154. })(jQuery);
  155. // ------------- DRAW FILL SVG ---------------------------------------------- //
  156. // ============ https://github.com/callmenick/Draw-Fill-SVG ================= //
  157. // -------------------------------------------------------------------------- //
  158. (function( window ){
  159. 'use strict';
  160. /**
  161. * Cross browser transition end events
  162. *
  163. * Use modernizr to detect cross browser transition end events. Make sure
  164. * to include Modernizr in your doc and have "Modernizr.prefixed()" checked
  165. * off in the extensibility section.
  166. */
  167. var transEndEventNames = {
  168. "WebkitTransition" : "webkitTransitionEnd",
  169. "MozTransition" : "transitionend",
  170. "OTransition" : "oTransitionEnd",
  171. "msTransition" : "MSTransitionEnd",
  172. "transition" : "transitionend"
  173. },
  174. transEndEventName = transEndEventNames[ Modernizr.prefixed('transition') ];
  175. /**
  176. * Extend obj function
  177. *
  178. */
  179. function extend( a, b ) {
  180. for( var key in b ) {
  181. if( b.hasOwnProperty( key ) ) {
  182. a[key] = b[key];
  183. }
  184. }
  185. return a;
  186. }
  187. /**
  188. * DrawFillSVG constructor
  189. *
  190. */
  191. function DrawFillSVG( options ) {
  192. this.options = extend( {}, this.options );
  193. extend( this.options, options );
  194. this._init();
  195. }
  196. /**
  197. * DrawFillSVG options
  198. *
  199. * Available options:
  200. * elementId - the ID of the element to draw
  201. */
  202. DrawFillSVG.prototype.options = {
  203. elementId : "svg"
  204. }
  205. /**
  206. * DrawFillSVG _init
  207. *
  208. * Initialise DrawFillSVG
  209. */
  210. DrawFillSVG.prototype._init = function() {
  211. this.svg = document.getElementById(this.options.elementId);
  212. this.paths = this.svg.querySelectorAll("path");
  213. this._initAnimation();
  214. }
  215. /**
  216. * DrawFillSVG _initAnimation()
  217. *
  218. * Reset some style properties on our paths, add some transitions, set the
  219. * stroke-dasharray to the length of the path, and the stroke-dashoffset to
  220. * the length of the path pushing it out of view initially. Then, set the
  221. * stroke-dashoffset to 0, animating the strokes in a drawing manner. Then,
  222. * run the path filler sequence.
  223. */
  224. DrawFillSVG.prototype._initAnimation = function() {
  225. for ( var i = 0; i < this.paths.length; i++ ) {
  226. var path = this.paths[i];
  227. var length = path.getTotalLength();
  228. // reset opacities
  229. path.style.fillOpacity = 0;
  230. path.style.strokeOpacity = 1;
  231. // reset transitions
  232. path.style.transition = path.style.WebkitTransition = "none";
  233. // reset stroke dash array and stroke dash offset
  234. path.style.strokeDasharray = length + " " + length;
  235. path.style.strokeDashoffset = length;
  236. path.getBoundingClientRect();
  237. // apply new transitions
  238. path.style.transition = path.style.WebkitTransition = "stroke-dashoffset 2s ease-in-out";
  239. // go baby go
  240. path.style.strokeDashoffset = 0;
  241. // fill the path
  242. this._fillPath( path );
  243. }
  244. }
  245. /**
  246. * DrawFillSVG _fillPath()
  247. *
  248. * Resets the transition props, then fills the path and fades out the stroke
  249. * by updating the styles.
  250. */
  251. DrawFillSVG.prototype._fillPath = function( path ) {
  252. path.addEventListener( transEndEventName, function() {
  253. // reset transitions
  254. path.style.transition = path.style.WebkitTransition = "none";
  255. path.style.transition = path.style.WebkitTransition = "fill-opacity 1s ease-in-out, stroke-opacity 1s ease-in-out";
  256. // edit props
  257. path.style.fillOpacity = 1;
  258. path.style.strokeOpacity = 0;
  259. } );
  260. }
  261. /**
  262. * DrawFillSVG replay
  263. *
  264. * A public function that allows you to replay the animation if you want. For
  265. * example, click a button, and replay the animation.
  266. */
  267. DrawFillSVG.prototype.replay = function() {
  268. this._initAnimation();
  269. }
  270. /**
  271. * Add to global namespace
  272. */
  273. window.DrawFillSVG = DrawFillSVG;
  274. })( window );
  275. // ------------- JQUERY TYPED.JS -------------------------------------------- //
  276. // ============ https://github.com/mattboldt/typed.js/ ====================== //
  277. // -------------------------------------------------------------------------- //
  278. !function($){
  279. "use strict";
  280. var Typed = function(el, options){
  281. // chosen element to manipulate text
  282. this.el = $(el);
  283. // options
  284. this.options = $.extend({}, $.fn.typed.defaults, options);
  285. // text content of element
  286. this.baseText = this.el.text() || this.el.attr('placeholder') || '';
  287. // typing speed
  288. this.typeSpeed = this.options.typeSpeed;
  289. // add a delay before typing starts
  290. this.startDelay = this.options.startDelay;
  291. // backspacing speed
  292. this.backSpeed = this.options.backSpeed;
  293. // amount of time to wait before backspacing
  294. this.backDelay = this.options.backDelay;
  295. // input strings of text
  296. this.strings = this.options.strings;
  297. // character number position of current string
  298. this.strPos = 0;
  299. // current array position
  300. this.arrayPos = 0;
  301. // number to stop backspacing on.
  302. // default 0, can change depending on how many chars
  303. // you want to remove at the time
  304. this.stopNum = 0;
  305. // Looping logic
  306. this.loop = this.options.loop;
  307. this.loopCount = this.options.loopCount;
  308. this.curLoop = 0;
  309. // for stopping
  310. this.stop = false;
  311. // show cursor
  312. this.showCursor = this.isInput ? false : this.options.showCursor;
  313. // custom cursor
  314. this.cursorChar = this.options.cursorChar;
  315. // attribute to type
  316. this.isInput = this.el.is('input');
  317. this.attr = this.options.attr || (this.isInput ? 'placeholder' : null);
  318. // All systems go!
  319. this.build();
  320. };
  321. Typed.prototype = {
  322. constructor: Typed
  323. , init: function(){
  324. // begin the loop w/ first current string (global self.string)
  325. // current string will be passed as an argument each time after this
  326. var self = this;
  327. self.timeout = setTimeout(function() {
  328. // Start typing
  329. self.typewrite(self.strings[self.arrayPos], self.strPos);
  330. }, self.startDelay);
  331. }
  332. , build: function(){
  333. // Insert cursor
  334. if (this.showCursor === true){
  335. this.cursor = $("<span class=\"typed-cursor\">" + this.cursorChar + "</span>");
  336. this.el.after(this.cursor);
  337. }
  338. this.init();
  339. }
  340. // pass current string state to each function, types 1 char per call
  341. , typewrite: function(curString, curStrPos){
  342. // exit when stopped
  343. if(this.stop === true)
  344. return;
  345. // varying values for setTimeout during typing
  346. // can't be global since number changes each time loop is executed
  347. var humanize = Math.round(Math.random() * (100 - 30)) + this.typeSpeed;
  348. var self = this;
  349. // ------------- optional ------------- //
  350. // backpaces a certain string faster
  351. // ------------------------------------ //
  352. // if (self.arrayPos == 1){
  353. // self.backDelay = 50;
  354. // }
  355. // else{ self.backDelay = 500; }
  356. // contain typing function in a timeout humanize'd delay
  357. self.timeout = setTimeout(function() {
  358. // check for an escape character before a pause value
  359. // format: \^\d+ .. eg: ^1000 .. should be able to print the ^ too using ^^
  360. // single ^ are removed from string
  361. var charPause = 0;
  362. var substr = curString.substr(curStrPos);
  363. if (substr.charAt(0) === '^') {
  364. var skip = 1; // skip atleast 1
  365. if(/^\^\d+/.test(substr)) {
  366. substr = /\d+/.exec(substr)[0];
  367. skip += substr.length;
  368. charPause = parseInt(substr);
  369. }
  370. // strip out the escape character and pause value so they're not printed
  371. curString = curString.substring(0,curStrPos)+curString.substring(curStrPos+skip);
  372. }
  373. // timeout for any pause after a character
  374. self.timeout = setTimeout(function() {
  375. if(curStrPos === curString.length) {
  376. // fires callback function
  377. self.options.onStringTyped(self.arrayPos);
  378. // is this the final string
  379. if(self.arrayPos === self.strings.length-1) {
  380. // animation that occurs on the last typed string
  381. self.options.callback();
  382. self.curLoop++;
  383. // quit if we wont loop back
  384. if(self.loop === false || self.curLoop === self.loopCount)
  385. return;
  386. }
  387. self.timeout = setTimeout(function(){
  388. self.backspace(curString, curStrPos);
  389. }, self.backDelay);
  390. } else {
  391. /* call before functions if applicable */
  392. if(curStrPos === 0)
  393. self.options.preStringTyped(self.arrayPos);
  394. // start typing each new char into existing string
  395. // curString: arg, self.baseText: original text inside element
  396. var nextString = self.baseText + curString.substr(0, curStrPos+1);
  397. if (self.attr) {
  398. self.el.attr(self.attr, nextString);
  399. } else {
  400. self.el.text(nextString);
  401. }
  402. // add characters one by one
  403. curStrPos++;
  404. // loop the function
  405. self.typewrite(curString, curStrPos);
  406. }
  407. // end of character pause
  408. }, charPause);
  409. // humanized value for typing
  410. }, humanize);
  411. }
  412. , backspace: function(curString, curStrPos){
  413. // exit when stopped
  414. if (this.stop === true) {
  415. return;
  416. }
  417. // varying values for setTimeout during typing
  418. // can't be global since number changes each time loop is executed
  419. var humanize = Math.round(Math.random() * (100 - 30)) + this.backSpeed;
  420. var self = this;
  421. self.timeout = setTimeout(function() {
  422. // ----- this part is optional ----- //
  423. // check string array position
  424. // on the first string, only delete one word
  425. // the stopNum actually represents the amount of chars to
  426. // ------------- CUSTOM OPTIONS --------------------------------------------- //
  427. // ========================================================================== //
  428. // -------------------------------------------------------------------------- //
  429. if (self.arrayPos == 1) {
  430. self.stopNum = 17;
  431. self.backDelay = 500;
  432. }
  433. else if (self.arrayPos == 2) {
  434. self.stopNum = 54;
  435. }
  436. else{self.stopNum = 0;}
  437. // ----- continue important stuff ----- //
  438. // replace text with base text + typed characters
  439. var nextString = self.baseText + curString.substr(0, curStrPos);
  440. if (self.attr) {
  441. self.el.attr(self.attr, nextString);
  442. } else {
  443. self.el.text(nextString);
  444. }
  445. // if the number (id of character in current string) is
  446. // less than the stop number, keep going
  447. if (curStrPos > self.stopNum){
  448. // subtract characters one by one
  449. curStrPos--;
  450. // loop the function
  451. self.backspace(curString, curStrPos);
  452. }
  453. // if the stop number has been reached, increase
  454. // array position to next string
  455. else if (curStrPos <= self.stopNum) {
  456. self.arrayPos++;
  457. if(self.arrayPos === self.strings.length) {
  458. self.arrayPos = 0;
  459. self.init();
  460. } else
  461. self.typewrite(self.strings[self.arrayPos], curStrPos);
  462. }
  463. // humanized value for typing
  464. }, humanize);
  465. }
  466. // Start & Stop currently not working
  467. // , stop: function() {
  468. // var self = this;
  469. // self.stop = true;
  470. // clearInterval(self.timeout);
  471. // }
  472. // , start: function() {
  473. // var self = this;
  474. // if(self.stop === false)
  475. // return;
  476. // this.stop = false;
  477. // this.init();
  478. // }
  479. // Reset and rebuild the element
  480. , reset: function(){
  481. var self = this;
  482. clearInterval(self.timeout);
  483. var id = this.el.attr('id');
  484. this.el.after('<span id="' + id + '"/>')
  485. this.el.remove();
  486. this.cursor.remove();
  487. // Send the callback
  488. self.options.resetCallback();
  489. }
  490. };
  491. $.fn.typed = function (option) {
  492. return this.each(function () {
  493. var $this = $(this)
  494. , data = $this.data('typed')
  495. , options = typeof option == 'object' && option;
  496. if (!data) $this.data('typed', (data = new Typed(this, options)));
  497. if (typeof option == 'string') data[option]();
  498. });
  499. };
  500. $.fn.typed.defaults = {
  501. strings: ["These are the default values...", "You know what you should do?", "Use your own!", "Have a great day!"],
  502. // typing speed
  503. typeSpeed: 0,
  504. // time before typing starts
  505. startDelay: 0,
  506. // backspacing speed
  507. backSpeed: 0,
  508. // time before backspacing
  509. backDelay: 500,
  510. // loop
  511. loop: false,
  512. // false = infinite
  513. loopCount: false,
  514. // show cursor
  515. showCursor: true,
  516. // character for cursor
  517. cursorChar: "|",
  518. // attribute to type (null == text)
  519. attr: null,
  520. // call when done callback function
  521. callback: function() {},
  522. // starting callback function before each string
  523. preStringTyped: function() {},
  524. //callback for every typed string
  525. onStringTyped: function() {},
  526. // callback for reset
  527. resetCallback: function() {}
  528. };
  529. }(window.jQuery);
  530. // ------------- JQUERY SCROLLTO--------------------------------------------- //
  531. // ============ https://github.com/balupton/jquery-scrollto ================= //
  532. // -------------------------------------------------------------------------- //
  533. /*global define:false require:false */
  534. (function (name, context, definition) {
  535. if (typeof module != 'undefined' && module.exports) module.exports = definition();
  536. else if (typeof define == 'function' && define.amd) define(definition);
  537. else context[name] = definition();
  538. })('jquery-scrollto', this, function(){
  539. // Prepare
  540. var jQuery, $, ScrollTo;
  541. jQuery = $ = window.jQuery || require('jquery');
  542. // Fix scrolling animations on html/body on safari
  543. $.propHooks.scrollTop = $.propHooks.scrollLeft = {
  544. get: function(elem,prop) {
  545. var result = null;
  546. if ( elem.tagName === 'HTML' || elem.tagName === 'BODY' ) {
  547. if ( prop === 'scrollLeft' ) {
  548. result = window.scrollX;
  549. } else if ( prop === 'scrollTop' ) {
  550. result = window.scrollY;
  551. }
  552. }
  553. if ( result == null ) {
  554. result = elem[prop];
  555. }
  556. return result;
  557. }
  558. };
  559. $.Tween.propHooks.scrollTop = $.Tween.propHooks.scrollLeft = {
  560. get: function(tween) {
  561. return $.propHooks.scrollTop.get(tween.elem, tween.prop);
  562. },
  563. set: function(tween) {
  564. // Our safari fix
  565. if ( tween.elem.tagName === 'HTML' || tween.elem.tagName === 'BODY' ) {
  566. // Defaults
  567. tween.options.bodyScrollLeft = (tween.options.bodyScrollLeft || window.scrollX);
  568. tween.options.bodyScrollTop = (tween.options.bodyScrollTop || window.scrollY);
  569. // Apply
  570. if ( tween.prop === 'scrollLeft' ) {
  571. tween.options.bodyScrollLeft = Math.round(tween.now);
  572. }
  573. else if ( tween.prop === 'scrollTop' ) {
  574. tween.options.bodyScrollTop = Math.round(tween.now);
  575. }
  576. // Apply
  577. window.scrollTo(tween.options.bodyScrollLeft, tween.options.bodyScrollTop);
  578. }
  579. // jQuery's IE8 Fix
  580. else if ( tween.elem.nodeType && tween.elem.parentNode ) {
  581. tween.elem[ tween.prop ] = tween.now;
  582. }
  583. }
  584. };
  585. // jQuery ScrollTo
  586. ScrollTo = {
  587. // Configuration
  588. config: {
  589. duration: 400,
  590. easing: 'swing',
  591. callback: undefined,
  592. durationMode: 'each',
  593. offsetTop: 0,
  594. offsetLeft: 0
  595. },
  596. // Set Configuration
  597. configure: function(options){
  598. // Apply Options to Config
  599. $.extend(ScrollTo.config, options||{});
  600. // Chain
  601. return this;
  602. },
  603. // Perform the Scroll Animation for the Collections
  604. // We use $inline here, so we can determine the actual offset start for each overflow:scroll item
  605. // Each collection is for each overflow:scroll item
  606. scroll: function(collections, config){
  607. // Prepare
  608. var collection, $container, container, $target, $inline, position, containerTagName,
  609. containerScrollTop, containerScrollLeft,
  610. containerScrollTopEnd, containerScrollLeftEnd,
  611. startOffsetTop, targetOffsetTop, targetOffsetTopAdjusted,
  612. startOffsetLeft, targetOffsetLeft, targetOffsetLeftAdjusted,
  613. scrollOptions,
  614. callback;
  615. // Determine the Scroll
  616. collection = collections.pop();
  617. $container = collection.$container;
  618. $target = collection.$target;
  619. containerTagName = $container.prop('tagName');
  620. // Prepare the Inline Element of the Container
  621. $inline = $('<span/>').css({
  622. 'position': 'absolute',
  623. 'top': '0px',
  624. 'left': '0px'
  625. });
  626. position = $container.css('position');
  627. // Insert the Inline Element of the Container
  628. $container.css({position:'relative'});
  629. $inline.appendTo($container);
  630. // Determine the top offset
  631. startOffsetTop = $inline.offset().top;
  632. targetOffsetTop = $target.offset().top;
  633. targetOffsetTopAdjusted = targetOffsetTop - startOffsetTop - parseInt(config.offsetTop,10);
  634. // Determine the left offset
  635. startOffsetLeft = $inline.offset().left;
  636. targetOffsetLeft = $target.offset().left;
  637. targetOffsetLeftAdjusted = targetOffsetLeft - startOffsetLeft - parseInt(config.offsetLeft,10);
  638. // Determine current scroll positions
  639. containerScrollTop = $container.prop('scrollTop');
  640. containerScrollLeft = $container.prop('scrollLeft');
  641. // Reset the Inline Element of the Container
  642. $inline.remove();
  643. $container.css({position:position});
  644. // Prepare the scroll options
  645. scrollOptions = {};
  646. // Prepare the callback
  647. callback = function(event){
  648. // Check
  649. if ( collections.length === 0 ) {
  650. // Callback
  651. if ( typeof config.callback === 'function' ) {
  652. config.callback();
  653. }
  654. }
  655. else {
  656. // Recurse
  657. ScrollTo.scroll(collections,config);
  658. }
  659. // Return true
  660. return true;
  661. };
  662. // Handle if we only want to scroll if we are outside the viewport
  663. if ( config.onlyIfOutside ) {
  664. // Determine current scroll positions
  665. containerScrollTopEnd = containerScrollTop + $container.height();
  666. containerScrollLeftEnd = containerScrollLeft + $container.width();
  667. // Check if we are in the range of the visible area of the container
  668. if ( containerScrollTop < targetOffsetTopAdjusted && targetOffsetTopAdjusted < containerScrollTopEnd ) {
  669. targetOffsetTopAdjusted = containerScrollTop;
  670. }
  671. if ( containerScrollLeft < targetOffsetLeftAdjusted && targetOffsetLeftAdjusted < containerScrollLeftEnd ) {
  672. targetOffsetLeftAdjusted = containerScrollLeft;
  673. }
  674. }
  675. // Determine the scroll options
  676. if ( targetOffsetTopAdjusted !== containerScrollTop ) {
  677. scrollOptions.scrollTop = targetOffsetTopAdjusted;
  678. }
  679. if ( targetOffsetLeftAdjusted !== containerScrollLeft ) {
  680. scrollOptions.scrollLeft = targetOffsetLeftAdjusted;
  681. }
  682. // Check to see if the scroll is necessary
  683. if ( $container.prop('scrollHeight') === $container.width() ) {
  684. delete scrollOptions.scrollTop;
  685. }
  686. if ( $container.prop('scrollWidth') === $container.width() ) {
  687. delete scrollOptions.scrollLeft;
  688. }
  689. // Perform the scroll
  690. if ( scrollOptions.scrollTop != null || scrollOptions.scrollLeft != null ) {
  691. $container.animate(scrollOptions, {
  692. duration: config.duration,
  693. easing: config.easing,
  694. complete: callback
  695. });
  696. }
  697. else {
  698. callback();
  699. }
  700. // Return true
  701. return true;
  702. },
  703. // ScrollTo the Element using the Options
  704. fn: function(options){
  705. // Prepare
  706. var collections, config, $container, container;
  707. collections = [];
  708. // Prepare
  709. var $target = $(this);
  710. if ( $target.length === 0 ) {
  711. // Chain
  712. return this;
  713. }
  714. // Handle Options
  715. config = $.extend({},ScrollTo.config,options);
  716. // Fetch
  717. $container = $target.parent();
  718. container = $container.get(0);
  719. // Cycle through the containers
  720. while ( ($container.length === 1) && (container !== document.body) && (container !== document) ) {
  721. // Check Container for scroll differences
  722. var containerScrollTop, containerScrollLeft;
  723. containerScrollTop = $container.css('overflow-y') !== 'visible' && container.scrollHeight !== container.clientHeight;
  724. containerScrollLeft = $container.css('overflow-x') !== 'visible' && container.scrollWidth !== container.clientWidth;
  725. if ( containerScrollTop || containerScrollLeft ) {
  726. // Push the Collection
  727. collections.push({
  728. '$container': $container,
  729. '$target': $target
  730. });
  731. // Update the Target
  732. $target = $container;
  733. }
  734. // Update the Container
  735. $container = $container.parent();
  736. container = $container.get(0);
  737. }
  738. // Add the final collection
  739. collections.push({
  740. '$container': $('html'),
  741. // document.body doesn't work in firefox, html works for all
  742. // internet explorer starts at the beggining
  743. '$target': $target
  744. });
  745. // Adjust the Config
  746. if ( config.durationMode === 'all' ) {
  747. config.duration /= collections.length;
  748. }
  749. // Handle
  750. ScrollTo.scroll(collections,config);
  751. // Chain
  752. return this;
  753. }
  754. };
  755. // Apply our extensions to jQuery
  756. $.ScrollTo = $.ScrollTo || ScrollTo;
  757. $.fn.ScrollTo = $.fn.ScrollTo || ScrollTo.fn;
  758. // Export
  759. return ScrollTo;
  760. });
  761. // ------------- WOW ANIMATE ------------------------------------------------ //
  762. // ==============https://github.com/matthieua/WOW =========================== //
  763. // -------------------------------------------------------------------------- //
  764. (function() {
  765. var MutationObserver, Util, WeakMap, getComputedStyle, getComputedStyleRX,
  766. __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
  767. __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
  768. Util = (function() {
  769. function Util() {}
  770. Util.prototype.extend = function(custom, defaults) {
  771. var key, value;
  772. for (key in defaults) {
  773. value = defaults[key];
  774. if (custom[key] == null) {
  775. custom[key] = value;
  776. }
  777. }
  778. return custom;
  779. };
  780. Util.prototype.isMobile = function(agent) {
  781. return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(agent);
  782. };
  783. Util.prototype.addEvent = function(elem, event, fn) {
  784. if (elem.addEventListener != null) {
  785. return elem.addEventListener(event, fn, false);
  786. } else if (elem.attachEvent != null) {
  787. return elem.attachEvent("on" + event, fn);
  788. } else {
  789. return elem[event] = fn;
  790. }
  791. };
  792. Util.prototype.removeEvent = function(elem, event, fn) {
  793. if (elem.removeEventListener != null) {
  794. return elem.removeEventListener(event, fn, false);
  795. } else if (elem.detachEvent != null) {
  796. return elem.detachEvent("on" + event, fn);
  797. } else {
  798. return delete elem[event];
  799. }
  800. };
  801. Util.prototype.innerHeight = function() {
  802. if ('innerHeight' in window) {
  803. return window.innerHeight;
  804. } else {
  805. return document.documentElement.clientHeight;
  806. }
  807. };
  808. return Util;
  809. })();
  810. WeakMap = this.WeakMap || this.MozWeakMap || (WeakMap = (function() {
  811. function WeakMap() {
  812. this.keys = [];
  813. this.values = [];
  814. }
  815. WeakMap.prototype.get = function(key) {
  816. var i, item, _i, _len, _ref;
  817. _ref = this.keys;
  818. for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) {
  819. item = _ref[i];
  820. if (item === key) {
  821. return this.values[i];
  822. }
  823. }
  824. };
  825. WeakMap.prototype.set = function(key, value) {
  826. var i, item, _i, _len, _ref;
  827. _ref = this.keys;
  828. for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) {
  829. item = _ref[i];
  830. if (item === key) {
  831. this.values[i] = value;
  832. return;
  833. }
  834. }
  835. this.keys.push(key);
  836. return this.values.push(value);
  837. };
  838. return WeakMap;
  839. })());
  840. MutationObserver = this.MutationObserver || this.WebkitMutationObserver || this.MozMutationObserver || (MutationObserver = (function() {
  841. function MutationObserver() {
  842. if (typeof console !== "undefined" && console !== null) {
  843. console.warn('MutationObserver is not supported by your browser.');
  844. }
  845. if (typeof console !== "undefined" && console !== null) {
  846. console.warn('WOW.js cannot detect dom mutations, please call .sync() after loading new content.');
  847. }
  848. }
  849. MutationObserver.notSupported = true;
  850. MutationObserver.prototype.observe = function() {};
  851. return MutationObserver;
  852. })());
  853. getComputedStyle = this.getComputedStyle || function(el, pseudo) {
  854. this.getPropertyValue = function(prop) {
  855. var _ref;
  856. if (prop === 'float') {
  857. prop = 'styleFloat';
  858. }
  859. if (getComputedStyleRX.test(prop)) {
  860. prop.replace(getComputedStyleRX, function(_, char) {
  861. return char.toUpperCase();
  862. });
  863. }
  864. return ((_ref = el.currentStyle) != null ? _ref[prop] : void 0) || null;
  865. };
  866. return this;
  867. };
  868. getComputedStyleRX = /(\-([a-z]){1})/g;
  869. this.WOW = (function() {
  870. WOW.prototype.defaults = {
  871. boxClass: 'wow',
  872. animateClass: 'animated',
  873. offset: 0,
  874. mobile: true,
  875. live: true
  876. };
  877. function WOW(options) {
  878. if (options == null) {
  879. options = {};
  880. }
  881. this.scrollCallback = __bind(this.scrollCallback, this);
  882. this.scrollHandler = __bind(this.scrollHandler, this);
  883. this.start = __bind(this.start, this);
  884. this.scrolled = true;
  885. this.config = this.util().extend(options, this.defaults);
  886. this.animationNameCache = new WeakMap();
  887. }
  888. WOW.prototype.init = function() {
  889. var _ref;
  890. this.element = window.document.documentElement;
  891. if ((_ref = document.readyState) === "interactive" || _ref === "complete") {
  892. this.start();
  893. } else {
  894. this.util().addEvent(document, 'DOMContentLoaded', this.start);
  895. }
  896. return this.finished = [];
  897. };
  898. WOW.prototype.start = function() {
  899. var box, _i, _len, _ref;
  900. this.stopped = false;
  901. this.boxes = (function() {
  902. var _i, _len, _ref, _results;
  903. _ref = this.element.querySelectorAll("." + this.config.boxClass);
  904. _results = [];
  905. for (_i = 0, _len = _ref.length; _i < _len; _i++) {
  906. box = _ref[_i];
  907. _results.push(box);
  908. }
  909. return _results;
  910. }).call(this);
  911. this.all = (function() {
  912. var _i, _len, _ref, _results;
  913. _ref = this.boxes;
  914. _results = [];
  915. for (_i = 0, _len = _ref.length; _i < _len; _i++) {
  916. box = _ref[_i];
  917. _results.push(box);
  918. }
  919. return _results;
  920. }).call(this);
  921. if (this.boxes.length) {
  922. if (this.disabled()) {
  923. this.resetStyle();
  924. } else {
  925. _ref = this.boxes;
  926. for (_i = 0, _len = _ref.length; _i < _len; _i++) {
  927. box = _ref[_i];
  928. this.applyStyle(box, true);
  929. }
  930. this.util().addEvent(window, 'scroll', this.scrollHandler);
  931. this.util().addEvent(window, 'resize', this.scrollHandler);
  932. this.interval = setInterval(this.scrollCallback, 50);
  933. }
  934. }
  935. if (this.config.live) {
  936. return new MutationObserver((function(_this) {
  937. return function(records) {
  938. var node, record, _j, _len1, _results;
  939. _results = [];
  940. for (_j = 0, _len1 = records.length; _j < _len1; _j++) {
  941. record = records[_j];
  942. _results.push((function() {
  943. var _k, _len2, _ref1, _results1;
  944. _ref1 = record.addedNodes || [];
  945. _results1 = [];
  946. for (_k = 0, _len2 = _ref1.length; _k < _len2; _k++) {
  947. node = _ref1[_k];
  948. _results1.push(this.doSync(node));
  949. }
  950. return _results1;
  951. }).call(_this));
  952. }
  953. return _results;
  954. };
  955. })(this)).observe(document.body, {
  956. childList: true,
  957. subtree: true
  958. });
  959. }
  960. };
  961. WOW.prototype.stop = function() {
  962. this.stopped = true;
  963. this.util().removeEvent(window, 'scroll', this.scrollHandler);
  964. this.util().removeEvent(window, 'resize', this.scrollHandler);
  965. if (this.interval != null) {
  966. return clearInterval(this.interval);
  967. }
  968. };
  969. WOW.prototype.sync = function(element) {
  970. if (MutationObserver.notSupported) {
  971. return this.doSync(this.element);
  972. }
  973. };
  974. WOW.prototype.doSync = function(element) {
  975. var box, _i, _len, _ref, _results;
  976. if (element == null) {
  977. element = this.element;
  978. }
  979. if (element.nodeType !== 1) {
  980. return;
  981. }
  982. element = element.parentNode || element;
  983. _ref = element.querySelectorAll("." + this.config.boxClass);
  984. _results = [];
  985. for (_i = 0, _len = _ref.length; _i < _len; _i++) {
  986. box = _ref[_i];
  987. if (__indexOf.call(this.all, box) < 0) {
  988. this.boxes.push(box);
  989. this.all.push(box);
  990. if (this.stopped || this.disabled()) {
  991. this.resetStyle();
  992. } else {
  993. this.applyStyle(box, true);
  994. }
  995. _results.push(this.scrolled = true);
  996. } else {
  997. _results.push(void 0);
  998. }
  999. }
  1000. return _results;
  1001. };
  1002. WOW.prototype.show = function(box) {
  1003. this.applyStyle(box);
  1004. return box.className = "" + box.className + " " + this.config.animateClass;
  1005. };
  1006. WOW.prototype.applyStyle = function(box, hidden) {
  1007. var delay, duration, iteration;
  1008. duration = box.getAttribute('data-wow-duration');
  1009. delay = box.getAttribute('data-wow-delay');
  1010. iteration = box.getAttribute('data-wow-iteration');
  1011. return this.animate((function(_this) {
  1012. return function() {
  1013. return _this.customStyle(box, hidden, duration, delay, iteration);
  1014. };
  1015. })(this));
  1016. };
  1017. WOW.prototype.animate = (function() {
  1018. if ('requestAnimationFrame' in window) {
  1019. return function(callback) {
  1020. return window.requestAnimationFrame(callback);
  1021. };
  1022. } else {
  1023. return function(callback) {
  1024. return callback();
  1025. };
  1026. }
  1027. })();
  1028. WOW.prototype.resetStyle = function() {
  1029. var box, _i, _len, _ref, _results;
  1030. _ref = this.boxes;
  1031. _results = [];
  1032. for (_i = 0, _len = _ref.length; _i < _len; _i++) {
  1033. box = _ref[_i];
  1034. _results.push(box.style.visibility = 'visible');
  1035. }
  1036. return _results;
  1037. };
  1038. WOW.prototype.customStyle = function(box, hidden, duration, delay, iteration) {
  1039. if (hidden) {
  1040. this.cacheAnimationName(box);
  1041. }
  1042. box.style.visibility = hidden ? 'hidden' : 'visible';
  1043. if (duration) {
  1044. this.vendorSet(box.style, {
  1045. animationDuration: duration
  1046. });
  1047. }
  1048. if (delay) {
  1049. this.vendorSet(box.style, {
  1050. animationDelay: delay
  1051. });
  1052. }
  1053. if (iteration) {
  1054. this.vendorSet(box.style, {
  1055. animationIterationCount: iteration
  1056. });
  1057. }
  1058. this.vendorSet(box.style, {
  1059. animationName: hidden ? 'none' : this.cachedAnimationName(box)
  1060. });
  1061. return box;
  1062. };
  1063. WOW.prototype.vendors = ["moz", "webkit"];
  1064. WOW.prototype.vendorSet = function(elem, properties) {
  1065. var name, value, vendor, _results;
  1066. _results = [];
  1067. for (name in properties) {
  1068. value = properties[name];
  1069. elem["" + name] = value;
  1070. _results.push((function() {
  1071. var _i, _len, _ref, _results1;
  1072. _ref = this.vendors;
  1073. _results1 = [];
  1074. for (_i = 0, _len = _ref.length; _i < _len; _i++) {
  1075. vendor = _ref[_i];
  1076. _results1.push(elem["" + vendor + (name.charAt(0).toUpperCase()) + (name.substr(1))] = value);
  1077. }
  1078. return _results1;
  1079. }).call(this));
  1080. }
  1081. return _results;
  1082. };
  1083. WOW.prototype.vendorCSS = function(elem, property) {
  1084. var result, style, vendor, _i, _len, _ref;
  1085. style = getComputedStyle(elem);
  1086. result = style.getPropertyCSSValue(property);
  1087. _ref = this.vendors;
  1088. for (_i = 0, _len = _ref.length; _i < _len; _i++) {
  1089. vendor = _ref[_i];
  1090. result = result || style.getPropertyCSSValue("-" + vendor + "-" + property);
  1091. }
  1092. return result;
  1093. };
  1094. WOW.prototype.animationName = function(box) {
  1095. var animationName;
  1096. try {
  1097. animationName = this.vendorCSS(box, 'animation-name').cssText;
  1098. } catch (_error) {
  1099. animationName = getComputedStyle(box).getPropertyValue('animation-name');
  1100. }
  1101. if (animationName === 'none') {
  1102. return '';
  1103. } else {
  1104. return animationName;
  1105. }
  1106. };
  1107. WOW.prototype.cacheAnimationName = function(box) {
  1108. return this.animationNameCache.set(box, this.animationName(box));
  1109. };
  1110. WOW.prototype.cachedAnimationName = function(box) {
  1111. return this.animationNameCache.get(box);
  1112. };
  1113. WOW.prototype.scrollHandler = function() {
  1114. return this.scrolled = true;
  1115. };
  1116. WOW.prototype.scrollCallback = function() {
  1117. var box;
  1118. if (this.scrolled) {
  1119. this.scrolled = false;
  1120. this.boxes = (function() {
  1121. var _i, _len, _ref, _results;
  1122. _ref = this.boxes;
  1123. _results = [];
  1124. for (_i = 0, _len = _ref.length; _i < _len; _i++) {
  1125. box = _ref[_i];
  1126. if (!(box)) {
  1127. continue;
  1128. }
  1129. if (this.isVisible(box)) {
  1130. this.show(box);
  1131. continue;
  1132. }
  1133. _results.push(box);
  1134. }
  1135. return _results;
  1136. }).call(this);
  1137. if (!(this.boxes.length || this.config.live)) {
  1138. return this.stop();
  1139. }
  1140. }
  1141. };
  1142. WOW.prototype.offsetTop = function(element) {
  1143. var top;
  1144. while (element.offsetTop === void 0) {
  1145. element = element.parentNode;
  1146. }
  1147. top = element.offsetTop;
  1148. while (element = element.offsetParent) {
  1149. top += element.offsetTop;
  1150. }
  1151. return top;
  1152. };
  1153. WOW.prototype.isVisible = function(box) {
  1154. var bottom, offset, top, viewBottom, viewTop;
  1155. offset = box.getAttribute('data-wow-offset') || this.config.offset;
  1156. viewTop = window.pageYOffset;
  1157. viewBottom = viewTop + Math.min(this.element.clientHeight, this.util().innerHeight()) - offset;
  1158. top = this.offsetTop(box);
  1159. bottom = top + box.clientHeight;
  1160. return top <= viewBottom && bottom >= viewTop;
  1161. };
  1162. WOW.prototype.util = function() {
  1163. return this._util != null ? this._util : this._util = new Util();
  1164. };
  1165. WOW.prototype.disabled = function() {
  1166. return !this.config.mobile && this.util().isMobile(navigator.userAgent);
  1167. };
  1168. return WOW;
  1169. })();
  1170. }).call(this);
  1171. // ------------- JQUERY SMOOTHSTATE ----------------------------------------- //
  1172. // ============ https://github.com/miguel-perez/jquery.smoothState.js ======= //
  1173. // -------------------------------------------------------------------------- //
  1174. ;(function ( $, window, document, undefined ) {
  1175. "use strict";
  1176. var
  1177. /** Used later to scroll page to the top */
  1178. $body = $("html, body"),
  1179. /** Used in development mode to console out useful warnings */
  1180. consl = (window.console || false),
  1181. /** Plugin default options */
  1182. defaults = {
  1183. /** jquery element string to specify which anchors smoothstate should bind to */
  1184. anchors : "a",
  1185. /** If set to true, smoothState will prefetch a link's contents on hover */
  1186. prefetch : false,
  1187. /** A selecor that deinfes with links should be ignored by smoothState */
  1188. blacklist : ".no-smoothstate, [target]",
  1189. /** If set to true, smoothState will log useful debug information instead of aborting */
  1190. development : false,
  1191. /** The number of pages smoothState will try to store in memory and not request again */
  1192. pageCacheSize : 0,
  1193. /** A function that can be used to alter urls before they are used to request content */
  1194. alterRequestUrl : function (url) {
  1195. return url;
  1196. },
  1197. /** Run when a link has been activated */
  1198. onStart : {
  1199. duration: 0,
  1200. render: function (url, $container) {
  1201. $body.scrollTop(0);
  1202. }
  1203. },
  1204. /** Run if the page request is still pending and onStart has finished animating */
  1205. onProgress : {
  1206. duration: 0,
  1207. render: function (url, $container) {
  1208. $body.css("cursor", "wait");
  1209. $body.find("a").css("cursor", "wait");
  1210. }
  1211. },
  1212. /** Run when requested content is ready to be injected into the page */
  1213. onEnd : {
  1214. duration: 0,
  1215. render: function (url, $container, $content) {
  1216. $body.css("cursor", "auto");
  1217. $body.find("a").css("cursor", "auto");
  1218. $container.html($content);
  1219. }
  1220. },
  1221. /** Run when content has been injected and all animations are complete */
  1222. callback : function(url, $container, $content) {
  1223. }
  1224. },
  1225. /** Utility functions that are decoupled from SmoothState */
  1226. utility = {
  1227. /**
  1228. * Checks to see if the url is external
  1229. * @param {string} url - url being evaluated
  1230. * @see http://stackoverflow.com/questions/6238351/fastest-way-to-detect-external-urls
  1231. *
  1232. */
  1233. isExternal: function (url) {
  1234. var match = url.match(/^([^:\/?#]+:)?(?:\/\/([^\/?#]*))?([^?#]+)?(\?[^#]*)?(#.*)?/);
  1235. if (typeof match[1] === "string" && match[1].length > 0 && match[1].toLowerCase() !== window.location.protocol) {
  1236. return true;
  1237. }
  1238. if (typeof match[2] === "string" && match[2].length > 0 && match[2].replace(new RegExp(":(" + {"http:": 80, "https:": 443}[window.location.protocol] + ")?$"), "") !== window.location.host) {
  1239. return true;
  1240. }
  1241. return false;
  1242. },
  1243. /**
  1244. * Checks to see if the url is an internal hash
  1245. * @param {string} url - url being evaluated
  1246. *
  1247. */
  1248. isHash: function (url) {
  1249. var hasPathname = (url.indexOf(window.location.pathname) > 0) ? true : false,
  1250. hasHash = (url.indexOf("#") > 0) ? true : false;
  1251. return (hasPathname && hasHash) ? true : false;
  1252. },
  1253. /**
  1254. * Checks to see if we should be loading this URL
  1255. * @param {string} url - url being evaluated
  1256. * @param {string} blacklist - jquery selector
  1257. *
  1258. */
  1259. shouldLoad: function ($anchor, blacklist) {
  1260. var url = $anchor.prop("href");
  1261. // URL will only be loaded if it"s not an external link, hash, or blacklisted
  1262. return (!utility.isExternal(url) && !utility.isHash(url) && !$anchor.is(blacklist));
  1263. },
  1264. /**
  1265. * Prevents jQuery from stripping elements from $(html)
  1266. * @param {string} url - url being evaluated
  1267. * @author Ben Alman http://benalman.com/
  1268. * @see https://gist.github.com/cowboy/742952
  1269. *
  1270. */
  1271. htmlDoc: function (html) {
  1272. var parent,
  1273. elems = $(),
  1274. matchTag = /<(\/?)(html|head|body|title|base|meta)(\s+[^>]*)?>/ig,
  1275. prefix = "ss" + Math.round(Math.random() * 100000),
  1276. htmlParsed = html.replace(matchTag, function(tag, slash, name, attrs) {
  1277. var obj = {};
  1278. if (!slash) {
  1279. elems = elems.add("<" + name + "/>");
  1280. if (attrs) {
  1281. $.each($("<div" + attrs + "/>")[0].attributes, function(i, attr) {
  1282. obj[attr.name] = attr.value;
  1283. });
  1284. }
  1285. elems.eq(-1).attr(obj);
  1286. }
  1287. return "<" + slash + "div" + (slash ? "" : " id='" + prefix + (elems.length - 1) + "'") + ">";
  1288. });
  1289. // If no placeholder elements were necessary, just return normal
  1290. // jQuery-parsed HTML.
  1291. if (!elems.length) {
  1292. return $(html);
  1293. }
  1294. // Create parent node if it hasn"t been created yet.
  1295. if (!parent) {
  1296. parent = $("<div/>");
  1297. }
  1298. // Create the parent node and append the parsed, place-held HTML.
  1299. parent.html(htmlParsed);
  1300. // Replace each placeholder element with its intended element.
  1301. $.each(elems, function(i) {
  1302. var elem = parent.find("#" + prefix + i).before(elems[i]);
  1303. elems.eq(i).html(elem.contents());
  1304. elem.remove();
  1305. });
  1306. return parent.children().unwrap();
  1307. },
  1308. /**
  1309. * Resets an object if it has too many properties
  1310. *
  1311. * This is used to clear the "cache" object that stores
  1312. * all of the html. This would prevent the client from
  1313. * running out of memory and allow the user to hit the
  1314. * server for a fresh copy of the content.
  1315. *
  1316. * @param {object} obj
  1317. * @param {number} cap
  1318. *
  1319. */
  1320. clearIfOverCapacity: function (obj, cap) {
  1321. // Polyfill Object.keys if it doesn"t exist
  1322. if (!Object.keys) {
  1323. Object.keys = function (obj) {
  1324. var keys = [],
  1325. k;
  1326. for (k in obj) {
  1327. if (Object.prototype.hasOwnProperty.call(obj, k)) {
  1328. keys.push(k);
  1329. }
  1330. }
  1331. return keys;
  1332. };
  1333. }
  1334. if (Object.keys(obj).length > cap) {
  1335. obj = {};
  1336. }
  1337. return obj;
  1338. },
  1339. /**
  1340. * Finds the inner content of an element, by an ID, from a jQuery object
  1341. * @param {string} id
  1342. * @param {object} $html
  1343. *
  1344. */
  1345. getContentById: function (id, $html) {
  1346. $html = ($html instanceof jQuery) ? $html : utility.htmlDoc($html);
  1347. var $insideElem = $html.find(id),
  1348. updatedContainer = ($insideElem.length) ? $.trim($insideElem.html()) : $html.filter(id).html(),
  1349. newContent = (updatedContainer.length) ? $(updatedContainer) : null;
  1350. return newContent;
  1351. },
  1352. /**
  1353. * Stores html content as jquery object in given object
  1354. * @param {object} object - object contents will be stored into
  1355. * @param {string} url - url to be used as the prop
  1356. * @param {jquery} html - contents to store
  1357. *
  1358. */
  1359. storePageIn: function (object, url, $html) {
  1360. $html = ($html instanceof jQuery) ? $html : utility.htmlDoc($html);
  1361. object[url] = { // Content is indexed by the url
  1362. status: "loaded",
  1363. title: $html.find("title").text(), // Stores the title of the page
  1364. html: $html // Stores the contents of the page
  1365. };
  1366. return object;
  1367. },
  1368. /**
  1369. * Triggers an "allanimationend" event when all animations are complete
  1370. * @param {object} $element - jQuery object that should trigger event
  1371. * @param {string} resetOn - which other events to trigger allanimationend on
  1372. *
  1373. */
  1374. triggerAllAnimationEndEvent: function ($element, resetOn) {
  1375. resetOn = " " + resetOn || "";
  1376. var animationCount = 0,
  1377. animationstart = "animationstart webkitAnimationStart oanimationstart MSAnimationStart",
  1378. animationend = "animationend webkitAnimationEnd oanimationend MSAnimationEnd",
  1379. eventname = "allanimationend",
  1380. onAnimationStart = function (e) {
  1381. if ($(e.delegateTarget).is($element)) {
  1382. e.stopPropagation();
  1383. animationCount ++;
  1384. }
  1385. },
  1386. onAnimationEnd = function (e) {
  1387. if ($(e.delegateTarget).is($element)) {
  1388. e.stopPropagation();
  1389. animationCount --;
  1390. if(animationCount === 0) {
  1391. $element.trigger(eventname);
  1392. }
  1393. }
  1394. };
  1395. $element.on(animationstart, onAnimationStart);
  1396. $element.on(animationend, onAnimationEnd);
  1397. $element.on("allanimationend" + resetOn, function(){
  1398. animationCount = 0;
  1399. utility.redraw($element);
  1400. });
  1401. },
  1402. /** Forces browser to redraw elements */
  1403. redraw: function ($element) {
  1404. $element.height(0);
  1405. setTimeout(function(){$element.height("auto");}, 0);
  1406. }
  1407. },
  1408. /** Handles the popstate event, like when the user hits "back" */
  1409. onPopState = function ( e ) {
  1410. if(e.state !== null) {
  1411. var url = window.location.href,
  1412. $page = $("#" + e.state.id),
  1413. page = $page.data("smoothState");
  1414. if(page.href !== url && !utility.isHash(url)) {
  1415. page.load(url, true);
  1416. }
  1417. }
  1418. },
  1419. /** Constructor function */
  1420. SmoothState = function ( element, options ) {
  1421. var
  1422. /** Container element smoothState is run on */
  1423. $container = $(element),
  1424. /** Variable that stores pages after they are requested */
  1425. cache = {},
  1426. /** Url of the content that is currently displayed */
  1427. currentHref = window.location.href,
  1428. /**
  1429. * Loads the contents of a url into our container
  1430. *
  1431. * @param {string} url
  1432. * @param {bool} isPopped - used to determine if whe should
  1433. * add a new item into the history object
  1434. *
  1435. */
  1436. load = function (url, isPopped) {
  1437. /** Makes this an optional variable by setting a default */
  1438. isPopped = isPopped || false;
  1439. var
  1440. /** Used to check if the onProgress function has been run */
  1441. hasRunCallback = false,
  1442. callbBackEnded = false,
  1443. /** List of responses for the states of the page request */
  1444. responses = {
  1445. /** Page is ready, update the content */
  1446. loaded: function() {
  1447. var eventName = hasRunCallback ? "ss.onProgressEnd" : "ss.onStartEnd";
  1448. if(!callbBackEnded || !hasRunCallback) {
  1449. $container.one(eventName, function(){
  1450. updateContent(url);
  1451. });
  1452. } else if(callbBackEnded) {
  1453. updateContent(url);
  1454. }
  1455. if(!isPopped) {
  1456. window.history.pushState({ id: $container.prop("id") }, cache[url].title, url);
  1457. }
  1458. },
  1459. /** Loading, wait 10 ms and check again */
  1460. fetching: function() {
  1461. if(!hasRunCallback) {
  1462. hasRunCallback = true;
  1463. // Run the onProgress callback and set trigger
  1464. $container.one("ss.onStartEnd", function(){
  1465. options.onProgress.render(url, $container, null);
  1466. setTimeout(function(){
  1467. $container.trigger("ss.onProgressEnd");
  1468. callbBackEnded = true;
  1469. }, options.onStart.duration);
  1470. });
  1471. }
  1472. setTimeout(function () {
  1473. // Might of been canceled, better check!
  1474. if(cache.hasOwnProperty(url)){
  1475. responses[cache[url].status]();
  1476. }
  1477. }, 10);
  1478. },
  1479. /** Error, abort and redirect */
  1480. error: function(){
  1481. window.location = url;
  1482. }
  1483. };
  1484. if (!cache.hasOwnProperty(url)) {
  1485. fetch(url);
  1486. }
  1487. // Run the onStart callback and set trigger
  1488. options.onStart.render(url, $container, null);
  1489. setTimeout(function(){
  1490. $container.trigger("ss.onStartEnd");
  1491. }, options.onStart.duration);
  1492. // Start checking for the status of content
  1493. responses[cache[url].status]();
  1494. },
  1495. /** Updates the contents from cache[url] */
  1496. updateContent = function (url) {
  1497. // If the content has been requested and is done:
  1498. var containerId = "#" + $container.prop("id"),
  1499. $content = cache[url] ? utility.getContentById(containerId, cache[url].html) : null;
  1500. if($content) {
  1501. document.title = cache[url].title;
  1502. $container.data("smoothState").href = url;
  1503. // Call the onEnd callback and set trigger
  1504. options.onEnd.render(url, $container, $content);
  1505. $container.one("ss.onEndEnd", function(){
  1506. options.callback(url, $container, $content);
  1507. });
  1508. setTimeout(function(){
  1509. $container.trigger("ss.onEndEnd");
  1510. }, options.onEnd.duration);
  1511. } else if (!$content && options.development && consl) {
  1512. // Throw warning to help debug in development mode
  1513. consl.warn("No element with an id of " + containerId + " in response from " + url + " in " + cache);
  1514. } else {
  1515. // No content availble to update with, aborting...
  1516. window.location = url;
  1517. }
  1518. },
  1519. /**
  1520. * Fetches the contents of a url and stores it in the "cache" varible
  1521. * @param {string} url
  1522. *
  1523. */
  1524. fetch = function (url) {
  1525. // Don"t fetch we have the content already
  1526. if(cache.hasOwnProperty(url)) {
  1527. return;
  1528. }
  1529. cache = utility.clearIfOverCapacity(cache, options.pageCacheSize);
  1530. cache[url] = { status: "fetching" };
  1531. var requestUrl = options.alterRequestUrl(url) || url,
  1532. request = $.ajax(requestUrl);
  1533. // Store contents in cache variable if successful
  1534. request.success(function (html) {
  1535. // Clear cache varible if it"s getting too big
  1536. utility.storePageIn(cache, url, html);
  1537. $container.data("smoothState").cache = cache;
  1538. });
  1539. // Mark as error
  1540. request.error(function () {
  1541. cache[url].status = "error";
  1542. });
  1543. },
  1544. /**
  1545. * Binds to the hover event of a link, used for prefetching content
  1546. *
  1547. * @param {object} event
  1548. *
  1549. */
  1550. hoverAnchor = function (event) {
  1551. var $anchor = $(event.currentTarget),
  1552. url = $anchor.prop("href");
  1553. if (utility.shouldLoad($anchor, options.blacklist)) {
  1554. event.stopPropagation();
  1555. fetch(url);
  1556. }
  1557. },
  1558. /**
  1559. * Binds to the click event of a link, used to show the content
  1560. *
  1561. * @param {object} event
  1562. *
  1563. */
  1564. clickAnchor = function (event) {
  1565. var $anchor = $(event.currentTarget),
  1566. url = $anchor.prop("href");
  1567. // Ctrl (or Cmd) + click must open a new tab
  1568. if (!event.metaKey && !event.ctrlKey && utility.shouldLoad($anchor, options.blacklist)) {
  1569. // stopPropagation so that event doesn"t fire on parent containers.
  1570. event.stopPropagation();
  1571. event.preventDefault();
  1572. load(url);
  1573. }
  1574. },
  1575. /**
  1576. * Binds all events and inits functionality
  1577. *
  1578. * @param {object} event
  1579. *
  1580. */
  1581. bindEventHandlers = function ($element) {
  1582. //@todo: Handle form submissions
  1583. $element.on("click", options.anchors, clickAnchor);
  1584. if (options.prefetch) {
  1585. $element.on("mouseover touchstart", options.anchors, hoverAnchor);
  1586. }
  1587. },
  1588. /** Used to restart css animations with a class */
  1589. toggleAnimationClass = function (classname) {
  1590. var classes = $container.addClass(classname).prop("class");
  1591. $container.removeClass(classes);
  1592. setTimeout(function(){
  1593. $container.addClass(classes);
  1594. },0);
  1595. $container.one("ss.onStartEnd ss.onProgressEnd ss.onEndEnd", function(){
  1596. $container.removeClass(classname);
  1597. });
  1598. };
  1599. /** Override defaults with options passed in */
  1600. options = $.extend(defaults, options);
  1601. /** Sets a default state */
  1602. if(window.history.state === null) {
  1603. window.history.replaceState({ id: $container.prop("id") }, document.title, currentHref);
  1604. }
  1605. /** Stores the current page in cache variable */
  1606. utility.storePageIn(cache, currentHref, document.documentElement.outerHTML);
  1607. /** Bind all of the event handlers on the container, not anchors */
  1608. utility.triggerAllAnimationEndEvent($container, "ss.onStartEnd ss.onProgressEnd ss.onEndEnd");
  1609. /** Bind all of the event handlers on the container, not anchors */
  1610. bindEventHandlers($container);
  1611. /** Public methods */
  1612. return {
  1613. href: currentHref,
  1614. cache: cache,
  1615. load: load,
  1616. fetch: fetch,
  1617. toggleAnimationClass: toggleAnimationClass
  1618. };
  1619. },
  1620. /** Returns elements with SmoothState attached to it */
  1621. declareSmoothState = function ( options ) {
  1622. return this.each(function () {
  1623. // Checks to make sure the smoothState element has an id and isn"t already bound
  1624. if(this.id && !$.data(this, "smoothState")) {
  1625. // Makes public methods available via $("element").data("smoothState");
  1626. $.data(this, "smoothState", new SmoothState(this, options));
  1627. } else if (!this.id && consl) {
  1628. // Throw warning if in development mode
  1629. consl.warn("Every smoothState container needs an id but the following one does not have one:", this);
  1630. }
  1631. });
  1632. };
  1633. /** Sets the popstate function */
  1634. window.onpopstate = onPopState;
  1635. /** Makes utility functions public for unit tests */
  1636. $.smoothStateUtility = utility;
  1637. /** Defines the smoothState plugin */
  1638. $.fn.smoothState = declareSmoothState;
  1639. })(jQuery, window, document);
  1640. // ------------- jQuery Cookie Plugin v1.4.1 -------------------------------- //
  1641. // ============ https://github.com/carhartl/jquery-cookie =================== //
  1642. // -------------------------------------------------------------------------- //
  1643. (function (factory) {
  1644. if (typeof define === 'function' && define.amd) {
  1645. // AMD
  1646. define(['jquery'], factory);
  1647. } else if (typeof exports === 'object') {
  1648. // CommonJS
  1649. factory(require('jquery'));
  1650. } else {
  1651. // Browser globals
  1652. factory(jQuery);
  1653. }
  1654. }(function ($) {
  1655. var pluses = /\+/g;
  1656. function encode(s) {
  1657. return config.raw ? s : encodeURIComponent(s);
  1658. }
  1659. function decode(s) {
  1660. return config.raw ? s : decodeURIComponent(s);
  1661. }
  1662. function stringifyCookieValue(value) {
  1663. return encode(config.json ? JSON.stringify(value) : String(value));
  1664. }
  1665. function parseCookieValue(s) {
  1666. if (s.indexOf('"') === 0) {
  1667. // This is a quoted cookie as according to RFC2068, unescape...
  1668. s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
  1669. }
  1670. try {
  1671. // Replace server-side written pluses with spaces.
  1672. // If we can't decode the cookie, ignore it, it's unusable.
  1673. // If we can't parse the cookie, ignore it, it's unusable.
  1674. s = decodeURIComponent(s.replace(pluses, ' '));
  1675. return config.json ? JSON.parse(s) : s;
  1676. } catch(e) {}
  1677. }
  1678. function read(s, converter) {
  1679. var value = config.raw ? s : parseCookieValue(s);
  1680. return $.isFunction(converter) ? converter(value) : value;
  1681. }
  1682. var config = $.cookie = function (key, value, options) {
  1683. // Write
  1684. if (arguments.length > 1 && !$.isFunction(value)) {
  1685. options = $.extend({}, config.defaults, options);
  1686. if (typeof options.expires === 'number') {
  1687. var days = options.expires, t = options.expires = new Date();
  1688. t.setTime(+t + days * 864e+5);
  1689. }
  1690. return (document.cookie = [
  1691. encode(key), '=', stringifyCookieValue(value),
  1692. options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
  1693. options.path ? '; path=' + options.path : '',
  1694. options.domain ? '; domain=' + options.domain : '',
  1695. options.secure ? '; secure' : ''
  1696. ].join(''));
  1697. }
  1698. // Read
  1699. var result = key ? undefined : {};
  1700. // To prevent the for loop in the first place assign an empty array
  1701. // in case there are no cookies at all. Also prevents odd result when
  1702. // calling $.cookie().
  1703. var cookies = document.cookie ? document.cookie.split('; ') : [];
  1704. for (var i = 0, l = cookies.length; i < l; i++) {
  1705. var parts = cookies[i].split('=');
  1706. var name = decode(parts.shift());
  1707. var cookie = parts.join('=');
  1708. if (key && key === name) {
  1709. // If second argument (value) is a function it's a converter...
  1710. result = read(cookie, value);
  1711. break;
  1712. }
  1713. // Prevent storing a cookie that we couldn't decode.
  1714. if (!key && (cookie = read(cookie)) !== undefined) {
  1715. result[name] = cookie;
  1716. }
  1717. }
  1718. return result;
  1719. };
  1720. config.defaults = {};
  1721. $.removeCookie = function (key, options) {
  1722. if ($.cookie(key) === undefined) {
  1723. return false;
  1724. }
  1725. // Must not alter options, thus extending a fresh object...
  1726. $.cookie(key, '', $.extend({}, options, { expires: -1 }));
  1727. return !$.cookie(key);
  1728. };
  1729. }));
  1730. // ----------------- jQuery Waypoints v2.0.5 -------------------------------- //
  1731. // ======== https://github.com/imakewebthings/jquery-waypoints ============== //
  1732. // -------------------------------------------------------------------------- //
  1733. (function() {
  1734. var __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; },
  1735. __slice = [].slice;
  1736. (function(root, factory) {
  1737. if (typeof define === 'function' && define.amd) {
  1738. return define('waypoints', ['jquery'], function($) {
  1739. return factory($, root);
  1740. });
  1741. } else {
  1742. return factory(root.jQuery, root);
  1743. }
  1744. })(window, function($, window) {
  1745. var $w, Context, Waypoint, allWaypoints, contextCounter, contextKey, contexts, isTouch, jQMethods, methods, resizeEvent, scrollEvent, waypointCounter, waypointKey, wp, wps;
  1746. $w = $(window);
  1747. isTouch = __indexOf.call(window, 'ontouchstart') >= 0;
  1748. allWaypoints = {
  1749. horizontal: {},
  1750. vertical: {}
  1751. };
  1752. contextCounter = 1;
  1753. contexts = {};
  1754. contextKey = 'waypoints-context-id';
  1755. resizeEvent = 'resize.waypoints';
  1756. scrollEvent = 'scroll.waypoints';
  1757. waypointCounter = 1;
  1758. waypointKey = 'waypoints-waypoint-ids';
  1759. wp = 'waypoint';
  1760. wps = 'waypoints';
  1761. Context = (function() {
  1762. function Context($element) {
  1763. var _this = this;
  1764. this.$element = $element;
  1765. this.element = $element[0];
  1766. this.didResize = false;
  1767. this.didScroll = false;
  1768. this.id = 'context' + contextCounter++;
  1769. this.oldScroll = {
  1770. x: $element.scrollLeft(),
  1771. y: $element.scrollTop()
  1772. };
  1773. this.waypoints = {
  1774. horizontal: {},
  1775. vertical: {}
  1776. };
  1777. this.element[contextKey] = this.id;
  1778. contexts[this.id] = this;
  1779. $element.bind(scrollEvent, function() {
  1780. var scrollHandler;
  1781. if (!(_this.didScroll || isTouch)) {
  1782. _this.didScroll = true;
  1783. scrollHandler = function() {
  1784. _this.doScroll();
  1785. return _this.didScroll = false;
  1786. };
  1787. return window.setTimeout(scrollHandler, $[wps].settings.scrollThrottle);
  1788. }
  1789. });
  1790. $element.bind(resizeEvent, function() {
  1791. var resizeHandler;
  1792. if (!_this.didResize) {
  1793. _this.didResize = true;
  1794. resizeHandler = function() {
  1795. $[wps]('refresh');
  1796. return _this.didResize = false;
  1797. };
  1798. return window.setTimeout(resizeHandler, $[wps].settings.resizeThrottle);
  1799. }
  1800. });
  1801. }
  1802. Context.prototype.doScroll = function() {
  1803. var axes,
  1804. _this = this;
  1805. axes = {
  1806. horizontal: {
  1807. newScroll: this.$element.scrollLeft(),
  1808. oldScroll: this.oldScroll.x,
  1809. forward: 'right',
  1810. backward: 'left'
  1811. },
  1812. vertical: {
  1813. newScroll: this.$element.scrollTop(),
  1814. oldScroll: this.oldScroll.y,
  1815. forward: 'down',
  1816. backward: 'up'
  1817. }
  1818. };
  1819. if (isTouch && (!axes.vertical.oldScroll || !axes.vertical.newScroll)) {
  1820. $[wps]('refresh');
  1821. }
  1822. $.each(axes, function(aKey, axis) {
  1823. var direction, isForward, triggered;
  1824. triggered = [];
  1825. isForward = axis.newScroll > axis.oldScroll;
  1826. direction = isForward ? axis.forward : axis.backward;
  1827. $.each(_this.waypoints[aKey], function(wKey, waypoint) {
  1828. var _ref, _ref1;
  1829. if ((axis.oldScroll < (_ref = waypoint.offset) && _ref <= axis.newScroll)) {
  1830. return triggered.push(waypoint);
  1831. } else if ((axis.newScroll < (_ref1 = waypoint.offset) && _ref1 <= axis.oldScroll)) {
  1832. return triggered.push(waypoint);
  1833. }
  1834. });
  1835. triggered.sort(function(a, b) {
  1836. return a.offset - b.offset;
  1837. });
  1838. if (!isForward) {
  1839. triggered.reverse();
  1840. }
  1841. return $.each(triggered, function(i, waypoint) {
  1842. if (waypoint.options.continuous || i === triggered.length - 1) {
  1843. return waypoint.trigger([direction]);
  1844. }
  1845. });
  1846. });
  1847. return this.oldScroll = {
  1848. x: axes.horizontal.newScroll,
  1849. y: axes.vertical.newScroll
  1850. };
  1851. };
  1852. Context.prototype.refresh = function() {
  1853. var axes, cOffset, isWin,
  1854. _this = this;
  1855. isWin = $.isWindow(this.element);
  1856. cOffset = this.$element.offset();
  1857. this.doScroll();
  1858. axes = {
  1859. horizontal: {
  1860. contextOffset: isWin ? 0 : cOffset.left,
  1861. contextScroll: isWin ? 0 : this.oldScroll.x,
  1862. contextDimension: this.$element.width(),
  1863. oldScroll: this.oldScroll.x,
  1864. forward: 'right',
  1865. backward: 'left',
  1866. offsetProp: 'left'
  1867. },
  1868. vertical: {
  1869. contextOffset: isWin ? 0 : cOffset.top,
  1870. contextScroll: isWin ? 0 : this.oldScroll.y,
  1871. contextDimension: isWin ? $[wps]('viewportHeight') : this.$element.height(),
  1872. oldScroll: this.oldScroll.y,
  1873. forward: 'down',
  1874. backward: 'up',
  1875. offsetProp: 'top'
  1876. }
  1877. };
  1878. return $.each(axes, function(aKey, axis) {
  1879. return $.each(_this.waypoints[aKey], function(i, waypoint) {
  1880. var adjustment, elementOffset, oldOffset, _ref, _ref1;
  1881. adjustment = waypoint.options.offset;
  1882. oldOffset = waypoint.offset;
  1883. elementOffset = $.isWindow(waypoint.element) ? 0 : waypoint.$element.offset()[axis.offsetProp];
  1884. if ($.isFunction(adjustment)) {
  1885. adjustment = adjustment.apply(waypoint.element);
  1886. } else if (typeof adjustment === 'string') {
  1887. adjustment = parseFloat(adjustment);
  1888. if (waypoint.options.offset.indexOf('%') > -1) {
  1889. adjustment = Math.ceil(axis.contextDimension * adjustment / 100);
  1890. }
  1891. }
  1892. waypoint.offset = elementOffset - axis.contextOffset + axis.contextScroll - adjustment;
  1893. if ((waypoint.options.onlyOnScroll && (oldOffset != null)) || !waypoint.enabled) {
  1894. return;
  1895. }
  1896. if (oldOffset !== null && (oldOffset < (_ref = axis.oldScroll) && _ref <= waypoint.offset)) {
  1897. return waypoint.trigger([axis.backward]);
  1898. } else if (oldOffset !== null && (oldOffset > (_ref1 = axis.oldScroll) && _ref1 >= waypoint.offset)) {
  1899. return waypoint.trigger([axis.forward]);
  1900. } else if (oldOffset === null && axis.oldScroll >= waypoint.offset) {
  1901. return waypoint.trigger([axis.forward]);
  1902. }
  1903. });
  1904. });
  1905. };
  1906. Context.prototype.checkEmpty = function() {
  1907. if ($.isEmptyObject(this.waypoints.horizontal) && $.isEmptyObject(this.waypoints.vertical)) {
  1908. this.$element.unbind([resizeEvent, scrollEvent].join(' '));
  1909. return delete contexts[this.id];
  1910. }
  1911. };
  1912. return Context;
  1913. })();
  1914. Waypoint = (function() {
  1915. function Waypoint($element, context, options) {
  1916. var idList, _ref;
  1917. if (options.offset === 'bottom-in-view') {
  1918. options.offset = function() {
  1919. var contextHeight;
  1920. contextHeight = $[wps]('viewportHeight');
  1921. if (!$.isWindow(context.element)) {
  1922. contextHeight = context.$element.height();
  1923. }
  1924. return contextHeight - $(this).outerHeight();
  1925. };
  1926. }
  1927. this.$element = $element;
  1928. this.element = $element[0];
  1929. this.axis = options.horizontal ? 'horizontal' : 'vertical';
  1930. this.callback = options.handler;
  1931. this.context = context;
  1932. this.enabled = options.enabled;
  1933. this.id = 'waypoints' + waypointCounter++;
  1934. this.offset = null;
  1935. this.options = options;
  1936. context.waypoints[this.axis][this.id] = this;
  1937. allWaypoints[this.axis][this.id] = this;
  1938. idList = (_ref = this.element[waypointKey]) != null ? _ref : [];
  1939. idList.push(this.id);
  1940. this.element[waypointKey] = idList;
  1941. }
  1942. Waypoint.prototype.trigger = function(args) {
  1943. if (!this.enabled) {
  1944. return;
  1945. }
  1946. if (this.callback != null) {
  1947. this.callback.apply(this.element, args);
  1948. }
  1949. if (this.options.triggerOnce) {
  1950. return this.destroy();
  1951. }
  1952. };
  1953. Waypoint.prototype.disable = function() {
  1954. return this.enabled = false;
  1955. };
  1956. Waypoint.prototype.enable = function() {
  1957. this.context.refresh();
  1958. return this.enabled = true;
  1959. };
  1960. Waypoint.prototype.destroy = function() {
  1961. delete allWaypoints[this.axis][this.id];
  1962. delete this.context.waypoints[this.axis][this.id];
  1963. return this.context.checkEmpty();
  1964. };
  1965. Waypoint.getWaypointsByElement = function(element) {
  1966. var all, ids;
  1967. ids = element[waypointKey];
  1968. if (!ids) {
  1969. return [];
  1970. }
  1971. all = $.extend({}, allWaypoints.horizontal, allWaypoints.vertical);
  1972. return $.map(ids, function(id) {
  1973. return all[id];
  1974. });
  1975. };
  1976. return Waypoint;
  1977. })();
  1978. methods = {
  1979. init: function(f, options) {
  1980. var _ref;
  1981. options = $.extend({}, $.fn[wp].defaults, options);
  1982. if ((_ref = options.handler) == null) {
  1983. options.handler = f;
  1984. }
  1985. this.each(function() {
  1986. var $this, context, contextElement, _ref1;
  1987. $this = $(this);
  1988. contextElement = (_ref1 = options.context) != null ? _ref1 : $.fn[wp].defaults.context;
  1989. if (!$.isWindow(contextElement)) {
  1990. contextElement = $this.closest(contextElement);
  1991. }
  1992. contextElement = $(contextElement);
  1993. context = contexts[contextElement[0][contextKey]];
  1994. if (!context) {
  1995. context = new Context(contextElement);
  1996. }
  1997. return new Waypoint($this, context, options);
  1998. });
  1999. $[wps]('refresh');
  2000. return this;
  2001. },
  2002. disable: function() {
  2003. return methods._invoke.call(this, 'disable');
  2004. },
  2005. enable: function() {
  2006. return methods._invoke.call(this, 'enable');
  2007. },
  2008. destroy: function() {
  2009. return methods._invoke.call(this, 'destroy');
  2010. },
  2011. prev: function(axis, selector) {
  2012. return methods._traverse.call(this, axis, selector, function(stack, index, waypoints) {
  2013. if (index > 0) {
  2014. return stack.push(waypoints[index - 1]);
  2015. }
  2016. });
  2017. },
  2018. next: function(axis, selector) {
  2019. return methods._traverse.call(this, axis, selector, function(stack, index, waypoints) {
  2020. if (index < waypoints.length - 1) {
  2021. return stack.push(waypoints[index + 1]);
  2022. }
  2023. });
  2024. },
  2025. _traverse: function(axis, selector, push) {
  2026. var stack, waypoints;
  2027. if (axis == null) {
  2028. axis = 'vertical';
  2029. }
  2030. if (selector == null) {
  2031. selector = window;
  2032. }
  2033. waypoints = jQMethods.aggregate(selector);
  2034. stack = [];
  2035. this.each(function() {
  2036. var index;
  2037. index = $.inArray(this, waypoints[axis]);
  2038. return push(stack, index, waypoints[axis]);
  2039. });
  2040. return this.pushStack(stack);
  2041. },
  2042. _invoke: function(method) {
  2043. this.each(function() {
  2044. var waypoints;
  2045. waypoints = Waypoint.getWaypointsByElement(this);
  2046. return $.each(waypoints, function(i, waypoint) {
  2047. waypoint[method]();
  2048. return true;
  2049. });
  2050. });
  2051. return this;
  2052. }
  2053. };
  2054. $.fn[wp] = function() {
  2055. var args, method;
  2056. method = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
  2057. if (methods[method]) {
  2058. return methods[method].apply(this, args);
  2059. } else if ($.isFunction(method)) {
  2060. return methods.init.apply(this, arguments);
  2061. } else if ($.isPlainObject(method)) {
  2062. return methods.init.apply(this, [null, method]);
  2063. } else if (!method) {
  2064. return $.error("jQuery Waypoints needs a callback function or handler option.");
  2065. } else {
  2066. return $.error("The " + method + " method does not exist in jQuery Waypoints.");
  2067. }
  2068. };
  2069. $.fn[wp].defaults = {
  2070. context: window,
  2071. continuous: true,
  2072. enabled: true,
  2073. horizontal: false,
  2074. offset: 0,
  2075. triggerOnce: false
  2076. };
  2077. jQMethods = {
  2078. refresh: function() {
  2079. return $.each(contexts, function(i, context) {
  2080. return context.refresh();
  2081. });
  2082. },
  2083. viewportHeight: function() {
  2084. var _ref;
  2085. return (_ref = window.innerHeight) != null ? _ref : $w.height();
  2086. },
  2087. aggregate: function(contextSelector) {
  2088. var collection, waypoints, _ref;
  2089. collection = allWaypoints;
  2090. if (contextSelector) {
  2091. collection = (_ref = contexts[$(contextSelector)[0][contextKey]]) != null ? _ref.waypoints : void 0;
  2092. }
  2093. if (!collection) {
  2094. return [];
  2095. }
  2096. waypoints = {
  2097. horizontal: [],
  2098. vertical: []
  2099. };
  2100. $.each(waypoints, function(axis, arr) {
  2101. $.each(collection[axis], function(key, waypoint) {
  2102. return arr.push(waypoint);
  2103. });
  2104. arr.sort(function(a, b) {
  2105. return a.offset - b.offset;
  2106. });
  2107. waypoints[axis] = $.map(arr, function(waypoint) {
  2108. return waypoint.element;
  2109. });
  2110. return waypoints[axis] = $.unique(waypoints[axis]);
  2111. });
  2112. return waypoints;
  2113. },
  2114. above: function(contextSelector) {
  2115. if (contextSelector == null) {
  2116. contextSelector = window;
  2117. }
  2118. return jQMethods._filter(contextSelector, 'vertical', function(context, waypoint) {
  2119. return waypoint.offset <= context.oldScroll.y;
  2120. });
  2121. },
  2122. below: function(contextSelector) {
  2123. if (contextSelector == null) {
  2124. contextSelector = window;
  2125. }
  2126. return jQMethods._filter(contextSelector, 'vertical', function(context, waypoint) {
  2127. return waypoint.offset > context.oldScroll.y;
  2128. });
  2129. },
  2130. left: function(contextSelector) {
  2131. if (contextSelector == null) {
  2132. contextSelector = window;
  2133. }
  2134. return jQMethods._filter(contextSelector, 'horizontal', function(context, waypoint) {
  2135. return waypoint.offset <= context.oldScroll.x;
  2136. });
  2137. },
  2138. right: function(contextSelector) {
  2139. if (contextSelector == null) {
  2140. contextSelector = window;
  2141. }
  2142. return jQMethods._filter(contextSelector, 'horizontal', function(context, waypoint) {
  2143. return waypoint.offset > context.oldScroll.x;
  2144. });
  2145. },
  2146. enable: function() {
  2147. return jQMethods._invoke('enable');
  2148. },
  2149. disable: function() {
  2150. return jQMethods._invoke('disable');
  2151. },
  2152. destroy: function() {
  2153. return jQMethods._invoke('destroy');
  2154. },
  2155. extendFn: function(methodName, f) {
  2156. return methods[methodName] = f;
  2157. },
  2158. _invoke: function(method) {
  2159. var waypoints;
  2160. waypoints = $.extend({}, allWaypoints.vertical, allWaypoints.horizontal);
  2161. return $.each(waypoints, function(key, waypoint) {
  2162. waypoint[method]();
  2163. return true;
  2164. });
  2165. },
  2166. _filter: function(selector, axis, test) {
  2167. var context, waypoints;
  2168. context = contexts[$(selector)[0][contextKey]];
  2169. if (!context) {
  2170. return [];
  2171. }
  2172. waypoints = [];
  2173. $.each(context.waypoints[axis], function(i, waypoint) {
  2174. if (test(context, waypoint)) {
  2175. return waypoints.push(waypoint);
  2176. }
  2177. });
  2178. waypoints.sort(function(a, b) {
  2179. return a.offset - b.offset;
  2180. });
  2181. return $.map(waypoints, function(waypoint) {
  2182. return waypoint.element;
  2183. });
  2184. }
  2185. };
  2186. $[wps] = function() {
  2187. var args, method;
  2188. method = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
  2189. if (jQMethods[method]) {
  2190. return jQMethods[method].apply(null, args);
  2191. } else {
  2192. return jQMethods.aggregate.call(null, method);
  2193. }
  2194. };
  2195. $[wps].settings = {
  2196. resizeThrottle: 100,
  2197. scrollThrottle: 30
  2198. };
  2199. return $w.on('load.waypoints', function() {
  2200. return $[wps]('refresh');
  2201. });
  2202. });
  2203. }).call(this);
  2204. // ----------------- jQuery Github Embedder ----------------------------- //
  2205. // =========== https://github.com/kirbysayshi/ghembedder =============== //
  2206. // ---------------------------------------------------------------------- //
  2207. !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.ghembedder=e()}}(function(){var define,module,exports;return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){var ghe=module.exports={_apiBase:"https://api.github.com",_library:{},_rLeadSlash:/^\/+|\/+$/g,_rWhiteSpace:/\s/g};ghe._decodeContent=function(content){var decoded=window.atob(content.replace(ghe._rWhiteSpace,""));return decoded};ghe._keygen=function(){return"ghembedder_key_"+~~(Math.random()*1e5)};ghe._jsonpCallback=function(key){return window[key]=function(resp){var lib=ghe._library[key],linenos=false,hasLineRange=lib.lineBegin>-1&&lib.lineEnd>-1,decoded,lines,nums,tabSpace=new Array(lib.tabSize+1).join(" ");if(resp.data&&resp.data.content){lib.data=resp.data;decoded=ghe._decodeContent(resp.data.content);decoded=decoded.replace(/[&<>"'`]/g,function(){var chars={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"};return function(match){return chars[match]}}());lines=decoded.split("\n");if(hasLineRange){lines=lines.splice(lib.lineBegin-1,lib.lineEnd-lib.lineBegin+1)}if(lib.linenos){linenos=hasLineRange?lib.lineBegin:lib.linenos}lines=lines.map(function(l,i){return'<a class="nocode" id="'+lib.fileName+"-L"+(i+lib.lineBegin)+'">'+(l?"":" ")+"</a>"+l.replace(/\t/gi,tabSpace)});decoded=lines.join("\n");if(exports.prettyPrintOne){decoded=exports.prettyPrintOne(decoded,lib.lang,linenos)}lib.el.className+=" ghe";lib.el.innerHTML='<pre><code data-language="javascript">'+decoded+"</code></pre>"+(lib.annotate?ghe._annotation(key):"");delete window[key];if(lib.onload){lib.onload(null,lib)}}}};ghe._annotation=function(key){var lib=ghe._library[key],hasLineRange=lib.lineBegin>-1&&lib.lineEnd>-1;return'<div class="ghe-annotation">'+lib.fileName+(hasLineRange?", lines "+lib.lineBegin+"-"+lib.lineEnd:"")+(lib.data?'. <a href="'+lib.data._links.html+'" target="_blank">Source</a>':"")+"</div>"};ghe._jsonp=function(fileUrl,cbName){var script=document.createElement("script");script.type="text/javascript";script.src=fileUrl+(fileUrl.indexOf("?")>-1?"&":"?")+"callback="+cbName;document.getElementsByTagName("head")[0].appendChild(script)};ghe._parseNode=function(el){var lines=el.getAttribute("data-ghlines"),path=el.getAttribute("data-ghpath"),start,end;if(lines&&lines.indexOf("-")>-1){lines=lines.split("-");start=parseInt(lines[0],10);end=parseInt(lines[1],10)}else if(lines){start=end=parseInt(lines,10)}else{start=end=-1}return{path:path,userrepo:el.getAttribute("data-ghuserrepo"),ref:el.getAttribute("data-ghref")||"master",lineBegin:start,lineEnd:end,el:el,fileName:path.split("/").pop(),lang:el.getAttribute("data-ghlang"),linenos:el.getAttribute("data-ghlinenos"),annotate:el.getAttribute("data-ghannotate"),tabSize:parseInt(el.getAttribute("data-ghtabsize"),10)||4}};ghe.load=function(cfg,opt_cb){var key=ghe._keygen();if(cfg.nodeName){cfg=ghe._parseNode(cfg)}if(opt_cb){cfg.onload=opt_cb}ghe._jsonpCallback(key);ghe._library[key]=cfg;ghe._jsonp(ghe._apiBase+"/repos/"+cfg.userrepo.replace(ghe._rLeadSlash,"")+"/contents/"+cfg.path.replace(ghe._rLeadSlash,"")+"?ref="+cfg.ref,key)};ghe.autoload=function(){var nodes;if(window.jQuery){nodes=window.jQuery("[data-ghpath]")}else{nodes=document.querySelectorAll("[data-ghpath]")}for(var i=0;i<nodes.length;i++){ghe.load(nodes[i])}}},{}]},{},[1])(1)});
  2208. ghembedder.autoload();
  2209. ;jQuery(document).ready(function($){
  2210. var i = 0;
  2211. var box_title_png = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAAXCAMAAAAx3e/WAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYxIDY0LjE0MDk0OSwgMjAxMC8xMi8wNy0xMDo1NzowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNS4xIE1hY2ludG9zaCIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDpEQjIyNkJERkM0NjYxMUUxOEFDQzk3ODcxRDkzRjhCRSIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDpEQjIyNkJFMEM0NjYxMUUxOEFDQzk3ODcxRDkzRjhCRSI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOkRCMjI2QkREQzQ2NjExRTE4QUNDOTc4NzFEOTNGOEJFIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOkRCMjI2QkRFQzQ2NjExRTE4QUNDOTc4NzFEOTNGOEJFIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+dka2KgAAAEVQTFRFxMTEyMjI0tLSvb29vr6+zc3Ny8vLxcXFz8/P6enp3t7ex8fH0dHR1NTUw8PDwMDAzs7OvLy8wcHBu7u7v7+/zMzM////budQFwAAABd0Uk5T/////////////////////////////wDmQOZeAAAAcklEQVR42tSQSQ7DMAwD6chOukWs5eX/Ty2coo0T9wOdEzEgdRBuzNmnDofgja52JDyz5TCqUp0O6kfrb4bzSXkRiTviEZZ6JKLMJ5VQ2v8iGbtbfEwXmjFMG0VwdQo10hQNxYqtLMv9O6xvpZ/QeAkwAKjwHiJLaJc3AAAAAElFTkSuQmCC';
  2212. var stats_png = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAqCAMAAACEJ4viAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYxIDY0LjE0MDk0OSwgMjAxMC8xMi8wNy0xMDo1NzowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNS4xIE1hY2ludG9zaCIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDpEQjIyNkJEQkM0NjYxMUUxOEFDQzk3ODcxRDkzRjhCRSIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDpEQjIyNkJEQ0M0NjYxMUUxOEFDQzk3ODcxRDkzRjhCRSI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOkRCMjI2QkQ5QzQ2NjExRTE4QUNDOTc4NzFEOTNGOEJFIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOkRCMjI2QkRBQzQ2NjExRTE4QUNDOTc4NzFEOTNGOEJFIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+h1kA9gAAAK5QTFRF+fn5sbGx8fHx09PTmpqa2dnZ/f3919fX9PT00NDQ1dXVpKSk+vr6+/v7vb298vLyycnJ8/PztLS0zc3N6enp/v7+q6ur2NjY9/f3srKy/Pz8p6en7u7uoaGhnJyc4eHhtbW1pqam6Ojo9fX17e3toqKirKys1NTUzs7Ox8fHwcHBwMDA5eXlnZ2dpaWl0dHR9vb25ubm4uLi3d3dqqqqwsLCv7+/oKCgmZmZ////8yEsbwAAAMBJREFUeNrE0tcOgjAUBuDSliUoMhTEvfdef9//xUQjgaLX0Ium/ZLT/+SkRPxZpGykvuf5VMJogy5jY9yjDHcWFhqlcRuHc4o6B1QK0BDg+hcZgNDh3NWTwzItH/bRrhvT+g3zSxZkNGCZpoWGIbU0a3Y6zV5VA6keyeDxiw62P0gUqEW0FbDim4nVikFJbU2zZXybUEaxhCqOQqyh5/G0wpWICUwthyqwD4InOMuXJ7/gs7WkoPdVg1vykF8CDACEFanKO3aSYwAAAABJRU5ErkJggg==';
  2213. $('.github-widget').each(function(){
  2214. if(i == 0) $('head').append(
  2215. '<style type="text/css">'
  2216. +'.github-box *{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;}'
  2217. +'.github-box{font-family:helvetica,arial,sans-serif;font-size:13px;line-height:18px;background:#fafafa;border:1px solid #ddd;color:#666;border-radius:3px}'
  2218. +'.github-box a{color:#4183c4;border:0;text-decoration:none}'
  2219. +'.github-box .github-box-title{position:relative;border-bottom:1px solid #ddd;border-radius:3px 3px 0 0;background:#fcfcfc;background:-moz-linear-gradient(#fcfcfc,#ebebeb);background:-webkit-linear-gradient(#fcfcfc,#ebebeb);}'
  2220. +'.github-box .github-box-title h3{word-wrap:break-word;font-family:helvetica,arial,sans-serif;font-weight:normal;font-size:16px;color:gray;margin:0;padding:10px 10px 10px 30px;background:url('+box_title_png+') 7px center no-repeat; width: auto;}'
  2221. +'.github-box .github-box-title h3 .repo{font-weight:bold}'
  2222. +'.github-box .github-box-title .github-stats{float:right;position:absolute;top:8px;right:10px;font-size:11px;font-weight:bold;line-height:21px;height:auto;min-height:21px}'
  2223. +'.github-box .github-box-title .github-stats a{display:inline-block;height:21px;color:#666;border:1px solid #ddd;border-radius:3px;padding:0 5px 0 18px;background: white url('+stats_png+') no-repeat}'
  2224. +'.github-box .github-box-title .github-stats .watchers{border-right:1px solid #ddd}'
  2225. +'.github-box .github-box-title .github-stats .forks{background-position:-4px -21px;padding-left:15px}'
  2226. +'.github-box .github-box-content{padding:10px;font-weight:300}'
  2227. +'.github-box .github-box-content p{margin:0}'
  2228. +'.github-box .github-box-content .link{font-weight:bold}'
  2229. +'.github-box .github-box-download{position:relative;border-top:1px solid #ddd;background:white;border-radius:0 0 3px 3px;padding:10px;height:auto;min-height:24px;}'
  2230. +'.github-box .github-box-download .updated{word-wrap:break-word;margin:0;font-size:11px;color:#666;line-height:24px;font-weight:300;width:auto}'
  2231. +'.github-box .github-box-download .updated strong{font-weight:bold;color:#000}'
  2232. +'.github-box .github-box-download .download{float:right;position:absolute;top:10px;right:10px;height:24px;line-height:24px;font-size:12px;color:#666;font-weight:bold;text-shadow:0 1px 0 rgba(255,255,255,0.9);padding:0 10px;border:1px solid #ddd;border-bottom-color:#bbb;border-radius:3px;background:#f5f5f5;background:-moz-linear-gradient(#f5f5f5,#e5e5e5);background:-webkit-linear-gradient(#f5f5f5,#e5e5e5);}'
  2233. +'.github-box .github-box-download .download:hover{color:#527894;border-color:#cfe3ed;border-bottom-color:#9fc7db;background:#f1f7fa;background:-moz-linear-gradient(#f1f7fa,#dbeaf1);background:-webkit-linear-gradient(#f1f7fa,#dbeaf1);}'
  2234. +'@media (max-width: 767px) {'
  2235. +'.github-box .github-box-title{height:auto;min-height:60px}'
  2236. +'.github-box .github-box-title h3 .repo{display:block}'
  2237. +'.github-box .github-box-title .github-stats a{display:block;clear:right;float:right;}'
  2238. +'.github-box .github-box-download{height:auto;min-height:46px;}'
  2239. +'.github-box .github-box-download .download{top:32px;}'
  2240. +'}'
  2241. +'</style>'
  2242. );
  2243. i++;
  2244. var $container = $(this), $widget,
  2245. repo = $container.data('repo'),
  2246. vendorName = repo.split('/')[0],
  2247. repoName = repo.split('/')[1],
  2248. vendorUrl = "http://github.com/" + vendorName,
  2249. repoUrl = "http://github.com/" + vendorName + '/' + repoName;
  2250. $widget = $(
  2251. '<div class="github-box repo">'
  2252. +'<div class="github-box-title">'
  2253. +'<h3>'
  2254. +'<a class="owner" href="' + vendorUrl + '" title="' + vendorUrl + '">' + vendorName + '</a>'
  2255. +'/'
  2256. +'<a class="repo" href="' + repoUrl + '" title="' + repoUrl + '">' + repoName + '</a>'
  2257. +'</h3>'
  2258. +'<div class="github-stats">'
  2259. +'<a class="watchers" href="' + repoUrl + '/watchers" title="See watchers">?</a>'
  2260. +'<a class="forks" href="' + repoUrl + '/network/members" title="See forkers">?</a>'
  2261. +'</div>'
  2262. +'</div>'
  2263. +'<div class="github-box-content">'
  2264. +'<p class="description"><span></span> &mdash; <a href="' + repoUrl + '#readme">Read More</a></p>'
  2265. +'<p class="link"></p>'
  2266. +'</div>'
  2267. +'<div class="github-box-download">'
  2268. +'<div class="updated"></div>'
  2269. +'<a class="download" href="' + repoUrl + '/zipball/master" title="Get an archive of this repository">Download as zip</a>'
  2270. +'</div>'
  2271. +'</div>'
  2272. );
  2273. $widget.appendTo($container);
  2274. $.ajax({
  2275. url: 'https://api.github.com/repos/' + repo,
  2276. dataType: 'jsonp',
  2277. success: function(results) {
  2278. var repo = results.data, date, pushed_at = 'unknown';
  2279. if (repo.pushed_at) {
  2280. date = new Date(repo.pushed_at);
  2281. pushed_at = (date.getMonth() + 1) + '-' + date.getDate() + '-' + date.getFullYear();
  2282. }
  2283. $widget.find('.watchers').text(repo.watchers);
  2284. $widget.find('.forks').text(repo.forks);
  2285. $widget.find('.description span').text(repo.description);
  2286. $widget.find('.updated').html('Latest commit to the <strong>' + repo.default_branch + '</strong> branch on ' + pushed_at);
  2287. // Don't show "null" if the repo has no homepage URL.
  2288. if(repo.homepage != null) $widget.find('.link').append($('<a />').attr('href', repo.homepage).text(repo.homepage));
  2289. }
  2290. });
  2291. });
  2292. });
  2293. // ----------------- JavaScript Cookie v2.2.0 ----------------------------- //
  2294. // =========== https://github.com/js-cookie/js-cookie =============== //
  2295. // ---------------------------------------------------------------------- //
  2296. ;(function (factory) {
  2297. var registeredInModuleLoader;
  2298. if (typeof define === 'function' && define.amd) {
  2299. define(factory);
  2300. registeredInModuleLoader = true;
  2301. }
  2302. if (typeof exports === 'object') {
  2303. module.exports = factory();
  2304. registeredInModuleLoader = true;
  2305. }
  2306. if (!registeredInModuleLoader) {
  2307. var OldCookies = window.Cookies;
  2308. var api = window.Cookies = factory();
  2309. api.noConflict = function () {
  2310. window.Cookies = OldCookies;
  2311. return api;
  2312. };
  2313. }
  2314. }(function () {
  2315. function extend () {
  2316. var i = 0;
  2317. var result = {};
  2318. for (; i < arguments.length; i++) {
  2319. var attributes = arguments[ i ];
  2320. for (var key in attributes) {
  2321. result[key] = attributes[key];
  2322. }
  2323. }
  2324. return result;
  2325. }
  2326. function decode (s) {
  2327. return s.replace(/(%[0-9A-Z]{2})+/g, decodeURIComponent);
  2328. }
  2329. function init (converter) {
  2330. function api() {}
  2331. function set (key, value, attributes) {
  2332. if (typeof document === 'undefined') {
  2333. return;
  2334. }
  2335. attributes = extend({
  2336. path: '/'
  2337. }, api.defaults, attributes);
  2338. if (typeof attributes.expires === 'number') {
  2339. attributes.expires = new Date(new Date() * 1 + attributes.expires * 864e+5);
  2340. }
  2341. // We're using "expires" because "max-age" is not supported by IE
  2342. attributes.expires = attributes.expires ? attributes.expires.toUTCString() : '';
  2343. try {
  2344. var result = JSON.stringify(value);
  2345. if (/^[\{\[]/.test(result)) {
  2346. value = result;
  2347. }
  2348. } catch (e) {}
  2349. value = converter.write ?
  2350. converter.write(value, key) :
  2351. encodeURIComponent(String(value))
  2352. .replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent);
  2353. key = encodeURIComponent(String(key))
  2354. .replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent)
  2355. .replace(/[\(\)]/g, escape);
  2356. var stringifiedAttributes = '';
  2357. for (var attributeName in attributes) {
  2358. if (!attributes[attributeName]) {
  2359. continue;
  2360. }
  2361. stringifiedAttributes += '; ' + attributeName;
  2362. if (attributes[attributeName] === true) {
  2363. continue;
  2364. }
  2365. // Considers RFC 6265 section 5.2:
  2366. // ...
  2367. // 3. If the remaining unparsed-attributes contains a %x3B (";")
  2368. // character:
  2369. // Consume the characters of the unparsed-attributes up to,
  2370. // not including, the first %x3B (";") character.
  2371. // ...
  2372. stringifiedAttributes += '=' + attributes[attributeName].split(';')[0];
  2373. }
  2374. return (document.cookie = key + '=' + value + stringifiedAttributes);
  2375. }
  2376. function get (key, json) {
  2377. if (typeof document === 'undefined') {
  2378. return;
  2379. }
  2380. var jar = {};
  2381. // To prevent the for loop in the first place assign an empty array
  2382. // in case there are no cookies at all.
  2383. var cookies = document.cookie ? document.cookie.split('; ') : [];
  2384. var i = 0;
  2385. for (; i < cookies.length; i++) {
  2386. var parts = cookies[i].split('=');
  2387. var cookie = parts.slice(1).join('=');
  2388. if (!json && cookie.charAt(0) === '"') {
  2389. cookie = cookie.slice(1, -1);
  2390. }
  2391. try {
  2392. var name = decode(parts[0]);
  2393. cookie = (converter.read || converter)(cookie, name) ||
  2394. decode(cookie);
  2395. if (json) {
  2396. try {
  2397. cookie = JSON.parse(cookie);
  2398. } catch (e) {}
  2399. }
  2400. jar[name] = cookie;
  2401. if (key === name) {
  2402. break;
  2403. }
  2404. } catch (e) {}
  2405. }
  2406. return key ? jar[key] : jar;
  2407. }
  2408. api.set = set;
  2409. api.get = function (key) {
  2410. return get(key, false /* read as raw */);
  2411. };
  2412. api.getJSON = function (key) {
  2413. return get(key, true /* read as json */);
  2414. };
  2415. api.remove = function (key, attributes) {
  2416. set(key, '', extend(attributes, {
  2417. expires: -1
  2418. }));
  2419. };
  2420. api.defaults = {};
  2421. api.withConverter = init;
  2422. return api;
  2423. }
  2424. return init(function () {});
  2425. }));