materialize.dev.js 385 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476
  1. "use strict";
  2. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  3. /*!
  4. * Materialize v0.100.2 (http://materializecss.com)
  5. * Copyright 2014-2017 Materialize
  6. * MIT License (https://raw.githubusercontent.com/Dogfalo/materialize/master/LICENSE)
  7. */
  8. var _createClass = function () {
  9. function defineProperties(target, props) {
  10. for (var i = 0; i < props.length; i++) {
  11. var descriptor = props[i];
  12. descriptor.enumerable = descriptor.enumerable || false;
  13. descriptor.configurable = true;
  14. if ("value" in descriptor) descriptor.writable = true;
  15. Object.defineProperty(target, descriptor.key, descriptor);
  16. }
  17. }
  18. return function (Constructor, protoProps, staticProps) {
  19. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  20. if (staticProps) defineProperties(Constructor, staticProps);
  21. return Constructor;
  22. };
  23. }();
  24. function _classCallCheck(instance, Constructor) {
  25. if (!(instance instanceof Constructor)) {
  26. throw new TypeError("Cannot call a class as a function");
  27. }
  28. } // Check for jQuery.
  29. if (typeof jQuery === 'undefined') {
  30. // Check if require is a defined function.
  31. if (typeof require === 'function') {
  32. jQuery = $ = require('jquery'); // Else use the dollar sign alias.
  33. } else {
  34. jQuery = $;
  35. }
  36. }
  37. ;
  38. /*
  39. * jQuery Easing v1.4.0 - http://gsgd.co.uk/sandbox/jquery/easing/
  40. * Open source under the BSD License.
  41. * Copyright © 2008 George McGinley Smith
  42. * All rights reserved.
  43. * https://raw.github.com/gdsmith/jquery-easing/master/LICENSE
  44. */
  45. (function (factory) {
  46. if (typeof define === "function" && define.amd) {
  47. define(['jquery'], function ($) {
  48. return factory($);
  49. });
  50. } else if ((typeof module === "undefined" ? "undefined" : _typeof(module)) === "object" && _typeof(module.exports) === "object") {
  51. exports = factory(require('jquery'));
  52. } else {
  53. factory(jQuery);
  54. }
  55. })(function ($) {
  56. // Preserve the original jQuery "swing" easing as "jswing"
  57. $.easing['jswing'] = $.easing['swing'];
  58. var pow = Math.pow,
  59. sqrt = Math.sqrt,
  60. sin = Math.sin,
  61. cos = Math.cos,
  62. PI = Math.PI,
  63. c1 = 1.70158,
  64. c2 = c1 * 1.525,
  65. c3 = c1 + 1,
  66. c4 = 2 * PI / 3,
  67. c5 = 2 * PI / 4.5; // x is the fraction of animation progress, in the range 0..1
  68. function bounceOut(x) {
  69. var n1 = 7.5625,
  70. d1 = 2.75;
  71. if (x < 1 / d1) {
  72. return n1 * x * x;
  73. } else if (x < 2 / d1) {
  74. return n1 * (x -= 1.5 / d1) * x + .75;
  75. } else if (x < 2.5 / d1) {
  76. return n1 * (x -= 2.25 / d1) * x + .9375;
  77. } else {
  78. return n1 * (x -= 2.625 / d1) * x + .984375;
  79. }
  80. }
  81. $.extend($.easing, {
  82. def: 'easeOutQuad',
  83. swing: function swing(x) {
  84. return $.easing[$.easing.def](x);
  85. },
  86. easeInQuad: function easeInQuad(x) {
  87. return x * x;
  88. },
  89. easeOutQuad: function easeOutQuad(x) {
  90. return 1 - (1 - x) * (1 - x);
  91. },
  92. easeInOutQuad: function easeInOutQuad(x) {
  93. return x < 0.5 ? 2 * x * x : 1 - pow(-2 * x + 2, 2) / 2;
  94. },
  95. easeInCubic: function easeInCubic(x) {
  96. return x * x * x;
  97. },
  98. easeOutCubic: function easeOutCubic(x) {
  99. return 1 - pow(1 - x, 3);
  100. },
  101. easeInOutCubic: function easeInOutCubic(x) {
  102. return x < 0.5 ? 4 * x * x * x : 1 - pow(-2 * x + 2, 3) / 2;
  103. },
  104. easeInQuart: function easeInQuart(x) {
  105. return x * x * x * x;
  106. },
  107. easeOutQuart: function easeOutQuart(x) {
  108. return 1 - pow(1 - x, 4);
  109. },
  110. easeInOutQuart: function easeInOutQuart(x) {
  111. return x < 0.5 ? 8 * x * x * x * x : 1 - pow(-2 * x + 2, 4) / 2;
  112. },
  113. easeInQuint: function easeInQuint(x) {
  114. return x * x * x * x * x;
  115. },
  116. easeOutQuint: function easeOutQuint(x) {
  117. return 1 - pow(1 - x, 5);
  118. },
  119. easeInOutQuint: function easeInOutQuint(x) {
  120. return x < 0.5 ? 16 * x * x * x * x * x : 1 - pow(-2 * x + 2, 5) / 2;
  121. },
  122. easeInSine: function easeInSine(x) {
  123. return 1 - cos(x * PI / 2);
  124. },
  125. easeOutSine: function easeOutSine(x) {
  126. return sin(x * PI / 2);
  127. },
  128. easeInOutSine: function easeInOutSine(x) {
  129. return -(cos(PI * x) - 1) / 2;
  130. },
  131. easeInExpo: function easeInExpo(x) {
  132. return x === 0 ? 0 : pow(2, 10 * x - 10);
  133. },
  134. easeOutExpo: function easeOutExpo(x) {
  135. return x === 1 ? 1 : 1 - pow(2, -10 * x);
  136. },
  137. easeInOutExpo: function easeInOutExpo(x) {
  138. return x === 0 ? 0 : x === 1 ? 1 : x < 0.5 ? pow(2, 20 * x - 10) / 2 : (2 - pow(2, -20 * x + 10)) / 2;
  139. },
  140. easeInCirc: function easeInCirc(x) {
  141. return 1 - sqrt(1 - pow(x, 2));
  142. },
  143. easeOutCirc: function easeOutCirc(x) {
  144. return sqrt(1 - pow(x - 1, 2));
  145. },
  146. easeInOutCirc: function easeInOutCirc(x) {
  147. return x < 0.5 ? (1 - sqrt(1 - pow(2 * x, 2))) / 2 : (sqrt(1 - pow(-2 * x + 2, 2)) + 1) / 2;
  148. },
  149. easeInElastic: function easeInElastic(x) {
  150. return x === 0 ? 0 : x === 1 ? 1 : -pow(2, 10 * x - 10) * sin((x * 10 - 10.75) * c4);
  151. },
  152. easeOutElastic: function easeOutElastic(x) {
  153. return x === 0 ? 0 : x === 1 ? 1 : pow(2, -10 * x) * sin((x * 10 - 0.75) * c4) + 1;
  154. },
  155. easeInOutElastic: function easeInOutElastic(x) {
  156. 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;
  157. },
  158. easeInBack: function easeInBack(x) {
  159. return c3 * x * x * x - c1 * x * x;
  160. },
  161. easeOutBack: function easeOutBack(x) {
  162. return 1 + c3 * pow(x - 1, 3) + c1 * pow(x - 1, 2);
  163. },
  164. easeInOutBack: function easeInOutBack(x) {
  165. 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;
  166. },
  167. easeInBounce: function easeInBounce(x) {
  168. return 1 - bounceOut(1 - x);
  169. },
  170. easeOutBounce: bounceOut,
  171. easeInOutBounce: function easeInOutBounce(x) {
  172. return x < 0.5 ? (1 - bounceOut(1 - 2 * x)) / 2 : (1 + bounceOut(2 * x - 1)) / 2;
  173. }
  174. });
  175. });
  176. ; // Custom Easing
  177. jQuery.extend(jQuery.easing, {
  178. easeInOutMaterial: function easeInOutMaterial(x, t, b, c, d) {
  179. if ((t /= d / 2) < 1) return c / 2 * t * t + b;
  180. return c / 4 * ((t -= 2) * t * t + 2) + b;
  181. }
  182. });
  183. ;
  184. /*! VelocityJS.org (1.2.3). (C) 2014 Julian Shapiro. MIT @license: en.wikipedia.org/wiki/MIT_License */
  185. /*! VelocityJS.org jQuery Shim (1.0.1). (C) 2014 The jQuery Foundation. MIT @license: en.wikipedia.org/wiki/MIT_License. */
  186. /*! Note that this has been modified by Materialize to confirm that Velocity is not already being imported. */
  187. jQuery.Velocity ? console.log("Velocity is already loaded. You may be needlessly importing Velocity again; note that Materialize includes Velocity.") : (!function (e) {
  188. function t(e) {
  189. var t = e.length,
  190. a = r.type(e);
  191. 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;
  192. }
  193. if (!e.jQuery) {
  194. var r = function r(e, t) {
  195. return new r.fn.init(e, t);
  196. };
  197. r.isWindow = function (e) {
  198. return null != e && e == e.window;
  199. }, r.type = function (e) {
  200. return null == e ? e + "" : "object" == _typeof(e) || "function" == typeof e ? n[i.call(e)] || "object" : _typeof(e);
  201. }, r.isArray = Array.isArray || function (e) {
  202. return "array" === r.type(e);
  203. }, r.isPlainObject = function (e) {
  204. var t;
  205. if (!e || "object" !== r.type(e) || e.nodeType || r.isWindow(e)) return !1;
  206. try {
  207. if (e.constructor && !o.call(e, "constructor") && !o.call(e.constructor.prototype, "isPrototypeOf")) return !1;
  208. } catch (a) {
  209. return !1;
  210. }
  211. for (t in e) {}
  212. return void 0 === t || o.call(e, t);
  213. }, r.each = function (e, r, a) {
  214. var n,
  215. o = 0,
  216. i = e.length,
  217. s = t(e);
  218. if (a) {
  219. if (s) for (; i > o && (n = r.apply(e[o], a), n !== !1); o++) {} else for (o in e) {
  220. if (n = r.apply(e[o], a), n === !1) break;
  221. }
  222. } else if (s) for (; i > o && (n = r.call(e[o], o, e[o]), n !== !1); o++) {} else for (o in e) {
  223. if (n = r.call(e[o], o, e[o]), n === !1) break;
  224. }
  225. return e;
  226. }, r.data = function (e, t, n) {
  227. if (void 0 === n) {
  228. var o = e[r.expando],
  229. i = o && a[o];
  230. if (void 0 === t) return i;
  231. if (i && t in i) return i[t];
  232. } else if (void 0 !== t) {
  233. var o = e[r.expando] || (e[r.expando] = ++r.uuid);
  234. return a[o] = a[o] || {}, a[o][t] = n, n;
  235. }
  236. }, r.removeData = function (e, t) {
  237. var n = e[r.expando],
  238. o = n && a[n];
  239. o && r.each(t, function (e, t) {
  240. delete o[t];
  241. });
  242. }, r.extend = function () {
  243. var e,
  244. t,
  245. a,
  246. n,
  247. o,
  248. i,
  249. s = arguments[0] || {},
  250. l = 1,
  251. u = arguments.length,
  252. c = !1;
  253. 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++) {
  254. if (null != (o = arguments[l])) for (n in o) {
  255. 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));
  256. }
  257. }
  258. return s;
  259. }, r.queue = function (e, a, n) {
  260. function o(e, r) {
  261. var a = r || [];
  262. return null != e && (t(Object(e)) ? !function (e, t) {
  263. for (var r = +t.length, a = 0, n = e.length; r > a;) {
  264. e[n++] = t[a++];
  265. }
  266. if (r !== r) for (; void 0 !== t[a];) {
  267. e[n++] = t[a++];
  268. }
  269. return e.length = n, e;
  270. }(a, "string" == typeof e ? [e] : e) : [].push.call(a, e)), a;
  271. }
  272. if (e) {
  273. a = (a || "fx") + "queue";
  274. var i = r.data(e, a);
  275. return n ? (!i || r.isArray(n) ? i = r.data(e, a, o(n)) : i.push(n), i) : i || [];
  276. }
  277. }, r.dequeue = function (e, t) {
  278. r.each(e.nodeType ? [e] : e, function (e, a) {
  279. t = t || "fx";
  280. var n = r.queue(a, t),
  281. o = n.shift();
  282. "inprogress" === o && (o = n.shift()), o && ("fx" === t && n.unshift("inprogress"), o.call(a, function () {
  283. r.dequeue(a, t);
  284. }));
  285. });
  286. }, r.fn = r.prototype = {
  287. init: function init(e) {
  288. if (e.nodeType) return this[0] = e, this;
  289. throw new Error("Not a DOM node.");
  290. },
  291. offset: function offset() {
  292. var t = this[0].getBoundingClientRect ? this[0].getBoundingClientRect() : {
  293. top: 0,
  294. left: 0
  295. };
  296. return {
  297. top: t.top + (e.pageYOffset || document.scrollTop || 0) - (document.clientTop || 0),
  298. left: t.left + (e.pageXOffset || document.scrollLeft || 0) - (document.clientLeft || 0)
  299. };
  300. },
  301. position: function position() {
  302. function e() {
  303. for (var e = this.offsetParent || document; e && "html" === !e.nodeType.toLowerCase && "static" === e.style.position;) {
  304. e = e.offsetParent;
  305. }
  306. return e || document;
  307. }
  308. var t = this[0],
  309. e = e.apply(t),
  310. a = this.offset(),
  311. n = /^(?:body|html)$/i.test(e.nodeName) ? {
  312. top: 0,
  313. left: 0
  314. } : r(e).offset();
  315. 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), {
  316. top: a.top - n.top,
  317. left: a.left - n.left
  318. };
  319. }
  320. };
  321. var a = {};
  322. r.expando = "velocity" + new Date().getTime(), r.uuid = 0;
  323. 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++) {
  324. n["[object " + s[l] + "]"] = s[l].toLowerCase();
  325. }
  326. r.fn.init.prototype = r.fn, e.Velocity = {
  327. Utilities: r
  328. };
  329. }
  330. }(window), function (e) {
  331. "object" == (typeof module === "undefined" ? "undefined" : _typeof(module)) && "object" == _typeof(module.exports) ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : e();
  332. }(function () {
  333. return function (e, t, r, a) {
  334. function n(e) {
  335. for (var t = -1, r = e ? e.length : 0, a = []; ++t < r;) {
  336. var n = e[t];
  337. n && a.push(n);
  338. }
  339. return a;
  340. }
  341. function o(e) {
  342. return m.isWrapped(e) ? e = [].slice.call(e) : m.isNode(e) && (e = [e]), e;
  343. }
  344. function i(e) {
  345. var t = f.data(e, "velocity");
  346. return null === t ? a : t;
  347. }
  348. function s(e) {
  349. return function (t) {
  350. return Math.round(t * e) * (1 / e);
  351. };
  352. }
  353. function l(e, r, a, n) {
  354. function o(e, t) {
  355. return 1 - 3 * t + 3 * e;
  356. }
  357. function i(e, t) {
  358. return 3 * t - 6 * e;
  359. }
  360. function s(e) {
  361. return 3 * e;
  362. }
  363. function l(e, t, r) {
  364. return ((o(t, r) * e + i(t, r)) * e + s(t)) * e;
  365. }
  366. function u(e, t, r) {
  367. return 3 * o(t, r) * e * e + 2 * i(t, r) * e + s(t);
  368. }
  369. function c(t, r) {
  370. for (var n = 0; m > n; ++n) {
  371. var o = u(r, e, a);
  372. if (0 === o) return r;
  373. var i = l(r, e, a) - t;
  374. r -= i / o;
  375. }
  376. return r;
  377. }
  378. function p() {
  379. for (var t = 0; b > t; ++t) {
  380. w[t] = l(t * x, e, a);
  381. }
  382. }
  383. function f(t, r, n) {
  384. var o,
  385. i,
  386. s = 0;
  387. do {
  388. i = r + (n - r) / 2, o = l(i, e, a) - t, o > 0 ? n = i : r = i;
  389. } while (Math.abs(o) > h && ++s < v);
  390. return i;
  391. }
  392. function d(t) {
  393. for (var r = 0, n = 1, o = b - 1; n != o && w[n] <= t; ++n) {
  394. r += x;
  395. }
  396. --n;
  397. var i = (t - w[n]) / (w[n + 1] - w[n]),
  398. s = r + i * x,
  399. l = u(s, e, a);
  400. return l >= y ? c(t, s) : 0 == l ? s : f(t, r, r + x);
  401. }
  402. function g() {
  403. V = !0, (e != r || a != n) && p();
  404. }
  405. var m = 4,
  406. y = .001,
  407. h = 1e-7,
  408. v = 10,
  409. b = 11,
  410. x = 1 / (b - 1),
  411. S = "Float32Array" in t;
  412. if (4 !== arguments.length) return !1;
  413. for (var P = 0; 4 > P; ++P) {
  414. if ("number" != typeof arguments[P] || isNaN(arguments[P]) || !isFinite(arguments[P])) return !1;
  415. }
  416. e = Math.min(e, 1), a = Math.min(a, 1), e = Math.max(e, 0), a = Math.max(a, 0);
  417. var w = S ? new Float32Array(b) : new Array(b),
  418. V = !1,
  419. C = function C(t) {
  420. return V || g(), e === r && a === n ? t : 0 === t ? 0 : 1 === t ? 1 : l(d(t), r, n);
  421. };
  422. C.getControlPoints = function () {
  423. return [{
  424. x: e,
  425. y: r
  426. }, {
  427. x: a,
  428. y: n
  429. }];
  430. };
  431. var T = "generateBezier(" + [e, r, a, n] + ")";
  432. return C.toString = function () {
  433. return T;
  434. }, C;
  435. }
  436. function u(e, t) {
  437. var r = e;
  438. 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;
  439. }
  440. function c(e) {
  441. if (e) {
  442. var t = new Date().getTime(),
  443. r = b.State.calls.length;
  444. r > 1e4 && (b.State.calls = n(b.State.calls));
  445. for (var o = 0; r > o; o++) {
  446. if (b.State.calls[o]) {
  447. var s = b.State.calls[o],
  448. l = s[0],
  449. u = s[2],
  450. d = s[3],
  451. g = !!d,
  452. y = null;
  453. d || (d = b.State.calls[o][3] = t - 16);
  454. for (var h = Math.min((t - d) / u.duration, 1), v = 0, x = l.length; x > v; v++) {
  455. var P = l[v],
  456. V = P.element;
  457. if (i(V)) {
  458. var C = !1;
  459. if (u.display !== a && null !== u.display && "none" !== u.display) {
  460. if ("flex" === u.display) {
  461. var T = ["-webkit-box", "-moz-box", "-ms-flexbox", "-webkit-flex"];
  462. f.each(T, function (e, t) {
  463. S.setPropertyValue(V, "display", t);
  464. });
  465. }
  466. S.setPropertyValue(V, "display", u.display);
  467. }
  468. u.visibility !== a && "hidden" !== u.visibility && S.setPropertyValue(V, "visibility", u.visibility);
  469. for (var k in P) {
  470. if ("element" !== k) {
  471. var A,
  472. F = P[k],
  473. j = m.isString(F.easing) ? b.Easings[F.easing] : F.easing;
  474. if (1 === h) A = F.endValue;else {
  475. var E = F.endValue - F.startValue;
  476. if (A = F.startValue + E * j(h, u, E), !g && A === F.currentValue) continue;
  477. }
  478. if (F.currentValue = A, "tween" === k) y = A;else {
  479. if (S.Hooks.registered[k]) {
  480. var H = S.Hooks.getRoot(k),
  481. N = i(V).rootPropertyValueCache[H];
  482. N && (F.rootPropertyValue = N);
  483. }
  484. var L = S.setPropertyValue(V, k, F.currentValue + (0 === parseFloat(A) ? "" : F.unitType), F.rootPropertyValue, F.scrollData);
  485. 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);
  486. }
  487. }
  488. }
  489. u.mobileHA && i(V).transformCache.translate3d === a && (i(V).transformCache.translate3d = "(0px, 0px, 0px)", C = !0), C && S.flushTransformCache(V);
  490. }
  491. }
  492. 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);
  493. }
  494. }
  495. }
  496. b.State.isTicking && w(c);
  497. }
  498. function p(e, t) {
  499. if (!b.State.calls[e]) return !1;
  500. 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++) {
  501. var p = r[u].element;
  502. 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)) {
  503. i(p).isAnimating = !1, i(p).rootPropertyValueCache = {};
  504. var d = !1;
  505. f.each(S.Lists.transforms3D, function (e, t) {
  506. var r = /^scale/.test(t) ? 1 : 0,
  507. n = i(p).transformCache[t];
  508. i(p).transformCache[t] !== a && new RegExp("^\\(" + r + "[^.]").test(n) && (d = !0, delete i(p).transformCache[t]);
  509. }), o.mobileHA && (d = !0, delete i(p).transformCache.translate3d), d && S.flushTransformCache(p), S.Values.removeClass(p, "velocity-animating");
  510. }
  511. if (!t && o.complete && !o.loop && u === c - 1) try {
  512. o.complete.call(n, n);
  513. } catch (g) {
  514. setTimeout(function () {
  515. throw g;
  516. }, 1);
  517. }
  518. s && o.loop !== !0 && s(n), i(p) && o.loop === !0 && !t && (f.each(i(p).tweensContainer, function (e, t) {
  519. /^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);
  520. }), b(p, "reverse", {
  521. loop: !0,
  522. delay: o.delay
  523. })), o.queue !== !1 && f.dequeue(p, o.queue);
  524. }
  525. b.State.calls[e] = !1;
  526. for (var m = 0, y = b.State.calls.length; y > m; m++) {
  527. if (b.State.calls[m] !== !1) {
  528. l = !0;
  529. break;
  530. }
  531. }
  532. l === !1 && (b.State.isTicking = !1, delete b.State.calls, b.State.calls = []);
  533. }
  534. var f,
  535. d = function () {
  536. if (r.documentMode) return r.documentMode;
  537. for (var e = 7; e > 4; e--) {
  538. var t = r.createElement("div");
  539. if (t.innerHTML = "<!--[if IE " + e + "]><span></span><![endif]-->", t.getElementsByTagName("span").length) return t = null, e;
  540. }
  541. return a;
  542. }(),
  543. g = function () {
  544. var e = 0;
  545. return t.webkitRequestAnimationFrame || t.mozRequestAnimationFrame || function (t) {
  546. var r,
  547. a = new Date().getTime();
  548. return r = Math.max(0, 16 - (a - e)), e = a + r, setTimeout(function () {
  549. t(a + r);
  550. }, r);
  551. };
  552. }(),
  553. m = {
  554. isString: function isString(e) {
  555. return "string" == typeof e;
  556. },
  557. isArray: Array.isArray || function (e) {
  558. return "[object Array]" === Object.prototype.toString.call(e);
  559. },
  560. isFunction: function isFunction(e) {
  561. return "[object Function]" === Object.prototype.toString.call(e);
  562. },
  563. isNode: function isNode(e) {
  564. return e && e.nodeType;
  565. },
  566. isNodeList: function isNodeList(e) {
  567. 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);
  568. },
  569. isWrapped: function isWrapped(e) {
  570. return e && (e.jquery || t.Zepto && t.Zepto.zepto.isZ(e));
  571. },
  572. isSVG: function isSVG(e) {
  573. return t.SVGElement && e instanceof t.SVGElement;
  574. },
  575. isEmptyObject: function isEmptyObject(e) {
  576. for (var t in e) {
  577. return !1;
  578. }
  579. return !0;
  580. }
  581. },
  582. y = !1;
  583. 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.");
  584. if (7 >= d) return void (jQuery.fn.velocity = jQuery.fn.animate);
  585. var h = 400,
  586. v = "swing",
  587. b = {
  588. State: {
  589. isMobile: /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),
  590. isAndroid: /Android/i.test(navigator.userAgent),
  591. isGingerbread: /Android 2\.3\.[3-7]/i.test(navigator.userAgent),
  592. isChrome: t.chrome,
  593. isFirefox: /Firefox/i.test(navigator.userAgent),
  594. prefixElement: r.createElement("div"),
  595. prefixMatches: {},
  596. scrollAnchor: null,
  597. scrollPropertyLeft: null,
  598. scrollPropertyTop: null,
  599. isTicking: !1,
  600. calls: []
  601. },
  602. CSS: {},
  603. Utilities: f,
  604. Redirects: {},
  605. Easings: {},
  606. Promise: t.Promise,
  607. defaults: {
  608. queue: "",
  609. duration: h,
  610. easing: v,
  611. begin: a,
  612. complete: a,
  613. progress: a,
  614. display: a,
  615. visibility: a,
  616. loop: !1,
  617. delay: !1,
  618. mobileHA: !0,
  619. _cacheValues: !0
  620. },
  621. init: function init(e) {
  622. f.data(e, "velocity", {
  623. isSVG: m.isSVG(e),
  624. isAnimating: !1,
  625. computedStyle: null,
  626. tweensContainer: null,
  627. rootPropertyValueCache: {},
  628. transformCache: {}
  629. });
  630. },
  631. hook: null,
  632. mock: !1,
  633. version: {
  634. major: 1,
  635. minor: 2,
  636. patch: 2
  637. },
  638. debug: !1
  639. };
  640. 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");
  641. var x = function () {
  642. function e(e) {
  643. return -e.tension * e.x - e.friction * e.v;
  644. }
  645. function t(t, r, a) {
  646. var n = {
  647. x: t.x + a.dx * r,
  648. v: t.v + a.dv * r,
  649. tension: t.tension,
  650. friction: t.friction
  651. };
  652. return {
  653. dx: n.v,
  654. dv: e(n)
  655. };
  656. }
  657. function r(r, a) {
  658. var n = {
  659. dx: r.v,
  660. dv: e(r)
  661. },
  662. o = t(r, .5 * a, n),
  663. i = t(r, .5 * a, o),
  664. s = t(r, a, i),
  665. l = 1 / 6 * (n.dx + 2 * (o.dx + i.dx) + s.dx),
  666. u = 1 / 6 * (n.dv + 2 * (o.dv + i.dv) + s.dv);
  667. return r.x = r.x + l * a, r.v = r.v + u * a, r;
  668. }
  669. return function a(e, t, n) {
  670. var o,
  671. i,
  672. s,
  673. l = {
  674. x: -1,
  675. v: 0,
  676. tension: null,
  677. friction: null
  678. },
  679. u = [0],
  680. c = 0,
  681. p = 1e-4,
  682. f = .016;
  683. 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;) {}
  684. return o ? function (e) {
  685. return u[e * (u.length - 1) | 0];
  686. } : c;
  687. };
  688. }();
  689. b.Easings = {
  690. linear: function linear(e) {
  691. return e;
  692. },
  693. swing: function swing(e) {
  694. return .5 - Math.cos(e * Math.PI) / 2;
  695. },
  696. spring: function spring(e) {
  697. return 1 - Math.cos(4.5 * e * Math.PI) * Math.exp(6 * -e);
  698. }
  699. }, 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) {
  700. b.Easings[t[0]] = l.apply(null, t[1]);
  701. });
  702. var S = b.CSS = {
  703. RegEx: {
  704. isHex: /^#([A-f\d]{3}){1,2}$/i,
  705. valueUnwrap: /^[A-z]+\((.*)\)$/i,
  706. wrappedValueAlreadyExtracted: /[0-9.]+ [0-9.]+ [0-9.]+( [0-9.]+)?/,
  707. valueSplit: /([A-z]+\(.+\))|(([A-z0-9#-.]+?)(?=\s|$))/gi
  708. },
  709. Lists: {
  710. colors: ["fill", "stroke", "stopColor", "color", "backgroundColor", "borderColor", "borderTopColor", "borderRightColor", "borderBottomColor", "borderLeftColor", "outlineColor"],
  711. transformsBase: ["translateX", "translateY", "scale", "scaleX", "scaleY", "skewX", "skewY", "rotateZ"],
  712. transforms3D: ["transformPerspective", "translateZ", "scaleZ", "rotateX", "rotateY"]
  713. },
  714. Hooks: {
  715. templates: {
  716. textShadow: ["Color X Y Blur", "black 0px 0px 0px"],
  717. boxShadow: ["Color X Y Blur Spread", "black 0px 0px 0px 0px"],
  718. clip: ["Top Right Bottom Left", "0px 0px 0px 0px"],
  719. backgroundPosition: ["X Y", "0% 0%"],
  720. transformOrigin: ["X Y Z", "50% 50% 0px"],
  721. perspectiveOrigin: ["X Y", "50% 50%"]
  722. },
  723. registered: {},
  724. register: function register() {
  725. for (var e = 0; e < S.Lists.colors.length; e++) {
  726. var t = "color" === S.Lists.colors[e] ? "0 0 0 1" : "255 255 255 1";
  727. S.Hooks.templates[S.Lists.colors[e]] = ["Red Green Blue Alpha", t];
  728. }
  729. var r, a, n;
  730. if (d) for (r in S.Hooks.templates) {
  731. a = S.Hooks.templates[r], n = a[0].split(" ");
  732. var o = a[1].match(S.RegEx.valueSplit);
  733. "Color" === n[0] && (n.push(n.shift()), o.push(o.shift()), S.Hooks.templates[r] = [n.join(" "), o.join(" ")]);
  734. }
  735. for (r in S.Hooks.templates) {
  736. a = S.Hooks.templates[r], n = a[0].split(" ");
  737. for (var e in n) {
  738. var i = r + n[e],
  739. s = e;
  740. S.Hooks.registered[i] = [r, s];
  741. }
  742. }
  743. },
  744. getRoot: function getRoot(e) {
  745. var t = S.Hooks.registered[e];
  746. return t ? t[0] : e;
  747. },
  748. cleanRootPropertyValue: function cleanRootPropertyValue(e, t) {
  749. return S.RegEx.valueUnwrap.test(t) && (t = t.match(S.RegEx.valueUnwrap)[1]), S.Values.isCSSNullValue(t) && (t = S.Hooks.templates[e][1]), t;
  750. },
  751. extractValue: function extractValue(e, t) {
  752. var r = S.Hooks.registered[e];
  753. if (r) {
  754. var a = r[0],
  755. n = r[1];
  756. return t = S.Hooks.cleanRootPropertyValue(a, t), t.toString().match(S.RegEx.valueSplit)[n];
  757. }
  758. return t;
  759. },
  760. injectValue: function injectValue(e, t, r) {
  761. var a = S.Hooks.registered[e];
  762. if (a) {
  763. var n,
  764. o,
  765. i = a[0],
  766. s = a[1];
  767. return r = S.Hooks.cleanRootPropertyValue(i, r), n = r.toString().match(S.RegEx.valueSplit), n[s] = t, o = n.join(" ");
  768. }
  769. return r;
  770. }
  771. },
  772. Normalizations: {
  773. registered: {
  774. clip: function clip(e, t, r) {
  775. switch (e) {
  776. case "name":
  777. return "clip";
  778. case "extract":
  779. var a;
  780. return S.RegEx.wrappedValueAlreadyExtracted.test(r) ? a = r : (a = r.toString().match(S.RegEx.valueUnwrap), a = a ? a[1].replace(/,(\s+)?/g, " ") : r), a;
  781. case "inject":
  782. return "rect(" + r + ")";
  783. }
  784. },
  785. blur: function blur(e, t, r) {
  786. switch (e) {
  787. case "name":
  788. return b.State.isFirefox ? "filter" : "-webkit-filter";
  789. case "extract":
  790. var a = parseFloat(r);
  791. if (!a && 0 !== a) {
  792. var n = r.toString().match(/blur\(([0-9]+[A-z]+)\)/i);
  793. a = n ? n[1] : 0;
  794. }
  795. return a;
  796. case "inject":
  797. return parseFloat(r) ? "blur(" + r + ")" : "none";
  798. }
  799. },
  800. opacity: function opacity(e, t, r) {
  801. if (8 >= d) switch (e) {
  802. case "name":
  803. return "filter";
  804. case "extract":
  805. var a = r.toString().match(/alpha\(opacity=(.*)\)/i);
  806. return r = a ? a[1] / 100 : 1;
  807. case "inject":
  808. return t.style.zoom = 1, parseFloat(r) >= 1 ? "" : "alpha(opacity=" + parseInt(100 * parseFloat(r), 10) + ")";
  809. } else switch (e) {
  810. case "name":
  811. return "opacity";
  812. case "extract":
  813. return r;
  814. case "inject":
  815. return r;
  816. }
  817. }
  818. },
  819. register: function register() {
  820. 9 >= d || b.State.isGingerbread || (S.Lists.transformsBase = S.Lists.transformsBase.concat(S.Lists.transforms3D));
  821. for (var e = 0; e < S.Lists.transformsBase.length; e++) {
  822. !function () {
  823. var t = S.Lists.transformsBase[e];
  824. S.Normalizations.registered[t] = function (e, r, n) {
  825. switch (e) {
  826. case "name":
  827. return "transform";
  828. case "extract":
  829. return i(r) === a || i(r).transformCache[t] === a ? /^scale/i.test(t) ? 1 : 0 : i(r).transformCache[t].replace(/[()]/g, "");
  830. case "inject":
  831. var o = !1;
  832. switch (t.substr(0, t.length - 1)) {
  833. case "translate":
  834. o = !/(%|px|em|rem|vw|vh|\d)$/i.test(n);
  835. break;
  836. case "scal":
  837. case "scale":
  838. b.State.isAndroid && i(r).transformCache[t] === a && 1 > n && (n = 1), o = !/(\d)$/i.test(n);
  839. break;
  840. case "skew":
  841. o = !/(deg|\d)$/i.test(n);
  842. break;
  843. case "rotate":
  844. o = !/(deg|\d)$/i.test(n);
  845. }
  846. return o || (i(r).transformCache[t] = "(" + n + ")"), i(r).transformCache[t];
  847. }
  848. };
  849. }();
  850. }
  851. for (var e = 0; e < S.Lists.colors.length; e++) {
  852. !function () {
  853. var t = S.Lists.colors[e];
  854. S.Normalizations.registered[t] = function (e, r, n) {
  855. switch (e) {
  856. case "name":
  857. return t;
  858. case "extract":
  859. var o;
  860. if (S.RegEx.wrappedValueAlreadyExtracted.test(n)) o = n;else {
  861. var i,
  862. s = {
  863. black: "rgb(0, 0, 0)",
  864. blue: "rgb(0, 0, 255)",
  865. gray: "rgb(128, 128, 128)",
  866. green: "rgb(0, 128, 0)",
  867. red: "rgb(255, 0, 0)",
  868. white: "rgb(255, 255, 255)"
  869. };
  870. /^[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, " ");
  871. }
  872. return 8 >= d || 3 !== o.split(" ").length || (o += " 1"), o;
  873. case "inject":
  874. 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, "") + ")";
  875. }
  876. };
  877. }();
  878. }
  879. }
  880. },
  881. Names: {
  882. camelCase: function camelCase(e) {
  883. return e.replace(/-(\w)/g, function (e, t) {
  884. return t.toUpperCase();
  885. });
  886. },
  887. SVGAttribute: function SVGAttribute(e) {
  888. var t = "width|height|x|y|cx|cy|r|rx|ry|x1|x2|y1|y2";
  889. return (d || b.State.isAndroid && !b.State.isChrome) && (t += "|transform"), new RegExp("^(" + t + ")$", "i").test(e);
  890. },
  891. prefixCheck: function prefixCheck(e) {
  892. if (b.State.prefixMatches[e]) return [b.State.prefixMatches[e], !0];
  893. for (var t = ["", "Webkit", "Moz", "ms", "O"], r = 0, a = t.length; a > r; r++) {
  894. var n;
  895. if (n = 0 === r ? e : t[r] + e.replace(/^\w/, function (e) {
  896. return e.toUpperCase();
  897. }), m.isString(b.State.prefixElement.style[n])) return b.State.prefixMatches[e] = n, [n, !0];
  898. }
  899. return [e, !1];
  900. }
  901. },
  902. Values: {
  903. hexToRgb: function hexToRgb(e) {
  904. var t,
  905. r = /^#?([a-f\d])([a-f\d])([a-f\d])$/i,
  906. a = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i;
  907. return e = e.replace(r, function (e, t, r, a) {
  908. return t + t + r + r + a + a;
  909. }), t = a.exec(e), t ? [parseInt(t[1], 16), parseInt(t[2], 16), parseInt(t[3], 16)] : [0, 0, 0];
  910. },
  911. isCSSNullValue: function isCSSNullValue(e) {
  912. return 0 == e || /^(none|auto|transparent|(rgba\(0, ?0, ?0, ?0\)))$/i.test(e);
  913. },
  914. getUnitType: function getUnitType(e) {
  915. 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";
  916. },
  917. getDisplayType: function getDisplayType(e) {
  918. var t = e && e.tagName.toString().toLowerCase();
  919. 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";
  920. },
  921. addClass: function addClass(e, t) {
  922. e.classList ? e.classList.add(t) : e.className += (e.className.length ? " " : "") + t;
  923. },
  924. removeClass: function removeClass(e, t) {
  925. e.classList ? e.classList.remove(t) : e.className = e.className.toString().replace(new RegExp("(^|\\s)" + t.split(" ").join("|") + "(\\s|$)", "gi"), " ");
  926. }
  927. },
  928. getPropertyValue: function getPropertyValue(e, r, n, o) {
  929. function s(e, r) {
  930. function n() {
  931. u && S.setPropertyValue(e, "display", "none");
  932. }
  933. var l = 0;
  934. if (8 >= d) l = f.css(e, r);else {
  935. var u = !1;
  936. if (/^(width|height)$/.test(r) && 0 === S.getPropertyValue(e, "display") && (u = !0, S.setPropertyValue(e, "display", S.Values.getDisplayType(e))), !o) {
  937. if ("height" === r && "border-box" !== S.getPropertyValue(e, "boxSizing").toString().toLowerCase()) {
  938. 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);
  939. return n(), c;
  940. }
  941. if ("width" === r && "border-box" !== S.getPropertyValue(e, "boxSizing").toString().toLowerCase()) {
  942. 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);
  943. return n(), p;
  944. }
  945. }
  946. var g;
  947. 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();
  948. }
  949. if ("auto" === l && /^(top|right|bottom|left)$/i.test(r)) {
  950. var m = s(e, "position");
  951. ("fixed" === m || "absolute" === m && /top|left/i.test(r)) && (l = f(e).position()[r] + "px");
  952. }
  953. return l;
  954. }
  955. var l;
  956. if (S.Hooks.registered[r]) {
  957. var u = r,
  958. c = S.Hooks.getRoot(u);
  959. 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);
  960. } else if (S.Normalizations.registered[r]) {
  961. var p, g;
  962. 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);
  963. }
  964. if (!/^[\d-]/.test(l)) if (i(e) && i(e).isSVG && S.Names.SVGAttribute(r)) {
  965. if (/^(height|width)$/i.test(r)) try {
  966. l = e.getBBox()[r];
  967. } catch (m) {
  968. l = 0;
  969. } else l = e.getAttribute(r);
  970. } else l = s(e, S.Names.prefixCheck(r)[0]);
  971. return S.Values.isCSSNullValue(l) && (l = 0), b.debug >= 2 && console.log("Get " + r + ": " + l), l;
  972. },
  973. setPropertyValue: function setPropertyValue(e, r, a, n, o) {
  974. var s = r;
  975. 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 {
  976. if (S.Hooks.registered[r]) {
  977. var l = r,
  978. u = S.Hooks.getRoot(r);
  979. n = n || S.getPropertyValue(e, u), a = S.Hooks.injectValue(l, a, n), r = u;
  980. }
  981. 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 {
  982. e.style[s] = a;
  983. } catch (c) {
  984. b.debug && console.log("Browser does not support [" + a + "] for [" + s + "]");
  985. } else i(e) && i(e).isSVG && S.Names.SVGAttribute(r) ? e.setAttribute(r, a) : e.style[s] = a;
  986. b.debug >= 2 && console.log("Set " + r + " (" + s + "): " + a);
  987. }
  988. return [s, a];
  989. },
  990. flushTransformCache: function flushTransformCache(e) {
  991. function t(t) {
  992. return parseFloat(S.getPropertyValue(e, t));
  993. }
  994. var r = "";
  995. if ((d || b.State.isAndroid && !b.State.isChrome) && i(e).isSVG) {
  996. var a = {
  997. translate: [t("translateX"), t("translateY")],
  998. skewX: [t("skewX")],
  999. skewY: [t("skewY")],
  1000. scale: 1 !== t("scale") ? [t("scale"), t("scale")] : [t("scaleX"), t("scaleY")],
  1001. rotate: [t("rotateZ"), 0, 0]
  1002. };
  1003. f.each(i(e).transformCache, function (e) {
  1004. /^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]);
  1005. });
  1006. } else {
  1007. var n, o;
  1008. f.each(i(e).transformCache, function (t) {
  1009. return n = i(e).transformCache[t], "transformPerspective" === t ? (o = n, !0) : (9 === d && "rotateZ" === t && (t = "rotate"), void (r += t + n + " "));
  1010. }), o && (r = "perspective" + o + " " + r);
  1011. }
  1012. S.setPropertyValue(e, "transform", r);
  1013. }
  1014. };
  1015. S.Hooks.register(), S.Normalizations.register(), b.hook = function (e, t, r) {
  1016. var n = a;
  1017. return e = o(e), f.each(e, function (e, o) {
  1018. if (i(o) === a && b.init(o), r === a) n === a && (n = b.CSS.getPropertyValue(o, t));else {
  1019. var s = b.CSS.setPropertyValue(o, t, r);
  1020. "transform" === s[0] && b.CSS.flushTransformCache(o), n = s;
  1021. }
  1022. }), n;
  1023. };
  1024. var P = function P() {
  1025. function e() {
  1026. return s ? k.promise || null : l;
  1027. }
  1028. function n() {
  1029. function e(e) {
  1030. function p(e, t) {
  1031. var r = a,
  1032. n = a,
  1033. i = a;
  1034. 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];
  1035. }
  1036. function d(e, t) {
  1037. var r, a;
  1038. return a = (t || "0").toString().toLowerCase().replace(/[%A-z]+$/, function (e) {
  1039. return r = e, "";
  1040. }), r || (r = S.Values.getUnitType(e)), [a, r];
  1041. }
  1042. function h() {
  1043. var e = {
  1044. myParent: o.parentNode || r.body,
  1045. position: S.getPropertyValue(o, "position"),
  1046. fontSize: S.getPropertyValue(o, "fontSize")
  1047. },
  1048. a = e.position === L.lastPosition && e.myParent === L.lastParent,
  1049. n = e.fontSize === L.lastFontSize;
  1050. L.lastParent = e.myParent, L.lastPosition = e.position, L.lastFontSize = e.fontSize;
  1051. var s = 100,
  1052. l = {};
  1053. if (n && a) l.emToPx = L.lastEmToPx, l.percentToPxWidth = L.lastPercentToPxWidth, l.percentToPxHeight = L.lastPercentToPxHeight;else {
  1054. var u = i(o).isSVG ? r.createElementNS("http://www.w3.org/2000/svg", "rect") : r.createElement("div");
  1055. b.init(u), e.myParent.appendChild(u), f.each(["overflow", "overflowX", "overflowY"], function (e, t) {
  1056. b.CSS.setPropertyValue(u, t, "hidden");
  1057. }), 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) {
  1058. b.CSS.setPropertyValue(u, t, s + "%");
  1059. }), 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);
  1060. }
  1061. 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;
  1062. }
  1063. if (s.begin && 0 === V) try {
  1064. s.begin.call(g, g);
  1065. } catch (x) {
  1066. setTimeout(function () {
  1067. throw x;
  1068. }, 1);
  1069. }
  1070. if ("scroll" === A) {
  1071. var P,
  1072. C,
  1073. T,
  1074. F = /^x$/i.test(s.axis) ? "Left" : "Top",
  1075. j = parseFloat(s.offset) || 0;
  1076. 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 = {
  1077. scroll: {
  1078. rootPropertyValue: !1,
  1079. startValue: P,
  1080. currentValue: P,
  1081. endValue: T,
  1082. unitType: "",
  1083. easing: s.easing,
  1084. scrollData: {
  1085. container: s.container,
  1086. direction: F,
  1087. alternateValue: C
  1088. }
  1089. },
  1090. element: o
  1091. }, b.debug && console.log("tweensContainer (scroll): ", l.scroll, o);
  1092. } else if ("reverse" === A) {
  1093. if (!i(o).tweensContainer) return void f.dequeue(o, s.queue);
  1094. "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);
  1095. var E = f.extend(!0, {}, i(o).tweensContainer);
  1096. for (var H in E) {
  1097. if ("element" !== H) {
  1098. var N = E[H].startValue;
  1099. 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);
  1100. }
  1101. }
  1102. l = E;
  1103. } else if ("start" === A) {
  1104. var E;
  1105. i(o).tweensContainer && i(o).isAnimating === !0 && (E = i(o).tweensContainer), f.each(y, function (e, t) {
  1106. if (RegExp("^" + S.Lists.colors.join("$|^") + "$").test(e)) {
  1107. var r = p(t, !0),
  1108. n = r[0],
  1109. o = r[1],
  1110. i = r[2];
  1111. if (S.RegEx.isHex.test(n)) {
  1112. for (var s = ["Red", "Green", "Blue"], l = S.Values.hexToRgb(n), u = i ? S.Values.hexToRgb(i) : a, c = 0; c < s.length; c++) {
  1113. var f = [l[c]];
  1114. o && f.push(o), u !== a && f.push(u[c]), y[e + s[c]] = f;
  1115. }
  1116. delete y[e];
  1117. }
  1118. }
  1119. });
  1120. for (var z in y) {
  1121. var O = p(y[z]),
  1122. q = O[0],
  1123. $ = O[1],
  1124. M = O[2];
  1125. z = S.Names.camelCase(z);
  1126. var I = S.Hooks.getRoot(z),
  1127. B = !1;
  1128. if (i(o).isSVG || "tween" === I || S.Names.prefixCheck(I)[1] !== !1 || S.Normalizations.registered[I] !== a) {
  1129. (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));
  1130. var W,
  1131. G,
  1132. Y,
  1133. D = !1;
  1134. if (W = d(z, M), M = W[0], Y = W[1], W = d(z, q), q = W[0].replace(/^([+-\/*])=/, function (e, t) {
  1135. return D = t, "";
  1136. }), 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 {
  1137. n = n || h();
  1138. var Q = /margin|padding|left|right|width|text|word|letter/i.test(z) || /X$/.test(z) || "x" === z ? "x" : "y";
  1139. switch (Y) {
  1140. case "%":
  1141. M *= "x" === Q ? n.percentToPxWidth : n.percentToPxHeight;
  1142. break;
  1143. case "px":
  1144. break;
  1145. default:
  1146. M *= n[Y + "ToPx"];
  1147. }
  1148. switch (G) {
  1149. case "%":
  1150. M *= 1 / ("x" === Q ? n.percentToPxWidth : n.percentToPxHeight);
  1151. break;
  1152. case "px":
  1153. break;
  1154. default:
  1155. M *= 1 / n[G + "ToPx"];
  1156. }
  1157. }
  1158. switch (D) {
  1159. case "+":
  1160. q = M + q;
  1161. break;
  1162. case "-":
  1163. q = M - q;
  1164. break;
  1165. case "*":
  1166. q = M * q;
  1167. break;
  1168. case "/":
  1169. q = M / q;
  1170. }
  1171. l[z] = {
  1172. rootPropertyValue: B,
  1173. startValue: M,
  1174. currentValue: M,
  1175. endValue: q,
  1176. unitType: G,
  1177. easing: $
  1178. }, b.debug && console.log("tweensContainer (" + z + "): " + JSON.stringify(l[z]), o);
  1179. } else b.debug && console.log("Skipping [" + I + "] due to a lack of browser support.");
  1180. }
  1181. l.element = o;
  1182. }
  1183. 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++);
  1184. }
  1185. var n,
  1186. o = this,
  1187. s = f.extend({}, b.defaults, v),
  1188. l = {};
  1189. switch (i(o) === a && b.init(o), parseFloat(s.delay) && s.queue !== !1 && f.queue(o, s.queue, function (e) {
  1190. b.velocityQueueEntryFlag = !0, i(o).delayTimer = {
  1191. setTimeout: setTimeout(e, parseFloat(s.delay)),
  1192. next: e
  1193. };
  1194. }), s.duration.toString().toLowerCase()) {
  1195. case "fast":
  1196. s.duration = 200;
  1197. break;
  1198. case "normal":
  1199. s.duration = h;
  1200. break;
  1201. case "slow":
  1202. s.duration = 600;
  1203. break;
  1204. default:
  1205. s.duration = parseFloat(s.duration) || 1;
  1206. }
  1207. 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) {
  1208. return r === !0 ? (k.promise && k.resolver(g), !0) : (b.velocityQueueEntryFlag = !0, void e(t));
  1209. }), "" !== s.queue && "fx" !== s.queue || "inprogress" === f.queue(o)[0] || f.dequeue(o);
  1210. }
  1211. var s,
  1212. l,
  1213. d,
  1214. g,
  1215. y,
  1216. v,
  1217. x = arguments[0] && (arguments[0].p || f.isPlainObject(arguments[0].properties) && !arguments[0].properties.names || m.isString(arguments[0].properties));
  1218. 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)) {
  1219. x ? (y = arguments[0].properties || arguments[0].p, v = arguments[0].options || arguments[0].o) : (y = arguments[d], v = arguments[d + 1]);
  1220. var w = g.length,
  1221. V = 0;
  1222. if (!/^(stop|finish)$/i.test(y) && !f.isPlainObject(v)) {
  1223. var C = d + 1;
  1224. v = {};
  1225. for (var T = C; T < arguments.length; T++) {
  1226. 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];
  1227. }
  1228. }
  1229. var k = {
  1230. promise: null,
  1231. resolver: null,
  1232. rejecter: null
  1233. };
  1234. s && b.Promise && (k.promise = new b.Promise(function (e, t) {
  1235. k.resolver = e, k.rejecter = t;
  1236. }));
  1237. var A;
  1238. switch (y) {
  1239. case "scroll":
  1240. A = "scroll";
  1241. break;
  1242. case "reverse":
  1243. A = "reverse";
  1244. break;
  1245. case "finish":
  1246. case "stop":
  1247. f.each(g, function (e, t) {
  1248. i(t) && i(t).delayTimer && (clearTimeout(i(t).delayTimer.setTimeout), i(t).delayTimer.next && i(t).delayTimer.next(), delete i(t).delayTimer);
  1249. });
  1250. var F = [];
  1251. return f.each(b.State.calls, function (e, t) {
  1252. t && f.each(t[1], function (r, n) {
  1253. var o = v === a ? "" : v;
  1254. return o === !0 || t[2].queue === o || v === a && t[2].queue === !1 ? void f.each(g, function (r, a) {
  1255. a === n && ((v === !0 || m.isString(v)) && (f.each(f.queue(a, m.isString(v) ? v : ""), function (e, t) {
  1256. m.isFunction(t) && t(null, !0);
  1257. }), f.queue(a, m.isString(v) ? v : "", [])), "stop" === y ? (i(a) && i(a).tweensContainer && o !== !1 && f.each(i(a).tweensContainer, function (e, t) {
  1258. t.endValue = t.currentValue;
  1259. }), F.push(e)) : "finish" === y && (t[2].duration = 1));
  1260. }) : !0;
  1261. });
  1262. }), "stop" === y && (f.each(F, function (e, t) {
  1263. p(t, !0);
  1264. }), k.promise && k.resolver(g)), e();
  1265. default:
  1266. if (!f.isPlainObject(y) || m.isEmptyObject(y)) {
  1267. if (m.isString(y) && b.Redirects[y]) {
  1268. var j = f.extend({}, v),
  1269. E = j.duration,
  1270. H = j.delay || 0;
  1271. return j.backwards === !0 && (g = f.extend(!0, [], g).reverse()), f.each(g, function (e, t) {
  1272. 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);
  1273. }), e();
  1274. }
  1275. var N = "Velocity: First argument (" + y + ") was not a property map, a known action, or a registered redirect. Aborting.";
  1276. return k.promise ? k.rejecter(new Error(N)) : console.log(N), e();
  1277. }
  1278. A = "start";
  1279. }
  1280. var L = {
  1281. lastParent: null,
  1282. lastPosition: null,
  1283. lastFontSize: null,
  1284. lastPercentToPxWidth: null,
  1285. lastPercentToPxHeight: null,
  1286. lastEmToPx: null,
  1287. remToPx: null,
  1288. vwToPx: null,
  1289. vhToPx: null
  1290. },
  1291. R = [];
  1292. f.each(g, function (e, t) {
  1293. m.isNode(t) && n.call(t);
  1294. });
  1295. var z,
  1296. j = f.extend({}, b.defaults, v);
  1297. if (j.loop = parseInt(j.loop), z = 2 * j.loop - 1, j.loop) for (var O = 0; z > O; O++) {
  1298. var q = {
  1299. delay: j.delay,
  1300. progress: j.progress
  1301. };
  1302. O === z - 1 && (q.display = j.display, q.visibility = j.visibility, q.complete = j.complete), P(g, "reverse", q);
  1303. }
  1304. return e();
  1305. }
  1306. };
  1307. b = f.extend(P, b), b.animate = P;
  1308. var w = t.requestAnimationFrame || g;
  1309. return b.State.isMobile || r.hidden === a || r.addEventListener("visibilitychange", function () {
  1310. r.hidden ? (w = function w(e) {
  1311. return setTimeout(function () {
  1312. e(!0);
  1313. }, 16);
  1314. }, c()) : w = t.requestAnimationFrame || g;
  1315. }), e.Velocity = b, e !== t && (e.fn.velocity = P, e.fn.velocity.defaults = b.defaults), f.each(["Down", "Up"], function (e, t) {
  1316. b.Redirects["slide" + t] = function (e, r, n, o, i, s) {
  1317. var l = f.extend({}, r),
  1318. u = l.begin,
  1319. c = l.complete,
  1320. p = {
  1321. height: "",
  1322. marginTop: "",
  1323. marginBottom: "",
  1324. paddingTop: "",
  1325. paddingBottom: ""
  1326. },
  1327. d = {};
  1328. l.display === a && (l.display = "Down" === t ? "inline" === b.CSS.Values.getDisplayType(e) ? "inline-block" : "block" : "none"), l.begin = function () {
  1329. u && u.call(i, i);
  1330. for (var r in p) {
  1331. d[r] = e.style[r];
  1332. var a = b.CSS.getPropertyValue(e, r);
  1333. p[r] = "Down" === t ? [a, 0] : [0, a];
  1334. }
  1335. d.overflow = e.style.overflow, e.style.overflow = "hidden";
  1336. }, l.complete = function () {
  1337. for (var t in d) {
  1338. e.style[t] = d[t];
  1339. }
  1340. c && c.call(i, i), s && s.resolver(i);
  1341. }, b(e, p, l);
  1342. };
  1343. }), f.each(["In", "Out"], function (e, t) {
  1344. b.Redirects["fade" + t] = function (e, r, n, o, i, s) {
  1345. var l = f.extend({}, r),
  1346. u = {
  1347. opacity: "In" === t ? 1 : 0
  1348. },
  1349. c = l.complete;
  1350. l.complete = n !== o - 1 ? l.begin = null : function () {
  1351. c && c.call(i, i), s && s.resolver(i);
  1352. }, l.display === a && (l.display = "In" === t ? "auto" : "none"), b(this, u, l);
  1353. };
  1354. }), b;
  1355. }(window.jQuery || window.Zepto || window, window, document);
  1356. }));
  1357. ;
  1358. !function (a, b, c, d) {
  1359. "use strict";
  1360. function k(a, b, c) {
  1361. return setTimeout(q(a, c), b);
  1362. }
  1363. function l(a, b, c) {
  1364. return Array.isArray(a) ? (m(a, c[b], c), !0) : !1;
  1365. }
  1366. function m(a, b, c) {
  1367. var e;
  1368. if (a) if (a.forEach) a.forEach(b, c);else if (a.length !== d) for (e = 0; e < a.length;) {
  1369. b.call(c, a[e], e, a), e++;
  1370. } else for (e in a) {
  1371. a.hasOwnProperty(e) && b.call(c, a[e], e, a);
  1372. }
  1373. }
  1374. function n(a, b, c) {
  1375. for (var e = Object.keys(b), f = 0; f < e.length;) {
  1376. (!c || c && a[e[f]] === d) && (a[e[f]] = b[e[f]]), f++;
  1377. }
  1378. return a;
  1379. }
  1380. function o(a, b) {
  1381. return n(a, b, !0);
  1382. }
  1383. function p(a, b, c) {
  1384. var e,
  1385. d = b.prototype;
  1386. e = a.prototype = Object.create(d), e.constructor = a, e._super = d, c && n(e, c);
  1387. }
  1388. function q(a, b) {
  1389. return function () {
  1390. return a.apply(b, arguments);
  1391. };
  1392. }
  1393. function r(a, b) {
  1394. return _typeof(a) == g ? a.apply(b ? b[0] || d : d, b) : a;
  1395. }
  1396. function s(a, b) {
  1397. return a === d ? b : a;
  1398. }
  1399. function t(a, b, c) {
  1400. m(x(b), function (b) {
  1401. a.addEventListener(b, c, !1);
  1402. });
  1403. }
  1404. function u(a, b, c) {
  1405. m(x(b), function (b) {
  1406. a.removeEventListener(b, c, !1);
  1407. });
  1408. }
  1409. function v(a, b) {
  1410. for (; a;) {
  1411. if (a == b) return !0;
  1412. a = a.parentNode;
  1413. }
  1414. return !1;
  1415. }
  1416. function w(a, b) {
  1417. return a.indexOf(b) > -1;
  1418. }
  1419. function x(a) {
  1420. return a.trim().split(/\s+/g);
  1421. }
  1422. function y(a, b, c) {
  1423. if (a.indexOf && !c) return a.indexOf(b);
  1424. for (var d = 0; d < a.length;) {
  1425. if (c && a[d][c] == b || !c && a[d] === b) return d;
  1426. d++;
  1427. }
  1428. return -1;
  1429. }
  1430. function z(a) {
  1431. return Array.prototype.slice.call(a, 0);
  1432. }
  1433. function A(a, b, c) {
  1434. for (var d = [], e = [], f = 0; f < a.length;) {
  1435. var g = b ? a[f][b] : a[f];
  1436. y(e, g) < 0 && d.push(a[f]), e[f] = g, f++;
  1437. }
  1438. return c && (d = b ? d.sort(function (a, c) {
  1439. return a[b] > c[b];
  1440. }) : d.sort()), d;
  1441. }
  1442. function B(a, b) {
  1443. for (var c, f, g = b[0].toUpperCase() + b.slice(1), h = 0; h < e.length;) {
  1444. if (c = e[h], f = c ? c + g : b, f in a) return f;
  1445. h++;
  1446. }
  1447. return d;
  1448. }
  1449. function D() {
  1450. return C++;
  1451. }
  1452. function E(a) {
  1453. var b = a.ownerDocument;
  1454. return b.defaultView || b.parentWindow;
  1455. }
  1456. function ab(a, b) {
  1457. var c = this;
  1458. this.manager = a, this.callback = b, this.element = a.element, this.target = a.options.inputTarget, this.domHandler = function (b) {
  1459. r(a.options.enable, [a]) && c.handler(b);
  1460. }, this.init();
  1461. }
  1462. function bb(a) {
  1463. var b,
  1464. c = a.options.inputClass;
  1465. return b = c ? c : H ? wb : I ? Eb : G ? Gb : rb, new b(a, cb);
  1466. }
  1467. function cb(a, b, c) {
  1468. var d = c.pointers.length,
  1469. e = c.changedPointers.length,
  1470. f = b & O && 0 === d - e,
  1471. g = b & (Q | R) && 0 === d - e;
  1472. 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;
  1473. }
  1474. function db(a, b) {
  1475. var c = a.session,
  1476. d = b.pointers,
  1477. e = d.length;
  1478. c.firstInput || (c.firstInput = gb(b)), e > 1 && !c.firstMultiple ? c.firstMultiple = gb(b) : 1 === e && (c.firstMultiple = !1);
  1479. var f = c.firstInput,
  1480. g = c.firstMultiple,
  1481. h = g ? g.center : f.center,
  1482. i = b.center = hb(d);
  1483. 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);
  1484. var k = a.element;
  1485. v(b.srcEvent.target, k) && (k = b.srcEvent.target), b.target = k;
  1486. }
  1487. function eb(a, b) {
  1488. var c = b.center,
  1489. d = a.offsetDelta || {},
  1490. e = a.prevDelta || {},
  1491. f = a.prevInput || {};
  1492. (b.eventType === O || f.eventType === Q) && (e = a.prevDelta = {
  1493. x: f.deltaX || 0,
  1494. y: f.deltaY || 0
  1495. }, d = a.offsetDelta = {
  1496. x: c.x,
  1497. y: c.y
  1498. }), b.deltaX = e.x + (c.x - d.x), b.deltaY = e.y + (c.y - d.y);
  1499. }
  1500. function fb(a, b) {
  1501. var f,
  1502. g,
  1503. h,
  1504. j,
  1505. c = a.lastInterval || b,
  1506. e = b.timeStamp - c.timeStamp;
  1507. if (b.eventType != R && (e > N || c.velocity === d)) {
  1508. var k = c.deltaX - b.deltaX,
  1509. l = c.deltaY - b.deltaY,
  1510. m = ib(e, k, l);
  1511. g = m.x, h = m.y, f = i(m.x) > i(m.y) ? m.x : m.y, j = jb(k, l), a.lastInterval = b;
  1512. } else f = c.velocity, g = c.velocityX, h = c.velocityY, j = c.direction;
  1513. b.velocity = f, b.velocityX = g, b.velocityY = h, b.direction = j;
  1514. }
  1515. function gb(a) {
  1516. for (var b = [], c = 0; c < a.pointers.length;) {
  1517. b[c] = {
  1518. clientX: h(a.pointers[c].clientX),
  1519. clientY: h(a.pointers[c].clientY)
  1520. }, c++;
  1521. }
  1522. return {
  1523. timeStamp: j(),
  1524. pointers: b,
  1525. center: hb(b),
  1526. deltaX: a.deltaX,
  1527. deltaY: a.deltaY
  1528. };
  1529. }
  1530. function hb(a) {
  1531. var b = a.length;
  1532. if (1 === b) return {
  1533. x: h(a[0].clientX),
  1534. y: h(a[0].clientY)
  1535. };
  1536. for (var c = 0, d = 0, e = 0; b > e;) {
  1537. c += a[e].clientX, d += a[e].clientY, e++;
  1538. }
  1539. return {
  1540. x: h(c / b),
  1541. y: h(d / b)
  1542. };
  1543. }
  1544. function ib(a, b, c) {
  1545. return {
  1546. x: b / a || 0,
  1547. y: c / a || 0
  1548. };
  1549. }
  1550. function jb(a, b) {
  1551. return a === b ? S : i(a) >= i(b) ? a > 0 ? T : U : b > 0 ? V : W;
  1552. }
  1553. function kb(a, b, c) {
  1554. c || (c = $);
  1555. var d = b[c[0]] - a[c[0]],
  1556. e = b[c[1]] - a[c[1]];
  1557. return Math.sqrt(d * d + e * e);
  1558. }
  1559. function lb(a, b, c) {
  1560. c || (c = $);
  1561. var d = b[c[0]] - a[c[0]],
  1562. e = b[c[1]] - a[c[1]];
  1563. return 180 * Math.atan2(e, d) / Math.PI;
  1564. }
  1565. function mb(a, b) {
  1566. return lb(b[1], b[0], _) - lb(a[1], a[0], _);
  1567. }
  1568. function nb(a, b) {
  1569. return kb(b[0], b[1], _) / kb(a[0], a[1], _);
  1570. }
  1571. function rb() {
  1572. this.evEl = pb, this.evWin = qb, this.allow = !0, this.pressed = !1, ab.apply(this, arguments);
  1573. }
  1574. function wb() {
  1575. this.evEl = ub, this.evWin = vb, ab.apply(this, arguments), this.store = this.manager.session.pointerEvents = [];
  1576. }
  1577. function Ab() {
  1578. this.evTarget = yb, this.evWin = zb, this.started = !1, ab.apply(this, arguments);
  1579. }
  1580. function Bb(a, b) {
  1581. var c = z(a.touches),
  1582. d = z(a.changedTouches);
  1583. return b & (Q | R) && (c = A(c.concat(d), "identifier", !0)), [c, d];
  1584. }
  1585. function Eb() {
  1586. this.evTarget = Db, this.targetIds = {}, ab.apply(this, arguments);
  1587. }
  1588. function Fb(a, b) {
  1589. var c = z(a.touches),
  1590. d = this.targetIds;
  1591. if (b & (O | P) && 1 === c.length) return d[c[0].identifier] = !0, [c, c];
  1592. var e,
  1593. f,
  1594. g = z(a.changedTouches),
  1595. h = [],
  1596. i = this.target;
  1597. if (f = c.filter(function (a) {
  1598. return v(a.target, i);
  1599. }), b === O) for (e = 0; e < f.length;) {
  1600. d[f[e].identifier] = !0, e++;
  1601. }
  1602. for (e = 0; e < g.length;) {
  1603. d[g[e].identifier] && h.push(g[e]), b & (Q | R) && delete d[g[e].identifier], e++;
  1604. }
  1605. return h.length ? [A(f.concat(h), "identifier", !0), h] : void 0;
  1606. }
  1607. function Gb() {
  1608. ab.apply(this, arguments);
  1609. var a = q(this.handler, this);
  1610. this.touch = new Eb(this.manager, a), this.mouse = new rb(this.manager, a);
  1611. }
  1612. function Pb(a, b) {
  1613. this.manager = a, this.set(b);
  1614. }
  1615. function Qb(a) {
  1616. if (w(a, Mb)) return Mb;
  1617. var b = w(a, Nb),
  1618. c = w(a, Ob);
  1619. return b && c ? Nb + " " + Ob : b || c ? b ? Nb : Ob : w(a, Lb) ? Lb : Kb;
  1620. }
  1621. function Yb(a) {
  1622. 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 = [];
  1623. }
  1624. function Zb(a) {
  1625. return a & Wb ? "cancel" : a & Ub ? "end" : a & Tb ? "move" : a & Sb ? "start" : "";
  1626. }
  1627. function $b(a) {
  1628. return a == W ? "down" : a == V ? "up" : a == T ? "left" : a == U ? "right" : "";
  1629. }
  1630. function _b(a, b) {
  1631. var c = b.manager;
  1632. return c ? c.get(a) : a;
  1633. }
  1634. function ac() {
  1635. Yb.apply(this, arguments);
  1636. }
  1637. function bc() {
  1638. ac.apply(this, arguments), this.pX = null, this.pY = null;
  1639. }
  1640. function cc() {
  1641. ac.apply(this, arguments);
  1642. }
  1643. function dc() {
  1644. Yb.apply(this, arguments), this._timer = null, this._input = null;
  1645. }
  1646. function ec() {
  1647. ac.apply(this, arguments);
  1648. }
  1649. function fc() {
  1650. ac.apply(this, arguments);
  1651. }
  1652. function gc() {
  1653. Yb.apply(this, arguments), this.pTime = !1, this.pCenter = !1, this._timer = null, this._input = null, this.count = 0;
  1654. }
  1655. function hc(a, b) {
  1656. return b = b || {}, b.recognizers = s(b.recognizers, hc.defaults.preset), new kc(a, b);
  1657. }
  1658. function kc(a, b) {
  1659. 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) {
  1660. var b = this.add(new a[0](a[1]));
  1661. a[2] && b.recognizeWith(a[2]), a[3] && b.requireFailure(a[3]);
  1662. }, this);
  1663. }
  1664. function lc(a, b) {
  1665. var c = a.element;
  1666. m(a.options.cssProps, function (a, d) {
  1667. c.style[B(c.style, d)] = b ? a : "";
  1668. });
  1669. }
  1670. function mc(a, c) {
  1671. var d = b.createEvent("Event");
  1672. d.initEvent(a, !0, !0), d.gesture = c, c.target.dispatchEvent(d);
  1673. }
  1674. var e = ["", "webkit", "moz", "MS", "ms", "o"],
  1675. f = b.createElement("div"),
  1676. g = "function",
  1677. h = Math.round,
  1678. i = Math.abs,
  1679. j = Date.now,
  1680. C = 1,
  1681. F = /mobile|tablet|ip(ad|hone|od)|android/i,
  1682. G = "ontouchstart" in a,
  1683. H = B(a, "PointerEvent") !== d,
  1684. I = G && F.test(navigator.userAgent),
  1685. J = "touch",
  1686. K = "pen",
  1687. L = "mouse",
  1688. M = "kinect",
  1689. N = 25,
  1690. O = 1,
  1691. P = 2,
  1692. Q = 4,
  1693. R = 8,
  1694. S = 1,
  1695. T = 2,
  1696. U = 4,
  1697. V = 8,
  1698. W = 16,
  1699. X = T | U,
  1700. Y = V | W,
  1701. Z = X | Y,
  1702. $ = ["x", "y"],
  1703. _ = ["clientX", "clientY"];
  1704. ab.prototype = {
  1705. handler: function handler() {},
  1706. init: function init() {
  1707. 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);
  1708. },
  1709. destroy: function destroy() {
  1710. 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);
  1711. }
  1712. };
  1713. var ob = {
  1714. mousedown: O,
  1715. mousemove: P,
  1716. mouseup: Q
  1717. },
  1718. pb = "mousedown",
  1719. qb = "mousemove mouseup";
  1720. p(rb, ab, {
  1721. handler: function handler(a) {
  1722. var b = ob[a.type];
  1723. 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, {
  1724. pointers: [a],
  1725. changedPointers: [a],
  1726. pointerType: L,
  1727. srcEvent: a
  1728. }));
  1729. }
  1730. });
  1731. var sb = {
  1732. pointerdown: O,
  1733. pointermove: P,
  1734. pointerup: Q,
  1735. pointercancel: R,
  1736. pointerout: R
  1737. },
  1738. tb = {
  1739. 2: J,
  1740. 3: K,
  1741. 4: L,
  1742. 5: M
  1743. },
  1744. ub = "pointerdown",
  1745. vb = "pointermove pointerup pointercancel";
  1746. a.MSPointerEvent && (ub = "MSPointerDown", vb = "MSPointerMove MSPointerUp MSPointerCancel"), p(wb, ab, {
  1747. handler: function handler(a) {
  1748. var b = this.store,
  1749. c = !1,
  1750. d = a.type.toLowerCase().replace("ms", ""),
  1751. e = sb[d],
  1752. f = tb[a.pointerType] || a.pointerType,
  1753. g = f == J,
  1754. h = y(b, a.pointerId, "pointerId");
  1755. 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, {
  1756. pointers: b,
  1757. changedPointers: [a],
  1758. pointerType: f,
  1759. srcEvent: a
  1760. }), c && b.splice(h, 1));
  1761. }
  1762. });
  1763. var xb = {
  1764. touchstart: O,
  1765. touchmove: P,
  1766. touchend: Q,
  1767. touchcancel: R
  1768. },
  1769. yb = "touchstart",
  1770. zb = "touchstart touchmove touchend touchcancel";
  1771. p(Ab, ab, {
  1772. handler: function handler(a) {
  1773. var b = xb[a.type];
  1774. if (b === O && (this.started = !0), this.started) {
  1775. var c = Bb.call(this, a, b);
  1776. b & (Q | R) && 0 === c[0].length - c[1].length && (this.started = !1), this.callback(this.manager, b, {
  1777. pointers: c[0],
  1778. changedPointers: c[1],
  1779. pointerType: J,
  1780. srcEvent: a
  1781. });
  1782. }
  1783. }
  1784. });
  1785. var Cb = {
  1786. touchstart: O,
  1787. touchmove: P,
  1788. touchend: Q,
  1789. touchcancel: R
  1790. },
  1791. Db = "touchstart touchmove touchend touchcancel";
  1792. p(Eb, ab, {
  1793. handler: function handler(a) {
  1794. var b = Cb[a.type],
  1795. c = Fb.call(this, a, b);
  1796. c && this.callback(this.manager, b, {
  1797. pointers: c[0],
  1798. changedPointers: c[1],
  1799. pointerType: J,
  1800. srcEvent: a
  1801. });
  1802. }
  1803. }), p(Gb, ab, {
  1804. handler: function handler(a, b, c) {
  1805. var d = c.pointerType == J,
  1806. e = c.pointerType == L;
  1807. if (d) this.mouse.allow = !1;else if (e && !this.mouse.allow) return;
  1808. b & (Q | R) && (this.mouse.allow = !0), this.callback(a, b, c);
  1809. },
  1810. destroy: function destroy() {
  1811. this.touch.destroy(), this.mouse.destroy();
  1812. }
  1813. });
  1814. var Hb = B(f.style, "touchAction"),
  1815. Ib = Hb !== d,
  1816. Jb = "compute",
  1817. Kb = "auto",
  1818. Lb = "manipulation",
  1819. Mb = "none",
  1820. Nb = "pan-x",
  1821. Ob = "pan-y";
  1822. Pb.prototype = {
  1823. set: function set(a) {
  1824. a == Jb && (a = this.compute()), Ib && (this.manager.element.style[Hb] = a), this.actions = a.toLowerCase().trim();
  1825. },
  1826. update: function update() {
  1827. this.set(this.manager.options.touchAction);
  1828. },
  1829. compute: function compute() {
  1830. var a = [];
  1831. return m(this.manager.recognizers, function (b) {
  1832. r(b.options.enable, [b]) && (a = a.concat(b.getTouchAction()));
  1833. }), Qb(a.join(" "));
  1834. },
  1835. preventDefaults: function preventDefaults(a) {
  1836. if (!Ib) {
  1837. var b = a.srcEvent,
  1838. c = a.offsetDirection;
  1839. if (this.manager.session.prevented) return b.preventDefault(), void 0;
  1840. var d = this.actions,
  1841. e = w(d, Mb),
  1842. f = w(d, Ob),
  1843. g = w(d, Nb);
  1844. return e || f && c & X || g && c & Y ? this.preventSrc(b) : void 0;
  1845. }
  1846. },
  1847. preventSrc: function preventSrc(a) {
  1848. this.manager.session.prevented = !0, a.preventDefault();
  1849. }
  1850. };
  1851. var Rb = 1,
  1852. Sb = 2,
  1853. Tb = 4,
  1854. Ub = 8,
  1855. Vb = Ub,
  1856. Wb = 16,
  1857. Xb = 32;
  1858. Yb.prototype = {
  1859. defaults: {},
  1860. set: function set(a) {
  1861. return n(this.options, a), this.manager && this.manager.touchAction.update(), this;
  1862. },
  1863. recognizeWith: function recognizeWith(a) {
  1864. if (l(a, "recognizeWith", this)) return this;
  1865. var b = this.simultaneous;
  1866. return a = _b(a, this), b[a.id] || (b[a.id] = a, a.recognizeWith(this)), this;
  1867. },
  1868. dropRecognizeWith: function dropRecognizeWith(a) {
  1869. return l(a, "dropRecognizeWith", this) ? this : (a = _b(a, this), delete this.simultaneous[a.id], this);
  1870. },
  1871. requireFailure: function requireFailure(a) {
  1872. if (l(a, "requireFailure", this)) return this;
  1873. var b = this.requireFail;
  1874. return a = _b(a, this), -1 === y(b, a) && (b.push(a), a.requireFailure(this)), this;
  1875. },
  1876. dropRequireFailure: function dropRequireFailure(a) {
  1877. if (l(a, "dropRequireFailure", this)) return this;
  1878. a = _b(a, this);
  1879. var b = y(this.requireFail, a);
  1880. return b > -1 && this.requireFail.splice(b, 1), this;
  1881. },
  1882. hasRequireFailures: function hasRequireFailures() {
  1883. return this.requireFail.length > 0;
  1884. },
  1885. canRecognizeWith: function canRecognizeWith(a) {
  1886. return !!this.simultaneous[a.id];
  1887. },
  1888. emit: function emit(a) {
  1889. function d(d) {
  1890. b.manager.emit(b.options.event + (d ? Zb(c) : ""), a);
  1891. }
  1892. var b = this,
  1893. c = this.state;
  1894. Ub > c && d(!0), d(), c >= Ub && d(!0);
  1895. },
  1896. tryEmit: function tryEmit(a) {
  1897. return this.canEmit() ? this.emit(a) : (this.state = Xb, void 0);
  1898. },
  1899. canEmit: function canEmit() {
  1900. for (var a = 0; a < this.requireFail.length;) {
  1901. if (!(this.requireFail[a].state & (Xb | Rb))) return !1;
  1902. a++;
  1903. }
  1904. return !0;
  1905. },
  1906. recognize: function recognize(a) {
  1907. var b = n({}, a);
  1908. 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);
  1909. },
  1910. process: function process() {},
  1911. getTouchAction: function getTouchAction() {},
  1912. reset: function reset() {}
  1913. }, p(ac, Yb, {
  1914. defaults: {
  1915. pointers: 1
  1916. },
  1917. attrTest: function attrTest(a) {
  1918. var b = this.options.pointers;
  1919. return 0 === b || a.pointers.length === b;
  1920. },
  1921. process: function process(a) {
  1922. var b = this.state,
  1923. c = a.eventType,
  1924. d = b & (Sb | Tb),
  1925. e = this.attrTest(a);
  1926. return d && (c & R || !e) ? b | Wb : d || e ? c & Q ? b | Ub : b & Sb ? b | Tb : Sb : Xb;
  1927. }
  1928. }), p(bc, ac, {
  1929. defaults: {
  1930. event: "pan",
  1931. threshold: 10,
  1932. pointers: 1,
  1933. direction: Z
  1934. },
  1935. getTouchAction: function getTouchAction() {
  1936. var a = this.options.direction,
  1937. b = [];
  1938. return a & X && b.push(Ob), a & Y && b.push(Nb), b;
  1939. },
  1940. directionTest: function directionTest(a) {
  1941. var b = this.options,
  1942. c = !0,
  1943. d = a.distance,
  1944. e = a.direction,
  1945. f = a.deltaX,
  1946. g = a.deltaY;
  1947. 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;
  1948. },
  1949. attrTest: function attrTest(a) {
  1950. return ac.prototype.attrTest.call(this, a) && (this.state & Sb || !(this.state & Sb) && this.directionTest(a));
  1951. },
  1952. emit: function emit(a) {
  1953. this.pX = a.deltaX, this.pY = a.deltaY;
  1954. var b = $b(a.direction);
  1955. b && this.manager.emit(this.options.event + b, a), this._super.emit.call(this, a);
  1956. }
  1957. }), p(cc, ac, {
  1958. defaults: {
  1959. event: "pinch",
  1960. threshold: 0,
  1961. pointers: 2
  1962. },
  1963. getTouchAction: function getTouchAction() {
  1964. return [Mb];
  1965. },
  1966. attrTest: function attrTest(a) {
  1967. return this._super.attrTest.call(this, a) && (Math.abs(a.scale - 1) > this.options.threshold || this.state & Sb);
  1968. },
  1969. emit: function emit(a) {
  1970. if (this._super.emit.call(this, a), 1 !== a.scale) {
  1971. var b = a.scale < 1 ? "in" : "out";
  1972. this.manager.emit(this.options.event + b, a);
  1973. }
  1974. }
  1975. }), p(dc, Yb, {
  1976. defaults: {
  1977. event: "press",
  1978. pointers: 1,
  1979. time: 500,
  1980. threshold: 5
  1981. },
  1982. getTouchAction: function getTouchAction() {
  1983. return [Kb];
  1984. },
  1985. process: function process(a) {
  1986. var b = this.options,
  1987. c = a.pointers.length === b.pointers,
  1988. d = a.distance < b.threshold,
  1989. e = a.deltaTime > b.time;
  1990. if (this._input = a, !d || !c || a.eventType & (Q | R) && !e) this.reset();else if (a.eventType & O) this.reset(), this._timer = k(function () {
  1991. this.state = Vb, this.tryEmit();
  1992. }, b.time, this);else if (a.eventType & Q) return Vb;
  1993. return Xb;
  1994. },
  1995. reset: function reset() {
  1996. clearTimeout(this._timer);
  1997. },
  1998. emit: function emit(a) {
  1999. 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)));
  2000. }
  2001. }), p(ec, ac, {
  2002. defaults: {
  2003. event: "rotate",
  2004. threshold: 0,
  2005. pointers: 2
  2006. },
  2007. getTouchAction: function getTouchAction() {
  2008. return [Mb];
  2009. },
  2010. attrTest: function attrTest(a) {
  2011. return this._super.attrTest.call(this, a) && (Math.abs(a.rotation) > this.options.threshold || this.state & Sb);
  2012. }
  2013. }), p(fc, ac, {
  2014. defaults: {
  2015. event: "swipe",
  2016. threshold: 10,
  2017. velocity: .65,
  2018. direction: X | Y,
  2019. pointers: 1
  2020. },
  2021. getTouchAction: function getTouchAction() {
  2022. return bc.prototype.getTouchAction.call(this);
  2023. },
  2024. attrTest: function attrTest(a) {
  2025. var c,
  2026. b = this.options.direction;
  2027. 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;
  2028. },
  2029. emit: function emit(a) {
  2030. var b = $b(a.direction);
  2031. b && this.manager.emit(this.options.event + b, a), this.manager.emit(this.options.event, a);
  2032. }
  2033. }), p(gc, Yb, {
  2034. defaults: {
  2035. event: "tap",
  2036. pointers: 1,
  2037. taps: 1,
  2038. interval: 300,
  2039. time: 250,
  2040. threshold: 2,
  2041. posThreshold: 10
  2042. },
  2043. getTouchAction: function getTouchAction() {
  2044. return [Lb];
  2045. },
  2046. process: function process(a) {
  2047. var b = this.options,
  2048. c = a.pointers.length === b.pointers,
  2049. d = a.distance < b.threshold,
  2050. e = a.deltaTime < b.time;
  2051. if (this.reset(), a.eventType & O && 0 === this.count) return this.failTimeout();
  2052. if (d && e && c) {
  2053. if (a.eventType != Q) return this.failTimeout();
  2054. var f = this.pTime ? a.timeStamp - this.pTime < b.interval : !0,
  2055. g = !this.pCenter || kb(this.pCenter, a.center) < b.posThreshold;
  2056. this.pTime = a.timeStamp, this.pCenter = a.center, g && f ? this.count += 1 : this.count = 1, this._input = a;
  2057. var h = this.count % b.taps;
  2058. if (0 === h) return this.hasRequireFailures() ? (this._timer = k(function () {
  2059. this.state = Vb, this.tryEmit();
  2060. }, b.interval, this), Sb) : Vb;
  2061. }
  2062. return Xb;
  2063. },
  2064. failTimeout: function failTimeout() {
  2065. return this._timer = k(function () {
  2066. this.state = Xb;
  2067. }, this.options.interval, this), Xb;
  2068. },
  2069. reset: function reset() {
  2070. clearTimeout(this._timer);
  2071. },
  2072. emit: function emit() {
  2073. this.state == Vb && (this._input.tapCount = this.count, this.manager.emit(this.options.event, this._input));
  2074. }
  2075. }), hc.VERSION = "2.0.4", hc.defaults = {
  2076. domEvents: !1,
  2077. touchAction: Jb,
  2078. enable: !0,
  2079. inputTarget: null,
  2080. inputClass: null,
  2081. preset: [[ec, {
  2082. enable: !1
  2083. }], [cc, {
  2084. enable: !1
  2085. }, ["rotate"]], [fc, {
  2086. direction: X
  2087. }], [bc, {
  2088. direction: X
  2089. }, ["swipe"]], [gc], [gc, {
  2090. event: "doubletap",
  2091. taps: 2
  2092. }, ["tap"]], [dc]],
  2093. cssProps: {
  2094. userSelect: "default",
  2095. touchSelect: "none",
  2096. touchCallout: "none",
  2097. contentZooming: "none",
  2098. userDrag: "none",
  2099. tapHighlightColor: "rgba(0,0,0,0)"
  2100. }
  2101. };
  2102. var ic = 1,
  2103. jc = 2;
  2104. kc.prototype = {
  2105. set: function set(a) {
  2106. return n(this.options, a), a.touchAction && this.touchAction.update(), a.inputTarget && (this.input.destroy(), this.input.target = a.inputTarget, this.input.init()), this;
  2107. },
  2108. stop: function stop(a) {
  2109. this.session.stopped = a ? jc : ic;
  2110. },
  2111. recognize: function recognize(a) {
  2112. var b = this.session;
  2113. if (!b.stopped) {
  2114. this.touchAction.preventDefaults(a);
  2115. var c,
  2116. d = this.recognizers,
  2117. e = b.curRecognizer;
  2118. (!e || e && e.state & Vb) && (e = b.curRecognizer = null);
  2119. for (var f = 0; f < d.length;) {
  2120. 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++;
  2121. }
  2122. }
  2123. },
  2124. get: function get(a) {
  2125. if (a instanceof Yb) return a;
  2126. for (var b = this.recognizers, c = 0; c < b.length; c++) {
  2127. if (b[c].options.event == a) return b[c];
  2128. }
  2129. return null;
  2130. },
  2131. add: function add(a) {
  2132. if (l(a, "add", this)) return this;
  2133. var b = this.get(a.options.event);
  2134. return b && this.remove(b), this.recognizers.push(a), a.manager = this, this.touchAction.update(), a;
  2135. },
  2136. remove: function remove(a) {
  2137. if (l(a, "remove", this)) return this;
  2138. var b = this.recognizers;
  2139. return a = this.get(a), b.splice(y(b, a), 1), this.touchAction.update(), this;
  2140. },
  2141. on: function on(a, b) {
  2142. var c = this.handlers;
  2143. return m(x(a), function (a) {
  2144. c[a] = c[a] || [], c[a].push(b);
  2145. }), this;
  2146. },
  2147. off: function off(a, b) {
  2148. var c = this.handlers;
  2149. return m(x(a), function (a) {
  2150. b ? c[a].splice(y(c[a], b), 1) : delete c[a];
  2151. }), this;
  2152. },
  2153. emit: function emit(a, b) {
  2154. this.options.domEvents && mc(a, b);
  2155. var c = this.handlers[a] && this.handlers[a].slice();
  2156. if (c && c.length) {
  2157. b.type = a, b.preventDefault = function () {
  2158. b.srcEvent.preventDefault();
  2159. };
  2160. for (var d = 0; d < c.length;) {
  2161. c[d](b), d++;
  2162. }
  2163. }
  2164. },
  2165. destroy: function destroy() {
  2166. this.element && lc(this, !1), this.handlers = {}, this.session = {}, this.input.destroy(), this.element = null;
  2167. }
  2168. }, n(hc, {
  2169. INPUT_START: O,
  2170. INPUT_MOVE: P,
  2171. INPUT_END: Q,
  2172. INPUT_CANCEL: R,
  2173. STATE_POSSIBLE: Rb,
  2174. STATE_BEGAN: Sb,
  2175. STATE_CHANGED: Tb,
  2176. STATE_ENDED: Ub,
  2177. STATE_RECOGNIZED: Vb,
  2178. STATE_CANCELLED: Wb,
  2179. STATE_FAILED: Xb,
  2180. DIRECTION_NONE: S,
  2181. DIRECTION_LEFT: T,
  2182. DIRECTION_RIGHT: U,
  2183. DIRECTION_UP: V,
  2184. DIRECTION_DOWN: W,
  2185. DIRECTION_HORIZONTAL: X,
  2186. DIRECTION_VERTICAL: Y,
  2187. DIRECTION_ALL: Z,
  2188. Manager: kc,
  2189. Input: ab,
  2190. TouchAction: Pb,
  2191. TouchInput: Eb,
  2192. MouseInput: rb,
  2193. PointerEventInput: wb,
  2194. TouchMouseInput: Gb,
  2195. SingleTouchInput: Ab,
  2196. Recognizer: Yb,
  2197. AttrRecognizer: ac,
  2198. Tap: gc,
  2199. Pan: bc,
  2200. Swipe: fc,
  2201. Pinch: cc,
  2202. Rotate: ec,
  2203. Press: dc,
  2204. on: t,
  2205. off: u,
  2206. each: m,
  2207. merge: o,
  2208. extend: n,
  2209. inherit: p,
  2210. bindFn: q,
  2211. prefixed: B
  2212. }), (typeof define === "undefined" ? "undefined" : _typeof(define)) == g && define.amd ? define(function () {
  2213. return hc;
  2214. }) : "undefined" != typeof module && module.exports ? module.exports = hc : a[c] = hc;
  2215. }(window, document, "Hammer");
  2216. ;
  2217. (function (factory) {
  2218. if (typeof define === 'function' && define.amd) {
  2219. define(['jquery', 'hammerjs'], factory);
  2220. } else if ((typeof exports === "undefined" ? "undefined" : _typeof(exports)) === 'object') {
  2221. factory(require('jquery'), require('hammerjs'));
  2222. } else {
  2223. factory(jQuery, Hammer);
  2224. }
  2225. })(function ($, Hammer) {
  2226. function hammerify(el, options) {
  2227. var $el = $(el);
  2228. if (!$el.data("hammer")) {
  2229. $el.data("hammer", new Hammer($el[0], options));
  2230. }
  2231. }
  2232. $.fn.hammer = function (options) {
  2233. return this.each(function () {
  2234. hammerify(this, options);
  2235. });
  2236. }; // extend the emit method to also trigger jQuery events
  2237. Hammer.Manager.prototype.emit = function (originalEmit) {
  2238. return function (type, data) {
  2239. originalEmit.call(this, type, data);
  2240. $(this.element).trigger({
  2241. type: type,
  2242. gesture: data
  2243. });
  2244. };
  2245. }(Hammer.Manager.prototype.emit);
  2246. });
  2247. ; // Required for Meteor package, the use of window prevents export by Meteor
  2248. (function (window) {
  2249. if (window.Package) {
  2250. Materialize = {};
  2251. } else {
  2252. window.Materialize = {};
  2253. }
  2254. })(window);
  2255. if (typeof exports !== 'undefined' && !exports.nodeType) {
  2256. if (typeof module !== 'undefined' && !module.nodeType && module.exports) {
  2257. exports = module.exports = Materialize;
  2258. }
  2259. exports["default"] = Materialize;
  2260. }
  2261. /*
  2262. * raf.js
  2263. * https://github.com/ngryman/raf.js
  2264. *
  2265. * original requestAnimationFrame polyfill by Erik Möller
  2266. * inspired from paul_irish gist and post
  2267. *
  2268. * Copyright (c) 2013 ngryman
  2269. * Licensed under the MIT license.
  2270. */
  2271. (function (window) {
  2272. var lastTime = 0,
  2273. vendors = ['webkit', 'moz'],
  2274. requestAnimationFrame = window.requestAnimationFrame,
  2275. cancelAnimationFrame = window.cancelAnimationFrame,
  2276. i = vendors.length; // try to un-prefix existing raf
  2277. while (--i >= 0 && !requestAnimationFrame) {
  2278. requestAnimationFrame = window[vendors[i] + 'RequestAnimationFrame'];
  2279. cancelAnimationFrame = window[vendors[i] + 'CancelRequestAnimationFrame'];
  2280. } // polyfill with setTimeout fallback
  2281. // heavily inspired from @darius gist mod: https://gist.github.com/paulirish/1579671#comment-837945
  2282. if (!requestAnimationFrame || !cancelAnimationFrame) {
  2283. requestAnimationFrame = function requestAnimationFrame(callback) {
  2284. var now = +Date.now(),
  2285. nextTime = Math.max(lastTime + 16, now);
  2286. return setTimeout(function () {
  2287. callback(lastTime = nextTime);
  2288. }, nextTime - now);
  2289. };
  2290. cancelAnimationFrame = clearTimeout;
  2291. } // export to window
  2292. window.requestAnimationFrame = requestAnimationFrame;
  2293. window.cancelAnimationFrame = cancelAnimationFrame;
  2294. })(window);
  2295. /**
  2296. * Generate approximated selector string for a jQuery object
  2297. * @param {jQuery} obj jQuery object to be parsed
  2298. * @returns {string}
  2299. */
  2300. Materialize.objectSelectorString = function (obj) {
  2301. var tagStr = obj.prop('tagName') || '';
  2302. var idStr = obj.attr('id') || '';
  2303. var classStr = obj.attr('class') || '';
  2304. return (tagStr + idStr + classStr).replace(/\s/g, '');
  2305. }; // Unique Random ID
  2306. Materialize.guid = function () {
  2307. function s4() {
  2308. return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
  2309. }
  2310. return function () {
  2311. return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
  2312. };
  2313. }();
  2314. /**
  2315. * Escapes hash from special characters
  2316. * @param {string} hash String returned from this.hash
  2317. * @returns {string}
  2318. */
  2319. Materialize.escapeHash = function (hash) {
  2320. return hash.replace(/(:|\.|\[|\]|,|=)/g, "\\$1");
  2321. };
  2322. Materialize.elementOrParentIsFixed = function (element) {
  2323. var $element = $(element);
  2324. var $checkElements = $element.add($element.parents());
  2325. var isFixed = false;
  2326. $checkElements.each(function () {
  2327. if ($(this).css("position") === "fixed") {
  2328. isFixed = true;
  2329. return false;
  2330. }
  2331. });
  2332. return isFixed;
  2333. };
  2334. /**
  2335. * Get time in ms
  2336. * @license https://raw.github.com/jashkenas/underscore/master/LICENSE
  2337. * @type {function}
  2338. * @return {number}
  2339. */
  2340. var getTime = Date.now || function () {
  2341. return new Date().getTime();
  2342. };
  2343. /**
  2344. * Returns a function, that, when invoked, will only be triggered at most once
  2345. * during a given window of time. Normally, the throttled function will run
  2346. * as much as it can, without ever going more than once per `wait` duration;
  2347. * but if you'd like to disable the execution on the leading edge, pass
  2348. * `{leading: false}`. To disable execution on the trailing edge, ditto.
  2349. * @license https://raw.github.com/jashkenas/underscore/master/LICENSE
  2350. * @param {function} func
  2351. * @param {number} wait
  2352. * @param {Object=} options
  2353. * @returns {Function}
  2354. */
  2355. Materialize.throttle = function (func, wait, options) {
  2356. var context, args, result;
  2357. var timeout = null;
  2358. var previous = 0;
  2359. options || (options = {});
  2360. var later = function later() {
  2361. previous = options.leading === false ? 0 : getTime();
  2362. timeout = null;
  2363. result = func.apply(context, args);
  2364. context = args = null;
  2365. };
  2366. return function () {
  2367. var now = getTime();
  2368. if (!previous && options.leading === false) previous = now;
  2369. var remaining = wait - (now - previous);
  2370. context = this;
  2371. args = arguments;
  2372. if (remaining <= 0) {
  2373. clearTimeout(timeout);
  2374. timeout = null;
  2375. previous = now;
  2376. result = func.apply(context, args);
  2377. context = args = null;
  2378. } else if (!timeout && options.trailing !== false) {
  2379. timeout = setTimeout(later, remaining);
  2380. }
  2381. return result;
  2382. };
  2383. }; // Velocity has conflicts when loaded with jQuery, this will check for it
  2384. // First, check if in noConflict mode
  2385. var Vel;
  2386. if (jQuery) {
  2387. Vel = jQuery.Velocity;
  2388. } else if ($) {
  2389. Vel = $.Velocity;
  2390. } else {
  2391. Vel = Velocity;
  2392. }
  2393. if (Vel) {
  2394. Materialize.Vel = Vel;
  2395. } else {
  2396. Materialize.Vel = Velocity;
  2397. }
  2398. ;
  2399. (function ($) {
  2400. $.fn.collapsible = function (options, methodParam) {
  2401. var defaults = {
  2402. accordion: undefined,
  2403. onOpen: undefined,
  2404. onClose: undefined
  2405. };
  2406. var methodName = options;
  2407. options = $.extend(defaults, options);
  2408. return this.each(function () {
  2409. var $this = $(this);
  2410. var $panel_headers = $(this).find('> li > .collapsible-header');
  2411. var collapsible_type = $this.data("collapsible");
  2412. /****************
  2413. Helper Functions
  2414. ****************/
  2415. // Accordion Open
  2416. function accordionOpen(object) {
  2417. $panel_headers = $this.find('> li > .collapsible-header');
  2418. if (object.hasClass('active')) {
  2419. object.parent().addClass('active');
  2420. } else {
  2421. object.parent().removeClass('active');
  2422. }
  2423. if (object.parent().hasClass('active')) {
  2424. object.siblings('.collapsible-body').stop(true, false).slideDown({
  2425. duration: 350,
  2426. easing: "easeOutQuart",
  2427. queue: false,
  2428. complete: function complete() {
  2429. $(this).css('height', '');
  2430. }
  2431. });
  2432. } else {
  2433. object.siblings('.collapsible-body').stop(true, false).slideUp({
  2434. duration: 350,
  2435. easing: "easeOutQuart",
  2436. queue: false,
  2437. complete: function complete() {
  2438. $(this).css('height', '');
  2439. }
  2440. });
  2441. }
  2442. $panel_headers.not(object).removeClass('active').parent().removeClass('active'); // Close previously open accordion elements.
  2443. $panel_headers.not(object).parent().children('.collapsible-body').stop(true, false).each(function () {
  2444. if ($(this).is(':visible')) {
  2445. $(this).slideUp({
  2446. duration: 350,
  2447. easing: "easeOutQuart",
  2448. queue: false,
  2449. complete: function complete() {
  2450. $(this).css('height', '');
  2451. execCallbacks($(this).siblings('.collapsible-header'));
  2452. }
  2453. });
  2454. }
  2455. });
  2456. } // Expandable Open
  2457. function expandableOpen(object) {
  2458. if (object.hasClass('active')) {
  2459. object.parent().addClass('active');
  2460. } else {
  2461. object.parent().removeClass('active');
  2462. }
  2463. if (object.parent().hasClass('active')) {
  2464. object.siblings('.collapsible-body').stop(true, false).slideDown({
  2465. duration: 350,
  2466. easing: "easeOutQuart",
  2467. queue: false,
  2468. complete: function complete() {
  2469. $(this).css('height', '');
  2470. }
  2471. });
  2472. } else {
  2473. object.siblings('.collapsible-body').stop(true, false).slideUp({
  2474. duration: 350,
  2475. easing: "easeOutQuart",
  2476. queue: false,
  2477. complete: function complete() {
  2478. $(this).css('height', '');
  2479. }
  2480. });
  2481. }
  2482. } // Open collapsible. object: .collapsible-header
  2483. function collapsibleOpen(object, noToggle) {
  2484. if (!noToggle) {
  2485. object.toggleClass('active');
  2486. }
  2487. if (options.accordion || collapsible_type === "accordion" || collapsible_type === undefined) {
  2488. // Handle Accordion
  2489. accordionOpen(object);
  2490. } else {
  2491. // Handle Expandables
  2492. expandableOpen(object);
  2493. }
  2494. execCallbacks(object);
  2495. } // Handle callbacks
  2496. function execCallbacks(object) {
  2497. if (object.hasClass('active')) {
  2498. if (typeof options.onOpen === "function") {
  2499. options.onOpen.call(this, object.parent());
  2500. }
  2501. } else {
  2502. if (typeof options.onClose === "function") {
  2503. options.onClose.call(this, object.parent());
  2504. }
  2505. }
  2506. }
  2507. /**
  2508. * Check if object is children of panel header
  2509. * @param {Object} object Jquery object
  2510. * @return {Boolean} true if it is children
  2511. */
  2512. function isChildrenOfPanelHeader(object) {
  2513. var panelHeader = getPanelHeader(object);
  2514. return panelHeader.length > 0;
  2515. }
  2516. /**
  2517. * Get panel header from a children element
  2518. * @param {Object} object Jquery object
  2519. * @return {Object} panel header object
  2520. */
  2521. function getPanelHeader(object) {
  2522. return object.closest('li > .collapsible-header');
  2523. } // Turn off any existing event handlers
  2524. function removeEventHandlers() {
  2525. $this.off('click.collapse', '> li > .collapsible-header');
  2526. }
  2527. /***** End Helper Functions *****/
  2528. // Methods
  2529. if (methodName === 'destroy') {
  2530. removeEventHandlers();
  2531. return;
  2532. } else if (methodParam >= 0 && methodParam < $panel_headers.length) {
  2533. var $curr_header = $panel_headers.eq(methodParam);
  2534. if ($curr_header.length && (methodName === 'open' || methodName === 'close' && $curr_header.hasClass('active'))) {
  2535. collapsibleOpen($curr_header);
  2536. }
  2537. return;
  2538. }
  2539. removeEventHandlers(); // Add click handler to only direct collapsible header children
  2540. $this.on('click.collapse', '> li > .collapsible-header', function (e) {
  2541. var element = $(e.target);
  2542. if (isChildrenOfPanelHeader(element)) {
  2543. element = getPanelHeader(element);
  2544. }
  2545. collapsibleOpen(element);
  2546. }); // Open first active
  2547. if (options.accordion || collapsible_type === "accordion" || collapsible_type === undefined) {
  2548. // Handle Accordion
  2549. collapsibleOpen($panel_headers.filter('.active').first(), true);
  2550. } else {
  2551. // Handle Expandables
  2552. $panel_headers.filter('.active').each(function () {
  2553. collapsibleOpen($(this), true);
  2554. });
  2555. }
  2556. });
  2557. };
  2558. $(document).ready(function () {
  2559. $('.collapsible').collapsible();
  2560. });
  2561. })(jQuery);
  2562. ;
  2563. (function ($) {
  2564. // Add posibility to scroll to selected option
  2565. // usefull for select for example
  2566. $.fn.scrollTo = function (elem) {
  2567. $(this).scrollTop($(this).scrollTop() - $(this).offset().top + $(elem).offset().top);
  2568. return this;
  2569. };
  2570. $.fn.dropdown = function (options) {
  2571. var defaults = {
  2572. inDuration: 300,
  2573. outDuration: 225,
  2574. constrainWidth: true,
  2575. // Constrains width of dropdown to the activator
  2576. hover: false,
  2577. gutter: 0,
  2578. // Spacing from edge
  2579. belowOrigin: false,
  2580. alignment: 'left',
  2581. stopPropagation: false
  2582. }; // Open dropdown.
  2583. if (options === "open") {
  2584. this.each(function () {
  2585. $(this).trigger('open');
  2586. });
  2587. return false;
  2588. } // Close dropdown.
  2589. if (options === "close") {
  2590. this.each(function () {
  2591. $(this).trigger('close');
  2592. });
  2593. return false;
  2594. }
  2595. this.each(function () {
  2596. var origin = $(this);
  2597. var curr_options = $.extend({}, defaults, options);
  2598. var isFocused = false; // Dropdown menu
  2599. var activates = $("#" + origin.attr('data-activates'));
  2600. function updateOptions() {
  2601. if (origin.data('induration') !== undefined) curr_options.inDuration = origin.data('induration');
  2602. if (origin.data('outduration') !== undefined) curr_options.outDuration = origin.data('outduration');
  2603. if (origin.data('constrainwidth') !== undefined) curr_options.constrainWidth = origin.data('constrainwidth');
  2604. if (origin.data('hover') !== undefined) curr_options.hover = origin.data('hover');
  2605. if (origin.data('gutter') !== undefined) curr_options.gutter = origin.data('gutter');
  2606. if (origin.data('beloworigin') !== undefined) curr_options.belowOrigin = origin.data('beloworigin');
  2607. if (origin.data('alignment') !== undefined) curr_options.alignment = origin.data('alignment');
  2608. if (origin.data('stoppropagation') !== undefined) curr_options.stopPropagation = origin.data('stoppropagation');
  2609. }
  2610. updateOptions(); // Attach dropdown to its activator
  2611. origin.after(activates);
  2612. /*
  2613. Helper function to position and resize dropdown.
  2614. Used in hover and click handler.
  2615. */
  2616. function placeDropdown(eventType) {
  2617. // Check for simultaneous focus and click events.
  2618. if (eventType === 'focus') {
  2619. isFocused = true;
  2620. } // Check html data attributes
  2621. updateOptions(); // Set Dropdown state
  2622. activates.addClass('active');
  2623. origin.addClass('active');
  2624. var originWidth = origin[0].getBoundingClientRect().width; // Constrain width
  2625. if (curr_options.constrainWidth === true) {
  2626. activates.css('width', originWidth);
  2627. } else {
  2628. activates.css('white-space', 'nowrap');
  2629. } // Offscreen detection
  2630. var windowHeight = window.innerHeight;
  2631. var originHeight = origin.innerHeight();
  2632. var offsetLeft = origin.offset().left;
  2633. var offsetTop = origin.offset().top - $(window).scrollTop();
  2634. var currAlignment = curr_options.alignment;
  2635. var gutterSpacing = 0;
  2636. var leftPosition = 0; // Below Origin
  2637. var verticalOffset = 0;
  2638. if (curr_options.belowOrigin === true) {
  2639. verticalOffset = originHeight;
  2640. } // Check for scrolling positioned container.
  2641. var scrollYOffset = 0;
  2642. var scrollXOffset = 0;
  2643. var wrapper = origin.parent();
  2644. if (!wrapper.is('body')) {
  2645. if (wrapper[0].scrollHeight > wrapper[0].clientHeight) {
  2646. scrollYOffset = wrapper[0].scrollTop;
  2647. }
  2648. if (wrapper[0].scrollWidth > wrapper[0].clientWidth) {
  2649. scrollXOffset = wrapper[0].scrollLeft;
  2650. }
  2651. }
  2652. if (offsetLeft + activates.innerWidth() > $(window).width()) {
  2653. // Dropdown goes past screen on right, force right alignment
  2654. currAlignment = 'right';
  2655. } else if (offsetLeft - activates.innerWidth() + origin.innerWidth() < 0) {
  2656. // Dropdown goes past screen on left, force left alignment
  2657. currAlignment = 'left';
  2658. } // Vertical bottom offscreen detection
  2659. if (offsetTop + activates.innerHeight() > windowHeight) {
  2660. // If going upwards still goes offscreen, just crop height of dropdown.
  2661. if (offsetTop + originHeight - activates.innerHeight() < 0) {
  2662. var adjustedHeight = windowHeight - offsetTop - verticalOffset;
  2663. activates.css('max-height', adjustedHeight);
  2664. } else {
  2665. // Flow upwards.
  2666. if (!verticalOffset) {
  2667. verticalOffset += originHeight;
  2668. }
  2669. verticalOffset -= activates.innerHeight();
  2670. }
  2671. } // Handle edge alignment
  2672. if (currAlignment === 'left') {
  2673. gutterSpacing = curr_options.gutter;
  2674. leftPosition = origin.position().left + gutterSpacing;
  2675. } else if (currAlignment === 'right') {
  2676. // Material icons fix
  2677. activates.stop(true, true).css({
  2678. opacity: 0,
  2679. left: 0
  2680. });
  2681. var offsetRight = origin.position().left + originWidth - activates.width();
  2682. gutterSpacing = -curr_options.gutter;
  2683. leftPosition = offsetRight + gutterSpacing;
  2684. } // Position dropdown
  2685. activates.css({
  2686. position: 'absolute',
  2687. top: origin.position().top + verticalOffset + scrollYOffset == 0 ? 64 : origin.position().top + verticalOffset + scrollYOffset,
  2688. left: leftPosition + scrollXOffset
  2689. }); // Show dropdown
  2690. activates.slideDown({
  2691. queue: false,
  2692. duration: curr_options.inDuration,
  2693. easing: 'easeOutCubic',
  2694. complete: function complete() {
  2695. $(this).css('height', '');
  2696. }
  2697. }).animate({
  2698. opacity: 1
  2699. }, {
  2700. queue: false,
  2701. duration: curr_options.inDuration,
  2702. easing: 'easeOutSine'
  2703. }); // Add click close handler to document
  2704. setTimeout(function () {
  2705. $(document).on('click.' + activates.attr('id'), function (e) {
  2706. hideDropdown();
  2707. $(document).off('click.' + activates.attr('id'));
  2708. });
  2709. }, 0);
  2710. }
  2711. function hideDropdown() {
  2712. // Check for simultaneous focus and click events.
  2713. isFocused = false;
  2714. activates.fadeOut(curr_options.outDuration);
  2715. activates.removeClass('active');
  2716. origin.removeClass('active');
  2717. $(document).off('click.' + activates.attr('id'));
  2718. setTimeout(function () {
  2719. activates.css('max-height', '');
  2720. }, curr_options.outDuration);
  2721. } // Hover
  2722. if (curr_options.hover) {
  2723. var open = false;
  2724. origin.off('click.' + origin.attr('id')); // Hover handler to show dropdown
  2725. origin.on('mouseenter', function (e) {
  2726. // Mouse over
  2727. if (open === false) {
  2728. placeDropdown();
  2729. open = true;
  2730. }
  2731. });
  2732. origin.on('mouseleave', function (e) {
  2733. // If hover on origin then to something other than dropdown content, then close
  2734. var toEl = e.toElement || e.relatedTarget; // added browser compatibility for target element
  2735. if (!$(toEl).closest('.dropdown-content').is(activates)) {
  2736. activates.stop(true, true);
  2737. hideDropdown();
  2738. open = false;
  2739. }
  2740. });
  2741. activates.on('mouseleave', function (e) {
  2742. // Mouse out
  2743. var toEl = e.toElement || e.relatedTarget;
  2744. if (!$(toEl).closest('.dropdown-button').is(origin)) {
  2745. activates.stop(true, true);
  2746. hideDropdown();
  2747. open = false;
  2748. }
  2749. }); // Click
  2750. } else {
  2751. // Click handler to show dropdown
  2752. origin.off('click.' + origin.attr('id'));
  2753. origin.on('click.' + origin.attr('id'), function (e) {
  2754. if (!isFocused) {
  2755. if (origin[0] == e.currentTarget && !origin.hasClass('active') && $(e.target).closest('.dropdown-content').length === 0) {
  2756. e.preventDefault(); // Prevents button click from moving window
  2757. if (curr_options.stopPropagation) {
  2758. e.stopPropagation();
  2759. }
  2760. placeDropdown('click');
  2761. } // If origin is clicked and menu is open, close menu
  2762. else if (origin.hasClass('active')) {
  2763. hideDropdown();
  2764. $(document).off('click.' + activates.attr('id'));
  2765. }
  2766. }
  2767. });
  2768. } // End else
  2769. // Listen to open and close event - useful for select component
  2770. origin.on('open', function (e, eventType) {
  2771. placeDropdown(eventType);
  2772. });
  2773. origin.on('close', hideDropdown);
  2774. });
  2775. }; // End dropdown plugin
  2776. $(document).ready(function () {
  2777. $('.dropdown-button').dropdown();
  2778. });
  2779. })(jQuery);
  2780. ;
  2781. (function ($, Vel) {
  2782. 'use strict';
  2783. var _defaults = {
  2784. opacity: 0.5,
  2785. inDuration: 250,
  2786. outDuration: 250,
  2787. ready: undefined,
  2788. complete: undefined,
  2789. dismissible: true,
  2790. startingTop: '4%',
  2791. endingTop: '10%'
  2792. };
  2793. /**
  2794. * @class
  2795. *
  2796. */
  2797. var Modal = function () {
  2798. /**
  2799. * Construct Modal instance and set up overlay
  2800. * @constructor
  2801. * @param {jQuery} $el
  2802. * @param {Object} options
  2803. */
  2804. function Modal($el, options) {
  2805. _classCallCheck(this, Modal); // If exists, destroy and reinitialize
  2806. if (!!$el[0].M_Modal) {
  2807. $el[0].M_Modal.destroy();
  2808. }
  2809. /**
  2810. * The jQuery element
  2811. * @type {jQuery}
  2812. */
  2813. this.$el = $el;
  2814. /**
  2815. * Options for the modal
  2816. * @member Modal#options
  2817. * @prop {Number} [opacity=0.5] - Opacity of the modal overlay
  2818. * @prop {Number} [inDuration=250] - Length in ms of enter transition
  2819. * @prop {Number} [outDuration=250] - Length in ms of exit transition
  2820. * @prop {Function} ready - Callback function called when modal is finished entering
  2821. * @prop {Function} complete - Callback function called when modal is finished exiting
  2822. * @prop {Boolean} [dismissible=true] - Allow modal to be dismissed by keyboard or overlay click
  2823. * @prop {String} [startingTop='4%'] - startingTop
  2824. * @prop {String} [endingTop='10%'] - endingTop
  2825. */
  2826. this.options = $.extend({}, Modal.defaults, options);
  2827. /**
  2828. * Describes open/close state of modal
  2829. * @type {Boolean}
  2830. */
  2831. this.isOpen = false;
  2832. this.$el[0].M_Modal = this;
  2833. this.id = $el.attr('id');
  2834. this.openingTrigger = undefined;
  2835. this.$overlay = $('<div class="modal-overlay"></div>');
  2836. Modal._increment++;
  2837. Modal._count++;
  2838. this.$overlay[0].style.zIndex = 1000 + Modal._increment * 2;
  2839. this.$el[0].style.zIndex = 1000 + Modal._increment * 2 + 1;
  2840. this.setupEventHandlers();
  2841. }
  2842. _createClass(Modal, [{
  2843. key: 'getInstance',
  2844. /**
  2845. * Get Instance
  2846. */
  2847. value: function getInstance() {
  2848. return this;
  2849. }
  2850. /**
  2851. * Teardown component
  2852. */
  2853. }, {
  2854. key: 'destroy',
  2855. value: function destroy() {
  2856. this.removeEventHandlers();
  2857. this.$el[0].removeAttribute('style');
  2858. if (!!this.$overlay[0].parentNode) {
  2859. this.$overlay[0].parentNode.removeChild(this.$overlay[0]);
  2860. }
  2861. this.$el[0].M_Modal = undefined;
  2862. Modal._count--;
  2863. }
  2864. /**
  2865. * Setup Event Handlers
  2866. */
  2867. }, {
  2868. key: 'setupEventHandlers',
  2869. value: function setupEventHandlers() {
  2870. this.handleOverlayClickBound = this.handleOverlayClick.bind(this);
  2871. this.handleModalCloseClickBound = this.handleModalCloseClick.bind(this);
  2872. if (Modal._count === 1) {
  2873. document.body.addEventListener('click', this.handleTriggerClick);
  2874. }
  2875. this.$overlay[0].addEventListener('click', this.handleOverlayClickBound);
  2876. this.$el[0].addEventListener('click', this.handleModalCloseClickBound);
  2877. }
  2878. /**
  2879. * Remove Event Handlers
  2880. */
  2881. }, {
  2882. key: 'removeEventHandlers',
  2883. value: function removeEventHandlers() {
  2884. if (Modal._count === 0) {
  2885. document.body.removeEventListener('click', this.handleTriggerClick);
  2886. }
  2887. this.$overlay[0].removeEventListener('click', this.handleOverlayClickBound);
  2888. this.$el[0].removeEventListener('click', this.handleModalCloseClickBound);
  2889. }
  2890. /**
  2891. * Handle Trigger Click
  2892. * @param {Event} e
  2893. */
  2894. }, {
  2895. key: 'handleTriggerClick',
  2896. value: function handleTriggerClick(e) {
  2897. var $trigger = $(e.target).closest('.modal-trigger');
  2898. if (e.target && $trigger.length) {
  2899. var modalId = $trigger[0].getAttribute('href');
  2900. if (modalId) {
  2901. modalId = modalId.slice(1);
  2902. } else {
  2903. modalId = $trigger[0].getAttribute('data-target');
  2904. }
  2905. var modalInstance = document.getElementById(modalId).M_Modal;
  2906. if (modalInstance) {
  2907. modalInstance.open($trigger);
  2908. }
  2909. e.preventDefault();
  2910. }
  2911. }
  2912. /**
  2913. * Handle Overlay Click
  2914. */
  2915. }, {
  2916. key: 'handleOverlayClick',
  2917. value: function handleOverlayClick() {
  2918. if (this.options.dismissible) {
  2919. this.close();
  2920. }
  2921. }
  2922. /**
  2923. * Handle Modal Close Click
  2924. * @param {Event} e
  2925. */
  2926. }, {
  2927. key: 'handleModalCloseClick',
  2928. value: function handleModalCloseClick(e) {
  2929. var $closeTrigger = $(e.target).closest('.modal-close');
  2930. if (e.target && $closeTrigger.length) {
  2931. this.close();
  2932. }
  2933. }
  2934. /**
  2935. * Handle Keydown
  2936. * @param {Event} e
  2937. */
  2938. }, {
  2939. key: 'handleKeydown',
  2940. value: function handleKeydown(e) {
  2941. // ESC key
  2942. if (e.keyCode === 27 && this.options.dismissible) {
  2943. this.close();
  2944. }
  2945. }
  2946. /**
  2947. * Animate in modal
  2948. */
  2949. }, {
  2950. key: 'animateIn',
  2951. value: function animateIn() {
  2952. var _this = this; // Set initial styles
  2953. $.extend(this.$el[0].style, {
  2954. display: 'block',
  2955. opacity: 0
  2956. });
  2957. $.extend(this.$overlay[0].style, {
  2958. display: 'block',
  2959. opacity: 0
  2960. }); // Animate overlay
  2961. Vel(this.$overlay[0], {
  2962. opacity: this.options.opacity
  2963. }, {
  2964. duration: this.options.inDuration,
  2965. queue: false,
  2966. ease: 'easeOutCubic'
  2967. }); // Define modal animation options
  2968. var enterVelocityOptions = {
  2969. duration: this.options.inDuration,
  2970. queue: false,
  2971. ease: 'easeOutCubic',
  2972. // Handle modal ready callback
  2973. complete: function complete() {
  2974. if (typeof _this.options.ready === 'function') {
  2975. _this.options.ready.call(_this, _this.$el, _this.openingTrigger);
  2976. }
  2977. }
  2978. }; // Bottom sheet animation
  2979. if (this.$el[0].classList.contains('bottom-sheet')) {
  2980. Vel(this.$el[0], {
  2981. bottom: 0,
  2982. opacity: 1
  2983. }, enterVelocityOptions); // Normal modal animation
  2984. } else {
  2985. Vel.hook(this.$el[0], 'scaleX', 0.7);
  2986. this.$el[0].style.top = this.options.startingTop;
  2987. Vel(this.$el[0], {
  2988. top: this.options.endingTop,
  2989. opacity: 1,
  2990. scaleX: 1
  2991. }, enterVelocityOptions);
  2992. }
  2993. }
  2994. /**
  2995. * Animate out modal
  2996. */
  2997. }, {
  2998. key: 'animateOut',
  2999. value: function animateOut() {
  3000. var _this2 = this; // Animate overlay
  3001. Vel(this.$overlay[0], {
  3002. opacity: 0
  3003. }, {
  3004. duration: this.options.outDuration,
  3005. queue: false,
  3006. ease: 'easeOutQuart'
  3007. }); // Define modal animation options
  3008. var exitVelocityOptions = {
  3009. duration: this.options.outDuration,
  3010. queue: false,
  3011. ease: 'easeOutCubic',
  3012. // Handle modal ready callback
  3013. complete: function complete() {
  3014. _this2.$el[0].style.display = 'none'; // Call complete callback
  3015. if (typeof _this2.options.complete === 'function') {
  3016. _this2.options.complete.call(_this2, _this2.$el);
  3017. }
  3018. _this2.$overlay[0].parentNode.removeChild(_this2.$overlay[0]);
  3019. }
  3020. }; // Bottom sheet animation
  3021. if (this.$el[0].classList.contains('bottom-sheet')) {
  3022. Vel(this.$el[0], {
  3023. bottom: '-100%',
  3024. opacity: 0
  3025. }, exitVelocityOptions); // Normal modal animation
  3026. } else {
  3027. Vel(this.$el[0], {
  3028. top: this.options.startingTop,
  3029. opacity: 0,
  3030. scaleX: 0.7
  3031. }, exitVelocityOptions);
  3032. }
  3033. }
  3034. /**
  3035. * Open Modal
  3036. * @param {jQuery} [$trigger]
  3037. */
  3038. }, {
  3039. key: 'open',
  3040. value: function open($trigger) {
  3041. if (this.isOpen) {
  3042. return;
  3043. }
  3044. this.isOpen = true;
  3045. var body = document.body;
  3046. body.style.overflow = 'hidden';
  3047. this.$el[0].classList.add('open');
  3048. body.appendChild(this.$overlay[0]); // Set opening trigger, undefined indicates modal was opened by javascript
  3049. this.openingTrigger = !!$trigger ? $trigger : undefined;
  3050. if (this.options.dismissible) {
  3051. this.handleKeydownBound = this.handleKeydown.bind(this);
  3052. document.addEventListener('keydown', this.handleKeydownBound);
  3053. }
  3054. this.animateIn();
  3055. return this;
  3056. }
  3057. /**
  3058. * Close Modal
  3059. */
  3060. }, {
  3061. key: 'close',
  3062. value: function close() {
  3063. if (!this.isOpen) {
  3064. return;
  3065. }
  3066. this.isOpen = false;
  3067. this.$el[0].classList.remove('open');
  3068. document.body.style.overflow = '';
  3069. if (this.options.dismissible) {
  3070. document.removeEventListener('keydown', this.handleKeydownBound);
  3071. }
  3072. this.animateOut();
  3073. return this;
  3074. }
  3075. }], [{
  3076. key: 'init',
  3077. value: function init($els, options) {
  3078. var arr = [];
  3079. $els.each(function () {
  3080. arr.push(new Modal($(this), options));
  3081. });
  3082. return arr;
  3083. }
  3084. }, {
  3085. key: 'defaults',
  3086. get: function get() {
  3087. return _defaults;
  3088. }
  3089. }]);
  3090. return Modal;
  3091. }();
  3092. /**
  3093. * @static
  3094. * @memberof Modal
  3095. */
  3096. Modal._increment = 0;
  3097. /**
  3098. * @static
  3099. * @memberof Modal
  3100. */
  3101. Modal._count = 0;
  3102. Materialize.Modal = Modal;
  3103. $.fn.modal = function (methodOrOptions) {
  3104. // Call plugin method if valid method name is passed in
  3105. if (Modal.prototype[methodOrOptions]) {
  3106. // Getter methods
  3107. if (methodOrOptions.slice(0, 3) === 'get') {
  3108. return this.first()[0].M_Modal[methodOrOptions](); // Void methods
  3109. } else {
  3110. return this.each(function () {
  3111. this.M_Modal[methodOrOptions]();
  3112. });
  3113. } // Initialize plugin if options or no argument is passed in
  3114. } else if (_typeof(methodOrOptions) === 'object' || !methodOrOptions) {
  3115. Modal.init(this, arguments[0]);
  3116. return this; // Return error if an unrecognized method name is passed in
  3117. } else {
  3118. $.error('Method ' + methodOrOptions + ' does not exist on jQuery.modal');
  3119. }
  3120. };
  3121. })(jQuery, Materialize.Vel);
  3122. ;
  3123. (function ($) {
  3124. $.fn.materialbox = function () {
  3125. return this.each(function () {
  3126. if ($(this).hasClass('initialized')) {
  3127. return;
  3128. }
  3129. $(this).addClass('initialized');
  3130. var overlayActive = false;
  3131. var doneAnimating = true;
  3132. var inDuration = 275;
  3133. var outDuration = 200;
  3134. var origin = $(this);
  3135. var placeholder = $('<div></div>').addClass('material-placeholder');
  3136. var originalWidth = 0;
  3137. var originalHeight = 0;
  3138. var ancestorsChanged;
  3139. var ancestor;
  3140. var originInlineStyles = origin.attr('style');
  3141. origin.wrap(placeholder); // Start click handler
  3142. origin.on('click', function () {
  3143. var placeholder = origin.parent('.material-placeholder');
  3144. var windowWidth = window.innerWidth;
  3145. var windowHeight = window.innerHeight;
  3146. var originalWidth = origin.width();
  3147. var originalHeight = origin.height(); // If already modal, return to original
  3148. if (doneAnimating === false) {
  3149. returnToOriginal();
  3150. return false;
  3151. } else if (overlayActive && doneAnimating === true) {
  3152. returnToOriginal();
  3153. return false;
  3154. } // Set states
  3155. doneAnimating = false;
  3156. origin.addClass('active');
  3157. overlayActive = true; // Set positioning for placeholder
  3158. placeholder.css({
  3159. width: placeholder[0].getBoundingClientRect().width,
  3160. height: placeholder[0].getBoundingClientRect().height,
  3161. position: 'relative',
  3162. top: 0,
  3163. left: 0
  3164. }); // Find ancestor with overflow: hidden; and remove it
  3165. ancestorsChanged = undefined;
  3166. ancestor = placeholder[0].parentNode;
  3167. var count = 0;
  3168. while (ancestor !== null && !$(ancestor).is(document)) {
  3169. var curr = $(ancestor);
  3170. if (curr.css('overflow') !== 'visible') {
  3171. curr.css('overflow', 'visible');
  3172. if (ancestorsChanged === undefined) {
  3173. ancestorsChanged = curr;
  3174. } else {
  3175. ancestorsChanged = ancestorsChanged.add(curr);
  3176. }
  3177. }
  3178. ancestor = ancestor.parentNode;
  3179. } // Set css on origin
  3180. origin.css({
  3181. position: 'absolute',
  3182. 'z-index': 1000,
  3183. 'will-change': 'left, top, width, height'
  3184. }).data('width', originalWidth).data('height', originalHeight); // Add overlay
  3185. var overlay = $('<div id="materialbox-overlay"></div>').css({
  3186. opacity: 0
  3187. }).click(function () {
  3188. if (doneAnimating === true) returnToOriginal();
  3189. }); // Put before in origin image to preserve z-index layering.
  3190. origin.before(overlay); // Set dimensions if needed
  3191. var overlayOffset = overlay[0].getBoundingClientRect();
  3192. overlay.css({
  3193. width: windowWidth,
  3194. height: windowHeight,
  3195. left: -1 * overlayOffset.left,
  3196. top: -1 * overlayOffset.top
  3197. }); // Animate Overlay
  3198. overlay.velocity({
  3199. opacity: 1
  3200. }, {
  3201. duration: inDuration,
  3202. queue: false,
  3203. easing: 'easeOutQuad'
  3204. }); // Add and animate caption if it exists
  3205. if (origin.data('caption') !== "") {
  3206. var $photo_caption = $('<div class="materialbox-caption"></div>');
  3207. $photo_caption.text(origin.data('caption'));
  3208. $('body').append($photo_caption);
  3209. $photo_caption.css({
  3210. "display": "inline"
  3211. });
  3212. $photo_caption.velocity({
  3213. opacity: 1
  3214. }, {
  3215. duration: inDuration,
  3216. queue: false,
  3217. easing: 'easeOutQuad'
  3218. });
  3219. } // Resize Image
  3220. var ratio = 0;
  3221. var widthPercent = originalWidth / windowWidth;
  3222. var heightPercent = originalHeight / windowHeight;
  3223. var newWidth = 0;
  3224. var newHeight = 0;
  3225. if (widthPercent > heightPercent) {
  3226. ratio = originalHeight / originalWidth;
  3227. newWidth = windowWidth * 0.9;
  3228. newHeight = windowWidth * 0.9 * ratio;
  3229. } else {
  3230. ratio = originalWidth / originalHeight;
  3231. newWidth = windowHeight * 0.9 * ratio;
  3232. newHeight = windowHeight * 0.9;
  3233. } // Animate image + set z-index
  3234. if (origin.hasClass('responsive-img')) {
  3235. origin.velocity({
  3236. 'max-width': newWidth,
  3237. 'width': originalWidth
  3238. }, {
  3239. duration: 0,
  3240. queue: false,
  3241. complete: function complete() {
  3242. origin.css({
  3243. left: 0,
  3244. top: 0
  3245. }).velocity({
  3246. height: newHeight,
  3247. width: newWidth,
  3248. left: $(document).scrollLeft() + windowWidth / 2 - origin.parent('.material-placeholder').offset().left - newWidth / 2,
  3249. top: $(document).scrollTop() + windowHeight / 2 - origin.parent('.material-placeholder').offset().top - newHeight / 2
  3250. }, {
  3251. duration: inDuration,
  3252. queue: false,
  3253. easing: 'easeOutQuad',
  3254. complete: function complete() {
  3255. doneAnimating = true;
  3256. }
  3257. });
  3258. } // End Complete
  3259. }); // End Velocity
  3260. } else {
  3261. origin.css('left', 0).css('top', 0).velocity({
  3262. height: newHeight,
  3263. width: newWidth,
  3264. left: $(document).scrollLeft() + windowWidth / 2 - origin.parent('.material-placeholder').offset().left - newWidth / 2,
  3265. top: $(document).scrollTop() + windowHeight / 2 - origin.parent('.material-placeholder').offset().top - newHeight / 2
  3266. }, {
  3267. duration: inDuration,
  3268. queue: false,
  3269. easing: 'easeOutQuad',
  3270. complete: function complete() {
  3271. doneAnimating = true;
  3272. }
  3273. }); // End Velocity
  3274. } // Handle Exit triggers
  3275. $(window).on('scroll.materialbox', function () {
  3276. if (overlayActive) {
  3277. returnToOriginal();
  3278. }
  3279. });
  3280. $(window).on('resize.materialbox', function () {
  3281. if (overlayActive) {
  3282. returnToOriginal();
  3283. }
  3284. });
  3285. $(document).on('keyup.materialbox', function (e) {
  3286. // ESC key
  3287. if (e.keyCode === 27 && doneAnimating === true && overlayActive) {
  3288. returnToOriginal();
  3289. }
  3290. });
  3291. }); // End click handler
  3292. // This function returns the modaled image to the original spot
  3293. function returnToOriginal() {
  3294. doneAnimating = false;
  3295. var placeholder = origin.parent('.material-placeholder');
  3296. var windowWidth = window.innerWidth;
  3297. var windowHeight = window.innerHeight;
  3298. var originalWidth = origin.data('width');
  3299. var originalHeight = origin.data('height');
  3300. origin.velocity("stop", true);
  3301. $('#materialbox-overlay').velocity("stop", true);
  3302. $('.materialbox-caption').velocity("stop", true); // disable exit handlers
  3303. $(window).off('scroll.materialbox');
  3304. $(document).off('keyup.materialbox');
  3305. $(window).off('resize.materialbox');
  3306. $('#materialbox-overlay').velocity({
  3307. opacity: 0
  3308. }, {
  3309. duration: outDuration,
  3310. // Delay prevents animation overlapping
  3311. queue: false,
  3312. easing: 'easeOutQuad',
  3313. complete: function complete() {
  3314. // Remove Overlay
  3315. overlayActive = false;
  3316. $(this).remove();
  3317. }
  3318. }); // Resize Image
  3319. origin.velocity({
  3320. width: originalWidth,
  3321. height: originalHeight,
  3322. left: 0,
  3323. top: 0
  3324. }, {
  3325. duration: outDuration,
  3326. queue: false,
  3327. easing: 'easeOutQuad',
  3328. complete: function complete() {
  3329. placeholder.css({
  3330. height: '',
  3331. width: '',
  3332. position: '',
  3333. top: '',
  3334. left: ''
  3335. });
  3336. origin.removeAttr('style');
  3337. origin.attr('style', originInlineStyles); // Remove class
  3338. origin.removeClass('active');
  3339. doneAnimating = true; // Remove overflow overrides on ancestors
  3340. if (ancestorsChanged) {
  3341. ancestorsChanged.css('overflow', '');
  3342. }
  3343. }
  3344. }); // Remove Caption + reset css settings on image
  3345. $('.materialbox-caption').velocity({
  3346. opacity: 0
  3347. }, {
  3348. duration: outDuration,
  3349. // Delay prevents animation overlapping
  3350. queue: false,
  3351. easing: 'easeOutQuad',
  3352. complete: function complete() {
  3353. $(this).remove();
  3354. }
  3355. });
  3356. }
  3357. });
  3358. };
  3359. $(document).ready(function () {
  3360. $('.materialboxed').materialbox();
  3361. });
  3362. })(jQuery);
  3363. ;
  3364. (function ($) {
  3365. $.fn.parallax = function () {
  3366. var window_width = $(window).width(); // Parallax Scripts
  3367. return this.each(function (i) {
  3368. var $this = $(this);
  3369. $this.addClass('parallax');
  3370. function updateParallax(initial) {
  3371. var container_height;
  3372. if (window_width < 601) {
  3373. container_height = $this.height() > 0 ? $this.height() : $this.children("img").height();
  3374. } else {
  3375. container_height = $this.height() > 0 ? $this.height() : 500;
  3376. }
  3377. var $img = $this.children("img").first();
  3378. var img_height = $img.height();
  3379. var parallax_dist = img_height - container_height;
  3380. var bottom = $this.offset().top + container_height;
  3381. var top = $this.offset().top;
  3382. var scrollTop = $(window).scrollTop();
  3383. var windowHeight = window.innerHeight;
  3384. var windowBottom = scrollTop + windowHeight;
  3385. var percentScrolled = (windowBottom - top) / (container_height + windowHeight);
  3386. var parallax = Math.round(parallax_dist * percentScrolled);
  3387. if (initial) {
  3388. $img.css('display', 'block');
  3389. }
  3390. if (bottom > scrollTop && top < scrollTop + windowHeight) {
  3391. $img.css('transform', "translate3D(-50%," + parallax + "px, 0)");
  3392. }
  3393. } // Wait for image load
  3394. $this.children("img").one("load", function () {
  3395. updateParallax(true);
  3396. }).each(function () {
  3397. if (this.complete) $(this).trigger("load");
  3398. });
  3399. $(window).scroll(function () {
  3400. window_width = $(window).width();
  3401. updateParallax(false);
  3402. });
  3403. $(window).resize(function () {
  3404. window_width = $(window).width();
  3405. updateParallax(false);
  3406. });
  3407. });
  3408. };
  3409. })(jQuery);
  3410. ;
  3411. (function ($) {
  3412. var methods = {
  3413. init: function init(options) {
  3414. var defaults = {
  3415. onShow: null,
  3416. swipeable: false,
  3417. responsiveThreshold: Infinity // breakpoint for swipeable
  3418. };
  3419. options = $.extend(defaults, options);
  3420. var namespace = Materialize.objectSelectorString($(this));
  3421. return this.each(function (i) {
  3422. var uniqueNamespace = namespace + i; // For each set of tabs, we want to keep track of
  3423. // which tab is active and its associated content
  3424. var $this = $(this),
  3425. window_width = $(window).width();
  3426. var $active,
  3427. $content,
  3428. $links = $this.find('li.tab a'),
  3429. $tabs_width = $this.width(),
  3430. $tabs_content = $(),
  3431. $tabs_wrapper,
  3432. $tab_width = Math.max($tabs_width, $this[0].scrollWidth) / $links.length,
  3433. $indicator,
  3434. index = 0,
  3435. prev_index = 0,
  3436. clicked = false,
  3437. clickedTimeout,
  3438. transition = 300; // Finds right attribute for indicator based on active tab.
  3439. // el: jQuery Object
  3440. var calcRightPos = function calcRightPos(el) {
  3441. return Math.ceil($tabs_width - el.position().left - el[0].getBoundingClientRect().width - $this.scrollLeft());
  3442. }; // Finds left attribute for indicator based on active tab.
  3443. // el: jQuery Object
  3444. var calcLeftPos = function calcLeftPos(el) {
  3445. return Math.floor(el.position().left + $this.scrollLeft());
  3446. }; // Animates Indicator to active tab.
  3447. // prev_index: Number
  3448. var animateIndicator = function animateIndicator(prev_index) {
  3449. if (index - prev_index >= 0) {
  3450. $indicator.velocity({
  3451. "right": calcRightPos($active)
  3452. }, {
  3453. duration: transition,
  3454. queue: false,
  3455. easing: 'easeOutQuad'
  3456. });
  3457. $indicator.velocity({
  3458. "left": calcLeftPos($active)
  3459. }, {
  3460. duration: transition,
  3461. queue: false,
  3462. easing: 'easeOutQuad',
  3463. delay: 90
  3464. });
  3465. } else {
  3466. $indicator.velocity({
  3467. "left": calcLeftPos($active)
  3468. }, {
  3469. duration: transition,
  3470. queue: false,
  3471. easing: 'easeOutQuad'
  3472. });
  3473. $indicator.velocity({
  3474. "right": calcRightPos($active)
  3475. }, {
  3476. duration: transition,
  3477. queue: false,
  3478. easing: 'easeOutQuad',
  3479. delay: 90
  3480. });
  3481. }
  3482. }; // Change swipeable according to responsive threshold
  3483. if (options.swipeable) {
  3484. if (window_width > options.responsiveThreshold) {
  3485. options.swipeable = false;
  3486. }
  3487. } // If the location.hash matches one of the links, use that as the active tab.
  3488. $active = $($links.filter('[href="' + location.hash + '"]')); // If no match is found, use the first link or any with class 'active' as the initial active tab.
  3489. if ($active.length === 0) {
  3490. $active = $(this).find('li.tab a.active').first();
  3491. }
  3492. if ($active.length === 0) {
  3493. $active = $(this).find('li.tab a').first();
  3494. }
  3495. $active.addClass('active');
  3496. index = $links.index($active);
  3497. if (index < 0) {
  3498. index = 0;
  3499. }
  3500. if ($active[0] !== undefined) {
  3501. $content = $($active[0].hash);
  3502. $content.addClass('active');
  3503. } // append indicator then set indicator width to tab width
  3504. if (!$this.find('.indicator').length) {
  3505. $this.append('<li class="indicator"></li>');
  3506. }
  3507. $indicator = $this.find('.indicator'); // we make sure that the indicator is at the end of the tabs
  3508. $this.append($indicator);
  3509. if ($this.is(":visible")) {
  3510. // $indicator.css({"right": $tabs_width - ((index + 1) * $tab_width)});
  3511. // $indicator.css({"left": index * $tab_width});
  3512. setTimeout(function () {
  3513. $indicator.css({
  3514. "right": calcRightPos($active)
  3515. });
  3516. $indicator.css({
  3517. "left": calcLeftPos($active)
  3518. });
  3519. }, 0);
  3520. }
  3521. $(window).off('resize.tabs-' + uniqueNamespace).on('resize.tabs-' + uniqueNamespace, function () {
  3522. $tabs_width = $this.width();
  3523. $tab_width = Math.max($tabs_width, $this[0].scrollWidth) / $links.length;
  3524. if (index < 0) {
  3525. index = 0;
  3526. }
  3527. if ($tab_width !== 0 && $tabs_width !== 0) {
  3528. $indicator.css({
  3529. "right": calcRightPos($active)
  3530. });
  3531. $indicator.css({
  3532. "left": calcLeftPos($active)
  3533. });
  3534. }
  3535. }); // Initialize Tabs Content.
  3536. if (options.swipeable) {
  3537. // TODO: Duplicate calls with swipeable? handle multiple div wrapping.
  3538. $links.each(function () {
  3539. var $curr_content = $(Materialize.escapeHash(this.hash));
  3540. $curr_content.addClass('carousel-item');
  3541. $tabs_content = $tabs_content.add($curr_content);
  3542. });
  3543. $tabs_wrapper = $tabs_content.wrapAll('<div class="tabs-content carousel"></div>');
  3544. $tabs_content.css('display', '');
  3545. $('.tabs-content.carousel').carousel({
  3546. fullWidth: true,
  3547. noWrap: true,
  3548. onCycleTo: function onCycleTo(item) {
  3549. if (!clicked) {
  3550. var prev_index = index;
  3551. index = $tabs_wrapper.index(item);
  3552. $active.removeClass('active');
  3553. $active = $links.eq(index);
  3554. $active.addClass('active');
  3555. animateIndicator(prev_index);
  3556. if (typeof options.onShow === "function") {
  3557. options.onShow.call($this[0], $content);
  3558. }
  3559. }
  3560. }
  3561. });
  3562. } else {
  3563. // Hide the remaining content
  3564. $links.not($active).each(function () {
  3565. $(Materialize.escapeHash(this.hash)).hide();
  3566. });
  3567. } // Bind the click event handler
  3568. $this.off('click.tabs').on('click.tabs', 'a', function (e) {
  3569. if ($(this).parent().hasClass('disabled')) {
  3570. e.preventDefault();
  3571. return;
  3572. } // Act as regular link if target attribute is specified.
  3573. if (!!$(this).attr("target")) {
  3574. return;
  3575. }
  3576. clicked = true;
  3577. $tabs_width = $this.width();
  3578. $tab_width = Math.max($tabs_width, $this[0].scrollWidth) / $links.length; // Make the old tab inactive.
  3579. $active.removeClass('active');
  3580. var $oldContent = $content; // Update the variables with the new link and content
  3581. $active = $(this);
  3582. $content = $(Materialize.escapeHash(this.hash));
  3583. $links = $this.find('li.tab a');
  3584. var activeRect = $active.position(); // Make the tab active.
  3585. $active.addClass('active');
  3586. prev_index = index;
  3587. index = $links.index($(this));
  3588. if (index < 0) {
  3589. index = 0;
  3590. } // Change url to current tab
  3591. // window.location.hash = $active.attr('href');
  3592. // Swap content
  3593. if (options.swipeable) {
  3594. if ($tabs_content.length) {
  3595. $tabs_content.carousel('set', index, function () {
  3596. if (typeof options.onShow === "function") {
  3597. options.onShow.call($this[0], $content);
  3598. }
  3599. });
  3600. }
  3601. } else {
  3602. if ($content !== undefined) {
  3603. $content.show();
  3604. $content.addClass('active');
  3605. if (typeof options.onShow === "function") {
  3606. options.onShow.call(this, $content);
  3607. }
  3608. }
  3609. if ($oldContent !== undefined && !$oldContent.is($content)) {
  3610. $oldContent.hide();
  3611. $oldContent.removeClass('active');
  3612. }
  3613. } // Reset clicked state
  3614. clickedTimeout = setTimeout(function () {
  3615. clicked = false;
  3616. }, transition); // Update indicator
  3617. animateIndicator(prev_index); // Prevent the anchor's default click action
  3618. e.preventDefault();
  3619. });
  3620. });
  3621. },
  3622. select_tab: function select_tab(id) {
  3623. this.find('a[href="#' + id + '"]').trigger('click');
  3624. }
  3625. };
  3626. $.fn.tabs = function (methodOrOptions) {
  3627. if (methods[methodOrOptions]) {
  3628. return methods[methodOrOptions].apply(this, Array.prototype.slice.call(arguments, 1));
  3629. } else if (_typeof(methodOrOptions) === 'object' || !methodOrOptions) {
  3630. // Default to "init"
  3631. return methods.init.apply(this, arguments);
  3632. } else {
  3633. $.error('Method ' + methodOrOptions + ' does not exist on jQuery.tabs');
  3634. }
  3635. };
  3636. $(document).ready(function () {
  3637. $('ul.tabs').tabs();
  3638. });
  3639. })(jQuery);
  3640. ;
  3641. (function ($) {
  3642. $.fn.tooltip = function (options) {
  3643. var timeout = null,
  3644. margin = 5; // Defaults
  3645. var defaults = {
  3646. delay: 350,
  3647. tooltip: '',
  3648. position: 'bottom',
  3649. html: false
  3650. }; // Remove tooltip from the activator
  3651. if (options === "remove") {
  3652. this.each(function () {
  3653. $('#' + $(this).attr('data-tooltip-id')).remove();
  3654. $(this).removeAttr('data-tooltip-id');
  3655. $(this).off('mouseenter.tooltip mouseleave.tooltip');
  3656. });
  3657. return false;
  3658. }
  3659. options = $.extend(defaults, options);
  3660. return this.each(function () {
  3661. var tooltipId = Materialize.guid();
  3662. var origin = $(this); // Destroy old tooltip
  3663. if (origin.attr('data-tooltip-id')) {
  3664. $('#' + origin.attr('data-tooltip-id')).remove();
  3665. }
  3666. origin.attr('data-tooltip-id', tooltipId); // Get attributes.
  3667. var allowHtml, tooltipDelay, tooltipPosition, tooltipText, tooltipEl, backdrop;
  3668. var setAttributes = function setAttributes() {
  3669. allowHtml = origin.attr('data-html') ? origin.attr('data-html') === 'true' : options.html;
  3670. tooltipDelay = origin.attr('data-delay');
  3671. tooltipDelay = tooltipDelay === undefined || tooltipDelay === '' ? options.delay : tooltipDelay;
  3672. tooltipPosition = origin.attr('data-position');
  3673. tooltipPosition = tooltipPosition === undefined || tooltipPosition === '' ? options.position : tooltipPosition;
  3674. tooltipText = origin.attr('data-tooltip');
  3675. tooltipText = tooltipText === undefined || tooltipText === '' ? options.tooltip : tooltipText;
  3676. };
  3677. setAttributes();
  3678. var renderTooltipEl = function renderTooltipEl() {
  3679. var tooltip = $('<div class="material-tooltip"></div>'); // Create Text span
  3680. if (allowHtml) {
  3681. tooltipText = $('<span></span>').html(tooltipText);
  3682. } else {
  3683. tooltipText = $('<span></span>').text(tooltipText);
  3684. } // Create tooltip
  3685. tooltip.append(tooltipText).appendTo($('body')).attr('id', tooltipId); // Create backdrop
  3686. backdrop = $('<div class="backdrop"></div>');
  3687. backdrop.appendTo(tooltip);
  3688. return tooltip;
  3689. };
  3690. tooltipEl = renderTooltipEl(); // Destroy previously binded events
  3691. origin.off('mouseenter.tooltip mouseleave.tooltip'); // Mouse In
  3692. var started = false,
  3693. timeoutRef;
  3694. origin.on({
  3695. 'mouseenter.tooltip': function mouseenterTooltip(e) {
  3696. var showTooltip = function showTooltip() {
  3697. setAttributes();
  3698. started = true;
  3699. tooltipEl.velocity('stop');
  3700. backdrop.velocity('stop');
  3701. tooltipEl.css({
  3702. visibility: 'visible',
  3703. left: '0px',
  3704. top: '0px'
  3705. }); // Tooltip positioning
  3706. var originWidth = origin.outerWidth();
  3707. var originHeight = origin.outerHeight();
  3708. var tooltipHeight = tooltipEl.outerHeight();
  3709. var tooltipWidth = tooltipEl.outerWidth();
  3710. var tooltipVerticalMovement = '0px';
  3711. var tooltipHorizontalMovement = '0px';
  3712. var backdropOffsetWidth = backdrop[0].offsetWidth;
  3713. var backdropOffsetHeight = backdrop[0].offsetHeight;
  3714. var scaleXFactor = 8;
  3715. var scaleYFactor = 8;
  3716. var scaleFactor = 0;
  3717. var targetTop, targetLeft, newCoordinates;
  3718. if (tooltipPosition === "top") {
  3719. // Top Position
  3720. targetTop = origin.offset().top - tooltipHeight - margin;
  3721. targetLeft = origin.offset().left + originWidth / 2 - tooltipWidth / 2;
  3722. newCoordinates = repositionWithinScreen(targetLeft, targetTop, tooltipWidth, tooltipHeight);
  3723. tooltipVerticalMovement = '-10px';
  3724. backdrop.css({
  3725. bottom: 0,
  3726. left: 0,
  3727. borderRadius: '14px 14px 0 0',
  3728. transformOrigin: '50% 100%',
  3729. marginTop: tooltipHeight,
  3730. marginLeft: tooltipWidth / 2 - backdropOffsetWidth / 2
  3731. });
  3732. } // Left Position
  3733. else if (tooltipPosition === "left") {
  3734. targetTop = origin.offset().top + originHeight / 2 - tooltipHeight / 2;
  3735. targetLeft = origin.offset().left - tooltipWidth - margin;
  3736. newCoordinates = repositionWithinScreen(targetLeft, targetTop, tooltipWidth, tooltipHeight);
  3737. tooltipHorizontalMovement = '-10px';
  3738. backdrop.css({
  3739. top: '-7px',
  3740. right: 0,
  3741. width: '14px',
  3742. height: '14px',
  3743. borderRadius: '14px 0 0 14px',
  3744. transformOrigin: '95% 50%',
  3745. marginTop: tooltipHeight / 2,
  3746. marginLeft: tooltipWidth
  3747. });
  3748. } // Right Position
  3749. else if (tooltipPosition === "right") {
  3750. targetTop = origin.offset().top + originHeight / 2 - tooltipHeight / 2;
  3751. targetLeft = origin.offset().left + originWidth + margin;
  3752. newCoordinates = repositionWithinScreen(targetLeft, targetTop, tooltipWidth, tooltipHeight);
  3753. tooltipHorizontalMovement = '+10px';
  3754. backdrop.css({
  3755. top: '-7px',
  3756. left: 0,
  3757. width: '14px',
  3758. height: '14px',
  3759. borderRadius: '0 14px 14px 0',
  3760. transformOrigin: '5% 50%',
  3761. marginTop: tooltipHeight / 2,
  3762. marginLeft: '0px'
  3763. });
  3764. } else {
  3765. // Bottom Position
  3766. targetTop = origin.offset().top + origin.outerHeight() + margin;
  3767. targetLeft = origin.offset().left + originWidth / 2 - tooltipWidth / 2;
  3768. newCoordinates = repositionWithinScreen(targetLeft, targetTop, tooltipWidth, tooltipHeight);
  3769. tooltipVerticalMovement = '+10px';
  3770. backdrop.css({
  3771. top: 0,
  3772. left: 0,
  3773. marginLeft: tooltipWidth / 2 - backdropOffsetWidth / 2
  3774. });
  3775. } // Set tooptip css placement
  3776. tooltipEl.css({
  3777. top: newCoordinates.y,
  3778. left: newCoordinates.x
  3779. }); // Calculate Scale to fill
  3780. scaleXFactor = Math.SQRT2 * tooltipWidth / parseInt(backdropOffsetWidth);
  3781. scaleYFactor = Math.SQRT2 * tooltipHeight / parseInt(backdropOffsetHeight);
  3782. scaleFactor = Math.max(scaleXFactor, scaleYFactor);
  3783. tooltipEl.velocity({
  3784. translateY: tooltipVerticalMovement,
  3785. translateX: tooltipHorizontalMovement
  3786. }, {
  3787. duration: 350,
  3788. queue: false
  3789. }).velocity({
  3790. opacity: 1
  3791. }, {
  3792. duration: 300,
  3793. delay: 50,
  3794. queue: false
  3795. });
  3796. backdrop.css({
  3797. visibility: 'visible'
  3798. }).velocity({
  3799. opacity: 1
  3800. }, {
  3801. duration: 55,
  3802. delay: 0,
  3803. queue: false
  3804. }).velocity({
  3805. scaleX: scaleFactor,
  3806. scaleY: scaleFactor
  3807. }, {
  3808. duration: 300,
  3809. delay: 0,
  3810. queue: false,
  3811. easing: 'easeInOutQuad'
  3812. });
  3813. };
  3814. timeoutRef = setTimeout(showTooltip, tooltipDelay); // End Interval
  3815. // Mouse Out
  3816. },
  3817. 'mouseleave.tooltip': function mouseleaveTooltip() {
  3818. // Reset State
  3819. started = false;
  3820. clearTimeout(timeoutRef); // Animate back
  3821. setTimeout(function () {
  3822. if (started !== true) {
  3823. tooltipEl.velocity({
  3824. opacity: 0,
  3825. translateY: 0,
  3826. translateX: 0
  3827. }, {
  3828. duration: 225,
  3829. queue: false
  3830. });
  3831. backdrop.velocity({
  3832. opacity: 0,
  3833. scaleX: 1,
  3834. scaleY: 1
  3835. }, {
  3836. duration: 225,
  3837. queue: false,
  3838. complete: function complete() {
  3839. backdrop.css({
  3840. visibility: 'hidden'
  3841. });
  3842. tooltipEl.css({
  3843. visibility: 'hidden'
  3844. });
  3845. started = false;
  3846. }
  3847. });
  3848. }
  3849. }, 225);
  3850. }
  3851. });
  3852. });
  3853. };
  3854. var repositionWithinScreen = function repositionWithinScreen(x, y, width, height) {
  3855. var newX = x;
  3856. var newY = y;
  3857. if (newX < 0) {
  3858. newX = 4;
  3859. } else if (newX + width > window.innerWidth) {
  3860. newX -= newX + width - window.innerWidth;
  3861. }
  3862. if (newY < 0) {
  3863. newY = 4;
  3864. } else if (newY + height > window.innerHeight + $(window).scrollTop) {
  3865. newY -= newY + height - window.innerHeight;
  3866. }
  3867. return {
  3868. x: newX,
  3869. y: newY
  3870. };
  3871. };
  3872. $(document).ready(function () {
  3873. $('.tooltipped').tooltip();
  3874. });
  3875. })(jQuery);
  3876. ;
  3877. /*!
  3878. * Waves v0.6.4
  3879. * http://fian.my.id/Waves
  3880. *
  3881. * Copyright 2014 Alfiana E. Sibuea and other contributors
  3882. * Released under the MIT license
  3883. * https://github.com/fians/Waves/blob/master/LICENSE
  3884. */
  3885. ;
  3886. (function (window) {
  3887. 'use strict';
  3888. var Waves = Waves || {};
  3889. var $$ = document.querySelectorAll.bind(document); // Find exact position of element
  3890. function isWindow(obj) {
  3891. return obj !== null && obj === obj.window;
  3892. }
  3893. function getWindow(elem) {
  3894. return isWindow(elem) ? elem : elem.nodeType === 9 && elem.defaultView;
  3895. }
  3896. function offset(elem) {
  3897. var docElem,
  3898. win,
  3899. box = {
  3900. top: 0,
  3901. left: 0
  3902. },
  3903. doc = elem && elem.ownerDocument;
  3904. docElem = doc.documentElement;
  3905. if (_typeof(elem.getBoundingClientRect) !== (typeof undefined === "undefined" ? "undefined" : _typeof(undefined))) {
  3906. box = elem.getBoundingClientRect();
  3907. }
  3908. win = getWindow(doc);
  3909. return {
  3910. top: box.top + win.pageYOffset - docElem.clientTop,
  3911. left: box.left + win.pageXOffset - docElem.clientLeft
  3912. };
  3913. }
  3914. function convertStyle(obj) {
  3915. var style = '';
  3916. for (var a in obj) {
  3917. if (obj.hasOwnProperty(a)) {
  3918. style += a + ':' + obj[a] + ';';
  3919. }
  3920. }
  3921. return style;
  3922. }
  3923. var Effect = {
  3924. // Effect delay
  3925. duration: 750,
  3926. show: function show(e, element) {
  3927. if ($('.waves-ripple')[0]) {
  3928. $('.waves-ripple')[0].remove();
  3929. } // Disable right click
  3930. if (e.button === 2) {
  3931. return false;
  3932. }
  3933. var el = element || this; // Create ripple
  3934. var ripple = document.createElement('div');
  3935. ripple.className = 'waves-ripple';
  3936. el.appendChild(ripple); // Get click coordinate and element witdh
  3937. var pos = offset(el);
  3938. var relativeY = e.pageY - pos.top;
  3939. var relativeX = e.pageX - pos.left;
  3940. var scale = 'scale(' + el.clientWidth / 100 * 10 + ')'; // Support for touch devices
  3941. if ('touches' in e) {
  3942. relativeY = e.touches[0].pageY - pos.top;
  3943. relativeX = e.touches[0].pageX - pos.left;
  3944. } // Attach data to element
  3945. ripple.setAttribute('data-hold', Date.now());
  3946. ripple.setAttribute('data-scale', scale);
  3947. ripple.setAttribute('data-x', relativeX);
  3948. ripple.setAttribute('data-y', relativeY); // Set ripple position
  3949. var rippleStyle = {
  3950. 'top': relativeY + 'px',
  3951. 'left': relativeX + 'px'
  3952. };
  3953. ripple.className = ripple.className + ' waves-notransition';
  3954. ripple.setAttribute('style', convertStyle(rippleStyle));
  3955. ripple.className = ripple.className.replace('waves-notransition', ''); // Scale the ripple
  3956. rippleStyle['-webkit-transform'] = scale;
  3957. rippleStyle['-moz-transform'] = scale;
  3958. rippleStyle['-ms-transform'] = scale;
  3959. rippleStyle['-o-transform'] = scale;
  3960. rippleStyle.transform = scale;
  3961. rippleStyle.opacity = '1';
  3962. rippleStyle['-webkit-transition-duration'] = Effect.duration + 'ms';
  3963. rippleStyle['-moz-transition-duration'] = Effect.duration + 'ms';
  3964. rippleStyle['-o-transition-duration'] = Effect.duration + 'ms';
  3965. rippleStyle['transition-duration'] = Effect.duration + 'ms';
  3966. rippleStyle['-webkit-transition-timing-function'] = 'cubic-bezier(0.250, 0.460, 0.450, 0.940)';
  3967. rippleStyle['-moz-transition-timing-function'] = 'cubic-bezier(0.250, 0.460, 0.450, 0.940)';
  3968. rippleStyle['-o-transition-timing-function'] = 'cubic-bezier(0.250, 0.460, 0.450, 0.940)';
  3969. rippleStyle['transition-timing-function'] = 'cubic-bezier(0.250, 0.460, 0.450, 0.940)';
  3970. ripple.setAttribute('style', convertStyle(rippleStyle));
  3971. },
  3972. hide: function hide(e) {
  3973. TouchHandler.touchup(e);
  3974. var el = this;
  3975. var width = el.clientWidth * 1.4; // Get first ripple
  3976. var ripple = null;
  3977. var ripples = el.getElementsByClassName('waves-ripple');
  3978. if (ripples.length > 0) {
  3979. ripple = ripples[ripples.length - 1];
  3980. ripples[1] ? ripples[1].remove() : '';
  3981. } else {
  3982. return false;
  3983. }
  3984. var relativeX = ripple.getAttribute('data-x');
  3985. var relativeY = ripple.getAttribute('data-y');
  3986. var scale = ripple.getAttribute('data-scale'); // Get delay beetween mousedown and mouse leave
  3987. var diff = Date.now() - Number(ripple.getAttribute('data-hold'));
  3988. var delay = 350 - diff;
  3989. if (delay < 0) {
  3990. delay = 0;
  3991. } // Fade out ripple after delay
  3992. setTimeout(function () {
  3993. var style = {
  3994. 'top': relativeY + 'px',
  3995. 'left': relativeX + 'px',
  3996. 'opacity': '0',
  3997. // Duration
  3998. '-webkit-transition-duration': Effect.duration + 'ms',
  3999. '-moz-transition-duration': Effect.duration + 'ms',
  4000. '-o-transition-duration': Effect.duration + 'ms',
  4001. 'transition-duration': Effect.duration + 'ms',
  4002. '-webkit-transform': scale,
  4003. '-moz-transform': scale,
  4004. '-ms-transform': scale,
  4005. '-o-transform': scale,
  4006. 'transform': scale
  4007. };
  4008. ripple.setAttribute('style', convertStyle(style));
  4009. setTimeout(function () {
  4010. try {
  4011. el.removeChild(ripple);
  4012. } catch (e) {
  4013. return false;
  4014. }
  4015. }, Effect.duration);
  4016. }, delay);
  4017. },
  4018. // Little hack to make <input> can perform waves effect
  4019. wrapInput: function wrapInput(elements) {
  4020. for (var a = 0; a < elements.length; a++) {
  4021. var el = elements[a];
  4022. if (el.tagName.toLowerCase() === 'input') {
  4023. var parent = el.parentNode; // If input already have parent just pass through
  4024. if (parent.tagName.toLowerCase() === 'i' && parent.className.indexOf('waves-effect') !== -1) {
  4025. continue;
  4026. } // Put element class and style to the specified parent
  4027. var wrapper = document.createElement('i');
  4028. wrapper.className = el.className + ' waves-input-wrapper';
  4029. var elementStyle = el.getAttribute('style');
  4030. if (!elementStyle) {
  4031. elementStyle = '';
  4032. }
  4033. wrapper.setAttribute('style', elementStyle);
  4034. el.className = 'waves-button-input';
  4035. el.removeAttribute('style'); // Put element as child
  4036. parent.replaceChild(wrapper, el);
  4037. wrapper.appendChild(el);
  4038. }
  4039. }
  4040. }
  4041. };
  4042. /**
  4043. * Disable mousedown event for 500ms during and after touch
  4044. */
  4045. var TouchHandler = {
  4046. /* uses an integer rather than bool so there's no issues with
  4047. * needing to clear timeouts if another touch event occurred
  4048. * within the 500ms. Cannot mouseup between touchstart and
  4049. * touchend, nor in the 500ms after touchend. */
  4050. touches: 0,
  4051. allowEvent: function allowEvent(e) {
  4052. var allow = true;
  4053. if (e.type === 'touchstart') {
  4054. TouchHandler.touches += 1; //push
  4055. } else if (e.type === 'touchend' || e.type === 'touchcancel') {
  4056. setTimeout(function () {
  4057. if (TouchHandler.touches > 0) {
  4058. TouchHandler.touches -= 1; //pop after 500ms
  4059. }
  4060. }, 500);
  4061. } else if (e.type === 'mousedown' && TouchHandler.touches > 0) {
  4062. allow = false;
  4063. }
  4064. return allow;
  4065. },
  4066. touchup: function touchup(e) {
  4067. TouchHandler.allowEvent(e);
  4068. }
  4069. };
  4070. /**
  4071. * Delegated click handler for .waves-effect element.
  4072. * returns null when .waves-effect element not in "click tree"
  4073. */
  4074. function getWavesEffectElement(e) {
  4075. if (TouchHandler.allowEvent(e) === false) {
  4076. return null;
  4077. }
  4078. var element = null;
  4079. var target = e.target || e.srcElement;
  4080. while (target.parentNode !== null) {
  4081. if (!(target instanceof SVGElement) && target.className.indexOf('waves-effect') !== -1) {
  4082. element = target;
  4083. break;
  4084. }
  4085. target = target.parentNode;
  4086. }
  4087. return element;
  4088. }
  4089. /**
  4090. * Bubble the click and show effect if .waves-effect elem was found
  4091. */
  4092. function showEffect(e) {
  4093. var element = getWavesEffectElement(e);
  4094. if (element !== null) {
  4095. Effect.show(e, element);
  4096. if ('ontouchstart' in window) {
  4097. element.addEventListener('touchend', Effect.hide, false);
  4098. element.addEventListener('touchcancel', Effect.hide, false);
  4099. }
  4100. element.addEventListener('mouseup', Effect.hide, false);
  4101. element.addEventListener('mouseleave', Effect.hide, false);
  4102. element.addEventListener('dragend', Effect.hide, false);
  4103. }
  4104. }
  4105. Waves.displayEffect = function (options) {
  4106. options = options || {};
  4107. if ('duration' in options) {
  4108. Effect.duration = options.duration;
  4109. } //Wrap input inside <i> tag
  4110. Effect.wrapInput($$('.waves-effect'));
  4111. if ('ontouchstart' in window) {
  4112. document.body.addEventListener('touchstart', showEffect, false);
  4113. }
  4114. document.body.addEventListener('mousedown', showEffect, false);
  4115. };
  4116. /**
  4117. * Attach Waves to an input element (or any element which doesn't
  4118. * bubble mouseup/mousedown events).
  4119. * Intended to be used with dynamically loaded forms/inputs, or
  4120. * where the user doesn't want a delegated click handler.
  4121. */
  4122. Waves.attach = function (element) {
  4123. //FUTURE: automatically add waves classes and allow users
  4124. // to specify them with an options param? Eg. light/classic/button
  4125. if (element.tagName.toLowerCase() === 'input') {
  4126. Effect.wrapInput([element]);
  4127. element = element.parentNode;
  4128. }
  4129. if ('ontouchstart' in window) {
  4130. element.addEventListener('touchstart', showEffect, false);
  4131. }
  4132. element.addEventListener('mousedown', showEffect, false);
  4133. };
  4134. window.Waves = Waves;
  4135. document.addEventListener('DOMContentLoaded', function () {
  4136. Waves.displayEffect();
  4137. }, false);
  4138. })(window);
  4139. ;
  4140. (function ($, Vel) {
  4141. 'use strict';
  4142. var _defaults = {
  4143. displayLength: Infinity,
  4144. inDuration: 300,
  4145. outDuration: 375,
  4146. className: undefined,
  4147. completeCallback: undefined,
  4148. activationPercent: 0.8
  4149. };
  4150. var Toast = function () {
  4151. function Toast(message, displayLength, className, completeCallback) {
  4152. _classCallCheck(this, Toast);
  4153. if (!message) {
  4154. return;
  4155. }
  4156. /**
  4157. * Options for the toast
  4158. * @member Toast#options
  4159. */
  4160. this.options = {
  4161. displayLength: displayLength,
  4162. className: className,
  4163. completeCallback: completeCallback
  4164. };
  4165. this.options = $.extend({}, Toast.defaults, this.options);
  4166. this.message = message;
  4167. /**
  4168. * Describes current pan state toast
  4169. * @type {Boolean}
  4170. */
  4171. this.panning = false;
  4172. /**
  4173. * Time remaining until toast is removed
  4174. */
  4175. this.timeRemaining = this.options.displayLength;
  4176. if (Toast._toasts.length === 0) {
  4177. Toast._createContainer();
  4178. } // Create new toast
  4179. Toast._toasts.push(this);
  4180. var toastElement = this.createToast();
  4181. toastElement.M_Toast = this;
  4182. this.el = toastElement;
  4183. this._animateIn();
  4184. this.setTimer();
  4185. }
  4186. _createClass(Toast, [{
  4187. key: 'createToast',
  4188. /**
  4189. * Create toast and append it to toast container
  4190. */
  4191. value: function createToast() {
  4192. var toast = document.createElement('div');
  4193. toast.classList.add('toast'); // Add custom classes onto toast
  4194. if (this.options.className) {
  4195. var classes = this.options.className.split(' ');
  4196. var i = void 0,
  4197. count = void 0;
  4198. for (i = 0, count = classes.length; i < count; i++) {
  4199. toast.classList.add(classes[i]);
  4200. }
  4201. } // Set content
  4202. if ((typeof HTMLElement === "undefined" ? "undefined" : _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') {
  4203. toast.appendChild(this.message); // Check if it is jQuery object
  4204. } else if (this.message instanceof jQuery) {
  4205. $(toast).append(this.message); // Insert as text;
  4206. } else {
  4207. toast.innerHTML = this.message;
  4208. } // Append toasft
  4209. Toast._container.appendChild(toast);
  4210. return toast;
  4211. }
  4212. /**
  4213. * Animate in toast
  4214. */
  4215. }, {
  4216. key: '_animateIn',
  4217. value: function _animateIn() {
  4218. // Animate toast in
  4219. Vel(this.el, {
  4220. top: 0,
  4221. opacity: 1
  4222. }, {
  4223. duration: 300,
  4224. easing: 'easeOutCubic',
  4225. queue: false
  4226. });
  4227. }
  4228. /**
  4229. * Create setInterval which automatically removes toast when timeRemaining >= 0
  4230. * has been reached
  4231. */
  4232. }, {
  4233. key: 'setTimer',
  4234. value: function setTimer() {
  4235. var _this3 = this;
  4236. if (this.timeRemaining !== Infinity) {
  4237. this.counterInterval = setInterval(function () {
  4238. // If toast is not being dragged, decrease its time remaining
  4239. if (!_this3.panning) {
  4240. _this3.timeRemaining -= 20;
  4241. } // Animate toast out
  4242. if (_this3.timeRemaining <= 0) {
  4243. _this3.remove();
  4244. }
  4245. }, 20);
  4246. }
  4247. }
  4248. /**
  4249. * Dismiss toast with animation
  4250. */
  4251. }, {
  4252. key: 'remove',
  4253. value: function remove() {
  4254. var _this4 = this;
  4255. window.clearInterval(this.counterInterval);
  4256. var activationDistance = this.el.offsetWidth * this.options.activationPercent;
  4257. if (this.wasSwiped) {
  4258. this.el.style.transition = 'transform .05s, opacity .05s';
  4259. this.el.style.transform = 'translateX(' + activationDistance + 'px)';
  4260. this.el.style.opacity = 0;
  4261. }
  4262. Vel(this.el, {
  4263. opacity: 0,
  4264. marginTop: '-40px'
  4265. }, {
  4266. duration: this.options.outDuration,
  4267. easing: 'easeOutExpo',
  4268. queue: false,
  4269. complete: function complete() {
  4270. // Call the optional callback
  4271. if (typeof _this4.options.completeCallback === 'function') {
  4272. _this4.options.completeCallback();
  4273. } // Remove toast from DOM
  4274. _this4.el.parentNode.removeChild(_this4.el);
  4275. Toast._toasts.splice(Toast._toasts.indexOf(_this4), 1);
  4276. if (Toast._toasts.length === 0) {
  4277. Toast._removeContainer();
  4278. }
  4279. }
  4280. });
  4281. }
  4282. }], [{
  4283. key: '_createContainer',
  4284. /**
  4285. * Append toast container and add event handlers
  4286. */
  4287. value: function _createContainer() {
  4288. var container = document.createElement('div');
  4289. container.setAttribute('id', 'toast-container'); // Add event handler
  4290. container.addEventListener('touchstart', Toast._onDragStart);
  4291. container.addEventListener('touchmove', Toast._onDragMove);
  4292. container.addEventListener('touchend', Toast._onDragEnd);
  4293. container.addEventListener('mousedown', Toast._onDragStart);
  4294. document.addEventListener('mousemove', Toast._onDragMove);
  4295. document.addEventListener('mouseup', Toast._onDragEnd);
  4296. document.body.appendChild(container);
  4297. Toast._container = container;
  4298. }
  4299. /**
  4300. * Remove toast container and event handlers
  4301. */
  4302. }, {
  4303. key: '_removeContainer',
  4304. value: function _removeContainer() {
  4305. // Add event handler
  4306. document.removeEventListener('mousemove', Toast._onDragMove);
  4307. document.removeEventListener('mouseup', Toast._onDragEnd);
  4308. Toast._container.parentNode.removeChild(Toast._container);
  4309. Toast._container = null;
  4310. }
  4311. /**
  4312. * Begin drag handler
  4313. * @param {Event} e
  4314. */
  4315. }, {
  4316. key: '_onDragStart',
  4317. value: function _onDragStart(e) {
  4318. if (e.target && $(e.target).closest('.toast').length) {
  4319. var $toast = $(e.target).closest('.toast');
  4320. var toast = $toast[0].M_Toast;
  4321. toast.panning = true;
  4322. Toast._draggedToast = toast;
  4323. toast.el.classList.add('panning');
  4324. toast.el.style.transition = '';
  4325. toast.startingXPos = Toast._xPos(e);
  4326. toast.time = Date.now();
  4327. toast.xPos = Toast._xPos(e);
  4328. }
  4329. }
  4330. /**
  4331. * Drag move handler
  4332. * @param {Event} e
  4333. */
  4334. }, {
  4335. key: '_onDragMove',
  4336. value: function _onDragMove(e) {
  4337. if (!!Toast._draggedToast) {
  4338. e.preventDefault();
  4339. var toast = Toast._draggedToast;
  4340. toast.deltaX = Math.abs(toast.xPos - Toast._xPos(e));
  4341. toast.xPos = Toast._xPos(e);
  4342. toast.velocityX = toast.deltaX / (Date.now() - toast.time);
  4343. toast.time = Date.now();
  4344. var totalDeltaX = toast.xPos - toast.startingXPos;
  4345. var activationDistance = toast.el.offsetWidth * toast.options.activationPercent;
  4346. toast.el.style.transform = 'translateX(' + totalDeltaX + 'px)';
  4347. toast.el.style.opacity = 1 - Math.abs(totalDeltaX / activationDistance);
  4348. }
  4349. }
  4350. /**
  4351. * End drag handler
  4352. * @param {Event} e
  4353. */
  4354. }, {
  4355. key: '_onDragEnd',
  4356. value: function _onDragEnd(e) {
  4357. if (!!Toast._draggedToast) {
  4358. var toast = Toast._draggedToast;
  4359. toast.panning = false;
  4360. toast.el.classList.remove('panning');
  4361. var totalDeltaX = toast.xPos - toast.startingXPos;
  4362. var activationDistance = toast.el.offsetWidth * toast.options.activationPercent;
  4363. var shouldBeDismissed = Math.abs(totalDeltaX) > activationDistance || toast.velocityX > 1; // Remove toast
  4364. if (shouldBeDismissed) {
  4365. toast.wasSwiped = true;
  4366. toast.remove(); // Animate toast back to original position
  4367. } else {
  4368. toast.el.style.transition = 'transform .2s, opacity .2s';
  4369. toast.el.style.transform = '';
  4370. toast.el.style.opacity = '';
  4371. }
  4372. Toast._draggedToast = null;
  4373. }
  4374. }
  4375. /**
  4376. * Get x position of mouse or touch event
  4377. * @param {Event} e
  4378. */
  4379. }, {
  4380. key: '_xPos',
  4381. value: function _xPos(e) {
  4382. if (e.targetTouches && e.targetTouches.length >= 1) {
  4383. return e.targetTouches[0].clientX;
  4384. } // mouse event
  4385. return e.clientX;
  4386. }
  4387. /**
  4388. * Remove all toasts
  4389. */
  4390. }, {
  4391. key: 'removeAll',
  4392. value: function removeAll() {
  4393. for (var toastIndex in Toast._toasts) {
  4394. Toast._toasts[toastIndex].remove();
  4395. }
  4396. }
  4397. }, {
  4398. key: 'defaults',
  4399. get: function get() {
  4400. return _defaults;
  4401. }
  4402. }]);
  4403. return Toast;
  4404. }();
  4405. /**
  4406. * @static
  4407. * @memberof Toast
  4408. * @type {Array.<Toast>}
  4409. */
  4410. Toast._toasts = [];
  4411. /**
  4412. * @static
  4413. * @memberof Toast
  4414. */
  4415. Toast._container = null;
  4416. /**
  4417. * @static
  4418. * @memberof Toast
  4419. * @type {Toast}
  4420. */
  4421. Toast._draggedToast = null;
  4422. Materialize.Toast = Toast;
  4423. Materialize.toast = function (message, displayLength, className, completeCallback) {
  4424. return new Toast(message, displayLength, className, completeCallback);
  4425. };
  4426. })(jQuery, Materialize.Vel);
  4427. ;
  4428. (function ($) {
  4429. var methods = {
  4430. init: function init(options) {
  4431. var defaults = {
  4432. menuWidth: 300,
  4433. edge: 'left',
  4434. closeOnClick: false,
  4435. draggable: true,
  4436. onOpen: null,
  4437. onClose: null
  4438. };
  4439. options = $.extend(defaults, options);
  4440. $(this).each(function () {
  4441. var $this = $(this);
  4442. var menuId = $this.attr('data-activates');
  4443. var menu = $("#" + menuId); // Set to width
  4444. if (options.menuWidth != 300) {
  4445. menu.css('width', options.menuWidth);
  4446. } // Add Touch Area
  4447. var $dragTarget = $('.drag-target[data-sidenav="' + menuId + '"]');
  4448. if (options.draggable) {
  4449. // Regenerate dragTarget
  4450. if ($dragTarget.length) {
  4451. $dragTarget.remove();
  4452. }
  4453. $dragTarget = $('<div class="drag-target"></div>').attr('data-sidenav', menuId);
  4454. $('body').append($dragTarget);
  4455. } else {
  4456. $dragTarget = $();
  4457. }
  4458. if (options.edge == 'left') {
  4459. menu.css('transform', 'translateX(-100%)');
  4460. $dragTarget.css({
  4461. 'left': 0
  4462. }); // Add Touch Area
  4463. } else {
  4464. menu.addClass('right-aligned') // Change text-alignment to right
  4465. .css('transform', 'translateX(100%)');
  4466. $dragTarget.css({
  4467. 'right': 0
  4468. }); // Add Touch Area
  4469. } // If fixed sidenav, bring menu out
  4470. if (menu.hasClass('fixed')) {
  4471. if (window.innerWidth > 992) {
  4472. menu.css('transform', 'translateX(0)');
  4473. }
  4474. } // Window resize to reset on large screens fixed
  4475. if (menu.hasClass('fixed')) {
  4476. $(window).resize(function () {
  4477. if (window.innerWidth > 992) {
  4478. // Close menu if window is resized bigger than 992 and user has fixed sidenav
  4479. if ($('#sidenav-overlay').length !== 0 && menuOut) {
  4480. removeMenu(true);
  4481. } else {
  4482. // menu.removeAttr('style');
  4483. menu.css('transform', 'translateX(0%)'); // menu.css('width', options.menuWidth);
  4484. }
  4485. } else if (menuOut === false) {
  4486. if (options.edge === 'left') {
  4487. menu.css('transform', 'translateX(-100%)');
  4488. } else {
  4489. menu.css('transform', 'translateX(100%)');
  4490. }
  4491. }
  4492. });
  4493. } // if closeOnClick, then add close event for all a tags in side sideNav
  4494. if (options.closeOnClick === true) {
  4495. menu.on("click.itemclick", "a:not(.collapsible-header)", function () {
  4496. if (!(window.innerWidth > 992 && menu.hasClass('fixed'))) {
  4497. removeMenu();
  4498. }
  4499. });
  4500. }
  4501. var removeMenu = function removeMenu(restoreNav) {
  4502. panning = false;
  4503. menuOut = false; // Reenable scrolling
  4504. $('body').css({
  4505. overflow: '',
  4506. width: ''
  4507. });
  4508. $('#sidenav-overlay').velocity({
  4509. opacity: 0
  4510. }, {
  4511. duration: 200,
  4512. queue: false,
  4513. easing: 'easeOutQuad',
  4514. complete: function complete() {
  4515. $(this).remove();
  4516. }
  4517. });
  4518. if (options.edge === 'left') {
  4519. // Reset phantom div
  4520. $dragTarget.css({
  4521. width: '',
  4522. right: '',
  4523. left: '0'
  4524. });
  4525. menu.velocity({
  4526. 'translateX': '-100%'
  4527. }, {
  4528. duration: 200,
  4529. queue: false,
  4530. easing: 'easeOutCubic',
  4531. complete: function complete() {
  4532. if (restoreNav === true) {
  4533. // Restore Fixed sidenav
  4534. menu.removeAttr('style');
  4535. menu.css('width', options.menuWidth);
  4536. }
  4537. }
  4538. });
  4539. } else {
  4540. // Reset phantom div
  4541. $dragTarget.css({
  4542. width: '',
  4543. right: '0',
  4544. left: ''
  4545. });
  4546. menu.velocity({
  4547. 'translateX': '100%'
  4548. }, {
  4549. duration: 200,
  4550. queue: false,
  4551. easing: 'easeOutCubic',
  4552. complete: function complete() {
  4553. if (restoreNav === true) {
  4554. // Restore Fixed sidenav
  4555. menu.removeAttr('style');
  4556. menu.css('width', options.menuWidth);
  4557. }
  4558. }
  4559. });
  4560. } // Callback
  4561. if (typeof options.onClose === 'function') {
  4562. options.onClose.call(this, menu);
  4563. }
  4564. }; // Touch Event
  4565. var panning = false;
  4566. var menuOut = false;
  4567. if (options.draggable) {
  4568. $dragTarget.on('click', function () {
  4569. if (menuOut) {
  4570. removeMenu();
  4571. }
  4572. });
  4573. $dragTarget.hammer({
  4574. prevent_default: false
  4575. }).on('pan', function (e) {
  4576. if (e.gesture.pointerType == "touch") {
  4577. var direction = e.gesture.direction;
  4578. var x = e.gesture.center.x;
  4579. var y = e.gesture.center.y;
  4580. var velocityX = e.gesture.velocityX; // Vertical scroll bugfix
  4581. if (x === 0 && y === 0) {
  4582. return;
  4583. } // Disable Scrolling
  4584. var $body = $('body');
  4585. var $overlay = $('#sidenav-overlay');
  4586. var oldWidth = $body.innerWidth();
  4587. $body.css('overflow', 'hidden');
  4588. $body.width(oldWidth); // If overlay does not exist, create one and if it is clicked, close menu
  4589. if ($overlay.length === 0) {
  4590. $overlay = $('<div id="sidenav-overlay"></div>');
  4591. $overlay.css('opacity', 0).click(function () {
  4592. removeMenu();
  4593. }); // Run 'onOpen' when sidenav is opened via touch/swipe if applicable
  4594. if (typeof options.onOpen === 'function') {
  4595. options.onOpen.call(this, menu);
  4596. }
  4597. $('body').append($overlay);
  4598. } // Keep within boundaries
  4599. if (options.edge === 'left') {
  4600. if (x > options.menuWidth) {
  4601. x = options.menuWidth;
  4602. } else if (x < 0) {
  4603. x = 0;
  4604. }
  4605. }
  4606. if (options.edge === 'left') {
  4607. // Left Direction
  4608. if (x < options.menuWidth / 2) {
  4609. menuOut = false;
  4610. } // Right Direction
  4611. else if (x >= options.menuWidth / 2) {
  4612. menuOut = true;
  4613. }
  4614. menu.css('transform', 'translateX(' + (x - options.menuWidth) + 'px)');
  4615. } else {
  4616. // Left Direction
  4617. if (x < window.innerWidth - options.menuWidth / 2) {
  4618. menuOut = true;
  4619. } // Right Direction
  4620. else if (x >= window.innerWidth - options.menuWidth / 2) {
  4621. menuOut = false;
  4622. }
  4623. var rightPos = x - options.menuWidth / 2;
  4624. if (rightPos < 0) {
  4625. rightPos = 0;
  4626. }
  4627. menu.css('transform', 'translateX(' + rightPos + 'px)');
  4628. } // Percentage overlay
  4629. var overlayPerc;
  4630. if (options.edge === 'left') {
  4631. overlayPerc = x / options.menuWidth;
  4632. $overlay.velocity({
  4633. opacity: overlayPerc
  4634. }, {
  4635. duration: 10,
  4636. queue: false,
  4637. easing: 'easeOutQuad'
  4638. });
  4639. } else {
  4640. overlayPerc = Math.abs((x - window.innerWidth) / options.menuWidth);
  4641. $overlay.velocity({
  4642. opacity: overlayPerc
  4643. }, {
  4644. duration: 10,
  4645. queue: false,
  4646. easing: 'easeOutQuad'
  4647. });
  4648. }
  4649. }
  4650. }).on('panend', function (e) {
  4651. if (e.gesture.pointerType == "touch") {
  4652. var $overlay = $('#sidenav-overlay');
  4653. var velocityX = e.gesture.velocityX;
  4654. var x = e.gesture.center.x;
  4655. var leftPos = x - options.menuWidth;
  4656. var rightPos = x - options.menuWidth / 2;
  4657. if (leftPos > 0) {
  4658. leftPos = 0;
  4659. }
  4660. if (rightPos < 0) {
  4661. rightPos = 0;
  4662. }
  4663. panning = false;
  4664. if (options.edge === 'left') {
  4665. // If velocityX <= 0.3 then the user is flinging the menu closed so ignore menuOut
  4666. if (menuOut && velocityX <= 0.3 || velocityX < -0.5) {
  4667. // Return menu to open
  4668. if (leftPos !== 0) {
  4669. menu.velocity({
  4670. 'translateX': [0, leftPos]
  4671. }, {
  4672. duration: 300,
  4673. queue: false,
  4674. easing: 'easeOutQuad'
  4675. });
  4676. }
  4677. $overlay.velocity({
  4678. opacity: 1
  4679. }, {
  4680. duration: 50,
  4681. queue: false,
  4682. easing: 'easeOutQuad'
  4683. });
  4684. $dragTarget.css({
  4685. width: '50%',
  4686. right: 0,
  4687. left: ''
  4688. });
  4689. menuOut = true;
  4690. } else if (!menuOut || velocityX > 0.3) {
  4691. // Enable Scrolling
  4692. $('body').css({
  4693. overflow: '',
  4694. width: ''
  4695. }); // Slide menu closed
  4696. menu.velocity({
  4697. 'translateX': [-1 * options.menuWidth - 10, leftPos]
  4698. }, {
  4699. duration: 200,
  4700. queue: false,
  4701. easing: 'easeOutQuad'
  4702. });
  4703. $overlay.velocity({
  4704. opacity: 0
  4705. }, {
  4706. duration: 200,
  4707. queue: false,
  4708. easing: 'easeOutQuad',
  4709. complete: function complete() {
  4710. // Run 'onClose' when sidenav is closed via touch/swipe if applicable
  4711. if (typeof options.onClose === 'function') {
  4712. options.onClose.call(this, menu);
  4713. }
  4714. $(this).remove();
  4715. }
  4716. });
  4717. $dragTarget.css({
  4718. width: '10px',
  4719. right: '',
  4720. left: 0
  4721. });
  4722. }
  4723. } else {
  4724. if (menuOut && velocityX >= -0.3 || velocityX > 0.5) {
  4725. // Return menu to open
  4726. if (rightPos !== 0) {
  4727. menu.velocity({
  4728. 'translateX': [0, rightPos]
  4729. }, {
  4730. duration: 300,
  4731. queue: false,
  4732. easing: 'easeOutQuad'
  4733. });
  4734. }
  4735. $overlay.velocity({
  4736. opacity: 1
  4737. }, {
  4738. duration: 50,
  4739. queue: false,
  4740. easing: 'easeOutQuad'
  4741. });
  4742. $dragTarget.css({
  4743. width: '50%',
  4744. right: '',
  4745. left: 0
  4746. });
  4747. menuOut = true;
  4748. } else if (!menuOut || velocityX < -0.3) {
  4749. // Enable Scrolling
  4750. $('body').css({
  4751. overflow: '',
  4752. width: ''
  4753. }); // Slide menu closed
  4754. menu.velocity({
  4755. 'translateX': [options.menuWidth + 10, rightPos]
  4756. }, {
  4757. duration: 200,
  4758. queue: false,
  4759. easing: 'easeOutQuad'
  4760. });
  4761. $overlay.velocity({
  4762. opacity: 0
  4763. }, {
  4764. duration: 200,
  4765. queue: false,
  4766. easing: 'easeOutQuad',
  4767. complete: function complete() {
  4768. // Run 'onClose' when sidenav is closed via touch/swipe if applicable
  4769. if (typeof options.onClose === 'function') {
  4770. options.onClose.call(this, menu);
  4771. }
  4772. $(this).remove();
  4773. }
  4774. });
  4775. $dragTarget.css({
  4776. width: '10px',
  4777. right: 0,
  4778. left: ''
  4779. });
  4780. }
  4781. }
  4782. }
  4783. });
  4784. }
  4785. $this.off('click.sidenav').on('click.sidenav', function () {
  4786. if (menuOut === true) {
  4787. menuOut = false;
  4788. panning = false;
  4789. removeMenu();
  4790. } else {
  4791. // Disable Scrolling
  4792. var $body = $('body');
  4793. var $overlay = $('<div id="sidenav-overlay"></div>');
  4794. var oldWidth = $body.innerWidth();
  4795. $body.css('overflow', 'hidden');
  4796. $body.width(oldWidth); // Push current drag target on top of DOM tree
  4797. $('body').append($dragTarget);
  4798. if (options.edge === 'left') {
  4799. $dragTarget.css({
  4800. width: '50%',
  4801. right: 0,
  4802. left: ''
  4803. });
  4804. menu.velocity({
  4805. 'translateX': [0, -1 * options.menuWidth]
  4806. }, {
  4807. duration: 300,
  4808. queue: false,
  4809. easing: 'easeOutQuad'
  4810. });
  4811. } else {
  4812. $dragTarget.css({
  4813. width: '50%',
  4814. right: '',
  4815. left: 0
  4816. });
  4817. menu.velocity({
  4818. 'translateX': [0, options.menuWidth]
  4819. }, {
  4820. duration: 300,
  4821. queue: false,
  4822. easing: 'easeOutQuad'
  4823. });
  4824. } // Overlay close on click
  4825. $overlay.css('opacity', 0).click(function () {
  4826. menuOut = false;
  4827. panning = false;
  4828. removeMenu();
  4829. $overlay.velocity({
  4830. opacity: 0
  4831. }, {
  4832. duration: 300,
  4833. queue: false,
  4834. easing: 'easeOutQuad',
  4835. complete: function complete() {
  4836. $(this).remove();
  4837. }
  4838. });
  4839. }); // Append body
  4840. $('body').append($overlay);
  4841. $overlay.velocity({
  4842. opacity: 1
  4843. }, {
  4844. duration: 300,
  4845. queue: false,
  4846. easing: 'easeOutQuad',
  4847. complete: function complete() {
  4848. menuOut = true;
  4849. panning = false;
  4850. }
  4851. }); // Callback
  4852. if (typeof options.onOpen === 'function') {
  4853. options.onOpen.call(this, menu);
  4854. }
  4855. }
  4856. return false;
  4857. });
  4858. });
  4859. },
  4860. destroy: function destroy() {
  4861. var $overlay = $('#sidenav-overlay');
  4862. var $dragTarget = $('.drag-target[data-sidenav="' + $(this).attr('data-activates') + '"]');
  4863. $overlay.trigger('click');
  4864. $dragTarget.remove();
  4865. $(this).off('click');
  4866. $overlay.remove();
  4867. },
  4868. show: function show() {
  4869. this.trigger('click');
  4870. },
  4871. hide: function hide() {
  4872. $('#sidenav-overlay').trigger('click');
  4873. }
  4874. };
  4875. $.fn.sideNav = function (methodOrOptions) {
  4876. if (methods[methodOrOptions]) {
  4877. return methods[methodOrOptions].apply(this, Array.prototype.slice.call(arguments, 1));
  4878. } else if (_typeof(methodOrOptions) === 'object' || !methodOrOptions) {
  4879. // Default to "init"
  4880. return methods.init.apply(this, arguments);
  4881. } else {
  4882. $.error('Method ' + methodOrOptions + ' does not exist on jQuery.sideNav');
  4883. }
  4884. }; // Plugin end
  4885. })(jQuery);
  4886. ;
  4887. /**
  4888. * Extend jquery with a scrollspy plugin.
  4889. * This watches the window scroll and fires events when elements are scrolled into viewport.
  4890. *
  4891. * throttle() and getTime() taken from Underscore.js
  4892. * https://github.com/jashkenas/underscore
  4893. *
  4894. * @author Copyright 2013 John Smart
  4895. * @license https://raw.github.com/thesmart/jquery-scrollspy/master/LICENSE
  4896. * @see https://github.com/thesmart
  4897. * @version 0.1.2
  4898. */
  4899. (function ($) {
  4900. var jWindow = $(window);
  4901. var elements = [];
  4902. var elementsInView = [];
  4903. var isSpying = false;
  4904. var ticks = 0;
  4905. var unique_id = 1;
  4906. var offset = {
  4907. top: 0,
  4908. right: 0,
  4909. bottom: 0,
  4910. left: 0
  4911. /**
  4912. * Find elements that are within the boundary
  4913. * @param {number} top
  4914. * @param {number} right
  4915. * @param {number} bottom
  4916. * @param {number} left
  4917. * @return {jQuery} A collection of elements
  4918. */
  4919. };
  4920. function findElements(top, right, bottom, left) {
  4921. var hits = $();
  4922. $.each(elements, function (i, element) {
  4923. if (element.height() > 0) {
  4924. var elTop = element.offset().top,
  4925. elLeft = element.offset().left,
  4926. elRight = elLeft + element.width(),
  4927. elBottom = elTop + element.height();
  4928. var isIntersect = !(elLeft > right || elRight < left || elTop > bottom || elBottom < top);
  4929. if (isIntersect) {
  4930. hits.push(element);
  4931. }
  4932. }
  4933. });
  4934. return hits;
  4935. }
  4936. /**
  4937. * Called when the user scrolls the window
  4938. */
  4939. function onScroll(scrollOffset) {
  4940. // unique tick id
  4941. ++ticks; // viewport rectangle
  4942. var top = jWindow.scrollTop(),
  4943. left = jWindow.scrollLeft(),
  4944. right = left + jWindow.width(),
  4945. bottom = top + jWindow.height(); // determine which elements are in view
  4946. var intersections = findElements(top + offset.top + scrollOffset || 200, right + offset.right, bottom + offset.bottom, left + offset.left);
  4947. $.each(intersections, function (i, element) {
  4948. var lastTick = element.data('scrollSpy:ticks');
  4949. if (typeof lastTick != 'number') {
  4950. // entered into view
  4951. element.triggerHandler('scrollSpy:enter');
  4952. } // update tick id
  4953. element.data('scrollSpy:ticks', ticks);
  4954. }); // determine which elements are no longer in view
  4955. $.each(elementsInView, function (i, element) {
  4956. var lastTick = element.data('scrollSpy:ticks');
  4957. if (typeof lastTick == 'number' && lastTick !== ticks) {
  4958. // exited from view
  4959. element.triggerHandler('scrollSpy:exit');
  4960. element.data('scrollSpy:ticks', null);
  4961. }
  4962. }); // remember elements in view for next tick
  4963. elementsInView = intersections;
  4964. }
  4965. /**
  4966. * Called when window is resized
  4967. */
  4968. function onWinSize() {
  4969. jWindow.trigger('scrollSpy:winSize');
  4970. }
  4971. /**
  4972. * Enables ScrollSpy using a selector
  4973. * @param {jQuery|string} selector The elements collection, or a selector
  4974. * @param {Object=} options Optional.
  4975. throttle : number -> scrollspy throttling. Default: 100 ms
  4976. offsetTop : number -> offset from top. Default: 0
  4977. offsetRight : number -> offset from right. Default: 0
  4978. offsetBottom : number -> offset from bottom. Default: 0
  4979. offsetLeft : number -> offset from left. Default: 0
  4980. activeClass : string -> Class name to be added to the active link. Default: active
  4981. * @returns {jQuery}
  4982. */
  4983. $.scrollSpy = function (selector, options) {
  4984. var defaults = {
  4985. throttle: 100,
  4986. scrollOffset: 200,
  4987. // offset - 200 allows elements near bottom of page to scroll
  4988. activeClass: 'active',
  4989. getActiveElement: function getActiveElement(id) {
  4990. return 'a[href="#' + id + '"]';
  4991. }
  4992. };
  4993. options = $.extend(defaults, options);
  4994. var visible = [];
  4995. selector = $(selector);
  4996. selector.each(function (i, element) {
  4997. elements.push($(element));
  4998. $(element).data("scrollSpy:id", i); // Smooth scroll to section
  4999. $('a[href="#' + $(element).attr('id') + '"]').click(function (e) {
  5000. e.preventDefault();
  5001. var offset = $(Materialize.escapeHash(this.hash)).offset().top + 1;
  5002. $('html, body').animate({
  5003. scrollTop: offset - options.scrollOffset
  5004. }, {
  5005. duration: 400,
  5006. queue: false,
  5007. easing: 'easeOutCubic'
  5008. });
  5009. });
  5010. });
  5011. offset.top = options.offsetTop || 0;
  5012. offset.right = options.offsetRight || 0;
  5013. offset.bottom = options.offsetBottom || 0;
  5014. offset.left = options.offsetLeft || 0;
  5015. var throttledScroll = Materialize.throttle(function () {
  5016. onScroll(options.scrollOffset);
  5017. }, options.throttle || 100);
  5018. var readyScroll = function readyScroll() {
  5019. $(document).ready(throttledScroll);
  5020. };
  5021. if (!isSpying) {
  5022. jWindow.on('scroll', readyScroll);
  5023. jWindow.on('resize', readyScroll);
  5024. isSpying = true;
  5025. } // perform a scan once, after current execution context, and after dom is ready
  5026. setTimeout(readyScroll, 0);
  5027. selector.on('scrollSpy:enter', function () {
  5028. visible = $.grep(visible, function (value) {
  5029. return value.height() != 0;
  5030. });
  5031. var $this = $(this);
  5032. if (visible[0]) {
  5033. $(options.getActiveElement(visible[0].attr('id'))).removeClass(options.activeClass);
  5034. if ($this.data('scrollSpy:id') < visible[0].data('scrollSpy:id')) {
  5035. visible.unshift($(this));
  5036. } else {
  5037. visible.push($(this));
  5038. }
  5039. } else {
  5040. visible.push($(this));
  5041. }
  5042. $(options.getActiveElement(visible[0].attr('id'))).addClass(options.activeClass);
  5043. });
  5044. selector.on('scrollSpy:exit', function () {
  5045. visible = $.grep(visible, function (value) {
  5046. return value.height() != 0;
  5047. });
  5048. if (visible[0]) {
  5049. $(options.getActiveElement(visible[0].attr('id'))).removeClass(options.activeClass);
  5050. var $this = $(this);
  5051. visible = $.grep(visible, function (value) {
  5052. return value.attr('id') != $this.attr('id');
  5053. });
  5054. if (visible[0]) {
  5055. // Check if empty
  5056. $(options.getActiveElement(visible[0].attr('id'))).addClass(options.activeClass);
  5057. }
  5058. }
  5059. });
  5060. return selector;
  5061. };
  5062. /**
  5063. * Listen for window resize events
  5064. * @param {Object=} options Optional. Set { throttle: number } to change throttling. Default: 100 ms
  5065. * @returns {jQuery} $(window)
  5066. */
  5067. $.winSizeSpy = function (options) {
  5068. $.winSizeSpy = function () {
  5069. return jWindow;
  5070. }; // lock from multiple calls
  5071. options = options || {
  5072. throttle: 100
  5073. };
  5074. return jWindow.on('resize', Materialize.throttle(onWinSize, options.throttle || 100));
  5075. };
  5076. /**
  5077. * Enables ScrollSpy on a collection of elements
  5078. * e.g. $('.scrollSpy').scrollSpy()
  5079. * @param {Object=} options Optional.
  5080. throttle : number -> scrollspy throttling. Default: 100 ms
  5081. offsetTop : number -> offset from top. Default: 0
  5082. offsetRight : number -> offset from right. Default: 0
  5083. offsetBottom : number -> offset from bottom. Default: 0
  5084. offsetLeft : number -> offset from left. Default: 0
  5085. * @returns {jQuery}
  5086. */
  5087. $.fn.scrollSpy = function (options) {
  5088. return $.scrollSpy($(this), options);
  5089. };
  5090. })(jQuery);
  5091. ;
  5092. (function ($) {
  5093. $(document).ready(function () {
  5094. // Function to update labels of text fields
  5095. Materialize.updateTextFields = function () {
  5096. 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';
  5097. $(input_selector).each(function (index, element) {
  5098. var $this = $(this);
  5099. if ($(element).val().length > 0 || $(element).is(':focus') || element.autofocus || $this.attr('placeholder') !== undefined) {
  5100. $this.siblings('label').addClass('active');
  5101. } else if ($(element)[0].validity) {
  5102. $this.siblings('label').toggleClass('active', $(element)[0].validity.badInput === true);
  5103. } else {
  5104. $this.siblings('label').removeClass('active');
  5105. }
  5106. });
  5107. }; // Text based inputs
  5108. 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'; // Add active if form auto complete
  5109. $(document).on('change', input_selector, function () {
  5110. if ($(this).val().length !== 0 || $(this).attr('placeholder') !== undefined) {
  5111. $(this).siblings('label').addClass('active');
  5112. }
  5113. validate_field($(this));
  5114. }); // Add active if input element has been pre-populated on document ready
  5115. $(document).ready(function () {
  5116. Materialize.updateTextFields();
  5117. }); // HTML DOM FORM RESET handling
  5118. $(document).on('reset', function (e) {
  5119. var formReset = $(e.target);
  5120. if (formReset.is('form')) {
  5121. formReset.find(input_selector).removeClass('valid').removeClass('invalid');
  5122. formReset.find(input_selector).each(function () {
  5123. if ($(this).attr('value') === '') {
  5124. $(this).siblings('label').removeClass('active');
  5125. }
  5126. }); // Reset select
  5127. formReset.find('select.initialized').each(function () {
  5128. var reset_text = formReset.find('option[selected]').text();
  5129. formReset.siblings('input.select-dropdown').val(reset_text);
  5130. });
  5131. }
  5132. }); // Add active when element has focus
  5133. $(document).on('focus', input_selector, function () {
  5134. $(this).siblings('label, .prefix').addClass('active');
  5135. });
  5136. $(document).on('blur', input_selector, function () {
  5137. var $inputElement = $(this);
  5138. var selector = ".prefix";
  5139. if ($inputElement.val().length === 0 && $inputElement[0].validity.badInput !== true && $inputElement.attr('placeholder') === undefined) {
  5140. selector += ", label";
  5141. }
  5142. $inputElement.siblings(selector).removeClass('active');
  5143. validate_field($inputElement);
  5144. });
  5145. window.validate_field = function (object) {
  5146. var hasLength = object.attr('data-length') !== undefined;
  5147. var lenAttr = parseInt(object.attr('data-length'));
  5148. var len = object.val().length;
  5149. if (object.val().length === 0 && object[0].validity.badInput === false && !object.is(':required')) {
  5150. if (object.hasClass('validate')) {
  5151. object.removeClass('valid');
  5152. object.removeClass('invalid');
  5153. }
  5154. } else {
  5155. if (object.hasClass('validate')) {
  5156. // Check for character counter attributes
  5157. if (object.is(':valid') && hasLength && len <= lenAttr || object.is(':valid') && !hasLength) {
  5158. object.removeClass('invalid');
  5159. object.addClass('valid');
  5160. } else {
  5161. object.removeClass('valid');
  5162. object.addClass('invalid');
  5163. }
  5164. }
  5165. }
  5166. }; // Radio and Checkbox focus class
  5167. var radio_checkbox = 'input[type=radio], input[type=checkbox]';
  5168. $(document).on('keyup.radio', radio_checkbox, function (e) {
  5169. // TAB, check if tabbing to radio or checkbox.
  5170. if (e.which === 9) {
  5171. $(this).addClass('tabbed');
  5172. var $this = $(this);
  5173. $this.one('blur', function (e) {
  5174. $(this).removeClass('tabbed');
  5175. });
  5176. return;
  5177. }
  5178. }); // Textarea Auto Resize
  5179. var hiddenDiv = $('.hiddendiv').first();
  5180. if (!hiddenDiv.length) {
  5181. hiddenDiv = $('<div class="hiddendiv common"></div>');
  5182. $('body').append(hiddenDiv);
  5183. }
  5184. var text_area_selector = '.materialize-textarea';
  5185. function textareaAutoResize($textarea) {
  5186. // Set font properties of hiddenDiv
  5187. var fontFamily = $textarea.css('font-family');
  5188. var fontSize = $textarea.css('font-size');
  5189. var lineHeight = $textarea.css('line-height');
  5190. var padding = $textarea.css('padding');
  5191. if (fontSize) {
  5192. hiddenDiv.css('font-size', fontSize);
  5193. }
  5194. if (fontFamily) {
  5195. hiddenDiv.css('font-family', fontFamily);
  5196. }
  5197. if (lineHeight) {
  5198. hiddenDiv.css('line-height', lineHeight);
  5199. }
  5200. if (padding) {
  5201. hiddenDiv.css('padding', padding);
  5202. } // Set original-height, if none
  5203. if (!$textarea.data('original-height')) {
  5204. $textarea.data('original-height', $textarea.height());
  5205. }
  5206. if ($textarea.attr('wrap') === 'off') {
  5207. hiddenDiv.css('overflow-wrap', 'normal').css('white-space', 'pre');
  5208. }
  5209. hiddenDiv.text($textarea.val() + '\n');
  5210. var content = hiddenDiv.html().replace(/\n/g, '<br>');
  5211. hiddenDiv.html(content); // When textarea is hidden, width goes crazy.
  5212. // Approximate with half of window size
  5213. if ($textarea.is(':visible')) {
  5214. hiddenDiv.css('width', $textarea.width());
  5215. } else {
  5216. hiddenDiv.css('width', $(window).width() / 2);
  5217. }
  5218. /**
  5219. * Resize if the new height is greater than the
  5220. * original height of the textarea
  5221. */
  5222. if ($textarea.data('original-height') <= hiddenDiv.height()) {
  5223. $textarea.css('height', hiddenDiv.height());
  5224. } else if ($textarea.val().length < $textarea.data('previous-length')) {
  5225. /**
  5226. * In case the new height is less than original height, it
  5227. * means the textarea has less text than before
  5228. * So we set the height to the original one
  5229. */
  5230. $textarea.css('height', $textarea.data('original-height'));
  5231. }
  5232. $textarea.data('previous-length', $textarea.val().length);
  5233. }
  5234. $(text_area_selector).each(function () {
  5235. var $textarea = $(this);
  5236. /**
  5237. * Instead of resizing textarea on document load,
  5238. * store the original height and the original length
  5239. */
  5240. $textarea.data('original-height', $textarea.height());
  5241. $textarea.data('previous-length', $textarea.val().length);
  5242. });
  5243. $('body').on('keyup keydown autoresize', text_area_selector, function () {
  5244. textareaAutoResize($(this));
  5245. }); // File Input Path
  5246. $(document).on('change', '.file-field input[type="file"]', function () {
  5247. var file_field = $(this).closest('.file-field');
  5248. var path_input = file_field.find('input.file-path');
  5249. var files = $(this)[0].files;
  5250. var file_names = [];
  5251. for (var i = 0; i < files.length; i++) {
  5252. file_names.push(files[i].name);
  5253. }
  5254. path_input.val(file_names.join(", "));
  5255. path_input.trigger('change');
  5256. });
  5257. /****************
  5258. * Range Input *
  5259. ****************/
  5260. var range_type = 'input[type=range]';
  5261. var range_mousedown = false;
  5262. var left;
  5263. $(range_type).each(function () {
  5264. var thumb = $('<span class="thumb"><span class="value"></span></span>');
  5265. $(this).after(thumb);
  5266. });
  5267. var showRangeBubble = function showRangeBubble(thumb) {
  5268. var paddingLeft = parseInt(thumb.parent().css('padding-left'));
  5269. var marginLeft = -7 + paddingLeft + 'px';
  5270. thumb.velocity({
  5271. height: "30px",
  5272. width: "30px",
  5273. top: "-30px",
  5274. marginLeft: marginLeft
  5275. }, {
  5276. duration: 300,
  5277. easing: 'easeOutExpo'
  5278. });
  5279. };
  5280. var calcRangeOffset = function calcRangeOffset(range) {
  5281. var width = range.width() - 15;
  5282. var max = parseFloat(range.attr('max'));
  5283. var min = parseFloat(range.attr('min'));
  5284. var percent = (parseFloat(range.val()) - min) / (max - min);
  5285. return percent * width;
  5286. };
  5287. var range_wrapper = '.range-field';
  5288. $(document).on('change', range_type, function (e) {
  5289. var thumb = $(this).siblings('.thumb');
  5290. thumb.find('.value').html($(this).val());
  5291. if (!thumb.hasClass('active')) {
  5292. showRangeBubble(thumb);
  5293. }
  5294. var offsetLeft = calcRangeOffset($(this));
  5295. thumb.addClass('active').css('left', offsetLeft);
  5296. });
  5297. $(document).on('mousedown touchstart', range_type, function (e) {
  5298. var thumb = $(this).siblings('.thumb'); // If thumb indicator does not exist yet, create it
  5299. if (thumb.length <= 0) {
  5300. thumb = $('<span class="thumb"><span class="value"></span></span>');
  5301. $(this).after(thumb);
  5302. } // Set indicator value
  5303. thumb.find('.value').html($(this).val());
  5304. range_mousedown = true;
  5305. $(this).addClass('active');
  5306. if (!thumb.hasClass('active')) {
  5307. showRangeBubble(thumb);
  5308. }
  5309. if (e.type !== 'input') {
  5310. var offsetLeft = calcRangeOffset($(this));
  5311. thumb.addClass('active').css('left', offsetLeft);
  5312. }
  5313. });
  5314. $(document).on('mouseup touchend', range_wrapper, function () {
  5315. range_mousedown = false;
  5316. $(this).removeClass('active');
  5317. });
  5318. $(document).on('input mousemove touchmove', range_wrapper, function (e) {
  5319. var thumb = $(this).children('.thumb');
  5320. var left;
  5321. var input = $(this).find(range_type);
  5322. if (range_mousedown) {
  5323. if (!thumb.hasClass('active')) {
  5324. showRangeBubble(thumb);
  5325. }
  5326. var offsetLeft = calcRangeOffset(input);
  5327. thumb.addClass('active').css('left', offsetLeft);
  5328. thumb.find('.value').html(thumb.siblings(range_type).val());
  5329. }
  5330. });
  5331. $(document).on('mouseout touchleave', range_wrapper, function () {
  5332. if (!range_mousedown) {
  5333. var thumb = $(this).children('.thumb');
  5334. var paddingLeft = parseInt($(this).css('padding-left'));
  5335. var marginLeft = 7 + paddingLeft + 'px';
  5336. if (thumb.hasClass('active')) {
  5337. thumb.velocity({
  5338. height: '0',
  5339. width: '0',
  5340. top: '10px',
  5341. marginLeft: marginLeft
  5342. }, {
  5343. duration: 100
  5344. });
  5345. }
  5346. thumb.removeClass('active');
  5347. }
  5348. });
  5349. /**************************
  5350. * Auto complete plugin *
  5351. *************************/
  5352. $.fn.autocomplete = function (options) {
  5353. // Defaults
  5354. var defaults = {
  5355. data: {},
  5356. limit: Infinity,
  5357. onAutocomplete: null,
  5358. minLength: 1
  5359. };
  5360. options = $.extend(defaults, options);
  5361. return this.each(function () {
  5362. var $input = $(this);
  5363. var data = options.data,
  5364. count = 0,
  5365. activeIndex = -1,
  5366. oldVal,
  5367. $inputDiv = $input.closest('.input-field'); // Div to append on
  5368. // Check if data isn't empty
  5369. if (!$.isEmptyObject(data)) {
  5370. var $autocomplete = $('<ul class="autocomplete-content dropdown-content"></ul>');
  5371. var $oldAutocomplete; // Append autocomplete element.
  5372. // Prevent double structure init.
  5373. if ($inputDiv.length) {
  5374. $oldAutocomplete = $inputDiv.children('.autocomplete-content.dropdown-content').first();
  5375. if (!$oldAutocomplete.length) {
  5376. $inputDiv.append($autocomplete); // Set ul in body
  5377. }
  5378. } else {
  5379. $oldAutocomplete = $input.next('.autocomplete-content.dropdown-content');
  5380. if (!$oldAutocomplete.length) {
  5381. $input.after($autocomplete);
  5382. }
  5383. }
  5384. if ($oldAutocomplete.length) {
  5385. $autocomplete = $oldAutocomplete;
  5386. } // Highlight partial match.
  5387. var highlight = function highlight(string, $el) {
  5388. var img = $el.find('img');
  5389. var matchStart = $el.text().toLowerCase().indexOf("" + string.toLowerCase() + ""),
  5390. matchEnd = matchStart + string.length - 1,
  5391. beforeMatch = $el.text().slice(0, matchStart),
  5392. matchText = $el.text().slice(matchStart, matchEnd + 1),
  5393. afterMatch = $el.text().slice(matchEnd + 1);
  5394. $el.html("<span>" + beforeMatch + "<span class='highlight'>" + matchText + "</span>" + afterMatch + "</span>");
  5395. if (img.length) {
  5396. $el.prepend(img);
  5397. }
  5398. }; // Reset current element position
  5399. var resetCurrentElement = function resetCurrentElement() {
  5400. activeIndex = -1;
  5401. $autocomplete.find('.active').removeClass('active');
  5402. }; // Remove autocomplete elements
  5403. var removeAutocomplete = function removeAutocomplete() {
  5404. $autocomplete.empty();
  5405. resetCurrentElement();
  5406. oldVal = undefined;
  5407. };
  5408. $input.off('blur.autocomplete').on('blur.autocomplete', function () {
  5409. removeAutocomplete();
  5410. }); // Perform search
  5411. $input.off('keyup.autocomplete focus.autocomplete').on('keyup.autocomplete focus.autocomplete', function (e) {
  5412. // Reset count.
  5413. count = 0;
  5414. var val = $input.val().toLowerCase(); // Don't capture enter or arrow key usage.
  5415. if (e.which === 13 || e.which === 38 || e.which === 40) {
  5416. return;
  5417. } // Check if the input isn't empty
  5418. if (oldVal !== val) {
  5419. removeAutocomplete();
  5420. if (val.length >= options.minLength) {
  5421. for (var key in data) {
  5422. if (data.hasOwnProperty(key) && key.toLowerCase().indexOf(val) !== -1) {
  5423. // Break if past limit
  5424. if (count >= options.limit) {
  5425. break;
  5426. }
  5427. var autocompleteOption = $('<li></li>');
  5428. if (!!data[key]) {
  5429. autocompleteOption.append('<img src="' + data[key] + '" class="right circle"><span>' + key + '</span>');
  5430. } else {
  5431. autocompleteOption.append('<span>' + key + '</span>');
  5432. }
  5433. $autocomplete.append(autocompleteOption);
  5434. highlight(val, autocompleteOption);
  5435. count++;
  5436. }
  5437. }
  5438. }
  5439. } // Update oldVal
  5440. oldVal = val;
  5441. });
  5442. $input.off('keydown.autocomplete').on('keydown.autocomplete', function (e) {
  5443. // Arrow keys and enter key usage
  5444. var keyCode = e.which,
  5445. liElement,
  5446. numItems = $autocomplete.children('li').length,
  5447. $active = $autocomplete.children('.active').first(); // select element on Enter
  5448. if (keyCode === 13 && activeIndex >= 0) {
  5449. liElement = $autocomplete.children('li').eq(activeIndex);
  5450. if (liElement.length) {
  5451. liElement.trigger('mousedown.autocomplete');
  5452. e.preventDefault();
  5453. }
  5454. return;
  5455. } // Capture up and down key
  5456. if (keyCode === 38 || keyCode === 40) {
  5457. e.preventDefault();
  5458. if (keyCode === 38 && activeIndex > 0) {
  5459. activeIndex--;
  5460. }
  5461. if (keyCode === 40 && activeIndex < numItems - 1) {
  5462. activeIndex++;
  5463. }
  5464. $active.removeClass('active');
  5465. if (activeIndex >= 0) {
  5466. $autocomplete.children('li').eq(activeIndex).addClass('active');
  5467. }
  5468. }
  5469. }); // Set input value
  5470. $autocomplete.off('mousedown.autocomplete touchstart.autocomplete').on('mousedown.autocomplete touchstart.autocomplete', 'li', function () {
  5471. var text = $(this).text().trim();
  5472. $input.val(text);
  5473. $input.trigger('change');
  5474. removeAutocomplete(); // Handle onAutocomplete callback.
  5475. if (typeof options.onAutocomplete === "function") {
  5476. options.onAutocomplete.call(this, text);
  5477. }
  5478. }); // Empty data
  5479. } else {
  5480. $input.off('keyup.autocomplete focus.autocomplete');
  5481. }
  5482. });
  5483. };
  5484. }); // End of $(document).ready
  5485. /*******************
  5486. * Select Plugin *
  5487. ******************/
  5488. $.fn.material_select = function (callback) {
  5489. $(this).each(function () {
  5490. var $select = $(this);
  5491. if ($select.hasClass('browser-default')) {
  5492. return; // Continue to next (return false breaks out of entire loop)
  5493. }
  5494. var multiple = $select.attr('multiple') ? true : false,
  5495. lastID = $select.attr('data-select-id'); // Tear down structure if Select needs to be rebuilt
  5496. if (lastID) {
  5497. $select.parent().find('span.caret').remove();
  5498. $select.parent().find('input').remove();
  5499. $select.unwrap();
  5500. $('ul#select-options-' + lastID).remove();
  5501. } // If destroying the select, remove the selelct-id and reset it to it's uninitialized state.
  5502. if (callback === 'destroy') {
  5503. $select.removeAttr('data-select-id').removeClass('initialized');
  5504. $(window).off('click.select');
  5505. return;
  5506. }
  5507. var uniqueID = Materialize.guid();
  5508. $select.attr('data-select-id', uniqueID);
  5509. var wrapper = $('<div class="select-wrapper"></div>');
  5510. wrapper.addClass($select.attr('class'));
  5511. if ($select.is(':disabled')) wrapper.addClass('disabled');
  5512. var options = $('<ul id="select-options-' + uniqueID + '" class="dropdown-content select-dropdown ' + (multiple ? 'multiple-select-dropdown' : '') + '"></ul>'),
  5513. selectChildren = $select.children('option, optgroup'),
  5514. valuesSelected = [],
  5515. optionsHover = false;
  5516. var label = $select.find('option:selected').html() || $select.find('option:first').html() || "";
  5517. var a = "disabled";
  5518. var a1 = $("#send_file")[0];
  5519. var a2 = $("#qiehuanbtn")[0];
  5520. var a3 = $("#send_string")[0];
  5521. var a4 = $("#uploadpy")[0];
  5522. if (label == CCB.str_group.no_port_option) {
  5523. if (a1.className.indexOf("disabled") != -1) {} else {
  5524. a1.className += a;
  5525. a2.className += a;
  5526. a3.className += a;
  5527. a4.className += a;
  5528. }
  5529. } else {
  5530. a1.className = a1.className.replace(a, "");
  5531. a2.className = a2.className.replace(a, "");
  5532. a3.className = a3.className.replace(a, "");
  5533. a4.className = a4.className.replace(a, "");
  5534. } // Function that renders and appends the option taking into
  5535. // account type and possible image icon.
  5536. var appendOptionWithIcon = function appendOptionWithIcon(select, option, type) {
  5537. // Add disabled attr if disabled
  5538. var disabledClass = option.is(':disabled') ? 'disabled ' : '';
  5539. var optgroupClass = type === 'optgroup-option' ? 'optgroup-option ' : '';
  5540. var multipleCheckbox = multiple ? '<input type="checkbox"' + disabledClass + '/><label></label>' : ''; // add icons
  5541. var icon_url = option.data('icon');
  5542. var classes = option.attr('class');
  5543. if (!!icon_url) {
  5544. var classString = '';
  5545. if (!!classes) classString = ' class="' + classes + '"'; // Check for multiple type.
  5546. options.append($('<li class="' + disabledClass + optgroupClass + '"><img alt="" src="' + icon_url + '"' + classString + '><span>' + multipleCheckbox + option.html() + '</span></li>'));
  5547. return true;
  5548. } // Check for multiple type.
  5549. options.append($('<li class="' + disabledClass + optgroupClass + '"><span>' + multipleCheckbox + option.html() + '</span></li>'));
  5550. };
  5551. /* Create dropdown structure. */
  5552. if (selectChildren.length) {
  5553. selectChildren.each(function () {
  5554. if ($(this).is('option')) {
  5555. // Direct descendant option.
  5556. if (multiple) {
  5557. appendOptionWithIcon($select, $(this), 'multiple');
  5558. } else {
  5559. appendOptionWithIcon($select, $(this));
  5560. }
  5561. } else if ($(this).is('optgroup')) {
  5562. // Optgroup.
  5563. var selectOptions = $(this).children('option');
  5564. options.append($('<li class="optgroup"><span>' + $(this).attr('label') + '</span></li>'));
  5565. selectOptions.each(function () {
  5566. appendOptionWithIcon($select, $(this), 'optgroup-option');
  5567. });
  5568. }
  5569. });
  5570. }
  5571. options.find('li:not(.optgroup)').each(function (i) {
  5572. $(this).click(function (e) {
  5573. // Check if option element is disabled
  5574. if (!$(this).hasClass('disabled') && !$(this).hasClass('optgroup')) {
  5575. var selected = true;
  5576. if (multiple) {
  5577. $('input[type="checkbox"]', this).prop('checked', function (i, v) {
  5578. return !v;
  5579. });
  5580. selected = toggleEntryFromArray(valuesSelected, i, $select);
  5581. $newSelect.trigger('focus');
  5582. } else {
  5583. options.find('li').removeClass('active');
  5584. $(this).toggleClass('active');
  5585. $newSelect.val($(this).text());
  5586. }
  5587. activateOption(options, $(this));
  5588. $select.find('option').eq(i).prop('selected', selected); // Trigger onchange() event
  5589. $select.trigger('change');
  5590. if (typeof callback !== 'undefined') callback();
  5591. }
  5592. e.stopPropagation();
  5593. });
  5594. }); // Wrap Elements
  5595. $select.wrap(wrapper); // Add Select Display Element
  5596. var dropdownIcon = $('<span class="caret">&#9660;</span>'); // escape double quotes
  5597. var sanitizedLabelHtml = label.replace(/"/g, '&quot;');
  5598. var $newSelect = $('<input type="text" class="select-dropdown" readonly="true" ' + ($select.is(':disabled') ? 'disabled' : '') + ' data-activates="select-options-' + uniqueID + '" value="' + sanitizedLabelHtml + '"/>');
  5599. $select.before($newSelect);
  5600. $newSelect.before(dropdownIcon);
  5601. $newSelect.after(options); // Check if section element is disabled
  5602. if (!$select.is(':disabled')) {
  5603. $newSelect.dropdown({
  5604. 'hover': false
  5605. });
  5606. } // Copy tabindex
  5607. if ($select.attr('tabindex')) {
  5608. $($newSelect[0]).attr('tabindex', $select.attr('tabindex'));
  5609. }
  5610. $select.addClass('initialized');
  5611. $newSelect.on({
  5612. 'focus': function focus() {
  5613. if ($('ul.select-dropdown').not(options[0]).is(':visible')) {
  5614. $('input.select-dropdown').trigger('close');
  5615. $(window).off('click.select');
  5616. }
  5617. if (!options.is(':visible')) {
  5618. $(this).trigger('open', ['focus']);
  5619. var label = $(this).val();
  5620. if (multiple && label.indexOf(',') >= 0) {
  5621. label = label.split(',')[0];
  5622. }
  5623. var selectedOption = options.find('li').filter(function () {
  5624. return $(this).text().toLowerCase() === label.toLowerCase();
  5625. })[0];
  5626. activateOption(options, selectedOption, true);
  5627. $(window).off('click.select').on('click.select', function () {
  5628. multiple && (optionsHover || $newSelect.trigger('close'));
  5629. $(window).off('click.select');
  5630. });
  5631. }
  5632. },
  5633. 'click': function click(e) {
  5634. e.stopPropagation();
  5635. }
  5636. });
  5637. $newSelect.on('blur', function () {
  5638. if (!multiple) {
  5639. $(this).trigger('close');
  5640. $(window).off('click.select');
  5641. }
  5642. options.find('li.selected').removeClass('selected');
  5643. });
  5644. options.hover(function () {
  5645. optionsHover = true;
  5646. }, function () {
  5647. optionsHover = false;
  5648. }); // Add initial multiple selections.
  5649. if (multiple) {
  5650. $select.find("option:selected:not(:disabled)").each(function () {
  5651. var index = this.index;
  5652. toggleEntryFromArray(valuesSelected, index, $select);
  5653. options.find("li:not(.optgroup)").eq(index).find(":checkbox").prop("checked", true);
  5654. });
  5655. }
  5656. /**
  5657. * Make option as selected and scroll to selected position
  5658. * @param {jQuery} collection Select options jQuery element
  5659. * @param {Element} newOption element of the new option
  5660. * @param {Boolean} firstActivation If on first activation of select
  5661. */
  5662. var activateOption = function activateOption(collection, newOption, firstActivation) {
  5663. if (newOption) {
  5664. collection.find('li.selected').removeClass('selected');
  5665. var option = $(newOption);
  5666. option.addClass('selected');
  5667. if (!multiple || !!firstActivation) {
  5668. options.scrollTo(option);
  5669. }
  5670. }
  5671. }; // Allow user to search by typing
  5672. // this array is cleared after 1 second
  5673. var filterQuery = [],
  5674. onKeyDown = function onKeyDown(e) {
  5675. // TAB - switch to another input
  5676. if (e.which == 9) {
  5677. $newSelect.trigger('close');
  5678. return;
  5679. } // ARROW DOWN WHEN SELECT IS CLOSED - open select options
  5680. if (e.which == 40 && !options.is(':visible')) {
  5681. $newSelect.trigger('open');
  5682. return;
  5683. } // ENTER WHEN SELECT IS CLOSED - submit form
  5684. if (e.which == 13 && !options.is(':visible')) {
  5685. return;
  5686. }
  5687. e.preventDefault(); // CASE WHEN USER TYPE LETTERS
  5688. var letter = String.fromCharCode(e.which).toLowerCase(),
  5689. nonLetters = [9, 13, 27, 38, 40];
  5690. if (letter && nonLetters.indexOf(e.which) === -1) {
  5691. filterQuery.push(letter);
  5692. var string = filterQuery.join(''),
  5693. newOption = options.find('li').filter(function () {
  5694. return $(this).text().toLowerCase().indexOf(string) === 0;
  5695. })[0];
  5696. if (newOption) {
  5697. activateOption(options, newOption);
  5698. }
  5699. } // ENTER - select option and close when select options are opened
  5700. if (e.which == 13) {
  5701. var activeOption = options.find('li.selected:not(.disabled)')[0];
  5702. if (activeOption) {
  5703. $(activeOption).trigger('click');
  5704. if (!multiple) {
  5705. $newSelect.trigger('close');
  5706. }
  5707. }
  5708. } // ARROW DOWN - move to next not disabled option
  5709. if (e.which == 40) {
  5710. if (options.find('li.selected').length) {
  5711. newOption = options.find('li.selected').next('li:not(.disabled)')[0];
  5712. } else {
  5713. newOption = options.find('li:not(.disabled)')[0];
  5714. }
  5715. activateOption(options, newOption);
  5716. } // ESC - close options
  5717. if (e.which == 27) {
  5718. $newSelect.trigger('close');
  5719. } // ARROW UP - move to previous not disabled option
  5720. if (e.which == 38) {
  5721. newOption = options.find('li.selected').prev('li:not(.disabled)')[0];
  5722. if (newOption) activateOption(options, newOption);
  5723. } // Automaticaly clean filter query so user can search again by starting letters
  5724. setTimeout(function () {
  5725. filterQuery = [];
  5726. }, 1000);
  5727. };
  5728. $newSelect.on('keydown', onKeyDown);
  5729. });
  5730. function toggleEntryFromArray(entriesArray, entryIndex, select) {
  5731. var index = entriesArray.indexOf(entryIndex),
  5732. notAdded = index === -1;
  5733. if (notAdded) {
  5734. entriesArray.push(entryIndex);
  5735. } else {
  5736. entriesArray.splice(index, 1);
  5737. }
  5738. select.siblings('ul.dropdown-content').find('li:not(.optgroup)').eq(entryIndex).toggleClass('active'); // use notAdded instead of true (to detect if the option is selected or not)
  5739. select.find('option').eq(entryIndex).prop('selected', notAdded);
  5740. setValueToInput(entriesArray, select);
  5741. return notAdded;
  5742. }
  5743. function setValueToInput(entriesArray, select) {
  5744. var value = '';
  5745. for (var i = 0, count = entriesArray.length; i < count; i++) {
  5746. var text = select.find('option').eq(entriesArray[i]).text();
  5747. i === 0 ? value += text : value += ', ' + text;
  5748. }
  5749. if (value === '') {
  5750. value = select.find('option:disabled').eq(0).text();
  5751. }
  5752. select.siblings('input.select-dropdown').val(value);
  5753. }
  5754. };
  5755. })(jQuery);
  5756. ;
  5757. (function ($) {
  5758. var methods = {
  5759. init: function init(options) {
  5760. var defaults = {
  5761. indicators: true,
  5762. height: 400,
  5763. transition: 500,
  5764. interval: 6000
  5765. };
  5766. options = $.extend(defaults, options);
  5767. return this.each(function () {
  5768. // For each slider, we want to keep track of
  5769. // which slide is active and its associated content
  5770. var $this = $(this);
  5771. var $slider = $this.find('ul.slides').first();
  5772. var $slides = $slider.find('> li');
  5773. var $active_index = $slider.find('.active').index();
  5774. var $active, $indicators, $interval;
  5775. if ($active_index != -1) {
  5776. $active = $slides.eq($active_index);
  5777. } // Transitions the caption depending on alignment
  5778. function captionTransition(caption, duration) {
  5779. if (caption.hasClass("center-align")) {
  5780. caption.velocity({
  5781. opacity: 0,
  5782. translateY: -100
  5783. }, {
  5784. duration: duration,
  5785. queue: false
  5786. });
  5787. } else if (caption.hasClass("right-align")) {
  5788. caption.velocity({
  5789. opacity: 0,
  5790. translateX: 100
  5791. }, {
  5792. duration: duration,
  5793. queue: false
  5794. });
  5795. } else if (caption.hasClass("left-align")) {
  5796. caption.velocity({
  5797. opacity: 0,
  5798. translateX: -100
  5799. }, {
  5800. duration: duration,
  5801. queue: false
  5802. });
  5803. }
  5804. } // This function will transition the slide to any index of the next slide
  5805. function moveToSlide(index) {
  5806. // Wrap around indices.
  5807. if (index >= $slides.length) index = 0;else if (index < 0) index = $slides.length - 1;
  5808. $active_index = $slider.find('.active').index(); // Only do if index changes
  5809. if ($active_index != index) {
  5810. $active = $slides.eq($active_index);
  5811. $caption = $active.find('.caption');
  5812. $active.removeClass('active');
  5813. $active.velocity({
  5814. opacity: 0
  5815. }, {
  5816. duration: options.transition,
  5817. queue: false,
  5818. easing: 'easeOutQuad',
  5819. complete: function complete() {
  5820. $slides.not('.active').velocity({
  5821. opacity: 0,
  5822. translateX: 0,
  5823. translateY: 0
  5824. }, {
  5825. duration: 0,
  5826. queue: false
  5827. });
  5828. }
  5829. });
  5830. captionTransition($caption, options.transition); // Update indicators
  5831. if (options.indicators) {
  5832. $indicators.eq($active_index).removeClass('active');
  5833. }
  5834. $slides.eq(index).velocity({
  5835. opacity: 1
  5836. }, {
  5837. duration: options.transition,
  5838. queue: false,
  5839. easing: 'easeOutQuad'
  5840. });
  5841. $slides.eq(index).find('.caption').velocity({
  5842. opacity: 1,
  5843. translateX: 0,
  5844. translateY: 0
  5845. }, {
  5846. duration: options.transition,
  5847. delay: options.transition,
  5848. queue: false,
  5849. easing: 'easeOutQuad'
  5850. });
  5851. $slides.eq(index).addClass('active'); // Update indicators
  5852. if (options.indicators) {
  5853. $indicators.eq(index).addClass('active');
  5854. }
  5855. }
  5856. } // Set height of slider
  5857. // If fullscreen, do nothing
  5858. if (!$this.hasClass('fullscreen')) {
  5859. if (options.indicators) {
  5860. // Add height if indicators are present
  5861. $this.height(options.height + 40);
  5862. } else {
  5863. $this.height(options.height);
  5864. }
  5865. $slider.height(options.height);
  5866. } // Set initial positions of captions
  5867. $slides.find('.caption').each(function () {
  5868. captionTransition($(this), 0);
  5869. }); // Move img src into background-image
  5870. $slides.find('img').each(function () {
  5871. var placeholderBase64 = 'data:image/gif;base64,R0lGODlhAQABAIABAP///wAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';
  5872. if ($(this).attr('src') !== placeholderBase64) {
  5873. $(this).css('background-image', 'url("' + $(this).attr('src') + '")');
  5874. $(this).attr('src', placeholderBase64);
  5875. }
  5876. }); // dynamically add indicators
  5877. if (options.indicators) {
  5878. $indicators = $('<ul class="indicators"></ul>');
  5879. $slides.each(function (index) {
  5880. var $indicator = $('<li class="indicator-item"></li>'); // Handle clicks on indicators
  5881. $indicator.click(function () {
  5882. var $parent = $slider.parent();
  5883. var curr_index = $parent.find($(this)).index();
  5884. moveToSlide(curr_index); // reset interval
  5885. clearInterval($interval);
  5886. $interval = setInterval(function () {
  5887. $active_index = $slider.find('.active').index();
  5888. if ($slides.length == $active_index + 1) $active_index = 0; // loop to start
  5889. else $active_index += 1;
  5890. moveToSlide($active_index);
  5891. }, options.transition + options.interval);
  5892. });
  5893. $indicators.append($indicator);
  5894. });
  5895. $this.append($indicators);
  5896. $indicators = $this.find('ul.indicators').find('li.indicator-item');
  5897. }
  5898. if ($active) {
  5899. $active.show();
  5900. } else {
  5901. $slides.first().addClass('active').velocity({
  5902. opacity: 1
  5903. }, {
  5904. duration: options.transition,
  5905. queue: false,
  5906. easing: 'easeOutQuad'
  5907. });
  5908. $active_index = 0;
  5909. $active = $slides.eq($active_index); // Update indicators
  5910. if (options.indicators) {
  5911. $indicators.eq($active_index).addClass('active');
  5912. }
  5913. } // Adjust height to current slide
  5914. $active.find('img').each(function () {
  5915. $active.find('.caption').velocity({
  5916. opacity: 1,
  5917. translateX: 0,
  5918. translateY: 0
  5919. }, {
  5920. duration: options.transition,
  5921. queue: false,
  5922. easing: 'easeOutQuad'
  5923. });
  5924. }); // auto scroll
  5925. $interval = setInterval(function () {
  5926. $active_index = $slider.find('.active').index();
  5927. moveToSlide($active_index + 1);
  5928. }, options.transition + options.interval); // HammerJS, Swipe navigation
  5929. // Touch Event
  5930. var panning = false;
  5931. var swipeLeft = false;
  5932. var swipeRight = false;
  5933. $this.hammer({
  5934. prevent_default: false
  5935. }).on('pan', function (e) {
  5936. if (e.gesture.pointerType === "touch") {
  5937. // reset interval
  5938. clearInterval($interval);
  5939. var direction = e.gesture.direction;
  5940. var x = e.gesture.deltaX;
  5941. var velocityX = e.gesture.velocityX;
  5942. var velocityY = e.gesture.velocityY;
  5943. $curr_slide = $slider.find('.active');
  5944. if (Math.abs(velocityX) > Math.abs(velocityY)) {
  5945. $curr_slide.velocity({
  5946. translateX: x
  5947. }, {
  5948. duration: 50,
  5949. queue: false,
  5950. easing: 'easeOutQuad'
  5951. });
  5952. } // Swipe Left
  5953. if (direction === 4 && (x > $this.innerWidth() / 2 || velocityX < -0.65)) {
  5954. swipeRight = true;
  5955. } // Swipe Right
  5956. else if (direction === 2 && (x < -1 * $this.innerWidth() / 2 || velocityX > 0.65)) {
  5957. swipeLeft = true;
  5958. } // Make Slide Behind active slide visible
  5959. var next_slide;
  5960. if (swipeLeft) {
  5961. next_slide = $curr_slide.next();
  5962. if (next_slide.length === 0) {
  5963. next_slide = $slides.first();
  5964. }
  5965. next_slide.velocity({
  5966. opacity: 1
  5967. }, {
  5968. duration: 300,
  5969. queue: false,
  5970. easing: 'easeOutQuad'
  5971. });
  5972. }
  5973. if (swipeRight) {
  5974. next_slide = $curr_slide.prev();
  5975. if (next_slide.length === 0) {
  5976. next_slide = $slides.last();
  5977. }
  5978. next_slide.velocity({
  5979. opacity: 1
  5980. }, {
  5981. duration: 300,
  5982. queue: false,
  5983. easing: 'easeOutQuad'
  5984. });
  5985. }
  5986. }
  5987. }).on('panend', function (e) {
  5988. if (e.gesture.pointerType === "touch") {
  5989. $curr_slide = $slider.find('.active');
  5990. panning = false;
  5991. curr_index = $slider.find('.active').index();
  5992. if (!swipeRight && !swipeLeft || $slides.length <= 1) {
  5993. // Return to original spot
  5994. $curr_slide.velocity({
  5995. translateX: 0
  5996. }, {
  5997. duration: 300,
  5998. queue: false,
  5999. easing: 'easeOutQuad'
  6000. });
  6001. } else if (swipeLeft) {
  6002. moveToSlide(curr_index + 1);
  6003. $curr_slide.velocity({
  6004. translateX: -1 * $this.innerWidth()
  6005. }, {
  6006. duration: 300,
  6007. queue: false,
  6008. easing: 'easeOutQuad',
  6009. complete: function complete() {
  6010. $curr_slide.velocity({
  6011. opacity: 0,
  6012. translateX: 0
  6013. }, {
  6014. duration: 0,
  6015. queue: false
  6016. });
  6017. }
  6018. });
  6019. } else if (swipeRight) {
  6020. moveToSlide(curr_index - 1);
  6021. $curr_slide.velocity({
  6022. translateX: $this.innerWidth()
  6023. }, {
  6024. duration: 300,
  6025. queue: false,
  6026. easing: 'easeOutQuad',
  6027. complete: function complete() {
  6028. $curr_slide.velocity({
  6029. opacity: 0,
  6030. translateX: 0
  6031. }, {
  6032. duration: 0,
  6033. queue: false
  6034. });
  6035. }
  6036. });
  6037. }
  6038. swipeLeft = false;
  6039. swipeRight = false; // Restart interval
  6040. clearInterval($interval);
  6041. $interval = setInterval(function () {
  6042. $active_index = $slider.find('.active').index();
  6043. if ($slides.length == $active_index + 1) $active_index = 0; // loop to start
  6044. else $active_index += 1;
  6045. moveToSlide($active_index);
  6046. }, options.transition + options.interval);
  6047. }
  6048. });
  6049. $this.on('sliderPause', function () {
  6050. clearInterval($interval);
  6051. });
  6052. $this.on('sliderStart', function () {
  6053. clearInterval($interval);
  6054. $interval = setInterval(function () {
  6055. $active_index = $slider.find('.active').index();
  6056. if ($slides.length == $active_index + 1) $active_index = 0; // loop to start
  6057. else $active_index += 1;
  6058. moveToSlide($active_index);
  6059. }, options.transition + options.interval);
  6060. });
  6061. $this.on('sliderNext', function () {
  6062. $active_index = $slider.find('.active').index();
  6063. moveToSlide($active_index + 1);
  6064. });
  6065. $this.on('sliderPrev', function () {
  6066. $active_index = $slider.find('.active').index();
  6067. moveToSlide($active_index - 1);
  6068. });
  6069. });
  6070. },
  6071. pause: function pause() {
  6072. $(this).trigger('sliderPause');
  6073. },
  6074. start: function start() {
  6075. $(this).trigger('sliderStart');
  6076. },
  6077. next: function next() {
  6078. $(this).trigger('sliderNext');
  6079. },
  6080. prev: function prev() {
  6081. $(this).trigger('sliderPrev');
  6082. }
  6083. };
  6084. $.fn.slider = function (methodOrOptions) {
  6085. if (methods[methodOrOptions]) {
  6086. return methods[methodOrOptions].apply(this, Array.prototype.slice.call(arguments, 1));
  6087. } else if (_typeof(methodOrOptions) === 'object' || !methodOrOptions) {
  6088. // Default to "init"
  6089. return methods.init.apply(this, arguments);
  6090. } else {
  6091. $.error('Method ' + methodOrOptions + ' does not exist on jQuery.tooltip');
  6092. }
  6093. }; // Plugin end
  6094. })(jQuery);
  6095. ;
  6096. (function ($) {
  6097. $(document).ready(function () {
  6098. $(document).on('click.card', '.card', function (e) {
  6099. if ($(this).find('> .card-reveal').length) {
  6100. var $card = $(e.target).closest('.card');
  6101. if ($card.data('initialOverflow') === undefined) {
  6102. $card.data('initialOverflow', $card.css('overflow') === undefined ? '' : $card.css('overflow'));
  6103. }
  6104. if ($(e.target).is($('.card-reveal .card-title>i'))) {
  6105. // Make Reveal animate down and display none
  6106. $(this).find('.card-reveal').velocity({
  6107. translateY: 0
  6108. }, {
  6109. duration: 225,
  6110. queue: false,
  6111. easing: 'easeInOutQuad',
  6112. complete: function complete() {
  6113. $(this).css({
  6114. display: 'none'
  6115. });
  6116. $card.css('overflow', $card.data('initialOverflow'));
  6117. }
  6118. });
  6119. } else if ($(e.target).is($('.card .activator')) || $(e.target).is($('.card .activator i'))) {
  6120. $card.css('overflow', 'hidden');
  6121. $(this).find('.card-reveal').css({
  6122. display: 'block'
  6123. }).velocity("stop", false).velocity({
  6124. translateY: '-100%'
  6125. }, {
  6126. duration: 300,
  6127. queue: false,
  6128. easing: 'easeInOutQuad'
  6129. });
  6130. }
  6131. }
  6132. });
  6133. });
  6134. })(jQuery);
  6135. ;
  6136. (function ($) {
  6137. var materialChipsDefaults = {
  6138. data: [],
  6139. placeholder: '',
  6140. secondaryPlaceholder: '',
  6141. autocompleteOptions: {}
  6142. };
  6143. $(document).ready(function () {
  6144. // Handle removal of static chips.
  6145. $(document).on('click', '.chip .close', function (e) {
  6146. var $chips = $(this).closest('.chips');
  6147. if ($chips.attr('data-initialized')) {
  6148. return;
  6149. }
  6150. $(this).closest('.chip').remove();
  6151. });
  6152. });
  6153. $.fn.material_chip = function (options) {
  6154. var self = this;
  6155. this.$el = $(this);
  6156. this.$document = $(document);
  6157. this.SELS = {
  6158. CHIPS: '.chips',
  6159. CHIP: '.chip',
  6160. INPUT: 'input',
  6161. DELETE: '.material-icons',
  6162. SELECTED_CHIP: '.selected'
  6163. };
  6164. if ('data' === options) {
  6165. return this.$el.data('chips');
  6166. }
  6167. var curr_options = $.extend({}, materialChipsDefaults, options);
  6168. self.hasAutocomplete = !$.isEmptyObject(curr_options.autocompleteOptions.data); // Initialize
  6169. this.init = function () {
  6170. var i = 0;
  6171. var chips;
  6172. self.$el.each(function () {
  6173. var $chips = $(this);
  6174. var chipId = Materialize.guid();
  6175. self.chipId = chipId;
  6176. if (!curr_options.data || !(curr_options.data instanceof Array)) {
  6177. curr_options.data = [];
  6178. }
  6179. $chips.data('chips', curr_options.data);
  6180. $chips.attr('data-index', i);
  6181. $chips.attr('data-initialized', true);
  6182. if (!$chips.hasClass(self.SELS.CHIPS)) {
  6183. $chips.addClass('chips');
  6184. }
  6185. self.chips($chips, chipId);
  6186. i++;
  6187. });
  6188. };
  6189. this.handleEvents = function () {
  6190. var SELS = self.SELS;
  6191. self.$document.off('click.chips-focus', SELS.CHIPS).on('click.chips-focus', SELS.CHIPS, function (e) {
  6192. $(e.target).find(SELS.INPUT).focus();
  6193. });
  6194. self.$document.off('click.chips-select', SELS.CHIP).on('click.chips-select', SELS.CHIP, function (e) {
  6195. var $chip = $(e.target);
  6196. if ($chip.length) {
  6197. var wasSelected = $chip.hasClass('selected');
  6198. var $chips = $chip.closest(SELS.CHIPS);
  6199. $(SELS.CHIP).removeClass('selected');
  6200. if (!wasSelected) {
  6201. self.selectChip($chip.index(), $chips);
  6202. }
  6203. }
  6204. });
  6205. self.$document.off('keydown.chips').on('keydown.chips', function (e) {
  6206. if ($(e.target).is('input, textarea')) {
  6207. return;
  6208. } // delete
  6209. var $chip = self.$document.find(SELS.CHIP + SELS.SELECTED_CHIP);
  6210. var $chips = $chip.closest(SELS.CHIPS);
  6211. var length = $chip.siblings(SELS.CHIP).length;
  6212. var index;
  6213. if (!$chip.length) {
  6214. return;
  6215. }
  6216. if (e.which === 8 || e.which === 46) {
  6217. e.preventDefault();
  6218. index = $chip.index();
  6219. self.deleteChip(index, $chips);
  6220. var selectIndex = null;
  6221. if (index + 1 < length) {
  6222. selectIndex = index;
  6223. } else if (index === length || index + 1 === length) {
  6224. selectIndex = length - 1;
  6225. }
  6226. if (selectIndex < 0) selectIndex = null;
  6227. if (null !== selectIndex) {
  6228. self.selectChip(selectIndex, $chips);
  6229. }
  6230. if (!length) $chips.find('input').focus(); // left
  6231. } else if (e.which === 37) {
  6232. index = $chip.index() - 1;
  6233. if (index < 0) {
  6234. return;
  6235. }
  6236. $(SELS.CHIP).removeClass('selected');
  6237. self.selectChip(index, $chips); // right
  6238. } else if (e.which === 39) {
  6239. index = $chip.index() + 1;
  6240. $(SELS.CHIP).removeClass('selected');
  6241. if (index > length) {
  6242. $chips.find('input').focus();
  6243. return;
  6244. }
  6245. self.selectChip(index, $chips);
  6246. }
  6247. });
  6248. self.$document.off('focusin.chips', SELS.CHIPS + ' ' + SELS.INPUT).on('focusin.chips', SELS.CHIPS + ' ' + SELS.INPUT, function (e) {
  6249. var $currChips = $(e.target).closest(SELS.CHIPS);
  6250. $currChips.addClass('focus');
  6251. $currChips.siblings('label, .prefix').addClass('active');
  6252. $(SELS.CHIP).removeClass('selected');
  6253. });
  6254. self.$document.off('focusout.chips', SELS.CHIPS + ' ' + SELS.INPUT).on('focusout.chips', SELS.CHIPS + ' ' + SELS.INPUT, function (e) {
  6255. var $currChips = $(e.target).closest(SELS.CHIPS);
  6256. $currChips.removeClass('focus'); // Remove active if empty
  6257. if ($currChips.data('chips') === undefined || !$currChips.data('chips').length) {
  6258. $currChips.siblings('label').removeClass('active');
  6259. }
  6260. $currChips.siblings('.prefix').removeClass('active');
  6261. });
  6262. self.$document.off('keydown.chips-add', SELS.CHIPS + ' ' + SELS.INPUT).on('keydown.chips-add', SELS.CHIPS + ' ' + SELS.INPUT, function (e) {
  6263. var $target = $(e.target);
  6264. var $chips = $target.closest(SELS.CHIPS);
  6265. var chipsLength = $chips.children(SELS.CHIP).length; // enter
  6266. if (13 === e.which) {
  6267. // Override enter if autocompleting.
  6268. if (self.hasAutocomplete && $chips.find('.autocomplete-content.dropdown-content').length && $chips.find('.autocomplete-content.dropdown-content').children().length) {
  6269. return;
  6270. }
  6271. e.preventDefault();
  6272. self.addChip({
  6273. tag: $target.val()
  6274. }, $chips);
  6275. $target.val('');
  6276. return;
  6277. } // delete or left
  6278. if ((8 === e.keyCode || 37 === e.keyCode) && '' === $target.val() && chipsLength) {
  6279. e.preventDefault();
  6280. self.selectChip(chipsLength - 1, $chips);
  6281. $target.blur();
  6282. return;
  6283. }
  6284. }); // Click on delete icon in chip.
  6285. self.$document.off('click.chips-delete', SELS.CHIPS + ' ' + SELS.DELETE).on('click.chips-delete', SELS.CHIPS + ' ' + SELS.DELETE, function (e) {
  6286. var $target = $(e.target);
  6287. var $chips = $target.closest(SELS.CHIPS);
  6288. var $chip = $target.closest(SELS.CHIP);
  6289. e.stopPropagation();
  6290. self.deleteChip($chip.index(), $chips);
  6291. $chips.find('input').focus();
  6292. });
  6293. };
  6294. this.chips = function ($chips, chipId) {
  6295. $chips.empty();
  6296. $chips.data('chips').forEach(function (elem) {
  6297. $chips.append(self.renderChip(elem));
  6298. });
  6299. $chips.append($('<input id="' + chipId + '" class="input" placeholder="">'));
  6300. self.setPlaceholder($chips); // Set for attribute for label
  6301. var label = $chips.next('label');
  6302. if (label.length) {
  6303. label.attr('for', chipId);
  6304. if ($chips.data('chips') !== undefined && $chips.data('chips').length) {
  6305. label.addClass('active');
  6306. }
  6307. } // Setup autocomplete if needed.
  6308. var input = $('#' + chipId);
  6309. if (self.hasAutocomplete) {
  6310. curr_options.autocompleteOptions.onAutocomplete = function (val) {
  6311. self.addChip({
  6312. tag: val
  6313. }, $chips);
  6314. input.val('');
  6315. input.focus();
  6316. };
  6317. input.autocomplete(curr_options.autocompleteOptions);
  6318. }
  6319. };
  6320. /**
  6321. * Render chip jQuery element.
  6322. * @param {Object} elem
  6323. * @return {jQuery}
  6324. */
  6325. this.renderChip = function (elem) {
  6326. if (!elem.tag) return;
  6327. var $renderedChip = $('<div class="chip"></div>');
  6328. $renderedChip.text(elem.tag);
  6329. if (elem.image) {
  6330. $renderedChip.prepend($('<img />').attr('src', elem.image));
  6331. }
  6332. $renderedChip.append($('<i class="material-icons close">close</i>'));
  6333. return $renderedChip;
  6334. };
  6335. this.setPlaceholder = function ($chips) {
  6336. if ($chips.data('chips') !== undefined && !$chips.data('chips').length && curr_options.placeholder) {
  6337. $chips.find('input').prop('placeholder', curr_options.placeholder);
  6338. } else if (($chips.data('chips') === undefined || !!$chips.data('chips').length) && curr_options.secondaryPlaceholder) {
  6339. $chips.find('input').prop('placeholder', curr_options.secondaryPlaceholder);
  6340. }
  6341. };
  6342. this.isValid = function ($chips, elem) {
  6343. var chips = $chips.data('chips');
  6344. var exists = false;
  6345. for (var i = 0; i < chips.length; i++) {
  6346. if (chips[i].tag === elem.tag) {
  6347. exists = true;
  6348. return;
  6349. }
  6350. }
  6351. return '' !== elem.tag && !exists;
  6352. };
  6353. this.addChip = function (elem, $chips) {
  6354. if (!self.isValid($chips, elem)) {
  6355. return;
  6356. }
  6357. var $renderedChip = self.renderChip(elem);
  6358. var newData = [];
  6359. var oldData = $chips.data('chips');
  6360. for (var i = 0; i < oldData.length; i++) {
  6361. newData.push(oldData[i]);
  6362. }
  6363. newData.push(elem);
  6364. $chips.data('chips', newData);
  6365. $renderedChip.insertBefore($chips.find('input'));
  6366. $chips.trigger('chip.add', elem);
  6367. self.setPlaceholder($chips);
  6368. };
  6369. this.deleteChip = function (chipIndex, $chips) {
  6370. var chip = $chips.data('chips')[chipIndex];
  6371. $chips.find('.chip').eq(chipIndex).remove();
  6372. var newData = [];
  6373. var oldData = $chips.data('chips');
  6374. for (var i = 0; i < oldData.length; i++) {
  6375. if (i !== chipIndex) {
  6376. newData.push(oldData[i]);
  6377. }
  6378. }
  6379. $chips.data('chips', newData);
  6380. $chips.trigger('chip.delete', chip);
  6381. self.setPlaceholder($chips);
  6382. };
  6383. this.selectChip = function (chipIndex, $chips) {
  6384. var $chip = $chips.find('.chip').eq(chipIndex);
  6385. if ($chip && false === $chip.hasClass('selected')) {
  6386. $chip.addClass('selected');
  6387. $chips.trigger('chip.select', $chips.data('chips')[chipIndex]);
  6388. }
  6389. };
  6390. this.getChipsElement = function (index, $chips) {
  6391. return $chips.eq(index);
  6392. }; // init
  6393. this.init();
  6394. this.handleEvents();
  6395. };
  6396. })(jQuery);
  6397. ;
  6398. (function ($) {
  6399. $.fn.pushpin = function (options) {
  6400. // Defaults
  6401. var defaults = {
  6402. top: 0,
  6403. bottom: Infinity,
  6404. offset: 0
  6405. }; // Remove pushpin event and classes
  6406. if (options === "remove") {
  6407. this.each(function () {
  6408. if (id = $(this).data('pushpin-id')) {
  6409. $(window).off('scroll.' + id);
  6410. $(this).removeData('pushpin-id').removeClass('pin-top pinned pin-bottom').removeAttr('style');
  6411. }
  6412. });
  6413. return false;
  6414. }
  6415. options = $.extend(defaults, options);
  6416. $index = 0;
  6417. return this.each(function () {
  6418. var $uniqueId = Materialize.guid(),
  6419. $this = $(this),
  6420. $original_offset = $(this).offset().top;
  6421. function removePinClasses(object) {
  6422. object.removeClass('pin-top');
  6423. object.removeClass('pinned');
  6424. object.removeClass('pin-bottom');
  6425. }
  6426. function updateElements(objects, scrolled) {
  6427. objects.each(function () {
  6428. // Add position fixed (because its between top and bottom)
  6429. if (options.top <= scrolled && options.bottom >= scrolled && !$(this).hasClass('pinned')) {
  6430. removePinClasses($(this));
  6431. $(this).css('top', options.offset);
  6432. $(this).addClass('pinned');
  6433. } // Add pin-top (when scrolled position is above top)
  6434. if (scrolled < options.top && !$(this).hasClass('pin-top')) {
  6435. removePinClasses($(this));
  6436. $(this).css('top', 0);
  6437. $(this).addClass('pin-top');
  6438. } // Add pin-bottom (when scrolled position is below bottom)
  6439. if (scrolled > options.bottom && !$(this).hasClass('pin-bottom')) {
  6440. removePinClasses($(this));
  6441. $(this).addClass('pin-bottom');
  6442. $(this).css('top', options.bottom - $original_offset);
  6443. }
  6444. });
  6445. }
  6446. $(this).data('pushpin-id', $uniqueId);
  6447. updateElements($this, $(window).scrollTop());
  6448. $(window).on('scroll.' + $uniqueId, function () {
  6449. var $scrolled = $(window).scrollTop() + options.offset;
  6450. updateElements($this, $scrolled);
  6451. });
  6452. });
  6453. };
  6454. })(jQuery);
  6455. ;
  6456. (function ($) {
  6457. $(document).ready(function () {
  6458. // jQuery reverse
  6459. $.fn.reverse = [].reverse; // Hover behaviour: make sure this doesn't work on .click-to-toggle FABs!
  6460. $(document).on('mouseenter.fixedActionBtn', '.fixed-action-btn:not(.click-to-toggle):not(.toolbar)', function (e) {
  6461. var $this = $(this);
  6462. openFABMenu($this);
  6463. });
  6464. $(document).on('mouseleave.fixedActionBtn', '.fixed-action-btn:not(.click-to-toggle):not(.toolbar)', function (e) {
  6465. var $this = $(this);
  6466. closeFABMenu($this);
  6467. }); // Toggle-on-click behaviour.
  6468. $(document).on('click.fabClickToggle', '.fixed-action-btn.click-to-toggle > a', function (e) {
  6469. var $this = $(this);
  6470. var $menu = $this.parent();
  6471. if ($menu.hasClass('active')) {
  6472. closeFABMenu($menu);
  6473. } else {
  6474. openFABMenu($menu);
  6475. }
  6476. }); // Toolbar transition behaviour.
  6477. $(document).on('click.fabToolbar', '.fixed-action-btn.toolbar > a', function (e) {
  6478. var $this = $(this);
  6479. var $menu = $this.parent();
  6480. FABtoToolbar($menu);
  6481. });
  6482. });
  6483. $.fn.extend({
  6484. openFAB: function openFAB() {
  6485. openFABMenu($(this));
  6486. },
  6487. closeFAB: function closeFAB() {
  6488. closeFABMenu($(this));
  6489. },
  6490. openToolbar: function openToolbar() {
  6491. FABtoToolbar($(this));
  6492. },
  6493. closeToolbar: function closeToolbar() {
  6494. toolbarToFAB($(this));
  6495. }
  6496. });
  6497. var openFABMenu = function openFABMenu(btn) {
  6498. var $this = btn;
  6499. if ($this.hasClass('active') === false) {
  6500. // Get direction option
  6501. var horizontal = $this.hasClass('horizontal');
  6502. var offsetY, offsetX;
  6503. if (horizontal === true) {
  6504. offsetX = 40;
  6505. } else {
  6506. offsetY = 40;
  6507. }
  6508. $this.addClass('active');
  6509. $this.find('ul .btn-floating').velocity({
  6510. scaleY: ".4",
  6511. scaleX: ".4",
  6512. translateY: offsetY + 'px',
  6513. translateX: offsetX + 'px'
  6514. }, {
  6515. duration: 0
  6516. });
  6517. var time = 0;
  6518. $this.find('ul .btn-floating').reverse().each(function () {
  6519. $(this).velocity({
  6520. opacity: "1",
  6521. scaleX: "1",
  6522. scaleY: "1",
  6523. translateY: "0",
  6524. translateX: '0'
  6525. }, {
  6526. duration: 80,
  6527. delay: time
  6528. });
  6529. time += 40;
  6530. });
  6531. }
  6532. };
  6533. var closeFABMenu = function closeFABMenu(btn) {
  6534. var $this = btn; // Get direction option
  6535. var horizontal = $this.hasClass('horizontal');
  6536. var offsetY, offsetX;
  6537. if (horizontal === true) {
  6538. offsetX = 40;
  6539. } else {
  6540. offsetY = 40;
  6541. }
  6542. $this.removeClass('active');
  6543. var time = 0;
  6544. $this.find('ul .btn-floating').velocity("stop", true);
  6545. $this.find('ul .btn-floating').velocity({
  6546. opacity: "0",
  6547. scaleX: ".4",
  6548. scaleY: ".4",
  6549. translateY: offsetY + 'px',
  6550. translateX: offsetX + 'px'
  6551. }, {
  6552. duration: 80
  6553. });
  6554. };
  6555. /**
  6556. * Transform FAB into toolbar
  6557. * @param {Object} object jQuery object
  6558. */
  6559. var FABtoToolbar = function FABtoToolbar(btn) {
  6560. if (btn.attr('data-open') === "true") {
  6561. return;
  6562. }
  6563. var offsetX, offsetY, scaleFactor;
  6564. var windowWidth = window.innerWidth;
  6565. var windowHeight = window.innerHeight;
  6566. var btnRect = btn[0].getBoundingClientRect();
  6567. var anchor = btn.find('> a').first();
  6568. var menu = btn.find('> ul').first();
  6569. var backdrop = $('<div class="fab-backdrop"></div>');
  6570. var fabColor = anchor.css('background-color');
  6571. anchor.append(backdrop);
  6572. offsetX = btnRect.left - windowWidth / 2 + btnRect.width / 2;
  6573. offsetY = windowHeight - btnRect.bottom;
  6574. scaleFactor = windowWidth / backdrop.width();
  6575. btn.attr('data-origin-bottom', btnRect.bottom);
  6576. btn.attr('data-origin-left', btnRect.left);
  6577. btn.attr('data-origin-width', btnRect.width); // Set initial state
  6578. btn.addClass('active');
  6579. btn.attr('data-open', true);
  6580. btn.css({
  6581. 'text-align': 'center',
  6582. width: '100%',
  6583. bottom: 0,
  6584. left: 0,
  6585. transform: 'translateX(' + offsetX + 'px)',
  6586. transition: 'none'
  6587. });
  6588. anchor.css({
  6589. transform: 'translateY(' + -offsetY + 'px)',
  6590. transition: 'none'
  6591. });
  6592. backdrop.css({
  6593. 'background-color': fabColor
  6594. });
  6595. setTimeout(function () {
  6596. btn.css({
  6597. transform: '',
  6598. transition: 'transform .2s cubic-bezier(0.550, 0.085, 0.680, 0.530), background-color 0s linear .2s'
  6599. });
  6600. anchor.css({
  6601. overflow: 'visible',
  6602. transform: '',
  6603. transition: 'transform .2s'
  6604. });
  6605. setTimeout(function () {
  6606. btn.css({
  6607. overflow: 'hidden',
  6608. 'background-color': fabColor
  6609. });
  6610. backdrop.css({
  6611. transform: 'scale(' + scaleFactor + ')',
  6612. transition: 'transform .2s cubic-bezier(0.550, 0.055, 0.675, 0.190)'
  6613. });
  6614. menu.find('> li > a').css({
  6615. opacity: 1
  6616. }); // Scroll to close.
  6617. $(window).on('scroll.fabToolbarClose', function () {
  6618. toolbarToFAB(btn);
  6619. $(window).off('scroll.fabToolbarClose');
  6620. $(document).off('click.fabToolbarClose');
  6621. });
  6622. $(document).on('click.fabToolbarClose', function (e) {
  6623. if (!$(e.target).closest(menu).length) {
  6624. toolbarToFAB(btn);
  6625. $(window).off('scroll.fabToolbarClose');
  6626. $(document).off('click.fabToolbarClose');
  6627. }
  6628. });
  6629. }, 100);
  6630. }, 0);
  6631. };
  6632. /**
  6633. * Transform toolbar back into FAB
  6634. * @param {Object} object jQuery object
  6635. */
  6636. var toolbarToFAB = function toolbarToFAB(btn) {
  6637. if (btn.attr('data-open') !== "true") {
  6638. return;
  6639. }
  6640. var offsetX, offsetY, scaleFactor;
  6641. var windowWidth = window.innerWidth;
  6642. var windowHeight = window.innerHeight;
  6643. var btnWidth = btn.attr('data-origin-width');
  6644. var btnBottom = btn.attr('data-origin-bottom');
  6645. var btnLeft = btn.attr('data-origin-left');
  6646. var anchor = btn.find('> .btn-floating').first();
  6647. var menu = btn.find('> ul').first();
  6648. var backdrop = btn.find('.fab-backdrop');
  6649. var fabColor = anchor.css('background-color');
  6650. offsetX = btnLeft - windowWidth / 2 + btnWidth / 2;
  6651. offsetY = windowHeight - btnBottom;
  6652. scaleFactor = windowWidth / backdrop.width(); // Hide backdrop
  6653. btn.removeClass('active');
  6654. btn.attr('data-open', false);
  6655. btn.css({
  6656. 'background-color': 'transparent',
  6657. transition: 'none'
  6658. });
  6659. anchor.css({
  6660. transition: 'none'
  6661. });
  6662. backdrop.css({
  6663. transform: 'scale(0)',
  6664. 'background-color': fabColor
  6665. });
  6666. menu.find('> li > a').css({
  6667. opacity: ''
  6668. });
  6669. setTimeout(function () {
  6670. backdrop.remove(); // Set initial state.
  6671. btn.css({
  6672. 'text-align': '',
  6673. width: '',
  6674. bottom: '',
  6675. left: '',
  6676. overflow: '',
  6677. 'background-color': '',
  6678. transform: 'translate3d(' + -offsetX + 'px,0,0)'
  6679. });
  6680. anchor.css({
  6681. overflow: '',
  6682. transform: 'translate3d(0,' + offsetY + 'px,0)'
  6683. });
  6684. setTimeout(function () {
  6685. btn.css({
  6686. transform: 'translate3d(0,0,0)',
  6687. transition: 'transform .2s'
  6688. });
  6689. anchor.css({
  6690. transform: 'translate3d(0,0,0)',
  6691. transition: 'transform .2s cubic-bezier(0.550, 0.055, 0.675, 0.190)'
  6692. });
  6693. }, 20);
  6694. }, 200);
  6695. };
  6696. })(jQuery);
  6697. ;
  6698. (function ($) {
  6699. // Image transition function
  6700. Materialize.fadeInImage = function (selectorOrEl) {
  6701. var element;
  6702. if (typeof selectorOrEl === 'string') {
  6703. element = $(selectorOrEl);
  6704. } else if (_typeof(selectorOrEl) === 'object') {
  6705. element = selectorOrEl;
  6706. } else {
  6707. return;
  6708. }
  6709. element.css({
  6710. opacity: 0
  6711. });
  6712. $(element).velocity({
  6713. opacity: 1
  6714. }, {
  6715. duration: 650,
  6716. queue: false,
  6717. easing: 'easeOutSine'
  6718. });
  6719. $(element).velocity({
  6720. opacity: 1
  6721. }, {
  6722. duration: 1300,
  6723. queue: false,
  6724. easing: 'swing',
  6725. step: function step(now, fx) {
  6726. fx.start = 100;
  6727. var grayscale_setting = now / 100;
  6728. var brightness_setting = 150 - (100 - now) / 1.75;
  6729. if (brightness_setting < 100) {
  6730. brightness_setting = 100;
  6731. }
  6732. if (now >= 0) {
  6733. $(this).css({
  6734. "-webkit-filter": "grayscale(" + grayscale_setting + ")" + "brightness(" + brightness_setting + "%)",
  6735. "filter": "grayscale(" + grayscale_setting + ")" + "brightness(" + brightness_setting + "%)"
  6736. });
  6737. }
  6738. }
  6739. });
  6740. }; // Horizontal staggered list
  6741. Materialize.showStaggeredList = function (selectorOrEl) {
  6742. var element;
  6743. if (typeof selectorOrEl === 'string') {
  6744. element = $(selectorOrEl);
  6745. } else if (_typeof(selectorOrEl) === 'object') {
  6746. element = selectorOrEl;
  6747. } else {
  6748. return;
  6749. }
  6750. var time = 0;
  6751. element.find('li').velocity({
  6752. translateX: "-100px"
  6753. }, {
  6754. duration: 0
  6755. });
  6756. element.find('li').each(function () {
  6757. $(this).velocity({
  6758. opacity: "1",
  6759. translateX: "0"
  6760. }, {
  6761. duration: 800,
  6762. delay: time,
  6763. easing: [60, 10]
  6764. });
  6765. time += 120;
  6766. });
  6767. };
  6768. $(document).ready(function () {
  6769. // Hardcoded .staggered-list scrollFire
  6770. // var staggeredListOptions = [];
  6771. // $('ul.staggered-list').each(function (i) {
  6772. // var label = 'scrollFire-' + i;
  6773. // $(this).addClass(label);
  6774. // staggeredListOptions.push(
  6775. // {selector: 'ul.staggered-list.' + label,
  6776. // offset: 200,
  6777. // callback: 'showStaggeredList("ul.staggered-list.' + label + '")'});
  6778. // });
  6779. // scrollFire(staggeredListOptions);
  6780. // HammerJS, Swipe navigation
  6781. // Touch Event
  6782. var swipeLeft = false;
  6783. var swipeRight = false; // Dismissible Collections
  6784. $('.dismissable').each(function () {
  6785. $(this).hammer({
  6786. prevent_default: false
  6787. }).on('pan', function (e) {
  6788. if (e.gesture.pointerType === "touch") {
  6789. var $this = $(this);
  6790. var direction = e.gesture.direction;
  6791. var x = e.gesture.deltaX;
  6792. var velocityX = e.gesture.velocityX;
  6793. $this.velocity({
  6794. translateX: x
  6795. }, {
  6796. duration: 50,
  6797. queue: false,
  6798. easing: 'easeOutQuad'
  6799. }); // Swipe Left
  6800. if (direction === 4 && (x > $this.innerWidth() / 2 || velocityX < -0.75)) {
  6801. swipeLeft = true;
  6802. } // Swipe Right
  6803. if (direction === 2 && (x < -1 * $this.innerWidth() / 2 || velocityX > 0.75)) {
  6804. swipeRight = true;
  6805. }
  6806. }
  6807. }).on('panend', function (e) {
  6808. // Reset if collection is moved back into original position
  6809. if (Math.abs(e.gesture.deltaX) < $(this).innerWidth() / 2) {
  6810. swipeRight = false;
  6811. swipeLeft = false;
  6812. }
  6813. if (e.gesture.pointerType === "touch") {
  6814. var $this = $(this);
  6815. if (swipeLeft || swipeRight) {
  6816. var fullWidth;
  6817. if (swipeLeft) {
  6818. fullWidth = $this.innerWidth();
  6819. } else {
  6820. fullWidth = -1 * $this.innerWidth();
  6821. }
  6822. $this.velocity({
  6823. translateX: fullWidth
  6824. }, {
  6825. duration: 100,
  6826. queue: false,
  6827. easing: 'easeOutQuad',
  6828. complete: function complete() {
  6829. $this.css('border', 'none');
  6830. $this.velocity({
  6831. height: 0,
  6832. padding: 0
  6833. }, {
  6834. duration: 200,
  6835. queue: false,
  6836. easing: 'easeOutQuad',
  6837. complete: function complete() {
  6838. $this.remove();
  6839. }
  6840. });
  6841. }
  6842. });
  6843. } else {
  6844. $this.velocity({
  6845. translateX: 0
  6846. }, {
  6847. duration: 100,
  6848. queue: false,
  6849. easing: 'easeOutQuad'
  6850. });
  6851. }
  6852. swipeLeft = false;
  6853. swipeRight = false;
  6854. }
  6855. });
  6856. }); // time = 0
  6857. // // Vertical Staggered list
  6858. // $('ul.staggered-list.vertical li').velocity(
  6859. // { translateY: "100px"},
  6860. // { duration: 0 });
  6861. // $('ul.staggered-list.vertical li').each(function() {
  6862. // $(this).velocity(
  6863. // { opacity: "1", translateY: "0"},
  6864. // { duration: 800, delay: time, easing: [60, 25] });
  6865. // time += 120;
  6866. // });
  6867. // // Fade in and Scale
  6868. // $('.fade-in.scale').velocity(
  6869. // { scaleX: .4, scaleY: .4, translateX: -600},
  6870. // { duration: 0});
  6871. // $('.fade-in').each(function() {
  6872. // $(this).velocity(
  6873. // { opacity: "1", scaleX: 1, scaleY: 1, translateX: 0},
  6874. // { duration: 800, easing: [60, 10] });
  6875. // });
  6876. });
  6877. })(jQuery);
  6878. ;
  6879. (function ($) {
  6880. var scrollFireEventsHandled = false; // Input: Array of JSON objects {selector, offset, callback}
  6881. Materialize.scrollFire = function (options) {
  6882. var onScroll = function onScroll() {
  6883. var windowScroll = window.pageYOffset + window.innerHeight;
  6884. for (var i = 0; i < options.length; i++) {
  6885. // Get options from each line
  6886. var value = options[i];
  6887. var selector = value.selector,
  6888. offset = value.offset,
  6889. callback = value.callback;
  6890. var currentElement = document.querySelector(selector);
  6891. if (currentElement !== null) {
  6892. var elementOffset = currentElement.getBoundingClientRect().top + window.pageYOffset;
  6893. if (windowScroll > elementOffset + offset) {
  6894. if (value.done !== true) {
  6895. if (typeof callback === 'function') {
  6896. callback.call(this, currentElement);
  6897. } else if (typeof callback === 'string') {
  6898. var callbackFunc = new Function(callback);
  6899. callbackFunc(currentElement);
  6900. }
  6901. value.done = true;
  6902. }
  6903. }
  6904. }
  6905. }
  6906. };
  6907. var throttledScroll = Materialize.throttle(function () {
  6908. onScroll();
  6909. }, options.throttle || 100);
  6910. if (!scrollFireEventsHandled) {
  6911. window.addEventListener("scroll", throttledScroll);
  6912. window.addEventListener("resize", throttledScroll);
  6913. scrollFireEventsHandled = true;
  6914. } // perform a scan once, after current execution context, and after dom is ready
  6915. setTimeout(throttledScroll, 0);
  6916. };
  6917. })(jQuery);
  6918. ;
  6919. /*!
  6920. * pickadate.js v3.5.0, 2014/04/13
  6921. * By Amsul, http://amsul.ca
  6922. * Hosted on http://amsul.github.io/pickadate.js
  6923. * Licensed under MIT
  6924. */
  6925. (function (factory) {
  6926. Materialize.Picker = factory(jQuery);
  6927. })(function ($) {
  6928. var $window = $(window);
  6929. var $document = $(document);
  6930. var $html = $(document.documentElement);
  6931. /**
  6932. * The picker constructor that creates a blank picker.
  6933. */
  6934. function PickerConstructor(ELEMENT, NAME, COMPONENT, OPTIONS) {
  6935. // If there’s no element, return the picker constructor.
  6936. if (!ELEMENT) return PickerConstructor;
  6937. var IS_DEFAULT_THEME = false,
  6938. // The state of the picker.
  6939. STATE = {
  6940. id: ELEMENT.id || 'P' + Math.abs(~~(Math.random() * new Date()))
  6941. },
  6942. // Merge the defaults and options passed.
  6943. SETTINGS = COMPONENT ? $.extend(true, {}, COMPONENT.defaults, OPTIONS) : OPTIONS || {},
  6944. // Merge the default classes with the settings classes.
  6945. CLASSES = $.extend({}, PickerConstructor.klasses(), SETTINGS.klass),
  6946. // The element node wrapper into a jQuery object.
  6947. $ELEMENT = $(ELEMENT),
  6948. // Pseudo picker constructor.
  6949. PickerInstance = function PickerInstance() {
  6950. return this.start();
  6951. },
  6952. // The picker prototype.
  6953. P = PickerInstance.prototype = {
  6954. constructor: PickerInstance,
  6955. $node: $ELEMENT,
  6956. /**
  6957. * Initialize everything
  6958. */
  6959. start: function start() {
  6960. // If it’s already started, do nothing.
  6961. if (STATE && STATE.start) return P; // Update the picker states.
  6962. STATE.methods = {};
  6963. STATE.start = true;
  6964. STATE.open = false;
  6965. STATE.type = ELEMENT.type; // Confirm focus state, convert into text input to remove UA stylings,
  6966. // and set as readonly to prevent keyboard popup.
  6967. ELEMENT.autofocus = ELEMENT == getActiveElement();
  6968. ELEMENT.readOnly = !SETTINGS.editable;
  6969. ELEMENT.id = ELEMENT.id || STATE.id;
  6970. if (ELEMENT.type != 'text') {
  6971. ELEMENT.type = 'text';
  6972. } // Create a new picker component with the settings.
  6973. P.component = new COMPONENT(P, SETTINGS); // Create the picker root with a holder and then prepare it.
  6974. P.$root = $(PickerConstructor._.node('div', createWrappedComponent(), CLASSES.picker, 'id="' + ELEMENT.id + '_root" tabindex="0"'));
  6975. prepareElementRoot(); // If there’s a format for the hidden input element, create the element.
  6976. if (SETTINGS.formatSubmit) {
  6977. prepareElementHidden();
  6978. } // Prepare the input element.
  6979. prepareElement(); // Insert the root as specified in the settings.
  6980. if (SETTINGS.container) $(SETTINGS.container).append(P.$root);else $ELEMENT.before(P.$root); // Bind the default component and settings events.
  6981. P.on({
  6982. start: P.component.onStart,
  6983. render: P.component.onRender,
  6984. stop: P.component.onStop,
  6985. open: P.component.onOpen,
  6986. close: P.component.onClose,
  6987. set: P.component.onSet
  6988. }).on({
  6989. start: SETTINGS.onStart,
  6990. render: SETTINGS.onRender,
  6991. stop: SETTINGS.onStop,
  6992. open: SETTINGS.onOpen,
  6993. close: SETTINGS.onClose,
  6994. set: SETTINGS.onSet
  6995. }); // Once we’re all set, check the theme in use.
  6996. IS_DEFAULT_THEME = isUsingDefaultTheme(P.$root.children()[0]); // If the element has autofocus, open the picker.
  6997. if (ELEMENT.autofocus) {
  6998. P.open();
  6999. } // Trigger queued the “start” and “render” events.
  7000. return P.trigger('start').trigger('render');
  7001. },
  7002. //start
  7003. /**
  7004. * Render a new picker
  7005. */
  7006. render: function render(entireComponent) {
  7007. // Insert a new component holder in the root or box.
  7008. if (entireComponent) P.$root.html(createWrappedComponent());else P.$root.find('.' + CLASSES.box).html(P.component.nodes(STATE.open)); // Trigger the queued “render” events.
  7009. return P.trigger('render');
  7010. },
  7011. //render
  7012. /**
  7013. * Destroy everything
  7014. */
  7015. stop: function stop() {
  7016. // If it’s already stopped, do nothing.
  7017. if (!STATE.start) return P; // Then close the picker.
  7018. P.close(); // Remove the hidden field.
  7019. if (P._hidden) {
  7020. P._hidden.parentNode.removeChild(P._hidden);
  7021. } // Remove the root.
  7022. P.$root.remove(); // Remove the input class, remove the stored data, and unbind
  7023. // the events (after a tick for IE - see `P.close`).
  7024. $ELEMENT.removeClass(CLASSES.input).removeData(NAME);
  7025. setTimeout(function () {
  7026. $ELEMENT.off('.' + STATE.id);
  7027. }, 0); // Restore the element state
  7028. ELEMENT.type = STATE.type;
  7029. ELEMENT.readOnly = false; // Trigger the queued “stop” events.
  7030. P.trigger('stop'); // Reset the picker states.
  7031. STATE.methods = {};
  7032. STATE.start = false;
  7033. return P;
  7034. },
  7035. //stop
  7036. /**
  7037. * Open up the picker
  7038. */
  7039. open: function open(dontGiveFocus) {
  7040. // If it’s already open, do nothing.
  7041. if (STATE.open) return P; // Add the “active” class.
  7042. $ELEMENT.addClass(CLASSES.active);
  7043. aria(ELEMENT, 'expanded', true); // * A Firefox bug, when `html` has `overflow:hidden`, results in
  7044. // killing transitions :(. So add the “opened” state on the next tick.
  7045. // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=625289
  7046. setTimeout(function () {
  7047. // Add the “opened” class to the picker root.
  7048. P.$root.addClass(CLASSES.opened);
  7049. aria(P.$root[0], 'hidden', false);
  7050. }, 0); // If we have to give focus, bind the element and doc events.
  7051. if (dontGiveFocus !== false) {
  7052. // Set it as open.
  7053. STATE.open = true; // Prevent the page from scrolling.
  7054. if (IS_DEFAULT_THEME) {
  7055. $html.css('overflow', 'hidden').css('padding-right', '+=' + getScrollbarWidth());
  7056. } // Pass focus to the root element’s jQuery object.
  7057. // * Workaround for iOS8 to bring the picker’s root into view.
  7058. P.$root.eq(0).focus(); // Bind the document events.
  7059. $document.on('click.' + STATE.id + ' focusin.' + STATE.id, function (event) {
  7060. var target = event.target; // If the target of the event is not the element, close the picker picker.
  7061. // * Don’t worry about clicks or focusins on the root because those don’t bubble up.
  7062. // Also, for Firefox, a click on an `option` element bubbles up directly
  7063. // to the doc. So make sure the target wasn't the doc.
  7064. // * In Firefox stopPropagation() doesn’t prevent right-click events from bubbling,
  7065. // which causes the picker to unexpectedly close when right-clicking it. So make
  7066. // sure the event wasn’t a right-click.
  7067. if (target != ELEMENT && target != document && event.which != 3) {
  7068. // If the target was the holder that covers the screen,
  7069. // keep the element focused to maintain tabindex.
  7070. P.close(target === P.$root.children()[0]);
  7071. }
  7072. }).on('keydown.' + STATE.id, function (event) {
  7073. var // Get the keycode.
  7074. keycode = event.keyCode,
  7075. // Translate that to a selection change.
  7076. keycodeToMove = P.component.key[keycode],
  7077. // Grab the target.
  7078. target = event.target; // On escape, close the picker and give focus.
  7079. if (keycode == 27) {
  7080. P.close(true);
  7081. } // Check if there is a key movement or “enter” keypress on the element.
  7082. else if (target == P.$root[0] && (keycodeToMove || keycode == 13)) {
  7083. // Prevent the default action to stop page movement.
  7084. event.preventDefault(); // Trigger the key movement action.
  7085. if (keycodeToMove) {
  7086. PickerConstructor._.trigger(P.component.key.go, P, [PickerConstructor._.trigger(keycodeToMove)]);
  7087. } // On “enter”, if the highlighted item isn’t disabled, set the value and close.
  7088. else if (!P.$root.find('.' + CLASSES.highlighted).hasClass(CLASSES.disabled)) {
  7089. P.set('select', P.component.item.highlight);
  7090. if (SETTINGS.closeOnSelect) {
  7091. P.close(true);
  7092. }
  7093. }
  7094. } // If the target is within the root and “enter” is pressed,
  7095. // prevent the default action and trigger a click on the target instead.
  7096. else if ($.contains(P.$root[0], target) && keycode == 13) {
  7097. event.preventDefault();
  7098. target.click();
  7099. }
  7100. });
  7101. } // Trigger the queued “open” events.
  7102. return P.trigger('open');
  7103. },
  7104. //open
  7105. /**
  7106. * Close the picker
  7107. */
  7108. close: function close(giveFocus) {
  7109. // If we need to give focus, do it before changing states.
  7110. if (giveFocus) {
  7111. // ....ah yes! It would’ve been incomplete without a crazy workaround for IE :|
  7112. // The focus is triggered *after* the close has completed - causing it
  7113. // to open again. So unbind and rebind the event at the next tick.
  7114. P.$root.off('focus.toOpen').eq(0).focus();
  7115. setTimeout(function () {
  7116. P.$root.on('focus.toOpen', handleFocusToOpenEvent);
  7117. }, 0);
  7118. } // Remove the “active” class.
  7119. $ELEMENT.removeClass(CLASSES.active);
  7120. aria(ELEMENT, 'expanded', false); // * A Firefox bug, when `html` has `overflow:hidden`, results in
  7121. // killing transitions :(. So remove the “opened” state on the next tick.
  7122. // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=625289
  7123. setTimeout(function () {
  7124. // Remove the “opened” and “focused” class from the picker root.
  7125. P.$root.removeClass(CLASSES.opened + ' ' + CLASSES.focused);
  7126. aria(P.$root[0], 'hidden', true);
  7127. }, 0); // If it’s already closed, do nothing more.
  7128. if (!STATE.open) return P; // Set it as closed.
  7129. STATE.open = false; // Allow the page to scroll.
  7130. if (IS_DEFAULT_THEME) {
  7131. $html.css('overflow', '').css('padding-right', '-=' + getScrollbarWidth());
  7132. } // Unbind the document events.
  7133. $document.off('.' + STATE.id); // Trigger the queued “close” events.
  7134. return P.trigger('close');
  7135. },
  7136. //close
  7137. /**
  7138. * Clear the values
  7139. */
  7140. clear: function clear(options) {
  7141. return P.set('clear', null, options);
  7142. },
  7143. //clear
  7144. /**
  7145. * Set something
  7146. */
  7147. set: function set(thing, value, options) {
  7148. var thingItem,
  7149. thingValue,
  7150. thingIsObject = $.isPlainObject(thing),
  7151. thingObject = thingIsObject ? thing : {}; // Make sure we have usable options.
  7152. options = thingIsObject && $.isPlainObject(value) ? value : options || {};
  7153. if (thing) {
  7154. // If the thing isn’t an object, make it one.
  7155. if (!thingIsObject) {
  7156. thingObject[thing] = value;
  7157. } // Go through the things of items to set.
  7158. for (thingItem in thingObject) {
  7159. // Grab the value of the thing.
  7160. thingValue = thingObject[thingItem]; // First, if the item exists and there’s a value, set it.
  7161. if (thingItem in P.component.item) {
  7162. if (thingValue === undefined) thingValue = null;
  7163. P.component.set(thingItem, thingValue, options);
  7164. } // Then, check to update the element value and broadcast a change.
  7165. if (thingItem == 'select' || thingItem == 'clear') {
  7166. $ELEMENT.val(thingItem == 'clear' ? '' : P.get(thingItem, SETTINGS.format)).trigger('change');
  7167. }
  7168. } // Render a new picker.
  7169. P.render();
  7170. } // When the method isn’t muted, trigger queued “set” events and pass the `thingObject`.
  7171. return options.muted ? P : P.trigger('set', thingObject);
  7172. },
  7173. //set
  7174. /**
  7175. * Get something
  7176. */
  7177. get: function get(thing, format) {
  7178. // Make sure there’s something to get.
  7179. thing = thing || 'value'; // If a picker state exists, return that.
  7180. if (STATE[thing] != null) {
  7181. return STATE[thing];
  7182. } // Return the submission value, if that.
  7183. if (thing == 'valueSubmit') {
  7184. if (P._hidden) {
  7185. return P._hidden.value;
  7186. }
  7187. thing = 'value';
  7188. } // Return the value, if that.
  7189. if (thing == 'value') {
  7190. return ELEMENT.value;
  7191. } // Check if a component item exists, return that.
  7192. if (thing in P.component.item) {
  7193. if (typeof format == 'string') {
  7194. var thingValue = P.component.get(thing);
  7195. return thingValue ? PickerConstructor._.trigger(P.component.formats.toString, P.component, [format, thingValue]) : '';
  7196. }
  7197. return P.component.get(thing);
  7198. }
  7199. },
  7200. //get
  7201. /**
  7202. * Bind events on the things.
  7203. */
  7204. on: function on(thing, method, internal) {
  7205. var thingName,
  7206. thingMethod,
  7207. thingIsObject = $.isPlainObject(thing),
  7208. thingObject = thingIsObject ? thing : {};
  7209. if (thing) {
  7210. // If the thing isn’t an object, make it one.
  7211. if (!thingIsObject) {
  7212. thingObject[thing] = method;
  7213. } // Go through the things to bind to.
  7214. for (thingName in thingObject) {
  7215. // Grab the method of the thing.
  7216. thingMethod = thingObject[thingName]; // If it was an internal binding, prefix it.
  7217. if (internal) {
  7218. thingName = '_' + thingName;
  7219. } // Make sure the thing methods collection exists.
  7220. STATE.methods[thingName] = STATE.methods[thingName] || []; // Add the method to the relative method collection.
  7221. STATE.methods[thingName].push(thingMethod);
  7222. }
  7223. }
  7224. return P;
  7225. },
  7226. //on
  7227. /**
  7228. * Unbind events on the things.
  7229. */
  7230. off: function off() {
  7231. var i,
  7232. thingName,
  7233. names = arguments;
  7234. for (i = 0, namesCount = names.length; i < namesCount; i += 1) {
  7235. thingName = names[i];
  7236. if (thingName in STATE.methods) {
  7237. delete STATE.methods[thingName];
  7238. }
  7239. }
  7240. return P;
  7241. },
  7242. /**
  7243. * Fire off method events.
  7244. */
  7245. trigger: function trigger(name, data) {
  7246. var _trigger = function _trigger(name) {
  7247. var methodList = STATE.methods[name];
  7248. if (methodList) {
  7249. methodList.map(function (method) {
  7250. PickerConstructor._.trigger(method, P, [data]);
  7251. });
  7252. }
  7253. };
  7254. _trigger('_' + name);
  7255. _trigger(name);
  7256. return P;
  7257. } //trigger
  7258. //PickerInstance.prototype
  7259. /**
  7260. * Wrap the picker holder components together.
  7261. */
  7262. };
  7263. function createWrappedComponent() {
  7264. // Create a picker wrapper holder
  7265. return PickerConstructor._.node('div', // Create a picker wrapper node
  7266. PickerConstructor._.node('div', // Create a picker frame
  7267. PickerConstructor._.node('div', // Create a picker box node
  7268. PickerConstructor._.node('div', // Create the components nodes.
  7269. P.component.nodes(STATE.open), // The picker box class
  7270. CLASSES.box), // Picker wrap class
  7271. CLASSES.wrap), // Picker frame class
  7272. CLASSES.frame), // Picker holder class
  7273. CLASSES.holder); //endreturn
  7274. } //createWrappedComponent
  7275. /**
  7276. * Prepare the input element with all bindings.
  7277. */
  7278. function prepareElement() {
  7279. $ELEMENT. // Store the picker data by component name.
  7280. data(NAME, P). // Add the “input” class name.
  7281. addClass(CLASSES.input). // Remove the tabindex.
  7282. attr('tabindex', -1). // If there’s a `data-value`, update the value of the element.
  7283. val($ELEMENT.data('value') ? P.get('select', SETTINGS.format) : ELEMENT.value); // Only bind keydown events if the element isn’t editable.
  7284. if (!SETTINGS.editable) {
  7285. $ELEMENT. // On focus/click, focus onto the root to open it up.
  7286. on('focus.' + STATE.id + ' click.' + STATE.id, function (event) {
  7287. event.preventDefault();
  7288. P.$root.eq(0).focus();
  7289. }). // Handle keyboard event based on the picker being opened or not.
  7290. on('keydown.' + STATE.id, handleKeydownEvent);
  7291. } // Update the aria attributes.
  7292. aria(ELEMENT, {
  7293. haspopup: true,
  7294. expanded: false,
  7295. readonly: false,
  7296. owns: ELEMENT.id + '_root'
  7297. });
  7298. }
  7299. /**
  7300. * Prepare the root picker element with all bindings.
  7301. */
  7302. function prepareElementRoot() {
  7303. P.$root.on({
  7304. // For iOS8.
  7305. keydown: handleKeydownEvent,
  7306. // When something within the root is focused, stop from bubbling
  7307. // to the doc and remove the “focused” state from the root.
  7308. focusin: function focusin(event) {
  7309. P.$root.removeClass(CLASSES.focused);
  7310. event.stopPropagation();
  7311. },
  7312. // When something within the root holder is clicked, stop it
  7313. // from bubbling to the doc.
  7314. 'mousedown click': function mousedownClick(event) {
  7315. var target = event.target; // Make sure the target isn’t the root holder so it can bubble up.
  7316. if (target != P.$root.children()[0]) {
  7317. event.stopPropagation(); // * For mousedown events, cancel the default action in order to
  7318. // prevent cases where focus is shifted onto external elements
  7319. // when using things like jQuery mobile or MagnificPopup (ref: #249 & #120).
  7320. // Also, for Firefox, don’t prevent action on the `option` element.
  7321. if (event.type == 'mousedown' && !$(target).is('input, select, textarea, button, option')) {
  7322. event.preventDefault(); // Re-focus onto the root so that users can click away
  7323. // from elements focused within the picker.
  7324. P.$root.eq(0).focus();
  7325. }
  7326. }
  7327. }
  7328. }). // Add/remove the “target” class on focus and blur.
  7329. on({
  7330. focus: function focus() {
  7331. $ELEMENT.addClass(CLASSES.target);
  7332. },
  7333. blur: function blur() {
  7334. $ELEMENT.removeClass(CLASSES.target);
  7335. }
  7336. }). // Open the picker and adjust the root “focused” state
  7337. on('focus.toOpen', handleFocusToOpenEvent). // If there’s a click on an actionable element, carry out the actions.
  7338. on('click', '[data-pick], [data-nav], [data-clear], [data-close]', function () {
  7339. var $target = $(this),
  7340. targetData = $target.data(),
  7341. targetDisabled = $target.hasClass(CLASSES.navDisabled) || $target.hasClass(CLASSES.disabled),
  7342. // * For IE, non-focusable elements can be active elements as well
  7343. // (http://stackoverflow.com/a/2684561).
  7344. activeElement = getActiveElement();
  7345. activeElement = activeElement && (activeElement.type || activeElement.href) && activeElement; // If it’s disabled or nothing inside is actively focused, re-focus the element.
  7346. if (targetDisabled || activeElement && !$.contains(P.$root[0], activeElement)) {
  7347. P.$root.eq(0).focus();
  7348. } // If something is superficially changed, update the `highlight` based on the `nav`.
  7349. if (!targetDisabled && targetData.nav) {
  7350. P.set('highlight', P.component.item.highlight, {
  7351. nav: targetData.nav
  7352. });
  7353. } // If something is picked, set `select` then close with focus.
  7354. else if (!targetDisabled && 'pick' in targetData) {
  7355. P.set('select', targetData.pick);
  7356. if (SETTINGS.closeOnSelect) {
  7357. P.close(true);
  7358. }
  7359. } // If a “clear” button is pressed, empty the values and close with focus.
  7360. else if (targetData.clear) {
  7361. P.clear();
  7362. if (SETTINGS.closeOnSelect) {
  7363. P.close(true);
  7364. }
  7365. } else if (targetData.close) {
  7366. P.close(true);
  7367. }
  7368. }); //P.$root
  7369. aria(P.$root[0], 'hidden', true);
  7370. }
  7371. /**
  7372. * Prepare the hidden input element along with all bindings.
  7373. */
  7374. function prepareElementHidden() {
  7375. var name;
  7376. if (SETTINGS.hiddenName === true) {
  7377. name = ELEMENT.name;
  7378. ELEMENT.name = '';
  7379. } else {
  7380. name = [typeof SETTINGS.hiddenPrefix == 'string' ? SETTINGS.hiddenPrefix : '', typeof SETTINGS.hiddenSuffix == 'string' ? SETTINGS.hiddenSuffix : '_submit'];
  7381. name = name[0] + ELEMENT.name + name[1];
  7382. }
  7383. P._hidden = $('<input ' + 'type=hidden ' + // Create the name using the original input’s with a prefix and suffix.
  7384. 'name="' + name + '"' + ( // If the element has a value, set the hidden value as well.
  7385. $ELEMENT.data('value') || ELEMENT.value ? ' value="' + P.get('select', SETTINGS.formatSubmit) + '"' : '') + '>')[0];
  7386. $ELEMENT. // If the value changes, update the hidden input with the correct format.
  7387. on('change.' + STATE.id, function () {
  7388. P._hidden.value = ELEMENT.value ? P.get('select', SETTINGS.formatSubmit) : '';
  7389. }); // Insert the hidden input as specified in the settings.
  7390. if (SETTINGS.container) $(SETTINGS.container).append(P._hidden);else $ELEMENT.before(P._hidden);
  7391. } // For iOS8.
  7392. function handleKeydownEvent(event) {
  7393. var keycode = event.keyCode,
  7394. // Check if one of the delete keys was pressed.
  7395. isKeycodeDelete = /^(8|46)$/.test(keycode); // For some reason IE clears the input value on “escape”.
  7396. if (keycode == 27) {
  7397. P.close();
  7398. return false;
  7399. } // Check if `space` or `delete` was pressed or the picker is closed with a key movement.
  7400. if (keycode == 32 || isKeycodeDelete || !STATE.open && P.component.key[keycode]) {
  7401. // Prevent it from moving the page and bubbling to doc.
  7402. event.preventDefault();
  7403. event.stopPropagation(); // If `delete` was pressed, clear the values and close the picker.
  7404. // Otherwise open the picker.
  7405. if (isKeycodeDelete) {
  7406. P.clear().close();
  7407. } else {
  7408. P.open();
  7409. }
  7410. }
  7411. } // Separated for IE
  7412. function handleFocusToOpenEvent(event) {
  7413. // Stop the event from propagating to the doc.
  7414. event.stopPropagation(); // If it’s a focus event, add the “focused” class to the root.
  7415. if (event.type == 'focus') {
  7416. P.$root.addClass(CLASSES.focused);
  7417. } // And then finally open the picker.
  7418. P.open();
  7419. } // Return a new picker instance.
  7420. return new PickerInstance();
  7421. } //PickerConstructor
  7422. /**
  7423. * The default classes and prefix to use for the HTML classes.
  7424. */
  7425. PickerConstructor.klasses = function (prefix) {
  7426. prefix = prefix || 'picker';
  7427. return {
  7428. picker: prefix,
  7429. opened: prefix + '--opened',
  7430. focused: prefix + '--focused',
  7431. input: prefix + '__input',
  7432. active: prefix + '__input--active',
  7433. target: prefix + '__input--target',
  7434. holder: prefix + '__holder',
  7435. frame: prefix + '__frame',
  7436. wrap: prefix + '__wrap',
  7437. box: prefix + '__box'
  7438. };
  7439. }; //PickerConstructor.klasses
  7440. /**
  7441. * Check if the default theme is being used.
  7442. */
  7443. function isUsingDefaultTheme(element) {
  7444. var theme,
  7445. prop = 'position'; // For IE.
  7446. if (element.currentStyle) {
  7447. theme = element.currentStyle[prop];
  7448. } // For normal browsers.
  7449. else if (window.getComputedStyle) {
  7450. theme = getComputedStyle(element)[prop];
  7451. }
  7452. return theme == 'fixed';
  7453. }
  7454. /**
  7455. * Get the width of the browser’s scrollbar.
  7456. * Taken from: https://github.com/VodkaBears/Remodal/blob/master/src/jquery.remodal.js
  7457. */
  7458. function getScrollbarWidth() {
  7459. if ($html.height() <= $window.height()) {
  7460. return 0;
  7461. }
  7462. var $outer = $('<div style="visibility:hidden;width:100px" />').appendTo('body'); // Get the width without scrollbars.
  7463. var widthWithoutScroll = $outer[0].offsetWidth; // Force adding scrollbars.
  7464. $outer.css('overflow', 'scroll'); // Add the inner div.
  7465. var $inner = $('<div style="width:100%" />').appendTo($outer); // Get the width with scrollbars.
  7466. var widthWithScroll = $inner[0].offsetWidth; // Remove the divs.
  7467. $outer.remove(); // Return the difference between the widths.
  7468. return widthWithoutScroll - widthWithScroll;
  7469. }
  7470. /**
  7471. * PickerConstructor helper methods.
  7472. */
  7473. PickerConstructor._ = {
  7474. /**
  7475. * Create a group of nodes. Expects:
  7476. * `
  7477. {
  7478. min: {Integer},
  7479. max: {Integer},
  7480. i: {Integer},
  7481. node: {String},
  7482. item: {Function}
  7483. }
  7484. * `
  7485. */
  7486. group: function group(groupObject) {
  7487. var // Scope for the looped object
  7488. loopObjectScope,
  7489. // Create the nodes list
  7490. nodesList = '',
  7491. // The counter starts from the `min`
  7492. counter = PickerConstructor._.trigger(groupObject.min, groupObject); // Loop from the `min` to `max`, incrementing by `i`
  7493. for (; counter <= PickerConstructor._.trigger(groupObject.max, groupObject, [counter]); counter += groupObject.i) {
  7494. // Trigger the `item` function within scope of the object
  7495. loopObjectScope = PickerConstructor._.trigger(groupObject.item, groupObject, [counter]); // Splice the subgroup and create nodes out of the sub nodes
  7496. nodesList += PickerConstructor._.node(groupObject.node, loopObjectScope[0], // the node
  7497. loopObjectScope[1], // the classes
  7498. loopObjectScope[2] // the attributes
  7499. );
  7500. } // Return the list of nodes
  7501. return nodesList;
  7502. },
  7503. //group
  7504. /**
  7505. * Create a dom node string
  7506. */
  7507. node: function node(wrapper, item, klass, attribute) {
  7508. // If the item is false-y, just return an empty string
  7509. if (!item) return ''; // If the item is an array, do a join
  7510. item = $.isArray(item) ? item.join('') : item; // Check for the class
  7511. klass = klass ? ' class="' + klass + '"' : ''; // Check for any attributes
  7512. attribute = attribute ? ' ' + attribute : ''; // Return the wrapped item
  7513. return '<' + wrapper + klass + attribute + '>' + item + '</' + wrapper + '>';
  7514. },
  7515. //node
  7516. /**
  7517. * Lead numbers below 10 with a zero.
  7518. */
  7519. lead: function lead(number) {
  7520. return (number < 10 ? '0' : '') + number;
  7521. },
  7522. /**
  7523. * Trigger a function otherwise return the value.
  7524. */
  7525. trigger: function trigger(callback, scope, args) {
  7526. return typeof callback == 'function' ? callback.apply(scope, args || []) : callback;
  7527. },
  7528. /**
  7529. * If the second character is a digit, length is 2 otherwise 1.
  7530. */
  7531. digits: function digits(string) {
  7532. return /\d/.test(string[1]) ? 2 : 1;
  7533. },
  7534. /**
  7535. * Tell if something is a date object.
  7536. */
  7537. isDate: function isDate(value) {
  7538. return {}.toString.call(value).indexOf('Date') > -1 && this.isInteger(value.getDate());
  7539. },
  7540. /**
  7541. * Tell if something is an integer.
  7542. */
  7543. isInteger: function isInteger(value) {
  7544. return {}.toString.call(value).indexOf('Number') > -1 && value % 1 === 0;
  7545. },
  7546. /**
  7547. * Create ARIA attribute strings.
  7548. */
  7549. ariaAttr: ariaAttr //PickerConstructor._
  7550. /**
  7551. * Extend the picker with a component and defaults.
  7552. */
  7553. };
  7554. PickerConstructor.extend = function (name, Component) {
  7555. // Extend jQuery.
  7556. $.fn[name] = function (options, action) {
  7557. // Grab the component data.
  7558. var componentData = this.data(name); // If the picker is requested, return the data object.
  7559. if (options == 'picker') {
  7560. return componentData;
  7561. } // If the component data exists and `options` is a string, carry out the action.
  7562. if (componentData && typeof options == 'string') {
  7563. return PickerConstructor._.trigger(componentData[options], componentData, [action]);
  7564. } // Otherwise go through each matched element and if the component
  7565. // doesn’t exist, create a new picker using `this` element
  7566. // and merging the defaults and options with a deep copy.
  7567. return this.each(function () {
  7568. var $this = $(this);
  7569. if (!$this.data(name)) {
  7570. new PickerConstructor(this, name, Component, options);
  7571. }
  7572. });
  7573. }; // Set the defaults.
  7574. $.fn[name].defaults = Component.defaults;
  7575. }; //PickerConstructor.extend
  7576. function aria(element, attribute, value) {
  7577. if ($.isPlainObject(attribute)) {
  7578. for (var key in attribute) {
  7579. ariaSet(element, key, attribute[key]);
  7580. }
  7581. } else {
  7582. ariaSet(element, attribute, value);
  7583. }
  7584. }
  7585. function ariaSet(element, attribute, value) {
  7586. element.setAttribute((attribute == 'role' ? '' : 'aria-') + attribute, value);
  7587. }
  7588. function ariaAttr(attribute, data) {
  7589. if (!$.isPlainObject(attribute)) {
  7590. attribute = {
  7591. attribute: data
  7592. };
  7593. }
  7594. data = '';
  7595. for (var key in attribute) {
  7596. var attr = (key == 'role' ? '' : 'aria-') + key,
  7597. attrVal = attribute[key];
  7598. data += attrVal == null ? '' : attr + '="' + attribute[key] + '"';
  7599. }
  7600. return data;
  7601. } // IE8 bug throws an error for activeElements within iframes.
  7602. function getActiveElement() {
  7603. try {
  7604. return document.activeElement;
  7605. } catch (err) {}
  7606. } // Expose the picker constructor.
  7607. return PickerConstructor;
  7608. });
  7609. ;
  7610. /*!
  7611. * Date picker for pickadate.js v3.5.0
  7612. * http://amsul.github.io/pickadate.js/date.htm
  7613. */
  7614. (function (factory) {
  7615. factory(Materialize.Picker, jQuery);
  7616. })(function (Picker, $) {
  7617. /**
  7618. * Globals and constants
  7619. */
  7620. var DAYS_IN_WEEK = 7,
  7621. WEEKS_IN_CALENDAR = 6,
  7622. _ = Picker._;
  7623. /**
  7624. * The date picker constructor
  7625. */
  7626. function DatePicker(picker, settings) {
  7627. var calendar = this,
  7628. element = picker.$node[0],
  7629. elementValue = element.value,
  7630. elementDataValue = picker.$node.data('value'),
  7631. valueString = elementDataValue || elementValue,
  7632. formatString = elementDataValue ? settings.formatSubmit : settings.format,
  7633. isRTL = function isRTL() {
  7634. return element.currentStyle ? // For IE.
  7635. element.currentStyle.direction == 'rtl' : // For normal browsers.
  7636. getComputedStyle(picker.$root[0]).direction == 'rtl';
  7637. };
  7638. calendar.settings = settings;
  7639. calendar.$node = picker.$node; // The queue of methods that will be used to build item objects.
  7640. calendar.queue = {
  7641. min: 'measure create',
  7642. max: 'measure create',
  7643. now: 'now create',
  7644. select: 'parse create validate',
  7645. highlight: 'parse navigate create validate',
  7646. view: 'parse create validate viewset',
  7647. disable: 'deactivate',
  7648. enable: 'activate' // The component's item object.
  7649. };
  7650. calendar.item = {};
  7651. calendar.item.clear = null;
  7652. calendar.item.disable = (settings.disable || []).slice(0);
  7653. calendar.item.enable = -function (collectionDisabled) {
  7654. return collectionDisabled[0] === true ? collectionDisabled.shift() : -1;
  7655. }(calendar.item.disable);
  7656. calendar.set('min', settings.min).set('max', settings.max).set('now'); // When there’s a value, set the `select`, which in turn
  7657. // also sets the `highlight` and `view`.
  7658. if (valueString) {
  7659. calendar.set('select', valueString, {
  7660. format: formatString
  7661. });
  7662. } // If there’s no value, default to highlighting “today”.
  7663. else {
  7664. calendar.set('select', null).set('highlight', calendar.item.now);
  7665. } // The keycode to movement mapping.
  7666. calendar.key = {
  7667. 40: 7,
  7668. // Down
  7669. 38: -7,
  7670. // Up
  7671. 39: function _() {
  7672. return isRTL() ? -1 : 1;
  7673. },
  7674. // Right
  7675. 37: function _() {
  7676. return isRTL() ? 1 : -1;
  7677. },
  7678. // Left
  7679. go: function go(timeChange) {
  7680. var highlightedObject = calendar.item.highlight,
  7681. targetDate = new Date(highlightedObject.year, highlightedObject.month, highlightedObject.date + timeChange);
  7682. calendar.set('highlight', targetDate, {
  7683. interval: timeChange
  7684. });
  7685. this.render();
  7686. } // Bind some picker events.
  7687. };
  7688. picker.on('render', function () {
  7689. picker.$root.find('.' + settings.klass.selectMonth).on('change', function () {
  7690. var value = this.value;
  7691. if (value) {
  7692. picker.set('highlight', [picker.get('view').year, value, picker.get('highlight').date]);
  7693. picker.$root.find('.' + settings.klass.selectMonth).trigger('focus');
  7694. }
  7695. });
  7696. picker.$root.find('.' + settings.klass.selectYear).on('change', function () {
  7697. var value = this.value;
  7698. if (value) {
  7699. picker.set('highlight', [value, picker.get('view').month, picker.get('highlight').date]);
  7700. picker.$root.find('.' + settings.klass.selectYear).trigger('focus');
  7701. }
  7702. });
  7703. }, 1).on('open', function () {
  7704. var includeToday = '';
  7705. if (calendar.disabled(calendar.get('now'))) {
  7706. includeToday = ':not(.' + settings.klass.buttonToday + ')';
  7707. }
  7708. picker.$root.find('button' + includeToday + ', select').attr('disabled', false);
  7709. }, 1).on('close', function () {
  7710. picker.$root.find('button, select').attr('disabled', true);
  7711. }, 1);
  7712. } //DatePicker
  7713. /**
  7714. * Set a datepicker item object.
  7715. */
  7716. DatePicker.prototype.set = function (type, value, options) {
  7717. var calendar = this,
  7718. calendarItem = calendar.item; // If the value is `null` just set it immediately.
  7719. if (value === null) {
  7720. if (type == 'clear') type = 'select';
  7721. calendarItem[type] = value;
  7722. return calendar;
  7723. } // Otherwise go through the queue of methods, and invoke the functions.
  7724. // Update this as the time unit, and set the final value as this item.
  7725. // * In the case of `enable`, keep the queue but set `disable` instead.
  7726. // And in the case of `flip`, keep the queue but set `enable` instead.
  7727. calendarItem[type == 'enable' ? 'disable' : type == 'flip' ? 'enable' : type] = calendar.queue[type].split(' ').map(function (method) {
  7728. value = calendar[method](type, value, options);
  7729. return value;
  7730. }).pop(); // Check if we need to cascade through more updates.
  7731. if (type == 'select') {
  7732. calendar.set('highlight', calendarItem.select, options);
  7733. } else if (type == 'highlight') {
  7734. calendar.set('view', calendarItem.highlight, options);
  7735. } else if (type.match(/^(flip|min|max|disable|enable)$/)) {
  7736. if (calendarItem.select && calendar.disabled(calendarItem.select)) {
  7737. calendar.set('select', calendarItem.select, options);
  7738. }
  7739. if (calendarItem.highlight && calendar.disabled(calendarItem.highlight)) {
  7740. calendar.set('highlight', calendarItem.highlight, options);
  7741. }
  7742. }
  7743. return calendar;
  7744. }; //DatePicker.prototype.set
  7745. /**
  7746. * Get a datepicker item object.
  7747. */
  7748. DatePicker.prototype.get = function (type) {
  7749. return this.item[type];
  7750. }; //DatePicker.prototype.get
  7751. /**
  7752. * Create a picker date object.
  7753. */
  7754. DatePicker.prototype.create = function (type, value, options) {
  7755. var isInfiniteValue,
  7756. calendar = this; // If there’s no value, use the type as the value.
  7757. value = value === undefined ? type : value; // If it’s infinity, update the value.
  7758. if (value == -Infinity || value == Infinity) {
  7759. isInfiniteValue = value;
  7760. } // If it’s an object, use the native date object.
  7761. else if ($.isPlainObject(value) && _.isInteger(value.pick)) {
  7762. value = value.obj;
  7763. } // If it’s an array, convert it into a date and make sure
  7764. // that it’s a valid date – otherwise default to today.
  7765. else if ($.isArray(value)) {
  7766. value = new Date(value[0], value[1], value[2]);
  7767. value = _.isDate(value) ? value : calendar.create().obj;
  7768. } // If it’s a number or date object, make a normalized date.
  7769. else if (_.isInteger(value) || _.isDate(value)) {
  7770. value = calendar.normalize(new Date(value), options);
  7771. } // If it’s a literal true or any other case, set it to now.
  7772. else
  7773. /*if ( value === true )*/
  7774. {
  7775. value = calendar.now(type, value, options);
  7776. } // Return the compiled object.
  7777. return {
  7778. year: isInfiniteValue || value.getFullYear(),
  7779. month: isInfiniteValue || value.getMonth(),
  7780. date: isInfiniteValue || value.getDate(),
  7781. day: isInfiniteValue || value.getDay(),
  7782. obj: isInfiniteValue || value,
  7783. pick: isInfiniteValue || value.getTime()
  7784. };
  7785. }; //DatePicker.prototype.create
  7786. /**
  7787. * Create a range limit object using an array, date object,
  7788. * literal “true”, or integer relative to another time.
  7789. */
  7790. DatePicker.prototype.createRange = function (from, to) {
  7791. var calendar = this,
  7792. createDate = function createDate(date) {
  7793. if (date === true || $.isArray(date) || _.isDate(date)) {
  7794. return calendar.create(date);
  7795. }
  7796. return date;
  7797. }; // Create objects if possible.
  7798. if (!_.isInteger(from)) {
  7799. from = createDate(from);
  7800. }
  7801. if (!_.isInteger(to)) {
  7802. to = createDate(to);
  7803. } // Create relative dates.
  7804. if (_.isInteger(from) && $.isPlainObject(to)) {
  7805. from = [to.year, to.month, to.date + from];
  7806. } else if (_.isInteger(to) && $.isPlainObject(from)) {
  7807. to = [from.year, from.month, from.date + to];
  7808. }
  7809. return {
  7810. from: createDate(from),
  7811. to: createDate(to)
  7812. };
  7813. }; //DatePicker.prototype.createRange
  7814. /**
  7815. * Check if a date unit falls within a date range object.
  7816. */
  7817. DatePicker.prototype.withinRange = function (range, dateUnit) {
  7818. range = this.createRange(range.from, range.to);
  7819. return dateUnit.pick >= range.from.pick && dateUnit.pick <= range.to.pick;
  7820. };
  7821. /**
  7822. * Check if two date range objects overlap.
  7823. */
  7824. DatePicker.prototype.overlapRanges = function (one, two) {
  7825. var calendar = this; // Convert the ranges into comparable dates.
  7826. one = calendar.createRange(one.from, one.to);
  7827. two = calendar.createRange(two.from, two.to);
  7828. return calendar.withinRange(one, two.from) || calendar.withinRange(one, two.to) || calendar.withinRange(two, one.from) || calendar.withinRange(two, one.to);
  7829. };
  7830. /**
  7831. * Get the date today.
  7832. */
  7833. DatePicker.prototype.now = function (type, value, options) {
  7834. value = new Date();
  7835. if (options && options.rel) {
  7836. value.setDate(value.getDate() + options.rel);
  7837. }
  7838. return this.normalize(value, options);
  7839. };
  7840. /**
  7841. * Navigate to next/prev month.
  7842. */
  7843. DatePicker.prototype.navigate = function (type, value, options) {
  7844. var targetDateObject,
  7845. targetYear,
  7846. targetMonth,
  7847. targetDate,
  7848. isTargetArray = $.isArray(value),
  7849. isTargetObject = $.isPlainObject(value),
  7850. viewsetObject = this.item.view;
  7851. /*,
  7852. safety = 100*/
  7853. if (isTargetArray || isTargetObject) {
  7854. if (isTargetObject) {
  7855. targetYear = value.year;
  7856. targetMonth = value.month;
  7857. targetDate = value.date;
  7858. } else {
  7859. targetYear = +value[0];
  7860. targetMonth = +value[1];
  7861. targetDate = +value[2];
  7862. } // If we’re navigating months but the view is in a different
  7863. // month, navigate to the view’s year and month.
  7864. if (options && options.nav && viewsetObject && viewsetObject.month !== targetMonth) {
  7865. targetYear = viewsetObject.year;
  7866. targetMonth = viewsetObject.month;
  7867. } // Figure out the expected target year and month.
  7868. targetDateObject = new Date(targetYear, targetMonth + (options && options.nav ? options.nav : 0), 1);
  7869. targetYear = targetDateObject.getFullYear();
  7870. targetMonth = targetDateObject.getMonth(); // If the month we’re going to doesn’t have enough days,
  7871. // keep decreasing the date until we reach the month’s last date.
  7872. while (
  7873. /*safety &&*/
  7874. new Date(targetYear, targetMonth, targetDate).getMonth() !== targetMonth) {
  7875. targetDate -= 1;
  7876. /*safety -= 1
  7877. if ( !safety ) {
  7878. throw 'Fell into an infinite loop while navigating to ' + new Date( targetYear, targetMonth, targetDate ) + '.'
  7879. }*/
  7880. }
  7881. value = [targetYear, targetMonth, targetDate];
  7882. }
  7883. return value;
  7884. }; //DatePicker.prototype.navigate
  7885. /**
  7886. * Normalize a date by setting the hours to midnight.
  7887. */
  7888. DatePicker.prototype.normalize = function (value
  7889. /*, options*/
  7890. ) {
  7891. value.setHours(0, 0, 0, 0);
  7892. return value;
  7893. };
  7894. /**
  7895. * Measure the range of dates.
  7896. */
  7897. DatePicker.prototype.measure = function (type, value
  7898. /*, options*/
  7899. ) {
  7900. var calendar = this; // If it’s anything false-y, remove the limits.
  7901. if (!value) {
  7902. value = type == 'min' ? -Infinity : Infinity;
  7903. } // If it’s a string, parse it.
  7904. else if (typeof value == 'string') {
  7905. value = calendar.parse(type, value);
  7906. } // If it's an integer, get a date relative to today.
  7907. else if (_.isInteger(value)) {
  7908. value = calendar.now(type, value, {
  7909. rel: value
  7910. });
  7911. }
  7912. return value;
  7913. }; ///DatePicker.prototype.measure
  7914. /**
  7915. * Create a viewset object based on navigation.
  7916. */
  7917. DatePicker.prototype.viewset = function (type, dateObject
  7918. /*, options*/
  7919. ) {
  7920. return this.create([dateObject.year, dateObject.month, 1]);
  7921. };
  7922. /**
  7923. * Validate a date as enabled and shift if needed.
  7924. */
  7925. DatePicker.prototype.validate = function (type, dateObject, options) {
  7926. var calendar = this,
  7927. // Keep a reference to the original date.
  7928. originalDateObject = dateObject,
  7929. // Make sure we have an interval.
  7930. interval = options && options.interval ? options.interval : 1,
  7931. // Check if the calendar enabled dates are inverted.
  7932. isFlippedBase = calendar.item.enable === -1,
  7933. // Check if we have any enabled dates after/before now.
  7934. hasEnabledBeforeTarget,
  7935. hasEnabledAfterTarget,
  7936. // The min & max limits.
  7937. minLimitObject = calendar.item.min,
  7938. maxLimitObject = calendar.item.max,
  7939. // Check if we’ve reached the limit during shifting.
  7940. reachedMin,
  7941. reachedMax,
  7942. // Check if the calendar is inverted and at least one weekday is enabled.
  7943. hasEnabledWeekdays = isFlippedBase && calendar.item.disable.filter(function (value) {
  7944. // If there’s a date, check where it is relative to the target.
  7945. if ($.isArray(value)) {
  7946. var dateTime = calendar.create(value).pick;
  7947. if (dateTime < dateObject.pick) hasEnabledBeforeTarget = true;else if (dateTime > dateObject.pick) hasEnabledAfterTarget = true;
  7948. } // Return only integers for enabled weekdays.
  7949. return _.isInteger(value);
  7950. }).length;
  7951. /*,
  7952. safety = 100*/
  7953. // Cases to validate for:
  7954. // [1] Not inverted and date disabled.
  7955. // [2] Inverted and some dates enabled.
  7956. // [3] Not inverted and out of range.
  7957. //
  7958. // Cases to **not** validate for:
  7959. // • Navigating months.
  7960. // • Not inverted and date enabled.
  7961. // • Inverted and all dates disabled.
  7962. // • ..and anything else.
  7963. if (!options || !options.nav) if (
  7964. /* 1 */
  7965. !isFlippedBase && calendar.disabled(dateObject) ||
  7966. /* 2 */
  7967. isFlippedBase && calendar.disabled(dateObject) && (hasEnabledWeekdays || hasEnabledBeforeTarget || hasEnabledAfterTarget) ||
  7968. /* 3 */
  7969. !isFlippedBase && (dateObject.pick <= minLimitObject.pick || dateObject.pick >= maxLimitObject.pick)) {
  7970. // When inverted, flip the direction if there aren’t any enabled weekdays
  7971. // and there are no enabled dates in the direction of the interval.
  7972. if (isFlippedBase && !hasEnabledWeekdays && (!hasEnabledAfterTarget && interval > 0 || !hasEnabledBeforeTarget && interval < 0)) {
  7973. interval *= -1;
  7974. } // Keep looping until we reach an enabled date.
  7975. while (
  7976. /*safety &&*/
  7977. calendar.disabled(dateObject)) {
  7978. /*safety -= 1
  7979. if ( !safety ) {
  7980. throw 'Fell into an infinite loop while validating ' + dateObject.obj + '.'
  7981. }*/
  7982. // If we’ve looped into the next/prev month with a large interval, return to the original date and flatten the interval.
  7983. if (Math.abs(interval) > 1 && (dateObject.month < originalDateObject.month || dateObject.month > originalDateObject.month)) {
  7984. dateObject = originalDateObject;
  7985. interval = interval > 0 ? 1 : -1;
  7986. } // If we’ve reached the min/max limit, reverse the direction, flatten the interval and set it to the limit.
  7987. if (dateObject.pick <= minLimitObject.pick) {
  7988. reachedMin = true;
  7989. interval = 1;
  7990. dateObject = calendar.create([minLimitObject.year, minLimitObject.month, minLimitObject.date + (dateObject.pick === minLimitObject.pick ? 0 : -1)]);
  7991. } else if (dateObject.pick >= maxLimitObject.pick) {
  7992. reachedMax = true;
  7993. interval = -1;
  7994. dateObject = calendar.create([maxLimitObject.year, maxLimitObject.month, maxLimitObject.date + (dateObject.pick === maxLimitObject.pick ? 0 : 1)]);
  7995. } // If we’ve reached both limits, just break out of the loop.
  7996. if (reachedMin && reachedMax) {
  7997. break;
  7998. } // Finally, create the shifted date using the interval and keep looping.
  7999. dateObject = calendar.create([dateObject.year, dateObject.month, dateObject.date + interval]);
  8000. }
  8001. } //endif
  8002. // Return the date object settled on.
  8003. return dateObject;
  8004. }; //DatePicker.prototype.validate
  8005. /**
  8006. * Check if a date is disabled.
  8007. */
  8008. DatePicker.prototype.disabled = function (dateToVerify) {
  8009. var calendar = this,
  8010. // Filter through the disabled dates to check if this is one.
  8011. isDisabledMatch = calendar.item.disable.filter(function (dateToDisable) {
  8012. // If the date is a number, match the weekday with 0index and `firstDay` check.
  8013. if (_.isInteger(dateToDisable)) {
  8014. return dateToVerify.day === (calendar.settings.firstDay ? dateToDisable : dateToDisable - 1) % 7;
  8015. } // If it’s an array or a native JS date, create and match the exact date.
  8016. if ($.isArray(dateToDisable) || _.isDate(dateToDisable)) {
  8017. return dateToVerify.pick === calendar.create(dateToDisable).pick;
  8018. } // If it’s an object, match a date within the “from” and “to” range.
  8019. if ($.isPlainObject(dateToDisable)) {
  8020. return calendar.withinRange(dateToDisable, dateToVerify);
  8021. }
  8022. }); // If this date matches a disabled date, confirm it’s not inverted.
  8023. isDisabledMatch = isDisabledMatch.length && !isDisabledMatch.filter(function (dateToDisable) {
  8024. return $.isArray(dateToDisable) && dateToDisable[3] == 'inverted' || $.isPlainObject(dateToDisable) && dateToDisable.inverted;
  8025. }).length; // Check the calendar “enabled” flag and respectively flip the
  8026. // disabled state. Then also check if it’s beyond the min/max limits.
  8027. return calendar.item.enable === -1 ? !isDisabledMatch : isDisabledMatch || dateToVerify.pick < calendar.item.min.pick || dateToVerify.pick > calendar.item.max.pick;
  8028. }; //DatePicker.prototype.disabled
  8029. /**
  8030. * Parse a string into a usable type.
  8031. */
  8032. DatePicker.prototype.parse = function (type, value, options) {
  8033. var calendar = this,
  8034. parsingObject = {}; // If it’s already parsed, we’re good.
  8035. if (!value || typeof value != 'string') {
  8036. return value;
  8037. } // We need a `.format` to parse the value with.
  8038. if (!(options && options.format)) {
  8039. options = options || {};
  8040. options.format = calendar.settings.format;
  8041. } // Convert the format into an array and then map through it.
  8042. calendar.formats.toArray(options.format).map(function (label) {
  8043. var // Grab the formatting label.
  8044. formattingLabel = calendar.formats[label],
  8045. // The format length is from the formatting label function or the
  8046. // label length without the escaping exclamation (!) mark.
  8047. formatLength = formattingLabel ? _.trigger(formattingLabel, calendar, [value, parsingObject]) : label.replace(/^!/, '').length; // If there's a format label, split the value up to the format length.
  8048. // Then add it to the parsing object with appropriate label.
  8049. if (formattingLabel) {
  8050. parsingObject[label] = value.substr(0, formatLength);
  8051. } // Update the value as the substring from format length to end.
  8052. value = value.substr(formatLength);
  8053. }); // Compensate for month 0index.
  8054. return [parsingObject.yyyy || parsingObject.yy, +(parsingObject.mm || parsingObject.m) - 1, parsingObject.dd || parsingObject.d];
  8055. }; //DatePicker.prototype.parse
  8056. /**
  8057. * Various formats to display the object in.
  8058. */
  8059. DatePicker.prototype.formats = function () {
  8060. // Return the length of the first word in a collection.
  8061. function getWordLengthFromCollection(string, collection, dateObject) {
  8062. // Grab the first word from the string.
  8063. var word = string.match(/\w+/)[0]; // If there's no month index, add it to the date object
  8064. if (!dateObject.mm && !dateObject.m) {
  8065. dateObject.m = collection.indexOf(word) + 1;
  8066. } // Return the length of the word.
  8067. return word.length;
  8068. } // Get the length of the first word in a string.
  8069. function getFirstWordLength(string) {
  8070. return string.match(/\w+/)[0].length;
  8071. }
  8072. return {
  8073. d: function d(string, dateObject) {
  8074. // If there's string, then get the digits length.
  8075. // Otherwise return the selected date.
  8076. return string ? _.digits(string) : dateObject.date;
  8077. },
  8078. dd: function dd(string, dateObject) {
  8079. // If there's a string, then the length is always 2.
  8080. // Otherwise return the selected date with a leading zero.
  8081. return string ? 2 : _.lead(dateObject.date);
  8082. },
  8083. ddd: function ddd(string, dateObject) {
  8084. // If there's a string, then get the length of the first word.
  8085. // Otherwise return the short selected weekday.
  8086. return string ? getFirstWordLength(string) : this.settings.weekdaysShort[dateObject.day];
  8087. },
  8088. dddd: function dddd(string, dateObject) {
  8089. // If there's a string, then get the length of the first word.
  8090. // Otherwise return the full selected weekday.
  8091. return string ? getFirstWordLength(string) : this.settings.weekdaysFull[dateObject.day];
  8092. },
  8093. m: function m(string, dateObject) {
  8094. // If there's a string, then get the length of the digits
  8095. // Otherwise return the selected month with 0index compensation.
  8096. return string ? _.digits(string) : dateObject.month + 1;
  8097. },
  8098. mm: function mm(string, dateObject) {
  8099. // If there's a string, then the length is always 2.
  8100. // Otherwise return the selected month with 0index and leading zero.
  8101. return string ? 2 : _.lead(dateObject.month + 1);
  8102. },
  8103. mmm: function mmm(string, dateObject) {
  8104. var collection = this.settings.monthsShort; // If there's a string, get length of the relevant month from the short
  8105. // months collection. Otherwise return the selected month from that collection.
  8106. return string ? getWordLengthFromCollection(string, collection, dateObject) : collection[dateObject.month];
  8107. },
  8108. mmmm: function mmmm(string, dateObject) {
  8109. var collection = this.settings.monthsFull; // If there's a string, get length of the relevant month from the full
  8110. // months collection. Otherwise return the selected month from that collection.
  8111. return string ? getWordLengthFromCollection(string, collection, dateObject) : collection[dateObject.month];
  8112. },
  8113. yy: function yy(string, dateObject) {
  8114. // If there's a string, then the length is always 2.
  8115. // Otherwise return the selected year by slicing out the first 2 digits.
  8116. return string ? 2 : ('' + dateObject.year).slice(2);
  8117. },
  8118. yyyy: function yyyy(string, dateObject) {
  8119. // If there's a string, then the length is always 4.
  8120. // Otherwise return the selected year.
  8121. return string ? 4 : dateObject.year;
  8122. },
  8123. // Create an array by splitting the formatting string passed.
  8124. toArray: function toArray(formatString) {
  8125. return formatString.split(/(d{1,4}|m{1,4}|y{4}|yy|!.)/g);
  8126. },
  8127. // Format an object into a string using the formatting options.
  8128. toString: function toString(formatString, itemObject) {
  8129. var calendar = this;
  8130. return calendar.formats.toArray(formatString).map(function (label) {
  8131. return _.trigger(calendar.formats[label], calendar, [0, itemObject]) || label.replace(/^!/, '');
  8132. }).join('');
  8133. }
  8134. };
  8135. }(); //DatePicker.prototype.formats
  8136. /**
  8137. * Check if two date units are the exact.
  8138. */
  8139. DatePicker.prototype.isDateExact = function (one, two) {
  8140. var calendar = this; // When we’re working with weekdays, do a direct comparison.
  8141. if (_.isInteger(one) && _.isInteger(two) || typeof one == 'boolean' && typeof two == 'boolean') {
  8142. return one === two;
  8143. } // When we’re working with date representations, compare the “pick” value.
  8144. if ((_.isDate(one) || $.isArray(one)) && (_.isDate(two) || $.isArray(two))) {
  8145. return calendar.create(one).pick === calendar.create(two).pick;
  8146. } // When we’re working with range objects, compare the “from” and “to”.
  8147. if ($.isPlainObject(one) && $.isPlainObject(two)) {
  8148. return calendar.isDateExact(one.from, two.from) && calendar.isDateExact(one.to, two.to);
  8149. }
  8150. return false;
  8151. };
  8152. /**
  8153. * Check if two date units overlap.
  8154. */
  8155. DatePicker.prototype.isDateOverlap = function (one, two) {
  8156. var calendar = this,
  8157. firstDay = calendar.settings.firstDay ? 1 : 0; // When we’re working with a weekday index, compare the days.
  8158. if (_.isInteger(one) && (_.isDate(two) || $.isArray(two))) {
  8159. one = one % 7 + firstDay;
  8160. return one === calendar.create(two).day + 1;
  8161. }
  8162. if (_.isInteger(two) && (_.isDate(one) || $.isArray(one))) {
  8163. two = two % 7 + firstDay;
  8164. return two === calendar.create(one).day + 1;
  8165. } // When we’re working with range objects, check if the ranges overlap.
  8166. if ($.isPlainObject(one) && $.isPlainObject(two)) {
  8167. return calendar.overlapRanges(one, two);
  8168. }
  8169. return false;
  8170. };
  8171. /**
  8172. * Flip the “enabled” state.
  8173. */
  8174. DatePicker.prototype.flipEnable = function (val) {
  8175. var itemObject = this.item;
  8176. itemObject.enable = val || (itemObject.enable == -1 ? 1 : -1);
  8177. };
  8178. /**
  8179. * Mark a collection of dates as “disabled”.
  8180. */
  8181. DatePicker.prototype.deactivate = function (type, datesToDisable) {
  8182. var calendar = this,
  8183. disabledItems = calendar.item.disable.slice(0); // If we’re flipping, that’s all we need to do.
  8184. if (datesToDisable == 'flip') {
  8185. calendar.flipEnable();
  8186. } else if (datesToDisable === false) {
  8187. calendar.flipEnable(1);
  8188. disabledItems = [];
  8189. } else if (datesToDisable === true) {
  8190. calendar.flipEnable(-1);
  8191. disabledItems = [];
  8192. } // Otherwise go through the dates to disable.
  8193. else {
  8194. datesToDisable.map(function (unitToDisable) {
  8195. var matchFound; // When we have disabled items, check for matches.
  8196. // If something is matched, immediately break out.
  8197. for (var index = 0; index < disabledItems.length; index += 1) {
  8198. if (calendar.isDateExact(unitToDisable, disabledItems[index])) {
  8199. matchFound = true;
  8200. break;
  8201. }
  8202. } // If nothing was found, add the validated unit to the collection.
  8203. if (!matchFound) {
  8204. if (_.isInteger(unitToDisable) || _.isDate(unitToDisable) || $.isArray(unitToDisable) || $.isPlainObject(unitToDisable) && unitToDisable.from && unitToDisable.to) {
  8205. disabledItems.push(unitToDisable);
  8206. }
  8207. }
  8208. });
  8209. } // Return the updated collection.
  8210. return disabledItems;
  8211. }; //DatePicker.prototype.deactivate
  8212. /**
  8213. * Mark a collection of dates as “enabled”.
  8214. */
  8215. DatePicker.prototype.activate = function (type, datesToEnable) {
  8216. var calendar = this,
  8217. disabledItems = calendar.item.disable,
  8218. disabledItemsCount = disabledItems.length; // If we’re flipping, that’s all we need to do.
  8219. if (datesToEnable == 'flip') {
  8220. calendar.flipEnable();
  8221. } else if (datesToEnable === true) {
  8222. calendar.flipEnable(1);
  8223. disabledItems = [];
  8224. } else if (datesToEnable === false) {
  8225. calendar.flipEnable(-1);
  8226. disabledItems = [];
  8227. } // Otherwise go through the disabled dates.
  8228. else {
  8229. datesToEnable.map(function (unitToEnable) {
  8230. var matchFound, disabledUnit, index, isExactRange; // Go through the disabled items and try to find a match.
  8231. for (index = 0; index < disabledItemsCount; index += 1) {
  8232. disabledUnit = disabledItems[index]; // When an exact match is found, remove it from the collection.
  8233. if (calendar.isDateExact(disabledUnit, unitToEnable)) {
  8234. matchFound = disabledItems[index] = null;
  8235. isExactRange = true;
  8236. break;
  8237. } // When an overlapped match is found, add the “inverted” state to it.
  8238. else if (calendar.isDateOverlap(disabledUnit, unitToEnable)) {
  8239. if ($.isPlainObject(unitToEnable)) {
  8240. unitToEnable.inverted = true;
  8241. matchFound = unitToEnable;
  8242. } else if ($.isArray(unitToEnable)) {
  8243. matchFound = unitToEnable;
  8244. if (!matchFound[3]) matchFound.push('inverted');
  8245. } else if (_.isDate(unitToEnable)) {
  8246. matchFound = [unitToEnable.getFullYear(), unitToEnable.getMonth(), unitToEnable.getDate(), 'inverted'];
  8247. }
  8248. break;
  8249. }
  8250. } // If a match was found, remove a previous duplicate entry.
  8251. if (matchFound) for (index = 0; index < disabledItemsCount; index += 1) {
  8252. if (calendar.isDateExact(disabledItems[index], unitToEnable)) {
  8253. disabledItems[index] = null;
  8254. break;
  8255. }
  8256. } // In the event that we’re dealing with an exact range of dates,
  8257. // make sure there are no “inverted” dates because of it.
  8258. if (isExactRange) for (index = 0; index < disabledItemsCount; index += 1) {
  8259. if (calendar.isDateOverlap(disabledItems[index], unitToEnable)) {
  8260. disabledItems[index] = null;
  8261. break;
  8262. }
  8263. } // If something is still matched, add it into the collection.
  8264. if (matchFound) {
  8265. disabledItems.push(matchFound);
  8266. }
  8267. });
  8268. } // Return the updated collection.
  8269. return disabledItems.filter(function (val) {
  8270. return val != null;
  8271. });
  8272. }; //DatePicker.prototype.activate
  8273. /**
  8274. * Create a string for the nodes in the picker.
  8275. */
  8276. DatePicker.prototype.nodes = function (isOpen) {
  8277. var calendar = this,
  8278. settings = calendar.settings,
  8279. calendarItem = calendar.item,
  8280. nowObject = calendarItem.now,
  8281. selectedObject = calendarItem.select,
  8282. highlightedObject = calendarItem.highlight,
  8283. viewsetObject = calendarItem.view,
  8284. disabledCollection = calendarItem.disable,
  8285. minLimitObject = calendarItem.min,
  8286. maxLimitObject = calendarItem.max,
  8287. // Create the calendar table head using a copy of weekday labels collection.
  8288. // * We do a copy so we don't mutate the original array.
  8289. tableHead = function (collection, fullCollection) {
  8290. // If the first day should be Monday, move Sunday to the end.
  8291. if (settings.firstDay) {
  8292. collection.push(collection.shift());
  8293. fullCollection.push(fullCollection.shift());
  8294. } // Create and return the table head group.
  8295. return _.node('thead', _.node('tr', _.group({
  8296. min: 0,
  8297. max: DAYS_IN_WEEK - 1,
  8298. i: 1,
  8299. node: 'th',
  8300. item: function item(counter) {
  8301. return [collection[counter], settings.klass.weekdays, 'scope=col title="' + fullCollection[counter] + '"'];
  8302. }
  8303. }))); //endreturn
  8304. // Materialize modified
  8305. }((settings.showWeekdaysFull ? settings.weekdaysFull : settings.weekdaysLetter).slice(0), settings.weekdaysFull.slice(0)),
  8306. //tableHead
  8307. // Create the nav for next/prev month.
  8308. createMonthNav = function createMonthNav(next) {
  8309. // Otherwise, return the created month tag.
  8310. return _.node('div', ' ', settings.klass['nav' + (next ? 'Next' : 'Prev')] + ( // If the focused month is outside the range, disabled the button.
  8311. 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({
  8312. role: 'button',
  8313. controls: calendar.$node[0].id + '_table'
  8314. }) + ' ' + 'title="' + (next ? settings.labelMonthNext : settings.labelMonthPrev) + '"'); //endreturn
  8315. },
  8316. //createMonthNav
  8317. // Create the month label.
  8318. //Materialize modified
  8319. createMonthLabel = function createMonthLabel(override) {
  8320. var monthsCollection = settings.showMonthsShort ? settings.monthsShort : settings.monthsFull; // Materialize modified
  8321. if (override == "short_months") {
  8322. monthsCollection = settings.monthsShort;
  8323. } // If there are months to select, add a dropdown menu.
  8324. if (settings.selectMonths && override == undefined) {
  8325. return _.node('select', _.group({
  8326. min: 0,
  8327. max: 11,
  8328. i: 1,
  8329. node: 'option',
  8330. item: function item(loopedMonth) {
  8331. return [// The looped month and no classes.
  8332. monthsCollection[loopedMonth], 0, // Set the value and selected index.
  8333. 'value=' + loopedMonth + (viewsetObject.month == loopedMonth ? ' selected' : '') + (viewsetObject.year == minLimitObject.year && loopedMonth < minLimitObject.month || viewsetObject.year == maxLimitObject.year && loopedMonth > maxLimitObject.month ? ' disabled' : '')];
  8334. }
  8335. }), settings.klass.selectMonth + ' browser-default', (isOpen ? '' : 'disabled') + ' ' + _.ariaAttr({
  8336. controls: calendar.$node[0].id + '_table'
  8337. }) + ' ' + 'title="' + settings.labelMonthSelect + '"');
  8338. } // Materialize modified
  8339. if (override == "short_months") if (selectedObject != null) return monthsCollection[selectedObject.month];else return monthsCollection[viewsetObject.month]; // If there's a need for a month selector
  8340. return _.node('div', monthsCollection[viewsetObject.month], settings.klass.month);
  8341. },
  8342. //createMonthLabel
  8343. // Create the year label.
  8344. // Materialize modified
  8345. createYearLabel = function createYearLabel(override) {
  8346. var focusedYear = viewsetObject.year,
  8347. // If years selector is set to a literal "true", set it to 5. Otherwise
  8348. // divide in half to get half before and half after focused year.
  8349. numberYears = settings.selectYears === true ? 5 : ~~(settings.selectYears / 2); // If there are years to select, add a dropdown menu.
  8350. if (numberYears) {
  8351. var minYear = minLimitObject.year,
  8352. maxYear = maxLimitObject.year,
  8353. lowestYear = focusedYear - numberYears,
  8354. highestYear = focusedYear + numberYears; // If the min year is greater than the lowest year, increase the highest year
  8355. // by the difference and set the lowest year to the min year.
  8356. if (minYear > lowestYear) {
  8357. highestYear += minYear - lowestYear;
  8358. lowestYear = minYear;
  8359. } // If the max year is less than the highest year, decrease the lowest year
  8360. // by the lower of the two: available and needed years. Then set the
  8361. // highest year to the max year.
  8362. if (maxYear < highestYear) {
  8363. var availableYears = lowestYear - minYear,
  8364. neededYears = highestYear - maxYear;
  8365. lowestYear -= availableYears > neededYears ? neededYears : availableYears;
  8366. highestYear = maxYear;
  8367. }
  8368. if (settings.selectYears && override == undefined) {
  8369. return _.node('select', _.group({
  8370. min: lowestYear,
  8371. max: highestYear,
  8372. i: 1,
  8373. node: 'option',
  8374. item: function item(loopedYear) {
  8375. return [// The looped year and no classes.
  8376. loopedYear, 0, // Set the value and selected index.
  8377. 'value=' + loopedYear + (focusedYear == loopedYear ? ' selected' : '')];
  8378. }
  8379. }), settings.klass.selectYear + ' browser-default', (isOpen ? '' : 'disabled') + ' ' + _.ariaAttr({
  8380. controls: calendar.$node[0].id + '_table'
  8381. }) + ' ' + 'title="' + settings.labelYearSelect + '"');
  8382. }
  8383. } // Materialize modified
  8384. if (override === 'raw' && selectedObject != null) {
  8385. return _.node('div', selectedObject.year);
  8386. } // Otherwise just return the year focused
  8387. return _.node('div', focusedYear, settings.klass.year);
  8388. }; //createYearLabel
  8389. // Materialize modified
  8390. createDayLabel = function createDayLabel() {
  8391. if (selectedObject != null) return selectedObject.date;else return nowObject.date;
  8392. };
  8393. createWeekdayLabel = function createWeekdayLabel() {
  8394. var display_day;
  8395. if (selectedObject != null) display_day = selectedObject.day;else display_day = nowObject.day;
  8396. var weekday = settings.weekdaysShort[display_day];
  8397. return weekday;
  8398. }; // Create and return the entire calendar.
  8399. return _.node( // Date presentation View
  8400. 'div', _.node( // Div for Year
  8401. 'div', createYearLabel("raw"), settings.klass.year_display) + _.node('span', createWeekdayLabel() + ', ', "picker__weekday-display") + _.node( // Div for short Month
  8402. 'span', createMonthLabel("short_months") + ' ', settings.klass.month_display) + _.node( // Div for Day
  8403. 'span', createDayLabel(), settings.klass.day_display), settings.klass.date_display) + // Calendar container
  8404. _.node('div', _.node('div', _.node('div', (settings.selectYears ? createMonthLabel() + createYearLabel() : createMonthLabel() + createYearLabel()) + createMonthNav() + createMonthNav(1), settings.klass.header) + _.node('table', tableHead + _.node('tbody', _.group({
  8405. min: 0,
  8406. max: WEEKS_IN_CALENDAR - 1,
  8407. i: 1,
  8408. node: 'tr',
  8409. item: function item(rowCounter) {
  8410. // If Monday is the first day and the month starts on Sunday, shift the date back a week.
  8411. var shiftDateBy = settings.firstDay && calendar.create([viewsetObject.year, viewsetObject.month, 1]).day === 0 ? -7 : 0;
  8412. return [_.group({
  8413. min: DAYS_IN_WEEK * rowCounter - viewsetObject.day + shiftDateBy + 1,
  8414. // Add 1 for weekday 0index
  8415. max: function max() {
  8416. return this.min + DAYS_IN_WEEK - 1;
  8417. },
  8418. i: 1,
  8419. node: 'td',
  8420. item: function item(targetDate) {
  8421. // Convert the time date from a relative date to a target date.
  8422. targetDate = calendar.create([viewsetObject.year, viewsetObject.month, targetDate + (settings.firstDay ? 1 : 0)]);
  8423. var isSelected = selectedObject && selectedObject.pick == targetDate.pick,
  8424. isHighlighted = highlightedObject && highlightedObject.pick == targetDate.pick,
  8425. isDisabled = disabledCollection && calendar.disabled(targetDate) || targetDate.pick < minLimitObject.pick || targetDate.pick > maxLimitObject.pick,
  8426. formattedDate = _.trigger(calendar.formats.toString, calendar, [settings.format, targetDate]);
  8427. return [_.node('div', targetDate.date, function (klasses) {
  8428. // Add the `infocus` or `outfocus` classes based on month in view.
  8429. klasses.push(viewsetObject.month == targetDate.month ? settings.klass.infocus : settings.klass.outfocus); // Add the `today` class if needed.
  8430. if (nowObject.pick == targetDate.pick) {
  8431. klasses.push(settings.klass.now);
  8432. } // Add the `selected` class if something's selected and the time matches.
  8433. if (isSelected) {
  8434. klasses.push(settings.klass.selected);
  8435. } // Add the `highlighted` class if something's highlighted and the time matches.
  8436. if (isHighlighted) {
  8437. klasses.push(settings.klass.highlighted);
  8438. } // Add the `disabled` class if something's disabled and the object matches.
  8439. if (isDisabled) {
  8440. klasses.push(settings.klass.disabled);
  8441. }
  8442. return klasses.join(' ');
  8443. }([settings.klass.day]), 'data-pick=' + targetDate.pick + ' ' + _.ariaAttr({
  8444. role: 'gridcell',
  8445. label: formattedDate,
  8446. selected: isSelected && calendar.$node.val() === formattedDate ? true : null,
  8447. activedescendant: isHighlighted ? true : null,
  8448. disabled: isDisabled ? true : null
  8449. }) + ' ' + (isDisabled ? '' : 'tabindex="0"')), '', _.ariaAttr({
  8450. role: 'presentation'
  8451. })]; //endreturn
  8452. }
  8453. })]; //endreturn
  8454. }
  8455. })), settings.klass.table, 'id="' + calendar.$node[0].id + '_table' + '" ' + _.ariaAttr({
  8456. role: 'grid',
  8457. controls: calendar.$node[0].id,
  8458. readonly: true
  8459. })), settings.klass.calendar_container) // end calendar
  8460. + // * For Firefox forms to submit, make sure to set the buttons’ `type` attributes as “button”.
  8461. _.node('div', _.node('button', settings.today, "btn-flat picker__today waves-effect", 'type=button data-pick=' + nowObject.pick + (isOpen && !calendar.disabled(nowObject) ? '' : ' disabled') + ' ' + _.ariaAttr({
  8462. controls: calendar.$node[0].id
  8463. })) + _.node('button', settings.clear, "btn-flat picker__clear waves-effect", 'type=button data-clear=1' + (isOpen ? '' : ' disabled') + ' ' + _.ariaAttr({
  8464. controls: calendar.$node[0].id
  8465. })) + _.node('button', settings.close, "btn-flat picker__close waves-effect", 'type=button data-close=true ' + (isOpen ? '' : ' disabled') + ' ' + _.ariaAttr({
  8466. controls: calendar.$node[0].id
  8467. })), settings.klass.footer), 'picker__container__wrapper'); //endreturn
  8468. }; //DatePicker.prototype.nodes
  8469. /**
  8470. * The date picker defaults.
  8471. */
  8472. DatePicker.defaults = function (prefix) {
  8473. return {
  8474. // The title label to use for the month nav buttons
  8475. labelMonthNext: 'Next month',
  8476. labelMonthPrev: 'Previous month',
  8477. // The title label to use for the dropdown selectors
  8478. labelMonthSelect: 'Select a month',
  8479. labelYearSelect: 'Select a year',
  8480. // Months and weekdays
  8481. monthsFull: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
  8482. monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
  8483. weekdaysFull: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
  8484. weekdaysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
  8485. // Materialize modified
  8486. weekdaysLetter: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
  8487. // Today and clear
  8488. today: 'Today',
  8489. clear: 'Clear',
  8490. close: 'Ok',
  8491. // Picker close behavior (Prevent a change in behaviour for backwards compatibility)
  8492. closeOnSelect: false,
  8493. // The format to show on the `input` element
  8494. format: 'd mmmm, yyyy',
  8495. // Classes
  8496. klass: {
  8497. table: prefix + 'table',
  8498. header: prefix + 'header',
  8499. // Materialize Added klasses
  8500. date_display: prefix + 'date-display',
  8501. day_display: prefix + 'day-display',
  8502. month_display: prefix + 'month-display',
  8503. year_display: prefix + 'year-display',
  8504. calendar_container: prefix + 'calendar-container',
  8505. // end
  8506. navPrev: prefix + 'nav--prev',
  8507. navNext: prefix + 'nav--next',
  8508. navDisabled: prefix + 'nav--disabled',
  8509. month: prefix + 'month',
  8510. year: prefix + 'year',
  8511. selectMonth: prefix + 'select--month',
  8512. selectYear: prefix + 'select--year',
  8513. weekdays: prefix + 'weekday',
  8514. day: prefix + 'day',
  8515. disabled: prefix + 'day--disabled',
  8516. selected: prefix + 'day--selected',
  8517. highlighted: prefix + 'day--highlighted',
  8518. now: prefix + 'day--today',
  8519. infocus: prefix + 'day--infocus',
  8520. outfocus: prefix + 'day--outfocus',
  8521. footer: prefix + 'footer',
  8522. buttonClear: prefix + 'button--clear',
  8523. buttonToday: prefix + 'button--today',
  8524. buttonClose: prefix + 'button--close'
  8525. }
  8526. };
  8527. }(Picker.klasses().picker + '__');
  8528. /**
  8529. * Extend the picker to add the date picker.
  8530. */
  8531. Picker.extend('pickadate', DatePicker);
  8532. });
  8533. ;
  8534. /*!
  8535. * ClockPicker v0.0.7 (http://weareoutman.github.io/clockpicker/)
  8536. * Copyright 2014 Wang Shenwei.
  8537. * Licensed under MIT (https://github.com/weareoutman/clockpicker/blob/gh-pages/LICENSE)
  8538. *
  8539. * Further modified
  8540. * Copyright 2015 Ching Yaw Hao.
  8541. */
  8542. (function ($) {
  8543. var $win = $(window),
  8544. $doc = $(document); // Can I use inline svg ?
  8545. var svgNS = 'http://www.w3.org/2000/svg',
  8546. svgSupported = 'SVGAngle' in window && function () {
  8547. var supported,
  8548. el = document.createElement('div');
  8549. el.innerHTML = '<svg/>';
  8550. supported = (el.firstChild && el.firstChild.namespaceURI) == svgNS;
  8551. el.innerHTML = '';
  8552. return supported;
  8553. }(); // Can I use transition ?
  8554. var transitionSupported = function () {
  8555. var style = document.createElement('div').style;
  8556. return 'transition' in style || 'WebkitTransition' in style || 'MozTransition' in style || 'msTransition' in style || 'OTransition' in style;
  8557. }(); // Listen touch events in touch screen device, instead of mouse events in desktop.
  8558. var touchSupported = 'ontouchstart' in window,
  8559. mousedownEvent = 'mousedown' + (touchSupported ? ' touchstart' : ''),
  8560. mousemoveEvent = 'mousemove.clockpicker' + (touchSupported ? ' touchmove.clockpicker' : ''),
  8561. mouseupEvent = 'mouseup.clockpicker' + (touchSupported ? ' touchend.clockpicker' : ''); // Vibrate the device if supported
  8562. var vibrate = navigator.vibrate ? 'vibrate' : navigator.webkitVibrate ? 'webkitVibrate' : null;
  8563. function createSvgElement(name) {
  8564. return document.createElementNS(svgNS, name);
  8565. }
  8566. function leadingZero(num) {
  8567. return (num < 10 ? '0' : '') + num;
  8568. } // Get a unique id
  8569. var idCounter = 0;
  8570. function uniqueId(prefix) {
  8571. var id = ++idCounter + '';
  8572. return prefix ? prefix + id : id;
  8573. } // Clock size
  8574. var dialRadius = 135,
  8575. outerRadius = 105,
  8576. // innerRadius = 80 on 12 hour clock
  8577. innerRadius = 70,
  8578. tickRadius = 20,
  8579. diameter = dialRadius * 2,
  8580. duration = transitionSupported ? 350 : 1; // Popover template
  8581. 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(''); // ClockPicker
  8582. function ClockPicker(element, options) {
  8583. var popover = $(tpl),
  8584. plate = popover.find('.clockpicker-plate'),
  8585. holder = popover.find('.picker__holder'),
  8586. hoursView = popover.find('.clockpicker-hours'),
  8587. minutesView = popover.find('.clockpicker-minutes'),
  8588. amPmBlock = popover.find('.clockpicker-am-pm-block'),
  8589. isInput = element.prop('tagName') === 'INPUT',
  8590. input = isInput ? element : element.find('input'),
  8591. label = $("label[for=" + input.attr("id") + "]"),
  8592. self = this;
  8593. this.id = uniqueId('cp');
  8594. this.element = element;
  8595. this.holder = holder;
  8596. this.options = options;
  8597. this.isAppended = false;
  8598. this.isShown = false;
  8599. this.currentView = 'hours';
  8600. this.isInput = isInput;
  8601. this.input = input;
  8602. this.label = label;
  8603. this.popover = popover;
  8604. this.plate = plate;
  8605. this.hoursView = hoursView;
  8606. this.minutesView = minutesView;
  8607. this.amPmBlock = amPmBlock;
  8608. this.spanHours = popover.find('.clockpicker-span-hours');
  8609. this.spanMinutes = popover.find('.clockpicker-span-minutes');
  8610. this.spanAmPm = popover.find('.clockpicker-span-am-pm');
  8611. this.footer = popover.find('.picker__footer');
  8612. this.amOrPm = "PM"; // Setup for for 12 hour clock if option is selected
  8613. if (options.twelvehour) {
  8614. if (!options.ampmclickable) {
  8615. this.spanAmPm.empty();
  8616. $('<div id="click-am">AM</div>').appendTo(this.spanAmPm);
  8617. $('<div id="click-pm">PM</div>').appendTo(this.spanAmPm);
  8618. } else {
  8619. this.spanAmPm.empty();
  8620. $('<div id="click-am">AM</div>').on("click", function () {
  8621. self.spanAmPm.children('#click-am').addClass("text-primary");
  8622. self.spanAmPm.children('#click-pm').removeClass("text-primary");
  8623. self.amOrPm = "AM";
  8624. }).appendTo(this.spanAmPm);
  8625. $('<div id="click-pm">PM</div>').on("click", function () {
  8626. self.spanAmPm.children('#click-pm').addClass("text-primary");
  8627. self.spanAmPm.children('#click-am').removeClass("text-primary");
  8628. self.amOrPm = 'PM';
  8629. }).appendTo(this.spanAmPm);
  8630. }
  8631. } // Add buttons to footer
  8632. $('<button type="button" class="btn-flat picker__clear" tabindex="' + (options.twelvehour ? '3' : '1') + '">' + options.cleartext + '</button>').click($.proxy(this.clear, this)).appendTo(this.footer);
  8633. $('<button type="button" class="btn-flat picker__close" tabindex="' + (options.twelvehour ? '3' : '1') + '">' + options.canceltext + '</button>').click($.proxy(this.hide, this)).appendTo(this.footer);
  8634. $('<button type="button" class="btn-flat picker__close" tabindex="' + (options.twelvehour ? '3' : '1') + '">' + options.donetext + '</button>').click($.proxy(this.done, this)).appendTo(this.footer);
  8635. this.spanHours.click($.proxy(this.toggleView, this, 'hours'));
  8636. this.spanMinutes.click($.proxy(this.toggleView, this, 'minutes')); // Show or toggle
  8637. input.on('focus.clockpicker click.clockpicker', $.proxy(this.show, this)); // Build ticks
  8638. var tickTpl = $('<div class="clockpicker-tick"></div>'),
  8639. i,
  8640. tick,
  8641. radian,
  8642. radius; // Hours view
  8643. if (options.twelvehour) {
  8644. for (i = 1; i < 13; i += 1) {
  8645. tick = tickTpl.clone();
  8646. radian = i / 6 * Math.PI;
  8647. radius = outerRadius;
  8648. tick.css({
  8649. left: dialRadius + Math.sin(radian) * radius - tickRadius,
  8650. top: dialRadius - Math.cos(radian) * radius - tickRadius
  8651. });
  8652. tick.html(i === 0 ? '00' : i);
  8653. hoursView.append(tick);
  8654. tick.on(mousedownEvent, mousedown);
  8655. }
  8656. } else {
  8657. for (i = 0; i < 24; i += 1) {
  8658. tick = tickTpl.clone();
  8659. radian = i / 6 * Math.PI;
  8660. var inner = i > 0 && i < 13;
  8661. radius = inner ? innerRadius : outerRadius;
  8662. tick.css({
  8663. left: dialRadius + Math.sin(radian) * radius - tickRadius,
  8664. top: dialRadius - Math.cos(radian) * radius - tickRadius
  8665. });
  8666. tick.html(i === 0 ? '00' : i);
  8667. hoursView.append(tick);
  8668. tick.on(mousedownEvent, mousedown);
  8669. }
  8670. } // Minutes view
  8671. for (i = 0; i < 60; i += 5) {
  8672. tick = tickTpl.clone();
  8673. radian = i / 30 * Math.PI;
  8674. tick.css({
  8675. left: dialRadius + Math.sin(radian) * outerRadius - tickRadius,
  8676. top: dialRadius - Math.cos(radian) * outerRadius - tickRadius
  8677. });
  8678. tick.html(leadingZero(i));
  8679. minutesView.append(tick);
  8680. tick.on(mousedownEvent, mousedown);
  8681. } // Clicking on minutes view space
  8682. plate.on(mousedownEvent, function (e) {
  8683. if ($(e.target).closest('.clockpicker-tick').length === 0) {
  8684. mousedown(e, true);
  8685. }
  8686. }); // Mousedown or touchstart
  8687. function mousedown(e, space) {
  8688. var offset = plate.offset(),
  8689. isTouch = /^touch/.test(e.type),
  8690. x0 = offset.left + dialRadius,
  8691. y0 = offset.top + dialRadius,
  8692. dx = (isTouch ? e.originalEvent.touches[0] : e).pageX - x0,
  8693. dy = (isTouch ? e.originalEvent.touches[0] : e).pageY - y0,
  8694. z = Math.sqrt(dx * dx + dy * dy),
  8695. moved = false; // When clicking on minutes view space, check the mouse position
  8696. if (space && (z < outerRadius - tickRadius || z > outerRadius + tickRadius)) {
  8697. return;
  8698. }
  8699. e.preventDefault(); // Set cursor style of body after 200ms
  8700. var movingTimer = setTimeout(function () {
  8701. self.popover.addClass('clockpicker-moving');
  8702. }, 200); // Clock
  8703. self.setHand(dx, dy, !space, true); // Mousemove on document
  8704. $doc.off(mousemoveEvent).on(mousemoveEvent, function (e) {
  8705. e.preventDefault();
  8706. var isTouch = /^touch/.test(e.type),
  8707. x = (isTouch ? e.originalEvent.touches[0] : e).pageX - x0,
  8708. y = (isTouch ? e.originalEvent.touches[0] : e).pageY - y0;
  8709. if (!moved && x === dx && y === dy) {
  8710. // Clicking in chrome on windows will trigger a mousemove event
  8711. return;
  8712. }
  8713. moved = true;
  8714. self.setHand(x, y, false, true);
  8715. }); // Mouseup on document
  8716. $doc.off(mouseupEvent).on(mouseupEvent, function (e) {
  8717. $doc.off(mouseupEvent);
  8718. e.preventDefault();
  8719. var isTouch = /^touch/.test(e.type),
  8720. x = (isTouch ? e.originalEvent.changedTouches[0] : e).pageX - x0,
  8721. y = (isTouch ? e.originalEvent.changedTouches[0] : e).pageY - y0;
  8722. if ((space || moved) && x === dx && y === dy) {
  8723. self.setHand(x, y);
  8724. }
  8725. if (self.currentView === 'hours') {
  8726. self.toggleView('minutes', duration / 2);
  8727. } else if (options.autoclose) {
  8728. self.minutesView.addClass('clockpicker-dial-out');
  8729. setTimeout(function () {
  8730. self.done();
  8731. }, duration / 2);
  8732. }
  8733. plate.prepend(canvas); // Reset cursor style of body
  8734. clearTimeout(movingTimer);
  8735. self.popover.removeClass('clockpicker-moving'); // Unbind mousemove event
  8736. $doc.off(mousemoveEvent);
  8737. });
  8738. }
  8739. if (svgSupported) {
  8740. // Draw clock hands and others
  8741. var canvas = popover.find('.clockpicker-canvas'),
  8742. svg = createSvgElement('svg');
  8743. svg.setAttribute('class', 'clockpicker-svg');
  8744. svg.setAttribute('width', diameter);
  8745. svg.setAttribute('height', diameter);
  8746. var g = createSvgElement('g');
  8747. g.setAttribute('transform', 'translate(' + dialRadius + ',' + dialRadius + ')');
  8748. var bearing = createSvgElement('circle');
  8749. bearing.setAttribute('class', 'clockpicker-canvas-bearing');
  8750. bearing.setAttribute('cx', 0);
  8751. bearing.setAttribute('cy', 0);
  8752. bearing.setAttribute('r', 4);
  8753. var hand = createSvgElement('line');
  8754. hand.setAttribute('x1', 0);
  8755. hand.setAttribute('y1', 0);
  8756. var bg = createSvgElement('circle');
  8757. bg.setAttribute('class', 'clockpicker-canvas-bg');
  8758. bg.setAttribute('r', tickRadius);
  8759. g.appendChild(hand);
  8760. g.appendChild(bg);
  8761. g.appendChild(bearing);
  8762. svg.appendChild(g);
  8763. canvas.append(svg);
  8764. this.hand = hand;
  8765. this.bg = bg;
  8766. this.bearing = bearing;
  8767. this.g = g;
  8768. this.canvas = canvas;
  8769. }
  8770. raiseCallback(this.options.init);
  8771. }
  8772. function raiseCallback(callbackFunction) {
  8773. if (callbackFunction && typeof callbackFunction === "function") callbackFunction();
  8774. } // Default options
  8775. ClockPicker.DEFAULTS = {
  8776. 'default': '',
  8777. // default time, 'now' or '13:14' e.g.
  8778. fromnow: 0,
  8779. // set default time to * milliseconds from now (using with default = 'now')
  8780. donetext: 'Ok',
  8781. // done button text
  8782. cleartext: 'Clear',
  8783. canceltext: 'Cancel',
  8784. autoclose: false,
  8785. // auto close when minute is selected
  8786. ampmclickable: true,
  8787. // set am/pm button on itself
  8788. darktheme: false,
  8789. // set to dark theme
  8790. twelvehour: true,
  8791. // change to 12 hour AM/PM clock from 24 hour
  8792. vibrate: true // vibrate the device when dragging clock hand
  8793. }; // Show or hide popover
  8794. ClockPicker.prototype.toggle = function () {
  8795. this[this.isShown ? 'hide' : 'show']();
  8796. }; // Set popover position
  8797. ClockPicker.prototype.locate = function () {
  8798. var element = this.element,
  8799. popover = this.popover,
  8800. offset = element.offset(),
  8801. width = element.outerWidth(),
  8802. height = element.outerHeight(),
  8803. align = this.options.align,
  8804. self = this;
  8805. popover.show();
  8806. }; // Show popover
  8807. ClockPicker.prototype.show = function (e) {
  8808. // Not show again
  8809. if (this.isShown) {
  8810. return;
  8811. }
  8812. raiseCallback(this.options.beforeShow);
  8813. $(':input').each(function () {
  8814. $(this).attr('tabindex', -1);
  8815. });
  8816. var self = this; // Initialize
  8817. this.input.blur();
  8818. this.popover.addClass('picker--opened');
  8819. this.input.addClass('picker__input picker__input--active');
  8820. $(document.body).css('overflow', 'hidden'); // Get the time
  8821. var value = ((this.input.prop('value') || this.options['default'] || '') + '').split(':');
  8822. if (this.options.twelvehour && !(typeof value[1] === 'undefined')) {
  8823. if (value[1].indexOf("AM") > 0) {
  8824. this.amOrPm = 'AM';
  8825. } else {
  8826. this.amOrPm = 'PM';
  8827. }
  8828. value[1] = value[1].replace("AM", "").replace("PM", "");
  8829. }
  8830. if (value[0] === 'now') {
  8831. var now = new Date(+new Date() + this.options.fromnow);
  8832. value = [now.getHours(), now.getMinutes()];
  8833. if (this.options.twelvehour) {
  8834. this.amOrPm = value[0] >= 12 && value[0] < 24 ? 'PM' : 'AM';
  8835. }
  8836. }
  8837. this.hours = +value[0] || 0;
  8838. this.minutes = +value[1] || 0;
  8839. this.spanHours.html(this.hours);
  8840. this.spanMinutes.html(leadingZero(this.minutes));
  8841. if (!this.isAppended) {
  8842. // Append popover to input by default
  8843. var containerEl = document.querySelector(this.options.container);
  8844. if (this.options.container && containerEl) {
  8845. containerEl.appendChild(this.popover[0]);
  8846. } else {
  8847. this.popover.insertAfter(this.input);
  8848. }
  8849. if (this.options.twelvehour) {
  8850. if (this.amOrPm === 'PM') {
  8851. this.spanAmPm.children('#click-pm').addClass("text-primary");
  8852. this.spanAmPm.children('#click-am').removeClass("text-primary");
  8853. } else {
  8854. this.spanAmPm.children('#click-am').addClass("text-primary");
  8855. this.spanAmPm.children('#click-pm').removeClass("text-primary");
  8856. }
  8857. } // Reset position when resize
  8858. $win.on('resize.clockpicker' + this.id, function () {
  8859. if (self.isShown) {
  8860. self.locate();
  8861. }
  8862. });
  8863. this.isAppended = true;
  8864. } // Toggle to hours view
  8865. this.toggleView('hours'); // Set position
  8866. this.locate();
  8867. this.isShown = true; // Hide when clicking or tabbing on any element except the clock and input
  8868. $doc.on('click.clockpicker.' + this.id + ' focusin.clockpicker.' + this.id, function (e) {
  8869. var target = $(e.target);
  8870. if (target.closest(self.popover.find('.picker__wrap')).length === 0 && target.closest(self.input).length === 0) {
  8871. self.hide();
  8872. }
  8873. }); // Hide when ESC is pressed
  8874. $doc.on('keyup.clockpicker.' + this.id, function (e) {
  8875. if (e.keyCode === 27) {
  8876. self.hide();
  8877. }
  8878. });
  8879. raiseCallback(this.options.afterShow);
  8880. }; // Hide popover
  8881. ClockPicker.prototype.hide = function () {
  8882. raiseCallback(this.options.beforeHide);
  8883. this.input.removeClass('picker__input picker__input--active');
  8884. this.popover.removeClass('picker--opened');
  8885. $(document.body).css('overflow', 'visible');
  8886. this.isShown = false;
  8887. $(':input').each(function (index) {
  8888. $(this).attr('tabindex', index + 1);
  8889. }); // Unbinding events on document
  8890. $doc.off('click.clockpicker.' + this.id + ' focusin.clockpicker.' + this.id);
  8891. $doc.off('keyup.clockpicker.' + this.id);
  8892. this.popover.hide();
  8893. raiseCallback(this.options.afterHide);
  8894. }; // Toggle to hours or minutes view
  8895. ClockPicker.prototype.toggleView = function (view, delay) {
  8896. var raiseAfterHourSelect = false;
  8897. if (view === 'minutes' && $(this.hoursView).css("visibility") === "visible") {
  8898. raiseCallback(this.options.beforeHourSelect);
  8899. raiseAfterHourSelect = true;
  8900. }
  8901. var isHours = view === 'hours',
  8902. nextView = isHours ? this.hoursView : this.minutesView,
  8903. hideView = isHours ? this.minutesView : this.hoursView;
  8904. this.currentView = view;
  8905. this.spanHours.toggleClass('text-primary', isHours);
  8906. this.spanMinutes.toggleClass('text-primary', !isHours); // Let's make transitions
  8907. hideView.addClass('clockpicker-dial-out');
  8908. nextView.css('visibility', 'visible').removeClass('clockpicker-dial-out'); // Reset clock hand
  8909. this.resetClock(delay); // After transitions ended
  8910. clearTimeout(this.toggleViewTimer);
  8911. this.toggleViewTimer = setTimeout(function () {
  8912. hideView.css('visibility', 'hidden');
  8913. }, duration);
  8914. if (raiseAfterHourSelect) {
  8915. raiseCallback(this.options.afterHourSelect);
  8916. }
  8917. }; // Reset clock hand
  8918. ClockPicker.prototype.resetClock = function (delay) {
  8919. var view = this.currentView,
  8920. value = this[view],
  8921. isHours = view === 'hours',
  8922. unit = Math.PI / (isHours ? 6 : 30),
  8923. radian = value * unit,
  8924. radius = isHours && value > 0 && value < 13 ? innerRadius : outerRadius,
  8925. x = Math.sin(radian) * radius,
  8926. y = -Math.cos(radian) * radius,
  8927. self = this;
  8928. if (svgSupported && delay) {
  8929. self.canvas.addClass('clockpicker-canvas-out');
  8930. setTimeout(function () {
  8931. self.canvas.removeClass('clockpicker-canvas-out');
  8932. self.setHand(x, y);
  8933. }, delay);
  8934. } else this.setHand(x, y);
  8935. }; // Set clock hand to (x, y)
  8936. ClockPicker.prototype.setHand = function (x, y, roundBy5, dragging) {
  8937. var radian = Math.atan2(x, -y),
  8938. isHours = this.currentView === 'hours',
  8939. unit = Math.PI / (isHours || roundBy5 ? 6 : 30),
  8940. z = Math.sqrt(x * x + y * y),
  8941. options = this.options,
  8942. inner = isHours && z < (outerRadius + innerRadius) / 2,
  8943. radius = inner ? innerRadius : outerRadius,
  8944. value;
  8945. if (options.twelvehour) {
  8946. radius = outerRadius;
  8947. } // Radian should in range [0, 2PI]
  8948. if (radian < 0) {
  8949. radian = Math.PI * 2 + radian;
  8950. } // Get the round value
  8951. value = Math.round(radian / unit); // Get the round radian
  8952. radian = value * unit; // Correct the hours or minutes
  8953. if (options.twelvehour) {
  8954. if (isHours) {
  8955. if (value === 0) value = 12;
  8956. } else {
  8957. if (roundBy5) value *= 5;
  8958. if (value === 60) value = 0;
  8959. }
  8960. } else {
  8961. if (isHours) {
  8962. if (value === 12) value = 0;
  8963. value = inner ? value === 0 ? 12 : value : value === 0 ? 0 : value + 12;
  8964. } else {
  8965. if (roundBy5) value *= 5;
  8966. if (value === 60) value = 0;
  8967. }
  8968. } // Once hours or minutes changed, vibrate the device
  8969. if (this[this.currentView] !== value) {
  8970. if (vibrate && this.options.vibrate) {
  8971. // Do not vibrate too frequently
  8972. if (!this.vibrateTimer) {
  8973. navigator[vibrate](10);
  8974. this.vibrateTimer = setTimeout($.proxy(function () {
  8975. this.vibrateTimer = null;
  8976. }, this), 100);
  8977. }
  8978. }
  8979. }
  8980. this[this.currentView] = value;
  8981. if (isHours) {
  8982. this['spanHours'].html(value);
  8983. } else {
  8984. this['spanMinutes'].html(leadingZero(value));
  8985. } // If svg is not supported, just add an active class to the tick
  8986. if (!svgSupported) {
  8987. this[isHours ? 'hoursView' : 'minutesView'].find('.clockpicker-tick').each(function () {
  8988. var tick = $(this);
  8989. tick.toggleClass('active', value === +tick.html());
  8990. });
  8991. return;
  8992. } // Set clock hand and others' position
  8993. var cx1 = Math.sin(radian) * (radius - tickRadius),
  8994. cy1 = -Math.cos(radian) * (radius - tickRadius),
  8995. cx2 = Math.sin(radian) * radius,
  8996. cy2 = -Math.cos(radian) * radius;
  8997. this.hand.setAttribute('x2', cx1);
  8998. this.hand.setAttribute('y2', cy1);
  8999. this.bg.setAttribute('cx', cx2);
  9000. this.bg.setAttribute('cy', cy2);
  9001. }; // Hours and minutes are selected
  9002. ClockPicker.prototype.done = function () {
  9003. raiseCallback(this.options.beforeDone);
  9004. this.hide();
  9005. this.label.addClass('active');
  9006. var last = this.input.prop('value'),
  9007. value = leadingZero(this.hours) + ':' + leadingZero(this.minutes);
  9008. if (this.options.twelvehour) {
  9009. value = value + this.amOrPm;
  9010. }
  9011. this.input.prop('value', value);
  9012. if (value !== last) {
  9013. this.input.triggerHandler('change');
  9014. if (!this.isInput) {
  9015. this.element.trigger('change');
  9016. }
  9017. }
  9018. if (this.options.autoclose) this.input.trigger('blur');
  9019. raiseCallback(this.options.afterDone);
  9020. }; // Clear input field
  9021. ClockPicker.prototype.clear = function () {
  9022. this.hide();
  9023. this.label.removeClass('active');
  9024. var last = this.input.prop('value'),
  9025. value = '';
  9026. this.input.prop('value', value);
  9027. if (value !== last) {
  9028. this.input.triggerHandler('change');
  9029. if (!this.isInput) {
  9030. this.element.trigger('change');
  9031. }
  9032. }
  9033. if (this.options.autoclose) {
  9034. this.input.trigger('blur');
  9035. }
  9036. }; // Remove clockpicker from input
  9037. ClockPicker.prototype.remove = function () {
  9038. this.element.removeData('clockpicker');
  9039. this.input.off('focus.clockpicker click.clockpicker');
  9040. if (this.isShown) {
  9041. this.hide();
  9042. }
  9043. if (this.isAppended) {
  9044. $win.off('resize.clockpicker' + this.id);
  9045. this.popover.remove();
  9046. }
  9047. }; // Extends $.fn.clockpicker
  9048. $.fn.pickatime = function (option) {
  9049. var args = Array.prototype.slice.call(arguments, 1);
  9050. return this.each(function () {
  9051. var $this = $(this),
  9052. data = $this.data('clockpicker');
  9053. if (!data) {
  9054. var options = $.extend({}, ClockPicker.DEFAULTS, $this.data(), _typeof(option) == 'object' && option);
  9055. $this.data('clockpicker', new ClockPicker($this, options));
  9056. } else {
  9057. // Manual operatsions. show, hide, remove, e.g.
  9058. if (typeof data[option] === 'function') {
  9059. data[option].apply(data, args);
  9060. }
  9061. }
  9062. });
  9063. };
  9064. })(jQuery);
  9065. ;
  9066. (function ($) {
  9067. $.fn.characterCounter = function () {
  9068. return this.each(function () {
  9069. var $input = $(this);
  9070. var $counterElement = $input.parent().find('span[class="character-counter"]'); // character counter has already been added appended to the parent container
  9071. if ($counterElement.length) {
  9072. return;
  9073. }
  9074. var itHasLengthAttribute = $input.attr('data-length') !== undefined;
  9075. if (itHasLengthAttribute) {
  9076. $input.on('input', updateCounter);
  9077. $input.on('focus', updateCounter);
  9078. $input.on('blur', removeCounterElement);
  9079. addCounterElement($input);
  9080. }
  9081. });
  9082. };
  9083. function updateCounter() {
  9084. var maxLength = +$(this).attr('data-length'),
  9085. actualLength = +$(this).val().length,
  9086. isValidLength = actualLength <= maxLength;
  9087. $(this).parent().find('span[class="character-counter"]').html(actualLength + '/' + maxLength);
  9088. addInputStyle(isValidLength, $(this));
  9089. }
  9090. function addCounterElement($input) {
  9091. var $counterElement = $input.parent().find('span[class="character-counter"]');
  9092. if ($counterElement.length) {
  9093. return;
  9094. }
  9095. $counterElement = $('<span/>').addClass('character-counter').css('float', 'right').css('font-size', '12px').css('height', 1);
  9096. $input.parent().append($counterElement);
  9097. }
  9098. function removeCounterElement() {
  9099. $(this).parent().find('span[class="character-counter"]').html('');
  9100. }
  9101. function addInputStyle(isValidLength, $input) {
  9102. var inputHasInvalidClass = $input.hasClass('invalid');
  9103. if (isValidLength && inputHasInvalidClass) {
  9104. $input.removeClass('invalid');
  9105. } else if (!isValidLength && !inputHasInvalidClass) {
  9106. $input.removeClass('valid');
  9107. $input.addClass('invalid');
  9108. }
  9109. }
  9110. $(document).ready(function () {
  9111. $('input, textarea').characterCounter();
  9112. });
  9113. })(jQuery);
  9114. ;
  9115. (function ($) {
  9116. var methods = {
  9117. init: function init(options) {
  9118. var defaults = {
  9119. duration: 200,
  9120. // ms
  9121. dist: -100,
  9122. // zoom scale TODO: make this more intuitive as an option
  9123. shift: 0,
  9124. // spacing for center image
  9125. padding: 0,
  9126. // Padding between non center items
  9127. fullWidth: false,
  9128. // Change to full width styles
  9129. indicators: false,
  9130. // Toggle indicators
  9131. noWrap: false,
  9132. // Don't wrap around and cycle through items.
  9133. onCycleTo: null // Callback for when a new slide is cycled to.
  9134. };
  9135. options = $.extend(defaults, options);
  9136. var namespace = Materialize.objectSelectorString($(this));
  9137. return this.each(function (i) {
  9138. var images, item_width, item_height, offset, center, pressed, dim, count, reference, referenceY, amplitude, target, velocity, scrolling, xform, frame, timestamp, ticker, dragged, vertical_dragged;
  9139. var $indicators = $('<ul class="indicators"></ul>');
  9140. var scrollingTimeout = null;
  9141. var oneTimeCallback = null; // Initialize
  9142. var view = $(this);
  9143. var hasMultipleSlides = view.find('.carousel-item').length > 1;
  9144. var showIndicators = (view.attr('data-indicators') || options.indicators) && hasMultipleSlides;
  9145. var noWrap = view.attr('data-no-wrap') || options.noWrap || !hasMultipleSlides;
  9146. var uniqueNamespace = view.attr('data-namespace') || namespace + i;
  9147. view.attr('data-namespace', uniqueNamespace); // Options
  9148. var setCarouselHeight = function setCarouselHeight(imageOnly) {
  9149. var firstSlide = view.find('.carousel-item.active').length ? view.find('.carousel-item.active').first() : view.find('.carousel-item').first();
  9150. var firstImage = firstSlide.find('img').first();
  9151. if (firstImage.length) {
  9152. if (firstImage[0].complete) {
  9153. // If image won't trigger the load event
  9154. var imageHeight = firstImage.height();
  9155. if (imageHeight > 0) {
  9156. view.css('height', firstImage.height());
  9157. } else {
  9158. // If image still has no height, use the natural dimensions to calculate
  9159. var naturalWidth = firstImage[0].naturalWidth;
  9160. var naturalHeight = firstImage[0].naturalHeight;
  9161. var adjustedHeight = view.width() / naturalWidth * naturalHeight;
  9162. view.css('height', adjustedHeight);
  9163. }
  9164. } else {
  9165. // Get height when image is loaded normally
  9166. firstImage.on('load', function () {
  9167. view.css('height', $(this).height());
  9168. });
  9169. }
  9170. } else if (!imageOnly) {
  9171. var slideHeight = firstSlide.height();
  9172. view.css('height', slideHeight);
  9173. }
  9174. };
  9175. if (options.fullWidth) {
  9176. options.dist = 0;
  9177. setCarouselHeight(); // Offset fixed items when indicators.
  9178. if (showIndicators) {
  9179. view.find('.carousel-fixed-item').addClass('with-indicators');
  9180. }
  9181. } // Don't double initialize.
  9182. if (view.hasClass('initialized')) {
  9183. // Recalculate variables
  9184. $(window).trigger('resize'); // Redraw carousel.
  9185. view.trigger('carouselNext', [0.000001]);
  9186. return true;
  9187. }
  9188. view.addClass('initialized');
  9189. pressed = false;
  9190. offset = target = 0;
  9191. images = [];
  9192. item_width = view.find('.carousel-item').first().innerWidth();
  9193. item_height = view.find('.carousel-item').first().innerHeight();
  9194. dim = item_width * 2 + options.padding;
  9195. view.find('.carousel-item').each(function (i) {
  9196. images.push($(this)[0]);
  9197. if (showIndicators) {
  9198. var $indicator = $('<li class="indicator-item"></li>'); // Add active to first by default.
  9199. if (i === 0) {
  9200. $indicator.addClass('active');
  9201. } // Handle clicks on indicators.
  9202. $indicator.click(function (e) {
  9203. e.stopPropagation();
  9204. var index = $(this).index();
  9205. cycleTo(index);
  9206. });
  9207. $indicators.append($indicator);
  9208. }
  9209. });
  9210. if (showIndicators) {
  9211. view.append($indicators);
  9212. }
  9213. count = images.length;
  9214. function setupEvents() {
  9215. if (typeof window.ontouchstart !== 'undefined') {
  9216. view.on('touchstart.carousel', tap);
  9217. view.on('touchmove.carousel', drag);
  9218. view.on('touchend.carousel', release);
  9219. }
  9220. view.on('mousedown.carousel', tap);
  9221. view.on('mousemove.carousel', drag);
  9222. view.on('mouseup.carousel', release);
  9223. view.on('mouseleave.carousel', release);
  9224. view.on('click.carousel', click);
  9225. }
  9226. function xpos(e) {
  9227. // touch event
  9228. if (e.targetTouches && e.targetTouches.length >= 1) {
  9229. return e.targetTouches[0].clientX;
  9230. } // mouse event
  9231. return e.clientX;
  9232. }
  9233. function ypos(e) {
  9234. // touch event
  9235. if (e.targetTouches && e.targetTouches.length >= 1) {
  9236. return e.targetTouches[0].clientY;
  9237. } // mouse event
  9238. return e.clientY;
  9239. }
  9240. function wrap(x) {
  9241. return x >= count ? x % count : x < 0 ? wrap(count + x % count) : x;
  9242. }
  9243. function scroll(x) {
  9244. // Track scrolling state
  9245. scrolling = true;
  9246. if (!view.hasClass('scrolling')) {
  9247. view.addClass('scrolling');
  9248. }
  9249. if (scrollingTimeout != null) {
  9250. window.clearTimeout(scrollingTimeout);
  9251. }
  9252. scrollingTimeout = window.setTimeout(function () {
  9253. scrolling = false;
  9254. view.removeClass('scrolling');
  9255. }, options.duration); // Start actual scroll
  9256. var i, half, delta, dir, tween, el, alignment, xTranslation;
  9257. var lastCenter = center;
  9258. offset = typeof x === 'number' ? x : offset;
  9259. center = Math.floor((offset + dim / 2) / dim);
  9260. delta = offset - center * dim;
  9261. dir = delta < 0 ? 1 : -1;
  9262. tween = -dir * delta * 2 / dim;
  9263. half = count >> 1;
  9264. if (!options.fullWidth) {
  9265. alignment = 'translateX(' + (view[0].clientWidth - item_width) / 2 + 'px) ';
  9266. alignment += 'translateY(' + (view[0].clientHeight - item_height) / 2 + 'px)';
  9267. } else {
  9268. alignment = 'translateX(0)';
  9269. } // Set indicator active
  9270. if (showIndicators) {
  9271. var diff = center % count;
  9272. var activeIndicator = $indicators.find('.indicator-item.active');
  9273. if (activeIndicator.index() !== diff) {
  9274. activeIndicator.removeClass('active');
  9275. $indicators.find('.indicator-item').eq(diff).addClass('active');
  9276. }
  9277. } // center
  9278. // Don't show wrapped items.
  9279. if (!noWrap || center >= 0 && center < count) {
  9280. el = images[wrap(center)]; // Add active class to center item.
  9281. if (!$(el).hasClass('active')) {
  9282. view.find('.carousel-item').removeClass('active');
  9283. $(el).addClass('active');
  9284. }
  9285. el.style[xform] = alignment + ' translateX(' + -delta / 2 + 'px)' + ' translateX(' + dir * options.shift * tween * i + 'px)' + ' translateZ(' + options.dist * tween + 'px)';
  9286. el.style.zIndex = 0;
  9287. if (options.fullWidth) {
  9288. tweenedOpacity = 1;
  9289. } else {
  9290. tweenedOpacity = 1 - 0.2 * tween;
  9291. }
  9292. el.style.opacity = tweenedOpacity;
  9293. el.style.display = 'block';
  9294. }
  9295. for (i = 1; i <= half; ++i) {
  9296. // right side
  9297. if (options.fullWidth) {
  9298. zTranslation = options.dist;
  9299. tweenedOpacity = i === half && delta < 0 ? 1 - tween : 1;
  9300. } else {
  9301. zTranslation = options.dist * (i * 2 + tween * dir);
  9302. tweenedOpacity = 1 - 0.2 * (i * 2 + tween * dir);
  9303. } // Don't show wrapped items.
  9304. if (!noWrap || center + i < count) {
  9305. el = images[wrap(center + i)];
  9306. el.style[xform] = alignment + ' translateX(' + (options.shift + (dim * i - delta) / 2) + 'px)' + ' translateZ(' + zTranslation + 'px)';
  9307. el.style.zIndex = -i;
  9308. el.style.opacity = tweenedOpacity;
  9309. el.style.display = 'block';
  9310. } // left side
  9311. if (options.fullWidth) {
  9312. zTranslation = options.dist;
  9313. tweenedOpacity = i === half && delta > 0 ? 1 - tween : 1;
  9314. } else {
  9315. zTranslation = options.dist * (i * 2 - tween * dir);
  9316. tweenedOpacity = 1 - 0.2 * (i * 2 - tween * dir);
  9317. } // Don't show wrapped items.
  9318. if (!noWrap || center - i >= 0) {
  9319. el = images[wrap(center - i)];
  9320. el.style[xform] = alignment + ' translateX(' + (-options.shift + (-dim * i - delta) / 2) + 'px)' + ' translateZ(' + zTranslation + 'px)';
  9321. el.style.zIndex = -i;
  9322. el.style.opacity = tweenedOpacity;
  9323. el.style.display = 'block';
  9324. }
  9325. } // center
  9326. // Don't show wrapped items.
  9327. if (!noWrap || center >= 0 && center < count) {
  9328. el = images[wrap(center)];
  9329. el.style[xform] = alignment + ' translateX(' + -delta / 2 + 'px)' + ' translateX(' + dir * options.shift * tween + 'px)' + ' translateZ(' + options.dist * tween + 'px)';
  9330. el.style.zIndex = 0;
  9331. if (options.fullWidth) {
  9332. tweenedOpacity = 1;
  9333. } else {
  9334. tweenedOpacity = 1 - 0.2 * tween;
  9335. }
  9336. el.style.opacity = tweenedOpacity;
  9337. el.style.display = 'block';
  9338. } // onCycleTo callback
  9339. if (lastCenter !== center && typeof options.onCycleTo === "function") {
  9340. var $curr_item = view.find('.carousel-item').eq(wrap(center));
  9341. options.onCycleTo.call(this, $curr_item, dragged);
  9342. } // One time callback
  9343. if (typeof oneTimeCallback === "function") {
  9344. oneTimeCallback.call(this, $curr_item, dragged);
  9345. oneTimeCallback = null;
  9346. }
  9347. }
  9348. function track() {
  9349. var now, elapsed, delta, v;
  9350. now = Date.now();
  9351. elapsed = now - timestamp;
  9352. timestamp = now;
  9353. delta = offset - frame;
  9354. frame = offset;
  9355. v = 1000 * delta / (1 + elapsed);
  9356. velocity = 0.8 * v + 0.2 * velocity;
  9357. }
  9358. function autoScroll() {
  9359. var elapsed, delta;
  9360. if (amplitude) {
  9361. elapsed = Date.now() - timestamp;
  9362. delta = amplitude * Math.exp(-elapsed / options.duration);
  9363. if (delta > 2 || delta < -2) {
  9364. scroll(target - delta);
  9365. requestAnimationFrame(autoScroll);
  9366. } else {
  9367. scroll(target);
  9368. }
  9369. }
  9370. }
  9371. function click(e) {
  9372. // Disable clicks if carousel was dragged.
  9373. if (dragged) {
  9374. e.preventDefault();
  9375. e.stopPropagation();
  9376. return false;
  9377. } else if (!options.fullWidth) {
  9378. var clickedIndex = $(e.target).closest('.carousel-item').index();
  9379. var diff = wrap(center) - clickedIndex; // Disable clicks if carousel was shifted by click
  9380. if (diff !== 0) {
  9381. e.preventDefault();
  9382. e.stopPropagation();
  9383. }
  9384. cycleTo(clickedIndex);
  9385. }
  9386. }
  9387. function cycleTo(n) {
  9388. var diff = center % count - n; // Account for wraparound.
  9389. if (!noWrap) {
  9390. if (diff < 0) {
  9391. if (Math.abs(diff + count) < Math.abs(diff)) {
  9392. diff += count;
  9393. }
  9394. } else if (diff > 0) {
  9395. if (Math.abs(diff - count) < diff) {
  9396. diff -= count;
  9397. }
  9398. }
  9399. } // Call prev or next accordingly.
  9400. if (diff < 0) {
  9401. view.trigger('carouselNext', [Math.abs(diff)]);
  9402. } else if (diff > 0) {
  9403. view.trigger('carouselPrev', [diff]);
  9404. }
  9405. }
  9406. function tap(e) {
  9407. // Fixes firefox draggable image bug
  9408. if (e.type === 'mousedown' && $(e.target).is('img')) {
  9409. e.preventDefault();
  9410. }
  9411. pressed = true;
  9412. dragged = false;
  9413. vertical_dragged = false;
  9414. reference = xpos(e);
  9415. referenceY = ypos(e);
  9416. velocity = amplitude = 0;
  9417. frame = offset;
  9418. timestamp = Date.now();
  9419. clearInterval(ticker);
  9420. ticker = setInterval(track, 100);
  9421. }
  9422. function drag(e) {
  9423. var x, delta, deltaY;
  9424. if (pressed) {
  9425. x = xpos(e);
  9426. y = ypos(e);
  9427. delta = reference - x;
  9428. deltaY = Math.abs(referenceY - y);
  9429. if (deltaY < 30 && !vertical_dragged) {
  9430. // If vertical scrolling don't allow dragging.
  9431. if (delta > 2 || delta < -2) {
  9432. dragged = true;
  9433. reference = x;
  9434. scroll(offset + delta);
  9435. }
  9436. } else if (dragged) {
  9437. // If dragging don't allow vertical scroll.
  9438. e.preventDefault();
  9439. e.stopPropagation();
  9440. return false;
  9441. } else {
  9442. // Vertical scrolling.
  9443. vertical_dragged = true;
  9444. }
  9445. }
  9446. if (dragged) {
  9447. // If dragging don't allow vertical scroll.
  9448. e.preventDefault();
  9449. e.stopPropagation();
  9450. return false;
  9451. }
  9452. }
  9453. function release(e) {
  9454. if (pressed) {
  9455. pressed = false;
  9456. } else {
  9457. return;
  9458. }
  9459. clearInterval(ticker);
  9460. target = offset;
  9461. if (velocity > 10 || velocity < -10) {
  9462. amplitude = 0.9 * velocity;
  9463. target = offset + amplitude;
  9464. }
  9465. target = Math.round(target / dim) * dim; // No wrap of items.
  9466. if (noWrap) {
  9467. if (target >= dim * (count - 1)) {
  9468. target = dim * (count - 1);
  9469. } else if (target < 0) {
  9470. target = 0;
  9471. }
  9472. }
  9473. amplitude = target - offset;
  9474. timestamp = Date.now();
  9475. requestAnimationFrame(autoScroll);
  9476. if (dragged) {
  9477. e.preventDefault();
  9478. e.stopPropagation();
  9479. }
  9480. return false;
  9481. }
  9482. xform = 'transform';
  9483. ['webkit', 'Moz', 'O', 'ms'].every(function (prefix) {
  9484. var e = prefix + 'Transform';
  9485. if (typeof document.body.style[e] !== 'undefined') {
  9486. xform = e;
  9487. return false;
  9488. }
  9489. return true;
  9490. });
  9491. var throttledResize = Materialize.throttle(function () {
  9492. if (options.fullWidth) {
  9493. item_width = view.find('.carousel-item').first().innerWidth();
  9494. var imageHeight = view.find('.carousel-item.active').height();
  9495. dim = item_width * 2 + options.padding;
  9496. offset = center * 2 * item_width;
  9497. target = offset;
  9498. setCarouselHeight(true);
  9499. } else {
  9500. scroll();
  9501. }
  9502. }, 200);
  9503. $(window).off('resize.carousel-' + uniqueNamespace).on('resize.carousel-' + uniqueNamespace, throttledResize);
  9504. setupEvents();
  9505. scroll(offset);
  9506. $(this).on('carouselNext', function (e, n, callback) {
  9507. if (n === undefined) {
  9508. n = 1;
  9509. }
  9510. if (typeof callback === "function") {
  9511. oneTimeCallback = callback;
  9512. }
  9513. target = dim * Math.round(offset / dim) + dim * n;
  9514. if (offset !== target) {
  9515. amplitude = target - offset;
  9516. timestamp = Date.now();
  9517. requestAnimationFrame(autoScroll);
  9518. }
  9519. });
  9520. $(this).on('carouselPrev', function (e, n, callback) {
  9521. if (n === undefined) {
  9522. n = 1;
  9523. }
  9524. if (typeof callback === "function") {
  9525. oneTimeCallback = callback;
  9526. }
  9527. target = dim * Math.round(offset / dim) - dim * n;
  9528. if (offset !== target) {
  9529. amplitude = target - offset;
  9530. timestamp = Date.now();
  9531. requestAnimationFrame(autoScroll);
  9532. }
  9533. });
  9534. $(this).on('carouselSet', function (e, n, callback) {
  9535. if (n === undefined) {
  9536. n = 0;
  9537. }
  9538. if (typeof callback === "function") {
  9539. oneTimeCallback = callback;
  9540. }
  9541. cycleTo(n);
  9542. });
  9543. });
  9544. },
  9545. next: function next(n, callback) {
  9546. $(this).trigger('carouselNext', [n, callback]);
  9547. },
  9548. prev: function prev(n, callback) {
  9549. $(this).trigger('carouselPrev', [n, callback]);
  9550. },
  9551. set: function set(n, callback) {
  9552. $(this).trigger('carouselSet', [n, callback]);
  9553. },
  9554. destroy: function destroy() {
  9555. var uniqueNamespace = $(this).attr('data-namespace');
  9556. $(this).removeAttr('data-namespace');
  9557. $(this).removeClass('initialized');
  9558. $(this).find('.indicators').remove(); // Remove event handlers
  9559. $(this).off('carouselNext carouselPrev carouselSet');
  9560. $(window).off('resize.carousel-' + uniqueNamespace);
  9561. if (typeof window.ontouchstart !== 'undefined') {
  9562. $(this).off('touchstart.carousel touchmove.carousel touchend.carousel');
  9563. }
  9564. $(this).off('mousedown.carousel mousemove.carousel mouseup.carousel mouseleave.carousel click.carousel');
  9565. }
  9566. };
  9567. $.fn.carousel = function (methodOrOptions) {
  9568. if (methods[methodOrOptions]) {
  9569. return methods[methodOrOptions].apply(this, Array.prototype.slice.call(arguments, 1));
  9570. } else if (_typeof(methodOrOptions) === 'object' || !methodOrOptions) {
  9571. // Default to "init"
  9572. return methods.init.apply(this, arguments);
  9573. } else {
  9574. $.error('Method ' + methodOrOptions + ' does not exist on jQuery.carousel');
  9575. }
  9576. }; // Plugin end
  9577. })(jQuery);
  9578. ;
  9579. (function ($) {
  9580. var methods = {
  9581. init: function init(options) {
  9582. return this.each(function () {
  9583. var origin = $('#' + $(this).attr('data-activates'));
  9584. var screen = $('body'); // Creating tap target
  9585. var tapTargetEl = $(this);
  9586. var tapTargetWrapper = tapTargetEl.parent('.tap-target-wrapper');
  9587. var tapTargetWave = tapTargetWrapper.find('.tap-target-wave');
  9588. var tapTargetOriginEl = tapTargetWrapper.find('.tap-target-origin');
  9589. var tapTargetContentEl = tapTargetEl.find('.tap-target-content'); // Creating wrapper
  9590. if (!tapTargetWrapper.length) {
  9591. tapTargetWrapper = tapTargetEl.wrap($('<div class="tap-target-wrapper"></div>')).parent();
  9592. } // Creating content
  9593. if (!tapTargetContentEl.length) {
  9594. tapTargetContentEl = $('<div class="tap-target-content"></div>');
  9595. tapTargetEl.append(tapTargetContentEl);
  9596. } // Creating foreground wave
  9597. if (!tapTargetWave.length) {
  9598. tapTargetWave = $('<div class="tap-target-wave"></div>'); // Creating origin
  9599. if (!tapTargetOriginEl.length) {
  9600. tapTargetOriginEl = origin.clone(true, true);
  9601. tapTargetOriginEl.addClass('tap-target-origin');
  9602. tapTargetOriginEl.removeAttr('id');
  9603. tapTargetOriginEl.removeAttr('style');
  9604. tapTargetWave.append(tapTargetOriginEl);
  9605. }
  9606. tapTargetWrapper.append(tapTargetWave);
  9607. } // Open
  9608. var openTapTarget = function openTapTarget() {
  9609. if (tapTargetWrapper.is('.open')) {
  9610. return;
  9611. } // Adding open class
  9612. tapTargetWrapper.addClass('open');
  9613. setTimeout(function () {
  9614. tapTargetOriginEl.off('click.tapTarget').on('click.tapTarget', function (e) {
  9615. closeTapTarget();
  9616. tapTargetOriginEl.off('click.tapTarget');
  9617. });
  9618. $(document).off('click.tapTarget').on('click.tapTarget', function (e) {
  9619. closeTapTarget();
  9620. $(document).off('click.tapTarget');
  9621. });
  9622. var throttledCalc = Materialize.throttle(function () {
  9623. calculateTapTarget();
  9624. }, 200);
  9625. $(window).off('resize.tapTarget').on('resize.tapTarget', throttledCalc);
  9626. }, 0);
  9627. }; // Close
  9628. var closeTapTarget = function closeTapTarget() {
  9629. if (!tapTargetWrapper.is('.open')) {
  9630. return;
  9631. }
  9632. tapTargetWrapper.removeClass('open');
  9633. tapTargetOriginEl.off('click.tapTarget');
  9634. $(document).off('click.tapTarget');
  9635. $(window).off('resize.tapTarget');
  9636. }; // Pre calculate
  9637. var calculateTapTarget = function calculateTapTarget() {
  9638. // Element or parent is fixed position?
  9639. var isFixed = origin.css('position') === 'fixed';
  9640. if (!isFixed) {
  9641. var parents = origin.parents();
  9642. for (var i = 0; i < parents.length; i++) {
  9643. isFixed = $(parents[i]).css('position') == 'fixed';
  9644. if (isFixed) {
  9645. break;
  9646. }
  9647. }
  9648. } // Calculating origin
  9649. var originWidth = origin.outerWidth();
  9650. var originHeight = origin.outerHeight();
  9651. var originTop = isFixed ? origin.offset().top - $(document).scrollTop() : origin.offset().top;
  9652. var originLeft = isFixed ? origin.offset().left - $(document).scrollLeft() : origin.offset().left; // Calculating screen
  9653. var windowWidth = $(window).width();
  9654. var windowHeight = $(window).height();
  9655. var centerX = windowWidth / 2;
  9656. var centerY = windowHeight / 2;
  9657. var isLeft = originLeft <= centerX;
  9658. var isRight = originLeft > centerX;
  9659. var isTop = originTop <= centerY;
  9660. var isBottom = originTop > centerY;
  9661. var isCenterX = originLeft >= windowWidth * 0.25 && originLeft <= windowWidth * 0.75;
  9662. var isCenterY = originTop >= windowHeight * 0.25 && originTop <= windowHeight * 0.75; // Calculating tap target
  9663. var tapTargetWidth = tapTargetEl.outerWidth();
  9664. var tapTargetHeight = tapTargetEl.outerHeight();
  9665. var tapTargetTop = originTop + originHeight / 2 - tapTargetHeight / 2;
  9666. var tapTargetLeft = originLeft + originWidth / 2 - tapTargetWidth / 2;
  9667. var tapTargetPosition = isFixed ? 'fixed' : 'absolute'; // Calculating content
  9668. var tapTargetTextWidth = isCenterX ? tapTargetWidth : tapTargetWidth / 2 + originWidth;
  9669. var tapTargetTextHeight = tapTargetHeight / 2;
  9670. var tapTargetTextTop = isTop ? tapTargetHeight / 2 : 0;
  9671. var tapTargetTextBottom = 0;
  9672. var tapTargetTextLeft = isLeft && !isCenterX ? tapTargetWidth / 2 - originWidth : 0;
  9673. var tapTargetTextRight = 0;
  9674. var tapTargetTextPadding = originWidth;
  9675. var tapTargetTextAlign = isBottom ? 'bottom' : 'top'; // Calculating wave
  9676. var tapTargetWaveWidth = originWidth > originHeight ? originWidth * 2 : originWidth * 2;
  9677. var tapTargetWaveHeight = tapTargetWaveWidth;
  9678. var tapTargetWaveTop = tapTargetHeight / 2 - tapTargetWaveHeight / 2;
  9679. var tapTargetWaveLeft = tapTargetWidth / 2 - tapTargetWaveWidth / 2; // Setting tap target
  9680. var tapTargetWrapperCssObj = {};
  9681. tapTargetWrapperCssObj.top = isTop ? tapTargetTop : '';
  9682. tapTargetWrapperCssObj.right = isRight ? windowWidth - tapTargetLeft - tapTargetWidth : '';
  9683. tapTargetWrapperCssObj.bottom = isBottom ? windowHeight - tapTargetTop - tapTargetHeight : '';
  9684. tapTargetWrapperCssObj.left = isLeft ? tapTargetLeft : '';
  9685. tapTargetWrapperCssObj.position = tapTargetPosition;
  9686. tapTargetWrapper.css(tapTargetWrapperCssObj); // Setting content
  9687. tapTargetContentEl.css({
  9688. width: tapTargetTextWidth,
  9689. height: tapTargetTextHeight,
  9690. top: tapTargetTextTop,
  9691. right: tapTargetTextRight,
  9692. bottom: tapTargetTextBottom,
  9693. left: tapTargetTextLeft,
  9694. padding: tapTargetTextPadding,
  9695. verticalAlign: tapTargetTextAlign
  9696. }); // Setting wave
  9697. tapTargetWave.css({
  9698. top: tapTargetWaveTop,
  9699. left: tapTargetWaveLeft,
  9700. width: tapTargetWaveWidth,
  9701. height: tapTargetWaveHeight
  9702. });
  9703. };
  9704. if (options == 'open') {
  9705. calculateTapTarget();
  9706. openTapTarget();
  9707. }
  9708. if (options == 'close') closeTapTarget();
  9709. });
  9710. },
  9711. open: function open() {},
  9712. close: function close() {}
  9713. };
  9714. $.fn.tapTarget = function (methodOrOptions) {
  9715. if (methods[methodOrOptions] || _typeof(methodOrOptions) === 'object') return methods.init.apply(this, arguments);
  9716. $.error('Method ' + methodOrOptions + ' does not exist on jQuery.tap-target');
  9717. };
  9718. })(jQuery);