all.js 185 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532
  1. /*
  2. * Foundation Responsive Library
  3. * http://foundation.zurb.com
  4. * Copyright 2013, ZURB
  5. * Free to use under the MIT license.
  6. * http://www.opensource.org/licenses/mit-license.php
  7. */
  8. (function ($, window, document, undefined) {
  9. 'use strict';
  10. // Used to retrieve Foundation media queries from CSS.
  11. if($('head').has('.foundation-mq-small').length === 0) {
  12. $('head').append('<meta class="foundation-mq-small">');
  13. }
  14. if($('head').has('.foundation-mq-medium').length === 0) {
  15. $('head').append('<meta class="foundation-mq-medium">');
  16. }
  17. if($('head').has('.foundation-mq-large').length === 0) {
  18. $('head').append('<meta class="foundation-mq-large">');
  19. }
  20. if($('head').has('.foundation-mq-xlarge').length === 0) {
  21. $('head').append('<meta class="foundation-mq-xlarge">');
  22. }
  23. if($('head').has('.foundation-mq-xxlarge').length === 0) {
  24. $('head').append('<meta class="foundation-mq-xxlarge">');
  25. }
  26. // Embed FastClick (this should be removed later)
  27. function FastClick(layer){'use strict';var oldOnClick,self=this;this.trackingClick=false;this.trackingClickStart=0;this.targetElement=null;this.touchStartX=0;this.touchStartY=0;this.lastTouchIdentifier=0;this.touchBoundary=10;this.layer=layer;if(!layer||!layer.nodeType){throw new TypeError('Layer must be a document node');}this.onClick=function(){return FastClick.prototype.onClick.apply(self,arguments)};this.onMouse=function(){return FastClick.prototype.onMouse.apply(self,arguments)};this.onTouchStart=function(){return FastClick.prototype.onTouchStart.apply(self,arguments)};this.onTouchMove=function(){return FastClick.prototype.onTouchMove.apply(self,arguments)};this.onTouchEnd=function(){return FastClick.prototype.onTouchEnd.apply(self,arguments)};this.onTouchCancel=function(){return FastClick.prototype.onTouchCancel.apply(self,arguments)};if(FastClick.notNeeded(layer)){return}if(this.deviceIsAndroid){layer.addEventListener('mouseover',this.onMouse,true);layer.addEventListener('mousedown',this.onMouse,true);layer.addEventListener('mouseup',this.onMouse,true)}layer.addEventListener('click',this.onClick,true);layer.addEventListener('touchstart',this.onTouchStart,false);layer.addEventListener('touchmove',this.onTouchMove,false);layer.addEventListener('touchend',this.onTouchEnd,false);layer.addEventListener('touchcancel',this.onTouchCancel,false);if(!Event.prototype.stopImmediatePropagation){layer.removeEventListener=function(type,callback,capture){var rmv=Node.prototype.removeEventListener;if(type==='click'){rmv.call(layer,type,callback.hijacked||callback,capture)}else{rmv.call(layer,type,callback,capture)}};layer.addEventListener=function(type,callback,capture){var adv=Node.prototype.addEventListener;if(type==='click'){adv.call(layer,type,callback.hijacked||(callback.hijacked=function(event){if(!event.propagationStopped){callback(event)}}),capture)}else{adv.call(layer,type,callback,capture)}}}if(typeof layer.onclick==='function'){oldOnClick=layer.onclick;layer.addEventListener('click',function(event){oldOnClick(event)},false);layer.onclick=null}}FastClick.prototype.deviceIsAndroid=navigator.userAgent.indexOf('Android')>0;FastClick.prototype.deviceIsIOS=/iP(ad|hone|od)/.test(navigator.userAgent);FastClick.prototype.deviceIsIOS4=FastClick.prototype.deviceIsIOS&&(/OS 4_\d(_\d)?/).test(navigator.userAgent);FastClick.prototype.deviceIsIOSWithBadTarget=FastClick.prototype.deviceIsIOS&&(/OS ([6-9]|\d{2})_\d/).test(navigator.userAgent);FastClick.prototype.needsClick=function(target){'use strict';switch(target.nodeName.toLowerCase()){case'button':case'select':case'textarea':if(target.disabled){return true}break;case'input':if((this.deviceIsIOS&&target.type==='file')||target.disabled){return true}break;case'label':case'video':return true}return(/\bneedsclick\b/).test(target.className)};FastClick.prototype.needsFocus=function(target){'use strict';switch(target.nodeName.toLowerCase()){case'textarea':case'select':return true;case'input':switch(target.type){case'button':case'checkbox':case'file':case'image':case'radio':case'submit':return false}return!target.disabled&&!target.readOnly;default:return(/\bneedsfocus\b/).test(target.className)}};FastClick.prototype.sendClick=function(targetElement,event){'use strict';var clickEvent,touch;if(document.activeElement&&document.activeElement!==targetElement){document.activeElement.blur()}touch=event.changedTouches[0];clickEvent=document.createEvent('MouseEvents');clickEvent.initMouseEvent('click',true,true,window,1,touch.screenX,touch.screenY,touch.clientX,touch.clientY,false,false,false,false,0,null);clickEvent.forwardedTouchEvent=true;targetElement.dispatchEvent(clickEvent)};FastClick.prototype.focus=function(targetElement){'use strict';var length;if(this.deviceIsIOS&&targetElement.setSelectionRange){length=targetElement.value.length;targetElement.setSelectionRange(length,length)}else{targetElement.focus()}};FastClick.prototype.updateScrollParent=function(targetElement){'use strict';var scrollParent,parentElement;scrollParent=targetElement.fastClickScrollParent;if(!scrollParent||!scrollParent.contains(targetElement)){parentElement=targetElement;do{if(parentElement.scrollHeight>parentElement.offsetHeight){scrollParent=parentElement;targetElement.fastClickScrollParent=parentElement;break}parentElement=parentElement.parentElement}while(parentElement)}if(scrollParent){scrollParent.fastClickLastScrollTop=scrollParent.scrollTop}};FastClick.prototype.getTargetElementFromEventTarget=function(eventTarget){'use strict';if(eventTarget.nodeType===Node.TEXT_NODE){return eventTarget.parentNode}return eventTarget};FastClick.prototype.onTouchStart=function(event){'use strict';var targetElement,touch,selection;if(event.targetTouches.length>1){return true}targetElement=this.getTargetElementFromEventTarget(event.target);touch=event.targetTouches[0];if(this.deviceIsIOS){selection=window.getSelection();if(selection.rangeCount&&!selection.isCollapsed){return true}if(!this.deviceIsIOS4){if(touch.identifier===this.lastTouchIdentifier){event.preventDefault();return false}this.lastTouchIdentifier=touch.identifier;this.updateScrollParent(targetElement)}}this.trackingClick=true;this.trackingClickStart=event.timeStamp;this.targetElement=targetElement;this.touchStartX=touch.pageX;this.touchStartY=touch.pageY;if((event.timeStamp-this.lastClickTime)<200){event.preventDefault()}return true};FastClick.prototype.touchHasMoved=function(event){'use strict';var touch=event.changedTouches[0],boundary=this.touchBoundary;if(Math.abs(touch.pageX-this.touchStartX)>boundary||Math.abs(touch.pageY-this.touchStartY)>boundary){return true}return false};FastClick.prototype.onTouchMove=function(event){'use strict';if(!this.trackingClick){return true}if(this.targetElement!==this.getTargetElementFromEventTarget(event.target)||this.touchHasMoved(event)){this.trackingClick=false;this.targetElement=null}return true};FastClick.prototype.findControl=function(labelElement){'use strict';if(labelElement.control!==undefined){return labelElement.control}if(labelElement.htmlFor){return document.getElementById(labelElement.htmlFor)}return labelElement.querySelector('button, input:not([type=hidden]), keygen, meter, output, progress, select, textarea')};FastClick.prototype.onTouchEnd=function(event){'use strict';var forElement,trackingClickStart,targetTagName,scrollParent,touch,targetElement=this.targetElement;if(!this.trackingClick){return true}if((event.timeStamp-this.lastClickTime)<200){this.cancelNextClick=true;return true}this.lastClickTime=event.timeStamp;trackingClickStart=this.trackingClickStart;this.trackingClick=false;this.trackingClickStart=0;if(this.deviceIsIOSWithBadTarget){touch=event.changedTouches[0];targetElement=document.elementFromPoint(touch.pageX-window.pageXOffset,touch.pageY-window.pageYOffset)||targetElement;targetElement.fastClickScrollParent=this.targetElement.fastClickScrollParent}targetTagName=targetElement.tagName.toLowerCase();if(targetTagName==='label'){forElement=this.findControl(targetElement);if(forElement){this.focus(targetElement);if(this.deviceIsAndroid){return false}targetElement=forElement}}else if(this.needsFocus(targetElement)){if((event.timeStamp-trackingClickStart)>100||(this.deviceIsIOS&&window.top!==window&&targetTagName==='input')){this.targetElement=null;return false}this.focus(targetElement);if(!this.deviceIsIOS4||targetTagName!=='select'){this.targetElement=null;event.preventDefault()}return false}if(this.deviceIsIOS&&!this.deviceIsIOS4){scrollParent=targetElement.fastClickScrollParent;if(scrollParent&&scrollParent.fastClickLastScrollTop!==scrollParent.scrollTop){return true}}if(!this.needsClick(targetElement)){event.preventDefault();this.sendClick(targetElement,event)}return false};FastClick.prototype.onTouchCancel=function(){'use strict';this.trackingClick=false;this.targetElement=null};FastClick.prototype.onMouse=function(event){'use strict';if(!this.targetElement){return true}if(event.forwardedTouchEvent){return true}if(!event.cancelable){return true}if(!this.needsClick(this.targetElement)||this.cancelNextClick){if(event.stopImmediatePropagation){event.stopImmediatePropagation()}else{event.propagationStopped=true}event.stopPropagation();event.preventDefault();return false}return true};FastClick.prototype.onClick=function(event){'use strict';var permitted;if(this.trackingClick){this.targetElement=null;this.trackingClick=false;return true}if(event.target.type==='submit'&&event.detail===0){return true}permitted=this.onMouse(event);if(!permitted){this.targetElement=null}return permitted};FastClick.prototype.destroy=function(){'use strict';var layer=this.layer;if(this.deviceIsAndroid){layer.removeEventListener('mouseover',this.onMouse,true);layer.removeEventListener('mousedown',this.onMouse,true);layer.removeEventListener('mouseup',this.onMouse,true)}layer.removeEventListener('click',this.onClick,true);layer.removeEventListener('touchstart',this.onTouchStart,false);layer.removeEventListener('touchmove',this.onTouchMove,false);layer.removeEventListener('touchend',this.onTouchEnd,false);layer.removeEventListener('touchcancel',this.onTouchCancel,false)};FastClick.notNeeded=function(layer){'use strict';var metaViewport;if(typeof window.ontouchstart==='undefined'){return true}if((/Chrome\/[0-9]+/).test(navigator.userAgent)){if(FastClick.prototype.deviceIsAndroid){metaViewport=document.querySelector('meta[name=viewport]');if(metaViewport&&metaViewport.content.indexOf('user-scalable=no')!==-1){return true}}else{return true}}if(layer.style.msTouchAction==='none'){return true}return false};FastClick.attach=function(layer){'use strict';return new FastClick(layer)};if(typeof define!=='undefined'&&define.amd){define(function(){'use strict';return FastClick})}else if(typeof module!=='undefined'&&module.exports){module.exports=FastClick.attach;module.exports.FastClick=FastClick}else{window.FastClick=FastClick}
  28. // Enable FastClick
  29. if(typeof FastClick !== 'undefined') {
  30. FastClick.attach(document.body);
  31. }
  32. // private Fast Selector wrapper,
  33. // returns jQuery object. Only use where
  34. // getElementById is not available.
  35. var S = function (selector, context) {
  36. if (typeof selector === 'string') {
  37. if (context) {
  38. return $(context.querySelectorAll(selector));
  39. }
  40. return $(document.querySelectorAll(selector));
  41. }
  42. return $(selector, context);
  43. };
  44. /*
  45. https://github.com/paulirish/matchMedia.js
  46. */
  47. window.matchMedia = window.matchMedia || (function( doc, undefined ) {
  48. "use strict";
  49. var bool,
  50. docElem = doc.documentElement,
  51. refNode = docElem.firstElementChild || docElem.firstChild,
  52. // fakeBody required for <FF4 when executed in <head>
  53. fakeBody = doc.createElement( "body" ),
  54. div = doc.createElement( "div" );
  55. div.id = "mq-test-1";
  56. div.style.cssText = "position:absolute;top:-100em";
  57. fakeBody.style.background = "none";
  58. fakeBody.appendChild(div);
  59. return function(q){
  60. div.innerHTML = "&shy;<style media=\"" + q + "\"> #mq-test-1 { width: 42px; }</style>";
  61. docElem.insertBefore( fakeBody, refNode );
  62. bool = div.offsetWidth === 42;
  63. docElem.removeChild( fakeBody );
  64. return {
  65. matches: bool,
  66. media: q
  67. };
  68. };
  69. }( document ));
  70. /*
  71. * jquery.requestAnimationFrame
  72. * https://github.com/gnarf37/jquery-requestAnimationFrame
  73. * Requires jQuery 1.8+
  74. *
  75. * Copyright (c) 2012 Corey Frang
  76. * Licensed under the MIT license.
  77. */
  78. (function( $ ) {
  79. // requestAnimationFrame polyfill adapted from Erik Möller
  80. // fixes from Paul Irish and Tino Zijdel
  81. // http://paulirish.com/2011/requestanimationframe-for-smart-animating/
  82. // http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
  83. var animating,
  84. lastTime = 0,
  85. vendors = ['webkit', 'moz'],
  86. requestAnimationFrame = window.requestAnimationFrame,
  87. cancelAnimationFrame = window.cancelAnimationFrame;
  88. for(; lastTime < vendors.length && !requestAnimationFrame; lastTime++) {
  89. requestAnimationFrame = window[ vendors[lastTime] + "RequestAnimationFrame" ];
  90. cancelAnimationFrame = cancelAnimationFrame ||
  91. window[ vendors[lastTime] + "CancelAnimationFrame" ] ||
  92. window[ vendors[lastTime] + "CancelRequestAnimationFrame" ];
  93. }
  94. function raf() {
  95. if ( animating ) {
  96. requestAnimationFrame( raf );
  97. jQuery.fx.tick();
  98. }
  99. }
  100. if ( requestAnimationFrame ) {
  101. // use rAF
  102. window.requestAnimationFrame = requestAnimationFrame;
  103. window.cancelAnimationFrame = cancelAnimationFrame;
  104. jQuery.fx.timer = function( timer ) {
  105. if ( timer() && jQuery.timers.push( timer ) && !animating ) {
  106. animating = true;
  107. raf();
  108. }
  109. };
  110. jQuery.fx.stop = function() {
  111. animating = false;
  112. };
  113. } else {
  114. // polyfill
  115. window.requestAnimationFrame = function( callback, element ) {
  116. var currTime = new Date().getTime(),
  117. timeToCall = Math.max( 0, 16 - ( currTime - lastTime ) ),
  118. id = window.setTimeout( function() {
  119. callback( currTime + timeToCall );
  120. }, timeToCall );
  121. lastTime = currTime + timeToCall;
  122. return id;
  123. };
  124. window.cancelAnimationFrame = function(id) {
  125. clearTimeout(id);
  126. };
  127. }
  128. }( jQuery ));
  129. function removeQuotes (string) {
  130. if (typeof string === 'string' || string instanceof String) {
  131. string = string.replace(/^[\\/'"]+|(;\s?})+|[\\/'"]+$/g, '');
  132. }
  133. return string;
  134. }
  135. window.Foundation = {
  136. name : 'Foundation',
  137. version : '5.0.0',
  138. media_queries : {
  139. small : S('.foundation-mq-small').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''),
  140. medium : S('.foundation-mq-medium').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''),
  141. large : S('.foundation-mq-large').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''),
  142. xlarge: S('.foundation-mq-xlarge').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''),
  143. xxlarge: S('.foundation-mq-xxlarge').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, '')
  144. },
  145. stylesheet : $('<style></style>').appendTo('head')[0].sheet,
  146. init : function (scope, libraries, method, options, response) {
  147. var library_arr,
  148. args = [scope, method, options, response],
  149. responses = [];
  150. // check RTL
  151. this.rtl = /rtl/i.test(S('html').attr('dir'));
  152. // set foundation global scope
  153. this.scope = scope || this.scope;
  154. if (libraries && typeof libraries === 'string' && !/reflow/i.test(libraries)) {
  155. if (this.libs.hasOwnProperty(libraries)) {
  156. responses.push(this.init_lib(libraries, args));
  157. }
  158. } else {
  159. for (var lib in this.libs) {
  160. responses.push(this.init_lib(lib, libraries));
  161. }
  162. }
  163. return scope;
  164. },
  165. init_lib : function (lib, args) {
  166. if (this.libs.hasOwnProperty(lib)) {
  167. this.patch(this.libs[lib]);
  168. if (args && args.hasOwnProperty(lib)) {
  169. return this.libs[lib].init.apply(this.libs[lib], [this.scope, args[lib]]);
  170. }
  171. return this.libs[lib].init.apply(this.libs[lib], args);
  172. }
  173. return function () {};
  174. },
  175. patch : function (lib) {
  176. lib.scope = this.scope;
  177. lib['data_options'] = this.lib_methods.data_options;
  178. lib['bindings'] = this.lib_methods.bindings;
  179. lib['S'] = S;
  180. lib.rtl = this.rtl;
  181. },
  182. inherit : function (scope, methods) {
  183. var methods_arr = methods.split(' ');
  184. for (var i = methods_arr.length - 1; i >= 0; i--) {
  185. if (this.lib_methods.hasOwnProperty(methods_arr[i])) {
  186. this.libs[scope.name][methods_arr[i]] = this.lib_methods[methods_arr[i]];
  187. }
  188. }
  189. },
  190. random_str : function (length) {
  191. var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');
  192. if (!length) {
  193. length = Math.floor(Math.random() * chars.length);
  194. }
  195. var str = '';
  196. for (var i = 0; i < length; i++) {
  197. str += chars[Math.floor(Math.random() * chars.length)];
  198. }
  199. return str;
  200. },
  201. libs : {},
  202. // methods that can be inherited in libraries
  203. lib_methods : {
  204. throttle : function(fun, delay) {
  205. var timer = null;
  206. return function () {
  207. var context = this, args = arguments;
  208. clearTimeout(timer);
  209. timer = setTimeout(function () {
  210. fun.apply(context, args);
  211. }, delay);
  212. };
  213. },
  214. // parses data-options attribute
  215. data_options : function (el) {
  216. var opts = {}, ii, p, opts_arr, opts_len,
  217. data_options = el.data('options');
  218. if (typeof data_options === 'object') {
  219. return data_options;
  220. }
  221. opts_arr = (data_options || ':').split(';'),
  222. opts_len = opts_arr.length;
  223. function isNumber (o) {
  224. return ! isNaN (o-0) && o !== null && o !== "" && o !== false && o !== true;
  225. }
  226. function trim(str) {
  227. if (typeof str === 'string') return $.trim(str);
  228. return str;
  229. }
  230. // parse options
  231. for (ii = opts_len - 1; ii >= 0; ii--) {
  232. p = opts_arr[ii].split(':');
  233. if (/true/i.test(p[1])) p[1] = true;
  234. if (/false/i.test(p[1])) p[1] = false;
  235. if (isNumber(p[1])) p[1] = parseInt(p[1], 10);
  236. if (p.length === 2 && p[0].length > 0) {
  237. opts[trim(p[0])] = trim(p[1]);
  238. }
  239. }
  240. return opts;
  241. },
  242. delay : function (fun, delay) {
  243. return setTimeout(fun, delay);
  244. },
  245. // test for empty object or array
  246. empty : function (obj) {
  247. if (obj.length && obj.length > 0) return false;
  248. if (obj.length && obj.length === 0) return true;
  249. for (var key in obj) {
  250. if (hasOwnProperty.call(obj, key)) return false;
  251. }
  252. return true;
  253. },
  254. register_media : function(media, media_class) {
  255. if(Foundation.media_queries[media] === undefined) {
  256. $('head').append('<meta class="' + media_class + '">');
  257. Foundation.media_queries[media] = removeQuotes($('.' + media_class).css('font-family'));
  258. }
  259. },
  260. addCustomRule : function(rule, media) {
  261. if(media === undefined) {
  262. Foundation.stylesheet.insertRule(rule, Foundation.stylesheet.cssRules.length);
  263. } else {
  264. var query = Foundation.media_queries[media];
  265. if(query !== undefined) {
  266. Foundation.stylesheet.insertRule('@media ' +
  267. Foundation.media_queries[media] + '{ ' + rule + ' }');
  268. }
  269. }
  270. },
  271. loaded : function (image, callback) {
  272. function loaded () {
  273. callback(image[0]);
  274. }
  275. function bindLoad () {
  276. this.one('load', loaded);
  277. if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) {
  278. var src = this.attr( 'src' ),
  279. param = src.match( /\?/ ) ? '&' : '?';
  280. param += 'random=' + (new Date()).getTime();
  281. this.attr('src', src + param);
  282. }
  283. }
  284. if (!image.attr('src')) {
  285. loaded();
  286. return;
  287. }
  288. if (image[0].complete || image[0].readyState === 4) {
  289. loaded();
  290. } else {
  291. bindLoad.call(image);
  292. }
  293. },
  294. bindings : function (method, options) {
  295. var self = this,
  296. should_bind_events = !S(this).data(this.name + '-init');
  297. if (typeof method === 'string') {
  298. return this[method].call(this);
  299. }
  300. if (S(this.scope).is('[data-' + this.name +']')) {
  301. S(this.scope).data(this.name + '-init', $.extend({}, this.settings, (options || method), this.data_options(S(this.scope))));
  302. if (should_bind_events) {
  303. this.events(this.scope);
  304. }
  305. } else {
  306. S('[data-' + this.name + ']', this.scope).each(function () {
  307. var should_bind_events = !S(this).data(self.name + '-init');
  308. S(this).data(self.name + '-init', $.extend({}, self.settings, (options || method), self.data_options(S(this))));
  309. if (should_bind_events) {
  310. self.events(this);
  311. }
  312. });
  313. }
  314. }
  315. }
  316. };
  317. $.fn.foundation = function () {
  318. var args = Array.prototype.slice.call(arguments, 0);
  319. return this.each(function () {
  320. Foundation.init.apply(Foundation, [this].concat(args));
  321. return this;
  322. });
  323. };
  324. }(jQuery, this, this.document));
  325. ;(function ($, window, document, undefined) {
  326. 'use strict';
  327. Foundation.libs.abide = {
  328. name : 'abide',
  329. version : '5.0.0',
  330. settings : {
  331. focus_on_invalid : true,
  332. timeout : 1000,
  333. patterns : {
  334. alpha: /[a-zA-Z]+/,
  335. alpha_numeric : /[a-zA-Z0-9]+/,
  336. integer: /-?\d+/,
  337. number: /-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?/,
  338. // generic password: upper-case, lower-case, number/special character, and min 8 characters
  339. password : /(?=^.{8,}$)((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$/,
  340. // amex, visa, diners
  341. card : /^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11})$/,
  342. cvv : /^([0-9]){3,4}$/,
  343. // http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the-type-attribute.html#valid-e-mail-address
  344. email : /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,
  345. url: /(https?|ftp|file|ssh):\/\/(((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?/,
  346. // abc.de
  347. domain: /^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,6}$/,
  348. datetime: /([0-2][0-9]{3})\-([0-1][0-9])\-([0-3][0-9])T([0-5][0-9])\:([0-5][0-9])\:([0-5][0-9])(Z|([\-\+]([0-1][0-9])\:00))/,
  349. // YYYY-MM-DD
  350. date: /(?:19|20)[0-9]{2}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-9])|(?:(?!02)(?:0[1-9]|1[0-2])-(?:30))|(?:(?:0[13578]|1[02])-31))/,
  351. // HH:MM:SS
  352. time : /(0[0-9]|1[0-9]|2[0-3])(:[0-5][0-9]){2}/,
  353. dateISO: /\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}/,
  354. // MM/DD/YYYY
  355. month_day_year : /(0[1-9]|1[012])[- \/.](0[1-9]|[12][0-9]|3[01])[- \/.](19|20)\d\d/,
  356. // #FFF or #FFFFFF
  357. color: /^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/
  358. }
  359. },
  360. timer : null,
  361. init : function (scope, method, options) {
  362. this.bindings(method, options);
  363. },
  364. events : function (scope) {
  365. var self = this,
  366. form = $(scope).attr('novalidate', 'novalidate'),
  367. settings = form.data('abide-init');
  368. form
  369. .off('.abide')
  370. .on('submit.fndtn.abide validate.fndtn.abide', function (e) {
  371. var is_ajax = /ajax/i.test($(this).attr('data-abide'));
  372. return self.validate($(this).find('input, textarea, select').get(), e, is_ajax);
  373. })
  374. .find('input, textarea, select')
  375. .off('.abide')
  376. .on('blur.fndtn.abide change.fndtn.abide', function (e) {
  377. self.validate([this], e);
  378. })
  379. .on('keydown.fndtn.abide', function (e) {
  380. var settings = $(this).closest('form').data('abide-init');
  381. clearTimeout(self.timer);
  382. self.timer = setTimeout(function () {
  383. self.validate([this], e);
  384. }.bind(this), settings.timeout);
  385. });
  386. },
  387. validate : function (els, e, is_ajax) {
  388. var validations = this.parse_patterns(els),
  389. validation_count = validations.length,
  390. form = $(els[0]).closest('form'),
  391. submit_event = /submit/.test(e.type);
  392. for (var i=0; i < validation_count; i++) {
  393. if (!validations[i] && (submit_event || is_ajax)) {
  394. if (this.settings.focus_on_invalid) els[i].focus();
  395. form.trigger('invalid');
  396. $(els[i]).closest('form').attr('data-invalid', '');
  397. return false;
  398. }
  399. }
  400. if (submit_event || is_ajax) {
  401. form.trigger('valid');
  402. }
  403. form.removeAttr('data-invalid');
  404. if (is_ajax) return false;
  405. return true;
  406. },
  407. parse_patterns : function (els) {
  408. var count = els.length,
  409. el_patterns = [];
  410. for (var i = count - 1; i >= 0; i--) {
  411. el_patterns.push(this.pattern(els[i]));
  412. }
  413. return this.check_validation_and_apply_styles(el_patterns);
  414. },
  415. pattern : function (el) {
  416. var type = el.getAttribute('type'),
  417. required = typeof el.getAttribute('required') === 'string';
  418. if (this.settings.patterns.hasOwnProperty(type)) {
  419. return [el, this.settings.patterns[type], required];
  420. }
  421. var pattern = el.getAttribute('pattern') || '';
  422. if (this.settings.patterns.hasOwnProperty(pattern) && pattern.length > 0) {
  423. return [el, this.settings.patterns[pattern], required];
  424. } else if (pattern.length > 0) {
  425. return [el, new RegExp(pattern), required];
  426. }
  427. pattern = /.*/;
  428. return [el, pattern, required];
  429. },
  430. check_validation_and_apply_styles : function (el_patterns) {
  431. var count = el_patterns.length,
  432. validations = [];
  433. for (var i = count - 1; i >= 0; i--) {
  434. var el = el_patterns[i][0],
  435. required = el_patterns[i][2],
  436. value = el.value,
  437. is_equal = el.getAttribute('data-equalto'),
  438. is_radio = el.type === "radio",
  439. valid_length = (required) ? (el.value.length > 0) : true;
  440. if (is_radio && required) {
  441. validations.push(this.valid_radio(el, required));
  442. } else if (is_equal && required) {
  443. validations.push(this.valid_equal(el, required));
  444. } else {
  445. if (el_patterns[i][1].test(value) && valid_length ||
  446. !required && el.value.length < 1) {
  447. $(el).removeAttr('data-invalid').parent().removeClass('error');
  448. validations.push(true);
  449. } else {
  450. $(el).attr('data-invalid', '').parent().addClass('error');
  451. validations.push(false);
  452. }
  453. }
  454. }
  455. return validations;
  456. },
  457. valid_radio : function (el, required) {
  458. var name = el.getAttribute('name'),
  459. group = document.getElementsByName(name),
  460. count = group.length,
  461. valid = false;
  462. for (var i=0; i < count; i++) {
  463. if (group[i].checked) valid = true;
  464. }
  465. for (var i=0; i < count; i++) {
  466. if (valid) {
  467. $(group[i]).removeAttr('data-invalid').parent().removeClass('error');
  468. } else {
  469. $(group[i]).attr('data-invalid', '').parent().addClass('error');
  470. }
  471. }
  472. return valid;
  473. },
  474. valid_equal: function(el, required) {
  475. var from = document.getElementById(el.getAttribute('data-equalto')).value,
  476. to = el.value,
  477. valid = (from === to);
  478. if (valid) {
  479. $(el).removeAttr('data-invalid').parent().removeClass('error');
  480. } else {
  481. $(el).attr('data-invalid', '').parent().addClass('error');
  482. }
  483. return valid;
  484. }
  485. };
  486. }(jQuery, this, this.document));
  487. ;(function ($, window, document, undefined) {
  488. 'use strict';
  489. Foundation.libs.accordion = {
  490. name : 'accordion',
  491. version : '5.0.1',
  492. settings : {
  493. active_class: 'active',
  494. toggleable: true
  495. },
  496. init : function (scope, method, options) {
  497. this.bindings(method, options);
  498. },
  499. events : function () {
  500. $(this.scope).off('.accordion').on('click.fndtn.accordion', '[data-accordion] > dd > a', function (e) {
  501. var accordion = $(this).parent(),
  502. target = $('#' + this.href.split('#')[1]),
  503. siblings = $('> dd > .content', target.closest('[data-accordion]')),
  504. settings = accordion.parent().data('accordion-init'),
  505. active = $('> dd > .content.' + settings.active_class, accordion.parent());
  506. e.preventDefault();
  507. if (active[0] == target[0] && settings.toggleable) {
  508. return target.toggleClass(settings.active_class);
  509. }
  510. siblings.removeClass(settings.active_class);
  511. target.addClass(settings.active_class);
  512. });
  513. },
  514. off : function () {},
  515. reflow : function () {}
  516. };
  517. }(jQuery, this, this.document));
  518. ;(function ($, window, document, undefined) {
  519. 'use strict';
  520. Foundation.libs.alert = {
  521. name : 'alert',
  522. version : '5.0.0',
  523. settings : {
  524. animation: 'fadeOut',
  525. speed: 300, // fade out speed
  526. callback: function (){}
  527. },
  528. init : function (scope, method, options) {
  529. this.bindings(method, options);
  530. },
  531. events : function () {
  532. $(this.scope).off('.alert').on('click.fndtn.alert', '[data-alert] a.close', function (e) {
  533. var alertBox = $(this).closest("[data-alert]"),
  534. settings = alertBox.data('alert-init');
  535. e.preventDefault();
  536. alertBox[settings.animation](settings.speed, function () {
  537. $(this).trigger('closed').remove();
  538. settings.callback();
  539. });
  540. });
  541. },
  542. reflow : function () {}
  543. };
  544. }(jQuery, this, this.document));
  545. ;(function ($, window, document, undefined) {
  546. 'use strict';
  547. Foundation.libs.clearing = {
  548. name : 'clearing',
  549. version: '5.0.0',
  550. settings : {
  551. templates : {
  552. viewing : '<a href="#" class="clearing-close">&times;</a>' +
  553. '<div class="visible-img" style="display: none"><img src="//:0">' +
  554. '<p class="clearing-caption"></p><a href="#" class="clearing-main-prev"><span></span></a>' +
  555. '<a href="#" class="clearing-main-next"><span></span></a></div>'
  556. },
  557. // comma delimited list of selectors that, on click, will close clearing,
  558. // add 'div.clearing-blackout, div.visible-img' to close on background click
  559. close_selectors : '.clearing-close',
  560. // event initializers and locks
  561. init : false,
  562. locked : false
  563. },
  564. init : function (scope, method, options) {
  565. var self = this;
  566. Foundation.inherit(this, 'throttle loaded');
  567. this.bindings(method, options);
  568. if ($(this.scope).is('[data-clearing]')) {
  569. this.assemble($('li', this.scope));
  570. } else {
  571. $('[data-clearing]', this.scope).each(function () {
  572. self.assemble($('li', this));
  573. });
  574. }
  575. },
  576. events : function (scope) {
  577. var self = this;
  578. $(this.scope)
  579. .off('.clearing')
  580. .on('click.fndtn.clearing', 'ul[data-clearing] li',
  581. function (e, current, target) {
  582. var current = current || $(this),
  583. target = target || current,
  584. next = current.next('li'),
  585. settings = current.closest('[data-clearing]').data('clearing-init'),
  586. image = $(e.target);
  587. e.preventDefault();
  588. if (!settings) {
  589. self.init();
  590. settings = current.closest('[data-clearing]').data('clearing-init');
  591. }
  592. // if clearing is open and the current image is
  593. // clicked, go to the next image in sequence
  594. if (target.hasClass('visible') &&
  595. current[0] === target[0] &&
  596. next.length > 0 && self.is_open(current)) {
  597. target = next;
  598. image = $('img', target);
  599. }
  600. // set current and target to the clicked li if not otherwise defined.
  601. self.open(image, current, target);
  602. self.update_paddles(target);
  603. })
  604. .on('click.fndtn.clearing', '.clearing-main-next',
  605. function (e) { self.nav(e, 'next') })
  606. .on('click.fndtn.clearing', '.clearing-main-prev',
  607. function (e) { self.nav(e, 'prev') })
  608. .on('click.fndtn.clearing', this.settings.close_selectors,
  609. function (e) { Foundation.libs.clearing.close(e, this) })
  610. .on('keydown.fndtn.clearing',
  611. function (e) { self.keydown(e) });
  612. $(window).off('.clearing').on('resize.fndtn.clearing',
  613. function () { self.resize() });
  614. this.swipe_events(scope);
  615. },
  616. swipe_events : function (scope) {
  617. var self = this;
  618. $(this.scope)
  619. .on('touchstart.fndtn.clearing', '.visible-img', function(e) {
  620. if (!e.touches) { e = e.originalEvent; }
  621. var data = {
  622. start_page_x: e.touches[0].pageX,
  623. start_page_y: e.touches[0].pageY,
  624. start_time: (new Date()).getTime(),
  625. delta_x: 0,
  626. is_scrolling: undefined
  627. };
  628. $(this).data('swipe-transition', data);
  629. e.stopPropagation();
  630. })
  631. .on('touchmove.fndtn.clearing', '.visible-img', function(e) {
  632. if (!e.touches) { e = e.originalEvent; }
  633. // Ignore pinch/zoom events
  634. if(e.touches.length > 1 || e.scale && e.scale !== 1) return;
  635. var data = $(this).data('swipe-transition');
  636. if (typeof data === 'undefined') {
  637. data = {};
  638. }
  639. data.delta_x = e.touches[0].pageX - data.start_page_x;
  640. if ( typeof data.is_scrolling === 'undefined') {
  641. data.is_scrolling = !!( data.is_scrolling || Math.abs(data.delta_x) < Math.abs(e.touches[0].pageY - data.start_page_y) );
  642. }
  643. if (!data.is_scrolling && !data.active) {
  644. e.preventDefault();
  645. var direction = (data.delta_x < 0) ? 'next' : 'prev';
  646. data.active = true;
  647. self.nav(e, direction);
  648. }
  649. })
  650. .on('touchend.fndtn.clearing', '.visible-img', function(e) {
  651. $(this).data('swipe-transition', {});
  652. e.stopPropagation();
  653. });
  654. },
  655. assemble : function ($li) {
  656. var $el = $li.parent();
  657. if ($el.parent().hasClass('carousel')) return;
  658. $el.after('<div id="foundationClearingHolder"></div>');
  659. var holder = $('#foundationClearingHolder'),
  660. settings = $el.data('clearing-init'),
  661. grid = $el.detach(),
  662. data = {
  663. grid: '<div class="carousel">' + grid[0].outerHTML + '</div>',
  664. viewing: settings.templates.viewing
  665. },
  666. wrapper = '<div class="clearing-assembled"><div>' + data.viewing +
  667. data.grid + '</div></div>';
  668. return holder.after(wrapper).remove();
  669. },
  670. open : function ($image, current, target) {
  671. var root = target.closest('.clearing-assembled'),
  672. container = $('div', root).first(),
  673. visible_image = $('.visible-img', container),
  674. image = $('img', visible_image).not($image);
  675. if (!this.locked()) {
  676. // set the image to the selected thumbnail
  677. image
  678. .attr('src', this.load($image))
  679. .css('visibility', 'hidden');
  680. this.loaded(image, function () {
  681. image.css('visibility', 'visible');
  682. // toggle the gallery
  683. root.addClass('clearing-blackout');
  684. container.addClass('clearing-container');
  685. visible_image.show();
  686. this.fix_height(target)
  687. .caption($('.clearing-caption', visible_image), $image)
  688. .center(image)
  689. .shift(current, target, function () {
  690. target.siblings().removeClass('visible');
  691. target.addClass('visible');
  692. });
  693. }.bind(this));
  694. }
  695. },
  696. close : function (e, el) {
  697. e.preventDefault();
  698. var root = (function (target) {
  699. if (/blackout/.test(target.selector)) {
  700. return target;
  701. } else {
  702. return target.closest('.clearing-blackout');
  703. }
  704. }($(el))), container, visible_image;
  705. if (el === e.target && root) {
  706. container = $('div', root).first();
  707. visible_image = $('.visible-img', container);
  708. this.settings.prev_index = 0;
  709. $('ul[data-clearing]', root)
  710. .attr('style', '').closest('.clearing-blackout')
  711. .removeClass('clearing-blackout');
  712. container.removeClass('clearing-container');
  713. visible_image.hide();
  714. }
  715. return false;
  716. },
  717. is_open : function (current) {
  718. return current.parent().prop('style').length > 0;
  719. },
  720. keydown : function (e) {
  721. var clearing = $('ul[data-clearing]', '.clearing-blackout');
  722. if (e.which === 39) this.go(clearing, 'next');
  723. if (e.which === 37) this.go(clearing, 'prev');
  724. if (e.which === 27) $('a.clearing-close').trigger('click');
  725. },
  726. nav : function (e, direction) {
  727. var clearing = $('ul[data-clearing]', '.clearing-blackout');
  728. e.preventDefault();
  729. this.go(clearing, direction);
  730. },
  731. resize : function () {
  732. var image = $('img', '.clearing-blackout .visible-img');
  733. if (image.length) {
  734. this.center(image);
  735. }
  736. },
  737. // visual adjustments
  738. fix_height : function (target) {
  739. var lis = target.parent().children(),
  740. self = this;
  741. lis.each(function () {
  742. var li = $(this),
  743. image = li.find('img');
  744. if (li.height() > image.outerHeight()) {
  745. li.addClass('fix-height');
  746. }
  747. })
  748. .closest('ul')
  749. .width(lis.length * 100 + '%');
  750. return this;
  751. },
  752. update_paddles : function (target) {
  753. var visible_image = target
  754. .closest('.carousel')
  755. .siblings('.visible-img');
  756. if (target.next().length > 0) {
  757. $('.clearing-main-next', visible_image)
  758. .removeClass('disabled');
  759. } else {
  760. $('.clearing-main-next', visible_image)
  761. .addClass('disabled');
  762. }
  763. if (target.prev().length > 0) {
  764. $('.clearing-main-prev', visible_image)
  765. .removeClass('disabled');
  766. } else {
  767. $('.clearing-main-prev', visible_image)
  768. .addClass('disabled');
  769. }
  770. },
  771. center : function (target) {
  772. if (!this.rtl) {
  773. target.css({
  774. marginLeft : -(target.outerWidth() / 2),
  775. marginTop : -(target.outerHeight() / 2)
  776. });
  777. } else {
  778. target.css({
  779. marginRight : -(target.outerWidth() / 2),
  780. marginTop : -(target.outerHeight() / 2)
  781. });
  782. }
  783. return this;
  784. },
  785. // image loading and preloading
  786. load : function ($image) {
  787. if ($image[0].nodeName === "A") {
  788. var href = $image.attr('href');
  789. } else {
  790. var href = $image.parent().attr('href');
  791. }
  792. this.preload($image);
  793. if (href) return href;
  794. return $image.attr('src');
  795. },
  796. preload : function ($image) {
  797. this
  798. .img($image.closest('li').next())
  799. .img($image.closest('li').prev());
  800. },
  801. img : function (img) {
  802. if (img.length) {
  803. var new_img = new Image(),
  804. new_a = $('a', img);
  805. if (new_a.length) {
  806. new_img.src = new_a.attr('href');
  807. } else {
  808. new_img.src = $('img', img).attr('src');
  809. }
  810. }
  811. return this;
  812. },
  813. // image caption
  814. caption : function (container, $image) {
  815. var caption = $image.data('caption');
  816. if (caption) {
  817. container
  818. .html(caption)
  819. .show();
  820. } else {
  821. container
  822. .text('')
  823. .hide();
  824. }
  825. return this;
  826. },
  827. // directional methods
  828. go : function ($ul, direction) {
  829. var current = $('.visible', $ul),
  830. target = current[direction]();
  831. if (target.length) {
  832. $('img', target)
  833. .trigger('click', [current, target]);
  834. }
  835. },
  836. shift : function (current, target, callback) {
  837. var clearing = target.parent(),
  838. old_index = this.settings.prev_index || target.index(),
  839. direction = this.direction(clearing, current, target),
  840. left = parseInt(clearing.css('left'), 10),
  841. width = target.outerWidth(),
  842. skip_shift;
  843. // we use jQuery animate instead of CSS transitions because we
  844. // need a callback to unlock the next animation
  845. if (target.index() !== old_index && !/skip/.test(direction)){
  846. if (/left/.test(direction)) {
  847. this.lock();
  848. clearing.animate({left : left + width}, 300, this.unlock());
  849. } else if (/right/.test(direction)) {
  850. this.lock();
  851. clearing.animate({left : left - width}, 300, this.unlock());
  852. }
  853. } else if (/skip/.test(direction)) {
  854. // the target image is not adjacent to the current image, so
  855. // do we scroll right or not
  856. skip_shift = target.index() - this.settings.up_count;
  857. this.lock();
  858. if (skip_shift > 0) {
  859. clearing.animate({left : -(skip_shift * width)}, 300, this.unlock());
  860. } else {
  861. clearing.animate({left : 0}, 300, this.unlock());
  862. }
  863. }
  864. callback();
  865. },
  866. direction : function ($el, current, target) {
  867. var lis = $('li', $el),
  868. li_width = lis.outerWidth() + (lis.outerWidth() / 4),
  869. up_count = Math.floor($('.clearing-container').outerWidth() / li_width) - 1,
  870. target_index = lis.index(target),
  871. response;
  872. this.settings.up_count = up_count;
  873. if (this.adjacent(this.settings.prev_index, target_index)) {
  874. if ((target_index > up_count)
  875. && target_index > this.settings.prev_index) {
  876. response = 'right';
  877. } else if ((target_index > up_count - 1)
  878. && target_index <= this.settings.prev_index) {
  879. response = 'left';
  880. } else {
  881. response = false;
  882. }
  883. } else {
  884. response = 'skip';
  885. }
  886. this.settings.prev_index = target_index;
  887. return response;
  888. },
  889. adjacent : function (current_index, target_index) {
  890. for (var i = target_index + 1; i >= target_index - 1; i--) {
  891. if (i === current_index) return true;
  892. }
  893. return false;
  894. },
  895. // lock management
  896. lock : function () {
  897. this.settings.locked = true;
  898. },
  899. unlock : function () {
  900. this.settings.locked = false;
  901. },
  902. locked : function () {
  903. return this.settings.locked;
  904. },
  905. off : function () {
  906. $(this.scope).off('.fndtn.clearing');
  907. $(window).off('.fndtn.clearing');
  908. },
  909. reflow : function () {
  910. this.init();
  911. }
  912. };
  913. }(jQuery, this, this.document));
  914. ;(function ($, window, document, undefined) {
  915. 'use strict';
  916. Foundation.libs.dropdown = {
  917. name : 'dropdown',
  918. version : '5.0.0',
  919. settings : {
  920. active_class: 'open',
  921. is_hover: false,
  922. opened: function(){},
  923. closed: function(){}
  924. },
  925. init : function (scope, method, options) {
  926. Foundation.inherit(this, 'throttle');
  927. this.bindings(method, options);
  928. },
  929. events : function (scope) {
  930. var self = this;
  931. $(this.scope)
  932. .off('.dropdown')
  933. .on('click.fndtn.dropdown', '[data-dropdown]', function (e) {
  934. var settings = $(this).data('dropdown-init');
  935. e.preventDefault();
  936. if (!settings.is_hover || Modernizr.touch) self.toggle($(this));
  937. })
  938. .on('mouseenter.fndtn.dropdown', '[data-dropdown], [data-dropdown-content]', function (e) {
  939. var $this = $(this);
  940. clearTimeout(self.timeout);
  941. if ($this.data('dropdown')) {
  942. var dropdown = $('#' + $this.data('dropdown')),
  943. target = $this;
  944. } else {
  945. var dropdown = $this;
  946. target = $("[data-dropdown='" + dropdown.attr('id') + "']");
  947. }
  948. var settings = target.data('dropdown-init');
  949. if (settings.is_hover) self.open.apply(self, [dropdown, target]);
  950. })
  951. .on('mouseleave.fndtn.dropdown', '[data-dropdown], [data-dropdown-content]', function (e) {
  952. var $this = $(this);
  953. self.timeout = setTimeout(function () {
  954. if ($this.data('dropdown')) {
  955. var settings = $this.data('dropdown-init');
  956. if (settings.is_hover) self.close.call(self, $('#' + $this.data('dropdown')));
  957. } else {
  958. var target = $('[data-dropdown="' + $(this).attr('id') + '"]'),
  959. settings = target.data('dropdown-init');
  960. if (settings.is_hover) self.close.call(self, $this);
  961. }
  962. }.bind(this), 150);
  963. })
  964. .on('click.fndtn.dropdown', function (e) {
  965. var parent = $(e.target).closest('[data-dropdown-content]');
  966. if ($(e.target).data('dropdown') || $(e.target).parent().data('dropdown')) {
  967. return;
  968. }
  969. if (!($(e.target).data('revealId')) &&
  970. (parent.length > 0 && ($(e.target).is('[data-dropdown-content]') ||
  971. $.contains(parent.first()[0], e.target)))) {
  972. e.stopPropagation();
  973. return;
  974. }
  975. self.close.call(self, $('[data-dropdown-content]'));
  976. })
  977. .on('opened.fndtn.dropdown', '[data-dropdown-content]', this.settings.opened)
  978. .on('closed.fndtn.dropdown', '[data-dropdown-content]', this.settings.closed);
  979. $(window)
  980. .off('.dropdown')
  981. .on('resize.fndtn.dropdown', self.throttle(function () {
  982. self.resize.call(self);
  983. }, 50)).trigger('resize');
  984. },
  985. close: function (dropdown) {
  986. var self = this;
  987. dropdown.each(function () {
  988. if ($(this).hasClass(self.settings.active_class)) {
  989. $(this)
  990. .css(Foundation.rtl ? 'right':'left', '-99999px')
  991. .removeClass(self.settings.active_class);
  992. $(this).trigger('closed');
  993. }
  994. });
  995. },
  996. open: function (dropdown, target) {
  997. this
  998. .css(dropdown
  999. .addClass(this.settings.active_class), target);
  1000. dropdown.trigger('opened');
  1001. },
  1002. toggle : function (target) {
  1003. var dropdown = $('#' + target.data('dropdown'));
  1004. if (dropdown.length === 0) {
  1005. // No dropdown found, not continuing
  1006. return;
  1007. }
  1008. this.close.call(this, $('[data-dropdown-content]').not(dropdown));
  1009. if (dropdown.hasClass(this.settings.active_class)) {
  1010. this.close.call(this, dropdown);
  1011. } else {
  1012. this.close.call(this, $('[data-dropdown-content]'))
  1013. this.open.call(this, dropdown, target);
  1014. }
  1015. },
  1016. resize : function () {
  1017. var dropdown = $('[data-dropdown-content].open'),
  1018. target = $("[data-dropdown='" + dropdown.attr('id') + "']");
  1019. if (dropdown.length && target.length) {
  1020. this.css(dropdown, target);
  1021. }
  1022. },
  1023. css : function (dropdown, target) {
  1024. var offset_parent = dropdown.offsetParent(),
  1025. position = target.offset();
  1026. position.top -= offset_parent.offset().top;
  1027. position.left -= offset_parent.offset().left;
  1028. if (this.small()) {
  1029. dropdown.css({
  1030. position : 'absolute',
  1031. width: '95%',
  1032. 'max-width': 'none',
  1033. top: position.top + target.outerHeight()
  1034. });
  1035. dropdown.css(Foundation.rtl ? 'right':'left', '2.5%');
  1036. } else {
  1037. if (!Foundation.rtl && $(window).width() > dropdown.outerWidth() + target.offset().left) {
  1038. var left = position.left;
  1039. if (dropdown.hasClass('right')) {
  1040. dropdown.removeClass('right');
  1041. }
  1042. } else {
  1043. if (!dropdown.hasClass('right')) {
  1044. dropdown.addClass('right');
  1045. }
  1046. var left = position.left - (dropdown.outerWidth() - target.outerWidth());
  1047. }
  1048. dropdown.attr('style', '').css({
  1049. position : 'absolute',
  1050. top: position.top + target.outerHeight(),
  1051. left: left
  1052. });
  1053. }
  1054. return dropdown;
  1055. },
  1056. small : function () {
  1057. return matchMedia(Foundation.media_queries.small).matches &&
  1058. !matchMedia(Foundation.media_queries.medium).matches;
  1059. },
  1060. off: function () {
  1061. $(this.scope).off('.fndtn.dropdown');
  1062. $('html, body').off('.fndtn.dropdown');
  1063. $(window).off('.fndtn.dropdown');
  1064. $('[data-dropdown-content]').off('.fndtn.dropdown');
  1065. this.settings.init = false;
  1066. },
  1067. reflow : function () {}
  1068. };
  1069. }(jQuery, this, this.document));
  1070. ;(function ($, window, document, undefined) {
  1071. 'use strict';
  1072. Foundation.libs.interchange = {
  1073. name : 'interchange',
  1074. version : '5.0.0',
  1075. cache : {},
  1076. images_loaded : false,
  1077. nodes_loaded : false,
  1078. settings : {
  1079. load_attr : 'interchange',
  1080. named_queries : {
  1081. 'default' : Foundation.media_queries.small,
  1082. small : Foundation.media_queries.small,
  1083. medium : Foundation.media_queries.medium,
  1084. large : Foundation.media_queries.large,
  1085. xlarge : Foundation.media_queries.xlarge,
  1086. xxlarge: Foundation.media_queries.xxlarge,
  1087. landscape : 'only screen and (orientation: landscape)',
  1088. portrait : 'only screen and (orientation: portrait)',
  1089. retina : 'only screen and (-webkit-min-device-pixel-ratio: 2),' +
  1090. 'only screen and (min--moz-device-pixel-ratio: 2),' +
  1091. 'only screen and (-o-min-device-pixel-ratio: 2/1),' +
  1092. 'only screen and (min-device-pixel-ratio: 2),' +
  1093. 'only screen and (min-resolution: 192dpi),' +
  1094. 'only screen and (min-resolution: 2dppx)'
  1095. },
  1096. directives : {
  1097. replace: function (el, path, trigger) {
  1098. // The trigger argument, if called within the directive, fires
  1099. // an event named after the directive on the element, passing
  1100. // any parameters along to the event that you pass to trigger.
  1101. //
  1102. // ex. trigger(), trigger([a, b, c]), or trigger(a, b, c)
  1103. //
  1104. // This allows you to bind a callback like so:
  1105. // $('#interchangeContainer').on('replace', function (e, a, b, c) {
  1106. // console.log($(this).html(), a, b, c);
  1107. // });
  1108. if (/IMG/.test(el[0].nodeName)) {
  1109. var orig_path = el[0].src;
  1110. if (new RegExp(path, 'i').test(orig_path)) return;
  1111. el[0].src = path;
  1112. return trigger(el[0].src);
  1113. }
  1114. var last_path = el.data('interchange-last-path');
  1115. if (last_path == path) return;
  1116. return $.get(path, function (response) {
  1117. el.html(response);
  1118. el.data('interchange-last-path', path);
  1119. trigger();
  1120. });
  1121. }
  1122. }
  1123. },
  1124. init : function (scope, method, options) {
  1125. Foundation.inherit(this, 'throttle');
  1126. this.data_attr = 'data-' + this.settings.load_attr;
  1127. this.bindings(method, options);
  1128. this.load('images');
  1129. this.load('nodes');
  1130. },
  1131. events : function () {
  1132. var self = this;
  1133. $(window)
  1134. .off('.interchange')
  1135. .on('resize.fndtn.interchange', self.throttle(function () {
  1136. self.resize.call(self);
  1137. }, 50));
  1138. return this;
  1139. },
  1140. resize : function () {
  1141. var cache = this.cache;
  1142. if(!this.images_loaded || !this.nodes_loaded) {
  1143. setTimeout($.proxy(this.resize, this), 50);
  1144. return;
  1145. }
  1146. for (var uuid in cache) {
  1147. if (cache.hasOwnProperty(uuid)) {
  1148. var passed = this.results(uuid, cache[uuid]);
  1149. if (passed) {
  1150. this.settings.directives[passed
  1151. .scenario[1]](passed.el, passed.scenario[0], function () {
  1152. if (arguments[0] instanceof Array) {
  1153. var args = arguments[0];
  1154. } else {
  1155. var args = Array.prototype.slice.call(arguments, 0);
  1156. }
  1157. passed.el.trigger(passed.scenario[1], args);
  1158. });
  1159. }
  1160. }
  1161. }
  1162. },
  1163. results : function (uuid, scenarios) {
  1164. var count = scenarios.length;
  1165. if (count > 0) {
  1166. var el = this.S('[data-uuid="' + uuid + '"]');
  1167. for (var i = count - 1; i >= 0; i--) {
  1168. var mq, rule = scenarios[i][2];
  1169. if (this.settings.named_queries.hasOwnProperty(rule)) {
  1170. mq = matchMedia(this.settings.named_queries[rule]);
  1171. } else {
  1172. mq = matchMedia(rule);
  1173. }
  1174. if (mq.matches) {
  1175. return {el: el, scenario: scenarios[i]};
  1176. }
  1177. }
  1178. }
  1179. return false;
  1180. },
  1181. load : function (type, force_update) {
  1182. if (typeof this['cached_' + type] === 'undefined' || force_update) {
  1183. this['update_' + type]();
  1184. }
  1185. return this['cached_' + type];
  1186. },
  1187. update_images : function () {
  1188. var images = this.S('img[' + this.data_attr + ']'),
  1189. count = images.length,
  1190. loaded_count = 0,
  1191. data_attr = this.data_attr;
  1192. this.cache = {};
  1193. this.cached_images = [];
  1194. this.images_loaded = (count === 0);
  1195. for (var i = count - 1; i >= 0; i--) {
  1196. loaded_count++;
  1197. if (images[i]) {
  1198. var str = images[i].getAttribute(data_attr) || '';
  1199. if (str.length > 0) {
  1200. this.cached_images.push(images[i]);
  1201. }
  1202. }
  1203. if(loaded_count === count) {
  1204. this.images_loaded = true;
  1205. this.enhance('images');
  1206. }
  1207. }
  1208. return this;
  1209. },
  1210. update_nodes : function () {
  1211. var nodes = this.S('[' + this.data_attr + ']:not(img)'),
  1212. count = nodes.length,
  1213. loaded_count = 0,
  1214. data_attr = this.data_attr;
  1215. this.cached_nodes = [];
  1216. // Set nodes_loaded to true if there are no nodes
  1217. // this.nodes_loaded = false;
  1218. this.nodes_loaded = (count === 0);
  1219. for (var i = count - 1; i >= 0; i--) {
  1220. loaded_count++;
  1221. var str = nodes[i].getAttribute(data_attr) || '';
  1222. if (str.length > 0) {
  1223. this.cached_nodes.push(nodes[i]);
  1224. }
  1225. if(loaded_count === count) {
  1226. this.nodes_loaded = true;
  1227. this.enhance('nodes');
  1228. }
  1229. }
  1230. return this;
  1231. },
  1232. enhance : function (type) {
  1233. var count = this['cached_' + type].length;
  1234. for (var i = count - 1; i >= 0; i--) {
  1235. this.object($(this['cached_' + type][i]));
  1236. }
  1237. return $(window).trigger('resize');
  1238. },
  1239. parse_params : function (path, directive, mq) {
  1240. return [this.trim(path), this.convert_directive(directive), this.trim(mq)];
  1241. },
  1242. convert_directive : function (directive) {
  1243. var trimmed = this.trim(directive);
  1244. if (trimmed.length > 0) {
  1245. return trimmed;
  1246. }
  1247. return 'replace';
  1248. },
  1249. object : function(el) {
  1250. var raw_arr = this.parse_data_attr(el),
  1251. scenarios = [], count = raw_arr.length;
  1252. if (count > 0) {
  1253. for (var i = count - 1; i >= 0; i--) {
  1254. var split = raw_arr[i].split(/\((.*?)(\))$/);
  1255. if (split.length > 1) {
  1256. var cached_split = split[0].split(','),
  1257. params = this.parse_params(cached_split[0],
  1258. cached_split[1], split[1]);
  1259. scenarios.push(params);
  1260. }
  1261. }
  1262. }
  1263. return this.store(el, scenarios);
  1264. },
  1265. uuid : function (separator) {
  1266. var delim = separator || "-";
  1267. function S4() {
  1268. return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
  1269. }
  1270. return (S4() + S4() + delim + S4() + delim + S4()
  1271. + delim + S4() + delim + S4() + S4() + S4());
  1272. },
  1273. store : function (el, scenarios) {
  1274. var uuid = this.uuid(),
  1275. current_uuid = el.data('uuid');
  1276. if (current_uuid) return this.cache[current_uuid];
  1277. el.attr('data-uuid', uuid);
  1278. return this.cache[uuid] = scenarios;
  1279. },
  1280. trim : function(str) {
  1281. if (typeof str === 'string') {
  1282. return $.trim(str);
  1283. }
  1284. return str;
  1285. },
  1286. parse_data_attr : function (el) {
  1287. var raw = el.data(this.settings.load_attr).split(/\[(.*?)\]/),
  1288. count = raw.length, output = [];
  1289. for (var i = count - 1; i >= 0; i--) {
  1290. if (raw[i].replace(/[\W\d]+/, '').length > 4) {
  1291. output.push(raw[i]);
  1292. }
  1293. }
  1294. return output;
  1295. },
  1296. reflow : function () {
  1297. this.load('images', true);
  1298. this.load('nodes', true);
  1299. }
  1300. };
  1301. }(jQuery, this, this.document));
  1302. ;(function ($, window, document, undefined) {
  1303. 'use strict';
  1304. var Modernizr = Modernizr || false;
  1305. Foundation.libs.joyride = {
  1306. name : 'joyride',
  1307. version : '5.0.0',
  1308. defaults : {
  1309. expose : false, // turn on or off the expose feature
  1310. modal : true, // Whether to cover page with modal during the tour
  1311. tip_location : 'bottom', // 'top' or 'bottom' in relation to parent
  1312. nub_position : 'auto', // override on a per tooltip bases
  1313. scroll_speed : 1500, // Page scrolling speed in milliseconds, 0 = no scroll animation
  1314. scroll_animation : 'linear', // supports 'swing' and 'linear', extend with jQuery UI.
  1315. timer : 0, // 0 = no timer , all other numbers = timer in milliseconds
  1316. start_timer_on_click : true, // true or false - true requires clicking the first button start the timer
  1317. start_offset : 0, // the index of the tooltip you want to start on (index of the li)
  1318. next_button : true, // true or false to control whether a next button is used
  1319. tip_animation : 'fade', // 'pop' or 'fade' in each tip
  1320. pause_after : [], // array of indexes where to pause the tour after
  1321. exposed : [], // array of expose elements
  1322. tip_animation_fade_speed: 300, // when tipAnimation = 'fade' this is speed in milliseconds for the transition
  1323. cookie_monster : false, // true or false to control whether cookies are used
  1324. cookie_name : 'joyride', // Name the cookie you'll use
  1325. cookie_domain : false, // Will this cookie be attached to a domain, ie. '.notableapp.com'
  1326. cookie_expires : 365, // set when you would like the cookie to expire.
  1327. tip_container : 'body', // Where will the tip be attached
  1328. tip_location_patterns : {
  1329. top: ['bottom'],
  1330. bottom: [], // bottom should not need to be repositioned
  1331. left: ['right', 'top', 'bottom'],
  1332. right: ['left', 'top', 'bottom']
  1333. },
  1334. post_ride_callback : function (){}, // A method to call once the tour closes (canceled or complete)
  1335. post_step_callback : function (){}, // A method to call after each step
  1336. pre_step_callback : function (){}, // A method to call before each step
  1337. pre_ride_callback : function (){}, // A method to call before the tour starts (passed index, tip, and cloned exposed element)
  1338. post_expose_callback : function (){}, // A method to call after an element has been exposed
  1339. template : { // HTML segments for tip layout
  1340. link : '<a href="#close" class="joyride-close-tip">&times;</a>',
  1341. timer : '<div class="joyride-timer-indicator-wrap"><span class="joyride-timer-indicator"></span></div>',
  1342. tip : '<div class="joyride-tip-guide"><span class="joyride-nub"></span></div>',
  1343. wrapper : '<div class="joyride-content-wrapper"></div>',
  1344. button : '<a href="#" class="small button joyride-next-tip"></a>',
  1345. modal : '<div class="joyride-modal-bg"></div>',
  1346. expose : '<div class="joyride-expose-wrapper"></div>',
  1347. expose_cover: '<div class="joyride-expose-cover"></div>'
  1348. },
  1349. expose_add_class : '' // One or more space-separated class names to be added to exposed element
  1350. },
  1351. init : function (scope, method, options) {
  1352. Foundation.inherit(this, 'throttle delay');
  1353. this.settings = this.defaults;
  1354. this.bindings(method, options)
  1355. },
  1356. events : function () {
  1357. var self = this;
  1358. $(this.scope)
  1359. .off('.joyride')
  1360. .on('click.fndtn.joyride', '.joyride-next-tip, .joyride-modal-bg', function (e) {
  1361. e.preventDefault();
  1362. if (this.settings.$li.next().length < 1) {
  1363. this.end();
  1364. } else if (this.settings.timer > 0) {
  1365. clearTimeout(this.settings.automate);
  1366. this.hide();
  1367. this.show();
  1368. this.startTimer();
  1369. } else {
  1370. this.hide();
  1371. this.show();
  1372. }
  1373. }.bind(this))
  1374. .on('click.fndtn.joyride', '.joyride-close-tip', function (e) {
  1375. e.preventDefault();
  1376. this.end();
  1377. }.bind(this));
  1378. $(window)
  1379. .off('.joyride')
  1380. .on('resize.fndtn.joyride', self.throttle(function () {
  1381. if ($('[data-joyride]').length > 0 && self.settings.$next_tip) {
  1382. if (self.settings.exposed.length > 0) {
  1383. var $els = $(self.settings.exposed);
  1384. $els.each(function () {
  1385. var $this = $(this);
  1386. self.un_expose($this);
  1387. self.expose($this);
  1388. });
  1389. }
  1390. if (self.is_phone()) {
  1391. self.pos_phone();
  1392. } else {
  1393. self.pos_default(false, true);
  1394. }
  1395. }
  1396. }, 100));
  1397. },
  1398. start : function () {
  1399. var self = this,
  1400. $this = $('[data-joyride]', this.scope),
  1401. integer_settings = ['timer', 'scrollSpeed', 'startOffset', 'tipAnimationFadeSpeed', 'cookieExpires'],
  1402. int_settings_count = integer_settings.length;
  1403. if (!$this.length > 0) return;
  1404. if (!this.settings.init) this.events();
  1405. this.settings = $this.data('joyride-init');
  1406. // non configureable settings
  1407. this.settings.$content_el = $this;
  1408. this.settings.$body = $(this.settings.tip_container);
  1409. this.settings.body_offset = $(this.settings.tip_container).position();
  1410. this.settings.$tip_content = this.settings.$content_el.find('> li');
  1411. this.settings.paused = false;
  1412. this.settings.attempts = 0;
  1413. // can we create cookies?
  1414. if (typeof $.cookie !== 'function') {
  1415. this.settings.cookie_monster = false;
  1416. }
  1417. // generate the tips and insert into dom.
  1418. if (!this.settings.cookie_monster || this.settings.cookie_monster && $.cookie(this.settings.cookie_name) === null) {
  1419. this.settings.$tip_content.each(function (index) {
  1420. var $this = $(this);
  1421. this.settings = $.extend({}, self.defaults, self.data_options($this))
  1422. // Make sure that settings parsed from data_options are integers where necessary
  1423. for (var i = int_settings_count - 1; i >= 0; i--) {
  1424. self.settings[integer_settings[i]] = parseInt(self.settings[integer_settings[i]], 10);
  1425. }
  1426. self.create({$li : $this, index : index});
  1427. });
  1428. // show first tip
  1429. if (!this.settings.start_timer_on_click && this.settings.timer > 0) {
  1430. this.show('init');
  1431. this.startTimer();
  1432. } else {
  1433. this.show('init');
  1434. }
  1435. }
  1436. },
  1437. resume : function () {
  1438. this.set_li();
  1439. this.show();
  1440. },
  1441. tip_template : function (opts) {
  1442. var $blank, content;
  1443. opts.tip_class = opts.tip_class || '';
  1444. $blank = $(this.settings.template.tip).addClass(opts.tip_class);
  1445. content = $.trim($(opts.li).html()) +
  1446. this.button_text(opts.button_text) +
  1447. this.settings.template.link +
  1448. this.timer_instance(opts.index);
  1449. $blank.append($(this.settings.template.wrapper));
  1450. $blank.first().attr('data-index', opts.index);
  1451. $('.joyride-content-wrapper', $blank).append(content);
  1452. return $blank[0];
  1453. },
  1454. timer_instance : function (index) {
  1455. var txt;
  1456. if ((index === 0 && this.settings.start_timer_on_click && this.settings.timer > 0) || this.settings.timer === 0) {
  1457. txt = '';
  1458. } else {
  1459. txt = $(this.settings.template.timer)[0].outerHTML;
  1460. }
  1461. return txt;
  1462. },
  1463. button_text : function (txt) {
  1464. if (this.settings.next_button) {
  1465. txt = $.trim(txt) || 'Next';
  1466. txt = $(this.settings.template.button).append(txt)[0].outerHTML;
  1467. } else {
  1468. txt = '';
  1469. }
  1470. return txt;
  1471. },
  1472. create : function (opts) {
  1473. var buttonText = opts.$li.attr('data-button') || opts.$li.attr('data-text'),
  1474. tipClass = opts.$li.attr('class'),
  1475. $tip_content = $(this.tip_template({
  1476. tip_class : tipClass,
  1477. index : opts.index,
  1478. button_text : buttonText,
  1479. li : opts.$li
  1480. }));
  1481. $(this.settings.tip_container).append($tip_content);
  1482. },
  1483. show : function (init) {
  1484. var $timer = null;
  1485. // are we paused?
  1486. if (this.settings.$li === undefined
  1487. || ($.inArray(this.settings.$li.index(), this.settings.pause_after) === -1)) {
  1488. // don't go to the next li if the tour was paused
  1489. if (this.settings.paused) {
  1490. this.settings.paused = false;
  1491. } else {
  1492. this.set_li(init);
  1493. }
  1494. this.settings.attempts = 0;
  1495. if (this.settings.$li.length && this.settings.$target.length > 0) {
  1496. if (init) { //run when we first start
  1497. this.settings.pre_ride_callback(this.settings.$li.index(), this.settings.$next_tip);
  1498. if (this.settings.modal) {
  1499. this.show_modal();
  1500. }
  1501. }
  1502. this.settings.pre_step_callback(this.settings.$li.index(), this.settings.$next_tip);
  1503. if (this.settings.modal && this.settings.expose) {
  1504. this.expose();
  1505. }
  1506. this.settings.tip_settings = $.extend({}, this.settings, this.data_options(this.settings.$li));
  1507. this.settings.timer = parseInt(this.settings.timer, 10);
  1508. this.settings.tip_settings.tip_location_pattern = this.settings.tip_location_patterns[this.settings.tip_settings.tip_location];
  1509. // scroll if not modal
  1510. if (!/body/i.test(this.settings.$target.selector)) {
  1511. this.scroll_to();
  1512. }
  1513. if (this.is_phone()) {
  1514. this.pos_phone(true);
  1515. } else {
  1516. this.pos_default(true);
  1517. }
  1518. $timer = this.settings.$next_tip.find('.joyride-timer-indicator');
  1519. if (/pop/i.test(this.settings.tip_animation)) {
  1520. $timer.width(0);
  1521. if (this.settings.timer > 0) {
  1522. this.settings.$next_tip.show();
  1523. this.delay(function () {
  1524. $timer.animate({
  1525. width: $timer.parent().width()
  1526. }, this.settings.timer, 'linear');
  1527. }.bind(this), this.settings.tip_animation_fade_speed);
  1528. } else {
  1529. this.settings.$next_tip.show();
  1530. }
  1531. } else if (/fade/i.test(this.settings.tip_animation)) {
  1532. $timer.width(0);
  1533. if (this.settings.timer > 0) {
  1534. this.settings.$next_tip
  1535. .fadeIn(this.settings.tip_animation_fade_speed)
  1536. .show();
  1537. this.delay(function () {
  1538. $timer.animate({
  1539. width: $timer.parent().width()
  1540. }, this.settings.timer, 'linear');
  1541. }.bind(this), this.settings.tip_animation_fadeSpeed);
  1542. } else {
  1543. this.settings.$next_tip.fadeIn(this.settings.tip_animation_fade_speed);
  1544. }
  1545. }
  1546. this.settings.$current_tip = this.settings.$next_tip;
  1547. // skip non-existant targets
  1548. } else if (this.settings.$li && this.settings.$target.length < 1) {
  1549. this.show();
  1550. } else {
  1551. this.end();
  1552. }
  1553. } else {
  1554. this.settings.paused = true;
  1555. }
  1556. },
  1557. is_phone : function () {
  1558. return matchMedia(Foundation.media_queries.small).matches &&
  1559. !matchMedia(Foundation.media_queries.medium).matches;
  1560. },
  1561. hide : function () {
  1562. if (this.settings.modal && this.settings.expose) {
  1563. this.un_expose();
  1564. }
  1565. if (!this.settings.modal) {
  1566. $('.joyride-modal-bg').hide();
  1567. }
  1568. // Prevent scroll bouncing...wait to remove from layout
  1569. this.settings.$current_tip.css('visibility', 'hidden');
  1570. setTimeout($.proxy(function() {
  1571. this.hide();
  1572. this.css('visibility', 'visible');
  1573. }, this.settings.$current_tip), 0);
  1574. this.settings.post_step_callback(this.settings.$li.index(),
  1575. this.settings.$current_tip);
  1576. },
  1577. set_li : function (init) {
  1578. if (init) {
  1579. this.settings.$li = this.settings.$tip_content.eq(this.settings.start_offset);
  1580. this.set_next_tip();
  1581. this.settings.$current_tip = this.settings.$next_tip;
  1582. } else {
  1583. this.settings.$li = this.settings.$li.next();
  1584. this.set_next_tip();
  1585. }
  1586. this.set_target();
  1587. },
  1588. set_next_tip : function () {
  1589. this.settings.$next_tip = $(".joyride-tip-guide").eq(this.settings.$li.index());
  1590. this.settings.$next_tip.data('closed', '');
  1591. },
  1592. set_target : function () {
  1593. var cl = this.settings.$li.attr('data-class'),
  1594. id = this.settings.$li.attr('data-id'),
  1595. $sel = function () {
  1596. if (id) {
  1597. return $(document.getElementById(id));
  1598. } else if (cl) {
  1599. return $('.' + cl).first();
  1600. } else {
  1601. return $('body');
  1602. }
  1603. };
  1604. this.settings.$target = $sel();
  1605. },
  1606. scroll_to : function () {
  1607. var window_half, tipOffset;
  1608. window_half = $(window).height() / 2;
  1609. tipOffset = Math.ceil(this.settings.$target.offset().top - window_half + this.settings.$next_tip.outerHeight());
  1610. if (tipOffset > 0) {
  1611. $('html, body').animate({
  1612. scrollTop: tipOffset
  1613. }, this.settings.scroll_speed, 'swing');
  1614. }
  1615. },
  1616. paused : function () {
  1617. return ($.inArray((this.settings.$li.index() + 1), this.settings.pause_after) === -1);
  1618. },
  1619. restart : function () {
  1620. this.hide();
  1621. this.settings.$li = undefined;
  1622. this.show('init');
  1623. },
  1624. pos_default : function (init, resizing) {
  1625. var half_fold = Math.ceil($(window).height() / 2),
  1626. tip_position = this.settings.$next_tip.offset(),
  1627. $nub = this.settings.$next_tip.find('.joyride-nub'),
  1628. nub_width = Math.ceil($nub.outerWidth() / 2),
  1629. nub_height = Math.ceil($nub.outerHeight() / 2),
  1630. toggle = init || false;
  1631. // tip must not be "display: none" to calculate position
  1632. if (toggle) {
  1633. this.settings.$next_tip.css('visibility', 'hidden');
  1634. this.settings.$next_tip.show();
  1635. }
  1636. if (typeof resizing === 'undefined') {
  1637. resizing = false;
  1638. }
  1639. if (!/body/i.test(this.settings.$target.selector)) {
  1640. if (this.bottom()) {
  1641. var leftOffset = this.settings.$target.offset().left;
  1642. if (Foundation.rtl) {
  1643. leftOffset = this.settings.$target.offset().width - this.settings.$next_tip.width() + leftOffset;
  1644. }
  1645. this.settings.$next_tip.css({
  1646. top: (this.settings.$target.offset().top + nub_height + this.settings.$target.outerHeight()),
  1647. left: leftOffset});
  1648. this.nub_position($nub, this.settings.tip_settings.nub_position, 'top');
  1649. } else if (this.top()) {
  1650. var leftOffset = this.settings.$target.offset().left;
  1651. if (Foundation.rtl) {
  1652. leftOffset = this.settings.$target.offset().width - this.settings.$next_tip.width() + leftOffset;
  1653. }
  1654. this.settings.$next_tip.css({
  1655. top: (this.settings.$target.offset().top - this.settings.$next_tip.outerHeight() - nub_height),
  1656. left: leftOffset});
  1657. this.nub_position($nub, this.settings.tip_settings.nub_position, 'bottom');
  1658. } else if (this.right()) {
  1659. this.settings.$next_tip.css({
  1660. top: this.settings.$target.offset().top,
  1661. left: (this.outerWidth(this.settings.$target) + this.settings.$target.offset().left + nub_width)});
  1662. this.nub_position($nub, this.settings.tip_settings.nub_position, 'left');
  1663. } else if (this.left()) {
  1664. this.settings.$next_tip.css({
  1665. top: this.settings.$target.offset().top,
  1666. left: (this.settings.$target.offset().left - this.outerWidth(this.settings.$next_tip) - nub_width)});
  1667. this.nub_position($nub, this.settings.tip_settings.nub_position, 'right');
  1668. }
  1669. if (!this.visible(this.corners(this.settings.$next_tip)) && this.settings.attempts < this.settings.tip_settings.tip_location_pattern.length) {
  1670. $nub.removeClass('bottom')
  1671. .removeClass('top')
  1672. .removeClass('right')
  1673. .removeClass('left');
  1674. this.settings.tip_settings.tip_location = this.settings.tip_settings.tip_location_pattern[this.settings.attempts];
  1675. this.settings.attempts++;
  1676. this.pos_default();
  1677. }
  1678. } else if (this.settings.$li.length) {
  1679. this.pos_modal($nub);
  1680. }
  1681. if (toggle) {
  1682. this.settings.$next_tip.hide();
  1683. this.settings.$next_tip.css('visibility', 'visible');
  1684. }
  1685. },
  1686. pos_phone : function (init) {
  1687. var tip_height = this.settings.$next_tip.outerHeight(),
  1688. tip_offset = this.settings.$next_tip.offset(),
  1689. target_height = this.settings.$target.outerHeight(),
  1690. $nub = $('.joyride-nub', this.settings.$next_tip),
  1691. nub_height = Math.ceil($nub.outerHeight() / 2),
  1692. toggle = init || false;
  1693. $nub.removeClass('bottom')
  1694. .removeClass('top')
  1695. .removeClass('right')
  1696. .removeClass('left');
  1697. if (toggle) {
  1698. this.settings.$next_tip.css('visibility', 'hidden');
  1699. this.settings.$next_tip.show();
  1700. }
  1701. if (!/body/i.test(this.settings.$target.selector)) {
  1702. if (this.top()) {
  1703. this.settings.$next_tip.offset({top: this.settings.$target.offset().top - tip_height - nub_height});
  1704. $nub.addClass('bottom');
  1705. } else {
  1706. this.settings.$next_tip.offset({top: this.settings.$target.offset().top + target_height + nub_height});
  1707. $nub.addClass('top');
  1708. }
  1709. } else if (this.settings.$li.length) {
  1710. this.pos_modal($nub);
  1711. }
  1712. if (toggle) {
  1713. this.settings.$next_tip.hide();
  1714. this.settings.$next_tip.css('visibility', 'visible');
  1715. }
  1716. },
  1717. pos_modal : function ($nub) {
  1718. this.center();
  1719. $nub.hide();
  1720. this.show_modal();
  1721. },
  1722. show_modal : function () {
  1723. if (!this.settings.$next_tip.data('closed')) {
  1724. var joyridemodalbg = $('.joyride-modal-bg');
  1725. if (joyridemodalbg.length < 1) {
  1726. $('body').append(this.settings.template.modal).show();
  1727. }
  1728. if (/pop/i.test(this.settings.tip_animation)) {
  1729. joyridemodalbg.show();
  1730. } else {
  1731. joyridemodalbg.fadeIn(this.settings.tip_animation_fade_speed);
  1732. }
  1733. }
  1734. },
  1735. expose : function () {
  1736. var expose,
  1737. exposeCover,
  1738. el,
  1739. origCSS,
  1740. origClasses,
  1741. randId = 'expose-'+Math.floor(Math.random()*10000);
  1742. if (arguments.length > 0 && arguments[0] instanceof $) {
  1743. el = arguments[0];
  1744. } else if(this.settings.$target && !/body/i.test(this.settings.$target.selector)){
  1745. el = this.settings.$target;
  1746. } else {
  1747. return false;
  1748. }
  1749. if(el.length < 1){
  1750. if(window.console){
  1751. console.error('element not valid', el);
  1752. }
  1753. return false;
  1754. }
  1755. expose = $(this.settings.template.expose);
  1756. this.settings.$body.append(expose);
  1757. expose.css({
  1758. top: el.offset().top,
  1759. left: el.offset().left,
  1760. width: el.outerWidth(true),
  1761. height: el.outerHeight(true)
  1762. });
  1763. exposeCover = $(this.settings.template.expose_cover);
  1764. origCSS = {
  1765. zIndex: el.css('z-index'),
  1766. position: el.css('position')
  1767. };
  1768. origClasses = el.attr('class') == null ? '' : el.attr('class');
  1769. el.css('z-index',parseInt(expose.css('z-index'))+1);
  1770. if (origCSS.position == 'static') {
  1771. el.css('position','relative');
  1772. }
  1773. el.data('expose-css',origCSS);
  1774. el.data('orig-class', origClasses);
  1775. el.attr('class', origClasses + ' ' + this.settings.expose_add_class);
  1776. exposeCover.css({
  1777. top: el.offset().top,
  1778. left: el.offset().left,
  1779. width: el.outerWidth(true),
  1780. height: el.outerHeight(true)
  1781. });
  1782. if (this.settings.modal) this.show_modal();
  1783. this.settings.$body.append(exposeCover);
  1784. expose.addClass(randId);
  1785. exposeCover.addClass(randId);
  1786. el.data('expose', randId);
  1787. this.settings.post_expose_callback(this.settings.$li.index(), this.settings.$next_tip, el);
  1788. this.add_exposed(el);
  1789. },
  1790. un_expose : function () {
  1791. var exposeId,
  1792. el,
  1793. expose ,
  1794. origCSS,
  1795. origClasses,
  1796. clearAll = false;
  1797. if (arguments.length > 0 && arguments[0] instanceof $) {
  1798. el = arguments[0];
  1799. } else if(this.settings.$target && !/body/i.test(this.settings.$target.selector)){
  1800. el = this.settings.$target;
  1801. } else {
  1802. return false;
  1803. }
  1804. if(el.length < 1){
  1805. if (window.console) {
  1806. console.error('element not valid', el);
  1807. }
  1808. return false;
  1809. }
  1810. exposeId = el.data('expose');
  1811. expose = $('.' + exposeId);
  1812. if (arguments.length > 1) {
  1813. clearAll = arguments[1];
  1814. }
  1815. if (clearAll === true) {
  1816. $('.joyride-expose-wrapper,.joyride-expose-cover').remove();
  1817. } else {
  1818. expose.remove();
  1819. }
  1820. origCSS = el.data('expose-css');
  1821. if (origCSS.zIndex == 'auto') {
  1822. el.css('z-index', '');
  1823. } else {
  1824. el.css('z-index', origCSS.zIndex);
  1825. }
  1826. if (origCSS.position != el.css('position')) {
  1827. if(origCSS.position == 'static') {// this is default, no need to set it.
  1828. el.css('position', '');
  1829. } else {
  1830. el.css('position', origCSS.position);
  1831. }
  1832. }
  1833. origClasses = el.data('orig-class');
  1834. el.attr('class', origClasses);
  1835. el.removeData('orig-classes');
  1836. el.removeData('expose');
  1837. el.removeData('expose-z-index');
  1838. this.remove_exposed(el);
  1839. },
  1840. add_exposed: function(el){
  1841. this.settings.exposed = this.settings.exposed || [];
  1842. if (el instanceof $ || typeof el === 'object') {
  1843. this.settings.exposed.push(el[0]);
  1844. } else if (typeof el == 'string') {
  1845. this.settings.exposed.push(el);
  1846. }
  1847. },
  1848. remove_exposed: function(el){
  1849. var search, count;
  1850. if (el instanceof $) {
  1851. search = el[0]
  1852. } else if (typeof el == 'string'){
  1853. search = el;
  1854. }
  1855. this.settings.exposed = this.settings.exposed || [];
  1856. count = this.settings.exposed.length;
  1857. for (var i=0; i < count; i++) {
  1858. if (this.settings.exposed[i] == search) {
  1859. this.settings.exposed.splice(i, 1);
  1860. return;
  1861. }
  1862. }
  1863. },
  1864. center : function () {
  1865. var $w = $(window);
  1866. this.settings.$next_tip.css({
  1867. top : ((($w.height() - this.settings.$next_tip.outerHeight()) / 2) + $w.scrollTop()),
  1868. left : ((($w.width() - this.settings.$next_tip.outerWidth()) / 2) + $w.scrollLeft())
  1869. });
  1870. return true;
  1871. },
  1872. bottom : function () {
  1873. return /bottom/i.test(this.settings.tip_settings.tip_location);
  1874. },
  1875. top : function () {
  1876. return /top/i.test(this.settings.tip_settings.tip_location);
  1877. },
  1878. right : function () {
  1879. return /right/i.test(this.settings.tip_settings.tip_location);
  1880. },
  1881. left : function () {
  1882. return /left/i.test(this.settings.tip_settings.tip_location);
  1883. },
  1884. corners : function (el) {
  1885. var w = $(window),
  1886. window_half = w.height() / 2,
  1887. //using this to calculate since scroll may not have finished yet.
  1888. tipOffset = Math.ceil(this.settings.$target.offset().top - window_half + this.settings.$next_tip.outerHeight()),
  1889. right = w.width() + w.scrollLeft(),
  1890. offsetBottom = w.height() + tipOffset,
  1891. bottom = w.height() + w.scrollTop(),
  1892. top = w.scrollTop();
  1893. if (tipOffset < top) {
  1894. if (tipOffset < 0) {
  1895. top = 0;
  1896. } else {
  1897. top = tipOffset;
  1898. }
  1899. }
  1900. if (offsetBottom > bottom) {
  1901. bottom = offsetBottom;
  1902. }
  1903. return [
  1904. el.offset().top < top,
  1905. right < el.offset().left + el.outerWidth(),
  1906. bottom < el.offset().top + el.outerHeight(),
  1907. w.scrollLeft() > el.offset().left
  1908. ];
  1909. },
  1910. visible : function (hidden_corners) {
  1911. var i = hidden_corners.length;
  1912. while (i--) {
  1913. if (hidden_corners[i]) return false;
  1914. }
  1915. return true;
  1916. },
  1917. nub_position : function (nub, pos, def) {
  1918. if (pos === 'auto') {
  1919. nub.addClass(def);
  1920. } else {
  1921. nub.addClass(pos);
  1922. }
  1923. },
  1924. startTimer : function () {
  1925. if (this.settings.$li.length) {
  1926. this.settings.automate = setTimeout(function () {
  1927. this.hide();
  1928. this.show();
  1929. this.startTimer();
  1930. }.bind(this), this.settings.timer);
  1931. } else {
  1932. clearTimeout(this.settings.automate);
  1933. }
  1934. },
  1935. end : function () {
  1936. if (this.settings.cookie_monster) {
  1937. $.cookie(this.settings.cookie_name, 'ridden', { expires: this.settings.cookie_expires, domain: this.settings.cookie_domain });
  1938. }
  1939. if (this.settings.timer > 0) {
  1940. clearTimeout(this.settings.automate);
  1941. }
  1942. if (this.settings.modal && this.settings.expose) {
  1943. this.un_expose();
  1944. }
  1945. this.settings.$next_tip.data('closed', true);
  1946. $('.joyride-modal-bg').hide();
  1947. this.settings.$current_tip.hide();
  1948. this.settings.post_step_callback(this.settings.$li.index(), this.settings.$current_tip);
  1949. this.settings.post_ride_callback(this.settings.$li.index(), this.settings.$current_tip);
  1950. $('.joyride-tip-guide').remove();
  1951. },
  1952. off : function () {
  1953. $(this.scope).off('.joyride');
  1954. $(window).off('.joyride');
  1955. $('.joyride-close-tip, .joyride-next-tip, .joyride-modal-bg').off('.joyride');
  1956. $('.joyride-tip-guide, .joyride-modal-bg').remove();
  1957. clearTimeout(this.settings.automate);
  1958. this.settings = {};
  1959. },
  1960. reflow : function () {}
  1961. };
  1962. }(jQuery, this, this.document));
  1963. ;(function ($, window, document, undefined) {
  1964. 'use strict';
  1965. Foundation.libs.magellan = {
  1966. name : 'magellan',
  1967. version : '5.0.0',
  1968. settings : {
  1969. active_class: 'active',
  1970. threshold: 0
  1971. },
  1972. init : function (scope, method, options) {
  1973. this.fixed_magellan = $("[data-magellan-expedition]");
  1974. this.set_threshold();
  1975. this.last_destination = $('[data-magellan-destination]').last();
  1976. this.events();
  1977. },
  1978. events : function () {
  1979. var self = this;
  1980. $(this.scope)
  1981. .off('.magellan')
  1982. .on('arrival.fndtn.magellan', '[data-magellan-arrival]', function (e) {
  1983. var $destination = $(this),
  1984. $expedition = $destination.closest('[data-magellan-expedition]'),
  1985. active_class = $expedition.attr('data-magellan-active-class')
  1986. || self.settings.active_class;
  1987. $destination
  1988. .closest('[data-magellan-expedition]')
  1989. .find('[data-magellan-arrival]')
  1990. .not($destination)
  1991. .removeClass(active_class);
  1992. $destination.addClass(active_class);
  1993. });
  1994. this.fixed_magellan
  1995. .off('.magellan')
  1996. .on('update-position.fndtn.magellan', function() {
  1997. var $el = $(this);
  1998. })
  1999. .trigger('update-position');
  2000. $(window)
  2001. .off('.magellan')
  2002. .on('resize.fndtn.magellan', function() {
  2003. this.fixed_magellan.trigger('update-position');
  2004. }.bind(this))
  2005. .on('scroll.fndtn.magellan', function() {
  2006. var windowScrollTop = $(window).scrollTop();
  2007. self.fixed_magellan.each(function() {
  2008. var $expedition = $(this);
  2009. if (typeof $expedition.data('magellan-top-offset') === 'undefined') {
  2010. $expedition.data('magellan-top-offset', $expedition.offset().top);
  2011. }
  2012. if (typeof $expedition.data('magellan-fixed-position') === 'undefined') {
  2013. $expedition.data('magellan-fixed-position', false);
  2014. }
  2015. var fixed_position = (windowScrollTop + self.settings.threshold) > $expedition.data("magellan-top-offset");
  2016. var attr = $expedition.attr('data-magellan-top-offset');
  2017. if ($expedition.data("magellan-fixed-position") != fixed_position) {
  2018. $expedition.data("magellan-fixed-position", fixed_position);
  2019. if (fixed_position) {
  2020. $expedition.addClass('fixed');
  2021. $expedition.css({position:"fixed", top:0});
  2022. } else {
  2023. $expedition.removeClass('fixed');
  2024. $expedition.css({position:"", top:""});
  2025. }
  2026. if (fixed_position && typeof attr != 'undefined' && attr != false) {
  2027. $expedition.css({position:"fixed", top:attr + "px"});
  2028. }
  2029. }
  2030. });
  2031. });
  2032. if (this.last_destination.length > 0) {
  2033. $(window).on('scroll.fndtn.magellan', function (e) {
  2034. var windowScrollTop = $(window).scrollTop(),
  2035. scrolltopPlusHeight = windowScrollTop + $(window).height(),
  2036. lastDestinationTop = Math.ceil(self.last_destination.offset().top);
  2037. $('[data-magellan-destination]').each(function () {
  2038. var $destination = $(this),
  2039. destination_name = $destination.attr('data-magellan-destination'),
  2040. topOffset = $destination.offset().top - $destination.outerHeight(true) - windowScrollTop;
  2041. if (topOffset <= self.settings.threshold) {
  2042. $("[data-magellan-arrival='" + destination_name + "']").trigger('arrival');
  2043. }
  2044. // In large screens we may hit the bottom of the page and dont reach the top of the last magellan-destination, so lets force it
  2045. if (scrolltopPlusHeight >= $(self.scope).height() && lastDestinationTop > windowScrollTop && lastDestinationTop < scrolltopPlusHeight) {
  2046. $('[data-magellan-arrival]').last().trigger('arrival');
  2047. }
  2048. });
  2049. });
  2050. }
  2051. },
  2052. set_threshold : function () {
  2053. if (typeof this.settings.threshold !== 'number') {
  2054. this.settings.threshold = (this.fixed_magellan.length > 0) ?
  2055. this.fixed_magellan.outerHeight(true) : 0;
  2056. }
  2057. },
  2058. off : function () {
  2059. $(this.scope).off('.fndtn.magellan');
  2060. $(window).off('.fndtn.magellan');
  2061. },
  2062. reflow : function () {}
  2063. };
  2064. }(jQuery, this, this.document));
  2065. ;(function ($, window, document, undefined) {
  2066. 'use strict';
  2067. Foundation.libs.offcanvas = {
  2068. name : 'offcanvas',
  2069. version : '5.0.0',
  2070. settings : {},
  2071. init : function (scope, method, options) {
  2072. this.events();
  2073. },
  2074. events : function () {
  2075. $(this.scope).off('.offcanvas')
  2076. .on('click.fndtn.offcanvas', '.left-off-canvas-toggle', function (e) {
  2077. e.preventDefault();
  2078. $(this).closest('.off-canvas-wrap').toggleClass('move-right');
  2079. })
  2080. .on('click.fndtn.offcanvas', '.exit-off-canvas', function (e) {
  2081. e.preventDefault();
  2082. $(".off-canvas-wrap").removeClass("move-right");
  2083. })
  2084. .on('click.fndtn.offcanvas', '.right-off-canvas-toggle', function (e) {
  2085. e.preventDefault();
  2086. $(this).closest(".off-canvas-wrap").toggleClass("move-left");
  2087. })
  2088. .on('click.fndtn.offcanvas', '.exit-off-canvas', function (e) {
  2089. e.preventDefault();
  2090. $(".off-canvas-wrap").removeClass("move-left");
  2091. });
  2092. },
  2093. reflow : function () {}
  2094. };
  2095. }(jQuery, this, this.document));
  2096. ;(function ($, window, document, undefined) {
  2097. 'use strict';
  2098. var noop = function() {};
  2099. var Orbit = function(el, settings) {
  2100. // Don't reinitialize plugin
  2101. if (el.hasClass(settings.slides_container_class)) {
  2102. return this;
  2103. }
  2104. var self = this,
  2105. container,
  2106. slides_container = el,
  2107. number_container,
  2108. bullets_container,
  2109. timer_container,
  2110. idx = 0,
  2111. animate,
  2112. timer,
  2113. locked = false,
  2114. adjust_height_after = false;
  2115. slides_container.children().first().addClass(settings.active_slide_class);
  2116. self.update_slide_number = function(index) {
  2117. if (settings.slide_number) {
  2118. number_container.find('span:first').text(parseInt(index)+1);
  2119. number_container.find('span:last').text(slides_container.children().length);
  2120. }
  2121. if (settings.bullets) {
  2122. bullets_container.children().removeClass(settings.bullets_active_class);
  2123. $(bullets_container.children().get(index)).addClass(settings.bullets_active_class);
  2124. }
  2125. };
  2126. self.update_active_link = function(index) {
  2127. var link = $('a[data-orbit-link="'+slides_container.children().eq(index).attr('data-orbit-slide')+'"]');
  2128. link.parents('ul').find('[data-orbit-link]').removeClass(settings.bullets_active_class);
  2129. link.addClass(settings.bullets_active_class);
  2130. };
  2131. self.build_markup = function() {
  2132. slides_container.wrap('<div class="'+settings.container_class+'"></div>');
  2133. container = slides_container.parent();
  2134. slides_container.addClass(settings.slides_container_class);
  2135. if (settings.navigation_arrows) {
  2136. container.append($('<a href="#"><span></span></a>').addClass(settings.prev_class));
  2137. container.append($('<a href="#"><span></span></a>').addClass(settings.next_class));
  2138. }
  2139. if (settings.timer) {
  2140. timer_container = $('<div>').addClass(settings.timer_container_class);
  2141. timer_container.append('<span>');
  2142. timer_container.append($('<div>').addClass(settings.timer_progress_class));
  2143. timer_container.addClass(settings.timer_paused_class);
  2144. container.append(timer_container);
  2145. }
  2146. if (settings.slide_number) {
  2147. number_container = $('<div>').addClass(settings.slide_number_class);
  2148. number_container.append('<span></span> ' + settings.slide_number_text + ' <span></span>');
  2149. container.append(number_container);
  2150. }
  2151. if (settings.bullets) {
  2152. bullets_container = $('<ol>').addClass(settings.bullets_container_class);
  2153. container.append(bullets_container);
  2154. bullets_container.wrap('<div class="orbit-bullets-container"></div>');
  2155. slides_container.children().each(function(idx, el) {
  2156. var bullet = $('<li>').attr('data-orbit-slide', idx);
  2157. bullets_container.append(bullet);
  2158. });
  2159. }
  2160. if (settings.stack_on_small) {
  2161. container.addClass(settings.stack_on_small_class);
  2162. }
  2163. self.update_slide_number(0);
  2164. self.update_active_link(0);
  2165. };
  2166. self._goto = function(next_idx, start_timer) {
  2167. // if (locked) {return false;}
  2168. if (next_idx === idx) {return false;}
  2169. if (typeof timer === 'object') {timer.restart();}
  2170. var slides = slides_container.children();
  2171. var dir = 'next';
  2172. locked = true;
  2173. if (next_idx < idx) {dir = 'prev';}
  2174. if (next_idx >= slides.length) {next_idx = 0;}
  2175. else if (next_idx < 0) {next_idx = slides.length - 1;}
  2176. var current = $(slides.get(idx));
  2177. var next = $(slides.get(next_idx));
  2178. current.css('zIndex', 2);
  2179. current.removeClass(settings.active_slide_class);
  2180. next.css('zIndex', 4).addClass(settings.active_slide_class);
  2181. slides_container.trigger('before-slide-change.fndtn.orbit');
  2182. settings.before_slide_change();
  2183. self.update_active_link(next_idx);
  2184. var callback = function() {
  2185. var unlock = function() {
  2186. idx = next_idx;
  2187. locked = false;
  2188. if (start_timer === true) {timer = self.create_timer(); timer.start();}
  2189. self.update_slide_number(idx);
  2190. slides_container.trigger('after-slide-change.fndtn.orbit',[{slide_number: idx, total_slides: slides.length}]);
  2191. settings.after_slide_change(idx, slides.length);
  2192. };
  2193. if (slides_container.height() != next.height() && settings.variable_height) {
  2194. slides_container.animate({'height': next.height()}, 250, 'linear', unlock);
  2195. } else {
  2196. unlock();
  2197. }
  2198. };
  2199. if (slides.length === 1) {callback(); return false;}
  2200. var start_animation = function() {
  2201. if (dir === 'next') {animate.next(current, next, callback);}
  2202. if (dir === 'prev') {animate.prev(current, next, callback);}
  2203. };
  2204. if (next.height() > slides_container.height() && settings.variable_height) {
  2205. slides_container.animate({'height': next.height()}, 250, 'linear', start_animation);
  2206. } else {
  2207. start_animation();
  2208. }
  2209. };
  2210. self.next = function(e) {
  2211. e.stopImmediatePropagation();
  2212. e.preventDefault();
  2213. self._goto(idx + 1);
  2214. };
  2215. self.prev = function(e) {
  2216. e.stopImmediatePropagation();
  2217. e.preventDefault();
  2218. self._goto(idx - 1);
  2219. };
  2220. self.link_custom = function(e) {
  2221. e.preventDefault();
  2222. var link = $(this).attr('data-orbit-link');
  2223. if ((typeof link === 'string') && (link = $.trim(link)) != "") {
  2224. var slide = container.find('[data-orbit-slide='+link+']');
  2225. if (slide.index() != -1) {self._goto(slide.index());}
  2226. }
  2227. };
  2228. self.link_bullet = function(e) {
  2229. var index = $(this).attr('data-orbit-slide');
  2230. if ((typeof index === 'string') && (index = $.trim(index)) != "") {
  2231. self._goto(parseInt(index));
  2232. }
  2233. }
  2234. self.timer_callback = function() {
  2235. self._goto(idx + 1, true);
  2236. }
  2237. self.compute_dimensions = function() {
  2238. var current = $(slides_container.children().get(idx));
  2239. var h = current.height();
  2240. if (!settings.variable_height) {
  2241. slides_container.children().each(function(){
  2242. if ($(this).height() > h) { h = $(this).height(); }
  2243. });
  2244. }
  2245. slides_container.height(h);
  2246. };
  2247. self.create_timer = function() {
  2248. var t = new Timer(
  2249. container.find('.'+settings.timer_container_class),
  2250. settings,
  2251. self.timer_callback
  2252. );
  2253. return t;
  2254. };
  2255. self.stop_timer = function() {
  2256. if (typeof timer === 'object') timer.stop();
  2257. };
  2258. self.toggle_timer = function() {
  2259. var t = container.find('.'+settings.timer_container_class);
  2260. if (t.hasClass(settings.timer_paused_class)) {
  2261. if (typeof timer === 'undefined') {timer = self.create_timer();}
  2262. timer.start();
  2263. }
  2264. else {
  2265. if (typeof timer === 'object') {timer.stop();}
  2266. }
  2267. };
  2268. self.init = function() {
  2269. self.build_markup();
  2270. if (settings.timer) {timer = self.create_timer(); timer.start();}
  2271. animate = new FadeAnimation(settings, slides_container);
  2272. if (settings.animation === 'slide')
  2273. animate = new SlideAnimation(settings, slides_container);
  2274. container.on('click', '.'+settings.next_class, self.next);
  2275. container.on('click', '.'+settings.prev_class, self.prev);
  2276. container.on('click', '[data-orbit-slide]', self.link_bullet);
  2277. container.on('click', self.toggle_timer);
  2278. if (settings.swipe) {
  2279. container.on('touchstart.fndtn.orbit', function(e) {
  2280. if (!e.touches) {e = e.originalEvent;}
  2281. var data = {
  2282. start_page_x: e.touches[0].pageX,
  2283. start_page_y: e.touches[0].pageY,
  2284. start_time: (new Date()).getTime(),
  2285. delta_x: 0,
  2286. is_scrolling: undefined
  2287. };
  2288. container.data('swipe-transition', data);
  2289. e.stopPropagation();
  2290. })
  2291. .on('touchmove.fndtn.orbit', function(e) {
  2292. if (!e.touches) { e = e.originalEvent; }
  2293. // Ignore pinch/zoom events
  2294. if(e.touches.length > 1 || e.scale && e.scale !== 1) return;
  2295. var data = container.data('swipe-transition');
  2296. if (typeof data === 'undefined') {data = {};}
  2297. data.delta_x = e.touches[0].pageX - data.start_page_x;
  2298. if ( typeof data.is_scrolling === 'undefined') {
  2299. data.is_scrolling = !!( data.is_scrolling || Math.abs(data.delta_x) < Math.abs(e.touches[0].pageY - data.start_page_y) );
  2300. }
  2301. if (!data.is_scrolling && !data.active) {
  2302. e.preventDefault();
  2303. var direction = (data.delta_x < 0) ? (idx+1) : (idx-1);
  2304. data.active = true;
  2305. self._goto(direction);
  2306. }
  2307. })
  2308. .on('touchend.fndtn.orbit', function(e) {
  2309. container.data('swipe-transition', {});
  2310. e.stopPropagation();
  2311. })
  2312. }
  2313. container.on('mouseenter.fndtn.orbit', function(e) {
  2314. if (settings.timer && settings.pause_on_hover) {
  2315. self.stop_timer();
  2316. }
  2317. })
  2318. .on('mouseleave.fndtn.orbit', function(e) {
  2319. if (settings.timer && settings.resume_on_mouseout) {
  2320. timer.start();
  2321. }
  2322. });
  2323. $(document).on('click', '[data-orbit-link]', self.link_custom);
  2324. $(window).on('resize', self.compute_dimensions);
  2325. $(window).on('load', self.compute_dimensions);
  2326. $(window).on('load', function(){
  2327. container.prev('.preloader').css('display', 'none');
  2328. });
  2329. slides_container.trigger('ready.fndtn.orbit');
  2330. };
  2331. self.init();
  2332. };
  2333. var Timer = function(el, settings, callback) {
  2334. var self = this,
  2335. duration = settings.timer_speed,
  2336. progress = el.find('.'+settings.timer_progress_class),
  2337. start,
  2338. timeout,
  2339. left = -1;
  2340. this.update_progress = function(w) {
  2341. var new_progress = progress.clone();
  2342. new_progress.attr('style', '');
  2343. new_progress.css('width', w+'%');
  2344. progress.replaceWith(new_progress);
  2345. progress = new_progress;
  2346. };
  2347. this.restart = function() {
  2348. clearTimeout(timeout);
  2349. el.addClass(settings.timer_paused_class);
  2350. left = -1;
  2351. self.update_progress(0);
  2352. };
  2353. this.start = function() {
  2354. if (!el.hasClass(settings.timer_paused_class)) {return true;}
  2355. left = (left === -1) ? duration : left;
  2356. el.removeClass(settings.timer_paused_class);
  2357. start = new Date().getTime();
  2358. progress.animate({'width': '100%'}, left, 'linear');
  2359. timeout = setTimeout(function() {
  2360. self.restart();
  2361. callback();
  2362. }, left);
  2363. el.trigger('timer-started.fndtn.orbit')
  2364. };
  2365. this.stop = function() {
  2366. if (el.hasClass(settings.timer_paused_class)) {return true;}
  2367. clearTimeout(timeout);
  2368. el.addClass(settings.timer_paused_class);
  2369. var end = new Date().getTime();
  2370. left = left - (end - start);
  2371. var w = 100 - ((left / duration) * 100);
  2372. self.update_progress(w);
  2373. el.trigger('timer-stopped.fndtn.orbit');
  2374. };
  2375. };
  2376. var SlideAnimation = function(settings, container) {
  2377. var duration = settings.animation_speed;
  2378. var is_rtl = ($('html[dir=rtl]').length === 1);
  2379. var margin = is_rtl ? 'marginRight' : 'marginLeft';
  2380. var animMargin = {};
  2381. animMargin[margin] = '0%';
  2382. this.next = function(current, next, callback) {
  2383. current.animate({marginLeft:'-100%'}, duration);
  2384. next.animate(animMargin, duration, function() {
  2385. current.css(margin, '100%');
  2386. callback();
  2387. });
  2388. };
  2389. this.prev = function(current, prev, callback) {
  2390. current.animate({marginLeft:'100%'}, duration);
  2391. prev.css(margin, '-100%');
  2392. prev.animate(animMargin, duration, function() {
  2393. current.css(margin, '100%');
  2394. callback();
  2395. });
  2396. };
  2397. };
  2398. var FadeAnimation = function(settings, container) {
  2399. var duration = settings.animation_speed;
  2400. var is_rtl = ($('html[dir=rtl]').length === 1);
  2401. var margin = is_rtl ? 'marginRight' : 'marginLeft';
  2402. this.next = function(current, next, callback) {
  2403. next.css({'margin':'0%', 'opacity':'0.01'});
  2404. next.animate({'opacity':'1'}, duration, 'linear', function() {
  2405. current.css('margin', '100%');
  2406. callback();
  2407. });
  2408. };
  2409. this.prev = function(current, prev, callback) {
  2410. prev.css({'margin':'0%', 'opacity':'0.01'});
  2411. prev.animate({'opacity':'1'}, duration, 'linear', function() {
  2412. current.css('margin', '100%');
  2413. callback();
  2414. });
  2415. };
  2416. };
  2417. Foundation.libs = Foundation.libs || {};
  2418. Foundation.libs.orbit = {
  2419. name: 'orbit',
  2420. version: '5.0.0',
  2421. settings: {
  2422. animation: 'slide',
  2423. timer_speed: 10000,
  2424. pause_on_hover: true,
  2425. resume_on_mouseout: false,
  2426. animation_speed: 500,
  2427. stack_on_small: false,
  2428. navigation_arrows: true,
  2429. slide_number: true,
  2430. slide_number_text: 'of',
  2431. container_class: 'orbit-container',
  2432. stack_on_small_class: 'orbit-stack-on-small',
  2433. next_class: 'orbit-next',
  2434. prev_class: 'orbit-prev',
  2435. timer_container_class: 'orbit-timer',
  2436. timer_paused_class: 'paused',
  2437. timer_progress_class: 'orbit-progress',
  2438. slides_container_class: 'orbit-slides-container',
  2439. bullets_container_class: 'orbit-bullets',
  2440. bullets_active_class: 'active',
  2441. slide_number_class: 'orbit-slide-number',
  2442. caption_class: 'orbit-caption',
  2443. active_slide_class: 'active',
  2444. orbit_transition_class: 'orbit-transitioning',
  2445. bullets: true,
  2446. timer: true,
  2447. variable_height: false,
  2448. swipe: true,
  2449. before_slide_change: noop,
  2450. after_slide_change: noop
  2451. },
  2452. init: function (scope, method, options) {
  2453. var self = this;
  2454. if (typeof method === 'object') {
  2455. $.extend(true, self.settings, method);
  2456. }
  2457. if ($(scope).is('[data-orbit]')) {
  2458. var $el = $(scope);
  2459. var opts = self.data_options($el);
  2460. new Orbit($el, $.extend({},self.settings, opts));
  2461. }
  2462. $('[data-orbit]', scope).each(function(idx, el) {
  2463. var $el = $(el);
  2464. var opts = self.data_options($el);
  2465. new Orbit($el, $.extend({},self.settings, opts));
  2466. });
  2467. }
  2468. };
  2469. }(jQuery, this, this.document));
  2470. ;(function ($, window, document, undefined) {
  2471. 'use strict';
  2472. Foundation.libs.reveal = {
  2473. name : 'reveal',
  2474. version : '5.0.0',
  2475. locked : false,
  2476. settings : {
  2477. animation: 'fadeAndPop',
  2478. animation_speed: 250,
  2479. close_on_background_click: true,
  2480. close_on_esc: true,
  2481. dismiss_modal_class: 'close-reveal-modal',
  2482. bg_class: 'reveal-modal-bg',
  2483. open: function(){},
  2484. opened: function(){},
  2485. close: function(){},
  2486. closed: function(){},
  2487. bg : $('.reveal-modal-bg'),
  2488. css : {
  2489. open : {
  2490. 'opacity': 0,
  2491. 'visibility': 'visible',
  2492. 'display' : 'block'
  2493. },
  2494. close : {
  2495. 'opacity': 1,
  2496. 'visibility': 'hidden',
  2497. 'display': 'none'
  2498. }
  2499. }
  2500. },
  2501. init : function (scope, method, options) {
  2502. Foundation.inherit(this, 'delay');
  2503. this.bindings(method, options);
  2504. },
  2505. events : function (scope) {
  2506. var self = this;
  2507. $('[data-reveal-id]', this.scope)
  2508. .off('.reveal')
  2509. .on('click.fndtn.reveal', function (e) {
  2510. e.preventDefault();
  2511. if (!self.locked) {
  2512. var element = $(this),
  2513. ajax = element.data('reveal-ajax');
  2514. self.locked = true;
  2515. if (typeof ajax === 'undefined') {
  2516. self.open.call(self, element);
  2517. } else {
  2518. var url = ajax === true ? element.attr('href') : ajax;
  2519. self.open.call(self, element, {url: url});
  2520. }
  2521. }
  2522. });
  2523. $(this.scope)
  2524. .off('.reveal')
  2525. .on('click.fndtn.reveal', this.close_targets(), function (e) {
  2526. e.preventDefault();
  2527. if (!self.locked) {
  2528. var settings = $('[data-reveal].open').data('reveal-init'),
  2529. bg_clicked = $(e.target)[0] === $('.' + settings.bg_class)[0];
  2530. if (bg_clicked && !settings.close_on_background_click) {
  2531. return;
  2532. }
  2533. self.locked = true;
  2534. self.close.call(self, bg_clicked ? $('[data-reveal].open') : $(this).closest('[data-reveal]'));
  2535. }
  2536. });
  2537. if($('[data-reveal]', this.scope).length > 0) {
  2538. $(this.scope)
  2539. // .off('.reveal')
  2540. .on('open.fndtn.reveal', this.settings.open)
  2541. .on('opened.fndtn.reveal', this.settings.opened)
  2542. .on('opened.fndtn.reveal', this.open_video)
  2543. .on('close.fndtn.reveal', this.settings.close)
  2544. .on('closed.fndtn.reveal', this.settings.closed)
  2545. .on('closed.fndtn.reveal', this.close_video);
  2546. } else {
  2547. $(this.scope)
  2548. // .off('.reveal')
  2549. .on('open.fndtn.reveal', '[data-reveal]', this.settings.open)
  2550. .on('opened.fndtn.reveal', '[data-reveal]', this.settings.opened)
  2551. .on('opened.fndtn.reveal', '[data-reveal]', this.open_video)
  2552. .on('close.fndtn.reveal', '[data-reveal]', this.settings.close)
  2553. .on('closed.fndtn.reveal', '[data-reveal]', this.settings.closed)
  2554. .on('closed.fndtn.reveal', '[data-reveal]', this.close_video);
  2555. }
  2556. $('body').on('keyup.fndtn.reveal', function ( event ) {
  2557. var open_modal = $('[data-reveal].open'),
  2558. settings = open_modal.data('reveal-init');
  2559. if ( event.which === 27 && settings.close_on_esc) { // 27 is the keycode for the Escape key
  2560. open_modal.foundation('reveal', 'close');
  2561. }
  2562. });
  2563. return true;
  2564. },
  2565. open : function (target, ajax_settings) {
  2566. if (target) {
  2567. if (typeof target.selector !== 'undefined') {
  2568. var modal = $('#' + target.data('reveal-id'));
  2569. } else {
  2570. var modal = $(this.scope);
  2571. ajax_settings = target;
  2572. }
  2573. } else {
  2574. var modal = $(this.scope);
  2575. }
  2576. if (!modal.hasClass('open')) {
  2577. var open_modal = $('[data-reveal].open');
  2578. if (typeof modal.data('css-top') === 'undefined') {
  2579. modal.data('css-top', parseInt(modal.css('top'), 10))
  2580. .data('offset', this.cache_offset(modal));
  2581. }
  2582. modal.trigger('open');
  2583. if (open_modal.length < 1) {
  2584. this.toggle_bg();
  2585. }
  2586. if (typeof ajax_settings === 'undefined' || !ajax_settings.url) {
  2587. this.hide(open_modal, this.settings.css.close);
  2588. this.show(modal, this.settings.css.open);
  2589. } else {
  2590. var self = this,
  2591. old_success = typeof ajax_settings.success !== 'undefined' ? ajax_settings.success : null;
  2592. $.extend(ajax_settings, {
  2593. success: function (data, textStatus, jqXHR) {
  2594. if ( $.isFunction(old_success) ) {
  2595. old_success(data, textStatus, jqXHR);
  2596. }
  2597. modal.html(data);
  2598. $(modal).foundation('section', 'reflow');
  2599. self.hide(open_modal, self.settings.css.close);
  2600. self.show(modal, self.settings.css.open);
  2601. }
  2602. });
  2603. $.ajax(ajax_settings);
  2604. }
  2605. }
  2606. },
  2607. close : function (modal) {
  2608. var modal = modal && modal.length ? modal : $(this.scope),
  2609. open_modals = $('[data-reveal].open');
  2610. if (open_modals.length > 0) {
  2611. this.locked = true;
  2612. modal.trigger('close');
  2613. this.toggle_bg();
  2614. this.hide(open_modals, this.settings.css.close);
  2615. }
  2616. },
  2617. close_targets : function () {
  2618. var base = '.' + this.settings.dismiss_modal_class;
  2619. if (this.settings.close_on_background_click) {
  2620. return base + ', .' + this.settings.bg_class;
  2621. }
  2622. return base;
  2623. },
  2624. toggle_bg : function () {
  2625. if ($('.' + this.settings.bg_class).length === 0) {
  2626. this.settings.bg = $('<div />', {'class': this.settings.bg_class})
  2627. .appendTo('body');
  2628. }
  2629. if (this.settings.bg.filter(':visible').length > 0) {
  2630. this.hide(this.settings.bg);
  2631. } else {
  2632. this.show(this.settings.bg);
  2633. }
  2634. },
  2635. show : function (el, css) {
  2636. // is modal
  2637. if (css) {
  2638. if (el.parent('body').length === 0) {
  2639. var placeholder = el.wrap('<div style="display: none;" />').parent();
  2640. el.on('closed.fndtn.reveal.wrapped', function() {
  2641. el.detach().appendTo(placeholder);
  2642. el.unwrap().unbind('closed.fndtn.reveal.wrapped');
  2643. });
  2644. el.detach().appendTo('body');
  2645. }
  2646. if (/pop/i.test(this.settings.animation)) {
  2647. css.top = $(window).scrollTop() - el.data('offset') + 'px';
  2648. var end_css = {
  2649. top: $(window).scrollTop() + el.data('css-top') + 'px',
  2650. opacity: 1
  2651. };
  2652. return this.delay(function () {
  2653. return el
  2654. .css(css)
  2655. .animate(end_css, this.settings.animation_speed, 'linear', function () {
  2656. this.locked = false;
  2657. el.trigger('opened');
  2658. }.bind(this))
  2659. .addClass('open');
  2660. }.bind(this), this.settings.animation_speed / 2);
  2661. }
  2662. if (/fade/i.test(this.settings.animation)) {
  2663. var end_css = {opacity: 1};
  2664. return this.delay(function () {
  2665. return el
  2666. .css(css)
  2667. .animate(end_css, this.settings.animation_speed, 'linear', function () {
  2668. this.locked = false;
  2669. el.trigger('opened');
  2670. }.bind(this))
  2671. .addClass('open');
  2672. }.bind(this), this.settings.animation_speed / 2);
  2673. }
  2674. return el.css(css).show().css({opacity: 1}).addClass('open').trigger('opened');
  2675. }
  2676. // should we animate the background?
  2677. if (/fade/i.test(this.settings.animation)) {
  2678. return el.fadeIn(this.settings.animation_speed / 2);
  2679. }
  2680. return el.show();
  2681. },
  2682. hide : function (el, css) {
  2683. // is modal
  2684. if (css) {
  2685. if (/pop/i.test(this.settings.animation)) {
  2686. var end_css = {
  2687. top: - $(window).scrollTop() - el.data('offset') + 'px',
  2688. opacity: 0
  2689. };
  2690. return this.delay(function () {
  2691. return el
  2692. .animate(end_css, this.settings.animation_speed, 'linear', function () {
  2693. this.locked = false;
  2694. el.css(css).trigger('closed');
  2695. }.bind(this))
  2696. .removeClass('open');
  2697. }.bind(this), this.settings.animation_speed / 2);
  2698. }
  2699. if (/fade/i.test(this.settings.animation)) {
  2700. var end_css = {opacity: 0};
  2701. return this.delay(function () {
  2702. return el
  2703. .animate(end_css, this.settings.animation_speed, 'linear', function () {
  2704. this.locked = false;
  2705. el.css(css).trigger('closed');
  2706. }.bind(this))
  2707. .removeClass('open');
  2708. }.bind(this), this.settings.animation_speed / 2);
  2709. }
  2710. return el.hide().css(css).removeClass('open').trigger('closed');
  2711. }
  2712. // should we animate the background?
  2713. if (/fade/i.test(this.settings.animation)) {
  2714. return el.fadeOut(this.settings.animation_speed / 2);
  2715. }
  2716. return el.hide();
  2717. },
  2718. close_video : function (e) {
  2719. var video = $(this).find('.flex-video'),
  2720. iframe = video.find('iframe');
  2721. if (iframe.length > 0) {
  2722. iframe.attr('data-src', iframe[0].src);
  2723. iframe.attr('src', 'about:blank');
  2724. video.hide();
  2725. }
  2726. },
  2727. open_video : function (e) {
  2728. var video = $(this).find('.flex-video'),
  2729. iframe = video.find('iframe');
  2730. if (iframe.length > 0) {
  2731. var data_src = iframe.attr('data-src');
  2732. if (typeof data_src === 'string') {
  2733. iframe[0].src = iframe.attr('data-src');
  2734. } else {
  2735. var src = iframe[0].src;
  2736. iframe[0].src = undefined;
  2737. iframe[0].src = src;
  2738. }
  2739. video.show();
  2740. }
  2741. },
  2742. cache_offset : function (modal) {
  2743. var offset = modal.show().height() + parseInt(modal.css('top'), 10);
  2744. modal.hide();
  2745. return offset;
  2746. },
  2747. off : function () {
  2748. $(this.scope).off('.fndtn.reveal');
  2749. },
  2750. reflow : function () {}
  2751. };
  2752. }(jQuery, this, this.document));
  2753. /*jslint unparam: true, browser: true, indent: 2 */
  2754. ;(function ($, window, document, undefined) {
  2755. 'use strict';
  2756. Foundation.libs.tab = {
  2757. name : 'tab',
  2758. version : '5.0.1',
  2759. settings : {
  2760. active_class: 'active'
  2761. },
  2762. init : function (scope, method, options) {
  2763. this.bindings(method, options);
  2764. },
  2765. events : function () {
  2766. $(this.scope).off('.tab').on('click.fndtn.tab', '[data-tab] > dd > a', function (e) {
  2767. e.preventDefault();
  2768. var tab = $(this).parent(),
  2769. target = $('#' + this.href.split('#')[1]),
  2770. siblings = tab.siblings(),
  2771. settings = tab.closest('[data-tab]').data('tab-init');
  2772. tab.addClass(settings.active_class);
  2773. siblings.removeClass(settings.active_class);
  2774. target.siblings().removeClass(settings.active_class).end().addClass(settings.active_class);
  2775. });
  2776. },
  2777. off : function () {},
  2778. reflow : function () {}
  2779. };
  2780. }(jQuery, this, this.document));
  2781. ;(function ($, window, document, undefined) {
  2782. 'use strict';
  2783. Foundation.libs.tooltip = {
  2784. name : 'tooltip',
  2785. version : '5.0.0',
  2786. settings : {
  2787. additional_inheritable_classes : [],
  2788. tooltip_class : '.tooltip',
  2789. append_to: 'body',
  2790. touch_close_text: 'Tap To Close',
  2791. disable_for_touch: false,
  2792. tip_template : function (selector, content) {
  2793. return '<span data-selector="' + selector + '" class="'
  2794. + Foundation.libs.tooltip.settings.tooltip_class.substring(1)
  2795. + '">' + content + '<span class="nub"></span></span>';
  2796. }
  2797. },
  2798. cache : {},
  2799. init : function (scope, method, options) {
  2800. this.bindings(method, options);
  2801. },
  2802. events : function () {
  2803. var self = this;
  2804. if (Modernizr.touch) {
  2805. $(this.scope)
  2806. .off('.tooltip')
  2807. .on('click.fndtn.tooltip touchstart.fndtn.tooltip touchend.fndtn.tooltip',
  2808. '[data-tooltip]', function (e) {
  2809. var settings = $.extend({}, self.settings, self.data_options($(this)));
  2810. if (!settings.disable_for_touch) {
  2811. e.preventDefault();
  2812. $(settings.tooltip_class).hide();
  2813. self.showOrCreateTip($(this));
  2814. }
  2815. })
  2816. .on('click.fndtn.tooltip touchstart.fndtn.tooltip touchend.fndtn.tooltip',
  2817. this.settings.tooltip_class, function (e) {
  2818. e.preventDefault();
  2819. $(this).fadeOut(150);
  2820. });
  2821. } else {
  2822. $(this.scope)
  2823. .off('.tooltip')
  2824. .on('mouseenter.fndtn.tooltip mouseleave.fndtn.tooltip',
  2825. '[data-tooltip]', function (e) {
  2826. var $this = $(this);
  2827. if (/enter|over/i.test(e.type)) {
  2828. self.showOrCreateTip($this);
  2829. } else if (e.type === 'mouseout' || e.type === 'mouseleave') {
  2830. self.hide($this);
  2831. }
  2832. });
  2833. }
  2834. },
  2835. showOrCreateTip : function ($target) {
  2836. var $tip = this.getTip($target);
  2837. if ($tip && $tip.length > 0) {
  2838. return this.show($target);
  2839. }
  2840. return this.create($target);
  2841. },
  2842. getTip : function ($target) {
  2843. var selector = this.selector($target),
  2844. tip = null;
  2845. if (selector) {
  2846. tip = $('span[data-selector="' + selector + '"]' + this.settings.tooltip_class);
  2847. }
  2848. return (typeof tip === 'object') ? tip : false;
  2849. },
  2850. selector : function ($target) {
  2851. var id = $target.attr('id'),
  2852. dataSelector = $target.attr('data-tooltip') || $target.attr('data-selector');
  2853. if ((id && id.length < 1 || !id) && typeof dataSelector != 'string') {
  2854. dataSelector = 'tooltip' + Math.random().toString(36).substring(7);
  2855. $target.attr('data-selector', dataSelector);
  2856. }
  2857. return (id && id.length > 0) ? id : dataSelector;
  2858. },
  2859. create : function ($target) {
  2860. var $tip = $(this.settings.tip_template(this.selector($target), $('<div></div>').html($target.attr('title')).html())),
  2861. classes = this.inheritable_classes($target);
  2862. $tip.addClass(classes).appendTo(this.settings.append_to);
  2863. if (Modernizr.touch) {
  2864. $tip.append('<span class="tap-to-close">'+this.settings.touch_close_text+'</span>');
  2865. }
  2866. $target.removeAttr('title').attr('title','');
  2867. this.show($target);
  2868. },
  2869. reposition : function (target, tip, classes) {
  2870. var width, nub, nubHeight, nubWidth, column, objPos;
  2871. tip.css('visibility', 'hidden').show();
  2872. width = target.data('width');
  2873. nub = tip.children('.nub');
  2874. nubHeight = nub.outerHeight();
  2875. nubWidth = nub.outerHeight();
  2876. objPos = function (obj, top, right, bottom, left, width) {
  2877. return obj.css({
  2878. 'top' : (top) ? top : 'auto',
  2879. 'bottom' : (bottom) ? bottom : 'auto',
  2880. 'left' : (left) ? left : 'auto',
  2881. 'right' : (right) ? right : 'auto',
  2882. 'width' : (width) ? width : 'auto'
  2883. }).end();
  2884. };
  2885. objPos(tip, (target.offset().top + target.outerHeight() + 10), 'auto', 'auto', target.offset().left, width);
  2886. if (this.small()) {
  2887. objPos(tip, (target.offset().top + target.outerHeight() + 10), 'auto', 'auto', 12.5, $(this.scope).width());
  2888. tip.addClass('tip-override');
  2889. objPos(nub, -nubHeight, 'auto', 'auto', target.offset().left);
  2890. } else {
  2891. var left = target.offset().left;
  2892. if (Foundation.rtl) {
  2893. left = target.offset().left + target.offset().width - tip.outerWidth();
  2894. }
  2895. objPos(tip, (target.offset().top + target.outerHeight() + 10), 'auto', 'auto', left, width);
  2896. tip.removeClass('tip-override');
  2897. if (classes && classes.indexOf('tip-top') > -1) {
  2898. objPos(tip, (target.offset().top - tip.outerHeight()), 'auto', 'auto', left, width)
  2899. .removeClass('tip-override');
  2900. } else if (classes && classes.indexOf('tip-left') > -1) {
  2901. objPos(tip, (target.offset().top + (target.outerHeight() / 2) - nubHeight*2.5), 'auto', 'auto', (target.offset().left - tip.outerWidth() - nubHeight), width)
  2902. .removeClass('tip-override');
  2903. } else if (classes && classes.indexOf('tip-right') > -1) {
  2904. objPos(tip, (target.offset().top + (target.outerHeight() / 2) - nubHeight*2.5), 'auto', 'auto', (target.offset().left + target.outerWidth() + nubHeight), width)
  2905. .removeClass('tip-override');
  2906. }
  2907. }
  2908. tip.css('visibility', 'visible').hide();
  2909. },
  2910. small : function () {
  2911. return matchMedia(Foundation.media_queries.small).matches;
  2912. },
  2913. inheritable_classes : function (target) {
  2914. var inheritables = ['tip-top', 'tip-left', 'tip-bottom', 'tip-right', 'noradius'].concat(this.settings.additional_inheritable_classes),
  2915. classes = target.attr('class'),
  2916. filtered = classes ? $.map(classes.split(' '), function (el, i) {
  2917. if ($.inArray(el, inheritables) !== -1) {
  2918. return el;
  2919. }
  2920. }).join(' ') : '';
  2921. return $.trim(filtered);
  2922. },
  2923. show : function ($target) {
  2924. var $tip = this.getTip($target);
  2925. this.reposition($target, $tip, $target.attr('class'));
  2926. $tip.fadeIn(150);
  2927. },
  2928. hide : function ($target) {
  2929. var $tip = this.getTip($target);
  2930. $tip.fadeOut(150);
  2931. },
  2932. // deprecate reload
  2933. reload : function () {
  2934. var $self = $(this);
  2935. return ($self.data('fndtn-tooltips')) ? $self.foundationTooltips('destroy').foundationTooltips('init') : $self.foundationTooltips('init');
  2936. },
  2937. off : function () {
  2938. $(this.scope).off('.fndtn.tooltip');
  2939. $(this.settings.tooltip_class).each(function (i) {
  2940. $('[data-tooltip]').get(i).attr('title', $(this).text());
  2941. }).remove();
  2942. },
  2943. reflow : function () {}
  2944. };
  2945. }(jQuery, this, this.document));
  2946. ;(function ($, window, document, undefined) {
  2947. 'use strict';
  2948. Foundation.libs.topbar = {
  2949. name : 'topbar',
  2950. version: '5.0.1',
  2951. settings : {
  2952. index : 0,
  2953. sticky_class : 'sticky',
  2954. custom_back_text: true,
  2955. back_text: 'Back',
  2956. is_hover: true,
  2957. mobile_show_parent_link: false,
  2958. scrolltop : true // jump to top when sticky nav menu toggle is clicked
  2959. },
  2960. init : function (section, method, options) {
  2961. Foundation.inherit(this, 'addCustomRule register_media throttle');
  2962. var self = this;
  2963. self.register_media('topbar', 'foundation-mq-topbar');
  2964. this.bindings(method, options);
  2965. $('[data-topbar]', this.scope).each(function () {
  2966. var topbar = $(this),
  2967. settings = topbar.data('topbar-init'),
  2968. section = $('section', this),
  2969. titlebar = $('> ul', this).first();
  2970. topbar.data('index', 0);
  2971. var topbarContainer = topbar.parent();
  2972. if(topbarContainer.hasClass('fixed') || topbarContainer.hasClass(settings.sticky_class)) {
  2973. self.settings.sticky_class = settings.sticky_class;
  2974. self.settings.stick_topbar = topbar;
  2975. topbar.data('height', topbarContainer.outerHeight());
  2976. topbar.data('stickyoffset', topbarContainer.offset().top);
  2977. } else {
  2978. topbar.data('height', topbar.outerHeight());
  2979. }
  2980. if (!settings.assembled) self.assemble(topbar);
  2981. if (settings.is_hover) {
  2982. $('.has-dropdown', topbar).addClass('not-click');
  2983. } else {
  2984. $('.has-dropdown', topbar).removeClass('not-click');
  2985. }
  2986. // Pad body when sticky (scrolled) or fixed.
  2987. self.addCustomRule('.f-topbar-fixed { padding-top: ' + topbar.data('height') + 'px }');
  2988. if (topbarContainer.hasClass('fixed')) {
  2989. $('body').addClass('f-topbar-fixed');
  2990. }
  2991. });
  2992. },
  2993. toggle: function (toggleEl) {
  2994. var self = this;
  2995. if (toggleEl) {
  2996. var topbar = $(toggleEl).closest('[data-topbar]');
  2997. } else {
  2998. var topbar = $('[data-topbar]');
  2999. }
  3000. var settings = topbar.data('topbar-init');
  3001. var section = $('section, .section', topbar);
  3002. if (self.breakpoint()) {
  3003. if (!self.rtl) {
  3004. section.css({left: '0%'});
  3005. $('>.name', section).css({left: '100%'});
  3006. } else {
  3007. section.css({right: '0%'});
  3008. $('>.name', section).css({right: '100%'});
  3009. }
  3010. $('li.moved', section).removeClass('moved');
  3011. topbar.data('index', 0);
  3012. topbar
  3013. .toggleClass('expanded')
  3014. .css('height', '');
  3015. }
  3016. if (settings.scrolltop) {
  3017. if (!topbar.hasClass('expanded')) {
  3018. if (topbar.hasClass('fixed')) {
  3019. topbar.parent().addClass('fixed');
  3020. topbar.removeClass('fixed');
  3021. $('body').addClass('f-topbar-fixed');
  3022. }
  3023. } else if (topbar.parent().hasClass('fixed')) {
  3024. if (settings.scrolltop) {
  3025. topbar.parent().removeClass('fixed');
  3026. topbar.addClass('fixed');
  3027. $('body').removeClass('f-topbar-fixed');
  3028. window.scrollTo(0,0);
  3029. } else {
  3030. topbar.parent().removeClass('expanded');
  3031. }
  3032. }
  3033. } else {
  3034. if(topbar.parent().hasClass(self.settings.sticky_class)) {
  3035. topbar.parent().addClass('fixed');
  3036. }
  3037. if(topbar.parent().hasClass('fixed')) {
  3038. if (!topbar.hasClass('expanded')) {
  3039. topbar.removeClass('fixed');
  3040. topbar.parent().removeClass('expanded');
  3041. self.update_sticky_positioning();
  3042. } else {
  3043. topbar.addClass('fixed');
  3044. topbar.parent().addClass('expanded');
  3045. }
  3046. }
  3047. }
  3048. },
  3049. timer : null,
  3050. events : function (bar) {
  3051. var self = this;
  3052. $(this.scope)
  3053. .off('.topbar')
  3054. .on('click.fndtn.topbar', '[data-topbar] .toggle-topbar', function (e) {
  3055. e.preventDefault();
  3056. self.toggle(this);
  3057. })
  3058. .on('click.fndtn.topbar', '[data-topbar] li.has-dropdown', function (e) {
  3059. var li = $(this),
  3060. target = $(e.target),
  3061. topbar = li.closest('[data-topbar]'),
  3062. settings = topbar.data('topbar-init');
  3063. if(target.data('revealId')) {
  3064. self.toggle();
  3065. return;
  3066. }
  3067. if (self.breakpoint()) return;
  3068. if (settings.is_hover && !Modernizr.touch) return;
  3069. e.stopImmediatePropagation();
  3070. if (li.hasClass('hover')) {
  3071. li
  3072. .removeClass('hover')
  3073. .find('li')
  3074. .removeClass('hover');
  3075. li.parents('li.hover')
  3076. .removeClass('hover');
  3077. } else {
  3078. li.addClass('hover');
  3079. if (target[0].nodeName === 'A' && target.parent().hasClass('has-dropdown')) {
  3080. e.preventDefault();
  3081. }
  3082. }
  3083. })
  3084. .on('click.fndtn.topbar', '[data-topbar] .has-dropdown>a', function (e) {
  3085. if (self.breakpoint()) {
  3086. e.preventDefault();
  3087. var $this = $(this),
  3088. topbar = $this.closest('[data-topbar]'),
  3089. section = topbar.find('section, .section'),
  3090. dropdownHeight = $this.next('.dropdown').outerHeight(),
  3091. $selectedLi = $this.closest('li');
  3092. topbar.data('index', topbar.data('index') + 1);
  3093. $selectedLi.addClass('moved');
  3094. if (!self.rtl) {
  3095. section.css({left: -(100 * topbar.data('index')) + '%'});
  3096. section.find('>.name').css({left: 100 * topbar.data('index') + '%'});
  3097. } else {
  3098. section.css({right: -(100 * topbar.data('index')) + '%'});
  3099. section.find('>.name').css({right: 100 * topbar.data('index') + '%'});
  3100. }
  3101. topbar.css('height', $this.siblings('ul').outerHeight(true) + topbar.data('height'));
  3102. }
  3103. });
  3104. $(window).off('.topbar').on('resize.fndtn.topbar', self.throttle(function () {
  3105. self.resize.call(self);
  3106. }, 50)).trigger('resize');
  3107. $('body').off('.topbar').on('click.fndtn.topbar touchstart.fndtn.topbar', function (e) {
  3108. var parent = $(e.target).closest('li').closest('li.hover');
  3109. if (parent.length > 0) {
  3110. return;
  3111. }
  3112. $('[data-topbar] li').removeClass('hover');
  3113. });
  3114. // Go up a level on Click
  3115. $(this.scope).on('click.fndtn.topbar', '[data-topbar] .has-dropdown .back', function (e) {
  3116. e.preventDefault();
  3117. var $this = $(this),
  3118. topbar = $this.closest('[data-topbar]'),
  3119. section = topbar.find('section, .section'),
  3120. settings = topbar.data('topbar-init'),
  3121. $movedLi = $this.closest('li.moved'),
  3122. $previousLevelUl = $movedLi.parent();
  3123. topbar.data('index', topbar.data('index') - 1);
  3124. if (!self.rtl) {
  3125. section.css({left: -(100 * topbar.data('index')) + '%'});
  3126. section.find('>.name').css({left: 100 * topbar.data('index') + '%'});
  3127. } else {
  3128. section.css({right: -(100 * topbar.data('index')) + '%'});
  3129. section.find('>.name').css({right: 100 * topbar.data('index') + '%'});
  3130. }
  3131. if (topbar.data('index') === 0) {
  3132. topbar.css('height', '');
  3133. } else {
  3134. topbar.css('height', $previousLevelUl.outerHeight(true) + topbar.data('height'));
  3135. }
  3136. setTimeout(function () {
  3137. $movedLi.removeClass('moved');
  3138. }, 300);
  3139. });
  3140. },
  3141. resize : function () {
  3142. var self = this;
  3143. $('[data-topbar]').each(function () {
  3144. var topbar = $(this),
  3145. settings = topbar.data('topbar-init');
  3146. var stickyContainer = topbar.parent('.' + self.settings.sticky_class);
  3147. var stickyOffset;
  3148. if (!self.breakpoint()) {
  3149. var doToggle = topbar.hasClass('expanded');
  3150. topbar
  3151. .css('height', '')
  3152. .removeClass('expanded')
  3153. .find('li')
  3154. .removeClass('hover');
  3155. if(doToggle) {
  3156. self.toggle(topbar);
  3157. }
  3158. }
  3159. if(stickyContainer.length > 0) {
  3160. if(stickyContainer.hasClass('fixed')) {
  3161. // Remove the fixed to allow for correct calculation of the offset.
  3162. stickyContainer.removeClass('fixed');
  3163. stickyOffset = stickyContainer.offset().top;
  3164. if($(document.body).hasClass('f-topbar-fixed')) {
  3165. stickyOffset -= topbar.data('height');
  3166. }
  3167. topbar.data('stickyoffset', stickyOffset);
  3168. stickyContainer.addClass('fixed');
  3169. } else {
  3170. stickyOffset = stickyContainer.offset().top;
  3171. topbar.data('stickyoffset', stickyOffset);
  3172. }
  3173. }
  3174. });
  3175. },
  3176. breakpoint : function () {
  3177. return !matchMedia(Foundation.media_queries['topbar']).matches;
  3178. },
  3179. assemble : function (topbar) {
  3180. var self = this,
  3181. settings = topbar.data('topbar-init'),
  3182. section = $('section', topbar),
  3183. titlebar = $('> ul', topbar).first();
  3184. // Pull element out of the DOM for manipulation
  3185. section.detach();
  3186. $('.has-dropdown>a', section).each(function () {
  3187. var $link = $(this),
  3188. $dropdown = $link.siblings('.dropdown'),
  3189. url = $link.attr('href');
  3190. if (settings.mobile_show_parent_link && url && url.length > 1) {
  3191. var $titleLi = $('<li class="title back js-generated"><h5><a href="#"></a></h5></li><li><a class="parent-link js-generated" href="' + url + '">' + $link.text() +'</a></li>');
  3192. } else {
  3193. var $titleLi = $('<li class="title back js-generated"><h5><a href="#"></a></h5></li>');
  3194. }
  3195. // Copy link to subnav
  3196. if (settings.custom_back_text == true) {
  3197. $('h5>a', $titleLi).html(settings.back_text);
  3198. } else {
  3199. $('h5>a', $titleLi).html('&laquo; ' + $link.html());
  3200. }
  3201. $dropdown.prepend($titleLi);
  3202. });
  3203. // Put element back in the DOM
  3204. section.appendTo(topbar);
  3205. // check for sticky
  3206. this.sticky();
  3207. this.assembled(topbar);
  3208. },
  3209. assembled : function (topbar) {
  3210. topbar.data('topbar-init', $.extend({}, topbar.data('topbar-init'), {assembled: true}));
  3211. },
  3212. height : function (ul) {
  3213. var total = 0,
  3214. self = this;
  3215. $('> li', ul).each(function () { total += $(this).outerHeight(true); });
  3216. return total;
  3217. },
  3218. sticky : function () {
  3219. var $window = $(window),
  3220. self = this;
  3221. $(window).on('scroll', function() {
  3222. self.update_sticky_positioning();
  3223. });
  3224. },
  3225. update_sticky_positioning: function() {
  3226. var klass = '.' + this.settings.sticky_class;
  3227. var $window = $(window);
  3228. if ($(klass).length > 0) {
  3229. var distance = this.settings.sticky_topbar.data('stickyoffset');
  3230. if (!$(klass).hasClass('expanded')) {
  3231. if ($window.scrollTop() > (distance)) {
  3232. if (!$(klass).hasClass('fixed')) {
  3233. $(klass).addClass('fixed');
  3234. $('body').addClass('f-topbar-fixed');
  3235. }
  3236. } else if ($window.scrollTop() <= distance) {
  3237. if ($(klass).hasClass('fixed')) {
  3238. $(klass).removeClass('fixed');
  3239. $('body').removeClass('f-topbar-fixed');
  3240. }
  3241. }
  3242. }
  3243. }
  3244. },
  3245. off : function () {
  3246. $(this.scope).off('.fndtn.topbar');
  3247. $(window).off('.fndtn.topbar');
  3248. },
  3249. reflow : function () {}
  3250. };
  3251. }(jQuery, this, this.document));
  3252. /*!
  3253. * Modernizr v2.7.1
  3254. * www.modernizr.com
  3255. *
  3256. * Copyright (c) Faruk Ates, Paul Irish, Alex Sexton
  3257. * Available under the BSD and MIT licenses: www.modernizr.com/license/
  3258. */
  3259. /*
  3260. * Modernizr tests which native CSS3 and HTML5 features are available in
  3261. * the current UA and makes the results available to you in two ways:
  3262. * as properties on a global Modernizr object, and as classes on the
  3263. * <html> element. This information allows you to progressively enhance
  3264. * your pages with a granular level of control over the experience.
  3265. *
  3266. * Modernizr has an optional (not included) conditional resource loader
  3267. * called Modernizr.load(), based on Yepnope.js (yepnopejs.com).
  3268. * To get a build that includes Modernizr.load(), as well as choosing
  3269. * which tests to include, go to www.modernizr.com/download/
  3270. *
  3271. * Authors Faruk Ates, Paul Irish, Alex Sexton
  3272. * Contributors Ryan Seddon, Ben Alman
  3273. */
  3274. window.Modernizr = (function( window, document, undefined ) {
  3275. var version = '2.7.1',
  3276. Modernizr = {},
  3277. /*>>cssclasses*/
  3278. // option for enabling the HTML classes to be added
  3279. enableClasses = true,
  3280. /*>>cssclasses*/
  3281. docElement = document.documentElement,
  3282. /**
  3283. * Create our "modernizr" element that we do most feature tests on.
  3284. */
  3285. mod = 'modernizr',
  3286. modElem = document.createElement(mod),
  3287. mStyle = modElem.style,
  3288. /**
  3289. * Create the input element for various Web Forms feature tests.
  3290. */
  3291. inputElem /*>>inputelem*/ = document.createElement('input') /*>>inputelem*/ ,
  3292. /*>>smile*/
  3293. smile = ':)',
  3294. /*>>smile*/
  3295. toString = {}.toString,
  3296. // TODO :: make the prefixes more granular
  3297. /*>>prefixes*/
  3298. // List of property values to set for css tests. See ticket #21
  3299. prefixes = ' -webkit- -moz- -o- -ms- '.split(' '),
  3300. /*>>prefixes*/
  3301. /*>>domprefixes*/
  3302. // Following spec is to expose vendor-specific style properties as:
  3303. // elem.style.WebkitBorderRadius
  3304. // and the following would be incorrect:
  3305. // elem.style.webkitBorderRadius
  3306. // Webkit ghosts their properties in lowercase but Opera & Moz do not.
  3307. // Microsoft uses a lowercase `ms` instead of the correct `Ms` in IE8+
  3308. // erik.eae.net/archives/2008/03/10/21.48.10/
  3309. // More here: github.com/Modernizr/Modernizr/issues/issue/21
  3310. omPrefixes = 'Webkit Moz O ms',
  3311. cssomPrefixes = omPrefixes.split(' '),
  3312. domPrefixes = omPrefixes.toLowerCase().split(' '),
  3313. /*>>domprefixes*/
  3314. /*>>ns*/
  3315. ns = {'svg': 'http://www.w3.org/2000/svg'},
  3316. /*>>ns*/
  3317. tests = {},
  3318. inputs = {},
  3319. attrs = {},
  3320. classes = [],
  3321. slice = classes.slice,
  3322. featureName, // used in testing loop
  3323. /*>>teststyles*/
  3324. // Inject element with style element and some CSS rules
  3325. injectElementWithStyles = function( rule, callback, nodes, testnames ) {
  3326. var style, ret, node, docOverflow,
  3327. div = document.createElement('div'),
  3328. // After page load injecting a fake body doesn't work so check if body exists
  3329. body = document.body,
  3330. // IE6 and 7 won't return offsetWidth or offsetHeight unless it's in the body element, so we fake it.
  3331. fakeBody = body || document.createElement('body');
  3332. if ( parseInt(nodes, 10) ) {
  3333. // In order not to give false positives we create a node for each test
  3334. // This also allows the method to scale for unspecified uses
  3335. while ( nodes-- ) {
  3336. node = document.createElement('div');
  3337. node.id = testnames ? testnames[nodes] : mod + (nodes + 1);
  3338. div.appendChild(node);
  3339. }
  3340. }
  3341. // <style> elements in IE6-9 are considered 'NoScope' elements and therefore will be removed
  3342. // when injected with innerHTML. To get around this you need to prepend the 'NoScope' element
  3343. // with a 'scoped' element, in our case the soft-hyphen entity as it won't mess with our measurements.
  3344. // msdn.microsoft.com/en-us/library/ms533897%28VS.85%29.aspx
  3345. // Documents served as xml will throw if using &shy; so use xml friendly encoded version. See issue #277
  3346. style = ['&#173;','<style id="s', mod, '">', rule, '</style>'].join('');
  3347. div.id = mod;
  3348. // IE6 will false positive on some tests due to the style element inside the test div somehow interfering offsetHeight, so insert it into body or fakebody.
  3349. // Opera will act all quirky when injecting elements in documentElement when page is served as xml, needs fakebody too. #270
  3350. (body ? div : fakeBody).innerHTML += style;
  3351. fakeBody.appendChild(div);
  3352. if ( !body ) {
  3353. //avoid crashing IE8, if background image is used
  3354. fakeBody.style.background = '';
  3355. //Safari 5.13/5.1.4 OSX stops loading if ::-webkit-scrollbar is used and scrollbars are visible
  3356. fakeBody.style.overflow = 'hidden';
  3357. docOverflow = docElement.style.overflow;
  3358. docElement.style.overflow = 'hidden';
  3359. docElement.appendChild(fakeBody);
  3360. }
  3361. ret = callback(div, rule);
  3362. // If this is done after page load we don't want to remove the body so check if body exists
  3363. if ( !body ) {
  3364. fakeBody.parentNode.removeChild(fakeBody);
  3365. docElement.style.overflow = docOverflow;
  3366. } else {
  3367. div.parentNode.removeChild(div);
  3368. }
  3369. return !!ret;
  3370. },
  3371. /*>>teststyles*/
  3372. /*>>mq*/
  3373. // adapted from matchMedia polyfill
  3374. // by Scott Jehl and Paul Irish
  3375. // gist.github.com/786768
  3376. testMediaQuery = function( mq ) {
  3377. var matchMedia = window.matchMedia || window.msMatchMedia;
  3378. if ( matchMedia ) {
  3379. return matchMedia(mq).matches;
  3380. }
  3381. var bool;
  3382. injectElementWithStyles('@media ' + mq + ' { #' + mod + ' { position: absolute; } }', function( node ) {
  3383. bool = (window.getComputedStyle ?
  3384. getComputedStyle(node, null) :
  3385. node.currentStyle)['position'] == 'absolute';
  3386. });
  3387. return bool;
  3388. },
  3389. /*>>mq*/
  3390. /*>>hasevent*/
  3391. //
  3392. // isEventSupported determines if a given element supports the given event
  3393. // kangax.github.com/iseventsupported/
  3394. //
  3395. // The following results are known incorrects:
  3396. // Modernizr.hasEvent("webkitTransitionEnd", elem) // false negative
  3397. // Modernizr.hasEvent("textInput") // in Webkit. github.com/Modernizr/Modernizr/issues/333
  3398. // ...
  3399. isEventSupported = (function() {
  3400. var TAGNAMES = {
  3401. 'select': 'input', 'change': 'input',
  3402. 'submit': 'form', 'reset': 'form',
  3403. 'error': 'img', 'load': 'img', 'abort': 'img'
  3404. };
  3405. function isEventSupported( eventName, element ) {
  3406. element = element || document.createElement(TAGNAMES[eventName] || 'div');
  3407. eventName = 'on' + eventName;
  3408. // When using `setAttribute`, IE skips "unload", WebKit skips "unload" and "resize", whereas `in` "catches" those
  3409. var isSupported = eventName in element;
  3410. if ( !isSupported ) {
  3411. // If it has no `setAttribute` (i.e. doesn't implement Node interface), try generic element
  3412. if ( !element.setAttribute ) {
  3413. element = document.createElement('div');
  3414. }
  3415. if ( element.setAttribute && element.removeAttribute ) {
  3416. element.setAttribute(eventName, '');
  3417. isSupported = is(element[eventName], 'function');
  3418. // If property was created, "remove it" (by setting value to `undefined`)
  3419. if ( !is(element[eventName], 'undefined') ) {
  3420. element[eventName] = undefined;
  3421. }
  3422. element.removeAttribute(eventName);
  3423. }
  3424. }
  3425. element = null;
  3426. return isSupported;
  3427. }
  3428. return isEventSupported;
  3429. })(),
  3430. /*>>hasevent*/
  3431. // TODO :: Add flag for hasownprop ? didn't last time
  3432. // hasOwnProperty shim by kangax needed for Safari 2.0 support
  3433. _hasOwnProperty = ({}).hasOwnProperty, hasOwnProp;
  3434. if ( !is(_hasOwnProperty, 'undefined') && !is(_hasOwnProperty.call, 'undefined') ) {
  3435. hasOwnProp = function (object, property) {
  3436. return _hasOwnProperty.call(object, property);
  3437. };
  3438. }
  3439. else {
  3440. hasOwnProp = function (object, property) { /* yes, this can give false positives/negatives, but most of the time we don't care about those */
  3441. return ((property in object) && is(object.constructor.prototype[property], 'undefined'));
  3442. };
  3443. }
  3444. // Adapted from ES5-shim https://github.com/kriskowal/es5-shim/blob/master/es5-shim.js
  3445. // es5.github.com/#x15.3.4.5
  3446. if (!Function.prototype.bind) {
  3447. Function.prototype.bind = function bind(that) {
  3448. var target = this;
  3449. if (typeof target != "function") {
  3450. throw new TypeError();
  3451. }
  3452. var args = slice.call(arguments, 1),
  3453. bound = function () {
  3454. if (this instanceof bound) {
  3455. var F = function(){};
  3456. F.prototype = target.prototype;
  3457. var self = new F();
  3458. var result = target.apply(
  3459. self,
  3460. args.concat(slice.call(arguments))
  3461. );
  3462. if (Object(result) === result) {
  3463. return result;
  3464. }
  3465. return self;
  3466. } else {
  3467. return target.apply(
  3468. that,
  3469. args.concat(slice.call(arguments))
  3470. );
  3471. }
  3472. };
  3473. return bound;
  3474. };
  3475. }
  3476. /**
  3477. * setCss applies given styles to the Modernizr DOM node.
  3478. */
  3479. function setCss( str ) {
  3480. mStyle.cssText = str;
  3481. }
  3482. /**
  3483. * setCssAll extrapolates all vendor-specific css strings.
  3484. */
  3485. function setCssAll( str1, str2 ) {
  3486. return setCss(prefixes.join(str1 + ';') + ( str2 || '' ));
  3487. }
  3488. /**
  3489. * is returns a boolean for if typeof obj is exactly type.
  3490. */
  3491. function is( obj, type ) {
  3492. return typeof obj === type;
  3493. }
  3494. /**
  3495. * contains returns a boolean for if substr is found within str.
  3496. */
  3497. function contains( str, substr ) {
  3498. return !!~('' + str).indexOf(substr);
  3499. }
  3500. /*>>testprop*/
  3501. // testProps is a generic CSS / DOM property test.
  3502. // In testing support for a given CSS property, it's legit to test:
  3503. // `elem.style[styleName] !== undefined`
  3504. // If the property is supported it will return an empty string,
  3505. // if unsupported it will return undefined.
  3506. // We'll take advantage of this quick test and skip setting a style
  3507. // on our modernizr element, but instead just testing undefined vs
  3508. // empty string.
  3509. // Because the testing of the CSS property names (with "-", as
  3510. // opposed to the camelCase DOM properties) is non-portable and
  3511. // non-standard but works in WebKit and IE (but not Gecko or Opera),
  3512. // we explicitly reject properties with dashes so that authors
  3513. // developing in WebKit or IE first don't end up with
  3514. // browser-specific content by accident.
  3515. function testProps( props, prefixed ) {
  3516. for ( var i in props ) {
  3517. var prop = props[i];
  3518. if ( !contains(prop, "-") && mStyle[prop] !== undefined ) {
  3519. return prefixed == 'pfx' ? prop : true;
  3520. }
  3521. }
  3522. return false;
  3523. }
  3524. /*>>testprop*/
  3525. // TODO :: add testDOMProps
  3526. /**
  3527. * testDOMProps is a generic DOM property test; if a browser supports
  3528. * a certain property, it won't return undefined for it.
  3529. */
  3530. function testDOMProps( props, obj, elem ) {
  3531. for ( var i in props ) {
  3532. var item = obj[props[i]];
  3533. if ( item !== undefined) {
  3534. // return the property name as a string
  3535. if (elem === false) return props[i];
  3536. // let's bind a function
  3537. if (is(item, 'function')){
  3538. // default to autobind unless override
  3539. return item.bind(elem || obj);
  3540. }
  3541. // return the unbound function or obj or value
  3542. return item;
  3543. }
  3544. }
  3545. return false;
  3546. }
  3547. /*>>testallprops*/
  3548. /**
  3549. * testPropsAll tests a list of DOM properties we want to check against.
  3550. * We specify literally ALL possible (known and/or likely) properties on
  3551. * the element including the non-vendor prefixed one, for forward-
  3552. * compatibility.
  3553. */
  3554. function testPropsAll( prop, prefixed, elem ) {
  3555. var ucProp = prop.charAt(0).toUpperCase() + prop.slice(1),
  3556. props = (prop + ' ' + cssomPrefixes.join(ucProp + ' ') + ucProp).split(' ');
  3557. // did they call .prefixed('boxSizing') or are we just testing a prop?
  3558. if(is(prefixed, "string") || is(prefixed, "undefined")) {
  3559. return testProps(props, prefixed);
  3560. // otherwise, they called .prefixed('requestAnimationFrame', window[, elem])
  3561. } else {
  3562. props = (prop + ' ' + (domPrefixes).join(ucProp + ' ') + ucProp).split(' ');
  3563. return testDOMProps(props, prefixed, elem);
  3564. }
  3565. }
  3566. /*>>testallprops*/
  3567. /**
  3568. * Tests
  3569. * -----
  3570. */
  3571. // The *new* flexbox
  3572. // dev.w3.org/csswg/css3-flexbox
  3573. tests['flexbox'] = function() {
  3574. return testPropsAll('flexWrap');
  3575. };
  3576. // The *old* flexbox
  3577. // www.w3.org/TR/2009/WD-css3-flexbox-20090723/
  3578. tests['flexboxlegacy'] = function() {
  3579. return testPropsAll('boxDirection');
  3580. };
  3581. // On the S60 and BB Storm, getContext exists, but always returns undefined
  3582. // so we actually have to call getContext() to verify
  3583. // github.com/Modernizr/Modernizr/issues/issue/97/
  3584. tests['canvas'] = function() {
  3585. var elem = document.createElement('canvas');
  3586. return !!(elem.getContext && elem.getContext('2d'));
  3587. };
  3588. tests['canvastext'] = function() {
  3589. return !!(Modernizr['canvas'] && is(document.createElement('canvas').getContext('2d').fillText, 'function'));
  3590. };
  3591. // webk.it/70117 is tracking a legit WebGL feature detect proposal
  3592. // We do a soft detect which may false positive in order to avoid
  3593. // an expensive context creation: bugzil.la/732441
  3594. tests['webgl'] = function() {
  3595. return !!window.WebGLRenderingContext;
  3596. };
  3597. /*
  3598. * The Modernizr.touch test only indicates if the browser supports
  3599. * touch events, which does not necessarily reflect a touchscreen
  3600. * device, as evidenced by tablets running Windows 7 or, alas,
  3601. * the Palm Pre / WebOS (touch) phones.
  3602. *
  3603. * Additionally, Chrome (desktop) used to lie about its support on this,
  3604. * but that has since been rectified: crbug.com/36415
  3605. *
  3606. * We also test for Firefox 4 Multitouch Support.
  3607. *
  3608. * For more info, see: modernizr.github.com/Modernizr/touch.html
  3609. */
  3610. tests['touch'] = function() {
  3611. var bool;
  3612. if(('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch) {
  3613. bool = true;
  3614. } else {
  3615. injectElementWithStyles(['@media (',prefixes.join('touch-enabled),('),mod,')','{#modernizr{top:9px;position:absolute}}'].join(''), function( node ) {
  3616. bool = node.offsetTop === 9;
  3617. });
  3618. }
  3619. return bool;
  3620. };
  3621. // geolocation is often considered a trivial feature detect...
  3622. // Turns out, it's quite tricky to get right:
  3623. //
  3624. // Using !!navigator.geolocation does two things we don't want. It:
  3625. // 1. Leaks memory in IE9: github.com/Modernizr/Modernizr/issues/513
  3626. // 2. Disables page caching in WebKit: webk.it/43956
  3627. //
  3628. // Meanwhile, in Firefox < 8, an about:config setting could expose
  3629. // a false positive that would throw an exception: bugzil.la/688158
  3630. tests['geolocation'] = function() {
  3631. return 'geolocation' in navigator;
  3632. };
  3633. tests['postmessage'] = function() {
  3634. return !!window.postMessage;
  3635. };
  3636. // Chrome incognito mode used to throw an exception when using openDatabase
  3637. // It doesn't anymore.
  3638. tests['websqldatabase'] = function() {
  3639. return !!window.openDatabase;
  3640. };
  3641. // Vendors had inconsistent prefixing with the experimental Indexed DB:
  3642. // - Webkit's implementation is accessible through webkitIndexedDB
  3643. // - Firefox shipped moz_indexedDB before FF4b9, but since then has been mozIndexedDB
  3644. // For speed, we don't test the legacy (and beta-only) indexedDB
  3645. tests['indexedDB'] = function() {
  3646. return !!testPropsAll("indexedDB", window);
  3647. };
  3648. // documentMode logic from YUI to filter out IE8 Compat Mode
  3649. // which false positives.
  3650. tests['hashchange'] = function() {
  3651. return isEventSupported('hashchange', window) && (document.documentMode === undefined || document.documentMode > 7);
  3652. };
  3653. // Per 1.6:
  3654. // This used to be Modernizr.historymanagement but the longer
  3655. // name has been deprecated in favor of a shorter and property-matching one.
  3656. // The old API is still available in 1.6, but as of 2.0 will throw a warning,
  3657. // and in the first release thereafter disappear entirely.
  3658. tests['history'] = function() {
  3659. return !!(window.history && history.pushState);
  3660. };
  3661. tests['draganddrop'] = function() {
  3662. var div = document.createElement('div');
  3663. return ('draggable' in div) || ('ondragstart' in div && 'ondrop' in div);
  3664. };
  3665. // FF3.6 was EOL'ed on 4/24/12, but the ESR version of FF10
  3666. // will be supported until FF19 (2/12/13), at which time, ESR becomes FF17.
  3667. // FF10 still uses prefixes, so check for it until then.
  3668. // for more ESR info, see: mozilla.org/en-US/firefox/organizations/faq/
  3669. tests['websockets'] = function() {
  3670. return 'WebSocket' in window || 'MozWebSocket' in window;
  3671. };
  3672. // css-tricks.com/rgba-browser-support/
  3673. tests['rgba'] = function() {
  3674. // Set an rgba() color and check the returned value
  3675. setCss('background-color:rgba(150,255,150,.5)');
  3676. return contains(mStyle.backgroundColor, 'rgba');
  3677. };
  3678. tests['hsla'] = function() {
  3679. // Same as rgba(), in fact, browsers re-map hsla() to rgba() internally,
  3680. // except IE9 who retains it as hsla
  3681. setCss('background-color:hsla(120,40%,100%,.5)');
  3682. return contains(mStyle.backgroundColor, 'rgba') || contains(mStyle.backgroundColor, 'hsla');
  3683. };
  3684. tests['multiplebgs'] = function() {
  3685. // Setting multiple images AND a color on the background shorthand property
  3686. // and then querying the style.background property value for the number of
  3687. // occurrences of "url(" is a reliable method for detecting ACTUAL support for this!
  3688. setCss('background:url(https://),url(https://),red url(https://)');
  3689. // If the UA supports multiple backgrounds, there should be three occurrences
  3690. // of the string "url(" in the return value for elemStyle.background
  3691. return (/(url\s*\(.*?){3}/).test(mStyle.background);
  3692. };
  3693. // this will false positive in Opera Mini
  3694. // github.com/Modernizr/Modernizr/issues/396
  3695. tests['backgroundsize'] = function() {
  3696. return testPropsAll('backgroundSize');
  3697. };
  3698. tests['borderimage'] = function() {
  3699. return testPropsAll('borderImage');
  3700. };
  3701. // Super comprehensive table about all the unique implementations of
  3702. // border-radius: muddledramblings.com/table-of-css3-border-radius-compliance
  3703. tests['borderradius'] = function() {
  3704. return testPropsAll('borderRadius');
  3705. };
  3706. // WebOS unfortunately false positives on this test.
  3707. tests['boxshadow'] = function() {
  3708. return testPropsAll('boxShadow');
  3709. };
  3710. // FF3.0 will false positive on this test
  3711. tests['textshadow'] = function() {
  3712. return document.createElement('div').style.textShadow === '';
  3713. };
  3714. tests['opacity'] = function() {
  3715. // Browsers that actually have CSS Opacity implemented have done so
  3716. // according to spec, which means their return values are within the
  3717. // range of [0.0,1.0] - including the leading zero.
  3718. setCssAll('opacity:.55');
  3719. // The non-literal . in this regex is intentional:
  3720. // German Chrome returns this value as 0,55
  3721. // github.com/Modernizr/Modernizr/issues/#issue/59/comment/516632
  3722. return (/^0.55$/).test(mStyle.opacity);
  3723. };
  3724. // Note, Android < 4 will pass this test, but can only animate
  3725. // a single property at a time
  3726. // daneden.me/2011/12/putting-up-with-androids-bullshit/
  3727. tests['cssanimations'] = function() {
  3728. return testPropsAll('animationName');
  3729. };
  3730. tests['csscolumns'] = function() {
  3731. return testPropsAll('columnCount');
  3732. };
  3733. tests['cssgradients'] = function() {
  3734. /**
  3735. * For CSS Gradients syntax, please see:
  3736. * webkit.org/blog/175/introducing-css-gradients/
  3737. * developer.mozilla.org/en/CSS/-moz-linear-gradient
  3738. * developer.mozilla.org/en/CSS/-moz-radial-gradient
  3739. * dev.w3.org/csswg/css3-images/#gradients-
  3740. */
  3741. var str1 = 'background-image:',
  3742. str2 = 'gradient(linear,left top,right bottom,from(#9f9),to(white));',
  3743. str3 = 'linear-gradient(left top,#9f9, white);';
  3744. setCss(
  3745. // legacy webkit syntax (FIXME: remove when syntax not in use anymore)
  3746. (str1 + '-webkit- '.split(' ').join(str2 + str1) +
  3747. // standard syntax // trailing 'background-image:'
  3748. prefixes.join(str3 + str1)).slice(0, -str1.length)
  3749. );
  3750. return contains(mStyle.backgroundImage, 'gradient');
  3751. };
  3752. tests['cssreflections'] = function() {
  3753. return testPropsAll('boxReflect');
  3754. };
  3755. tests['csstransforms'] = function() {
  3756. return !!testPropsAll('transform');
  3757. };
  3758. tests['csstransforms3d'] = function() {
  3759. var ret = !!testPropsAll('perspective');
  3760. // Webkit's 3D transforms are passed off to the browser's own graphics renderer.
  3761. // It works fine in Safari on Leopard and Snow Leopard, but not in Chrome in
  3762. // some conditions. As a result, Webkit typically recognizes the syntax but
  3763. // will sometimes throw a false positive, thus we must do a more thorough check:
  3764. if ( ret && 'webkitPerspective' in docElement.style ) {
  3765. // Webkit allows this media query to succeed only if the feature is enabled.
  3766. // `@media (transform-3d),(-webkit-transform-3d){ ... }`
  3767. injectElementWithStyles('@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}', function( node, rule ) {
  3768. ret = node.offsetLeft === 9 && node.offsetHeight === 3;
  3769. });
  3770. }
  3771. return ret;
  3772. };
  3773. tests['csstransitions'] = function() {
  3774. return testPropsAll('transition');
  3775. };
  3776. /*>>fontface*/
  3777. // @font-face detection routine by Diego Perini
  3778. // javascript.nwbox.com/CSSSupport/
  3779. // false positives:
  3780. // WebOS github.com/Modernizr/Modernizr/issues/342
  3781. // WP7 github.com/Modernizr/Modernizr/issues/538
  3782. tests['fontface'] = function() {
  3783. var bool;
  3784. injectElementWithStyles('@font-face {font-family:"font";src:url("https://")}', function( node, rule ) {
  3785. var style = document.getElementById('smodernizr'),
  3786. sheet = style.sheet || style.styleSheet,
  3787. cssText = sheet ? (sheet.cssRules && sheet.cssRules[0] ? sheet.cssRules[0].cssText : sheet.cssText || '') : '';
  3788. bool = /src/i.test(cssText) && cssText.indexOf(rule.split(' ')[0]) === 0;
  3789. });
  3790. return bool;
  3791. };
  3792. /*>>fontface*/
  3793. // CSS generated content detection
  3794. tests['generatedcontent'] = function() {
  3795. var bool;
  3796. injectElementWithStyles(['#',mod,'{font:0/0 a}#',mod,':after{content:"',smile,'";visibility:hidden;font:3px/1 a}'].join(''), function( node ) {
  3797. bool = node.offsetHeight >= 3;
  3798. });
  3799. return bool;
  3800. };
  3801. // These tests evaluate support of the video/audio elements, as well as
  3802. // testing what types of content they support.
  3803. //
  3804. // We're using the Boolean constructor here, so that we can extend the value
  3805. // e.g. Modernizr.video // true
  3806. // Modernizr.video.ogg // 'probably'
  3807. //
  3808. // Codec values from : github.com/NielsLeenheer/html5test/blob/9106a8/index.html#L845
  3809. // thx to NielsLeenheer and zcorpan
  3810. // Note: in some older browsers, "no" was a return value instead of empty string.
  3811. // It was live in FF3.5.0 and 3.5.1, but fixed in 3.5.2
  3812. // It was also live in Safari 4.0.0 - 4.0.4, but fixed in 4.0.5
  3813. tests['video'] = function() {
  3814. var elem = document.createElement('video'),
  3815. bool = false;
  3816. // IE9 Running on Windows Server SKU can cause an exception to be thrown, bug #224
  3817. try {
  3818. if ( bool = !!elem.canPlayType ) {
  3819. bool = new Boolean(bool);
  3820. bool.ogg = elem.canPlayType('video/ogg; codecs="theora"') .replace(/^no$/,'');
  3821. // Without QuickTime, this value will be `undefined`. github.com/Modernizr/Modernizr/issues/546
  3822. bool.h264 = elem.canPlayType('video/mp4; codecs="avc1.42E01E"') .replace(/^no$/,'');
  3823. bool.webm = elem.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,'');
  3824. }
  3825. } catch(e) { }
  3826. return bool;
  3827. };
  3828. tests['audio'] = function() {
  3829. var elem = document.createElement('audio'),
  3830. bool = false;
  3831. try {
  3832. if ( bool = !!elem.canPlayType ) {
  3833. bool = new Boolean(bool);
  3834. bool.ogg = elem.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,'');
  3835. bool.mp3 = elem.canPlayType('audio/mpeg;') .replace(/^no$/,'');
  3836. // Mimetypes accepted:
  3837. // developer.mozilla.org/En/Media_formats_supported_by_the_audio_and_video_elements
  3838. // bit.ly/iphoneoscodecs
  3839. bool.wav = elem.canPlayType('audio/wav; codecs="1"') .replace(/^no$/,'');
  3840. bool.m4a = ( elem.canPlayType('audio/x-m4a;') ||
  3841. elem.canPlayType('audio/aac;')) .replace(/^no$/,'');
  3842. }
  3843. } catch(e) { }
  3844. return bool;
  3845. };
  3846. // In FF4, if disabled, window.localStorage should === null.
  3847. // Normally, we could not test that directly and need to do a
  3848. // `('localStorage' in window) && ` test first because otherwise Firefox will
  3849. // throw bugzil.la/365772 if cookies are disabled
  3850. // Also in iOS5 Private Browsing mode, attempting to use localStorage.setItem
  3851. // will throw the exception:
  3852. // QUOTA_EXCEEDED_ERRROR DOM Exception 22.
  3853. // Peculiarly, getItem and removeItem calls do not throw.
  3854. // Because we are forced to try/catch this, we'll go aggressive.
  3855. // Just FWIW: IE8 Compat mode supports these features completely:
  3856. // www.quirksmode.org/dom/html5.html
  3857. // But IE8 doesn't support either with local files
  3858. tests['localstorage'] = function() {
  3859. try {
  3860. localStorage.setItem(mod, mod);
  3861. localStorage.removeItem(mod);
  3862. return true;
  3863. } catch(e) {
  3864. return false;
  3865. }
  3866. };
  3867. tests['sessionstorage'] = function() {
  3868. try {
  3869. sessionStorage.setItem(mod, mod);
  3870. sessionStorage.removeItem(mod);
  3871. return true;
  3872. } catch(e) {
  3873. return false;
  3874. }
  3875. };
  3876. tests['webworkers'] = function() {
  3877. return !!window.Worker;
  3878. };
  3879. tests['applicationcache'] = function() {
  3880. return !!window.applicationCache;
  3881. };
  3882. // Thanks to Erik Dahlstrom
  3883. tests['svg'] = function() {
  3884. return !!document.createElementNS && !!document.createElementNS(ns.svg, 'svg').createSVGRect;
  3885. };
  3886. // specifically for SVG inline in HTML, not within XHTML
  3887. // test page: paulirish.com/demo/inline-svg
  3888. tests['inlinesvg'] = function() {
  3889. var div = document.createElement('div');
  3890. div.innerHTML = '<svg/>';
  3891. return (div.firstChild && div.firstChild.namespaceURI) == ns.svg;
  3892. };
  3893. // SVG SMIL animation
  3894. tests['smil'] = function() {
  3895. return !!document.createElementNS && /SVGAnimate/.test(toString.call(document.createElementNS(ns.svg, 'animate')));
  3896. };
  3897. // This test is only for clip paths in SVG proper, not clip paths on HTML content
  3898. // demo: srufaculty.sru.edu/david.dailey/svg/newstuff/clipPath4.svg
  3899. // However read the comments to dig into applying SVG clippaths to HTML content here:
  3900. // github.com/Modernizr/Modernizr/issues/213#issuecomment-1149491
  3901. tests['svgclippaths'] = function() {
  3902. return !!document.createElementNS && /SVGClipPath/.test(toString.call(document.createElementNS(ns.svg, 'clipPath')));
  3903. };
  3904. /*>>webforms*/
  3905. // input features and input types go directly onto the ret object, bypassing the tests loop.
  3906. // Hold this guy to execute in a moment.
  3907. function webforms() {
  3908. /*>>input*/
  3909. // Run through HTML5's new input attributes to see if the UA understands any.
  3910. // We're using f which is the <input> element created early on
  3911. // Mike Taylr has created a comprehensive resource for testing these attributes
  3912. // when applied to all input types:
  3913. // miketaylr.com/code/input-type-attr.html
  3914. // spec: www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary
  3915. // Only input placeholder is tested while textarea's placeholder is not.
  3916. // Currently Safari 4 and Opera 11 have support only for the input placeholder
  3917. // Both tests are available in feature-detects/forms-placeholder.js
  3918. Modernizr['input'] = (function( props ) {
  3919. for ( var i = 0, len = props.length; i < len; i++ ) {
  3920. attrs[ props[i] ] = !!(props[i] in inputElem);
  3921. }
  3922. if (attrs.list){
  3923. // safari false positive's on datalist: webk.it/74252
  3924. // see also github.com/Modernizr/Modernizr/issues/146
  3925. attrs.list = !!(document.createElement('datalist') && window.HTMLDataListElement);
  3926. }
  3927. return attrs;
  3928. })('autocomplete autofocus list placeholder max min multiple pattern required step'.split(' '));
  3929. /*>>input*/
  3930. /*>>inputtypes*/
  3931. // Run through HTML5's new input types to see if the UA understands any.
  3932. // This is put behind the tests runloop because it doesn't return a
  3933. // true/false like all the other tests; instead, it returns an object
  3934. // containing each input type with its corresponding true/false value
  3935. // Big thanks to @miketaylr for the html5 forms expertise. miketaylr.com/
  3936. Modernizr['inputtypes'] = (function(props) {
  3937. for ( var i = 0, bool, inputElemType, defaultView, len = props.length; i < len; i++ ) {
  3938. inputElem.setAttribute('type', inputElemType = props[i]);
  3939. bool = inputElem.type !== 'text';
  3940. // We first check to see if the type we give it sticks..
  3941. // If the type does, we feed it a textual value, which shouldn't be valid.
  3942. // If the value doesn't stick, we know there's input sanitization which infers a custom UI
  3943. if ( bool ) {
  3944. inputElem.value = smile;
  3945. inputElem.style.cssText = 'position:absolute;visibility:hidden;';
  3946. if ( /^range$/.test(inputElemType) && inputElem.style.WebkitAppearance !== undefined ) {
  3947. docElement.appendChild(inputElem);
  3948. defaultView = document.defaultView;
  3949. // Safari 2-4 allows the smiley as a value, despite making a slider
  3950. bool = defaultView.getComputedStyle &&
  3951. defaultView.getComputedStyle(inputElem, null).WebkitAppearance !== 'textfield' &&
  3952. // Mobile android web browser has false positive, so must
  3953. // check the height to see if the widget is actually there.
  3954. (inputElem.offsetHeight !== 0);
  3955. docElement.removeChild(inputElem);
  3956. } else if ( /^(search|tel)$/.test(inputElemType) ){
  3957. // Spec doesn't define any special parsing or detectable UI
  3958. // behaviors so we pass these through as true
  3959. // Interestingly, opera fails the earlier test, so it doesn't
  3960. // even make it here.
  3961. } else if ( /^(url|email)$/.test(inputElemType) ) {
  3962. // Real url and email support comes with prebaked validation.
  3963. bool = inputElem.checkValidity && inputElem.checkValidity() === false;
  3964. } else {
  3965. // If the upgraded input compontent rejects the :) text, we got a winner
  3966. bool = inputElem.value != smile;
  3967. }
  3968. }
  3969. inputs[ props[i] ] = !!bool;
  3970. }
  3971. return inputs;
  3972. })('search tel url email datetime date month week time datetime-local number range color'.split(' '));
  3973. /*>>inputtypes*/
  3974. }
  3975. /*>>webforms*/
  3976. // End of test definitions
  3977. // -----------------------
  3978. // Run through all tests and detect their support in the current UA.
  3979. // todo: hypothetically we could be doing an array of tests and use a basic loop here.
  3980. for ( var feature in tests ) {
  3981. if ( hasOwnProp(tests, feature) ) {
  3982. // run the test, throw the return value into the Modernizr,
  3983. // then based on that boolean, define an appropriate className
  3984. // and push it into an array of classes we'll join later.
  3985. featureName = feature.toLowerCase();
  3986. Modernizr[featureName] = tests[feature]();
  3987. classes.push((Modernizr[featureName] ? '' : 'no-') + featureName);
  3988. }
  3989. }
  3990. /*>>webforms*/
  3991. // input tests need to run.
  3992. Modernizr.input || webforms();
  3993. /*>>webforms*/
  3994. /**
  3995. * addTest allows the user to define their own feature tests
  3996. * the result will be added onto the Modernizr object,
  3997. * as well as an appropriate className set on the html element
  3998. *
  3999. * @param feature - String naming the feature
  4000. * @param test - Function returning true if feature is supported, false if not
  4001. */
  4002. Modernizr.addTest = function ( feature, test ) {
  4003. if ( typeof feature == 'object' ) {
  4004. for ( var key in feature ) {
  4005. if ( hasOwnProp( feature, key ) ) {
  4006. Modernizr.addTest( key, feature[ key ] );
  4007. }
  4008. }
  4009. } else {
  4010. feature = feature.toLowerCase();
  4011. if ( Modernizr[feature] !== undefined ) {
  4012. // we're going to quit if you're trying to overwrite an existing test
  4013. // if we were to allow it, we'd do this:
  4014. // var re = new RegExp("\\b(no-)?" + feature + "\\b");
  4015. // docElement.className = docElement.className.replace( re, '' );
  4016. // but, no rly, stuff 'em.
  4017. return Modernizr;
  4018. }
  4019. test = typeof test == 'function' ? test() : test;
  4020. if (typeof enableClasses !== "undefined" && enableClasses) {
  4021. docElement.className += ' ' + (test ? '' : 'no-') + feature;
  4022. }
  4023. Modernizr[feature] = test;
  4024. }
  4025. return Modernizr; // allow chaining.
  4026. };
  4027. // Reset modElem.cssText to nothing to reduce memory footprint.
  4028. setCss('');
  4029. modElem = inputElem = null;
  4030. /*>>shiv*/
  4031. /**
  4032. * @preserve HTML5 Shiv prev3.7.1 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
  4033. */
  4034. ;(function(window, document) {
  4035. /*jshint evil:true */
  4036. /** version */
  4037. var version = '3.7.0';
  4038. /** Preset options */
  4039. var options = window.html5 || {};
  4040. /** Used to skip problem elements */
  4041. var reSkip = /^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i;
  4042. /** Not all elements can be cloned in IE **/
  4043. var saveClones = /^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i;
  4044. /** Detect whether the browser supports default html5 styles */
  4045. var supportsHtml5Styles;
  4046. /** Name of the expando, to work with multiple documents or to re-shiv one document */
  4047. var expando = '_html5shiv';
  4048. /** The id for the the documents expando */
  4049. var expanID = 0;
  4050. /** Cached data for each document */
  4051. var expandoData = {};
  4052. /** Detect whether the browser supports unknown elements */
  4053. var supportsUnknownElements;
  4054. (function() {
  4055. try {
  4056. var a = document.createElement('a');
  4057. a.innerHTML = '<xyz></xyz>';
  4058. //if the hidden property is implemented we can assume, that the browser supports basic HTML5 Styles
  4059. supportsHtml5Styles = ('hidden' in a);
  4060. supportsUnknownElements = a.childNodes.length == 1 || (function() {
  4061. // assign a false positive if unable to shiv
  4062. (document.createElement)('a');
  4063. var frag = document.createDocumentFragment();
  4064. return (
  4065. typeof frag.cloneNode == 'undefined' ||
  4066. typeof frag.createDocumentFragment == 'undefined' ||
  4067. typeof frag.createElement == 'undefined'
  4068. );
  4069. }());
  4070. } catch(e) {
  4071. // assign a false positive if detection fails => unable to shiv
  4072. supportsHtml5Styles = true;
  4073. supportsUnknownElements = true;
  4074. }
  4075. }());
  4076. /*--------------------------------------------------------------------------*/
  4077. /**
  4078. * Creates a style sheet with the given CSS text and adds it to the document.
  4079. * @private
  4080. * @param {Document} ownerDocument The document.
  4081. * @param {String} cssText The CSS text.
  4082. * @returns {StyleSheet} The style element.
  4083. */
  4084. function addStyleSheet(ownerDocument, cssText) {
  4085. var p = ownerDocument.createElement('p'),
  4086. parent = ownerDocument.getElementsByTagName('head')[0] || ownerDocument.documentElement;
  4087. p.innerHTML = 'x<style>' + cssText + '</style>';
  4088. return parent.insertBefore(p.lastChild, parent.firstChild);
  4089. }
  4090. /**
  4091. * Returns the value of `html5.elements` as an array.
  4092. * @private
  4093. * @returns {Array} An array of shived element node names.
  4094. */
  4095. function getElements() {
  4096. var elements = html5.elements;
  4097. return typeof elements == 'string' ? elements.split(' ') : elements;
  4098. }
  4099. /**
  4100. * Returns the data associated to the given document
  4101. * @private
  4102. * @param {Document} ownerDocument The document.
  4103. * @returns {Object} An object of data.
  4104. */
  4105. function getExpandoData(ownerDocument) {
  4106. var data = expandoData[ownerDocument[expando]];
  4107. if (!data) {
  4108. data = {};
  4109. expanID++;
  4110. ownerDocument[expando] = expanID;
  4111. expandoData[expanID] = data;
  4112. }
  4113. return data;
  4114. }
  4115. /**
  4116. * returns a shived element for the given nodeName and document
  4117. * @memberOf html5
  4118. * @param {String} nodeName name of the element
  4119. * @param {Document} ownerDocument The context document.
  4120. * @returns {Object} The shived element.
  4121. */
  4122. function createElement(nodeName, ownerDocument, data){
  4123. if (!ownerDocument) {
  4124. ownerDocument = document;
  4125. }
  4126. if(supportsUnknownElements){
  4127. return ownerDocument.createElement(nodeName);
  4128. }
  4129. if (!data) {
  4130. data = getExpandoData(ownerDocument);
  4131. }
  4132. var node;
  4133. if (data.cache[nodeName]) {
  4134. node = data.cache[nodeName].cloneNode();
  4135. } else if (saveClones.test(nodeName)) {
  4136. node = (data.cache[nodeName] = data.createElem(nodeName)).cloneNode();
  4137. } else {
  4138. node = data.createElem(nodeName);
  4139. }
  4140. // Avoid adding some elements to fragments in IE < 9 because
  4141. // * Attributes like `name` or `type` cannot be set/changed once an element
  4142. // is inserted into a document/fragment
  4143. // * Link elements with `src` attributes that are inaccessible, as with
  4144. // a 403 response, will cause the tab/window to crash
  4145. // * Script elements appended to fragments will execute when their `src`
  4146. // or `text` property is set
  4147. return node.canHaveChildren && !reSkip.test(nodeName) && !node.tagUrn ? data.frag.appendChild(node) : node;
  4148. }
  4149. /**
  4150. * returns a shived DocumentFragment for the given document
  4151. * @memberOf html5
  4152. * @param {Document} ownerDocument The context document.
  4153. * @returns {Object} The shived DocumentFragment.
  4154. */
  4155. function createDocumentFragment(ownerDocument, data){
  4156. if (!ownerDocument) {
  4157. ownerDocument = document;
  4158. }
  4159. if(supportsUnknownElements){
  4160. return ownerDocument.createDocumentFragment();
  4161. }
  4162. data = data || getExpandoData(ownerDocument);
  4163. var clone = data.frag.cloneNode(),
  4164. i = 0,
  4165. elems = getElements(),
  4166. l = elems.length;
  4167. for(;i<l;i++){
  4168. clone.createElement(elems[i]);
  4169. }
  4170. return clone;
  4171. }
  4172. /**
  4173. * Shivs the `createElement` and `createDocumentFragment` methods of the document.
  4174. * @private
  4175. * @param {Document|DocumentFragment} ownerDocument The document.
  4176. * @param {Object} data of the document.
  4177. */
  4178. function shivMethods(ownerDocument, data) {
  4179. if (!data.cache) {
  4180. data.cache = {};
  4181. data.createElem = ownerDocument.createElement;
  4182. data.createFrag = ownerDocument.createDocumentFragment;
  4183. data.frag = data.createFrag();
  4184. }
  4185. ownerDocument.createElement = function(nodeName) {
  4186. //abort shiv
  4187. if (!html5.shivMethods) {
  4188. return data.createElem(nodeName);
  4189. }
  4190. return createElement(nodeName, ownerDocument, data);
  4191. };
  4192. ownerDocument.createDocumentFragment = Function('h,f', 'return function(){' +
  4193. 'var n=f.cloneNode(),c=n.createElement;' +
  4194. 'h.shivMethods&&(' +
  4195. // unroll the `createElement` calls
  4196. getElements().join().replace(/[\w\-]+/g, function(nodeName) {
  4197. data.createElem(nodeName);
  4198. data.frag.createElement(nodeName);
  4199. return 'c("' + nodeName + '")';
  4200. }) +
  4201. ');return n}'
  4202. )(html5, data.frag);
  4203. }
  4204. /*--------------------------------------------------------------------------*/
  4205. /**
  4206. * Shivs the given document.
  4207. * @memberOf html5
  4208. * @param {Document} ownerDocument The document to shiv.
  4209. * @returns {Document} The shived document.
  4210. */
  4211. function shivDocument(ownerDocument) {
  4212. if (!ownerDocument) {
  4213. ownerDocument = document;
  4214. }
  4215. var data = getExpandoData(ownerDocument);
  4216. if (html5.shivCSS && !supportsHtml5Styles && !data.hasCSS) {
  4217. data.hasCSS = !!addStyleSheet(ownerDocument,
  4218. // corrects block display not defined in IE6/7/8/9
  4219. 'article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}' +
  4220. // adds styling not present in IE6/7/8/9
  4221. 'mark{background:#FF0;color:#000}' +
  4222. // hides non-rendered elements
  4223. 'template{display:none}'
  4224. );
  4225. }
  4226. if (!supportsUnknownElements) {
  4227. shivMethods(ownerDocument, data);
  4228. }
  4229. return ownerDocument;
  4230. }
  4231. /*--------------------------------------------------------------------------*/
  4232. /**
  4233. * The `html5` object is exposed so that more elements can be shived and
  4234. * existing shiving can be detected on iframes.
  4235. * @type Object
  4236. * @example
  4237. *
  4238. * // options can be changed before the script is included
  4239. * html5 = { 'elements': 'mark section', 'shivCSS': false, 'shivMethods': false };
  4240. */
  4241. var html5 = {
  4242. /**
  4243. * An array or space separated string of node names of the elements to shiv.
  4244. * @memberOf html5
  4245. * @type Array|String
  4246. */
  4247. 'elements': options.elements || 'abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output progress section summary template time video',
  4248. /**
  4249. * current version of html5shiv
  4250. */
  4251. 'version': version,
  4252. /**
  4253. * A flag to indicate that the HTML5 style sheet should be inserted.
  4254. * @memberOf html5
  4255. * @type Boolean
  4256. */
  4257. 'shivCSS': (options.shivCSS !== false),
  4258. /**
  4259. * Is equal to true if a browser supports creating unknown/HTML5 elements
  4260. * @memberOf html5
  4261. * @type boolean
  4262. */
  4263. 'supportsUnknownElements': supportsUnknownElements,
  4264. /**
  4265. * A flag to indicate that the document's `createElement` and `createDocumentFragment`
  4266. * methods should be overwritten.
  4267. * @memberOf html5
  4268. * @type Boolean
  4269. */
  4270. 'shivMethods': (options.shivMethods !== false),
  4271. /**
  4272. * A string to describe the type of `html5` object ("default" or "default print").
  4273. * @memberOf html5
  4274. * @type String
  4275. */
  4276. 'type': 'default',
  4277. // shivs the document according to the specified `html5` object options
  4278. 'shivDocument': shivDocument,
  4279. //creates a shived element
  4280. createElement: createElement,
  4281. //creates a shived documentFragment
  4282. createDocumentFragment: createDocumentFragment
  4283. };
  4284. /*--------------------------------------------------------------------------*/
  4285. // expose html5
  4286. window.html5 = html5;
  4287. // shiv the document
  4288. shivDocument(document);
  4289. }(this, document));
  4290. /*>>shiv*/
  4291. // Assign private properties to the return object with prefix
  4292. Modernizr._version = version;
  4293. // expose these for the plugin API. Look in the source for how to join() them against your input
  4294. /*>>prefixes*/
  4295. Modernizr._prefixes = prefixes;
  4296. /*>>prefixes*/
  4297. /*>>domprefixes*/
  4298. Modernizr._domPrefixes = domPrefixes;
  4299. Modernizr._cssomPrefixes = cssomPrefixes;
  4300. /*>>domprefixes*/
  4301. /*>>mq*/
  4302. // Modernizr.mq tests a given media query, live against the current state of the window
  4303. // A few important notes:
  4304. // * If a browser does not support media queries at all (eg. oldIE) the mq() will always return false
  4305. // * A max-width or orientation query will be evaluated against the current state, which may change later.
  4306. // * You must specify values. Eg. If you are testing support for the min-width media query use:
  4307. // Modernizr.mq('(min-width:0)')
  4308. // usage:
  4309. // Modernizr.mq('only screen and (max-width:768)')
  4310. Modernizr.mq = testMediaQuery;
  4311. /*>>mq*/
  4312. /*>>hasevent*/
  4313. // Modernizr.hasEvent() detects support for a given event, with an optional element to test on
  4314. // Modernizr.hasEvent('gesturestart', elem)
  4315. Modernizr.hasEvent = isEventSupported;
  4316. /*>>hasevent*/
  4317. /*>>testprop*/
  4318. // Modernizr.testProp() investigates whether a given style property is recognized
  4319. // Note that the property names must be provided in the camelCase variant.
  4320. // Modernizr.testProp('pointerEvents')
  4321. Modernizr.testProp = function(prop){
  4322. return testProps([prop]);
  4323. };
  4324. /*>>testprop*/
  4325. /*>>testallprops*/
  4326. // Modernizr.testAllProps() investigates whether a given style property,
  4327. // or any of its vendor-prefixed variants, is recognized
  4328. // Note that the property names must be provided in the camelCase variant.
  4329. // Modernizr.testAllProps('boxSizing')
  4330. Modernizr.testAllProps = testPropsAll;
  4331. /*>>testallprops*/
  4332. /*>>teststyles*/
  4333. // Modernizr.testStyles() allows you to add custom styles to the document and test an element afterwards
  4334. // Modernizr.testStyles('#modernizr { position:absolute }', function(elem, rule){ ... })
  4335. Modernizr.testStyles = injectElementWithStyles;
  4336. /*>>teststyles*/
  4337. /*>>prefixed*/
  4338. // Modernizr.prefixed() returns the prefixed or nonprefixed property name variant of your input
  4339. // Modernizr.prefixed('boxSizing') // 'MozBoxSizing'
  4340. // Properties must be passed as dom-style camelcase, rather than `box-sizing` hypentated style.
  4341. // Return values will also be the camelCase variant, if you need to translate that to hypenated style use:
  4342. //
  4343. // str.replace(/([A-Z])/g, function(str,m1){ return '-' + m1.toLowerCase(); }).replace(/^ms-/,'-ms-');
  4344. // If you're trying to ascertain which transition end event to bind to, you might do something like...
  4345. //
  4346. // var transEndEventNames = {
  4347. // 'WebkitTransition' : 'webkitTransitionEnd',
  4348. // 'MozTransition' : 'transitionend',
  4349. // 'OTransition' : 'oTransitionEnd',
  4350. // 'msTransition' : 'MSTransitionEnd',
  4351. // 'transition' : 'transitionend'
  4352. // },
  4353. // transEndEventName = transEndEventNames[ Modernizr.prefixed('transition') ];
  4354. Modernizr.prefixed = function(prop, obj, elem){
  4355. if(!obj) {
  4356. return testPropsAll(prop, 'pfx');
  4357. } else {
  4358. // Testing DOM property e.g. Modernizr.prefixed('requestAnimationFrame', window) // 'mozRequestAnimationFrame'
  4359. return testPropsAll(prop, obj, elem);
  4360. }
  4361. };
  4362. /*>>prefixed*/
  4363. /*>>cssclasses*/
  4364. // Remove "no-js" class from <html> element, if it exists:
  4365. docElement.className = docElement.className.replace(/(^|\s)no-js(\s|$)/, '$1$2') +
  4366. // Add the new classes to the <html> element.
  4367. (enableClasses ? ' js ' + classes.join(' ') : '');
  4368. /*>>cssclasses*/
  4369. return Modernizr;
  4370. })(this, this.document);
  4371. $(document).foundation();
  4372. $(document).ready(function() {
  4373. // Load latest forum posts
  4374. var discussions = $('#discussions'), limit = 2;
  4375. $.ajax({
  4376. url: discussions.data('feed-url') || "https://community.apachefriends.org/f/feed.php",
  4377. dataType: 'xml',
  4378. success: function(xml) {
  4379. $('> ol', discussions).empty(); $('> p', discussions).remove(); // clear any existing content
  4380. $(xml).find('entry').each(function(i) {
  4381. if (i > (limit - 1)) return; // stop if we have enough
  4382. var c = $(this).find('content').text().replace(/<img\b[^>]*>/ig, '');
  4383. $('> ol', discussions).append('<li><h5>' + $(this).find('title').text() + '</h5><p>' + truncate(c) + ' <a href="' + $(this).find('id').text() + '">Read more&nbsp;&raquo;</p></li>');
  4384. });
  4385. }
  4386. });
  4387. // tweet it form
  4388. $('form#tweet').submit(function(event) {
  4389. window.open($(this).attr('action') + '?' + $(this).serialize(), '_blank', 'scrollbars=no,menubar=no,height=400,width=500,resizable=yes,toolbar=no,status=no');
  4390. event.preventDefault();
  4391. });
  4392. // substitute @2x images where available
  4393. if (window.isRetina()) {
  4394. console.log("loading retina images..");
  4395. var replacement;
  4396. $('img[data-2x]').each(function(i, img) {
  4397. replacement = $(img).clone().attr('src', $(img).data('2x')) || img;
  4398. // only replace once the replacement is loaded
  4399. replacement.load(function() {
  4400. $(img).replaceWith($(this));
  4401. });
  4402. });
  4403. }
  4404. if (window.isLinux64) {
  4405. $('a[data-x64-href]').each(function(i) {
  4406. $(this).attr('href', $(this).data('x64-href'));
  4407. });
  4408. }
  4409. $('a[data-delayed-href]').click(function(event) {
  4410. window.open($(this).data('delayed-href'), '_blank');
  4411. window.location = $(this).attr('href');
  4412. event.preventDefault();
  4413. });
  4414. // FAQ accordions
  4415. var panels = $('dl.accordion > dd').hide();
  4416. var draws = $('dl.accordion > dt').css('cursor', 'pointer');
  4417. draws.click(function() {
  4418. panels.slideUp();
  4419. var next = $(this).next()
  4420. if (next.is(':hidden'))
  4421. next.slideDown();
  4422. return false;
  4423. });
  4424. });
  4425. function truncate(text, length) {
  4426. length = length || 100;
  4427. return $.trim(strip(text)).substring(0, length).trim(this) + "...";
  4428. }
  4429. function strip(html) {
  4430. var tmp = document.createElement("DIV");
  4431. tmp.innerHTML = html;
  4432. return tmp.textContent || tmp.innerText || "";
  4433. }
  4434. // Retina detection
  4435. window.isRetina = function() {
  4436. var mediaQuery = "(-webkit-min-device-pixel-ratio: 1.5),\
  4437. (min--moz-device-pixel-ratio: 1.5),\
  4438. (-o-min-device-pixel-ratio: 3/2),\
  4439. (min-resolution: 1.5dppx)";
  4440. return window.devicePixelRatio > 1 || (window.matchMedia && window.matchMedia(mediaQuery).matches)
  4441. }
  4442. // Linux x64 detection
  4443. window.isLinux64 = function() {
  4444. return window.navigator.platform.substr(0, 5) == "Linux" && window.navigator.platform.substr(-2,2) == "64";
  4445. }
  4446. ;