materialize.js 359 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021
  1. /*!
  2. * Materialize v0.100.2 (http://materializecss.com)
  3. * Copyright 2014-2017 Materialize
  4. * MIT License (https://raw.githubusercontent.com/Dogfalo/materialize/master/LICENSE)
  5. */
  6. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  7. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8. // Check for jQuery.
  9. if (typeof jQuery === 'undefined') {
  10. // Check if require is a defined function.
  11. if (typeof require === 'function') {
  12. jQuery = $ = require('jquery');
  13. // Else use the dollar sign alias.
  14. } else {
  15. jQuery = $;
  16. }
  17. }
  18. ; /*
  19. * jQuery Easing v1.4.0 - http://gsgd.co.uk/sandbox/jquery/easing/
  20. * Open source under the BSD License.
  21. * Copyright © 2008 George McGinley Smith
  22. * All rights reserved.
  23. * https://raw.github.com/gdsmith/jquery-easing/master/LICENSE
  24. */
  25. (function (factory) {
  26. if (typeof define === "function" && define.amd) {
  27. define(['jquery'], function ($) {
  28. return factory($);
  29. });
  30. } else if (typeof module === "object" && typeof module.exports === "object") {
  31. exports = factory(require('jquery'));
  32. } else {
  33. factory(jQuery);
  34. }
  35. })(function ($) {
  36. // Preserve the original jQuery "swing" easing as "jswing"
  37. $.easing['jswing'] = $.easing['swing'];
  38. var pow = Math.pow,
  39. sqrt = Math.sqrt,
  40. sin = Math.sin,
  41. cos = Math.cos,
  42. PI = Math.PI,
  43. c1 = 1.70158,
  44. c2 = c1 * 1.525,
  45. c3 = c1 + 1,
  46. c4 = 2 * PI / 3,
  47. c5 = 2 * PI / 4.5;
  48. // x is the fraction of animation progress, in the range 0..1
  49. function bounceOut(x) {
  50. var n1 = 7.5625,
  51. d1 = 2.75;
  52. if (x < 1 / d1) {
  53. return n1 * x * x;
  54. } else if (x < 2 / d1) {
  55. return n1 * (x -= 1.5 / d1) * x + .75;
  56. } else if (x < 2.5 / d1) {
  57. return n1 * (x -= 2.25 / d1) * x + .9375;
  58. } else {
  59. return n1 * (x -= 2.625 / d1) * x + .984375;
  60. }
  61. }
  62. $.extend($.easing, {
  63. def: 'easeOutQuad',
  64. swing: function (x) {
  65. return $.easing[$.easing.def](x);
  66. },
  67. easeInQuad: function (x) {
  68. return x * x;
  69. },
  70. easeOutQuad: function (x) {
  71. return 1 - (1 - x) * (1 - x);
  72. },
  73. easeInOutQuad: function (x) {
  74. return x < 0.5 ? 2 * x * x : 1 - pow(-2 * x + 2, 2) / 2;
  75. },
  76. easeInCubic: function (x) {
  77. return x * x * x;
  78. },
  79. easeOutCubic: function (x) {
  80. return 1 - pow(1 - x, 3);
  81. },
  82. easeInOutCubic: function (x) {
  83. return x < 0.5 ? 4 * x * x * x : 1 - pow(-2 * x + 2, 3) / 2;
  84. },
  85. easeInQuart: function (x) {
  86. return x * x * x * x;
  87. },
  88. easeOutQuart: function (x) {
  89. return 1 - pow(1 - x, 4);
  90. },
  91. easeInOutQuart: function (x) {
  92. return x < 0.5 ? 8 * x * x * x * x : 1 - pow(-2 * x + 2, 4) / 2;
  93. },
  94. easeInQuint: function (x) {
  95. return x * x * x * x * x;
  96. },
  97. easeOutQuint: function (x) {
  98. return 1 - pow(1 - x, 5);
  99. },
  100. easeInOutQuint: function (x) {
  101. return x < 0.5 ? 16 * x * x * x * x * x : 1 - pow(-2 * x + 2, 5) / 2;
  102. },
  103. easeInSine: function (x) {
  104. return 1 - cos(x * PI / 2);
  105. },
  106. easeOutSine: function (x) {
  107. return sin(x * PI / 2);
  108. },
  109. easeInOutSine: function (x) {
  110. return -(cos(PI * x) - 1) / 2;
  111. },
  112. easeInExpo: function (x) {
  113. return x === 0 ? 0 : pow(2, 10 * x - 10);
  114. },
  115. easeOutExpo: function (x) {
  116. return x === 1 ? 1 : 1 - pow(2, -10 * x);
  117. },
  118. easeInOutExpo: function (x) {
  119. return x === 0 ? 0 : x === 1 ? 1 : x < 0.5 ? pow(2, 20 * x - 10) / 2 : (2 - pow(2, -20 * x + 10)) / 2;
  120. },
  121. easeInCirc: function (x) {
  122. return 1 - sqrt(1 - pow(x, 2));
  123. },
  124. easeOutCirc: function (x) {
  125. return sqrt(1 - pow(x - 1, 2));
  126. },
  127. easeInOutCirc: function (x) {
  128. return x < 0.5 ? (1 - sqrt(1 - pow(2 * x, 2))) / 2 : (sqrt(1 - pow(-2 * x + 2, 2)) + 1) / 2;
  129. },
  130. easeInElastic: function (x) {
  131. return x === 0 ? 0 : x === 1 ? 1 : -pow(2, 10 * x - 10) * sin((x * 10 - 10.75) * c4);
  132. },
  133. easeOutElastic: function (x) {
  134. return x === 0 ? 0 : x === 1 ? 1 : pow(2, -10 * x) * sin((x * 10 - 0.75) * c4) + 1;
  135. },
  136. easeInOutElastic: function (x) {
  137. return x === 0 ? 0 : x === 1 ? 1 : x < 0.5 ? -(pow(2, 20 * x - 10) * sin((20 * x - 11.125) * c5)) / 2 : pow(2, -20 * x + 10) * sin((20 * x - 11.125) * c5) / 2 + 1;
  138. },
  139. easeInBack: function (x) {
  140. return c3 * x * x * x - c1 * x * x;
  141. },
  142. easeOutBack: function (x) {
  143. return 1 + c3 * pow(x - 1, 3) + c1 * pow(x - 1, 2);
  144. },
  145. easeInOutBack: function (x) {
  146. return x < 0.5 ? pow(2 * x, 2) * ((c2 + 1) * 2 * x - c2) / 2 : (pow(2 * x - 2, 2) * ((c2 + 1) * (x * 2 - 2) + c2) + 2) / 2;
  147. },
  148. easeInBounce: function (x) {
  149. return 1 - bounceOut(1 - x);
  150. },
  151. easeOutBounce: bounceOut,
  152. easeInOutBounce: function (x) {
  153. return x < 0.5 ? (1 - bounceOut(1 - 2 * x)) / 2 : (1 + bounceOut(2 * x - 1)) / 2;
  154. }
  155. });
  156. });; // Custom Easing
  157. jQuery.extend(jQuery.easing, {
  158. easeInOutMaterial: function (x, t, b, c, d) {
  159. if ((t /= d / 2) < 1) return c / 2 * t * t + b;
  160. return c / 4 * ((t -= 2) * t * t + 2) + b;
  161. }
  162. });; /*! VelocityJS.org (1.2.3). (C) 2014 Julian Shapiro. MIT @license: en.wikipedia.org/wiki/MIT_License */
  163. /*! VelocityJS.org jQuery Shim (1.0.1). (C) 2014 The jQuery Foundation. MIT @license: en.wikipedia.org/wiki/MIT_License. */
  164. /*! Note that this has been modified by Materialize to confirm that Velocity is not already being imported. */
  165. jQuery.Velocity ? console.log("Velocity is already loaded. You may be needlessly importing Velocity again; note that Materialize includes Velocity.") : (!function (e) {
  166. function t(e) {
  167. var t = e.length,
  168. a = r.type(e);return "function" === a || r.isWindow(e) ? !1 : 1 === e.nodeType && t ? !0 : "array" === a || 0 === t || "number" == typeof t && t > 0 && t - 1 in e;
  169. }if (!e.jQuery) {
  170. var r = function (e, t) {
  171. return new r.fn.init(e, t);
  172. };r.isWindow = function (e) {
  173. return null != e && e == e.window;
  174. }, r.type = function (e) {
  175. return null == e ? e + "" : "object" == typeof e || "function" == typeof e ? n[i.call(e)] || "object" : typeof e;
  176. }, r.isArray = Array.isArray || function (e) {
  177. return "array" === r.type(e);
  178. }, r.isPlainObject = function (e) {
  179. var t;if (!e || "object" !== r.type(e) || e.nodeType || r.isWindow(e)) return !1;try {
  180. if (e.constructor && !o.call(e, "constructor") && !o.call(e.constructor.prototype, "isPrototypeOf")) return !1;
  181. } catch (a) {
  182. return !1;
  183. }for (t in e) {}return void 0 === t || o.call(e, t);
  184. }, r.each = function (e, r, a) {
  185. var n,
  186. o = 0,
  187. i = e.length,
  188. s = t(e);if (a) {
  189. if (s) for (; i > o && (n = r.apply(e[o], a), n !== !1); o++) {} else for (o in e) {
  190. if (n = r.apply(e[o], a), n === !1) break;
  191. }
  192. } else if (s) for (; i > o && (n = r.call(e[o], o, e[o]), n !== !1); o++) {} else for (o in e) {
  193. if (n = r.call(e[o], o, e[o]), n === !1) break;
  194. }return e;
  195. }, r.data = function (e, t, n) {
  196. if (void 0 === n) {
  197. var o = e[r.expando],
  198. i = o && a[o];if (void 0 === t) return i;if (i && t in i) return i[t];
  199. } else if (void 0 !== t) {
  200. var o = e[r.expando] || (e[r.expando] = ++r.uuid);return a[o] = a[o] || {}, a[o][t] = n, n;
  201. }
  202. }, r.removeData = function (e, t) {
  203. var n = e[r.expando],
  204. o = n && a[n];o && r.each(t, function (e, t) {
  205. delete o[t];
  206. });
  207. }, r.extend = function () {
  208. var e,
  209. t,
  210. a,
  211. n,
  212. o,
  213. i,
  214. s = arguments[0] || {},
  215. l = 1,
  216. u = arguments.length,
  217. c = !1;for ("boolean" == typeof s && (c = s, s = arguments[l] || {}, l++), "object" != typeof s && "function" !== r.type(s) && (s = {}), l === u && (s = this, l--); u > l; l++) {
  218. if (null != (o = arguments[l])) for (n in o) {
  219. e = s[n], a = o[n], s !== a && (c && a && (r.isPlainObject(a) || (t = r.isArray(a))) ? (t ? (t = !1, i = e && r.isArray(e) ? e : []) : i = e && r.isPlainObject(e) ? e : {}, s[n] = r.extend(c, i, a)) : void 0 !== a && (s[n] = a));
  220. }
  221. }return s;
  222. }, r.queue = function (e, a, n) {
  223. function o(e, r) {
  224. var a = r || [];return null != e && (t(Object(e)) ? !function (e, t) {
  225. for (var r = +t.length, a = 0, n = e.length; r > a;) {
  226. e[n++] = t[a++];
  227. }if (r !== r) for (; void 0 !== t[a];) {
  228. e[n++] = t[a++];
  229. }return e.length = n, e;
  230. }(a, "string" == typeof e ? [e] : e) : [].push.call(a, e)), a;
  231. }if (e) {
  232. a = (a || "fx") + "queue";var i = r.data(e, a);return n ? (!i || r.isArray(n) ? i = r.data(e, a, o(n)) : i.push(n), i) : i || [];
  233. }
  234. }, r.dequeue = function (e, t) {
  235. r.each(e.nodeType ? [e] : e, function (e, a) {
  236. t = t || "fx";var n = r.queue(a, t),
  237. o = n.shift();"inprogress" === o && (o = n.shift()), o && ("fx" === t && n.unshift("inprogress"), o.call(a, function () {
  238. r.dequeue(a, t);
  239. }));
  240. });
  241. }, r.fn = r.prototype = { init: function (e) {
  242. if (e.nodeType) return this[0] = e, this;throw new Error("Not a DOM node.");
  243. }, offset: function () {
  244. var t = this[0].getBoundingClientRect ? this[0].getBoundingClientRect() : { top: 0, left: 0 };return { top: t.top + (e.pageYOffset || document.scrollTop || 0) - (document.clientTop || 0), left: t.left + (e.pageXOffset || document.scrollLeft || 0) - (document.clientLeft || 0) };
  245. }, position: function () {
  246. function e() {
  247. for (var e = this.offsetParent || document; e && "html" === !e.nodeType.toLowerCase && "static" === e.style.position;) {
  248. e = e.offsetParent;
  249. }return e || document;
  250. }var t = this[0],
  251. e = e.apply(t),
  252. a = this.offset(),
  253. n = /^(?:body|html)$/i.test(e.nodeName) ? { top: 0, left: 0 } : r(e).offset();return a.top -= parseFloat(t.style.marginTop) || 0, a.left -= parseFloat(t.style.marginLeft) || 0, e.style && (n.top += parseFloat(e.style.borderTopWidth) || 0, n.left += parseFloat(e.style.borderLeftWidth) || 0), { top: a.top - n.top, left: a.left - n.left };
  254. } };var a = {};r.expando = "velocity" + new Date().getTime(), r.uuid = 0;for (var n = {}, o = n.hasOwnProperty, i = n.toString, s = "Boolean Number String Function Array Date RegExp Object Error".split(" "), l = 0; l < s.length; l++) {
  255. n["[object " + s[l] + "]"] = s[l].toLowerCase();
  256. }r.fn.init.prototype = r.fn, e.Velocity = { Utilities: r };
  257. }
  258. }(window), function (e) {
  259. "object" == typeof module && "object" == typeof module.exports ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : e();
  260. }(function () {
  261. return function (e, t, r, a) {
  262. function n(e) {
  263. for (var t = -1, r = e ? e.length : 0, a = []; ++t < r;) {
  264. var n = e[t];n && a.push(n);
  265. }return a;
  266. }function o(e) {
  267. return m.isWrapped(e) ? e = [].slice.call(e) : m.isNode(e) && (e = [e]), e;
  268. }function i(e) {
  269. var t = f.data(e, "velocity");return null === t ? a : t;
  270. }function s(e) {
  271. return function (t) {
  272. return Math.round(t * e) * (1 / e);
  273. };
  274. }function l(e, r, a, n) {
  275. function o(e, t) {
  276. return 1 - 3 * t + 3 * e;
  277. }function i(e, t) {
  278. return 3 * t - 6 * e;
  279. }function s(e) {
  280. return 3 * e;
  281. }function l(e, t, r) {
  282. return ((o(t, r) * e + i(t, r)) * e + s(t)) * e;
  283. }function u(e, t, r) {
  284. return 3 * o(t, r) * e * e + 2 * i(t, r) * e + s(t);
  285. }function c(t, r) {
  286. for (var n = 0; m > n; ++n) {
  287. var o = u(r, e, a);if (0 === o) return r;var i = l(r, e, a) - t;r -= i / o;
  288. }return r;
  289. }function p() {
  290. for (var t = 0; b > t; ++t) {
  291. w[t] = l(t * x, e, a);
  292. }
  293. }function f(t, r, n) {
  294. var o,
  295. i,
  296. s = 0;do {
  297. i = r + (n - r) / 2, o = l(i, e, a) - t, o > 0 ? n = i : r = i;
  298. } while (Math.abs(o) > h && ++s < v);return i;
  299. }function d(t) {
  300. for (var r = 0, n = 1, o = b - 1; n != o && w[n] <= t; ++n) {
  301. r += x;
  302. }--n;var i = (t - w[n]) / (w[n + 1] - w[n]),
  303. s = r + i * x,
  304. l = u(s, e, a);return l >= y ? c(t, s) : 0 == l ? s : f(t, r, r + x);
  305. }function g() {
  306. V = !0, (e != r || a != n) && p();
  307. }var m = 4,
  308. y = .001,
  309. h = 1e-7,
  310. v = 10,
  311. b = 11,
  312. x = 1 / (b - 1),
  313. S = "Float32Array" in t;if (4 !== arguments.length) return !1;for (var P = 0; 4 > P; ++P) {
  314. if ("number" != typeof arguments[P] || isNaN(arguments[P]) || !isFinite(arguments[P])) return !1;
  315. }e = Math.min(e, 1), a = Math.min(a, 1), e = Math.max(e, 0), a = Math.max(a, 0);var w = S ? new Float32Array(b) : new Array(b),
  316. V = !1,
  317. C = function (t) {
  318. return V || g(), e === r && a === n ? t : 0 === t ? 0 : 1 === t ? 1 : l(d(t), r, n);
  319. };C.getControlPoints = function () {
  320. return [{ x: e, y: r }, { x: a, y: n }];
  321. };var T = "generateBezier(" + [e, r, a, n] + ")";return C.toString = function () {
  322. return T;
  323. }, C;
  324. }function u(e, t) {
  325. var r = e;return m.isString(e) ? b.Easings[e] || (r = !1) : r = m.isArray(e) && 1 === e.length ? s.apply(null, e) : m.isArray(e) && 2 === e.length ? x.apply(null, e.concat([t])) : m.isArray(e) && 4 === e.length ? l.apply(null, e) : !1, r === !1 && (r = b.Easings[b.defaults.easing] ? b.defaults.easing : v), r;
  326. }function c(e) {
  327. if (e) {
  328. var t = new Date().getTime(),
  329. r = b.State.calls.length;r > 1e4 && (b.State.calls = n(b.State.calls));for (var o = 0; r > o; o++) {
  330. if (b.State.calls[o]) {
  331. var s = b.State.calls[o],
  332. l = s[0],
  333. u = s[2],
  334. d = s[3],
  335. g = !!d,
  336. y = null;d || (d = b.State.calls[o][3] = t - 16);for (var h = Math.min((t - d) / u.duration, 1), v = 0, x = l.length; x > v; v++) {
  337. var P = l[v],
  338. V = P.element;if (i(V)) {
  339. var C = !1;if (u.display !== a && null !== u.display && "none" !== u.display) {
  340. if ("flex" === u.display) {
  341. var T = ["-webkit-box", "-moz-box", "-ms-flexbox", "-webkit-flex"];f.each(T, function (e, t) {
  342. S.setPropertyValue(V, "display", t);
  343. });
  344. }S.setPropertyValue(V, "display", u.display);
  345. }u.visibility !== a && "hidden" !== u.visibility && S.setPropertyValue(V, "visibility", u.visibility);for (var k in P) {
  346. if ("element" !== k) {
  347. var A,
  348. F = P[k],
  349. j = m.isString(F.easing) ? b.Easings[F.easing] : F.easing;if (1 === h) A = F.endValue;else {
  350. var E = F.endValue - F.startValue;if (A = F.startValue + E * j(h, u, E), !g && A === F.currentValue) continue;
  351. }if (F.currentValue = A, "tween" === k) y = A;else {
  352. if (S.Hooks.registered[k]) {
  353. var H = S.Hooks.getRoot(k),
  354. N = i(V).rootPropertyValueCache[H];N && (F.rootPropertyValue = N);
  355. }var L = S.setPropertyValue(V, k, F.currentValue + (0 === parseFloat(A) ? "" : F.unitType), F.rootPropertyValue, F.scrollData);S.Hooks.registered[k] && (i(V).rootPropertyValueCache[H] = S.Normalizations.registered[H] ? S.Normalizations.registered[H]("extract", null, L[1]) : L[1]), "transform" === L[0] && (C = !0);
  356. }
  357. }
  358. }u.mobileHA && i(V).transformCache.translate3d === a && (i(V).transformCache.translate3d = "(0px, 0px, 0px)", C = !0), C && S.flushTransformCache(V);
  359. }
  360. }u.display !== a && "none" !== u.display && (b.State.calls[o][2].display = !1), u.visibility !== a && "hidden" !== u.visibility && (b.State.calls[o][2].visibility = !1), u.progress && u.progress.call(s[1], s[1], h, Math.max(0, d + u.duration - t), d, y), 1 === h && p(o);
  361. }
  362. }
  363. }b.State.isTicking && w(c);
  364. }function p(e, t) {
  365. if (!b.State.calls[e]) return !1;for (var r = b.State.calls[e][0], n = b.State.calls[e][1], o = b.State.calls[e][2], s = b.State.calls[e][4], l = !1, u = 0, c = r.length; c > u; u++) {
  366. var p = r[u].element;if (t || o.loop || ("none" === o.display && S.setPropertyValue(p, "display", o.display), "hidden" === o.visibility && S.setPropertyValue(p, "visibility", o.visibility)), o.loop !== !0 && (f.queue(p)[1] === a || !/\.velocityQueueEntryFlag/i.test(f.queue(p)[1])) && i(p)) {
  367. i(p).isAnimating = !1, i(p).rootPropertyValueCache = {};var d = !1;f.each(S.Lists.transforms3D, function (e, t) {
  368. var r = /^scale/.test(t) ? 1 : 0,
  369. n = i(p).transformCache[t];i(p).transformCache[t] !== a && new RegExp("^\\(" + r + "[^.]").test(n) && (d = !0, delete i(p).transformCache[t]);
  370. }), o.mobileHA && (d = !0, delete i(p).transformCache.translate3d), d && S.flushTransformCache(p), S.Values.removeClass(p, "velocity-animating");
  371. }if (!t && o.complete && !o.loop && u === c - 1) try {
  372. o.complete.call(n, n);
  373. } catch (g) {
  374. setTimeout(function () {
  375. throw g;
  376. }, 1);
  377. }s && o.loop !== !0 && s(n), i(p) && o.loop === !0 && !t && (f.each(i(p).tweensContainer, function (e, t) {
  378. /^rotate/.test(e) && 360 === parseFloat(t.endValue) && (t.endValue = 0, t.startValue = 360), /^backgroundPosition/.test(e) && 100 === parseFloat(t.endValue) && "%" === t.unitType && (t.endValue = 0, t.startValue = 100);
  379. }), b(p, "reverse", { loop: !0, delay: o.delay })), o.queue !== !1 && f.dequeue(p, o.queue);
  380. }b.State.calls[e] = !1;for (var m = 0, y = b.State.calls.length; y > m; m++) {
  381. if (b.State.calls[m] !== !1) {
  382. l = !0;break;
  383. }
  384. }l === !1 && (b.State.isTicking = !1, delete b.State.calls, b.State.calls = []);
  385. }var f,
  386. d = function () {
  387. if (r.documentMode) return r.documentMode;for (var e = 7; e > 4; e--) {
  388. var t = r.createElement("div");if (t.innerHTML = "<!--[if IE " + e + "]><span></span><![endif]-->", t.getElementsByTagName("span").length) return t = null, e;
  389. }return a;
  390. }(),
  391. g = function () {
  392. var e = 0;return t.webkitRequestAnimationFrame || t.mozRequestAnimationFrame || function (t) {
  393. var r,
  394. a = new Date().getTime();return r = Math.max(0, 16 - (a - e)), e = a + r, setTimeout(function () {
  395. t(a + r);
  396. }, r);
  397. };
  398. }(),
  399. m = { isString: function (e) {
  400. return "string" == typeof e;
  401. }, isArray: Array.isArray || function (e) {
  402. return "[object Array]" === Object.prototype.toString.call(e);
  403. }, isFunction: function (e) {
  404. return "[object Function]" === Object.prototype.toString.call(e);
  405. }, isNode: function (e) {
  406. return e && e.nodeType;
  407. }, isNodeList: function (e) {
  408. return "object" == typeof e && /^\[object (HTMLCollection|NodeList|Object)\]$/.test(Object.prototype.toString.call(e)) && e.length !== a && (0 === e.length || "object" == typeof e[0] && e[0].nodeType > 0);
  409. }, isWrapped: function (e) {
  410. return e && (e.jquery || t.Zepto && t.Zepto.zepto.isZ(e));
  411. }, isSVG: function (e) {
  412. return t.SVGElement && e instanceof t.SVGElement;
  413. }, isEmptyObject: function (e) {
  414. for (var t in e) {
  415. return !1;
  416. }return !0;
  417. } },
  418. y = !1;if (e.fn && e.fn.jquery ? (f = e, y = !0) : f = t.Velocity.Utilities, 8 >= d && !y) throw new Error("Velocity: IE8 and below require jQuery to be loaded before Velocity.");if (7 >= d) return void (jQuery.fn.velocity = jQuery.fn.animate);var h = 400,
  419. v = "swing",
  420. b = { State: { isMobile: /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent), isAndroid: /Android/i.test(navigator.userAgent), isGingerbread: /Android 2\.3\.[3-7]/i.test(navigator.userAgent), isChrome: t.chrome, isFirefox: /Firefox/i.test(navigator.userAgent), prefixElement: r.createElement("div"), prefixMatches: {}, scrollAnchor: null, scrollPropertyLeft: null, scrollPropertyTop: null, isTicking: !1, calls: [] }, CSS: {}, Utilities: f, Redirects: {}, Easings: {}, Promise: t.Promise, defaults: { queue: "", duration: h, easing: v, begin: a, complete: a, progress: a, display: a, visibility: a, loop: !1, delay: !1, mobileHA: !0, _cacheValues: !0 }, init: function (e) {
  421. f.data(e, "velocity", { isSVG: m.isSVG(e), isAnimating: !1, computedStyle: null, tweensContainer: null, rootPropertyValueCache: {}, transformCache: {} });
  422. }, hook: null, mock: !1, version: { major: 1, minor: 2, patch: 2 }, debug: !1 };t.pageYOffset !== a ? (b.State.scrollAnchor = t, b.State.scrollPropertyLeft = "pageXOffset", b.State.scrollPropertyTop = "pageYOffset") : (b.State.scrollAnchor = r.documentElement || r.body.parentNode || r.body, b.State.scrollPropertyLeft = "scrollLeft", b.State.scrollPropertyTop = "scrollTop");var x = function () {
  423. function e(e) {
  424. return -e.tension * e.x - e.friction * e.v;
  425. }function t(t, r, a) {
  426. var n = { x: t.x + a.dx * r, v: t.v + a.dv * r, tension: t.tension, friction: t.friction };return { dx: n.v, dv: e(n) };
  427. }function r(r, a) {
  428. var n = { dx: r.v, dv: e(r) },
  429. o = t(r, .5 * a, n),
  430. i = t(r, .5 * a, o),
  431. s = t(r, a, i),
  432. l = 1 / 6 * (n.dx + 2 * (o.dx + i.dx) + s.dx),
  433. u = 1 / 6 * (n.dv + 2 * (o.dv + i.dv) + s.dv);return r.x = r.x + l * a, r.v = r.v + u * a, r;
  434. }return function a(e, t, n) {
  435. var o,
  436. i,
  437. s,
  438. l = { x: -1, v: 0, tension: null, friction: null },
  439. u = [0],
  440. c = 0,
  441. p = 1e-4,
  442. f = .016;for (e = parseFloat(e) || 500, t = parseFloat(t) || 20, n = n || null, l.tension = e, l.friction = t, o = null !== n, o ? (c = a(e, t), i = c / n * f) : i = f; s = r(s || l, i), u.push(1 + s.x), c += 16, Math.abs(s.x) > p && Math.abs(s.v) > p;) {}return o ? function (e) {
  443. return u[e * (u.length - 1) | 0];
  444. } : c;
  445. };
  446. }();b.Easings = { linear: function (e) {
  447. return e;
  448. }, swing: function (e) {
  449. return .5 - Math.cos(e * Math.PI) / 2;
  450. }, spring: function (e) {
  451. return 1 - Math.cos(4.5 * e * Math.PI) * Math.exp(6 * -e);
  452. } }, f.each([["ease", [.25, .1, .25, 1]], ["ease-in", [.42, 0, 1, 1]], ["ease-out", [0, 0, .58, 1]], ["ease-in-out", [.42, 0, .58, 1]], ["easeInSine", [.47, 0, .745, .715]], ["easeOutSine", [.39, .575, .565, 1]], ["easeInOutSine", [.445, .05, .55, .95]], ["easeInQuad", [.55, .085, .68, .53]], ["easeOutQuad", [.25, .46, .45, .94]], ["easeInOutQuad", [.455, .03, .515, .955]], ["easeInCubic", [.55, .055, .675, .19]], ["easeOutCubic", [.215, .61, .355, 1]], ["easeInOutCubic", [.645, .045, .355, 1]], ["easeInQuart", [.895, .03, .685, .22]], ["easeOutQuart", [.165, .84, .44, 1]], ["easeInOutQuart", [.77, 0, .175, 1]], ["easeInQuint", [.755, .05, .855, .06]], ["easeOutQuint", [.23, 1, .32, 1]], ["easeInOutQuint", [.86, 0, .07, 1]], ["easeInExpo", [.95, .05, .795, .035]], ["easeOutExpo", [.19, 1, .22, 1]], ["easeInOutExpo", [1, 0, 0, 1]], ["easeInCirc", [.6, .04, .98, .335]], ["easeOutCirc", [.075, .82, .165, 1]], ["easeInOutCirc", [.785, .135, .15, .86]]], function (e, t) {
  453. b.Easings[t[0]] = l.apply(null, t[1]);
  454. });var S = b.CSS = { RegEx: { isHex: /^#([A-f\d]{3}){1,2}$/i, valueUnwrap: /^[A-z]+\((.*)\)$/i, wrappedValueAlreadyExtracted: /[0-9.]+ [0-9.]+ [0-9.]+( [0-9.]+)?/, valueSplit: /([A-z]+\(.+\))|(([A-z0-9#-.]+?)(?=\s|$))/gi }, Lists: { colors: ["fill", "stroke", "stopColor", "color", "backgroundColor", "borderColor", "borderTopColor", "borderRightColor", "borderBottomColor", "borderLeftColor", "outlineColor"], transformsBase: ["translateX", "translateY", "scale", "scaleX", "scaleY", "skewX", "skewY", "rotateZ"], transforms3D: ["transformPerspective", "translateZ", "scaleZ", "rotateX", "rotateY"] }, Hooks: { templates: { textShadow: ["Color X Y Blur", "black 0px 0px 0px"], boxShadow: ["Color X Y Blur Spread", "black 0px 0px 0px 0px"], clip: ["Top Right Bottom Left", "0px 0px 0px 0px"], backgroundPosition: ["X Y", "0% 0%"], transformOrigin: ["X Y Z", "50% 50% 0px"], perspectiveOrigin: ["X Y", "50% 50%"] }, registered: {}, register: function () {
  455. for (var e = 0; e < S.Lists.colors.length; e++) {
  456. var t = "color" === S.Lists.colors[e] ? "0 0 0 1" : "255 255 255 1";S.Hooks.templates[S.Lists.colors[e]] = ["Red Green Blue Alpha", t];
  457. }var r, a, n;if (d) for (r in S.Hooks.templates) {
  458. a = S.Hooks.templates[r], n = a[0].split(" ");var o = a[1].match(S.RegEx.valueSplit);"Color" === n[0] && (n.push(n.shift()), o.push(o.shift()), S.Hooks.templates[r] = [n.join(" "), o.join(" ")]);
  459. }for (r in S.Hooks.templates) {
  460. a = S.Hooks.templates[r], n = a[0].split(" ");for (var e in n) {
  461. var i = r + n[e],
  462. s = e;S.Hooks.registered[i] = [r, s];
  463. }
  464. }
  465. }, getRoot: function (e) {
  466. var t = S.Hooks.registered[e];return t ? t[0] : e;
  467. }, cleanRootPropertyValue: function (e, t) {
  468. return S.RegEx.valueUnwrap.test(t) && (t = t.match(S.RegEx.valueUnwrap)[1]), S.Values.isCSSNullValue(t) && (t = S.Hooks.templates[e][1]), t;
  469. }, extractValue: function (e, t) {
  470. var r = S.Hooks.registered[e];if (r) {
  471. var a = r[0],
  472. n = r[1];return t = S.Hooks.cleanRootPropertyValue(a, t), t.toString().match(S.RegEx.valueSplit)[n];
  473. }return t;
  474. }, injectValue: function (e, t, r) {
  475. var a = S.Hooks.registered[e];if (a) {
  476. var n,
  477. o,
  478. i = a[0],
  479. s = a[1];return r = S.Hooks.cleanRootPropertyValue(i, r), n = r.toString().match(S.RegEx.valueSplit), n[s] = t, o = n.join(" ");
  480. }return r;
  481. } }, Normalizations: { registered: { clip: function (e, t, r) {
  482. switch (e) {case "name":
  483. return "clip";case "extract":
  484. var a;return S.RegEx.wrappedValueAlreadyExtracted.test(r) ? a = r : (a = r.toString().match(S.RegEx.valueUnwrap), a = a ? a[1].replace(/,(\s+)?/g, " ") : r), a;case "inject":
  485. return "rect(" + r + ")";}
  486. }, blur: function (e, t, r) {
  487. switch (e) {case "name":
  488. return b.State.isFirefox ? "filter" : "-webkit-filter";case "extract":
  489. var a = parseFloat(r);if (!a && 0 !== a) {
  490. var n = r.toString().match(/blur\(([0-9]+[A-z]+)\)/i);a = n ? n[1] : 0;
  491. }return a;case "inject":
  492. return parseFloat(r) ? "blur(" + r + ")" : "none";}
  493. }, opacity: function (e, t, r) {
  494. if (8 >= d) switch (e) {case "name":
  495. return "filter";case "extract":
  496. var a = r.toString().match(/alpha\(opacity=(.*)\)/i);return r = a ? a[1] / 100 : 1;case "inject":
  497. return t.style.zoom = 1, parseFloat(r) >= 1 ? "" : "alpha(opacity=" + parseInt(100 * parseFloat(r), 10) + ")";} else switch (e) {case "name":
  498. return "opacity";case "extract":
  499. return r;case "inject":
  500. return r;}
  501. } }, register: function () {
  502. 9 >= d || b.State.isGingerbread || (S.Lists.transformsBase = S.Lists.transformsBase.concat(S.Lists.transforms3D));for (var e = 0; e < S.Lists.transformsBase.length; e++) {
  503. !function () {
  504. var t = S.Lists.transformsBase[e];S.Normalizations.registered[t] = function (e, r, n) {
  505. switch (e) {case "name":
  506. return "transform";case "extract":
  507. return i(r) === a || i(r).transformCache[t] === a ? /^scale/i.test(t) ? 1 : 0 : i(r).transformCache[t].replace(/[()]/g, "");case "inject":
  508. var o = !1;switch (t.substr(0, t.length - 1)) {case "translate":
  509. o = !/(%|px|em|rem|vw|vh|\d)$/i.test(n);break;case "scal":case "scale":
  510. b.State.isAndroid && i(r).transformCache[t] === a && 1 > n && (n = 1), o = !/(\d)$/i.test(n);break;case "skew":
  511. o = !/(deg|\d)$/i.test(n);break;case "rotate":
  512. o = !/(deg|\d)$/i.test(n);}return o || (i(r).transformCache[t] = "(" + n + ")"), i(r).transformCache[t];}
  513. };
  514. }();
  515. }for (var e = 0; e < S.Lists.colors.length; e++) {
  516. !function () {
  517. var t = S.Lists.colors[e];S.Normalizations.registered[t] = function (e, r, n) {
  518. switch (e) {case "name":
  519. return t;case "extract":
  520. var o;if (S.RegEx.wrappedValueAlreadyExtracted.test(n)) o = n;else {
  521. var i,
  522. s = { black: "rgb(0, 0, 0)", blue: "rgb(0, 0, 255)", gray: "rgb(128, 128, 128)", green: "rgb(0, 128, 0)", red: "rgb(255, 0, 0)", white: "rgb(255, 255, 255)" };/^[A-z]+$/i.test(n) ? i = s[n] !== a ? s[n] : s.black : S.RegEx.isHex.test(n) ? i = "rgb(" + S.Values.hexToRgb(n).join(" ") + ")" : /^rgba?\(/i.test(n) || (i = s.black), o = (i || n).toString().match(S.RegEx.valueUnwrap)[1].replace(/,(\s+)?/g, " ");
  523. }return 8 >= d || 3 !== o.split(" ").length || (o += " 1"), o;case "inject":
  524. return 8 >= d ? 4 === n.split(" ").length && (n = n.split(/\s+/).slice(0, 3).join(" ")) : 3 === n.split(" ").length && (n += " 1"), (8 >= d ? "rgb" : "rgba") + "(" + n.replace(/\s+/g, ",").replace(/\.(\d)+(?=,)/g, "") + ")";}
  525. };
  526. }();
  527. }
  528. } }, Names: { camelCase: function (e) {
  529. return e.replace(/-(\w)/g, function (e, t) {
  530. return t.toUpperCase();
  531. });
  532. }, SVGAttribute: function (e) {
  533. var t = "width|height|x|y|cx|cy|r|rx|ry|x1|x2|y1|y2";return (d || b.State.isAndroid && !b.State.isChrome) && (t += "|transform"), new RegExp("^(" + t + ")$", "i").test(e);
  534. }, prefixCheck: function (e) {
  535. if (b.State.prefixMatches[e]) return [b.State.prefixMatches[e], !0];for (var t = ["", "Webkit", "Moz", "ms", "O"], r = 0, a = t.length; a > r; r++) {
  536. var n;if (n = 0 === r ? e : t[r] + e.replace(/^\w/, function (e) {
  537. return e.toUpperCase();
  538. }), m.isString(b.State.prefixElement.style[n])) return b.State.prefixMatches[e] = n, [n, !0];
  539. }return [e, !1];
  540. } }, Values: { hexToRgb: function (e) {
  541. var t,
  542. r = /^#?([a-f\d])([a-f\d])([a-f\d])$/i,
  543. a = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i;return e = e.replace(r, function (e, t, r, a) {
  544. return t + t + r + r + a + a;
  545. }), t = a.exec(e), t ? [parseInt(t[1], 16), parseInt(t[2], 16), parseInt(t[3], 16)] : [0, 0, 0];
  546. }, isCSSNullValue: function (e) {
  547. return 0 == e || /^(none|auto|transparent|(rgba\(0, ?0, ?0, ?0\)))$/i.test(e);
  548. }, getUnitType: function (e) {
  549. return (/^(rotate|skew)/i.test(e) ? "deg" : /(^(scale|scaleX|scaleY|scaleZ|alpha|flexGrow|flexHeight|zIndex|fontWeight)$)|((opacity|red|green|blue|alpha)$)/i.test(e) ? "" : "px"
  550. );
  551. }, getDisplayType: function (e) {
  552. var t = e && e.tagName.toString().toLowerCase();return (/^(b|big|i|small|tt|abbr|acronym|cite|code|dfn|em|kbd|strong|samp|var|a|bdo|br|img|map|object|q|script|span|sub|sup|button|input|label|select|textarea)$/i.test(t) ? "inline" : /^(li)$/i.test(t) ? "list-item" : /^(tr)$/i.test(t) ? "table-row" : /^(table)$/i.test(t) ? "table" : /^(tbody)$/i.test(t) ? "table-row-group" : "block"
  553. );
  554. }, addClass: function (e, t) {
  555. e.classList ? e.classList.add(t) : e.className += (e.className.length ? " " : "") + t;
  556. }, removeClass: function (e, t) {
  557. e.classList ? e.classList.remove(t) : e.className = e.className.toString().replace(new RegExp("(^|\\s)" + t.split(" ").join("|") + "(\\s|$)", "gi"), " ");
  558. } }, getPropertyValue: function (e, r, n, o) {
  559. function s(e, r) {
  560. function n() {
  561. u && S.setPropertyValue(e, "display", "none");
  562. }var l = 0;if (8 >= d) l = f.css(e, r);else {
  563. var u = !1;if (/^(width|height)$/.test(r) && 0 === S.getPropertyValue(e, "display") && (u = !0, S.setPropertyValue(e, "display", S.Values.getDisplayType(e))), !o) {
  564. if ("height" === r && "border-box" !== S.getPropertyValue(e, "boxSizing").toString().toLowerCase()) {
  565. var c = e.offsetHeight - (parseFloat(S.getPropertyValue(e, "borderTopWidth")) || 0) - (parseFloat(S.getPropertyValue(e, "borderBottomWidth")) || 0) - (parseFloat(S.getPropertyValue(e, "paddingTop")) || 0) - (parseFloat(S.getPropertyValue(e, "paddingBottom")) || 0);return n(), c;
  566. }if ("width" === r && "border-box" !== S.getPropertyValue(e, "boxSizing").toString().toLowerCase()) {
  567. var p = e.offsetWidth - (parseFloat(S.getPropertyValue(e, "borderLeftWidth")) || 0) - (parseFloat(S.getPropertyValue(e, "borderRightWidth")) || 0) - (parseFloat(S.getPropertyValue(e, "paddingLeft")) || 0) - (parseFloat(S.getPropertyValue(e, "paddingRight")) || 0);return n(), p;
  568. }
  569. }var g;g = i(e) === a ? t.getComputedStyle(e, null) : i(e).computedStyle ? i(e).computedStyle : i(e).computedStyle = t.getComputedStyle(e, null), "borderColor" === r && (r = "borderTopColor"), l = 9 === d && "filter" === r ? g.getPropertyValue(r) : g[r], ("" === l || null === l) && (l = e.style[r]), n();
  570. }if ("auto" === l && /^(top|right|bottom|left)$/i.test(r)) {
  571. var m = s(e, "position");("fixed" === m || "absolute" === m && /top|left/i.test(r)) && (l = f(e).position()[r] + "px");
  572. }return l;
  573. }var l;if (S.Hooks.registered[r]) {
  574. var u = r,
  575. c = S.Hooks.getRoot(u);n === a && (n = S.getPropertyValue(e, S.Names.prefixCheck(c)[0])), S.Normalizations.registered[c] && (n = S.Normalizations.registered[c]("extract", e, n)), l = S.Hooks.extractValue(u, n);
  576. } else if (S.Normalizations.registered[r]) {
  577. var p, g;p = S.Normalizations.registered[r]("name", e), "transform" !== p && (g = s(e, S.Names.prefixCheck(p)[0]), S.Values.isCSSNullValue(g) && S.Hooks.templates[r] && (g = S.Hooks.templates[r][1])), l = S.Normalizations.registered[r]("extract", e, g);
  578. }if (!/^[\d-]/.test(l)) if (i(e) && i(e).isSVG && S.Names.SVGAttribute(r)) {
  579. if (/^(height|width)$/i.test(r)) try {
  580. l = e.getBBox()[r];
  581. } catch (m) {
  582. l = 0;
  583. } else l = e.getAttribute(r);
  584. } else l = s(e, S.Names.prefixCheck(r)[0]);return S.Values.isCSSNullValue(l) && (l = 0), b.debug >= 2 && console.log("Get " + r + ": " + l), l;
  585. }, setPropertyValue: function (e, r, a, n, o) {
  586. var s = r;if ("scroll" === r) o.container ? o.container["scroll" + o.direction] = a : "Left" === o.direction ? t.scrollTo(a, o.alternateValue) : t.scrollTo(o.alternateValue, a);else if (S.Normalizations.registered[r] && "transform" === S.Normalizations.registered[r]("name", e)) S.Normalizations.registered[r]("inject", e, a), s = "transform", a = i(e).transformCache[r];else {
  587. if (S.Hooks.registered[r]) {
  588. var l = r,
  589. u = S.Hooks.getRoot(r);n = n || S.getPropertyValue(e, u), a = S.Hooks.injectValue(l, a, n), r = u;
  590. }if (S.Normalizations.registered[r] && (a = S.Normalizations.registered[r]("inject", e, a), r = S.Normalizations.registered[r]("name", e)), s = S.Names.prefixCheck(r)[0], 8 >= d) try {
  591. e.style[s] = a;
  592. } catch (c) {
  593. b.debug && console.log("Browser does not support [" + a + "] for [" + s + "]");
  594. } else i(e) && i(e).isSVG && S.Names.SVGAttribute(r) ? e.setAttribute(r, a) : e.style[s] = a;b.debug >= 2 && console.log("Set " + r + " (" + s + "): " + a);
  595. }return [s, a];
  596. }, flushTransformCache: function (e) {
  597. function t(t) {
  598. return parseFloat(S.getPropertyValue(e, t));
  599. }var r = "";if ((d || b.State.isAndroid && !b.State.isChrome) && i(e).isSVG) {
  600. var a = { translate: [t("translateX"), t("translateY")], skewX: [t("skewX")], skewY: [t("skewY")], scale: 1 !== t("scale") ? [t("scale"), t("scale")] : [t("scaleX"), t("scaleY")], rotate: [t("rotateZ"), 0, 0] };f.each(i(e).transformCache, function (e) {
  601. /^translate/i.test(e) ? e = "translate" : /^scale/i.test(e) ? e = "scale" : /^rotate/i.test(e) && (e = "rotate"), a[e] && (r += e + "(" + a[e].join(" ") + ") ", delete a[e]);
  602. });
  603. } else {
  604. var n, o;f.each(i(e).transformCache, function (t) {
  605. return n = i(e).transformCache[t], "transformPerspective" === t ? (o = n, !0) : (9 === d && "rotateZ" === t && (t = "rotate"), void (r += t + n + " "));
  606. }), o && (r = "perspective" + o + " " + r);
  607. }S.setPropertyValue(e, "transform", r);
  608. } };S.Hooks.register(), S.Normalizations.register(), b.hook = function (e, t, r) {
  609. var n = a;return e = o(e), f.each(e, function (e, o) {
  610. if (i(o) === a && b.init(o), r === a) n === a && (n = b.CSS.getPropertyValue(o, t));else {
  611. var s = b.CSS.setPropertyValue(o, t, r);"transform" === s[0] && b.CSS.flushTransformCache(o), n = s;
  612. }
  613. }), n;
  614. };var P = function () {
  615. function e() {
  616. return s ? k.promise || null : l;
  617. }function n() {
  618. function e(e) {
  619. function p(e, t) {
  620. var r = a,
  621. n = a,
  622. i = a;return m.isArray(e) ? (r = e[0], !m.isArray(e[1]) && /^[\d-]/.test(e[1]) || m.isFunction(e[1]) || S.RegEx.isHex.test(e[1]) ? i = e[1] : (m.isString(e[1]) && !S.RegEx.isHex.test(e[1]) || m.isArray(e[1])) && (n = t ? e[1] : u(e[1], s.duration), e[2] !== a && (i = e[2]))) : r = e, t || (n = n || s.easing), m.isFunction(r) && (r = r.call(o, V, w)), m.isFunction(i) && (i = i.call(o, V, w)), [r || 0, n, i];
  623. }function d(e, t) {
  624. var r, a;return a = (t || "0").toString().toLowerCase().replace(/[%A-z]+$/, function (e) {
  625. return r = e, "";
  626. }), r || (r = S.Values.getUnitType(e)), [a, r];
  627. }function h() {
  628. var e = { myParent: o.parentNode || r.body, position: S.getPropertyValue(o, "position"), fontSize: S.getPropertyValue(o, "fontSize") },
  629. a = e.position === L.lastPosition && e.myParent === L.lastParent,
  630. n = e.fontSize === L.lastFontSize;L.lastParent = e.myParent, L.lastPosition = e.position, L.lastFontSize = e.fontSize;var s = 100,
  631. l = {};if (n && a) l.emToPx = L.lastEmToPx, l.percentToPxWidth = L.lastPercentToPxWidth, l.percentToPxHeight = L.lastPercentToPxHeight;else {
  632. var u = i(o).isSVG ? r.createElementNS("http://www.w3.org/2000/svg", "rect") : r.createElement("div");b.init(u), e.myParent.appendChild(u), f.each(["overflow", "overflowX", "overflowY"], function (e, t) {
  633. b.CSS.setPropertyValue(u, t, "hidden");
  634. }), b.CSS.setPropertyValue(u, "position", e.position), b.CSS.setPropertyValue(u, "fontSize", e.fontSize), b.CSS.setPropertyValue(u, "boxSizing", "content-box"), f.each(["minWidth", "maxWidth", "width", "minHeight", "maxHeight", "height"], function (e, t) {
  635. b.CSS.setPropertyValue(u, t, s + "%");
  636. }), b.CSS.setPropertyValue(u, "paddingLeft", s + "em"), l.percentToPxWidth = L.lastPercentToPxWidth = (parseFloat(S.getPropertyValue(u, "width", null, !0)) || 1) / s, l.percentToPxHeight = L.lastPercentToPxHeight = (parseFloat(S.getPropertyValue(u, "height", null, !0)) || 1) / s, l.emToPx = L.lastEmToPx = (parseFloat(S.getPropertyValue(u, "paddingLeft")) || 1) / s, e.myParent.removeChild(u);
  637. }return null === L.remToPx && (L.remToPx = parseFloat(S.getPropertyValue(r.body, "fontSize")) || 16), null === L.vwToPx && (L.vwToPx = parseFloat(t.innerWidth) / 100, L.vhToPx = parseFloat(t.innerHeight) / 100), l.remToPx = L.remToPx, l.vwToPx = L.vwToPx, l.vhToPx = L.vhToPx, b.debug >= 1 && console.log("Unit ratios: " + JSON.stringify(l), o), l;
  638. }if (s.begin && 0 === V) try {
  639. s.begin.call(g, g);
  640. } catch (x) {
  641. setTimeout(function () {
  642. throw x;
  643. }, 1);
  644. }if ("scroll" === A) {
  645. var P,
  646. C,
  647. T,
  648. F = /^x$/i.test(s.axis) ? "Left" : "Top",
  649. j = parseFloat(s.offset) || 0;s.container ? m.isWrapped(s.container) || m.isNode(s.container) ? (s.container = s.container[0] || s.container, P = s.container["scroll" + F], T = P + f(o).position()[F.toLowerCase()] + j) : s.container = null : (P = b.State.scrollAnchor[b.State["scrollProperty" + F]], C = b.State.scrollAnchor[b.State["scrollProperty" + ("Left" === F ? "Top" : "Left")]], T = f(o).offset()[F.toLowerCase()] + j), l = { scroll: { rootPropertyValue: !1, startValue: P, currentValue: P, endValue: T, unitType: "", easing: s.easing, scrollData: { container: s.container, direction: F, alternateValue: C } }, element: o }, b.debug && console.log("tweensContainer (scroll): ", l.scroll, o);
  650. } else if ("reverse" === A) {
  651. if (!i(o).tweensContainer) return void f.dequeue(o, s.queue);"none" === i(o).opts.display && (i(o).opts.display = "auto"), "hidden" === i(o).opts.visibility && (i(o).opts.visibility = "visible"), i(o).opts.loop = !1, i(o).opts.begin = null, i(o).opts.complete = null, v.easing || delete s.easing, v.duration || delete s.duration, s = f.extend({}, i(o).opts, s);var E = f.extend(!0, {}, i(o).tweensContainer);for (var H in E) {
  652. if ("element" !== H) {
  653. var N = E[H].startValue;E[H].startValue = E[H].currentValue = E[H].endValue, E[H].endValue = N, m.isEmptyObject(v) || (E[H].easing = s.easing), b.debug && console.log("reverse tweensContainer (" + H + "): " + JSON.stringify(E[H]), o);
  654. }
  655. }l = E;
  656. } else if ("start" === A) {
  657. var E;i(o).tweensContainer && i(o).isAnimating === !0 && (E = i(o).tweensContainer), f.each(y, function (e, t) {
  658. if (RegExp("^" + S.Lists.colors.join("$|^") + "$").test(e)) {
  659. var r = p(t, !0),
  660. n = r[0],
  661. o = r[1],
  662. i = r[2];if (S.RegEx.isHex.test(n)) {
  663. for (var s = ["Red", "Green", "Blue"], l = S.Values.hexToRgb(n), u = i ? S.Values.hexToRgb(i) : a, c = 0; c < s.length; c++) {
  664. var f = [l[c]];o && f.push(o), u !== a && f.push(u[c]), y[e + s[c]] = f;
  665. }delete y[e];
  666. }
  667. }
  668. });for (var z in y) {
  669. var O = p(y[z]),
  670. q = O[0],
  671. $ = O[1],
  672. M = O[2];z = S.Names.camelCase(z);var I = S.Hooks.getRoot(z),
  673. B = !1;if (i(o).isSVG || "tween" === I || S.Names.prefixCheck(I)[1] !== !1 || S.Normalizations.registered[I] !== a) {
  674. (s.display !== a && null !== s.display && "none" !== s.display || s.visibility !== a && "hidden" !== s.visibility) && /opacity|filter/.test(z) && !M && 0 !== q && (M = 0), s._cacheValues && E && E[z] ? (M === a && (M = E[z].endValue + E[z].unitType), B = i(o).rootPropertyValueCache[I]) : S.Hooks.registered[z] ? M === a ? (B = S.getPropertyValue(o, I), M = S.getPropertyValue(o, z, B)) : B = S.Hooks.templates[I][1] : M === a && (M = S.getPropertyValue(o, z));var W,
  675. G,
  676. Y,
  677. D = !1;if (W = d(z, M), M = W[0], Y = W[1], W = d(z, q), q = W[0].replace(/^([+-\/*])=/, function (e, t) {
  678. return D = t, "";
  679. }), G = W[1], M = parseFloat(M) || 0, q = parseFloat(q) || 0, "%" === G && (/^(fontSize|lineHeight)$/.test(z) ? (q /= 100, G = "em") : /^scale/.test(z) ? (q /= 100, G = "") : /(Red|Green|Blue)$/i.test(z) && (q = q / 100 * 255, G = "")), /[\/*]/.test(D)) G = Y;else if (Y !== G && 0 !== M) if (0 === q) G = Y;else {
  680. n = n || h();var Q = /margin|padding|left|right|width|text|word|letter/i.test(z) || /X$/.test(z) || "x" === z ? "x" : "y";switch (Y) {case "%":
  681. M *= "x" === Q ? n.percentToPxWidth : n.percentToPxHeight;break;case "px":
  682. break;default:
  683. M *= n[Y + "ToPx"];}switch (G) {case "%":
  684. M *= 1 / ("x" === Q ? n.percentToPxWidth : n.percentToPxHeight);break;case "px":
  685. break;default:
  686. M *= 1 / n[G + "ToPx"];}
  687. }switch (D) {case "+":
  688. q = M + q;break;case "-":
  689. q = M - q;break;case "*":
  690. q = M * q;break;case "/":
  691. q = M / q;}l[z] = { rootPropertyValue: B, startValue: M, currentValue: M, endValue: q, unitType: G, easing: $ }, b.debug && console.log("tweensContainer (" + z + "): " + JSON.stringify(l[z]), o);
  692. } else b.debug && console.log("Skipping [" + I + "] due to a lack of browser support.");
  693. }l.element = o;
  694. }l.element && (S.Values.addClass(o, "velocity-animating"), R.push(l), "" === s.queue && (i(o).tweensContainer = l, i(o).opts = s), i(o).isAnimating = !0, V === w - 1 ? (b.State.calls.push([R, g, s, null, k.resolver]), b.State.isTicking === !1 && (b.State.isTicking = !0, c())) : V++);
  695. }var n,
  696. o = this,
  697. s = f.extend({}, b.defaults, v),
  698. l = {};switch (i(o) === a && b.init(o), parseFloat(s.delay) && s.queue !== !1 && f.queue(o, s.queue, function (e) {
  699. b.velocityQueueEntryFlag = !0, i(o).delayTimer = { setTimeout: setTimeout(e, parseFloat(s.delay)), next: e };
  700. }), s.duration.toString().toLowerCase()) {case "fast":
  701. s.duration = 200;break;case "normal":
  702. s.duration = h;break;case "slow":
  703. s.duration = 600;break;default:
  704. s.duration = parseFloat(s.duration) || 1;}b.mock !== !1 && (b.mock === !0 ? s.duration = s.delay = 1 : (s.duration *= parseFloat(b.mock) || 1, s.delay *= parseFloat(b.mock) || 1)), s.easing = u(s.easing, s.duration), s.begin && !m.isFunction(s.begin) && (s.begin = null), s.progress && !m.isFunction(s.progress) && (s.progress = null), s.complete && !m.isFunction(s.complete) && (s.complete = null), s.display !== a && null !== s.display && (s.display = s.display.toString().toLowerCase(), "auto" === s.display && (s.display = b.CSS.Values.getDisplayType(o))), s.visibility !== a && null !== s.visibility && (s.visibility = s.visibility.toString().toLowerCase()), s.mobileHA = s.mobileHA && b.State.isMobile && !b.State.isGingerbread, s.queue === !1 ? s.delay ? setTimeout(e, s.delay) : e() : f.queue(o, s.queue, function (t, r) {
  705. return r === !0 ? (k.promise && k.resolver(g), !0) : (b.velocityQueueEntryFlag = !0, void e(t));
  706. }), "" !== s.queue && "fx" !== s.queue || "inprogress" === f.queue(o)[0] || f.dequeue(o);
  707. }var s,
  708. l,
  709. d,
  710. g,
  711. y,
  712. v,
  713. x = arguments[0] && (arguments[0].p || f.isPlainObject(arguments[0].properties) && !arguments[0].properties.names || m.isString(arguments[0].properties));if (m.isWrapped(this) ? (s = !1, d = 0, g = this, l = this) : (s = !0, d = 1, g = x ? arguments[0].elements || arguments[0].e : arguments[0]), g = o(g)) {
  714. x ? (y = arguments[0].properties || arguments[0].p, v = arguments[0].options || arguments[0].o) : (y = arguments[d], v = arguments[d + 1]);var w = g.length,
  715. V = 0;if (!/^(stop|finish)$/i.test(y) && !f.isPlainObject(v)) {
  716. var C = d + 1;v = {};for (var T = C; T < arguments.length; T++) {
  717. m.isArray(arguments[T]) || !/^(fast|normal|slow)$/i.test(arguments[T]) && !/^\d/.test(arguments[T]) ? m.isString(arguments[T]) || m.isArray(arguments[T]) ? v.easing = arguments[T] : m.isFunction(arguments[T]) && (v.complete = arguments[T]) : v.duration = arguments[T];
  718. }
  719. }var k = { promise: null, resolver: null, rejecter: null };s && b.Promise && (k.promise = new b.Promise(function (e, t) {
  720. k.resolver = e, k.rejecter = t;
  721. }));var A;switch (y) {case "scroll":
  722. A = "scroll";break;case "reverse":
  723. A = "reverse";break;case "finish":case "stop":
  724. f.each(g, function (e, t) {
  725. i(t) && i(t).delayTimer && (clearTimeout(i(t).delayTimer.setTimeout), i(t).delayTimer.next && i(t).delayTimer.next(), delete i(t).delayTimer);
  726. });var F = [];return f.each(b.State.calls, function (e, t) {
  727. t && f.each(t[1], function (r, n) {
  728. var o = v === a ? "" : v;return o === !0 || t[2].queue === o || v === a && t[2].queue === !1 ? void f.each(g, function (r, a) {
  729. a === n && ((v === !0 || m.isString(v)) && (f.each(f.queue(a, m.isString(v) ? v : ""), function (e, t) {
  730. m.isFunction(t) && t(null, !0);
  731. }), f.queue(a, m.isString(v) ? v : "", [])), "stop" === y ? (i(a) && i(a).tweensContainer && o !== !1 && f.each(i(a).tweensContainer, function (e, t) {
  732. t.endValue = t.currentValue;
  733. }), F.push(e)) : "finish" === y && (t[2].duration = 1));
  734. }) : !0;
  735. });
  736. }), "stop" === y && (f.each(F, function (e, t) {
  737. p(t, !0);
  738. }), k.promise && k.resolver(g)), e();default:
  739. if (!f.isPlainObject(y) || m.isEmptyObject(y)) {
  740. if (m.isString(y) && b.Redirects[y]) {
  741. var j = f.extend({}, v),
  742. E = j.duration,
  743. H = j.delay || 0;return j.backwards === !0 && (g = f.extend(!0, [], g).reverse()), f.each(g, function (e, t) {
  744. parseFloat(j.stagger) ? j.delay = H + parseFloat(j.stagger) * e : m.isFunction(j.stagger) && (j.delay = H + j.stagger.call(t, e, w)), j.drag && (j.duration = parseFloat(E) || (/^(callout|transition)/.test(y) ? 1e3 : h), j.duration = Math.max(j.duration * (j.backwards ? 1 - e / w : (e + 1) / w), .75 * j.duration, 200)), b.Redirects[y].call(t, t, j || {}, e, w, g, k.promise ? k : a);
  745. }), e();
  746. }var N = "Velocity: First argument (" + y + ") was not a property map, a known action, or a registered redirect. Aborting.";return k.promise ? k.rejecter(new Error(N)) : console.log(N), e();
  747. }A = "start";}var L = { lastParent: null, lastPosition: null, lastFontSize: null, lastPercentToPxWidth: null, lastPercentToPxHeight: null, lastEmToPx: null, remToPx: null, vwToPx: null, vhToPx: null },
  748. R = [];f.each(g, function (e, t) {
  749. m.isNode(t) && n.call(t);
  750. });var z,
  751. j = f.extend({}, b.defaults, v);if (j.loop = parseInt(j.loop), z = 2 * j.loop - 1, j.loop) for (var O = 0; z > O; O++) {
  752. var q = { delay: j.delay, progress: j.progress };O === z - 1 && (q.display = j.display, q.visibility = j.visibility, q.complete = j.complete), P(g, "reverse", q);
  753. }return e();
  754. }
  755. };b = f.extend(P, b), b.animate = P;var w = t.requestAnimationFrame || g;return b.State.isMobile || r.hidden === a || r.addEventListener("visibilitychange", function () {
  756. r.hidden ? (w = function (e) {
  757. return setTimeout(function () {
  758. e(!0);
  759. }, 16);
  760. }, c()) : w = t.requestAnimationFrame || g;
  761. }), e.Velocity = b, e !== t && (e.fn.velocity = P, e.fn.velocity.defaults = b.defaults), f.each(["Down", "Up"], function (e, t) {
  762. b.Redirects["slide" + t] = function (e, r, n, o, i, s) {
  763. var l = f.extend({}, r),
  764. u = l.begin,
  765. c = l.complete,
  766. p = { height: "", marginTop: "", marginBottom: "", paddingTop: "", paddingBottom: "" },
  767. d = {};l.display === a && (l.display = "Down" === t ? "inline" === b.CSS.Values.getDisplayType(e) ? "inline-block" : "block" : "none"), l.begin = function () {
  768. u && u.call(i, i);for (var r in p) {
  769. d[r] = e.style[r];var a = b.CSS.getPropertyValue(e, r);p[r] = "Down" === t ? [a, 0] : [0, a];
  770. }d.overflow = e.style.overflow, e.style.overflow = "hidden";
  771. }, l.complete = function () {
  772. for (var t in d) {
  773. e.style[t] = d[t];
  774. }c && c.call(i, i), s && s.resolver(i);
  775. }, b(e, p, l);
  776. };
  777. }), f.each(["In", "Out"], function (e, t) {
  778. b.Redirects["fade" + t] = function (e, r, n, o, i, s) {
  779. var l = f.extend({}, r),
  780. u = { opacity: "In" === t ? 1 : 0 },
  781. c = l.complete;l.complete = n !== o - 1 ? l.begin = null : function () {
  782. c && c.call(i, i), s && s.resolver(i);
  783. }, l.display === a && (l.display = "In" === t ? "auto" : "none"), b(this, u, l);
  784. };
  785. }), b;
  786. }(window.jQuery || window.Zepto || window, window, document);
  787. }));
  788. ;!function (a, b, c, d) {
  789. "use strict";
  790. function k(a, b, c) {
  791. return setTimeout(q(a, c), b);
  792. }function l(a, b, c) {
  793. return Array.isArray(a) ? (m(a, c[b], c), !0) : !1;
  794. }function m(a, b, c) {
  795. var e;if (a) if (a.forEach) a.forEach(b, c);else if (a.length !== d) for (e = 0; e < a.length;) {
  796. b.call(c, a[e], e, a), e++;
  797. } else for (e in a) {
  798. a.hasOwnProperty(e) && b.call(c, a[e], e, a);
  799. }
  800. }function n(a, b, c) {
  801. for (var e = Object.keys(b), f = 0; f < e.length;) {
  802. (!c || c && a[e[f]] === d) && (a[e[f]] = b[e[f]]), f++;
  803. }return a;
  804. }function o(a, b) {
  805. return n(a, b, !0);
  806. }function p(a, b, c) {
  807. var e,
  808. d = b.prototype;e = a.prototype = Object.create(d), e.constructor = a, e._super = d, c && n(e, c);
  809. }function q(a, b) {
  810. return function () {
  811. return a.apply(b, arguments);
  812. };
  813. }function r(a, b) {
  814. return typeof a == g ? a.apply(b ? b[0] || d : d, b) : a;
  815. }function s(a, b) {
  816. return a === d ? b : a;
  817. }function t(a, b, c) {
  818. m(x(b), function (b) {
  819. a.addEventListener(b, c, !1);
  820. });
  821. }function u(a, b, c) {
  822. m(x(b), function (b) {
  823. a.removeEventListener(b, c, !1);
  824. });
  825. }function v(a, b) {
  826. for (; a;) {
  827. if (a == b) return !0;a = a.parentNode;
  828. }return !1;
  829. }function w(a, b) {
  830. return a.indexOf(b) > -1;
  831. }function x(a) {
  832. return a.trim().split(/\s+/g);
  833. }function y(a, b, c) {
  834. if (a.indexOf && !c) return a.indexOf(b);for (var d = 0; d < a.length;) {
  835. if (c && a[d][c] == b || !c && a[d] === b) return d;d++;
  836. }return -1;
  837. }function z(a) {
  838. return Array.prototype.slice.call(a, 0);
  839. }function A(a, b, c) {
  840. for (var d = [], e = [], f = 0; f < a.length;) {
  841. var g = b ? a[f][b] : a[f];y(e, g) < 0 && d.push(a[f]), e[f] = g, f++;
  842. }return c && (d = b ? d.sort(function (a, c) {
  843. return a[b] > c[b];
  844. }) : d.sort()), d;
  845. }function B(a, b) {
  846. for (var c, f, g = b[0].toUpperCase() + b.slice(1), h = 0; h < e.length;) {
  847. if (c = e[h], f = c ? c + g : b, f in a) return f;h++;
  848. }return d;
  849. }function D() {
  850. return C++;
  851. }function E(a) {
  852. var b = a.ownerDocument;return b.defaultView || b.parentWindow;
  853. }function ab(a, b) {
  854. var c = this;this.manager = a, this.callback = b, this.element = a.element, this.target = a.options.inputTarget, this.domHandler = function (b) {
  855. r(a.options.enable, [a]) && c.handler(b);
  856. }, this.init();
  857. }function bb(a) {
  858. var b,
  859. c = a.options.inputClass;return b = c ? c : H ? wb : I ? Eb : G ? Gb : rb, new b(a, cb);
  860. }function cb(a, b, c) {
  861. var d = c.pointers.length,
  862. e = c.changedPointers.length,
  863. f = b & O && 0 === d - e,
  864. g = b & (Q | R) && 0 === d - e;c.isFirst = !!f, c.isFinal = !!g, f && (a.session = {}), c.eventType = b, db(a, c), a.emit("hammer.input", c), a.recognize(c), a.session.prevInput = c;
  865. }function db(a, b) {
  866. var c = a.session,
  867. d = b.pointers,
  868. e = d.length;c.firstInput || (c.firstInput = gb(b)), e > 1 && !c.firstMultiple ? c.firstMultiple = gb(b) : 1 === e && (c.firstMultiple = !1);var f = c.firstInput,
  869. g = c.firstMultiple,
  870. h = g ? g.center : f.center,
  871. i = b.center = hb(d);b.timeStamp = j(), b.deltaTime = b.timeStamp - f.timeStamp, b.angle = lb(h, i), b.distance = kb(h, i), eb(c, b), b.offsetDirection = jb(b.deltaX, b.deltaY), b.scale = g ? nb(g.pointers, d) : 1, b.rotation = g ? mb(g.pointers, d) : 0, fb(c, b);var k = a.element;v(b.srcEvent.target, k) && (k = b.srcEvent.target), b.target = k;
  872. }function eb(a, b) {
  873. var c = b.center,
  874. d = a.offsetDelta || {},
  875. e = a.prevDelta || {},
  876. f = a.prevInput || {};(b.eventType === O || f.eventType === Q) && (e = a.prevDelta = { x: f.deltaX || 0, y: f.deltaY || 0 }, d = a.offsetDelta = { x: c.x, y: c.y }), b.deltaX = e.x + (c.x - d.x), b.deltaY = e.y + (c.y - d.y);
  877. }function fb(a, b) {
  878. var f,
  879. g,
  880. h,
  881. j,
  882. c = a.lastInterval || b,
  883. e = b.timeStamp - c.timeStamp;if (b.eventType != R && (e > N || c.velocity === d)) {
  884. var k = c.deltaX - b.deltaX,
  885. l = c.deltaY - b.deltaY,
  886. m = ib(e, k, l);g = m.x, h = m.y, f = i(m.x) > i(m.y) ? m.x : m.y, j = jb(k, l), a.lastInterval = b;
  887. } else f = c.velocity, g = c.velocityX, h = c.velocityY, j = c.direction;b.velocity = f, b.velocityX = g, b.velocityY = h, b.direction = j;
  888. }function gb(a) {
  889. for (var b = [], c = 0; c < a.pointers.length;) {
  890. b[c] = { clientX: h(a.pointers[c].clientX), clientY: h(a.pointers[c].clientY) }, c++;
  891. }return { timeStamp: j(), pointers: b, center: hb(b), deltaX: a.deltaX, deltaY: a.deltaY };
  892. }function hb(a) {
  893. var b = a.length;if (1 === b) return { x: h(a[0].clientX), y: h(a[0].clientY) };for (var c = 0, d = 0, e = 0; b > e;) {
  894. c += a[e].clientX, d += a[e].clientY, e++;
  895. }return { x: h(c / b), y: h(d / b) };
  896. }function ib(a, b, c) {
  897. return { x: b / a || 0, y: c / a || 0 };
  898. }function jb(a, b) {
  899. return a === b ? S : i(a) >= i(b) ? a > 0 ? T : U : b > 0 ? V : W;
  900. }function kb(a, b, c) {
  901. c || (c = $);var d = b[c[0]] - a[c[0]],
  902. e = b[c[1]] - a[c[1]];return Math.sqrt(d * d + e * e);
  903. }function lb(a, b, c) {
  904. c || (c = $);var d = b[c[0]] - a[c[0]],
  905. e = b[c[1]] - a[c[1]];return 180 * Math.atan2(e, d) / Math.PI;
  906. }function mb(a, b) {
  907. return lb(b[1], b[0], _) - lb(a[1], a[0], _);
  908. }function nb(a, b) {
  909. return kb(b[0], b[1], _) / kb(a[0], a[1], _);
  910. }function rb() {
  911. this.evEl = pb, this.evWin = qb, this.allow = !0, this.pressed = !1, ab.apply(this, arguments);
  912. }function wb() {
  913. this.evEl = ub, this.evWin = vb, ab.apply(this, arguments), this.store = this.manager.session.pointerEvents = [];
  914. }function Ab() {
  915. this.evTarget = yb, this.evWin = zb, this.started = !1, ab.apply(this, arguments);
  916. }function Bb(a, b) {
  917. var c = z(a.touches),
  918. d = z(a.changedTouches);return b & (Q | R) && (c = A(c.concat(d), "identifier", !0)), [c, d];
  919. }function Eb() {
  920. this.evTarget = Db, this.targetIds = {}, ab.apply(this, arguments);
  921. }function Fb(a, b) {
  922. var c = z(a.touches),
  923. d = this.targetIds;if (b & (O | P) && 1 === c.length) return d[c[0].identifier] = !0, [c, c];var e,
  924. f,
  925. g = z(a.changedTouches),
  926. h = [],
  927. i = this.target;if (f = c.filter(function (a) {
  928. return v(a.target, i);
  929. }), b === O) for (e = 0; e < f.length;) {
  930. d[f[e].identifier] = !0, e++;
  931. }for (e = 0; e < g.length;) {
  932. d[g[e].identifier] && h.push(g[e]), b & (Q | R) && delete d[g[e].identifier], e++;
  933. }return h.length ? [A(f.concat(h), "identifier", !0), h] : void 0;
  934. }function Gb() {
  935. ab.apply(this, arguments);var a = q(this.handler, this);this.touch = new Eb(this.manager, a), this.mouse = new rb(this.manager, a);
  936. }function Pb(a, b) {
  937. this.manager = a, this.set(b);
  938. }function Qb(a) {
  939. if (w(a, Mb)) return Mb;var b = w(a, Nb),
  940. c = w(a, Ob);return b && c ? Nb + " " + Ob : b || c ? b ? Nb : Ob : w(a, Lb) ? Lb : Kb;
  941. }function Yb(a) {
  942. this.id = D(), this.manager = null, this.options = o(a || {}, this.defaults), this.options.enable = s(this.options.enable, !0), this.state = Rb, this.simultaneous = {}, this.requireFail = [];
  943. }function Zb(a) {
  944. return a & Wb ? "cancel" : a & Ub ? "end" : a & Tb ? "move" : a & Sb ? "start" : "";
  945. }function $b(a) {
  946. return a == W ? "down" : a == V ? "up" : a == T ? "left" : a == U ? "right" : "";
  947. }function _b(a, b) {
  948. var c = b.manager;return c ? c.get(a) : a;
  949. }function ac() {
  950. Yb.apply(this, arguments);
  951. }function bc() {
  952. ac.apply(this, arguments), this.pX = null, this.pY = null;
  953. }function cc() {
  954. ac.apply(this, arguments);
  955. }function dc() {
  956. Yb.apply(this, arguments), this._timer = null, this._input = null;
  957. }function ec() {
  958. ac.apply(this, arguments);
  959. }function fc() {
  960. ac.apply(this, arguments);
  961. }function gc() {
  962. Yb.apply(this, arguments), this.pTime = !1, this.pCenter = !1, this._timer = null, this._input = null, this.count = 0;
  963. }function hc(a, b) {
  964. return b = b || {}, b.recognizers = s(b.recognizers, hc.defaults.preset), new kc(a, b);
  965. }function kc(a, b) {
  966. b = b || {}, this.options = o(b, hc.defaults), this.options.inputTarget = this.options.inputTarget || a, this.handlers = {}, this.session = {}, this.recognizers = [], this.element = a, this.input = bb(this), this.touchAction = new Pb(this, this.options.touchAction), lc(this, !0), m(b.recognizers, function (a) {
  967. var b = this.add(new a[0](a[1]));a[2] && b.recognizeWith(a[2]), a[3] && b.requireFailure(a[3]);
  968. }, this);
  969. }function lc(a, b) {
  970. var c = a.element;m(a.options.cssProps, function (a, d) {
  971. c.style[B(c.style, d)] = b ? a : "";
  972. });
  973. }function mc(a, c) {
  974. var d = b.createEvent("Event");d.initEvent(a, !0, !0), d.gesture = c, c.target.dispatchEvent(d);
  975. }var e = ["", "webkit", "moz", "MS", "ms", "o"],
  976. f = b.createElement("div"),
  977. g = "function",
  978. h = Math.round,
  979. i = Math.abs,
  980. j = Date.now,
  981. C = 1,
  982. F = /mobile|tablet|ip(ad|hone|od)|android/i,
  983. G = "ontouchstart" in a,
  984. H = B(a, "PointerEvent") !== d,
  985. I = G && F.test(navigator.userAgent),
  986. J = "touch",
  987. K = "pen",
  988. L = "mouse",
  989. M = "kinect",
  990. N = 25,
  991. O = 1,
  992. P = 2,
  993. Q = 4,
  994. R = 8,
  995. S = 1,
  996. T = 2,
  997. U = 4,
  998. V = 8,
  999. W = 16,
  1000. X = T | U,
  1001. Y = V | W,
  1002. Z = X | Y,
  1003. $ = ["x", "y"],
  1004. _ = ["clientX", "clientY"];ab.prototype = { handler: function () {}, init: function () {
  1005. this.evEl && t(this.element, this.evEl, this.domHandler), this.evTarget && t(this.target, this.evTarget, this.domHandler), this.evWin && t(E(this.element), this.evWin, this.domHandler);
  1006. }, destroy: function () {
  1007. this.evEl && u(this.element, this.evEl, this.domHandler), this.evTarget && u(this.target, this.evTarget, this.domHandler), this.evWin && u(E(this.element), this.evWin, this.domHandler);
  1008. } };var ob = { mousedown: O, mousemove: P, mouseup: Q },
  1009. pb = "mousedown",
  1010. qb = "mousemove mouseup";p(rb, ab, { handler: function (a) {
  1011. var b = ob[a.type];b & O && 0 === a.button && (this.pressed = !0), b & P && 1 !== a.which && (b = Q), this.pressed && this.allow && (b & Q && (this.pressed = !1), this.callback(this.manager, b, { pointers: [a], changedPointers: [a], pointerType: L, srcEvent: a }));
  1012. } });var sb = { pointerdown: O, pointermove: P, pointerup: Q, pointercancel: R, pointerout: R },
  1013. tb = { 2: J, 3: K, 4: L, 5: M },
  1014. ub = "pointerdown",
  1015. vb = "pointermove pointerup pointercancel";a.MSPointerEvent && (ub = "MSPointerDown", vb = "MSPointerMove MSPointerUp MSPointerCancel"), p(wb, ab, { handler: function (a) {
  1016. var b = this.store,
  1017. c = !1,
  1018. d = a.type.toLowerCase().replace("ms", ""),
  1019. e = sb[d],
  1020. f = tb[a.pointerType] || a.pointerType,
  1021. g = f == J,
  1022. h = y(b, a.pointerId, "pointerId");e & O && (0 === a.button || g) ? 0 > h && (b.push(a), h = b.length - 1) : e & (Q | R) && (c = !0), 0 > h || (b[h] = a, this.callback(this.manager, e, { pointers: b, changedPointers: [a], pointerType: f, srcEvent: a }), c && b.splice(h, 1));
  1023. } });var xb = { touchstart: O, touchmove: P, touchend: Q, touchcancel: R },
  1024. yb = "touchstart",
  1025. zb = "touchstart touchmove touchend touchcancel";p(Ab, ab, { handler: function (a) {
  1026. var b = xb[a.type];if (b === O && (this.started = !0), this.started) {
  1027. var c = Bb.call(this, a, b);b & (Q | R) && 0 === c[0].length - c[1].length && (this.started = !1), this.callback(this.manager, b, { pointers: c[0], changedPointers: c[1], pointerType: J, srcEvent: a });
  1028. }
  1029. } });var Cb = { touchstart: O, touchmove: P, touchend: Q, touchcancel: R },
  1030. Db = "touchstart touchmove touchend touchcancel";p(Eb, ab, { handler: function (a) {
  1031. var b = Cb[a.type],
  1032. c = Fb.call(this, a, b);c && this.callback(this.manager, b, { pointers: c[0], changedPointers: c[1], pointerType: J, srcEvent: a });
  1033. } }), p(Gb, ab, { handler: function (a, b, c) {
  1034. var d = c.pointerType == J,
  1035. e = c.pointerType == L;if (d) this.mouse.allow = !1;else if (e && !this.mouse.allow) return;b & (Q | R) && (this.mouse.allow = !0), this.callback(a, b, c);
  1036. }, destroy: function () {
  1037. this.touch.destroy(), this.mouse.destroy();
  1038. } });var Hb = B(f.style, "touchAction"),
  1039. Ib = Hb !== d,
  1040. Jb = "compute",
  1041. Kb = "auto",
  1042. Lb = "manipulation",
  1043. Mb = "none",
  1044. Nb = "pan-x",
  1045. Ob = "pan-y";Pb.prototype = { set: function (a) {
  1046. a == Jb && (a = this.compute()), Ib && (this.manager.element.style[Hb] = a), this.actions = a.toLowerCase().trim();
  1047. }, update: function () {
  1048. this.set(this.manager.options.touchAction);
  1049. }, compute: function () {
  1050. var a = [];return m(this.manager.recognizers, function (b) {
  1051. r(b.options.enable, [b]) && (a = a.concat(b.getTouchAction()));
  1052. }), Qb(a.join(" "));
  1053. }, preventDefaults: function (a) {
  1054. if (!Ib) {
  1055. var b = a.srcEvent,
  1056. c = a.offsetDirection;if (this.manager.session.prevented) return b.preventDefault(), void 0;var d = this.actions,
  1057. e = w(d, Mb),
  1058. f = w(d, Ob),
  1059. g = w(d, Nb);return e || f && c & X || g && c & Y ? this.preventSrc(b) : void 0;
  1060. }
  1061. }, preventSrc: function (a) {
  1062. this.manager.session.prevented = !0, a.preventDefault();
  1063. } };var Rb = 1,
  1064. Sb = 2,
  1065. Tb = 4,
  1066. Ub = 8,
  1067. Vb = Ub,
  1068. Wb = 16,
  1069. Xb = 32;Yb.prototype = { defaults: {}, set: function (a) {
  1070. return n(this.options, a), this.manager && this.manager.touchAction.update(), this;
  1071. }, recognizeWith: function (a) {
  1072. if (l(a, "recognizeWith", this)) return this;var b = this.simultaneous;return a = _b(a, this), b[a.id] || (b[a.id] = a, a.recognizeWith(this)), this;
  1073. }, dropRecognizeWith: function (a) {
  1074. return l(a, "dropRecognizeWith", this) ? this : (a = _b(a, this), delete this.simultaneous[a.id], this);
  1075. }, requireFailure: function (a) {
  1076. if (l(a, "requireFailure", this)) return this;var b = this.requireFail;return a = _b(a, this), -1 === y(b, a) && (b.push(a), a.requireFailure(this)), this;
  1077. }, dropRequireFailure: function (a) {
  1078. if (l(a, "dropRequireFailure", this)) return this;a = _b(a, this);var b = y(this.requireFail, a);return b > -1 && this.requireFail.splice(b, 1), this;
  1079. }, hasRequireFailures: function () {
  1080. return this.requireFail.length > 0;
  1081. }, canRecognizeWith: function (a) {
  1082. return !!this.simultaneous[a.id];
  1083. }, emit: function (a) {
  1084. function d(d) {
  1085. b.manager.emit(b.options.event + (d ? Zb(c) : ""), a);
  1086. }var b = this,
  1087. c = this.state;Ub > c && d(!0), d(), c >= Ub && d(!0);
  1088. }, tryEmit: function (a) {
  1089. return this.canEmit() ? this.emit(a) : (this.state = Xb, void 0);
  1090. }, canEmit: function () {
  1091. for (var a = 0; a < this.requireFail.length;) {
  1092. if (!(this.requireFail[a].state & (Xb | Rb))) return !1;a++;
  1093. }return !0;
  1094. }, recognize: function (a) {
  1095. var b = n({}, a);return r(this.options.enable, [this, b]) ? (this.state & (Vb | Wb | Xb) && (this.state = Rb), this.state = this.process(b), this.state & (Sb | Tb | Ub | Wb) && this.tryEmit(b), void 0) : (this.reset(), this.state = Xb, void 0);
  1096. }, process: function () {}, getTouchAction: function () {}, reset: function () {} }, p(ac, Yb, { defaults: { pointers: 1 }, attrTest: function (a) {
  1097. var b = this.options.pointers;return 0 === b || a.pointers.length === b;
  1098. }, process: function (a) {
  1099. var b = this.state,
  1100. c = a.eventType,
  1101. d = b & (Sb | Tb),
  1102. e = this.attrTest(a);return d && (c & R || !e) ? b | Wb : d || e ? c & Q ? b | Ub : b & Sb ? b | Tb : Sb : Xb;
  1103. } }), p(bc, ac, { defaults: { event: "pan", threshold: 10, pointers: 1, direction: Z }, getTouchAction: function () {
  1104. var a = this.options.direction,
  1105. b = [];return a & X && b.push(Ob), a & Y && b.push(Nb), b;
  1106. }, directionTest: function (a) {
  1107. var b = this.options,
  1108. c = !0,
  1109. d = a.distance,
  1110. e = a.direction,
  1111. f = a.deltaX,
  1112. g = a.deltaY;return e & b.direction || (b.direction & X ? (e = 0 === f ? S : 0 > f ? T : U, c = f != this.pX, d = Math.abs(a.deltaX)) : (e = 0 === g ? S : 0 > g ? V : W, c = g != this.pY, d = Math.abs(a.deltaY))), a.direction = e, c && d > b.threshold && e & b.direction;
  1113. }, attrTest: function (a) {
  1114. return ac.prototype.attrTest.call(this, a) && (this.state & Sb || !(this.state & Sb) && this.directionTest(a));
  1115. }, emit: function (a) {
  1116. this.pX = a.deltaX, this.pY = a.deltaY;var b = $b(a.direction);b && this.manager.emit(this.options.event + b, a), this._super.emit.call(this, a);
  1117. } }), p(cc, ac, { defaults: { event: "pinch", threshold: 0, pointers: 2 }, getTouchAction: function () {
  1118. return [Mb];
  1119. }, attrTest: function (a) {
  1120. return this._super.attrTest.call(this, a) && (Math.abs(a.scale - 1) > this.options.threshold || this.state & Sb);
  1121. }, emit: function (a) {
  1122. if (this._super.emit.call(this, a), 1 !== a.scale) {
  1123. var b = a.scale < 1 ? "in" : "out";this.manager.emit(this.options.event + b, a);
  1124. }
  1125. } }), p(dc, Yb, { defaults: { event: "press", pointers: 1, time: 500, threshold: 5 }, getTouchAction: function () {
  1126. return [Kb];
  1127. }, process: function (a) {
  1128. var b = this.options,
  1129. c = a.pointers.length === b.pointers,
  1130. d = a.distance < b.threshold,
  1131. e = a.deltaTime > b.time;if (this._input = a, !d || !c || a.eventType & (Q | R) && !e) this.reset();else if (a.eventType & O) this.reset(), this._timer = k(function () {
  1132. this.state = Vb, this.tryEmit();
  1133. }, b.time, this);else if (a.eventType & Q) return Vb;return Xb;
  1134. }, reset: function () {
  1135. clearTimeout(this._timer);
  1136. }, emit: function (a) {
  1137. this.state === Vb && (a && a.eventType & Q ? this.manager.emit(this.options.event + "up", a) : (this._input.timeStamp = j(), this.manager.emit(this.options.event, this._input)));
  1138. } }), p(ec, ac, { defaults: { event: "rotate", threshold: 0, pointers: 2 }, getTouchAction: function () {
  1139. return [Mb];
  1140. }, attrTest: function (a) {
  1141. return this._super.attrTest.call(this, a) && (Math.abs(a.rotation) > this.options.threshold || this.state & Sb);
  1142. } }), p(fc, ac, { defaults: { event: "swipe", threshold: 10, velocity: .65, direction: X | Y, pointers: 1 }, getTouchAction: function () {
  1143. return bc.prototype.getTouchAction.call(this);
  1144. }, attrTest: function (a) {
  1145. var c,
  1146. b = this.options.direction;return b & (X | Y) ? c = a.velocity : b & X ? c = a.velocityX : b & Y && (c = a.velocityY), this._super.attrTest.call(this, a) && b & a.direction && a.distance > this.options.threshold && i(c) > this.options.velocity && a.eventType & Q;
  1147. }, emit: function (a) {
  1148. var b = $b(a.direction);b && this.manager.emit(this.options.event + b, a), this.manager.emit(this.options.event, a);
  1149. } }), p(gc, Yb, { defaults: { event: "tap", pointers: 1, taps: 1, interval: 300, time: 250, threshold: 2, posThreshold: 10 }, getTouchAction: function () {
  1150. return [Lb];
  1151. }, process: function (a) {
  1152. var b = this.options,
  1153. c = a.pointers.length === b.pointers,
  1154. d = a.distance < b.threshold,
  1155. e = a.deltaTime < b.time;if (this.reset(), a.eventType & O && 0 === this.count) return this.failTimeout();if (d && e && c) {
  1156. if (a.eventType != Q) return this.failTimeout();var f = this.pTime ? a.timeStamp - this.pTime < b.interval : !0,
  1157. g = !this.pCenter || kb(this.pCenter, a.center) < b.posThreshold;this.pTime = a.timeStamp, this.pCenter = a.center, g && f ? this.count += 1 : this.count = 1, this._input = a;var h = this.count % b.taps;if (0 === h) return this.hasRequireFailures() ? (this._timer = k(function () {
  1158. this.state = Vb, this.tryEmit();
  1159. }, b.interval, this), Sb) : Vb;
  1160. }return Xb;
  1161. }, failTimeout: function () {
  1162. return this._timer = k(function () {
  1163. this.state = Xb;
  1164. }, this.options.interval, this), Xb;
  1165. }, reset: function () {
  1166. clearTimeout(this._timer);
  1167. }, emit: function () {
  1168. this.state == Vb && (this._input.tapCount = this.count, this.manager.emit(this.options.event, this._input));
  1169. } }), hc.VERSION = "2.0.4", hc.defaults = { domEvents: !1, touchAction: Jb, enable: !0, inputTarget: null, inputClass: null, preset: [[ec, { enable: !1 }], [cc, { enable: !1 }, ["rotate"]], [fc, { direction: X }], [bc, { direction: X }, ["swipe"]], [gc], [gc, { event: "doubletap", taps: 2 }, ["tap"]], [dc]], cssProps: { userSelect: "default", touchSelect: "none", touchCallout: "none", contentZooming: "none", userDrag: "none", tapHighlightColor: "rgba(0,0,0,0)" } };var ic = 1,
  1170. jc = 2;kc.prototype = { set: function (a) {
  1171. return n(this.options, a), a.touchAction && this.touchAction.update(), a.inputTarget && (this.input.destroy(), this.input.target = a.inputTarget, this.input.init()), this;
  1172. }, stop: function (a) {
  1173. this.session.stopped = a ? jc : ic;
  1174. }, recognize: function (a) {
  1175. var b = this.session;if (!b.stopped) {
  1176. this.touchAction.preventDefaults(a);var c,
  1177. d = this.recognizers,
  1178. e = b.curRecognizer;(!e || e && e.state & Vb) && (e = b.curRecognizer = null);for (var f = 0; f < d.length;) {
  1179. c = d[f], b.stopped === jc || e && c != e && !c.canRecognizeWith(e) ? c.reset() : c.recognize(a), !e && c.state & (Sb | Tb | Ub) && (e = b.curRecognizer = c), f++;
  1180. }
  1181. }
  1182. }, get: function (a) {
  1183. if (a instanceof Yb) return a;for (var b = this.recognizers, c = 0; c < b.length; c++) {
  1184. if (b[c].options.event == a) return b[c];
  1185. }return null;
  1186. }, add: function (a) {
  1187. if (l(a, "add", this)) return this;var b = this.get(a.options.event);return b && this.remove(b), this.recognizers.push(a), a.manager = this, this.touchAction.update(), a;
  1188. }, remove: function (a) {
  1189. if (l(a, "remove", this)) return this;var b = this.recognizers;return a = this.get(a), b.splice(y(b, a), 1), this.touchAction.update(), this;
  1190. }, on: function (a, b) {
  1191. var c = this.handlers;return m(x(a), function (a) {
  1192. c[a] = c[a] || [], c[a].push(b);
  1193. }), this;
  1194. }, off: function (a, b) {
  1195. var c = this.handlers;return m(x(a), function (a) {
  1196. b ? c[a].splice(y(c[a], b), 1) : delete c[a];
  1197. }), this;
  1198. }, emit: function (a, b) {
  1199. this.options.domEvents && mc(a, b);var c = this.handlers[a] && this.handlers[a].slice();if (c && c.length) {
  1200. b.type = a, b.preventDefault = function () {
  1201. b.srcEvent.preventDefault();
  1202. };for (var d = 0; d < c.length;) {
  1203. c[d](b), d++;
  1204. }
  1205. }
  1206. }, destroy: function () {
  1207. this.element && lc(this, !1), this.handlers = {}, this.session = {}, this.input.destroy(), this.element = null;
  1208. } }, n(hc, { INPUT_START: O, INPUT_MOVE: P, INPUT_END: Q, INPUT_CANCEL: R, STATE_POSSIBLE: Rb, STATE_BEGAN: Sb, STATE_CHANGED: Tb, STATE_ENDED: Ub, STATE_RECOGNIZED: Vb, STATE_CANCELLED: Wb, STATE_FAILED: Xb, DIRECTION_NONE: S, DIRECTION_LEFT: T, DIRECTION_RIGHT: U, DIRECTION_UP: V, DIRECTION_DOWN: W, DIRECTION_HORIZONTAL: X, DIRECTION_VERTICAL: Y, DIRECTION_ALL: Z, Manager: kc, Input: ab, TouchAction: Pb, TouchInput: Eb, MouseInput: rb, PointerEventInput: wb, TouchMouseInput: Gb, SingleTouchInput: Ab, Recognizer: Yb, AttrRecognizer: ac, Tap: gc, Pan: bc, Swipe: fc, Pinch: cc, Rotate: ec, Press: dc, on: t, off: u, each: m, merge: o, extend: n, inherit: p, bindFn: q, prefixed: B }), typeof define == g && define.amd ? define(function () {
  1209. return hc;
  1210. }) : "undefined" != typeof module && module.exports ? module.exports = hc : a[c] = hc;
  1211. }(window, document, "Hammer");;(function (factory) {
  1212. if (typeof define === 'function' && define.amd) {
  1213. define(['jquery', 'hammerjs'], factory);
  1214. } else if (typeof exports === 'object') {
  1215. factory(require('jquery'), require('hammerjs'));
  1216. } else {
  1217. factory(jQuery, Hammer);
  1218. }
  1219. })(function ($, Hammer) {
  1220. function hammerify(el, options) {
  1221. var $el = $(el);
  1222. if (!$el.data("hammer")) {
  1223. $el.data("hammer", new Hammer($el[0], options));
  1224. }
  1225. }
  1226. $.fn.hammer = function (options) {
  1227. return this.each(function () {
  1228. hammerify(this, options);
  1229. });
  1230. };
  1231. // extend the emit method to also trigger jQuery events
  1232. Hammer.Manager.prototype.emit = function (originalEmit) {
  1233. return function (type, data) {
  1234. originalEmit.call(this, type, data);
  1235. $(this.element).trigger({
  1236. type: type,
  1237. gesture: data
  1238. });
  1239. };
  1240. }(Hammer.Manager.prototype.emit);
  1241. });
  1242. ; // Required for Meteor package, the use of window prevents export by Meteor
  1243. (function (window) {
  1244. if (window.Package) {
  1245. Materialize = {};
  1246. } else {
  1247. window.Materialize = {};
  1248. }
  1249. })(window);
  1250. if (typeof exports !== 'undefined' && !exports.nodeType) {
  1251. if (typeof module !== 'undefined' && !module.nodeType && module.exports) {
  1252. exports = module.exports = Materialize;
  1253. }
  1254. exports.default = Materialize;
  1255. }
  1256. /*
  1257. * raf.js
  1258. * https://github.com/ngryman/raf.js
  1259. *
  1260. * original requestAnimationFrame polyfill by Erik Möller
  1261. * inspired from paul_irish gist and post
  1262. *
  1263. * Copyright (c) 2013 ngryman
  1264. * Licensed under the MIT license.
  1265. */
  1266. (function (window) {
  1267. var lastTime = 0,
  1268. vendors = ['webkit', 'moz'],
  1269. requestAnimationFrame = window.requestAnimationFrame,
  1270. cancelAnimationFrame = window.cancelAnimationFrame,
  1271. i = vendors.length;
  1272. // try to un-prefix existing raf
  1273. while (--i >= 0 && !requestAnimationFrame) {
  1274. requestAnimationFrame = window[vendors[i] + 'RequestAnimationFrame'];
  1275. cancelAnimationFrame = window[vendors[i] + 'CancelRequestAnimationFrame'];
  1276. }
  1277. // polyfill with setTimeout fallback
  1278. // heavily inspired from @darius gist mod: https://gist.github.com/paulirish/1579671#comment-837945
  1279. if (!requestAnimationFrame || !cancelAnimationFrame) {
  1280. requestAnimationFrame = function (callback) {
  1281. var now = +Date.now(),
  1282. nextTime = Math.max(lastTime + 16, now);
  1283. return setTimeout(function () {
  1284. callback(lastTime = nextTime);
  1285. }, nextTime - now);
  1286. };
  1287. cancelAnimationFrame = clearTimeout;
  1288. }
  1289. // export to window
  1290. window.requestAnimationFrame = requestAnimationFrame;
  1291. window.cancelAnimationFrame = cancelAnimationFrame;
  1292. })(window);
  1293. /**
  1294. * Generate approximated selector string for a jQuery object
  1295. * @param {jQuery} obj jQuery object to be parsed
  1296. * @returns {string}
  1297. */
  1298. Materialize.objectSelectorString = function (obj) {
  1299. var tagStr = obj.prop('tagName') || '';
  1300. var idStr = obj.attr('id') || '';
  1301. var classStr = obj.attr('class') || '';
  1302. return (tagStr + idStr + classStr).replace(/\s/g, '');
  1303. };
  1304. // Unique Random ID
  1305. Materialize.guid = function () {
  1306. function s4() {
  1307. return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
  1308. }
  1309. return function () {
  1310. return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
  1311. };
  1312. }();
  1313. /**
  1314. * Escapes hash from special characters
  1315. * @param {string} hash String returned from this.hash
  1316. * @returns {string}
  1317. */
  1318. Materialize.escapeHash = function (hash) {
  1319. return hash.replace(/(:|\.|\[|\]|,|=)/g, "\\$1");
  1320. };
  1321. Materialize.elementOrParentIsFixed = function (element) {
  1322. var $element = $(element);
  1323. var $checkElements = $element.add($element.parents());
  1324. var isFixed = false;
  1325. $checkElements.each(function () {
  1326. if ($(this).css("position") === "fixed") {
  1327. isFixed = true;
  1328. return false;
  1329. }
  1330. });
  1331. return isFixed;
  1332. };
  1333. /**
  1334. * Get time in ms
  1335. * @license https://raw.github.com/jashkenas/underscore/master/LICENSE
  1336. * @type {function}
  1337. * @return {number}
  1338. */
  1339. var getTime = Date.now || function () {
  1340. return new Date().getTime();
  1341. };
  1342. /**
  1343. * Returns a function, that, when invoked, will only be triggered at most once
  1344. * during a given window of time. Normally, the throttled function will run
  1345. * as much as it can, without ever going more than once per `wait` duration;
  1346. * but if you'd like to disable the execution on the leading edge, pass
  1347. * `{leading: false}`. To disable execution on the trailing edge, ditto.
  1348. * @license https://raw.github.com/jashkenas/underscore/master/LICENSE
  1349. * @param {function} func
  1350. * @param {number} wait
  1351. * @param {Object=} options
  1352. * @returns {Function}
  1353. */
  1354. Materialize.throttle = function (func, wait, options) {
  1355. var context, args, result;
  1356. var timeout = null;
  1357. var previous = 0;
  1358. options || (options = {});
  1359. var later = function () {
  1360. previous = options.leading === false ? 0 : getTime();
  1361. timeout = null;
  1362. result = func.apply(context, args);
  1363. context = args = null;
  1364. };
  1365. return function () {
  1366. var now = getTime();
  1367. if (!previous && options.leading === false) previous = now;
  1368. var remaining = wait - (now - previous);
  1369. context = this;
  1370. args = arguments;
  1371. if (remaining <= 0) {
  1372. clearTimeout(timeout);
  1373. timeout = null;
  1374. previous = now;
  1375. result = func.apply(context, args);
  1376. context = args = null;
  1377. } else if (!timeout && options.trailing !== false) {
  1378. timeout = setTimeout(later, remaining);
  1379. }
  1380. return result;
  1381. };
  1382. };
  1383. // Velocity has conflicts when loaded with jQuery, this will check for it
  1384. // First, check if in noConflict mode
  1385. var Vel;
  1386. if (jQuery) {
  1387. Vel = jQuery.Velocity;
  1388. } else if ($) {
  1389. Vel = $.Velocity;
  1390. } else {
  1391. Vel = Velocity;
  1392. }
  1393. if (Vel) {
  1394. Materialize.Vel = Vel;
  1395. } else {
  1396. Materialize.Vel = Velocity;
  1397. }
  1398. ;(function ($) {
  1399. $.fn.collapsible = function (options, methodParam) {
  1400. var defaults = {
  1401. accordion: undefined,
  1402. onOpen: undefined,
  1403. onClose: undefined
  1404. };
  1405. var methodName = options;
  1406. options = $.extend(defaults, options);
  1407. return this.each(function () {
  1408. var $this = $(this);
  1409. var $panel_headers = $(this).find('> li > .collapsible-header');
  1410. var collapsible_type = $this.data("collapsible");
  1411. /****************
  1412. Helper Functions
  1413. ****************/
  1414. // Accordion Open
  1415. function accordionOpen(object) {
  1416. $panel_headers = $this.find('> li > .collapsible-header');
  1417. if (object.hasClass('active')) {
  1418. object.parent().addClass('active');
  1419. } else {
  1420. object.parent().removeClass('active');
  1421. }
  1422. if (object.parent().hasClass('active')) {
  1423. object.siblings('.collapsible-body').stop(true, false).slideDown({ duration: 350, easing: "easeOutQuart", queue: false, complete: function () {
  1424. $(this).css('height', '');
  1425. } });
  1426. } else {
  1427. object.siblings('.collapsible-body').stop(true, false).slideUp({ duration: 350, easing: "easeOutQuart", queue: false, complete: function () {
  1428. $(this).css('height', '');
  1429. } });
  1430. }
  1431. $panel_headers.not(object).removeClass('active').parent().removeClass('active');
  1432. // Close previously open accordion elements.
  1433. $panel_headers.not(object).parent().children('.collapsible-body').stop(true, false).each(function () {
  1434. if ($(this).is(':visible')) {
  1435. $(this).slideUp({
  1436. duration: 350,
  1437. easing: "easeOutQuart",
  1438. queue: false,
  1439. complete: function () {
  1440. $(this).css('height', '');
  1441. execCallbacks($(this).siblings('.collapsible-header'));
  1442. }
  1443. });
  1444. }
  1445. });
  1446. }
  1447. // Expandable Open
  1448. function expandableOpen(object) {
  1449. if (object.hasClass('active')) {
  1450. object.parent().addClass('active');
  1451. } else {
  1452. object.parent().removeClass('active');
  1453. }
  1454. if (object.parent().hasClass('active')) {
  1455. object.siblings('.collapsible-body').stop(true, false).slideDown({ duration: 350, easing: "easeOutQuart", queue: false, complete: function () {
  1456. $(this).css('height', '');
  1457. } });
  1458. } else {
  1459. object.siblings('.collapsible-body').stop(true, false).slideUp({ duration: 350, easing: "easeOutQuart", queue: false, complete: function () {
  1460. $(this).css('height', '');
  1461. } });
  1462. }
  1463. }
  1464. // Open collapsible. object: .collapsible-header
  1465. function collapsibleOpen(object, noToggle) {
  1466. if (!noToggle) {
  1467. object.toggleClass('active');
  1468. }
  1469. if (options.accordion || collapsible_type === "accordion" || collapsible_type === undefined) {
  1470. // Handle Accordion
  1471. accordionOpen(object);
  1472. } else {
  1473. // Handle Expandables
  1474. expandableOpen(object);
  1475. }
  1476. execCallbacks(object);
  1477. }
  1478. // Handle callbacks
  1479. function execCallbacks(object) {
  1480. if (object.hasClass('active')) {
  1481. if (typeof options.onOpen === "function") {
  1482. options.onOpen.call(this, object.parent());
  1483. }
  1484. } else {
  1485. if (typeof options.onClose === "function") {
  1486. options.onClose.call(this, object.parent());
  1487. }
  1488. }
  1489. }
  1490. /**
  1491. * Check if object is children of panel header
  1492. * @param {Object} object Jquery object
  1493. * @return {Boolean} true if it is children
  1494. */
  1495. function isChildrenOfPanelHeader(object) {
  1496. var panelHeader = getPanelHeader(object);
  1497. return panelHeader.length > 0;
  1498. }
  1499. /**
  1500. * Get panel header from a children element
  1501. * @param {Object} object Jquery object
  1502. * @return {Object} panel header object
  1503. */
  1504. function getPanelHeader(object) {
  1505. return object.closest('li > .collapsible-header');
  1506. }
  1507. // Turn off any existing event handlers
  1508. function removeEventHandlers() {
  1509. $this.off('click.collapse', '> li > .collapsible-header');
  1510. }
  1511. /***** End Helper Functions *****/
  1512. // Methods
  1513. if (methodName === 'destroy') {
  1514. removeEventHandlers();
  1515. return;
  1516. } else if (methodParam >= 0 && methodParam < $panel_headers.length) {
  1517. var $curr_header = $panel_headers.eq(methodParam);
  1518. if ($curr_header.length && (methodName === 'open' || methodName === 'close' && $curr_header.hasClass('active'))) {
  1519. collapsibleOpen($curr_header);
  1520. }
  1521. return;
  1522. }
  1523. removeEventHandlers();
  1524. // Add click handler to only direct collapsible header children
  1525. $this.on('click.collapse', '> li > .collapsible-header', function (e) {
  1526. var element = $(e.target);
  1527. if (isChildrenOfPanelHeader(element)) {
  1528. element = getPanelHeader(element);
  1529. }
  1530. collapsibleOpen(element);
  1531. });
  1532. // Open first active
  1533. if (options.accordion || collapsible_type === "accordion" || collapsible_type === undefined) {
  1534. // Handle Accordion
  1535. collapsibleOpen($panel_headers.filter('.active').first(), true);
  1536. } else {
  1537. // Handle Expandables
  1538. $panel_headers.filter('.active').each(function () {
  1539. collapsibleOpen($(this), true);
  1540. });
  1541. }
  1542. });
  1543. };
  1544. $(document).ready(function () {
  1545. $('.collapsible').collapsible();
  1546. });
  1547. })(jQuery);;(function ($) {
  1548. // Add posibility to scroll to selected option
  1549. // usefull for select for example
  1550. $.fn.scrollTo = function (elem) {
  1551. $(this).scrollTop($(this).scrollTop() - $(this).offset().top + $(elem).offset().top);
  1552. return this;
  1553. };
  1554. $.fn.dropdown = function (options) {
  1555. var defaults = {
  1556. inDuration: 300,
  1557. outDuration: 225,
  1558. constrainWidth: true, // Constrains width of dropdown to the activator
  1559. hover: false,
  1560. gutter: 0, // Spacing from edge
  1561. belowOrigin: false,
  1562. alignment: 'left',
  1563. stopPropagation: false
  1564. };
  1565. // Open dropdown.
  1566. if (options === "open") {
  1567. this.each(function () {
  1568. $(this).trigger('open');
  1569. });
  1570. return false;
  1571. }
  1572. // Close dropdown.
  1573. if (options === "close") {
  1574. this.each(function () {
  1575. $(this).trigger('close');
  1576. });
  1577. return false;
  1578. }
  1579. this.each(function () {
  1580. var origin = $(this);
  1581. var curr_options = $.extend({}, defaults, options);
  1582. var isFocused = false;
  1583. // Dropdown menu
  1584. var activates = $("#" + origin.attr('data-activates'));
  1585. function updateOptions() {
  1586. if (origin.data('induration') !== undefined) curr_options.inDuration = origin.data('induration');
  1587. if (origin.data('outduration') !== undefined) curr_options.outDuration = origin.data('outduration');
  1588. if (origin.data('constrainwidth') !== undefined) curr_options.constrainWidth = origin.data('constrainwidth');
  1589. if (origin.data('hover') !== undefined) curr_options.hover = origin.data('hover');
  1590. if (origin.data('gutter') !== undefined) curr_options.gutter = origin.data('gutter');
  1591. if (origin.data('beloworigin') !== undefined) curr_options.belowOrigin = origin.data('beloworigin');
  1592. if (origin.data('alignment') !== undefined) curr_options.alignment = origin.data('alignment');
  1593. if (origin.data('stoppropagation') !== undefined) curr_options.stopPropagation = origin.data('stoppropagation');
  1594. }
  1595. updateOptions();
  1596. // Attach dropdown to its activator
  1597. origin.after(activates);
  1598. /*
  1599. Helper function to position and resize dropdown.
  1600. Used in hover and click handler.
  1601. */
  1602. function placeDropdown(eventType) {
  1603. // Check for simultaneous focus and click events.
  1604. if (eventType === 'focus') {
  1605. isFocused = true;
  1606. }
  1607. // Check html data attributes
  1608. updateOptions();
  1609. // Set Dropdown state
  1610. activates.addClass('active');
  1611. origin.addClass('active');
  1612. var originWidth = origin[0].getBoundingClientRect().width;
  1613. // Constrain width
  1614. if (curr_options.constrainWidth === true) {
  1615. activates.css('width', originWidth);
  1616. } else {
  1617. activates.css('white-space', 'nowrap');
  1618. }
  1619. // Offscreen detection
  1620. var windowHeight = window.innerHeight;
  1621. var originHeight = origin.innerHeight();
  1622. var offsetLeft = origin.offset().left;
  1623. var offsetTop = origin.offset().top - $(window).scrollTop();
  1624. var currAlignment = curr_options.alignment;
  1625. var gutterSpacing = 0;
  1626. var leftPosition = 0;
  1627. // Below Origin
  1628. var verticalOffset = 0;
  1629. if (curr_options.belowOrigin === true) {
  1630. verticalOffset = originHeight;
  1631. }
  1632. // Check for scrolling positioned container.
  1633. var scrollYOffset = 0;
  1634. var scrollXOffset = 0;
  1635. var wrapper = origin.parent();
  1636. if (!wrapper.is('body')) {
  1637. if (wrapper[0].scrollHeight > wrapper[0].clientHeight) {
  1638. scrollYOffset = wrapper[0].scrollTop;
  1639. }
  1640. if (wrapper[0].scrollWidth > wrapper[0].clientWidth) {
  1641. scrollXOffset = wrapper[0].scrollLeft;
  1642. }
  1643. }
  1644. if (offsetLeft + activates.innerWidth() > $(window).width()) {
  1645. // Dropdown goes past screen on right, force right alignment
  1646. currAlignment = 'right';
  1647. } else if (offsetLeft - activates.innerWidth() + origin.innerWidth() < 0) {
  1648. // Dropdown goes past screen on left, force left alignment
  1649. currAlignment = 'left';
  1650. }
  1651. // Vertical bottom offscreen detection
  1652. if (offsetTop + activates.innerHeight() > windowHeight) {
  1653. // If going upwards still goes offscreen, just crop height of dropdown.
  1654. if (offsetTop + originHeight - activates.innerHeight() < 0) {
  1655. var adjustedHeight = windowHeight - offsetTop - verticalOffset;
  1656. activates.css('max-height', adjustedHeight);
  1657. } else {
  1658. // Flow upwards.
  1659. if (!verticalOffset) {
  1660. verticalOffset += originHeight;
  1661. }
  1662. verticalOffset -= activates.innerHeight();
  1663. }
  1664. }
  1665. // Handle edge alignment
  1666. if (currAlignment === 'left') {
  1667. gutterSpacing = curr_options.gutter;
  1668. leftPosition = origin.position().left + gutterSpacing;
  1669. } else if (currAlignment === 'right') {
  1670. // Material icons fix
  1671. activates.stop(true, true).css({
  1672. opacity: 0,
  1673. left: 0
  1674. });
  1675. var offsetRight = origin.position().left + originWidth - activates.width();
  1676. gutterSpacing = -curr_options.gutter;
  1677. leftPosition = offsetRight + gutterSpacing;
  1678. }
  1679. // Position dropdown
  1680. activates.css({
  1681. position: 'absolute',
  1682. top: origin.position().top + verticalOffset + scrollYOffset,
  1683. left: leftPosition + scrollXOffset
  1684. });
  1685. // Show dropdown
  1686. activates.slideDown({
  1687. queue: false,
  1688. duration: curr_options.inDuration,
  1689. easing: 'easeOutCubic',
  1690. complete: function () {
  1691. $(this).css('height', '');
  1692. }
  1693. }).animate({ opacity: 1 }, { queue: false, duration: curr_options.inDuration, easing: 'easeOutSine' });
  1694. // Add click close handler to document
  1695. setTimeout(function () {
  1696. $(document).on('click.' + activates.attr('id'), function (e) {
  1697. hideDropdown();
  1698. $(document).off('click.' + activates.attr('id'));
  1699. });
  1700. }, 0);
  1701. }
  1702. function hideDropdown() {
  1703. // Check for simultaneous focus and click events.
  1704. isFocused = false;
  1705. activates.fadeOut(curr_options.outDuration);
  1706. activates.removeClass('active');
  1707. origin.removeClass('active');
  1708. $(document).off('click.' + activates.attr('id'));
  1709. setTimeout(function () {
  1710. activates.css('max-height', '');
  1711. }, curr_options.outDuration);
  1712. }
  1713. // Hover
  1714. if (curr_options.hover) {
  1715. var open = false;
  1716. origin.off('click.' + origin.attr('id'));
  1717. // Hover handler to show dropdown
  1718. origin.on('mouseenter', function (e) {
  1719. // Mouse over
  1720. if (open === false) {
  1721. placeDropdown();
  1722. open = true;
  1723. }
  1724. });
  1725. origin.on('mouseleave', function (e) {
  1726. // If hover on origin then to something other than dropdown content, then close
  1727. var toEl = e.toElement || e.relatedTarget; // added browser compatibility for target element
  1728. if (!$(toEl).closest('.dropdown-content').is(activates)) {
  1729. activates.stop(true, true);
  1730. hideDropdown();
  1731. open = false;
  1732. }
  1733. });
  1734. activates.on('mouseleave', function (e) {
  1735. // Mouse out
  1736. var toEl = e.toElement || e.relatedTarget;
  1737. if (!$(toEl).closest('.dropdown-button').is(origin)) {
  1738. activates.stop(true, true);
  1739. hideDropdown();
  1740. open = false;
  1741. }
  1742. });
  1743. // Click
  1744. } else {
  1745. // Click handler to show dropdown
  1746. origin.off('click.' + origin.attr('id'));
  1747. origin.on('click.' + origin.attr('id'), function (e) {
  1748. if (!isFocused) {
  1749. if (origin[0] == e.currentTarget && !origin.hasClass('active') && $(e.target).closest('.dropdown-content').length === 0) {
  1750. e.preventDefault(); // Prevents button click from moving window
  1751. if (curr_options.stopPropagation) {
  1752. e.stopPropagation();
  1753. }
  1754. placeDropdown('click');
  1755. }
  1756. // If origin is clicked and menu is open, close menu
  1757. else if (origin.hasClass('active')) {
  1758. hideDropdown();
  1759. $(document).off('click.' + activates.attr('id'));
  1760. }
  1761. }
  1762. });
  1763. } // End else
  1764. // Listen to open and close event - useful for select component
  1765. origin.on('open', function (e, eventType) {
  1766. placeDropdown(eventType);
  1767. });
  1768. origin.on('close', hideDropdown);
  1769. });
  1770. }; // End dropdown plugin
  1771. $(document).ready(function () {
  1772. $('.dropdown-button').dropdown();
  1773. });
  1774. })(jQuery);
  1775. ;(function ($, Vel) {
  1776. 'use strict';
  1777. var _defaults = {
  1778. opacity: 0.5,
  1779. inDuration: 250,
  1780. outDuration: 250,
  1781. ready: undefined,
  1782. complete: undefined,
  1783. dismissible: true,
  1784. startingTop: '4%',
  1785. endingTop: '10%'
  1786. };
  1787. /**
  1788. * @class
  1789. *
  1790. */
  1791. var Modal = function () {
  1792. /**
  1793. * Construct Modal instance and set up overlay
  1794. * @constructor
  1795. * @param {jQuery} $el
  1796. * @param {Object} options
  1797. */
  1798. function Modal($el, options) {
  1799. _classCallCheck(this, Modal);
  1800. // If exists, destroy and reinitialize
  1801. if (!!$el[0].M_Modal) {
  1802. $el[0].M_Modal.destroy();
  1803. }
  1804. /**
  1805. * The jQuery element
  1806. * @type {jQuery}
  1807. */
  1808. this.$el = $el;
  1809. /**
  1810. * Options for the modal
  1811. * @member Modal#options
  1812. * @prop {Number} [opacity=0.5] - Opacity of the modal overlay
  1813. * @prop {Number} [inDuration=250] - Length in ms of enter transition
  1814. * @prop {Number} [outDuration=250] - Length in ms of exit transition
  1815. * @prop {Function} ready - Callback function called when modal is finished entering
  1816. * @prop {Function} complete - Callback function called when modal is finished exiting
  1817. * @prop {Boolean} [dismissible=true] - Allow modal to be dismissed by keyboard or overlay click
  1818. * @prop {String} [startingTop='4%'] - startingTop
  1819. * @prop {String} [endingTop='10%'] - endingTop
  1820. */
  1821. this.options = $.extend({}, Modal.defaults, options);
  1822. /**
  1823. * Describes open/close state of modal
  1824. * @type {Boolean}
  1825. */
  1826. this.isOpen = false;
  1827. this.$el[0].M_Modal = this;
  1828. this.id = $el.attr('id');
  1829. this.openingTrigger = undefined;
  1830. this.$overlay = $('<div class="modal-overlay"></div>');
  1831. Modal._increment++;
  1832. Modal._count++;
  1833. this.$overlay[0].style.zIndex = 1000 + Modal._increment * 2;
  1834. this.$el[0].style.zIndex = 1000 + Modal._increment * 2 + 1;
  1835. this.setupEventHandlers();
  1836. }
  1837. _createClass(Modal, [{
  1838. key: 'getInstance',
  1839. /**
  1840. * Get Instance
  1841. */
  1842. value: function getInstance() {
  1843. return this;
  1844. }
  1845. /**
  1846. * Teardown component
  1847. */
  1848. }, {
  1849. key: 'destroy',
  1850. value: function destroy() {
  1851. this.removeEventHandlers();
  1852. this.$el[0].removeAttribute('style');
  1853. if (!!this.$overlay[0].parentNode) {
  1854. this.$overlay[0].parentNode.removeChild(this.$overlay[0]);
  1855. }
  1856. this.$el[0].M_Modal = undefined;
  1857. Modal._count--;
  1858. }
  1859. /**
  1860. * Setup Event Handlers
  1861. */
  1862. }, {
  1863. key: 'setupEventHandlers',
  1864. value: function setupEventHandlers() {
  1865. this.handleOverlayClickBound = this.handleOverlayClick.bind(this);
  1866. this.handleModalCloseClickBound = this.handleModalCloseClick.bind(this);
  1867. if (Modal._count === 1) {
  1868. document.body.addEventListener('click', this.handleTriggerClick);
  1869. }
  1870. this.$overlay[0].addEventListener('click', this.handleOverlayClickBound);
  1871. this.$el[0].addEventListener('click', this.handleModalCloseClickBound);
  1872. }
  1873. /**
  1874. * Remove Event Handlers
  1875. */
  1876. }, {
  1877. key: 'removeEventHandlers',
  1878. value: function removeEventHandlers() {
  1879. if (Modal._count === 0) {
  1880. document.body.removeEventListener('click', this.handleTriggerClick);
  1881. }
  1882. this.$overlay[0].removeEventListener('click', this.handleOverlayClickBound);
  1883. this.$el[0].removeEventListener('click', this.handleModalCloseClickBound);
  1884. }
  1885. /**
  1886. * Handle Trigger Click
  1887. * @param {Event} e
  1888. */
  1889. }, {
  1890. key: 'handleTriggerClick',
  1891. value: function handleTriggerClick(e) {
  1892. var $trigger = $(e.target).closest('.modal-trigger');
  1893. if (e.target && $trigger.length) {
  1894. var modalId = $trigger[0].getAttribute('href');
  1895. if (modalId) {
  1896. modalId = modalId.slice(1);
  1897. } else {
  1898. modalId = $trigger[0].getAttribute('data-target');
  1899. }
  1900. var modalInstance = document.getElementById(modalId).M_Modal;
  1901. if (modalInstance) {
  1902. modalInstance.open($trigger);
  1903. }
  1904. e.preventDefault();
  1905. }
  1906. }
  1907. /**
  1908. * Handle Overlay Click
  1909. */
  1910. }, {
  1911. key: 'handleOverlayClick',
  1912. value: function handleOverlayClick() {
  1913. if (this.options.dismissible) {
  1914. this.close();
  1915. }
  1916. }
  1917. /**
  1918. * Handle Modal Close Click
  1919. * @param {Event} e
  1920. */
  1921. }, {
  1922. key: 'handleModalCloseClick',
  1923. value: function handleModalCloseClick(e) {
  1924. var $closeTrigger = $(e.target).closest('.modal-close');
  1925. if (e.target && $closeTrigger.length) {
  1926. this.close();
  1927. }
  1928. }
  1929. /**
  1930. * Handle Keydown
  1931. * @param {Event} e
  1932. */
  1933. }, {
  1934. key: 'handleKeydown',
  1935. value: function handleKeydown(e) {
  1936. // ESC key
  1937. if (e.keyCode === 27 && this.options.dismissible) {
  1938. this.close();
  1939. }
  1940. }
  1941. /**
  1942. * Animate in modal
  1943. */
  1944. }, {
  1945. key: 'animateIn',
  1946. value: function animateIn() {
  1947. var _this = this;
  1948. // Set initial styles
  1949. $.extend(this.$el[0].style, {
  1950. display: 'block',
  1951. opacity: 0
  1952. });
  1953. $.extend(this.$overlay[0].style, {
  1954. display: 'block',
  1955. opacity: 0
  1956. });
  1957. // Animate overlay
  1958. Vel(this.$overlay[0], { opacity: this.options.opacity }, { duration: this.options.inDuration, queue: false, ease: 'easeOutCubic' });
  1959. // Define modal animation options
  1960. var enterVelocityOptions = {
  1961. duration: this.options.inDuration,
  1962. queue: false,
  1963. ease: 'easeOutCubic',
  1964. // Handle modal ready callback
  1965. complete: function () {
  1966. if (typeof _this.options.ready === 'function') {
  1967. _this.options.ready.call(_this, _this.$el, _this.openingTrigger);
  1968. }
  1969. }
  1970. };
  1971. // Bottom sheet animation
  1972. if (this.$el[0].classList.contains('bottom-sheet')) {
  1973. Vel(this.$el[0], { bottom: 0, opacity: 1 }, enterVelocityOptions);
  1974. // Normal modal animation
  1975. } else {
  1976. Vel.hook(this.$el[0], 'scaleX', 0.7);
  1977. this.$el[0].style.top = this.options.startingTop;
  1978. Vel(this.$el[0], { top: this.options.endingTop, opacity: 1, scaleX: 1 }, enterVelocityOptions);
  1979. }
  1980. }
  1981. /**
  1982. * Animate out modal
  1983. */
  1984. }, {
  1985. key: 'animateOut',
  1986. value: function animateOut() {
  1987. var _this2 = this;
  1988. // Animate overlay
  1989. Vel(this.$overlay[0], { opacity: 0 }, { duration: this.options.outDuration, queue: false, ease: 'easeOutQuart' });
  1990. // Define modal animation options
  1991. var exitVelocityOptions = {
  1992. duration: this.options.outDuration,
  1993. queue: false,
  1994. ease: 'easeOutCubic',
  1995. // Handle modal ready callback
  1996. complete: function () {
  1997. _this2.$el[0].style.display = 'none';
  1998. // Call complete callback
  1999. if (typeof _this2.options.complete === 'function') {
  2000. _this2.options.complete.call(_this2, _this2.$el);
  2001. }
  2002. _this2.$overlay[0].parentNode.removeChild(_this2.$overlay[0]);
  2003. }
  2004. };
  2005. // Bottom sheet animation
  2006. if (this.$el[0].classList.contains('bottom-sheet')) {
  2007. Vel(this.$el[0], { bottom: '-100%', opacity: 0 }, exitVelocityOptions);
  2008. // Normal modal animation
  2009. } else {
  2010. Vel(this.$el[0], { top: this.options.startingTop, opacity: 0, scaleX: 0.7 }, exitVelocityOptions);
  2011. }
  2012. }
  2013. /**
  2014. * Open Modal
  2015. * @param {jQuery} [$trigger]
  2016. */
  2017. }, {
  2018. key: 'open',
  2019. value: function open($trigger) {
  2020. if (this.isOpen) {
  2021. return;
  2022. }
  2023. this.isOpen = true;
  2024. var body = document.body;
  2025. body.style.overflow = 'hidden';
  2026. this.$el[0].classList.add('open');
  2027. body.appendChild(this.$overlay[0]);
  2028. // Set opening trigger, undefined indicates modal was opened by javascript
  2029. this.openingTrigger = !!$trigger ? $trigger : undefined;
  2030. if (this.options.dismissible) {
  2031. this.handleKeydownBound = this.handleKeydown.bind(this);
  2032. document.addEventListener('keydown', this.handleKeydownBound);
  2033. }
  2034. this.animateIn();
  2035. return this;
  2036. }
  2037. /**
  2038. * Close Modal
  2039. */
  2040. }, {
  2041. key: 'close',
  2042. value: function close() {
  2043. if (!this.isOpen) {
  2044. return;
  2045. }
  2046. this.isOpen = false;
  2047. this.$el[0].classList.remove('open');
  2048. document.body.style.overflow = '';
  2049. if (this.options.dismissible) {
  2050. document.removeEventListener('keydown', this.handleKeydownBound);
  2051. }
  2052. this.animateOut();
  2053. return this;
  2054. }
  2055. }], [{
  2056. key: 'init',
  2057. value: function init($els, options) {
  2058. var arr = [];
  2059. $els.each(function () {
  2060. arr.push(new Modal($(this), options));
  2061. });
  2062. return arr;
  2063. }
  2064. }, {
  2065. key: 'defaults',
  2066. get: function () {
  2067. return _defaults;
  2068. }
  2069. }]);
  2070. return Modal;
  2071. }();
  2072. /**
  2073. * @static
  2074. * @memberof Modal
  2075. */
  2076. Modal._increment = 0;
  2077. /**
  2078. * @static
  2079. * @memberof Modal
  2080. */
  2081. Modal._count = 0;
  2082. Materialize.Modal = Modal;
  2083. $.fn.modal = function (methodOrOptions) {
  2084. // Call plugin method if valid method name is passed in
  2085. if (Modal.prototype[methodOrOptions]) {
  2086. // Getter methods
  2087. if (methodOrOptions.slice(0, 3) === 'get') {
  2088. return this.first()[0].M_Modal[methodOrOptions]();
  2089. // Void methods
  2090. } else {
  2091. return this.each(function () {
  2092. this.M_Modal[methodOrOptions]();
  2093. });
  2094. }
  2095. // Initialize plugin if options or no argument is passed in
  2096. } else if (typeof methodOrOptions === 'object' || !methodOrOptions) {
  2097. Modal.init(this, arguments[0]);
  2098. return this;
  2099. // Return error if an unrecognized method name is passed in
  2100. } else {
  2101. $.error('Method ' + methodOrOptions + ' does not exist on jQuery.modal');
  2102. }
  2103. };
  2104. })(jQuery, Materialize.Vel);
  2105. ;(function ($) {
  2106. $.fn.materialbox = function () {
  2107. return this.each(function () {
  2108. if ($(this).hasClass('initialized')) {
  2109. return;
  2110. }
  2111. $(this).addClass('initialized');
  2112. var overlayActive = false;
  2113. var doneAnimating = true;
  2114. var inDuration = 275;
  2115. var outDuration = 200;
  2116. var origin = $(this);
  2117. var placeholder = $('<div></div>').addClass('material-placeholder');
  2118. var originalWidth = 0;
  2119. var originalHeight = 0;
  2120. var ancestorsChanged;
  2121. var ancestor;
  2122. var originInlineStyles = origin.attr('style');
  2123. origin.wrap(placeholder);
  2124. // Start click handler
  2125. origin.on('click', function () {
  2126. var placeholder = origin.parent('.material-placeholder');
  2127. var windowWidth = window.innerWidth;
  2128. var windowHeight = window.innerHeight;
  2129. var originalWidth = origin.width();
  2130. var originalHeight = origin.height();
  2131. // If already modal, return to original
  2132. if (doneAnimating === false) {
  2133. returnToOriginal();
  2134. return false;
  2135. } else if (overlayActive && doneAnimating === true) {
  2136. returnToOriginal();
  2137. return false;
  2138. }
  2139. // Set states
  2140. doneAnimating = false;
  2141. origin.addClass('active');
  2142. overlayActive = true;
  2143. // Set positioning for placeholder
  2144. placeholder.css({
  2145. width: placeholder[0].getBoundingClientRect().width,
  2146. height: placeholder[0].getBoundingClientRect().height,
  2147. position: 'relative',
  2148. top: 0,
  2149. left: 0
  2150. });
  2151. // Find ancestor with overflow: hidden; and remove it
  2152. ancestorsChanged = undefined;
  2153. ancestor = placeholder[0].parentNode;
  2154. var count = 0;
  2155. while (ancestor !== null && !$(ancestor).is(document)) {
  2156. var curr = $(ancestor);
  2157. if (curr.css('overflow') !== 'visible') {
  2158. curr.css('overflow', 'visible');
  2159. if (ancestorsChanged === undefined) {
  2160. ancestorsChanged = curr;
  2161. } else {
  2162. ancestorsChanged = ancestorsChanged.add(curr);
  2163. }
  2164. }
  2165. ancestor = ancestor.parentNode;
  2166. }
  2167. // Set css on origin
  2168. origin.css({
  2169. position: 'absolute',
  2170. 'z-index': 1000,
  2171. 'will-change': 'left, top, width, height'
  2172. }).data('width', originalWidth).data('height', originalHeight);
  2173. // Add overlay
  2174. var overlay = $('<div id="materialbox-overlay"></div>').css({
  2175. opacity: 0
  2176. }).click(function () {
  2177. if (doneAnimating === true) returnToOriginal();
  2178. });
  2179. // Put before in origin image to preserve z-index layering.
  2180. origin.before(overlay);
  2181. // Set dimensions if needed
  2182. var overlayOffset = overlay[0].getBoundingClientRect();
  2183. overlay.css({
  2184. width: windowWidth,
  2185. height: windowHeight,
  2186. left: -1 * overlayOffset.left,
  2187. top: -1 * overlayOffset.top
  2188. });
  2189. // Animate Overlay
  2190. overlay.velocity({ opacity: 1 }, { duration: inDuration, queue: false, easing: 'easeOutQuad' });
  2191. // Add and animate caption if it exists
  2192. if (origin.data('caption') !== "") {
  2193. var $photo_caption = $('<div class="materialbox-caption"></div>');
  2194. $photo_caption.text(origin.data('caption'));
  2195. $('body').append($photo_caption);
  2196. $photo_caption.css({ "display": "inline" });
  2197. $photo_caption.velocity({ opacity: 1 }, { duration: inDuration, queue: false, easing: 'easeOutQuad' });
  2198. }
  2199. // Resize Image
  2200. var ratio = 0;
  2201. var widthPercent = originalWidth / windowWidth;
  2202. var heightPercent = originalHeight / windowHeight;
  2203. var newWidth = 0;
  2204. var newHeight = 0;
  2205. if (widthPercent > heightPercent) {
  2206. ratio = originalHeight / originalWidth;
  2207. newWidth = windowWidth * 0.9;
  2208. newHeight = windowWidth * 0.9 * ratio;
  2209. } else {
  2210. ratio = originalWidth / originalHeight;
  2211. newWidth = windowHeight * 0.9 * ratio;
  2212. newHeight = windowHeight * 0.9;
  2213. }
  2214. // Animate image + set z-index
  2215. if (origin.hasClass('responsive-img')) {
  2216. origin.velocity({ 'max-width': newWidth, 'width': originalWidth }, { duration: 0, queue: false,
  2217. complete: function () {
  2218. origin.css({ left: 0, top: 0 }).velocity({
  2219. height: newHeight,
  2220. width: newWidth,
  2221. left: $(document).scrollLeft() + windowWidth / 2 - origin.parent('.material-placeholder').offset().left - newWidth / 2,
  2222. top: $(document).scrollTop() + windowHeight / 2 - origin.parent('.material-placeholder').offset().top - newHeight / 2
  2223. }, {
  2224. duration: inDuration,
  2225. queue: false,
  2226. easing: 'easeOutQuad',
  2227. complete: function () {
  2228. doneAnimating = true;
  2229. }
  2230. });
  2231. } // End Complete
  2232. }); // End Velocity
  2233. } else {
  2234. origin.css('left', 0).css('top', 0).velocity({
  2235. height: newHeight,
  2236. width: newWidth,
  2237. left: $(document).scrollLeft() + windowWidth / 2 - origin.parent('.material-placeholder').offset().left - newWidth / 2,
  2238. top: $(document).scrollTop() + windowHeight / 2 - origin.parent('.material-placeholder').offset().top - newHeight / 2
  2239. }, {
  2240. duration: inDuration,
  2241. queue: false,
  2242. easing: 'easeOutQuad',
  2243. complete: function () {
  2244. doneAnimating = true;
  2245. }
  2246. }); // End Velocity
  2247. }
  2248. // Handle Exit triggers
  2249. $(window).on('scroll.materialbox', function () {
  2250. if (overlayActive) {
  2251. returnToOriginal();
  2252. }
  2253. });
  2254. $(window).on('resize.materialbox', function () {
  2255. if (overlayActive) {
  2256. returnToOriginal();
  2257. }
  2258. });
  2259. $(document).on('keyup.materialbox', function (e) {
  2260. // ESC key
  2261. if (e.keyCode === 27 && doneAnimating === true && overlayActive) {
  2262. returnToOriginal();
  2263. }
  2264. });
  2265. }); // End click handler
  2266. // This function returns the modaled image to the original spot
  2267. function returnToOriginal() {
  2268. doneAnimating = false;
  2269. var placeholder = origin.parent('.material-placeholder');
  2270. var windowWidth = window.innerWidth;
  2271. var windowHeight = window.innerHeight;
  2272. var originalWidth = origin.data('width');
  2273. var originalHeight = origin.data('height');
  2274. origin.velocity("stop", true);
  2275. $('#materialbox-overlay').velocity("stop", true);
  2276. $('.materialbox-caption').velocity("stop", true);
  2277. // disable exit handlers
  2278. $(window).off('scroll.materialbox');
  2279. $(document).off('keyup.materialbox');
  2280. $(window).off('resize.materialbox');
  2281. $('#materialbox-overlay').velocity({ opacity: 0 }, {
  2282. duration: outDuration, // Delay prevents animation overlapping
  2283. queue: false, easing: 'easeOutQuad',
  2284. complete: function () {
  2285. // Remove Overlay
  2286. overlayActive = false;
  2287. $(this).remove();
  2288. }
  2289. });
  2290. // Resize Image
  2291. origin.velocity({
  2292. width: originalWidth,
  2293. height: originalHeight,
  2294. left: 0,
  2295. top: 0
  2296. }, {
  2297. duration: outDuration,
  2298. queue: false, easing: 'easeOutQuad',
  2299. complete: function () {
  2300. placeholder.css({
  2301. height: '',
  2302. width: '',
  2303. position: '',
  2304. top: '',
  2305. left: ''
  2306. });
  2307. origin.removeAttr('style');
  2308. origin.attr('style', originInlineStyles);
  2309. // Remove class
  2310. origin.removeClass('active');
  2311. doneAnimating = true;
  2312. // Remove overflow overrides on ancestors
  2313. if (ancestorsChanged) {
  2314. ancestorsChanged.css('overflow', '');
  2315. }
  2316. }
  2317. });
  2318. // Remove Caption + reset css settings on image
  2319. $('.materialbox-caption').velocity({ opacity: 0 }, {
  2320. duration: outDuration, // Delay prevents animation overlapping
  2321. queue: false, easing: 'easeOutQuad',
  2322. complete: function () {
  2323. $(this).remove();
  2324. }
  2325. });
  2326. }
  2327. });
  2328. };
  2329. $(document).ready(function () {
  2330. $('.materialboxed').materialbox();
  2331. });
  2332. })(jQuery);
  2333. ;(function ($) {
  2334. $.fn.parallax = function () {
  2335. var window_width = $(window).width();
  2336. // Parallax Scripts
  2337. return this.each(function (i) {
  2338. var $this = $(this);
  2339. $this.addClass('parallax');
  2340. function updateParallax(initial) {
  2341. var container_height;
  2342. if (window_width < 601) {
  2343. container_height = $this.height() > 0 ? $this.height() : $this.children("img").height();
  2344. } else {
  2345. container_height = $this.height() > 0 ? $this.height() : 500;
  2346. }
  2347. var $img = $this.children("img").first();
  2348. var img_height = $img.height();
  2349. var parallax_dist = img_height - container_height;
  2350. var bottom = $this.offset().top + container_height;
  2351. var top = $this.offset().top;
  2352. var scrollTop = $(window).scrollTop();
  2353. var windowHeight = window.innerHeight;
  2354. var windowBottom = scrollTop + windowHeight;
  2355. var percentScrolled = (windowBottom - top) / (container_height + windowHeight);
  2356. var parallax = Math.round(parallax_dist * percentScrolled);
  2357. if (initial) {
  2358. $img.css('display', 'block');
  2359. }
  2360. if (bottom > scrollTop && top < scrollTop + windowHeight) {
  2361. $img.css('transform', "translate3D(-50%," + parallax + "px, 0)");
  2362. }
  2363. }
  2364. // Wait for image load
  2365. $this.children("img").one("load", function () {
  2366. updateParallax(true);
  2367. }).each(function () {
  2368. if (this.complete) $(this).trigger("load");
  2369. });
  2370. $(window).scroll(function () {
  2371. window_width = $(window).width();
  2372. updateParallax(false);
  2373. });
  2374. $(window).resize(function () {
  2375. window_width = $(window).width();
  2376. updateParallax(false);
  2377. });
  2378. });
  2379. };
  2380. })(jQuery);
  2381. ;(function ($) {
  2382. var methods = {
  2383. init: function (options) {
  2384. var defaults = {
  2385. onShow: null,
  2386. swipeable: false,
  2387. responsiveThreshold: Infinity // breakpoint for swipeable
  2388. };
  2389. options = $.extend(defaults, options);
  2390. var namespace = Materialize.objectSelectorString($(this));
  2391. return this.each(function (i) {
  2392. var uniqueNamespace = namespace + i;
  2393. // For each set of tabs, we want to keep track of
  2394. // which tab is active and its associated content
  2395. var $this = $(this),
  2396. window_width = $(window).width();
  2397. var $active,
  2398. $content,
  2399. $links = $this.find('li.tab a'),
  2400. $tabs_width = $this.width(),
  2401. $tabs_content = $(),
  2402. $tabs_wrapper,
  2403. $tab_width = Math.max($tabs_width, $this[0].scrollWidth) / $links.length,
  2404. $indicator,
  2405. index = 0,
  2406. prev_index = 0,
  2407. clicked = false,
  2408. clickedTimeout,
  2409. transition = 300;
  2410. // Finds right attribute for indicator based on active tab.
  2411. // el: jQuery Object
  2412. var calcRightPos = function (el) {
  2413. return Math.ceil($tabs_width - el.position().left - el[0].getBoundingClientRect().width - $this.scrollLeft());
  2414. };
  2415. // Finds left attribute for indicator based on active tab.
  2416. // el: jQuery Object
  2417. var calcLeftPos = function (el) {
  2418. return Math.floor(el.position().left + $this.scrollLeft());
  2419. };
  2420. // Animates Indicator to active tab.
  2421. // prev_index: Number
  2422. var animateIndicator = function (prev_index) {
  2423. if (index - prev_index >= 0) {
  2424. $indicator.velocity({ "right": calcRightPos($active) }, { duration: transition, queue: false, easing: 'easeOutQuad' });
  2425. $indicator.velocity({ "left": calcLeftPos($active) }, { duration: transition, queue: false, easing: 'easeOutQuad', delay: 90 });
  2426. } else {
  2427. $indicator.velocity({ "left": calcLeftPos($active) }, { duration: transition, queue: false, easing: 'easeOutQuad' });
  2428. $indicator.velocity({ "right": calcRightPos($active) }, { duration: transition, queue: false, easing: 'easeOutQuad', delay: 90 });
  2429. }
  2430. };
  2431. // Change swipeable according to responsive threshold
  2432. if (options.swipeable) {
  2433. if (window_width > options.responsiveThreshold) {
  2434. options.swipeable = false;
  2435. }
  2436. }
  2437. // If the location.hash matches one of the links, use that as the active tab.
  2438. $active = $($links.filter('[href="' + location.hash + '"]'));
  2439. // If no match is found, use the first link or any with class 'active' as the initial active tab.
  2440. if ($active.length === 0) {
  2441. $active = $(this).find('li.tab a.active').first();
  2442. }
  2443. if ($active.length === 0) {
  2444. $active = $(this).find('li.tab a').first();
  2445. }
  2446. $active.addClass('active');
  2447. index = $links.index($active);
  2448. if (index < 0) {
  2449. index = 0;
  2450. }
  2451. if ($active[0] !== undefined) {
  2452. $content = $($active[0].hash);
  2453. $content.addClass('active');
  2454. }
  2455. // append indicator then set indicator width to tab width
  2456. if (!$this.find('.indicator').length) {
  2457. $this.append('<li class="indicator"></li>');
  2458. }
  2459. $indicator = $this.find('.indicator');
  2460. // we make sure that the indicator is at the end of the tabs
  2461. $this.append($indicator);
  2462. if ($this.is(":visible")) {
  2463. // $indicator.css({"right": $tabs_width - ((index + 1) * $tab_width)});
  2464. // $indicator.css({"left": index * $tab_width});
  2465. setTimeout(function () {
  2466. $indicator.css({ "right": calcRightPos($active) });
  2467. $indicator.css({ "left": calcLeftPos($active) });
  2468. }, 0);
  2469. }
  2470. $(window).off('resize.tabs-' + uniqueNamespace).on('resize.tabs-' + uniqueNamespace, function () {
  2471. $tabs_width = $this.width();
  2472. $tab_width = Math.max($tabs_width, $this[0].scrollWidth) / $links.length;
  2473. if (index < 0) {
  2474. index = 0;
  2475. }
  2476. if ($tab_width !== 0 && $tabs_width !== 0) {
  2477. $indicator.css({ "right": calcRightPos($active) });
  2478. $indicator.css({ "left": calcLeftPos($active) });
  2479. }
  2480. });
  2481. // Initialize Tabs Content.
  2482. if (options.swipeable) {
  2483. // TODO: Duplicate calls with swipeable? handle multiple div wrapping.
  2484. $links.each(function () {
  2485. var $curr_content = $(Materialize.escapeHash(this.hash));
  2486. $curr_content.addClass('carousel-item');
  2487. $tabs_content = $tabs_content.add($curr_content);
  2488. });
  2489. $tabs_wrapper = $tabs_content.wrapAll('<div class="tabs-content carousel"></div>');
  2490. $tabs_content.css('display', '');
  2491. $('.tabs-content.carousel').carousel({
  2492. fullWidth: true,
  2493. noWrap: true,
  2494. onCycleTo: function (item) {
  2495. if (!clicked) {
  2496. var prev_index = index;
  2497. index = $tabs_wrapper.index(item);
  2498. $active.removeClass('active');
  2499. $active = $links.eq(index);
  2500. $active.addClass('active');
  2501. animateIndicator(prev_index);
  2502. if (typeof options.onShow === "function") {
  2503. options.onShow.call($this[0], $content);
  2504. }
  2505. }
  2506. }
  2507. });
  2508. } else {
  2509. // Hide the remaining content
  2510. $links.not($active).each(function () {
  2511. $(Materialize.escapeHash(this.hash)).hide();
  2512. });
  2513. }
  2514. // Bind the click event handler
  2515. $this.off('click.tabs').on('click.tabs', 'a', function (e) {
  2516. if ($(this).parent().hasClass('disabled')) {
  2517. e.preventDefault();
  2518. return;
  2519. }
  2520. // Act as regular link if target attribute is specified.
  2521. if (!!$(this).attr("target")) {
  2522. return;
  2523. }
  2524. clicked = true;
  2525. $tabs_width = $this.width();
  2526. $tab_width = Math.max($tabs_width, $this[0].scrollWidth) / $links.length;
  2527. // Make the old tab inactive.
  2528. $active.removeClass('active');
  2529. var $oldContent = $content;
  2530. // Update the variables with the new link and content
  2531. $active = $(this);
  2532. $content = $(Materialize.escapeHash(this.hash));
  2533. $links = $this.find('li.tab a');
  2534. var activeRect = $active.position();
  2535. // Make the tab active.
  2536. $active.addClass('active');
  2537. prev_index = index;
  2538. index = $links.index($(this));
  2539. if (index < 0) {
  2540. index = 0;
  2541. }
  2542. // Change url to current tab
  2543. // window.location.hash = $active.attr('href');
  2544. // Swap content
  2545. if (options.swipeable) {
  2546. if ($tabs_content.length) {
  2547. $tabs_content.carousel('set', index, function () {
  2548. if (typeof options.onShow === "function") {
  2549. options.onShow.call($this[0], $content);
  2550. }
  2551. });
  2552. }
  2553. } else {
  2554. if ($content !== undefined) {
  2555. $content.show();
  2556. $content.addClass('active');
  2557. if (typeof options.onShow === "function") {
  2558. options.onShow.call(this, $content);
  2559. }
  2560. }
  2561. if ($oldContent !== undefined && !$oldContent.is($content)) {
  2562. $oldContent.hide();
  2563. $oldContent.removeClass('active');
  2564. }
  2565. }
  2566. // Reset clicked state
  2567. clickedTimeout = setTimeout(function () {
  2568. clicked = false;
  2569. }, transition);
  2570. // Update indicator
  2571. animateIndicator(prev_index);
  2572. // Prevent the anchor's default click action
  2573. e.preventDefault();
  2574. });
  2575. });
  2576. },
  2577. select_tab: function (id) {
  2578. this.find('a[href="#' + id + '"]').trigger('click');
  2579. }
  2580. };
  2581. $.fn.tabs = function (methodOrOptions) {
  2582. if (methods[methodOrOptions]) {
  2583. return methods[methodOrOptions].apply(this, Array.prototype.slice.call(arguments, 1));
  2584. } else if (typeof methodOrOptions === 'object' || !methodOrOptions) {
  2585. // Default to "init"
  2586. return methods.init.apply(this, arguments);
  2587. } else {
  2588. $.error('Method ' + methodOrOptions + ' does not exist on jQuery.tabs');
  2589. }
  2590. };
  2591. $(document).ready(function () {
  2592. $('ul.tabs').tabs();
  2593. });
  2594. })(jQuery);
  2595. ;(function ($) {
  2596. $.fn.tooltip = function (options) {
  2597. var timeout = null,
  2598. margin = 5;
  2599. // Defaults
  2600. var defaults = {
  2601. delay: 350,
  2602. tooltip: '',
  2603. position: 'bottom',
  2604. html: false
  2605. };
  2606. // Remove tooltip from the activator
  2607. if (options === "remove") {
  2608. this.each(function () {
  2609. $('#' + $(this).attr('data-tooltip-id')).remove();
  2610. $(this).removeAttr('data-tooltip-id');
  2611. $(this).off('mouseenter.tooltip mouseleave.tooltip');
  2612. });
  2613. return false;
  2614. }
  2615. options = $.extend(defaults, options);
  2616. return this.each(function () {
  2617. var tooltipId = Materialize.guid();
  2618. var origin = $(this);
  2619. // Destroy old tooltip
  2620. if (origin.attr('data-tooltip-id')) {
  2621. $('#' + origin.attr('data-tooltip-id')).remove();
  2622. }
  2623. origin.attr('data-tooltip-id', tooltipId);
  2624. // Get attributes.
  2625. var allowHtml, tooltipDelay, tooltipPosition, tooltipText, tooltipEl, backdrop;
  2626. var setAttributes = function () {
  2627. allowHtml = origin.attr('data-html') ? origin.attr('data-html') === 'true' : options.html;
  2628. tooltipDelay = origin.attr('data-delay');
  2629. tooltipDelay = tooltipDelay === undefined || tooltipDelay === '' ? options.delay : tooltipDelay;
  2630. tooltipPosition = origin.attr('data-position');
  2631. tooltipPosition = tooltipPosition === undefined || tooltipPosition === '' ? options.position : tooltipPosition;
  2632. tooltipText = origin.attr('data-tooltip');
  2633. tooltipText = tooltipText === undefined || tooltipText === '' ? options.tooltip : tooltipText;
  2634. };
  2635. setAttributes();
  2636. var renderTooltipEl = function () {
  2637. var tooltip = $('<div class="material-tooltip"></div>');
  2638. // Create Text span
  2639. if (allowHtml) {
  2640. tooltipText = $('<span></span>').html(tooltipText);
  2641. } else {
  2642. tooltipText = $('<span></span>').text(tooltipText);
  2643. }
  2644. // Create tooltip
  2645. tooltip.append(tooltipText).appendTo($('body')).attr('id', tooltipId);
  2646. // Create backdrop
  2647. backdrop = $('<div class="backdrop"></div>');
  2648. backdrop.appendTo(tooltip);
  2649. return tooltip;
  2650. };
  2651. tooltipEl = renderTooltipEl();
  2652. // Destroy previously binded events
  2653. origin.off('mouseenter.tooltip mouseleave.tooltip');
  2654. // Mouse In
  2655. var started = false,
  2656. timeoutRef;
  2657. origin.on({ 'mouseenter.tooltip': function (e) {
  2658. var showTooltip = function () {
  2659. setAttributes();
  2660. started = true;
  2661. tooltipEl.velocity('stop');
  2662. backdrop.velocity('stop');
  2663. tooltipEl.css({ visibility: 'visible', left: '0px', top: '0px' });
  2664. // Tooltip positioning
  2665. var originWidth = origin.outerWidth();
  2666. var originHeight = origin.outerHeight();
  2667. var tooltipHeight = tooltipEl.outerHeight();
  2668. var tooltipWidth = tooltipEl.outerWidth();
  2669. var tooltipVerticalMovement = '0px';
  2670. var tooltipHorizontalMovement = '0px';
  2671. var backdropOffsetWidth = backdrop[0].offsetWidth;
  2672. var backdropOffsetHeight = backdrop[0].offsetHeight;
  2673. var scaleXFactor = 8;
  2674. var scaleYFactor = 8;
  2675. var scaleFactor = 0;
  2676. var targetTop, targetLeft, newCoordinates;
  2677. if (tooltipPosition === "top") {
  2678. // Top Position
  2679. targetTop = origin.offset().top - tooltipHeight - margin;
  2680. targetLeft = origin.offset().left + originWidth / 2 - tooltipWidth / 2;
  2681. newCoordinates = repositionWithinScreen(targetLeft, targetTop, tooltipWidth, tooltipHeight);
  2682. tooltipVerticalMovement = '-10px';
  2683. backdrop.css({
  2684. bottom: 0,
  2685. left: 0,
  2686. borderRadius: '14px 14px 0 0',
  2687. transformOrigin: '50% 100%',
  2688. marginTop: tooltipHeight,
  2689. marginLeft: tooltipWidth / 2 - backdropOffsetWidth / 2
  2690. });
  2691. }
  2692. // Left Position
  2693. else if (tooltipPosition === "left") {
  2694. targetTop = origin.offset().top + originHeight / 2 - tooltipHeight / 2;
  2695. targetLeft = origin.offset().left - tooltipWidth - margin;
  2696. newCoordinates = repositionWithinScreen(targetLeft, targetTop, tooltipWidth, tooltipHeight);
  2697. tooltipHorizontalMovement = '-10px';
  2698. backdrop.css({
  2699. top: '-7px',
  2700. right: 0,
  2701. width: '14px',
  2702. height: '14px',
  2703. borderRadius: '14px 0 0 14px',
  2704. transformOrigin: '95% 50%',
  2705. marginTop: tooltipHeight / 2,
  2706. marginLeft: tooltipWidth
  2707. });
  2708. }
  2709. // Right Position
  2710. else if (tooltipPosition === "right") {
  2711. targetTop = origin.offset().top + originHeight / 2 - tooltipHeight / 2;
  2712. targetLeft = origin.offset().left + originWidth + margin;
  2713. newCoordinates = repositionWithinScreen(targetLeft, targetTop, tooltipWidth, tooltipHeight);
  2714. tooltipHorizontalMovement = '+10px';
  2715. backdrop.css({
  2716. top: '-7px',
  2717. left: 0,
  2718. width: '14px',
  2719. height: '14px',
  2720. borderRadius: '0 14px 14px 0',
  2721. transformOrigin: '5% 50%',
  2722. marginTop: tooltipHeight / 2,
  2723. marginLeft: '0px'
  2724. });
  2725. } else {
  2726. // Bottom Position
  2727. targetTop = origin.offset().top + origin.outerHeight() + margin;
  2728. targetLeft = origin.offset().left + originWidth / 2 - tooltipWidth / 2;
  2729. newCoordinates = repositionWithinScreen(targetLeft, targetTop, tooltipWidth, tooltipHeight);
  2730. tooltipVerticalMovement = '+10px';
  2731. backdrop.css({
  2732. top: 0,
  2733. left: 0,
  2734. marginLeft: tooltipWidth / 2 - backdropOffsetWidth / 2
  2735. });
  2736. }
  2737. // Set tooptip css placement
  2738. tooltipEl.css({
  2739. top: newCoordinates.y,
  2740. left: newCoordinates.x
  2741. });
  2742. // Calculate Scale to fill
  2743. scaleXFactor = Math.SQRT2 * tooltipWidth / parseInt(backdropOffsetWidth);
  2744. scaleYFactor = Math.SQRT2 * tooltipHeight / parseInt(backdropOffsetHeight);
  2745. scaleFactor = Math.max(scaleXFactor, scaleYFactor);
  2746. tooltipEl.velocity({ translateY: tooltipVerticalMovement, translateX: tooltipHorizontalMovement }, { duration: 350, queue: false }).velocity({ opacity: 1 }, { duration: 300, delay: 50, queue: false });
  2747. backdrop.css({ visibility: 'visible' }).velocity({ opacity: 1 }, { duration: 55, delay: 0, queue: false }).velocity({ scaleX: scaleFactor, scaleY: scaleFactor }, { duration: 300, delay: 0, queue: false, easing: 'easeInOutQuad' });
  2748. };
  2749. timeoutRef = setTimeout(showTooltip, tooltipDelay); // End Interval
  2750. // Mouse Out
  2751. },
  2752. 'mouseleave.tooltip': function () {
  2753. // Reset State
  2754. started = false;
  2755. clearTimeout(timeoutRef);
  2756. // Animate back
  2757. setTimeout(function () {
  2758. if (started !== true) {
  2759. tooltipEl.velocity({
  2760. opacity: 0, translateY: 0, translateX: 0 }, { duration: 225, queue: false });
  2761. backdrop.velocity({ opacity: 0, scaleX: 1, scaleY: 1 }, {
  2762. duration: 225,
  2763. queue: false,
  2764. complete: function () {
  2765. backdrop.css({ visibility: 'hidden' });
  2766. tooltipEl.css({ visibility: 'hidden' });
  2767. started = false;
  2768. }
  2769. });
  2770. }
  2771. }, 225);
  2772. }
  2773. });
  2774. });
  2775. };
  2776. var repositionWithinScreen = function (x, y, width, height) {
  2777. var newX = x;
  2778. var newY = y;
  2779. if (newX < 0) {
  2780. newX = 4;
  2781. } else if (newX + width > window.innerWidth) {
  2782. newX -= newX + width - window.innerWidth;
  2783. }
  2784. if (newY < 0) {
  2785. newY = 4;
  2786. } else if (newY + height > window.innerHeight + $(window).scrollTop) {
  2787. newY -= newY + height - window.innerHeight;
  2788. }
  2789. return { x: newX, y: newY };
  2790. };
  2791. $(document).ready(function () {
  2792. $('.tooltipped').tooltip();
  2793. });
  2794. })(jQuery);
  2795. ; /*!
  2796. * Waves v0.6.4
  2797. * http://fian.my.id/Waves
  2798. *
  2799. * Copyright 2014 Alfiana E. Sibuea and other contributors
  2800. * Released under the MIT license
  2801. * https://github.com/fians/Waves/blob/master/LICENSE
  2802. */
  2803. ;(function (window) {
  2804. 'use strict';
  2805. var Waves = Waves || {};
  2806. var $$ = document.querySelectorAll.bind(document);
  2807. // Find exact position of element
  2808. function isWindow(obj) {
  2809. return obj !== null && obj === obj.window;
  2810. }
  2811. function getWindow(elem) {
  2812. return isWindow(elem) ? elem : elem.nodeType === 9 && elem.defaultView;
  2813. }
  2814. function offset(elem) {
  2815. var docElem,
  2816. win,
  2817. box = { top: 0, left: 0 },
  2818. doc = elem && elem.ownerDocument;
  2819. docElem = doc.documentElement;
  2820. if (typeof elem.getBoundingClientRect !== typeof undefined) {
  2821. box = elem.getBoundingClientRect();
  2822. }
  2823. win = getWindow(doc);
  2824. return {
  2825. top: box.top + win.pageYOffset - docElem.clientTop,
  2826. left: box.left + win.pageXOffset - docElem.clientLeft
  2827. };
  2828. }
  2829. function convertStyle(obj) {
  2830. var style = '';
  2831. for (var a in obj) {
  2832. if (obj.hasOwnProperty(a)) {
  2833. style += a + ':' + obj[a] + ';';
  2834. }
  2835. }
  2836. return style;
  2837. }
  2838. var Effect = {
  2839. // Effect delay
  2840. duration: 750,
  2841. show: function (e, element) {
  2842. // Disable right click
  2843. if (e.button === 2) {
  2844. return false;
  2845. }
  2846. var el = element || this;
  2847. // Create ripple
  2848. var ripple = document.createElement('div');
  2849. ripple.className = 'waves-ripple';
  2850. el.appendChild(ripple);
  2851. // Get click coordinate and element witdh
  2852. var pos = offset(el);
  2853. var relativeY = e.pageY - pos.top;
  2854. var relativeX = e.pageX - pos.left;
  2855. var scale = 'scale(' + el.clientWidth / 100 * 10 + ')';
  2856. // Support for touch devices
  2857. if ('touches' in e) {
  2858. relativeY = e.touches[0].pageY - pos.top;
  2859. relativeX = e.touches[0].pageX - pos.left;
  2860. }
  2861. // Attach data to element
  2862. ripple.setAttribute('data-hold', Date.now());
  2863. ripple.setAttribute('data-scale', scale);
  2864. ripple.setAttribute('data-x', relativeX);
  2865. ripple.setAttribute('data-y', relativeY);
  2866. // Set ripple position
  2867. var rippleStyle = {
  2868. 'top': relativeY + 'px',
  2869. 'left': relativeX + 'px'
  2870. };
  2871. ripple.className = ripple.className + ' waves-notransition';
  2872. ripple.setAttribute('style', convertStyle(rippleStyle));
  2873. ripple.className = ripple.className.replace('waves-notransition', '');
  2874. // Scale the ripple
  2875. rippleStyle['-webkit-transform'] = scale;
  2876. rippleStyle['-moz-transform'] = scale;
  2877. rippleStyle['-ms-transform'] = scale;
  2878. rippleStyle['-o-transform'] = scale;
  2879. rippleStyle.transform = scale;
  2880. rippleStyle.opacity = '1';
  2881. rippleStyle['-webkit-transition-duration'] = Effect.duration + 'ms';
  2882. rippleStyle['-moz-transition-duration'] = Effect.duration + 'ms';
  2883. rippleStyle['-o-transition-duration'] = Effect.duration + 'ms';
  2884. rippleStyle['transition-duration'] = Effect.duration + 'ms';
  2885. rippleStyle['-webkit-transition-timing-function'] = 'cubic-bezier(0.250, 0.460, 0.450, 0.940)';
  2886. rippleStyle['-moz-transition-timing-function'] = 'cubic-bezier(0.250, 0.460, 0.450, 0.940)';
  2887. rippleStyle['-o-transition-timing-function'] = 'cubic-bezier(0.250, 0.460, 0.450, 0.940)';
  2888. rippleStyle['transition-timing-function'] = 'cubic-bezier(0.250, 0.460, 0.450, 0.940)';
  2889. ripple.setAttribute('style', convertStyle(rippleStyle));
  2890. },
  2891. hide: function (e) {
  2892. TouchHandler.touchup(e);
  2893. var el = this;
  2894. var width = el.clientWidth * 1.4;
  2895. // Get first ripple
  2896. var ripple = null;
  2897. var ripples = el.getElementsByClassName('waves-ripple');
  2898. if (ripples.length > 0) {
  2899. ripple = ripples[ripples.length - 1];
  2900. } else {
  2901. return false;
  2902. }
  2903. var relativeX = ripple.getAttribute('data-x');
  2904. var relativeY = ripple.getAttribute('data-y');
  2905. var scale = ripple.getAttribute('data-scale');
  2906. // Get delay beetween mousedown and mouse leave
  2907. var diff = Date.now() - Number(ripple.getAttribute('data-hold'));
  2908. var delay = 350 - diff;
  2909. if (delay < 0) {
  2910. delay = 0;
  2911. }
  2912. // Fade out ripple after delay
  2913. setTimeout(function () {
  2914. var style = {
  2915. 'top': relativeY + 'px',
  2916. 'left': relativeX + 'px',
  2917. 'opacity': '0',
  2918. // Duration
  2919. '-webkit-transition-duration': Effect.duration + 'ms',
  2920. '-moz-transition-duration': Effect.duration + 'ms',
  2921. '-o-transition-duration': Effect.duration + 'ms',
  2922. 'transition-duration': Effect.duration + 'ms',
  2923. '-webkit-transform': scale,
  2924. '-moz-transform': scale,
  2925. '-ms-transform': scale,
  2926. '-o-transform': scale,
  2927. 'transform': scale
  2928. };
  2929. ripple.setAttribute('style', convertStyle(style));
  2930. setTimeout(function () {
  2931. try {
  2932. el.removeChild(ripple);
  2933. } catch (e) {
  2934. return false;
  2935. }
  2936. }, Effect.duration);
  2937. }, delay);
  2938. },
  2939. // Little hack to make <input> can perform waves effect
  2940. wrapInput: function (elements) {
  2941. for (var a = 0; a < elements.length; a++) {
  2942. var el = elements[a];
  2943. if (el.tagName.toLowerCase() === 'input') {
  2944. var parent = el.parentNode;
  2945. // If input already have parent just pass through
  2946. if (parent.tagName.toLowerCase() === 'i' && parent.className.indexOf('waves-effect') !== -1) {
  2947. continue;
  2948. }
  2949. // Put element class and style to the specified parent
  2950. var wrapper = document.createElement('i');
  2951. wrapper.className = el.className + ' waves-input-wrapper';
  2952. var elementStyle = el.getAttribute('style');
  2953. if (!elementStyle) {
  2954. elementStyle = '';
  2955. }
  2956. wrapper.setAttribute('style', elementStyle);
  2957. el.className = 'waves-button-input';
  2958. el.removeAttribute('style');
  2959. // Put element as child
  2960. parent.replaceChild(wrapper, el);
  2961. wrapper.appendChild(el);
  2962. }
  2963. }
  2964. }
  2965. };
  2966. /**
  2967. * Disable mousedown event for 500ms during and after touch
  2968. */
  2969. var TouchHandler = {
  2970. /* uses an integer rather than bool so there's no issues with
  2971. * needing to clear timeouts if another touch event occurred
  2972. * within the 500ms. Cannot mouseup between touchstart and
  2973. * touchend, nor in the 500ms after touchend. */
  2974. touches: 0,
  2975. allowEvent: function (e) {
  2976. var allow = true;
  2977. if (e.type === 'touchstart') {
  2978. TouchHandler.touches += 1; //push
  2979. } else if (e.type === 'touchend' || e.type === 'touchcancel') {
  2980. setTimeout(function () {
  2981. if (TouchHandler.touches > 0) {
  2982. TouchHandler.touches -= 1; //pop after 500ms
  2983. }
  2984. }, 500);
  2985. } else if (e.type === 'mousedown' && TouchHandler.touches > 0) {
  2986. allow = false;
  2987. }
  2988. return allow;
  2989. },
  2990. touchup: function (e) {
  2991. TouchHandler.allowEvent(e);
  2992. }
  2993. };
  2994. /**
  2995. * Delegated click handler for .waves-effect element.
  2996. * returns null when .waves-effect element not in "click tree"
  2997. */
  2998. function getWavesEffectElement(e) {
  2999. if (TouchHandler.allowEvent(e) === false) {
  3000. return null;
  3001. }
  3002. var element = null;
  3003. var target = e.target || e.srcElement;
  3004. while (target.parentNode !== null) {
  3005. if (!(target instanceof SVGElement) && target.className.indexOf('waves-effect') !== -1) {
  3006. element = target;
  3007. break;
  3008. }
  3009. target = target.parentNode;
  3010. }
  3011. return element;
  3012. }
  3013. /**
  3014. * Bubble the click and show effect if .waves-effect elem was found
  3015. */
  3016. function showEffect(e) {
  3017. var element = getWavesEffectElement(e);
  3018. if (element !== null) {
  3019. Effect.show(e, element);
  3020. if ('ontouchstart' in window) {
  3021. element.addEventListener('touchend', Effect.hide, false);
  3022. element.addEventListener('touchcancel', Effect.hide, false);
  3023. }
  3024. element.addEventListener('mouseup', Effect.hide, false);
  3025. element.addEventListener('mouseleave', Effect.hide, false);
  3026. element.addEventListener('dragend', Effect.hide, false);
  3027. }
  3028. }
  3029. Waves.displayEffect = function (options) {
  3030. options = options || {};
  3031. if ('duration' in options) {
  3032. Effect.duration = options.duration;
  3033. }
  3034. //Wrap input inside <i> tag
  3035. Effect.wrapInput($$('.waves-effect'));
  3036. if ('ontouchstart' in window) {
  3037. document.body.addEventListener('touchstart', showEffect, false);
  3038. }
  3039. document.body.addEventListener('mousedown', showEffect, false);
  3040. };
  3041. /**
  3042. * Attach Waves to an input element (or any element which doesn't
  3043. * bubble mouseup/mousedown events).
  3044. * Intended to be used with dynamically loaded forms/inputs, or
  3045. * where the user doesn't want a delegated click handler.
  3046. */
  3047. Waves.attach = function (element) {
  3048. //FUTURE: automatically add waves classes and allow users
  3049. // to specify them with an options param? Eg. light/classic/button
  3050. if (element.tagName.toLowerCase() === 'input') {
  3051. Effect.wrapInput([element]);
  3052. element = element.parentNode;
  3053. }
  3054. if ('ontouchstart' in window) {
  3055. element.addEventListener('touchstart', showEffect, false);
  3056. }
  3057. element.addEventListener('mousedown', showEffect, false);
  3058. };
  3059. window.Waves = Waves;
  3060. document.addEventListener('DOMContentLoaded', function () {
  3061. Waves.displayEffect();
  3062. }, false);
  3063. })(window);
  3064. ;(function ($, Vel) {
  3065. 'use strict';
  3066. var _defaults = {
  3067. displayLength: Infinity,
  3068. inDuration: 300,
  3069. outDuration: 375,
  3070. className: undefined,
  3071. completeCallback: undefined,
  3072. activationPercent: 0.8
  3073. };
  3074. var Toast = function () {
  3075. function Toast(message, displayLength, className, completeCallback) {
  3076. _classCallCheck(this, Toast);
  3077. if (!message) {
  3078. return;
  3079. }
  3080. /**
  3081. * Options for the toast
  3082. * @member Toast#options
  3083. */
  3084. this.options = {
  3085. displayLength: displayLength,
  3086. className: className,
  3087. completeCallback: completeCallback
  3088. };
  3089. this.options = $.extend({}, Toast.defaults, this.options);
  3090. this.message = message;
  3091. /**
  3092. * Describes current pan state toast
  3093. * @type {Boolean}
  3094. */
  3095. this.panning = false;
  3096. /**
  3097. * Time remaining until toast is removed
  3098. */
  3099. this.timeRemaining = this.options.displayLength;
  3100. if (Toast._toasts.length === 0) {
  3101. Toast._createContainer();
  3102. }
  3103. // Create new toast
  3104. Toast._toasts.push(this);
  3105. var toastElement = this.createToast();
  3106. toastElement.M_Toast = this;
  3107. this.el = toastElement;
  3108. this._animateIn();
  3109. this.setTimer();
  3110. }
  3111. _createClass(Toast, [{
  3112. key: 'createToast',
  3113. /**
  3114. * Create toast and append it to toast container
  3115. */
  3116. value: function createToast() {
  3117. var toast = document.createElement('div');
  3118. toast.classList.add('toast');
  3119. // Add custom classes onto toast
  3120. if (this.options.className) {
  3121. var classes = this.options.className.split(' ');
  3122. var i = void 0,
  3123. count = void 0;
  3124. for (i = 0, count = classes.length; i < count; i++) {
  3125. toast.classList.add(classes[i]);
  3126. }
  3127. }
  3128. // Set content
  3129. if (typeof HTMLElement === 'object' ? this.message instanceof HTMLElement : this.message && typeof this.message === 'object' && this.message !== null && this.message.nodeType === 1 && typeof this.message.nodeName === 'string') {
  3130. toast.appendChild(this.message);
  3131. // Check if it is jQuery object
  3132. } else if (this.message instanceof jQuery) {
  3133. $(toast).append(this.message);
  3134. // Insert as text;
  3135. } else {
  3136. toast.innerHTML = this.message;
  3137. }
  3138. // Append toasft
  3139. Toast._container.appendChild(toast);
  3140. return toast;
  3141. }
  3142. /**
  3143. * Animate in toast
  3144. */
  3145. }, {
  3146. key: '_animateIn',
  3147. value: function _animateIn() {
  3148. // Animate toast in
  3149. Vel(this.el, { top: 0, opacity: 1 }, {
  3150. duration: 300,
  3151. easing: 'easeOutCubic',
  3152. queue: false
  3153. });
  3154. }
  3155. /**
  3156. * Create setInterval which automatically removes toast when timeRemaining >= 0
  3157. * has been reached
  3158. */
  3159. }, {
  3160. key: 'setTimer',
  3161. value: function setTimer() {
  3162. var _this3 = this;
  3163. if (this.timeRemaining !== Infinity) {
  3164. this.counterInterval = setInterval(function () {
  3165. // If toast is not being dragged, decrease its time remaining
  3166. if (!_this3.panning) {
  3167. _this3.timeRemaining -= 20;
  3168. }
  3169. // Animate toast out
  3170. if (_this3.timeRemaining <= 0) {
  3171. _this3.remove();
  3172. }
  3173. }, 20);
  3174. }
  3175. }
  3176. /**
  3177. * Dismiss toast with animation
  3178. */
  3179. }, {
  3180. key: 'remove',
  3181. value: function remove() {
  3182. var _this4 = this;
  3183. window.clearInterval(this.counterInterval);
  3184. var activationDistance = this.el.offsetWidth * this.options.activationPercent;
  3185. if (this.wasSwiped) {
  3186. this.el.style.transition = 'transform .05s, opacity .05s';
  3187. this.el.style.transform = 'translateX(' + activationDistance + 'px)';
  3188. this.el.style.opacity = 0;
  3189. }
  3190. Vel(this.el, { opacity: 0, marginTop: '-40px' }, {
  3191. duration: this.options.outDuration,
  3192. easing: 'easeOutExpo',
  3193. queue: false,
  3194. complete: function () {
  3195. // Call the optional callback
  3196. if (typeof _this4.options.completeCallback === 'function') {
  3197. _this4.options.completeCallback();
  3198. }
  3199. // Remove toast from DOM
  3200. _this4.el.parentNode.removeChild(_this4.el);
  3201. Toast._toasts.splice(Toast._toasts.indexOf(_this4), 1);
  3202. if (Toast._toasts.length === 0) {
  3203. Toast._removeContainer();
  3204. }
  3205. }
  3206. });
  3207. }
  3208. }], [{
  3209. key: '_createContainer',
  3210. /**
  3211. * Append toast container and add event handlers
  3212. */
  3213. value: function _createContainer() {
  3214. var container = document.createElement('div');
  3215. container.setAttribute('id', 'toast-container');
  3216. // Add event handler
  3217. container.addEventListener('touchstart', Toast._onDragStart);
  3218. container.addEventListener('touchmove', Toast._onDragMove);
  3219. container.addEventListener('touchend', Toast._onDragEnd);
  3220. container.addEventListener('mousedown', Toast._onDragStart);
  3221. document.addEventListener('mousemove', Toast._onDragMove);
  3222. document.addEventListener('mouseup', Toast._onDragEnd);
  3223. document.body.appendChild(container);
  3224. Toast._container = container;
  3225. }
  3226. /**
  3227. * Remove toast container and event handlers
  3228. */
  3229. }, {
  3230. key: '_removeContainer',
  3231. value: function _removeContainer() {
  3232. // Add event handler
  3233. document.removeEventListener('mousemove', Toast._onDragMove);
  3234. document.removeEventListener('mouseup', Toast._onDragEnd);
  3235. Toast._container.parentNode.removeChild(Toast._container);
  3236. Toast._container = null;
  3237. }
  3238. /**
  3239. * Begin drag handler
  3240. * @param {Event} e
  3241. */
  3242. }, {
  3243. key: '_onDragStart',
  3244. value: function _onDragStart(e) {
  3245. if (e.target && $(e.target).closest('.toast').length) {
  3246. var $toast = $(e.target).closest('.toast');
  3247. var toast = $toast[0].M_Toast;
  3248. toast.panning = true;
  3249. Toast._draggedToast = toast;
  3250. toast.el.classList.add('panning');
  3251. toast.el.style.transition = '';
  3252. toast.startingXPos = Toast._xPos(e);
  3253. toast.time = Date.now();
  3254. toast.xPos = Toast._xPos(e);
  3255. }
  3256. }
  3257. /**
  3258. * Drag move handler
  3259. * @param {Event} e
  3260. */
  3261. }, {
  3262. key: '_onDragMove',
  3263. value: function _onDragMove(e) {
  3264. if (!!Toast._draggedToast) {
  3265. e.preventDefault();
  3266. var toast = Toast._draggedToast;
  3267. toast.deltaX = Math.abs(toast.xPos - Toast._xPos(e));
  3268. toast.xPos = Toast._xPos(e);
  3269. toast.velocityX = toast.deltaX / (Date.now() - toast.time);
  3270. toast.time = Date.now();
  3271. var totalDeltaX = toast.xPos - toast.startingXPos;
  3272. var activationDistance = toast.el.offsetWidth * toast.options.activationPercent;
  3273. toast.el.style.transform = 'translateX(' + totalDeltaX + 'px)';
  3274. toast.el.style.opacity = 1 - Math.abs(totalDeltaX / activationDistance);
  3275. }
  3276. }
  3277. /**
  3278. * End drag handler
  3279. * @param {Event} e
  3280. */
  3281. }, {
  3282. key: '_onDragEnd',
  3283. value: function _onDragEnd(e) {
  3284. if (!!Toast._draggedToast) {
  3285. var toast = Toast._draggedToast;
  3286. toast.panning = false;
  3287. toast.el.classList.remove('panning');
  3288. var totalDeltaX = toast.xPos - toast.startingXPos;
  3289. var activationDistance = toast.el.offsetWidth * toast.options.activationPercent;
  3290. var shouldBeDismissed = Math.abs(totalDeltaX) > activationDistance || toast.velocityX > 1;
  3291. // Remove toast
  3292. if (shouldBeDismissed) {
  3293. toast.wasSwiped = true;
  3294. toast.remove();
  3295. // Animate toast back to original position
  3296. } else {
  3297. toast.el.style.transition = 'transform .2s, opacity .2s';
  3298. toast.el.style.transform = '';
  3299. toast.el.style.opacity = '';
  3300. }
  3301. Toast._draggedToast = null;
  3302. }
  3303. }
  3304. /**
  3305. * Get x position of mouse or touch event
  3306. * @param {Event} e
  3307. */
  3308. }, {
  3309. key: '_xPos',
  3310. value: function _xPos(e) {
  3311. if (e.targetTouches && e.targetTouches.length >= 1) {
  3312. return e.targetTouches[0].clientX;
  3313. }
  3314. // mouse event
  3315. return e.clientX;
  3316. }
  3317. /**
  3318. * Remove all toasts
  3319. */
  3320. }, {
  3321. key: 'removeAll',
  3322. value: function removeAll() {
  3323. for (var toastIndex in Toast._toasts) {
  3324. Toast._toasts[toastIndex].remove();
  3325. }
  3326. }
  3327. }, {
  3328. key: 'defaults',
  3329. get: function () {
  3330. return _defaults;
  3331. }
  3332. }]);
  3333. return Toast;
  3334. }();
  3335. /**
  3336. * @static
  3337. * @memberof Toast
  3338. * @type {Array.<Toast>}
  3339. */
  3340. Toast._toasts = [];
  3341. /**
  3342. * @static
  3343. * @memberof Toast
  3344. */
  3345. Toast._container = null;
  3346. /**
  3347. * @static
  3348. * @memberof Toast
  3349. * @type {Toast}
  3350. */
  3351. Toast._draggedToast = null;
  3352. Materialize.Toast = Toast;
  3353. Materialize.toast = function (message, displayLength, className, completeCallback) {
  3354. return new Toast(message, displayLength, className, completeCallback);
  3355. };
  3356. })(jQuery, Materialize.Vel);
  3357. ;(function ($) {
  3358. var methods = {
  3359. init: function (options) {
  3360. var defaults = {
  3361. menuWidth: 300,
  3362. edge: 'left',
  3363. closeOnClick: false,
  3364. draggable: true,
  3365. onOpen: null,
  3366. onClose: null
  3367. };
  3368. options = $.extend(defaults, options);
  3369. $(this).each(function () {
  3370. var $this = $(this);
  3371. var menuId = $this.attr('data-activates');
  3372. var menu = $("#" + menuId);
  3373. // Set to width
  3374. if (options.menuWidth != 300) {
  3375. menu.css('width', options.menuWidth);
  3376. }
  3377. // Add Touch Area
  3378. var $dragTarget = $('.drag-target[data-sidenav="' + menuId + '"]');
  3379. if (options.draggable) {
  3380. // Regenerate dragTarget
  3381. if ($dragTarget.length) {
  3382. $dragTarget.remove();
  3383. }
  3384. $dragTarget = $('<div class="drag-target"></div>').attr('data-sidenav', menuId);
  3385. $('body').append($dragTarget);
  3386. } else {
  3387. $dragTarget = $();
  3388. }
  3389. if (options.edge == 'left') {
  3390. menu.css('transform', 'translateX(-100%)');
  3391. $dragTarget.css({ 'left': 0 }); // Add Touch Area
  3392. } else {
  3393. menu.addClass('right-aligned') // Change text-alignment to right
  3394. .css('transform', 'translateX(100%)');
  3395. $dragTarget.css({ 'right': 0 }); // Add Touch Area
  3396. }
  3397. // If fixed sidenav, bring menu out
  3398. if (menu.hasClass('fixed')) {
  3399. if (window.innerWidth > 992) {
  3400. menu.css('transform', 'translateX(0)');
  3401. }
  3402. }
  3403. // Window resize to reset on large screens fixed
  3404. if (menu.hasClass('fixed')) {
  3405. $(window).resize(function () {
  3406. if (window.innerWidth > 992) {
  3407. // Close menu if window is resized bigger than 992 and user has fixed sidenav
  3408. if ($('#sidenav-overlay').length !== 0 && menuOut) {
  3409. removeMenu(true);
  3410. } else {
  3411. // menu.removeAttr('style');
  3412. menu.css('transform', 'translateX(0%)');
  3413. // menu.css('width', options.menuWidth);
  3414. }
  3415. } else if (menuOut === false) {
  3416. if (options.edge === 'left') {
  3417. menu.css('transform', 'translateX(-100%)');
  3418. } else {
  3419. menu.css('transform', 'translateX(100%)');
  3420. }
  3421. }
  3422. });
  3423. }
  3424. // if closeOnClick, then add close event for all a tags in side sideNav
  3425. if (options.closeOnClick === true) {
  3426. menu.on("click.itemclick", "a:not(.collapsible-header)", function () {
  3427. if (!(window.innerWidth > 992 && menu.hasClass('fixed'))) {
  3428. removeMenu();
  3429. }
  3430. });
  3431. }
  3432. var removeMenu = function (restoreNav) {
  3433. panning = false;
  3434. menuOut = false;
  3435. // Reenable scrolling
  3436. $('body').css({
  3437. overflow: '',
  3438. width: ''
  3439. });
  3440. $('#sidenav-overlay').velocity({ opacity: 0 }, { duration: 200,
  3441. queue: false, easing: 'easeOutQuad',
  3442. complete: function () {
  3443. $(this).remove();
  3444. } });
  3445. if (options.edge === 'left') {
  3446. // Reset phantom div
  3447. $dragTarget.css({ width: '', right: '', left: '0' });
  3448. menu.velocity({ 'translateX': '-100%' }, { duration: 200,
  3449. queue: false,
  3450. easing: 'easeOutCubic',
  3451. complete: function () {
  3452. if (restoreNav === true) {
  3453. // Restore Fixed sidenav
  3454. menu.removeAttr('style');
  3455. menu.css('width', options.menuWidth);
  3456. }
  3457. }
  3458. });
  3459. } else {
  3460. // Reset phantom div
  3461. $dragTarget.css({ width: '', right: '0', left: '' });
  3462. menu.velocity({ 'translateX': '100%' }, { duration: 200,
  3463. queue: false,
  3464. easing: 'easeOutCubic',
  3465. complete: function () {
  3466. if (restoreNav === true) {
  3467. // Restore Fixed sidenav
  3468. menu.removeAttr('style');
  3469. menu.css('width', options.menuWidth);
  3470. }
  3471. }
  3472. });
  3473. }
  3474. // Callback
  3475. if (typeof options.onClose === 'function') {
  3476. options.onClose.call(this, menu);
  3477. }
  3478. };
  3479. // Touch Event
  3480. var panning = false;
  3481. var menuOut = false;
  3482. if (options.draggable) {
  3483. $dragTarget.on('click', function () {
  3484. if (menuOut) {
  3485. removeMenu();
  3486. }
  3487. });
  3488. $dragTarget.hammer({
  3489. prevent_default: false
  3490. }).on('pan', function (e) {
  3491. if (e.gesture.pointerType == "touch") {
  3492. var direction = e.gesture.direction;
  3493. var x = e.gesture.center.x;
  3494. var y = e.gesture.center.y;
  3495. var velocityX = e.gesture.velocityX;
  3496. // Vertical scroll bugfix
  3497. if (x === 0 && y === 0) {
  3498. return;
  3499. }
  3500. // Disable Scrolling
  3501. var $body = $('body');
  3502. var $overlay = $('#sidenav-overlay');
  3503. var oldWidth = $body.innerWidth();
  3504. $body.css('overflow', 'hidden');
  3505. $body.width(oldWidth);
  3506. // If overlay does not exist, create one and if it is clicked, close menu
  3507. if ($overlay.length === 0) {
  3508. $overlay = $('<div id="sidenav-overlay"></div>');
  3509. $overlay.css('opacity', 0).click(function () {
  3510. removeMenu();
  3511. });
  3512. // Run 'onOpen' when sidenav is opened via touch/swipe if applicable
  3513. if (typeof options.onOpen === 'function') {
  3514. options.onOpen.call(this, menu);
  3515. }
  3516. $('body').append($overlay);
  3517. }
  3518. // Keep within boundaries
  3519. if (options.edge === 'left') {
  3520. if (x > options.menuWidth) {
  3521. x = options.menuWidth;
  3522. } else if (x < 0) {
  3523. x = 0;
  3524. }
  3525. }
  3526. if (options.edge === 'left') {
  3527. // Left Direction
  3528. if (x < options.menuWidth / 2) {
  3529. menuOut = false;
  3530. }
  3531. // Right Direction
  3532. else if (x >= options.menuWidth / 2) {
  3533. menuOut = true;
  3534. }
  3535. menu.css('transform', 'translateX(' + (x - options.menuWidth) + 'px)');
  3536. } else {
  3537. // Left Direction
  3538. if (x < window.innerWidth - options.menuWidth / 2) {
  3539. menuOut = true;
  3540. }
  3541. // Right Direction
  3542. else if (x >= window.innerWidth - options.menuWidth / 2) {
  3543. menuOut = false;
  3544. }
  3545. var rightPos = x - options.menuWidth / 2;
  3546. if (rightPos < 0) {
  3547. rightPos = 0;
  3548. }
  3549. menu.css('transform', 'translateX(' + rightPos + 'px)');
  3550. }
  3551. // Percentage overlay
  3552. var overlayPerc;
  3553. if (options.edge === 'left') {
  3554. overlayPerc = x / options.menuWidth;
  3555. $overlay.velocity({ opacity: overlayPerc }, { duration: 10, queue: false, easing: 'easeOutQuad' });
  3556. } else {
  3557. overlayPerc = Math.abs((x - window.innerWidth) / options.menuWidth);
  3558. $overlay.velocity({ opacity: overlayPerc }, { duration: 10, queue: false, easing: 'easeOutQuad' });
  3559. }
  3560. }
  3561. }).on('panend', function (e) {
  3562. if (e.gesture.pointerType == "touch") {
  3563. var $overlay = $('#sidenav-overlay');
  3564. var velocityX = e.gesture.velocityX;
  3565. var x = e.gesture.center.x;
  3566. var leftPos = x - options.menuWidth;
  3567. var rightPos = x - options.menuWidth / 2;
  3568. if (leftPos > 0) {
  3569. leftPos = 0;
  3570. }
  3571. if (rightPos < 0) {
  3572. rightPos = 0;
  3573. }
  3574. panning = false;
  3575. if (options.edge === 'left') {
  3576. // If velocityX <= 0.3 then the user is flinging the menu closed so ignore menuOut
  3577. if (menuOut && velocityX <= 0.3 || velocityX < -0.5) {
  3578. // Return menu to open
  3579. if (leftPos !== 0) {
  3580. menu.velocity({ 'translateX': [0, leftPos] }, { duration: 300, queue: false, easing: 'easeOutQuad' });
  3581. }
  3582. $overlay.velocity({ opacity: 1 }, { duration: 50, queue: false, easing: 'easeOutQuad' });
  3583. $dragTarget.css({ width: '50%', right: 0, left: '' });
  3584. menuOut = true;
  3585. } else if (!menuOut || velocityX > 0.3) {
  3586. // Enable Scrolling
  3587. $('body').css({
  3588. overflow: '',
  3589. width: ''
  3590. });
  3591. // Slide menu closed
  3592. menu.velocity({ 'translateX': [-1 * options.menuWidth - 10, leftPos] }, { duration: 200, queue: false, easing: 'easeOutQuad' });
  3593. $overlay.velocity({ opacity: 0 }, { duration: 200, queue: false, easing: 'easeOutQuad',
  3594. complete: function () {
  3595. // Run 'onClose' when sidenav is closed via touch/swipe if applicable
  3596. if (typeof options.onClose === 'function') {
  3597. options.onClose.call(this, menu);
  3598. }
  3599. $(this).remove();
  3600. } });
  3601. $dragTarget.css({ width: '10px', right: '', left: 0 });
  3602. }
  3603. } else {
  3604. if (menuOut && velocityX >= -0.3 || velocityX > 0.5) {
  3605. // Return menu to open
  3606. if (rightPos !== 0) {
  3607. menu.velocity({ 'translateX': [0, rightPos] }, { duration: 300, queue: false, easing: 'easeOutQuad' });
  3608. }
  3609. $overlay.velocity({ opacity: 1 }, { duration: 50, queue: false, easing: 'easeOutQuad' });
  3610. $dragTarget.css({ width: '50%', right: '', left: 0 });
  3611. menuOut = true;
  3612. } else if (!menuOut || velocityX < -0.3) {
  3613. // Enable Scrolling
  3614. $('body').css({
  3615. overflow: '',
  3616. width: ''
  3617. });
  3618. // Slide menu closed
  3619. menu.velocity({ 'translateX': [options.menuWidth + 10, rightPos] }, { duration: 200, queue: false, easing: 'easeOutQuad' });
  3620. $overlay.velocity({ opacity: 0 }, { duration: 200, queue: false, easing: 'easeOutQuad',
  3621. complete: function () {
  3622. // Run 'onClose' when sidenav is closed via touch/swipe if applicable
  3623. if (typeof options.onClose === 'function') {
  3624. options.onClose.call(this, menu);
  3625. }
  3626. $(this).remove();
  3627. } });
  3628. $dragTarget.css({ width: '10px', right: 0, left: '' });
  3629. }
  3630. }
  3631. }
  3632. });
  3633. }
  3634. $this.off('click.sidenav').on('click.sidenav', function () {
  3635. if (menuOut === true) {
  3636. menuOut = false;
  3637. panning = false;
  3638. removeMenu();
  3639. } else {
  3640. // Disable Scrolling
  3641. var $body = $('body');
  3642. var $overlay = $('<div id="sidenav-overlay"></div>');
  3643. var oldWidth = $body.innerWidth();
  3644. $body.css('overflow', 'hidden');
  3645. $body.width(oldWidth);
  3646. // Push current drag target on top of DOM tree
  3647. $('body').append($dragTarget);
  3648. if (options.edge === 'left') {
  3649. $dragTarget.css({ width: '50%', right: 0, left: '' });
  3650. menu.velocity({ 'translateX': [0, -1 * options.menuWidth] }, { duration: 300, queue: false, easing: 'easeOutQuad' });
  3651. } else {
  3652. $dragTarget.css({ width: '50%', right: '', left: 0 });
  3653. menu.velocity({ 'translateX': [0, options.menuWidth] }, { duration: 300, queue: false, easing: 'easeOutQuad' });
  3654. }
  3655. // Overlay close on click
  3656. $overlay.css('opacity', 0).click(function () {
  3657. menuOut = false;
  3658. panning = false;
  3659. removeMenu();
  3660. $overlay.velocity({ opacity: 0 }, { duration: 300, queue: false, easing: 'easeOutQuad',
  3661. complete: function () {
  3662. $(this).remove();
  3663. }
  3664. });
  3665. });
  3666. // Append body
  3667. $('body').append($overlay);
  3668. $overlay.velocity({ opacity: 1 }, { duration: 300, queue: false, easing: 'easeOutQuad',
  3669. complete: function () {
  3670. menuOut = true;
  3671. panning = false;
  3672. }
  3673. });
  3674. // Callback
  3675. if (typeof options.onOpen === 'function') {
  3676. options.onOpen.call(this, menu);
  3677. }
  3678. }
  3679. return false;
  3680. });
  3681. });
  3682. },
  3683. destroy: function () {
  3684. var $overlay = $('#sidenav-overlay');
  3685. var $dragTarget = $('.drag-target[data-sidenav="' + $(this).attr('data-activates') + '"]');
  3686. $overlay.trigger('click');
  3687. $dragTarget.remove();
  3688. $(this).off('click');
  3689. $overlay.remove();
  3690. },
  3691. show: function () {
  3692. this.trigger('click');
  3693. },
  3694. hide: function () {
  3695. $('#sidenav-overlay').trigger('click');
  3696. }
  3697. };
  3698. $.fn.sideNav = function (methodOrOptions) {
  3699. if (methods[methodOrOptions]) {
  3700. return methods[methodOrOptions].apply(this, Array.prototype.slice.call(arguments, 1));
  3701. } else if (typeof methodOrOptions === 'object' || !methodOrOptions) {
  3702. // Default to "init"
  3703. return methods.init.apply(this, arguments);
  3704. } else {
  3705. $.error('Method ' + methodOrOptions + ' does not exist on jQuery.sideNav');
  3706. }
  3707. }; // Plugin end
  3708. })(jQuery);
  3709. ; /**
  3710. * Extend jquery with a scrollspy plugin.
  3711. * This watches the window scroll and fires events when elements are scrolled into viewport.
  3712. *
  3713. * throttle() and getTime() taken from Underscore.js
  3714. * https://github.com/jashkenas/underscore
  3715. *
  3716. * @author Copyright 2013 John Smart
  3717. * @license https://raw.github.com/thesmart/jquery-scrollspy/master/LICENSE
  3718. * @see https://github.com/thesmart
  3719. * @version 0.1.2
  3720. */
  3721. (function ($) {
  3722. var jWindow = $(window);
  3723. var elements = [];
  3724. var elementsInView = [];
  3725. var isSpying = false;
  3726. var ticks = 0;
  3727. var unique_id = 1;
  3728. var offset = {
  3729. top: 0,
  3730. right: 0,
  3731. bottom: 0,
  3732. left: 0
  3733. /**
  3734. * Find elements that are within the boundary
  3735. * @param {number} top
  3736. * @param {number} right
  3737. * @param {number} bottom
  3738. * @param {number} left
  3739. * @return {jQuery} A collection of elements
  3740. */
  3741. };function findElements(top, right, bottom, left) {
  3742. var hits = $();
  3743. $.each(elements, function (i, element) {
  3744. if (element.height() > 0) {
  3745. var elTop = element.offset().top,
  3746. elLeft = element.offset().left,
  3747. elRight = elLeft + element.width(),
  3748. elBottom = elTop + element.height();
  3749. var isIntersect = !(elLeft > right || elRight < left || elTop > bottom || elBottom < top);
  3750. if (isIntersect) {
  3751. hits.push(element);
  3752. }
  3753. }
  3754. });
  3755. return hits;
  3756. }
  3757. /**
  3758. * Called when the user scrolls the window
  3759. */
  3760. function onScroll(scrollOffset) {
  3761. // unique tick id
  3762. ++ticks;
  3763. // viewport rectangle
  3764. var top = jWindow.scrollTop(),
  3765. left = jWindow.scrollLeft(),
  3766. right = left + jWindow.width(),
  3767. bottom = top + jWindow.height();
  3768. // determine which elements are in view
  3769. var intersections = findElements(top + offset.top + scrollOffset || 200, right + offset.right, bottom + offset.bottom, left + offset.left);
  3770. $.each(intersections, function (i, element) {
  3771. var lastTick = element.data('scrollSpy:ticks');
  3772. if (typeof lastTick != 'number') {
  3773. // entered into view
  3774. element.triggerHandler('scrollSpy:enter');
  3775. }
  3776. // update tick id
  3777. element.data('scrollSpy:ticks', ticks);
  3778. });
  3779. // determine which elements are no longer in view
  3780. $.each(elementsInView, function (i, element) {
  3781. var lastTick = element.data('scrollSpy:ticks');
  3782. if (typeof lastTick == 'number' && lastTick !== ticks) {
  3783. // exited from view
  3784. element.triggerHandler('scrollSpy:exit');
  3785. element.data('scrollSpy:ticks', null);
  3786. }
  3787. });
  3788. // remember elements in view for next tick
  3789. elementsInView = intersections;
  3790. }
  3791. /**
  3792. * Called when window is resized
  3793. */
  3794. function onWinSize() {
  3795. jWindow.trigger('scrollSpy:winSize');
  3796. }
  3797. /**
  3798. * Enables ScrollSpy using a selector
  3799. * @param {jQuery|string} selector The elements collection, or a selector
  3800. * @param {Object=} options Optional.
  3801. throttle : number -> scrollspy throttling. Default: 100 ms
  3802. offsetTop : number -> offset from top. Default: 0
  3803. offsetRight : number -> offset from right. Default: 0
  3804. offsetBottom : number -> offset from bottom. Default: 0
  3805. offsetLeft : number -> offset from left. Default: 0
  3806. activeClass : string -> Class name to be added to the active link. Default: active
  3807. * @returns {jQuery}
  3808. */
  3809. $.scrollSpy = function (selector, options) {
  3810. var defaults = {
  3811. throttle: 100,
  3812. scrollOffset: 200, // offset - 200 allows elements near bottom of page to scroll
  3813. activeClass: 'active',
  3814. getActiveElement: function (id) {
  3815. return 'a[href="#' + id + '"]';
  3816. }
  3817. };
  3818. options = $.extend(defaults, options);
  3819. var visible = [];
  3820. selector = $(selector);
  3821. selector.each(function (i, element) {
  3822. elements.push($(element));
  3823. $(element).data("scrollSpy:id", i);
  3824. // Smooth scroll to section
  3825. $('a[href="#' + $(element).attr('id') + '"]').click(function (e) {
  3826. e.preventDefault();
  3827. var offset = $(Materialize.escapeHash(this.hash)).offset().top + 1;
  3828. $('html, body').animate({ scrollTop: offset - options.scrollOffset }, { duration: 400, queue: false, easing: 'easeOutCubic' });
  3829. });
  3830. });
  3831. offset.top = options.offsetTop || 0;
  3832. offset.right = options.offsetRight || 0;
  3833. offset.bottom = options.offsetBottom || 0;
  3834. offset.left = options.offsetLeft || 0;
  3835. var throttledScroll = Materialize.throttle(function () {
  3836. onScroll(options.scrollOffset);
  3837. }, options.throttle || 100);
  3838. var readyScroll = function () {
  3839. $(document).ready(throttledScroll);
  3840. };
  3841. if (!isSpying) {
  3842. jWindow.on('scroll', readyScroll);
  3843. jWindow.on('resize', readyScroll);
  3844. isSpying = true;
  3845. }
  3846. // perform a scan once, after current execution context, and after dom is ready
  3847. setTimeout(readyScroll, 0);
  3848. selector.on('scrollSpy:enter', function () {
  3849. visible = $.grep(visible, function (value) {
  3850. return value.height() != 0;
  3851. });
  3852. var $this = $(this);
  3853. if (visible[0]) {
  3854. $(options.getActiveElement(visible[0].attr('id'))).removeClass(options.activeClass);
  3855. if ($this.data('scrollSpy:id') < visible[0].data('scrollSpy:id')) {
  3856. visible.unshift($(this));
  3857. } else {
  3858. visible.push($(this));
  3859. }
  3860. } else {
  3861. visible.push($(this));
  3862. }
  3863. $(options.getActiveElement(visible[0].attr('id'))).addClass(options.activeClass);
  3864. });
  3865. selector.on('scrollSpy:exit', function () {
  3866. visible = $.grep(visible, function (value) {
  3867. return value.height() != 0;
  3868. });
  3869. if (visible[0]) {
  3870. $(options.getActiveElement(visible[0].attr('id'))).removeClass(options.activeClass);
  3871. var $this = $(this);
  3872. visible = $.grep(visible, function (value) {
  3873. return value.attr('id') != $this.attr('id');
  3874. });
  3875. if (visible[0]) {
  3876. // Check if empty
  3877. $(options.getActiveElement(visible[0].attr('id'))).addClass(options.activeClass);
  3878. }
  3879. }
  3880. });
  3881. return selector;
  3882. };
  3883. /**
  3884. * Listen for window resize events
  3885. * @param {Object=} options Optional. Set { throttle: number } to change throttling. Default: 100 ms
  3886. * @returns {jQuery} $(window)
  3887. */
  3888. $.winSizeSpy = function (options) {
  3889. $.winSizeSpy = function () {
  3890. return jWindow;
  3891. }; // lock from multiple calls
  3892. options = options || {
  3893. throttle: 100
  3894. };
  3895. return jWindow.on('resize', Materialize.throttle(onWinSize, options.throttle || 100));
  3896. };
  3897. /**
  3898. * Enables ScrollSpy on a collection of elements
  3899. * e.g. $('.scrollSpy').scrollSpy()
  3900. * @param {Object=} options Optional.
  3901. throttle : number -> scrollspy throttling. Default: 100 ms
  3902. offsetTop : number -> offset from top. Default: 0
  3903. offsetRight : number -> offset from right. Default: 0
  3904. offsetBottom : number -> offset from bottom. Default: 0
  3905. offsetLeft : number -> offset from left. Default: 0
  3906. * @returns {jQuery}
  3907. */
  3908. $.fn.scrollSpy = function (options) {
  3909. return $.scrollSpy($(this), options);
  3910. };
  3911. })(jQuery);
  3912. ;(function ($) {
  3913. $(document).ready(function () {
  3914. // Function to update labels of text fields
  3915. Materialize.updateTextFields = function () {
  3916. var input_selector = 'input[type=text], input[type=password], input[type=email], input[type=url], input[type=tel], input[type=number], input[type=search], textarea';
  3917. $(input_selector).each(function (index, element) {
  3918. var $this = $(this);
  3919. if ($(element).val().length > 0 || $(element).is(':focus') || element.autofocus || $this.attr('placeholder') !== undefined) {
  3920. $this.siblings('label').addClass('active');
  3921. } else if ($(element)[0].validity) {
  3922. $this.siblings('label').toggleClass('active', $(element)[0].validity.badInput === true);
  3923. } else {
  3924. $this.siblings('label').removeClass('active');
  3925. }
  3926. });
  3927. };
  3928. // Text based inputs
  3929. var input_selector = 'input[type=text], input[type=password], input[type=email], input[type=url], input[type=tel], input[type=number], input[type=search], textarea';
  3930. // Add active if form auto complete
  3931. $(document).on('change', input_selector, function () {
  3932. if ($(this).val().length !== 0 || $(this).attr('placeholder') !== undefined) {
  3933. $(this).siblings('label').addClass('active');
  3934. }
  3935. validate_field($(this));
  3936. });
  3937. // Add active if input element has been pre-populated on document ready
  3938. $(document).ready(function () {
  3939. Materialize.updateTextFields();
  3940. });
  3941. // HTML DOM FORM RESET handling
  3942. $(document).on('reset', function (e) {
  3943. var formReset = $(e.target);
  3944. if (formReset.is('form')) {
  3945. formReset.find(input_selector).removeClass('valid').removeClass('invalid');
  3946. formReset.find(input_selector).each(function () {
  3947. if ($(this).attr('value') === '') {
  3948. $(this).siblings('label').removeClass('active');
  3949. }
  3950. });
  3951. // Reset select
  3952. formReset.find('select.initialized').each(function () {
  3953. var reset_text = formReset.find('option[selected]').text();
  3954. formReset.siblings('input.select-dropdown').val(reset_text);
  3955. });
  3956. }
  3957. });
  3958. // Add active when element has focus
  3959. $(document).on('focus', input_selector, function () {
  3960. $(this).siblings('label, .prefix').addClass('active');
  3961. });
  3962. $(document).on('blur', input_selector, function () {
  3963. var $inputElement = $(this);
  3964. var selector = ".prefix";
  3965. if ($inputElement.val().length === 0 && $inputElement[0].validity.badInput !== true && $inputElement.attr('placeholder') === undefined) {
  3966. selector += ", label";
  3967. }
  3968. $inputElement.siblings(selector).removeClass('active');
  3969. validate_field($inputElement);
  3970. });
  3971. window.validate_field = function (object) {
  3972. var hasLength = object.attr('data-length') !== undefined;
  3973. var lenAttr = parseInt(object.attr('data-length'));
  3974. var len = object.val().length;
  3975. if (object.val().length === 0 && object[0].validity.badInput === false && !object.is(':required')) {
  3976. if (object.hasClass('validate')) {
  3977. object.removeClass('valid');
  3978. object.removeClass('invalid');
  3979. }
  3980. } else {
  3981. if (object.hasClass('validate')) {
  3982. // Check for character counter attributes
  3983. if (object.is(':valid') && hasLength && len <= lenAttr || object.is(':valid') && !hasLength) {
  3984. object.removeClass('invalid');
  3985. object.addClass('valid');
  3986. } else {
  3987. object.removeClass('valid');
  3988. object.addClass('invalid');
  3989. }
  3990. }
  3991. }
  3992. };
  3993. // Radio and Checkbox focus class
  3994. var radio_checkbox = 'input[type=radio], input[type=checkbox]';
  3995. $(document).on('keyup.radio', radio_checkbox, function (e) {
  3996. // TAB, check if tabbing to radio or checkbox.
  3997. if (e.which === 9) {
  3998. $(this).addClass('tabbed');
  3999. var $this = $(this);
  4000. $this.one('blur', function (e) {
  4001. $(this).removeClass('tabbed');
  4002. });
  4003. return;
  4004. }
  4005. });
  4006. // Textarea Auto Resize
  4007. var hiddenDiv = $('.hiddendiv').first();
  4008. if (!hiddenDiv.length) {
  4009. hiddenDiv = $('<div class="hiddendiv common"></div>');
  4010. $('body').append(hiddenDiv);
  4011. }
  4012. var text_area_selector = '.materialize-textarea';
  4013. function textareaAutoResize($textarea) {
  4014. // Set font properties of hiddenDiv
  4015. var fontFamily = $textarea.css('font-family');
  4016. var fontSize = $textarea.css('font-size');
  4017. var lineHeight = $textarea.css('line-height');
  4018. var padding = $textarea.css('padding');
  4019. if (fontSize) {
  4020. hiddenDiv.css('font-size', fontSize);
  4021. }
  4022. if (fontFamily) {
  4023. hiddenDiv.css('font-family', fontFamily);
  4024. }
  4025. if (lineHeight) {
  4026. hiddenDiv.css('line-height', lineHeight);
  4027. }
  4028. if (padding) {
  4029. hiddenDiv.css('padding', padding);
  4030. }
  4031. // Set original-height, if none
  4032. if (!$textarea.data('original-height')) {
  4033. $textarea.data('original-height', $textarea.height());
  4034. }
  4035. if ($textarea.attr('wrap') === 'off') {
  4036. hiddenDiv.css('overflow-wrap', 'normal').css('white-space', 'pre');
  4037. }
  4038. hiddenDiv.text($textarea.val() + '\n');
  4039. var content = hiddenDiv.html().replace(/\n/g, '<br>');
  4040. hiddenDiv.html(content);
  4041. // When textarea is hidden, width goes crazy.
  4042. // Approximate with half of window size
  4043. if ($textarea.is(':visible')) {
  4044. hiddenDiv.css('width', $textarea.width());
  4045. } else {
  4046. hiddenDiv.css('width', $(window).width() / 2);
  4047. }
  4048. /**
  4049. * Resize if the new height is greater than the
  4050. * original height of the textarea
  4051. */
  4052. if ($textarea.data('original-height') <= hiddenDiv.height()) {
  4053. $textarea.css('height', hiddenDiv.height());
  4054. } else if ($textarea.val().length < $textarea.data('previous-length')) {
  4055. /**
  4056. * In case the new height is less than original height, it
  4057. * means the textarea has less text than before
  4058. * So we set the height to the original one
  4059. */
  4060. $textarea.css('height', $textarea.data('original-height'));
  4061. }
  4062. $textarea.data('previous-length', $textarea.val().length);
  4063. }
  4064. $(text_area_selector).each(function () {
  4065. var $textarea = $(this);
  4066. /**
  4067. * Instead of resizing textarea on document load,
  4068. * store the original height and the original length
  4069. */
  4070. $textarea.data('original-height', $textarea.height());
  4071. $textarea.data('previous-length', $textarea.val().length);
  4072. });
  4073. $('body').on('keyup keydown autoresize', text_area_selector, function () {
  4074. textareaAutoResize($(this));
  4075. });
  4076. // File Input Path
  4077. $(document).on('change', '.file-field input[type="file"]', function () {
  4078. var file_field = $(this).closest('.file-field');
  4079. var path_input = file_field.find('input.file-path');
  4080. var files = $(this)[0].files;
  4081. var file_names = [];
  4082. for (var i = 0; i < files.length; i++) {
  4083. file_names.push(files[i].name);
  4084. }
  4085. path_input.val(file_names.join(", "));
  4086. path_input.trigger('change');
  4087. });
  4088. /****************
  4089. * Range Input *
  4090. ****************/
  4091. var range_type = 'input[type=range]';
  4092. var range_mousedown = false;
  4093. var left;
  4094. $(range_type).each(function () {
  4095. var thumb = $('<span class="thumb"><span class="value"></span></span>');
  4096. $(this).after(thumb);
  4097. });
  4098. var showRangeBubble = function (thumb) {
  4099. var paddingLeft = parseInt(thumb.parent().css('padding-left'));
  4100. var marginLeft = -7 + paddingLeft + 'px';
  4101. thumb.velocity({ height: "30px", width: "30px", top: "-30px", marginLeft: marginLeft }, { duration: 300, easing: 'easeOutExpo' });
  4102. };
  4103. var calcRangeOffset = function (range) {
  4104. var width = range.width() - 15;
  4105. var max = parseFloat(range.attr('max'));
  4106. var min = parseFloat(range.attr('min'));
  4107. var percent = (parseFloat(range.val()) - min) / (max - min);
  4108. return percent * width;
  4109. };
  4110. var range_wrapper = '.range-field';
  4111. $(document).on('change', range_type, function (e) {
  4112. var thumb = $(this).siblings('.thumb');
  4113. thumb.find('.value').html($(this).val());
  4114. if (!thumb.hasClass('active')) {
  4115. showRangeBubble(thumb);
  4116. }
  4117. var offsetLeft = calcRangeOffset($(this));
  4118. thumb.addClass('active').css('left', offsetLeft);
  4119. });
  4120. $(document).on('mousedown touchstart', range_type, function (e) {
  4121. var thumb = $(this).siblings('.thumb');
  4122. // If thumb indicator does not exist yet, create it
  4123. if (thumb.length <= 0) {
  4124. thumb = $('<span class="thumb"><span class="value"></span></span>');
  4125. $(this).after(thumb);
  4126. }
  4127. // Set indicator value
  4128. thumb.find('.value').html($(this).val());
  4129. range_mousedown = true;
  4130. $(this).addClass('active');
  4131. if (!thumb.hasClass('active')) {
  4132. showRangeBubble(thumb);
  4133. }
  4134. if (e.type !== 'input') {
  4135. var offsetLeft = calcRangeOffset($(this));
  4136. thumb.addClass('active').css('left', offsetLeft);
  4137. }
  4138. });
  4139. $(document).on('mouseup touchend', range_wrapper, function () {
  4140. range_mousedown = false;
  4141. $(this).removeClass('active');
  4142. });
  4143. $(document).on('input mousemove touchmove', range_wrapper, function (e) {
  4144. var thumb = $(this).children('.thumb');
  4145. var left;
  4146. var input = $(this).find(range_type);
  4147. if (range_mousedown) {
  4148. if (!thumb.hasClass('active')) {
  4149. showRangeBubble(thumb);
  4150. }
  4151. var offsetLeft = calcRangeOffset(input);
  4152. thumb.addClass('active').css('left', offsetLeft);
  4153. thumb.find('.value').html(thumb.siblings(range_type).val());
  4154. }
  4155. });
  4156. $(document).on('mouseout touchleave', range_wrapper, function () {
  4157. if (!range_mousedown) {
  4158. var thumb = $(this).children('.thumb');
  4159. var paddingLeft = parseInt($(this).css('padding-left'));
  4160. var marginLeft = 7 + paddingLeft + 'px';
  4161. if (thumb.hasClass('active')) {
  4162. thumb.velocity({ height: '0', width: '0', top: '10px', marginLeft: marginLeft }, { duration: 100 });
  4163. }
  4164. thumb.removeClass('active');
  4165. }
  4166. });
  4167. /**************************
  4168. * Auto complete plugin *
  4169. *************************/
  4170. $.fn.autocomplete = function (options) {
  4171. // Defaults
  4172. var defaults = {
  4173. data: {},
  4174. limit: Infinity,
  4175. onAutocomplete: null,
  4176. minLength: 1
  4177. };
  4178. options = $.extend(defaults, options);
  4179. return this.each(function () {
  4180. var $input = $(this);
  4181. var data = options.data,
  4182. count = 0,
  4183. activeIndex = -1,
  4184. oldVal,
  4185. $inputDiv = $input.closest('.input-field'); // Div to append on
  4186. // Check if data isn't empty
  4187. if (!$.isEmptyObject(data)) {
  4188. var $autocomplete = $('<ul class="autocomplete-content dropdown-content"></ul>');
  4189. var $oldAutocomplete;
  4190. // Append autocomplete element.
  4191. // Prevent double structure init.
  4192. if ($inputDiv.length) {
  4193. $oldAutocomplete = $inputDiv.children('.autocomplete-content.dropdown-content').first();
  4194. if (!$oldAutocomplete.length) {
  4195. $inputDiv.append($autocomplete); // Set ul in body
  4196. }
  4197. } else {
  4198. $oldAutocomplete = $input.next('.autocomplete-content.dropdown-content');
  4199. if (!$oldAutocomplete.length) {
  4200. $input.after($autocomplete);
  4201. }
  4202. }
  4203. if ($oldAutocomplete.length) {
  4204. $autocomplete = $oldAutocomplete;
  4205. }
  4206. // Highlight partial match.
  4207. var highlight = function (string, $el) {
  4208. var img = $el.find('img');
  4209. var matchStart = $el.text().toLowerCase().indexOf("" + string.toLowerCase() + ""),
  4210. matchEnd = matchStart + string.length - 1,
  4211. beforeMatch = $el.text().slice(0, matchStart),
  4212. matchText = $el.text().slice(matchStart, matchEnd + 1),
  4213. afterMatch = $el.text().slice(matchEnd + 1);
  4214. $el.html("<span>" + beforeMatch + "<span class='highlight'>" + matchText + "</span>" + afterMatch + "</span>");
  4215. if (img.length) {
  4216. $el.prepend(img);
  4217. }
  4218. };
  4219. // Reset current element position
  4220. var resetCurrentElement = function () {
  4221. activeIndex = -1;
  4222. $autocomplete.find('.active').removeClass('active');
  4223. };
  4224. // Remove autocomplete elements
  4225. var removeAutocomplete = function () {
  4226. $autocomplete.empty();
  4227. resetCurrentElement();
  4228. oldVal = undefined;
  4229. };
  4230. $input.off('blur.autocomplete').on('blur.autocomplete', function () {
  4231. removeAutocomplete();
  4232. });
  4233. // Perform search
  4234. $input.off('keyup.autocomplete focus.autocomplete').on('keyup.autocomplete focus.autocomplete', function (e) {
  4235. // Reset count.
  4236. count = 0;
  4237. var val = $input.val().toLowerCase();
  4238. // Don't capture enter or arrow key usage.
  4239. if (e.which === 13 || e.which === 38 || e.which === 40) {
  4240. return;
  4241. }
  4242. // Check if the input isn't empty
  4243. if (oldVal !== val) {
  4244. removeAutocomplete();
  4245. if (val.length >= options.minLength) {
  4246. for (var key in data) {
  4247. if (data.hasOwnProperty(key) && key.toLowerCase().indexOf(val) !== -1) {
  4248. // Break if past limit
  4249. if (count >= options.limit) {
  4250. break;
  4251. }
  4252. var autocompleteOption = $('<li></li>');
  4253. if (!!data[key]) {
  4254. autocompleteOption.append('<img src="' + data[key] + '" class="right circle"><span>' + key + '</span>');
  4255. } else {
  4256. autocompleteOption.append('<span>' + key + '</span>');
  4257. }
  4258. $autocomplete.append(autocompleteOption);
  4259. highlight(val, autocompleteOption);
  4260. count++;
  4261. }
  4262. }
  4263. }
  4264. }
  4265. // Update oldVal
  4266. oldVal = val;
  4267. });
  4268. $input.off('keydown.autocomplete').on('keydown.autocomplete', function (e) {
  4269. // Arrow keys and enter key usage
  4270. var keyCode = e.which,
  4271. liElement,
  4272. numItems = $autocomplete.children('li').length,
  4273. $active = $autocomplete.children('.active').first();
  4274. // select element on Enter
  4275. if (keyCode === 13 && activeIndex >= 0) {
  4276. liElement = $autocomplete.children('li').eq(activeIndex);
  4277. if (liElement.length) {
  4278. liElement.trigger('mousedown.autocomplete');
  4279. e.preventDefault();
  4280. }
  4281. return;
  4282. }
  4283. // Capture up and down key
  4284. if (keyCode === 38 || keyCode === 40) {
  4285. e.preventDefault();
  4286. if (keyCode === 38 && activeIndex > 0) {
  4287. activeIndex--;
  4288. }
  4289. if (keyCode === 40 && activeIndex < numItems - 1) {
  4290. activeIndex++;
  4291. }
  4292. $active.removeClass('active');
  4293. if (activeIndex >= 0) {
  4294. $autocomplete.children('li').eq(activeIndex).addClass('active');
  4295. }
  4296. }
  4297. });
  4298. // Set input value
  4299. $autocomplete.off('mousedown.autocomplete touchstart.autocomplete').on('mousedown.autocomplete touchstart.autocomplete', 'li', function () {
  4300. var text = $(this).text().trim();
  4301. $input.val(text);
  4302. $input.trigger('change');
  4303. removeAutocomplete();
  4304. // Handle onAutocomplete callback.
  4305. if (typeof options.onAutocomplete === "function") {
  4306. options.onAutocomplete.call(this, text);
  4307. }
  4308. });
  4309. // Empty data
  4310. } else {
  4311. $input.off('keyup.autocomplete focus.autocomplete');
  4312. }
  4313. });
  4314. };
  4315. }); // End of $(document).ready
  4316. /*******************
  4317. * Select Plugin *
  4318. ******************/
  4319. $.fn.material_select = function (callback) {
  4320. $(this).each(function () {
  4321. var $select = $(this);
  4322. if ($select.hasClass('browser-default')) {
  4323. return; // Continue to next (return false breaks out of entire loop)
  4324. }
  4325. var multiple = $select.attr('multiple') ? true : false,
  4326. lastID = $select.attr('data-select-id'); // Tear down structure if Select needs to be rebuilt
  4327. if (lastID) {
  4328. $select.parent().find('span.caret').remove();
  4329. $select.parent().find('input').remove();
  4330. $select.unwrap();
  4331. $('ul#select-options-' + lastID).remove();
  4332. }
  4333. // If destroying the select, remove the selelct-id and reset it to it's uninitialized state.
  4334. if (callback === 'destroy') {
  4335. $select.removeAttr('data-select-id').removeClass('initialized');
  4336. $(window).off('click.select');
  4337. return;
  4338. }
  4339. var uniqueID = Materialize.guid();
  4340. $select.attr('data-select-id', uniqueID);
  4341. var wrapper = $('<div class="select-wrapper"></div>');
  4342. wrapper.addClass($select.attr('class'));
  4343. if ($select.is(':disabled')) wrapper.addClass('disabled');
  4344. var options = $('<ul id="select-options-' + uniqueID + '" class="dropdown-content select-dropdown ' + (multiple ? 'multiple-select-dropdown' : '') + '"></ul>'),
  4345. selectChildren = $select.children('option, optgroup'),
  4346. valuesSelected = [],
  4347. optionsHover = false;
  4348. var label = $select.find('option:selected').html() || $select.find('option:first').html() || "";
  4349. // Function that renders and appends the option taking into
  4350. // account type and possible image icon.
  4351. var appendOptionWithIcon = function (select, option, type) {
  4352. // Add disabled attr if disabled
  4353. var disabledClass = option.is(':disabled') ? 'disabled ' : '';
  4354. var optgroupClass = type === 'optgroup-option' ? 'optgroup-option ' : '';
  4355. var multipleCheckbox = multiple ? '<input type="checkbox"' + disabledClass + '/><label></label>' : '';
  4356. // add icons
  4357. var icon_url = option.data('icon');
  4358. var classes = option.attr('class');
  4359. if (!!icon_url) {
  4360. var classString = '';
  4361. if (!!classes) classString = ' class="' + classes + '"';
  4362. // Check for multiple type.
  4363. options.append($('<li class="' + disabledClass + optgroupClass + '"><img alt="" src="' + icon_url + '"' + classString + '><span>' + multipleCheckbox + option.html() + '</span></li>'));
  4364. return true;
  4365. }
  4366. // Check for multiple type.
  4367. options.append($('<li class="' + disabledClass + optgroupClass + '"><span>' + multipleCheckbox + option.html() + '</span></li>'));
  4368. };
  4369. /* Create dropdown structure. */
  4370. if (selectChildren.length) {
  4371. selectChildren.each(function () {
  4372. if ($(this).is('option')) {
  4373. // Direct descendant option.
  4374. if (multiple) {
  4375. appendOptionWithIcon($select, $(this), 'multiple');
  4376. } else {
  4377. appendOptionWithIcon($select, $(this));
  4378. }
  4379. } else if ($(this).is('optgroup')) {
  4380. // Optgroup.
  4381. var selectOptions = $(this).children('option');
  4382. options.append($('<li class="optgroup"><span>' + $(this).attr('label') + '</span></li>'));
  4383. selectOptions.each(function () {
  4384. appendOptionWithIcon($select, $(this), 'optgroup-option');
  4385. });
  4386. }
  4387. });
  4388. }
  4389. options.find('li:not(.optgroup)').each(function (i) {
  4390. $(this).click(function (e) {
  4391. // Check if option element is disabled
  4392. if (!$(this).hasClass('disabled') && !$(this).hasClass('optgroup')) {
  4393. var selected = true;
  4394. if (multiple) {
  4395. $('input[type="checkbox"]', this).prop('checked', function (i, v) {
  4396. return !v;
  4397. });
  4398. selected = toggleEntryFromArray(valuesSelected, i, $select);
  4399. $newSelect.trigger('focus');
  4400. } else {
  4401. options.find('li').removeClass('active');
  4402. $(this).toggleClass('active');
  4403. $newSelect.val($(this).text());
  4404. }
  4405. activateOption(options, $(this));
  4406. $select.find('option').eq(i).prop('selected', selected);
  4407. // Trigger onchange() event
  4408. $select.trigger('change');
  4409. if (typeof callback !== 'undefined') callback();
  4410. }
  4411. e.stopPropagation();
  4412. });
  4413. });
  4414. // Wrap Elements
  4415. $select.wrap(wrapper);
  4416. // Add Select Display Element
  4417. var dropdownIcon = $('<span class="caret">&#9660;</span>');
  4418. // escape double quotes
  4419. var sanitizedLabelHtml = label.replace(/"/g, '&quot;');
  4420. var $newSelect = $('<input type="text" class="select-dropdown" readonly="true" ' + ($select.is(':disabled') ? 'disabled' : '') + ' data-activates="select-options-' + uniqueID + '" value="' + sanitizedLabelHtml + '"/>');
  4421. $select.before($newSelect);
  4422. $newSelect.before(dropdownIcon);
  4423. $newSelect.after(options);
  4424. // Check if section element is disabled
  4425. if (!$select.is(':disabled')) {
  4426. $newSelect.dropdown({ 'hover': false });
  4427. }
  4428. // Copy tabindex
  4429. if ($select.attr('tabindex')) {
  4430. $($newSelect[0]).attr('tabindex', $select.attr('tabindex'));
  4431. }
  4432. $select.addClass('initialized');
  4433. $newSelect.on({
  4434. 'focus': function () {
  4435. if ($('ul.select-dropdown').not(options[0]).is(':visible')) {
  4436. $('input.select-dropdown').trigger('close');
  4437. $(window).off('click.select');
  4438. }
  4439. if (!options.is(':visible')) {
  4440. $(this).trigger('open', ['focus']);
  4441. var label = $(this).val();
  4442. if (multiple && label.indexOf(',') >= 0) {
  4443. label = label.split(',')[0];
  4444. }
  4445. var selectedOption = options.find('li').filter(function () {
  4446. return $(this).text().toLowerCase() === label.toLowerCase();
  4447. })[0];
  4448. activateOption(options, selectedOption, true);
  4449. $(window).off('click.select').on('click.select', function () {
  4450. multiple && (optionsHover || $newSelect.trigger('close'));
  4451. $(window).off('click.select');
  4452. });
  4453. }
  4454. },
  4455. 'click': function (e) {
  4456. e.stopPropagation();
  4457. }
  4458. });
  4459. $newSelect.on('blur', function () {
  4460. if (!multiple) {
  4461. $(this).trigger('close');
  4462. $(window).off('click.select');
  4463. }
  4464. options.find('li.selected').removeClass('selected');
  4465. });
  4466. options.hover(function () {
  4467. optionsHover = true;
  4468. }, function () {
  4469. optionsHover = false;
  4470. });
  4471. // Add initial multiple selections.
  4472. if (multiple) {
  4473. $select.find("option:selected:not(:disabled)").each(function () {
  4474. var index = this.index;
  4475. toggleEntryFromArray(valuesSelected, index, $select);
  4476. options.find("li:not(.optgroup)").eq(index).find(":checkbox").prop("checked", true);
  4477. });
  4478. }
  4479. /**
  4480. * Make option as selected and scroll to selected position
  4481. * @param {jQuery} collection Select options jQuery element
  4482. * @param {Element} newOption element of the new option
  4483. * @param {Boolean} firstActivation If on first activation of select
  4484. */
  4485. var activateOption = function (collection, newOption, firstActivation) {
  4486. if (newOption) {
  4487. collection.find('li.selected').removeClass('selected');
  4488. var option = $(newOption);
  4489. option.addClass('selected');
  4490. if (!multiple || !!firstActivation) {
  4491. options.scrollTo(option);
  4492. }
  4493. }
  4494. };
  4495. // Allow user to search by typing
  4496. // this array is cleared after 1 second
  4497. var filterQuery = [],
  4498. onKeyDown = function (e) {
  4499. // TAB - switch to another input
  4500. if (e.which == 9) {
  4501. $newSelect.trigger('close');
  4502. return;
  4503. }
  4504. // ARROW DOWN WHEN SELECT IS CLOSED - open select options
  4505. if (e.which == 40 && !options.is(':visible')) {
  4506. $newSelect.trigger('open');
  4507. return;
  4508. }
  4509. // ENTER WHEN SELECT IS CLOSED - submit form
  4510. if (e.which == 13 && !options.is(':visible')) {
  4511. return;
  4512. }
  4513. e.preventDefault();
  4514. // CASE WHEN USER TYPE LETTERS
  4515. var letter = String.fromCharCode(e.which).toLowerCase(),
  4516. nonLetters = [9, 13, 27, 38, 40];
  4517. if (letter && nonLetters.indexOf(e.which) === -1) {
  4518. filterQuery.push(letter);
  4519. var string = filterQuery.join(''),
  4520. newOption = options.find('li').filter(function () {
  4521. return $(this).text().toLowerCase().indexOf(string) === 0;
  4522. })[0];
  4523. if (newOption) {
  4524. activateOption(options, newOption);
  4525. }
  4526. }
  4527. // ENTER - select option and close when select options are opened
  4528. if (e.which == 13) {
  4529. var activeOption = options.find('li.selected:not(.disabled)')[0];
  4530. if (activeOption) {
  4531. $(activeOption).trigger('click');
  4532. if (!multiple) {
  4533. $newSelect.trigger('close');
  4534. }
  4535. }
  4536. }
  4537. // ARROW DOWN - move to next not disabled option
  4538. if (e.which == 40) {
  4539. if (options.find('li.selected').length) {
  4540. newOption = options.find('li.selected').next('li:not(.disabled)')[0];
  4541. } else {
  4542. newOption = options.find('li:not(.disabled)')[0];
  4543. }
  4544. activateOption(options, newOption);
  4545. }
  4546. // ESC - close options
  4547. if (e.which == 27) {
  4548. $newSelect.trigger('close');
  4549. }
  4550. // ARROW UP - move to previous not disabled option
  4551. if (e.which == 38) {
  4552. newOption = options.find('li.selected').prev('li:not(.disabled)')[0];
  4553. if (newOption) activateOption(options, newOption);
  4554. }
  4555. // Automaticaly clean filter query so user can search again by starting letters
  4556. setTimeout(function () {
  4557. filterQuery = [];
  4558. }, 1000);
  4559. };
  4560. $newSelect.on('keydown', onKeyDown);
  4561. });
  4562. function toggleEntryFromArray(entriesArray, entryIndex, select) {
  4563. var index = entriesArray.indexOf(entryIndex),
  4564. notAdded = index === -1;
  4565. if (notAdded) {
  4566. entriesArray.push(entryIndex);
  4567. } else {
  4568. entriesArray.splice(index, 1);
  4569. }
  4570. select.siblings('ul.dropdown-content').find('li:not(.optgroup)').eq(entryIndex).toggleClass('active');
  4571. // use notAdded instead of true (to detect if the option is selected or not)
  4572. select.find('option').eq(entryIndex).prop('selected', notAdded);
  4573. setValueToInput(entriesArray, select);
  4574. return notAdded;
  4575. }
  4576. function setValueToInput(entriesArray, select) {
  4577. var value = '';
  4578. for (var i = 0, count = entriesArray.length; i < count; i++) {
  4579. var text = select.find('option').eq(entriesArray[i]).text();
  4580. i === 0 ? value += text : value += ', ' + text;
  4581. }
  4582. if (value === '') {
  4583. value = select.find('option:disabled').eq(0).text();
  4584. }
  4585. select.siblings('input.select-dropdown').val(value);
  4586. }
  4587. };
  4588. })(jQuery);
  4589. ;(function ($) {
  4590. var methods = {
  4591. init: function (options) {
  4592. var defaults = {
  4593. indicators: true,
  4594. height: 400,
  4595. transition: 500,
  4596. interval: 6000
  4597. };
  4598. options = $.extend(defaults, options);
  4599. return this.each(function () {
  4600. // For each slider, we want to keep track of
  4601. // which slide is active and its associated content
  4602. var $this = $(this);
  4603. var $slider = $this.find('ul.slides').first();
  4604. var $slides = $slider.find('> li');
  4605. var $active_index = $slider.find('.active').index();
  4606. var $active, $indicators, $interval;
  4607. if ($active_index != -1) {
  4608. $active = $slides.eq($active_index);
  4609. }
  4610. // Transitions the caption depending on alignment
  4611. function captionTransition(caption, duration) {
  4612. if (caption.hasClass("center-align")) {
  4613. caption.velocity({ opacity: 0, translateY: -100 }, { duration: duration, queue: false });
  4614. } else if (caption.hasClass("right-align")) {
  4615. caption.velocity({ opacity: 0, translateX: 100 }, { duration: duration, queue: false });
  4616. } else if (caption.hasClass("left-align")) {
  4617. caption.velocity({ opacity: 0, translateX: -100 }, { duration: duration, queue: false });
  4618. }
  4619. }
  4620. // This function will transition the slide to any index of the next slide
  4621. function moveToSlide(index) {
  4622. // Wrap around indices.
  4623. if (index >= $slides.length) index = 0;else if (index < 0) index = $slides.length - 1;
  4624. $active_index = $slider.find('.active').index();
  4625. // Only do if index changes
  4626. if ($active_index != index) {
  4627. $active = $slides.eq($active_index);
  4628. $caption = $active.find('.caption');
  4629. $active.removeClass('active');
  4630. $active.velocity({ opacity: 0 }, { duration: options.transition, queue: false, easing: 'easeOutQuad',
  4631. complete: function () {
  4632. $slides.not('.active').velocity({ opacity: 0, translateX: 0, translateY: 0 }, { duration: 0, queue: false });
  4633. } });
  4634. captionTransition($caption, options.transition);
  4635. // Update indicators
  4636. if (options.indicators) {
  4637. $indicators.eq($active_index).removeClass('active');
  4638. }
  4639. $slides.eq(index).velocity({ opacity: 1 }, { duration: options.transition, queue: false, easing: 'easeOutQuad' });
  4640. $slides.eq(index).find('.caption').velocity({ opacity: 1, translateX: 0, translateY: 0 }, { duration: options.transition, delay: options.transition, queue: false, easing: 'easeOutQuad' });
  4641. $slides.eq(index).addClass('active');
  4642. // Update indicators
  4643. if (options.indicators) {
  4644. $indicators.eq(index).addClass('active');
  4645. }
  4646. }
  4647. }
  4648. // Set height of slider
  4649. // If fullscreen, do nothing
  4650. if (!$this.hasClass('fullscreen')) {
  4651. if (options.indicators) {
  4652. // Add height if indicators are present
  4653. $this.height(options.height + 40);
  4654. } else {
  4655. $this.height(options.height);
  4656. }
  4657. $slider.height(options.height);
  4658. }
  4659. // Set initial positions of captions
  4660. $slides.find('.caption').each(function () {
  4661. captionTransition($(this), 0);
  4662. });
  4663. // Move img src into background-image
  4664. $slides.find('img').each(function () {
  4665. var placeholderBase64 = 'data:image/gif;base64,R0lGODlhAQABAIABAP///wAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';
  4666. if ($(this).attr('src') !== placeholderBase64) {
  4667. $(this).css('background-image', 'url("' + $(this).attr('src') + '")');
  4668. $(this).attr('src', placeholderBase64);
  4669. }
  4670. });
  4671. // dynamically add indicators
  4672. if (options.indicators) {
  4673. $indicators = $('<ul class="indicators"></ul>');
  4674. $slides.each(function (index) {
  4675. var $indicator = $('<li class="indicator-item"></li>');
  4676. // Handle clicks on indicators
  4677. $indicator.click(function () {
  4678. var $parent = $slider.parent();
  4679. var curr_index = $parent.find($(this)).index();
  4680. moveToSlide(curr_index);
  4681. // reset interval
  4682. clearInterval($interval);
  4683. $interval = setInterval(function () {
  4684. $active_index = $slider.find('.active').index();
  4685. if ($slides.length == $active_index + 1) $active_index = 0; // loop to start
  4686. else $active_index += 1;
  4687. moveToSlide($active_index);
  4688. }, options.transition + options.interval);
  4689. });
  4690. $indicators.append($indicator);
  4691. });
  4692. $this.append($indicators);
  4693. $indicators = $this.find('ul.indicators').find('li.indicator-item');
  4694. }
  4695. if ($active) {
  4696. $active.show();
  4697. } else {
  4698. $slides.first().addClass('active').velocity({ opacity: 1 }, { duration: options.transition, queue: false, easing: 'easeOutQuad' });
  4699. $active_index = 0;
  4700. $active = $slides.eq($active_index);
  4701. // Update indicators
  4702. if (options.indicators) {
  4703. $indicators.eq($active_index).addClass('active');
  4704. }
  4705. }
  4706. // Adjust height to current slide
  4707. $active.find('img').each(function () {
  4708. $active.find('.caption').velocity({ opacity: 1, translateX: 0, translateY: 0 }, { duration: options.transition, queue: false, easing: 'easeOutQuad' });
  4709. });
  4710. // auto scroll
  4711. $interval = setInterval(function () {
  4712. $active_index = $slider.find('.active').index();
  4713. moveToSlide($active_index + 1);
  4714. }, options.transition + options.interval);
  4715. // HammerJS, Swipe navigation
  4716. // Touch Event
  4717. var panning = false;
  4718. var swipeLeft = false;
  4719. var swipeRight = false;
  4720. $this.hammer({
  4721. prevent_default: false
  4722. }).on('pan', function (e) {
  4723. if (e.gesture.pointerType === "touch") {
  4724. // reset interval
  4725. clearInterval($interval);
  4726. var direction = e.gesture.direction;
  4727. var x = e.gesture.deltaX;
  4728. var velocityX = e.gesture.velocityX;
  4729. var velocityY = e.gesture.velocityY;
  4730. $curr_slide = $slider.find('.active');
  4731. if (Math.abs(velocityX) > Math.abs(velocityY)) {
  4732. $curr_slide.velocity({ translateX: x
  4733. }, { duration: 50, queue: false, easing: 'easeOutQuad' });
  4734. }
  4735. // Swipe Left
  4736. if (direction === 4 && (x > $this.innerWidth() / 2 || velocityX < -0.65)) {
  4737. swipeRight = true;
  4738. }
  4739. // Swipe Right
  4740. else if (direction === 2 && (x < -1 * $this.innerWidth() / 2 || velocityX > 0.65)) {
  4741. swipeLeft = true;
  4742. }
  4743. // Make Slide Behind active slide visible
  4744. var next_slide;
  4745. if (swipeLeft) {
  4746. next_slide = $curr_slide.next();
  4747. if (next_slide.length === 0) {
  4748. next_slide = $slides.first();
  4749. }
  4750. next_slide.velocity({ opacity: 1
  4751. }, { duration: 300, queue: false, easing: 'easeOutQuad' });
  4752. }
  4753. if (swipeRight) {
  4754. next_slide = $curr_slide.prev();
  4755. if (next_slide.length === 0) {
  4756. next_slide = $slides.last();
  4757. }
  4758. next_slide.velocity({ opacity: 1
  4759. }, { duration: 300, queue: false, easing: 'easeOutQuad' });
  4760. }
  4761. }
  4762. }).on('panend', function (e) {
  4763. if (e.gesture.pointerType === "touch") {
  4764. $curr_slide = $slider.find('.active');
  4765. panning = false;
  4766. curr_index = $slider.find('.active').index();
  4767. if (!swipeRight && !swipeLeft || $slides.length <= 1) {
  4768. // Return to original spot
  4769. $curr_slide.velocity({ translateX: 0
  4770. }, { duration: 300, queue: false, easing: 'easeOutQuad' });
  4771. } else if (swipeLeft) {
  4772. moveToSlide(curr_index + 1);
  4773. $curr_slide.velocity({ translateX: -1 * $this.innerWidth() }, { duration: 300, queue: false, easing: 'easeOutQuad',
  4774. complete: function () {
  4775. $curr_slide.velocity({ opacity: 0, translateX: 0 }, { duration: 0, queue: false });
  4776. } });
  4777. } else if (swipeRight) {
  4778. moveToSlide(curr_index - 1);
  4779. $curr_slide.velocity({ translateX: $this.innerWidth() }, { duration: 300, queue: false, easing: 'easeOutQuad',
  4780. complete: function () {
  4781. $curr_slide.velocity({ opacity: 0, translateX: 0 }, { duration: 0, queue: false });
  4782. } });
  4783. }
  4784. swipeLeft = false;
  4785. swipeRight = false;
  4786. // Restart interval
  4787. clearInterval($interval);
  4788. $interval = setInterval(function () {
  4789. $active_index = $slider.find('.active').index();
  4790. if ($slides.length == $active_index + 1) $active_index = 0; // loop to start
  4791. else $active_index += 1;
  4792. moveToSlide($active_index);
  4793. }, options.transition + options.interval);
  4794. }
  4795. });
  4796. $this.on('sliderPause', function () {
  4797. clearInterval($interval);
  4798. });
  4799. $this.on('sliderStart', function () {
  4800. clearInterval($interval);
  4801. $interval = setInterval(function () {
  4802. $active_index = $slider.find('.active').index();
  4803. if ($slides.length == $active_index + 1) $active_index = 0; // loop to start
  4804. else $active_index += 1;
  4805. moveToSlide($active_index);
  4806. }, options.transition + options.interval);
  4807. });
  4808. $this.on('sliderNext', function () {
  4809. $active_index = $slider.find('.active').index();
  4810. moveToSlide($active_index + 1);
  4811. });
  4812. $this.on('sliderPrev', function () {
  4813. $active_index = $slider.find('.active').index();
  4814. moveToSlide($active_index - 1);
  4815. });
  4816. });
  4817. },
  4818. pause: function () {
  4819. $(this).trigger('sliderPause');
  4820. },
  4821. start: function () {
  4822. $(this).trigger('sliderStart');
  4823. },
  4824. next: function () {
  4825. $(this).trigger('sliderNext');
  4826. },
  4827. prev: function () {
  4828. $(this).trigger('sliderPrev');
  4829. }
  4830. };
  4831. $.fn.slider = function (methodOrOptions) {
  4832. if (methods[methodOrOptions]) {
  4833. return methods[methodOrOptions].apply(this, Array.prototype.slice.call(arguments, 1));
  4834. } else if (typeof methodOrOptions === 'object' || !methodOrOptions) {
  4835. // Default to "init"
  4836. return methods.init.apply(this, arguments);
  4837. } else {
  4838. $.error('Method ' + methodOrOptions + ' does not exist on jQuery.tooltip');
  4839. }
  4840. }; // Plugin end
  4841. })(jQuery);
  4842. ;(function ($) {
  4843. $(document).ready(function () {
  4844. $(document).on('click.card', '.card', function (e) {
  4845. if ($(this).find('> .card-reveal').length) {
  4846. var $card = $(e.target).closest('.card');
  4847. if ($card.data('initialOverflow') === undefined) {
  4848. $card.data('initialOverflow', $card.css('overflow') === undefined ? '' : $card.css('overflow'));
  4849. }
  4850. if ($(e.target).is($('.card-reveal .card-title')) || $(e.target).is($('.card-reveal .card-title i'))) {
  4851. // Make Reveal animate down and display none
  4852. $(this).find('.card-reveal').velocity({ translateY: 0 }, {
  4853. duration: 225,
  4854. queue: false,
  4855. easing: 'easeInOutQuad',
  4856. complete: function () {
  4857. $(this).css({ display: 'none' });
  4858. $card.css('overflow', $card.data('initialOverflow'));
  4859. }
  4860. });
  4861. } else if ($(e.target).is($('.card .activator')) || $(e.target).is($('.card .activator i'))) {
  4862. $card.css('overflow', 'hidden');
  4863. $(this).find('.card-reveal').css({ display: 'block' }).velocity("stop", false).velocity({ translateY: '-100%' }, { duration: 300, queue: false, easing: 'easeInOutQuad' });
  4864. }
  4865. }
  4866. });
  4867. });
  4868. })(jQuery);
  4869. ;(function ($) {
  4870. var materialChipsDefaults = {
  4871. data: [],
  4872. placeholder: '',
  4873. secondaryPlaceholder: '',
  4874. autocompleteOptions: {}
  4875. };
  4876. $(document).ready(function () {
  4877. // Handle removal of static chips.
  4878. $(document).on('click', '.chip .close', function (e) {
  4879. var $chips = $(this).closest('.chips');
  4880. if ($chips.attr('data-initialized')) {
  4881. return;
  4882. }
  4883. $(this).closest('.chip').remove();
  4884. });
  4885. });
  4886. $.fn.material_chip = function (options) {
  4887. var self = this;
  4888. this.$el = $(this);
  4889. this.$document = $(document);
  4890. this.SELS = {
  4891. CHIPS: '.chips',
  4892. CHIP: '.chip',
  4893. INPUT: 'input',
  4894. DELETE: '.material-icons',
  4895. SELECTED_CHIP: '.selected'
  4896. };
  4897. if ('data' === options) {
  4898. return this.$el.data('chips');
  4899. }
  4900. var curr_options = $.extend({}, materialChipsDefaults, options);
  4901. self.hasAutocomplete = !$.isEmptyObject(curr_options.autocompleteOptions.data);
  4902. // Initialize
  4903. this.init = function () {
  4904. var i = 0;
  4905. var chips;
  4906. self.$el.each(function () {
  4907. var $chips = $(this);
  4908. var chipId = Materialize.guid();
  4909. self.chipId = chipId;
  4910. if (!curr_options.data || !(curr_options.data instanceof Array)) {
  4911. curr_options.data = [];
  4912. }
  4913. $chips.data('chips', curr_options.data);
  4914. $chips.attr('data-index', i);
  4915. $chips.attr('data-initialized', true);
  4916. if (!$chips.hasClass(self.SELS.CHIPS)) {
  4917. $chips.addClass('chips');
  4918. }
  4919. self.chips($chips, chipId);
  4920. i++;
  4921. });
  4922. };
  4923. this.handleEvents = function () {
  4924. var SELS = self.SELS;
  4925. self.$document.off('click.chips-focus', SELS.CHIPS).on('click.chips-focus', SELS.CHIPS, function (e) {
  4926. $(e.target).find(SELS.INPUT).focus();
  4927. });
  4928. self.$document.off('click.chips-select', SELS.CHIP).on('click.chips-select', SELS.CHIP, function (e) {
  4929. var $chip = $(e.target);
  4930. if ($chip.length) {
  4931. var wasSelected = $chip.hasClass('selected');
  4932. var $chips = $chip.closest(SELS.CHIPS);
  4933. $(SELS.CHIP).removeClass('selected');
  4934. if (!wasSelected) {
  4935. self.selectChip($chip.index(), $chips);
  4936. }
  4937. }
  4938. });
  4939. self.$document.off('keydown.chips').on('keydown.chips', function (e) {
  4940. if ($(e.target).is('input, textarea')) {
  4941. return;
  4942. }
  4943. // delete
  4944. var $chip = self.$document.find(SELS.CHIP + SELS.SELECTED_CHIP);
  4945. var $chips = $chip.closest(SELS.CHIPS);
  4946. var length = $chip.siblings(SELS.CHIP).length;
  4947. var index;
  4948. if (!$chip.length) {
  4949. return;
  4950. }
  4951. if (e.which === 8 || e.which === 46) {
  4952. e.preventDefault();
  4953. index = $chip.index();
  4954. self.deleteChip(index, $chips);
  4955. var selectIndex = null;
  4956. if (index + 1 < length) {
  4957. selectIndex = index;
  4958. } else if (index === length || index + 1 === length) {
  4959. selectIndex = length - 1;
  4960. }
  4961. if (selectIndex < 0) selectIndex = null;
  4962. if (null !== selectIndex) {
  4963. self.selectChip(selectIndex, $chips);
  4964. }
  4965. if (!length) $chips.find('input').focus();
  4966. // left
  4967. } else if (e.which === 37) {
  4968. index = $chip.index() - 1;
  4969. if (index < 0) {
  4970. return;
  4971. }
  4972. $(SELS.CHIP).removeClass('selected');
  4973. self.selectChip(index, $chips);
  4974. // right
  4975. } else if (e.which === 39) {
  4976. index = $chip.index() + 1;
  4977. $(SELS.CHIP).removeClass('selected');
  4978. if (index > length) {
  4979. $chips.find('input').focus();
  4980. return;
  4981. }
  4982. self.selectChip(index, $chips);
  4983. }
  4984. });
  4985. self.$document.off('focusin.chips', SELS.CHIPS + ' ' + SELS.INPUT).on('focusin.chips', SELS.CHIPS + ' ' + SELS.INPUT, function (e) {
  4986. var $currChips = $(e.target).closest(SELS.CHIPS);
  4987. $currChips.addClass('focus');
  4988. $currChips.siblings('label, .prefix').addClass('active');
  4989. $(SELS.CHIP).removeClass('selected');
  4990. });
  4991. self.$document.off('focusout.chips', SELS.CHIPS + ' ' + SELS.INPUT).on('focusout.chips', SELS.CHIPS + ' ' + SELS.INPUT, function (e) {
  4992. var $currChips = $(e.target).closest(SELS.CHIPS);
  4993. $currChips.removeClass('focus');
  4994. // Remove active if empty
  4995. if ($currChips.data('chips') === undefined || !$currChips.data('chips').length) {
  4996. $currChips.siblings('label').removeClass('active');
  4997. }
  4998. $currChips.siblings('.prefix').removeClass('active');
  4999. });
  5000. self.$document.off('keydown.chips-add', SELS.CHIPS + ' ' + SELS.INPUT).on('keydown.chips-add', SELS.CHIPS + ' ' + SELS.INPUT, function (e) {
  5001. var $target = $(e.target);
  5002. var $chips = $target.closest(SELS.CHIPS);
  5003. var chipsLength = $chips.children(SELS.CHIP).length;
  5004. // enter
  5005. if (13 === e.which) {
  5006. // Override enter if autocompleting.
  5007. if (self.hasAutocomplete && $chips.find('.autocomplete-content.dropdown-content').length && $chips.find('.autocomplete-content.dropdown-content').children().length) {
  5008. return;
  5009. }
  5010. e.preventDefault();
  5011. self.addChip({ tag: $target.val() }, $chips);
  5012. $target.val('');
  5013. return;
  5014. }
  5015. // delete or left
  5016. if ((8 === e.keyCode || 37 === e.keyCode) && '' === $target.val() && chipsLength) {
  5017. e.preventDefault();
  5018. self.selectChip(chipsLength - 1, $chips);
  5019. $target.blur();
  5020. return;
  5021. }
  5022. });
  5023. // Click on delete icon in chip.
  5024. self.$document.off('click.chips-delete', SELS.CHIPS + ' ' + SELS.DELETE).on('click.chips-delete', SELS.CHIPS + ' ' + SELS.DELETE, function (e) {
  5025. var $target = $(e.target);
  5026. var $chips = $target.closest(SELS.CHIPS);
  5027. var $chip = $target.closest(SELS.CHIP);
  5028. e.stopPropagation();
  5029. self.deleteChip($chip.index(), $chips);
  5030. $chips.find('input').focus();
  5031. });
  5032. };
  5033. this.chips = function ($chips, chipId) {
  5034. $chips.empty();
  5035. $chips.data('chips').forEach(function (elem) {
  5036. $chips.append(self.renderChip(elem));
  5037. });
  5038. $chips.append($('<input id="' + chipId + '" class="input" placeholder="">'));
  5039. self.setPlaceholder($chips);
  5040. // Set for attribute for label
  5041. var label = $chips.next('label');
  5042. if (label.length) {
  5043. label.attr('for', chipId);
  5044. if ($chips.data('chips') !== undefined && $chips.data('chips').length) {
  5045. label.addClass('active');
  5046. }
  5047. }
  5048. // Setup autocomplete if needed.
  5049. var input = $('#' + chipId);
  5050. if (self.hasAutocomplete) {
  5051. curr_options.autocompleteOptions.onAutocomplete = function (val) {
  5052. self.addChip({ tag: val }, $chips);
  5053. input.val('');
  5054. input.focus();
  5055. };
  5056. input.autocomplete(curr_options.autocompleteOptions);
  5057. }
  5058. };
  5059. /**
  5060. * Render chip jQuery element.
  5061. * @param {Object} elem
  5062. * @return {jQuery}
  5063. */
  5064. this.renderChip = function (elem) {
  5065. if (!elem.tag) return;
  5066. var $renderedChip = $('<div class="chip"></div>');
  5067. $renderedChip.text(elem.tag);
  5068. if (elem.image) {
  5069. $renderedChip.prepend($('<img />').attr('src', elem.image));
  5070. }
  5071. $renderedChip.append($('<i class="material-icons close">close</i>'));
  5072. return $renderedChip;
  5073. };
  5074. this.setPlaceholder = function ($chips) {
  5075. if ($chips.data('chips') !== undefined && !$chips.data('chips').length && curr_options.placeholder) {
  5076. $chips.find('input').prop('placeholder', curr_options.placeholder);
  5077. } else if (($chips.data('chips') === undefined || !!$chips.data('chips').length) && curr_options.secondaryPlaceholder) {
  5078. $chips.find('input').prop('placeholder', curr_options.secondaryPlaceholder);
  5079. }
  5080. };
  5081. this.isValid = function ($chips, elem) {
  5082. var chips = $chips.data('chips');
  5083. var exists = false;
  5084. for (var i = 0; i < chips.length; i++) {
  5085. if (chips[i].tag === elem.tag) {
  5086. exists = true;
  5087. return;
  5088. }
  5089. }
  5090. return '' !== elem.tag && !exists;
  5091. };
  5092. this.addChip = function (elem, $chips) {
  5093. if (!self.isValid($chips, elem)) {
  5094. return;
  5095. }
  5096. var $renderedChip = self.renderChip(elem);
  5097. var newData = [];
  5098. var oldData = $chips.data('chips');
  5099. for (var i = 0; i < oldData.length; i++) {
  5100. newData.push(oldData[i]);
  5101. }
  5102. newData.push(elem);
  5103. $chips.data('chips', newData);
  5104. $renderedChip.insertBefore($chips.find('input'));
  5105. $chips.trigger('chip.add', elem);
  5106. self.setPlaceholder($chips);
  5107. };
  5108. this.deleteChip = function (chipIndex, $chips) {
  5109. var chip = $chips.data('chips')[chipIndex];
  5110. $chips.find('.chip').eq(chipIndex).remove();
  5111. var newData = [];
  5112. var oldData = $chips.data('chips');
  5113. for (var i = 0; i < oldData.length; i++) {
  5114. if (i !== chipIndex) {
  5115. newData.push(oldData[i]);
  5116. }
  5117. }
  5118. $chips.data('chips', newData);
  5119. $chips.trigger('chip.delete', chip);
  5120. self.setPlaceholder($chips);
  5121. };
  5122. this.selectChip = function (chipIndex, $chips) {
  5123. var $chip = $chips.find('.chip').eq(chipIndex);
  5124. if ($chip && false === $chip.hasClass('selected')) {
  5125. $chip.addClass('selected');
  5126. $chips.trigger('chip.select', $chips.data('chips')[chipIndex]);
  5127. }
  5128. };
  5129. this.getChipsElement = function (index, $chips) {
  5130. return $chips.eq(index);
  5131. };
  5132. // init
  5133. this.init();
  5134. this.handleEvents();
  5135. };
  5136. })(jQuery);
  5137. ;(function ($) {
  5138. $.fn.pushpin = function (options) {
  5139. // Defaults
  5140. var defaults = {
  5141. top: 0,
  5142. bottom: Infinity,
  5143. offset: 0
  5144. };
  5145. // Remove pushpin event and classes
  5146. if (options === "remove") {
  5147. this.each(function () {
  5148. if (id = $(this).data('pushpin-id')) {
  5149. $(window).off('scroll.' + id);
  5150. $(this).removeData('pushpin-id').removeClass('pin-top pinned pin-bottom').removeAttr('style');
  5151. }
  5152. });
  5153. return false;
  5154. }
  5155. options = $.extend(defaults, options);
  5156. $index = 0;
  5157. return this.each(function () {
  5158. var $uniqueId = Materialize.guid(),
  5159. $this = $(this),
  5160. $original_offset = $(this).offset().top;
  5161. function removePinClasses(object) {
  5162. object.removeClass('pin-top');
  5163. object.removeClass('pinned');
  5164. object.removeClass('pin-bottom');
  5165. }
  5166. function updateElements(objects, scrolled) {
  5167. objects.each(function () {
  5168. // Add position fixed (because its between top and bottom)
  5169. if (options.top <= scrolled && options.bottom >= scrolled && !$(this).hasClass('pinned')) {
  5170. removePinClasses($(this));
  5171. $(this).css('top', options.offset);
  5172. $(this).addClass('pinned');
  5173. }
  5174. // Add pin-top (when scrolled position is above top)
  5175. if (scrolled < options.top && !$(this).hasClass('pin-top')) {
  5176. removePinClasses($(this));
  5177. $(this).css('top', 0);
  5178. $(this).addClass('pin-top');
  5179. }
  5180. // Add pin-bottom (when scrolled position is below bottom)
  5181. if (scrolled > options.bottom && !$(this).hasClass('pin-bottom')) {
  5182. removePinClasses($(this));
  5183. $(this).addClass('pin-bottom');
  5184. $(this).css('top', options.bottom - $original_offset);
  5185. }
  5186. });
  5187. }
  5188. $(this).data('pushpin-id', $uniqueId);
  5189. updateElements($this, $(window).scrollTop());
  5190. $(window).on('scroll.' + $uniqueId, function () {
  5191. var $scrolled = $(window).scrollTop() + options.offset;
  5192. updateElements($this, $scrolled);
  5193. });
  5194. });
  5195. };
  5196. })(jQuery);;(function ($) {
  5197. $(document).ready(function () {
  5198. // jQuery reverse
  5199. $.fn.reverse = [].reverse;
  5200. // Hover behaviour: make sure this doesn't work on .click-to-toggle FABs!
  5201. $(document).on('mouseenter.fixedActionBtn', '.fixed-action-btn:not(.click-to-toggle):not(.toolbar)', function (e) {
  5202. var $this = $(this);
  5203. openFABMenu($this);
  5204. });
  5205. $(document).on('mouseleave.fixedActionBtn', '.fixed-action-btn:not(.click-to-toggle):not(.toolbar)', function (e) {
  5206. var $this = $(this);
  5207. closeFABMenu($this);
  5208. });
  5209. // Toggle-on-click behaviour.
  5210. $(document).on('click.fabClickToggle', '.fixed-action-btn.click-to-toggle > a', function (e) {
  5211. var $this = $(this);
  5212. var $menu = $this.parent();
  5213. if ($menu.hasClass('active')) {
  5214. closeFABMenu($menu);
  5215. } else {
  5216. openFABMenu($menu);
  5217. }
  5218. });
  5219. // Toolbar transition behaviour.
  5220. $(document).on('click.fabToolbar', '.fixed-action-btn.toolbar > a', function (e) {
  5221. var $this = $(this);
  5222. var $menu = $this.parent();
  5223. FABtoToolbar($menu);
  5224. });
  5225. });
  5226. $.fn.extend({
  5227. openFAB: function () {
  5228. openFABMenu($(this));
  5229. },
  5230. closeFAB: function () {
  5231. closeFABMenu($(this));
  5232. },
  5233. openToolbar: function () {
  5234. FABtoToolbar($(this));
  5235. },
  5236. closeToolbar: function () {
  5237. toolbarToFAB($(this));
  5238. }
  5239. });
  5240. var openFABMenu = function (btn) {
  5241. var $this = btn;
  5242. if ($this.hasClass('active') === false) {
  5243. // Get direction option
  5244. var horizontal = $this.hasClass('horizontal');
  5245. var offsetY, offsetX;
  5246. if (horizontal === true) {
  5247. offsetX = 40;
  5248. } else {
  5249. offsetY = 40;
  5250. }
  5251. $this.addClass('active');
  5252. $this.find('ul .btn-floating').velocity({ scaleY: ".4", scaleX: ".4", translateY: offsetY + 'px', translateX: offsetX + 'px' }, { duration: 0 });
  5253. var time = 0;
  5254. $this.find('ul .btn-floating').reverse().each(function () {
  5255. $(this).velocity({ opacity: "1", scaleX: "1", scaleY: "1", translateY: "0", translateX: '0' }, { duration: 80, delay: time });
  5256. time += 40;
  5257. });
  5258. }
  5259. };
  5260. var closeFABMenu = function (btn) {
  5261. var $this = btn;
  5262. // Get direction option
  5263. var horizontal = $this.hasClass('horizontal');
  5264. var offsetY, offsetX;
  5265. if (horizontal === true) {
  5266. offsetX = 40;
  5267. } else {
  5268. offsetY = 40;
  5269. }
  5270. $this.removeClass('active');
  5271. var time = 0;
  5272. $this.find('ul .btn-floating').velocity("stop", true);
  5273. $this.find('ul .btn-floating').velocity({ opacity: "0", scaleX: ".4", scaleY: ".4", translateY: offsetY + 'px', translateX: offsetX + 'px' }, { duration: 80 });
  5274. };
  5275. /**
  5276. * Transform FAB into toolbar
  5277. * @param {Object} object jQuery object
  5278. */
  5279. var FABtoToolbar = function (btn) {
  5280. if (btn.attr('data-open') === "true") {
  5281. return;
  5282. }
  5283. var offsetX, offsetY, scaleFactor;
  5284. var windowWidth = window.innerWidth;
  5285. var windowHeight = window.innerHeight;
  5286. var btnRect = btn[0].getBoundingClientRect();
  5287. var anchor = btn.find('> a').first();
  5288. var menu = btn.find('> ul').first();
  5289. var backdrop = $('<div class="fab-backdrop"></div>');
  5290. var fabColor = anchor.css('background-color');
  5291. anchor.append(backdrop);
  5292. offsetX = btnRect.left - windowWidth / 2 + btnRect.width / 2;
  5293. offsetY = windowHeight - btnRect.bottom;
  5294. scaleFactor = windowWidth / backdrop.width();
  5295. btn.attr('data-origin-bottom', btnRect.bottom);
  5296. btn.attr('data-origin-left', btnRect.left);
  5297. btn.attr('data-origin-width', btnRect.width);
  5298. // Set initial state
  5299. btn.addClass('active');
  5300. btn.attr('data-open', true);
  5301. btn.css({
  5302. 'text-align': 'center',
  5303. width: '100%',
  5304. bottom: 0,
  5305. left: 0,
  5306. transform: 'translateX(' + offsetX + 'px)',
  5307. transition: 'none'
  5308. });
  5309. anchor.css({
  5310. transform: 'translateY(' + -offsetY + 'px)',
  5311. transition: 'none'
  5312. });
  5313. backdrop.css({
  5314. 'background-color': fabColor
  5315. });
  5316. setTimeout(function () {
  5317. btn.css({
  5318. transform: '',
  5319. transition: 'transform .2s cubic-bezier(0.550, 0.085, 0.680, 0.530), background-color 0s linear .2s'
  5320. });
  5321. anchor.css({
  5322. overflow: 'visible',
  5323. transform: '',
  5324. transition: 'transform .2s'
  5325. });
  5326. setTimeout(function () {
  5327. btn.css({
  5328. overflow: 'hidden',
  5329. 'background-color': fabColor
  5330. });
  5331. backdrop.css({
  5332. transform: 'scale(' + scaleFactor + ')',
  5333. transition: 'transform .2s cubic-bezier(0.550, 0.055, 0.675, 0.190)'
  5334. });
  5335. menu.find('> li > a').css({
  5336. opacity: 1
  5337. });
  5338. // Scroll to close.
  5339. $(window).on('scroll.fabToolbarClose', function () {
  5340. toolbarToFAB(btn);
  5341. $(window).off('scroll.fabToolbarClose');
  5342. $(document).off('click.fabToolbarClose');
  5343. });
  5344. $(document).on('click.fabToolbarClose', function (e) {
  5345. if (!$(e.target).closest(menu).length) {
  5346. toolbarToFAB(btn);
  5347. $(window).off('scroll.fabToolbarClose');
  5348. $(document).off('click.fabToolbarClose');
  5349. }
  5350. });
  5351. }, 100);
  5352. }, 0);
  5353. };
  5354. /**
  5355. * Transform toolbar back into FAB
  5356. * @param {Object} object jQuery object
  5357. */
  5358. var toolbarToFAB = function (btn) {
  5359. if (btn.attr('data-open') !== "true") {
  5360. return;
  5361. }
  5362. var offsetX, offsetY, scaleFactor;
  5363. var windowWidth = window.innerWidth;
  5364. var windowHeight = window.innerHeight;
  5365. var btnWidth = btn.attr('data-origin-width');
  5366. var btnBottom = btn.attr('data-origin-bottom');
  5367. var btnLeft = btn.attr('data-origin-left');
  5368. var anchor = btn.find('> .btn-floating').first();
  5369. var menu = btn.find('> ul').first();
  5370. var backdrop = btn.find('.fab-backdrop');
  5371. var fabColor = anchor.css('background-color');
  5372. offsetX = btnLeft - windowWidth / 2 + btnWidth / 2;
  5373. offsetY = windowHeight - btnBottom;
  5374. scaleFactor = windowWidth / backdrop.width();
  5375. // Hide backdrop
  5376. btn.removeClass('active');
  5377. btn.attr('data-open', false);
  5378. btn.css({
  5379. 'background-color': 'transparent',
  5380. transition: 'none'
  5381. });
  5382. anchor.css({
  5383. transition: 'none'
  5384. });
  5385. backdrop.css({
  5386. transform: 'scale(0)',
  5387. 'background-color': fabColor
  5388. });
  5389. menu.find('> li > a').css({
  5390. opacity: ''
  5391. });
  5392. setTimeout(function () {
  5393. backdrop.remove();
  5394. // Set initial state.
  5395. btn.css({
  5396. 'text-align': '',
  5397. width: '',
  5398. bottom: '',
  5399. left: '',
  5400. overflow: '',
  5401. 'background-color': '',
  5402. transform: 'translate3d(' + -offsetX + 'px,0,0)'
  5403. });
  5404. anchor.css({
  5405. overflow: '',
  5406. transform: 'translate3d(0,' + offsetY + 'px,0)'
  5407. });
  5408. setTimeout(function () {
  5409. btn.css({
  5410. transform: 'translate3d(0,0,0)',
  5411. transition: 'transform .2s'
  5412. });
  5413. anchor.css({
  5414. transform: 'translate3d(0,0,0)',
  5415. transition: 'transform .2s cubic-bezier(0.550, 0.055, 0.675, 0.190)'
  5416. });
  5417. }, 20);
  5418. }, 200);
  5419. };
  5420. })(jQuery);
  5421. ;(function ($) {
  5422. // Image transition function
  5423. Materialize.fadeInImage = function (selectorOrEl) {
  5424. var element;
  5425. if (typeof selectorOrEl === 'string') {
  5426. element = $(selectorOrEl);
  5427. } else if (typeof selectorOrEl === 'object') {
  5428. element = selectorOrEl;
  5429. } else {
  5430. return;
  5431. }
  5432. element.css({ opacity: 0 });
  5433. $(element).velocity({ opacity: 1 }, {
  5434. duration: 650,
  5435. queue: false,
  5436. easing: 'easeOutSine'
  5437. });
  5438. $(element).velocity({ opacity: 1 }, {
  5439. duration: 1300,
  5440. queue: false,
  5441. easing: 'swing',
  5442. step: function (now, fx) {
  5443. fx.start = 100;
  5444. var grayscale_setting = now / 100;
  5445. var brightness_setting = 150 - (100 - now) / 1.75;
  5446. if (brightness_setting < 100) {
  5447. brightness_setting = 100;
  5448. }
  5449. if (now >= 0) {
  5450. $(this).css({
  5451. "-webkit-filter": "grayscale(" + grayscale_setting + ")" + "brightness(" + brightness_setting + "%)",
  5452. "filter": "grayscale(" + grayscale_setting + ")" + "brightness(" + brightness_setting + "%)"
  5453. });
  5454. }
  5455. }
  5456. });
  5457. };
  5458. // Horizontal staggered list
  5459. Materialize.showStaggeredList = function (selectorOrEl) {
  5460. var element;
  5461. if (typeof selectorOrEl === 'string') {
  5462. element = $(selectorOrEl);
  5463. } else if (typeof selectorOrEl === 'object') {
  5464. element = selectorOrEl;
  5465. } else {
  5466. return;
  5467. }
  5468. var time = 0;
  5469. element.find('li').velocity({ translateX: "-100px" }, { duration: 0 });
  5470. element.find('li').each(function () {
  5471. $(this).velocity({ opacity: "1", translateX: "0" }, { duration: 800, delay: time, easing: [60, 10] });
  5472. time += 120;
  5473. });
  5474. };
  5475. $(document).ready(function () {
  5476. // Hardcoded .staggered-list scrollFire
  5477. // var staggeredListOptions = [];
  5478. // $('ul.staggered-list').each(function (i) {
  5479. // var label = 'scrollFire-' + i;
  5480. // $(this).addClass(label);
  5481. // staggeredListOptions.push(
  5482. // {selector: 'ul.staggered-list.' + label,
  5483. // offset: 200,
  5484. // callback: 'showStaggeredList("ul.staggered-list.' + label + '")'});
  5485. // });
  5486. // scrollFire(staggeredListOptions);
  5487. // HammerJS, Swipe navigation
  5488. // Touch Event
  5489. var swipeLeft = false;
  5490. var swipeRight = false;
  5491. // Dismissible Collections
  5492. $('.dismissable').each(function () {
  5493. $(this).hammer({
  5494. prevent_default: false
  5495. }).on('pan', function (e) {
  5496. if (e.gesture.pointerType === "touch") {
  5497. var $this = $(this);
  5498. var direction = e.gesture.direction;
  5499. var x = e.gesture.deltaX;
  5500. var velocityX = e.gesture.velocityX;
  5501. $this.velocity({ translateX: x
  5502. }, { duration: 50, queue: false, easing: 'easeOutQuad' });
  5503. // Swipe Left
  5504. if (direction === 4 && (x > $this.innerWidth() / 2 || velocityX < -0.75)) {
  5505. swipeLeft = true;
  5506. }
  5507. // Swipe Right
  5508. if (direction === 2 && (x < -1 * $this.innerWidth() / 2 || velocityX > 0.75)) {
  5509. swipeRight = true;
  5510. }
  5511. }
  5512. }).on('panend', function (e) {
  5513. // Reset if collection is moved back into original position
  5514. if (Math.abs(e.gesture.deltaX) < $(this).innerWidth() / 2) {
  5515. swipeRight = false;
  5516. swipeLeft = false;
  5517. }
  5518. if (e.gesture.pointerType === "touch") {
  5519. var $this = $(this);
  5520. if (swipeLeft || swipeRight) {
  5521. var fullWidth;
  5522. if (swipeLeft) {
  5523. fullWidth = $this.innerWidth();
  5524. } else {
  5525. fullWidth = -1 * $this.innerWidth();
  5526. }
  5527. $this.velocity({ translateX: fullWidth
  5528. }, { duration: 100, queue: false, easing: 'easeOutQuad', complete: function () {
  5529. $this.css('border', 'none');
  5530. $this.velocity({ height: 0, padding: 0
  5531. }, { duration: 200, queue: false, easing: 'easeOutQuad', complete: function () {
  5532. $this.remove();
  5533. }
  5534. });
  5535. }
  5536. });
  5537. } else {
  5538. $this.velocity({ translateX: 0
  5539. }, { duration: 100, queue: false, easing: 'easeOutQuad' });
  5540. }
  5541. swipeLeft = false;
  5542. swipeRight = false;
  5543. }
  5544. });
  5545. });
  5546. // time = 0
  5547. // // Vertical Staggered list
  5548. // $('ul.staggered-list.vertical li').velocity(
  5549. // { translateY: "100px"},
  5550. // { duration: 0 });
  5551. // $('ul.staggered-list.vertical li').each(function() {
  5552. // $(this).velocity(
  5553. // { opacity: "1", translateY: "0"},
  5554. // { duration: 800, delay: time, easing: [60, 25] });
  5555. // time += 120;
  5556. // });
  5557. // // Fade in and Scale
  5558. // $('.fade-in.scale').velocity(
  5559. // { scaleX: .4, scaleY: .4, translateX: -600},
  5560. // { duration: 0});
  5561. // $('.fade-in').each(function() {
  5562. // $(this).velocity(
  5563. // { opacity: "1", scaleX: 1, scaleY: 1, translateX: 0},
  5564. // { duration: 800, easing: [60, 10] });
  5565. // });
  5566. });
  5567. })(jQuery);
  5568. ;(function ($) {
  5569. var scrollFireEventsHandled = false;
  5570. // Input: Array of JSON objects {selector, offset, callback}
  5571. Materialize.scrollFire = function (options) {
  5572. var onScroll = function () {
  5573. var windowScroll = window.pageYOffset + window.innerHeight;
  5574. for (var i = 0; i < options.length; i++) {
  5575. // Get options from each line
  5576. var value = options[i];
  5577. var selector = value.selector,
  5578. offset = value.offset,
  5579. callback = value.callback;
  5580. var currentElement = document.querySelector(selector);
  5581. if (currentElement !== null) {
  5582. var elementOffset = currentElement.getBoundingClientRect().top + window.pageYOffset;
  5583. if (windowScroll > elementOffset + offset) {
  5584. if (value.done !== true) {
  5585. if (typeof callback === 'function') {
  5586. callback.call(this, currentElement);
  5587. } else if (typeof callback === 'string') {
  5588. var callbackFunc = new Function(callback);
  5589. callbackFunc(currentElement);
  5590. }
  5591. value.done = true;
  5592. }
  5593. }
  5594. }
  5595. }
  5596. };
  5597. var throttledScroll = Materialize.throttle(function () {
  5598. onScroll();
  5599. }, options.throttle || 100);
  5600. if (!scrollFireEventsHandled) {
  5601. window.addEventListener("scroll", throttledScroll);
  5602. window.addEventListener("resize", throttledScroll);
  5603. scrollFireEventsHandled = true;
  5604. }
  5605. // perform a scan once, after current execution context, and after dom is ready
  5606. setTimeout(throttledScroll, 0);
  5607. };
  5608. })(jQuery);
  5609. ; /*!
  5610. * pickadate.js v3.5.0, 2014/04/13
  5611. * By Amsul, http://amsul.ca
  5612. * Hosted on http://amsul.github.io/pickadate.js
  5613. * Licensed under MIT
  5614. */
  5615. (function (factory) {
  5616. Materialize.Picker = factory(jQuery);
  5617. })(function ($) {
  5618. var $window = $(window);
  5619. var $document = $(document);
  5620. var $html = $(document.documentElement);
  5621. /**
  5622. * The picker constructor that creates a blank picker.
  5623. */
  5624. function PickerConstructor(ELEMENT, NAME, COMPONENT, OPTIONS) {
  5625. // If there’s no element, return the picker constructor.
  5626. if (!ELEMENT) return PickerConstructor;
  5627. var IS_DEFAULT_THEME = false,
  5628. // The state of the picker.
  5629. STATE = {
  5630. id: ELEMENT.id || 'P' + Math.abs(~~(Math.random() * new Date()))
  5631. },
  5632. // Merge the defaults and options passed.
  5633. SETTINGS = COMPONENT ? $.extend(true, {}, COMPONENT.defaults, OPTIONS) : OPTIONS || {},
  5634. // Merge the default classes with the settings classes.
  5635. CLASSES = $.extend({}, PickerConstructor.klasses(), SETTINGS.klass),
  5636. // The element node wrapper into a jQuery object.
  5637. $ELEMENT = $(ELEMENT),
  5638. // Pseudo picker constructor.
  5639. PickerInstance = function () {
  5640. return this.start();
  5641. },
  5642. // The picker prototype.
  5643. P = PickerInstance.prototype = {
  5644. constructor: PickerInstance,
  5645. $node: $ELEMENT,
  5646. /**
  5647. * Initialize everything
  5648. */
  5649. start: function () {
  5650. // If it’s already started, do nothing.
  5651. if (STATE && STATE.start) return P;
  5652. // Update the picker states.
  5653. STATE.methods = {};
  5654. STATE.start = true;
  5655. STATE.open = false;
  5656. STATE.type = ELEMENT.type;
  5657. // Confirm focus state, convert into text input to remove UA stylings,
  5658. // and set as readonly to prevent keyboard popup.
  5659. ELEMENT.autofocus = ELEMENT == getActiveElement();
  5660. ELEMENT.readOnly = !SETTINGS.editable;
  5661. ELEMENT.id = ELEMENT.id || STATE.id;
  5662. if (ELEMENT.type != 'text') {
  5663. ELEMENT.type = 'text';
  5664. }
  5665. // Create a new picker component with the settings.
  5666. P.component = new COMPONENT(P, SETTINGS);
  5667. // Create the picker root with a holder and then prepare it.
  5668. P.$root = $(PickerConstructor._.node('div', createWrappedComponent(), CLASSES.picker, 'id="' + ELEMENT.id + '_root" tabindex="0"'));
  5669. prepareElementRoot();
  5670. // If there’s a format for the hidden input element, create the element.
  5671. if (SETTINGS.formatSubmit) {
  5672. prepareElementHidden();
  5673. }
  5674. // Prepare the input element.
  5675. prepareElement();
  5676. // Insert the root as specified in the settings.
  5677. if (SETTINGS.container) $(SETTINGS.container).append(P.$root);else $ELEMENT.before(P.$root);
  5678. // Bind the default component and settings events.
  5679. P.on({
  5680. start: P.component.onStart,
  5681. render: P.component.onRender,
  5682. stop: P.component.onStop,
  5683. open: P.component.onOpen,
  5684. close: P.component.onClose,
  5685. set: P.component.onSet
  5686. }).on({
  5687. start: SETTINGS.onStart,
  5688. render: SETTINGS.onRender,
  5689. stop: SETTINGS.onStop,
  5690. open: SETTINGS.onOpen,
  5691. close: SETTINGS.onClose,
  5692. set: SETTINGS.onSet
  5693. });
  5694. // Once we’re all set, check the theme in use.
  5695. IS_DEFAULT_THEME = isUsingDefaultTheme(P.$root.children()[0]);
  5696. // If the element has autofocus, open the picker.
  5697. if (ELEMENT.autofocus) {
  5698. P.open();
  5699. }
  5700. // Trigger queued the “start” and “render” events.
  5701. return P.trigger('start').trigger('render');
  5702. }, //start
  5703. /**
  5704. * Render a new picker
  5705. */
  5706. render: function (entireComponent) {
  5707. // Insert a new component holder in the root or box.
  5708. if (entireComponent) P.$root.html(createWrappedComponent());else P.$root.find('.' + CLASSES.box).html(P.component.nodes(STATE.open));
  5709. // Trigger the queued “render” events.
  5710. return P.trigger('render');
  5711. }, //render
  5712. /**
  5713. * Destroy everything
  5714. */
  5715. stop: function () {
  5716. // If it’s already stopped, do nothing.
  5717. if (!STATE.start) return P;
  5718. // Then close the picker.
  5719. P.close();
  5720. // Remove the hidden field.
  5721. if (P._hidden) {
  5722. P._hidden.parentNode.removeChild(P._hidden);
  5723. }
  5724. // Remove the root.
  5725. P.$root.remove();
  5726. // Remove the input class, remove the stored data, and unbind
  5727. // the events (after a tick for IE - see `P.close`).
  5728. $ELEMENT.removeClass(CLASSES.input).removeData(NAME);
  5729. setTimeout(function () {
  5730. $ELEMENT.off('.' + STATE.id);
  5731. }, 0);
  5732. // Restore the element state
  5733. ELEMENT.type = STATE.type;
  5734. ELEMENT.readOnly = false;
  5735. // Trigger the queued “stop” events.
  5736. P.trigger('stop');
  5737. // Reset the picker states.
  5738. STATE.methods = {};
  5739. STATE.start = false;
  5740. return P;
  5741. }, //stop
  5742. /**
  5743. * Open up the picker
  5744. */
  5745. open: function (dontGiveFocus) {
  5746. // If it’s already open, do nothing.
  5747. if (STATE.open) return P;
  5748. // Add the “active” class.
  5749. $ELEMENT.addClass(CLASSES.active);
  5750. aria(ELEMENT, 'expanded', true);
  5751. // * A Firefox bug, when `html` has `overflow:hidden`, results in
  5752. // killing transitions :(. So add the “opened” state on the next tick.
  5753. // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=625289
  5754. setTimeout(function () {
  5755. // Add the “opened” class to the picker root.
  5756. P.$root.addClass(CLASSES.opened);
  5757. aria(P.$root[0], 'hidden', false);
  5758. }, 0);
  5759. // If we have to give focus, bind the element and doc events.
  5760. if (dontGiveFocus !== false) {
  5761. // Set it as open.
  5762. STATE.open = true;
  5763. // Prevent the page from scrolling.
  5764. if (IS_DEFAULT_THEME) {
  5765. $html.css('overflow', 'hidden').css('padding-right', '+=' + getScrollbarWidth());
  5766. }
  5767. // Pass focus to the root element’s jQuery object.
  5768. // * Workaround for iOS8 to bring the picker’s root into view.
  5769. P.$root.eq(0).focus();
  5770. // Bind the document events.
  5771. $document.on('click.' + STATE.id + ' focusin.' + STATE.id, function (event) {
  5772. var target = event.target;
  5773. // If the target of the event is not the element, close the picker picker.
  5774. // * Don’t worry about clicks or focusins on the root because those don’t bubble up.
  5775. // Also, for Firefox, a click on an `option` element bubbles up directly
  5776. // to the doc. So make sure the target wasn't the doc.
  5777. // * In Firefox stopPropagation() doesn’t prevent right-click events from bubbling,
  5778. // which causes the picker to unexpectedly close when right-clicking it. So make
  5779. // sure the event wasn’t a right-click.
  5780. if (target != ELEMENT && target != document && event.which != 3) {
  5781. // If the target was the holder that covers the screen,
  5782. // keep the element focused to maintain tabindex.
  5783. P.close(target === P.$root.children()[0]);
  5784. }
  5785. }).on('keydown.' + STATE.id, function (event) {
  5786. var
  5787. // Get the keycode.
  5788. keycode = event.keyCode,
  5789. // Translate that to a selection change.
  5790. keycodeToMove = P.component.key[keycode],
  5791. // Grab the target.
  5792. target = event.target;
  5793. // On escape, close the picker and give focus.
  5794. if (keycode == 27) {
  5795. P.close(true);
  5796. }
  5797. // Check if there is a key movement or “enter” keypress on the element.
  5798. else if (target == P.$root[0] && (keycodeToMove || keycode == 13)) {
  5799. // Prevent the default action to stop page movement.
  5800. event.preventDefault();
  5801. // Trigger the key movement action.
  5802. if (keycodeToMove) {
  5803. PickerConstructor._.trigger(P.component.key.go, P, [PickerConstructor._.trigger(keycodeToMove)]);
  5804. }
  5805. // On “enter”, if the highlighted item isn’t disabled, set the value and close.
  5806. else if (!P.$root.find('.' + CLASSES.highlighted).hasClass(CLASSES.disabled)) {
  5807. P.set('select', P.component.item.highlight);
  5808. if (SETTINGS.closeOnSelect) {
  5809. P.close(true);
  5810. }
  5811. }
  5812. }
  5813. // If the target is within the root and “enter” is pressed,
  5814. // prevent the default action and trigger a click on the target instead.
  5815. else if ($.contains(P.$root[0], target) && keycode == 13) {
  5816. event.preventDefault();
  5817. target.click();
  5818. }
  5819. });
  5820. }
  5821. // Trigger the queued “open” events.
  5822. return P.trigger('open');
  5823. }, //open
  5824. /**
  5825. * Close the picker
  5826. */
  5827. close: function (giveFocus) {
  5828. // If we need to give focus, do it before changing states.
  5829. if (giveFocus) {
  5830. // ....ah yes! It would’ve been incomplete without a crazy workaround for IE :|
  5831. // The focus is triggered *after* the close has completed - causing it
  5832. // to open again. So unbind and rebind the event at the next tick.
  5833. P.$root.off('focus.toOpen').eq(0).focus();
  5834. setTimeout(function () {
  5835. P.$root.on('focus.toOpen', handleFocusToOpenEvent);
  5836. }, 0);
  5837. }
  5838. // Remove the “active” class.
  5839. $ELEMENT.removeClass(CLASSES.active);
  5840. aria(ELEMENT, 'expanded', false);
  5841. // * A Firefox bug, when `html` has `overflow:hidden`, results in
  5842. // killing transitions :(. So remove the “opened” state on the next tick.
  5843. // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=625289
  5844. setTimeout(function () {
  5845. // Remove the “opened” and “focused” class from the picker root.
  5846. P.$root.removeClass(CLASSES.opened + ' ' + CLASSES.focused);
  5847. aria(P.$root[0], 'hidden', true);
  5848. }, 0);
  5849. // If it’s already closed, do nothing more.
  5850. if (!STATE.open) return P;
  5851. // Set it as closed.
  5852. STATE.open = false;
  5853. // Allow the page to scroll.
  5854. if (IS_DEFAULT_THEME) {
  5855. $html.css('overflow', '').css('padding-right', '-=' + getScrollbarWidth());
  5856. }
  5857. // Unbind the document events.
  5858. $document.off('.' + STATE.id);
  5859. // Trigger the queued “close” events.
  5860. return P.trigger('close');
  5861. }, //close
  5862. /**
  5863. * Clear the values
  5864. */
  5865. clear: function (options) {
  5866. return P.set('clear', null, options);
  5867. }, //clear
  5868. /**
  5869. * Set something
  5870. */
  5871. set: function (thing, value, options) {
  5872. var thingItem,
  5873. thingValue,
  5874. thingIsObject = $.isPlainObject(thing),
  5875. thingObject = thingIsObject ? thing : {};
  5876. // Make sure we have usable options.
  5877. options = thingIsObject && $.isPlainObject(value) ? value : options || {};
  5878. if (thing) {
  5879. // If the thing isn’t an object, make it one.
  5880. if (!thingIsObject) {
  5881. thingObject[thing] = value;
  5882. }
  5883. // Go through the things of items to set.
  5884. for (thingItem in thingObject) {
  5885. // Grab the value of the thing.
  5886. thingValue = thingObject[thingItem];
  5887. // First, if the item exists and there’s a value, set it.
  5888. if (thingItem in P.component.item) {
  5889. if (thingValue === undefined) thingValue = null;
  5890. P.component.set(thingItem, thingValue, options);
  5891. }
  5892. // Then, check to update the element value and broadcast a change.
  5893. if (thingItem == 'select' || thingItem == 'clear') {
  5894. $ELEMENT.val(thingItem == 'clear' ? '' : P.get(thingItem, SETTINGS.format)).trigger('change');
  5895. }
  5896. }
  5897. // Render a new picker.
  5898. P.render();
  5899. }
  5900. // When the method isn’t muted, trigger queued “set” events and pass the `thingObject`.
  5901. return options.muted ? P : P.trigger('set', thingObject);
  5902. }, //set
  5903. /**
  5904. * Get something
  5905. */
  5906. get: function (thing, format) {
  5907. // Make sure there’s something to get.
  5908. thing = thing || 'value';
  5909. // If a picker state exists, return that.
  5910. if (STATE[thing] != null) {
  5911. return STATE[thing];
  5912. }
  5913. // Return the submission value, if that.
  5914. if (thing == 'valueSubmit') {
  5915. if (P._hidden) {
  5916. return P._hidden.value;
  5917. }
  5918. thing = 'value';
  5919. }
  5920. // Return the value, if that.
  5921. if (thing == 'value') {
  5922. return ELEMENT.value;
  5923. }
  5924. // Check if a component item exists, return that.
  5925. if (thing in P.component.item) {
  5926. if (typeof format == 'string') {
  5927. var thingValue = P.component.get(thing);
  5928. return thingValue ? PickerConstructor._.trigger(P.component.formats.toString, P.component, [format, thingValue]) : '';
  5929. }
  5930. return P.component.get(thing);
  5931. }
  5932. }, //get
  5933. /**
  5934. * Bind events on the things.
  5935. */
  5936. on: function (thing, method, internal) {
  5937. var thingName,
  5938. thingMethod,
  5939. thingIsObject = $.isPlainObject(thing),
  5940. thingObject = thingIsObject ? thing : {};
  5941. if (thing) {
  5942. // If the thing isn’t an object, make it one.
  5943. if (!thingIsObject) {
  5944. thingObject[thing] = method;
  5945. }
  5946. // Go through the things to bind to.
  5947. for (thingName in thingObject) {
  5948. // Grab the method of the thing.
  5949. thingMethod = thingObject[thingName];
  5950. // If it was an internal binding, prefix it.
  5951. if (internal) {
  5952. thingName = '_' + thingName;
  5953. }
  5954. // Make sure the thing methods collection exists.
  5955. STATE.methods[thingName] = STATE.methods[thingName] || [];
  5956. // Add the method to the relative method collection.
  5957. STATE.methods[thingName].push(thingMethod);
  5958. }
  5959. }
  5960. return P;
  5961. }, //on
  5962. /**
  5963. * Unbind events on the things.
  5964. */
  5965. off: function () {
  5966. var i,
  5967. thingName,
  5968. names = arguments;
  5969. for (i = 0, namesCount = names.length; i < namesCount; i += 1) {
  5970. thingName = names[i];
  5971. if (thingName in STATE.methods) {
  5972. delete STATE.methods[thingName];
  5973. }
  5974. }
  5975. return P;
  5976. },
  5977. /**
  5978. * Fire off method events.
  5979. */
  5980. trigger: function (name, data) {
  5981. var _trigger = function (name) {
  5982. var methodList = STATE.methods[name];
  5983. if (methodList) {
  5984. methodList.map(function (method) {
  5985. PickerConstructor._.trigger(method, P, [data]);
  5986. });
  5987. }
  5988. };
  5989. _trigger('_' + name);
  5990. _trigger(name);
  5991. return P;
  5992. } //trigger
  5993. //PickerInstance.prototype
  5994. /**
  5995. * Wrap the picker holder components together.
  5996. */
  5997. };function createWrappedComponent() {
  5998. // Create a picker wrapper holder
  5999. return PickerConstructor._.node('div',
  6000. // Create a picker wrapper node
  6001. PickerConstructor._.node('div',
  6002. // Create a picker frame
  6003. PickerConstructor._.node('div',
  6004. // Create a picker box node
  6005. PickerConstructor._.node('div',
  6006. // Create the components nodes.
  6007. P.component.nodes(STATE.open),
  6008. // The picker box class
  6009. CLASSES.box),
  6010. // Picker wrap class
  6011. CLASSES.wrap),
  6012. // Picker frame class
  6013. CLASSES.frame),
  6014. // Picker holder class
  6015. CLASSES.holder); //endreturn
  6016. } //createWrappedComponent
  6017. /**
  6018. * Prepare the input element with all bindings.
  6019. */
  6020. function prepareElement() {
  6021. $ELEMENT.
  6022. // Store the picker data by component name.
  6023. data(NAME, P).
  6024. // Add the “input” class name.
  6025. addClass(CLASSES.input).
  6026. // Remove the tabindex.
  6027. attr('tabindex', -1).
  6028. // If there’s a `data-value`, update the value of the element.
  6029. val($ELEMENT.data('value') ? P.get('select', SETTINGS.format) : ELEMENT.value);
  6030. // Only bind keydown events if the element isn’t editable.
  6031. if (!SETTINGS.editable) {
  6032. $ELEMENT.
  6033. // On focus/click, focus onto the root to open it up.
  6034. on('focus.' + STATE.id + ' click.' + STATE.id, function (event) {
  6035. event.preventDefault();
  6036. P.$root.eq(0).focus();
  6037. }).
  6038. // Handle keyboard event based on the picker being opened or not.
  6039. on('keydown.' + STATE.id, handleKeydownEvent);
  6040. }
  6041. // Update the aria attributes.
  6042. aria(ELEMENT, {
  6043. haspopup: true,
  6044. expanded: false,
  6045. readonly: false,
  6046. owns: ELEMENT.id + '_root'
  6047. });
  6048. }
  6049. /**
  6050. * Prepare the root picker element with all bindings.
  6051. */
  6052. function prepareElementRoot() {
  6053. P.$root.on({
  6054. // For iOS8.
  6055. keydown: handleKeydownEvent,
  6056. // When something within the root is focused, stop from bubbling
  6057. // to the doc and remove the “focused” state from the root.
  6058. focusin: function (event) {
  6059. P.$root.removeClass(CLASSES.focused);
  6060. event.stopPropagation();
  6061. },
  6062. // When something within the root holder is clicked, stop it
  6063. // from bubbling to the doc.
  6064. 'mousedown click': function (event) {
  6065. var target = event.target;
  6066. // Make sure the target isn’t the root holder so it can bubble up.
  6067. if (target != P.$root.children()[0]) {
  6068. event.stopPropagation();
  6069. // * For mousedown events, cancel the default action in order to
  6070. // prevent cases where focus is shifted onto external elements
  6071. // when using things like jQuery mobile or MagnificPopup (ref: #249 & #120).
  6072. // Also, for Firefox, don’t prevent action on the `option` element.
  6073. if (event.type == 'mousedown' && !$(target).is('input, select, textarea, button, option')) {
  6074. event.preventDefault();
  6075. // Re-focus onto the root so that users can click away
  6076. // from elements focused within the picker.
  6077. P.$root.eq(0).focus();
  6078. }
  6079. }
  6080. }
  6081. }).
  6082. // Add/remove the “target” class on focus and blur.
  6083. on({
  6084. focus: function () {
  6085. $ELEMENT.addClass(CLASSES.target);
  6086. },
  6087. blur: function () {
  6088. $ELEMENT.removeClass(CLASSES.target);
  6089. }
  6090. }).
  6091. // Open the picker and adjust the root “focused” state
  6092. on('focus.toOpen', handleFocusToOpenEvent).
  6093. // If there’s a click on an actionable element, carry out the actions.
  6094. on('click', '[data-pick], [data-nav], [data-clear], [data-close]', function () {
  6095. var $target = $(this),
  6096. targetData = $target.data(),
  6097. targetDisabled = $target.hasClass(CLASSES.navDisabled) || $target.hasClass(CLASSES.disabled),
  6098. // * For IE, non-focusable elements can be active elements as well
  6099. // (http://stackoverflow.com/a/2684561).
  6100. activeElement = getActiveElement();
  6101. activeElement = activeElement && (activeElement.type || activeElement.href) && activeElement;
  6102. // If it’s disabled or nothing inside is actively focused, re-focus the element.
  6103. if (targetDisabled || activeElement && !$.contains(P.$root[0], activeElement)) {
  6104. P.$root.eq(0).focus();
  6105. }
  6106. // If something is superficially changed, update the `highlight` based on the `nav`.
  6107. if (!targetDisabled && targetData.nav) {
  6108. P.set('highlight', P.component.item.highlight, { nav: targetData.nav });
  6109. }
  6110. // If something is picked, set `select` then close with focus.
  6111. else if (!targetDisabled && 'pick' in targetData) {
  6112. P.set('select', targetData.pick);
  6113. if (SETTINGS.closeOnSelect) {
  6114. P.close(true);
  6115. }
  6116. }
  6117. // If a “clear” button is pressed, empty the values and close with focus.
  6118. else if (targetData.clear) {
  6119. P.clear();
  6120. if (SETTINGS.closeOnSelect) {
  6121. P.close(true);
  6122. }
  6123. } else if (targetData.close) {
  6124. P.close(true);
  6125. }
  6126. }); //P.$root
  6127. aria(P.$root[0], 'hidden', true);
  6128. }
  6129. /**
  6130. * Prepare the hidden input element along with all bindings.
  6131. */
  6132. function prepareElementHidden() {
  6133. var name;
  6134. if (SETTINGS.hiddenName === true) {
  6135. name = ELEMENT.name;
  6136. ELEMENT.name = '';
  6137. } else {
  6138. name = [typeof SETTINGS.hiddenPrefix == 'string' ? SETTINGS.hiddenPrefix : '', typeof SETTINGS.hiddenSuffix == 'string' ? SETTINGS.hiddenSuffix : '_submit'];
  6139. name = name[0] + ELEMENT.name + name[1];
  6140. }
  6141. P._hidden = $('<input ' + 'type=hidden ' +
  6142. // Create the name using the original input’s with a prefix and suffix.
  6143. 'name="' + name + '"' + (
  6144. // If the element has a value, set the hidden value as well.
  6145. $ELEMENT.data('value') || ELEMENT.value ? ' value="' + P.get('select', SETTINGS.formatSubmit) + '"' : '') + '>')[0];
  6146. $ELEMENT.
  6147. // If the value changes, update the hidden input with the correct format.
  6148. on('change.' + STATE.id, function () {
  6149. P._hidden.value = ELEMENT.value ? P.get('select', SETTINGS.formatSubmit) : '';
  6150. });
  6151. // Insert the hidden input as specified in the settings.
  6152. if (SETTINGS.container) $(SETTINGS.container).append(P._hidden);else $ELEMENT.before(P._hidden);
  6153. }
  6154. // For iOS8.
  6155. function handleKeydownEvent(event) {
  6156. var keycode = event.keyCode,
  6157. // Check if one of the delete keys was pressed.
  6158. isKeycodeDelete = /^(8|46)$/.test(keycode);
  6159. // For some reason IE clears the input value on “escape”.
  6160. if (keycode == 27) {
  6161. P.close();
  6162. return false;
  6163. }
  6164. // Check if `space` or `delete` was pressed or the picker is closed with a key movement.
  6165. if (keycode == 32 || isKeycodeDelete || !STATE.open && P.component.key[keycode]) {
  6166. // Prevent it from moving the page and bubbling to doc.
  6167. event.preventDefault();
  6168. event.stopPropagation();
  6169. // If `delete` was pressed, clear the values and close the picker.
  6170. // Otherwise open the picker.
  6171. if (isKeycodeDelete) {
  6172. P.clear().close();
  6173. } else {
  6174. P.open();
  6175. }
  6176. }
  6177. }
  6178. // Separated for IE
  6179. function handleFocusToOpenEvent(event) {
  6180. // Stop the event from propagating to the doc.
  6181. event.stopPropagation();
  6182. // If it’s a focus event, add the “focused” class to the root.
  6183. if (event.type == 'focus') {
  6184. P.$root.addClass(CLASSES.focused);
  6185. }
  6186. // And then finally open the picker.
  6187. P.open();
  6188. }
  6189. // Return a new picker instance.
  6190. return new PickerInstance();
  6191. } //PickerConstructor
  6192. /**
  6193. * The default classes and prefix to use for the HTML classes.
  6194. */
  6195. PickerConstructor.klasses = function (prefix) {
  6196. prefix = prefix || 'picker';
  6197. return {
  6198. picker: prefix,
  6199. opened: prefix + '--opened',
  6200. focused: prefix + '--focused',
  6201. input: prefix + '__input',
  6202. active: prefix + '__input--active',
  6203. target: prefix + '__input--target',
  6204. holder: prefix + '__holder',
  6205. frame: prefix + '__frame',
  6206. wrap: prefix + '__wrap',
  6207. box: prefix + '__box'
  6208. };
  6209. }; //PickerConstructor.klasses
  6210. /**
  6211. * Check if the default theme is being used.
  6212. */
  6213. function isUsingDefaultTheme(element) {
  6214. var theme,
  6215. prop = 'position';
  6216. // For IE.
  6217. if (element.currentStyle) {
  6218. theme = element.currentStyle[prop];
  6219. }
  6220. // For normal browsers.
  6221. else if (window.getComputedStyle) {
  6222. theme = getComputedStyle(element)[prop];
  6223. }
  6224. return theme == 'fixed';
  6225. }
  6226. /**
  6227. * Get the width of the browser’s scrollbar.
  6228. * Taken from: https://github.com/VodkaBears/Remodal/blob/master/src/jquery.remodal.js
  6229. */
  6230. function getScrollbarWidth() {
  6231. if ($html.height() <= $window.height()) {
  6232. return 0;
  6233. }
  6234. var $outer = $('<div style="visibility:hidden;width:100px" />').appendTo('body');
  6235. // Get the width without scrollbars.
  6236. var widthWithoutScroll = $outer[0].offsetWidth;
  6237. // Force adding scrollbars.
  6238. $outer.css('overflow', 'scroll');
  6239. // Add the inner div.
  6240. var $inner = $('<div style="width:100%" />').appendTo($outer);
  6241. // Get the width with scrollbars.
  6242. var widthWithScroll = $inner[0].offsetWidth;
  6243. // Remove the divs.
  6244. $outer.remove();
  6245. // Return the difference between the widths.
  6246. return widthWithoutScroll - widthWithScroll;
  6247. }
  6248. /**
  6249. * PickerConstructor helper methods.
  6250. */
  6251. PickerConstructor._ = {
  6252. /**
  6253. * Create a group of nodes. Expects:
  6254. * `
  6255. {
  6256. min: {Integer},
  6257. max: {Integer},
  6258. i: {Integer},
  6259. node: {String},
  6260. item: {Function}
  6261. }
  6262. * `
  6263. */
  6264. group: function (groupObject) {
  6265. var
  6266. // Scope for the looped object
  6267. loopObjectScope,
  6268. // Create the nodes list
  6269. nodesList = '',
  6270. // The counter starts from the `min`
  6271. counter = PickerConstructor._.trigger(groupObject.min, groupObject);
  6272. // Loop from the `min` to `max`, incrementing by `i`
  6273. for (; counter <= PickerConstructor._.trigger(groupObject.max, groupObject, [counter]); counter += groupObject.i) {
  6274. // Trigger the `item` function within scope of the object
  6275. loopObjectScope = PickerConstructor._.trigger(groupObject.item, groupObject, [counter]);
  6276. // Splice the subgroup and create nodes out of the sub nodes
  6277. nodesList += PickerConstructor._.node(groupObject.node, loopObjectScope[0], // the node
  6278. loopObjectScope[1], // the classes
  6279. loopObjectScope[2] // the attributes
  6280. );
  6281. }
  6282. // Return the list of nodes
  6283. return nodesList;
  6284. }, //group
  6285. /**
  6286. * Create a dom node string
  6287. */
  6288. node: function (wrapper, item, klass, attribute) {
  6289. // If the item is false-y, just return an empty string
  6290. if (!item) return '';
  6291. // If the item is an array, do a join
  6292. item = $.isArray(item) ? item.join('') : item;
  6293. // Check for the class
  6294. klass = klass ? ' class="' + klass + '"' : '';
  6295. // Check for any attributes
  6296. attribute = attribute ? ' ' + attribute : '';
  6297. // Return the wrapped item
  6298. return '<' + wrapper + klass + attribute + '>' + item + '</' + wrapper + '>';
  6299. }, //node
  6300. /**
  6301. * Lead numbers below 10 with a zero.
  6302. */
  6303. lead: function (number) {
  6304. return (number < 10 ? '0' : '') + number;
  6305. },
  6306. /**
  6307. * Trigger a function otherwise return the value.
  6308. */
  6309. trigger: function (callback, scope, args) {
  6310. return typeof callback == 'function' ? callback.apply(scope, args || []) : callback;
  6311. },
  6312. /**
  6313. * If the second character is a digit, length is 2 otherwise 1.
  6314. */
  6315. digits: function (string) {
  6316. return (/\d/.test(string[1]) ? 2 : 1
  6317. );
  6318. },
  6319. /**
  6320. * Tell if something is a date object.
  6321. */
  6322. isDate: function (value) {
  6323. return {}.toString.call(value).indexOf('Date') > -1 && this.isInteger(value.getDate());
  6324. },
  6325. /**
  6326. * Tell if something is an integer.
  6327. */
  6328. isInteger: function (value) {
  6329. return {}.toString.call(value).indexOf('Number') > -1 && value % 1 === 0;
  6330. },
  6331. /**
  6332. * Create ARIA attribute strings.
  6333. */
  6334. ariaAttr: ariaAttr //PickerConstructor._
  6335. /**
  6336. * Extend the picker with a component and defaults.
  6337. */
  6338. };PickerConstructor.extend = function (name, Component) {
  6339. // Extend jQuery.
  6340. $.fn[name] = function (options, action) {
  6341. // Grab the component data.
  6342. var componentData = this.data(name);
  6343. // If the picker is requested, return the data object.
  6344. if (options == 'picker') {
  6345. return componentData;
  6346. }
  6347. // If the component data exists and `options` is a string, carry out the action.
  6348. if (componentData && typeof options == 'string') {
  6349. return PickerConstructor._.trigger(componentData[options], componentData, [action]);
  6350. }
  6351. // Otherwise go through each matched element and if the component
  6352. // doesn’t exist, create a new picker using `this` element
  6353. // and merging the defaults and options with a deep copy.
  6354. return this.each(function () {
  6355. var $this = $(this);
  6356. if (!$this.data(name)) {
  6357. new PickerConstructor(this, name, Component, options);
  6358. }
  6359. });
  6360. };
  6361. // Set the defaults.
  6362. $.fn[name].defaults = Component.defaults;
  6363. }; //PickerConstructor.extend
  6364. function aria(element, attribute, value) {
  6365. if ($.isPlainObject(attribute)) {
  6366. for (var key in attribute) {
  6367. ariaSet(element, key, attribute[key]);
  6368. }
  6369. } else {
  6370. ariaSet(element, attribute, value);
  6371. }
  6372. }
  6373. function ariaSet(element, attribute, value) {
  6374. element.setAttribute((attribute == 'role' ? '' : 'aria-') + attribute, value);
  6375. }
  6376. function ariaAttr(attribute, data) {
  6377. if (!$.isPlainObject(attribute)) {
  6378. attribute = { attribute: data };
  6379. }
  6380. data = '';
  6381. for (var key in attribute) {
  6382. var attr = (key == 'role' ? '' : 'aria-') + key,
  6383. attrVal = attribute[key];
  6384. data += attrVal == null ? '' : attr + '="' + attribute[key] + '"';
  6385. }
  6386. return data;
  6387. }
  6388. // IE8 bug throws an error for activeElements within iframes.
  6389. function getActiveElement() {
  6390. try {
  6391. return document.activeElement;
  6392. } catch (err) {}
  6393. }
  6394. // Expose the picker constructor.
  6395. return PickerConstructor;
  6396. });
  6397. ; /*!
  6398. * Date picker for pickadate.js v3.5.0
  6399. * http://amsul.github.io/pickadate.js/date.htm
  6400. */
  6401. (function (factory) {
  6402. factory(Materialize.Picker, jQuery);
  6403. })(function (Picker, $) {
  6404. /**
  6405. * Globals and constants
  6406. */
  6407. var DAYS_IN_WEEK = 7,
  6408. WEEKS_IN_CALENDAR = 6,
  6409. _ = Picker._;
  6410. /**
  6411. * The date picker constructor
  6412. */
  6413. function DatePicker(picker, settings) {
  6414. var calendar = this,
  6415. element = picker.$node[0],
  6416. elementValue = element.value,
  6417. elementDataValue = picker.$node.data('value'),
  6418. valueString = elementDataValue || elementValue,
  6419. formatString = elementDataValue ? settings.formatSubmit : settings.format,
  6420. isRTL = function () {
  6421. return element.currentStyle ?
  6422. // For IE.
  6423. element.currentStyle.direction == 'rtl' :
  6424. // For normal browsers.
  6425. getComputedStyle(picker.$root[0]).direction == 'rtl';
  6426. };
  6427. calendar.settings = settings;
  6428. calendar.$node = picker.$node;
  6429. // The queue of methods that will be used to build item objects.
  6430. calendar.queue = {
  6431. min: 'measure create',
  6432. max: 'measure create',
  6433. now: 'now create',
  6434. select: 'parse create validate',
  6435. highlight: 'parse navigate create validate',
  6436. view: 'parse create validate viewset',
  6437. disable: 'deactivate',
  6438. enable: 'activate'
  6439. // The component's item object.
  6440. };calendar.item = {};
  6441. calendar.item.clear = null;
  6442. calendar.item.disable = (settings.disable || []).slice(0);
  6443. calendar.item.enable = -function (collectionDisabled) {
  6444. return collectionDisabled[0] === true ? collectionDisabled.shift() : -1;
  6445. }(calendar.item.disable);
  6446. calendar.set('min', settings.min).set('max', settings.max).set('now');
  6447. // When there’s a value, set the `select`, which in turn
  6448. // also sets the `highlight` and `view`.
  6449. if (valueString) {
  6450. calendar.set('select', valueString, { format: formatString });
  6451. }
  6452. // If there’s no value, default to highlighting “today”.
  6453. else {
  6454. calendar.set('select', null).set('highlight', calendar.item.now);
  6455. }
  6456. // The keycode to movement mapping.
  6457. calendar.key = {
  6458. 40: 7, // Down
  6459. 38: -7, // Up
  6460. 39: function () {
  6461. return isRTL() ? -1 : 1;
  6462. }, // Right
  6463. 37: function () {
  6464. return isRTL() ? 1 : -1;
  6465. }, // Left
  6466. go: function (timeChange) {
  6467. var highlightedObject = calendar.item.highlight,
  6468. targetDate = new Date(highlightedObject.year, highlightedObject.month, highlightedObject.date + timeChange);
  6469. calendar.set('highlight', targetDate, { interval: timeChange });
  6470. this.render();
  6471. }
  6472. // Bind some picker events.
  6473. };picker.on('render', function () {
  6474. picker.$root.find('.' + settings.klass.selectMonth).on('change', function () {
  6475. var value = this.value;
  6476. if (value) {
  6477. picker.set('highlight', [picker.get('view').year, value, picker.get('highlight').date]);
  6478. picker.$root.find('.' + settings.klass.selectMonth).trigger('focus');
  6479. }
  6480. });
  6481. picker.$root.find('.' + settings.klass.selectYear).on('change', function () {
  6482. var value = this.value;
  6483. if (value) {
  6484. picker.set('highlight', [value, picker.get('view').month, picker.get('highlight').date]);
  6485. picker.$root.find('.' + settings.klass.selectYear).trigger('focus');
  6486. }
  6487. });
  6488. }, 1).on('open', function () {
  6489. var includeToday = '';
  6490. if (calendar.disabled(calendar.get('now'))) {
  6491. includeToday = ':not(.' + settings.klass.buttonToday + ')';
  6492. }
  6493. picker.$root.find('button' + includeToday + ', select').attr('disabled', false);
  6494. }, 1).on('close', function () {
  6495. picker.$root.find('button, select').attr('disabled', true);
  6496. }, 1);
  6497. } //DatePicker
  6498. /**
  6499. * Set a datepicker item object.
  6500. */
  6501. DatePicker.prototype.set = function (type, value, options) {
  6502. var calendar = this,
  6503. calendarItem = calendar.item;
  6504. // If the value is `null` just set it immediately.
  6505. if (value === null) {
  6506. if (type == 'clear') type = 'select';
  6507. calendarItem[type] = value;
  6508. return calendar;
  6509. }
  6510. // Otherwise go through the queue of methods, and invoke the functions.
  6511. // Update this as the time unit, and set the final value as this item.
  6512. // * In the case of `enable`, keep the queue but set `disable` instead.
  6513. // And in the case of `flip`, keep the queue but set `enable` instead.
  6514. calendarItem[type == 'enable' ? 'disable' : type == 'flip' ? 'enable' : type] = calendar.queue[type].split(' ').map(function (method) {
  6515. value = calendar[method](type, value, options);
  6516. return value;
  6517. }).pop();
  6518. // Check if we need to cascade through more updates.
  6519. if (type == 'select') {
  6520. calendar.set('highlight', calendarItem.select, options);
  6521. } else if (type == 'highlight') {
  6522. calendar.set('view', calendarItem.highlight, options);
  6523. } else if (type.match(/^(flip|min|max|disable|enable)$/)) {
  6524. if (calendarItem.select && calendar.disabled(calendarItem.select)) {
  6525. calendar.set('select', calendarItem.select, options);
  6526. }
  6527. if (calendarItem.highlight && calendar.disabled(calendarItem.highlight)) {
  6528. calendar.set('highlight', calendarItem.highlight, options);
  6529. }
  6530. }
  6531. return calendar;
  6532. }; //DatePicker.prototype.set
  6533. /**
  6534. * Get a datepicker item object.
  6535. */
  6536. DatePicker.prototype.get = function (type) {
  6537. return this.item[type];
  6538. }; //DatePicker.prototype.get
  6539. /**
  6540. * Create a picker date object.
  6541. */
  6542. DatePicker.prototype.create = function (type, value, options) {
  6543. var isInfiniteValue,
  6544. calendar = this;
  6545. // If there’s no value, use the type as the value.
  6546. value = value === undefined ? type : value;
  6547. // If it’s infinity, update the value.
  6548. if (value == -Infinity || value == Infinity) {
  6549. isInfiniteValue = value;
  6550. }
  6551. // If it’s an object, use the native date object.
  6552. else if ($.isPlainObject(value) && _.isInteger(value.pick)) {
  6553. value = value.obj;
  6554. }
  6555. // If it’s an array, convert it into a date and make sure
  6556. // that it’s a valid date – otherwise default to today.
  6557. else if ($.isArray(value)) {
  6558. value = new Date(value[0], value[1], value[2]);
  6559. value = _.isDate(value) ? value : calendar.create().obj;
  6560. }
  6561. // If it’s a number or date object, make a normalized date.
  6562. else if (_.isInteger(value) || _.isDate(value)) {
  6563. value = calendar.normalize(new Date(value), options);
  6564. }
  6565. // If it’s a literal true or any other case, set it to now.
  6566. else /*if ( value === true )*/{
  6567. value = calendar.now(type, value, options);
  6568. }
  6569. // Return the compiled object.
  6570. return {
  6571. year: isInfiniteValue || value.getFullYear(),
  6572. month: isInfiniteValue || value.getMonth(),
  6573. date: isInfiniteValue || value.getDate(),
  6574. day: isInfiniteValue || value.getDay(),
  6575. obj: isInfiniteValue || value,
  6576. pick: isInfiniteValue || value.getTime()
  6577. };
  6578. }; //DatePicker.prototype.create
  6579. /**
  6580. * Create a range limit object using an array, date object,
  6581. * literal “true”, or integer relative to another time.
  6582. */
  6583. DatePicker.prototype.createRange = function (from, to) {
  6584. var calendar = this,
  6585. createDate = function (date) {
  6586. if (date === true || $.isArray(date) || _.isDate(date)) {
  6587. return calendar.create(date);
  6588. }
  6589. return date;
  6590. };
  6591. // Create objects if possible.
  6592. if (!_.isInteger(from)) {
  6593. from = createDate(from);
  6594. }
  6595. if (!_.isInteger(to)) {
  6596. to = createDate(to);
  6597. }
  6598. // Create relative dates.
  6599. if (_.isInteger(from) && $.isPlainObject(to)) {
  6600. from = [to.year, to.month, to.date + from];
  6601. } else if (_.isInteger(to) && $.isPlainObject(from)) {
  6602. to = [from.year, from.month, from.date + to];
  6603. }
  6604. return {
  6605. from: createDate(from),
  6606. to: createDate(to)
  6607. };
  6608. }; //DatePicker.prototype.createRange
  6609. /**
  6610. * Check if a date unit falls within a date range object.
  6611. */
  6612. DatePicker.prototype.withinRange = function (range, dateUnit) {
  6613. range = this.createRange(range.from, range.to);
  6614. return dateUnit.pick >= range.from.pick && dateUnit.pick <= range.to.pick;
  6615. };
  6616. /**
  6617. * Check if two date range objects overlap.
  6618. */
  6619. DatePicker.prototype.overlapRanges = function (one, two) {
  6620. var calendar = this;
  6621. // Convert the ranges into comparable dates.
  6622. one = calendar.createRange(one.from, one.to);
  6623. two = calendar.createRange(two.from, two.to);
  6624. return calendar.withinRange(one, two.from) || calendar.withinRange(one, two.to) || calendar.withinRange(two, one.from) || calendar.withinRange(two, one.to);
  6625. };
  6626. /**
  6627. * Get the date today.
  6628. */
  6629. DatePicker.prototype.now = function (type, value, options) {
  6630. value = new Date();
  6631. if (options && options.rel) {
  6632. value.setDate(value.getDate() + options.rel);
  6633. }
  6634. return this.normalize(value, options);
  6635. };
  6636. /**
  6637. * Navigate to next/prev month.
  6638. */
  6639. DatePicker.prototype.navigate = function (type, value, options) {
  6640. var targetDateObject,
  6641. targetYear,
  6642. targetMonth,
  6643. targetDate,
  6644. isTargetArray = $.isArray(value),
  6645. isTargetObject = $.isPlainObject(value),
  6646. viewsetObject = this.item.view; /*,
  6647. safety = 100*/
  6648. if (isTargetArray || isTargetObject) {
  6649. if (isTargetObject) {
  6650. targetYear = value.year;
  6651. targetMonth = value.month;
  6652. targetDate = value.date;
  6653. } else {
  6654. targetYear = +value[0];
  6655. targetMonth = +value[1];
  6656. targetDate = +value[2];
  6657. }
  6658. // If we’re navigating months but the view is in a different
  6659. // month, navigate to the view’s year and month.
  6660. if (options && options.nav && viewsetObject && viewsetObject.month !== targetMonth) {
  6661. targetYear = viewsetObject.year;
  6662. targetMonth = viewsetObject.month;
  6663. }
  6664. // Figure out the expected target year and month.
  6665. targetDateObject = new Date(targetYear, targetMonth + (options && options.nav ? options.nav : 0), 1);
  6666. targetYear = targetDateObject.getFullYear();
  6667. targetMonth = targetDateObject.getMonth();
  6668. // If the month we’re going to doesn’t have enough days,
  6669. // keep decreasing the date until we reach the month’s last date.
  6670. while ( /*safety &&*/new Date(targetYear, targetMonth, targetDate).getMonth() !== targetMonth) {
  6671. targetDate -= 1;
  6672. /*safety -= 1
  6673. if ( !safety ) {
  6674. throw 'Fell into an infinite loop while navigating to ' + new Date( targetYear, targetMonth, targetDate ) + '.'
  6675. }*/
  6676. }
  6677. value = [targetYear, targetMonth, targetDate];
  6678. }
  6679. return value;
  6680. }; //DatePicker.prototype.navigate
  6681. /**
  6682. * Normalize a date by setting the hours to midnight.
  6683. */
  6684. DatePicker.prototype.normalize = function (value /*, options*/) {
  6685. value.setHours(0, 0, 0, 0);
  6686. return value;
  6687. };
  6688. /**
  6689. * Measure the range of dates.
  6690. */
  6691. DatePicker.prototype.measure = function (type, value /*, options*/) {
  6692. var calendar = this;
  6693. // If it’s anything false-y, remove the limits.
  6694. if (!value) {
  6695. value = type == 'min' ? -Infinity : Infinity;
  6696. }
  6697. // If it’s a string, parse it.
  6698. else if (typeof value == 'string') {
  6699. value = calendar.parse(type, value);
  6700. }
  6701. // If it's an integer, get a date relative to today.
  6702. else if (_.isInteger(value)) {
  6703. value = calendar.now(type, value, { rel: value });
  6704. }
  6705. return value;
  6706. }; ///DatePicker.prototype.measure
  6707. /**
  6708. * Create a viewset object based on navigation.
  6709. */
  6710. DatePicker.prototype.viewset = function (type, dateObject /*, options*/) {
  6711. return this.create([dateObject.year, dateObject.month, 1]);
  6712. };
  6713. /**
  6714. * Validate a date as enabled and shift if needed.
  6715. */
  6716. DatePicker.prototype.validate = function (type, dateObject, options) {
  6717. var calendar = this,
  6718. // Keep a reference to the original date.
  6719. originalDateObject = dateObject,
  6720. // Make sure we have an interval.
  6721. interval = options && options.interval ? options.interval : 1,
  6722. // Check if the calendar enabled dates are inverted.
  6723. isFlippedBase = calendar.item.enable === -1,
  6724. // Check if we have any enabled dates after/before now.
  6725. hasEnabledBeforeTarget,
  6726. hasEnabledAfterTarget,
  6727. // The min & max limits.
  6728. minLimitObject = calendar.item.min,
  6729. maxLimitObject = calendar.item.max,
  6730. // Check if we’ve reached the limit during shifting.
  6731. reachedMin,
  6732. reachedMax,
  6733. // Check if the calendar is inverted and at least one weekday is enabled.
  6734. hasEnabledWeekdays = isFlippedBase && calendar.item.disable.filter(function (value) {
  6735. // If there’s a date, check where it is relative to the target.
  6736. if ($.isArray(value)) {
  6737. var dateTime = calendar.create(value).pick;
  6738. if (dateTime < dateObject.pick) hasEnabledBeforeTarget = true;else if (dateTime > dateObject.pick) hasEnabledAfterTarget = true;
  6739. }
  6740. // Return only integers for enabled weekdays.
  6741. return _.isInteger(value);
  6742. }).length; /*,
  6743. safety = 100*/
  6744. // Cases to validate for:
  6745. // [1] Not inverted and date disabled.
  6746. // [2] Inverted and some dates enabled.
  6747. // [3] Not inverted and out of range.
  6748. //
  6749. // Cases to **not** validate for:
  6750. // • Navigating months.
  6751. // • Not inverted and date enabled.
  6752. // • Inverted and all dates disabled.
  6753. // • ..and anything else.
  6754. if (!options || !options.nav) if (
  6755. /* 1 */!isFlippedBase && calendar.disabled(dateObject) ||
  6756. /* 2 */isFlippedBase && calendar.disabled(dateObject) && (hasEnabledWeekdays || hasEnabledBeforeTarget || hasEnabledAfterTarget) ||
  6757. /* 3 */!isFlippedBase && (dateObject.pick <= minLimitObject.pick || dateObject.pick >= maxLimitObject.pick)) {
  6758. // When inverted, flip the direction if there aren’t any enabled weekdays
  6759. // and there are no enabled dates in the direction of the interval.
  6760. if (isFlippedBase && !hasEnabledWeekdays && (!hasEnabledAfterTarget && interval > 0 || !hasEnabledBeforeTarget && interval < 0)) {
  6761. interval *= -1;
  6762. }
  6763. // Keep looping until we reach an enabled date.
  6764. while ( /*safety &&*/calendar.disabled(dateObject)) {
  6765. /*safety -= 1
  6766. if ( !safety ) {
  6767. throw 'Fell into an infinite loop while validating ' + dateObject.obj + '.'
  6768. }*/
  6769. // If we’ve looped into the next/prev month with a large interval, return to the original date and flatten the interval.
  6770. if (Math.abs(interval) > 1 && (dateObject.month < originalDateObject.month || dateObject.month > originalDateObject.month)) {
  6771. dateObject = originalDateObject;
  6772. interval = interval > 0 ? 1 : -1;
  6773. }
  6774. // If we’ve reached the min/max limit, reverse the direction, flatten the interval and set it to the limit.
  6775. if (dateObject.pick <= minLimitObject.pick) {
  6776. reachedMin = true;
  6777. interval = 1;
  6778. dateObject = calendar.create([minLimitObject.year, minLimitObject.month, minLimitObject.date + (dateObject.pick === minLimitObject.pick ? 0 : -1)]);
  6779. } else if (dateObject.pick >= maxLimitObject.pick) {
  6780. reachedMax = true;
  6781. interval = -1;
  6782. dateObject = calendar.create([maxLimitObject.year, maxLimitObject.month, maxLimitObject.date + (dateObject.pick === maxLimitObject.pick ? 0 : 1)]);
  6783. }
  6784. // If we’ve reached both limits, just break out of the loop.
  6785. if (reachedMin && reachedMax) {
  6786. break;
  6787. }
  6788. // Finally, create the shifted date using the interval and keep looping.
  6789. dateObject = calendar.create([dateObject.year, dateObject.month, dateObject.date + interval]);
  6790. }
  6791. } //endif
  6792. // Return the date object settled on.
  6793. return dateObject;
  6794. }; //DatePicker.prototype.validate
  6795. /**
  6796. * Check if a date is disabled.
  6797. */
  6798. DatePicker.prototype.disabled = function (dateToVerify) {
  6799. var calendar = this,
  6800. // Filter through the disabled dates to check if this is one.
  6801. isDisabledMatch = calendar.item.disable.filter(function (dateToDisable) {
  6802. // If the date is a number, match the weekday with 0index and `firstDay` check.
  6803. if (_.isInteger(dateToDisable)) {
  6804. return dateToVerify.day === (calendar.settings.firstDay ? dateToDisable : dateToDisable - 1) % 7;
  6805. }
  6806. // If it’s an array or a native JS date, create and match the exact date.
  6807. if ($.isArray(dateToDisable) || _.isDate(dateToDisable)) {
  6808. return dateToVerify.pick === calendar.create(dateToDisable).pick;
  6809. }
  6810. // If it’s an object, match a date within the “from” and “to” range.
  6811. if ($.isPlainObject(dateToDisable)) {
  6812. return calendar.withinRange(dateToDisable, dateToVerify);
  6813. }
  6814. });
  6815. // If this date matches a disabled date, confirm it’s not inverted.
  6816. isDisabledMatch = isDisabledMatch.length && !isDisabledMatch.filter(function (dateToDisable) {
  6817. return $.isArray(dateToDisable) && dateToDisable[3] == 'inverted' || $.isPlainObject(dateToDisable) && dateToDisable.inverted;
  6818. }).length;
  6819. // Check the calendar “enabled” flag and respectively flip the
  6820. // disabled state. Then also check if it’s beyond the min/max limits.
  6821. return calendar.item.enable === -1 ? !isDisabledMatch : isDisabledMatch || dateToVerify.pick < calendar.item.min.pick || dateToVerify.pick > calendar.item.max.pick;
  6822. }; //DatePicker.prototype.disabled
  6823. /**
  6824. * Parse a string into a usable type.
  6825. */
  6826. DatePicker.prototype.parse = function (type, value, options) {
  6827. var calendar = this,
  6828. parsingObject = {};
  6829. // If it’s already parsed, we’re good.
  6830. if (!value || typeof value != 'string') {
  6831. return value;
  6832. }
  6833. // We need a `.format` to parse the value with.
  6834. if (!(options && options.format)) {
  6835. options = options || {};
  6836. options.format = calendar.settings.format;
  6837. }
  6838. // Convert the format into an array and then map through it.
  6839. calendar.formats.toArray(options.format).map(function (label) {
  6840. var
  6841. // Grab the formatting label.
  6842. formattingLabel = calendar.formats[label],
  6843. // The format length is from the formatting label function or the
  6844. // label length without the escaping exclamation (!) mark.
  6845. formatLength = formattingLabel ? _.trigger(formattingLabel, calendar, [value, parsingObject]) : label.replace(/^!/, '').length;
  6846. // If there's a format label, split the value up to the format length.
  6847. // Then add it to the parsing object with appropriate label.
  6848. if (formattingLabel) {
  6849. parsingObject[label] = value.substr(0, formatLength);
  6850. }
  6851. // Update the value as the substring from format length to end.
  6852. value = value.substr(formatLength);
  6853. });
  6854. // Compensate for month 0index.
  6855. return [parsingObject.yyyy || parsingObject.yy, +(parsingObject.mm || parsingObject.m) - 1, parsingObject.dd || parsingObject.d];
  6856. }; //DatePicker.prototype.parse
  6857. /**
  6858. * Various formats to display the object in.
  6859. */
  6860. DatePicker.prototype.formats = function () {
  6861. // Return the length of the first word in a collection.
  6862. function getWordLengthFromCollection(string, collection, dateObject) {
  6863. // Grab the first word from the string.
  6864. var word = string.match(/\w+/)[0];
  6865. // If there's no month index, add it to the date object
  6866. if (!dateObject.mm && !dateObject.m) {
  6867. dateObject.m = collection.indexOf(word) + 1;
  6868. }
  6869. // Return the length of the word.
  6870. return word.length;
  6871. }
  6872. // Get the length of the first word in a string.
  6873. function getFirstWordLength(string) {
  6874. return string.match(/\w+/)[0].length;
  6875. }
  6876. return {
  6877. d: function (string, dateObject) {
  6878. // If there's string, then get the digits length.
  6879. // Otherwise return the selected date.
  6880. return string ? _.digits(string) : dateObject.date;
  6881. },
  6882. dd: function (string, dateObject) {
  6883. // If there's a string, then the length is always 2.
  6884. // Otherwise return the selected date with a leading zero.
  6885. return string ? 2 : _.lead(dateObject.date);
  6886. },
  6887. ddd: function (string, dateObject) {
  6888. // If there's a string, then get the length of the first word.
  6889. // Otherwise return the short selected weekday.
  6890. return string ? getFirstWordLength(string) : this.settings.weekdaysShort[dateObject.day];
  6891. },
  6892. dddd: function (string, dateObject) {
  6893. // If there's a string, then get the length of the first word.
  6894. // Otherwise return the full selected weekday.
  6895. return string ? getFirstWordLength(string) : this.settings.weekdaysFull[dateObject.day];
  6896. },
  6897. m: function (string, dateObject) {
  6898. // If there's a string, then get the length of the digits
  6899. // Otherwise return the selected month with 0index compensation.
  6900. return string ? _.digits(string) : dateObject.month + 1;
  6901. },
  6902. mm: function (string, dateObject) {
  6903. // If there's a string, then the length is always 2.
  6904. // Otherwise return the selected month with 0index and leading zero.
  6905. return string ? 2 : _.lead(dateObject.month + 1);
  6906. },
  6907. mmm: function (string, dateObject) {
  6908. var collection = this.settings.monthsShort;
  6909. // If there's a string, get length of the relevant month from the short
  6910. // months collection. Otherwise return the selected month from that collection.
  6911. return string ? getWordLengthFromCollection(string, collection, dateObject) : collection[dateObject.month];
  6912. },
  6913. mmmm: function (string, dateObject) {
  6914. var collection = this.settings.monthsFull;
  6915. // If there's a string, get length of the relevant month from the full
  6916. // months collection. Otherwise return the selected month from that collection.
  6917. return string ? getWordLengthFromCollection(string, collection, dateObject) : collection[dateObject.month];
  6918. },
  6919. yy: function (string, dateObject) {
  6920. // If there's a string, then the length is always 2.
  6921. // Otherwise return the selected year by slicing out the first 2 digits.
  6922. return string ? 2 : ('' + dateObject.year).slice(2);
  6923. },
  6924. yyyy: function (string, dateObject) {
  6925. // If there's a string, then the length is always 4.
  6926. // Otherwise return the selected year.
  6927. return string ? 4 : dateObject.year;
  6928. },
  6929. // Create an array by splitting the formatting string passed.
  6930. toArray: function (formatString) {
  6931. return formatString.split(/(d{1,4}|m{1,4}|y{4}|yy|!.)/g);
  6932. },
  6933. // Format an object into a string using the formatting options.
  6934. toString: function (formatString, itemObject) {
  6935. var calendar = this;
  6936. return calendar.formats.toArray(formatString).map(function (label) {
  6937. return _.trigger(calendar.formats[label], calendar, [0, itemObject]) || label.replace(/^!/, '');
  6938. }).join('');
  6939. }
  6940. };
  6941. }(); //DatePicker.prototype.formats
  6942. /**
  6943. * Check if two date units are the exact.
  6944. */
  6945. DatePicker.prototype.isDateExact = function (one, two) {
  6946. var calendar = this;
  6947. // When we’re working with weekdays, do a direct comparison.
  6948. if (_.isInteger(one) && _.isInteger(two) || typeof one == 'boolean' && typeof two == 'boolean') {
  6949. return one === two;
  6950. }
  6951. // When we’re working with date representations, compare the “pick” value.
  6952. if ((_.isDate(one) || $.isArray(one)) && (_.isDate(two) || $.isArray(two))) {
  6953. return calendar.create(one).pick === calendar.create(two).pick;
  6954. }
  6955. // When we’re working with range objects, compare the “from” and “to”.
  6956. if ($.isPlainObject(one) && $.isPlainObject(two)) {
  6957. return calendar.isDateExact(one.from, two.from) && calendar.isDateExact(one.to, two.to);
  6958. }
  6959. return false;
  6960. };
  6961. /**
  6962. * Check if two date units overlap.
  6963. */
  6964. DatePicker.prototype.isDateOverlap = function (one, two) {
  6965. var calendar = this,
  6966. firstDay = calendar.settings.firstDay ? 1 : 0;
  6967. // When we’re working with a weekday index, compare the days.
  6968. if (_.isInteger(one) && (_.isDate(two) || $.isArray(two))) {
  6969. one = one % 7 + firstDay;
  6970. return one === calendar.create(two).day + 1;
  6971. }
  6972. if (_.isInteger(two) && (_.isDate(one) || $.isArray(one))) {
  6973. two = two % 7 + firstDay;
  6974. return two === calendar.create(one).day + 1;
  6975. }
  6976. // When we’re working with range objects, check if the ranges overlap.
  6977. if ($.isPlainObject(one) && $.isPlainObject(two)) {
  6978. return calendar.overlapRanges(one, two);
  6979. }
  6980. return false;
  6981. };
  6982. /**
  6983. * Flip the “enabled” state.
  6984. */
  6985. DatePicker.prototype.flipEnable = function (val) {
  6986. var itemObject = this.item;
  6987. itemObject.enable = val || (itemObject.enable == -1 ? 1 : -1);
  6988. };
  6989. /**
  6990. * Mark a collection of dates as “disabled”.
  6991. */
  6992. DatePicker.prototype.deactivate = function (type, datesToDisable) {
  6993. var calendar = this,
  6994. disabledItems = calendar.item.disable.slice(0);
  6995. // If we’re flipping, that’s all we need to do.
  6996. if (datesToDisable == 'flip') {
  6997. calendar.flipEnable();
  6998. } else if (datesToDisable === false) {
  6999. calendar.flipEnable(1);
  7000. disabledItems = [];
  7001. } else if (datesToDisable === true) {
  7002. calendar.flipEnable(-1);
  7003. disabledItems = [];
  7004. }
  7005. // Otherwise go through the dates to disable.
  7006. else {
  7007. datesToDisable.map(function (unitToDisable) {
  7008. var matchFound;
  7009. // When we have disabled items, check for matches.
  7010. // If something is matched, immediately break out.
  7011. for (var index = 0; index < disabledItems.length; index += 1) {
  7012. if (calendar.isDateExact(unitToDisable, disabledItems[index])) {
  7013. matchFound = true;
  7014. break;
  7015. }
  7016. }
  7017. // If nothing was found, add the validated unit to the collection.
  7018. if (!matchFound) {
  7019. if (_.isInteger(unitToDisable) || _.isDate(unitToDisable) || $.isArray(unitToDisable) || $.isPlainObject(unitToDisable) && unitToDisable.from && unitToDisable.to) {
  7020. disabledItems.push(unitToDisable);
  7021. }
  7022. }
  7023. });
  7024. }
  7025. // Return the updated collection.
  7026. return disabledItems;
  7027. }; //DatePicker.prototype.deactivate
  7028. /**
  7029. * Mark a collection of dates as “enabled”.
  7030. */
  7031. DatePicker.prototype.activate = function (type, datesToEnable) {
  7032. var calendar = this,
  7033. disabledItems = calendar.item.disable,
  7034. disabledItemsCount = disabledItems.length;
  7035. // If we’re flipping, that’s all we need to do.
  7036. if (datesToEnable == 'flip') {
  7037. calendar.flipEnable();
  7038. } else if (datesToEnable === true) {
  7039. calendar.flipEnable(1);
  7040. disabledItems = [];
  7041. } else if (datesToEnable === false) {
  7042. calendar.flipEnable(-1);
  7043. disabledItems = [];
  7044. }
  7045. // Otherwise go through the disabled dates.
  7046. else {
  7047. datesToEnable.map(function (unitToEnable) {
  7048. var matchFound, disabledUnit, index, isExactRange;
  7049. // Go through the disabled items and try to find a match.
  7050. for (index = 0; index < disabledItemsCount; index += 1) {
  7051. disabledUnit = disabledItems[index];
  7052. // When an exact match is found, remove it from the collection.
  7053. if (calendar.isDateExact(disabledUnit, unitToEnable)) {
  7054. matchFound = disabledItems[index] = null;
  7055. isExactRange = true;
  7056. break;
  7057. }
  7058. // When an overlapped match is found, add the “inverted” state to it.
  7059. else if (calendar.isDateOverlap(disabledUnit, unitToEnable)) {
  7060. if ($.isPlainObject(unitToEnable)) {
  7061. unitToEnable.inverted = true;
  7062. matchFound = unitToEnable;
  7063. } else if ($.isArray(unitToEnable)) {
  7064. matchFound = unitToEnable;
  7065. if (!matchFound[3]) matchFound.push('inverted');
  7066. } else if (_.isDate(unitToEnable)) {
  7067. matchFound = [unitToEnable.getFullYear(), unitToEnable.getMonth(), unitToEnable.getDate(), 'inverted'];
  7068. }
  7069. break;
  7070. }
  7071. }
  7072. // If a match was found, remove a previous duplicate entry.
  7073. if (matchFound) for (index = 0; index < disabledItemsCount; index += 1) {
  7074. if (calendar.isDateExact(disabledItems[index], unitToEnable)) {
  7075. disabledItems[index] = null;
  7076. break;
  7077. }
  7078. }
  7079. // In the event that we’re dealing with an exact range of dates,
  7080. // make sure there are no “inverted” dates because of it.
  7081. if (isExactRange) for (index = 0; index < disabledItemsCount; index += 1) {
  7082. if (calendar.isDateOverlap(disabledItems[index], unitToEnable)) {
  7083. disabledItems[index] = null;
  7084. break;
  7085. }
  7086. }
  7087. // If something is still matched, add it into the collection.
  7088. if (matchFound) {
  7089. disabledItems.push(matchFound);
  7090. }
  7091. });
  7092. }
  7093. // Return the updated collection.
  7094. return disabledItems.filter(function (val) {
  7095. return val != null;
  7096. });
  7097. }; //DatePicker.prototype.activate
  7098. /**
  7099. * Create a string for the nodes in the picker.
  7100. */
  7101. DatePicker.prototype.nodes = function (isOpen) {
  7102. var calendar = this,
  7103. settings = calendar.settings,
  7104. calendarItem = calendar.item,
  7105. nowObject = calendarItem.now,
  7106. selectedObject = calendarItem.select,
  7107. highlightedObject = calendarItem.highlight,
  7108. viewsetObject = calendarItem.view,
  7109. disabledCollection = calendarItem.disable,
  7110. minLimitObject = calendarItem.min,
  7111. maxLimitObject = calendarItem.max,
  7112. // Create the calendar table head using a copy of weekday labels collection.
  7113. // * We do a copy so we don't mutate the original array.
  7114. tableHead = function (collection, fullCollection) {
  7115. // If the first day should be Monday, move Sunday to the end.
  7116. if (settings.firstDay) {
  7117. collection.push(collection.shift());
  7118. fullCollection.push(fullCollection.shift());
  7119. }
  7120. // Create and return the table head group.
  7121. return _.node('thead', _.node('tr', _.group({
  7122. min: 0,
  7123. max: DAYS_IN_WEEK - 1,
  7124. i: 1,
  7125. node: 'th',
  7126. item: function (counter) {
  7127. return [collection[counter], settings.klass.weekdays, 'scope=col title="' + fullCollection[counter] + '"'];
  7128. }
  7129. }))); //endreturn
  7130. // Materialize modified
  7131. }((settings.showWeekdaysFull ? settings.weekdaysFull : settings.weekdaysLetter).slice(0), settings.weekdaysFull.slice(0)),
  7132. //tableHead
  7133. // Create the nav for next/prev month.
  7134. createMonthNav = function (next) {
  7135. // Otherwise, return the created month tag.
  7136. return _.node('div', ' ', settings.klass['nav' + (next ? 'Next' : 'Prev')] + (
  7137. // If the focused month is outside the range, disabled the button.
  7138. next && viewsetObject.year >= maxLimitObject.year && viewsetObject.month >= maxLimitObject.month || !next && viewsetObject.year <= minLimitObject.year && viewsetObject.month <= minLimitObject.month ? ' ' + settings.klass.navDisabled : ''), 'data-nav=' + (next || -1) + ' ' + _.ariaAttr({
  7139. role: 'button',
  7140. controls: calendar.$node[0].id + '_table'
  7141. }) + ' ' + 'title="' + (next ? settings.labelMonthNext : settings.labelMonthPrev) + '"'); //endreturn
  7142. },
  7143. //createMonthNav
  7144. // Create the month label.
  7145. //Materialize modified
  7146. createMonthLabel = function (override) {
  7147. var monthsCollection = settings.showMonthsShort ? settings.monthsShort : settings.monthsFull;
  7148. // Materialize modified
  7149. if (override == "short_months") {
  7150. monthsCollection = settings.monthsShort;
  7151. }
  7152. // If there are months to select, add a dropdown menu.
  7153. if (settings.selectMonths && override == undefined) {
  7154. return _.node('select', _.group({
  7155. min: 0,
  7156. max: 11,
  7157. i: 1,
  7158. node: 'option',
  7159. item: function (loopedMonth) {
  7160. return [
  7161. // The looped month and no classes.
  7162. monthsCollection[loopedMonth], 0,
  7163. // Set the value and selected index.
  7164. 'value=' + loopedMonth + (viewsetObject.month == loopedMonth ? ' selected' : '') + (viewsetObject.year == minLimitObject.year && loopedMonth < minLimitObject.month || viewsetObject.year == maxLimitObject.year && loopedMonth > maxLimitObject.month ? ' disabled' : '')];
  7165. }
  7166. }), settings.klass.selectMonth + ' browser-default', (isOpen ? '' : 'disabled') + ' ' + _.ariaAttr({ controls: calendar.$node[0].id + '_table' }) + ' ' + 'title="' + settings.labelMonthSelect + '"');
  7167. }
  7168. // Materialize modified
  7169. if (override == "short_months") if (selectedObject != null) return monthsCollection[selectedObject.month];else return monthsCollection[viewsetObject.month];
  7170. // If there's a need for a month selector
  7171. return _.node('div', monthsCollection[viewsetObject.month], settings.klass.month);
  7172. },
  7173. //createMonthLabel
  7174. // Create the year label.
  7175. // Materialize modified
  7176. createYearLabel = function (override) {
  7177. var focusedYear = viewsetObject.year,
  7178. // If years selector is set to a literal "true", set it to 5. Otherwise
  7179. // divide in half to get half before and half after focused year.
  7180. numberYears = settings.selectYears === true ? 5 : ~~(settings.selectYears / 2);
  7181. // If there are years to select, add a dropdown menu.
  7182. if (numberYears) {
  7183. var minYear = minLimitObject.year,
  7184. maxYear = maxLimitObject.year,
  7185. lowestYear = focusedYear - numberYears,
  7186. highestYear = focusedYear + numberYears;
  7187. // If the min year is greater than the lowest year, increase the highest year
  7188. // by the difference and set the lowest year to the min year.
  7189. if (minYear > lowestYear) {
  7190. highestYear += minYear - lowestYear;
  7191. lowestYear = minYear;
  7192. }
  7193. // If the max year is less than the highest year, decrease the lowest year
  7194. // by the lower of the two: available and needed years. Then set the
  7195. // highest year to the max year.
  7196. if (maxYear < highestYear) {
  7197. var availableYears = lowestYear - minYear,
  7198. neededYears = highestYear - maxYear;
  7199. lowestYear -= availableYears > neededYears ? neededYears : availableYears;
  7200. highestYear = maxYear;
  7201. }
  7202. if (settings.selectYears && override == undefined) {
  7203. return _.node('select', _.group({
  7204. min: lowestYear,
  7205. max: highestYear,
  7206. i: 1,
  7207. node: 'option',
  7208. item: function (loopedYear) {
  7209. return [
  7210. // The looped year and no classes.
  7211. loopedYear, 0,
  7212. // Set the value and selected index.
  7213. 'value=' + loopedYear + (focusedYear == loopedYear ? ' selected' : '')];
  7214. }
  7215. }), settings.klass.selectYear + ' browser-default', (isOpen ? '' : 'disabled') + ' ' + _.ariaAttr({ controls: calendar.$node[0].id + '_table' }) + ' ' + 'title="' + settings.labelYearSelect + '"');
  7216. }
  7217. }
  7218. // Materialize modified
  7219. if (override === 'raw' && selectedObject != null) {
  7220. return _.node('div', selectedObject.year);
  7221. }
  7222. // Otherwise just return the year focused
  7223. return _.node('div', focusedYear, settings.klass.year);
  7224. }; //createYearLabel
  7225. // Materialize modified
  7226. createDayLabel = function () {
  7227. if (selectedObject != null) return selectedObject.date;else return nowObject.date;
  7228. };
  7229. createWeekdayLabel = function () {
  7230. var display_day;
  7231. if (selectedObject != null) display_day = selectedObject.day;else display_day = nowObject.day;
  7232. var weekday = settings.weekdaysShort[display_day];
  7233. return weekday;
  7234. };
  7235. // Create and return the entire calendar.
  7236. return _.node(
  7237. // Date presentation View
  7238. 'div', _.node(
  7239. // Div for Year
  7240. 'div', createYearLabel("raw"), settings.klass.year_display) + _.node('span', createWeekdayLabel() + ', ', "picker__weekday-display") + _.node(
  7241. // Div for short Month
  7242. 'span', createMonthLabel("short_months") + ' ', settings.klass.month_display) + _.node(
  7243. // Div for Day
  7244. 'span', createDayLabel(), settings.klass.day_display), settings.klass.date_display) +
  7245. // Calendar container
  7246. _.node('div', _.node('div', _.node('div', (settings.selectYears ? createMonthLabel() + createYearLabel() : createMonthLabel() + createYearLabel()) + createMonthNav() + createMonthNav(1), settings.klass.header) + _.node('table', tableHead + _.node('tbody', _.group({
  7247. min: 0,
  7248. max: WEEKS_IN_CALENDAR - 1,
  7249. i: 1,
  7250. node: 'tr',
  7251. item: function (rowCounter) {
  7252. // If Monday is the first day and the month starts on Sunday, shift the date back a week.
  7253. var shiftDateBy = settings.firstDay && calendar.create([viewsetObject.year, viewsetObject.month, 1]).day === 0 ? -7 : 0;
  7254. return [_.group({
  7255. min: DAYS_IN_WEEK * rowCounter - viewsetObject.day + shiftDateBy + 1, // Add 1 for weekday 0index
  7256. max: function () {
  7257. return this.min + DAYS_IN_WEEK - 1;
  7258. },
  7259. i: 1,
  7260. node: 'td',
  7261. item: function (targetDate) {
  7262. // Convert the time date from a relative date to a target date.
  7263. targetDate = calendar.create([viewsetObject.year, viewsetObject.month, targetDate + (settings.firstDay ? 1 : 0)]);
  7264. var isSelected = selectedObject && selectedObject.pick == targetDate.pick,
  7265. isHighlighted = highlightedObject && highlightedObject.pick == targetDate.pick,
  7266. isDisabled = disabledCollection && calendar.disabled(targetDate) || targetDate.pick < minLimitObject.pick || targetDate.pick > maxLimitObject.pick,
  7267. formattedDate = _.trigger(calendar.formats.toString, calendar, [settings.format, targetDate]);
  7268. return [_.node('div', targetDate.date, function (klasses) {
  7269. // Add the `infocus` or `outfocus` classes based on month in view.
  7270. klasses.push(viewsetObject.month == targetDate.month ? settings.klass.infocus : settings.klass.outfocus);
  7271. // Add the `today` class if needed.
  7272. if (nowObject.pick == targetDate.pick) {
  7273. klasses.push(settings.klass.now);
  7274. }
  7275. // Add the `selected` class if something's selected and the time matches.
  7276. if (isSelected) {
  7277. klasses.push(settings.klass.selected);
  7278. }
  7279. // Add the `highlighted` class if something's highlighted and the time matches.
  7280. if (isHighlighted) {
  7281. klasses.push(settings.klass.highlighted);
  7282. }
  7283. // Add the `disabled` class if something's disabled and the object matches.
  7284. if (isDisabled) {
  7285. klasses.push(settings.klass.disabled);
  7286. }
  7287. return klasses.join(' ');
  7288. }([settings.klass.day]), 'data-pick=' + targetDate.pick + ' ' + _.ariaAttr({
  7289. role: 'gridcell',
  7290. label: formattedDate,
  7291. selected: isSelected && calendar.$node.val() === formattedDate ? true : null,
  7292. activedescendant: isHighlighted ? true : null,
  7293. disabled: isDisabled ? true : null
  7294. }) + ' ' + (isDisabled ? '' : 'tabindex="0"')), '', _.ariaAttr({ role: 'presentation' })]; //endreturn
  7295. }
  7296. })]; //endreturn
  7297. }
  7298. })), settings.klass.table, 'id="' + calendar.$node[0].id + '_table' + '" ' + _.ariaAttr({
  7299. role: 'grid',
  7300. controls: calendar.$node[0].id,
  7301. readonly: true
  7302. })), settings.klass.calendar_container) // end calendar
  7303. +
  7304. // * For Firefox forms to submit, make sure to set the buttons’ `type` attributes as “button”.
  7305. _.node('div', _.node('button', settings.today, "btn-flat picker__today waves-effect", 'type=button data-pick=' + nowObject.pick + (isOpen && !calendar.disabled(nowObject) ? '' : ' disabled') + ' ' + _.ariaAttr({ controls: calendar.$node[0].id })) + _.node('button', settings.clear, "btn-flat picker__clear waves-effect", 'type=button data-clear=1' + (isOpen ? '' : ' disabled') + ' ' + _.ariaAttr({ controls: calendar.$node[0].id })) + _.node('button', settings.close, "btn-flat picker__close waves-effect", 'type=button data-close=true ' + (isOpen ? '' : ' disabled') + ' ' + _.ariaAttr({ controls: calendar.$node[0].id })), settings.klass.footer), 'picker__container__wrapper'); //endreturn
  7306. }; //DatePicker.prototype.nodes
  7307. /**
  7308. * The date picker defaults.
  7309. */
  7310. DatePicker.defaults = function (prefix) {
  7311. return {
  7312. // The title label to use for the month nav buttons
  7313. labelMonthNext: 'Next month',
  7314. labelMonthPrev: 'Previous month',
  7315. // The title label to use for the dropdown selectors
  7316. labelMonthSelect: 'Select a month',
  7317. labelYearSelect: 'Select a year',
  7318. // Months and weekdays
  7319. monthsFull: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
  7320. monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
  7321. weekdaysFull: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
  7322. weekdaysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
  7323. // Materialize modified
  7324. weekdaysLetter: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
  7325. // Today and clear
  7326. today: 'Today',
  7327. clear: 'Clear',
  7328. close: 'Ok',
  7329. // Picker close behavior (Prevent a change in behaviour for backwards compatibility)
  7330. closeOnSelect: false,
  7331. // The format to show on the `input` element
  7332. format: 'd mmmm, yyyy',
  7333. // Classes
  7334. klass: {
  7335. table: prefix + 'table',
  7336. header: prefix + 'header',
  7337. // Materialize Added klasses
  7338. date_display: prefix + 'date-display',
  7339. day_display: prefix + 'day-display',
  7340. month_display: prefix + 'month-display',
  7341. year_display: prefix + 'year-display',
  7342. calendar_container: prefix + 'calendar-container',
  7343. // end
  7344. navPrev: prefix + 'nav--prev',
  7345. navNext: prefix + 'nav--next',
  7346. navDisabled: prefix + 'nav--disabled',
  7347. month: prefix + 'month',
  7348. year: prefix + 'year',
  7349. selectMonth: prefix + 'select--month',
  7350. selectYear: prefix + 'select--year',
  7351. weekdays: prefix + 'weekday',
  7352. day: prefix + 'day',
  7353. disabled: prefix + 'day--disabled',
  7354. selected: prefix + 'day--selected',
  7355. highlighted: prefix + 'day--highlighted',
  7356. now: prefix + 'day--today',
  7357. infocus: prefix + 'day--infocus',
  7358. outfocus: prefix + 'day--outfocus',
  7359. footer: prefix + 'footer',
  7360. buttonClear: prefix + 'button--clear',
  7361. buttonToday: prefix + 'button--today',
  7362. buttonClose: prefix + 'button--close'
  7363. }
  7364. };
  7365. }(Picker.klasses().picker + '__');
  7366. /**
  7367. * Extend the picker to add the date picker.
  7368. */
  7369. Picker.extend('pickadate', DatePicker);
  7370. });
  7371. ; /*!
  7372. * ClockPicker v0.0.7 (http://weareoutman.github.io/clockpicker/)
  7373. * Copyright 2014 Wang Shenwei.
  7374. * Licensed under MIT (https://github.com/weareoutman/clockpicker/blob/gh-pages/LICENSE)
  7375. *
  7376. * Further modified
  7377. * Copyright 2015 Ching Yaw Hao.
  7378. */
  7379. (function ($) {
  7380. var $win = $(window),
  7381. $doc = $(document);
  7382. // Can I use inline svg ?
  7383. var svgNS = 'http://www.w3.org/2000/svg',
  7384. svgSupported = 'SVGAngle' in window && function () {
  7385. var supported,
  7386. el = document.createElement('div');
  7387. el.innerHTML = '<svg/>';
  7388. supported = (el.firstChild && el.firstChild.namespaceURI) == svgNS;
  7389. el.innerHTML = '';
  7390. return supported;
  7391. }();
  7392. // Can I use transition ?
  7393. var transitionSupported = function () {
  7394. var style = document.createElement('div').style;
  7395. return 'transition' in style || 'WebkitTransition' in style || 'MozTransition' in style || 'msTransition' in style || 'OTransition' in style;
  7396. }();
  7397. // Listen touch events in touch screen device, instead of mouse events in desktop.
  7398. var touchSupported = 'ontouchstart' in window,
  7399. mousedownEvent = 'mousedown' + (touchSupported ? ' touchstart' : ''),
  7400. mousemoveEvent = 'mousemove.clockpicker' + (touchSupported ? ' touchmove.clockpicker' : ''),
  7401. mouseupEvent = 'mouseup.clockpicker' + (touchSupported ? ' touchend.clockpicker' : '');
  7402. // Vibrate the device if supported
  7403. var vibrate = navigator.vibrate ? 'vibrate' : navigator.webkitVibrate ? 'webkitVibrate' : null;
  7404. function createSvgElement(name) {
  7405. return document.createElementNS(svgNS, name);
  7406. }
  7407. function leadingZero(num) {
  7408. return (num < 10 ? '0' : '') + num;
  7409. }
  7410. // Get a unique id
  7411. var idCounter = 0;
  7412. function uniqueId(prefix) {
  7413. var id = ++idCounter + '';
  7414. return prefix ? prefix + id : id;
  7415. }
  7416. // Clock size
  7417. var dialRadius = 135,
  7418. outerRadius = 105,
  7419. // innerRadius = 80 on 12 hour clock
  7420. innerRadius = 70,
  7421. tickRadius = 20,
  7422. diameter = dialRadius * 2,
  7423. duration = transitionSupported ? 350 : 1;
  7424. // Popover template
  7425. var tpl = ['<div class="clockpicker picker">', '<div class="picker__holder">', '<div class="picker__frame">', '<div class="picker__wrap">', '<div class="picker__box">', '<div class="picker__date-display">', '<div class="clockpicker-display">', '<div class="clockpicker-display-column">', '<span class="clockpicker-span-hours text-primary"></span>', ':', '<span class="clockpicker-span-minutes"></span>', '</div>', '<div class="clockpicker-display-column clockpicker-display-am-pm">', '<div class="clockpicker-span-am-pm"></div>', '</div>', '</div>', '</div>', '<div class="picker__container__wrapper">', '<div class="picker__calendar-container">', '<div class="clockpicker-plate">', '<div class="clockpicker-canvas"></div>', '<div class="clockpicker-dial clockpicker-hours"></div>', '<div class="clockpicker-dial clockpicker-minutes clockpicker-dial-out"></div>', '</div>', '<div class="clockpicker-am-pm-block">', '</div>', '</div>', '<div class="picker__footer">', '</div>', '</div>', '</div>', '</div>', '</div>', '</div>', '</div>'].join('');
  7426. // ClockPicker
  7427. function ClockPicker(element, options) {
  7428. var popover = $(tpl),
  7429. plate = popover.find('.clockpicker-plate'),
  7430. holder = popover.find('.picker__holder'),
  7431. hoursView = popover.find('.clockpicker-hours'),
  7432. minutesView = popover.find('.clockpicker-minutes'),
  7433. amPmBlock = popover.find('.clockpicker-am-pm-block'),
  7434. isInput = element.prop('tagName') === 'INPUT',
  7435. input = isInput ? element : element.find('input'),
  7436. label = $("label[for=" + input.attr("id") + "]"),
  7437. self = this;
  7438. this.id = uniqueId('cp');
  7439. this.element = element;
  7440. this.holder = holder;
  7441. this.options = options;
  7442. this.isAppended = false;
  7443. this.isShown = false;
  7444. this.currentView = 'hours';
  7445. this.isInput = isInput;
  7446. this.input = input;
  7447. this.label = label;
  7448. this.popover = popover;
  7449. this.plate = plate;
  7450. this.hoursView = hoursView;
  7451. this.minutesView = minutesView;
  7452. this.amPmBlock = amPmBlock;
  7453. this.spanHours = popover.find('.clockpicker-span-hours');
  7454. this.spanMinutes = popover.find('.clockpicker-span-minutes');
  7455. this.spanAmPm = popover.find('.clockpicker-span-am-pm');
  7456. this.footer = popover.find('.picker__footer');
  7457. this.amOrPm = "PM";
  7458. // Setup for for 12 hour clock if option is selected
  7459. if (options.twelvehour) {
  7460. if (!options.ampmclickable) {
  7461. this.spanAmPm.empty();
  7462. $('<div id="click-am">AM</div>').appendTo(this.spanAmPm);
  7463. $('<div id="click-pm">PM</div>').appendTo(this.spanAmPm);
  7464. } else {
  7465. this.spanAmPm.empty();
  7466. $('<div id="click-am">AM</div>').on("click", function () {
  7467. self.spanAmPm.children('#click-am').addClass("text-primary");
  7468. self.spanAmPm.children('#click-pm').removeClass("text-primary");
  7469. self.amOrPm = "AM";
  7470. }).appendTo(this.spanAmPm);
  7471. $('<div id="click-pm">PM</div>').on("click", function () {
  7472. self.spanAmPm.children('#click-pm').addClass("text-primary");
  7473. self.spanAmPm.children('#click-am').removeClass("text-primary");
  7474. self.amOrPm = 'PM';
  7475. }).appendTo(this.spanAmPm);
  7476. }
  7477. }
  7478. // Add buttons to footer
  7479. $('<button type="button" class="btn-flat picker__clear" tabindex="' + (options.twelvehour ? '3' : '1') + '">' + options.cleartext + '</button>').click($.proxy(this.clear, this)).appendTo(this.footer);
  7480. $('<button type="button" class="btn-flat picker__close" tabindex="' + (options.twelvehour ? '3' : '1') + '">' + options.canceltext + '</button>').click($.proxy(this.hide, this)).appendTo(this.footer);
  7481. $('<button type="button" class="btn-flat picker__close" tabindex="' + (options.twelvehour ? '3' : '1') + '">' + options.donetext + '</button>').click($.proxy(this.done, this)).appendTo(this.footer);
  7482. this.spanHours.click($.proxy(this.toggleView, this, 'hours'));
  7483. this.spanMinutes.click($.proxy(this.toggleView, this, 'minutes'));
  7484. // Show or toggle
  7485. input.on('focus.clockpicker click.clockpicker', $.proxy(this.show, this));
  7486. // Build ticks
  7487. var tickTpl = $('<div class="clockpicker-tick"></div>'),
  7488. i,
  7489. tick,
  7490. radian,
  7491. radius;
  7492. // Hours view
  7493. if (options.twelvehour) {
  7494. for (i = 1; i < 13; i += 1) {
  7495. tick = tickTpl.clone();
  7496. radian = i / 6 * Math.PI;
  7497. radius = outerRadius;
  7498. tick.css({
  7499. left: dialRadius + Math.sin(radian) * radius - tickRadius,
  7500. top: dialRadius - Math.cos(radian) * radius - tickRadius
  7501. });
  7502. tick.html(i === 0 ? '00' : i);
  7503. hoursView.append(tick);
  7504. tick.on(mousedownEvent, mousedown);
  7505. }
  7506. } else {
  7507. for (i = 0; i < 24; i += 1) {
  7508. tick = tickTpl.clone();
  7509. radian = i / 6 * Math.PI;
  7510. var inner = i > 0 && i < 13;
  7511. radius = inner ? innerRadius : outerRadius;
  7512. tick.css({
  7513. left: dialRadius + Math.sin(radian) * radius - tickRadius,
  7514. top: dialRadius - Math.cos(radian) * radius - tickRadius
  7515. });
  7516. tick.html(i === 0 ? '00' : i);
  7517. hoursView.append(tick);
  7518. tick.on(mousedownEvent, mousedown);
  7519. }
  7520. }
  7521. // Minutes view
  7522. for (i = 0; i < 60; i += 5) {
  7523. tick = tickTpl.clone();
  7524. radian = i / 30 * Math.PI;
  7525. tick.css({
  7526. left: dialRadius + Math.sin(radian) * outerRadius - tickRadius,
  7527. top: dialRadius - Math.cos(radian) * outerRadius - tickRadius
  7528. });
  7529. tick.html(leadingZero(i));
  7530. minutesView.append(tick);
  7531. tick.on(mousedownEvent, mousedown);
  7532. }
  7533. // Clicking on minutes view space
  7534. plate.on(mousedownEvent, function (e) {
  7535. if ($(e.target).closest('.clockpicker-tick').length === 0) {
  7536. mousedown(e, true);
  7537. }
  7538. });
  7539. // Mousedown or touchstart
  7540. function mousedown(e, space) {
  7541. var offset = plate.offset(),
  7542. isTouch = /^touch/.test(e.type),
  7543. x0 = offset.left + dialRadius,
  7544. y0 = offset.top + dialRadius,
  7545. dx = (isTouch ? e.originalEvent.touches[0] : e).pageX - x0,
  7546. dy = (isTouch ? e.originalEvent.touches[0] : e).pageY - y0,
  7547. z = Math.sqrt(dx * dx + dy * dy),
  7548. moved = false;
  7549. // When clicking on minutes view space, check the mouse position
  7550. if (space && (z < outerRadius - tickRadius || z > outerRadius + tickRadius)) {
  7551. return;
  7552. }
  7553. e.preventDefault();
  7554. // Set cursor style of body after 200ms
  7555. var movingTimer = setTimeout(function () {
  7556. self.popover.addClass('clockpicker-moving');
  7557. }, 200);
  7558. // Clock
  7559. self.setHand(dx, dy, !space, true);
  7560. // Mousemove on document
  7561. $doc.off(mousemoveEvent).on(mousemoveEvent, function (e) {
  7562. e.preventDefault();
  7563. var isTouch = /^touch/.test(e.type),
  7564. x = (isTouch ? e.originalEvent.touches[0] : e).pageX - x0,
  7565. y = (isTouch ? e.originalEvent.touches[0] : e).pageY - y0;
  7566. if (!moved && x === dx && y === dy) {
  7567. // Clicking in chrome on windows will trigger a mousemove event
  7568. return;
  7569. }
  7570. moved = true;
  7571. self.setHand(x, y, false, true);
  7572. });
  7573. // Mouseup on document
  7574. $doc.off(mouseupEvent).on(mouseupEvent, function (e) {
  7575. $doc.off(mouseupEvent);
  7576. e.preventDefault();
  7577. var isTouch = /^touch/.test(e.type),
  7578. x = (isTouch ? e.originalEvent.changedTouches[0] : e).pageX - x0,
  7579. y = (isTouch ? e.originalEvent.changedTouches[0] : e).pageY - y0;
  7580. if ((space || moved) && x === dx && y === dy) {
  7581. self.setHand(x, y);
  7582. }
  7583. if (self.currentView === 'hours') {
  7584. self.toggleView('minutes', duration / 2);
  7585. } else if (options.autoclose) {
  7586. self.minutesView.addClass('clockpicker-dial-out');
  7587. setTimeout(function () {
  7588. self.done();
  7589. }, duration / 2);
  7590. }
  7591. plate.prepend(canvas);
  7592. // Reset cursor style of body
  7593. clearTimeout(movingTimer);
  7594. self.popover.removeClass('clockpicker-moving');
  7595. // Unbind mousemove event
  7596. $doc.off(mousemoveEvent);
  7597. });
  7598. }
  7599. if (svgSupported) {
  7600. // Draw clock hands and others
  7601. var canvas = popover.find('.clockpicker-canvas'),
  7602. svg = createSvgElement('svg');
  7603. svg.setAttribute('class', 'clockpicker-svg');
  7604. svg.setAttribute('width', diameter);
  7605. svg.setAttribute('height', diameter);
  7606. var g = createSvgElement('g');
  7607. g.setAttribute('transform', 'translate(' + dialRadius + ',' + dialRadius + ')');
  7608. var bearing = createSvgElement('circle');
  7609. bearing.setAttribute('class', 'clockpicker-canvas-bearing');
  7610. bearing.setAttribute('cx', 0);
  7611. bearing.setAttribute('cy', 0);
  7612. bearing.setAttribute('r', 4);
  7613. var hand = createSvgElement('line');
  7614. hand.setAttribute('x1', 0);
  7615. hand.setAttribute('y1', 0);
  7616. var bg = createSvgElement('circle');
  7617. bg.setAttribute('class', 'clockpicker-canvas-bg');
  7618. bg.setAttribute('r', tickRadius);
  7619. g.appendChild(hand);
  7620. g.appendChild(bg);
  7621. g.appendChild(bearing);
  7622. svg.appendChild(g);
  7623. canvas.append(svg);
  7624. this.hand = hand;
  7625. this.bg = bg;
  7626. this.bearing = bearing;
  7627. this.g = g;
  7628. this.canvas = canvas;
  7629. }
  7630. raiseCallback(this.options.init);
  7631. }
  7632. function raiseCallback(callbackFunction) {
  7633. if (callbackFunction && typeof callbackFunction === "function") callbackFunction();
  7634. }
  7635. // Default options
  7636. ClockPicker.DEFAULTS = {
  7637. 'default': '', // default time, 'now' or '13:14' e.g.
  7638. fromnow: 0, // set default time to * milliseconds from now (using with default = 'now')
  7639. donetext: 'Ok', // done button text
  7640. cleartext: 'Clear',
  7641. canceltext: 'Cancel',
  7642. autoclose: false, // auto close when minute is selected
  7643. ampmclickable: true, // set am/pm button on itself
  7644. darktheme: false, // set to dark theme
  7645. twelvehour: true, // change to 12 hour AM/PM clock from 24 hour
  7646. vibrate: true // vibrate the device when dragging clock hand
  7647. };
  7648. // Show or hide popover
  7649. ClockPicker.prototype.toggle = function () {
  7650. this[this.isShown ? 'hide' : 'show']();
  7651. };
  7652. // Set popover position
  7653. ClockPicker.prototype.locate = function () {
  7654. var element = this.element,
  7655. popover = this.popover,
  7656. offset = element.offset(),
  7657. width = element.outerWidth(),
  7658. height = element.outerHeight(),
  7659. align = this.options.align,
  7660. self = this;
  7661. popover.show();
  7662. };
  7663. // Show popover
  7664. ClockPicker.prototype.show = function (e) {
  7665. // Not show again
  7666. if (this.isShown) {
  7667. return;
  7668. }
  7669. raiseCallback(this.options.beforeShow);
  7670. $(':input').each(function () {
  7671. $(this).attr('tabindex', -1);
  7672. });
  7673. var self = this;
  7674. // Initialize
  7675. this.input.blur();
  7676. this.popover.addClass('picker--opened');
  7677. this.input.addClass('picker__input picker__input--active');
  7678. $(document.body).css('overflow', 'hidden');
  7679. // Get the time
  7680. var value = ((this.input.prop('value') || this.options['default'] || '') + '').split(':');
  7681. if (this.options.twelvehour && !(typeof value[1] === 'undefined')) {
  7682. if (value[1].indexOf("AM") > 0) {
  7683. this.amOrPm = 'AM';
  7684. } else {
  7685. this.amOrPm = 'PM';
  7686. }
  7687. value[1] = value[1].replace("AM", "").replace("PM", "");
  7688. }
  7689. if (value[0] === 'now') {
  7690. var now = new Date(+new Date() + this.options.fromnow);
  7691. value = [now.getHours(), now.getMinutes()];
  7692. if (this.options.twelvehour) {
  7693. this.amOrPm = value[0] >= 12 && value[0] < 24 ? 'PM' : 'AM';
  7694. }
  7695. }
  7696. this.hours = +value[0] || 0;
  7697. this.minutes = +value[1] || 0;
  7698. this.spanHours.html(this.hours);
  7699. this.spanMinutes.html(leadingZero(this.minutes));
  7700. if (!this.isAppended) {
  7701. // Append popover to input by default
  7702. var containerEl = document.querySelector(this.options.container);
  7703. if (this.options.container && containerEl) {
  7704. containerEl.appendChild(this.popover[0]);
  7705. } else {
  7706. this.popover.insertAfter(this.input);
  7707. }
  7708. if (this.options.twelvehour) {
  7709. if (this.amOrPm === 'PM') {
  7710. this.spanAmPm.children('#click-pm').addClass("text-primary");
  7711. this.spanAmPm.children('#click-am').removeClass("text-primary");
  7712. } else {
  7713. this.spanAmPm.children('#click-am').addClass("text-primary");
  7714. this.spanAmPm.children('#click-pm').removeClass("text-primary");
  7715. }
  7716. }
  7717. // Reset position when resize
  7718. $win.on('resize.clockpicker' + this.id, function () {
  7719. if (self.isShown) {
  7720. self.locate();
  7721. }
  7722. });
  7723. this.isAppended = true;
  7724. }
  7725. // Toggle to hours view
  7726. this.toggleView('hours');
  7727. // Set position
  7728. this.locate();
  7729. this.isShown = true;
  7730. // Hide when clicking or tabbing on any element except the clock and input
  7731. $doc.on('click.clockpicker.' + this.id + ' focusin.clockpicker.' + this.id, function (e) {
  7732. var target = $(e.target);
  7733. if (target.closest(self.popover.find('.picker__wrap')).length === 0 && target.closest(self.input).length === 0) {
  7734. self.hide();
  7735. }
  7736. });
  7737. // Hide when ESC is pressed
  7738. $doc.on('keyup.clockpicker.' + this.id, function (e) {
  7739. if (e.keyCode === 27) {
  7740. self.hide();
  7741. }
  7742. });
  7743. raiseCallback(this.options.afterShow);
  7744. };
  7745. // Hide popover
  7746. ClockPicker.prototype.hide = function () {
  7747. raiseCallback(this.options.beforeHide);
  7748. this.input.removeClass('picker__input picker__input--active');
  7749. this.popover.removeClass('picker--opened');
  7750. $(document.body).css('overflow', 'visible');
  7751. this.isShown = false;
  7752. $(':input').each(function (index) {
  7753. $(this).attr('tabindex', index + 1);
  7754. });
  7755. // Unbinding events on document
  7756. $doc.off('click.clockpicker.' + this.id + ' focusin.clockpicker.' + this.id);
  7757. $doc.off('keyup.clockpicker.' + this.id);
  7758. this.popover.hide();
  7759. raiseCallback(this.options.afterHide);
  7760. };
  7761. // Toggle to hours or minutes view
  7762. ClockPicker.prototype.toggleView = function (view, delay) {
  7763. var raiseAfterHourSelect = false;
  7764. if (view === 'minutes' && $(this.hoursView).css("visibility") === "visible") {
  7765. raiseCallback(this.options.beforeHourSelect);
  7766. raiseAfterHourSelect = true;
  7767. }
  7768. var isHours = view === 'hours',
  7769. nextView = isHours ? this.hoursView : this.minutesView,
  7770. hideView = isHours ? this.minutesView : this.hoursView;
  7771. this.currentView = view;
  7772. this.spanHours.toggleClass('text-primary', isHours);
  7773. this.spanMinutes.toggleClass('text-primary', !isHours);
  7774. // Let's make transitions
  7775. hideView.addClass('clockpicker-dial-out');
  7776. nextView.css('visibility', 'visible').removeClass('clockpicker-dial-out');
  7777. // Reset clock hand
  7778. this.resetClock(delay);
  7779. // After transitions ended
  7780. clearTimeout(this.toggleViewTimer);
  7781. this.toggleViewTimer = setTimeout(function () {
  7782. hideView.css('visibility', 'hidden');
  7783. }, duration);
  7784. if (raiseAfterHourSelect) {
  7785. raiseCallback(this.options.afterHourSelect);
  7786. }
  7787. };
  7788. // Reset clock hand
  7789. ClockPicker.prototype.resetClock = function (delay) {
  7790. var view = this.currentView,
  7791. value = this[view],
  7792. isHours = view === 'hours',
  7793. unit = Math.PI / (isHours ? 6 : 30),
  7794. radian = value * unit,
  7795. radius = isHours && value > 0 && value < 13 ? innerRadius : outerRadius,
  7796. x = Math.sin(radian) * radius,
  7797. y = -Math.cos(radian) * radius,
  7798. self = this;
  7799. if (svgSupported && delay) {
  7800. self.canvas.addClass('clockpicker-canvas-out');
  7801. setTimeout(function () {
  7802. self.canvas.removeClass('clockpicker-canvas-out');
  7803. self.setHand(x, y);
  7804. }, delay);
  7805. } else this.setHand(x, y);
  7806. };
  7807. // Set clock hand to (x, y)
  7808. ClockPicker.prototype.setHand = function (x, y, roundBy5, dragging) {
  7809. var radian = Math.atan2(x, -y),
  7810. isHours = this.currentView === 'hours',
  7811. unit = Math.PI / (isHours || roundBy5 ? 6 : 30),
  7812. z = Math.sqrt(x * x + y * y),
  7813. options = this.options,
  7814. inner = isHours && z < (outerRadius + innerRadius) / 2,
  7815. radius = inner ? innerRadius : outerRadius,
  7816. value;
  7817. if (options.twelvehour) {
  7818. radius = outerRadius;
  7819. }
  7820. // Radian should in range [0, 2PI]
  7821. if (radian < 0) {
  7822. radian = Math.PI * 2 + radian;
  7823. }
  7824. // Get the round value
  7825. value = Math.round(radian / unit);
  7826. // Get the round radian
  7827. radian = value * unit;
  7828. // Correct the hours or minutes
  7829. if (options.twelvehour) {
  7830. if (isHours) {
  7831. if (value === 0) value = 12;
  7832. } else {
  7833. if (roundBy5) value *= 5;
  7834. if (value === 60) value = 0;
  7835. }
  7836. } else {
  7837. if (isHours) {
  7838. if (value === 12) value = 0;
  7839. value = inner ? value === 0 ? 12 : value : value === 0 ? 0 : value + 12;
  7840. } else {
  7841. if (roundBy5) value *= 5;
  7842. if (value === 60) value = 0;
  7843. }
  7844. }
  7845. // Once hours or minutes changed, vibrate the device
  7846. if (this[this.currentView] !== value) {
  7847. if (vibrate && this.options.vibrate) {
  7848. // Do not vibrate too frequently
  7849. if (!this.vibrateTimer) {
  7850. navigator[vibrate](10);
  7851. this.vibrateTimer = setTimeout($.proxy(function () {
  7852. this.vibrateTimer = null;
  7853. }, this), 100);
  7854. }
  7855. }
  7856. }
  7857. this[this.currentView] = value;
  7858. if (isHours) {
  7859. this['spanHours'].html(value);
  7860. } else {
  7861. this['spanMinutes'].html(leadingZero(value));
  7862. }
  7863. // If svg is not supported, just add an active class to the tick
  7864. if (!svgSupported) {
  7865. this[isHours ? 'hoursView' : 'minutesView'].find('.clockpicker-tick').each(function () {
  7866. var tick = $(this);
  7867. tick.toggleClass('active', value === +tick.html());
  7868. });
  7869. return;
  7870. }
  7871. // Set clock hand and others' position
  7872. var cx1 = Math.sin(radian) * (radius - tickRadius),
  7873. cy1 = -Math.cos(radian) * (radius - tickRadius),
  7874. cx2 = Math.sin(radian) * radius,
  7875. cy2 = -Math.cos(radian) * radius;
  7876. this.hand.setAttribute('x2', cx1);
  7877. this.hand.setAttribute('y2', cy1);
  7878. this.bg.setAttribute('cx', cx2);
  7879. this.bg.setAttribute('cy', cy2);
  7880. };
  7881. // Hours and minutes are selected
  7882. ClockPicker.prototype.done = function () {
  7883. raiseCallback(this.options.beforeDone);
  7884. this.hide();
  7885. this.label.addClass('active');
  7886. var last = this.input.prop('value'),
  7887. value = leadingZero(this.hours) + ':' + leadingZero(this.minutes);
  7888. if (this.options.twelvehour) {
  7889. value = value + this.amOrPm;
  7890. }
  7891. this.input.prop('value', value);
  7892. if (value !== last) {
  7893. this.input.triggerHandler('change');
  7894. if (!this.isInput) {
  7895. this.element.trigger('change');
  7896. }
  7897. }
  7898. if (this.options.autoclose) this.input.trigger('blur');
  7899. raiseCallback(this.options.afterDone);
  7900. };
  7901. // Clear input field
  7902. ClockPicker.prototype.clear = function () {
  7903. this.hide();
  7904. this.label.removeClass('active');
  7905. var last = this.input.prop('value'),
  7906. value = '';
  7907. this.input.prop('value', value);
  7908. if (value !== last) {
  7909. this.input.triggerHandler('change');
  7910. if (!this.isInput) {
  7911. this.element.trigger('change');
  7912. }
  7913. }
  7914. if (this.options.autoclose) {
  7915. this.input.trigger('blur');
  7916. }
  7917. };
  7918. // Remove clockpicker from input
  7919. ClockPicker.prototype.remove = function () {
  7920. this.element.removeData('clockpicker');
  7921. this.input.off('focus.clockpicker click.clockpicker');
  7922. if (this.isShown) {
  7923. this.hide();
  7924. }
  7925. if (this.isAppended) {
  7926. $win.off('resize.clockpicker' + this.id);
  7927. this.popover.remove();
  7928. }
  7929. };
  7930. // Extends $.fn.clockpicker
  7931. $.fn.pickatime = function (option) {
  7932. var args = Array.prototype.slice.call(arguments, 1);
  7933. return this.each(function () {
  7934. var $this = $(this),
  7935. data = $this.data('clockpicker');
  7936. if (!data) {
  7937. var options = $.extend({}, ClockPicker.DEFAULTS, $this.data(), typeof option == 'object' && option);
  7938. $this.data('clockpicker', new ClockPicker($this, options));
  7939. } else {
  7940. // Manual operatsions. show, hide, remove, e.g.
  7941. if (typeof data[option] === 'function') {
  7942. data[option].apply(data, args);
  7943. }
  7944. }
  7945. });
  7946. };
  7947. })(jQuery);
  7948. ;(function ($) {
  7949. $.fn.characterCounter = function () {
  7950. return this.each(function () {
  7951. var $input = $(this);
  7952. var $counterElement = $input.parent().find('span[class="character-counter"]');
  7953. // character counter has already been added appended to the parent container
  7954. if ($counterElement.length) {
  7955. return;
  7956. }
  7957. var itHasLengthAttribute = $input.attr('data-length') !== undefined;
  7958. if (itHasLengthAttribute) {
  7959. $input.on('input', updateCounter);
  7960. $input.on('focus', updateCounter);
  7961. $input.on('blur', removeCounterElement);
  7962. addCounterElement($input);
  7963. }
  7964. });
  7965. };
  7966. function updateCounter() {
  7967. var maxLength = +$(this).attr('data-length'),
  7968. actualLength = +$(this).val().length,
  7969. isValidLength = actualLength <= maxLength;
  7970. $(this).parent().find('span[class="character-counter"]').html(actualLength + '/' + maxLength);
  7971. addInputStyle(isValidLength, $(this));
  7972. }
  7973. function addCounterElement($input) {
  7974. var $counterElement = $input.parent().find('span[class="character-counter"]');
  7975. if ($counterElement.length) {
  7976. return;
  7977. }
  7978. $counterElement = $('<span/>').addClass('character-counter').css('float', 'right').css('font-size', '12px').css('height', 1);
  7979. $input.parent().append($counterElement);
  7980. }
  7981. function removeCounterElement() {
  7982. $(this).parent().find('span[class="character-counter"]').html('');
  7983. }
  7984. function addInputStyle(isValidLength, $input) {
  7985. var inputHasInvalidClass = $input.hasClass('invalid');
  7986. if (isValidLength && inputHasInvalidClass) {
  7987. $input.removeClass('invalid');
  7988. } else if (!isValidLength && !inputHasInvalidClass) {
  7989. $input.removeClass('valid');
  7990. $input.addClass('invalid');
  7991. }
  7992. }
  7993. $(document).ready(function () {
  7994. $('input, textarea').characterCounter();
  7995. });
  7996. })(jQuery);
  7997. ;(function ($) {
  7998. var methods = {
  7999. init: function (options) {
  8000. var defaults = {
  8001. duration: 200, // ms
  8002. dist: -100, // zoom scale TODO: make this more intuitive as an option
  8003. shift: 0, // spacing for center image
  8004. padding: 0, // Padding between non center items
  8005. fullWidth: false, // Change to full width styles
  8006. indicators: false, // Toggle indicators
  8007. noWrap: false, // Don't wrap around and cycle through items.
  8008. onCycleTo: null // Callback for when a new slide is cycled to.
  8009. };
  8010. options = $.extend(defaults, options);
  8011. var namespace = Materialize.objectSelectorString($(this));
  8012. return this.each(function (i) {
  8013. var images, item_width, item_height, offset, center, pressed, dim, count, reference, referenceY, amplitude, target, velocity, scrolling, xform, frame, timestamp, ticker, dragged, vertical_dragged;
  8014. var $indicators = $('<ul class="indicators"></ul>');
  8015. var scrollingTimeout = null;
  8016. var oneTimeCallback = null;
  8017. // Initialize
  8018. var view = $(this);
  8019. var hasMultipleSlides = view.find('.carousel-item').length > 1;
  8020. var showIndicators = (view.attr('data-indicators') || options.indicators) && hasMultipleSlides;
  8021. var noWrap = view.attr('data-no-wrap') || options.noWrap || !hasMultipleSlides;
  8022. var uniqueNamespace = view.attr('data-namespace') || namespace + i;
  8023. view.attr('data-namespace', uniqueNamespace);
  8024. // Options
  8025. var setCarouselHeight = function (imageOnly) {
  8026. var firstSlide = view.find('.carousel-item.active').length ? view.find('.carousel-item.active').first() : view.find('.carousel-item').first();
  8027. var firstImage = firstSlide.find('img').first();
  8028. if (firstImage.length) {
  8029. if (firstImage[0].complete) {
  8030. // If image won't trigger the load event
  8031. var imageHeight = firstImage.height();
  8032. if (imageHeight > 0) {
  8033. view.css('height', firstImage.height());
  8034. } else {
  8035. // If image still has no height, use the natural dimensions to calculate
  8036. var naturalWidth = firstImage[0].naturalWidth;
  8037. var naturalHeight = firstImage[0].naturalHeight;
  8038. var adjustedHeight = view.width() / naturalWidth * naturalHeight;
  8039. view.css('height', adjustedHeight);
  8040. }
  8041. } else {
  8042. // Get height when image is loaded normally
  8043. firstImage.on('load', function () {
  8044. view.css('height', $(this).height());
  8045. });
  8046. }
  8047. } else if (!imageOnly) {
  8048. var slideHeight = firstSlide.height();
  8049. view.css('height', slideHeight);
  8050. }
  8051. };
  8052. if (options.fullWidth) {
  8053. options.dist = 0;
  8054. setCarouselHeight();
  8055. // Offset fixed items when indicators.
  8056. if (showIndicators) {
  8057. view.find('.carousel-fixed-item').addClass('with-indicators');
  8058. }
  8059. }
  8060. // Don't double initialize.
  8061. if (view.hasClass('initialized')) {
  8062. // Recalculate variables
  8063. $(window).trigger('resize');
  8064. // Redraw carousel.
  8065. view.trigger('carouselNext', [0.000001]);
  8066. return true;
  8067. }
  8068. view.addClass('initialized');
  8069. pressed = false;
  8070. offset = target = 0;
  8071. images = [];
  8072. item_width = view.find('.carousel-item').first().innerWidth();
  8073. item_height = view.find('.carousel-item').first().innerHeight();
  8074. dim = item_width * 2 + options.padding;
  8075. view.find('.carousel-item').each(function (i) {
  8076. images.push($(this)[0]);
  8077. if (showIndicators) {
  8078. var $indicator = $('<li class="indicator-item"></li>');
  8079. // Add active to first by default.
  8080. if (i === 0) {
  8081. $indicator.addClass('active');
  8082. }
  8083. // Handle clicks on indicators.
  8084. $indicator.click(function (e) {
  8085. e.stopPropagation();
  8086. var index = $(this).index();
  8087. cycleTo(index);
  8088. });
  8089. $indicators.append($indicator);
  8090. }
  8091. });
  8092. if (showIndicators) {
  8093. view.append($indicators);
  8094. }
  8095. count = images.length;
  8096. function setupEvents() {
  8097. if (typeof window.ontouchstart !== 'undefined') {
  8098. view.on('touchstart.carousel', tap);
  8099. view.on('touchmove.carousel', drag);
  8100. view.on('touchend.carousel', release);
  8101. }
  8102. view.on('mousedown.carousel', tap);
  8103. view.on('mousemove.carousel', drag);
  8104. view.on('mouseup.carousel', release);
  8105. view.on('mouseleave.carousel', release);
  8106. view.on('click.carousel', click);
  8107. }
  8108. function xpos(e) {
  8109. // touch event
  8110. if (e.targetTouches && e.targetTouches.length >= 1) {
  8111. return e.targetTouches[0].clientX;
  8112. }
  8113. // mouse event
  8114. return e.clientX;
  8115. }
  8116. function ypos(e) {
  8117. // touch event
  8118. if (e.targetTouches && e.targetTouches.length >= 1) {
  8119. return e.targetTouches[0].clientY;
  8120. }
  8121. // mouse event
  8122. return e.clientY;
  8123. }
  8124. function wrap(x) {
  8125. return x >= count ? x % count : x < 0 ? wrap(count + x % count) : x;
  8126. }
  8127. function scroll(x) {
  8128. // Track scrolling state
  8129. scrolling = true;
  8130. if (!view.hasClass('scrolling')) {
  8131. view.addClass('scrolling');
  8132. }
  8133. if (scrollingTimeout != null) {
  8134. window.clearTimeout(scrollingTimeout);
  8135. }
  8136. scrollingTimeout = window.setTimeout(function () {
  8137. scrolling = false;
  8138. view.removeClass('scrolling');
  8139. }, options.duration);
  8140. // Start actual scroll
  8141. var i, half, delta, dir, tween, el, alignment, xTranslation;
  8142. var lastCenter = center;
  8143. offset = typeof x === 'number' ? x : offset;
  8144. center = Math.floor((offset + dim / 2) / dim);
  8145. delta = offset - center * dim;
  8146. dir = delta < 0 ? 1 : -1;
  8147. tween = -dir * delta * 2 / dim;
  8148. half = count >> 1;
  8149. if (!options.fullWidth) {
  8150. alignment = 'translateX(' + (view[0].clientWidth - item_width) / 2 + 'px) ';
  8151. alignment += 'translateY(' + (view[0].clientHeight - item_height) / 2 + 'px)';
  8152. } else {
  8153. alignment = 'translateX(0)';
  8154. }
  8155. // Set indicator active
  8156. if (showIndicators) {
  8157. var diff = center % count;
  8158. var activeIndicator = $indicators.find('.indicator-item.active');
  8159. if (activeIndicator.index() !== diff) {
  8160. activeIndicator.removeClass('active');
  8161. $indicators.find('.indicator-item').eq(diff).addClass('active');
  8162. }
  8163. }
  8164. // center
  8165. // Don't show wrapped items.
  8166. if (!noWrap || center >= 0 && center < count) {
  8167. el = images[wrap(center)];
  8168. // Add active class to center item.
  8169. if (!$(el).hasClass('active')) {
  8170. view.find('.carousel-item').removeClass('active');
  8171. $(el).addClass('active');
  8172. }
  8173. el.style[xform] = alignment + ' translateX(' + -delta / 2 + 'px)' + ' translateX(' + dir * options.shift * tween * i + 'px)' + ' translateZ(' + options.dist * tween + 'px)';
  8174. el.style.zIndex = 0;
  8175. if (options.fullWidth) {
  8176. tweenedOpacity = 1;
  8177. } else {
  8178. tweenedOpacity = 1 - 0.2 * tween;
  8179. }
  8180. el.style.opacity = tweenedOpacity;
  8181. el.style.display = 'block';
  8182. }
  8183. for (i = 1; i <= half; ++i) {
  8184. // right side
  8185. if (options.fullWidth) {
  8186. zTranslation = options.dist;
  8187. tweenedOpacity = i === half && delta < 0 ? 1 - tween : 1;
  8188. } else {
  8189. zTranslation = options.dist * (i * 2 + tween * dir);
  8190. tweenedOpacity = 1 - 0.2 * (i * 2 + tween * dir);
  8191. }
  8192. // Don't show wrapped items.
  8193. if (!noWrap || center + i < count) {
  8194. el = images[wrap(center + i)];
  8195. el.style[xform] = alignment + ' translateX(' + (options.shift + (dim * i - delta) / 2) + 'px)' + ' translateZ(' + zTranslation + 'px)';
  8196. el.style.zIndex = -i;
  8197. el.style.opacity = tweenedOpacity;
  8198. el.style.display = 'block';
  8199. }
  8200. // left side
  8201. if (options.fullWidth) {
  8202. zTranslation = options.dist;
  8203. tweenedOpacity = i === half && delta > 0 ? 1 - tween : 1;
  8204. } else {
  8205. zTranslation = options.dist * (i * 2 - tween * dir);
  8206. tweenedOpacity = 1 - 0.2 * (i * 2 - tween * dir);
  8207. }
  8208. // Don't show wrapped items.
  8209. if (!noWrap || center - i >= 0) {
  8210. el = images[wrap(center - i)];
  8211. el.style[xform] = alignment + ' translateX(' + (-options.shift + (-dim * i - delta) / 2) + 'px)' + ' translateZ(' + zTranslation + 'px)';
  8212. el.style.zIndex = -i;
  8213. el.style.opacity = tweenedOpacity;
  8214. el.style.display = 'block';
  8215. }
  8216. }
  8217. // center
  8218. // Don't show wrapped items.
  8219. if (!noWrap || center >= 0 && center < count) {
  8220. el = images[wrap(center)];
  8221. el.style[xform] = alignment + ' translateX(' + -delta / 2 + 'px)' + ' translateX(' + dir * options.shift * tween + 'px)' + ' translateZ(' + options.dist * tween + 'px)';
  8222. el.style.zIndex = 0;
  8223. if (options.fullWidth) {
  8224. tweenedOpacity = 1;
  8225. } else {
  8226. tweenedOpacity = 1 - 0.2 * tween;
  8227. }
  8228. el.style.opacity = tweenedOpacity;
  8229. el.style.display = 'block';
  8230. }
  8231. // onCycleTo callback
  8232. if (lastCenter !== center && typeof options.onCycleTo === "function") {
  8233. var $curr_item = view.find('.carousel-item').eq(wrap(center));
  8234. options.onCycleTo.call(this, $curr_item, dragged);
  8235. }
  8236. // One time callback
  8237. if (typeof oneTimeCallback === "function") {
  8238. oneTimeCallback.call(this, $curr_item, dragged);
  8239. oneTimeCallback = null;
  8240. }
  8241. }
  8242. function track() {
  8243. var now, elapsed, delta, v;
  8244. now = Date.now();
  8245. elapsed = now - timestamp;
  8246. timestamp = now;
  8247. delta = offset - frame;
  8248. frame = offset;
  8249. v = 1000 * delta / (1 + elapsed);
  8250. velocity = 0.8 * v + 0.2 * velocity;
  8251. }
  8252. function autoScroll() {
  8253. var elapsed, delta;
  8254. if (amplitude) {
  8255. elapsed = Date.now() - timestamp;
  8256. delta = amplitude * Math.exp(-elapsed / options.duration);
  8257. if (delta > 2 || delta < -2) {
  8258. scroll(target - delta);
  8259. requestAnimationFrame(autoScroll);
  8260. } else {
  8261. scroll(target);
  8262. }
  8263. }
  8264. }
  8265. function click(e) {
  8266. // Disable clicks if carousel was dragged.
  8267. if (dragged) {
  8268. e.preventDefault();
  8269. e.stopPropagation();
  8270. return false;
  8271. } else if (!options.fullWidth) {
  8272. var clickedIndex = $(e.target).closest('.carousel-item').index();
  8273. var diff = wrap(center) - clickedIndex;
  8274. // Disable clicks if carousel was shifted by click
  8275. if (diff !== 0) {
  8276. e.preventDefault();
  8277. e.stopPropagation();
  8278. }
  8279. cycleTo(clickedIndex);
  8280. }
  8281. }
  8282. function cycleTo(n) {
  8283. var diff = center % count - n;
  8284. // Account for wraparound.
  8285. if (!noWrap) {
  8286. if (diff < 0) {
  8287. if (Math.abs(diff + count) < Math.abs(diff)) {
  8288. diff += count;
  8289. }
  8290. } else if (diff > 0) {
  8291. if (Math.abs(diff - count) < diff) {
  8292. diff -= count;
  8293. }
  8294. }
  8295. }
  8296. // Call prev or next accordingly.
  8297. if (diff < 0) {
  8298. view.trigger('carouselNext', [Math.abs(diff)]);
  8299. } else if (diff > 0) {
  8300. view.trigger('carouselPrev', [diff]);
  8301. }
  8302. }
  8303. function tap(e) {
  8304. // Fixes firefox draggable image bug
  8305. if (e.type === 'mousedown' && $(e.target).is('img')) {
  8306. e.preventDefault();
  8307. }
  8308. pressed = true;
  8309. dragged = false;
  8310. vertical_dragged = false;
  8311. reference = xpos(e);
  8312. referenceY = ypos(e);
  8313. velocity = amplitude = 0;
  8314. frame = offset;
  8315. timestamp = Date.now();
  8316. clearInterval(ticker);
  8317. ticker = setInterval(track, 100);
  8318. }
  8319. function drag(e) {
  8320. var x, delta, deltaY;
  8321. if (pressed) {
  8322. x = xpos(e);
  8323. y = ypos(e);
  8324. delta = reference - x;
  8325. deltaY = Math.abs(referenceY - y);
  8326. if (deltaY < 30 && !vertical_dragged) {
  8327. // If vertical scrolling don't allow dragging.
  8328. if (delta > 2 || delta < -2) {
  8329. dragged = true;
  8330. reference = x;
  8331. scroll(offset + delta);
  8332. }
  8333. } else if (dragged) {
  8334. // If dragging don't allow vertical scroll.
  8335. e.preventDefault();
  8336. e.stopPropagation();
  8337. return false;
  8338. } else {
  8339. // Vertical scrolling.
  8340. vertical_dragged = true;
  8341. }
  8342. }
  8343. if (dragged) {
  8344. // If dragging don't allow vertical scroll.
  8345. e.preventDefault();
  8346. e.stopPropagation();
  8347. return false;
  8348. }
  8349. }
  8350. function release(e) {
  8351. if (pressed) {
  8352. pressed = false;
  8353. } else {
  8354. return;
  8355. }
  8356. clearInterval(ticker);
  8357. target = offset;
  8358. if (velocity > 10 || velocity < -10) {
  8359. amplitude = 0.9 * velocity;
  8360. target = offset + amplitude;
  8361. }
  8362. target = Math.round(target / dim) * dim;
  8363. // No wrap of items.
  8364. if (noWrap) {
  8365. if (target >= dim * (count - 1)) {
  8366. target = dim * (count - 1);
  8367. } else if (target < 0) {
  8368. target = 0;
  8369. }
  8370. }
  8371. amplitude = target - offset;
  8372. timestamp = Date.now();
  8373. requestAnimationFrame(autoScroll);
  8374. if (dragged) {
  8375. e.preventDefault();
  8376. e.stopPropagation();
  8377. }
  8378. return false;
  8379. }
  8380. xform = 'transform';
  8381. ['webkit', 'Moz', 'O', 'ms'].every(function (prefix) {
  8382. var e = prefix + 'Transform';
  8383. if (typeof document.body.style[e] !== 'undefined') {
  8384. xform = e;
  8385. return false;
  8386. }
  8387. return true;
  8388. });
  8389. var throttledResize = Materialize.throttle(function () {
  8390. if (options.fullWidth) {
  8391. item_width = view.find('.carousel-item').first().innerWidth();
  8392. var imageHeight = view.find('.carousel-item.active').height();
  8393. dim = item_width * 2 + options.padding;
  8394. offset = center * 2 * item_width;
  8395. target = offset;
  8396. setCarouselHeight(true);
  8397. } else {
  8398. scroll();
  8399. }
  8400. }, 200);
  8401. $(window).off('resize.carousel-' + uniqueNamespace).on('resize.carousel-' + uniqueNamespace, throttledResize);
  8402. setupEvents();
  8403. scroll(offset);
  8404. $(this).on('carouselNext', function (e, n, callback) {
  8405. if (n === undefined) {
  8406. n = 1;
  8407. }
  8408. if (typeof callback === "function") {
  8409. oneTimeCallback = callback;
  8410. }
  8411. target = dim * Math.round(offset / dim) + dim * n;
  8412. if (offset !== target) {
  8413. amplitude = target - offset;
  8414. timestamp = Date.now();
  8415. requestAnimationFrame(autoScroll);
  8416. }
  8417. });
  8418. $(this).on('carouselPrev', function (e, n, callback) {
  8419. if (n === undefined) {
  8420. n = 1;
  8421. }
  8422. if (typeof callback === "function") {
  8423. oneTimeCallback = callback;
  8424. }
  8425. target = dim * Math.round(offset / dim) - dim * n;
  8426. if (offset !== target) {
  8427. amplitude = target - offset;
  8428. timestamp = Date.now();
  8429. requestAnimationFrame(autoScroll);
  8430. }
  8431. });
  8432. $(this).on('carouselSet', function (e, n, callback) {
  8433. if (n === undefined) {
  8434. n = 0;
  8435. }
  8436. if (typeof callback === "function") {
  8437. oneTimeCallback = callback;
  8438. }
  8439. cycleTo(n);
  8440. });
  8441. });
  8442. },
  8443. next: function (n, callback) {
  8444. $(this).trigger('carouselNext', [n, callback]);
  8445. },
  8446. prev: function (n, callback) {
  8447. $(this).trigger('carouselPrev', [n, callback]);
  8448. },
  8449. set: function (n, callback) {
  8450. $(this).trigger('carouselSet', [n, callback]);
  8451. },
  8452. destroy: function () {
  8453. var uniqueNamespace = $(this).attr('data-namespace');
  8454. $(this).removeAttr('data-namespace');
  8455. $(this).removeClass('initialized');
  8456. $(this).find('.indicators').remove();
  8457. // Remove event handlers
  8458. $(this).off('carouselNext carouselPrev carouselSet');
  8459. $(window).off('resize.carousel-' + uniqueNamespace);
  8460. if (typeof window.ontouchstart !== 'undefined') {
  8461. $(this).off('touchstart.carousel touchmove.carousel touchend.carousel');
  8462. }
  8463. $(this).off('mousedown.carousel mousemove.carousel mouseup.carousel mouseleave.carousel click.carousel');
  8464. }
  8465. };
  8466. $.fn.carousel = function (methodOrOptions) {
  8467. if (methods[methodOrOptions]) {
  8468. return methods[methodOrOptions].apply(this, Array.prototype.slice.call(arguments, 1));
  8469. } else if (typeof methodOrOptions === 'object' || !methodOrOptions) {
  8470. // Default to "init"
  8471. return methods.init.apply(this, arguments);
  8472. } else {
  8473. $.error('Method ' + methodOrOptions + ' does not exist on jQuery.carousel');
  8474. }
  8475. }; // Plugin end
  8476. })(jQuery);
  8477. ;(function ($) {
  8478. var methods = {
  8479. init: function (options) {
  8480. return this.each(function () {
  8481. var origin = $('#' + $(this).attr('data-activates'));
  8482. var screen = $('body');
  8483. // Creating tap target
  8484. var tapTargetEl = $(this);
  8485. var tapTargetWrapper = tapTargetEl.parent('.tap-target-wrapper');
  8486. var tapTargetWave = tapTargetWrapper.find('.tap-target-wave');
  8487. var tapTargetOriginEl = tapTargetWrapper.find('.tap-target-origin');
  8488. var tapTargetContentEl = tapTargetEl.find('.tap-target-content');
  8489. // Creating wrapper
  8490. if (!tapTargetWrapper.length) {
  8491. tapTargetWrapper = tapTargetEl.wrap($('<div class="tap-target-wrapper"></div>')).parent();
  8492. }
  8493. // Creating content
  8494. if (!tapTargetContentEl.length) {
  8495. tapTargetContentEl = $('<div class="tap-target-content"></div>');
  8496. tapTargetEl.append(tapTargetContentEl);
  8497. }
  8498. // Creating foreground wave
  8499. if (!tapTargetWave.length) {
  8500. tapTargetWave = $('<div class="tap-target-wave"></div>');
  8501. // Creating origin
  8502. if (!tapTargetOriginEl.length) {
  8503. tapTargetOriginEl = origin.clone(true, true);
  8504. tapTargetOriginEl.addClass('tap-target-origin');
  8505. tapTargetOriginEl.removeAttr('id');
  8506. tapTargetOriginEl.removeAttr('style');
  8507. tapTargetWave.append(tapTargetOriginEl);
  8508. }
  8509. tapTargetWrapper.append(tapTargetWave);
  8510. }
  8511. // Open
  8512. var openTapTarget = function () {
  8513. if (tapTargetWrapper.is('.open')) {
  8514. return;
  8515. }
  8516. // Adding open class
  8517. tapTargetWrapper.addClass('open');
  8518. setTimeout(function () {
  8519. tapTargetOriginEl.off('click.tapTarget').on('click.tapTarget', function (e) {
  8520. closeTapTarget();
  8521. tapTargetOriginEl.off('click.tapTarget');
  8522. });
  8523. $(document).off('click.tapTarget').on('click.tapTarget', function (e) {
  8524. closeTapTarget();
  8525. $(document).off('click.tapTarget');
  8526. });
  8527. var throttledCalc = Materialize.throttle(function () {
  8528. calculateTapTarget();
  8529. }, 200);
  8530. $(window).off('resize.tapTarget').on('resize.tapTarget', throttledCalc);
  8531. }, 0);
  8532. };
  8533. // Close
  8534. var closeTapTarget = function () {
  8535. if (!tapTargetWrapper.is('.open')) {
  8536. return;
  8537. }
  8538. tapTargetWrapper.removeClass('open');
  8539. tapTargetOriginEl.off('click.tapTarget');
  8540. $(document).off('click.tapTarget');
  8541. $(window).off('resize.tapTarget');
  8542. };
  8543. // Pre calculate
  8544. var calculateTapTarget = function () {
  8545. // Element or parent is fixed position?
  8546. var isFixed = origin.css('position') === 'fixed';
  8547. if (!isFixed) {
  8548. var parents = origin.parents();
  8549. for (var i = 0; i < parents.length; i++) {
  8550. isFixed = $(parents[i]).css('position') == 'fixed';
  8551. if (isFixed) {
  8552. break;
  8553. }
  8554. }
  8555. }
  8556. // Calculating origin
  8557. var originWidth = origin.outerWidth();
  8558. var originHeight = origin.outerHeight();
  8559. var originTop = isFixed ? origin.offset().top - $(document).scrollTop() : origin.offset().top;
  8560. var originLeft = isFixed ? origin.offset().left - $(document).scrollLeft() : origin.offset().left;
  8561. // Calculating screen
  8562. var windowWidth = $(window).width();
  8563. var windowHeight = $(window).height();
  8564. var centerX = windowWidth / 2;
  8565. var centerY = windowHeight / 2;
  8566. var isLeft = originLeft <= centerX;
  8567. var isRight = originLeft > centerX;
  8568. var isTop = originTop <= centerY;
  8569. var isBottom = originTop > centerY;
  8570. var isCenterX = originLeft >= windowWidth * 0.25 && originLeft <= windowWidth * 0.75;
  8571. var isCenterY = originTop >= windowHeight * 0.25 && originTop <= windowHeight * 0.75;
  8572. // Calculating tap target
  8573. var tapTargetWidth = tapTargetEl.outerWidth();
  8574. var tapTargetHeight = tapTargetEl.outerHeight();
  8575. var tapTargetTop = originTop + originHeight / 2 - tapTargetHeight / 2;
  8576. var tapTargetLeft = originLeft + originWidth / 2 - tapTargetWidth / 2;
  8577. var tapTargetPosition = isFixed ? 'fixed' : 'absolute';
  8578. // Calculating content
  8579. var tapTargetTextWidth = isCenterX ? tapTargetWidth : tapTargetWidth / 2 + originWidth;
  8580. var tapTargetTextHeight = tapTargetHeight / 2;
  8581. var tapTargetTextTop = isTop ? tapTargetHeight / 2 : 0;
  8582. var tapTargetTextBottom = 0;
  8583. var tapTargetTextLeft = isLeft && !isCenterX ? tapTargetWidth / 2 - originWidth : 0;
  8584. var tapTargetTextRight = 0;
  8585. var tapTargetTextPadding = originWidth;
  8586. var tapTargetTextAlign = isBottom ? 'bottom' : 'top';
  8587. // Calculating wave
  8588. var tapTargetWaveWidth = originWidth > originHeight ? originWidth * 2 : originWidth * 2;
  8589. var tapTargetWaveHeight = tapTargetWaveWidth;
  8590. var tapTargetWaveTop = tapTargetHeight / 2 - tapTargetWaveHeight / 2;
  8591. var tapTargetWaveLeft = tapTargetWidth / 2 - tapTargetWaveWidth / 2;
  8592. // Setting tap target
  8593. var tapTargetWrapperCssObj = {};
  8594. tapTargetWrapperCssObj.top = isTop ? tapTargetTop : '';
  8595. tapTargetWrapperCssObj.right = isRight ? windowWidth - tapTargetLeft - tapTargetWidth : '';
  8596. tapTargetWrapperCssObj.bottom = isBottom ? windowHeight - tapTargetTop - tapTargetHeight : '';
  8597. tapTargetWrapperCssObj.left = isLeft ? tapTargetLeft : '';
  8598. tapTargetWrapperCssObj.position = tapTargetPosition;
  8599. tapTargetWrapper.css(tapTargetWrapperCssObj);
  8600. // Setting content
  8601. tapTargetContentEl.css({
  8602. width: tapTargetTextWidth,
  8603. height: tapTargetTextHeight,
  8604. top: tapTargetTextTop,
  8605. right: tapTargetTextRight,
  8606. bottom: tapTargetTextBottom,
  8607. left: tapTargetTextLeft,
  8608. padding: tapTargetTextPadding,
  8609. verticalAlign: tapTargetTextAlign
  8610. });
  8611. // Setting wave
  8612. tapTargetWave.css({
  8613. top: tapTargetWaveTop,
  8614. left: tapTargetWaveLeft,
  8615. width: tapTargetWaveWidth,
  8616. height: tapTargetWaveHeight
  8617. });
  8618. };
  8619. if (options == 'open') {
  8620. calculateTapTarget();
  8621. openTapTarget();
  8622. }
  8623. if (options == 'close') closeTapTarget();
  8624. });
  8625. },
  8626. open: function () {},
  8627. close: function () {}
  8628. };
  8629. $.fn.tapTarget = function (methodOrOptions) {
  8630. if (methods[methodOrOptions] || typeof methodOrOptions === 'object') return methods.init.apply(this, arguments);
  8631. $.error('Method ' + methodOrOptions + ' does not exist on jQuery.tap-target');
  8632. };
  8633. })(jQuery);