scripts.js 148 KB

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