12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840 |
- // ========================== ALL SCRIPTS TOC =============================== //
- // ========== https://github.com/tuupola/jquery_lazyload ==================== //
- // ====== https://github.com/ixisio/bootstrap-touch-carousel ================ //
- // ============ https://github.com/Formstone/Wallpaper ====================== //
- // ========== https://github.com/ccampbell/rainbow ========================== //
- // ============ https://github.com/morr/jquery.appear ======================= //
- // ============ https://github.com/callmenick/Draw-Fill-SVG ================= //
- // ============ https://github.com/mattboldt/typed.js/ ====================== //
- // ============ https://github.com/balupton/jquery-scrollto ================= //
- // ==============https://github.com/matthieua/WOW =========================== //
- // ============ https://github.com/miguel-perez/jquery.smoothState.js ======= //
- // ============ https://github.com/carhartl/jquery-cookie =================== //
- // ======== https://github.com/imakewebthings/jquery-waypoints ============== //
- // ============= https://github.com/kirbysayshi/ghembedder ================= //
- // ============== https://github.com/js-cookie/js-cookie ==================== //
- // --------------------- Lazy Load 1.9.7 ---------------------------------- //
- // ========== https://github.com/tuupola/jquery_lazyload =================== //
- // ------------------------------------------------------------------------- //
- !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);
- // ------------- Touch Carousel Hammer.js ---------------------------------- //
- // ====== https://github.com/ixisio/bootstrap-touch-carousel =============== //
- // ------------------------------------------------------------------------- //
- +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)}();
- // ------------- JQUERY Wallpaper------------------------------------------- //
- // ============ https://github.com/Formstone/Wallpaper ===================== //
- // ------------------------------------------------------------------------- //
- !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);
- // ------------- Rainbow Syntax Highligher ---------------------------------- //
- // ========== https://github.com/ccampbell/rainbow ========================== //
- // -------------------------------------------------------------------------- //
- /* 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 */
- 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>=
- 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=
- 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)&&
- 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,
- "<").replace(/>/g,">").replace(/&(?![\w\#]+;)/g,"&"),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"),
- 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)}}}();
- (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},
- {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:/>|</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},
- {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}],
- !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},
- {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}|~|!|\*|\/|%|(?:<){1,2}|(?:>){1,3}|instanceof|(?:&){1,2}|\^|\|{1,2}|\?|:|(?:=|!|\+|-|\*|\/|%|\^|\||(?:<){1,2}|(?:>){1,3})?=)/g}],
- !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},
- {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",
- 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:/(\/|\/=|&=|&&|&|\|=|\|\|\||\-=|\-\-|\-|\+=|\+\+|\+|<=|<<|<|<<=|<>=|<>|>|>>>=|>>=|>=|>>|>>>|!=|!<>=|!<>|!<=|!<|!>=|!>|!|[|]|\$|==|=|\*=|\*|%=|%|\^\^=|\^=|\^\^|\^|~=|~|@|=>|\:)/gm}],
- !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},
- {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},
- {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},
- 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:/\=|<\-|<-/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:/<-|<-|-|==|<=|<=|>>|>=|<|>|&&|&&|&|&|!=|\|\|?|\*|\+|\^|\/|%%|%\/%|\=|%in%|%\*%|%o%|%x%|\$|:|~|\[{1,2}|\]{1,2}/g},
- {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:/<\?=?(?!xml)(php)?([\s\S]*?)(\?>)/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:/(<\/?)(style.*?)(>)/g},2:{language:"css"},3:"support.tag.style",4:"entity.tag.style",5:"support.tag.style"},pattern:/(<style.*?>)([\s\S]*?)(<\/)(style)(>)/gm},
- {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:/(<\/?)(script.*?)(>)/g},2:{language:"javascript"},3:"support.tag.script",4:"entity.tag.script",5:"support.tag.script"},pattern:/(<script(?! src).*?>)([\s\S]*?)(<\/)(script)(>)/gm},{name:"comment.html",pattern:/<\!--[\S\s]*?-->/g},
- {matches:{1:"support.tag.open",2:"support.tag.close"},pattern:/(<)|(\/?\??>)/g},{name:"support.tag",matches:{1:"support.tag",2:"support.tag.special",3:"support.tag-name"},pattern:/(<\??)(\/|\!?)(\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"},
- pattern:/\s(\w+)(?=\s|>)(?![\s\S]*<)/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},
- {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},
- {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",
- 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,}\((.*?)((-|=)>)/gi},{matches:{1:{name:"function.argument.coffee",pattern:/([\@\w]+)/g},2:"keyword.function"},pattern:/\s\((.*?)\)\s{0,}((-|=)>)/gi},{matches:{1:"entity.name.function",2:"keyword.operator",3:"keyword.function"},pattern:/(\w+)\s{0,}(=|:)\s{0,}((-|=)>)/gi},{matches:{1:"storage.class",
- 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},
- {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},
- {name:"entity.name.binary",pattern:/(<|>|&|[=~\|\\\/!@*\-_+])+/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},
- {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",
- 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:/(\+\+|\+=|\+|--|-=|-|<<=|<<|<=|=>|>>=|>>|>=|!=|!|~|\^|\|\||&&|&=|&|\?\?|::|:|\*=|\*|\/=|%=|\|=|==|=)/g},{name:"preprocessor",pattern:/(\#if|\#else|\#elif|\#endif|\#define|\#undef|\#warning|\#error|\#line|\#region|\#endregion|\#pragma)[\s\S]*?$/gm}],
- !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},
- {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:/<|>|&/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}],
- !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"},
- 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:/(<\?(php)?|\?>)/g},{matches:{1:"keyword.namespace",2:{name:"support.namespace",
- 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},
- {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](?=(\(|\[|\{|<|.)(.*?)(?:'|\)|\]|\}|>|\1))(?:\(\2\)|\[\2\]|\{\2\}|\<\2>|\1\2\1)/g},
- {matches:{1:"string",2:"string",3:"string"},pattern:/(<<)(\w+).*?$([\s\S]*?^\2)/gm},{matches:{1:"string",2:"string",3:"string"},pattern:/(<<\-)(\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(?=(\(|\[|\{|<|.)(.*?)('|\)|\]|\}|>|\1))(?:\(\2\)|\[\2\]|\{\2\}|\<\2>|\1\2\1)([a-z]*)/g},
- {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+<\s+((?:(?:::)?[A-Z]\w*)+))?/g},
- {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},
- {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|=|<<|<<=|%=|&=|\*=|\*\*=|\+=|\-=|\^=|\|{1,2}=|<<|<=>|<(?!<|=)|>(?!<|=|>)|<=|>=|===|==|=~|!=|!~|%|&|\*\*|\*|\+|\-|\/|\||~|>>/g},
- {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:/&/g},{name:"direct-descendant",pattern:/>/g},{name:"entity.name.class",
- 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);
- // ------------- JQUERY APPEAR ---------------------------------------------- //
- // ============ https://github.com/morr/jquery.appear ====================== //
- // -------------------------------------------------------------------------- //
- (function($) {
- var selectors = [];
- var check_binded = false;
- var check_lock = false;
- var defaults = {
- interval: 250,
- force_process: false
- }
- var $window = $(window);
- var $prior_appeared;
- function process() {
- check_lock = false;
- for (var index = 0, selectorsLength = selectors.length; index < selectorsLength; index++) {
- var $appeared = $(selectors[index]).filter(function() {
- return $(this).is(':appeared');
- });
- $appeared.trigger('appear', [$appeared]);
- if ($prior_appeared) {
- var $disappeared = $prior_appeared.not($appeared);
- $disappeared.trigger('disappear', [$disappeared]);
- }
- $prior_appeared = $appeared;
- }
- }
- // "appeared" custom filter
- $.expr[':']['appeared'] = function(element) {
- var $element = $(element);
- if (!$element.is(':visible')) {
- return false;
- }
- var window_left = $window.scrollLeft();
- var window_top = $window.scrollTop();
- var offset = $element.offset();
- var left = offset.left;
- var top = offset.top;
- if (top + $element.height() >= window_top &&
- top - ($element.data('appear-top-offset') || 0) <= window_top + $window.height() &&
- left + $element.width() >= window_left &&
- left - ($element.data('appear-left-offset') || 0) <= window_left + $window.width()) {
- return true;
- } else {
- return false;
- }
- }
- $.fn.extend({
- // watching for element's appearance in browser viewport
- appear: function(options) {
- var opts = $.extend({}, defaults, options || {});
- var selector = this.selector || this;
- if (!check_binded) {
- var on_check = function() {
- if (check_lock) {
- return;
- }
- check_lock = true;
- setTimeout(process, opts.interval);
- };
- $(window).scroll(on_check).resize(on_check);
- check_binded = true;
- }
- if (opts.force_process) {
- setTimeout(process, opts.interval);
- }
- selectors.push(selector);
- return $(selector);
- }
- });
- $.extend({
- // force elements's appearance check
- force_appear: function() {
- if (check_binded) {
- process();
- return true;
- };
- return false;
- }
- });
- })(jQuery);
- // ------------- DRAW FILL SVG ---------------------------------------------- //
- // ============ https://github.com/callmenick/Draw-Fill-SVG ================= //
- // -------------------------------------------------------------------------- //
- (function( window ){
- 'use strict';
- /**
- * Cross browser transition end events
- *
- * Use modernizr to detect cross browser transition end events. Make sure
- * to include Modernizr in your doc and have "Modernizr.prefixed()" checked
- * off in the extensibility section.
- */
- var transEndEventNames = {
- "WebkitTransition" : "webkitTransitionEnd",
- "MozTransition" : "transitionend",
- "OTransition" : "oTransitionEnd",
- "msTransition" : "MSTransitionEnd",
- "transition" : "transitionend"
- },
- transEndEventName = transEndEventNames[ Modernizr.prefixed('transition') ];
- /**
- * Extend obj function
- *
- */
- function extend( a, b ) {
- for( var key in b ) {
- if( b.hasOwnProperty( key ) ) {
- a[key] = b[key];
- }
- }
- return a;
- }
- /**
- * DrawFillSVG constructor
- *
- */
- function DrawFillSVG( options ) {
- this.options = extend( {}, this.options );
- extend( this.options, options );
- this._init();
- }
- /**
- * DrawFillSVG options
- *
- * Available options:
- * elementId - the ID of the element to draw
- */
- DrawFillSVG.prototype.options = {
- elementId : "svg"
- }
- /**
- * DrawFillSVG _init
- *
- * Initialise DrawFillSVG
- */
- DrawFillSVG.prototype._init = function() {
- this.svg = document.getElementById(this.options.elementId);
- this.paths = this.svg.querySelectorAll("path");
- this._initAnimation();
- }
- /**
- * DrawFillSVG _initAnimation()
- *
- * Reset some style properties on our paths, add some transitions, set the
- * stroke-dasharray to the length of the path, and the stroke-dashoffset to
- * the length of the path pushing it out of view initially. Then, set the
- * stroke-dashoffset to 0, animating the strokes in a drawing manner. Then,
- * run the path filler sequence.
- */
- DrawFillSVG.prototype._initAnimation = function() {
- for ( var i = 0; i < this.paths.length; i++ ) {
- var path = this.paths[i];
- var length = path.getTotalLength();
- // reset opacities
- path.style.fillOpacity = 0;
- path.style.strokeOpacity = 1;
- // reset transitions
- path.style.transition = path.style.WebkitTransition = "none";
- // reset stroke dash array and stroke dash offset
- path.style.strokeDasharray = length + " " + length;
- path.style.strokeDashoffset = length;
- path.getBoundingClientRect();
- // apply new transitions
- path.style.transition = path.style.WebkitTransition = "stroke-dashoffset 2s ease-in-out";
- // go baby go
- path.style.strokeDashoffset = 0;
- // fill the path
- this._fillPath( path );
- }
- }
- /**
- * DrawFillSVG _fillPath()
- *
- * Resets the transition props, then fills the path and fades out the stroke
- * by updating the styles.
- */
- DrawFillSVG.prototype._fillPath = function( path ) {
- path.addEventListener( transEndEventName, function() {
- // reset transitions
- path.style.transition = path.style.WebkitTransition = "none";
- path.style.transition = path.style.WebkitTransition = "fill-opacity 1s ease-in-out, stroke-opacity 1s ease-in-out";
- // edit props
- path.style.fillOpacity = 1;
- path.style.strokeOpacity = 0;
- } );
- }
- /**
- * DrawFillSVG replay
- *
- * A public function that allows you to replay the animation if you want. For
- * example, click a button, and replay the animation.
- */
- DrawFillSVG.prototype.replay = function() {
- this._initAnimation();
- }
- /**
- * Add to global namespace
- */
- window.DrawFillSVG = DrawFillSVG;
- })( window );
- // ------------- JQUERY TYPED.JS -------------------------------------------- //
- // ============ https://github.com/mattboldt/typed.js/ ====================== //
- // -------------------------------------------------------------------------- //
- !function($){
- "use strict";
- var Typed = function(el, options){
- // chosen element to manipulate text
- this.el = $(el);
- // options
- this.options = $.extend({}, $.fn.typed.defaults, options);
- // text content of element
- this.baseText = this.el.text() || this.el.attr('placeholder') || '';
- // typing speed
- this.typeSpeed = this.options.typeSpeed;
- // add a delay before typing starts
- this.startDelay = this.options.startDelay;
- // backspacing speed
- this.backSpeed = this.options.backSpeed;
- // amount of time to wait before backspacing
- this.backDelay = this.options.backDelay;
- // input strings of text
- this.strings = this.options.strings;
- // character number position of current string
- this.strPos = 0;
- // current array position
- this.arrayPos = 0;
- // number to stop backspacing on.
- // default 0, can change depending on how many chars
- // you want to remove at the time
- this.stopNum = 0;
- // Looping logic
- this.loop = this.options.loop;
- this.loopCount = this.options.loopCount;
- this.curLoop = 0;
- // for stopping
- this.stop = false;
- // show cursor
- this.showCursor = this.isInput ? false : this.options.showCursor;
- // custom cursor
- this.cursorChar = this.options.cursorChar;
- // attribute to type
- this.isInput = this.el.is('input');
- this.attr = this.options.attr || (this.isInput ? 'placeholder' : null);
- // All systems go!
- this.build();
- };
- Typed.prototype = {
- constructor: Typed
- , init: function(){
- // begin the loop w/ first current string (global self.string)
- // current string will be passed as an argument each time after this
- var self = this;
- self.timeout = setTimeout(function() {
- // Start typing
- self.typewrite(self.strings[self.arrayPos], self.strPos);
- }, self.startDelay);
- }
- , build: function(){
- // Insert cursor
- if (this.showCursor === true){
- this.cursor = $("<span class=\"typed-cursor\">" + this.cursorChar + "</span>");
- this.el.after(this.cursor);
- }
- this.init();
- }
- // pass current string state to each function, types 1 char per call
- , typewrite: function(curString, curStrPos){
- // exit when stopped
- if(this.stop === true)
- return;
- // varying values for setTimeout during typing
- // can't be global since number changes each time loop is executed
- var humanize = Math.round(Math.random() * (100 - 30)) + this.typeSpeed;
- var self = this;
- // ------------- optional ------------- //
- // backpaces a certain string faster
- // ------------------------------------ //
- // if (self.arrayPos == 1){
- // self.backDelay = 50;
- // }
- // else{ self.backDelay = 500; }
- // contain typing function in a timeout humanize'd delay
- self.timeout = setTimeout(function() {
- // check for an escape character before a pause value
- // format: \^\d+ .. eg: ^1000 .. should be able to print the ^ too using ^^
- // single ^ are removed from string
- var charPause = 0;
- var substr = curString.substr(curStrPos);
- if (substr.charAt(0) === '^') {
- var skip = 1; // skip atleast 1
- if(/^\^\d+/.test(substr)) {
- substr = /\d+/.exec(substr)[0];
- skip += substr.length;
- charPause = parseInt(substr);
- }
- // strip out the escape character and pause value so they're not printed
- curString = curString.substring(0,curStrPos)+curString.substring(curStrPos+skip);
- }
- // timeout for any pause after a character
- self.timeout = setTimeout(function() {
- if(curStrPos === curString.length) {
- // fires callback function
- self.options.onStringTyped(self.arrayPos);
- // is this the final string
- if(self.arrayPos === self.strings.length-1) {
- // animation that occurs on the last typed string
- self.options.callback();
- self.curLoop++;
- // quit if we wont loop back
- if(self.loop === false || self.curLoop === self.loopCount)
- return;
- }
- self.timeout = setTimeout(function(){
- self.backspace(curString, curStrPos);
- }, self.backDelay);
- } else {
- /* call before functions if applicable */
- if(curStrPos === 0)
- self.options.preStringTyped(self.arrayPos);
- // start typing each new char into existing string
- // curString: arg, self.baseText: original text inside element
- var nextString = self.baseText + curString.substr(0, curStrPos+1);
- if (self.attr) {
- self.el.attr(self.attr, nextString);
- } else {
- self.el.text(nextString);
- }
- // add characters one by one
- curStrPos++;
- // loop the function
- self.typewrite(curString, curStrPos);
- }
- // end of character pause
- }, charPause);
- // humanized value for typing
- }, humanize);
- }
- , backspace: function(curString, curStrPos){
- // exit when stopped
- if (this.stop === true) {
- return;
- }
- // varying values for setTimeout during typing
- // can't be global since number changes each time loop is executed
- var humanize = Math.round(Math.random() * (100 - 30)) + this.backSpeed;
- var self = this;
- self.timeout = setTimeout(function() {
- // ----- this part is optional ----- //
- // check string array position
- // on the first string, only delete one word
- // the stopNum actually represents the amount of chars to
-
- // ------------- CUSTOM OPTIONS --------------------------------------------- //
- // ========================================================================== //
- // -------------------------------------------------------------------------- //
- if (self.arrayPos == 1) {
- self.stopNum = 17;
- self.backDelay = 500;
- }
- else if (self.arrayPos == 2) {
- self.stopNum = 54;
- }
- else{self.stopNum = 0;}
- // ----- continue important stuff ----- //
- // replace text with base text + typed characters
- var nextString = self.baseText + curString.substr(0, curStrPos);
- if (self.attr) {
- self.el.attr(self.attr, nextString);
- } else {
- self.el.text(nextString);
- }
- // if the number (id of character in current string) is
- // less than the stop number, keep going
- if (curStrPos > self.stopNum){
- // subtract characters one by one
- curStrPos--;
- // loop the function
- self.backspace(curString, curStrPos);
- }
- // if the stop number has been reached, increase
- // array position to next string
- else if (curStrPos <= self.stopNum) {
- self.arrayPos++;
- if(self.arrayPos === self.strings.length) {
- self.arrayPos = 0;
- self.init();
- } else
- self.typewrite(self.strings[self.arrayPos], curStrPos);
- }
- // humanized value for typing
- }, humanize);
- }
- // Start & Stop currently not working
- // , stop: function() {
- // var self = this;
- // self.stop = true;
- // clearInterval(self.timeout);
- // }
- // , start: function() {
- // var self = this;
- // if(self.stop === false)
- // return;
- // this.stop = false;
- // this.init();
- // }
- // Reset and rebuild the element
- , reset: function(){
- var self = this;
- clearInterval(self.timeout);
- var id = this.el.attr('id');
- this.el.after('<span id="' + id + '"/>')
- this.el.remove();
- this.cursor.remove();
- // Send the callback
- self.options.resetCallback();
- }
- };
- $.fn.typed = function (option) {
- return this.each(function () {
- var $this = $(this)
- , data = $this.data('typed')
- , options = typeof option == 'object' && option;
- if (!data) $this.data('typed', (data = new Typed(this, options)));
- if (typeof option == 'string') data[option]();
- });
- };
- $.fn.typed.defaults = {
- strings: ["These are the default values...", "You know what you should do?", "Use your own!", "Have a great day!"],
- // typing speed
- typeSpeed: 0,
- // time before typing starts
- startDelay: 0,
- // backspacing speed
- backSpeed: 0,
- // time before backspacing
- backDelay: 500,
- // loop
- loop: false,
- // false = infinite
- loopCount: false,
- // show cursor
- showCursor: true,
- // character for cursor
- cursorChar: "|",
- // attribute to type (null == text)
- attr: null,
- // call when done callback function
- callback: function() {},
- // starting callback function before each string
- preStringTyped: function() {},
- //callback for every typed string
- onStringTyped: function() {},
- // callback for reset
- resetCallback: function() {}
- };
- }(window.jQuery);
- // ------------- JQUERY SCROLLTO--------------------------------------------- //
- // ============ https://github.com/balupton/jquery-scrollto ================= //
- // -------------------------------------------------------------------------- //
- /*global define:false require:false */
- (function (name, context, definition) {
- if (typeof module != 'undefined' && module.exports) module.exports = definition();
- else if (typeof define == 'function' && define.amd) define(definition);
- else context[name] = definition();
- })('jquery-scrollto', this, function(){
- // Prepare
- var jQuery, $, ScrollTo;
- jQuery = $ = window.jQuery || require('jquery');
- // Fix scrolling animations on html/body on safari
- $.propHooks.scrollTop = $.propHooks.scrollLeft = {
- get: function(elem,prop) {
- var result = null;
- if ( elem.tagName === 'HTML' || elem.tagName === 'BODY' ) {
- if ( prop === 'scrollLeft' ) {
- result = window.scrollX;
- } else if ( prop === 'scrollTop' ) {
- result = window.scrollY;
- }
- }
- if ( result == null ) {
- result = elem[prop];
- }
- return result;
- }
- };
- $.Tween.propHooks.scrollTop = $.Tween.propHooks.scrollLeft = {
- get: function(tween) {
- return $.propHooks.scrollTop.get(tween.elem, tween.prop);
- },
- set: function(tween) {
- // Our safari fix
- if ( tween.elem.tagName === 'HTML' || tween.elem.tagName === 'BODY' ) {
- // Defaults
- tween.options.bodyScrollLeft = (tween.options.bodyScrollLeft || window.scrollX);
- tween.options.bodyScrollTop = (tween.options.bodyScrollTop || window.scrollY);
- // Apply
- if ( tween.prop === 'scrollLeft' ) {
- tween.options.bodyScrollLeft = Math.round(tween.now);
- }
- else if ( tween.prop === 'scrollTop' ) {
- tween.options.bodyScrollTop = Math.round(tween.now);
- }
- // Apply
- window.scrollTo(tween.options.bodyScrollLeft, tween.options.bodyScrollTop);
- }
- // jQuery's IE8 Fix
- else if ( tween.elem.nodeType && tween.elem.parentNode ) {
- tween.elem[ tween.prop ] = tween.now;
- }
- }
- };
- // jQuery ScrollTo
- ScrollTo = {
- // Configuration
- config: {
- duration: 400,
- easing: 'swing',
- callback: undefined,
- durationMode: 'each',
- offsetTop: 0,
- offsetLeft: 0
- },
- // Set Configuration
- configure: function(options){
- // Apply Options to Config
- $.extend(ScrollTo.config, options||{});
- // Chain
- return this;
- },
- // Perform the Scroll Animation for the Collections
- // We use $inline here, so we can determine the actual offset start for each overflow:scroll item
- // Each collection is for each overflow:scroll item
- scroll: function(collections, config){
- // Prepare
- var collection, $container, container, $target, $inline, position, containerTagName,
- containerScrollTop, containerScrollLeft,
- containerScrollTopEnd, containerScrollLeftEnd,
- startOffsetTop, targetOffsetTop, targetOffsetTopAdjusted,
- startOffsetLeft, targetOffsetLeft, targetOffsetLeftAdjusted,
- scrollOptions,
- callback;
- // Determine the Scroll
- collection = collections.pop();
- $container = collection.$container;
- $target = collection.$target;
- containerTagName = $container.prop('tagName');
- // Prepare the Inline Element of the Container
- $inline = $('<span/>').css({
- 'position': 'absolute',
- 'top': '0px',
- 'left': '0px'
- });
- position = $container.css('position');
- // Insert the Inline Element of the Container
- $container.css({position:'relative'});
- $inline.appendTo($container);
- // Determine the top offset
- startOffsetTop = $inline.offset().top;
- targetOffsetTop = $target.offset().top;
- targetOffsetTopAdjusted = targetOffsetTop - startOffsetTop - parseInt(config.offsetTop,10);
- // Determine the left offset
- startOffsetLeft = $inline.offset().left;
- targetOffsetLeft = $target.offset().left;
- targetOffsetLeftAdjusted = targetOffsetLeft - startOffsetLeft - parseInt(config.offsetLeft,10);
- // Determine current scroll positions
- containerScrollTop = $container.prop('scrollTop');
- containerScrollLeft = $container.prop('scrollLeft');
- // Reset the Inline Element of the Container
- $inline.remove();
- $container.css({position:position});
- // Prepare the scroll options
- scrollOptions = {};
- // Prepare the callback
- callback = function(event){
- // Check
- if ( collections.length === 0 ) {
- // Callback
- if ( typeof config.callback === 'function' ) {
- config.callback();
- }
- }
- else {
- // Recurse
- ScrollTo.scroll(collections,config);
- }
- // Return true
- return true;
- };
- // Handle if we only want to scroll if we are outside the viewport
- if ( config.onlyIfOutside ) {
- // Determine current scroll positions
- containerScrollTopEnd = containerScrollTop + $container.height();
- containerScrollLeftEnd = containerScrollLeft + $container.width();
- // Check if we are in the range of the visible area of the container
- if ( containerScrollTop < targetOffsetTopAdjusted && targetOffsetTopAdjusted < containerScrollTopEnd ) {
- targetOffsetTopAdjusted = containerScrollTop;
- }
- if ( containerScrollLeft < targetOffsetLeftAdjusted && targetOffsetLeftAdjusted < containerScrollLeftEnd ) {
- targetOffsetLeftAdjusted = containerScrollLeft;
- }
- }
- // Determine the scroll options
- if ( targetOffsetTopAdjusted !== containerScrollTop ) {
- scrollOptions.scrollTop = targetOffsetTopAdjusted;
- }
- if ( targetOffsetLeftAdjusted !== containerScrollLeft ) {
- scrollOptions.scrollLeft = targetOffsetLeftAdjusted;
- }
- // Check to see if the scroll is necessary
- if ( $container.prop('scrollHeight') === $container.width() ) {
- delete scrollOptions.scrollTop;
- }
- if ( $container.prop('scrollWidth') === $container.width() ) {
- delete scrollOptions.scrollLeft;
- }
- // Perform the scroll
- if ( scrollOptions.scrollTop != null || scrollOptions.scrollLeft != null ) {
- $container.animate(scrollOptions, {
- duration: config.duration,
- easing: config.easing,
- complete: callback
- });
- }
- else {
- callback();
- }
- // Return true
- return true;
- },
- // ScrollTo the Element using the Options
- fn: function(options){
- // Prepare
- var collections, config, $container, container;
- collections = [];
- // Prepare
- var $target = $(this);
- if ( $target.length === 0 ) {
- // Chain
- return this;
- }
- // Handle Options
- config = $.extend({},ScrollTo.config,options);
- // Fetch
- $container = $target.parent();
- container = $container.get(0);
- // Cycle through the containers
- while ( ($container.length === 1) && (container !== document.body) && (container !== document) ) {
- // Check Container for scroll differences
- var containerScrollTop, containerScrollLeft;
- containerScrollTop = $container.css('overflow-y') !== 'visible' && container.scrollHeight !== container.clientHeight;
- containerScrollLeft = $container.css('overflow-x') !== 'visible' && container.scrollWidth !== container.clientWidth;
- if ( containerScrollTop || containerScrollLeft ) {
- // Push the Collection
- collections.push({
- '$container': $container,
- '$target': $target
- });
- // Update the Target
- $target = $container;
- }
- // Update the Container
- $container = $container.parent();
- container = $container.get(0);
- }
- // Add the final collection
- collections.push({
- '$container': $('html'),
- // document.body doesn't work in firefox, html works for all
- // internet explorer starts at the beggining
- '$target': $target
- });
- // Adjust the Config
- if ( config.durationMode === 'all' ) {
- config.duration /= collections.length;
- }
- // Handle
- ScrollTo.scroll(collections,config);
- // Chain
- return this;
- }
- };
- // Apply our extensions to jQuery
- $.ScrollTo = $.ScrollTo || ScrollTo;
- $.fn.ScrollTo = $.fn.ScrollTo || ScrollTo.fn;
- // Export
- return ScrollTo;
- });
- // ------------- WOW ANIMATE ------------------------------------------------ //
- // ==============https://github.com/matthieua/WOW =========================== //
- // -------------------------------------------------------------------------- //
- (function() {
- var MutationObserver, Util, WeakMap, getComputedStyle, getComputedStyleRX,
- __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
- __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; };
- Util = (function() {
- function Util() {}
- Util.prototype.extend = function(custom, defaults) {
- var key, value;
- for (key in defaults) {
- value = defaults[key];
- if (custom[key] == null) {
- custom[key] = value;
- }
- }
- return custom;
- };
- Util.prototype.isMobile = function(agent) {
- return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(agent);
- };
- Util.prototype.addEvent = function(elem, event, fn) {
- if (elem.addEventListener != null) {
- return elem.addEventListener(event, fn, false);
- } else if (elem.attachEvent != null) {
- return elem.attachEvent("on" + event, fn);
- } else {
- return elem[event] = fn;
- }
- };
- Util.prototype.removeEvent = function(elem, event, fn) {
- if (elem.removeEventListener != null) {
- return elem.removeEventListener(event, fn, false);
- } else if (elem.detachEvent != null) {
- return elem.detachEvent("on" + event, fn);
- } else {
- return delete elem[event];
- }
- };
- Util.prototype.innerHeight = function() {
- if ('innerHeight' in window) {
- return window.innerHeight;
- } else {
- return document.documentElement.clientHeight;
- }
- };
- return Util;
- })();
- WeakMap = this.WeakMap || this.MozWeakMap || (WeakMap = (function() {
- function WeakMap() {
- this.keys = [];
- this.values = [];
- }
- WeakMap.prototype.get = function(key) {
- var i, item, _i, _len, _ref;
- _ref = this.keys;
- for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) {
- item = _ref[i];
- if (item === key) {
- return this.values[i];
- }
- }
- };
- WeakMap.prototype.set = function(key, value) {
- var i, item, _i, _len, _ref;
- _ref = this.keys;
- for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) {
- item = _ref[i];
- if (item === key) {
- this.values[i] = value;
- return;
- }
- }
- this.keys.push(key);
- return this.values.push(value);
- };
- return WeakMap;
- })());
- MutationObserver = this.MutationObserver || this.WebkitMutationObserver || this.MozMutationObserver || (MutationObserver = (function() {
- function MutationObserver() {
- if (typeof console !== "undefined" && console !== null) {
- console.warn('MutationObserver is not supported by your browser.');
- }
- if (typeof console !== "undefined" && console !== null) {
- console.warn('WOW.js cannot detect dom mutations, please call .sync() after loading new content.');
- }
- }
- MutationObserver.notSupported = true;
- MutationObserver.prototype.observe = function() {};
- return MutationObserver;
- })());
- getComputedStyle = this.getComputedStyle || function(el, pseudo) {
- this.getPropertyValue = function(prop) {
- var _ref;
- if (prop === 'float') {
- prop = 'styleFloat';
- }
- if (getComputedStyleRX.test(prop)) {
- prop.replace(getComputedStyleRX, function(_, char) {
- return char.toUpperCase();
- });
- }
- return ((_ref = el.currentStyle) != null ? _ref[prop] : void 0) || null;
- };
- return this;
- };
- getComputedStyleRX = /(\-([a-z]){1})/g;
- this.WOW = (function() {
- WOW.prototype.defaults = {
- boxClass: 'wow',
- animateClass: 'animated',
- offset: 0,
- mobile: true,
- live: true
- };
- function WOW(options) {
- if (options == null) {
- options = {};
- }
- this.scrollCallback = __bind(this.scrollCallback, this);
- this.scrollHandler = __bind(this.scrollHandler, this);
- this.start = __bind(this.start, this);
- this.scrolled = true;
- this.config = this.util().extend(options, this.defaults);
- this.animationNameCache = new WeakMap();
- }
- WOW.prototype.init = function() {
- var _ref;
- this.element = window.document.documentElement;
- if ((_ref = document.readyState) === "interactive" || _ref === "complete") {
- this.start();
- } else {
- this.util().addEvent(document, 'DOMContentLoaded', this.start);
- }
- return this.finished = [];
- };
- WOW.prototype.start = function() {
- var box, _i, _len, _ref;
- this.stopped = false;
- this.boxes = (function() {
- var _i, _len, _ref, _results;
- _ref = this.element.querySelectorAll("." + this.config.boxClass);
- _results = [];
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- box = _ref[_i];
- _results.push(box);
- }
- return _results;
- }).call(this);
- this.all = (function() {
- var _i, _len, _ref, _results;
- _ref = this.boxes;
- _results = [];
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- box = _ref[_i];
- _results.push(box);
- }
- return _results;
- }).call(this);
- if (this.boxes.length) {
- if (this.disabled()) {
- this.resetStyle();
- } else {
- _ref = this.boxes;
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- box = _ref[_i];
- this.applyStyle(box, true);
- }
- this.util().addEvent(window, 'scroll', this.scrollHandler);
- this.util().addEvent(window, 'resize', this.scrollHandler);
- this.interval = setInterval(this.scrollCallback, 50);
- }
- }
- if (this.config.live) {
- return new MutationObserver((function(_this) {
- return function(records) {
- var node, record, _j, _len1, _results;
- _results = [];
- for (_j = 0, _len1 = records.length; _j < _len1; _j++) {
- record = records[_j];
- _results.push((function() {
- var _k, _len2, _ref1, _results1;
- _ref1 = record.addedNodes || [];
- _results1 = [];
- for (_k = 0, _len2 = _ref1.length; _k < _len2; _k++) {
- node = _ref1[_k];
- _results1.push(this.doSync(node));
- }
- return _results1;
- }).call(_this));
- }
- return _results;
- };
- })(this)).observe(document.body, {
- childList: true,
- subtree: true
- });
- }
- };
- WOW.prototype.stop = function() {
- this.stopped = true;
- this.util().removeEvent(window, 'scroll', this.scrollHandler);
- this.util().removeEvent(window, 'resize', this.scrollHandler);
- if (this.interval != null) {
- return clearInterval(this.interval);
- }
- };
- WOW.prototype.sync = function(element) {
- if (MutationObserver.notSupported) {
- return this.doSync(this.element);
- }
- };
- WOW.prototype.doSync = function(element) {
- var box, _i, _len, _ref, _results;
- if (element == null) {
- element = this.element;
- }
- if (element.nodeType !== 1) {
- return;
- }
- element = element.parentNode || element;
- _ref = element.querySelectorAll("." + this.config.boxClass);
- _results = [];
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- box = _ref[_i];
- if (__indexOf.call(this.all, box) < 0) {
- this.boxes.push(box);
- this.all.push(box);
- if (this.stopped || this.disabled()) {
- this.resetStyle();
- } else {
- this.applyStyle(box, true);
- }
- _results.push(this.scrolled = true);
- } else {
- _results.push(void 0);
- }
- }
- return _results;
- };
- WOW.prototype.show = function(box) {
- this.applyStyle(box);
- return box.className = "" + box.className + " " + this.config.animateClass;
- };
- WOW.prototype.applyStyle = function(box, hidden) {
- var delay, duration, iteration;
- duration = box.getAttribute('data-wow-duration');
- delay = box.getAttribute('data-wow-delay');
- iteration = box.getAttribute('data-wow-iteration');
- return this.animate((function(_this) {
- return function() {
- return _this.customStyle(box, hidden, duration, delay, iteration);
- };
- })(this));
- };
- WOW.prototype.animate = (function() {
- if ('requestAnimationFrame' in window) {
- return function(callback) {
- return window.requestAnimationFrame(callback);
- };
- } else {
- return function(callback) {
- return callback();
- };
- }
- })();
- WOW.prototype.resetStyle = function() {
- var box, _i, _len, _ref, _results;
- _ref = this.boxes;
- _results = [];
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- box = _ref[_i];
- _results.push(box.style.visibility = 'visible');
- }
- return _results;
- };
- WOW.prototype.customStyle = function(box, hidden, duration, delay, iteration) {
- if (hidden) {
- this.cacheAnimationName(box);
- }
- box.style.visibility = hidden ? 'hidden' : 'visible';
- if (duration) {
- this.vendorSet(box.style, {
- animationDuration: duration
- });
- }
- if (delay) {
- this.vendorSet(box.style, {
- animationDelay: delay
- });
- }
- if (iteration) {
- this.vendorSet(box.style, {
- animationIterationCount: iteration
- });
- }
- this.vendorSet(box.style, {
- animationName: hidden ? 'none' : this.cachedAnimationName(box)
- });
- return box;
- };
- WOW.prototype.vendors = ["moz", "webkit"];
- WOW.prototype.vendorSet = function(elem, properties) {
- var name, value, vendor, _results;
- _results = [];
- for (name in properties) {
- value = properties[name];
- elem["" + name] = value;
- _results.push((function() {
- var _i, _len, _ref, _results1;
- _ref = this.vendors;
- _results1 = [];
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- vendor = _ref[_i];
- _results1.push(elem["" + vendor + (name.charAt(0).toUpperCase()) + (name.substr(1))] = value);
- }
- return _results1;
- }).call(this));
- }
- return _results;
- };
- WOW.prototype.vendorCSS = function(elem, property) {
- var result, style, vendor, _i, _len, _ref;
- style = getComputedStyle(elem);
- result = style.getPropertyCSSValue(property);
- _ref = this.vendors;
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- vendor = _ref[_i];
- result = result || style.getPropertyCSSValue("-" + vendor + "-" + property);
- }
- return result;
- };
- WOW.prototype.animationName = function(box) {
- var animationName;
- try {
- animationName = this.vendorCSS(box, 'animation-name').cssText;
- } catch (_error) {
- animationName = getComputedStyle(box).getPropertyValue('animation-name');
- }
- if (animationName === 'none') {
- return '';
- } else {
- return animationName;
- }
- };
- WOW.prototype.cacheAnimationName = function(box) {
- return this.animationNameCache.set(box, this.animationName(box));
- };
- WOW.prototype.cachedAnimationName = function(box) {
- return this.animationNameCache.get(box);
- };
- WOW.prototype.scrollHandler = function() {
- return this.scrolled = true;
- };
- WOW.prototype.scrollCallback = function() {
- var box;
- if (this.scrolled) {
- this.scrolled = false;
- this.boxes = (function() {
- var _i, _len, _ref, _results;
- _ref = this.boxes;
- _results = [];
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- box = _ref[_i];
- if (!(box)) {
- continue;
- }
- if (this.isVisible(box)) {
- this.show(box);
- continue;
- }
- _results.push(box);
- }
- return _results;
- }).call(this);
- if (!(this.boxes.length || this.config.live)) {
- return this.stop();
- }
- }
- };
- WOW.prototype.offsetTop = function(element) {
- var top;
- while (element.offsetTop === void 0) {
- element = element.parentNode;
- }
- top = element.offsetTop;
- while (element = element.offsetParent) {
- top += element.offsetTop;
- }
- return top;
- };
- WOW.prototype.isVisible = function(box) {
- var bottom, offset, top, viewBottom, viewTop;
- offset = box.getAttribute('data-wow-offset') || this.config.offset;
- viewTop = window.pageYOffset;
- viewBottom = viewTop + Math.min(this.element.clientHeight, this.util().innerHeight()) - offset;
- top = this.offsetTop(box);
- bottom = top + box.clientHeight;
- return top <= viewBottom && bottom >= viewTop;
- };
- WOW.prototype.util = function() {
- return this._util != null ? this._util : this._util = new Util();
- };
- WOW.prototype.disabled = function() {
- return !this.config.mobile && this.util().isMobile(navigator.userAgent);
- };
- return WOW;
- })();
- }).call(this);
- // ------------- JQUERY SMOOTHSTATE ----------------------------------------- //
- // ============ https://github.com/miguel-perez/jquery.smoothState.js ======= //
- // -------------------------------------------------------------------------- //
- ;(function ( $, window, document, undefined ) {
- "use strict";
- var
- /** Used later to scroll page to the top */
- $body = $("html, body"),
-
- /** Used in development mode to console out useful warnings */
- consl = (window.console || false),
-
- /** Plugin default options */
- defaults = {
- /** jquery element string to specify which anchors smoothstate should bind to */
- anchors : "a",
- /** If set to true, smoothState will prefetch a link's contents on hover */
- prefetch : false,
-
- /** A selecor that deinfes with links should be ignored by smoothState */
- blacklist : ".no-smoothstate, [target]",
-
- /** If set to true, smoothState will log useful debug information instead of aborting */
- development : false,
-
- /** The number of pages smoothState will try to store in memory and not request again */
- pageCacheSize : 0,
-
- /** A function that can be used to alter urls before they are used to request content */
- alterRequestUrl : function (url) {
- return url;
- },
-
- /** Run when a link has been activated */
- onStart : {
- duration: 0,
- render: function (url, $container) {
- $body.scrollTop(0);
- }
- },
- /** Run if the page request is still pending and onStart has finished animating */
- onProgress : {
- duration: 0,
- render: function (url, $container) {
- $body.css("cursor", "wait");
- $body.find("a").css("cursor", "wait");
- }
- },
- /** Run when requested content is ready to be injected into the page */
- onEnd : {
- duration: 0,
- render: function (url, $container, $content) {
- $body.css("cursor", "auto");
- $body.find("a").css("cursor", "auto");
- $container.html($content);
- }
- },
- /** Run when content has been injected and all animations are complete */
- callback : function(url, $container, $content) {
- }
- },
-
- /** Utility functions that are decoupled from SmoothState */
- utility = {
- /**
- * Checks to see if the url is external
- * @param {string} url - url being evaluated
- * @see http://stackoverflow.com/questions/6238351/fastest-way-to-detect-external-urls
- *
- */
- isExternal: function (url) {
- var match = url.match(/^([^:\/?#]+:)?(?:\/\/([^\/?#]*))?([^?#]+)?(\?[^#]*)?(#.*)?/);
- if (typeof match[1] === "string" && match[1].length > 0 && match[1].toLowerCase() !== window.location.protocol) {
- return true;
- }
- if (typeof match[2] === "string" && match[2].length > 0 && match[2].replace(new RegExp(":(" + {"http:": 80, "https:": 443}[window.location.protocol] + ")?$"), "") !== window.location.host) {
- return true;
- }
- return false;
- },
- /**
- * Checks to see if the url is an internal hash
- * @param {string} url - url being evaluated
- *
- */
- isHash: function (url) {
- var hasPathname = (url.indexOf(window.location.pathname) > 0) ? true : false,
- hasHash = (url.indexOf("#") > 0) ? true : false;
- return (hasPathname && hasHash) ? true : false;
- },
- /**
- * Checks to see if we should be loading this URL
- * @param {string} url - url being evaluated
- * @param {string} blacklist - jquery selector
- *
- */
- shouldLoad: function ($anchor, blacklist) {
- var url = $anchor.prop("href");
- // URL will only be loaded if it"s not an external link, hash, or blacklisted
- return (!utility.isExternal(url) && !utility.isHash(url) && !$anchor.is(blacklist));
- },
- /**
- * Prevents jQuery from stripping elements from $(html)
- * @param {string} url - url being evaluated
- * @author Ben Alman http://benalman.com/
- * @see https://gist.github.com/cowboy/742952
- *
- */
- htmlDoc: function (html) {
- var parent,
- elems = $(),
- matchTag = /<(\/?)(html|head|body|title|base|meta)(\s+[^>]*)?>/ig,
- prefix = "ss" + Math.round(Math.random() * 100000),
- htmlParsed = html.replace(matchTag, function(tag, slash, name, attrs) {
- var obj = {};
- if (!slash) {
- elems = elems.add("<" + name + "/>");
- if (attrs) {
- $.each($("<div" + attrs + "/>")[0].attributes, function(i, attr) {
- obj[attr.name] = attr.value;
- });
- }
- elems.eq(-1).attr(obj);
- }
- return "<" + slash + "div" + (slash ? "" : " id='" + prefix + (elems.length - 1) + "'") + ">";
- });
- // If no placeholder elements were necessary, just return normal
- // jQuery-parsed HTML.
- if (!elems.length) {
- return $(html);
- }
- // Create parent node if it hasn"t been created yet.
- if (!parent) {
- parent = $("<div/>");
- }
- // Create the parent node and append the parsed, place-held HTML.
- parent.html(htmlParsed);
-
- // Replace each placeholder element with its intended element.
- $.each(elems, function(i) {
- var elem = parent.find("#" + prefix + i).before(elems[i]);
- elems.eq(i).html(elem.contents());
- elem.remove();
- });
- return parent.children().unwrap();
- },
- /**
- * Resets an object if it has too many properties
- *
- * This is used to clear the "cache" object that stores
- * all of the html. This would prevent the client from
- * running out of memory and allow the user to hit the
- * server for a fresh copy of the content.
- *
- * @param {object} obj
- * @param {number} cap
- *
- */
- clearIfOverCapacity: function (obj, cap) {
- // Polyfill Object.keys if it doesn"t exist
- if (!Object.keys) {
- Object.keys = function (obj) {
- var keys = [],
- k;
- for (k in obj) {
- if (Object.prototype.hasOwnProperty.call(obj, k)) {
- keys.push(k);
- }
- }
- return keys;
- };
- }
- if (Object.keys(obj).length > cap) {
- obj = {};
- }
- return obj;
- },
- /**
- * Finds the inner content of an element, by an ID, from a jQuery object
- * @param {string} id
- * @param {object} $html
- *
- */
- getContentById: function (id, $html) {
- $html = ($html instanceof jQuery) ? $html : utility.htmlDoc($html);
- var $insideElem = $html.find(id),
- updatedContainer = ($insideElem.length) ? $.trim($insideElem.html()) : $html.filter(id).html(),
- newContent = (updatedContainer.length) ? $(updatedContainer) : null;
- return newContent;
- },
- /**
- * Stores html content as jquery object in given object
- * @param {object} object - object contents will be stored into
- * @param {string} url - url to be used as the prop
- * @param {jquery} html - contents to store
- *
- */
- storePageIn: function (object, url, $html) {
- $html = ($html instanceof jQuery) ? $html : utility.htmlDoc($html);
- object[url] = { // Content is indexed by the url
- status: "loaded",
- title: $html.find("title").text(), // Stores the title of the page
- html: $html // Stores the contents of the page
- };
- return object;
- },
- /**
- * Triggers an "allanimationend" event when all animations are complete
- * @param {object} $element - jQuery object that should trigger event
- * @param {string} resetOn - which other events to trigger allanimationend on
- *
- */
- triggerAllAnimationEndEvent: function ($element, resetOn) {
- resetOn = " " + resetOn || "";
- var animationCount = 0,
- animationstart = "animationstart webkitAnimationStart oanimationstart MSAnimationStart",
- animationend = "animationend webkitAnimationEnd oanimationend MSAnimationEnd",
- eventname = "allanimationend",
- onAnimationStart = function (e) {
- if ($(e.delegateTarget).is($element)) {
- e.stopPropagation();
- animationCount ++;
- }
- },
- onAnimationEnd = function (e) {
- if ($(e.delegateTarget).is($element)) {
- e.stopPropagation();
- animationCount --;
- if(animationCount === 0) {
- $element.trigger(eventname);
- }
- }
- };
- $element.on(animationstart, onAnimationStart);
- $element.on(animationend, onAnimationEnd);
- $element.on("allanimationend" + resetOn, function(){
- animationCount = 0;
- utility.redraw($element);
- });
- },
- /** Forces browser to redraw elements */
- redraw: function ($element) {
- $element.height(0);
- setTimeout(function(){$element.height("auto");}, 0);
- }
- },
- /** Handles the popstate event, like when the user hits "back" */
- onPopState = function ( e ) {
- if(e.state !== null) {
- var url = window.location.href,
- $page = $("#" + e.state.id),
- page = $page.data("smoothState");
-
- if(page.href !== url && !utility.isHash(url)) {
- page.load(url, true);
- }
- }
- },
- /** Constructor function */
- SmoothState = function ( element, options ) {
- var
- /** Container element smoothState is run on */
- $container = $(element),
-
- /** Variable that stores pages after they are requested */
- cache = {},
-
- /** Url of the content that is currently displayed */
- currentHref = window.location.href,
- /**
- * Loads the contents of a url into our container
- *
- * @param {string} url
- * @param {bool} isPopped - used to determine if whe should
- * add a new item into the history object
- *
- */
- load = function (url, isPopped) {
-
- /** Makes this an optional variable by setting a default */
- isPopped = isPopped || false;
- var
- /** Used to check if the onProgress function has been run */
- hasRunCallback = false,
- callbBackEnded = false,
-
- /** List of responses for the states of the page request */
- responses = {
- /** Page is ready, update the content */
- loaded: function() {
- var eventName = hasRunCallback ? "ss.onProgressEnd" : "ss.onStartEnd";
- if(!callbBackEnded || !hasRunCallback) {
- $container.one(eventName, function(){
- updateContent(url);
- });
- } else if(callbBackEnded) {
- updateContent(url);
- }
- if(!isPopped) {
- window.history.pushState({ id: $container.prop("id") }, cache[url].title, url);
- }
- },
- /** Loading, wait 10 ms and check again */
- fetching: function() {
-
- if(!hasRunCallback) {
-
- hasRunCallback = true;
-
- // Run the onProgress callback and set trigger
- $container.one("ss.onStartEnd", function(){
- options.onProgress.render(url, $container, null);
-
- setTimeout(function(){
- $container.trigger("ss.onProgressEnd");
- callbBackEnded = true;
- }, options.onStart.duration);
-
- });
- }
-
- setTimeout(function () {
- // Might of been canceled, better check!
- if(cache.hasOwnProperty(url)){
- responses[cache[url].status]();
- }
- }, 10);
- },
- /** Error, abort and redirect */
- error: function(){
- window.location = url;
- }
- };
-
- if (!cache.hasOwnProperty(url)) {
- fetch(url);
- }
-
- // Run the onStart callback and set trigger
- options.onStart.render(url, $container, null);
- setTimeout(function(){
- $container.trigger("ss.onStartEnd");
- }, options.onStart.duration);
- // Start checking for the status of content
- responses[cache[url].status]();
- },
- /** Updates the contents from cache[url] */
- updateContent = function (url) {
- // If the content has been requested and is done:
- var containerId = "#" + $container.prop("id"),
- $content = cache[url] ? utility.getContentById(containerId, cache[url].html) : null;
- if($content) {
- document.title = cache[url].title;
- $container.data("smoothState").href = url;
-
- // Call the onEnd callback and set trigger
- options.onEnd.render(url, $container, $content);
- $container.one("ss.onEndEnd", function(){
- options.callback(url, $container, $content);
- });
- setTimeout(function(){
- $container.trigger("ss.onEndEnd");
- }, options.onEnd.duration);
- } else if (!$content && options.development && consl) {
- // Throw warning to help debug in development mode
- consl.warn("No element with an id of " + containerId + " in response from " + url + " in " + cache);
- } else {
- // No content availble to update with, aborting...
- window.location = url;
- }
- },
- /**
- * Fetches the contents of a url and stores it in the "cache" varible
- * @param {string} url
- *
- */
- fetch = function (url) {
- // Don"t fetch we have the content already
- if(cache.hasOwnProperty(url)) {
- return;
- }
- cache = utility.clearIfOverCapacity(cache, options.pageCacheSize);
-
- cache[url] = { status: "fetching" };
- var requestUrl = options.alterRequestUrl(url) || url,
- request = $.ajax(requestUrl);
- // Store contents in cache variable if successful
- request.success(function (html) {
- // Clear cache varible if it"s getting too big
- utility.storePageIn(cache, url, html);
- $container.data("smoothState").cache = cache;
- });
- // Mark as error
- request.error(function () {
- cache[url].status = "error";
- });
- },
- /**
- * Binds to the hover event of a link, used for prefetching content
- *
- * @param {object} event
- *
- */
- hoverAnchor = function (event) {
- var $anchor = $(event.currentTarget),
- url = $anchor.prop("href");
- if (utility.shouldLoad($anchor, options.blacklist)) {
- event.stopPropagation();
- fetch(url);
- }
- },
- /**
- * Binds to the click event of a link, used to show the content
- *
- * @param {object} event
- *
- */
- clickAnchor = function (event) {
- var $anchor = $(event.currentTarget),
- url = $anchor.prop("href");
- // Ctrl (or Cmd) + click must open a new tab
- if (!event.metaKey && !event.ctrlKey && utility.shouldLoad($anchor, options.blacklist)) {
- // stopPropagation so that event doesn"t fire on parent containers.
- event.stopPropagation();
- event.preventDefault();
- load(url);
- }
- },
- /**
- * Binds all events and inits functionality
- *
- * @param {object} event
- *
- */
- bindEventHandlers = function ($element) {
- //@todo: Handle form submissions
- $element.on("click", options.anchors, clickAnchor);
- if (options.prefetch) {
- $element.on("mouseover touchstart", options.anchors, hoverAnchor);
- }
- },
- /** Used to restart css animations with a class */
- toggleAnimationClass = function (classname) {
- var classes = $container.addClass(classname).prop("class");
-
- $container.removeClass(classes);
-
- setTimeout(function(){
- $container.addClass(classes);
- },0);
- $container.one("ss.onStartEnd ss.onProgressEnd ss.onEndEnd", function(){
- $container.removeClass(classname);
- });
-
- };
- /** Override defaults with options passed in */
- options = $.extend(defaults, options);
- /** Sets a default state */
- if(window.history.state === null) {
- window.history.replaceState({ id: $container.prop("id") }, document.title, currentHref);
- }
- /** Stores the current page in cache variable */
- utility.storePageIn(cache, currentHref, document.documentElement.outerHTML);
- /** Bind all of the event handlers on the container, not anchors */
- utility.triggerAllAnimationEndEvent($container, "ss.onStartEnd ss.onProgressEnd ss.onEndEnd");
- /** Bind all of the event handlers on the container, not anchors */
- bindEventHandlers($container);
- /** Public methods */
- return {
- href: currentHref,
- cache: cache,
- load: load,
- fetch: fetch,
- toggleAnimationClass: toggleAnimationClass
- };
- },
- /** Returns elements with SmoothState attached to it */
- declareSmoothState = function ( options ) {
- return this.each(function () {
- // Checks to make sure the smoothState element has an id and isn"t already bound
- if(this.id && !$.data(this, "smoothState")) {
- // Makes public methods available via $("element").data("smoothState");
- $.data(this, "smoothState", new SmoothState(this, options));
- } else if (!this.id && consl) {
- // Throw warning if in development mode
- consl.warn("Every smoothState container needs an id but the following one does not have one:", this);
- }
- });
- };
- /** Sets the popstate function */
- window.onpopstate = onPopState;
- /** Makes utility functions public for unit tests */
- $.smoothStateUtility = utility;
- /** Defines the smoothState plugin */
- $.fn.smoothState = declareSmoothState;
- })(jQuery, window, document);
- // ------------- jQuery Cookie Plugin v1.4.1 -------------------------------- //
- // ============ https://github.com/carhartl/jquery-cookie =================== //
- // -------------------------------------------------------------------------- //
- (function (factory) {
- if (typeof define === 'function' && define.amd) {
- // AMD
- define(['jquery'], factory);
- } else if (typeof exports === 'object') {
- // CommonJS
- factory(require('jquery'));
- } else {
- // Browser globals
- factory(jQuery);
- }
- }(function ($) {
- var pluses = /\+/g;
- function encode(s) {
- return config.raw ? s : encodeURIComponent(s);
- }
- function decode(s) {
- return config.raw ? s : decodeURIComponent(s);
- }
- function stringifyCookieValue(value) {
- return encode(config.json ? JSON.stringify(value) : String(value));
- }
- function parseCookieValue(s) {
- if (s.indexOf('"') === 0) {
- // This is a quoted cookie as according to RFC2068, unescape...
- s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
- }
- try {
- // Replace server-side written pluses with spaces.
- // If we can't decode the cookie, ignore it, it's unusable.
- // If we can't parse the cookie, ignore it, it's unusable.
- s = decodeURIComponent(s.replace(pluses, ' '));
- return config.json ? JSON.parse(s) : s;
- } catch(e) {}
- }
- function read(s, converter) {
- var value = config.raw ? s : parseCookieValue(s);
- return $.isFunction(converter) ? converter(value) : value;
- }
- var config = $.cookie = function (key, value, options) {
- // Write
- if (arguments.length > 1 && !$.isFunction(value)) {
- options = $.extend({}, config.defaults, options);
- if (typeof options.expires === 'number') {
- var days = options.expires, t = options.expires = new Date();
- t.setTime(+t + days * 864e+5);
- }
- return (document.cookie = [
- encode(key), '=', stringifyCookieValue(value),
- options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
- options.path ? '; path=' + options.path : '',
- options.domain ? '; domain=' + options.domain : '',
- options.secure ? '; secure' : ''
- ].join(''));
- }
- // Read
- var result = key ? undefined : {};
- // To prevent the for loop in the first place assign an empty array
- // in case there are no cookies at all. Also prevents odd result when
- // calling $.cookie().
- var cookies = document.cookie ? document.cookie.split('; ') : [];
- for (var i = 0, l = cookies.length; i < l; i++) {
- var parts = cookies[i].split('=');
- var name = decode(parts.shift());
- var cookie = parts.join('=');
- if (key && key === name) {
- // If second argument (value) is a function it's a converter...
- result = read(cookie, value);
- break;
- }
- // Prevent storing a cookie that we couldn't decode.
- if (!key && (cookie = read(cookie)) !== undefined) {
- result[name] = cookie;
- }
- }
- return result;
- };
- config.defaults = {};
- $.removeCookie = function (key, options) {
- if ($.cookie(key) === undefined) {
- return false;
- }
- // Must not alter options, thus extending a fresh object...
- $.cookie(key, '', $.extend({}, options, { expires: -1 }));
- return !$.cookie(key);
- };
- }));
- // ----------------- jQuery Waypoints v2.0.5 -------------------------------- //
- // ======== https://github.com/imakewebthings/jquery-waypoints ============== //
- // -------------------------------------------------------------------------- //
- (function() {
- 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; },
- __slice = [].slice;
- (function(root, factory) {
- if (typeof define === 'function' && define.amd) {
- return define('waypoints', ['jquery'], function($) {
- return factory($, root);
- });
- } else {
- return factory(root.jQuery, root);
- }
- })(window, function($, window) {
- var $w, Context, Waypoint, allWaypoints, contextCounter, contextKey, contexts, isTouch, jQMethods, methods, resizeEvent, scrollEvent, waypointCounter, waypointKey, wp, wps;
- $w = $(window);
- isTouch = __indexOf.call(window, 'ontouchstart') >= 0;
- allWaypoints = {
- horizontal: {},
- vertical: {}
- };
- contextCounter = 1;
- contexts = {};
- contextKey = 'waypoints-context-id';
- resizeEvent = 'resize.waypoints';
- scrollEvent = 'scroll.waypoints';
- waypointCounter = 1;
- waypointKey = 'waypoints-waypoint-ids';
- wp = 'waypoint';
- wps = 'waypoints';
- Context = (function() {
- function Context($element) {
- var _this = this;
- this.$element = $element;
- this.element = $element[0];
- this.didResize = false;
- this.didScroll = false;
- this.id = 'context' + contextCounter++;
- this.oldScroll = {
- x: $element.scrollLeft(),
- y: $element.scrollTop()
- };
- this.waypoints = {
- horizontal: {},
- vertical: {}
- };
- this.element[contextKey] = this.id;
- contexts[this.id] = this;
- $element.bind(scrollEvent, function() {
- var scrollHandler;
- if (!(_this.didScroll || isTouch)) {
- _this.didScroll = true;
- scrollHandler = function() {
- _this.doScroll();
- return _this.didScroll = false;
- };
- return window.setTimeout(scrollHandler, $[wps].settings.scrollThrottle);
- }
- });
- $element.bind(resizeEvent, function() {
- var resizeHandler;
- if (!_this.didResize) {
- _this.didResize = true;
- resizeHandler = function() {
- $[wps]('refresh');
- return _this.didResize = false;
- };
- return window.setTimeout(resizeHandler, $[wps].settings.resizeThrottle);
- }
- });
- }
- Context.prototype.doScroll = function() {
- var axes,
- _this = this;
- axes = {
- horizontal: {
- newScroll: this.$element.scrollLeft(),
- oldScroll: this.oldScroll.x,
- forward: 'right',
- backward: 'left'
- },
- vertical: {
- newScroll: this.$element.scrollTop(),
- oldScroll: this.oldScroll.y,
- forward: 'down',
- backward: 'up'
- }
- };
- if (isTouch && (!axes.vertical.oldScroll || !axes.vertical.newScroll)) {
- $[wps]('refresh');
- }
- $.each(axes, function(aKey, axis) {
- var direction, isForward, triggered;
- triggered = [];
- isForward = axis.newScroll > axis.oldScroll;
- direction = isForward ? axis.forward : axis.backward;
- $.each(_this.waypoints[aKey], function(wKey, waypoint) {
- var _ref, _ref1;
- if ((axis.oldScroll < (_ref = waypoint.offset) && _ref <= axis.newScroll)) {
- return triggered.push(waypoint);
- } else if ((axis.newScroll < (_ref1 = waypoint.offset) && _ref1 <= axis.oldScroll)) {
- return triggered.push(waypoint);
- }
- });
- triggered.sort(function(a, b) {
- return a.offset - b.offset;
- });
- if (!isForward) {
- triggered.reverse();
- }
- return $.each(triggered, function(i, waypoint) {
- if (waypoint.options.continuous || i === triggered.length - 1) {
- return waypoint.trigger([direction]);
- }
- });
- });
- return this.oldScroll = {
- x: axes.horizontal.newScroll,
- y: axes.vertical.newScroll
- };
- };
- Context.prototype.refresh = function() {
- var axes, cOffset, isWin,
- _this = this;
- isWin = $.isWindow(this.element);
- cOffset = this.$element.offset();
- this.doScroll();
- axes = {
- horizontal: {
- contextOffset: isWin ? 0 : cOffset.left,
- contextScroll: isWin ? 0 : this.oldScroll.x,
- contextDimension: this.$element.width(),
- oldScroll: this.oldScroll.x,
- forward: 'right',
- backward: 'left',
- offsetProp: 'left'
- },
- vertical: {
- contextOffset: isWin ? 0 : cOffset.top,
- contextScroll: isWin ? 0 : this.oldScroll.y,
- contextDimension: isWin ? $[wps]('viewportHeight') : this.$element.height(),
- oldScroll: this.oldScroll.y,
- forward: 'down',
- backward: 'up',
- offsetProp: 'top'
- }
- };
- return $.each(axes, function(aKey, axis) {
- return $.each(_this.waypoints[aKey], function(i, waypoint) {
- var adjustment, elementOffset, oldOffset, _ref, _ref1;
- adjustment = waypoint.options.offset;
- oldOffset = waypoint.offset;
- elementOffset = $.isWindow(waypoint.element) ? 0 : waypoint.$element.offset()[axis.offsetProp];
- if ($.isFunction(adjustment)) {
- adjustment = adjustment.apply(waypoint.element);
- } else if (typeof adjustment === 'string') {
- adjustment = parseFloat(adjustment);
- if (waypoint.options.offset.indexOf('%') > -1) {
- adjustment = Math.ceil(axis.contextDimension * adjustment / 100);
- }
- }
- waypoint.offset = elementOffset - axis.contextOffset + axis.contextScroll - adjustment;
- if ((waypoint.options.onlyOnScroll && (oldOffset != null)) || !waypoint.enabled) {
- return;
- }
- if (oldOffset !== null && (oldOffset < (_ref = axis.oldScroll) && _ref <= waypoint.offset)) {
- return waypoint.trigger([axis.backward]);
- } else if (oldOffset !== null && (oldOffset > (_ref1 = axis.oldScroll) && _ref1 >= waypoint.offset)) {
- return waypoint.trigger([axis.forward]);
- } else if (oldOffset === null && axis.oldScroll >= waypoint.offset) {
- return waypoint.trigger([axis.forward]);
- }
- });
- });
- };
- Context.prototype.checkEmpty = function() {
- if ($.isEmptyObject(this.waypoints.horizontal) && $.isEmptyObject(this.waypoints.vertical)) {
- this.$element.unbind([resizeEvent, scrollEvent].join(' '));
- return delete contexts[this.id];
- }
- };
- return Context;
- })();
- Waypoint = (function() {
- function Waypoint($element, context, options) {
- var idList, _ref;
- if (options.offset === 'bottom-in-view') {
- options.offset = function() {
- var contextHeight;
- contextHeight = $[wps]('viewportHeight');
- if (!$.isWindow(context.element)) {
- contextHeight = context.$element.height();
- }
- return contextHeight - $(this).outerHeight();
- };
- }
- this.$element = $element;
- this.element = $element[0];
- this.axis = options.horizontal ? 'horizontal' : 'vertical';
- this.callback = options.handler;
- this.context = context;
- this.enabled = options.enabled;
- this.id = 'waypoints' + waypointCounter++;
- this.offset = null;
- this.options = options;
- context.waypoints[this.axis][this.id] = this;
- allWaypoints[this.axis][this.id] = this;
- idList = (_ref = this.element[waypointKey]) != null ? _ref : [];
- idList.push(this.id);
- this.element[waypointKey] = idList;
- }
- Waypoint.prototype.trigger = function(args) {
- if (!this.enabled) {
- return;
- }
- if (this.callback != null) {
- this.callback.apply(this.element, args);
- }
- if (this.options.triggerOnce) {
- return this.destroy();
- }
- };
- Waypoint.prototype.disable = function() {
- return this.enabled = false;
- };
- Waypoint.prototype.enable = function() {
- this.context.refresh();
- return this.enabled = true;
- };
- Waypoint.prototype.destroy = function() {
- delete allWaypoints[this.axis][this.id];
- delete this.context.waypoints[this.axis][this.id];
- return this.context.checkEmpty();
- };
- Waypoint.getWaypointsByElement = function(element) {
- var all, ids;
- ids = element[waypointKey];
- if (!ids) {
- return [];
- }
- all = $.extend({}, allWaypoints.horizontal, allWaypoints.vertical);
- return $.map(ids, function(id) {
- return all[id];
- });
- };
- return Waypoint;
- })();
- methods = {
- init: function(f, options) {
- var _ref;
- options = $.extend({}, $.fn[wp].defaults, options);
- if ((_ref = options.handler) == null) {
- options.handler = f;
- }
- this.each(function() {
- var $this, context, contextElement, _ref1;
- $this = $(this);
- contextElement = (_ref1 = options.context) != null ? _ref1 : $.fn[wp].defaults.context;
- if (!$.isWindow(contextElement)) {
- contextElement = $this.closest(contextElement);
- }
- contextElement = $(contextElement);
- context = contexts[contextElement[0][contextKey]];
- if (!context) {
- context = new Context(contextElement);
- }
- return new Waypoint($this, context, options);
- });
- $[wps]('refresh');
- return this;
- },
- disable: function() {
- return methods._invoke.call(this, 'disable');
- },
- enable: function() {
- return methods._invoke.call(this, 'enable');
- },
- destroy: function() {
- return methods._invoke.call(this, 'destroy');
- },
- prev: function(axis, selector) {
- return methods._traverse.call(this, axis, selector, function(stack, index, waypoints) {
- if (index > 0) {
- return stack.push(waypoints[index - 1]);
- }
- });
- },
- next: function(axis, selector) {
- return methods._traverse.call(this, axis, selector, function(stack, index, waypoints) {
- if (index < waypoints.length - 1) {
- return stack.push(waypoints[index + 1]);
- }
- });
- },
- _traverse: function(axis, selector, push) {
- var stack, waypoints;
- if (axis == null) {
- axis = 'vertical';
- }
- if (selector == null) {
- selector = window;
- }
- waypoints = jQMethods.aggregate(selector);
- stack = [];
- this.each(function() {
- var index;
- index = $.inArray(this, waypoints[axis]);
- return push(stack, index, waypoints[axis]);
- });
- return this.pushStack(stack);
- },
- _invoke: function(method) {
- this.each(function() {
- var waypoints;
- waypoints = Waypoint.getWaypointsByElement(this);
- return $.each(waypoints, function(i, waypoint) {
- waypoint[method]();
- return true;
- });
- });
- return this;
- }
- };
- $.fn[wp] = function() {
- var args, method;
- method = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
- if (methods[method]) {
- return methods[method].apply(this, args);
- } else if ($.isFunction(method)) {
- return methods.init.apply(this, arguments);
- } else if ($.isPlainObject(method)) {
- return methods.init.apply(this, [null, method]);
- } else if (!method) {
- return $.error("jQuery Waypoints needs a callback function or handler option.");
- } else {
- return $.error("The " + method + " method does not exist in jQuery Waypoints.");
- }
- };
- $.fn[wp].defaults = {
- context: window,
- continuous: true,
- enabled: true,
- horizontal: false,
- offset: 0,
- triggerOnce: false
- };
- jQMethods = {
- refresh: function() {
- return $.each(contexts, function(i, context) {
- return context.refresh();
- });
- },
- viewportHeight: function() {
- var _ref;
- return (_ref = window.innerHeight) != null ? _ref : $w.height();
- },
- aggregate: function(contextSelector) {
- var collection, waypoints, _ref;
- collection = allWaypoints;
- if (contextSelector) {
- collection = (_ref = contexts[$(contextSelector)[0][contextKey]]) != null ? _ref.waypoints : void 0;
- }
- if (!collection) {
- return [];
- }
- waypoints = {
- horizontal: [],
- vertical: []
- };
- $.each(waypoints, function(axis, arr) {
- $.each(collection[axis], function(key, waypoint) {
- return arr.push(waypoint);
- });
- arr.sort(function(a, b) {
- return a.offset - b.offset;
- });
- waypoints[axis] = $.map(arr, function(waypoint) {
- return waypoint.element;
- });
- return waypoints[axis] = $.unique(waypoints[axis]);
- });
- return waypoints;
- },
- above: function(contextSelector) {
- if (contextSelector == null) {
- contextSelector = window;
- }
- return jQMethods._filter(contextSelector, 'vertical', function(context, waypoint) {
- return waypoint.offset <= context.oldScroll.y;
- });
- },
- below: function(contextSelector) {
- if (contextSelector == null) {
- contextSelector = window;
- }
- return jQMethods._filter(contextSelector, 'vertical', function(context, waypoint) {
- return waypoint.offset > context.oldScroll.y;
- });
- },
- left: function(contextSelector) {
- if (contextSelector == null) {
- contextSelector = window;
- }
- return jQMethods._filter(contextSelector, 'horizontal', function(context, waypoint) {
- return waypoint.offset <= context.oldScroll.x;
- });
- },
- right: function(contextSelector) {
- if (contextSelector == null) {
- contextSelector = window;
- }
- return jQMethods._filter(contextSelector, 'horizontal', function(context, waypoint) {
- return waypoint.offset > context.oldScroll.x;
- });
- },
- enable: function() {
- return jQMethods._invoke('enable');
- },
- disable: function() {
- return jQMethods._invoke('disable');
- },
- destroy: function() {
- return jQMethods._invoke('destroy');
- },
- extendFn: function(methodName, f) {
- return methods[methodName] = f;
- },
- _invoke: function(method) {
- var waypoints;
- waypoints = $.extend({}, allWaypoints.vertical, allWaypoints.horizontal);
- return $.each(waypoints, function(key, waypoint) {
- waypoint[method]();
- return true;
- });
- },
- _filter: function(selector, axis, test) {
- var context, waypoints;
- context = contexts[$(selector)[0][contextKey]];
- if (!context) {
- return [];
- }
- waypoints = [];
- $.each(context.waypoints[axis], function(i, waypoint) {
- if (test(context, waypoint)) {
- return waypoints.push(waypoint);
- }
- });
- waypoints.sort(function(a, b) {
- return a.offset - b.offset;
- });
- return $.map(waypoints, function(waypoint) {
- return waypoint.element;
- });
- }
- };
- $[wps] = function() {
- var args, method;
- method = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
- if (jQMethods[method]) {
- return jQMethods[method].apply(null, args);
- } else {
- return jQMethods.aggregate.call(null, method);
- }
- };
- $[wps].settings = {
- resizeThrottle: 100,
- scrollThrottle: 30
- };
- return $w.on('load.waypoints', function() {
- return $[wps]('refresh');
- });
- });
- }).call(this);
- // ----------------- jQuery Github Embedder ----------------------------- //
- // =========== https://github.com/kirbysayshi/ghembedder =============== //
- // ---------------------------------------------------------------------- //
- !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={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"};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)});
- ghembedder.autoload();
- ;jQuery(document).ready(function($){
-
- var i = 0;
- var box_title_png = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAAXCAMAAAAx3e/WAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYxIDY0LjE0MDk0OSwgMjAxMC8xMi8wNy0xMDo1NzowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNS4xIE1hY2ludG9zaCIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDpEQjIyNkJERkM0NjYxMUUxOEFDQzk3ODcxRDkzRjhCRSIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDpEQjIyNkJFMEM0NjYxMUUxOEFDQzk3ODcxRDkzRjhCRSI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOkRCMjI2QkREQzQ2NjExRTE4QUNDOTc4NzFEOTNGOEJFIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOkRCMjI2QkRFQzQ2NjExRTE4QUNDOTc4NzFEOTNGOEJFIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+dka2KgAAAEVQTFRFxMTEyMjI0tLSvb29vr6+zc3Ny8vLxcXFz8/P6enp3t7ex8fH0dHR1NTUw8PDwMDAzs7OvLy8wcHBu7u7v7+/zMzM////budQFwAAABd0Uk5T/////////////////////////////wDmQOZeAAAAcklEQVR42tSQSQ7DMAwD6chOukWs5eX/Ty2coo0T9wOdEzEgdRBuzNmnDofgja52JDyz5TCqUp0O6kfrb4bzSXkRiTviEZZ6JKLMJ5VQ2v8iGbtbfEwXmjFMG0VwdQo10hQNxYqtLMv9O6xvpZ/QeAkwAKjwHiJLaJc3AAAAAElFTkSuQmCC';
- 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==';
- $('.github-widget').each(function(){
- if(i == 0) $('head').append(
- '<style type="text/css">'
- +'.github-box *{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;}'
- +'.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}'
- +'.github-box a{color:#4183c4;border:0;text-decoration:none}'
- +'.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);}'
- +'.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;}'
- +'.github-box .github-box-title h3 .repo{font-weight:bold}'
- +'.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}'
- +'.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}'
- +'.github-box .github-box-title .github-stats .watchers{border-right:1px solid #ddd}'
- +'.github-box .github-box-title .github-stats .forks{background-position:-4px -21px;padding-left:15px}'
- +'.github-box .github-box-content{padding:10px;font-weight:300}'
- +'.github-box .github-box-content p{margin:0}'
- +'.github-box .github-box-content .link{font-weight:bold}'
- +'.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;}'
- +'.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}'
- +'.github-box .github-box-download .updated strong{font-weight:bold;color:#000}'
- +'.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);}'
- +'.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);}'
- +'@media (max-width: 767px) {'
- +'.github-box .github-box-title{height:auto;min-height:60px}'
- +'.github-box .github-box-title h3 .repo{display:block}'
- +'.github-box .github-box-title .github-stats a{display:block;clear:right;float:right;}'
- +'.github-box .github-box-download{height:auto;min-height:46px;}'
- +'.github-box .github-box-download .download{top:32px;}'
- +'}'
- +'</style>'
- );
- i++;
- var $container = $(this), $widget,
- repo = $container.data('repo'),
- vendorName = repo.split('/')[0],
- repoName = repo.split('/')[1],
- vendorUrl = "http://github.com/" + vendorName,
- repoUrl = "http://github.com/" + vendorName + '/' + repoName;
- $widget = $(
- '<div class="github-box repo">'
- +'<div class="github-box-title">'
- +'<h3>'
- +'<a class="owner" href="' + vendorUrl + '" title="' + vendorUrl + '">' + vendorName + '</a>'
- +'/'
- +'<a class="repo" href="' + repoUrl + '" title="' + repoUrl + '">' + repoName + '</a>'
- +'</h3>'
- +'<div class="github-stats">'
- +'<a class="watchers" href="' + repoUrl + '/watchers" title="See watchers">?</a>'
- +'<a class="forks" href="' + repoUrl + '/network/members" title="See forkers">?</a>'
- +'</div>'
- +'</div>'
- +'<div class="github-box-content">'
- +'<p class="description"><span></span> — <a href="' + repoUrl + '#readme">Read More</a></p>'
- +'<p class="link"></p>'
- +'</div>'
- +'<div class="github-box-download">'
- +'<div class="updated"></div>'
- +'<a class="download" href="' + repoUrl + '/zipball/master" title="Get an archive of this repository">Download as zip</a>'
- +'</div>'
- +'</div>'
- );
- $widget.appendTo($container);
- $.ajax({
- url: 'https://api.github.com/repos/' + repo,
- dataType: 'jsonp',
- success: function(results) {
- var repo = results.data, date, pushed_at = 'unknown';
- if (repo.pushed_at) {
- date = new Date(repo.pushed_at);
- pushed_at = (date.getMonth() + 1) + '-' + date.getDate() + '-' + date.getFullYear();
- }
- $widget.find('.watchers').text(repo.watchers);
- $widget.find('.forks').text(repo.forks);
- $widget.find('.description span').text(repo.description);
- $widget.find('.updated').html('Latest commit to the <strong>' + repo.default_branch + '</strong> branch on ' + pushed_at);
- // Don't show "null" if the repo has no homepage URL.
- if(repo.homepage != null) $widget.find('.link').append($('<a />').attr('href', repo.homepage).text(repo.homepage));
- }
- });
- });
- });
- // ----------------- JavaScript Cookie v2.2.0 ----------------------------- //
- // =========== https://github.com/js-cookie/js-cookie =============== //
- // ---------------------------------------------------------------------- //
- ;(function (factory) {
- var registeredInModuleLoader;
- if (typeof define === 'function' && define.amd) {
- define(factory);
- registeredInModuleLoader = true;
- }
- if (typeof exports === 'object') {
- module.exports = factory();
- registeredInModuleLoader = true;
- }
- if (!registeredInModuleLoader) {
- var OldCookies = window.Cookies;
- var api = window.Cookies = factory();
- api.noConflict = function () {
- window.Cookies = OldCookies;
- return api;
- };
- }
- }(function () {
- function extend () {
- var i = 0;
- var result = {};
- for (; i < arguments.length; i++) {
- var attributes = arguments[ i ];
- for (var key in attributes) {
- result[key] = attributes[key];
- }
- }
- return result;
- }
- function decode (s) {
- return s.replace(/(%[0-9A-Z]{2})+/g, decodeURIComponent);
- }
- function init (converter) {
- function api() {}
- function set (key, value, attributes) {
- if (typeof document === 'undefined') {
- return;
- }
- attributes = extend({
- path: '/'
- }, api.defaults, attributes);
- if (typeof attributes.expires === 'number') {
- attributes.expires = new Date(new Date() * 1 + attributes.expires * 864e+5);
- }
- // We're using "expires" because "max-age" is not supported by IE
- attributes.expires = attributes.expires ? attributes.expires.toUTCString() : '';
- try {
- var result = JSON.stringify(value);
- if (/^[\{\[]/.test(result)) {
- value = result;
- }
- } catch (e) {}
- value = converter.write ?
- converter.write(value, key) :
- encodeURIComponent(String(value))
- .replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent);
- key = encodeURIComponent(String(key))
- .replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent)
- .replace(/[\(\)]/g, escape);
- var stringifiedAttributes = '';
- for (var attributeName in attributes) {
- if (!attributes[attributeName]) {
- continue;
- }
- stringifiedAttributes += '; ' + attributeName;
- if (attributes[attributeName] === true) {
- continue;
- }
- // Considers RFC 6265 section 5.2:
- // ...
- // 3. If the remaining unparsed-attributes contains a %x3B (";")
- // character:
- // Consume the characters of the unparsed-attributes up to,
- // not including, the first %x3B (";") character.
- // ...
- stringifiedAttributes += '=' + attributes[attributeName].split(';')[0];
- }
- return (document.cookie = key + '=' + value + stringifiedAttributes);
- }
- function get (key, json) {
- if (typeof document === 'undefined') {
- return;
- }
- var jar = {};
- // To prevent the for loop in the first place assign an empty array
- // in case there are no cookies at all.
- var cookies = document.cookie ? document.cookie.split('; ') : [];
- var i = 0;
- for (; i < cookies.length; i++) {
- var parts = cookies[i].split('=');
- var cookie = parts.slice(1).join('=');
- if (!json && cookie.charAt(0) === '"') {
- cookie = cookie.slice(1, -1);
- }
- try {
- var name = decode(parts[0]);
- cookie = (converter.read || converter)(cookie, name) ||
- decode(cookie);
- if (json) {
- try {
- cookie = JSON.parse(cookie);
- } catch (e) {}
- }
- jar[name] = cookie;
- if (key === name) {
- break;
- }
- } catch (e) {}
- }
- return key ? jar[key] : jar;
- }
- api.set = set;
- api.get = function (key) {
- return get(key, false /* read as raw */);
- };
- api.getJSON = function (key) {
- return get(key, true /* read as json */);
- };
- api.remove = function (key, attributes) {
- set(key, '', extend(attributes, {
- expires: -1
- }));
- };
- api.defaults = {};
- api.withConverter = init;
- return api;
- }
- return init(function () {});
- }));
|