scripts.js 155 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677
  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. // --------------------- Lazy Load 1.9.7 ---------------------------------- //
  16. // ========== https://github.com/tuupola/jquery_lazyload =================== //
  17. // ------------------------------------------------------------------------- //
  18. !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);
  19. // ------------- Touch Carousel Hammer.js ---------------------------------- //
  20. // ====== https://github.com/ixisio/bootstrap-touch-carousel =============== //
  21. // ------------------------------------------------------------------------- //
  22. +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)}();
  23. // ------------- JQUERY Wallpaper------------------------------------------- //
  24. // ============ https://github.com/Formstone/Wallpaper ===================== //
  25. // ------------------------------------------------------------------------- //
  26. !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);
  27. // ------------- Rainbow Syntax Highligher ---------------------------------- //
  28. // ========== https://github.com/ccampbell/rainbow ========================== //
  29. // -------------------------------------------------------------------------- //
  30. /* 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 */
  31. 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>=
  32. 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=
  33. 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)&&
  34. 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,
  35. "&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"),
  36. 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)}}}();
  37. (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},
  38. {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},
  39. {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}],
  40. !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},
  41. {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}],
  42. !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},
  43. {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",
  44. 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}],
  45. !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},
  46. {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},
  47. {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},
  48. 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},
  49. {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},
  50. {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},
  51. {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"},
  52. 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},
  53. {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},
  54. {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",
  55. 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",
  56. 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},
  57. {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},
  58. {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},
  59. {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",
  60. 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}],
  61. !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},
  62. {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}],
  63. !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"},
  64. 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",
  65. 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},
  66. {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},
  67. {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},
  68. {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},
  69. {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},
  70. {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},
  71. {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",
  72. 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);
  73. // ------------- JQUERY APPEAR ---------------------------------------------- //
  74. // ============ https://github.com/morr/jquery.appear ====================== //
  75. // -------------------------------------------------------------------------- //
  76. (function($) {
  77. var selectors = [];
  78. var check_binded = false;
  79. var check_lock = false;
  80. var defaults = {
  81. interval: 250,
  82. force_process: false
  83. }
  84. var $window = $(window);
  85. var $prior_appeared;
  86. function process() {
  87. check_lock = false;
  88. for (var index = 0, selectorsLength = selectors.length; index < selectorsLength; index++) {
  89. var $appeared = $(selectors[index]).filter(function() {
  90. return $(this).is(':appeared');
  91. });
  92. $appeared.trigger('appear', [$appeared]);
  93. if ($prior_appeared) {
  94. var $disappeared = $prior_appeared.not($appeared);
  95. $disappeared.trigger('disappear', [$disappeared]);
  96. }
  97. $prior_appeared = $appeared;
  98. }
  99. }
  100. // "appeared" custom filter
  101. $.expr[':']['appeared'] = function(element) {
  102. var $element = $(element);
  103. if (!$element.is(':visible')) {
  104. return false;
  105. }
  106. var window_left = $window.scrollLeft();
  107. var window_top = $window.scrollTop();
  108. var offset = $element.offset();
  109. var left = offset.left;
  110. var top = offset.top;
  111. if (top + $element.height() >= window_top &&
  112. top - ($element.data('appear-top-offset') || 0) <= window_top + $window.height() &&
  113. left + $element.width() >= window_left &&
  114. left - ($element.data('appear-left-offset') || 0) <= window_left + $window.width()) {
  115. return true;
  116. } else {
  117. return false;
  118. }
  119. }
  120. $.fn.extend({
  121. // watching for element's appearance in browser viewport
  122. appear: function(options) {
  123. var opts = $.extend({}, defaults, options || {});
  124. var selector = this.selector || this;
  125. if (!check_binded) {
  126. var on_check = function() {
  127. if (check_lock) {
  128. return;
  129. }
  130. check_lock = true;
  131. setTimeout(process, opts.interval);
  132. };
  133. $(window).scroll(on_check).resize(on_check);
  134. check_binded = true;
  135. }
  136. if (opts.force_process) {
  137. setTimeout(process, opts.interval);
  138. }
  139. selectors.push(selector);
  140. return $(selector);
  141. }
  142. });
  143. $.extend({
  144. // force elements's appearance check
  145. force_appear: function() {
  146. if (check_binded) {
  147. process();
  148. return true;
  149. };
  150. return false;
  151. }
  152. });
  153. })(jQuery);
  154. // ------------- DRAW FILL SVG ---------------------------------------------- //
  155. // ============ https://github.com/callmenick/Draw-Fill-SVG ================= //
  156. // -------------------------------------------------------------------------- //
  157. (function( window ){
  158. 'use strict';
  159. /**
  160. * Cross browser transition end events
  161. *
  162. * Use modernizr to detect cross browser transition end events. Make sure
  163. * to include Modernizr in your doc and have "Modernizr.prefixed()" checked
  164. * off in the extensibility section.
  165. */
  166. var transEndEventNames = {
  167. "WebkitTransition" : "webkitTransitionEnd",
  168. "MozTransition" : "transitionend",
  169. "OTransition" : "oTransitionEnd",
  170. "msTransition" : "MSTransitionEnd",
  171. "transition" : "transitionend"
  172. },
  173. transEndEventName = transEndEventNames[ Modernizr.prefixed('transition') ];
  174. /**
  175. * Extend obj function
  176. *
  177. */
  178. function extend( a, b ) {
  179. for( var key in b ) {
  180. if( b.hasOwnProperty( key ) ) {
  181. a[key] = b[key];
  182. }
  183. }
  184. return a;
  185. }
  186. /**
  187. * DrawFillSVG constructor
  188. *
  189. */
  190. function DrawFillSVG( options ) {
  191. this.options = extend( {}, this.options );
  192. extend( this.options, options );
  193. this._init();
  194. }
  195. /**
  196. * DrawFillSVG options
  197. *
  198. * Available options:
  199. * elementId - the ID of the element to draw
  200. */
  201. DrawFillSVG.prototype.options = {
  202. elementId : "svg"
  203. }
  204. /**
  205. * DrawFillSVG _init
  206. *
  207. * Initialise DrawFillSVG
  208. */
  209. DrawFillSVG.prototype._init = function() {
  210. this.svg = document.getElementById(this.options.elementId);
  211. this.paths = this.svg.querySelectorAll("path");
  212. this._initAnimation();
  213. }
  214. /**
  215. * DrawFillSVG _initAnimation()
  216. *
  217. * Reset some style properties on our paths, add some transitions, set the
  218. * stroke-dasharray to the length of the path, and the stroke-dashoffset to
  219. * the length of the path pushing it out of view initially. Then, set the
  220. * stroke-dashoffset to 0, animating the strokes in a drawing manner. Then,
  221. * run the path filler sequence.
  222. */
  223. DrawFillSVG.prototype._initAnimation = function() {
  224. for ( var i = 0; i < this.paths.length; i++ ) {
  225. var path = this.paths[i];
  226. var length = path.getTotalLength();
  227. // reset opacities
  228. path.style.fillOpacity = 0;
  229. path.style.strokeOpacity = 1;
  230. // reset transitions
  231. path.style.transition = path.style.WebkitTransition = "none";
  232. // reset stroke dash array and stroke dash offset
  233. path.style.strokeDasharray = length + " " + length;
  234. path.style.strokeDashoffset = length;
  235. path.getBoundingClientRect();
  236. // apply new transitions
  237. path.style.transition = path.style.WebkitTransition = "stroke-dashoffset 2s ease-in-out";
  238. // go baby go
  239. path.style.strokeDashoffset = 0;
  240. // fill the path
  241. this._fillPath( path );
  242. }
  243. }
  244. /**
  245. * DrawFillSVG _fillPath()
  246. *
  247. * Resets the transition props, then fills the path and fades out the stroke
  248. * by updating the styles.
  249. */
  250. DrawFillSVG.prototype._fillPath = function( path ) {
  251. path.addEventListener( transEndEventName, function() {
  252. // reset transitions
  253. path.style.transition = path.style.WebkitTransition = "none";
  254. path.style.transition = path.style.WebkitTransition = "fill-opacity 1s ease-in-out, stroke-opacity 1s ease-in-out";
  255. // edit props
  256. path.style.fillOpacity = 1;
  257. path.style.strokeOpacity = 0;
  258. } );
  259. }
  260. /**
  261. * DrawFillSVG replay
  262. *
  263. * A public function that allows you to replay the animation if you want. For
  264. * example, click a button, and replay the animation.
  265. */
  266. DrawFillSVG.prototype.replay = function() {
  267. this._initAnimation();
  268. }
  269. /**
  270. * Add to global namespace
  271. */
  272. window.DrawFillSVG = DrawFillSVG;
  273. })( window );
  274. // ------------- JQUERY TYPED.JS -------------------------------------------- //
  275. // ============ https://github.com/mattboldt/typed.js/ ====================== //
  276. // -------------------------------------------------------------------------- //
  277. !function($){
  278. "use strict";
  279. var Typed = function(el, options){
  280. // chosen element to manipulate text
  281. this.el = $(el);
  282. // options
  283. this.options = $.extend({}, $.fn.typed.defaults, options);
  284. // text content of element
  285. this.baseText = this.el.text() || this.el.attr('placeholder') || '';
  286. // typing speed
  287. this.typeSpeed = this.options.typeSpeed;
  288. // add a delay before typing starts
  289. this.startDelay = this.options.startDelay;
  290. // backspacing speed
  291. this.backSpeed = this.options.backSpeed;
  292. // amount of time to wait before backspacing
  293. this.backDelay = this.options.backDelay;
  294. // input strings of text
  295. this.strings = this.options.strings;
  296. // character number position of current string
  297. this.strPos = 0;
  298. // current array position
  299. this.arrayPos = 0;
  300. // number to stop backspacing on.
  301. // default 0, can change depending on how many chars
  302. // you want to remove at the time
  303. this.stopNum = 0;
  304. // Looping logic
  305. this.loop = this.options.loop;
  306. this.loopCount = this.options.loopCount;
  307. this.curLoop = 0;
  308. // for stopping
  309. this.stop = false;
  310. // show cursor
  311. this.showCursor = this.isInput ? false : this.options.showCursor;
  312. // custom cursor
  313. this.cursorChar = this.options.cursorChar;
  314. // attribute to type
  315. this.isInput = this.el.is('input');
  316. this.attr = this.options.attr || (this.isInput ? 'placeholder' : null);
  317. // All systems go!
  318. this.build();
  319. };
  320. Typed.prototype = {
  321. constructor: Typed
  322. , init: function(){
  323. // begin the loop w/ first current string (global self.string)
  324. // current string will be passed as an argument each time after this
  325. var self = this;
  326. self.timeout = setTimeout(function() {
  327. // Start typing
  328. self.typewrite(self.strings[self.arrayPos], self.strPos);
  329. }, self.startDelay);
  330. }
  331. , build: function(){
  332. // Insert cursor
  333. if (this.showCursor === true){
  334. this.cursor = $("<span class=\"typed-cursor\">" + this.cursorChar + "</span>");
  335. this.el.after(this.cursor);
  336. }
  337. this.init();
  338. }
  339. // pass current string state to each function, types 1 char per call
  340. , typewrite: function(curString, curStrPos){
  341. // exit when stopped
  342. if(this.stop === true)
  343. return;
  344. // varying values for setTimeout during typing
  345. // can't be global since number changes each time loop is executed
  346. var humanize = Math.round(Math.random() * (100 - 30)) + this.typeSpeed;
  347. var self = this;
  348. // ------------- optional ------------- //
  349. // backpaces a certain string faster
  350. // ------------------------------------ //
  351. // if (self.arrayPos == 1){
  352. // self.backDelay = 50;
  353. // }
  354. // else{ self.backDelay = 500; }
  355. // contain typing function in a timeout humanize'd delay
  356. self.timeout = setTimeout(function() {
  357. // check for an escape character before a pause value
  358. // format: \^\d+ .. eg: ^1000 .. should be able to print the ^ too using ^^
  359. // single ^ are removed from string
  360. var charPause = 0;
  361. var substr = curString.substr(curStrPos);
  362. if (substr.charAt(0) === '^') {
  363. var skip = 1; // skip atleast 1
  364. if(/^\^\d+/.test(substr)) {
  365. substr = /\d+/.exec(substr)[0];
  366. skip += substr.length;
  367. charPause = parseInt(substr);
  368. }
  369. // strip out the escape character and pause value so they're not printed
  370. curString = curString.substring(0,curStrPos)+curString.substring(curStrPos+skip);
  371. }
  372. // timeout for any pause after a character
  373. self.timeout = setTimeout(function() {
  374. if(curStrPos === curString.length) {
  375. // fires callback function
  376. self.options.onStringTyped(self.arrayPos);
  377. // is this the final string
  378. if(self.arrayPos === self.strings.length-1) {
  379. // animation that occurs on the last typed string
  380. self.options.callback();
  381. self.curLoop++;
  382. // quit if we wont loop back
  383. if(self.loop === false || self.curLoop === self.loopCount)
  384. return;
  385. }
  386. self.timeout = setTimeout(function(){
  387. self.backspace(curString, curStrPos);
  388. }, self.backDelay);
  389. } else {
  390. /* call before functions if applicable */
  391. if(curStrPos === 0)
  392. self.options.preStringTyped(self.arrayPos);
  393. // start typing each new char into existing string
  394. // curString: arg, self.baseText: original text inside element
  395. var nextString = self.baseText + curString.substr(0, curStrPos+1);
  396. if (self.attr) {
  397. self.el.attr(self.attr, nextString);
  398. } else {
  399. self.el.text(nextString);
  400. }
  401. // add characters one by one
  402. curStrPos++;
  403. // loop the function
  404. self.typewrite(curString, curStrPos);
  405. }
  406. // end of character pause
  407. }, charPause);
  408. // humanized value for typing
  409. }, humanize);
  410. }
  411. , backspace: function(curString, curStrPos){
  412. // exit when stopped
  413. if (this.stop === true) {
  414. return;
  415. }
  416. // varying values for setTimeout during typing
  417. // can't be global since number changes each time loop is executed
  418. var humanize = Math.round(Math.random() * (100 - 30)) + this.backSpeed;
  419. var self = this;
  420. self.timeout = setTimeout(function() {
  421. // ----- this part is optional ----- //
  422. // check string array position
  423. // on the first string, only delete one word
  424. // the stopNum actually represents the amount of chars to
  425. // ------------- CUSTOM OPTIONS --------------------------------------------- //
  426. // ========================================================================== //
  427. // -------------------------------------------------------------------------- //
  428. if (self.arrayPos == 1) {
  429. self.stopNum = 17;
  430. self.backDelay = 500;
  431. }
  432. else if (self.arrayPos == 2) {
  433. self.stopNum = 54;
  434. }
  435. else{self.stopNum = 0;}
  436. // ----- continue important stuff ----- //
  437. // replace text with base text + typed characters
  438. var nextString = self.baseText + curString.substr(0, curStrPos);
  439. if (self.attr) {
  440. self.el.attr(self.attr, nextString);
  441. } else {
  442. self.el.text(nextString);
  443. }
  444. // if the number (id of character in current string) is
  445. // less than the stop number, keep going
  446. if (curStrPos > self.stopNum){
  447. // subtract characters one by one
  448. curStrPos--;
  449. // loop the function
  450. self.backspace(curString, curStrPos);
  451. }
  452. // if the stop number has been reached, increase
  453. // array position to next string
  454. else if (curStrPos <= self.stopNum) {
  455. self.arrayPos++;
  456. if(self.arrayPos === self.strings.length) {
  457. self.arrayPos = 0;
  458. self.init();
  459. } else
  460. self.typewrite(self.strings[self.arrayPos], curStrPos);
  461. }
  462. // humanized value for typing
  463. }, humanize);
  464. }
  465. // Start & Stop currently not working
  466. // , stop: function() {
  467. // var self = this;
  468. // self.stop = true;
  469. // clearInterval(self.timeout);
  470. // }
  471. // , start: function() {
  472. // var self = this;
  473. // if(self.stop === false)
  474. // return;
  475. // this.stop = false;
  476. // this.init();
  477. // }
  478. // Reset and rebuild the element
  479. , reset: function(){
  480. var self = this;
  481. clearInterval(self.timeout);
  482. var id = this.el.attr('id');
  483. this.el.after('<span id="' + id + '"/>')
  484. this.el.remove();
  485. this.cursor.remove();
  486. // Send the callback
  487. self.options.resetCallback();
  488. }
  489. };
  490. $.fn.typed = function (option) {
  491. return this.each(function () {
  492. var $this = $(this)
  493. , data = $this.data('typed')
  494. , options = typeof option == 'object' && option;
  495. if (!data) $this.data('typed', (data = new Typed(this, options)));
  496. if (typeof option == 'string') data[option]();
  497. });
  498. };
  499. $.fn.typed.defaults = {
  500. strings: ["These are the default values...", "You know what you should do?", "Use your own!", "Have a great day!"],
  501. // typing speed
  502. typeSpeed: 0,
  503. // time before typing starts
  504. startDelay: 0,
  505. // backspacing speed
  506. backSpeed: 0,
  507. // time before backspacing
  508. backDelay: 500,
  509. // loop
  510. loop: false,
  511. // false = infinite
  512. loopCount: false,
  513. // show cursor
  514. showCursor: true,
  515. // character for cursor
  516. cursorChar: "|",
  517. // attribute to type (null == text)
  518. attr: null,
  519. // call when done callback function
  520. callback: function() {},
  521. // starting callback function before each string
  522. preStringTyped: function() {},
  523. //callback for every typed string
  524. onStringTyped: function() {},
  525. // callback for reset
  526. resetCallback: function() {}
  527. };
  528. }(window.jQuery);
  529. // ------------- JQUERY SCROLLTO--------------------------------------------- //
  530. // ============ https://github.com/balupton/jquery-scrollto ================= //
  531. // -------------------------------------------------------------------------- //
  532. /*global define:false require:false */
  533. (function (name, context, definition) {
  534. if (typeof module != 'undefined' && module.exports) module.exports = definition();
  535. else if (typeof define == 'function' && define.amd) define(definition);
  536. else context[name] = definition();
  537. })('jquery-scrollto', this, function(){
  538. // Prepare
  539. var jQuery, $, ScrollTo;
  540. jQuery = $ = window.jQuery || require('jquery');
  541. // Fix scrolling animations on html/body on safari
  542. $.propHooks.scrollTop = $.propHooks.scrollLeft = {
  543. get: function(elem,prop) {
  544. var result = null;
  545. if ( elem.tagName === 'HTML' || elem.tagName === 'BODY' ) {
  546. if ( prop === 'scrollLeft' ) {
  547. result = window.scrollX;
  548. } else if ( prop === 'scrollTop' ) {
  549. result = window.scrollY;
  550. }
  551. }
  552. if ( result == null ) {
  553. result = elem[prop];
  554. }
  555. return result;
  556. }
  557. };
  558. $.Tween.propHooks.scrollTop = $.Tween.propHooks.scrollLeft = {
  559. get: function(tween) {
  560. return $.propHooks.scrollTop.get(tween.elem, tween.prop);
  561. },
  562. set: function(tween) {
  563. // Our safari fix
  564. if ( tween.elem.tagName === 'HTML' || tween.elem.tagName === 'BODY' ) {
  565. // Defaults
  566. tween.options.bodyScrollLeft = (tween.options.bodyScrollLeft || window.scrollX);
  567. tween.options.bodyScrollTop = (tween.options.bodyScrollTop || window.scrollY);
  568. // Apply
  569. if ( tween.prop === 'scrollLeft' ) {
  570. tween.options.bodyScrollLeft = Math.round(tween.now);
  571. }
  572. else if ( tween.prop === 'scrollTop' ) {
  573. tween.options.bodyScrollTop = Math.round(tween.now);
  574. }
  575. // Apply
  576. window.scrollTo(tween.options.bodyScrollLeft, tween.options.bodyScrollTop);
  577. }
  578. // jQuery's IE8 Fix
  579. else if ( tween.elem.nodeType && tween.elem.parentNode ) {
  580. tween.elem[ tween.prop ] = tween.now;
  581. }
  582. }
  583. };
  584. // jQuery ScrollTo
  585. ScrollTo = {
  586. // Configuration
  587. config: {
  588. duration: 400,
  589. easing: 'swing',
  590. callback: undefined,
  591. durationMode: 'each',
  592. offsetTop: 0,
  593. offsetLeft: 0
  594. },
  595. // Set Configuration
  596. configure: function(options){
  597. // Apply Options to Config
  598. $.extend(ScrollTo.config, options||{});
  599. // Chain
  600. return this;
  601. },
  602. // Perform the Scroll Animation for the Collections
  603. // We use $inline here, so we can determine the actual offset start for each overflow:scroll item
  604. // Each collection is for each overflow:scroll item
  605. scroll: function(collections, config){
  606. // Prepare
  607. var collection, $container, container, $target, $inline, position, containerTagName,
  608. containerScrollTop, containerScrollLeft,
  609. containerScrollTopEnd, containerScrollLeftEnd,
  610. startOffsetTop, targetOffsetTop, targetOffsetTopAdjusted,
  611. startOffsetLeft, targetOffsetLeft, targetOffsetLeftAdjusted,
  612. scrollOptions,
  613. callback;
  614. // Determine the Scroll
  615. collection = collections.pop();
  616. $container = collection.$container;
  617. $target = collection.$target;
  618. containerTagName = $container.prop('tagName');
  619. // Prepare the Inline Element of the Container
  620. $inline = $('<span/>').css({
  621. 'position': 'absolute',
  622. 'top': '0px',
  623. 'left': '0px'
  624. });
  625. position = $container.css('position');
  626. // Insert the Inline Element of the Container
  627. $container.css({position:'relative'});
  628. $inline.appendTo($container);
  629. // Determine the top offset
  630. startOffsetTop = $inline.offset().top;
  631. targetOffsetTop = $target.offset().top;
  632. targetOffsetTopAdjusted = targetOffsetTop - startOffsetTop - parseInt(config.offsetTop,10);
  633. // Determine the left offset
  634. startOffsetLeft = $inline.offset().left;
  635. targetOffsetLeft = $target.offset().left;
  636. targetOffsetLeftAdjusted = targetOffsetLeft - startOffsetLeft - parseInt(config.offsetLeft,10);
  637. // Determine current scroll positions
  638. containerScrollTop = $container.prop('scrollTop');
  639. containerScrollLeft = $container.prop('scrollLeft');
  640. // Reset the Inline Element of the Container
  641. $inline.remove();
  642. $container.css({position:position});
  643. // Prepare the scroll options
  644. scrollOptions = {};
  645. // Prepare the callback
  646. callback = function(event){
  647. // Check
  648. if ( collections.length === 0 ) {
  649. // Callback
  650. if ( typeof config.callback === 'function' ) {
  651. config.callback();
  652. }
  653. }
  654. else {
  655. // Recurse
  656. ScrollTo.scroll(collections,config);
  657. }
  658. // Return true
  659. return true;
  660. };
  661. // Handle if we only want to scroll if we are outside the viewport
  662. if ( config.onlyIfOutside ) {
  663. // Determine current scroll positions
  664. containerScrollTopEnd = containerScrollTop + $container.height();
  665. containerScrollLeftEnd = containerScrollLeft + $container.width();
  666. // Check if we are in the range of the visible area of the container
  667. if ( containerScrollTop < targetOffsetTopAdjusted && targetOffsetTopAdjusted < containerScrollTopEnd ) {
  668. targetOffsetTopAdjusted = containerScrollTop;
  669. }
  670. if ( containerScrollLeft < targetOffsetLeftAdjusted && targetOffsetLeftAdjusted < containerScrollLeftEnd ) {
  671. targetOffsetLeftAdjusted = containerScrollLeft;
  672. }
  673. }
  674. // Determine the scroll options
  675. if ( targetOffsetTopAdjusted !== containerScrollTop ) {
  676. scrollOptions.scrollTop = targetOffsetTopAdjusted;
  677. }
  678. if ( targetOffsetLeftAdjusted !== containerScrollLeft ) {
  679. scrollOptions.scrollLeft = targetOffsetLeftAdjusted;
  680. }
  681. // Check to see if the scroll is necessary
  682. if ( $container.prop('scrollHeight') === $container.width() ) {
  683. delete scrollOptions.scrollTop;
  684. }
  685. if ( $container.prop('scrollWidth') === $container.width() ) {
  686. delete scrollOptions.scrollLeft;
  687. }
  688. // Perform the scroll
  689. if ( scrollOptions.scrollTop != null || scrollOptions.scrollLeft != null ) {
  690. $container.animate(scrollOptions, {
  691. duration: config.duration,
  692. easing: config.easing,
  693. complete: callback
  694. });
  695. }
  696. else {
  697. callback();
  698. }
  699. // Return true
  700. return true;
  701. },
  702. // ScrollTo the Element using the Options
  703. fn: function(options){
  704. // Prepare
  705. var collections, config, $container, container;
  706. collections = [];
  707. // Prepare
  708. var $target = $(this);
  709. if ( $target.length === 0 ) {
  710. // Chain
  711. return this;
  712. }
  713. // Handle Options
  714. config = $.extend({},ScrollTo.config,options);
  715. // Fetch
  716. $container = $target.parent();
  717. container = $container.get(0);
  718. // Cycle through the containers
  719. while ( ($container.length === 1) && (container !== document.body) && (container !== document) ) {
  720. // Check Container for scroll differences
  721. var containerScrollTop, containerScrollLeft;
  722. containerScrollTop = $container.css('overflow-y') !== 'visible' && container.scrollHeight !== container.clientHeight;
  723. containerScrollLeft = $container.css('overflow-x') !== 'visible' && container.scrollWidth !== container.clientWidth;
  724. if ( containerScrollTop || containerScrollLeft ) {
  725. // Push the Collection
  726. collections.push({
  727. '$container': $container,
  728. '$target': $target
  729. });
  730. // Update the Target
  731. $target = $container;
  732. }
  733. // Update the Container
  734. $container = $container.parent();
  735. container = $container.get(0);
  736. }
  737. // Add the final collection
  738. collections.push({
  739. '$container': $('html'),
  740. // document.body doesn't work in firefox, html works for all
  741. // internet explorer starts at the beggining
  742. '$target': $target
  743. });
  744. // Adjust the Config
  745. if ( config.durationMode === 'all' ) {
  746. config.duration /= collections.length;
  747. }
  748. // Handle
  749. ScrollTo.scroll(collections,config);
  750. // Chain
  751. return this;
  752. }
  753. };
  754. // Apply our extensions to jQuery
  755. $.ScrollTo = $.ScrollTo || ScrollTo;
  756. $.fn.ScrollTo = $.fn.ScrollTo || ScrollTo.fn;
  757. // Export
  758. return ScrollTo;
  759. });
  760. // ------------- WOW ANIMATE ------------------------------------------------ //
  761. // ==============https://github.com/matthieua/WOW =========================== //
  762. // -------------------------------------------------------------------------- //
  763. (function() {
  764. var MutationObserver, Util, WeakMap, getComputedStyle, getComputedStyleRX,
  765. __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
  766. __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; };
  767. Util = (function() {
  768. function Util() {}
  769. Util.prototype.extend = function(custom, defaults) {
  770. var key, value;
  771. for (key in defaults) {
  772. value = defaults[key];
  773. if (custom[key] == null) {
  774. custom[key] = value;
  775. }
  776. }
  777. return custom;
  778. };
  779. Util.prototype.isMobile = function(agent) {
  780. return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(agent);
  781. };
  782. Util.prototype.addEvent = function(elem, event, fn) {
  783. if (elem.addEventListener != null) {
  784. return elem.addEventListener(event, fn, false);
  785. } else if (elem.attachEvent != null) {
  786. return elem.attachEvent("on" + event, fn);
  787. } else {
  788. return elem[event] = fn;
  789. }
  790. };
  791. Util.prototype.removeEvent = function(elem, event, fn) {
  792. if (elem.removeEventListener != null) {
  793. return elem.removeEventListener(event, fn, false);
  794. } else if (elem.detachEvent != null) {
  795. return elem.detachEvent("on" + event, fn);
  796. } else {
  797. return delete elem[event];
  798. }
  799. };
  800. Util.prototype.innerHeight = function() {
  801. if ('innerHeight' in window) {
  802. return window.innerHeight;
  803. } else {
  804. return document.documentElement.clientHeight;
  805. }
  806. };
  807. return Util;
  808. })();
  809. WeakMap = this.WeakMap || this.MozWeakMap || (WeakMap = (function() {
  810. function WeakMap() {
  811. this.keys = [];
  812. this.values = [];
  813. }
  814. WeakMap.prototype.get = function(key) {
  815. var i, item, _i, _len, _ref;
  816. _ref = this.keys;
  817. for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) {
  818. item = _ref[i];
  819. if (item === key) {
  820. return this.values[i];
  821. }
  822. }
  823. };
  824. WeakMap.prototype.set = function(key, value) {
  825. var i, item, _i, _len, _ref;
  826. _ref = this.keys;
  827. for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) {
  828. item = _ref[i];
  829. if (item === key) {
  830. this.values[i] = value;
  831. return;
  832. }
  833. }
  834. this.keys.push(key);
  835. return this.values.push(value);
  836. };
  837. return WeakMap;
  838. })());
  839. MutationObserver = this.MutationObserver || this.WebkitMutationObserver || this.MozMutationObserver || (MutationObserver = (function() {
  840. function MutationObserver() {
  841. if (typeof console !== "undefined" && console !== null) {
  842. console.warn('MutationObserver is not supported by your browser.');
  843. }
  844. if (typeof console !== "undefined" && console !== null) {
  845. console.warn('WOW.js cannot detect dom mutations, please call .sync() after loading new content.');
  846. }
  847. }
  848. MutationObserver.notSupported = true;
  849. MutationObserver.prototype.observe = function() {};
  850. return MutationObserver;
  851. })());
  852. getComputedStyle = this.getComputedStyle || function(el, pseudo) {
  853. this.getPropertyValue = function(prop) {
  854. var _ref;
  855. if (prop === 'float') {
  856. prop = 'styleFloat';
  857. }
  858. if (getComputedStyleRX.test(prop)) {
  859. prop.replace(getComputedStyleRX, function(_, char) {
  860. return char.toUpperCase();
  861. });
  862. }
  863. return ((_ref = el.currentStyle) != null ? _ref[prop] : void 0) || null;
  864. };
  865. return this;
  866. };
  867. getComputedStyleRX = /(\-([a-z]){1})/g;
  868. this.WOW = (function() {
  869. WOW.prototype.defaults = {
  870. boxClass: 'wow',
  871. animateClass: 'animated',
  872. offset: 0,
  873. mobile: true,
  874. live: true
  875. };
  876. function WOW(options) {
  877. if (options == null) {
  878. options = {};
  879. }
  880. this.scrollCallback = __bind(this.scrollCallback, this);
  881. this.scrollHandler = __bind(this.scrollHandler, this);
  882. this.start = __bind(this.start, this);
  883. this.scrolled = true;
  884. this.config = this.util().extend(options, this.defaults);
  885. this.animationNameCache = new WeakMap();
  886. }
  887. WOW.prototype.init = function() {
  888. var _ref;
  889. this.element = window.document.documentElement;
  890. if ((_ref = document.readyState) === "interactive" || _ref === "complete") {
  891. this.start();
  892. } else {
  893. this.util().addEvent(document, 'DOMContentLoaded', this.start);
  894. }
  895. return this.finished = [];
  896. };
  897. WOW.prototype.start = function() {
  898. var box, _i, _len, _ref;
  899. this.stopped = false;
  900. this.boxes = (function() {
  901. var _i, _len, _ref, _results;
  902. _ref = this.element.querySelectorAll("." + this.config.boxClass);
  903. _results = [];
  904. for (_i = 0, _len = _ref.length; _i < _len; _i++) {
  905. box = _ref[_i];
  906. _results.push(box);
  907. }
  908. return _results;
  909. }).call(this);
  910. this.all = (function() {
  911. var _i, _len, _ref, _results;
  912. _ref = this.boxes;
  913. _results = [];
  914. for (_i = 0, _len = _ref.length; _i < _len; _i++) {
  915. box = _ref[_i];
  916. _results.push(box);
  917. }
  918. return _results;
  919. }).call(this);
  920. if (this.boxes.length) {
  921. if (this.disabled()) {
  922. this.resetStyle();
  923. } else {
  924. _ref = this.boxes;
  925. for (_i = 0, _len = _ref.length; _i < _len; _i++) {
  926. box = _ref[_i];
  927. this.applyStyle(box, true);
  928. }
  929. this.util().addEvent(window, 'scroll', this.scrollHandler);
  930. this.util().addEvent(window, 'resize', this.scrollHandler);
  931. this.interval = setInterval(this.scrollCallback, 50);
  932. }
  933. }
  934. if (this.config.live) {
  935. return new MutationObserver((function(_this) {
  936. return function(records) {
  937. var node, record, _j, _len1, _results;
  938. _results = [];
  939. for (_j = 0, _len1 = records.length; _j < _len1; _j++) {
  940. record = records[_j];
  941. _results.push((function() {
  942. var _k, _len2, _ref1, _results1;
  943. _ref1 = record.addedNodes || [];
  944. _results1 = [];
  945. for (_k = 0, _len2 = _ref1.length; _k < _len2; _k++) {
  946. node = _ref1[_k];
  947. _results1.push(this.doSync(node));
  948. }
  949. return _results1;
  950. }).call(_this));
  951. }
  952. return _results;
  953. };
  954. })(this)).observe(document.body, {
  955. childList: true,
  956. subtree: true
  957. });
  958. }
  959. };
  960. WOW.prototype.stop = function() {
  961. this.stopped = true;
  962. this.util().removeEvent(window, 'scroll', this.scrollHandler);
  963. this.util().removeEvent(window, 'resize', this.scrollHandler);
  964. if (this.interval != null) {
  965. return clearInterval(this.interval);
  966. }
  967. };
  968. WOW.prototype.sync = function(element) {
  969. if (MutationObserver.notSupported) {
  970. return this.doSync(this.element);
  971. }
  972. };
  973. WOW.prototype.doSync = function(element) {
  974. var box, _i, _len, _ref, _results;
  975. if (element == null) {
  976. element = this.element;
  977. }
  978. if (element.nodeType !== 1) {
  979. return;
  980. }
  981. element = element.parentNode || element;
  982. _ref = element.querySelectorAll("." + this.config.boxClass);
  983. _results = [];
  984. for (_i = 0, _len = _ref.length; _i < _len; _i++) {
  985. box = _ref[_i];
  986. if (__indexOf.call(this.all, box) < 0) {
  987. this.boxes.push(box);
  988. this.all.push(box);
  989. if (this.stopped || this.disabled()) {
  990. this.resetStyle();
  991. } else {
  992. this.applyStyle(box, true);
  993. }
  994. _results.push(this.scrolled = true);
  995. } else {
  996. _results.push(void 0);
  997. }
  998. }
  999. return _results;
  1000. };
  1001. WOW.prototype.show = function(box) {
  1002. this.applyStyle(box);
  1003. return box.className = "" + box.className + " " + this.config.animateClass;
  1004. };
  1005. WOW.prototype.applyStyle = function(box, hidden) {
  1006. var delay, duration, iteration;
  1007. duration = box.getAttribute('data-wow-duration');
  1008. delay = box.getAttribute('data-wow-delay');
  1009. iteration = box.getAttribute('data-wow-iteration');
  1010. return this.animate((function(_this) {
  1011. return function() {
  1012. return _this.customStyle(box, hidden, duration, delay, iteration);
  1013. };
  1014. })(this));
  1015. };
  1016. WOW.prototype.animate = (function() {
  1017. if ('requestAnimationFrame' in window) {
  1018. return function(callback) {
  1019. return window.requestAnimationFrame(callback);
  1020. };
  1021. } else {
  1022. return function(callback) {
  1023. return callback();
  1024. };
  1025. }
  1026. })();
  1027. WOW.prototype.resetStyle = function() {
  1028. var box, _i, _len, _ref, _results;
  1029. _ref = this.boxes;
  1030. _results = [];
  1031. for (_i = 0, _len = _ref.length; _i < _len; _i++) {
  1032. box = _ref[_i];
  1033. _results.push(box.style.visibility = 'visible');
  1034. }
  1035. return _results;
  1036. };
  1037. WOW.prototype.customStyle = function(box, hidden, duration, delay, iteration) {
  1038. if (hidden) {
  1039. this.cacheAnimationName(box);
  1040. }
  1041. box.style.visibility = hidden ? 'hidden' : 'visible';
  1042. if (duration) {
  1043. this.vendorSet(box.style, {
  1044. animationDuration: duration
  1045. });
  1046. }
  1047. if (delay) {
  1048. this.vendorSet(box.style, {
  1049. animationDelay: delay
  1050. });
  1051. }
  1052. if (iteration) {
  1053. this.vendorSet(box.style, {
  1054. animationIterationCount: iteration
  1055. });
  1056. }
  1057. this.vendorSet(box.style, {
  1058. animationName: hidden ? 'none' : this.cachedAnimationName(box)
  1059. });
  1060. return box;
  1061. };
  1062. WOW.prototype.vendors = ["moz", "webkit"];
  1063. WOW.prototype.vendorSet = function(elem, properties) {
  1064. var name, value, vendor, _results;
  1065. _results = [];
  1066. for (name in properties) {
  1067. value = properties[name];
  1068. elem["" + name] = value;
  1069. _results.push((function() {
  1070. var _i, _len, _ref, _results1;
  1071. _ref = this.vendors;
  1072. _results1 = [];
  1073. for (_i = 0, _len = _ref.length; _i < _len; _i++) {
  1074. vendor = _ref[_i];
  1075. _results1.push(elem["" + vendor + (name.charAt(0).toUpperCase()) + (name.substr(1))] = value);
  1076. }
  1077. return _results1;
  1078. }).call(this));
  1079. }
  1080. return _results;
  1081. };
  1082. WOW.prototype.vendorCSS = function(elem, property) {
  1083. var result, style, vendor, _i, _len, _ref;
  1084. style = getComputedStyle(elem);
  1085. result = style.getPropertyCSSValue(property);
  1086. _ref = this.vendors;
  1087. for (_i = 0, _len = _ref.length; _i < _len; _i++) {
  1088. vendor = _ref[_i];
  1089. result = result || style.getPropertyCSSValue("-" + vendor + "-" + property);
  1090. }
  1091. return result;
  1092. };
  1093. WOW.prototype.animationName = function(box) {
  1094. var animationName;
  1095. try {
  1096. animationName = this.vendorCSS(box, 'animation-name').cssText;
  1097. } catch (_error) {
  1098. animationName = getComputedStyle(box).getPropertyValue('animation-name');
  1099. }
  1100. if (animationName === 'none') {
  1101. return '';
  1102. } else {
  1103. return animationName;
  1104. }
  1105. };
  1106. WOW.prototype.cacheAnimationName = function(box) {
  1107. return this.animationNameCache.set(box, this.animationName(box));
  1108. };
  1109. WOW.prototype.cachedAnimationName = function(box) {
  1110. return this.animationNameCache.get(box);
  1111. };
  1112. WOW.prototype.scrollHandler = function() {
  1113. return this.scrolled = true;
  1114. };
  1115. WOW.prototype.scrollCallback = function() {
  1116. var box;
  1117. if (this.scrolled) {
  1118. this.scrolled = false;
  1119. this.boxes = (function() {
  1120. var _i, _len, _ref, _results;
  1121. _ref = this.boxes;
  1122. _results = [];
  1123. for (_i = 0, _len = _ref.length; _i < _len; _i++) {
  1124. box = _ref[_i];
  1125. if (!(box)) {
  1126. continue;
  1127. }
  1128. if (this.isVisible(box)) {
  1129. this.show(box);
  1130. continue;
  1131. }
  1132. _results.push(box);
  1133. }
  1134. return _results;
  1135. }).call(this);
  1136. if (!(this.boxes.length || this.config.live)) {
  1137. return this.stop();
  1138. }
  1139. }
  1140. };
  1141. WOW.prototype.offsetTop = function(element) {
  1142. var top;
  1143. while (element.offsetTop === void 0) {
  1144. element = element.parentNode;
  1145. }
  1146. top = element.offsetTop;
  1147. while (element = element.offsetParent) {
  1148. top += element.offsetTop;
  1149. }
  1150. return top;
  1151. };
  1152. WOW.prototype.isVisible = function(box) {
  1153. var bottom, offset, top, viewBottom, viewTop;
  1154. offset = box.getAttribute('data-wow-offset') || this.config.offset;
  1155. viewTop = window.pageYOffset;
  1156. viewBottom = viewTop + Math.min(this.element.clientHeight, this.util().innerHeight()) - offset;
  1157. top = this.offsetTop(box);
  1158. bottom = top + box.clientHeight;
  1159. return top <= viewBottom && bottom >= viewTop;
  1160. };
  1161. WOW.prototype.util = function() {
  1162. return this._util != null ? this._util : this._util = new Util();
  1163. };
  1164. WOW.prototype.disabled = function() {
  1165. return !this.config.mobile && this.util().isMobile(navigator.userAgent);
  1166. };
  1167. return WOW;
  1168. })();
  1169. }).call(this);
  1170. // ------------- JQUERY SMOOTHSTATE ----------------------------------------- //
  1171. // ============ https://github.com/miguel-perez/jquery.smoothState.js ======= //
  1172. // -------------------------------------------------------------------------- //
  1173. ;(function ( $, window, document, undefined ) {
  1174. "use strict";
  1175. var
  1176. /** Used later to scroll page to the top */
  1177. $body = $("html, body"),
  1178. /** Used in development mode to console out useful warnings */
  1179. consl = (window.console || false),
  1180. /** Plugin default options */
  1181. defaults = {
  1182. /** jquery element string to specify which anchors smoothstate should bind to */
  1183. anchors : "a",
  1184. /** If set to true, smoothState will prefetch a link's contents on hover */
  1185. prefetch : false,
  1186. /** A selecor that deinfes with links should be ignored by smoothState */
  1187. blacklist : ".no-smoothstate, [target]",
  1188. /** If set to true, smoothState will log useful debug information instead of aborting */
  1189. development : false,
  1190. /** The number of pages smoothState will try to store in memory and not request again */
  1191. pageCacheSize : 0,
  1192. /** A function that can be used to alter urls before they are used to request content */
  1193. alterRequestUrl : function (url) {
  1194. return url;
  1195. },
  1196. /** Run when a link has been activated */
  1197. onStart : {
  1198. duration: 0,
  1199. render: function (url, $container) {
  1200. $body.scrollTop(0);
  1201. }
  1202. },
  1203. /** Run if the page request is still pending and onStart has finished animating */
  1204. onProgress : {
  1205. duration: 0,
  1206. render: function (url, $container) {
  1207. $body.css("cursor", "wait");
  1208. $body.find("a").css("cursor", "wait");
  1209. }
  1210. },
  1211. /** Run when requested content is ready to be injected into the page */
  1212. onEnd : {
  1213. duration: 0,
  1214. render: function (url, $container, $content) {
  1215. $body.css("cursor", "auto");
  1216. $body.find("a").css("cursor", "auto");
  1217. $container.html($content);
  1218. }
  1219. },
  1220. /** Run when content has been injected and all animations are complete */
  1221. callback : function(url, $container, $content) {
  1222. }
  1223. },
  1224. /** Utility functions that are decoupled from SmoothState */
  1225. utility = {
  1226. /**
  1227. * Checks to see if the url is external
  1228. * @param {string} url - url being evaluated
  1229. * @see http://stackoverflow.com/questions/6238351/fastest-way-to-detect-external-urls
  1230. *
  1231. */
  1232. isExternal: function (url) {
  1233. var match = url.match(/^([^:\/?#]+:)?(?:\/\/([^\/?#]*))?([^?#]+)?(\?[^#]*)?(#.*)?/);
  1234. if (typeof match[1] === "string" && match[1].length > 0 && match[1].toLowerCase() !== window.location.protocol) {
  1235. return true;
  1236. }
  1237. if (typeof match[2] === "string" && match[2].length > 0 && match[2].replace(new RegExp(":(" + {"http:": 80, "https:": 443}[window.location.protocol] + ")?$"), "") !== window.location.host) {
  1238. return true;
  1239. }
  1240. return false;
  1241. },
  1242. /**
  1243. * Checks to see if the url is an internal hash
  1244. * @param {string} url - url being evaluated
  1245. *
  1246. */
  1247. isHash: function (url) {
  1248. var hasPathname = (url.indexOf(window.location.pathname) > 0) ? true : false,
  1249. hasHash = (url.indexOf("#") > 0) ? true : false;
  1250. return (hasPathname && hasHash) ? true : false;
  1251. },
  1252. /**
  1253. * Checks to see if we should be loading this URL
  1254. * @param {string} url - url being evaluated
  1255. * @param {string} blacklist - jquery selector
  1256. *
  1257. */
  1258. shouldLoad: function ($anchor, blacklist) {
  1259. var url = $anchor.prop("href");
  1260. // URL will only be loaded if it"s not an external link, hash, or blacklisted
  1261. return (!utility.isExternal(url) && !utility.isHash(url) && !$anchor.is(blacklist));
  1262. },
  1263. /**
  1264. * Prevents jQuery from stripping elements from $(html)
  1265. * @param {string} url - url being evaluated
  1266. * @author Ben Alman http://benalman.com/
  1267. * @see https://gist.github.com/cowboy/742952
  1268. *
  1269. */
  1270. htmlDoc: function (html) {
  1271. var parent,
  1272. elems = $(),
  1273. matchTag = /<(\/?)(html|head|body|title|base|meta)(\s+[^>]*)?>/ig,
  1274. prefix = "ss" + Math.round(Math.random() * 100000),
  1275. htmlParsed = html.replace(matchTag, function(tag, slash, name, attrs) {
  1276. var obj = {};
  1277. if (!slash) {
  1278. elems = elems.add("<" + name + "/>");
  1279. if (attrs) {
  1280. $.each($("<div" + attrs + "/>")[0].attributes, function(i, attr) {
  1281. obj[attr.name] = attr.value;
  1282. });
  1283. }
  1284. elems.eq(-1).attr(obj);
  1285. }
  1286. return "<" + slash + "div" + (slash ? "" : " id='" + prefix + (elems.length - 1) + "'") + ">";
  1287. });
  1288. // If no placeholder elements were necessary, just return normal
  1289. // jQuery-parsed HTML.
  1290. if (!elems.length) {
  1291. return $(html);
  1292. }
  1293. // Create parent node if it hasn"t been created yet.
  1294. if (!parent) {
  1295. parent = $("<div/>");
  1296. }
  1297. // Create the parent node and append the parsed, place-held HTML.
  1298. parent.html(htmlParsed);
  1299. // Replace each placeholder element with its intended element.
  1300. $.each(elems, function(i) {
  1301. var elem = parent.find("#" + prefix + i).before(elems[i]);
  1302. elems.eq(i).html(elem.contents());
  1303. elem.remove();
  1304. });
  1305. return parent.children().unwrap();
  1306. },
  1307. /**
  1308. * Resets an object if it has too many properties
  1309. *
  1310. * This is used to clear the "cache" object that stores
  1311. * all of the html. This would prevent the client from
  1312. * running out of memory and allow the user to hit the
  1313. * server for a fresh copy of the content.
  1314. *
  1315. * @param {object} obj
  1316. * @param {number} cap
  1317. *
  1318. */
  1319. clearIfOverCapacity: function (obj, cap) {
  1320. // Polyfill Object.keys if it doesn"t exist
  1321. if (!Object.keys) {
  1322. Object.keys = function (obj) {
  1323. var keys = [],
  1324. k;
  1325. for (k in obj) {
  1326. if (Object.prototype.hasOwnProperty.call(obj, k)) {
  1327. keys.push(k);
  1328. }
  1329. }
  1330. return keys;
  1331. };
  1332. }
  1333. if (Object.keys(obj).length > cap) {
  1334. obj = {};
  1335. }
  1336. return obj;
  1337. },
  1338. /**
  1339. * Finds the inner content of an element, by an ID, from a jQuery object
  1340. * @param {string} id
  1341. * @param {object} $html
  1342. *
  1343. */
  1344. getContentById: function (id, $html) {
  1345. $html = ($html instanceof jQuery) ? $html : utility.htmlDoc($html);
  1346. var $insideElem = $html.find(id),
  1347. updatedContainer = ($insideElem.length) ? $.trim($insideElem.html()) : $html.filter(id).html(),
  1348. newContent = (updatedContainer.length) ? $(updatedContainer) : null;
  1349. return newContent;
  1350. },
  1351. /**
  1352. * Stores html content as jquery object in given object
  1353. * @param {object} object - object contents will be stored into
  1354. * @param {string} url - url to be used as the prop
  1355. * @param {jquery} html - contents to store
  1356. *
  1357. */
  1358. storePageIn: function (object, url, $html) {
  1359. $html = ($html instanceof jQuery) ? $html : utility.htmlDoc($html);
  1360. object[url] = { // Content is indexed by the url
  1361. status: "loaded",
  1362. title: $html.find("title").text(), // Stores the title of the page
  1363. html: $html // Stores the contents of the page
  1364. };
  1365. return object;
  1366. },
  1367. /**
  1368. * Triggers an "allanimationend" event when all animations are complete
  1369. * @param {object} $element - jQuery object that should trigger event
  1370. * @param {string} resetOn - which other events to trigger allanimationend on
  1371. *
  1372. */
  1373. triggerAllAnimationEndEvent: function ($element, resetOn) {
  1374. resetOn = " " + resetOn || "";
  1375. var animationCount = 0,
  1376. animationstart = "animationstart webkitAnimationStart oanimationstart MSAnimationStart",
  1377. animationend = "animationend webkitAnimationEnd oanimationend MSAnimationEnd",
  1378. eventname = "allanimationend",
  1379. onAnimationStart = function (e) {
  1380. if ($(e.delegateTarget).is($element)) {
  1381. e.stopPropagation();
  1382. animationCount ++;
  1383. }
  1384. },
  1385. onAnimationEnd = function (e) {
  1386. if ($(e.delegateTarget).is($element)) {
  1387. e.stopPropagation();
  1388. animationCount --;
  1389. if(animationCount === 0) {
  1390. $element.trigger(eventname);
  1391. }
  1392. }
  1393. };
  1394. $element.on(animationstart, onAnimationStart);
  1395. $element.on(animationend, onAnimationEnd);
  1396. $element.on("allanimationend" + resetOn, function(){
  1397. animationCount = 0;
  1398. utility.redraw($element);
  1399. });
  1400. },
  1401. /** Forces browser to redraw elements */
  1402. redraw: function ($element) {
  1403. $element.height(0);
  1404. setTimeout(function(){$element.height("auto");}, 0);
  1405. }
  1406. },
  1407. /** Handles the popstate event, like when the user hits "back" */
  1408. onPopState = function ( e ) {
  1409. if(e.state !== null) {
  1410. var url = window.location.href,
  1411. $page = $("#" + e.state.id),
  1412. page = $page.data("smoothState");
  1413. if(page.href !== url && !utility.isHash(url)) {
  1414. page.load(url, true);
  1415. }
  1416. }
  1417. },
  1418. /** Constructor function */
  1419. SmoothState = function ( element, options ) {
  1420. var
  1421. /** Container element smoothState is run on */
  1422. $container = $(element),
  1423. /** Variable that stores pages after they are requested */
  1424. cache = {},
  1425. /** Url of the content that is currently displayed */
  1426. currentHref = window.location.href,
  1427. /**
  1428. * Loads the contents of a url into our container
  1429. *
  1430. * @param {string} url
  1431. * @param {bool} isPopped - used to determine if whe should
  1432. * add a new item into the history object
  1433. *
  1434. */
  1435. load = function (url, isPopped) {
  1436. /** Makes this an optional variable by setting a default */
  1437. isPopped = isPopped || false;
  1438. var
  1439. /** Used to check if the onProgress function has been run */
  1440. hasRunCallback = false,
  1441. callbBackEnded = false,
  1442. /** List of responses for the states of the page request */
  1443. responses = {
  1444. /** Page is ready, update the content */
  1445. loaded: function() {
  1446. var eventName = hasRunCallback ? "ss.onProgressEnd" : "ss.onStartEnd";
  1447. if(!callbBackEnded || !hasRunCallback) {
  1448. $container.one(eventName, function(){
  1449. updateContent(url);
  1450. });
  1451. } else if(callbBackEnded) {
  1452. updateContent(url);
  1453. }
  1454. if(!isPopped) {
  1455. window.history.pushState({ id: $container.prop("id") }, cache[url].title, url);
  1456. }
  1457. },
  1458. /** Loading, wait 10 ms and check again */
  1459. fetching: function() {
  1460. if(!hasRunCallback) {
  1461. hasRunCallback = true;
  1462. // Run the onProgress callback and set trigger
  1463. $container.one("ss.onStartEnd", function(){
  1464. options.onProgress.render(url, $container, null);
  1465. setTimeout(function(){
  1466. $container.trigger("ss.onProgressEnd");
  1467. callbBackEnded = true;
  1468. }, options.onStart.duration);
  1469. });
  1470. }
  1471. setTimeout(function () {
  1472. // Might of been canceled, better check!
  1473. if(cache.hasOwnProperty(url)){
  1474. responses[cache[url].status]();
  1475. }
  1476. }, 10);
  1477. },
  1478. /** Error, abort and redirect */
  1479. error: function(){
  1480. window.location = url;
  1481. }
  1482. };
  1483. if (!cache.hasOwnProperty(url)) {
  1484. fetch(url);
  1485. }
  1486. // Run the onStart callback and set trigger
  1487. options.onStart.render(url, $container, null);
  1488. setTimeout(function(){
  1489. $container.trigger("ss.onStartEnd");
  1490. }, options.onStart.duration);
  1491. // Start checking for the status of content
  1492. responses[cache[url].status]();
  1493. },
  1494. /** Updates the contents from cache[url] */
  1495. updateContent = function (url) {
  1496. // If the content has been requested and is done:
  1497. var containerId = "#" + $container.prop("id"),
  1498. $content = cache[url] ? utility.getContentById(containerId, cache[url].html) : null;
  1499. if($content) {
  1500. document.title = cache[url].title;
  1501. $container.data("smoothState").href = url;
  1502. // Call the onEnd callback and set trigger
  1503. options.onEnd.render(url, $container, $content);
  1504. $container.one("ss.onEndEnd", function(){
  1505. options.callback(url, $container, $content);
  1506. });
  1507. setTimeout(function(){
  1508. $container.trigger("ss.onEndEnd");
  1509. }, options.onEnd.duration);
  1510. } else if (!$content && options.development && consl) {
  1511. // Throw warning to help debug in development mode
  1512. consl.warn("No element with an id of " + containerId + " in response from " + url + " in " + cache);
  1513. } else {
  1514. // No content availble to update with, aborting...
  1515. window.location = url;
  1516. }
  1517. },
  1518. /**
  1519. * Fetches the contents of a url and stores it in the "cache" varible
  1520. * @param {string} url
  1521. *
  1522. */
  1523. fetch = function (url) {
  1524. // Don"t fetch we have the content already
  1525. if(cache.hasOwnProperty(url)) {
  1526. return;
  1527. }
  1528. cache = utility.clearIfOverCapacity(cache, options.pageCacheSize);
  1529. cache[url] = { status: "fetching" };
  1530. var requestUrl = options.alterRequestUrl(url) || url,
  1531. request = $.ajax(requestUrl);
  1532. // Store contents in cache variable if successful
  1533. request.success(function (html) {
  1534. // Clear cache varible if it"s getting too big
  1535. utility.storePageIn(cache, url, html);
  1536. $container.data("smoothState").cache = cache;
  1537. });
  1538. // Mark as error
  1539. request.error(function () {
  1540. cache[url].status = "error";
  1541. });
  1542. },
  1543. /**
  1544. * Binds to the hover event of a link, used for prefetching content
  1545. *
  1546. * @param {object} event
  1547. *
  1548. */
  1549. hoverAnchor = function (event) {
  1550. var $anchor = $(event.currentTarget),
  1551. url = $anchor.prop("href");
  1552. if (utility.shouldLoad($anchor, options.blacklist)) {
  1553. event.stopPropagation();
  1554. fetch(url);
  1555. }
  1556. },
  1557. /**
  1558. * Binds to the click event of a link, used to show the content
  1559. *
  1560. * @param {object} event
  1561. *
  1562. */
  1563. clickAnchor = function (event) {
  1564. var $anchor = $(event.currentTarget),
  1565. url = $anchor.prop("href");
  1566. // Ctrl (or Cmd) + click must open a new tab
  1567. if (!event.metaKey && !event.ctrlKey && utility.shouldLoad($anchor, options.blacklist)) {
  1568. // stopPropagation so that event doesn"t fire on parent containers.
  1569. event.stopPropagation();
  1570. event.preventDefault();
  1571. load(url);
  1572. }
  1573. },
  1574. /**
  1575. * Binds all events and inits functionality
  1576. *
  1577. * @param {object} event
  1578. *
  1579. */
  1580. bindEventHandlers = function ($element) {
  1581. //@todo: Handle form submissions
  1582. $element.on("click", options.anchors, clickAnchor);
  1583. if (options.prefetch) {
  1584. $element.on("mouseover touchstart", options.anchors, hoverAnchor);
  1585. }
  1586. },
  1587. /** Used to restart css animations with a class */
  1588. toggleAnimationClass = function (classname) {
  1589. var classes = $container.addClass(classname).prop("class");
  1590. $container.removeClass(classes);
  1591. setTimeout(function(){
  1592. $container.addClass(classes);
  1593. },0);
  1594. $container.one("ss.onStartEnd ss.onProgressEnd ss.onEndEnd", function(){
  1595. $container.removeClass(classname);
  1596. });
  1597. };
  1598. /** Override defaults with options passed in */
  1599. options = $.extend(defaults, options);
  1600. /** Sets a default state */
  1601. if(window.history.state === null) {
  1602. window.history.replaceState({ id: $container.prop("id") }, document.title, currentHref);
  1603. }
  1604. /** Stores the current page in cache variable */
  1605. utility.storePageIn(cache, currentHref, document.documentElement.outerHTML);
  1606. /** Bind all of the event handlers on the container, not anchors */
  1607. utility.triggerAllAnimationEndEvent($container, "ss.onStartEnd ss.onProgressEnd ss.onEndEnd");
  1608. /** Bind all of the event handlers on the container, not anchors */
  1609. bindEventHandlers($container);
  1610. /** Public methods */
  1611. return {
  1612. href: currentHref,
  1613. cache: cache,
  1614. load: load,
  1615. fetch: fetch,
  1616. toggleAnimationClass: toggleAnimationClass
  1617. };
  1618. },
  1619. /** Returns elements with SmoothState attached to it */
  1620. declareSmoothState = function ( options ) {
  1621. return this.each(function () {
  1622. // Checks to make sure the smoothState element has an id and isn"t already bound
  1623. if(this.id && !$.data(this, "smoothState")) {
  1624. // Makes public methods available via $("element").data("smoothState");
  1625. $.data(this, "smoothState", new SmoothState(this, options));
  1626. } else if (!this.id && consl) {
  1627. // Throw warning if in development mode
  1628. consl.warn("Every smoothState container needs an id but the following one does not have one:", this);
  1629. }
  1630. });
  1631. };
  1632. /** Sets the popstate function */
  1633. window.onpopstate = onPopState;
  1634. /** Makes utility functions public for unit tests */
  1635. $.smoothStateUtility = utility;
  1636. /** Defines the smoothState plugin */
  1637. $.fn.smoothState = declareSmoothState;
  1638. })(jQuery, window, document);
  1639. // ------------- jQuery Cookie Plugin v1.4.1 -------------------------------- //
  1640. // ============ https://github.com/carhartl/jquery-cookie =================== //
  1641. // -------------------------------------------------------------------------- //
  1642. (function (factory) {
  1643. if (typeof define === 'function' && define.amd) {
  1644. // AMD
  1645. define(['jquery'], factory);
  1646. } else if (typeof exports === 'object') {
  1647. // CommonJS
  1648. factory(require('jquery'));
  1649. } else {
  1650. // Browser globals
  1651. factory(jQuery);
  1652. }
  1653. }(function ($) {
  1654. var pluses = /\+/g;
  1655. function encode(s) {
  1656. return config.raw ? s : encodeURIComponent(s);
  1657. }
  1658. function decode(s) {
  1659. return config.raw ? s : decodeURIComponent(s);
  1660. }
  1661. function stringifyCookieValue(value) {
  1662. return encode(config.json ? JSON.stringify(value) : String(value));
  1663. }
  1664. function parseCookieValue(s) {
  1665. if (s.indexOf('"') === 0) {
  1666. // This is a quoted cookie as according to RFC2068, unescape...
  1667. s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
  1668. }
  1669. try {
  1670. // Replace server-side written pluses with spaces.
  1671. // If we can't decode the cookie, ignore it, it's unusable.
  1672. // If we can't parse the cookie, ignore it, it's unusable.
  1673. s = decodeURIComponent(s.replace(pluses, ' '));
  1674. return config.json ? JSON.parse(s) : s;
  1675. } catch(e) {}
  1676. }
  1677. function read(s, converter) {
  1678. var value = config.raw ? s : parseCookieValue(s);
  1679. return $.isFunction(converter) ? converter(value) : value;
  1680. }
  1681. var config = $.cookie = function (key, value, options) {
  1682. // Write
  1683. if (arguments.length > 1 && !$.isFunction(value)) {
  1684. options = $.extend({}, config.defaults, options);
  1685. if (typeof options.expires === 'number') {
  1686. var days = options.expires, t = options.expires = new Date();
  1687. t.setTime(+t + days * 864e+5);
  1688. }
  1689. return (document.cookie = [
  1690. encode(key), '=', stringifyCookieValue(value),
  1691. options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
  1692. options.path ? '; path=' + options.path : '',
  1693. options.domain ? '; domain=' + options.domain : '',
  1694. options.secure ? '; secure' : ''
  1695. ].join(''));
  1696. }
  1697. // Read
  1698. var result = key ? undefined : {};
  1699. // To prevent the for loop in the first place assign an empty array
  1700. // in case there are no cookies at all. Also prevents odd result when
  1701. // calling $.cookie().
  1702. var cookies = document.cookie ? document.cookie.split('; ') : [];
  1703. for (var i = 0, l = cookies.length; i < l; i++) {
  1704. var parts = cookies[i].split('=');
  1705. var name = decode(parts.shift());
  1706. var cookie = parts.join('=');
  1707. if (key && key === name) {
  1708. // If second argument (value) is a function it's a converter...
  1709. result = read(cookie, value);
  1710. break;
  1711. }
  1712. // Prevent storing a cookie that we couldn't decode.
  1713. if (!key && (cookie = read(cookie)) !== undefined) {
  1714. result[name] = cookie;
  1715. }
  1716. }
  1717. return result;
  1718. };
  1719. config.defaults = {};
  1720. $.removeCookie = function (key, options) {
  1721. if ($.cookie(key) === undefined) {
  1722. return false;
  1723. }
  1724. // Must not alter options, thus extending a fresh object...
  1725. $.cookie(key, '', $.extend({}, options, { expires: -1 }));
  1726. return !$.cookie(key);
  1727. };
  1728. }));
  1729. // ----------------- jQuery Waypoints v2.0.5 -------------------------------- //
  1730. // ======== https://github.com/imakewebthings/jquery-waypoints ============== //
  1731. // -------------------------------------------------------------------------- //
  1732. (function() {
  1733. 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; },
  1734. __slice = [].slice;
  1735. (function(root, factory) {
  1736. if (typeof define === 'function' && define.amd) {
  1737. return define('waypoints', ['jquery'], function($) {
  1738. return factory($, root);
  1739. });
  1740. } else {
  1741. return factory(root.jQuery, root);
  1742. }
  1743. })(window, function($, window) {
  1744. var $w, Context, Waypoint, allWaypoints, contextCounter, contextKey, contexts, isTouch, jQMethods, methods, resizeEvent, scrollEvent, waypointCounter, waypointKey, wp, wps;
  1745. $w = $(window);
  1746. isTouch = __indexOf.call(window, 'ontouchstart') >= 0;
  1747. allWaypoints = {
  1748. horizontal: {},
  1749. vertical: {}
  1750. };
  1751. contextCounter = 1;
  1752. contexts = {};
  1753. contextKey = 'waypoints-context-id';
  1754. resizeEvent = 'resize.waypoints';
  1755. scrollEvent = 'scroll.waypoints';
  1756. waypointCounter = 1;
  1757. waypointKey = 'waypoints-waypoint-ids';
  1758. wp = 'waypoint';
  1759. wps = 'waypoints';
  1760. Context = (function() {
  1761. function Context($element) {
  1762. var _this = this;
  1763. this.$element = $element;
  1764. this.element = $element[0];
  1765. this.didResize = false;
  1766. this.didScroll = false;
  1767. this.id = 'context' + contextCounter++;
  1768. this.oldScroll = {
  1769. x: $element.scrollLeft(),
  1770. y: $element.scrollTop()
  1771. };
  1772. this.waypoints = {
  1773. horizontal: {},
  1774. vertical: {}
  1775. };
  1776. this.element[contextKey] = this.id;
  1777. contexts[this.id] = this;
  1778. $element.bind(scrollEvent, function() {
  1779. var scrollHandler;
  1780. if (!(_this.didScroll || isTouch)) {
  1781. _this.didScroll = true;
  1782. scrollHandler = function() {
  1783. _this.doScroll();
  1784. return _this.didScroll = false;
  1785. };
  1786. return window.setTimeout(scrollHandler, $[wps].settings.scrollThrottle);
  1787. }
  1788. });
  1789. $element.bind(resizeEvent, function() {
  1790. var resizeHandler;
  1791. if (!_this.didResize) {
  1792. _this.didResize = true;
  1793. resizeHandler = function() {
  1794. $[wps]('refresh');
  1795. return _this.didResize = false;
  1796. };
  1797. return window.setTimeout(resizeHandler, $[wps].settings.resizeThrottle);
  1798. }
  1799. });
  1800. }
  1801. Context.prototype.doScroll = function() {
  1802. var axes,
  1803. _this = this;
  1804. axes = {
  1805. horizontal: {
  1806. newScroll: this.$element.scrollLeft(),
  1807. oldScroll: this.oldScroll.x,
  1808. forward: 'right',
  1809. backward: 'left'
  1810. },
  1811. vertical: {
  1812. newScroll: this.$element.scrollTop(),
  1813. oldScroll: this.oldScroll.y,
  1814. forward: 'down',
  1815. backward: 'up'
  1816. }
  1817. };
  1818. if (isTouch && (!axes.vertical.oldScroll || !axes.vertical.newScroll)) {
  1819. $[wps]('refresh');
  1820. }
  1821. $.each(axes, function(aKey, axis) {
  1822. var direction, isForward, triggered;
  1823. triggered = [];
  1824. isForward = axis.newScroll > axis.oldScroll;
  1825. direction = isForward ? axis.forward : axis.backward;
  1826. $.each(_this.waypoints[aKey], function(wKey, waypoint) {
  1827. var _ref, _ref1;
  1828. if ((axis.oldScroll < (_ref = waypoint.offset) && _ref <= axis.newScroll)) {
  1829. return triggered.push(waypoint);
  1830. } else if ((axis.newScroll < (_ref1 = waypoint.offset) && _ref1 <= axis.oldScroll)) {
  1831. return triggered.push(waypoint);
  1832. }
  1833. });
  1834. triggered.sort(function(a, b) {
  1835. return a.offset - b.offset;
  1836. });
  1837. if (!isForward) {
  1838. triggered.reverse();
  1839. }
  1840. return $.each(triggered, function(i, waypoint) {
  1841. if (waypoint.options.continuous || i === triggered.length - 1) {
  1842. return waypoint.trigger([direction]);
  1843. }
  1844. });
  1845. });
  1846. return this.oldScroll = {
  1847. x: axes.horizontal.newScroll,
  1848. y: axes.vertical.newScroll
  1849. };
  1850. };
  1851. Context.prototype.refresh = function() {
  1852. var axes, cOffset, isWin,
  1853. _this = this;
  1854. isWin = $.isWindow(this.element);
  1855. cOffset = this.$element.offset();
  1856. this.doScroll();
  1857. axes = {
  1858. horizontal: {
  1859. contextOffset: isWin ? 0 : cOffset.left,
  1860. contextScroll: isWin ? 0 : this.oldScroll.x,
  1861. contextDimension: this.$element.width(),
  1862. oldScroll: this.oldScroll.x,
  1863. forward: 'right',
  1864. backward: 'left',
  1865. offsetProp: 'left'
  1866. },
  1867. vertical: {
  1868. contextOffset: isWin ? 0 : cOffset.top,
  1869. contextScroll: isWin ? 0 : this.oldScroll.y,
  1870. contextDimension: isWin ? $[wps]('viewportHeight') : this.$element.height(),
  1871. oldScroll: this.oldScroll.y,
  1872. forward: 'down',
  1873. backward: 'up',
  1874. offsetProp: 'top'
  1875. }
  1876. };
  1877. return $.each(axes, function(aKey, axis) {
  1878. return $.each(_this.waypoints[aKey], function(i, waypoint) {
  1879. var adjustment, elementOffset, oldOffset, _ref, _ref1;
  1880. adjustment = waypoint.options.offset;
  1881. oldOffset = waypoint.offset;
  1882. elementOffset = $.isWindow(waypoint.element) ? 0 : waypoint.$element.offset()[axis.offsetProp];
  1883. if ($.isFunction(adjustment)) {
  1884. adjustment = adjustment.apply(waypoint.element);
  1885. } else if (typeof adjustment === 'string') {
  1886. adjustment = parseFloat(adjustment);
  1887. if (waypoint.options.offset.indexOf('%') > -1) {
  1888. adjustment = Math.ceil(axis.contextDimension * adjustment / 100);
  1889. }
  1890. }
  1891. waypoint.offset = elementOffset - axis.contextOffset + axis.contextScroll - adjustment;
  1892. if ((waypoint.options.onlyOnScroll && (oldOffset != null)) || !waypoint.enabled) {
  1893. return;
  1894. }
  1895. if (oldOffset !== null && (oldOffset < (_ref = axis.oldScroll) && _ref <= waypoint.offset)) {
  1896. return waypoint.trigger([axis.backward]);
  1897. } else if (oldOffset !== null && (oldOffset > (_ref1 = axis.oldScroll) && _ref1 >= waypoint.offset)) {
  1898. return waypoint.trigger([axis.forward]);
  1899. } else if (oldOffset === null && axis.oldScroll >= waypoint.offset) {
  1900. return waypoint.trigger([axis.forward]);
  1901. }
  1902. });
  1903. });
  1904. };
  1905. Context.prototype.checkEmpty = function() {
  1906. if ($.isEmptyObject(this.waypoints.horizontal) && $.isEmptyObject(this.waypoints.vertical)) {
  1907. this.$element.unbind([resizeEvent, scrollEvent].join(' '));
  1908. return delete contexts[this.id];
  1909. }
  1910. };
  1911. return Context;
  1912. })();
  1913. Waypoint = (function() {
  1914. function Waypoint($element, context, options) {
  1915. var idList, _ref;
  1916. if (options.offset === 'bottom-in-view') {
  1917. options.offset = function() {
  1918. var contextHeight;
  1919. contextHeight = $[wps]('viewportHeight');
  1920. if (!$.isWindow(context.element)) {
  1921. contextHeight = context.$element.height();
  1922. }
  1923. return contextHeight - $(this).outerHeight();
  1924. };
  1925. }
  1926. this.$element = $element;
  1927. this.element = $element[0];
  1928. this.axis = options.horizontal ? 'horizontal' : 'vertical';
  1929. this.callback = options.handler;
  1930. this.context = context;
  1931. this.enabled = options.enabled;
  1932. this.id = 'waypoints' + waypointCounter++;
  1933. this.offset = null;
  1934. this.options = options;
  1935. context.waypoints[this.axis][this.id] = this;
  1936. allWaypoints[this.axis][this.id] = this;
  1937. idList = (_ref = this.element[waypointKey]) != null ? _ref : [];
  1938. idList.push(this.id);
  1939. this.element[waypointKey] = idList;
  1940. }
  1941. Waypoint.prototype.trigger = function(args) {
  1942. if (!this.enabled) {
  1943. return;
  1944. }
  1945. if (this.callback != null) {
  1946. this.callback.apply(this.element, args);
  1947. }
  1948. if (this.options.triggerOnce) {
  1949. return this.destroy();
  1950. }
  1951. };
  1952. Waypoint.prototype.disable = function() {
  1953. return this.enabled = false;
  1954. };
  1955. Waypoint.prototype.enable = function() {
  1956. this.context.refresh();
  1957. return this.enabled = true;
  1958. };
  1959. Waypoint.prototype.destroy = function() {
  1960. delete allWaypoints[this.axis][this.id];
  1961. delete this.context.waypoints[this.axis][this.id];
  1962. return this.context.checkEmpty();
  1963. };
  1964. Waypoint.getWaypointsByElement = function(element) {
  1965. var all, ids;
  1966. ids = element[waypointKey];
  1967. if (!ids) {
  1968. return [];
  1969. }
  1970. all = $.extend({}, allWaypoints.horizontal, allWaypoints.vertical);
  1971. return $.map(ids, function(id) {
  1972. return all[id];
  1973. });
  1974. };
  1975. return Waypoint;
  1976. })();
  1977. methods = {
  1978. init: function(f, options) {
  1979. var _ref;
  1980. options = $.extend({}, $.fn[wp].defaults, options);
  1981. if ((_ref = options.handler) == null) {
  1982. options.handler = f;
  1983. }
  1984. this.each(function() {
  1985. var $this, context, contextElement, _ref1;
  1986. $this = $(this);
  1987. contextElement = (_ref1 = options.context) != null ? _ref1 : $.fn[wp].defaults.context;
  1988. if (!$.isWindow(contextElement)) {
  1989. contextElement = $this.closest(contextElement);
  1990. }
  1991. contextElement = $(contextElement);
  1992. context = contexts[contextElement[0][contextKey]];
  1993. if (!context) {
  1994. context = new Context(contextElement);
  1995. }
  1996. return new Waypoint($this, context, options);
  1997. });
  1998. $[wps]('refresh');
  1999. return this;
  2000. },
  2001. disable: function() {
  2002. return methods._invoke.call(this, 'disable');
  2003. },
  2004. enable: function() {
  2005. return methods._invoke.call(this, 'enable');
  2006. },
  2007. destroy: function() {
  2008. return methods._invoke.call(this, 'destroy');
  2009. },
  2010. prev: function(axis, selector) {
  2011. return methods._traverse.call(this, axis, selector, function(stack, index, waypoints) {
  2012. if (index > 0) {
  2013. return stack.push(waypoints[index - 1]);
  2014. }
  2015. });
  2016. },
  2017. next: function(axis, selector) {
  2018. return methods._traverse.call(this, axis, selector, function(stack, index, waypoints) {
  2019. if (index < waypoints.length - 1) {
  2020. return stack.push(waypoints[index + 1]);
  2021. }
  2022. });
  2023. },
  2024. _traverse: function(axis, selector, push) {
  2025. var stack, waypoints;
  2026. if (axis == null) {
  2027. axis = 'vertical';
  2028. }
  2029. if (selector == null) {
  2030. selector = window;
  2031. }
  2032. waypoints = jQMethods.aggregate(selector);
  2033. stack = [];
  2034. this.each(function() {
  2035. var index;
  2036. index = $.inArray(this, waypoints[axis]);
  2037. return push(stack, index, waypoints[axis]);
  2038. });
  2039. return this.pushStack(stack);
  2040. },
  2041. _invoke: function(method) {
  2042. this.each(function() {
  2043. var waypoints;
  2044. waypoints = Waypoint.getWaypointsByElement(this);
  2045. return $.each(waypoints, function(i, waypoint) {
  2046. waypoint[method]();
  2047. return true;
  2048. });
  2049. });
  2050. return this;
  2051. }
  2052. };
  2053. $.fn[wp] = function() {
  2054. var args, method;
  2055. method = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
  2056. if (methods[method]) {
  2057. return methods[method].apply(this, args);
  2058. } else if ($.isFunction(method)) {
  2059. return methods.init.apply(this, arguments);
  2060. } else if ($.isPlainObject(method)) {
  2061. return methods.init.apply(this, [null, method]);
  2062. } else if (!method) {
  2063. return $.error("jQuery Waypoints needs a callback function or handler option.");
  2064. } else {
  2065. return $.error("The " + method + " method does not exist in jQuery Waypoints.");
  2066. }
  2067. };
  2068. $.fn[wp].defaults = {
  2069. context: window,
  2070. continuous: true,
  2071. enabled: true,
  2072. horizontal: false,
  2073. offset: 0,
  2074. triggerOnce: false
  2075. };
  2076. jQMethods = {
  2077. refresh: function() {
  2078. return $.each(contexts, function(i, context) {
  2079. return context.refresh();
  2080. });
  2081. },
  2082. viewportHeight: function() {
  2083. var _ref;
  2084. return (_ref = window.innerHeight) != null ? _ref : $w.height();
  2085. },
  2086. aggregate: function(contextSelector) {
  2087. var collection, waypoints, _ref;
  2088. collection = allWaypoints;
  2089. if (contextSelector) {
  2090. collection = (_ref = contexts[$(contextSelector)[0][contextKey]]) != null ? _ref.waypoints : void 0;
  2091. }
  2092. if (!collection) {
  2093. return [];
  2094. }
  2095. waypoints = {
  2096. horizontal: [],
  2097. vertical: []
  2098. };
  2099. $.each(waypoints, function(axis, arr) {
  2100. $.each(collection[axis], function(key, waypoint) {
  2101. return arr.push(waypoint);
  2102. });
  2103. arr.sort(function(a, b) {
  2104. return a.offset - b.offset;
  2105. });
  2106. waypoints[axis] = $.map(arr, function(waypoint) {
  2107. return waypoint.element;
  2108. });
  2109. return waypoints[axis] = $.unique(waypoints[axis]);
  2110. });
  2111. return waypoints;
  2112. },
  2113. above: function(contextSelector) {
  2114. if (contextSelector == null) {
  2115. contextSelector = window;
  2116. }
  2117. return jQMethods._filter(contextSelector, 'vertical', function(context, waypoint) {
  2118. return waypoint.offset <= context.oldScroll.y;
  2119. });
  2120. },
  2121. below: function(contextSelector) {
  2122. if (contextSelector == null) {
  2123. contextSelector = window;
  2124. }
  2125. return jQMethods._filter(contextSelector, 'vertical', function(context, waypoint) {
  2126. return waypoint.offset > context.oldScroll.y;
  2127. });
  2128. },
  2129. left: function(contextSelector) {
  2130. if (contextSelector == null) {
  2131. contextSelector = window;
  2132. }
  2133. return jQMethods._filter(contextSelector, 'horizontal', function(context, waypoint) {
  2134. return waypoint.offset <= context.oldScroll.x;
  2135. });
  2136. },
  2137. right: function(contextSelector) {
  2138. if (contextSelector == null) {
  2139. contextSelector = window;
  2140. }
  2141. return jQMethods._filter(contextSelector, 'horizontal', function(context, waypoint) {
  2142. return waypoint.offset > context.oldScroll.x;
  2143. });
  2144. },
  2145. enable: function() {
  2146. return jQMethods._invoke('enable');
  2147. },
  2148. disable: function() {
  2149. return jQMethods._invoke('disable');
  2150. },
  2151. destroy: function() {
  2152. return jQMethods._invoke('destroy');
  2153. },
  2154. extendFn: function(methodName, f) {
  2155. return methods[methodName] = f;
  2156. },
  2157. _invoke: function(method) {
  2158. var waypoints;
  2159. waypoints = $.extend({}, allWaypoints.vertical, allWaypoints.horizontal);
  2160. return $.each(waypoints, function(key, waypoint) {
  2161. waypoint[method]();
  2162. return true;
  2163. });
  2164. },
  2165. _filter: function(selector, axis, test) {
  2166. var context, waypoints;
  2167. context = contexts[$(selector)[0][contextKey]];
  2168. if (!context) {
  2169. return [];
  2170. }
  2171. waypoints = [];
  2172. $.each(context.waypoints[axis], function(i, waypoint) {
  2173. if (test(context, waypoint)) {
  2174. return waypoints.push(waypoint);
  2175. }
  2176. });
  2177. waypoints.sort(function(a, b) {
  2178. return a.offset - b.offset;
  2179. });
  2180. return $.map(waypoints, function(waypoint) {
  2181. return waypoint.element;
  2182. });
  2183. }
  2184. };
  2185. $[wps] = function() {
  2186. var args, method;
  2187. method = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
  2188. if (jQMethods[method]) {
  2189. return jQMethods[method].apply(null, args);
  2190. } else {
  2191. return jQMethods.aggregate.call(null, method);
  2192. }
  2193. };
  2194. $[wps].settings = {
  2195. resizeThrottle: 100,
  2196. scrollThrottle: 30
  2197. };
  2198. return $w.on('load.waypoints', function() {
  2199. return $[wps]('refresh');
  2200. });
  2201. });
  2202. }).call(this);
  2203. // ----------------- jQuery Github Embedder ----------------------------- //
  2204. // =========== https://github.com/kirbysayshi/ghembedder =============== //
  2205. // ---------------------------------------------------------------------- //
  2206. !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)});
  2207. ghembedder.autoload();
  2208. ;jQuery(document).ready(function($){
  2209. var i = 0;
  2210. var box_title_png = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAAXCAMAAAAx3e/WAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYxIDY0LjE0MDk0OSwgMjAxMC8xMi8wNy0xMDo1NzowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNS4xIE1hY2ludG9zaCIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDpEQjIyNkJERkM0NjYxMUUxOEFDQzk3ODcxRDkzRjhCRSIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDpEQjIyNkJFMEM0NjYxMUUxOEFDQzk3ODcxRDkzRjhCRSI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOkRCMjI2QkREQzQ2NjExRTE4QUNDOTc4NzFEOTNGOEJFIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOkRCMjI2QkRFQzQ2NjExRTE4QUNDOTc4NzFEOTNGOEJFIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+dka2KgAAAEVQTFRFxMTEyMjI0tLSvb29vr6+zc3Ny8vLxcXFz8/P6enp3t7ex8fH0dHR1NTUw8PDwMDAzs7OvLy8wcHBu7u7v7+/zMzM////budQFwAAABd0Uk5T/////////////////////////////wDmQOZeAAAAcklEQVR42tSQSQ7DMAwD6chOukWs5eX/Ty2coo0T9wOdEzEgdRBuzNmnDofgja52JDyz5TCqUp0O6kfrb4bzSXkRiTviEZZ6JKLMJ5VQ2v8iGbtbfEwXmjFMG0VwdQo10hQNxYqtLMv9O6xvpZ/QeAkwAKjwHiJLaJc3AAAAAElFTkSuQmCC';
  2211. 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==';
  2212. $('.github-widget').each(function(){
  2213. if(i == 0) $('head').append(
  2214. '<style type="text/css">'
  2215. +'.github-box *{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;}'
  2216. +'.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}'
  2217. +'.github-box a{color:#4183c4;border:0;text-decoration:none}'
  2218. +'.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);}'
  2219. +'.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;}'
  2220. +'.github-box .github-box-title h3 .repo{font-weight:bold}'
  2221. +'.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}'
  2222. +'.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}'
  2223. +'.github-box .github-box-title .github-stats .watchers{border-right:1px solid #ddd}'
  2224. +'.github-box .github-box-title .github-stats .forks{background-position:-4px -21px;padding-left:15px}'
  2225. +'.github-box .github-box-content{padding:10px;font-weight:300}'
  2226. +'.github-box .github-box-content p{margin:0}'
  2227. +'.github-box .github-box-content .link{font-weight:bold}'
  2228. +'.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;}'
  2229. +'.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}'
  2230. +'.github-box .github-box-download .updated strong{font-weight:bold;color:#000}'
  2231. +'.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);}'
  2232. +'.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);}'
  2233. +'@media (max-width: 767px) {'
  2234. +'.github-box .github-box-title{height:auto;min-height:60px}'
  2235. +'.github-box .github-box-title h3 .repo{display:block}'
  2236. +'.github-box .github-box-title .github-stats a{display:block;clear:right;float:right;}'
  2237. +'.github-box .github-box-download{height:auto;min-height:46px;}'
  2238. +'.github-box .github-box-download .download{top:32px;}'
  2239. +'}'
  2240. +'</style>'
  2241. );
  2242. i++;
  2243. var $container = $(this), $widget,
  2244. repo = $container.data('repo'),
  2245. vendorName = repo.split('/')[0],
  2246. repoName = repo.split('/')[1],
  2247. vendorUrl = "http://github.com/" + vendorName,
  2248. repoUrl = "http://github.com/" + vendorName + '/' + repoName;
  2249. $widget = $(
  2250. '<div class="github-box repo">'
  2251. +'<div class="github-box-title">'
  2252. +'<h3>'
  2253. +'<a class="owner" href="' + vendorUrl + '" title="' + vendorUrl + '">' + vendorName + '</a>'
  2254. +'/'
  2255. +'<a class="repo" href="' + repoUrl + '" title="' + repoUrl + '">' + repoName + '</a>'
  2256. +'</h3>'
  2257. +'<div class="github-stats">'
  2258. +'<a class="watchers" href="' + repoUrl + '/watchers" title="See watchers">?</a>'
  2259. +'<a class="forks" href="' + repoUrl + '/network/members" title="See forkers">?</a>'
  2260. +'</div>'
  2261. +'</div>'
  2262. +'<div class="github-box-content">'
  2263. +'<p class="description"><span></span> &mdash; <a href="' + repoUrl + '#readme">Read More</a></p>'
  2264. +'<p class="link"></p>'
  2265. +'</div>'
  2266. +'<div class="github-box-download">'
  2267. +'<div class="updated"></div>'
  2268. +'<a class="download" href="' + repoUrl + '/zipball/master" title="Get an archive of this repository">Download as zip</a>'
  2269. +'</div>'
  2270. +'</div>'
  2271. );
  2272. $widget.appendTo($container);
  2273. $.ajax({
  2274. url: 'https://api.github.com/repos/' + repo,
  2275. dataType: 'jsonp',
  2276. success: function(results) {
  2277. var repo = results.data, date, pushed_at = 'unknown';
  2278. if (repo.pushed_at) {
  2279. date = new Date(repo.pushed_at);
  2280. pushed_at = (date.getMonth() + 1) + '-' + date.getDate() + '-' + date.getFullYear();
  2281. }
  2282. $widget.find('.watchers').text(repo.watchers);
  2283. $widget.find('.forks').text(repo.forks);
  2284. $widget.find('.description span').text(repo.description);
  2285. $widget.find('.updated').html('Latest commit to the <strong>' + repo.default_branch + '</strong> branch on ' + pushed_at);
  2286. // Don't show "null" if the repo has no homepage URL.
  2287. if(repo.homepage != null) $widget.find('.link').append($('<a />').attr('href', repo.homepage).text(repo.homepage));
  2288. }
  2289. });
  2290. });
  2291. });