materialize.js 386 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229
  1. /*!
  2. * Materialize v0.100.2 (http://materializecss.com)
  3. * Copyright 2014-2017 Materialize
  4. * MIT License (https://raw.githubusercontent.com/Dogfalo/materialize/master/LICENSE)
  5. */
  6. var _createClass = function () {
  7. function defineProperties(target, props) {
  8. for (var i = 0; i < props.length; i++) {
  9. var descriptor = props[i];
  10. descriptor.enumerable = descriptor.enumerable || false;
  11. descriptor.configurable = true;
  12. if ("value" in descriptor)
  13. descriptor.writable = true;
  14. Object.defineProperty(target, descriptor.key, descriptor);
  15. }
  16. }
  17. return function (Constructor, protoProps, staticProps) {
  18. if (protoProps)
  19. defineProperties(Constructor.prototype, protoProps);
  20. if (staticProps)
  21. defineProperties(Constructor, staticProps);
  22. return Constructor;
  23. }
  24. ;
  25. }();
  26. function _classCallCheck(instance, Constructor) {
  27. if (!(instance instanceof Constructor)) {
  28. throw new TypeError("Cannot call a class as a function");
  29. }
  30. }
  31. // Check for jQuery.
  32. if (typeof jQuery === 'undefined') {
  33. // Check if require is a defined function.
  34. if (typeof require === 'function') {
  35. jQuery = $ = require('jquery');
  36. // Else use the dollar sign alias.
  37. } else {
  38. jQuery = $;
  39. }
  40. }
  41. ;/*
  42. * jQuery Easing v1.4.0 - http://gsgd.co.uk/sandbox/jquery/easing/
  43. * Open source under the BSD License.
  44. * Copyright © 2008 George McGinley Smith
  45. * All rights reserved.
  46. * https://raw.github.com/gdsmith/jquery-easing/master/LICENSE
  47. */
  48. (function (factory) {
  49. if (typeof define === "function" && define.amd) {
  50. define(['jquery'], function ($) {
  51. return factory($);
  52. });
  53. } else if (typeof module === "object" && typeof module.exports === "object") {
  54. exports = factory(require('jquery'));
  55. } else {
  56. factory(jQuery);
  57. }
  58. }
  59. )(function ($) {
  60. // Preserve the original jQuery "swing" easing as "jswing"
  61. $.easing['jswing'] = $.easing['swing'];
  62. var pow = Math.pow
  63. , sqrt = Math.sqrt
  64. , sin = Math.sin
  65. , cos = Math.cos
  66. , PI = Math.PI
  67. , c1 = 1.70158
  68. , c2 = c1 * 1.525
  69. , c3 = c1 + 1
  70. , c4 = 2 * PI / 3
  71. , c5 = 2 * PI / 4.5;
  72. // x is the fraction of animation progress, in the range 0..1
  73. function bounceOut(x) {
  74. var n1 = 7.5625
  75. , d1 = 2.75;
  76. if (x < 1 / d1) {
  77. return n1 * x * x;
  78. } else if (x < 2 / d1) {
  79. return n1 * (x -= 1.5 / d1) * x + .75;
  80. } else if (x < 2.5 / d1) {
  81. return n1 * (x -= 2.25 / d1) * x + .9375;
  82. } else {
  83. return n1 * (x -= 2.625 / d1) * x + .984375;
  84. }
  85. }
  86. $.extend($.easing, {
  87. def: 'easeOutQuad',
  88. swing: function (x) {
  89. return $.easing[$.easing.def](x);
  90. },
  91. easeInQuad: function (x) {
  92. return x * x;
  93. },
  94. easeOutQuad: function (x) {
  95. return 1 - (1 - x) * (1 - x);
  96. },
  97. easeInOutQuad: function (x) {
  98. return x < 0.5 ? 2 * x * x : 1 - pow(-2 * x + 2, 2) / 2;
  99. },
  100. easeInCubic: function (x) {
  101. return x * x * x;
  102. },
  103. easeOutCubic: function (x) {
  104. return 1 - pow(1 - x, 3);
  105. },
  106. easeInOutCubic: function (x) {
  107. return x < 0.5 ? 4 * x * x * x : 1 - pow(-2 * x + 2, 3) / 2;
  108. },
  109. easeInQuart: function (x) {
  110. return x * x * x * x;
  111. },
  112. easeOutQuart: function (x) {
  113. return 1 - pow(1 - x, 4);
  114. },
  115. easeInOutQuart: function (x) {
  116. return x < 0.5 ? 8 * x * x * x * x : 1 - pow(-2 * x + 2, 4) / 2;
  117. },
  118. easeInQuint: function (x) {
  119. return x * x * x * x * x;
  120. },
  121. easeOutQuint: function (x) {
  122. return 1 - pow(1 - x, 5);
  123. },
  124. easeInOutQuint: function (x) {
  125. return x < 0.5 ? 16 * x * x * x * x * x : 1 - pow(-2 * x + 2, 5) / 2;
  126. },
  127. easeInSine: function (x) {
  128. return 1 - cos(x * PI / 2);
  129. },
  130. easeOutSine: function (x) {
  131. return sin(x * PI / 2);
  132. },
  133. easeInOutSine: function (x) {
  134. return -(cos(PI * x) - 1) / 2;
  135. },
  136. easeInExpo: function (x) {
  137. return x === 0 ? 0 : pow(2, 10 * x - 10);
  138. },
  139. easeOutExpo: function (x) {
  140. return x === 1 ? 1 : 1 - pow(2, -10 * x);
  141. },
  142. easeInOutExpo: function (x) {
  143. return x === 0 ? 0 : x === 1 ? 1 : x < 0.5 ? pow(2, 20 * x - 10) / 2 : (2 - pow(2, -20 * x + 10)) / 2;
  144. },
  145. easeInCirc: function (x) {
  146. return 1 - sqrt(1 - pow(x, 2));
  147. },
  148. easeOutCirc: function (x) {
  149. return sqrt(1 - pow(x - 1, 2));
  150. },
  151. easeInOutCirc: function (x) {
  152. return x < 0.5 ? (1 - sqrt(1 - pow(2 * x, 2))) / 2 : (sqrt(1 - pow(-2 * x + 2, 2)) + 1) / 2;
  153. },
  154. easeInElastic: function (x) {
  155. return x === 0 ? 0 : x === 1 ? 1 : -pow(2, 10 * x - 10) * sin((x * 10 - 10.75) * c4);
  156. },
  157. easeOutElastic: function (x) {
  158. return x === 0 ? 0 : x === 1 ? 1 : pow(2, -10 * x) * sin((x * 10 - 0.75) * c4) + 1;
  159. },
  160. easeInOutElastic: function (x) {
  161. 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;
  162. },
  163. easeInBack: function (x) {
  164. return c3 * x * x * x - c1 * x * x;
  165. },
  166. easeOutBack: function (x) {
  167. return 1 + c3 * pow(x - 1, 3) + c1 * pow(x - 1, 2);
  168. },
  169. easeInOutBack: function (x) {
  170. 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;
  171. },
  172. easeInBounce: function (x) {
  173. return 1 - bounceOut(1 - x);
  174. },
  175. easeOutBounce: bounceOut,
  176. easeInOutBounce: function (x) {
  177. return x < 0.5 ? (1 - bounceOut(1 - 2 * x)) / 2 : (1 + bounceOut(2 * x - 1)) / 2;
  178. }
  179. });
  180. });
  181. ;// Custom Easing
  182. jQuery.extend(jQuery.easing, {
  183. easeInOutMaterial: function (x, t, b, c, d) {
  184. if ((t /= d / 2) < 1)
  185. return c / 2 * t * t + b;
  186. return c / 4 * ((t -= 2) * t * t + 2) + b;
  187. }
  188. });
  189. ;/*! VelocityJS.org (1.2.3). (C) 2014 Julian Shapiro. MIT @license: en.wikipedia.org/wiki/MIT_License */
  190. /*! VelocityJS.org jQuery Shim (1.0.1). (C) 2014 The jQuery Foundation. MIT @license: en.wikipedia.org/wiki/MIT_License. */
  191. /*! Note that this has been modified by Materialize to confirm that Velocity is not already being imported. */
  192. jQuery.Velocity ? console.log("Velocity is already loaded. You may be needlessly importing Velocity again; note that Materialize includes Velocity.") : (!function (e) {
  193. function t(e) {
  194. var t = e.length
  195. , a = r.type(e);
  196. 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;
  197. }
  198. if (!e.jQuery) {
  199. var r = function (e, t) {
  200. return new r.fn.init(e, t);
  201. };
  202. r.isWindow = function (e) {
  203. return null != e && e == e.window;
  204. }
  205. ,
  206. r.type = function (e) {
  207. return null == e ? e + "" : "object" == typeof e || "function" == typeof e ? n[i.call(e)] || "object" : typeof e;
  208. }
  209. ,
  210. r.isArray = Array.isArray || function (e) {
  211. return "array" === r.type(e);
  212. }
  213. ,
  214. r.isPlainObject = function (e) {
  215. var t;
  216. if (!e || "object" !== r.type(e) || e.nodeType || r.isWindow(e))
  217. return !1;
  218. try {
  219. if (e.constructor && !o.call(e, "constructor") && !o.call(e.constructor.prototype, "isPrototypeOf"))
  220. return !1;
  221. } catch (a) {
  222. return !1;
  223. }
  224. for (t in e) { }
  225. return void 0 === t || o.call(e, t);
  226. }
  227. ,
  228. r.each = function (e, r, a) {
  229. var n, o = 0, i = e.length, s = t(e);
  230. if (a) {
  231. if (s)
  232. for (; i > o && (n = r.apply(e[o], a),
  233. n !== !1); o++) { }
  234. else
  235. for (o in e) {
  236. if (n = r.apply(e[o], a),
  237. n === !1)
  238. break;
  239. }
  240. } else if (s)
  241. for (; i > o && (n = r.call(e[o], o, e[o]),
  242. n !== !1); o++) { }
  243. else
  244. for (o in e) {
  245. if (n = r.call(e[o], o, e[o]),
  246. n === !1)
  247. break;
  248. }
  249. return e;
  250. }
  251. ,
  252. r.data = function (e, t, n) {
  253. if (void 0 === n) {
  254. var o = e[r.expando]
  255. , i = o && a[o];
  256. if (void 0 === t)
  257. return i;
  258. if (i && t in i)
  259. return i[t];
  260. } else if (void 0 !== t) {
  261. var o = e[r.expando] || (e[r.expando] = ++r.uuid);
  262. return a[o] = a[o] || {},
  263. a[o][t] = n,
  264. n;
  265. }
  266. }
  267. ,
  268. r.removeData = function (e, t) {
  269. var n = e[r.expando]
  270. , o = n && a[n];
  271. o && r.each(t, function (e, t) {
  272. delete o[t];
  273. });
  274. }
  275. ,
  276. r.extend = function () {
  277. var e, t, a, n, o, i, s = arguments[0] || {}, l = 1, u = arguments.length, c = !1;
  278. for ("boolean" == typeof s && (c = s,
  279. s = arguments[l] || {},
  280. l++),
  281. "object" != typeof s && "function" !== r.type(s) && (s = {}),
  282. l === u && (s = this,
  283. l--); u > l; l++) {
  284. if (null != (o = arguments[l]))
  285. for (n in o) {
  286. e = s[n],
  287. a = o[n],
  288. s !== a && (c && a && (r.isPlainObject(a) || (t = r.isArray(a))) ? (t ? (t = !1,
  289. i = e && r.isArray(e) ? e : []) : i = e && r.isPlainObject(e) ? e : {},
  290. s[n] = r.extend(c, i, a)) : void 0 !== a && (s[n] = a));
  291. }
  292. }
  293. return s;
  294. }
  295. ,
  296. r.queue = function (e, a, n) {
  297. function o(e, r) {
  298. var a = r || [];
  299. return null != e && (t(Object(e)) ? !function (e, t) {
  300. for (var r = +t.length, a = 0, n = e.length; r > a;) {
  301. e[n++] = t[a++];
  302. }
  303. if (r !== r)
  304. for (; void 0 !== t[a];) {
  305. e[n++] = t[a++];
  306. }
  307. return e.length = n,
  308. e;
  309. }(a, "string" == typeof e ? [e] : e) : [].push.call(a, e)),
  310. a;
  311. }
  312. if (e) {
  313. a = (a || "fx") + "queue";
  314. var i = r.data(e, a);
  315. return n ? (!i || r.isArray(n) ? i = r.data(e, a, o(n)) : i.push(n),
  316. i) : i || [];
  317. }
  318. }
  319. ,
  320. r.dequeue = function (e, t) {
  321. r.each(e.nodeType ? [e] : e, function (e, a) {
  322. t = t || "fx";
  323. var n = r.queue(a, t)
  324. , o = n.shift();
  325. "inprogress" === o && (o = n.shift()),
  326. o && ("fx" === t && n.unshift("inprogress"),
  327. o.call(a, function () {
  328. r.dequeue(a, t);
  329. }));
  330. });
  331. }
  332. ,
  333. r.fn = r.prototype = {
  334. init: function (e) {
  335. if (e.nodeType)
  336. return this[0] = e,
  337. this;
  338. throw new Error("Not a DOM node.");
  339. },
  340. offset: function () {
  341. var t = this[0].getBoundingClientRect ? this[0].getBoundingClientRect() : {
  342. top: 0,
  343. left: 0
  344. };
  345. return {
  346. top: t.top + (e.pageYOffset || document.scrollTop || 0) - (document.clientTop || 0),
  347. left: t.left + (e.pageXOffset || document.scrollLeft || 0) - (document.clientLeft || 0)
  348. };
  349. },
  350. position: function () {
  351. function e() {
  352. for (var e = this.offsetParent || document; e && "html" === !e.nodeType.toLowerCase && "static" === e.style.position;) {
  353. e = e.offsetParent;
  354. }
  355. return e || document;
  356. }
  357. var t = this[0]
  358. , e = e.apply(t)
  359. , a = this.offset()
  360. , n = /^(?:body|html)$/i.test(e.nodeName) ? {
  361. top: 0,
  362. left: 0
  363. } : r(e).offset();
  364. return a.top -= parseFloat(t.style.marginTop) || 0,
  365. a.left -= parseFloat(t.style.marginLeft) || 0,
  366. e.style && (n.top += parseFloat(e.style.borderTopWidth) || 0,
  367. n.left += parseFloat(e.style.borderLeftWidth) || 0),
  368. {
  369. top: a.top - n.top,
  370. left: a.left - n.left
  371. };
  372. }
  373. };
  374. var a = {};
  375. r.expando = "velocity" + new Date().getTime(),
  376. r.uuid = 0;
  377. 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++) {
  378. n["[object " + s[l] + "]"] = s[l].toLowerCase();
  379. }
  380. r.fn.init.prototype = r.fn,
  381. e.Velocity = {
  382. Utilities: r
  383. };
  384. }
  385. }(window),
  386. function (e) {
  387. "object" == typeof module && "object" == typeof module.exports ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : e();
  388. }(function () {
  389. return function (e, t, r, a) {
  390. function n(e) {
  391. for (var t = -1, r = e ? e.length : 0, a = []; ++t < r;) {
  392. var n = e[t];
  393. n && a.push(n);
  394. }
  395. return a;
  396. }
  397. function o(e) {
  398. return m.isWrapped(e) ? e = [].slice.call(e) : m.isNode(e) && (e = [e]),
  399. e;
  400. }
  401. function i(e) {
  402. var t = f.data(e, "velocity");
  403. return null === t ? a : t;
  404. }
  405. function s(e) {
  406. return function (t) {
  407. return Math.round(t * e) * (1 / e);
  408. }
  409. ;
  410. }
  411. function l(e, r, a, n) {
  412. function o(e, t) {
  413. return 1 - 3 * t + 3 * e;
  414. }
  415. function i(e, t) {
  416. return 3 * t - 6 * e;
  417. }
  418. function s(e) {
  419. return 3 * e;
  420. }
  421. function l(e, t, r) {
  422. return ((o(t, r) * e + i(t, r)) * e + s(t)) * e;
  423. }
  424. function u(e, t, r) {
  425. return 3 * o(t, r) * e * e + 2 * i(t, r) * e + s(t);
  426. }
  427. function c(t, r) {
  428. for (var n = 0; m > n; ++n) {
  429. var o = u(r, e, a);
  430. if (0 === o)
  431. return r;
  432. var i = l(r, e, a) - t;
  433. r -= i / o;
  434. }
  435. return r;
  436. }
  437. function p() {
  438. for (var t = 0; b > t; ++t) {
  439. w[t] = l(t * x, e, a);
  440. }
  441. }
  442. function f(t, r, n) {
  443. var o, i, s = 0;
  444. do {
  445. i = r + (n - r) / 2,
  446. o = l(i, e, a) - t,
  447. o > 0 ? n = i : r = i;
  448. } while (Math.abs(o) > h && ++s < v); return i;
  449. }
  450. function d(t) {
  451. for (var r = 0, n = 1, o = b - 1; n != o && w[n] <= t; ++n) {
  452. r += x;
  453. }
  454. --n;
  455. var i = (t - w[n]) / (w[n + 1] - w[n])
  456. , s = r + i * x
  457. , l = u(s, e, a);
  458. return l >= y ? c(t, s) : 0 == l ? s : f(t, r, r + x);
  459. }
  460. function g() {
  461. V = !0,
  462. (e != r || a != n) && p();
  463. }
  464. var m = 4
  465. , y = .001
  466. , h = 1e-7
  467. , v = 10
  468. , b = 11
  469. , x = 1 / (b - 1)
  470. , S = "Float32Array" in t;
  471. if (4 !== arguments.length)
  472. return !1;
  473. for (var P = 0; 4 > P; ++P) {
  474. if ("number" != typeof arguments[P] || isNaN(arguments[P]) || !isFinite(arguments[P]))
  475. return !1;
  476. }
  477. e = Math.min(e, 1),
  478. a = Math.min(a, 1),
  479. e = Math.max(e, 0),
  480. a = Math.max(a, 0);
  481. var w = S ? new Float32Array(b) : new Array(b)
  482. , V = !1
  483. , C = function (t) {
  484. return V || g(),
  485. e === r && a === n ? t : 0 === t ? 0 : 1 === t ? 1 : l(d(t), r, n);
  486. };
  487. C.getControlPoints = function () {
  488. return [{
  489. x: e,
  490. y: r
  491. }, {
  492. x: a,
  493. y: n
  494. }];
  495. }
  496. ;
  497. var T = "generateBezier(" + [e, r, a, n] + ")";
  498. return C.toString = function () {
  499. return T;
  500. }
  501. ,
  502. C;
  503. }
  504. function u(e, t) {
  505. var r = e;
  506. 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,
  507. r === !1 && (r = b.Easings[b.defaults.easing] ? b.defaults.easing : v),
  508. r;
  509. }
  510. function c(e) {
  511. if (e) {
  512. var t = new Date().getTime()
  513. , r = b.State.calls.length;
  514. r > 1e4 && (b.State.calls = n(b.State.calls));
  515. for (var o = 0; r > o; o++) {
  516. if (b.State.calls[o]) {
  517. var s = b.State.calls[o]
  518. , l = s[0]
  519. , u = s[2]
  520. , d = s[3]
  521. , g = !!d
  522. , y = null;
  523. d || (d = b.State.calls[o][3] = t - 16);
  524. for (var h = Math.min((t - d) / u.duration, 1), v = 0, x = l.length; x > v; v++) {
  525. var P = l[v]
  526. , V = P.element;
  527. if (i(V)) {
  528. var C = !1;
  529. if (u.display !== a && null !== u.display && "none" !== u.display) {
  530. if ("flex" === u.display) {
  531. var T = ["-webkit-box", "-moz-box", "-ms-flexbox", "-webkit-flex"];
  532. f.each(T, function (e, t) {
  533. S.setPropertyValue(V, "display", t);
  534. });
  535. }
  536. S.setPropertyValue(V, "display", u.display);
  537. }
  538. u.visibility !== a && "hidden" !== u.visibility && S.setPropertyValue(V, "visibility", u.visibility);
  539. for (var k in P) {
  540. if ("element" !== k) {
  541. var A, F = P[k], j = m.isString(F.easing) ? b.Easings[F.easing] : F.easing;
  542. if (1 === h)
  543. A = F.endValue;
  544. else {
  545. var E = F.endValue - F.startValue;
  546. if (A = F.startValue + E * j(h, u, E),
  547. !g && A === F.currentValue)
  548. continue;
  549. }
  550. if (F.currentValue = A,
  551. "tween" === k)
  552. y = A;
  553. else {
  554. if (S.Hooks.registered[k]) {
  555. var H = S.Hooks.getRoot(k)
  556. , N = i(V).rootPropertyValueCache[H];
  557. N && (F.rootPropertyValue = N);
  558. }
  559. var L = S.setPropertyValue(V, k, F.currentValue + (0 === parseFloat(A) ? "" : F.unitType), F.rootPropertyValue, F.scrollData);
  560. S.Hooks.registered[k] && (i(V).rootPropertyValueCache[H] = S.Normalizations.registered[H] ? S.Normalizations.registered[H]("extract", null, L[1]) : L[1]),
  561. "transform" === L[0] && (C = !0);
  562. }
  563. }
  564. }
  565. u.mobileHA && i(V).transformCache.translate3d === a && (i(V).transformCache.translate3d = "(0px, 0px, 0px)",
  566. C = !0),
  567. C && S.flushTransformCache(V);
  568. }
  569. }
  570. u.display !== a && "none" !== u.display && (b.State.calls[o][2].display = !1),
  571. u.visibility !== a && "hidden" !== u.visibility && (b.State.calls[o][2].visibility = !1),
  572. u.progress && u.progress.call(s[1], s[1], h, Math.max(0, d + u.duration - t), d, y),
  573. 1 === h && p(o);
  574. }
  575. }
  576. }
  577. b.State.isTicking && w(c);
  578. }
  579. function p(e, t) {
  580. if (!b.State.calls[e])
  581. return !1;
  582. 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++) {
  583. var p = r[u].element;
  584. if (t || o.loop || ("none" === o.display && S.setPropertyValue(p, "display", o.display),
  585. "hidden" === o.visibility && S.setPropertyValue(p, "visibility", o.visibility)),
  586. o.loop !== !0 && (f.queue(p)[1] === a || !/\.velocityQueueEntryFlag/i.test(f.queue(p)[1])) && i(p)) {
  587. i(p).isAnimating = !1,
  588. i(p).rootPropertyValueCache = {};
  589. var d = !1;
  590. f.each(S.Lists.transforms3D, function (e, t) {
  591. var r = /^scale/.test(t) ? 1 : 0
  592. , n = i(p).transformCache[t];
  593. i(p).transformCache[t] !== a && new RegExp("^\\(" + r + "[^.]").test(n) && (d = !0,
  594. delete i(p).transformCache[t]);
  595. }),
  596. o.mobileHA && (d = !0,
  597. delete i(p).transformCache.translate3d),
  598. d && S.flushTransformCache(p),
  599. S.Values.removeClass(p, "velocity-animating");
  600. }
  601. if (!t && o.complete && !o.loop && u === c - 1)
  602. try {
  603. o.complete.call(n, n);
  604. } catch (g) {
  605. setTimeout(function () {
  606. throw g;
  607. }, 1);
  608. }
  609. s && o.loop !== !0 && s(n),
  610. i(p) && o.loop === !0 && !t && (f.each(i(p).tweensContainer, function (e, t) {
  611. /^rotate/.test(e) && 360 === parseFloat(t.endValue) && (t.endValue = 0,
  612. t.startValue = 360),
  613. /^backgroundPosition/.test(e) && 100 === parseFloat(t.endValue) && "%" === t.unitType && (t.endValue = 0,
  614. t.startValue = 100);
  615. }),
  616. b(p, "reverse", {
  617. loop: !0,
  618. delay: o.delay
  619. })),
  620. o.queue !== !1 && f.dequeue(p, o.queue);
  621. }
  622. b.State.calls[e] = !1;
  623. for (var m = 0, y = b.State.calls.length; y > m; m++) {
  624. if (b.State.calls[m] !== !1) {
  625. l = !0;
  626. break;
  627. }
  628. }
  629. l === !1 && (b.State.isTicking = !1,
  630. delete b.State.calls,
  631. b.State.calls = []);
  632. }
  633. var f, d = function () {
  634. if (r.documentMode)
  635. return r.documentMode;
  636. for (var e = 7; e > 4; e--) {
  637. var t = r.createElement("div");
  638. if (t.innerHTML = "<!--[if IE " + e + "]><span></span><![endif]-->",
  639. t.getElementsByTagName("span").length)
  640. return t = null,
  641. e;
  642. }
  643. return a;
  644. }(), g = function () {
  645. var e = 0;
  646. return t.webkitRequestAnimationFrame || t.mozRequestAnimationFrame || function (t) {
  647. var r, a = new Date().getTime();
  648. return r = Math.max(0, 16 - (a - e)),
  649. e = a + r,
  650. setTimeout(function () {
  651. t(a + r);
  652. }, r);
  653. }
  654. ;
  655. }(), m = {
  656. isString: function (e) {
  657. return "string" == typeof e;
  658. },
  659. isArray: Array.isArray || function (e) {
  660. return "[object Array]" === Object.prototype.toString.call(e);
  661. }
  662. ,
  663. isFunction: function (e) {
  664. return "[object Function]" === Object.prototype.toString.call(e);
  665. },
  666. isNode: function (e) {
  667. return e && e.nodeType;
  668. },
  669. isNodeList: function (e) {
  670. 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);
  671. },
  672. isWrapped: function (e) {
  673. return e && (e.jquery || t.Zepto && t.Zepto.zepto.isZ(e));
  674. },
  675. isSVG: function (e) {
  676. return t.SVGElement && e instanceof t.SVGElement;
  677. },
  678. isEmptyObject: function (e) {
  679. for (var t in e) {
  680. return !1;
  681. }
  682. return !0;
  683. }
  684. }, y = !1;
  685. if (e.fn && e.fn.jquery ? (f = e,
  686. y = !0) : f = t.Velocity.Utilities,
  687. 8 >= d && !y)
  688. throw new Error("Velocity: IE8 and below require jQuery to be loaded before Velocity.");
  689. if (7 >= d)
  690. return void (jQuery.fn.velocity = jQuery.fn.animate);
  691. var h = 400
  692. , v = "swing"
  693. , b = {
  694. State: {
  695. isMobile: /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),
  696. isAndroid: /Android/i.test(navigator.userAgent),
  697. isGingerbread: /Android 2\.3\.[3-7]/i.test(navigator.userAgent),
  698. isChrome: t.chrome,
  699. isFirefox: /Firefox/i.test(navigator.userAgent),
  700. prefixElement: r.createElement("div"),
  701. prefixMatches: {},
  702. scrollAnchor: null,
  703. scrollPropertyLeft: null,
  704. scrollPropertyTop: null,
  705. isTicking: !1,
  706. calls: []
  707. },
  708. CSS: {},
  709. Utilities: f,
  710. Redirects: {},
  711. Easings: {},
  712. Promise: t.Promise,
  713. defaults: {
  714. queue: "",
  715. duration: h,
  716. easing: v,
  717. begin: a,
  718. complete: a,
  719. progress: a,
  720. display: a,
  721. visibility: a,
  722. loop: !1,
  723. delay: !1,
  724. mobileHA: !0,
  725. _cacheValues: !0
  726. },
  727. init: function (e) {
  728. f.data(e, "velocity", {
  729. isSVG: m.isSVG(e),
  730. isAnimating: !1,
  731. computedStyle: null,
  732. tweensContainer: null,
  733. rootPropertyValueCache: {},
  734. transformCache: {}
  735. });
  736. },
  737. hook: null,
  738. mock: !1,
  739. version: {
  740. major: 1,
  741. minor: 2,
  742. patch: 2
  743. },
  744. debug: !1
  745. };
  746. t.pageYOffset !== a ? (b.State.scrollAnchor = t,
  747. b.State.scrollPropertyLeft = "pageXOffset",
  748. b.State.scrollPropertyTop = "pageYOffset") : (b.State.scrollAnchor = r.documentElement || r.body.parentNode || r.body,
  749. b.State.scrollPropertyLeft = "scrollLeft",
  750. b.State.scrollPropertyTop = "scrollTop");
  751. var x = function () {
  752. function e(e) {
  753. return -e.tension * e.x - e.friction * e.v;
  754. }
  755. function t(t, r, a) {
  756. var n = {
  757. x: t.x + a.dx * r,
  758. v: t.v + a.dv * r,
  759. tension: t.tension,
  760. friction: t.friction
  761. };
  762. return {
  763. dx: n.v,
  764. dv: e(n)
  765. };
  766. }
  767. function r(r, a) {
  768. var n = {
  769. dx: r.v,
  770. dv: e(r)
  771. }
  772. , o = t(r, .5 * a, n)
  773. , i = t(r, .5 * a, o)
  774. , s = t(r, a, i)
  775. , l = 1 / 6 * (n.dx + 2 * (o.dx + i.dx) + s.dx)
  776. , u = 1 / 6 * (n.dv + 2 * (o.dv + i.dv) + s.dv);
  777. return r.x = r.x + l * a,
  778. r.v = r.v + u * a,
  779. r;
  780. }
  781. return function a(e, t, n) {
  782. var o, i, s, l = {
  783. x: -1,
  784. v: 0,
  785. tension: null,
  786. friction: null
  787. }, u = [0], c = 0, p = 1e-4, f = .016;
  788. for (e = parseFloat(e) || 500,
  789. t = parseFloat(t) || 20,
  790. n = n || null,
  791. l.tension = e,
  792. l.friction = t,
  793. o = null !== n,
  794. o ? (c = a(e, t),
  795. i = c / n * f) : i = f; s = r(s || l, i),
  796. u.push(1 + s.x),
  797. c += 16,
  798. Math.abs(s.x) > p && Math.abs(s.v) > p;) { }
  799. return o ? function (e) {
  800. return u[e * (u.length - 1) | 0];
  801. }
  802. : c;
  803. }
  804. ;
  805. }();
  806. b.Easings = {
  807. linear: function (e) {
  808. return e;
  809. },
  810. swing: function (e) {
  811. return .5 - Math.cos(e * Math.PI) / 2;
  812. },
  813. spring: function (e) {
  814. return 1 - Math.cos(4.5 * e * Math.PI) * Math.exp(6 * -e);
  815. }
  816. },
  817. 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) {
  818. b.Easings[t[0]] = l.apply(null, t[1]);
  819. });
  820. var S = b.CSS = {
  821. RegEx: {
  822. isHex: /^#([A-f\d]{3}){1,2}$/i,
  823. valueUnwrap: /^[A-z]+\((.*)\)$/i,
  824. wrappedValueAlreadyExtracted: /[0-9.]+ [0-9.]+ [0-9.]+( [0-9.]+)?/,
  825. valueSplit: /([A-z]+\(.+\))|(([A-z0-9#-.]+?)(?=\s|$))/gi
  826. },
  827. Lists: {
  828. colors: ["fill", "stroke", "stopColor", "color", "backgroundColor", "borderColor", "borderTopColor", "borderRightColor", "borderBottomColor", "borderLeftColor", "outlineColor"],
  829. transformsBase: ["translateX", "translateY", "scale", "scaleX", "scaleY", "skewX", "skewY", "rotateZ"],
  830. transforms3D: ["transformPerspective", "translateZ", "scaleZ", "rotateX", "rotateY"]
  831. },
  832. Hooks: {
  833. templates: {
  834. textShadow: ["Color X Y Blur", "black 0px 0px 0px"],
  835. boxShadow: ["Color X Y Blur Spread", "black 0px 0px 0px 0px"],
  836. clip: ["Top Right Bottom Left", "0px 0px 0px 0px"],
  837. backgroundPosition: ["X Y", "0% 0%"],
  838. transformOrigin: ["X Y Z", "50% 50% 0px"],
  839. perspectiveOrigin: ["X Y", "50% 50%"]
  840. },
  841. registered: {},
  842. register: function () {
  843. for (var e = 0; e < S.Lists.colors.length; e++) {
  844. var t = "color" === S.Lists.colors[e] ? "0 0 0 1" : "255 255 255 1";
  845. S.Hooks.templates[S.Lists.colors[e]] = ["Red Green Blue Alpha", t];
  846. }
  847. var r, a, n;
  848. if (d)
  849. for (r in S.Hooks.templates) {
  850. a = S.Hooks.templates[r],
  851. n = a[0].split(" ");
  852. var o = a[1].match(S.RegEx.valueSplit);
  853. "Color" === n[0] && (n.push(n.shift()),
  854. o.push(o.shift()),
  855. S.Hooks.templates[r] = [n.join(" "), o.join(" ")]);
  856. }
  857. for (r in S.Hooks.templates) {
  858. a = S.Hooks.templates[r],
  859. n = a[0].split(" ");
  860. for (var e in n) {
  861. var i = r + n[e]
  862. , s = e;
  863. S.Hooks.registered[i] = [r, s];
  864. }
  865. }
  866. },
  867. getRoot: function (e) {
  868. var t = S.Hooks.registered[e];
  869. return t ? t[0] : e;
  870. },
  871. cleanRootPropertyValue: function (e, t) {
  872. return S.RegEx.valueUnwrap.test(t) && (t = t.match(S.RegEx.valueUnwrap)[1]),
  873. S.Values.isCSSNullValue(t) && (t = S.Hooks.templates[e][1]),
  874. t;
  875. },
  876. extractValue: function (e, t) {
  877. var r = S.Hooks.registered[e];
  878. if (r) {
  879. var a = r[0]
  880. , n = r[1];
  881. return t = S.Hooks.cleanRootPropertyValue(a, t),
  882. t.toString().match(S.RegEx.valueSplit)[n];
  883. }
  884. return t;
  885. },
  886. injectValue: function (e, t, r) {
  887. var a = S.Hooks.registered[e];
  888. if (a) {
  889. var n, o, i = a[0], s = a[1];
  890. return r = S.Hooks.cleanRootPropertyValue(i, r),
  891. n = r.toString().match(S.RegEx.valueSplit),
  892. n[s] = t,
  893. o = n.join(" ");
  894. }
  895. return r;
  896. }
  897. },
  898. Normalizations: {
  899. registered: {
  900. clip: function (e, t, r) {
  901. switch (e) {
  902. case "name":
  903. return "clip";
  904. case "extract":
  905. var a;
  906. return S.RegEx.wrappedValueAlreadyExtracted.test(r) ? a = r : (a = r.toString().match(S.RegEx.valueUnwrap),
  907. a = a ? a[1].replace(/,(\s+)?/g, " ") : r),
  908. a;
  909. case "inject":
  910. return "rect(" + r + ")";
  911. }
  912. },
  913. blur: function (e, t, r) {
  914. switch (e) {
  915. case "name":
  916. return b.State.isFirefox ? "filter" : "-webkit-filter";
  917. case "extract":
  918. var a = parseFloat(r);
  919. if (!a && 0 !== a) {
  920. var n = r.toString().match(/blur\(([0-9]+[A-z]+)\)/i);
  921. a = n ? n[1] : 0;
  922. }
  923. return a;
  924. case "inject":
  925. return parseFloat(r) ? "blur(" + r + ")" : "none";
  926. }
  927. },
  928. opacity: function (e, t, r) {
  929. if (8 >= d)
  930. switch (e) {
  931. case "name":
  932. return "filter";
  933. case "extract":
  934. var a = r.toString().match(/alpha\(opacity=(.*)\)/i);
  935. return r = a ? a[1] / 100 : 1;
  936. case "inject":
  937. return t.style.zoom = 1,
  938. parseFloat(r) >= 1 ? "" : "alpha(opacity=" + parseInt(100 * parseFloat(r), 10) + ")";
  939. }
  940. else
  941. switch (e) {
  942. case "name":
  943. return "opacity";
  944. case "extract":
  945. return r;
  946. case "inject":
  947. return r;
  948. }
  949. }
  950. },
  951. register: function () {
  952. 9 >= d || b.State.isGingerbread || (S.Lists.transformsBase = S.Lists.transformsBase.concat(S.Lists.transforms3D));
  953. for (var e = 0; e < S.Lists.transformsBase.length; e++) {
  954. !function () {
  955. var t = S.Lists.transformsBase[e];
  956. S.Normalizations.registered[t] = function (e, r, n) {
  957. switch (e) {
  958. case "name":
  959. return "transform";
  960. case "extract":
  961. return i(r) === a || i(r).transformCache[t] === a ? /^scale/i.test(t) ? 1 : 0 : i(r).transformCache[t].replace(/[()]/g, "");
  962. case "inject":
  963. var o = !1;
  964. switch (t.substr(0, t.length - 1)) {
  965. case "translate":
  966. o = !/(%|px|em|rem|vw|vh|\d)$/i.test(n);
  967. break;
  968. case "scal":
  969. case "scale":
  970. b.State.isAndroid && i(r).transformCache[t] === a && 1 > n && (n = 1),
  971. o = !/(\d)$/i.test(n);
  972. break;
  973. case "skew":
  974. o = !/(deg|\d)$/i.test(n);
  975. break;
  976. case "rotate":
  977. o = !/(deg|\d)$/i.test(n);
  978. }
  979. return o || (i(r).transformCache[t] = "(" + n + ")"),
  980. i(r).transformCache[t];
  981. }
  982. }
  983. ;
  984. }();
  985. }
  986. for (var e = 0; e < S.Lists.colors.length; e++) {
  987. !function () {
  988. var t = S.Lists.colors[e];
  989. S.Normalizations.registered[t] = function (e, r, n) {
  990. switch (e) {
  991. case "name":
  992. return t;
  993. case "extract":
  994. var o;
  995. if (S.RegEx.wrappedValueAlreadyExtracted.test(n))
  996. o = n;
  997. else {
  998. var i, s = {
  999. black: "rgb(0, 0, 0)",
  1000. blue: "rgb(0, 0, 255)",
  1001. gray: "rgb(128, 128, 128)",
  1002. green: "rgb(0, 128, 0)",
  1003. red: "rgb(255, 0, 0)",
  1004. white: "rgb(255, 255, 255)"
  1005. };
  1006. /^[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),
  1007. o = (i || n).toString().match(S.RegEx.valueUnwrap)[1].replace(/,(\s+)?/g, " ");
  1008. }
  1009. return 8 >= d || 3 !== o.split(" ").length || (o += " 1"),
  1010. o;
  1011. case "inject":
  1012. return 8 >= d ? 4 === n.split(" ").length && (n = n.split(/\s+/).slice(0, 3).join(" ")) : 3 === n.split(" ").length && (n += " 1"),
  1013. (8 >= d ? "rgb" : "rgba") + "(" + n.replace(/\s+/g, ",").replace(/\.(\d)+(?=,)/g, "") + ")";
  1014. }
  1015. }
  1016. ;
  1017. }();
  1018. }
  1019. }
  1020. },
  1021. Names: {
  1022. camelCase: function (e) {
  1023. return e.replace(/-(\w)/g, function (e, t) {
  1024. return t.toUpperCase();
  1025. });
  1026. },
  1027. SVGAttribute: function (e) {
  1028. var t = "width|height|x|y|cx|cy|r|rx|ry|x1|x2|y1|y2";
  1029. return (d || b.State.isAndroid && !b.State.isChrome) && (t += "|transform"),
  1030. new RegExp("^(" + t + ")$", "i").test(e);
  1031. },
  1032. prefixCheck: function (e) {
  1033. if (b.State.prefixMatches[e])
  1034. return [b.State.prefixMatches[e], !0];
  1035. for (var t = ["", "Webkit", "Moz", "ms", "O"], r = 0, a = t.length; a > r; r++) {
  1036. var n;
  1037. if (n = 0 === r ? e : t[r] + e.replace(/^\w/, function (e) {
  1038. return e.toUpperCase();
  1039. }),
  1040. m.isString(b.State.prefixElement.style[n]))
  1041. return b.State.prefixMatches[e] = n,
  1042. [n, !0];
  1043. }
  1044. return [e, !1];
  1045. }
  1046. },
  1047. Values: {
  1048. hexToRgb: function (e) {
  1049. var t, r = /^#?([a-f\d])([a-f\d])([a-f\d])$/i, a = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i;
  1050. return e = e.replace(r, function (e, t, r, a) {
  1051. return t + t + r + r + a + a;
  1052. }),
  1053. t = a.exec(e),
  1054. t ? [parseInt(t[1], 16), parseInt(t[2], 16), parseInt(t[3], 16)] : [0, 0, 0];
  1055. },
  1056. isCSSNullValue: function (e) {
  1057. return 0 == e || /^(none|auto|transparent|(rgba\(0, ?0, ?0, ?0\)))$/i.test(e);
  1058. },
  1059. getUnitType: function (e) {
  1060. 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");
  1061. },
  1062. getDisplayType: function (e) {
  1063. var t = e && e.tagName.toString().toLowerCase();
  1064. 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");
  1065. },
  1066. addClass: function (e, t) {
  1067. e.classList ? e.classList.add(t) : e.className += (e.className.length ? " " : "") + t;
  1068. },
  1069. removeClass: function (e, t) {
  1070. e.classList ? e.classList.remove(t) : e.className = e.className.toString().replace(new RegExp("(^|\\s)" + t.split(" ").join("|") + "(\\s|$)", "gi"), " ");
  1071. }
  1072. },
  1073. getPropertyValue: function (e, r, n, o) {
  1074. function s(e, r) {
  1075. function n() {
  1076. u && S.setPropertyValue(e, "display", "none");
  1077. }
  1078. var l = 0;
  1079. if (8 >= d)
  1080. l = f.css(e, r);
  1081. else {
  1082. var u = !1;
  1083. if (/^(width|height)$/.test(r) && 0 === S.getPropertyValue(e, "display") && (u = !0,
  1084. S.setPropertyValue(e, "display", S.Values.getDisplayType(e))),
  1085. !o) {
  1086. if ("height" === r && "border-box" !== S.getPropertyValue(e, "boxSizing").toString().toLowerCase()) {
  1087. 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);
  1088. return n(),
  1089. c;
  1090. }
  1091. if ("width" === r && "border-box" !== S.getPropertyValue(e, "boxSizing").toString().toLowerCase()) {
  1092. 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);
  1093. return n(),
  1094. p;
  1095. }
  1096. }
  1097. var g;
  1098. g = i(e) === a ? t.getComputedStyle(e, null) : i(e).computedStyle ? i(e).computedStyle : i(e).computedStyle = t.getComputedStyle(e, null),
  1099. "borderColor" === r && (r = "borderTopColor"),
  1100. l = 9 === d && "filter" === r ? g.getPropertyValue(r) : g[r],
  1101. ("" === l || null === l) && (l = e.style[r]),
  1102. n();
  1103. }
  1104. if ("auto" === l && /^(top|right|bottom|left)$/i.test(r)) {
  1105. var m = s(e, "position");
  1106. ("fixed" === m || "absolute" === m && /top|left/i.test(r)) && (l = f(e).position()[r] + "px");
  1107. }
  1108. return l;
  1109. }
  1110. var l;
  1111. if (S.Hooks.registered[r]) {
  1112. var u = r
  1113. , c = S.Hooks.getRoot(u);
  1114. n === a && (n = S.getPropertyValue(e, S.Names.prefixCheck(c)[0])),
  1115. S.Normalizations.registered[c] && (n = S.Normalizations.registered[c]("extract", e, n)),
  1116. l = S.Hooks.extractValue(u, n);
  1117. } else if (S.Normalizations.registered[r]) {
  1118. var p, g;
  1119. p = S.Normalizations.registered[r]("name", e),
  1120. "transform" !== p && (g = s(e, S.Names.prefixCheck(p)[0]),
  1121. S.Values.isCSSNullValue(g) && S.Hooks.templates[r] && (g = S.Hooks.templates[r][1])),
  1122. l = S.Normalizations.registered[r]("extract", e, g);
  1123. }
  1124. if (!/^[\d-]/.test(l))
  1125. if (i(e) && i(e).isSVG && S.Names.SVGAttribute(r)) {
  1126. if (/^(height|width)$/i.test(r))
  1127. try {
  1128. l = e.getBBox()[r];
  1129. } catch (m) {
  1130. l = 0;
  1131. }
  1132. else
  1133. l = e.getAttribute(r);
  1134. } else
  1135. l = s(e, S.Names.prefixCheck(r)[0]);
  1136. return S.Values.isCSSNullValue(l) && (l = 0),
  1137. b.debug >= 2 && console.log("Get " + r + ": " + l),
  1138. l;
  1139. },
  1140. setPropertyValue: function (e, r, a, n, o) {
  1141. var s = r;
  1142. if ("scroll" === r)
  1143. o.container ? o.container["scroll" + o.direction] = a : "Left" === o.direction ? t.scrollTo(a, o.alternateValue) : t.scrollTo(o.alternateValue, a);
  1144. else if (S.Normalizations.registered[r] && "transform" === S.Normalizations.registered[r]("name", e))
  1145. S.Normalizations.registered[r]("inject", e, a),
  1146. s = "transform",
  1147. a = i(e).transformCache[r];
  1148. else {
  1149. if (S.Hooks.registered[r]) {
  1150. var l = r
  1151. , u = S.Hooks.getRoot(r);
  1152. n = n || S.getPropertyValue(e, u),
  1153. a = S.Hooks.injectValue(l, a, n),
  1154. r = u;
  1155. }
  1156. if (S.Normalizations.registered[r] && (a = S.Normalizations.registered[r]("inject", e, a),
  1157. r = S.Normalizations.registered[r]("name", e)),
  1158. s = S.Names.prefixCheck(r)[0],
  1159. 8 >= d)
  1160. try {
  1161. e.style[s] = a;
  1162. } catch (c) {
  1163. b.debug && console.log("Browser does not support [" + a + "] for [" + s + "]");
  1164. }
  1165. else
  1166. i(e) && i(e).isSVG && S.Names.SVGAttribute(r) ? e.setAttribute(r, a) : e.style[s] = a;
  1167. b.debug >= 2 && console.log("Set " + r + " (" + s + "): " + a);
  1168. }
  1169. return [s, a];
  1170. },
  1171. flushTransformCache: function (e) {
  1172. function t(t) {
  1173. return parseFloat(S.getPropertyValue(e, t));
  1174. }
  1175. var r = "";
  1176. if ((d || b.State.isAndroid && !b.State.isChrome) && i(e).isSVG) {
  1177. var a = {
  1178. translate: [t("translateX"), t("translateY")],
  1179. skewX: [t("skewX")],
  1180. skewY: [t("skewY")],
  1181. scale: 1 !== t("scale") ? [t("scale"), t("scale")] : [t("scaleX"), t("scaleY")],
  1182. rotate: [t("rotateZ"), 0, 0]
  1183. };
  1184. f.each(i(e).transformCache, function (e) {
  1185. /^translate/i.test(e) ? e = "translate" : /^scale/i.test(e) ? e = "scale" : /^rotate/i.test(e) && (e = "rotate"),
  1186. a[e] && (r += e + "(" + a[e].join(" ") + ") ",
  1187. delete a[e]);
  1188. });
  1189. } else {
  1190. var n, o;
  1191. f.each(i(e).transformCache, function (t) {
  1192. return n = i(e).transformCache[t],
  1193. "transformPerspective" === t ? (o = n,
  1194. !0) : (9 === d && "rotateZ" === t && (t = "rotate"),
  1195. void (r += t + n + " "));
  1196. }),
  1197. o && (r = "perspective" + o + " " + r);
  1198. }
  1199. S.setPropertyValue(e, "transform", r);
  1200. }
  1201. };
  1202. S.Hooks.register(),
  1203. S.Normalizations.register(),
  1204. b.hook = function (e, t, r) {
  1205. var n = a;
  1206. return e = o(e),
  1207. f.each(e, function (e, o) {
  1208. if (i(o) === a && b.init(o),
  1209. r === a)
  1210. n === a && (n = b.CSS.getPropertyValue(o, t));
  1211. else {
  1212. var s = b.CSS.setPropertyValue(o, t, r);
  1213. "transform" === s[0] && b.CSS.flushTransformCache(o),
  1214. n = s;
  1215. }
  1216. }),
  1217. n;
  1218. }
  1219. ;
  1220. var P = function () {
  1221. function e() {
  1222. return s ? k.promise || null : l;
  1223. }
  1224. function n() {
  1225. function e(e) {
  1226. function p(e, t) {
  1227. var r = a
  1228. , n = a
  1229. , i = a;
  1230. return m.isArray(e) ? (r = e[0],
  1231. !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),
  1232. e[2] !== a && (i = e[2]))) : r = e,
  1233. t || (n = n || s.easing),
  1234. m.isFunction(r) && (r = r.call(o, V, w)),
  1235. m.isFunction(i) && (i = i.call(o, V, w)),
  1236. [r || 0, n, i];
  1237. }
  1238. function d(e, t) {
  1239. var r, a;
  1240. return a = (t || "0").toString().toLowerCase().replace(/[%A-z]+$/, function (e) {
  1241. return r = e,
  1242. "";
  1243. }),
  1244. r || (r = S.Values.getUnitType(e)),
  1245. [a, r];
  1246. }
  1247. function h() {
  1248. var e = {
  1249. myParent: o.parentNode || r.body,
  1250. position: S.getPropertyValue(o, "position"),
  1251. fontSize: S.getPropertyValue(o, "fontSize")
  1252. }
  1253. , a = e.position === L.lastPosition && e.myParent === L.lastParent
  1254. , n = e.fontSize === L.lastFontSize;
  1255. L.lastParent = e.myParent,
  1256. L.lastPosition = e.position,
  1257. L.lastFontSize = e.fontSize;
  1258. var s = 100
  1259. , l = {};
  1260. if (n && a)
  1261. l.emToPx = L.lastEmToPx,
  1262. l.percentToPxWidth = L.lastPercentToPxWidth,
  1263. l.percentToPxHeight = L.lastPercentToPxHeight;
  1264. else {
  1265. var u = i(o).isSVG ? r.createElementNS("http://www.w3.org/2000/svg", "rect") : r.createElement("div");
  1266. b.init(u),
  1267. e.myParent.appendChild(u),
  1268. f.each(["overflow", "overflowX", "overflowY"], function (e, t) {
  1269. b.CSS.setPropertyValue(u, t, "hidden");
  1270. }),
  1271. b.CSS.setPropertyValue(u, "position", e.position),
  1272. b.CSS.setPropertyValue(u, "fontSize", e.fontSize),
  1273. b.CSS.setPropertyValue(u, "boxSizing", "content-box"),
  1274. f.each(["minWidth", "maxWidth", "width", "minHeight", "maxHeight", "height"], function (e, t) {
  1275. b.CSS.setPropertyValue(u, t, s + "%");
  1276. }),
  1277. b.CSS.setPropertyValue(u, "paddingLeft", s + "em"),
  1278. l.percentToPxWidth = L.lastPercentToPxWidth = (parseFloat(S.getPropertyValue(u, "width", null, !0)) || 1) / s,
  1279. l.percentToPxHeight = L.lastPercentToPxHeight = (parseFloat(S.getPropertyValue(u, "height", null, !0)) || 1) / s,
  1280. l.emToPx = L.lastEmToPx = (parseFloat(S.getPropertyValue(u, "paddingLeft")) || 1) / s,
  1281. e.myParent.removeChild(u);
  1282. }
  1283. return null === L.remToPx && (L.remToPx = parseFloat(S.getPropertyValue(r.body, "fontSize")) || 16),
  1284. null === L.vwToPx && (L.vwToPx = parseFloat(t.innerWidth) / 100,
  1285. L.vhToPx = parseFloat(t.innerHeight) / 100),
  1286. l.remToPx = L.remToPx,
  1287. l.vwToPx = L.vwToPx,
  1288. l.vhToPx = L.vhToPx,
  1289. b.debug >= 1 && console.log("Unit ratios: " + JSON.stringify(l), o),
  1290. l;
  1291. }
  1292. if (s.begin && 0 === V)
  1293. try {
  1294. s.begin.call(g, g);
  1295. } catch (x) {
  1296. setTimeout(function () {
  1297. throw x;
  1298. }, 1);
  1299. }
  1300. if ("scroll" === A) {
  1301. var P, C, T, F = /^x$/i.test(s.axis) ? "Left" : "Top", j = parseFloat(s.offset) || 0;
  1302. s.container ? m.isWrapped(s.container) || m.isNode(s.container) ? (s.container = s.container[0] || s.container,
  1303. P = s.container["scroll" + F],
  1304. T = P + f(o).position()[F.toLowerCase()] + j) : s.container = null : (P = b.State.scrollAnchor[b.State["scrollProperty" + F]],
  1305. C = b.State.scrollAnchor[b.State["scrollProperty" + ("Left" === F ? "Top" : "Left")]],
  1306. T = f(o).offset()[F.toLowerCase()] + j),
  1307. l = {
  1308. scroll: {
  1309. rootPropertyValue: !1,
  1310. startValue: P,
  1311. currentValue: P,
  1312. endValue: T,
  1313. unitType: "",
  1314. easing: s.easing,
  1315. scrollData: {
  1316. container: s.container,
  1317. direction: F,
  1318. alternateValue: C
  1319. }
  1320. },
  1321. element: o
  1322. },
  1323. b.debug && console.log("tweensContainer (scroll): ", l.scroll, o);
  1324. } else if ("reverse" === A) {
  1325. if (!i(o).tweensContainer)
  1326. return void f.dequeue(o, s.queue);
  1327. "none" === i(o).opts.display && (i(o).opts.display = "auto"),
  1328. "hidden" === i(o).opts.visibility && (i(o).opts.visibility = "visible"),
  1329. i(o).opts.loop = !1,
  1330. i(o).opts.begin = null,
  1331. i(o).opts.complete = null,
  1332. v.easing || delete s.easing,
  1333. v.duration || delete s.duration,
  1334. s = f.extend({}, i(o).opts, s);
  1335. var E = f.extend(!0, {}, i(o).tweensContainer);
  1336. for (var H in E) {
  1337. if ("element" !== H) {
  1338. var N = E[H].startValue;
  1339. E[H].startValue = E[H].currentValue = E[H].endValue,
  1340. E[H].endValue = N,
  1341. m.isEmptyObject(v) || (E[H].easing = s.easing),
  1342. b.debug && console.log("reverse tweensContainer (" + H + "): " + JSON.stringify(E[H]), o);
  1343. }
  1344. }
  1345. l = E;
  1346. } else if ("start" === A) {
  1347. var E;
  1348. i(o).tweensContainer && i(o).isAnimating === !0 && (E = i(o).tweensContainer),
  1349. f.each(y, function (e, t) {
  1350. if (RegExp("^" + S.Lists.colors.join("$|^") + "$").test(e)) {
  1351. var r = p(t, !0)
  1352. , n = r[0]
  1353. , o = r[1]
  1354. , i = r[2];
  1355. if (S.RegEx.isHex.test(n)) {
  1356. for (var s = ["Red", "Green", "Blue"], l = S.Values.hexToRgb(n), u = i ? S.Values.hexToRgb(i) : a, c = 0; c < s.length; c++) {
  1357. var f = [l[c]];
  1358. o && f.push(o),
  1359. u !== a && f.push(u[c]),
  1360. y[e + s[c]] = f;
  1361. }
  1362. delete y[e];
  1363. }
  1364. }
  1365. });
  1366. for (var z in y) {
  1367. var O = p(y[z])
  1368. , q = O[0]
  1369. , $ = O[1]
  1370. , M = O[2];
  1371. z = S.Names.camelCase(z);
  1372. var I = S.Hooks.getRoot(z)
  1373. , B = !1;
  1374. if (i(o).isSVG || "tween" === I || S.Names.prefixCheck(I)[1] !== !1 || S.Normalizations.registered[I] !== a) {
  1375. (s.display !== a && null !== s.display && "none" !== s.display || s.visibility !== a && "hidden" !== s.visibility) && /opacity|filter/.test(z) && !M && 0 !== q && (M = 0),
  1376. s._cacheValues && E && E[z] ? (M === a && (M = E[z].endValue + E[z].unitType),
  1377. B = i(o).rootPropertyValueCache[I]) : S.Hooks.registered[z] ? M === a ? (B = S.getPropertyValue(o, I),
  1378. M = S.getPropertyValue(o, z, B)) : B = S.Hooks.templates[I][1] : M === a && (M = S.getPropertyValue(o, z));
  1379. var W, G, Y, D = !1;
  1380. if (W = d(z, M),
  1381. M = W[0],
  1382. Y = W[1],
  1383. W = d(z, q),
  1384. q = W[0].replace(/^([+-\/*])=/, function (e, t) {
  1385. return D = t,
  1386. "";
  1387. }),
  1388. G = W[1],
  1389. M = parseFloat(M) || 0,
  1390. q = parseFloat(q) || 0,
  1391. "%" === G && (/^(fontSize|lineHeight)$/.test(z) ? (q /= 100,
  1392. G = "em") : /^scale/.test(z) ? (q /= 100,
  1393. G = "") : /(Red|Green|Blue)$/i.test(z) && (q = q / 100 * 255,
  1394. G = "")),
  1395. /[\/*]/.test(D))
  1396. G = Y;
  1397. else if (Y !== G && 0 !== M)
  1398. if (0 === q)
  1399. G = Y;
  1400. else {
  1401. n = n || h();
  1402. var Q = /margin|padding|left|right|width|text|word|letter/i.test(z) || /X$/.test(z) || "x" === z ? "x" : "y";
  1403. switch (Y) {
  1404. case "%":
  1405. M *= "x" === Q ? n.percentToPxWidth : n.percentToPxHeight;
  1406. break;
  1407. case "px":
  1408. break;
  1409. default:
  1410. M *= n[Y + "ToPx"];
  1411. }
  1412. switch (G) {
  1413. case "%":
  1414. M *= 1 / ("x" === Q ? n.percentToPxWidth : n.percentToPxHeight);
  1415. break;
  1416. case "px":
  1417. break;
  1418. default:
  1419. M *= 1 / n[G + "ToPx"];
  1420. }
  1421. }
  1422. switch (D) {
  1423. case "+":
  1424. q = M + q;
  1425. break;
  1426. case "-":
  1427. q = M - q;
  1428. break;
  1429. case "*":
  1430. q = M * q;
  1431. break;
  1432. case "/":
  1433. q = M / q;
  1434. }
  1435. l[z] = {
  1436. rootPropertyValue: B,
  1437. startValue: M,
  1438. currentValue: M,
  1439. endValue: q,
  1440. unitType: G,
  1441. easing: $
  1442. },
  1443. b.debug && console.log("tweensContainer (" + z + "): " + JSON.stringify(l[z]), o);
  1444. } else
  1445. b.debug && console.log("Skipping [" + I + "] due to a lack of browser support.");
  1446. }
  1447. l.element = o;
  1448. }
  1449. l.element && (S.Values.addClass(o, "velocity-animating"),
  1450. R.push(l),
  1451. "" === s.queue && (i(o).tweensContainer = l,
  1452. i(o).opts = s),
  1453. i(o).isAnimating = !0,
  1454. V === w - 1 ? (b.State.calls.push([R, g, s, null, k.resolver]),
  1455. b.State.isTicking === !1 && (b.State.isTicking = !0,
  1456. c())) : V++);
  1457. }
  1458. var n, o = this, s = f.extend({}, b.defaults, v), l = {};
  1459. switch (i(o) === a && b.init(o),
  1460. parseFloat(s.delay) && s.queue !== !1 && f.queue(o, s.queue, function (e) {
  1461. b.velocityQueueEntryFlag = !0,
  1462. i(o).delayTimer = {
  1463. setTimeout: setTimeout(e, parseFloat(s.delay)),
  1464. next: e
  1465. };
  1466. }),
  1467. s.duration.toString().toLowerCase()) {
  1468. case "fast":
  1469. s.duration = 200;
  1470. break;
  1471. case "normal":
  1472. s.duration = h;
  1473. break;
  1474. case "slow":
  1475. s.duration = 600;
  1476. break;
  1477. default:
  1478. s.duration = parseFloat(s.duration) || 1;
  1479. }
  1480. b.mock !== !1 && (b.mock === !0 ? s.duration = s.delay = 1 : (s.duration *= parseFloat(b.mock) || 1,
  1481. s.delay *= parseFloat(b.mock) || 1)),
  1482. s.easing = u(s.easing, s.duration),
  1483. s.begin && !m.isFunction(s.begin) && (s.begin = null),
  1484. s.progress && !m.isFunction(s.progress) && (s.progress = null),
  1485. s.complete && !m.isFunction(s.complete) && (s.complete = null),
  1486. s.display !== a && null !== s.display && (s.display = s.display.toString().toLowerCase(),
  1487. "auto" === s.display && (s.display = b.CSS.Values.getDisplayType(o))),
  1488. s.visibility !== a && null !== s.visibility && (s.visibility = s.visibility.toString().toLowerCase()),
  1489. s.mobileHA = s.mobileHA && b.State.isMobile && !b.State.isGingerbread,
  1490. s.queue === !1 ? s.delay ? setTimeout(e, s.delay) : e() : f.queue(o, s.queue, function (t, r) {
  1491. return r === !0 ? (k.promise && k.resolver(g),
  1492. !0) : (b.velocityQueueEntryFlag = !0,
  1493. void e(t));
  1494. }),
  1495. "" !== s.queue && "fx" !== s.queue || "inprogress" === f.queue(o)[0] || f.dequeue(o);
  1496. }
  1497. var s, l, d, g, y, v, x = arguments[0] && (arguments[0].p || f.isPlainObject(arguments[0].properties) && !arguments[0].properties.names || m.isString(arguments[0].properties));
  1498. if (m.isWrapped(this) ? (s = !1,
  1499. d = 0,
  1500. g = this,
  1501. l = this) : (s = !0,
  1502. d = 1,
  1503. g = x ? arguments[0].elements || arguments[0].e : arguments[0]),
  1504. g = o(g)) {
  1505. x ? (y = arguments[0].properties || arguments[0].p,
  1506. v = arguments[0].options || arguments[0].o) : (y = arguments[d],
  1507. v = arguments[d + 1]);
  1508. var w = g.length
  1509. , V = 0;
  1510. if (!/^(stop|finish)$/i.test(y) && !f.isPlainObject(v)) {
  1511. var C = d + 1;
  1512. v = {};
  1513. for (var T = C; T < arguments.length; T++) {
  1514. 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];
  1515. }
  1516. }
  1517. var k = {
  1518. promise: null,
  1519. resolver: null,
  1520. rejecter: null
  1521. };
  1522. s && b.Promise && (k.promise = new b.Promise(function (e, t) {
  1523. k.resolver = e,
  1524. k.rejecter = t;
  1525. }
  1526. ));
  1527. var A;
  1528. switch (y) {
  1529. case "scroll":
  1530. A = "scroll";
  1531. break;
  1532. case "reverse":
  1533. A = "reverse";
  1534. break;
  1535. case "finish":
  1536. case "stop":
  1537. f.each(g, function (e, t) {
  1538. i(t) && i(t).delayTimer && (clearTimeout(i(t).delayTimer.setTimeout),
  1539. i(t).delayTimer.next && i(t).delayTimer.next(),
  1540. delete i(t).delayTimer);
  1541. });
  1542. var F = [];
  1543. return f.each(b.State.calls, function (e, t) {
  1544. t && f.each(t[1], function (r, n) {
  1545. var o = v === a ? "" : v;
  1546. return o === !0 || t[2].queue === o || v === a && t[2].queue === !1 ? void f.each(g, function (r, a) {
  1547. a === n && ((v === !0 || m.isString(v)) && (f.each(f.queue(a, m.isString(v) ? v : ""), function (e, t) {
  1548. m.isFunction(t) && t(null, !0);
  1549. }),
  1550. f.queue(a, m.isString(v) ? v : "", [])),
  1551. "stop" === y ? (i(a) && i(a).tweensContainer && o !== !1 && f.each(i(a).tweensContainer, function (e, t) {
  1552. t.endValue = t.currentValue;
  1553. }),
  1554. F.push(e)) : "finish" === y && (t[2].duration = 1));
  1555. }) : !0;
  1556. });
  1557. }),
  1558. "stop" === y && (f.each(F, function (e, t) {
  1559. p(t, !0);
  1560. }),
  1561. k.promise && k.resolver(g)),
  1562. e();
  1563. default:
  1564. if (!f.isPlainObject(y) || m.isEmptyObject(y)) {
  1565. if (m.isString(y) && b.Redirects[y]) {
  1566. var j = f.extend({}, v)
  1567. , E = j.duration
  1568. , H = j.delay || 0;
  1569. return j.backwards === !0 && (g = f.extend(!0, [], g).reverse()),
  1570. f.each(g, function (e, t) {
  1571. parseFloat(j.stagger) ? j.delay = H + parseFloat(j.stagger) * e : m.isFunction(j.stagger) && (j.delay = H + j.stagger.call(t, e, w)),
  1572. j.drag && (j.duration = parseFloat(E) || (/^(callout|transition)/.test(y) ? 1e3 : h),
  1573. j.duration = Math.max(j.duration * (j.backwards ? 1 - e / w : (e + 1) / w), .75 * j.duration, 200)),
  1574. b.Redirects[y].call(t, t, j || {}, e, w, g, k.promise ? k : a);
  1575. }),
  1576. e();
  1577. }
  1578. var N = "Velocity: First argument (" + y + ") was not a property map, a known action, or a registered redirect. Aborting.";
  1579. return k.promise ? k.rejecter(new Error(N)) : console.log(N),
  1580. e();
  1581. }
  1582. A = "start";
  1583. }
  1584. var L = {
  1585. lastParent: null,
  1586. lastPosition: null,
  1587. lastFontSize: null,
  1588. lastPercentToPxWidth: null,
  1589. lastPercentToPxHeight: null,
  1590. lastEmToPx: null,
  1591. remToPx: null,
  1592. vwToPx: null,
  1593. vhToPx: null
  1594. }
  1595. , R = [];
  1596. f.each(g, function (e, t) {
  1597. m.isNode(t) && n.call(t);
  1598. });
  1599. var z, j = f.extend({}, b.defaults, v);
  1600. if (j.loop = parseInt(j.loop),
  1601. z = 2 * j.loop - 1,
  1602. j.loop)
  1603. for (var O = 0; z > O; O++) {
  1604. var q = {
  1605. delay: j.delay,
  1606. progress: j.progress
  1607. };
  1608. O === z - 1 && (q.display = j.display,
  1609. q.visibility = j.visibility,
  1610. q.complete = j.complete),
  1611. P(g, "reverse", q);
  1612. }
  1613. return e();
  1614. }
  1615. };
  1616. b = f.extend(P, b),
  1617. b.animate = P;
  1618. var w = t.requestAnimationFrame || g;
  1619. return b.State.isMobile || r.hidden === a || r.addEventListener("visibilitychange", function () {
  1620. r.hidden ? (w = function (e) {
  1621. return setTimeout(function () {
  1622. e(!0);
  1623. }, 16);
  1624. }
  1625. ,
  1626. c()) : w = t.requestAnimationFrame || g;
  1627. }),
  1628. e.Velocity = b,
  1629. e !== t && (e.fn.velocity = P,
  1630. e.fn.velocity.defaults = b.defaults),
  1631. f.each(["Down", "Up"], function (e, t) {
  1632. b.Redirects["slide" + t] = function (e, r, n, o, i, s) {
  1633. var l = f.extend({}, r)
  1634. , u = l.begin
  1635. , c = l.complete
  1636. , p = {
  1637. height: "",
  1638. marginTop: "",
  1639. marginBottom: "",
  1640. paddingTop: "",
  1641. paddingBottom: ""
  1642. }
  1643. , d = {};
  1644. l.display === a && (l.display = "Down" === t ? "inline" === b.CSS.Values.getDisplayType(e) ? "inline-block" : "block" : "none"),
  1645. l.begin = function () {
  1646. u && u.call(i, i);
  1647. for (var r in p) {
  1648. d[r] = e.style[r];
  1649. var a = b.CSS.getPropertyValue(e, r);
  1650. p[r] = "Down" === t ? [a, 0] : [0, a];
  1651. }
  1652. d.overflow = e.style.overflow,
  1653. e.style.overflow = "hidden";
  1654. }
  1655. ,
  1656. l.complete = function () {
  1657. for (var t in d) {
  1658. e.style[t] = d[t];
  1659. }
  1660. c && c.call(i, i),
  1661. s && s.resolver(i);
  1662. }
  1663. ,
  1664. b(e, p, l);
  1665. }
  1666. ;
  1667. }),
  1668. f.each(["In", "Out"], function (e, t) {
  1669. b.Redirects["fade" + t] = function (e, r, n, o, i, s) {
  1670. var l = f.extend({}, r)
  1671. , u = {
  1672. opacity: "In" === t ? 1 : 0
  1673. }
  1674. , c = l.complete;
  1675. l.complete = n !== o - 1 ? l.begin = null : function () {
  1676. c && c.call(i, i),
  1677. s && s.resolver(i);
  1678. }
  1679. ,
  1680. l.display === a && (l.display = "In" === t ? "auto" : "none"),
  1681. b(this, u, l);
  1682. }
  1683. ;
  1684. }),
  1685. b;
  1686. }(window.jQuery || window.Zepto || window, window, document);
  1687. }));
  1688. ; !function (a, b, c, d) {
  1689. "use strict";
  1690. function k(a, b, c) {
  1691. return setTimeout(q(a, c), b);
  1692. }
  1693. function l(a, b, c) {
  1694. return Array.isArray(a) ? (m(a, c[b], c),
  1695. !0) : !1;
  1696. }
  1697. function m(a, b, c) {
  1698. var e;
  1699. if (a)
  1700. if (a.forEach)
  1701. a.forEach(b, c);
  1702. else if (a.length !== d)
  1703. for (e = 0; e < a.length;) {
  1704. b.call(c, a[e], e, a),
  1705. e++;
  1706. }
  1707. else
  1708. for (e in a) {
  1709. a.hasOwnProperty(e) && b.call(c, a[e], e, a);
  1710. }
  1711. }
  1712. function n(a, b, c) {
  1713. for (var e = Object.keys(b), f = 0; f < e.length;) {
  1714. (!c || c && a[e[f]] === d) && (a[e[f]] = b[e[f]]),
  1715. f++;
  1716. }
  1717. return a;
  1718. }
  1719. function o(a, b) {
  1720. return n(a, b, !0);
  1721. }
  1722. function p(a, b, c) {
  1723. var e, d = b.prototype;
  1724. e = a.prototype = Object.create(d),
  1725. e.constructor = a,
  1726. e._super = d,
  1727. c && n(e, c);
  1728. }
  1729. function q(a, b) {
  1730. return function () {
  1731. return a.apply(b, arguments);
  1732. }
  1733. ;
  1734. }
  1735. function r(a, b) {
  1736. return typeof a == g ? a.apply(b ? b[0] || d : d, b) : a;
  1737. }
  1738. function s(a, b) {
  1739. return a === d ? b : a;
  1740. }
  1741. function t(a, b, c) {
  1742. m(x(b), function (b) {
  1743. a.addEventListener(b, c, !1);
  1744. });
  1745. }
  1746. function u(a, b, c) {
  1747. m(x(b), function (b) {
  1748. a.removeEventListener(b, c, !1);
  1749. });
  1750. }
  1751. function v(a, b) {
  1752. for (; a;) {
  1753. if (a == b)
  1754. return !0;
  1755. a = a.parentNode;
  1756. }
  1757. return !1;
  1758. }
  1759. function w(a, b) {
  1760. return a.indexOf(b) > -1;
  1761. }
  1762. function x(a) {
  1763. return a.trim().split(/\s+/g);
  1764. }
  1765. function y(a, b, c) {
  1766. if (a.indexOf && !c)
  1767. return a.indexOf(b);
  1768. for (var d = 0; d < a.length;) {
  1769. if (c && a[d][c] == b || !c && a[d] === b)
  1770. return d;
  1771. d++;
  1772. }
  1773. return -1;
  1774. }
  1775. function z(a) {
  1776. return Array.prototype.slice.call(a, 0);
  1777. }
  1778. function A(a, b, c) {
  1779. for (var d = [], e = [], f = 0; f < a.length;) {
  1780. var g = b ? a[f][b] : a[f];
  1781. y(e, g) < 0 && d.push(a[f]),
  1782. e[f] = g,
  1783. f++;
  1784. }
  1785. return c && (d = b ? d.sort(function (a, c) {
  1786. return a[b] > c[b];
  1787. }) : d.sort()),
  1788. d;
  1789. }
  1790. function B(a, b) {
  1791. for (var c, f, g = b[0].toUpperCase() + b.slice(1), h = 0; h < e.length;) {
  1792. if (c = e[h],
  1793. f = c ? c + g : b,
  1794. f in a)
  1795. return f;
  1796. h++;
  1797. }
  1798. return d;
  1799. }
  1800. function D() {
  1801. return C++;
  1802. }
  1803. function E(a) {
  1804. var b = a.ownerDocument;
  1805. return b.defaultView || b.parentWindow;
  1806. }
  1807. function ab(a, b) {
  1808. var c = this;
  1809. this.manager = a,
  1810. this.callback = b,
  1811. this.element = a.element,
  1812. this.target = a.options.inputTarget,
  1813. this.domHandler = function (b) {
  1814. r(a.options.enable, [a]) && c.handler(b);
  1815. }
  1816. ,
  1817. this.init();
  1818. }
  1819. function bb(a) {
  1820. var b, c = a.options.inputClass;
  1821. return b = c ? c : H ? wb : I ? Eb : G ? Gb : rb,
  1822. new b(a, cb);
  1823. }
  1824. function cb(a, b, c) {
  1825. var d = c.pointers.length
  1826. , e = c.changedPointers.length
  1827. , f = b & O && 0 === d - e
  1828. , g = b & (Q | R) && 0 === d - e;
  1829. c.isFirst = !!f,
  1830. c.isFinal = !!g,
  1831. f && (a.session = {}),
  1832. c.eventType = b,
  1833. db(a, c),
  1834. a.emit("hammer.input", c),
  1835. a.recognize(c),
  1836. a.session.prevInput = c;
  1837. }
  1838. function db(a, b) {
  1839. var c = a.session
  1840. , d = b.pointers
  1841. , e = d.length;
  1842. c.firstInput || (c.firstInput = gb(b)),
  1843. e > 1 && !c.firstMultiple ? c.firstMultiple = gb(b) : 1 === e && (c.firstMultiple = !1);
  1844. var f = c.firstInput
  1845. , g = c.firstMultiple
  1846. , h = g ? g.center : f.center
  1847. , i = b.center = hb(d);
  1848. b.timeStamp = j(),
  1849. b.deltaTime = b.timeStamp - f.timeStamp,
  1850. b.angle = lb(h, i),
  1851. b.distance = kb(h, i),
  1852. eb(c, b),
  1853. b.offsetDirection = jb(b.deltaX, b.deltaY),
  1854. b.scale = g ? nb(g.pointers, d) : 1,
  1855. b.rotation = g ? mb(g.pointers, d) : 0,
  1856. fb(c, b);
  1857. var k = a.element;
  1858. v(b.srcEvent.target, k) && (k = b.srcEvent.target),
  1859. b.target = k;
  1860. }
  1861. function eb(a, b) {
  1862. var c = b.center
  1863. , d = a.offsetDelta || {}
  1864. , e = a.prevDelta || {}
  1865. , f = a.prevInput || {};
  1866. (b.eventType === O || f.eventType === Q) && (e = a.prevDelta = {
  1867. x: f.deltaX || 0,
  1868. y: f.deltaY || 0
  1869. },
  1870. d = a.offsetDelta = {
  1871. x: c.x,
  1872. y: c.y
  1873. }),
  1874. b.deltaX = e.x + (c.x - d.x),
  1875. b.deltaY = e.y + (c.y - d.y);
  1876. }
  1877. function fb(a, b) {
  1878. var f, g, h, j, c = a.lastInterval || b, e = b.timeStamp - c.timeStamp;
  1879. if (b.eventType != R && (e > N || c.velocity === d)) {
  1880. var k = c.deltaX - b.deltaX
  1881. , l = c.deltaY - b.deltaY
  1882. , m = ib(e, k, l);
  1883. g = m.x,
  1884. h = m.y,
  1885. f = i(m.x) > i(m.y) ? m.x : m.y,
  1886. j = jb(k, l),
  1887. a.lastInterval = b;
  1888. } else
  1889. f = c.velocity,
  1890. g = c.velocityX,
  1891. h = c.velocityY,
  1892. j = c.direction;
  1893. b.velocity = f,
  1894. b.velocityX = g,
  1895. b.velocityY = h,
  1896. b.direction = j;
  1897. }
  1898. function gb(a) {
  1899. for (var b = [], c = 0; c < a.pointers.length;) {
  1900. b[c] = {
  1901. clientX: h(a.pointers[c].clientX),
  1902. clientY: h(a.pointers[c].clientY)
  1903. },
  1904. c++;
  1905. }
  1906. return {
  1907. timeStamp: j(),
  1908. pointers: b,
  1909. center: hb(b),
  1910. deltaX: a.deltaX,
  1911. deltaY: a.deltaY
  1912. };
  1913. }
  1914. function hb(a) {
  1915. var b = a.length;
  1916. if (1 === b)
  1917. return {
  1918. x: h(a[0].clientX),
  1919. y: h(a[0].clientY)
  1920. };
  1921. for (var c = 0, d = 0, e = 0; b > e;) {
  1922. c += a[e].clientX,
  1923. d += a[e].clientY,
  1924. e++;
  1925. }
  1926. return {
  1927. x: h(c / b),
  1928. y: h(d / b)
  1929. };
  1930. }
  1931. function ib(a, b, c) {
  1932. return {
  1933. x: b / a || 0,
  1934. y: c / a || 0
  1935. };
  1936. }
  1937. function jb(a, b) {
  1938. return a === b ? S : i(a) >= i(b) ? a > 0 ? T : U : b > 0 ? V : W;
  1939. }
  1940. function kb(a, b, c) {
  1941. c || (c = $);
  1942. var d = b[c[0]] - a[c[0]]
  1943. , e = b[c[1]] - a[c[1]];
  1944. return Math.sqrt(d * d + e * e);
  1945. }
  1946. function lb(a, b, c) {
  1947. c || (c = $);
  1948. var d = b[c[0]] - a[c[0]]
  1949. , e = b[c[1]] - a[c[1]];
  1950. return 180 * Math.atan2(e, d) / Math.PI;
  1951. }
  1952. function mb(a, b) {
  1953. return lb(b[1], b[0], _) - lb(a[1], a[0], _);
  1954. }
  1955. function nb(a, b) {
  1956. return kb(b[0], b[1], _) / kb(a[0], a[1], _);
  1957. }
  1958. function rb() {
  1959. this.evEl = pb,
  1960. this.evWin = qb,
  1961. this.allow = !0,
  1962. this.pressed = !1,
  1963. ab.apply(this, arguments);
  1964. }
  1965. function wb() {
  1966. this.evEl = ub,
  1967. this.evWin = vb,
  1968. ab.apply(this, arguments),
  1969. this.store = this.manager.session.pointerEvents = [];
  1970. }
  1971. function Ab() {
  1972. this.evTarget = yb,
  1973. this.evWin = zb,
  1974. this.started = !1,
  1975. ab.apply(this, arguments);
  1976. }
  1977. function Bb(a, b) {
  1978. var c = z(a.touches)
  1979. , d = z(a.changedTouches);
  1980. return b & (Q | R) && (c = A(c.concat(d), "identifier", !0)),
  1981. [c, d];
  1982. }
  1983. function Eb() {
  1984. this.evTarget = Db,
  1985. this.targetIds = {},
  1986. ab.apply(this, arguments);
  1987. }
  1988. function Fb(a, b) {
  1989. var c = z(a.touches)
  1990. , d = this.targetIds;
  1991. if (b & (O | P) && 1 === c.length)
  1992. return d[c[0].identifier] = !0,
  1993. [c, c];
  1994. var e, f, g = z(a.changedTouches), h = [], i = this.target;
  1995. if (f = c.filter(function (a) {
  1996. return v(a.target, i);
  1997. }),
  1998. b === O)
  1999. for (e = 0; e < f.length;) {
  2000. d[f[e].identifier] = !0,
  2001. e++;
  2002. }
  2003. for (e = 0; e < g.length;) {
  2004. d[g[e].identifier] && h.push(g[e]),
  2005. b & (Q | R) && delete d[g[e].identifier],
  2006. e++;
  2007. }
  2008. return h.length ? [A(f.concat(h), "identifier", !0), h] : void 0;
  2009. }
  2010. function Gb() {
  2011. ab.apply(this, arguments);
  2012. var a = q(this.handler, this);
  2013. this.touch = new Eb(this.manager, a),
  2014. this.mouse = new rb(this.manager, a);
  2015. }
  2016. function Pb(a, b) {
  2017. this.manager = a,
  2018. this.set(b);
  2019. }
  2020. function Qb(a) {
  2021. if (w(a, Mb))
  2022. return Mb;
  2023. var b = w(a, Nb)
  2024. , c = w(a, Ob);
  2025. return b && c ? Nb + " " + Ob : b || c ? b ? Nb : Ob : w(a, Lb) ? Lb : Kb;
  2026. }
  2027. function Yb(a) {
  2028. this.id = D(),
  2029. this.manager = null,
  2030. this.options = o(a || {}, this.defaults),
  2031. this.options.enable = s(this.options.enable, !0),
  2032. this.state = Rb,
  2033. this.simultaneous = {},
  2034. this.requireFail = [];
  2035. }
  2036. function Zb(a) {
  2037. return a & Wb ? "cancel" : a & Ub ? "end" : a & Tb ? "move" : a & Sb ? "start" : "";
  2038. }
  2039. function $b(a) {
  2040. return a == W ? "down" : a == V ? "up" : a == T ? "left" : a == U ? "right" : "";
  2041. }
  2042. function _b(a, b) {
  2043. var c = b.manager;
  2044. return c ? c.get(a) : a;
  2045. }
  2046. function ac() {
  2047. Yb.apply(this, arguments);
  2048. }
  2049. function bc() {
  2050. ac.apply(this, arguments),
  2051. this.pX = null,
  2052. this.pY = null;
  2053. }
  2054. function cc() {
  2055. ac.apply(this, arguments);
  2056. }
  2057. function dc() {
  2058. Yb.apply(this, arguments),
  2059. this._timer = null,
  2060. this._input = null;
  2061. }
  2062. function ec() {
  2063. ac.apply(this, arguments);
  2064. }
  2065. function fc() {
  2066. ac.apply(this, arguments);
  2067. }
  2068. function gc() {
  2069. Yb.apply(this, arguments),
  2070. this.pTime = !1,
  2071. this.pCenter = !1,
  2072. this._timer = null,
  2073. this._input = null,
  2074. this.count = 0;
  2075. }
  2076. function hc(a, b) {
  2077. return b = b || {},
  2078. b.recognizers = s(b.recognizers, hc.defaults.preset),
  2079. new kc(a, b);
  2080. }
  2081. function kc(a, b) {
  2082. b = b || {},
  2083. this.options = o(b, hc.defaults),
  2084. this.options.inputTarget = this.options.inputTarget || a,
  2085. this.handlers = {},
  2086. this.session = {},
  2087. this.recognizers = [],
  2088. this.element = a,
  2089. this.input = bb(this),
  2090. this.touchAction = new Pb(this, this.options.touchAction),
  2091. lc(this, !0),
  2092. m(b.recognizers, function (a) {
  2093. var b = this.add(new a[0](a[1]));
  2094. a[2] && b.recognizeWith(a[2]),
  2095. a[3] && b.requireFailure(a[3]);
  2096. }, this);
  2097. }
  2098. function lc(a, b) {
  2099. var c = a.element;
  2100. m(a.options.cssProps, function (a, d) {
  2101. c.style[B(c.style, d)] = b ? a : "";
  2102. });
  2103. }
  2104. function mc(a, c) {
  2105. var d = b.createEvent("Event");
  2106. d.initEvent(a, !0, !0),
  2107. d.gesture = c,
  2108. c.target.dispatchEvent(d);
  2109. }
  2110. var e = ["", "webkit", "moz", "MS", "ms", "o"]
  2111. , f = b.createElement("div")
  2112. , g = "function"
  2113. , h = Math.round
  2114. , i = Math.abs
  2115. , j = Date.now
  2116. , C = 1
  2117. , F = /mobile|tablet|ip(ad|hone|od)|android/i
  2118. , G = "ontouchstart" in a
  2119. , H = B(a, "PointerEvent") !== d
  2120. , I = G && F.test(navigator.userAgent)
  2121. , J = "touch"
  2122. , K = "pen"
  2123. , L = "mouse"
  2124. , M = "kinect"
  2125. , N = 25
  2126. , O = 1
  2127. , P = 2
  2128. , Q = 4
  2129. , R = 8
  2130. , S = 1
  2131. , T = 2
  2132. , U = 4
  2133. , V = 8
  2134. , W = 16
  2135. , X = T | U
  2136. , Y = V | W
  2137. , Z = X | Y
  2138. , $ = ["x", "y"]
  2139. , _ = ["clientX", "clientY"];
  2140. ab.prototype = {
  2141. handler: function () { },
  2142. init: function () {
  2143. this.evEl && t(this.element, this.evEl, this.domHandler),
  2144. this.evTarget && t(this.target, this.evTarget, this.domHandler),
  2145. this.evWin && t(E(this.element), this.evWin, this.domHandler);
  2146. },
  2147. destroy: function () {
  2148. this.evEl && u(this.element, this.evEl, this.domHandler),
  2149. this.evTarget && u(this.target, this.evTarget, this.domHandler),
  2150. this.evWin && u(E(this.element), this.evWin, this.domHandler);
  2151. }
  2152. };
  2153. var ob = {
  2154. mousedown: O,
  2155. mousemove: P,
  2156. mouseup: Q
  2157. }
  2158. , pb = "mousedown"
  2159. , qb = "mousemove mouseup";
  2160. p(rb, ab, {
  2161. handler: function (a) {
  2162. var b = ob[a.type];
  2163. b & O && 0 === a.button && (this.pressed = !0),
  2164. b & P && 1 !== a.which && (b = Q),
  2165. this.pressed && this.allow && (b & Q && (this.pressed = !1),
  2166. this.callback(this.manager, b, {
  2167. pointers: [a],
  2168. changedPointers: [a],
  2169. pointerType: L,
  2170. srcEvent: a
  2171. }));
  2172. }
  2173. });
  2174. var sb = {
  2175. pointerdown: O,
  2176. pointermove: P,
  2177. pointerup: Q,
  2178. pointercancel: R,
  2179. pointerout: R
  2180. }
  2181. , tb = {
  2182. 2: J,
  2183. 3: K,
  2184. 4: L,
  2185. 5: M
  2186. }
  2187. , ub = "pointerdown"
  2188. , vb = "pointermove pointerup pointercancel";
  2189. a.MSPointerEvent && (ub = "MSPointerDown",
  2190. vb = "MSPointerMove MSPointerUp MSPointerCancel"),
  2191. p(wb, ab, {
  2192. handler: function (a) {
  2193. var b = this.store
  2194. , c = !1
  2195. , d = a.type.toLowerCase().replace("ms", "")
  2196. , e = sb[d]
  2197. , f = tb[a.pointerType] || a.pointerType
  2198. , g = f == J
  2199. , h = y(b, a.pointerId, "pointerId");
  2200. e & O && (0 === a.button || g) ? 0 > h && (b.push(a),
  2201. h = b.length - 1) : e & (Q | R) && (c = !0),
  2202. 0 > h || (b[h] = a,
  2203. this.callback(this.manager, e, {
  2204. pointers: b,
  2205. changedPointers: [a],
  2206. pointerType: f,
  2207. srcEvent: a
  2208. }),
  2209. c && b.splice(h, 1));
  2210. }
  2211. });
  2212. var xb = {
  2213. touchstart: O,
  2214. touchmove: P,
  2215. touchend: Q,
  2216. touchcancel: R
  2217. }
  2218. , yb = "touchstart"
  2219. , zb = "touchstart touchmove touchend touchcancel";
  2220. p(Ab, ab, {
  2221. handler: function (a) {
  2222. var b = xb[a.type];
  2223. if (b === O && (this.started = !0),
  2224. this.started) {
  2225. var c = Bb.call(this, a, b);
  2226. b & (Q | R) && 0 === c[0].length - c[1].length && (this.started = !1),
  2227. this.callback(this.manager, b, {
  2228. pointers: c[0],
  2229. changedPointers: c[1],
  2230. pointerType: J,
  2231. srcEvent: a
  2232. });
  2233. }
  2234. }
  2235. });
  2236. var Cb = {
  2237. touchstart: O,
  2238. touchmove: P,
  2239. touchend: Q,
  2240. touchcancel: R
  2241. }
  2242. , Db = "touchstart touchmove touchend touchcancel";
  2243. p(Eb, ab, {
  2244. handler: function (a) {
  2245. var b = Cb[a.type]
  2246. , c = Fb.call(this, a, b);
  2247. c && this.callback(this.manager, b, {
  2248. pointers: c[0],
  2249. changedPointers: c[1],
  2250. pointerType: J,
  2251. srcEvent: a
  2252. });
  2253. }
  2254. }),
  2255. p(Gb, ab, {
  2256. handler: function (a, b, c) {
  2257. var d = c.pointerType == J
  2258. , e = c.pointerType == L;
  2259. if (d)
  2260. this.mouse.allow = !1;
  2261. else if (e && !this.mouse.allow)
  2262. return;
  2263. b & (Q | R) && (this.mouse.allow = !0),
  2264. this.callback(a, b, c);
  2265. },
  2266. destroy: function () {
  2267. this.touch.destroy(),
  2268. this.mouse.destroy();
  2269. }
  2270. });
  2271. var Hb = B(f.style, "touchAction")
  2272. , Ib = Hb !== d
  2273. , Jb = "compute"
  2274. , Kb = "auto"
  2275. , Lb = "manipulation"
  2276. , Mb = "none"
  2277. , Nb = "pan-x"
  2278. , Ob = "pan-y";
  2279. Pb.prototype = {
  2280. set: function (a) {
  2281. a == Jb && (a = this.compute()),
  2282. Ib && (this.manager.element.style[Hb] = a),
  2283. this.actions = a.toLowerCase().trim();
  2284. },
  2285. update: function () {
  2286. this.set(this.manager.options.touchAction);
  2287. },
  2288. compute: function () {
  2289. var a = [];
  2290. return m(this.manager.recognizers, function (b) {
  2291. r(b.options.enable, [b]) && (a = a.concat(b.getTouchAction()));
  2292. }),
  2293. Qb(a.join(" "));
  2294. },
  2295. preventDefaults: function (a) {
  2296. if (!Ib) {
  2297. var b = a.srcEvent
  2298. , c = a.offsetDirection;
  2299. if (this.manager.session.prevented)
  2300. return b.preventDefault(),
  2301. void 0;
  2302. var d = this.actions
  2303. , e = w(d, Mb)
  2304. , f = w(d, Ob)
  2305. , g = w(d, Nb);
  2306. return e || f && c & X || g && c & Y ? this.preventSrc(b) : void 0;
  2307. }
  2308. },
  2309. preventSrc: function (a) {
  2310. this.manager.session.prevented = !0,
  2311. a.preventDefault();
  2312. }
  2313. };
  2314. var Rb = 1
  2315. , Sb = 2
  2316. , Tb = 4
  2317. , Ub = 8
  2318. , Vb = Ub
  2319. , Wb = 16
  2320. , Xb = 32;
  2321. Yb.prototype = {
  2322. defaults: {},
  2323. set: function (a) {
  2324. return n(this.options, a),
  2325. this.manager && this.manager.touchAction.update(),
  2326. this;
  2327. },
  2328. recognizeWith: function (a) {
  2329. if (l(a, "recognizeWith", this))
  2330. return this;
  2331. var b = this.simultaneous;
  2332. return a = _b(a, this),
  2333. b[a.id] || (b[a.id] = a,
  2334. a.recognizeWith(this)),
  2335. this;
  2336. },
  2337. dropRecognizeWith: function (a) {
  2338. return l(a, "dropRecognizeWith", this) ? this : (a = _b(a, this),
  2339. delete this.simultaneous[a.id],
  2340. this);
  2341. },
  2342. requireFailure: function (a) {
  2343. if (l(a, "requireFailure", this))
  2344. return this;
  2345. var b = this.requireFail;
  2346. return a = _b(a, this),
  2347. -1 === y(b, a) && (b.push(a),
  2348. a.requireFailure(this)),
  2349. this;
  2350. },
  2351. dropRequireFailure: function (a) {
  2352. if (l(a, "dropRequireFailure", this))
  2353. return this;
  2354. a = _b(a, this);
  2355. var b = y(this.requireFail, a);
  2356. return b > -1 && this.requireFail.splice(b, 1),
  2357. this;
  2358. },
  2359. hasRequireFailures: function () {
  2360. return this.requireFail.length > 0;
  2361. },
  2362. canRecognizeWith: function (a) {
  2363. return !!this.simultaneous[a.id];
  2364. },
  2365. emit: function (a) {
  2366. function d(d) {
  2367. b.manager.emit(b.options.event + (d ? Zb(c) : ""), a);
  2368. }
  2369. var b = this
  2370. , c = this.state;
  2371. Ub > c && d(!0),
  2372. d(),
  2373. c >= Ub && d(!0);
  2374. },
  2375. tryEmit: function (a) {
  2376. return this.canEmit() ? this.emit(a) : (this.state = Xb,
  2377. void 0);
  2378. },
  2379. canEmit: function () {
  2380. for (var a = 0; a < this.requireFail.length;) {
  2381. if (!(this.requireFail[a].state & (Xb | Rb)))
  2382. return !1;
  2383. a++;
  2384. }
  2385. return !0;
  2386. },
  2387. recognize: function (a) {
  2388. var b = n({}, a);
  2389. return r(this.options.enable, [this, b]) ? (this.state & (Vb | Wb | Xb) && (this.state = Rb),
  2390. this.state = this.process(b),
  2391. this.state & (Sb | Tb | Ub | Wb) && this.tryEmit(b),
  2392. void 0) : (this.reset(),
  2393. this.state = Xb,
  2394. void 0);
  2395. },
  2396. process: function () { },
  2397. getTouchAction: function () { },
  2398. reset: function () { }
  2399. },
  2400. p(ac, Yb, {
  2401. defaults: {
  2402. pointers: 1
  2403. },
  2404. attrTest: function (a) {
  2405. var b = this.options.pointers;
  2406. return 0 === b || a.pointers.length === b;
  2407. },
  2408. process: function (a) {
  2409. var b = this.state
  2410. , c = a.eventType
  2411. , d = b & (Sb | Tb)
  2412. , e = this.attrTest(a);
  2413. return d && (c & R || !e) ? b | Wb : d || e ? c & Q ? b | Ub : b & Sb ? b | Tb : Sb : Xb;
  2414. }
  2415. }),
  2416. p(bc, ac, {
  2417. defaults: {
  2418. event: "pan",
  2419. threshold: 10,
  2420. pointers: 1,
  2421. direction: Z
  2422. },
  2423. getTouchAction: function () {
  2424. var a = this.options.direction
  2425. , b = [];
  2426. return a & X && b.push(Ob),
  2427. a & Y && b.push(Nb),
  2428. b;
  2429. },
  2430. directionTest: function (a) {
  2431. var b = this.options
  2432. , c = !0
  2433. , d = a.distance
  2434. , e = a.direction
  2435. , f = a.deltaX
  2436. , g = a.deltaY;
  2437. return e & b.direction || (b.direction & X ? (e = 0 === f ? S : 0 > f ? T : U,
  2438. c = f != this.pX,
  2439. d = Math.abs(a.deltaX)) : (e = 0 === g ? S : 0 > g ? V : W,
  2440. c = g != this.pY,
  2441. d = Math.abs(a.deltaY))),
  2442. a.direction = e,
  2443. c && d > b.threshold && e & b.direction;
  2444. },
  2445. attrTest: function (a) {
  2446. return ac.prototype.attrTest.call(this, a) && (this.state & Sb || !(this.state & Sb) && this.directionTest(a));
  2447. },
  2448. emit: function (a) {
  2449. this.pX = a.deltaX,
  2450. this.pY = a.deltaY;
  2451. var b = $b(a.direction);
  2452. b && this.manager.emit(this.options.event + b, a),
  2453. this._super.emit.call(this, a);
  2454. }
  2455. }),
  2456. p(cc, ac, {
  2457. defaults: {
  2458. event: "pinch",
  2459. threshold: 0,
  2460. pointers: 2
  2461. },
  2462. getTouchAction: function () {
  2463. return [Mb];
  2464. },
  2465. attrTest: function (a) {
  2466. return this._super.attrTest.call(this, a) && (Math.abs(a.scale - 1) > this.options.threshold || this.state & Sb);
  2467. },
  2468. emit: function (a) {
  2469. if (this._super.emit.call(this, a),
  2470. 1 !== a.scale) {
  2471. var b = a.scale < 1 ? "in" : "out";
  2472. this.manager.emit(this.options.event + b, a);
  2473. }
  2474. }
  2475. }),
  2476. p(dc, Yb, {
  2477. defaults: {
  2478. event: "press",
  2479. pointers: 1,
  2480. time: 500,
  2481. threshold: 5
  2482. },
  2483. getTouchAction: function () {
  2484. return [Kb];
  2485. },
  2486. process: function (a) {
  2487. var b = this.options
  2488. , c = a.pointers.length === b.pointers
  2489. , d = a.distance < b.threshold
  2490. , e = a.deltaTime > b.time;
  2491. if (this._input = a,
  2492. !d || !c || a.eventType & (Q | R) && !e)
  2493. this.reset();
  2494. else if (a.eventType & O)
  2495. this.reset(),
  2496. this._timer = k(function () {
  2497. this.state = Vb,
  2498. this.tryEmit();
  2499. }, b.time, this);
  2500. else if (a.eventType & Q)
  2501. return Vb;
  2502. return Xb;
  2503. },
  2504. reset: function () {
  2505. clearTimeout(this._timer);
  2506. },
  2507. emit: function (a) {
  2508. this.state === Vb && (a && a.eventType & Q ? this.manager.emit(this.options.event + "up", a) : (this._input.timeStamp = j(),
  2509. this.manager.emit(this.options.event, this._input)));
  2510. }
  2511. }),
  2512. p(ec, ac, {
  2513. defaults: {
  2514. event: "rotate",
  2515. threshold: 0,
  2516. pointers: 2
  2517. },
  2518. getTouchAction: function () {
  2519. return [Mb];
  2520. },
  2521. attrTest: function (a) {
  2522. return this._super.attrTest.call(this, a) && (Math.abs(a.rotation) > this.options.threshold || this.state & Sb);
  2523. }
  2524. }),
  2525. p(fc, ac, {
  2526. defaults: {
  2527. event: "swipe",
  2528. threshold: 10,
  2529. velocity: .65,
  2530. direction: X | Y,
  2531. pointers: 1
  2532. },
  2533. getTouchAction: function () {
  2534. return bc.prototype.getTouchAction.call(this);
  2535. },
  2536. attrTest: function (a) {
  2537. var c, b = this.options.direction;
  2538. return b & (X | Y) ? c = a.velocity : b & X ? c = a.velocityX : b & Y && (c = a.velocityY),
  2539. this._super.attrTest.call(this, a) && b & a.direction && a.distance > this.options.threshold && i(c) > this.options.velocity && a.eventType & Q;
  2540. },
  2541. emit: function (a) {
  2542. var b = $b(a.direction);
  2543. b && this.manager.emit(this.options.event + b, a),
  2544. this.manager.emit(this.options.event, a);
  2545. }
  2546. }),
  2547. p(gc, Yb, {
  2548. defaults: {
  2549. event: "tap",
  2550. pointers: 1,
  2551. taps: 1,
  2552. interval: 300,
  2553. time: 250,
  2554. threshold: 2,
  2555. posThreshold: 10
  2556. },
  2557. getTouchAction: function () {
  2558. return [Lb];
  2559. },
  2560. process: function (a) {
  2561. var b = this.options
  2562. , c = a.pointers.length === b.pointers
  2563. , d = a.distance < b.threshold
  2564. , e = a.deltaTime < b.time;
  2565. if (this.reset(),
  2566. a.eventType & O && 0 === this.count)
  2567. return this.failTimeout();
  2568. if (d && e && c) {
  2569. if (a.eventType != Q)
  2570. return this.failTimeout();
  2571. var f = this.pTime ? a.timeStamp - this.pTime < b.interval : !0
  2572. , g = !this.pCenter || kb(this.pCenter, a.center) < b.posThreshold;
  2573. this.pTime = a.timeStamp,
  2574. this.pCenter = a.center,
  2575. g && f ? this.count += 1 : this.count = 1,
  2576. this._input = a;
  2577. var h = this.count % b.taps;
  2578. if (0 === h)
  2579. return this.hasRequireFailures() ? (this._timer = k(function () {
  2580. this.state = Vb,
  2581. this.tryEmit();
  2582. }, b.interval, this),
  2583. Sb) : Vb;
  2584. }
  2585. return Xb;
  2586. },
  2587. failTimeout: function () {
  2588. return this._timer = k(function () {
  2589. this.state = Xb;
  2590. }, this.options.interval, this),
  2591. Xb;
  2592. },
  2593. reset: function () {
  2594. clearTimeout(this._timer);
  2595. },
  2596. emit: function () {
  2597. this.state == Vb && (this._input.tapCount = this.count,
  2598. this.manager.emit(this.options.event, this._input));
  2599. }
  2600. }),
  2601. hc.VERSION = "2.0.4",
  2602. hc.defaults = {
  2603. domEvents: !1,
  2604. touchAction: Jb,
  2605. enable: !0,
  2606. inputTarget: null,
  2607. inputClass: null,
  2608. preset: [[ec, {
  2609. enable: !1
  2610. }], [cc, {
  2611. enable: !1
  2612. }, ["rotate"]], [fc, {
  2613. direction: X
  2614. }], [bc, {
  2615. direction: X
  2616. }, ["swipe"]], [gc], [gc, {
  2617. event: "doubletap",
  2618. taps: 2
  2619. }, ["tap"]], [dc]],
  2620. cssProps: {
  2621. userSelect: "default",
  2622. touchSelect: "none",
  2623. touchCallout: "none",
  2624. contentZooming: "none",
  2625. userDrag: "none",
  2626. tapHighlightColor: "rgba(0,0,0,0)"
  2627. }
  2628. };
  2629. var ic = 1
  2630. , jc = 2;
  2631. kc.prototype = {
  2632. set: function (a) {
  2633. return n(this.options, a),
  2634. a.touchAction && this.touchAction.update(),
  2635. a.inputTarget && (this.input.destroy(),
  2636. this.input.target = a.inputTarget,
  2637. this.input.init()),
  2638. this;
  2639. },
  2640. stop: function (a) {
  2641. this.session.stopped = a ? jc : ic;
  2642. },
  2643. recognize: function (a) {
  2644. var b = this.session;
  2645. if (!b.stopped) {
  2646. this.touchAction.preventDefaults(a);
  2647. var c, d = this.recognizers, e = b.curRecognizer;
  2648. (!e || e && e.state & Vb) && (e = b.curRecognizer = null);
  2649. for (var f = 0; f < d.length;) {
  2650. c = d[f],
  2651. b.stopped === jc || e && c != e && !c.canRecognizeWith(e) ? c.reset() : c.recognize(a),
  2652. !e && c.state & (Sb | Tb | Ub) && (e = b.curRecognizer = c),
  2653. f++;
  2654. }
  2655. }
  2656. },
  2657. get: function (a) {
  2658. if (a instanceof Yb)
  2659. return a;
  2660. for (var b = this.recognizers, c = 0; c < b.length; c++) {
  2661. if (b[c].options.event == a)
  2662. return b[c];
  2663. }
  2664. return null;
  2665. },
  2666. add: function (a) {
  2667. if (l(a, "add", this))
  2668. return this;
  2669. var b = this.get(a.options.event);
  2670. return b && this.remove(b),
  2671. this.recognizers.push(a),
  2672. a.manager = this,
  2673. this.touchAction.update(),
  2674. a;
  2675. },
  2676. remove: function (a) {
  2677. if (l(a, "remove", this))
  2678. return this;
  2679. var b = this.recognizers;
  2680. return a = this.get(a),
  2681. b.splice(y(b, a), 1),
  2682. this.touchAction.update(),
  2683. this;
  2684. },
  2685. on: function (a, b) {
  2686. var c = this.handlers;
  2687. return m(x(a), function (a) {
  2688. c[a] = c[a] || [],
  2689. c[a].push(b);
  2690. }),
  2691. this;
  2692. },
  2693. off: function (a, b) {
  2694. var c = this.handlers;
  2695. return m(x(a), function (a) {
  2696. b ? c[a].splice(y(c[a], b), 1) : delete c[a];
  2697. }),
  2698. this;
  2699. },
  2700. emit: function (a, b) {
  2701. this.options.domEvents && mc(a, b);
  2702. var c = this.handlers[a] && this.handlers[a].slice();
  2703. if (c && c.length) {
  2704. b.type = a,
  2705. b.preventDefault = function () {
  2706. b.srcEvent.preventDefault();
  2707. }
  2708. ;
  2709. for (var d = 0; d < c.length;) {
  2710. c[d](b),
  2711. d++;
  2712. }
  2713. }
  2714. },
  2715. destroy: function () {
  2716. this.element && lc(this, !1),
  2717. this.handlers = {},
  2718. this.session = {},
  2719. this.input.destroy(),
  2720. this.element = null;
  2721. }
  2722. },
  2723. n(hc, {
  2724. INPUT_START: O,
  2725. INPUT_MOVE: P,
  2726. INPUT_END: Q,
  2727. INPUT_CANCEL: R,
  2728. STATE_POSSIBLE: Rb,
  2729. STATE_BEGAN: Sb,
  2730. STATE_CHANGED: Tb,
  2731. STATE_ENDED: Ub,
  2732. STATE_RECOGNIZED: Vb,
  2733. STATE_CANCELLED: Wb,
  2734. STATE_FAILED: Xb,
  2735. DIRECTION_NONE: S,
  2736. DIRECTION_LEFT: T,
  2737. DIRECTION_RIGHT: U,
  2738. DIRECTION_UP: V,
  2739. DIRECTION_DOWN: W,
  2740. DIRECTION_HORIZONTAL: X,
  2741. DIRECTION_VERTICAL: Y,
  2742. DIRECTION_ALL: Z,
  2743. Manager: kc,
  2744. Input: ab,
  2745. TouchAction: Pb,
  2746. TouchInput: Eb,
  2747. MouseInput: rb,
  2748. PointerEventInput: wb,
  2749. TouchMouseInput: Gb,
  2750. SingleTouchInput: Ab,
  2751. Recognizer: Yb,
  2752. AttrRecognizer: ac,
  2753. Tap: gc,
  2754. Pan: bc,
  2755. Swipe: fc,
  2756. Pinch: cc,
  2757. Rotate: ec,
  2758. Press: dc,
  2759. on: t,
  2760. off: u,
  2761. each: m,
  2762. merge: o,
  2763. extend: n,
  2764. inherit: p,
  2765. bindFn: q,
  2766. prefixed: B
  2767. }),
  2768. // typeof define == g && define.amd ? define(function() {
  2769. // return hc;
  2770. // }) : "undefined" != typeof module && module.exports ? module.exports = hc : a[c] = hc;
  2771. a[c] = hc
  2772. }(window, document, "Hammer");
  2773. ; (function (factory) {
  2774. if (typeof define === 'function' && define.amd) {
  2775. define(['jquery', 'hammerjs'], factory);
  2776. } else if (typeof exports === 'object') {
  2777. factory(require('jquery'), require('hammerjs'));
  2778. } else {
  2779. factory(jQuery, Hammer);
  2780. }
  2781. }
  2782. )(function ($, Hammer) {
  2783. function hammerify(el, options) {
  2784. var $el = $(el);
  2785. if (!$el.data("hammer")) {
  2786. $el.data("hammer", new Hammer($el[0], options));
  2787. }
  2788. }
  2789. $.fn.hammer = function (options) {
  2790. return this.each(function () {
  2791. hammerify(this, options);
  2792. });
  2793. }
  2794. ;
  2795. // extend the emit method to also trigger jQuery events
  2796. Hammer.Manager.prototype.emit = function (originalEmit) {
  2797. return function (type, data) {
  2798. originalEmit.call(this, type, data);
  2799. $(this.element).trigger({
  2800. type: type,
  2801. gesture: data
  2802. });
  2803. }
  2804. ;
  2805. }(Hammer.Manager.prototype.emit);
  2806. });
  2807. ;// Required for Meteor package, the use of window prevents export by Meteor
  2808. (function (window) {
  2809. if (window.Package) {
  2810. Materialize = {};
  2811. } else {
  2812. window.Materialize = {};
  2813. }
  2814. }
  2815. )(window);
  2816. if (typeof exports !== 'undefined' && !exports.nodeType) {
  2817. if (typeof module !== 'undefined' && !module.nodeType && module.exports) {
  2818. exports = module.exports = Materialize;
  2819. }
  2820. exports.default = Materialize;
  2821. }
  2822. /*
  2823. * raf.js
  2824. * https://github.com/ngryman/raf.js
  2825. *
  2826. * original requestAnimationFrame polyfill by Erik Möller
  2827. * inspired from paul_irish gist and post
  2828. *
  2829. * Copyright (c) 2013 ngryman
  2830. * Licensed under the MIT license.
  2831. */
  2832. (function (window) {
  2833. var lastTime = 0
  2834. , vendors = ['webkit', 'moz']
  2835. , requestAnimationFrame = window.requestAnimationFrame
  2836. , cancelAnimationFrame = window.cancelAnimationFrame
  2837. , i = vendors.length;
  2838. // try to un-prefix existing raf
  2839. while (--i >= 0 && !requestAnimationFrame) {
  2840. requestAnimationFrame = window[vendors[i] + 'RequestAnimationFrame'];
  2841. cancelAnimationFrame = window[vendors[i] + 'CancelRequestAnimationFrame'];
  2842. }
  2843. // polyfill with setTimeout fallback
  2844. // heavily inspired from @darius gist mod: https://gist.github.com/paulirish/1579671#comment-837945
  2845. if (!requestAnimationFrame || !cancelAnimationFrame) {
  2846. requestAnimationFrame = function (callback) {
  2847. var now = +Date.now()
  2848. , nextTime = Math.max(lastTime + 16, now);
  2849. return setTimeout(function () {
  2850. callback(lastTime = nextTime);
  2851. }, nextTime - now);
  2852. }
  2853. ;
  2854. cancelAnimationFrame = clearTimeout;
  2855. }
  2856. // export to window
  2857. window.requestAnimationFrame = requestAnimationFrame;
  2858. window.cancelAnimationFrame = cancelAnimationFrame;
  2859. }
  2860. )(window);
  2861. /**
  2862. * Generate approximated selector string for a jQuery object
  2863. * @param {jQuery} obj jQuery object to be parsed
  2864. * @returns {string}
  2865. */
  2866. Materialize.objectSelectorString = function (obj) {
  2867. var tagStr = obj.prop('tagName') || '';
  2868. var idStr = obj.attr('id') || '';
  2869. var classStr = obj.attr('class') || '';
  2870. return (tagStr + idStr + classStr).replace(/\s/g, '');
  2871. }
  2872. ;
  2873. // Unique Random ID
  2874. Materialize.guid = function () {
  2875. function s4() {
  2876. return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
  2877. }
  2878. return function () {
  2879. return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
  2880. }
  2881. ;
  2882. }();
  2883. /**
  2884. * Escapes hash from special characters
  2885. * @param {string} hash String returned from this.hash
  2886. * @returns {string}
  2887. */
  2888. Materialize.escapeHash = function (hash) {
  2889. return hash.replace(/(:|\.|\[|\]|,|=)/g, "\\$1");
  2890. }
  2891. ;
  2892. Materialize.elementOrParentIsFixed = function (element) {
  2893. var $element = $(element);
  2894. var $checkElements = $element.add($element.parents());
  2895. var isFixed = false;
  2896. $checkElements.each(function () {
  2897. if ($(this).css("position") === "fixed") {
  2898. isFixed = true;
  2899. return false;
  2900. }
  2901. });
  2902. return isFixed;
  2903. }
  2904. ;
  2905. /**
  2906. * Get time in ms
  2907. * @license https://raw.github.com/jashkenas/underscore/master/LICENSE
  2908. * @type {function}
  2909. * @return {number}
  2910. */
  2911. var getTime = Date.now || function () {
  2912. return new Date().getTime();
  2913. }
  2914. ;
  2915. /**
  2916. * Returns a function, that, when invoked, will only be triggered at most once
  2917. * during a given window of time. Normally, the throttled function will run
  2918. * as much as it can, without ever going more than once per `wait` duration;
  2919. * but if you'd like to disable the execution on the leading edge, pass
  2920. * `{leading: false}`. To disable execution on the trailing edge, ditto.
  2921. * @license https://raw.github.com/jashkenas/underscore/master/LICENSE
  2922. * @param {function} func
  2923. * @param {number} wait
  2924. * @param {Object=} options
  2925. * @returns {Function}
  2926. */
  2927. Materialize.throttle = function (func, wait, options) {
  2928. var context, args, result;
  2929. var timeout = null;
  2930. var previous = 0;
  2931. options || (options = {});
  2932. var later = function () {
  2933. previous = options.leading === false ? 0 : getTime();
  2934. timeout = null;
  2935. result = func.apply(context, args);
  2936. context = args = null;
  2937. };
  2938. return function () {
  2939. var now = getTime();
  2940. if (!previous && options.leading === false)
  2941. previous = now;
  2942. var remaining = wait - (now - previous);
  2943. context = this;
  2944. args = arguments;
  2945. if (remaining <= 0) {
  2946. clearTimeout(timeout);
  2947. timeout = null;
  2948. previous = now;
  2949. result = func.apply(context, args);
  2950. context = args = null;
  2951. } else if (!timeout && options.trailing !== false) {
  2952. timeout = setTimeout(later, remaining);
  2953. }
  2954. return result;
  2955. }
  2956. ;
  2957. }
  2958. ;
  2959. // Velocity has conflicts when loaded with jQuery, this will check for it
  2960. // First, check if in noConflict mode
  2961. var Vel;
  2962. if (jQuery) {
  2963. Vel = jQuery.Velocity;
  2964. } else if ($) {
  2965. Vel = $.Velocity;
  2966. } else {
  2967. Vel = Velocity;
  2968. }
  2969. if (Vel) {
  2970. Materialize.Vel = Vel;
  2971. } else {
  2972. Materialize.Vel = Velocity;
  2973. }
  2974. ; (function ($) {
  2975. $.fn.collapsible = function (options, methodParam) {
  2976. var defaults = {
  2977. accordion: undefined,
  2978. onOpen: undefined,
  2979. onClose: undefined
  2980. };
  2981. var methodName = options;
  2982. options = $.extend(defaults, options);
  2983. return this.each(function () {
  2984. var $this = $(this);
  2985. var $panel_headers = $(this).find('> li > .collapsible-header');
  2986. var collapsible_type = $this.data("collapsible");
  2987. /****************
  2988. Helper Functions
  2989. ****************/
  2990. // Accordion Open
  2991. function accordionOpen(object) {
  2992. $panel_headers = $this.find('> li > .collapsible-header');
  2993. if (object.hasClass('active')) {
  2994. object.parent().addClass('active');
  2995. } else {
  2996. object.parent().removeClass('active');
  2997. }
  2998. if (object.parent().hasClass('active')) {
  2999. object.siblings('.collapsible-body').stop(true, false).slideDown({
  3000. duration: 350,
  3001. easing: "easeOutQuart",
  3002. queue: false,
  3003. complete: function () {
  3004. $(this).css('height', '');
  3005. }
  3006. });
  3007. } else {
  3008. object.siblings('.collapsible-body').stop(true, false).slideUp({
  3009. duration: 350,
  3010. easing: "easeOutQuart",
  3011. queue: false,
  3012. complete: function () {
  3013. $(this).css('height', '');
  3014. }
  3015. });
  3016. }
  3017. $panel_headers.not(object).removeClass('active').parent().removeClass('active');
  3018. // Close previously open accordion elements.
  3019. $panel_headers.not(object).parent().children('.collapsible-body').stop(true, false).each(function () {
  3020. if ($(this).is(':visible')) {
  3021. $(this).slideUp({
  3022. duration: 350,
  3023. easing: "easeOutQuart",
  3024. queue: false,
  3025. complete: function () {
  3026. $(this).css('height', '');
  3027. execCallbacks($(this).siblings('.collapsible-header'));
  3028. }
  3029. });
  3030. }
  3031. });
  3032. }
  3033. // Expandable Open
  3034. function expandableOpen(object) {
  3035. if (object.hasClass('active')) {
  3036. object.parent().addClass('active');
  3037. } else {
  3038. object.parent().removeClass('active');
  3039. }
  3040. if (object.parent().hasClass('active')) {
  3041. object.siblings('.collapsible-body').stop(true, false).slideDown({
  3042. duration: 350,
  3043. easing: "easeOutQuart",
  3044. queue: false,
  3045. complete: function () {
  3046. $(this).css('height', '');
  3047. }
  3048. });
  3049. } else {
  3050. object.siblings('.collapsible-body').stop(true, false).slideUp({
  3051. duration: 350,
  3052. easing: "easeOutQuart",
  3053. queue: false,
  3054. complete: function () {
  3055. $(this).css('height', '');
  3056. }
  3057. });
  3058. }
  3059. }
  3060. // Open collapsible. object: .collapsible-header
  3061. function collapsibleOpen(object, noToggle) {
  3062. if (!noToggle) {
  3063. object.toggleClass('active');
  3064. }
  3065. if (options.accordion || collapsible_type === "accordion" || collapsible_type === undefined) {
  3066. // Handle Accordion
  3067. accordionOpen(object);
  3068. } else {
  3069. // Handle Expandables
  3070. expandableOpen(object);
  3071. }
  3072. execCallbacks(object);
  3073. }
  3074. // Handle callbacks
  3075. function execCallbacks(object) {
  3076. if (object.hasClass('active')) {
  3077. if (typeof options.onOpen === "function") {
  3078. options.onOpen.call(this, object.parent());
  3079. }
  3080. } else {
  3081. if (typeof options.onClose === "function") {
  3082. options.onClose.call(this, object.parent());
  3083. }
  3084. }
  3085. }
  3086. /**
  3087. * Check if object is children of panel header
  3088. * @param {Object} object Jquery object
  3089. * @return {Boolean} true if it is children
  3090. */
  3091. function isChildrenOfPanelHeader(object) {
  3092. var panelHeader = getPanelHeader(object);
  3093. return panelHeader.length > 0;
  3094. }
  3095. /**
  3096. * Get panel header from a children element
  3097. * @param {Object} object Jquery object
  3098. * @return {Object} panel header object
  3099. */
  3100. function getPanelHeader(object) {
  3101. return object.closest('li > .collapsible-header');
  3102. }
  3103. // Turn off any existing event handlers
  3104. function removeEventHandlers() {
  3105. $this.off('click.collapse', '> li > .collapsible-header');
  3106. }
  3107. /***** End Helper Functions *****/
  3108. // Methods
  3109. if (methodName === 'destroy') {
  3110. removeEventHandlers();
  3111. return;
  3112. } else if (methodParam >= 0 && methodParam < $panel_headers.length) {
  3113. var $curr_header = $panel_headers.eq(methodParam);
  3114. if ($curr_header.length && (methodName === 'open' || methodName === 'close' && $curr_header.hasClass('active'))) {
  3115. collapsibleOpen($curr_header);
  3116. }
  3117. return;
  3118. }
  3119. removeEventHandlers();
  3120. // Add click handler to only direct collapsible header children
  3121. $this.on('click.collapse', '> li > .collapsible-header', function (e) {
  3122. var element = $(e.target);
  3123. if (isChildrenOfPanelHeader(element)) {
  3124. element = getPanelHeader(element);
  3125. }
  3126. collapsibleOpen(element);
  3127. });
  3128. // Open first active
  3129. if (options.accordion || collapsible_type === "accordion" || collapsible_type === undefined) {
  3130. // Handle Accordion
  3131. collapsibleOpen($panel_headers.filter('.active').first(), true);
  3132. } else {
  3133. // Handle Expandables
  3134. $panel_headers.filter('.active').each(function () {
  3135. collapsibleOpen($(this), true);
  3136. });
  3137. }
  3138. });
  3139. }
  3140. ;
  3141. $(document).ready(function () {
  3142. $('.collapsible').collapsible();
  3143. });
  3144. }
  3145. )(jQuery);
  3146. ; (function ($) {
  3147. // Add posibility to scroll to selected option
  3148. // usefull for select for example
  3149. $.fn.scrollTo = function (elem) {
  3150. $(this).scrollTop($(this).scrollTop() - $(this).offset().top + $(elem).offset().top);
  3151. return this;
  3152. }
  3153. ;
  3154. $.fn.dropdown = function (options) {
  3155. var defaults = {
  3156. inDuration: 300,
  3157. outDuration: 225,
  3158. constrainWidth: true,
  3159. // Constrains width of dropdown to the activator
  3160. hover: false,
  3161. gutter: 0,
  3162. // Spacing from edge
  3163. belowOrigin: false,
  3164. alignment: 'left',
  3165. stopPropagation: false
  3166. };
  3167. // Open dropdown.
  3168. if (options === "open") {
  3169. this.each(function () {
  3170. $(this).trigger('open');
  3171. });
  3172. return false;
  3173. }
  3174. // Close dropdown.
  3175. if (options === "close") {
  3176. this.each(function () {
  3177. $(this).trigger('close');
  3178. });
  3179. return false;
  3180. }
  3181. this.each(function () {
  3182. var origin = $(this);
  3183. var curr_options = $.extend({}, defaults, options);
  3184. var isFocused = false;
  3185. // Dropdown menu
  3186. var activates = $("#" + origin.attr('data-activates'));
  3187. function updateOptions() {
  3188. if (origin.data('induration') !== undefined)
  3189. curr_options.inDuration = origin.data('induration');
  3190. if (origin.data('outduration') !== undefined)
  3191. curr_options.outDuration = origin.data('outduration');
  3192. if (origin.data('constrainwidth') !== undefined)
  3193. curr_options.constrainWidth = origin.data('constrainwidth');
  3194. if (origin.data('hover') !== undefined)
  3195. curr_options.hover = origin.data('hover');
  3196. if (origin.data('gutter') !== undefined)
  3197. curr_options.gutter = origin.data('gutter');
  3198. if (origin.data('beloworigin') !== undefined)
  3199. curr_options.belowOrigin = origin.data('beloworigin');
  3200. if (origin.data('alignment') !== undefined)
  3201. curr_options.alignment = origin.data('alignment');
  3202. if (origin.data('stoppropagation') !== undefined)
  3203. curr_options.stopPropagation = origin.data('stoppropagation');
  3204. }
  3205. updateOptions();
  3206. // Attach dropdown to its activator
  3207. origin.after(activates);
  3208. /*
  3209. Helper function to position and resize dropdown.
  3210. Used in hover and click handler.
  3211. */
  3212. function placeDropdown(eventType) {
  3213. // Check for simultaneous focus and click events.
  3214. if (eventType === 'focus') {
  3215. isFocused = true;
  3216. }
  3217. // Check html data attributes
  3218. updateOptions();
  3219. // Set Dropdown state
  3220. activates.addClass('active');
  3221. origin.addClass('active');
  3222. var originWidth = origin[0].getBoundingClientRect().width;
  3223. // Constrain width
  3224. if (curr_options.constrainWidth === true) {
  3225. activates.css('width', originWidth);
  3226. } else {
  3227. activates.css('white-space', 'nowrap');
  3228. }
  3229. // Offscreen detection
  3230. var windowHeight = window.innerHeight;
  3231. var originHeight = origin.innerHeight();
  3232. var offsetLeft = origin.offset().left;
  3233. var offsetTop = origin.offset().top - $(window).scrollTop();
  3234. var currAlignment = curr_options.alignment;
  3235. var gutterSpacing = 0;
  3236. var leftPosition = 0;
  3237. // Below Origin
  3238. var verticalOffset = 0;
  3239. if (curr_options.belowOrigin === true) {
  3240. verticalOffset = originHeight;
  3241. }
  3242. // Check for scrolling positioned container.
  3243. var scrollYOffset = 0;
  3244. var scrollXOffset = 0;
  3245. var wrapper = origin.parent();
  3246. if (!wrapper.is('body')) {
  3247. if (wrapper[0].scrollHeight > wrapper[0].clientHeight) {
  3248. scrollYOffset = wrapper[0].scrollTop;
  3249. }
  3250. if (wrapper[0].scrollWidth > wrapper[0].clientWidth) {
  3251. scrollXOffset = wrapper[0].scrollLeft;
  3252. }
  3253. }
  3254. if (offsetLeft + activates.innerWidth() > $(window).width()) {
  3255. // Dropdown goes past screen on right, force right alignment
  3256. currAlignment = 'right';
  3257. } else if (offsetLeft - activates.innerWidth() + origin.innerWidth() < 0) {
  3258. // Dropdown goes past screen on left, force left alignment
  3259. currAlignment = 'left';
  3260. }
  3261. // Vertical bottom offscreen detection
  3262. if (offsetTop + activates.innerHeight() > windowHeight) {
  3263. // If going upwards still goes offscreen, just crop height of dropdown.
  3264. if (offsetTop + originHeight - activates.innerHeight() < 0) {
  3265. var adjustedHeight = windowHeight - offsetTop - verticalOffset;
  3266. activates.css('max-height', adjustedHeight);
  3267. } else {
  3268. // Flow upwards.
  3269. if (!verticalOffset) {
  3270. verticalOffset += originHeight;
  3271. }
  3272. verticalOffset -= activates.innerHeight();
  3273. }
  3274. }
  3275. // Handle edge alignment
  3276. if (currAlignment === 'left') {
  3277. gutterSpacing = curr_options.gutter;
  3278. leftPosition = origin.position().left + gutterSpacing;
  3279. } else if (currAlignment === 'right') {
  3280. // Material icons fix
  3281. activates.stop(true, true).css({
  3282. opacity: 0,
  3283. left: 0
  3284. });
  3285. var offsetRight = origin.position().left + originWidth - activates.width();
  3286. gutterSpacing = -curr_options.gutter;
  3287. leftPosition = offsetRight + gutterSpacing;
  3288. }
  3289. // Position dropdown
  3290. activates.css({
  3291. position: 'absolute',
  3292. top: origin.position().top + verticalOffset + scrollYOffset == 0 ? 64 : origin.position().top + verticalOffset + scrollYOffset,
  3293. left: leftPosition + scrollXOffset
  3294. });
  3295. // Show dropdown
  3296. activates.slideDown({
  3297. queue: false,
  3298. duration: curr_options.inDuration,
  3299. easing: 'easeOutCubic',
  3300. complete: function () {
  3301. $(this).css('height', '');
  3302. }
  3303. }).animate({
  3304. opacity: 1
  3305. }, {
  3306. queue: false,
  3307. duration: curr_options.inDuration,
  3308. easing: 'easeOutSine'
  3309. });
  3310. // Add click close handler to document
  3311. setTimeout(function () {
  3312. $(document).on('click.' + activates.attr('id'), function (e) {
  3313. hideDropdown();
  3314. $(document).off('click.' + activates.attr('id'));
  3315. });
  3316. }, 0);
  3317. }
  3318. function hideDropdown() {
  3319. // Check for simultaneous focus and click events.
  3320. isFocused = false;
  3321. activates.fadeOut(curr_options.outDuration);
  3322. activates.removeClass('active');
  3323. origin.removeClass('active');
  3324. $(document).off('click.' + activates.attr('id'));
  3325. setTimeout(function () {
  3326. activates.css('max-height', '');
  3327. }, curr_options.outDuration);
  3328. }
  3329. // Hover
  3330. if (curr_options.hover) {
  3331. var open = false;
  3332. origin.off('click.' + origin.attr('id'));
  3333. // Hover handler to show dropdown
  3334. origin.on('mouseenter', function (e) {
  3335. // Mouse over
  3336. if (open === false) {
  3337. placeDropdown();
  3338. open = true;
  3339. }
  3340. });
  3341. origin.on('mouseleave', function (e) {
  3342. // If hover on origin then to something other than dropdown content, then close
  3343. var toEl = e.toElement || e.relatedTarget;
  3344. // added browser compatibility for target element
  3345. if (!$(toEl).closest('.dropdown-content').is(activates)) {
  3346. activates.stop(true, true);
  3347. hideDropdown();
  3348. open = false;
  3349. }
  3350. });
  3351. activates.on('mouseleave', function (e) {
  3352. // Mouse out
  3353. var toEl = e.toElement || e.relatedTarget;
  3354. if (!$(toEl).closest('.dropdown-button').is(origin)) {
  3355. activates.stop(true, true);
  3356. hideDropdown();
  3357. open = false;
  3358. }
  3359. });
  3360. // Click
  3361. } else {
  3362. // Click handler to show dropdown
  3363. origin.off('click.' + origin.attr('id'));
  3364. origin.on('click.' + origin.attr('id'), function (e) {
  3365. if (!isFocused) {
  3366. if (origin[0] == e.currentTarget && !origin.hasClass('active') && $(e.target).closest('.dropdown-content').length === 0) {
  3367. e.preventDefault();
  3368. // Prevents button click from moving window
  3369. if (curr_options.stopPropagation) {
  3370. e.stopPropagation();
  3371. }
  3372. placeDropdown('click');
  3373. }// If origin is clicked and menu is open, close menu
  3374. else if (origin.hasClass('active')) {
  3375. hideDropdown();
  3376. $(document).off('click.' + activates.attr('id'));
  3377. }
  3378. }
  3379. });
  3380. }
  3381. // End else
  3382. // Listen to open and close event - useful for select component
  3383. origin.on('open', function (e, eventType) {
  3384. placeDropdown(eventType);
  3385. });
  3386. origin.on('close', hideDropdown);
  3387. });
  3388. }
  3389. ;
  3390. // End dropdown plugin
  3391. $(document).ready(function () {
  3392. $('.dropdown-button').dropdown();
  3393. });
  3394. }
  3395. )(jQuery);
  3396. ; (function ($, Vel) {
  3397. 'use strict';
  3398. var _defaults = {
  3399. opacity: 0.5,
  3400. inDuration: 250,
  3401. outDuration: 250,
  3402. ready: undefined,
  3403. complete: undefined,
  3404. dismissible: true,
  3405. startingTop: '4%',
  3406. endingTop: '10%'
  3407. };
  3408. /**
  3409. * @class
  3410. *
  3411. */
  3412. var Modal = function () {
  3413. /**
  3414. * Construct Modal instance and set up overlay
  3415. * @constructor
  3416. * @param {jQuery} $el
  3417. * @param {Object} options
  3418. */
  3419. function Modal($el, options) {
  3420. _classCallCheck(this, Modal);
  3421. // If exists, destroy and reinitialize
  3422. if (!!$el[0].M_Modal) {
  3423. $el[0].M_Modal.destroy();
  3424. }
  3425. /**
  3426. * The jQuery element
  3427. * @type {jQuery}
  3428. */
  3429. this.$el = $el;
  3430. /**
  3431. * Options for the modal
  3432. * @member Modal#options
  3433. * @prop {Number} [opacity=0.5] - Opacity of the modal overlay
  3434. * @prop {Number} [inDuration=250] - Length in ms of enter transition
  3435. * @prop {Number} [outDuration=250] - Length in ms of exit transition
  3436. * @prop {Function} ready - Callback function called when modal is finished entering
  3437. * @prop {Function} complete - Callback function called when modal is finished exiting
  3438. * @prop {Boolean} [dismissible=true] - Allow modal to be dismissed by keyboard or overlay click
  3439. * @prop {String} [startingTop='4%'] - startingTop
  3440. * @prop {String} [endingTop='10%'] - endingTop
  3441. */
  3442. this.options = $.extend({}, Modal.defaults, options);
  3443. /**
  3444. * Describes open/close state of modal
  3445. * @type {Boolean}
  3446. */
  3447. this.isOpen = false;
  3448. this.$el[0].M_Modal = this;
  3449. this.id = $el.attr('id');
  3450. this.openingTrigger = undefined;
  3451. this.$overlay = $('<div class="modal-overlay"></div>');
  3452. Modal._increment++;
  3453. Modal._count++;
  3454. this.$overlay[0].style.zIndex = 1000 + Modal._increment * 2;
  3455. this.$el[0].style.zIndex = 1000 + Modal._increment * 2 + 1;
  3456. this.setupEventHandlers();
  3457. }
  3458. _createClass(Modal, [{
  3459. key: 'getInstance',
  3460. /**
  3461. * Get Instance
  3462. */
  3463. value: function getInstance() {
  3464. return this;
  3465. }
  3466. /**
  3467. * Teardown component
  3468. */
  3469. }, {
  3470. key: 'destroy',
  3471. value: function destroy() {
  3472. this.removeEventHandlers();
  3473. this.$el[0].removeAttribute('style');
  3474. if (!!this.$overlay[0].parentNode) {
  3475. this.$overlay[0].parentNode.removeChild(this.$overlay[0]);
  3476. }
  3477. this.$el[0].M_Modal = undefined;
  3478. Modal._count--;
  3479. }
  3480. /**
  3481. * Setup Event Handlers
  3482. */
  3483. }, {
  3484. key: 'setupEventHandlers',
  3485. value: function setupEventHandlers() {
  3486. this.handleOverlayClickBound = this.handleOverlayClick.bind(this);
  3487. this.handleModalCloseClickBound = this.handleModalCloseClick.bind(this);
  3488. if (Modal._count === 1) {
  3489. document.body.addEventListener('click', this.handleTriggerClick);
  3490. }
  3491. this.$overlay[0].addEventListener('click', this.handleOverlayClickBound);
  3492. this.$el[0].addEventListener('click', this.handleModalCloseClickBound);
  3493. }
  3494. /**
  3495. * Remove Event Handlers
  3496. */
  3497. }, {
  3498. key: 'removeEventHandlers',
  3499. value: function removeEventHandlers() {
  3500. if (Modal._count === 0) {
  3501. document.body.removeEventListener('click', this.handleTriggerClick);
  3502. }
  3503. this.$overlay[0].removeEventListener('click', this.handleOverlayClickBound);
  3504. this.$el[0].removeEventListener('click', this.handleModalCloseClickBound);
  3505. }
  3506. /**
  3507. * Handle Trigger Click
  3508. * @param {Event} e
  3509. */
  3510. }, {
  3511. key: 'handleTriggerClick',
  3512. value: function handleTriggerClick(e) {
  3513. var $trigger = $(e.target).closest('.modal-trigger');
  3514. if (e.target && $trigger.length) {
  3515. var modalId = $trigger[0].getAttribute('href');
  3516. if (modalId) {
  3517. modalId = modalId.slice(1);
  3518. } else {
  3519. modalId = $trigger[0].getAttribute('data-target');
  3520. }
  3521. var modalInstance = document.getElementById(modalId).M_Modal;
  3522. if (modalInstance) {
  3523. modalInstance.open($trigger);
  3524. }
  3525. e.preventDefault();
  3526. }
  3527. }
  3528. /**
  3529. * Handle Overlay Click
  3530. */
  3531. }, {
  3532. key: 'handleOverlayClick',
  3533. value: function handleOverlayClick() {
  3534. if (this.options.dismissible) {
  3535. this.close();
  3536. }
  3537. }
  3538. /**
  3539. * Handle Modal Close Click
  3540. * @param {Event} e
  3541. */
  3542. }, {
  3543. key: 'handleModalCloseClick',
  3544. value: function handleModalCloseClick(e) {
  3545. var $closeTrigger = $(e.target).closest('.modal-close');
  3546. if (e.target && $closeTrigger.length) {
  3547. this.close();
  3548. }
  3549. }
  3550. /**
  3551. * Handle Keydown
  3552. * @param {Event} e
  3553. */
  3554. }, {
  3555. key: 'handleKeydown',
  3556. value: function handleKeydown(e) {
  3557. // ESC key
  3558. if (e.keyCode === 27 && this.options.dismissible) {
  3559. this.close();
  3560. }
  3561. }
  3562. /**
  3563. * Animate in modal
  3564. */
  3565. }, {
  3566. key: 'animateIn',
  3567. value: function animateIn() {
  3568. var _this = this;
  3569. // Set initial styles
  3570. $.extend(this.$el[0].style, {
  3571. display: 'block',
  3572. opacity: 0
  3573. });
  3574. $.extend(this.$overlay[0].style, {
  3575. display: 'block',
  3576. opacity: 0
  3577. });
  3578. // Animate overlay
  3579. Vel(this.$overlay[0], {
  3580. opacity: this.options.opacity
  3581. }, {
  3582. duration: this.options.inDuration,
  3583. queue: false,
  3584. ease: 'easeOutCubic'
  3585. });
  3586. // Define modal animation options
  3587. var enterVelocityOptions = {
  3588. duration: this.options.inDuration,
  3589. queue: false,
  3590. ease: 'easeOutCubic',
  3591. // Handle modal ready callback
  3592. complete: function () {
  3593. if (typeof _this.options.ready === 'function') {
  3594. _this.options.ready.call(_this, _this.$el, _this.openingTrigger);
  3595. }
  3596. }
  3597. };
  3598. // Bottom sheet animation
  3599. if (this.$el[0].classList.contains('bottom-sheet')) {
  3600. Vel(this.$el[0], {
  3601. bottom: 0,
  3602. opacity: 1
  3603. }, enterVelocityOptions);
  3604. // Normal modal animation
  3605. } else {
  3606. Vel.hook(this.$el[0], 'scaleX', 0.7);
  3607. this.$el[0].style.top = this.options.startingTop;
  3608. Vel(this.$el[0], {
  3609. top: this.options.endingTop,
  3610. opacity: 1,
  3611. scaleX: 1
  3612. }, enterVelocityOptions);
  3613. }
  3614. }
  3615. /**
  3616. * Animate out modal
  3617. */
  3618. }, {
  3619. key: 'animateOut',
  3620. value: function animateOut() {
  3621. var _this2 = this;
  3622. // Animate overlay
  3623. Vel(this.$overlay[0], {
  3624. opacity: 0
  3625. }, {
  3626. duration: this.options.outDuration,
  3627. queue: false,
  3628. ease: 'easeOutQuart'
  3629. });
  3630. // Define modal animation options
  3631. var exitVelocityOptions = {
  3632. duration: this.options.outDuration,
  3633. queue: false,
  3634. ease: 'easeOutCubic',
  3635. // Handle modal ready callback
  3636. complete: function () {
  3637. _this2.$el[0].style.display = 'none';
  3638. // Call complete callback
  3639. if (typeof _this2.options.complete === 'function') {
  3640. _this2.options.complete.call(_this2, _this2.$el);
  3641. }
  3642. _this2.$overlay[0].parentNode.removeChild(_this2.$overlay[0]);
  3643. }
  3644. };
  3645. // Bottom sheet animation
  3646. if (this.$el[0].classList.contains('bottom-sheet')) {
  3647. Vel(this.$el[0], {
  3648. bottom: '-100%',
  3649. opacity: 0
  3650. }, exitVelocityOptions);
  3651. // Normal modal animation
  3652. } else {
  3653. Vel(this.$el[0], {
  3654. top: this.options.startingTop,
  3655. opacity: 0,
  3656. scaleX: 0.7
  3657. }, exitVelocityOptions);
  3658. }
  3659. }
  3660. /**
  3661. * Open Modal
  3662. * @param {jQuery} [$trigger]
  3663. */
  3664. }, {
  3665. key: 'open',
  3666. value: function open($trigger) {
  3667. if (this.isOpen) {
  3668. return;
  3669. }
  3670. this.isOpen = true;
  3671. var body = document.body;
  3672. body.style.overflow = 'hidden';
  3673. this.$el[0].classList.add('open');
  3674. body.appendChild(this.$overlay[0]);
  3675. // Set opening trigger, undefined indicates modal was opened by javascript
  3676. this.openingTrigger = !!$trigger ? $trigger : undefined;
  3677. if (this.options.dismissible) {
  3678. this.handleKeydownBound = this.handleKeydown.bind(this);
  3679. document.addEventListener('keydown', this.handleKeydownBound);
  3680. }
  3681. this.animateIn();
  3682. return this;
  3683. }
  3684. /**
  3685. * Close Modal
  3686. */
  3687. }, {
  3688. key: 'close',
  3689. value: function close() {
  3690. if (!this.isOpen) {
  3691. return;
  3692. }
  3693. this.isOpen = false;
  3694. this.$el[0].classList.remove('open');
  3695. document.body.style.overflow = '';
  3696. if (this.options.dismissible) {
  3697. document.removeEventListener('keydown', this.handleKeydownBound);
  3698. }
  3699. this.animateOut();
  3700. return this;
  3701. }
  3702. }], [{
  3703. key: 'init',
  3704. value: function init($els, options) {
  3705. var arr = [];
  3706. $els.each(function () {
  3707. arr.push(new Modal($(this), options));
  3708. });
  3709. return arr;
  3710. }
  3711. }, {
  3712. key: 'defaults',
  3713. get: function () {
  3714. return _defaults;
  3715. }
  3716. }]);
  3717. return Modal;
  3718. }();
  3719. /**
  3720. * @static
  3721. * @memberof Modal
  3722. */
  3723. Modal._increment = 0;
  3724. /**
  3725. * @static
  3726. * @memberof Modal
  3727. */
  3728. Modal._count = 0;
  3729. Materialize.Modal = Modal;
  3730. $.fn.modal = function (methodOrOptions) {
  3731. // Call plugin method if valid method name is passed in
  3732. if (Modal.prototype[methodOrOptions]) {
  3733. // Getter methods
  3734. if (methodOrOptions.slice(0, 3) === 'get') {
  3735. return this.first()[0].M_Modal[methodOrOptions]();
  3736. // Void methods
  3737. } else {
  3738. return this.each(function () {
  3739. this.M_Modal[methodOrOptions]();
  3740. });
  3741. }
  3742. // Initialize plugin if options or no argument is passed in
  3743. } else if (typeof methodOrOptions === 'object' || !methodOrOptions) {
  3744. Modal.init(this, arguments[0]);
  3745. return this;
  3746. // Return error if an unrecognized method name is passed in
  3747. } else {
  3748. $.error('Method ' + methodOrOptions + ' does not exist on jQuery.modal');
  3749. }
  3750. }
  3751. ;
  3752. }
  3753. )(jQuery, Materialize.Vel);
  3754. ; (function ($) {
  3755. $.fn.materialbox = function () {
  3756. return this.each(function () {
  3757. if ($(this).hasClass('initialized')) {
  3758. return;
  3759. }
  3760. $(this).addClass('initialized');
  3761. var overlayActive = false;
  3762. var doneAnimating = true;
  3763. var inDuration = 275;
  3764. var outDuration = 200;
  3765. var origin = $(this);
  3766. var placeholder = $('<div></div>').addClass('material-placeholder');
  3767. var originalWidth = 0;
  3768. var originalHeight = 0;
  3769. var ancestorsChanged;
  3770. var ancestor;
  3771. var originInlineStyles = origin.attr('style');
  3772. origin.wrap(placeholder);
  3773. // Start click handler
  3774. origin.on('click', function () {
  3775. var placeholder = origin.parent('.material-placeholder');
  3776. var windowWidth = window.innerWidth;
  3777. var windowHeight = window.innerHeight;
  3778. var originalWidth = origin.width();
  3779. var originalHeight = origin.height();
  3780. // If already modal, return to original
  3781. if (doneAnimating === false) {
  3782. returnToOriginal();
  3783. return false;
  3784. } else if (overlayActive && doneAnimating === true) {
  3785. returnToOriginal();
  3786. return false;
  3787. }
  3788. // Set states
  3789. doneAnimating = false;
  3790. origin.addClass('active');
  3791. overlayActive = true;
  3792. // Set positioning for placeholder
  3793. placeholder.css({
  3794. width: placeholder[0].getBoundingClientRect().width,
  3795. height: placeholder[0].getBoundingClientRect().height,
  3796. position: 'relative',
  3797. top: 0,
  3798. left: 0
  3799. });
  3800. // Find ancestor with overflow: hidden; and remove it
  3801. ancestorsChanged = undefined;
  3802. ancestor = placeholder[0].parentNode;
  3803. var count = 0;
  3804. while (ancestor !== null && !$(ancestor).is(document)) {
  3805. var curr = $(ancestor);
  3806. if (curr.css('overflow') !== 'visible') {
  3807. curr.css('overflow', 'visible');
  3808. if (ancestorsChanged === undefined) {
  3809. ancestorsChanged = curr;
  3810. } else {
  3811. ancestorsChanged = ancestorsChanged.add(curr);
  3812. }
  3813. }
  3814. ancestor = ancestor.parentNode;
  3815. }
  3816. // Set css on origin
  3817. origin.css({
  3818. position: 'absolute',
  3819. 'z-index': 1000,
  3820. 'will-change': 'left, top, width, height'
  3821. }).data('width', originalWidth).data('height', originalHeight);
  3822. // Add overlay
  3823. var overlay = $('<div id="materialbox-overlay"></div>').css({
  3824. opacity: 0
  3825. }).click(function () {
  3826. if (doneAnimating === true)
  3827. returnToOriginal();
  3828. });
  3829. // Put before in origin image to preserve z-index layering.
  3830. origin.before(overlay);
  3831. // Set dimensions if needed
  3832. var overlayOffset = overlay[0].getBoundingClientRect();
  3833. overlay.css({
  3834. width: windowWidth,
  3835. height: windowHeight,
  3836. left: -1 * overlayOffset.left,
  3837. top: -1 * overlayOffset.top
  3838. });
  3839. // Animate Overlay
  3840. overlay.velocity({
  3841. opacity: 1
  3842. }, {
  3843. duration: inDuration,
  3844. queue: false,
  3845. easing: 'easeOutQuad'
  3846. });
  3847. // Add and animate caption if it exists
  3848. if (origin.data('caption') !== "") {
  3849. var $photo_caption = $('<div class="materialbox-caption"></div>');
  3850. $photo_caption.text(origin.data('caption'));
  3851. $('body').append($photo_caption);
  3852. $photo_caption.css({
  3853. "display": "inline"
  3854. });
  3855. $photo_caption.velocity({
  3856. opacity: 1
  3857. }, {
  3858. duration: inDuration,
  3859. queue: false,
  3860. easing: 'easeOutQuad'
  3861. });
  3862. }
  3863. // Resize Image
  3864. var ratio = 0;
  3865. var widthPercent = originalWidth / windowWidth;
  3866. var heightPercent = originalHeight / windowHeight;
  3867. var newWidth = 0;
  3868. var newHeight = 0;
  3869. if (widthPercent > heightPercent) {
  3870. ratio = originalHeight / originalWidth;
  3871. newWidth = windowWidth * 0.9;
  3872. newHeight = windowWidth * 0.9 * ratio;
  3873. } else {
  3874. ratio = originalWidth / originalHeight;
  3875. newWidth = windowHeight * 0.9 * ratio;
  3876. newHeight = windowHeight * 0.9;
  3877. }
  3878. // Animate image + set z-index
  3879. if (origin.hasClass('responsive-img')) {
  3880. origin.velocity({
  3881. 'max-width': newWidth,
  3882. 'width': originalWidth
  3883. }, {
  3884. duration: 0,
  3885. queue: false,
  3886. complete: function () {
  3887. origin.css({
  3888. left: 0,
  3889. top: 0
  3890. }).velocity({
  3891. height: newHeight,
  3892. width: newWidth,
  3893. left: $(document).scrollLeft() + windowWidth / 2 - origin.parent('.material-placeholder').offset().left - newWidth / 2,
  3894. top: $(document).scrollTop() + windowHeight / 2 - origin.parent('.material-placeholder').offset().top - newHeight / 2
  3895. }, {
  3896. duration: inDuration,
  3897. queue: false,
  3898. easing: 'easeOutQuad',
  3899. complete: function () {
  3900. doneAnimating = true;
  3901. }
  3902. });
  3903. }// End Complete
  3904. });
  3905. // End Velocity
  3906. } else {
  3907. origin.css('left', 0).css('top', 0).velocity({
  3908. height: newHeight,
  3909. width: newWidth,
  3910. left: $(document).scrollLeft() + windowWidth / 2 - origin.parent('.material-placeholder').offset().left - newWidth / 2,
  3911. top: $(document).scrollTop() + windowHeight / 2 - origin.parent('.material-placeholder').offset().top - newHeight / 2
  3912. }, {
  3913. duration: inDuration,
  3914. queue: false,
  3915. easing: 'easeOutQuad',
  3916. complete: function () {
  3917. doneAnimating = true;
  3918. }
  3919. });
  3920. // End Velocity
  3921. }
  3922. // Handle Exit triggers
  3923. $(window).on('scroll.materialbox', function () {
  3924. if (overlayActive) {
  3925. returnToOriginal();
  3926. }
  3927. });
  3928. $(window).on('resize.materialbox', function () {
  3929. if (overlayActive) {
  3930. returnToOriginal();
  3931. }
  3932. });
  3933. $(document).on('keyup.materialbox', function (e) {
  3934. // ESC key
  3935. if (e.keyCode === 27 && doneAnimating === true && overlayActive) {
  3936. returnToOriginal();
  3937. }
  3938. });
  3939. });
  3940. // End click handler
  3941. // This function returns the modaled image to the original spot
  3942. function returnToOriginal() {
  3943. doneAnimating = false;
  3944. var placeholder = origin.parent('.material-placeholder');
  3945. var windowWidth = window.innerWidth;
  3946. var windowHeight = window.innerHeight;
  3947. var originalWidth = origin.data('width');
  3948. var originalHeight = origin.data('height');
  3949. origin.velocity("stop", true);
  3950. $('#materialbox-overlay').velocity("stop", true);
  3951. $('.materialbox-caption').velocity("stop", true);
  3952. // disable exit handlers
  3953. $(window).off('scroll.materialbox');
  3954. $(document).off('keyup.materialbox');
  3955. $(window).off('resize.materialbox');
  3956. $('#materialbox-overlay').velocity({
  3957. opacity: 0
  3958. }, {
  3959. duration: outDuration,
  3960. // Delay prevents animation overlapping
  3961. queue: false,
  3962. easing: 'easeOutQuad',
  3963. complete: function () {
  3964. // Remove Overlay
  3965. overlayActive = false;
  3966. $(this).remove();
  3967. }
  3968. });
  3969. // Resize Image
  3970. origin.velocity({
  3971. width: originalWidth,
  3972. height: originalHeight,
  3973. left: 0,
  3974. top: 0
  3975. }, {
  3976. duration: outDuration,
  3977. queue: false,
  3978. easing: 'easeOutQuad',
  3979. complete: function () {
  3980. placeholder.css({
  3981. height: '',
  3982. width: '',
  3983. position: '',
  3984. top: '',
  3985. left: ''
  3986. });
  3987. origin.removeAttr('style');
  3988. origin.attr('style', originInlineStyles);
  3989. // Remove class
  3990. origin.removeClass('active');
  3991. doneAnimating = true;
  3992. // Remove overflow overrides on ancestors
  3993. if (ancestorsChanged) {
  3994. ancestorsChanged.css('overflow', '');
  3995. }
  3996. }
  3997. });
  3998. // Remove Caption + reset css settings on image
  3999. $('.materialbox-caption').velocity({
  4000. opacity: 0
  4001. }, {
  4002. duration: outDuration,
  4003. // Delay prevents animation overlapping
  4004. queue: false,
  4005. easing: 'easeOutQuad',
  4006. complete: function () {
  4007. $(this).remove();
  4008. }
  4009. });
  4010. }
  4011. });
  4012. }
  4013. ;
  4014. $(document).ready(function () {
  4015. $('.materialboxed').materialbox();
  4016. });
  4017. }
  4018. )(jQuery);
  4019. ; (function ($) {
  4020. $.fn.parallax = function () {
  4021. var window_width = $(window).width();
  4022. // Parallax Scripts
  4023. return this.each(function (i) {
  4024. var $this = $(this);
  4025. $this.addClass('parallax');
  4026. function updateParallax(initial) {
  4027. var container_height;
  4028. if (window_width < 601) {
  4029. container_height = $this.height() > 0 ? $this.height() : $this.children("img").height();
  4030. } else {
  4031. container_height = $this.height() > 0 ? $this.height() : 500;
  4032. }
  4033. var $img = $this.children("img").first();
  4034. var img_height = $img.height();
  4035. var parallax_dist = img_height - container_height;
  4036. var bottom = $this.offset().top + container_height;
  4037. var top = $this.offset().top;
  4038. var scrollTop = $(window).scrollTop();
  4039. var windowHeight = window.innerHeight;
  4040. var windowBottom = scrollTop + windowHeight;
  4041. var percentScrolled = (windowBottom - top) / (container_height + windowHeight);
  4042. var parallax = Math.round(parallax_dist * percentScrolled);
  4043. if (initial) {
  4044. $img.css('display', 'block');
  4045. }
  4046. if (bottom > scrollTop && top < scrollTop + windowHeight) {
  4047. $img.css('transform', "translate3D(-50%," + parallax + "px, 0)");
  4048. }
  4049. }
  4050. // Wait for image load
  4051. $this.children("img").one("load", function () {
  4052. updateParallax(true);
  4053. }).each(function () {
  4054. if (this.complete)
  4055. $(this).trigger("load");
  4056. });
  4057. $(window).scroll(function () {
  4058. window_width = $(window).width();
  4059. updateParallax(false);
  4060. });
  4061. $(window).resize(function () {
  4062. window_width = $(window).width();
  4063. updateParallax(false);
  4064. });
  4065. });
  4066. }
  4067. ;
  4068. }
  4069. )(jQuery);
  4070. ; (function ($) {
  4071. var methods = {
  4072. init: function (options) {
  4073. var defaults = {
  4074. onShow: null,
  4075. swipeable: false,
  4076. responsiveThreshold: Infinity // breakpoint for swipeable
  4077. };
  4078. options = $.extend(defaults, options);
  4079. var namespace = Materialize.objectSelectorString($(this));
  4080. return this.each(function (i) {
  4081. var uniqueNamespace = namespace + i;
  4082. // For each set of tabs, we want to keep track of
  4083. // which tab is active and its associated content
  4084. var $this = $(this)
  4085. , window_width = $(window).width();
  4086. var $active, $content, $links = $this.find('li.tab a'), $tabs_width = $this.width(), $tabs_content = $(), $tabs_wrapper, $tab_width = Math.max($tabs_width, $this[0].scrollWidth) / $links.length, $indicator, index = 0, prev_index = 0, clicked = false, clickedTimeout, transition = 300;
  4087. // Finds right attribute for indicator based on active tab.
  4088. // el: jQuery Object
  4089. var calcRightPos = function (el) {
  4090. return Math.ceil($tabs_width - el.position().left - el[0].getBoundingClientRect().width - $this.scrollLeft());
  4091. };
  4092. // Finds left attribute for indicator based on active tab.
  4093. // el: jQuery Object
  4094. var calcLeftPos = function (el) {
  4095. return Math.floor(el.position().left + $this.scrollLeft());
  4096. };
  4097. // Animates Indicator to active tab.
  4098. // prev_index: Number
  4099. var animateIndicator = function (prev_index) {
  4100. if (index - prev_index >= 0) {
  4101. $indicator.velocity({
  4102. "right": calcRightPos($active)
  4103. }, {
  4104. duration: transition,
  4105. queue: false,
  4106. easing: 'easeOutQuad'
  4107. });
  4108. $indicator.velocity({
  4109. "left": calcLeftPos($active)
  4110. }, {
  4111. duration: transition,
  4112. queue: false,
  4113. easing: 'easeOutQuad',
  4114. delay: 90
  4115. });
  4116. } else {
  4117. $indicator.velocity({
  4118. "left": calcLeftPos($active)
  4119. }, {
  4120. duration: transition,
  4121. queue: false,
  4122. easing: 'easeOutQuad'
  4123. });
  4124. $indicator.velocity({
  4125. "right": calcRightPos($active)
  4126. }, {
  4127. duration: transition,
  4128. queue: false,
  4129. easing: 'easeOutQuad',
  4130. delay: 90
  4131. });
  4132. }
  4133. };
  4134. // Change swipeable according to responsive threshold
  4135. if (options.swipeable) {
  4136. if (window_width > options.responsiveThreshold) {
  4137. options.swipeable = false;
  4138. }
  4139. }
  4140. // If the location.hash matches one of the links, use that as the active tab.
  4141. $active = $($links.filter('[href="' + location.hash + '"]'));
  4142. // If no match is found, use the first link or any with class 'active' as the initial active tab.
  4143. if ($active.length === 0) {
  4144. $active = $(this).find('li.tab a.active').first();
  4145. }
  4146. if ($active.length === 0) {
  4147. $active = $(this).find('li.tab a').first();
  4148. }
  4149. $active.addClass('active');
  4150. index = $links.index($active);
  4151. if (index < 0) {
  4152. index = 0;
  4153. }
  4154. if ($active[0] !== undefined) {
  4155. $content = $($active[0].hash);
  4156. $content.addClass('active');
  4157. }
  4158. // append indicator then set indicator width to tab width
  4159. if (!$this.find('.indicator').length) {
  4160. $this.append('<li class="indicator"></li>');
  4161. }
  4162. $indicator = $this.find('.indicator');
  4163. // we make sure that the indicator is at the end of the tabs
  4164. $this.append($indicator);
  4165. if ($this.is(":visible")) {
  4166. // $indicator.css({"right": $tabs_width - ((index + 1) * $tab_width)});
  4167. // $indicator.css({"left": index * $tab_width});
  4168. setTimeout(function () {
  4169. $indicator.css({
  4170. "right": calcRightPos($active)
  4171. });
  4172. $indicator.css({
  4173. "left": calcLeftPos($active)
  4174. });
  4175. }, 0);
  4176. }
  4177. $(window).off('resize.tabs-' + uniqueNamespace).on('resize.tabs-' + uniqueNamespace, function () {
  4178. $tabs_width = $this.width();
  4179. $tab_width = Math.max($tabs_width, $this[0].scrollWidth) / $links.length;
  4180. if (index < 0) {
  4181. index = 0;
  4182. }
  4183. if ($tab_width !== 0 && $tabs_width !== 0) {
  4184. $indicator.css({
  4185. "right": calcRightPos($active)
  4186. });
  4187. $indicator.css({
  4188. "left": calcLeftPos($active)
  4189. });
  4190. }
  4191. });
  4192. // Initialize Tabs Content.
  4193. if (options.swipeable) {
  4194. // TODO: Duplicate calls with swipeable? handle multiple div wrapping.
  4195. $links.each(function () {
  4196. var $curr_content = $(Materialize.escapeHash(this.hash));
  4197. $curr_content.addClass('carousel-item');
  4198. $tabs_content = $tabs_content.add($curr_content);
  4199. });
  4200. $tabs_wrapper = $tabs_content.wrapAll('<div class="tabs-content carousel"></div>');
  4201. $tabs_content.css('display', '');
  4202. $('.tabs-content.carousel').carousel({
  4203. fullWidth: true,
  4204. noWrap: true,
  4205. onCycleTo: function (item) {
  4206. if (!clicked) {
  4207. var prev_index = index;
  4208. index = $tabs_wrapper.index(item);
  4209. $active.removeClass('active');
  4210. $active = $links.eq(index);
  4211. $active.addClass('active');
  4212. animateIndicator(prev_index);
  4213. if (typeof options.onShow === "function") {
  4214. options.onShow.call($this[0], $content);
  4215. }
  4216. }
  4217. }
  4218. });
  4219. } else {
  4220. // Hide the remaining content
  4221. $links.not($active).each(function () {
  4222. $(Materialize.escapeHash(this.hash)).hide();
  4223. });
  4224. }
  4225. // Bind the click event handler
  4226. $this.off('click.tabs').on('click.tabs', 'a', function (e) {
  4227. if ($(this).parent().hasClass('disabled')) {
  4228. e.preventDefault();
  4229. return;
  4230. }
  4231. // Act as regular link if target attribute is specified.
  4232. if (!!$(this).attr("target")) {
  4233. return;
  4234. }
  4235. clicked = true;
  4236. $tabs_width = $this.width();
  4237. $tab_width = Math.max($tabs_width, $this[0].scrollWidth) / $links.length;
  4238. // Make the old tab inactive.
  4239. $active.removeClass('active');
  4240. var $oldContent = $content;
  4241. // Update the variables with the new link and content
  4242. $active = $(this);
  4243. $content = $(Materialize.escapeHash(this.hash));
  4244. $links = $this.find('li.tab a');
  4245. var activeRect = $active.position();
  4246. // Make the tab active.
  4247. $active.addClass('active');
  4248. prev_index = index;
  4249. index = $links.index($(this));
  4250. if (index < 0) {
  4251. index = 0;
  4252. }
  4253. // Change url to current tab
  4254. // window.location.hash = $active.attr('href');
  4255. // Swap content
  4256. if (options.swipeable) {
  4257. if ($tabs_content.length) {
  4258. $tabs_content.carousel('set', index, function () {
  4259. if (typeof options.onShow === "function") {
  4260. options.onShow.call($this[0], $content);
  4261. }
  4262. });
  4263. }
  4264. } else {
  4265. if ($content !== undefined) {
  4266. $content.show();
  4267. $content.addClass('active');
  4268. if (typeof options.onShow === "function") {
  4269. options.onShow.call(this, $content);
  4270. }
  4271. }
  4272. if ($oldContent !== undefined && !$oldContent.is($content)) {
  4273. $oldContent.hide();
  4274. $oldContent.removeClass('active');
  4275. }
  4276. }
  4277. // Reset clicked state
  4278. clickedTimeout = setTimeout(function () {
  4279. clicked = false;
  4280. }, transition);
  4281. // Update indicator
  4282. animateIndicator(prev_index);
  4283. // Prevent the anchor's default click action
  4284. e.preventDefault();
  4285. });
  4286. });
  4287. },
  4288. select_tab: function (id) {
  4289. this.find('a[href="#' + id + '"]').trigger('click');
  4290. }
  4291. };
  4292. $.fn.tabs = function (methodOrOptions) {
  4293. if (methods[methodOrOptions]) {
  4294. return methods[methodOrOptions].apply(this, Array.prototype.slice.call(arguments, 1));
  4295. } else if (typeof methodOrOptions === 'object' || !methodOrOptions) {
  4296. // Default to "init"
  4297. return methods.init.apply(this, arguments);
  4298. } else {
  4299. $.error('Method ' + methodOrOptions + ' does not exist on jQuery.tabs');
  4300. }
  4301. }
  4302. ;
  4303. $(document).ready(function () {
  4304. $('ul.tabs').tabs();
  4305. });
  4306. }
  4307. )(jQuery);
  4308. ; (function ($) {
  4309. $.fn.tooltip = function (options) {
  4310. var timeout = null
  4311. , margin = 5;
  4312. // Defaults
  4313. var defaults = {
  4314. delay: 350,
  4315. tooltip: '',
  4316. position: 'bottom',
  4317. html: false
  4318. };
  4319. // Remove tooltip from the activator
  4320. if (options === "remove") {
  4321. this.each(function () {
  4322. $('#' + $(this).attr('data-tooltip-id')).remove();
  4323. $(this).removeAttr('data-tooltip-id');
  4324. $(this).off('mouseenter.tooltip mouseleave.tooltip');
  4325. });
  4326. return false;
  4327. }
  4328. options = $.extend(defaults, options);
  4329. return this.each(function () {
  4330. var tooltipId = Materialize.guid();
  4331. var origin = $(this);
  4332. // Destroy old tooltip
  4333. if (origin.attr('data-tooltip-id')) {
  4334. $('#' + origin.attr('data-tooltip-id')).remove();
  4335. }
  4336. origin.attr('data-tooltip-id', tooltipId);
  4337. // Get attributes.
  4338. var allowHtml, tooltipDelay, tooltipPosition, tooltipText, tooltipEl, backdrop;
  4339. var setAttributes = function () {
  4340. allowHtml = origin.attr('data-html') ? origin.attr('data-html') === 'true' : options.html;
  4341. tooltipDelay = origin.attr('data-delay');
  4342. tooltipDelay = tooltipDelay === undefined || tooltipDelay === '' ? options.delay : tooltipDelay;
  4343. tooltipPosition = origin.attr('data-position');
  4344. tooltipPosition = tooltipPosition === undefined || tooltipPosition === '' ? options.position : tooltipPosition;
  4345. tooltipText = origin.attr('data-tooltip');
  4346. tooltipText = tooltipText === undefined || tooltipText === '' ? options.tooltip : tooltipText;
  4347. };
  4348. setAttributes();
  4349. var renderTooltipEl = function () {
  4350. var tooltip = $('<div class="material-tooltip"></div>');
  4351. // Create Text span
  4352. if (allowHtml) {
  4353. tooltipText = $('<span></span>').html(tooltipText);
  4354. } else {
  4355. tooltipText = $('<span></span>').text(tooltipText);
  4356. }
  4357. // Create tooltip
  4358. tooltip.append(tooltipText).appendTo($('body')).attr('id', tooltipId);
  4359. // Create backdrop
  4360. backdrop = $('<div class="backdrop"></div>');
  4361. backdrop.appendTo(tooltip);
  4362. return tooltip;
  4363. };
  4364. tooltipEl = renderTooltipEl();
  4365. // Destroy previously binded events
  4366. origin.off('mouseenter.tooltip mouseleave.tooltip');
  4367. // Mouse In
  4368. var started = false, timeoutRef;
  4369. origin.on({
  4370. 'mouseenter.tooltip': function (e) {
  4371. var showTooltip = function () {
  4372. setAttributes();
  4373. started = true;
  4374. tooltipEl.velocity('stop');
  4375. backdrop.velocity('stop');
  4376. tooltipEl.css({
  4377. visibility: 'visible',
  4378. left: '0px',
  4379. top: '0px'
  4380. });
  4381. // Tooltip positioning
  4382. var originWidth = origin.outerWidth();
  4383. var originHeight = origin.outerHeight();
  4384. var tooltipHeight = tooltipEl.outerHeight();
  4385. var tooltipWidth = tooltipEl.outerWidth();
  4386. var tooltipVerticalMovement = '0px';
  4387. var tooltipHorizontalMovement = '0px';
  4388. var backdropOffsetWidth = backdrop[0].offsetWidth;
  4389. var backdropOffsetHeight = backdrop[0].offsetHeight;
  4390. var scaleXFactor = 8;
  4391. var scaleYFactor = 8;
  4392. var scaleFactor = 0;
  4393. var targetTop, targetLeft, newCoordinates;
  4394. if (tooltipPosition === "top") {
  4395. // Top Position
  4396. targetTop = origin.offset().top - tooltipHeight - margin;
  4397. targetLeft = origin.offset().left + originWidth / 2 - tooltipWidth / 2;
  4398. newCoordinates = repositionWithinScreen(targetLeft, targetTop, tooltipWidth, tooltipHeight);
  4399. tooltipVerticalMovement = '-10px';
  4400. backdrop.css({
  4401. bottom: 0,
  4402. left: 0,
  4403. borderRadius: '14px 14px 0 0',
  4404. transformOrigin: '50% 100%',
  4405. marginTop: tooltipHeight,
  4406. marginLeft: tooltipWidth / 2 - backdropOffsetWidth / 2
  4407. });
  4408. }// Left Position
  4409. else if (tooltipPosition === "left") {
  4410. targetTop = origin.offset().top + originHeight / 2 - tooltipHeight / 2;
  4411. targetLeft = origin.offset().left - tooltipWidth - margin;
  4412. newCoordinates = repositionWithinScreen(targetLeft, targetTop, tooltipWidth, tooltipHeight);
  4413. tooltipHorizontalMovement = '-10px';
  4414. backdrop.css({
  4415. top: '-7px',
  4416. right: 0,
  4417. width: '14px',
  4418. height: '14px',
  4419. borderRadius: '14px 0 0 14px',
  4420. transformOrigin: '95% 50%',
  4421. marginTop: tooltipHeight / 2,
  4422. marginLeft: tooltipWidth
  4423. });
  4424. }// Right Position
  4425. else if (tooltipPosition === "right") {
  4426. targetTop = origin.offset().top + originHeight / 2 - tooltipHeight / 2;
  4427. targetLeft = origin.offset().left + originWidth + margin;
  4428. newCoordinates = repositionWithinScreen(targetLeft, targetTop, tooltipWidth, tooltipHeight);
  4429. tooltipHorizontalMovement = '+10px';
  4430. backdrop.css({
  4431. top: '-7px',
  4432. left: 0,
  4433. width: '14px',
  4434. height: '14px',
  4435. borderRadius: '0 14px 14px 0',
  4436. transformOrigin: '5% 50%',
  4437. marginTop: tooltipHeight / 2,
  4438. marginLeft: '0px'
  4439. });
  4440. } else {
  4441. // Bottom Position
  4442. targetTop = origin.offset().top + origin.outerHeight() + margin;
  4443. targetLeft = origin.offset().left + originWidth / 2 - tooltipWidth / 2;
  4444. newCoordinates = repositionWithinScreen(targetLeft, targetTop, tooltipWidth, tooltipHeight);
  4445. tooltipVerticalMovement = '+10px';
  4446. backdrop.css({
  4447. top: 0,
  4448. left: 0,
  4449. marginLeft: tooltipWidth / 2 - backdropOffsetWidth / 2
  4450. });
  4451. }
  4452. // Set tooptip css placement
  4453. tooltipEl.css({
  4454. top: newCoordinates.y,
  4455. left: newCoordinates.x
  4456. });
  4457. // Calculate Scale to fill
  4458. scaleXFactor = Math.SQRT2 * tooltipWidth / parseInt(backdropOffsetWidth);
  4459. scaleYFactor = Math.SQRT2 * tooltipHeight / parseInt(backdropOffsetHeight);
  4460. scaleFactor = Math.max(scaleXFactor, scaleYFactor);
  4461. tooltipEl.velocity({
  4462. translateY: tooltipVerticalMovement,
  4463. translateX: tooltipHorizontalMovement
  4464. }, {
  4465. duration: 350,
  4466. queue: false
  4467. }).velocity({
  4468. opacity: 1
  4469. }, {
  4470. duration: 300,
  4471. delay: 50,
  4472. queue: false
  4473. });
  4474. backdrop.css({
  4475. visibility: 'visible'
  4476. }).velocity({
  4477. opacity: 1
  4478. }, {
  4479. duration: 55,
  4480. delay: 0,
  4481. queue: false
  4482. }).velocity({
  4483. scaleX: scaleFactor,
  4484. scaleY: scaleFactor
  4485. }, {
  4486. duration: 300,
  4487. delay: 0,
  4488. queue: false,
  4489. easing: 'easeInOutQuad'
  4490. });
  4491. };
  4492. timeoutRef = setTimeout(showTooltip, tooltipDelay);
  4493. // End Interval
  4494. // Mouse Out
  4495. },
  4496. 'mouseleave.tooltip': function () {
  4497. // Reset State
  4498. started = false;
  4499. clearTimeout(timeoutRef);
  4500. // Animate back
  4501. setTimeout(function () {
  4502. if (started !== true) {
  4503. tooltipEl.velocity({
  4504. opacity: 0,
  4505. translateY: 0,
  4506. translateX: 0
  4507. }, {
  4508. duration: 225,
  4509. queue: false
  4510. });
  4511. backdrop.velocity({
  4512. opacity: 0,
  4513. scaleX: 1,
  4514. scaleY: 1
  4515. }, {
  4516. duration: 225,
  4517. queue: false,
  4518. complete: function () {
  4519. backdrop.css({
  4520. visibility: 'hidden'
  4521. });
  4522. tooltipEl.css({
  4523. visibility: 'hidden'
  4524. });
  4525. started = false;
  4526. }
  4527. });
  4528. }
  4529. }, 225);
  4530. }
  4531. });
  4532. });
  4533. }
  4534. ;
  4535. var repositionWithinScreen = function (x, y, width, height) {
  4536. var newX = x;
  4537. var newY = y;
  4538. if (newX < 0) {
  4539. newX = 4;
  4540. } else if (newX + width > window.innerWidth) {
  4541. newX -= newX + width - window.innerWidth;
  4542. }
  4543. if (newY < 0) {
  4544. newY = 4;
  4545. } else if (newY + height > window.innerHeight + $(window).scrollTop) {
  4546. newY -= newY + height - window.innerHeight;
  4547. }
  4548. return {
  4549. x: newX,
  4550. y: newY
  4551. };
  4552. };
  4553. $(document).ready(function () {
  4554. $('.tooltipped').tooltip();
  4555. });
  4556. }
  4557. )(jQuery);
  4558. ;/*!
  4559. * Waves v0.6.4
  4560. * http://fian.my.id/Waves
  4561. *
  4562. * Copyright 2014 Alfiana E. Sibuea and other contributors
  4563. * Released under the MIT license
  4564. * https://github.com/fians/Waves/blob/master/LICENSE
  4565. */
  4566. ; (function (window) {
  4567. 'use strict';
  4568. var Waves = Waves || {};
  4569. var $$ = document.querySelectorAll.bind(document);
  4570. // Find exact position of element
  4571. function isWindow(obj) {
  4572. return obj !== null && obj === obj.window;
  4573. }
  4574. function getWindow(elem) {
  4575. return isWindow(elem) ? elem : elem.nodeType === 9 && elem.defaultView;
  4576. }
  4577. function offset(elem) {
  4578. var docElem, win, box = {
  4579. top: 0,
  4580. left: 0
  4581. }, doc = elem && elem.ownerDocument;
  4582. docElem = doc.documentElement;
  4583. if (typeof elem.getBoundingClientRect !== typeof undefined) {
  4584. box = elem.getBoundingClientRect();
  4585. }
  4586. win = getWindow(doc);
  4587. return {
  4588. top: box.top + win.pageYOffset - docElem.clientTop,
  4589. left: box.left + win.pageXOffset - docElem.clientLeft
  4590. };
  4591. }
  4592. function convertStyle(obj) {
  4593. var style = '';
  4594. for (var a in obj) {
  4595. if (obj.hasOwnProperty(a)) {
  4596. style += a + ':' + obj[a] + ';';
  4597. }
  4598. }
  4599. return style;
  4600. }
  4601. var Effect = {
  4602. // Effect delay
  4603. duration: 750,
  4604. show: function (e, element) {
  4605. if ($('.waves-ripple')[0]) {
  4606. $('.waves-ripple')[0].remove();
  4607. }
  4608. // Disable right click
  4609. if (e.button === 2) {
  4610. return false;
  4611. }
  4612. var el = element || this;
  4613. // Create ripple
  4614. var ripple = document.createElement('div');
  4615. ripple.className = 'waves-ripple';
  4616. el.appendChild(ripple);
  4617. // Get click coordinate and element witdh
  4618. var pos = offset(el);
  4619. var relativeY = e.pageY - pos.top;
  4620. var relativeX = e.pageX - pos.left;
  4621. var scale = 'scale(' + el.clientWidth / 100 * 10 + ')';
  4622. // Support for touch devices
  4623. if ('touches' in e) {
  4624. relativeY = e.touches[0].pageY - pos.top;
  4625. relativeX = e.touches[0].pageX - pos.left;
  4626. }
  4627. // Attach data to element
  4628. ripple.setAttribute('data-hold', Date.now());
  4629. ripple.setAttribute('data-scale', scale);
  4630. ripple.setAttribute('data-x', relativeX);
  4631. ripple.setAttribute('data-y', relativeY);
  4632. // Set ripple position
  4633. var rippleStyle = {
  4634. 'top': relativeY + 'px',
  4635. 'left': relativeX + 'px'
  4636. };
  4637. ripple.className = ripple.className + ' waves-notransition';
  4638. ripple.setAttribute('style', convertStyle(rippleStyle));
  4639. ripple.className = ripple.className.replace('waves-notransition', '');
  4640. // Scale the ripple
  4641. rippleStyle['-webkit-transform'] = scale;
  4642. rippleStyle['-moz-transform'] = scale;
  4643. rippleStyle['-ms-transform'] = scale;
  4644. rippleStyle['-o-transform'] = scale;
  4645. rippleStyle.transform = scale;
  4646. rippleStyle.opacity = '1';
  4647. rippleStyle['-webkit-transition-duration'] = Effect.duration + 'ms';
  4648. rippleStyle['-moz-transition-duration'] = Effect.duration + 'ms';
  4649. rippleStyle['-o-transition-duration'] = Effect.duration + 'ms';
  4650. rippleStyle['transition-duration'] = Effect.duration + 'ms';
  4651. rippleStyle['-webkit-transition-timing-function'] = 'cubic-bezier(0.250, 0.460, 0.450, 0.940)';
  4652. rippleStyle['-moz-transition-timing-function'] = 'cubic-bezier(0.250, 0.460, 0.450, 0.940)';
  4653. rippleStyle['-o-transition-timing-function'] = 'cubic-bezier(0.250, 0.460, 0.450, 0.940)';
  4654. rippleStyle['transition-timing-function'] = 'cubic-bezier(0.250, 0.460, 0.450, 0.940)';
  4655. ripple.setAttribute('style', convertStyle(rippleStyle));
  4656. },
  4657. hide: function (e) {
  4658. TouchHandler.touchup(e);
  4659. var el = this;
  4660. var width = el.clientWidth * 1.4;
  4661. // Get first ripple
  4662. var ripple = null;
  4663. var ripples = el.getElementsByClassName('waves-ripple');
  4664. if (ripples.length > 0) {
  4665. ripple = ripples[ripples.length - 1];
  4666. ripples[1] ? ripples[1].remove() : '';
  4667. } else {
  4668. return false;
  4669. }
  4670. var relativeX = ripple.getAttribute('data-x');
  4671. var relativeY = ripple.getAttribute('data-y');
  4672. var scale = ripple.getAttribute('data-scale');
  4673. // Get delay beetween mousedown and mouse leave
  4674. var diff = Date.now() - Number(ripple.getAttribute('data-hold'));
  4675. var delay = 350 - diff;
  4676. if (delay < 0) {
  4677. delay = 0;
  4678. }
  4679. // Fade out ripple after delay
  4680. setTimeout(function () {
  4681. var style = {
  4682. 'top': relativeY + 'px',
  4683. 'left': relativeX + 'px',
  4684. 'opacity': '0',
  4685. // Duration
  4686. '-webkit-transition-duration': Effect.duration + 'ms',
  4687. '-moz-transition-duration': Effect.duration + 'ms',
  4688. '-o-transition-duration': Effect.duration + 'ms',
  4689. 'transition-duration': Effect.duration + 'ms',
  4690. '-webkit-transform': scale,
  4691. '-moz-transform': scale,
  4692. '-ms-transform': scale,
  4693. '-o-transform': scale,
  4694. 'transform': scale
  4695. };
  4696. ripple.setAttribute('style', convertStyle(style));
  4697. setTimeout(function () {
  4698. try {
  4699. el.removeChild(ripple);
  4700. } catch (e) {
  4701. return false;
  4702. }
  4703. }, Effect.duration);
  4704. }, delay);
  4705. },
  4706. // Little hack to make <input> can perform waves effect
  4707. wrapInput: function (elements) {
  4708. for (var a = 0; a < elements.length; a++) {
  4709. var el = elements[a];
  4710. if (el.tagName.toLowerCase() === 'input') {
  4711. var parent = el.parentNode;
  4712. // If input already have parent just pass through
  4713. if (parent.tagName.toLowerCase() === 'i' && parent.className.indexOf('waves-effect') !== -1) {
  4714. continue;
  4715. }
  4716. // Put element class and style to the specified parent
  4717. var wrapper = document.createElement('i');
  4718. wrapper.className = el.className + ' waves-input-wrapper';
  4719. var elementStyle = el.getAttribute('style');
  4720. if (!elementStyle) {
  4721. elementStyle = '';
  4722. }
  4723. wrapper.setAttribute('style', elementStyle);
  4724. el.className = 'waves-button-input';
  4725. el.removeAttribute('style');
  4726. // Put element as child
  4727. parent.replaceChild(wrapper, el);
  4728. wrapper.appendChild(el);
  4729. }
  4730. }
  4731. }
  4732. };
  4733. /**
  4734. * Disable mousedown event for 500ms during and after touch
  4735. */
  4736. var TouchHandler = {
  4737. /* uses an integer rather than bool so there's no issues with
  4738. * needing to clear timeouts if another touch event occurred
  4739. * within the 500ms. Cannot mouseup between touchstart and
  4740. * touchend, nor in the 500ms after touchend. */
  4741. touches: 0,
  4742. allowEvent: function (e) {
  4743. var allow = true;
  4744. if (e.type === 'touchstart') {
  4745. TouchHandler.touches += 1;
  4746. //push
  4747. } else if (e.type === 'touchend' || e.type === 'touchcancel') {
  4748. setTimeout(function () {
  4749. if (TouchHandler.touches > 0) {
  4750. TouchHandler.touches -= 1;
  4751. //pop after 500ms
  4752. }
  4753. }, 500);
  4754. } else if (e.type === 'mousedown' && TouchHandler.touches > 0) {
  4755. allow = false;
  4756. }
  4757. return allow;
  4758. },
  4759. touchup: function (e) {
  4760. TouchHandler.allowEvent(e);
  4761. }
  4762. };
  4763. /**
  4764. * Delegated click handler for .waves-effect element.
  4765. * returns null when .waves-effect element not in "click tree"
  4766. */
  4767. function getWavesEffectElement(e) {
  4768. if (TouchHandler.allowEvent(e) === false) {
  4769. return null;
  4770. }
  4771. var element = null;
  4772. var target = e.target || e.srcElement;
  4773. while (target.parentNode !== null) {
  4774. if (!(target instanceof SVGElement) && target.className.indexOf('waves-effect') !== -1) {
  4775. element = target;
  4776. break;
  4777. }
  4778. target = target.parentNode;
  4779. }
  4780. return element;
  4781. }
  4782. /**
  4783. * Bubble the click and show effect if .waves-effect elem was found
  4784. */
  4785. function showEffect(e) {
  4786. var element = getWavesEffectElement(e);
  4787. if (element !== null) {
  4788. Effect.show(e, element);
  4789. if ('ontouchstart' in window) {
  4790. element.addEventListener('touchend', Effect.hide, false);
  4791. element.addEventListener('touchcancel', Effect.hide, false);
  4792. }
  4793. element.addEventListener('mouseup', Effect.hide, false);
  4794. element.addEventListener('mouseleave', Effect.hide, false);
  4795. element.addEventListener('dragend', Effect.hide, false);
  4796. }
  4797. }
  4798. Waves.displayEffect = function (options) {
  4799. options = options || {};
  4800. if ('duration' in options) {
  4801. Effect.duration = options.duration;
  4802. }
  4803. //Wrap input inside <i> tag
  4804. Effect.wrapInput($$('.waves-effect'));
  4805. if ('ontouchstart' in window) {
  4806. document.body.addEventListener('touchstart', showEffect, false);
  4807. }
  4808. document.body.addEventListener('mousedown', showEffect, false);
  4809. }
  4810. ;
  4811. /**
  4812. * Attach Waves to an input element (or any element which doesn't
  4813. * bubble mouseup/mousedown events).
  4814. * Intended to be used with dynamically loaded forms/inputs, or
  4815. * where the user doesn't want a delegated click handler.
  4816. */
  4817. Waves.attach = function (element) {
  4818. //FUTURE: automatically add waves classes and allow users
  4819. // to specify them with an options param? Eg. light/classic/button
  4820. if (element.tagName.toLowerCase() === 'input') {
  4821. Effect.wrapInput([element]);
  4822. element = element.parentNode;
  4823. }
  4824. if ('ontouchstart' in window) {
  4825. element.addEventListener('touchstart', showEffect, false);
  4826. }
  4827. element.addEventListener('mousedown', showEffect, false);
  4828. }
  4829. ;
  4830. window.Waves = Waves;
  4831. document.addEventListener('DOMContentLoaded', function () {
  4832. Waves.displayEffect();
  4833. }, false);
  4834. }
  4835. )(window);
  4836. ; (function ($, Vel) {
  4837. 'use strict';
  4838. var _defaults = {
  4839. displayLength: Infinity,
  4840. inDuration: 300,
  4841. outDuration: 375,
  4842. className: undefined,
  4843. completeCallback: undefined,
  4844. activationPercent: 0.8
  4845. };
  4846. var Toast = function () {
  4847. function Toast(message, displayLength, className, completeCallback) {
  4848. _classCallCheck(this, Toast);
  4849. if (!message) {
  4850. return;
  4851. }
  4852. /**
  4853. * Options for the toast
  4854. * @member Toast#options
  4855. */
  4856. this.options = {
  4857. displayLength: displayLength,
  4858. className: className,
  4859. completeCallback: completeCallback
  4860. };
  4861. this.options = $.extend({}, Toast.defaults, this.options);
  4862. this.message = message;
  4863. /**
  4864. * Describes current pan state toast
  4865. * @type {Boolean}
  4866. */
  4867. this.panning = false;
  4868. /**
  4869. * Time remaining until toast is removed
  4870. */
  4871. this.timeRemaining = this.options.displayLength;
  4872. if (Toast._toasts.length === 0) {
  4873. Toast._createContainer();
  4874. }
  4875. // Create new toast
  4876. Toast._toasts.push(this);
  4877. var toastElement = this.createToast();
  4878. toastElement.M_Toast = this;
  4879. this.el = toastElement;
  4880. this._animateIn();
  4881. this.setTimer();
  4882. }
  4883. _createClass(Toast, [{
  4884. key: 'createToast',
  4885. /**
  4886. * Create toast and append it to toast container
  4887. */
  4888. value: function createToast() {
  4889. var toast = document.createElement('div');
  4890. toast.classList.add('toast');
  4891. // Add custom classes onto toast
  4892. if (this.options.className) {
  4893. var classes = this.options.className.split(' ');
  4894. var i = void 0
  4895. , count = void 0;
  4896. for (i = 0,
  4897. count = classes.length; i < count; i++) {
  4898. toast.classList.add(classes[i]);
  4899. }
  4900. }
  4901. // Set content
  4902. if (typeof HTMLElement === 'object' ? this.message instanceof HTMLElement : this.message && typeof this.message === 'object' && this.message !== null && this.message.nodeType === 1 && typeof this.message.nodeName === 'string') {
  4903. toast.appendChild(this.message);
  4904. // Check if it is jQuery object
  4905. } else if (this.message instanceof jQuery) {
  4906. $(toast).append(this.message);
  4907. // Insert as text;
  4908. } else {
  4909. toast.innerHTML = this.message;
  4910. }
  4911. // Append toasft
  4912. Toast._container.appendChild(toast);
  4913. return toast;
  4914. }
  4915. /**
  4916. * Animate in toast
  4917. */
  4918. }, {
  4919. key: '_animateIn',
  4920. value: function _animateIn() {
  4921. // Animate toast in
  4922. Vel(this.el, {
  4923. top: 0,
  4924. opacity: 1
  4925. }, {
  4926. duration: 300,
  4927. easing: 'easeOutCubic',
  4928. queue: false
  4929. });
  4930. }
  4931. /**
  4932. * Create setInterval which automatically removes toast when timeRemaining >= 0
  4933. * has been reached
  4934. */
  4935. }, {
  4936. key: 'setTimer',
  4937. value: function setTimer() {
  4938. var _this3 = this;
  4939. if (this.timeRemaining !== Infinity) {
  4940. this.counterInterval = setInterval(function () {
  4941. // If toast is not being dragged, decrease its time remaining
  4942. if (!_this3.panning) {
  4943. _this3.timeRemaining -= 20;
  4944. }
  4945. // Animate toast out
  4946. if (_this3.timeRemaining <= 0) {
  4947. _this3.remove();
  4948. }
  4949. }, 20);
  4950. }
  4951. }
  4952. /**
  4953. * Dismiss toast with animation
  4954. */
  4955. }, {
  4956. key: 'remove',
  4957. value: function remove() {
  4958. var _this4 = this;
  4959. window.clearInterval(this.counterInterval);
  4960. var activationDistance = this.el.offsetWidth * this.options.activationPercent;
  4961. if (this.wasSwiped) {
  4962. this.el.style.transition = 'transform .05s, opacity .05s';
  4963. this.el.style.transform = 'translateX(' + activationDistance + 'px)';
  4964. this.el.style.opacity = 0;
  4965. }
  4966. Vel(this.el, {
  4967. opacity: 0,
  4968. marginTop: '-40px'
  4969. }, {
  4970. duration: this.options.outDuration,
  4971. easing: 'easeOutExpo',
  4972. queue: false,
  4973. complete: function () {
  4974. // Call the optional callback
  4975. if (typeof _this4.options.completeCallback === 'function') {
  4976. _this4.options.completeCallback();
  4977. }
  4978. // Remove toast from DOM
  4979. _this4.el.parentNode.removeChild(_this4.el);
  4980. Toast._toasts.splice(Toast._toasts.indexOf(_this4), 1);
  4981. if (Toast._toasts.length === 0) {
  4982. Toast._removeContainer();
  4983. }
  4984. }
  4985. });
  4986. }
  4987. }], [{
  4988. key: '_createContainer',
  4989. /**
  4990. * Append toast container and add event handlers
  4991. */
  4992. value: function _createContainer() {
  4993. var container = document.createElement('div');
  4994. container.setAttribute('id', 'toast-container');
  4995. // Add event handler
  4996. container.addEventListener('touchstart', Toast._onDragStart);
  4997. container.addEventListener('touchmove', Toast._onDragMove);
  4998. container.addEventListener('touchend', Toast._onDragEnd);
  4999. container.addEventListener('mousedown', Toast._onDragStart);
  5000. document.addEventListener('mousemove', Toast._onDragMove);
  5001. document.addEventListener('mouseup', Toast._onDragEnd);
  5002. document.body.appendChild(container);
  5003. Toast._container = container;
  5004. }
  5005. /**
  5006. * Remove toast container and event handlers
  5007. */
  5008. }, {
  5009. key: '_removeContainer',
  5010. value: function _removeContainer() {
  5011. // Add event handler
  5012. document.removeEventListener('mousemove', Toast._onDragMove);
  5013. document.removeEventListener('mouseup', Toast._onDragEnd);
  5014. Toast._container.parentNode.removeChild(Toast._container);
  5015. Toast._container = null;
  5016. }
  5017. /**
  5018. * Begin drag handler
  5019. * @param {Event} e
  5020. */
  5021. }, {
  5022. key: '_onDragStart',
  5023. value: function _onDragStart(e) {
  5024. if (e.target && $(e.target).closest('.toast').length) {
  5025. var $toast = $(e.target).closest('.toast');
  5026. var toast = $toast[0].M_Toast;
  5027. toast.panning = true;
  5028. Toast._draggedToast = toast;
  5029. toast.el.classList.add('panning');
  5030. toast.el.style.transition = '';
  5031. toast.startingXPos = Toast._xPos(e);
  5032. toast.time = Date.now();
  5033. toast.xPos = Toast._xPos(e);
  5034. }
  5035. }
  5036. /**
  5037. * Drag move handler
  5038. * @param {Event} e
  5039. */
  5040. }, {
  5041. key: '_onDragMove',
  5042. value: function _onDragMove(e) {
  5043. if (!!Toast._draggedToast) {
  5044. e.preventDefault();
  5045. var toast = Toast._draggedToast;
  5046. toast.deltaX = Math.abs(toast.xPos - Toast._xPos(e));
  5047. toast.xPos = Toast._xPos(e);
  5048. toast.velocityX = toast.deltaX / (Date.now() - toast.time);
  5049. toast.time = Date.now();
  5050. var totalDeltaX = toast.xPos - toast.startingXPos;
  5051. var activationDistance = toast.el.offsetWidth * toast.options.activationPercent;
  5052. toast.el.style.transform = 'translateX(' + totalDeltaX + 'px)';
  5053. toast.el.style.opacity = 1 - Math.abs(totalDeltaX / activationDistance);
  5054. }
  5055. }
  5056. /**
  5057. * End drag handler
  5058. * @param {Event} e
  5059. */
  5060. }, {
  5061. key: '_onDragEnd',
  5062. value: function _onDragEnd(e) {
  5063. if (!!Toast._draggedToast) {
  5064. var toast = Toast._draggedToast;
  5065. toast.panning = false;
  5066. toast.el.classList.remove('panning');
  5067. var totalDeltaX = toast.xPos - toast.startingXPos;
  5068. var activationDistance = toast.el.offsetWidth * toast.options.activationPercent;
  5069. var shouldBeDismissed = Math.abs(totalDeltaX) > activationDistance || toast.velocityX > 1;
  5070. // Remove toast
  5071. if (shouldBeDismissed) {
  5072. toast.wasSwiped = true;
  5073. toast.remove();
  5074. // Animate toast back to original position
  5075. } else {
  5076. toast.el.style.transition = 'transform .2s, opacity .2s';
  5077. toast.el.style.transform = '';
  5078. toast.el.style.opacity = '';
  5079. }
  5080. Toast._draggedToast = null;
  5081. }
  5082. }
  5083. /**
  5084. * Get x position of mouse or touch event
  5085. * @param {Event} e
  5086. */
  5087. }, {
  5088. key: '_xPos',
  5089. value: function _xPos(e) {
  5090. if (e.targetTouches && e.targetTouches.length >= 1) {
  5091. return e.targetTouches[0].clientX;
  5092. }
  5093. // mouse event
  5094. return e.clientX;
  5095. }
  5096. /**
  5097. * Remove all toasts
  5098. */
  5099. }, {
  5100. key: 'removeAll',
  5101. value: function removeAll() {
  5102. for (var toastIndex in Toast._toasts) {
  5103. Toast._toasts[toastIndex].remove();
  5104. }
  5105. }
  5106. }, {
  5107. key: 'defaults',
  5108. get: function () {
  5109. return _defaults;
  5110. }
  5111. }]);
  5112. return Toast;
  5113. }();
  5114. /**
  5115. * @static
  5116. * @memberof Toast
  5117. * @type {Array.<Toast>}
  5118. */
  5119. Toast._toasts = [];
  5120. /**
  5121. * @static
  5122. * @memberof Toast
  5123. */
  5124. Toast._container = null;
  5125. /**
  5126. * @static
  5127. * @memberof Toast
  5128. * @type {Toast}
  5129. */
  5130. Toast._draggedToast = null;
  5131. Materialize.Toast = Toast;
  5132. Materialize.toast = function (message, displayLength, className, completeCallback) {
  5133. return new Toast(message, displayLength, className, completeCallback);
  5134. }
  5135. ;
  5136. }
  5137. )(jQuery, Materialize.Vel);
  5138. ; (function ($) {
  5139. var methods = {
  5140. init: function (options) {
  5141. var defaults = {
  5142. menuWidth: 300,
  5143. edge: 'left',
  5144. closeOnClick: false,
  5145. draggable: true,
  5146. onOpen: null,
  5147. onClose: null
  5148. };
  5149. options = $.extend(defaults, options);
  5150. $(this).each(function () {
  5151. var $this = $(this);
  5152. var menuId = $this.attr('data-activates');
  5153. var menu = $("#" + menuId);
  5154. // Set to width
  5155. if (options.menuWidth != 300) {
  5156. menu.css('width', options.menuWidth);
  5157. }
  5158. // Add Touch Area
  5159. var $dragTarget = $('.drag-target[data-sidenav="' + menuId + '"]');
  5160. if (options.draggable) {
  5161. // Regenerate dragTarget
  5162. if ($dragTarget.length) {
  5163. $dragTarget.remove();
  5164. }
  5165. $dragTarget = $('<div class="drag-target"></div>').attr('data-sidenav', menuId);
  5166. $('body').append($dragTarget);
  5167. } else {
  5168. $dragTarget = $();
  5169. }
  5170. if (options.edge == 'left') {
  5171. menu.css('transform', 'translateX(-100%)');
  5172. $dragTarget.css({
  5173. 'left': 0
  5174. });
  5175. // Add Touch Area
  5176. } else {
  5177. menu.addClass('right-aligned')// Change text-alignment to right
  5178. .css('transform', 'translateX(100%)');
  5179. $dragTarget.css({
  5180. 'right': 0
  5181. });
  5182. // Add Touch Area
  5183. }
  5184. // If fixed sidenav, bring menu out
  5185. if (menu.hasClass('fixed')) {
  5186. if (window.innerWidth > 992) {
  5187. menu.css('transform', 'translateX(0)');
  5188. }
  5189. }
  5190. // Window resize to reset on large screens fixed
  5191. if (menu.hasClass('fixed')) {
  5192. $(window).resize(function () {
  5193. if (window.innerWidth > 992) {
  5194. // Close menu if window is resized bigger than 992 and user has fixed sidenav
  5195. if ($('#sidenav-overlay').length !== 0 && menuOut) {
  5196. removeMenu(true);
  5197. } else {
  5198. // menu.removeAttr('style');
  5199. menu.css('transform', 'translateX(0%)');
  5200. // menu.css('width', options.menuWidth);
  5201. }
  5202. } else if (menuOut === false) {
  5203. if (options.edge === 'left') {
  5204. menu.css('transform', 'translateX(-100%)');
  5205. } else {
  5206. menu.css('transform', 'translateX(100%)');
  5207. }
  5208. }
  5209. });
  5210. }
  5211. // if closeOnClick, then add close event for all a tags in side sideNav
  5212. if (options.closeOnClick === true) {
  5213. menu.on("click.itemclick", "a:not(.collapsible-header)", function () {
  5214. if (!(window.innerWidth > 992 && menu.hasClass('fixed'))) {
  5215. removeMenu();
  5216. }
  5217. });
  5218. }
  5219. var removeMenu = function (restoreNav) {
  5220. panning = false;
  5221. menuOut = false;
  5222. // Reenable scrolling
  5223. $('body').css({
  5224. overflow: '',
  5225. width: ''
  5226. });
  5227. $('#sidenav-overlay').velocity({
  5228. opacity: 0
  5229. }, {
  5230. duration: 200,
  5231. queue: false,
  5232. easing: 'easeOutQuad',
  5233. complete: function () {
  5234. $(this).remove();
  5235. }
  5236. });
  5237. if (options.edge === 'left') {
  5238. // Reset phantom div
  5239. $dragTarget.css({
  5240. width: '',
  5241. right: '',
  5242. left: '0'
  5243. });
  5244. menu.velocity({
  5245. 'translateX': '-100%'
  5246. }, {
  5247. duration: 200,
  5248. queue: false,
  5249. easing: 'easeOutCubic',
  5250. complete: function () {
  5251. if (restoreNav === true) {
  5252. // Restore Fixed sidenav
  5253. menu.removeAttr('style');
  5254. menu.css('width', options.menuWidth);
  5255. }
  5256. }
  5257. });
  5258. } else {
  5259. // Reset phantom div
  5260. $dragTarget.css({
  5261. width: '',
  5262. right: '0',
  5263. left: ''
  5264. });
  5265. menu.velocity({
  5266. 'translateX': '100%'
  5267. }, {
  5268. duration: 200,
  5269. queue: false,
  5270. easing: 'easeOutCubic',
  5271. complete: function () {
  5272. if (restoreNav === true) {
  5273. // Restore Fixed sidenav
  5274. menu.removeAttr('style');
  5275. menu.css('width', options.menuWidth);
  5276. }
  5277. }
  5278. });
  5279. }
  5280. // Callback
  5281. if (typeof options.onClose === 'function') {
  5282. options.onClose.call(this, menu);
  5283. }
  5284. };
  5285. // Touch Event
  5286. var panning = false;
  5287. var menuOut = false;
  5288. if (options.draggable) {
  5289. $dragTarget.on('click', function () {
  5290. if (menuOut) {
  5291. removeMenu();
  5292. }
  5293. });
  5294. $dragTarget.hammer({
  5295. prevent_default: false
  5296. }).on('pan', function (e) {
  5297. if (e.gesture.pointerType == "touch") {
  5298. var direction = e.gesture.direction;
  5299. var x = e.gesture.center.x;
  5300. var y = e.gesture.center.y;
  5301. var velocityX = e.gesture.velocityX;
  5302. // Vertical scroll bugfix
  5303. if (x === 0 && y === 0) {
  5304. return;
  5305. }
  5306. // Disable Scrolling
  5307. var $body = $('body');
  5308. var $overlay = $('#sidenav-overlay');
  5309. var oldWidth = $body.innerWidth();
  5310. $body.css('overflow', 'hidden');
  5311. $body.width(oldWidth);
  5312. // If overlay does not exist, create one and if it is clicked, close menu
  5313. if ($overlay.length === 0) {
  5314. $overlay = $('<div id="sidenav-overlay"></div>');
  5315. $overlay.css('opacity', 0).click(function () {
  5316. removeMenu();
  5317. });
  5318. // Run 'onOpen' when sidenav is opened via touch/swipe if applicable
  5319. if (typeof options.onOpen === 'function') {
  5320. options.onOpen.call(this, menu);
  5321. }
  5322. $('body').append($overlay);
  5323. }
  5324. // Keep within boundaries
  5325. if (options.edge === 'left') {
  5326. if (x > options.menuWidth) {
  5327. x = options.menuWidth;
  5328. } else if (x < 0) {
  5329. x = 0;
  5330. }
  5331. }
  5332. if (options.edge === 'left') {
  5333. // Left Direction
  5334. if (x < options.menuWidth / 2) {
  5335. menuOut = false;
  5336. }// Right Direction
  5337. else if (x >= options.menuWidth / 2) {
  5338. menuOut = true;
  5339. }
  5340. menu.css('transform', 'translateX(' + (x - options.menuWidth) + 'px)');
  5341. } else {
  5342. // Left Direction
  5343. if (x < window.innerWidth - options.menuWidth / 2) {
  5344. menuOut = true;
  5345. }// Right Direction
  5346. else if (x >= window.innerWidth - options.menuWidth / 2) {
  5347. menuOut = false;
  5348. }
  5349. var rightPos = x - options.menuWidth / 2;
  5350. if (rightPos < 0) {
  5351. rightPos = 0;
  5352. }
  5353. menu.css('transform', 'translateX(' + rightPos + 'px)');
  5354. }
  5355. // Percentage overlay
  5356. var overlayPerc;
  5357. if (options.edge === 'left') {
  5358. overlayPerc = x / options.menuWidth;
  5359. $overlay.velocity({
  5360. opacity: overlayPerc
  5361. }, {
  5362. duration: 10,
  5363. queue: false,
  5364. easing: 'easeOutQuad'
  5365. });
  5366. } else {
  5367. overlayPerc = Math.abs((x - window.innerWidth) / options.menuWidth);
  5368. $overlay.velocity({
  5369. opacity: overlayPerc
  5370. }, {
  5371. duration: 10,
  5372. queue: false,
  5373. easing: 'easeOutQuad'
  5374. });
  5375. }
  5376. }
  5377. }).on('panend', function (e) {
  5378. if (e.gesture.pointerType == "touch") {
  5379. var $overlay = $('#sidenav-overlay');
  5380. var velocityX = e.gesture.velocityX;
  5381. var x = e.gesture.center.x;
  5382. var leftPos = x - options.menuWidth;
  5383. var rightPos = x - options.menuWidth / 2;
  5384. if (leftPos > 0) {
  5385. leftPos = 0;
  5386. }
  5387. if (rightPos < 0) {
  5388. rightPos = 0;
  5389. }
  5390. panning = false;
  5391. if (options.edge === 'left') {
  5392. // If velocityX <= 0.3 then the user is flinging the menu closed so ignore menuOut
  5393. if (menuOut && velocityX <= 0.3 || velocityX < -0.5) {
  5394. // Return menu to open
  5395. if (leftPos !== 0) {
  5396. menu.velocity({
  5397. 'translateX': [0, leftPos]
  5398. }, {
  5399. duration: 300,
  5400. queue: false,
  5401. easing: 'easeOutQuad'
  5402. });
  5403. }
  5404. $overlay.velocity({
  5405. opacity: 1
  5406. }, {
  5407. duration: 50,
  5408. queue: false,
  5409. easing: 'easeOutQuad'
  5410. });
  5411. $dragTarget.css({
  5412. width: '50%',
  5413. right: 0,
  5414. left: ''
  5415. });
  5416. menuOut = true;
  5417. } else if (!menuOut || velocityX > 0.3) {
  5418. // Enable Scrolling
  5419. $('body').css({
  5420. overflow: '',
  5421. width: ''
  5422. });
  5423. // Slide menu closed
  5424. menu.velocity({
  5425. 'translateX': [-1 * options.menuWidth - 10, leftPos]
  5426. }, {
  5427. duration: 200,
  5428. queue: false,
  5429. easing: 'easeOutQuad'
  5430. });
  5431. $overlay.velocity({
  5432. opacity: 0
  5433. }, {
  5434. duration: 200,
  5435. queue: false,
  5436. easing: 'easeOutQuad',
  5437. complete: function () {
  5438. // Run 'onClose' when sidenav is closed via touch/swipe if applicable
  5439. if (typeof options.onClose === 'function') {
  5440. options.onClose.call(this, menu);
  5441. }
  5442. $(this).remove();
  5443. }
  5444. });
  5445. $dragTarget.css({
  5446. width: '10px',
  5447. right: '',
  5448. left: 0
  5449. });
  5450. }
  5451. } else {
  5452. if (menuOut && velocityX >= -0.3 || velocityX > 0.5) {
  5453. // Return menu to open
  5454. if (rightPos !== 0) {
  5455. menu.velocity({
  5456. 'translateX': [0, rightPos]
  5457. }, {
  5458. duration: 300,
  5459. queue: false,
  5460. easing: 'easeOutQuad'
  5461. });
  5462. }
  5463. $overlay.velocity({
  5464. opacity: 1
  5465. }, {
  5466. duration: 50,
  5467. queue: false,
  5468. easing: 'easeOutQuad'
  5469. });
  5470. $dragTarget.css({
  5471. width: '50%',
  5472. right: '',
  5473. left: 0
  5474. });
  5475. menuOut = true;
  5476. } else if (!menuOut || velocityX < -0.3) {
  5477. // Enable Scrolling
  5478. $('body').css({
  5479. overflow: '',
  5480. width: ''
  5481. });
  5482. // Slide menu closed
  5483. menu.velocity({
  5484. 'translateX': [options.menuWidth + 10, rightPos]
  5485. }, {
  5486. duration: 200,
  5487. queue: false,
  5488. easing: 'easeOutQuad'
  5489. });
  5490. $overlay.velocity({
  5491. opacity: 0
  5492. }, {
  5493. duration: 200,
  5494. queue: false,
  5495. easing: 'easeOutQuad',
  5496. complete: function () {
  5497. // Run 'onClose' when sidenav is closed via touch/swipe if applicable
  5498. if (typeof options.onClose === 'function') {
  5499. options.onClose.call(this, menu);
  5500. }
  5501. $(this).remove();
  5502. }
  5503. });
  5504. $dragTarget.css({
  5505. width: '10px',
  5506. right: 0,
  5507. left: ''
  5508. });
  5509. }
  5510. }
  5511. }
  5512. });
  5513. }
  5514. $this.off('click.sidenav').on('click.sidenav', function () {
  5515. if (menuOut === true) {
  5516. menuOut = false;
  5517. panning = false;
  5518. removeMenu();
  5519. } else {
  5520. // Disable Scrolling
  5521. var $body = $('body');
  5522. var $overlay = $('<div id="sidenav-overlay"></div>');
  5523. var oldWidth = $body.innerWidth();
  5524. $body.css('overflow', 'hidden');
  5525. $body.width(oldWidth);
  5526. // Push current drag target on top of DOM tree
  5527. $('body').append($dragTarget);
  5528. if (options.edge === 'left') {
  5529. $dragTarget.css({
  5530. width: '50%',
  5531. right: 0,
  5532. left: ''
  5533. });
  5534. menu.velocity({
  5535. 'translateX': [0, -1 * options.menuWidth]
  5536. }, {
  5537. duration: 300,
  5538. queue: false,
  5539. easing: 'easeOutQuad'
  5540. });
  5541. } else {
  5542. $dragTarget.css({
  5543. width: '50%',
  5544. right: '',
  5545. left: 0
  5546. });
  5547. menu.velocity({
  5548. 'translateX': [0, options.menuWidth]
  5549. }, {
  5550. duration: 300,
  5551. queue: false,
  5552. easing: 'easeOutQuad'
  5553. });
  5554. }
  5555. // Overlay close on click
  5556. $overlay.css('opacity', 0).click(function () {
  5557. menuOut = false;
  5558. panning = false;
  5559. removeMenu();
  5560. $overlay.velocity({
  5561. opacity: 0
  5562. }, {
  5563. duration: 300,
  5564. queue: false,
  5565. easing: 'easeOutQuad',
  5566. complete: function () {
  5567. $(this).remove();
  5568. }
  5569. });
  5570. });
  5571. // Append body
  5572. $('body').append($overlay);
  5573. $overlay.velocity({
  5574. opacity: 1
  5575. }, {
  5576. duration: 300,
  5577. queue: false,
  5578. easing: 'easeOutQuad',
  5579. complete: function () {
  5580. menuOut = true;
  5581. panning = false;
  5582. }
  5583. });
  5584. // Callback
  5585. if (typeof options.onOpen === 'function') {
  5586. options.onOpen.call(this, menu);
  5587. }
  5588. }
  5589. return false;
  5590. });
  5591. });
  5592. },
  5593. destroy: function () {
  5594. var $overlay = $('#sidenav-overlay');
  5595. var $dragTarget = $('.drag-target[data-sidenav="' + $(this).attr('data-activates') + '"]');
  5596. $overlay.trigger('click');
  5597. $dragTarget.remove();
  5598. $(this).off('click');
  5599. $overlay.remove();
  5600. },
  5601. show: function () {
  5602. this.trigger('click');
  5603. },
  5604. hide: function () {
  5605. $('#sidenav-overlay').trigger('click');
  5606. }
  5607. };
  5608. $.fn.sideNav = function (methodOrOptions) {
  5609. if (methods[methodOrOptions]) {
  5610. return methods[methodOrOptions].apply(this, Array.prototype.slice.call(arguments, 1));
  5611. } else if (typeof methodOrOptions === 'object' || !methodOrOptions) {
  5612. // Default to "init"
  5613. return methods.init.apply(this, arguments);
  5614. } else {
  5615. $.error('Method ' + methodOrOptions + ' does not exist on jQuery.sideNav');
  5616. }
  5617. }
  5618. ;
  5619. // Plugin end
  5620. }
  5621. )(jQuery);
  5622. ;/**
  5623. * Extend jquery with a scrollspy plugin.
  5624. * This watches the window scroll and fires events when elements are scrolled into viewport.
  5625. *
  5626. * throttle() and getTime() taken from Underscore.js
  5627. * https://github.com/jashkenas/underscore
  5628. *
  5629. * @author Copyright 2013 John Smart
  5630. * @license https://raw.github.com/thesmart/jquery-scrollspy/master/LICENSE
  5631. * @see https://github.com/thesmart
  5632. * @version 0.1.2
  5633. */
  5634. (function ($) {
  5635. var jWindow = $(window);
  5636. var elements = [];
  5637. var elementsInView = [];
  5638. var isSpying = false;
  5639. var ticks = 0;
  5640. var unique_id = 1;
  5641. var offset = {
  5642. top: 0,
  5643. right: 0,
  5644. bottom: 0,
  5645. left: 0
  5646. /**
  5647. * Find elements that are within the boundary
  5648. * @param {number} top
  5649. * @param {number} right
  5650. * @param {number} bottom
  5651. * @param {number} left
  5652. * @return {jQuery} A collection of elements
  5653. */
  5654. };
  5655. function findElements(top, right, bottom, left) {
  5656. var hits = $();
  5657. $.each(elements, function (i, element) {
  5658. if (element.height() > 0) {
  5659. var elTop = element.offset().top
  5660. , elLeft = element.offset().left
  5661. , elRight = elLeft + element.width()
  5662. , elBottom = elTop + element.height();
  5663. var isIntersect = !(elLeft > right || elRight < left || elTop > bottom || elBottom < top);
  5664. if (isIntersect) {
  5665. hits.push(element);
  5666. }
  5667. }
  5668. });
  5669. return hits;
  5670. }
  5671. /**
  5672. * Called when the user scrolls the window
  5673. */
  5674. function onScroll(scrollOffset) {
  5675. // unique tick id
  5676. ++ticks;
  5677. // viewport rectangle
  5678. var top = jWindow.scrollTop()
  5679. , left = jWindow.scrollLeft()
  5680. , right = left + jWindow.width()
  5681. , bottom = top + jWindow.height();
  5682. // determine which elements are in view
  5683. var intersections = findElements(top + offset.top + scrollOffset || 200, right + offset.right, bottom + offset.bottom, left + offset.left);
  5684. $.each(intersections, function (i, element) {
  5685. var lastTick = element.data('scrollSpy:ticks');
  5686. if (typeof lastTick != 'number') {
  5687. // entered into view
  5688. element.triggerHandler('scrollSpy:enter');
  5689. }
  5690. // update tick id
  5691. element.data('scrollSpy:ticks', ticks);
  5692. });
  5693. // determine which elements are no longer in view
  5694. $.each(elementsInView, function (i, element) {
  5695. var lastTick = element.data('scrollSpy:ticks');
  5696. if (typeof lastTick == 'number' && lastTick !== ticks) {
  5697. // exited from view
  5698. element.triggerHandler('scrollSpy:exit');
  5699. element.data('scrollSpy:ticks', null);
  5700. }
  5701. });
  5702. // remember elements in view for next tick
  5703. elementsInView = intersections;
  5704. }
  5705. /**
  5706. * Called when window is resized
  5707. */
  5708. function onWinSize() {
  5709. jWindow.trigger('scrollSpy:winSize');
  5710. }
  5711. /**
  5712. * Enables ScrollSpy using a selector
  5713. * @param {jQuery|string} selector The elements collection, or a selector
  5714. * @param {Object=} options Optional.
  5715. throttle : number -> scrollspy throttling. Default: 100 ms
  5716. offsetTop : number -> offset from top. Default: 0
  5717. offsetRight : number -> offset from right. Default: 0
  5718. offsetBottom : number -> offset from bottom. Default: 0
  5719. offsetLeft : number -> offset from left. Default: 0
  5720. activeClass : string -> Class name to be added to the active link. Default: active
  5721. * @returns {jQuery}
  5722. */
  5723. $.scrollSpy = function (selector, options) {
  5724. var defaults = {
  5725. throttle: 100,
  5726. scrollOffset: 200,
  5727. // offset - 200 allows elements near bottom of page to scroll
  5728. activeClass: 'active',
  5729. getActiveElement: function (id) {
  5730. return 'a[href="#' + id + '"]';
  5731. }
  5732. };
  5733. options = $.extend(defaults, options);
  5734. var visible = [];
  5735. selector = $(selector);
  5736. selector.each(function (i, element) {
  5737. elements.push($(element));
  5738. $(element).data("scrollSpy:id", i);
  5739. // Smooth scroll to section
  5740. $('a[href="#' + $(element).attr('id') + '"]').click(function (e) {
  5741. e.preventDefault();
  5742. var offset = $(Materialize.escapeHash(this.hash)).offset().top + 1;
  5743. $('html, body').animate({
  5744. scrollTop: offset - options.scrollOffset
  5745. }, {
  5746. duration: 400,
  5747. queue: false,
  5748. easing: 'easeOutCubic'
  5749. });
  5750. });
  5751. });
  5752. offset.top = options.offsetTop || 0;
  5753. offset.right = options.offsetRight || 0;
  5754. offset.bottom = options.offsetBottom || 0;
  5755. offset.left = options.offsetLeft || 0;
  5756. var throttledScroll = Materialize.throttle(function () {
  5757. onScroll(options.scrollOffset);
  5758. }, options.throttle || 100);
  5759. var readyScroll = function () {
  5760. $(document).ready(throttledScroll);
  5761. };
  5762. if (!isSpying) {
  5763. jWindow.on('scroll', readyScroll);
  5764. jWindow.on('resize', readyScroll);
  5765. isSpying = true;
  5766. }
  5767. // perform a scan once, after current execution context, and after dom is ready
  5768. setTimeout(readyScroll, 0);
  5769. selector.on('scrollSpy:enter', function () {
  5770. visible = $.grep(visible, function (value) {
  5771. return value.height() != 0;
  5772. });
  5773. var $this = $(this);
  5774. if (visible[0]) {
  5775. $(options.getActiveElement(visible[0].attr('id'))).removeClass(options.activeClass);
  5776. if ($this.data('scrollSpy:id') < visible[0].data('scrollSpy:id')) {
  5777. visible.unshift($(this));
  5778. } else {
  5779. visible.push($(this));
  5780. }
  5781. } else {
  5782. visible.push($(this));
  5783. }
  5784. $(options.getActiveElement(visible[0].attr('id'))).addClass(options.activeClass);
  5785. });
  5786. selector.on('scrollSpy:exit', function () {
  5787. visible = $.grep(visible, function (value) {
  5788. return value.height() != 0;
  5789. });
  5790. if (visible[0]) {
  5791. $(options.getActiveElement(visible[0].attr('id'))).removeClass(options.activeClass);
  5792. var $this = $(this);
  5793. visible = $.grep(visible, function (value) {
  5794. return value.attr('id') != $this.attr('id');
  5795. });
  5796. if (visible[0]) {
  5797. // Check if empty
  5798. $(options.getActiveElement(visible[0].attr('id'))).addClass(options.activeClass);
  5799. }
  5800. }
  5801. });
  5802. return selector;
  5803. }
  5804. ;
  5805. /**
  5806. * Listen for window resize events
  5807. * @param {Object=} options Optional. Set { throttle: number } to change throttling. Default: 100 ms
  5808. * @returns {jQuery} $(window)
  5809. */
  5810. $.winSizeSpy = function (options) {
  5811. $.winSizeSpy = function () {
  5812. return jWindow;
  5813. }
  5814. ;
  5815. // lock from multiple calls
  5816. options = options || {
  5817. throttle: 100
  5818. };
  5819. return jWindow.on('resize', Materialize.throttle(onWinSize, options.throttle || 100));
  5820. }
  5821. ;
  5822. /**
  5823. * Enables ScrollSpy on a collection of elements
  5824. * e.g. $('.scrollSpy').scrollSpy()
  5825. * @param {Object=} options Optional.
  5826. throttle : number -> scrollspy throttling. Default: 100 ms
  5827. offsetTop : number -> offset from top. Default: 0
  5828. offsetRight : number -> offset from right. Default: 0
  5829. offsetBottom : number -> offset from bottom. Default: 0
  5830. offsetLeft : number -> offset from left. Default: 0
  5831. * @returns {jQuery}
  5832. */
  5833. $.fn.scrollSpy = function (options) {
  5834. return $.scrollSpy($(this), options);
  5835. }
  5836. ;
  5837. }
  5838. )(jQuery);
  5839. ; (function ($) {
  5840. $(document).ready(function () {
  5841. // Function to update labels of text fields
  5842. Materialize.updateTextFields = function () {
  5843. 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';
  5844. $(input_selector).each(function (index, element) {
  5845. var $this = $(this);
  5846. if ($(element).val().length > 0 || $(element).is(':focus') || element.autofocus || $this.attr('placeholder') !== undefined) {
  5847. $this.siblings('label').addClass('active');
  5848. } else if ($(element)[0].validity) {
  5849. $this.siblings('label').toggleClass('active', $(element)[0].validity.badInput === true);
  5850. } else {
  5851. $this.siblings('label').removeClass('active');
  5852. }
  5853. });
  5854. }
  5855. ;
  5856. // Text based inputs
  5857. 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';
  5858. // Add active if form auto complete
  5859. $(document).on('change', input_selector, function () {
  5860. if ($(this).val().length !== 0 || $(this).attr('placeholder') !== undefined) {
  5861. $(this).siblings('label').addClass('active');
  5862. }
  5863. validate_field($(this));
  5864. });
  5865. // Add active if input element has been pre-populated on document ready
  5866. $(document).ready(function () {
  5867. Materialize.updateTextFields();
  5868. });
  5869. // HTML DOM FORM RESET handling
  5870. $(document).on('reset', function (e) {
  5871. var formReset = $(e.target);
  5872. if (formReset.is('form')) {
  5873. formReset.find(input_selector).removeClass('valid').removeClass('invalid');
  5874. formReset.find(input_selector).each(function () {
  5875. if ($(this).attr('value') === '') {
  5876. $(this).siblings('label').removeClass('active');
  5877. }
  5878. });
  5879. // Reset select
  5880. formReset.find('select.initialized').each(function () {
  5881. var reset_text = formReset.find('option[selected]').text();
  5882. formReset.siblings('input.select-dropdown').val(reset_text);
  5883. });
  5884. }
  5885. });
  5886. // Add active when element has focus
  5887. $(document).on('focus', input_selector, function () {
  5888. $(this).siblings('label, .prefix').addClass('active');
  5889. });
  5890. $(document).on('blur', input_selector, function () {
  5891. var $inputElement = $(this);
  5892. var selector = ".prefix";
  5893. if ($inputElement.val().length === 0 && $inputElement[0].validity.badInput !== true && $inputElement.attr('placeholder') === undefined) {
  5894. selector += ", label";
  5895. }
  5896. $inputElement.siblings(selector).removeClass('active');
  5897. validate_field($inputElement);
  5898. });
  5899. window.validate_field = function (object) {
  5900. var hasLength = object.attr('data-length') !== undefined;
  5901. var lenAttr = parseInt(object.attr('data-length'));
  5902. var len = object.val().length;
  5903. if (object.val().length === 0 && object[0].validity.badInput === false && !object.is(':required')) {
  5904. if (object.hasClass('validate')) {
  5905. object.removeClass('valid');
  5906. object.removeClass('invalid');
  5907. }
  5908. } else {
  5909. if (object.hasClass('validate')) {
  5910. // Check for character counter attributes
  5911. if (object.is(':valid') && hasLength && len <= lenAttr || object.is(':valid') && !hasLength) {
  5912. object.removeClass('invalid');
  5913. object.addClass('valid');
  5914. } else {
  5915. object.removeClass('valid');
  5916. object.addClass('invalid');
  5917. }
  5918. }
  5919. }
  5920. }
  5921. ;
  5922. // Radio and Checkbox focus class
  5923. var radio_checkbox = 'input[type=radio], input[type=checkbox]';
  5924. $(document).on('keyup.radio', radio_checkbox, function (e) {
  5925. // TAB, check if tabbing to radio or checkbox.
  5926. if (e.which === 9) {
  5927. $(this).addClass('tabbed');
  5928. var $this = $(this);
  5929. $this.one('blur', function (e) {
  5930. $(this).removeClass('tabbed');
  5931. });
  5932. return;
  5933. }
  5934. });
  5935. // Textarea Auto Resize
  5936. var hiddenDiv = $('.hiddendiv').first();
  5937. if (!hiddenDiv.length) {
  5938. hiddenDiv = $('<div class="hiddendiv common"></div>');
  5939. $('body').append(hiddenDiv);
  5940. }
  5941. var text_area_selector = '.materialize-textarea';
  5942. function textareaAutoResize($textarea) {
  5943. // Set font properties of hiddenDiv
  5944. var fontFamily = $textarea.css('font-family');
  5945. var fontSize = $textarea.css('font-size');
  5946. var lineHeight = $textarea.css('line-height');
  5947. var padding = $textarea.css('padding');
  5948. if (fontSize) {
  5949. hiddenDiv.css('font-size', fontSize);
  5950. }
  5951. if (fontFamily) {
  5952. hiddenDiv.css('font-family', fontFamily);
  5953. }
  5954. if (lineHeight) {
  5955. hiddenDiv.css('line-height', lineHeight);
  5956. }
  5957. if (padding) {
  5958. hiddenDiv.css('padding', padding);
  5959. }
  5960. // Set original-height, if none
  5961. if (!$textarea.data('original-height')) {
  5962. $textarea.data('original-height', $textarea.height());
  5963. }
  5964. if ($textarea.attr('wrap') === 'off') {
  5965. hiddenDiv.css('overflow-wrap', 'normal').css('white-space', 'pre');
  5966. }
  5967. hiddenDiv.text($textarea.val() + '\n');
  5968. var content = hiddenDiv.html().replace(/\n/g, '<br>');
  5969. hiddenDiv.html(content);
  5970. // When textarea is hidden, width goes crazy.
  5971. // Approximate with half of window size
  5972. if ($textarea.is(':visible')) {
  5973. hiddenDiv.css('width', $textarea.width());
  5974. } else {
  5975. hiddenDiv.css('width', $(window).width() / 2);
  5976. }
  5977. /**
  5978. * Resize if the new height is greater than the
  5979. * original height of the textarea
  5980. */
  5981. if ($textarea.data('original-height') <= hiddenDiv.height()) {
  5982. $textarea.css('height', hiddenDiv.height());
  5983. } else if ($textarea.val().length < $textarea.data('previous-length')) {
  5984. /**
  5985. * In case the new height is less than original height, it
  5986. * means the textarea has less text than before
  5987. * So we set the height to the original one
  5988. */
  5989. $textarea.css('height', $textarea.data('original-height'));
  5990. }
  5991. $textarea.data('previous-length', $textarea.val().length);
  5992. }
  5993. $(text_area_selector).each(function () {
  5994. var $textarea = $(this);
  5995. /**
  5996. * Instead of resizing textarea on document load,
  5997. * store the original height and the original length
  5998. */
  5999. $textarea.data('original-height', $textarea.height());
  6000. $textarea.data('previous-length', $textarea.val().length);
  6001. });
  6002. $('body').on('keyup keydown autoresize', text_area_selector, function () {
  6003. textareaAutoResize($(this));
  6004. });
  6005. // File Input Path
  6006. $(document).on('change', '.file-field input[type="file"]', function () {
  6007. var file_field = $(this).closest('.file-field');
  6008. var path_input = file_field.find('input.file-path');
  6009. var files = $(this)[0].files;
  6010. var file_names = [];
  6011. for (var i = 0; i < files.length; i++) {
  6012. file_names.push(files[i].name);
  6013. }
  6014. path_input.val(file_names.join(", "));
  6015. path_input.trigger('change');
  6016. });
  6017. /****************
  6018. * Range Input *
  6019. ****************/
  6020. var range_type = 'input[type=range]';
  6021. var range_mousedown = false;
  6022. var left;
  6023. $(range_type).each(function () {
  6024. var thumb = $('<span class="thumb"><span class="value"></span></span>');
  6025. $(this).after(thumb);
  6026. });
  6027. var showRangeBubble = function (thumb) {
  6028. var paddingLeft = parseInt(thumb.parent().css('padding-left'));
  6029. var marginLeft = -7 + paddingLeft + 'px';
  6030. thumb.velocity({
  6031. height: "30px",
  6032. width: "30px",
  6033. top: "-30px",
  6034. marginLeft: marginLeft
  6035. }, {
  6036. duration: 300,
  6037. easing: 'easeOutExpo'
  6038. });
  6039. };
  6040. var calcRangeOffset = function (range) {
  6041. var width = range.width() - 15;
  6042. var max = parseFloat(range.attr('max'));
  6043. var min = parseFloat(range.attr('min'));
  6044. var percent = (parseFloat(range.val()) - min) / (max - min);
  6045. return percent * width;
  6046. };
  6047. var range_wrapper = '.range-field';
  6048. $(document).on('change', range_type, function (e) {
  6049. var thumb = $(this).siblings('.thumb');
  6050. thumb.find('.value').html($(this).val());
  6051. if (!thumb.hasClass('active')) {
  6052. showRangeBubble(thumb);
  6053. }
  6054. var offsetLeft = calcRangeOffset($(this));
  6055. thumb.addClass('active').css('left', offsetLeft);
  6056. });
  6057. $(document).on('mousedown touchstart', range_type, function (e) {
  6058. var thumb = $(this).siblings('.thumb');
  6059. // If thumb indicator does not exist yet, create it
  6060. if (thumb.length <= 0) {
  6061. thumb = $('<span class="thumb"><span class="value"></span></span>');
  6062. $(this).after(thumb);
  6063. }
  6064. // Set indicator value
  6065. thumb.find('.value').html($(this).val());
  6066. range_mousedown = true;
  6067. $(this).addClass('active');
  6068. if (!thumb.hasClass('active')) {
  6069. showRangeBubble(thumb);
  6070. }
  6071. if (e.type !== 'input') {
  6072. var offsetLeft = calcRangeOffset($(this));
  6073. thumb.addClass('active').css('left', offsetLeft);
  6074. }
  6075. });
  6076. $(document).on('mouseup touchend', range_wrapper, function () {
  6077. range_mousedown = false;
  6078. $(this).removeClass('active');
  6079. });
  6080. $(document).on('input mousemove touchmove', range_wrapper, function (e) {
  6081. var thumb = $(this).children('.thumb');
  6082. var left;
  6083. var input = $(this).find(range_type);
  6084. if (range_mousedown) {
  6085. if (!thumb.hasClass('active')) {
  6086. showRangeBubble(thumb);
  6087. }
  6088. var offsetLeft = calcRangeOffset(input);
  6089. thumb.addClass('active').css('left', offsetLeft);
  6090. thumb.find('.value').html(thumb.siblings(range_type).val());
  6091. }
  6092. });
  6093. $(document).on('mouseout touchleave', range_wrapper, function () {
  6094. if (!range_mousedown) {
  6095. var thumb = $(this).children('.thumb');
  6096. var paddingLeft = parseInt($(this).css('padding-left'));
  6097. var marginLeft = 7 + paddingLeft + 'px';
  6098. if (thumb.hasClass('active')) {
  6099. thumb.velocity({
  6100. height: '0',
  6101. width: '0',
  6102. top: '10px',
  6103. marginLeft: marginLeft
  6104. }, {
  6105. duration: 100
  6106. });
  6107. }
  6108. thumb.removeClass('active');
  6109. }
  6110. });
  6111. /**************************
  6112. * Auto complete plugin *
  6113. *************************/
  6114. $.fn.autocomplete = function (options) {
  6115. // Defaults
  6116. var defaults = {
  6117. data: {},
  6118. limit: Infinity,
  6119. onAutocomplete: null,
  6120. minLength: 1
  6121. };
  6122. options = $.extend(defaults, options);
  6123. return this.each(function () {
  6124. var $input = $(this);
  6125. var data = options.data, count = 0, activeIndex = -1, oldVal, $inputDiv = $input.closest('.input-field');
  6126. // Div to append on
  6127. // Check if data isn't empty
  6128. if (!$.isEmptyObject(data)) {
  6129. var $autocomplete = $('<ul class="autocomplete-content dropdown-content"></ul>');
  6130. var $oldAutocomplete;
  6131. // Append autocomplete element.
  6132. // Prevent double structure init.
  6133. if ($inputDiv.length) {
  6134. $oldAutocomplete = $inputDiv.children('.autocomplete-content.dropdown-content').first();
  6135. if (!$oldAutocomplete.length) {
  6136. $inputDiv.append($autocomplete);
  6137. // Set ul in body
  6138. }
  6139. } else {
  6140. $oldAutocomplete = $input.next('.autocomplete-content.dropdown-content');
  6141. if (!$oldAutocomplete.length) {
  6142. $input.after($autocomplete);
  6143. }
  6144. }
  6145. if ($oldAutocomplete.length) {
  6146. $autocomplete = $oldAutocomplete;
  6147. }
  6148. // Highlight partial match.
  6149. var highlight = function (string, $el) {
  6150. var img = $el.find('img');
  6151. var matchStart = $el.text().toLowerCase().indexOf("" + string.toLowerCase() + "")
  6152. , matchEnd = matchStart + string.length - 1
  6153. , beforeMatch = $el.text().slice(0, matchStart)
  6154. , matchText = $el.text().slice(matchStart, matchEnd + 1)
  6155. , afterMatch = $el.text().slice(matchEnd + 1);
  6156. $el.html("<span>" + beforeMatch + "<span class='highlight'>" + matchText + "</span>" + afterMatch + "</span>");
  6157. if (img.length) {
  6158. $el.prepend(img);
  6159. }
  6160. };
  6161. // Reset current element position
  6162. var resetCurrentElement = function () {
  6163. activeIndex = -1;
  6164. $autocomplete.find('.active').removeClass('active');
  6165. };
  6166. // Remove autocomplete elements
  6167. var removeAutocomplete = function () {
  6168. $autocomplete.empty();
  6169. resetCurrentElement();
  6170. oldVal = undefined;
  6171. };
  6172. $input.off('blur.autocomplete').on('blur.autocomplete', function () {
  6173. removeAutocomplete();
  6174. });
  6175. // Perform search
  6176. $input.off('keyup.autocomplete focus.autocomplete').on('keyup.autocomplete focus.autocomplete', function (e) {
  6177. // Reset count.
  6178. count = 0;
  6179. var val = $input.val().toLowerCase();
  6180. // Don't capture enter or arrow key usage.
  6181. if (e.which === 13 || e.which === 38 || e.which === 40) {
  6182. return;
  6183. }
  6184. // Check if the input isn't empty
  6185. if (oldVal !== val) {
  6186. removeAutocomplete();
  6187. if (val.length >= options.minLength) {
  6188. for (var key in data) {
  6189. if (data.hasOwnProperty(key) && key.toLowerCase().indexOf(val) !== -1) {
  6190. // Break if past limit
  6191. if (count >= options.limit) {
  6192. break;
  6193. }
  6194. var autocompleteOption = $('<li></li>');
  6195. if (!!data[key]) {
  6196. autocompleteOption.append('<img src="' + data[key] + '" class="right circle"><span>' + key + '</span>');
  6197. } else {
  6198. autocompleteOption.append('<span>' + key + '</span>');
  6199. }
  6200. $autocomplete.append(autocompleteOption);
  6201. highlight(val, autocompleteOption);
  6202. count++;
  6203. }
  6204. }
  6205. }
  6206. }
  6207. // Update oldVal
  6208. oldVal = val;
  6209. });
  6210. $input.off('keydown.autocomplete').on('keydown.autocomplete', function (e) {
  6211. // Arrow keys and enter key usage
  6212. var keyCode = e.which, liElement, numItems = $autocomplete.children('li').length, $active = $autocomplete.children('.active').first();
  6213. // select element on Enter
  6214. if (keyCode === 13 && activeIndex >= 0) {
  6215. liElement = $autocomplete.children('li').eq(activeIndex);
  6216. if (liElement.length) {
  6217. liElement.trigger('mousedown.autocomplete');
  6218. e.preventDefault();
  6219. }
  6220. return;
  6221. }
  6222. // Capture up and down key
  6223. if (keyCode === 38 || keyCode === 40) {
  6224. e.preventDefault();
  6225. if (keyCode === 38 && activeIndex > 0) {
  6226. activeIndex--;
  6227. }
  6228. if (keyCode === 40 && activeIndex < numItems - 1) {
  6229. activeIndex++;
  6230. }
  6231. $active.removeClass('active');
  6232. if (activeIndex >= 0) {
  6233. $autocomplete.children('li').eq(activeIndex).addClass('active');
  6234. }
  6235. }
  6236. });
  6237. // Set input value
  6238. $autocomplete.off('mousedown.autocomplete touchstart.autocomplete').on('mousedown.autocomplete touchstart.autocomplete', 'li', function () {
  6239. var text = $(this).text().trim();
  6240. $input.val(text);
  6241. $input.trigger('change');
  6242. removeAutocomplete();
  6243. // Handle onAutocomplete callback.
  6244. if (typeof options.onAutocomplete === "function") {
  6245. options.onAutocomplete.call(this, text);
  6246. }
  6247. });
  6248. // Empty data
  6249. } else {
  6250. $input.off('keyup.autocomplete focus.autocomplete');
  6251. }
  6252. });
  6253. }
  6254. ;
  6255. });
  6256. // End of $(document).ready
  6257. /*******************
  6258. * Select Plugin *
  6259. ******************/
  6260. $.fn.material_select = function (callback) {
  6261. $(this).each(function () {
  6262. var $select = $(this);
  6263. if ($select.hasClass('browser-default')) {
  6264. return;
  6265. // Continue to next (return false breaks out of entire loop)
  6266. }
  6267. var multiple = $select.attr('multiple') ? true : false
  6268. , lastID = $select.attr('data-select-id');
  6269. // Tear down structure if Select needs to be rebuilt
  6270. if (lastID) {
  6271. $select.parent().find('span.caret').remove();
  6272. $select.parent().find('input').remove();
  6273. $select.unwrap();
  6274. $('ul#select-options-' + lastID).remove();
  6275. }
  6276. // If destroying the select, remove the selelct-id and reset it to it's uninitialized state.
  6277. if (callback === 'destroy') {
  6278. $select.removeAttr('data-select-id').removeClass('initialized');
  6279. $(window).off('click.select');
  6280. return;
  6281. }
  6282. var uniqueID = Materialize.guid();
  6283. $select.attr('data-select-id', uniqueID);
  6284. var wrapper = $('<div class="select-wrapper"></div>');
  6285. wrapper.addClass($select.attr('class'));
  6286. if ($select.is(':disabled'))
  6287. wrapper.addClass('disabled');
  6288. var options = $('<ul id="select-options-' + uniqueID + '" class="dropdown-content select-dropdown ' + (multiple ? 'multiple-select-dropdown' : '') + '"></ul>')
  6289. , selectChildren = $select.children('option, optgroup')
  6290. , valuesSelected = []
  6291. , optionsHover = false;
  6292. var label = $select.find('option:selected').html() || $select.find('option:first').html() || "";
  6293. var statusText = $("#status_txt").text();
  6294. var a = " disabled"
  6295. var a1 = $("#send_file")[0];
  6296. var a2 = $("#qiehuanbtn")[0];
  6297. var a3 = $("#send_string")[0];
  6298. var a4 = $("#uploadpy")[0];
  6299. var a5 = $('#resetMainUIBtn')[0];
  6300. if (label == CCB.str_group.no_port_option || (statusText.indexOf(Ardublockly.LOCALISED_TEXT.statusbar) == -1
  6301. && statusText.indexOf(CCB.str_group.upload_success) == -1 && statusText.indexOf(CCB.str_group.upload_fail) == -1) || !!!isgetmcnty) {
  6302. if (a1.className.indexOf("disabled") != -1) {
  6303. } else {
  6304. a1.className += a;
  6305. a2.className += a;
  6306. a3.className += a;
  6307. a4.className += a;
  6308. a5.className += a;
  6309. $("#updatePython").attr("href", "javascript:;");
  6310. $("#updatePython").css("display", "none");
  6311. if(statusText.indexOf(CCB.str_group.uploading) == -1) {
  6312. $(".determinate").css("width","0px");
  6313. }
  6314. }
  6315. } else if (label != CCB.str_group.no_port_option && !!isgetmcnty && (statusText.indexOf(Ardublockly.LOCALISED_TEXT.statusbar) != -1 || statusText.indexOf(CCB.str_group.upload_success) != -1 || statusText.indexOf(CCB.str_group.upload_fail) != -1)) {
  6316. a1.className = a1.className.replace(a, "");
  6317. a2.className = a2.className.replace(a, "");
  6318. a3.className = a3.className.replace(a, "");
  6319. a4.className = a4.className.replace(a, "");
  6320. a5.className = a5.className.replace(a, "");
  6321. $("#updatePython").attr("href", "#updatePy");
  6322. $("#updatePython").css("display", "block");
  6323. }
  6324. // Function that renders and appends the option taking into
  6325. // account type and possible image icon.
  6326. var appendOptionWithIcon = function (select, option, type) {
  6327. // Add disabled attr if disabled
  6328. var disabledClass = option.is(':disabled') ? 'disabled ' : '';
  6329. var optgroupClass = type === 'optgroup-option' ? 'optgroup-option ' : '';
  6330. var multipleCheckbox = multiple ? '<input type="checkbox"' + disabledClass + '/><label></label>' : '';
  6331. // add icons
  6332. var icon_url = option.data('icon');
  6333. var classes = option.attr('class');
  6334. if (!!icon_url) {
  6335. var classString = '';
  6336. if (!!classes)
  6337. classString = ' class="' + classes + '"';
  6338. // Check for multiple type.
  6339. options.append($('<li class="' + disabledClass + optgroupClass + '"><img alt="" src="' + icon_url + '"' + classString + '><span>' + multipleCheckbox + option.html() + '</span></li>'));
  6340. return true;
  6341. }
  6342. // Check for multiple type.
  6343. options.append($('<li class="' + disabledClass + optgroupClass + '"><span>' + multipleCheckbox + option.html() + '</span></li>'));
  6344. };
  6345. /* Create dropdown structure. */
  6346. if (selectChildren.length) {
  6347. selectChildren.each(function () {
  6348. if ($(this).is('option')) {
  6349. // Direct descendant option.
  6350. if (multiple) {
  6351. appendOptionWithIcon($select, $(this), 'multiple');
  6352. } else {
  6353. appendOptionWithIcon($select, $(this));
  6354. }
  6355. } else if ($(this).is('optgroup')) {
  6356. // Optgroup.
  6357. var selectOptions = $(this).children('option');
  6358. options.append($('<li class="optgroup"><span>' + $(this).attr('label') + '</span></li>'));
  6359. selectOptions.each(function () {
  6360. appendOptionWithIcon($select, $(this), 'optgroup-option');
  6361. });
  6362. }
  6363. });
  6364. }
  6365. options.find('li:not(.optgroup)').each(function (i) {
  6366. $(this).click(function (e) {
  6367. // Check if option element is disabled
  6368. if (!$(this).hasClass('disabled') && !$(this).hasClass('optgroup')) {
  6369. var selected = true;
  6370. if (multiple) {
  6371. $('input[type="checkbox"]', this).prop('checked', function (i, v) {
  6372. return !v;
  6373. });
  6374. selected = toggleEntryFromArray(valuesSelected, i, $select);
  6375. $newSelect.trigger('focus');
  6376. } else {
  6377. options.find('li').removeClass('active');
  6378. $(this).toggleClass('active');
  6379. $newSelect.val($(this).text());
  6380. }
  6381. activateOption(options, $(this));
  6382. $select.find('option').eq(i).prop('selected', selected);
  6383. // Trigger onchange() event
  6384. $select.trigger('change');
  6385. if (typeof callback !== 'undefined')
  6386. callback();
  6387. }
  6388. e.stopPropagation();
  6389. });
  6390. });
  6391. // Wrap Elements
  6392. $select.wrap(wrapper);
  6393. // Add Select Display Element
  6394. var dropdownIcon = $('<span class="caret">&#9660;</span>');
  6395. // escape double quotes
  6396. var sanitizedLabelHtml = label.replace(/"/g, '&quot;');
  6397. var $newSelect = $('<input type="text" class="select-dropdown" readonly="true" ' + ($select.is(':disabled') ? 'disabled' : '') + ' data-activates="select-options-' + uniqueID + '" value="' + sanitizedLabelHtml + '"/>');
  6398. $select.before($newSelect);
  6399. $newSelect.before(dropdownIcon);
  6400. $newSelect.after(options);
  6401. // Check if section element is disabled
  6402. if (!$select.is(':disabled')) {
  6403. $newSelect.dropdown({
  6404. 'hover': false
  6405. });
  6406. }
  6407. // Copy tabindex
  6408. if ($select.attr('tabindex')) {
  6409. $($newSelect[0]).attr('tabindex', $select.attr('tabindex'));
  6410. }
  6411. $select.addClass('initialized');
  6412. $newSelect.on({
  6413. 'focus': function () {
  6414. if ($('ul.select-dropdown').not(options[0]).is(':visible')) {
  6415. $('input.select-dropdown').trigger('close');
  6416. $(window).off('click.select');
  6417. }
  6418. if (!options.is(':visible')) {
  6419. $(this).trigger('open', ['focus']);
  6420. var label = $(this).val();
  6421. if (multiple && label.indexOf(',') >= 0) {
  6422. label = label.split(',')[0];
  6423. }
  6424. var selectedOption = options.find('li').filter(function () {
  6425. return $(this).text().toLowerCase() === label.toLowerCase();
  6426. })[0];
  6427. activateOption(options, selectedOption, true);
  6428. $(window).off('click.select').on('click.select', function () {
  6429. multiple && (optionsHover || $newSelect.trigger('close'));
  6430. $(window).off('click.select');
  6431. });
  6432. }
  6433. },
  6434. 'click': function (e) {
  6435. e.stopPropagation();
  6436. }
  6437. });
  6438. $newSelect.on('blur', function () {
  6439. if (!multiple) {
  6440. $(this).trigger('close');
  6441. $(window).off('click.select');
  6442. }
  6443. options.find('li.selected').removeClass('selected');
  6444. });
  6445. options.hover(function () {
  6446. optionsHover = true;
  6447. }, function () {
  6448. optionsHover = false;
  6449. });
  6450. // Add initial multiple selections.
  6451. if (multiple) {
  6452. $select.find("option:selected:not(:disabled)").each(function () {
  6453. var index = this.index;
  6454. toggleEntryFromArray(valuesSelected, index, $select);
  6455. options.find("li:not(.optgroup)").eq(index).find(":checkbox").prop("checked", true);
  6456. });
  6457. }
  6458. /**
  6459. * Make option as selected and scroll to selected position
  6460. * @param {jQuery} collection Select options jQuery element
  6461. * @param {Element} newOption element of the new option
  6462. * @param {Boolean} firstActivation If on first activation of select
  6463. */
  6464. var activateOption = function (collection, newOption, firstActivation) {
  6465. if (newOption) {
  6466. collection.find('li.selected').removeClass('selected');
  6467. var option = $(newOption);
  6468. option.addClass('selected');
  6469. if (!multiple || !!firstActivation) {
  6470. options.scrollTo(option);
  6471. }
  6472. }
  6473. };
  6474. // Allow user to search by typing
  6475. // this array is cleared after 1 second
  6476. var filterQuery = []
  6477. , onKeyDown = function (e) {
  6478. // TAB - switch to another input
  6479. if (e.which == 9) {
  6480. $newSelect.trigger('close');
  6481. return;
  6482. }
  6483. // ARROW DOWN WHEN SELECT IS CLOSED - open select options
  6484. if (e.which == 40 && !options.is(':visible')) {
  6485. $newSelect.trigger('open');
  6486. return;
  6487. }
  6488. // ENTER WHEN SELECT IS CLOSED - submit form
  6489. if (e.which == 13 && !options.is(':visible')) {
  6490. return;
  6491. }
  6492. e.preventDefault();
  6493. // CASE WHEN USER TYPE LETTERS
  6494. var letter = String.fromCharCode(e.which).toLowerCase()
  6495. , nonLetters = [9, 13, 27, 38, 40];
  6496. if (letter && nonLetters.indexOf(e.which) === -1) {
  6497. filterQuery.push(letter);
  6498. var string = filterQuery.join('')
  6499. , newOption = options.find('li').filter(function () {
  6500. return $(this).text().toLowerCase().indexOf(string) === 0;
  6501. })[0];
  6502. if (newOption) {
  6503. activateOption(options, newOption);
  6504. }
  6505. }
  6506. // ENTER - select option and close when select options are opened
  6507. if (e.which == 13) {
  6508. var activeOption = options.find('li.selected:not(.disabled)')[0];
  6509. if (activeOption) {
  6510. $(activeOption).trigger('click');
  6511. if (!multiple) {
  6512. $newSelect.trigger('close');
  6513. }
  6514. }
  6515. }
  6516. // ARROW DOWN - move to next not disabled option
  6517. if (e.which == 40) {
  6518. if (options.find('li.selected').length) {
  6519. newOption = options.find('li.selected').next('li:not(.disabled)')[0];
  6520. } else {
  6521. newOption = options.find('li:not(.disabled)')[0];
  6522. }
  6523. activateOption(options, newOption);
  6524. }
  6525. // ESC - close options
  6526. if (e.which == 27) {
  6527. $newSelect.trigger('close');
  6528. }
  6529. // ARROW UP - move to previous not disabled option
  6530. if (e.which == 38) {
  6531. newOption = options.find('li.selected').prev('li:not(.disabled)')[0];
  6532. if (newOption)
  6533. activateOption(options, newOption);
  6534. }
  6535. // Automaticaly clean filter query so user can search again by starting letters
  6536. setTimeout(function () {
  6537. filterQuery = [];
  6538. }, 1000);
  6539. };
  6540. $newSelect.on('keydown', onKeyDown);
  6541. });
  6542. function toggleEntryFromArray(entriesArray, entryIndex, select) {
  6543. var index = entriesArray.indexOf(entryIndex)
  6544. , notAdded = index === -1;
  6545. if (notAdded) {
  6546. entriesArray.push(entryIndex);
  6547. } else {
  6548. entriesArray.splice(index, 1);
  6549. }
  6550. select.siblings('ul.dropdown-content').find('li:not(.optgroup)').eq(entryIndex).toggleClass('active');
  6551. // use notAdded instead of true (to detect if the option is selected or not)
  6552. select.find('option').eq(entryIndex).prop('selected', notAdded);
  6553. setValueToInput(entriesArray, select);
  6554. return notAdded;
  6555. }
  6556. function setValueToInput(entriesArray, select) {
  6557. var value = '';
  6558. for (var i = 0, count = entriesArray.length; i < count; i++) {
  6559. var text = select.find('option').eq(entriesArray[i]).text();
  6560. i === 0 ? value += text : value += ', ' + text;
  6561. }
  6562. if (value === '') {
  6563. value = select.find('option:disabled').eq(0).text();
  6564. }
  6565. select.siblings('input.select-dropdown').val(value);
  6566. }
  6567. }
  6568. ;
  6569. }
  6570. )(jQuery);
  6571. ; (function ($) {
  6572. var methods = {
  6573. init: function (options) {
  6574. var defaults = {
  6575. indicators: true,
  6576. height: 400,
  6577. transition: 500,
  6578. interval: 6000
  6579. };
  6580. options = $.extend(defaults, options);
  6581. return this.each(function () {
  6582. // For each slider, we want to keep track of
  6583. // which slide is active and its associated content
  6584. var $this = $(this);
  6585. var $slider = $this.find('ul.slides').first();
  6586. var $slides = $slider.find('> li');
  6587. var $active_index = $slider.find('.active').index();
  6588. var $active, $indicators, $interval;
  6589. if ($active_index != -1) {
  6590. $active = $slides.eq($active_index);
  6591. }
  6592. // Transitions the caption depending on alignment
  6593. function captionTransition(caption, duration) {
  6594. if (caption.hasClass("center-align")) {
  6595. caption.velocity({
  6596. opacity: 0,
  6597. translateY: -100
  6598. }, {
  6599. duration: duration,
  6600. queue: false
  6601. });
  6602. } else if (caption.hasClass("right-align")) {
  6603. caption.velocity({
  6604. opacity: 0,
  6605. translateX: 100
  6606. }, {
  6607. duration: duration,
  6608. queue: false
  6609. });
  6610. } else if (caption.hasClass("left-align")) {
  6611. caption.velocity({
  6612. opacity: 0,
  6613. translateX: -100
  6614. }, {
  6615. duration: duration,
  6616. queue: false
  6617. });
  6618. }
  6619. }
  6620. // This function will transition the slide to any index of the next slide
  6621. function moveToSlide(index) {
  6622. // Wrap around indices.
  6623. if (index >= $slides.length)
  6624. index = 0;
  6625. else if (index < 0)
  6626. index = $slides.length - 1;
  6627. $active_index = $slider.find('.active').index();
  6628. // Only do if index changes
  6629. if ($active_index != index) {
  6630. $active = $slides.eq($active_index);
  6631. $caption = $active.find('.caption');
  6632. $active.removeClass('active');
  6633. $active.velocity({
  6634. opacity: 0
  6635. }, {
  6636. duration: options.transition,
  6637. queue: false,
  6638. easing: 'easeOutQuad',
  6639. complete: function () {
  6640. $slides.not('.active').velocity({
  6641. opacity: 0,
  6642. translateX: 0,
  6643. translateY: 0
  6644. }, {
  6645. duration: 0,
  6646. queue: false
  6647. });
  6648. }
  6649. });
  6650. captionTransition($caption, options.transition);
  6651. // Update indicators
  6652. if (options.indicators) {
  6653. $indicators.eq($active_index).removeClass('active');
  6654. }
  6655. $slides.eq(index).velocity({
  6656. opacity: 1
  6657. }, {
  6658. duration: options.transition,
  6659. queue: false,
  6660. easing: 'easeOutQuad'
  6661. });
  6662. $slides.eq(index).find('.caption').velocity({
  6663. opacity: 1,
  6664. translateX: 0,
  6665. translateY: 0
  6666. }, {
  6667. duration: options.transition,
  6668. delay: options.transition,
  6669. queue: false,
  6670. easing: 'easeOutQuad'
  6671. });
  6672. $slides.eq(index).addClass('active');
  6673. // Update indicators
  6674. if (options.indicators) {
  6675. $indicators.eq(index).addClass('active');
  6676. }
  6677. }
  6678. }
  6679. // Set height of slider
  6680. // If fullscreen, do nothing
  6681. if (!$this.hasClass('fullscreen')) {
  6682. if (options.indicators) {
  6683. // Add height if indicators are present
  6684. $this.height(options.height + 40);
  6685. } else {
  6686. $this.height(options.height);
  6687. }
  6688. $slider.height(options.height);
  6689. }
  6690. // Set initial positions of captions
  6691. $slides.find('.caption').each(function () {
  6692. captionTransition($(this), 0);
  6693. });
  6694. // Move img src into background-image
  6695. $slides.find('img').each(function () {
  6696. var placeholderBase64 = 'data:image/gif;base64,R0lGODlhAQABAIABAP///wAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';
  6697. if ($(this).attr('src') !== placeholderBase64) {
  6698. $(this).css('background-image', 'url("' + $(this).attr('src') + '")');
  6699. $(this).attr('src', placeholderBase64);
  6700. }
  6701. });
  6702. // dynamically add indicators
  6703. if (options.indicators) {
  6704. $indicators = $('<ul class="indicators"></ul>');
  6705. $slides.each(function (index) {
  6706. var $indicator = $('<li class="indicator-item"></li>');
  6707. // Handle clicks on indicators
  6708. $indicator.click(function () {
  6709. var $parent = $slider.parent();
  6710. var curr_index = $parent.find($(this)).index();
  6711. moveToSlide(curr_index);
  6712. // reset interval
  6713. clearInterval($interval);
  6714. $interval = setInterval(function () {
  6715. $active_index = $slider.find('.active').index();
  6716. if ($slides.length == $active_index + 1)
  6717. $active_index = 0;
  6718. // loop to start
  6719. else
  6720. $active_index += 1;
  6721. moveToSlide($active_index);
  6722. }, options.transition + options.interval);
  6723. });
  6724. $indicators.append($indicator);
  6725. });
  6726. $this.append($indicators);
  6727. $indicators = $this.find('ul.indicators').find('li.indicator-item');
  6728. }
  6729. if ($active) {
  6730. $active.show();
  6731. } else {
  6732. $slides.first().addClass('active').velocity({
  6733. opacity: 1
  6734. }, {
  6735. duration: options.transition,
  6736. queue: false,
  6737. easing: 'easeOutQuad'
  6738. });
  6739. $active_index = 0;
  6740. $active = $slides.eq($active_index);
  6741. // Update indicators
  6742. if (options.indicators) {
  6743. $indicators.eq($active_index).addClass('active');
  6744. }
  6745. }
  6746. // Adjust height to current slide
  6747. $active.find('img').each(function () {
  6748. $active.find('.caption').velocity({
  6749. opacity: 1,
  6750. translateX: 0,
  6751. translateY: 0
  6752. }, {
  6753. duration: options.transition,
  6754. queue: false,
  6755. easing: 'easeOutQuad'
  6756. });
  6757. });
  6758. // auto scroll
  6759. $interval = setInterval(function () {
  6760. $active_index = $slider.find('.active').index();
  6761. moveToSlide($active_index + 1);
  6762. }, options.transition + options.interval);
  6763. // HammerJS, Swipe navigation
  6764. // Touch Event
  6765. var panning = false;
  6766. var swipeLeft = false;
  6767. var swipeRight = false;
  6768. $this.hammer({
  6769. prevent_default: false
  6770. }).on('pan', function (e) {
  6771. if (e.gesture.pointerType === "touch") {
  6772. // reset interval
  6773. clearInterval($interval);
  6774. var direction = e.gesture.direction;
  6775. var x = e.gesture.deltaX;
  6776. var velocityX = e.gesture.velocityX;
  6777. var velocityY = e.gesture.velocityY;
  6778. $curr_slide = $slider.find('.active');
  6779. if (Math.abs(velocityX) > Math.abs(velocityY)) {
  6780. $curr_slide.velocity({
  6781. translateX: x
  6782. }, {
  6783. duration: 50,
  6784. queue: false,
  6785. easing: 'easeOutQuad'
  6786. });
  6787. }
  6788. // Swipe Left
  6789. if (direction === 4 && (x > $this.innerWidth() / 2 || velocityX < -0.65)) {
  6790. swipeRight = true;
  6791. }// Swipe Right
  6792. else if (direction === 2 && (x < -1 * $this.innerWidth() / 2 || velocityX > 0.65)) {
  6793. swipeLeft = true;
  6794. }
  6795. // Make Slide Behind active slide visible
  6796. var next_slide;
  6797. if (swipeLeft) {
  6798. next_slide = $curr_slide.next();
  6799. if (next_slide.length === 0) {
  6800. next_slide = $slides.first();
  6801. }
  6802. next_slide.velocity({
  6803. opacity: 1
  6804. }, {
  6805. duration: 300,
  6806. queue: false,
  6807. easing: 'easeOutQuad'
  6808. });
  6809. }
  6810. if (swipeRight) {
  6811. next_slide = $curr_slide.prev();
  6812. if (next_slide.length === 0) {
  6813. next_slide = $slides.last();
  6814. }
  6815. next_slide.velocity({
  6816. opacity: 1
  6817. }, {
  6818. duration: 300,
  6819. queue: false,
  6820. easing: 'easeOutQuad'
  6821. });
  6822. }
  6823. }
  6824. }).on('panend', function (e) {
  6825. if (e.gesture.pointerType === "touch") {
  6826. $curr_slide = $slider.find('.active');
  6827. panning = false;
  6828. curr_index = $slider.find('.active').index();
  6829. if (!swipeRight && !swipeLeft || $slides.length <= 1) {
  6830. // Return to original spot
  6831. $curr_slide.velocity({
  6832. translateX: 0
  6833. }, {
  6834. duration: 300,
  6835. queue: false,
  6836. easing: 'easeOutQuad'
  6837. });
  6838. } else if (swipeLeft) {
  6839. moveToSlide(curr_index + 1);
  6840. $curr_slide.velocity({
  6841. translateX: -1 * $this.innerWidth()
  6842. }, {
  6843. duration: 300,
  6844. queue: false,
  6845. easing: 'easeOutQuad',
  6846. complete: function () {
  6847. $curr_slide.velocity({
  6848. opacity: 0,
  6849. translateX: 0
  6850. }, {
  6851. duration: 0,
  6852. queue: false
  6853. });
  6854. }
  6855. });
  6856. } else if (swipeRight) {
  6857. moveToSlide(curr_index - 1);
  6858. $curr_slide.velocity({
  6859. translateX: $this.innerWidth()
  6860. }, {
  6861. duration: 300,
  6862. queue: false,
  6863. easing: 'easeOutQuad',
  6864. complete: function () {
  6865. $curr_slide.velocity({
  6866. opacity: 0,
  6867. translateX: 0
  6868. }, {
  6869. duration: 0,
  6870. queue: false
  6871. });
  6872. }
  6873. });
  6874. }
  6875. swipeLeft = false;
  6876. swipeRight = false;
  6877. // Restart interval
  6878. clearInterval($interval);
  6879. $interval = setInterval(function () {
  6880. $active_index = $slider.find('.active').index();
  6881. if ($slides.length == $active_index + 1)
  6882. $active_index = 0;
  6883. // loop to start
  6884. else
  6885. $active_index += 1;
  6886. moveToSlide($active_index);
  6887. }, options.transition + options.interval);
  6888. }
  6889. });
  6890. $this.on('sliderPause', function () {
  6891. clearInterval($interval);
  6892. });
  6893. $this.on('sliderStart', function () {
  6894. clearInterval($interval);
  6895. $interval = setInterval(function () {
  6896. $active_index = $slider.find('.active').index();
  6897. if ($slides.length == $active_index + 1)
  6898. $active_index = 0;
  6899. // loop to start
  6900. else
  6901. $active_index += 1;
  6902. moveToSlide($active_index);
  6903. }, options.transition + options.interval);
  6904. });
  6905. $this.on('sliderNext', function () {
  6906. $active_index = $slider.find('.active').index();
  6907. moveToSlide($active_index + 1);
  6908. });
  6909. $this.on('sliderPrev', function () {
  6910. $active_index = $slider.find('.active').index();
  6911. moveToSlide($active_index - 1);
  6912. });
  6913. });
  6914. },
  6915. pause: function () {
  6916. $(this).trigger('sliderPause');
  6917. },
  6918. start: function () {
  6919. $(this).trigger('sliderStart');
  6920. },
  6921. next: function () {
  6922. $(this).trigger('sliderNext');
  6923. },
  6924. prev: function () {
  6925. $(this).trigger('sliderPrev');
  6926. }
  6927. };
  6928. $.fn.slider = function (methodOrOptions) {
  6929. if (methods[methodOrOptions]) {
  6930. return methods[methodOrOptions].apply(this, Array.prototype.slice.call(arguments, 1));
  6931. } else if (typeof methodOrOptions === 'object' || !methodOrOptions) {
  6932. // Default to "init"
  6933. return methods.init.apply(this, arguments);
  6934. } else {
  6935. $.error('Method ' + methodOrOptions + ' does not exist on jQuery.tooltip');
  6936. }
  6937. }
  6938. ;
  6939. // Plugin end
  6940. }
  6941. )(jQuery);
  6942. ; (function ($) {
  6943. $(document).ready(function () {
  6944. $(document).on('click.card', '.card', function (e) {
  6945. if ($(this).find('> .card-reveal').length) {
  6946. var $card = $(e.target).closest('.card');
  6947. if ($card.data('initialOverflow') === undefined) {
  6948. $card.data('initialOverflow', $card.css('overflow') === undefined ? '' : $card.css('overflow'));
  6949. }
  6950. if ($(e.target).is($('.card-reveal .card-title>i'))) {
  6951. // Make Reveal animate down and display none
  6952. $(this).find('.card-reveal').velocity({
  6953. translateY: 0
  6954. }, {
  6955. duration: 225,
  6956. queue: false,
  6957. easing: 'easeInOutQuad',
  6958. complete: function () {
  6959. $(this).css({
  6960. display: 'none'
  6961. });
  6962. $card.css('overflow', $card.data('initialOverflow'));
  6963. }
  6964. });
  6965. } else if ($(e.target).is($('.card .activator')) || $(e.target).is($('.card .activator i'))) {
  6966. $card.css('overflow', 'hidden');
  6967. $(this).find('.card-reveal').css({
  6968. display: 'block'
  6969. }).velocity("stop", false).velocity({
  6970. translateY: '-100%'
  6971. }, {
  6972. duration: 300,
  6973. queue: false,
  6974. easing: 'easeInOutQuad'
  6975. });
  6976. }
  6977. }
  6978. });
  6979. });
  6980. }
  6981. )(jQuery);
  6982. ; (function ($) {
  6983. var materialChipsDefaults = {
  6984. data: [],
  6985. placeholder: '',
  6986. secondaryPlaceholder: '',
  6987. autocompleteOptions: {}
  6988. };
  6989. $(document).ready(function () {
  6990. // Handle removal of static chips.
  6991. $(document).on('click', '.chip .close', function (e) {
  6992. var $chips = $(this).closest('.chips');
  6993. if ($chips.attr('data-initialized')) {
  6994. return;
  6995. }
  6996. $(this).closest('.chip').remove();
  6997. });
  6998. });
  6999. $.fn.material_chip = function (options) {
  7000. var self = this;
  7001. this.$el = $(this);
  7002. this.$document = $(document);
  7003. this.SELS = {
  7004. CHIPS: '.chips',
  7005. CHIP: '.chip',
  7006. INPUT: 'input',
  7007. DELETE: '.material-icons',
  7008. SELECTED_CHIP: '.selected'
  7009. };
  7010. if ('data' === options) {
  7011. return this.$el.data('chips');
  7012. }
  7013. var curr_options = $.extend({}, materialChipsDefaults, options);
  7014. self.hasAutocomplete = !$.isEmptyObject(curr_options.autocompleteOptions.data);
  7015. // Initialize
  7016. this.init = function () {
  7017. var i = 0;
  7018. var chips;
  7019. self.$el.each(function () {
  7020. var $chips = $(this);
  7021. var chipId = Materialize.guid();
  7022. self.chipId = chipId;
  7023. if (!curr_options.data || !(curr_options.data instanceof Array)) {
  7024. curr_options.data = [];
  7025. }
  7026. $chips.data('chips', curr_options.data);
  7027. $chips.attr('data-index', i);
  7028. $chips.attr('data-initialized', true);
  7029. if (!$chips.hasClass(self.SELS.CHIPS)) {
  7030. $chips.addClass('chips');
  7031. }
  7032. self.chips($chips, chipId);
  7033. i++;
  7034. });
  7035. }
  7036. ;
  7037. this.handleEvents = function () {
  7038. var SELS = self.SELS;
  7039. self.$document.off('click.chips-focus', SELS.CHIPS).on('click.chips-focus', SELS.CHIPS, function (e) {
  7040. $(e.target).find(SELS.INPUT).focus();
  7041. });
  7042. self.$document.off('click.chips-select', SELS.CHIP).on('click.chips-select', SELS.CHIP, function (e) {
  7043. var $chip = $(e.target);
  7044. if ($chip.length) {
  7045. var wasSelected = $chip.hasClass('selected');
  7046. var $chips = $chip.closest(SELS.CHIPS);
  7047. $(SELS.CHIP).removeClass('selected');
  7048. if (!wasSelected) {
  7049. self.selectChip($chip.index(), $chips);
  7050. }
  7051. }
  7052. });
  7053. self.$document.off('keydown.chips').on('keydown.chips', function (e) {
  7054. if ($(e.target).is('input, textarea')) {
  7055. return;
  7056. }
  7057. // delete
  7058. var $chip = self.$document.find(SELS.CHIP + SELS.SELECTED_CHIP);
  7059. var $chips = $chip.closest(SELS.CHIPS);
  7060. var length = $chip.siblings(SELS.CHIP).length;
  7061. var index;
  7062. if (!$chip.length) {
  7063. return;
  7064. }
  7065. if (e.which === 8 || e.which === 46) {
  7066. e.preventDefault();
  7067. index = $chip.index();
  7068. self.deleteChip(index, $chips);
  7069. var selectIndex = null;
  7070. if (index + 1 < length) {
  7071. selectIndex = index;
  7072. } else if (index === length || index + 1 === length) {
  7073. selectIndex = length - 1;
  7074. }
  7075. if (selectIndex < 0)
  7076. selectIndex = null;
  7077. if (null !== selectIndex) {
  7078. self.selectChip(selectIndex, $chips);
  7079. }
  7080. if (!length)
  7081. $chips.find('input').focus();
  7082. // left
  7083. } else if (e.which === 37) {
  7084. index = $chip.index() - 1;
  7085. if (index < 0) {
  7086. return;
  7087. }
  7088. $(SELS.CHIP).removeClass('selected');
  7089. self.selectChip(index, $chips);
  7090. // right
  7091. } else if (e.which === 39) {
  7092. index = $chip.index() + 1;
  7093. $(SELS.CHIP).removeClass('selected');
  7094. if (index > length) {
  7095. $chips.find('input').focus();
  7096. return;
  7097. }
  7098. self.selectChip(index, $chips);
  7099. }
  7100. });
  7101. self.$document.off('focusin.chips', SELS.CHIPS + ' ' + SELS.INPUT).on('focusin.chips', SELS.CHIPS + ' ' + SELS.INPUT, function (e) {
  7102. var $currChips = $(e.target).closest(SELS.CHIPS);
  7103. $currChips.addClass('focus');
  7104. $currChips.siblings('label, .prefix').addClass('active');
  7105. $(SELS.CHIP).removeClass('selected');
  7106. });
  7107. self.$document.off('focusout.chips', SELS.CHIPS + ' ' + SELS.INPUT).on('focusout.chips', SELS.CHIPS + ' ' + SELS.INPUT, function (e) {
  7108. var $currChips = $(e.target).closest(SELS.CHIPS);
  7109. $currChips.removeClass('focus');
  7110. // Remove active if empty
  7111. if ($currChips.data('chips') === undefined || !$currChips.data('chips').length) {
  7112. $currChips.siblings('label').removeClass('active');
  7113. }
  7114. $currChips.siblings('.prefix').removeClass('active');
  7115. });
  7116. self.$document.off('keydown.chips-add', SELS.CHIPS + ' ' + SELS.INPUT).on('keydown.chips-add', SELS.CHIPS + ' ' + SELS.INPUT, function (e) {
  7117. var $target = $(e.target);
  7118. var $chips = $target.closest(SELS.CHIPS);
  7119. var chipsLength = $chips.children(SELS.CHIP).length;
  7120. // enter
  7121. if (13 === e.which) {
  7122. // Override enter if autocompleting.
  7123. if (self.hasAutocomplete && $chips.find('.autocomplete-content.dropdown-content').length && $chips.find('.autocomplete-content.dropdown-content').children().length) {
  7124. return;
  7125. }
  7126. e.preventDefault();
  7127. self.addChip({
  7128. tag: $target.val()
  7129. }, $chips);
  7130. $target.val('');
  7131. return;
  7132. }
  7133. // delete or left
  7134. if ((8 === e.keyCode || 37 === e.keyCode) && '' === $target.val() && chipsLength) {
  7135. e.preventDefault();
  7136. self.selectChip(chipsLength - 1, $chips);
  7137. $target.blur();
  7138. return;
  7139. }
  7140. });
  7141. // Click on delete icon in chip.
  7142. self.$document.off('click.chips-delete', SELS.CHIPS + ' ' + SELS.DELETE).on('click.chips-delete', SELS.CHIPS + ' ' + SELS.DELETE, function (e) {
  7143. var $target = $(e.target);
  7144. var $chips = $target.closest(SELS.CHIPS);
  7145. var $chip = $target.closest(SELS.CHIP);
  7146. e.stopPropagation();
  7147. self.deleteChip($chip.index(), $chips);
  7148. $chips.find('input').focus();
  7149. });
  7150. }
  7151. ;
  7152. this.chips = function ($chips, chipId) {
  7153. $chips.empty();
  7154. $chips.data('chips').forEach(function (elem) {
  7155. $chips.append(self.renderChip(elem));
  7156. });
  7157. $chips.append($('<input id="' + chipId + '" class="input" placeholder="">'));
  7158. self.setPlaceholder($chips);
  7159. // Set for attribute for label
  7160. var label = $chips.next('label');
  7161. if (label.length) {
  7162. label.attr('for', chipId);
  7163. if ($chips.data('chips') !== undefined && $chips.data('chips').length) {
  7164. label.addClass('active');
  7165. }
  7166. }
  7167. // Setup autocomplete if needed.
  7168. var input = $('#' + chipId);
  7169. if (self.hasAutocomplete) {
  7170. curr_options.autocompleteOptions.onAutocomplete = function (val) {
  7171. self.addChip({
  7172. tag: val
  7173. }, $chips);
  7174. input.val('');
  7175. input.focus();
  7176. }
  7177. ;
  7178. input.autocomplete(curr_options.autocompleteOptions);
  7179. }
  7180. }
  7181. ;
  7182. /**
  7183. * Render chip jQuery element.
  7184. * @param {Object} elem
  7185. * @return {jQuery}
  7186. */
  7187. this.renderChip = function (elem) {
  7188. if (!elem.tag)
  7189. return;
  7190. var $renderedChip = $('<div class="chip"></div>');
  7191. $renderedChip.text(elem.tag);
  7192. if (elem.image) {
  7193. $renderedChip.prepend($('<img />').attr('src', elem.image));
  7194. }
  7195. $renderedChip.append($('<i class="material-icons close">close</i>'));
  7196. return $renderedChip;
  7197. }
  7198. ;
  7199. this.setPlaceholder = function ($chips) {
  7200. if ($chips.data('chips') !== undefined && !$chips.data('chips').length && curr_options.placeholder) {
  7201. $chips.find('input').prop('placeholder', curr_options.placeholder);
  7202. } else if (($chips.data('chips') === undefined || !!$chips.data('chips').length) && curr_options.secondaryPlaceholder) {
  7203. $chips.find('input').prop('placeholder', curr_options.secondaryPlaceholder);
  7204. }
  7205. }
  7206. ;
  7207. this.isValid = function ($chips, elem) {
  7208. var chips = $chips.data('chips');
  7209. var exists = false;
  7210. for (var i = 0; i < chips.length; i++) {
  7211. if (chips[i].tag === elem.tag) {
  7212. exists = true;
  7213. return;
  7214. }
  7215. }
  7216. return '' !== elem.tag && !exists;
  7217. }
  7218. ;
  7219. this.addChip = function (elem, $chips) {
  7220. if (!self.isValid($chips, elem)) {
  7221. return;
  7222. }
  7223. var $renderedChip = self.renderChip(elem);
  7224. var newData = [];
  7225. var oldData = $chips.data('chips');
  7226. for (var i = 0; i < oldData.length; i++) {
  7227. newData.push(oldData[i]);
  7228. }
  7229. newData.push(elem);
  7230. $chips.data('chips', newData);
  7231. $renderedChip.insertBefore($chips.find('input'));
  7232. $chips.trigger('chip.add', elem);
  7233. self.setPlaceholder($chips);
  7234. }
  7235. ;
  7236. this.deleteChip = function (chipIndex, $chips) {
  7237. var chip = $chips.data('chips')[chipIndex];
  7238. $chips.find('.chip').eq(chipIndex).remove();
  7239. var newData = [];
  7240. var oldData = $chips.data('chips');
  7241. for (var i = 0; i < oldData.length; i++) {
  7242. if (i !== chipIndex) {
  7243. newData.push(oldData[i]);
  7244. }
  7245. }
  7246. $chips.data('chips', newData);
  7247. $chips.trigger('chip.delete', chip);
  7248. self.setPlaceholder($chips);
  7249. }
  7250. ;
  7251. this.selectChip = function (chipIndex, $chips) {
  7252. var $chip = $chips.find('.chip').eq(chipIndex);
  7253. if ($chip && false === $chip.hasClass('selected')) {
  7254. $chip.addClass('selected');
  7255. $chips.trigger('chip.select', $chips.data('chips')[chipIndex]);
  7256. }
  7257. }
  7258. ;
  7259. this.getChipsElement = function (index, $chips) {
  7260. return $chips.eq(index);
  7261. }
  7262. ;
  7263. // init
  7264. this.init();
  7265. this.handleEvents();
  7266. }
  7267. ;
  7268. }
  7269. )(jQuery);
  7270. ; (function ($) {
  7271. $.fn.pushpin = function (options) {
  7272. // Defaults
  7273. var defaults = {
  7274. top: 0,
  7275. bottom: Infinity,
  7276. offset: 0
  7277. };
  7278. // Remove pushpin event and classes
  7279. if (options === "remove") {
  7280. this.each(function () {
  7281. if (id = $(this).data('pushpin-id')) {
  7282. $(window).off('scroll.' + id);
  7283. $(this).removeData('pushpin-id').removeClass('pin-top pinned pin-bottom').removeAttr('style');
  7284. }
  7285. });
  7286. return false;
  7287. }
  7288. options = $.extend(defaults, options);
  7289. $index = 0;
  7290. return this.each(function () {
  7291. var $uniqueId = Materialize.guid()
  7292. , $this = $(this)
  7293. , $original_offset = $(this).offset().top;
  7294. function removePinClasses(object) {
  7295. object.removeClass('pin-top');
  7296. object.removeClass('pinned');
  7297. object.removeClass('pin-bottom');
  7298. }
  7299. function updateElements(objects, scrolled) {
  7300. objects.each(function () {
  7301. // Add position fixed (because its between top and bottom)
  7302. if (options.top <= scrolled && options.bottom >= scrolled && !$(this).hasClass('pinned')) {
  7303. removePinClasses($(this));
  7304. $(this).css('top', options.offset);
  7305. $(this).addClass('pinned');
  7306. }
  7307. // Add pin-top (when scrolled position is above top)
  7308. if (scrolled < options.top && !$(this).hasClass('pin-top')) {
  7309. removePinClasses($(this));
  7310. $(this).css('top', 0);
  7311. $(this).addClass('pin-top');
  7312. }
  7313. // Add pin-bottom (when scrolled position is below bottom)
  7314. if (scrolled > options.bottom && !$(this).hasClass('pin-bottom')) {
  7315. removePinClasses($(this));
  7316. $(this).addClass('pin-bottom');
  7317. $(this).css('top', options.bottom - $original_offset);
  7318. }
  7319. });
  7320. }
  7321. $(this).data('pushpin-id', $uniqueId);
  7322. updateElements($this, $(window).scrollTop());
  7323. $(window).on('scroll.' + $uniqueId, function () {
  7324. var $scrolled = $(window).scrollTop() + options.offset;
  7325. updateElements($this, $scrolled);
  7326. });
  7327. });
  7328. }
  7329. ;
  7330. }
  7331. )(jQuery);
  7332. ; (function ($) {
  7333. $(document).ready(function () {
  7334. // jQuery reverse
  7335. $.fn.reverse = [].reverse;
  7336. // Hover behaviour: make sure this doesn't work on .click-to-toggle FABs!
  7337. $(document).on('mouseenter.fixedActionBtn', '.fixed-action-btn:not(.click-to-toggle):not(.toolbar)', function (e) {
  7338. var $this = $(this);
  7339. openFABMenu($this);
  7340. });
  7341. $(document).on('mouseleave.fixedActionBtn', '.fixed-action-btn:not(.click-to-toggle):not(.toolbar)', function (e) {
  7342. var $this = $(this);
  7343. closeFABMenu($this);
  7344. });
  7345. // Toggle-on-click behaviour.
  7346. $(document).on('click.fabClickToggle', '.fixed-action-btn.click-to-toggle > a', function (e) {
  7347. var $this = $(this);
  7348. var $menu = $this.parent();
  7349. if ($menu.hasClass('active')) {
  7350. closeFABMenu($menu);
  7351. } else {
  7352. openFABMenu($menu);
  7353. }
  7354. });
  7355. // Toolbar transition behaviour.
  7356. $(document).on('click.fabToolbar', '.fixed-action-btn.toolbar > a', function (e) {
  7357. var $this = $(this);
  7358. var $menu = $this.parent();
  7359. FABtoToolbar($menu);
  7360. });
  7361. });
  7362. $.fn.extend({
  7363. openFAB: function () {
  7364. openFABMenu($(this));
  7365. },
  7366. closeFAB: function () {
  7367. closeFABMenu($(this));
  7368. },
  7369. openToolbar: function () {
  7370. FABtoToolbar($(this));
  7371. },
  7372. closeToolbar: function () {
  7373. toolbarToFAB($(this));
  7374. }
  7375. });
  7376. var openFABMenu = function (btn) {
  7377. var $this = btn;
  7378. if ($this.hasClass('active') === false) {
  7379. // Get direction option
  7380. var horizontal = $this.hasClass('horizontal');
  7381. var offsetY, offsetX;
  7382. if (horizontal === true) {
  7383. offsetX = 40;
  7384. } else {
  7385. offsetY = 40;
  7386. }
  7387. if ($this.find("div").length > 0) {
  7388. $this.find("div")[0].style.display = "block";
  7389. } else {
  7390. $this.addClass('active');
  7391. $this.find('ul .btn-floating').velocity({
  7392. scaleY: ".4",
  7393. scaleX: ".4",
  7394. translateY: offsetY + 'px',
  7395. translateX: offsetX + 'px'
  7396. }, {
  7397. duration: 0
  7398. });
  7399. var time = 0;
  7400. $this.find('ul .btn-floating').reverse().each(function () {
  7401. $(this).velocity({
  7402. opacity: "1",
  7403. scaleX: "1",
  7404. scaleY: "1",
  7405. translateY: "0",
  7406. translateX: '0'
  7407. }, {
  7408. duration: 80,
  7409. delay: time
  7410. });
  7411. time += 40;
  7412. });
  7413. }
  7414. }
  7415. };
  7416. var closeFABMenu = function (btn) {
  7417. var $this = btn;
  7418. // Get direction option
  7419. var horizontal = $this.hasClass('horizontal');
  7420. var offsetY, offsetX;
  7421. if (horizontal === true) {
  7422. offsetX = 40;
  7423. } else {
  7424. offsetY = 40;
  7425. }
  7426. $this.removeClass('active');
  7427. var time = 0;
  7428. $this.find('ul .btn-floating').velocity("stop", true);
  7429. $this.find('ul .btn-floating').velocity({
  7430. opacity: "0",
  7431. scaleX: ".4",
  7432. scaleY: ".4",
  7433. translateY: offsetY + 'px',
  7434. translateX: offsetX + 'px'
  7435. }, {
  7436. duration: 80
  7437. });
  7438. };
  7439. /**
  7440. * Transform FAB into toolbar
  7441. * @param {Object} object jQuery object
  7442. */
  7443. var FABtoToolbar = function (btn) {
  7444. if (btn.attr('data-open') === "true") {
  7445. return;
  7446. }
  7447. var offsetX, offsetY, scaleFactor;
  7448. var windowWidth = window.innerWidth;
  7449. var windowHeight = window.innerHeight;
  7450. var btnRect = btn[0].getBoundingClientRect();
  7451. var anchor = btn.find('> a').first();
  7452. var menu = btn.find('> ul').first();
  7453. var backdrop = $('<div class="fab-backdrop"></div>');
  7454. var fabColor = anchor.css('background-color');
  7455. anchor.append(backdrop);
  7456. offsetX = btnRect.left - windowWidth / 2 + btnRect.width / 2;
  7457. offsetY = windowHeight - btnRect.bottom;
  7458. scaleFactor = windowWidth / backdrop.width();
  7459. btn.attr('data-origin-bottom', btnRect.bottom);
  7460. btn.attr('data-origin-left', btnRect.left);
  7461. btn.attr('data-origin-width', btnRect.width);
  7462. // Set initial state
  7463. btn.addClass('active');
  7464. btn.attr('data-open', true);
  7465. btn.css({
  7466. 'text-align': 'center',
  7467. width: '100%',
  7468. bottom: 0,
  7469. left: 0,
  7470. transform: 'translateX(' + offsetX + 'px)',
  7471. transition: 'none'
  7472. });
  7473. anchor.css({
  7474. transform: 'translateY(' + -offsetY + 'px)',
  7475. transition: 'none'
  7476. });
  7477. backdrop.css({
  7478. 'background-color': fabColor
  7479. });
  7480. setTimeout(function () {
  7481. btn.css({
  7482. transform: '',
  7483. transition: 'transform .2s cubic-bezier(0.550, 0.085, 0.680, 0.530), background-color 0s linear .2s'
  7484. });
  7485. anchor.css({
  7486. overflow: 'visible',
  7487. transform: '',
  7488. transition: 'transform .2s'
  7489. });
  7490. setTimeout(function () {
  7491. btn.css({
  7492. overflow: 'hidden',
  7493. 'background-color': fabColor
  7494. });
  7495. backdrop.css({
  7496. transform: 'scale(' + scaleFactor + ')',
  7497. transition: 'transform .2s cubic-bezier(0.550, 0.055, 0.675, 0.190)'
  7498. });
  7499. menu.find('> li > a').css({
  7500. opacity: 1
  7501. });
  7502. // Scroll to close.
  7503. $(window).on('scroll.fabToolbarClose', function () {
  7504. toolbarToFAB(btn);
  7505. $(window).off('scroll.fabToolbarClose');
  7506. $(document).off('click.fabToolbarClose');
  7507. });
  7508. $(document).on('click.fabToolbarClose', function (e) {
  7509. if (!$(e.target).closest(menu).length) {
  7510. toolbarToFAB(btn);
  7511. $(window).off('scroll.fabToolbarClose');
  7512. $(document).off('click.fabToolbarClose');
  7513. }
  7514. });
  7515. }, 100);
  7516. }, 0);
  7517. };
  7518. /**
  7519. * Transform toolbar back into FAB
  7520. * @param {Object} object jQuery object
  7521. */
  7522. var toolbarToFAB = function (btn) {
  7523. if (btn.attr('data-open') !== "true") {
  7524. return;
  7525. }
  7526. var offsetX, offsetY, scaleFactor;
  7527. var windowWidth = window.innerWidth;
  7528. var windowHeight = window.innerHeight;
  7529. var btnWidth = btn.attr('data-origin-width');
  7530. var btnBottom = btn.attr('data-origin-bottom');
  7531. var btnLeft = btn.attr('data-origin-left');
  7532. var anchor = btn.find('> .btn-floating').first();
  7533. var menu = btn.find('> ul').first();
  7534. var backdrop = btn.find('.fab-backdrop');
  7535. var fabColor = anchor.css('background-color');
  7536. offsetX = btnLeft - windowWidth / 2 + btnWidth / 2;
  7537. offsetY = windowHeight - btnBottom;
  7538. scaleFactor = windowWidth / backdrop.width();
  7539. // Hide backdrop
  7540. btn.removeClass('active');
  7541. btn.attr('data-open', false);
  7542. btn.css({
  7543. 'background-color': 'transparent',
  7544. transition: 'none'
  7545. });
  7546. anchor.css({
  7547. transition: 'none'
  7548. });
  7549. backdrop.css({
  7550. transform: 'scale(0)',
  7551. 'background-color': fabColor
  7552. });
  7553. menu.find('> li > a').css({
  7554. opacity: ''
  7555. });
  7556. setTimeout(function () {
  7557. backdrop.remove();
  7558. // Set initial state.
  7559. btn.css({
  7560. 'text-align': '',
  7561. width: '',
  7562. bottom: '',
  7563. left: '',
  7564. overflow: '',
  7565. 'background-color': '',
  7566. transform: 'translate3d(' + -offsetX + 'px,0,0)'
  7567. });
  7568. anchor.css({
  7569. overflow: '',
  7570. transform: 'translate3d(0,' + offsetY + 'px,0)'
  7571. });
  7572. setTimeout(function () {
  7573. btn.css({
  7574. transform: 'translate3d(0,0,0)',
  7575. transition: 'transform .2s'
  7576. });
  7577. anchor.css({
  7578. transform: 'translate3d(0,0,0)',
  7579. transition: 'transform .2s cubic-bezier(0.550, 0.055, 0.675, 0.190)'
  7580. });
  7581. }, 20);
  7582. }, 200);
  7583. };
  7584. }
  7585. )(jQuery);
  7586. ; (function ($) {
  7587. // Image transition function
  7588. Materialize.fadeInImage = function (selectorOrEl) {
  7589. var element;
  7590. if (typeof selectorOrEl === 'string') {
  7591. element = $(selectorOrEl);
  7592. } else if (typeof selectorOrEl === 'object') {
  7593. element = selectorOrEl;
  7594. } else {
  7595. return;
  7596. }
  7597. element.css({
  7598. opacity: 0
  7599. });
  7600. $(element).velocity({
  7601. opacity: 1
  7602. }, {
  7603. duration: 650,
  7604. queue: false,
  7605. easing: 'easeOutSine'
  7606. });
  7607. $(element).velocity({
  7608. opacity: 1
  7609. }, {
  7610. duration: 1300,
  7611. queue: false,
  7612. easing: 'swing',
  7613. step: function (now, fx) {
  7614. fx.start = 100;
  7615. var grayscale_setting = now / 100;
  7616. var brightness_setting = 150 - (100 - now) / 1.75;
  7617. if (brightness_setting < 100) {
  7618. brightness_setting = 100;
  7619. }
  7620. if (now >= 0) {
  7621. $(this).css({
  7622. "-webkit-filter": "grayscale(" + grayscale_setting + ")" + "brightness(" + brightness_setting + "%)",
  7623. "filter": "grayscale(" + grayscale_setting + ")" + "brightness(" + brightness_setting + "%)"
  7624. });
  7625. }
  7626. }
  7627. });
  7628. }
  7629. ;
  7630. // Horizontal staggered list
  7631. Materialize.showStaggeredList = function (selectorOrEl) {
  7632. var element;
  7633. if (typeof selectorOrEl === 'string') {
  7634. element = $(selectorOrEl);
  7635. } else if (typeof selectorOrEl === 'object') {
  7636. element = selectorOrEl;
  7637. } else {
  7638. return;
  7639. }
  7640. var time = 0;
  7641. element.find('li').velocity({
  7642. translateX: "-100px"
  7643. }, {
  7644. duration: 0
  7645. });
  7646. element.find('li').each(function () {
  7647. $(this).velocity({
  7648. opacity: "1",
  7649. translateX: "0"
  7650. }, {
  7651. duration: 800,
  7652. delay: time,
  7653. easing: [60, 10]
  7654. });
  7655. time += 120;
  7656. });
  7657. }
  7658. ;
  7659. $(document).ready(function () {
  7660. // Hardcoded .staggered-list scrollFire
  7661. // var staggeredListOptions = [];
  7662. // $('ul.staggered-list').each(function (i) {
  7663. // var label = 'scrollFire-' + i;
  7664. // $(this).addClass(label);
  7665. // staggeredListOptions.push(
  7666. // {selector: 'ul.staggered-list.' + label,
  7667. // offset: 200,
  7668. // callback: 'showStaggeredList("ul.staggered-list.' + label + '")'});
  7669. // });
  7670. // scrollFire(staggeredListOptions);
  7671. // HammerJS, Swipe navigation
  7672. // Touch Event
  7673. var swipeLeft = false;
  7674. var swipeRight = false;
  7675. // Dismissible Collections
  7676. $('.dismissable').each(function () {
  7677. $(this).hammer({
  7678. prevent_default: false
  7679. }).on('pan', function (e) {
  7680. if (e.gesture.pointerType === "touch") {
  7681. var $this = $(this);
  7682. var direction = e.gesture.direction;
  7683. var x = e.gesture.deltaX;
  7684. var velocityX = e.gesture.velocityX;
  7685. $this.velocity({
  7686. translateX: x
  7687. }, {
  7688. duration: 50,
  7689. queue: false,
  7690. easing: 'easeOutQuad'
  7691. });
  7692. // Swipe Left
  7693. if (direction === 4 && (x > $this.innerWidth() / 2 || velocityX < -0.75)) {
  7694. swipeLeft = true;
  7695. }
  7696. // Swipe Right
  7697. if (direction === 2 && (x < -1 * $this.innerWidth() / 2 || velocityX > 0.75)) {
  7698. swipeRight = true;
  7699. }
  7700. }
  7701. }).on('panend', function (e) {
  7702. // Reset if collection is moved back into original position
  7703. if (Math.abs(e.gesture.deltaX) < $(this).innerWidth() / 2) {
  7704. swipeRight = false;
  7705. swipeLeft = false;
  7706. }
  7707. if (e.gesture.pointerType === "touch") {
  7708. var $this = $(this);
  7709. if (swipeLeft || swipeRight) {
  7710. var fullWidth;
  7711. if (swipeLeft) {
  7712. fullWidth = $this.innerWidth();
  7713. } else {
  7714. fullWidth = -1 * $this.innerWidth();
  7715. }
  7716. $this.velocity({
  7717. translateX: fullWidth
  7718. }, {
  7719. duration: 100,
  7720. queue: false,
  7721. easing: 'easeOutQuad',
  7722. complete: function () {
  7723. $this.css('border', 'none');
  7724. $this.velocity({
  7725. height: 0,
  7726. padding: 0
  7727. }, {
  7728. duration: 200,
  7729. queue: false,
  7730. easing: 'easeOutQuad',
  7731. complete: function () {
  7732. $this.remove();
  7733. }
  7734. });
  7735. }
  7736. });
  7737. } else {
  7738. $this.velocity({
  7739. translateX: 0
  7740. }, {
  7741. duration: 100,
  7742. queue: false,
  7743. easing: 'easeOutQuad'
  7744. });
  7745. }
  7746. swipeLeft = false;
  7747. swipeRight = false;
  7748. }
  7749. });
  7750. });
  7751. // time = 0
  7752. // // Vertical Staggered list
  7753. // $('ul.staggered-list.vertical li').velocity(
  7754. // { translateY: "100px"},
  7755. // { duration: 0 });
  7756. // $('ul.staggered-list.vertical li').each(function() {
  7757. // $(this).velocity(
  7758. // { opacity: "1", translateY: "0"},
  7759. // { duration: 800, delay: time, easing: [60, 25] });
  7760. // time += 120;
  7761. // });
  7762. // // Fade in and Scale
  7763. // $('.fade-in.scale').velocity(
  7764. // { scaleX: .4, scaleY: .4, translateX: -600},
  7765. // { duration: 0});
  7766. // $('.fade-in').each(function() {
  7767. // $(this).velocity(
  7768. // { opacity: "1", scaleX: 1, scaleY: 1, translateX: 0},
  7769. // { duration: 800, easing: [60, 10] });
  7770. // });
  7771. });
  7772. }
  7773. )(jQuery);
  7774. ; (function ($) {
  7775. var scrollFireEventsHandled = false;
  7776. // Input: Array of JSON objects {selector, offset, callback}
  7777. Materialize.scrollFire = function (options) {
  7778. var onScroll = function () {
  7779. var windowScroll = window.pageYOffset + window.innerHeight;
  7780. for (var i = 0; i < options.length; i++) {
  7781. // Get options from each line
  7782. var value = options[i];
  7783. var selector = value.selector
  7784. , offset = value.offset
  7785. , callback = value.callback;
  7786. var currentElement = document.querySelector(selector);
  7787. if (currentElement !== null) {
  7788. var elementOffset = currentElement.getBoundingClientRect().top + window.pageYOffset;
  7789. if (windowScroll > elementOffset + offset) {
  7790. if (value.done !== true) {
  7791. if (typeof callback === 'function') {
  7792. callback.call(this, currentElement);
  7793. } else if (typeof callback === 'string') {
  7794. var callbackFunc = new Function(callback);
  7795. callbackFunc(currentElement);
  7796. }
  7797. value.done = true;
  7798. }
  7799. }
  7800. }
  7801. }
  7802. };
  7803. var throttledScroll = Materialize.throttle(function () {
  7804. onScroll();
  7805. }, options.throttle || 100);
  7806. if (!scrollFireEventsHandled) {
  7807. window.addEventListener("scroll", throttledScroll);
  7808. window.addEventListener("resize", throttledScroll);
  7809. scrollFireEventsHandled = true;
  7810. }
  7811. // perform a scan once, after current execution context, and after dom is ready
  7812. setTimeout(throttledScroll, 0);
  7813. }
  7814. ;
  7815. }
  7816. )(jQuery);
  7817. ;/*!
  7818. * pickadate.js v3.5.0, 2014/04/13
  7819. * By Amsul, http://amsul.ca
  7820. * Hosted on http://amsul.github.io/pickadate.js
  7821. * Licensed under MIT
  7822. */
  7823. (function (factory) {
  7824. Materialize.Picker = factory(jQuery);
  7825. }
  7826. )(function ($) {
  7827. var $window = $(window);
  7828. var $document = $(document);
  7829. var $html = $(document.documentElement);
  7830. /**
  7831. * The picker constructor that creates a blank picker.
  7832. */
  7833. function PickerConstructor(ELEMENT, NAME, COMPONENT, OPTIONS) {
  7834. // If there’s no element, return the picker constructor.
  7835. if (!ELEMENT)
  7836. return PickerConstructor;
  7837. var IS_DEFAULT_THEME = false
  7838. ,
  7839. // The state of the picker.
  7840. STATE = {
  7841. id: ELEMENT.id || 'P' + Math.abs(~~(Math.random() * new Date()))
  7842. }
  7843. ,
  7844. // Merge the defaults and options passed.
  7845. SETTINGS = COMPONENT ? $.extend(true, {}, COMPONENT.defaults, OPTIONS) : OPTIONS || {}
  7846. ,
  7847. // Merge the default classes with the settings classes.
  7848. CLASSES = $.extend({}, PickerConstructor.klasses(), SETTINGS.klass)
  7849. ,
  7850. // The element node wrapper into a jQuery object.
  7851. $ELEMENT = $(ELEMENT)
  7852. ,
  7853. // Pseudo picker constructor.
  7854. PickerInstance = function () {
  7855. return this.start();
  7856. }
  7857. ,
  7858. // The picker prototype.
  7859. P = PickerInstance.prototype = {
  7860. constructor: PickerInstance,
  7861. $node: $ELEMENT,
  7862. /**
  7863. * Initialize everything
  7864. */
  7865. start: function () {
  7866. // If it’s already started, do nothing.
  7867. if (STATE && STATE.start)
  7868. return P;
  7869. // Update the picker states.
  7870. STATE.methods = {};
  7871. STATE.start = true;
  7872. STATE.open = false;
  7873. STATE.type = ELEMENT.type;
  7874. // Confirm focus state, convert into text input to remove UA stylings,
  7875. // and set as readonly to prevent keyboard popup.
  7876. ELEMENT.autofocus = ELEMENT == getActiveElement();
  7877. ELEMENT.readOnly = !SETTINGS.editable;
  7878. ELEMENT.id = ELEMENT.id || STATE.id;
  7879. if (ELEMENT.type != 'text') {
  7880. ELEMENT.type = 'text';
  7881. }
  7882. // Create a new picker component with the settings.
  7883. P.component = new COMPONENT(P, SETTINGS);
  7884. // Create the picker root with a holder and then prepare it.
  7885. P.$root = $(PickerConstructor._.node('div', createWrappedComponent(), CLASSES.picker, 'id="' + ELEMENT.id + '_root" tabindex="0"'));
  7886. prepareElementRoot();
  7887. // If there’s a format for the hidden input element, create the element.
  7888. if (SETTINGS.formatSubmit) {
  7889. prepareElementHidden();
  7890. }
  7891. // Prepare the input element.
  7892. prepareElement();
  7893. // Insert the root as specified in the settings.
  7894. if (SETTINGS.container)
  7895. $(SETTINGS.container).append(P.$root);
  7896. else
  7897. $ELEMENT.before(P.$root);
  7898. // Bind the default component and settings events.
  7899. P.on({
  7900. start: P.component.onStart,
  7901. render: P.component.onRender,
  7902. stop: P.component.onStop,
  7903. open: P.component.onOpen,
  7904. close: P.component.onClose,
  7905. set: P.component.onSet
  7906. }).on({
  7907. start: SETTINGS.onStart,
  7908. render: SETTINGS.onRender,
  7909. stop: SETTINGS.onStop,
  7910. open: SETTINGS.onOpen,
  7911. close: SETTINGS.onClose,
  7912. set: SETTINGS.onSet
  7913. });
  7914. // Once we’re all set, check the theme in use.
  7915. IS_DEFAULT_THEME = isUsingDefaultTheme(P.$root.children()[0]);
  7916. // If the element has autofocus, open the picker.
  7917. if (ELEMENT.autofocus) {
  7918. P.open();
  7919. }
  7920. // Trigger queued the “start” and “render” events.
  7921. return P.trigger('start').trigger('render');
  7922. },
  7923. //start
  7924. /**
  7925. * Render a new picker
  7926. */
  7927. render: function (entireComponent) {
  7928. // Insert a new component holder in the root or box.
  7929. if (entireComponent)
  7930. P.$root.html(createWrappedComponent());
  7931. else
  7932. P.$root.find('.' + CLASSES.box).html(P.component.nodes(STATE.open));
  7933. // Trigger the queued “render” events.
  7934. return P.trigger('render');
  7935. },
  7936. //render
  7937. /**
  7938. * Destroy everything
  7939. */
  7940. stop: function () {
  7941. // If it’s already stopped, do nothing.
  7942. if (!STATE.start)
  7943. return P;
  7944. // Then close the picker.
  7945. P.close();
  7946. // Remove the hidden field.
  7947. if (P._hidden) {
  7948. P._hidden.parentNode.removeChild(P._hidden);
  7949. }
  7950. // Remove the root.
  7951. P.$root.remove();
  7952. // Remove the input class, remove the stored data, and unbind
  7953. // the events (after a tick for IE - see `P.close`).
  7954. $ELEMENT.removeClass(CLASSES.input).removeData(NAME);
  7955. setTimeout(function () {
  7956. $ELEMENT.off('.' + STATE.id);
  7957. }, 0);
  7958. // Restore the element state
  7959. ELEMENT.type = STATE.type;
  7960. ELEMENT.readOnly = false;
  7961. // Trigger the queued “stop” events.
  7962. P.trigger('stop');
  7963. // Reset the picker states.
  7964. STATE.methods = {};
  7965. STATE.start = false;
  7966. return P;
  7967. },
  7968. //stop
  7969. /**
  7970. * Open up the picker
  7971. */
  7972. open: function (dontGiveFocus) {
  7973. // If it’s already open, do nothing.
  7974. if (STATE.open)
  7975. return P;
  7976. // Add the “active” class.
  7977. $ELEMENT.addClass(CLASSES.active);
  7978. aria(ELEMENT, 'expanded', true);
  7979. // * A Firefox bug, when `html` has `overflow:hidden`, results in
  7980. // killing transitions :(. So add the “opened” state on the next tick.
  7981. // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=625289
  7982. setTimeout(function () {
  7983. // Add the “opened” class to the picker root.
  7984. P.$root.addClass(CLASSES.opened);
  7985. aria(P.$root[0], 'hidden', false);
  7986. }, 0);
  7987. // If we have to give focus, bind the element and doc events.
  7988. if (dontGiveFocus !== false) {
  7989. // Set it as open.
  7990. STATE.open = true;
  7991. // Prevent the page from scrolling.
  7992. if (IS_DEFAULT_THEME) {
  7993. $html.css('overflow', 'hidden').css('padding-right', '+=' + getScrollbarWidth());
  7994. }
  7995. // Pass focus to the root element’s jQuery object.
  7996. // * Workaround for iOS8 to bring the picker’s root into view.
  7997. P.$root.eq(0).focus();
  7998. // Bind the document events.
  7999. $document.on('click.' + STATE.id + ' focusin.' + STATE.id, function (event) {
  8000. var target = event.target;
  8001. // If the target of the event is not the element, close the picker picker.
  8002. // * Don’t worry about clicks or focusins on the root because those don’t bubble up.
  8003. // Also, for Firefox, a click on an `option` element bubbles up directly
  8004. // to the doc. So make sure the target wasn't the doc.
  8005. // * In Firefox stopPropagation() doesn’t prevent right-click events from bubbling,
  8006. // which causes the picker to unexpectedly close when right-clicking it. So make
  8007. // sure the event wasn’t a right-click.
  8008. if (target != ELEMENT && target != document && event.which != 3) {
  8009. // If the target was the holder that covers the screen,
  8010. // keep the element focused to maintain tabindex.
  8011. P.close(target === P.$root.children()[0]);
  8012. }
  8013. }).on('keydown.' + STATE.id, function (event) {
  8014. var // Get the keycode.
  8015. keycode = event.keyCode
  8016. ,
  8017. // Translate that to a selection change.
  8018. keycodeToMove = P.component.key[keycode]
  8019. ,
  8020. // Grab the target.
  8021. target = event.target;
  8022. // On escape, close the picker and give focus.
  8023. if (keycode == 27) {
  8024. P.close(true);
  8025. }
  8026. // Check if there is a key movement or “enter” keypress on the element.
  8027. else if (target == P.$root[0] && (keycodeToMove || keycode == 13)) {
  8028. // Prevent the default action to stop page movement.
  8029. event.preventDefault();
  8030. // Trigger the key movement action.
  8031. if (keycodeToMove) {
  8032. PickerConstructor._.trigger(P.component.key.go, P, [PickerConstructor._.trigger(keycodeToMove)]);
  8033. }
  8034. // On “enter”, if the highlighted item isn’t disabled, set the value and close.
  8035. else if (!P.$root.find('.' + CLASSES.highlighted).hasClass(CLASSES.disabled)) {
  8036. P.set('select', P.component.item.highlight);
  8037. if (SETTINGS.closeOnSelect) {
  8038. P.close(true);
  8039. }
  8040. }
  8041. }
  8042. // If the target is within the root and “enter” is pressed,
  8043. // prevent the default action and trigger a click on the target instead.
  8044. else if ($.contains(P.$root[0], target) && keycode == 13) {
  8045. event.preventDefault();
  8046. target.click();
  8047. }
  8048. });
  8049. }
  8050. // Trigger the queued “open” events.
  8051. return P.trigger('open');
  8052. },
  8053. //open
  8054. /**
  8055. * Close the picker
  8056. */
  8057. close: function (giveFocus) {
  8058. // If we need to give focus, do it before changing states.
  8059. if (giveFocus) {
  8060. // ....ah yes! It would’ve been incomplete without a crazy workaround for IE :|
  8061. // The focus is triggered *after* the close has completed - causing it
  8062. // to open again. So unbind and rebind the event at the next tick.
  8063. P.$root.off('focus.toOpen').eq(0).focus();
  8064. setTimeout(function () {
  8065. P.$root.on('focus.toOpen', handleFocusToOpenEvent);
  8066. }, 0);
  8067. }
  8068. // Remove the “active” class.
  8069. $ELEMENT.removeClass(CLASSES.active);
  8070. aria(ELEMENT, 'expanded', false);
  8071. // * A Firefox bug, when `html` has `overflow:hidden`, results in
  8072. // killing transitions :(. So remove the “opened” state on the next tick.
  8073. // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=625289
  8074. setTimeout(function () {
  8075. // Remove the “opened” and “focused” class from the picker root.
  8076. P.$root.removeClass(CLASSES.opened + ' ' + CLASSES.focused);
  8077. aria(P.$root[0], 'hidden', true);
  8078. }, 0);
  8079. // If it’s already closed, do nothing more.
  8080. if (!STATE.open)
  8081. return P;
  8082. // Set it as closed.
  8083. STATE.open = false;
  8084. // Allow the page to scroll.
  8085. if (IS_DEFAULT_THEME) {
  8086. $html.css('overflow', '').css('padding-right', '-=' + getScrollbarWidth());
  8087. }
  8088. // Unbind the document events.
  8089. $document.off('.' + STATE.id);
  8090. // Trigger the queued “close” events.
  8091. return P.trigger('close');
  8092. },
  8093. //close
  8094. /**
  8095. * Clear the values
  8096. */
  8097. clear: function (options) {
  8098. return P.set('clear', null, options);
  8099. },
  8100. //clear
  8101. /**
  8102. * Set something
  8103. */
  8104. set: function (thing, value, options) {
  8105. var thingItem, thingValue, thingIsObject = $.isPlainObject(thing), thingObject = thingIsObject ? thing : {};
  8106. // Make sure we have usable options.
  8107. options = thingIsObject && $.isPlainObject(value) ? value : options || {};
  8108. if (thing) {
  8109. // If the thing isn’t an object, make it one.
  8110. if (!thingIsObject) {
  8111. thingObject[thing] = value;
  8112. }
  8113. // Go through the things of items to set.
  8114. for (thingItem in thingObject) {
  8115. // Grab the value of the thing.
  8116. thingValue = thingObject[thingItem];
  8117. // First, if the item exists and there’s a value, set it.
  8118. if (thingItem in P.component.item) {
  8119. if (thingValue === undefined)
  8120. thingValue = null;
  8121. P.component.set(thingItem, thingValue, options);
  8122. }
  8123. // Then, check to update the element value and broadcast a change.
  8124. if (thingItem == 'select' || thingItem == 'clear') {
  8125. $ELEMENT.val(thingItem == 'clear' ? '' : P.get(thingItem, SETTINGS.format)).trigger('change');
  8126. }
  8127. }
  8128. // Render a new picker.
  8129. P.render();
  8130. }
  8131. // When the method isn’t muted, trigger queued “set” events and pass the `thingObject`.
  8132. return options.muted ? P : P.trigger('set', thingObject);
  8133. },
  8134. //set
  8135. /**
  8136. * Get something
  8137. */
  8138. get: function (thing, format) {
  8139. // Make sure there’s something to get.
  8140. thing = thing || 'value';
  8141. // If a picker state exists, return that.
  8142. if (STATE[thing] != null) {
  8143. return STATE[thing];
  8144. }
  8145. // Return the submission value, if that.
  8146. if (thing == 'valueSubmit') {
  8147. if (P._hidden) {
  8148. return P._hidden.value;
  8149. }
  8150. thing = 'value';
  8151. }
  8152. // Return the value, if that.
  8153. if (thing == 'value') {
  8154. return ELEMENT.value;
  8155. }
  8156. // Check if a component item exists, return that.
  8157. if (thing in P.component.item) {
  8158. if (typeof format == 'string') {
  8159. var thingValue = P.component.get(thing);
  8160. return thingValue ? PickerConstructor._.trigger(P.component.formats.toString, P.component, [format, thingValue]) : '';
  8161. }
  8162. return P.component.get(thing);
  8163. }
  8164. },
  8165. //get
  8166. /**
  8167. * Bind events on the things.
  8168. */
  8169. on: function (thing, method, internal) {
  8170. var thingName, thingMethod, thingIsObject = $.isPlainObject(thing), thingObject = thingIsObject ? thing : {};
  8171. if (thing) {
  8172. // If the thing isn’t an object, make it one.
  8173. if (!thingIsObject) {
  8174. thingObject[thing] = method;
  8175. }
  8176. // Go through the things to bind to.
  8177. for (thingName in thingObject) {
  8178. // Grab the method of the thing.
  8179. thingMethod = thingObject[thingName];
  8180. // If it was an internal binding, prefix it.
  8181. if (internal) {
  8182. thingName = '_' + thingName;
  8183. }
  8184. // Make sure the thing methods collection exists.
  8185. STATE.methods[thingName] = STATE.methods[thingName] || [];
  8186. // Add the method to the relative method collection.
  8187. STATE.methods[thingName].push(thingMethod);
  8188. }
  8189. }
  8190. return P;
  8191. },
  8192. //on
  8193. /**
  8194. * Unbind events on the things.
  8195. */
  8196. off: function () {
  8197. var i, thingName, names = arguments;
  8198. for (i = 0,
  8199. namesCount = names.length; i < namesCount; i += 1) {
  8200. thingName = names[i];
  8201. if (thingName in STATE.methods) {
  8202. delete STATE.methods[thingName];
  8203. }
  8204. }
  8205. return P;
  8206. },
  8207. /**
  8208. * Fire off method events.
  8209. */
  8210. trigger: function (name, data) {
  8211. var _trigger = function (name) {
  8212. var methodList = STATE.methods[name];
  8213. if (methodList) {
  8214. methodList.map(function (method) {
  8215. PickerConstructor._.trigger(method, P, [data]);
  8216. });
  8217. }
  8218. };
  8219. _trigger('_' + name);
  8220. _trigger(name);
  8221. return P;
  8222. }//trigger
  8223. //PickerInstance.prototype
  8224. /**
  8225. * Wrap the picker holder components together.
  8226. */
  8227. };
  8228. function createWrappedComponent() {
  8229. // Create a picker wrapper holder
  8230. return PickerConstructor._.node('div',
  8231. // Create a picker wrapper node
  8232. PickerConstructor._.node('div',
  8233. // Create a picker frame
  8234. PickerConstructor._.node('div',
  8235. // Create a picker box node
  8236. PickerConstructor._.node('div',
  8237. // Create the components nodes.
  8238. P.component.nodes(STATE.open),
  8239. // The picker box class
  8240. CLASSES.box),
  8241. // Picker wrap class
  8242. CLASSES.wrap),
  8243. // Picker frame class
  8244. CLASSES.frame),
  8245. // Picker holder class
  8246. CLASSES.holder);
  8247. //endreturn
  8248. }
  8249. //createWrappedComponent
  8250. /**
  8251. * Prepare the input element with all bindings.
  8252. */
  8253. function prepareElement() {
  8254. $ELEMENT.
  8255. // Store the picker data by component name.
  8256. data(NAME, P).
  8257. // Add the “input” class name.
  8258. addClass(CLASSES.input).
  8259. // Remove the tabindex.
  8260. attr('tabindex', -1).
  8261. // If there’s a `data-value`, update the value of the element.
  8262. val($ELEMENT.data('value') ? P.get('select', SETTINGS.format) : ELEMENT.value);
  8263. // Only bind keydown events if the element isn’t editable.
  8264. if (!SETTINGS.editable) {
  8265. $ELEMENT.
  8266. // On focus/click, focus onto the root to open it up.
  8267. on('focus.' + STATE.id + ' click.' + STATE.id, function (event) {
  8268. event.preventDefault();
  8269. P.$root.eq(0).focus();
  8270. }).
  8271. // Handle keyboard event based on the picker being opened or not.
  8272. on('keydown.' + STATE.id, handleKeydownEvent);
  8273. }
  8274. // Update the aria attributes.
  8275. aria(ELEMENT, {
  8276. haspopup: true,
  8277. expanded: false,
  8278. readonly: false,
  8279. owns: ELEMENT.id + '_root'
  8280. });
  8281. }
  8282. /**
  8283. * Prepare the root picker element with all bindings.
  8284. */
  8285. function prepareElementRoot() {
  8286. P.$root.on({
  8287. // For iOS8.
  8288. keydown: handleKeydownEvent,
  8289. // When something within the root is focused, stop from bubbling
  8290. // to the doc and remove the “focused” state from the root.
  8291. focusin: function (event) {
  8292. P.$root.removeClass(CLASSES.focused);
  8293. event.stopPropagation();
  8294. },
  8295. // When something within the root holder is clicked, stop it
  8296. // from bubbling to the doc.
  8297. 'mousedown click': function (event) {
  8298. var target = event.target;
  8299. // Make sure the target isn’t the root holder so it can bubble up.
  8300. if (target != P.$root.children()[0]) {
  8301. event.stopPropagation();
  8302. // * For mousedown events, cancel the default action in order to
  8303. // prevent cases where focus is shifted onto external elements
  8304. // when using things like jQuery mobile or MagnificPopup (ref: #249 & #120).
  8305. // Also, for Firefox, don’t prevent action on the `option` element.
  8306. if (event.type == 'mousedown' && !$(target).is('input, select, textarea, button, option')) {
  8307. event.preventDefault();
  8308. // Re-focus onto the root so that users can click away
  8309. // from elements focused within the picker.
  8310. P.$root.eq(0).focus();
  8311. }
  8312. }
  8313. }
  8314. }).
  8315. // Add/remove the “target” class on focus and blur.
  8316. on({
  8317. focus: function () {
  8318. $ELEMENT.addClass(CLASSES.target);
  8319. },
  8320. blur: function () {
  8321. $ELEMENT.removeClass(CLASSES.target);
  8322. }
  8323. }).
  8324. // Open the picker and adjust the root “focused” state
  8325. on('focus.toOpen', handleFocusToOpenEvent).
  8326. // If there’s a click on an actionable element, carry out the actions.
  8327. on('click', '[data-pick], [data-nav], [data-clear], [data-close]', function () {
  8328. var $target = $(this)
  8329. , targetData = $target.data()
  8330. , targetDisabled = $target.hasClass(CLASSES.navDisabled) || $target.hasClass(CLASSES.disabled)
  8331. ,
  8332. // * For IE, non-focusable elements can be active elements as well
  8333. // (http://stackoverflow.com/a/2684561).
  8334. activeElement = getActiveElement();
  8335. activeElement = activeElement && (activeElement.type || activeElement.href) && activeElement;
  8336. // If it’s disabled or nothing inside is actively focused, re-focus the element.
  8337. if (targetDisabled || activeElement && !$.contains(P.$root[0], activeElement)) {
  8338. P.$root.eq(0).focus();
  8339. }
  8340. // If something is superficially changed, update the `highlight` based on the `nav`.
  8341. if (!targetDisabled && targetData.nav) {
  8342. P.set('highlight', P.component.item.highlight, {
  8343. nav: targetData.nav
  8344. });
  8345. }
  8346. // If something is picked, set `select` then close with focus.
  8347. else if (!targetDisabled && 'pick' in targetData) {
  8348. P.set('select', targetData.pick);
  8349. if (SETTINGS.closeOnSelect) {
  8350. P.close(true);
  8351. }
  8352. }
  8353. // If a “clear” button is pressed, empty the values and close with focus.
  8354. else if (targetData.clear) {
  8355. P.clear();
  8356. if (SETTINGS.closeOnSelect) {
  8357. P.close(true);
  8358. }
  8359. } else if (targetData.close) {
  8360. P.close(true);
  8361. }
  8362. });
  8363. //P.$root
  8364. aria(P.$root[0], 'hidden', true);
  8365. }
  8366. /**
  8367. * Prepare the hidden input element along with all bindings.
  8368. */
  8369. function prepareElementHidden() {
  8370. var name;
  8371. if (SETTINGS.hiddenName === true) {
  8372. name = ELEMENT.name;
  8373. ELEMENT.name = '';
  8374. } else {
  8375. name = [typeof SETTINGS.hiddenPrefix == 'string' ? SETTINGS.hiddenPrefix : '', typeof SETTINGS.hiddenSuffix == 'string' ? SETTINGS.hiddenSuffix : '_submit'];
  8376. name = name[0] + ELEMENT.name + name[1];
  8377. }
  8378. P._hidden = $('<input ' + 'type=hidden ' +
  8379. // Create the name using the original input’s with a prefix and suffix.
  8380. 'name="' + name + '"' + (
  8381. // If the element has a value, set the hidden value as well.
  8382. $ELEMENT.data('value') || ELEMENT.value ? ' value="' + P.get('select', SETTINGS.formatSubmit) + '"' : '') + '>')[0];
  8383. $ELEMENT.
  8384. // If the value changes, update the hidden input with the correct format.
  8385. on('change.' + STATE.id, function () {
  8386. P._hidden.value = ELEMENT.value ? P.get('select', SETTINGS.formatSubmit) : '';
  8387. });
  8388. // Insert the hidden input as specified in the settings.
  8389. if (SETTINGS.container)
  8390. $(SETTINGS.container).append(P._hidden);
  8391. else
  8392. $ELEMENT.before(P._hidden);
  8393. }
  8394. // For iOS8.
  8395. function handleKeydownEvent(event) {
  8396. var keycode = event.keyCode
  8397. ,
  8398. // Check if one of the delete keys was pressed.
  8399. isKeycodeDelete = /^(8|46)$/.test(keycode);
  8400. // For some reason IE clears the input value on “escape”.
  8401. if (keycode == 27) {
  8402. P.close();
  8403. return false;
  8404. }
  8405. // Check if `space` or `delete` was pressed or the picker is closed with a key movement.
  8406. if (keycode == 32 || isKeycodeDelete || !STATE.open && P.component.key[keycode]) {
  8407. // Prevent it from moving the page and bubbling to doc.
  8408. event.preventDefault();
  8409. event.stopPropagation();
  8410. // If `delete` was pressed, clear the values and close the picker.
  8411. // Otherwise open the picker.
  8412. if (isKeycodeDelete) {
  8413. P.clear().close();
  8414. } else {
  8415. P.open();
  8416. }
  8417. }
  8418. }
  8419. // Separated for IE
  8420. function handleFocusToOpenEvent(event) {
  8421. // Stop the event from propagating to the doc.
  8422. event.stopPropagation();
  8423. // If it’s a focus event, add the “focused” class to the root.
  8424. if (event.type == 'focus') {
  8425. P.$root.addClass(CLASSES.focused);
  8426. }
  8427. // And then finally open the picker.
  8428. P.open();
  8429. }
  8430. // Return a new picker instance.
  8431. return new PickerInstance();
  8432. }
  8433. //PickerConstructor
  8434. /**
  8435. * The default classes and prefix to use for the HTML classes.
  8436. */
  8437. PickerConstructor.klasses = function (prefix) {
  8438. prefix = prefix || 'picker';
  8439. return {
  8440. picker: prefix,
  8441. opened: prefix + '--opened',
  8442. focused: prefix + '--focused',
  8443. input: prefix + '__input',
  8444. active: prefix + '__input--active',
  8445. target: prefix + '__input--target',
  8446. holder: prefix + '__holder',
  8447. frame: prefix + '__frame',
  8448. wrap: prefix + '__wrap',
  8449. box: prefix + '__box'
  8450. };
  8451. }
  8452. ;
  8453. //PickerConstructor.klasses
  8454. /**
  8455. * Check if the default theme is being used.
  8456. */
  8457. function isUsingDefaultTheme(element) {
  8458. var theme, prop = 'position';
  8459. // For IE.
  8460. if (element.currentStyle) {
  8461. theme = element.currentStyle[prop];
  8462. }
  8463. // For normal browsers.
  8464. else if (window.getComputedStyle) {
  8465. theme = getComputedStyle(element)[prop];
  8466. }
  8467. return theme == 'fixed';
  8468. }
  8469. /**
  8470. * Get the width of the browser’s scrollbar.
  8471. * Taken from: https://github.com/VodkaBears/Remodal/blob/master/src/jquery.remodal.js
  8472. */
  8473. function getScrollbarWidth() {
  8474. if ($html.height() <= $window.height()) {
  8475. return 0;
  8476. }
  8477. var $outer = $('<div style="visibility:hidden;width:100px" />').appendTo('body');
  8478. // Get the width without scrollbars.
  8479. var widthWithoutScroll = $outer[0].offsetWidth;
  8480. // Force adding scrollbars.
  8481. $outer.css('overflow', 'scroll');
  8482. // Add the inner div.
  8483. var $inner = $('<div style="width:100%" />').appendTo($outer);
  8484. // Get the width with scrollbars.
  8485. var widthWithScroll = $inner[0].offsetWidth;
  8486. // Remove the divs.
  8487. $outer.remove();
  8488. // Return the difference between the widths.
  8489. return widthWithoutScroll - widthWithScroll;
  8490. }
  8491. /**
  8492. * PickerConstructor helper methods.
  8493. */
  8494. PickerConstructor._ = {
  8495. /**
  8496. * Create a group of nodes. Expects:
  8497. * `
  8498. {
  8499. min: {Integer},
  8500. max: {Integer},
  8501. i: {Integer},
  8502. node: {String},
  8503. item: {Function}
  8504. }
  8505. * `
  8506. */
  8507. group: function (groupObject) {
  8508. var // Scope for the looped object
  8509. loopObjectScope,
  8510. // Create the nodes list
  8511. nodesList = '',
  8512. // The counter starts from the `min`
  8513. counter = PickerConstructor._.trigger(groupObject.min, groupObject);
  8514. // Loop from the `min` to `max`, incrementing by `i`
  8515. for (; counter <= PickerConstructor._.trigger(groupObject.max, groupObject, [counter]); counter += groupObject.i) {
  8516. // Trigger the `item` function within scope of the object
  8517. loopObjectScope = PickerConstructor._.trigger(groupObject.item, groupObject, [counter]);
  8518. // Splice the subgroup and create nodes out of the sub nodes
  8519. nodesList += PickerConstructor._.node(groupObject.node, loopObjectScope[0], // the node
  8520. loopObjectScope[1], // the classes
  8521. loopObjectScope[2]// the attributes
  8522. );
  8523. }
  8524. // Return the list of nodes
  8525. return nodesList;
  8526. },
  8527. //group
  8528. /**
  8529. * Create a dom node string
  8530. */
  8531. node: function (wrapper, item, klass, attribute) {
  8532. // If the item is false-y, just return an empty string
  8533. if (!item)
  8534. return '';
  8535. // If the item is an array, do a join
  8536. item = $.isArray(item) ? item.join('') : item;
  8537. // Check for the class
  8538. klass = klass ? ' class="' + klass + '"' : '';
  8539. // Check for any attributes
  8540. attribute = attribute ? ' ' + attribute : '';
  8541. // Return the wrapped item
  8542. return '<' + wrapper + klass + attribute + '>' + item + '</' + wrapper + '>';
  8543. },
  8544. //node
  8545. /**
  8546. * Lead numbers below 10 with a zero.
  8547. */
  8548. lead: function (number) {
  8549. return (number < 10 ? '0' : '') + number;
  8550. },
  8551. /**
  8552. * Trigger a function otherwise return the value.
  8553. */
  8554. trigger: function (callback, scope, args) {
  8555. return typeof callback == 'function' ? callback.apply(scope, args || []) : callback;
  8556. },
  8557. /**
  8558. * If the second character is a digit, length is 2 otherwise 1.
  8559. */
  8560. digits: function (string) {
  8561. return (/\d/.test(string[1]) ? 2 : 1);
  8562. },
  8563. /**
  8564. * Tell if something is a date object.
  8565. */
  8566. isDate: function (value) {
  8567. return {}.toString.call(value).indexOf('Date') > -1 && this.isInteger(value.getDate());
  8568. },
  8569. /**
  8570. * Tell if something is an integer.
  8571. */
  8572. isInteger: function (value) {
  8573. return {}.toString.call(value).indexOf('Number') > -1 && value % 1 === 0;
  8574. },
  8575. /**
  8576. * Create ARIA attribute strings.
  8577. */
  8578. ariaAttr: ariaAttr //PickerConstructor._
  8579. /**
  8580. * Extend the picker with a component and defaults.
  8581. */
  8582. };
  8583. PickerConstructor.extend = function (name, Component) {
  8584. // Extend jQuery.
  8585. $.fn[name] = function (options, action) {
  8586. // Grab the component data.
  8587. var componentData = this.data(name);
  8588. // If the picker is requested, return the data object.
  8589. if (options == 'picker') {
  8590. return componentData;
  8591. }
  8592. // If the component data exists and `options` is a string, carry out the action.
  8593. if (componentData && typeof options == 'string') {
  8594. return PickerConstructor._.trigger(componentData[options], componentData, [action]);
  8595. }
  8596. // Otherwise go through each matched element and if the component
  8597. // doesn’t exist, create a new picker using `this` element
  8598. // and merging the defaults and options with a deep copy.
  8599. return this.each(function () {
  8600. var $this = $(this);
  8601. if (!$this.data(name)) {
  8602. new PickerConstructor(this, name, Component, options);
  8603. }
  8604. });
  8605. }
  8606. ;
  8607. // Set the defaults.
  8608. $.fn[name].defaults = Component.defaults;
  8609. }
  8610. ;
  8611. //PickerConstructor.extend
  8612. function aria(element, attribute, value) {
  8613. if ($.isPlainObject(attribute)) {
  8614. for (var key in attribute) {
  8615. ariaSet(element, key, attribute[key]);
  8616. }
  8617. } else {
  8618. ariaSet(element, attribute, value);
  8619. }
  8620. }
  8621. function ariaSet(element, attribute, value) {
  8622. element.setAttribute((attribute == 'role' ? '' : 'aria-') + attribute, value);
  8623. }
  8624. function ariaAttr(attribute, data) {
  8625. if (!$.isPlainObject(attribute)) {
  8626. attribute = {
  8627. attribute: data
  8628. };
  8629. }
  8630. data = '';
  8631. for (var key in attribute) {
  8632. var attr = (key == 'role' ? '' : 'aria-') + key
  8633. , attrVal = attribute[key];
  8634. data += attrVal == null ? '' : attr + '="' + attribute[key] + '"';
  8635. }
  8636. return data;
  8637. }
  8638. // IE8 bug throws an error for activeElements within iframes.
  8639. function getActiveElement() {
  8640. try {
  8641. return document.activeElement;
  8642. } catch (err) { }
  8643. }
  8644. // Expose the picker constructor.
  8645. return PickerConstructor;
  8646. });
  8647. ;/*!
  8648. * Date picker for pickadate.js v3.5.0
  8649. * http://amsul.github.io/pickadate.js/date.htm
  8650. */
  8651. (function (factory) {
  8652. factory(Materialize.Picker, jQuery);
  8653. }
  8654. )(function (Picker, $) {
  8655. /**
  8656. * Globals and constants
  8657. */
  8658. var DAYS_IN_WEEK = 7
  8659. , WEEKS_IN_CALENDAR = 6
  8660. , _ = Picker._;
  8661. /**
  8662. * The date picker constructor
  8663. */
  8664. function DatePicker(picker, settings) {
  8665. var calendar = this
  8666. , element = picker.$node[0]
  8667. , elementValue = element.value
  8668. , elementDataValue = picker.$node.data('value')
  8669. , valueString = elementDataValue || elementValue
  8670. , formatString = elementDataValue ? settings.formatSubmit : settings.format
  8671. , isRTL = function () {
  8672. return element.currentStyle ?
  8673. // For IE.
  8674. element.currentStyle.direction == 'rtl' :
  8675. // For normal browsers.
  8676. getComputedStyle(picker.$root[0]).direction == 'rtl';
  8677. };
  8678. calendar.settings = settings;
  8679. calendar.$node = picker.$node;
  8680. // The queue of methods that will be used to build item objects.
  8681. calendar.queue = {
  8682. min: 'measure create',
  8683. max: 'measure create',
  8684. now: 'now create',
  8685. select: 'parse create validate',
  8686. highlight: 'parse navigate create validate',
  8687. view: 'parse create validate viewset',
  8688. disable: 'deactivate',
  8689. enable: 'activate'
  8690. // The component's item object.
  8691. };
  8692. calendar.item = {};
  8693. calendar.item.clear = null;
  8694. calendar.item.disable = (settings.disable || []).slice(0);
  8695. calendar.item.enable = -function (collectionDisabled) {
  8696. return collectionDisabled[0] === true ? collectionDisabled.shift() : -1;
  8697. }(calendar.item.disable);
  8698. calendar.set('min', settings.min).set('max', settings.max).set('now');
  8699. // When there’s a value, set the `select`, which in turn
  8700. // also sets the `highlight` and `view`.
  8701. if (valueString) {
  8702. calendar.set('select', valueString, {
  8703. format: formatString
  8704. });
  8705. }
  8706. // If there’s no value, default to highlighting “today”.
  8707. else {
  8708. calendar.set('select', null).set('highlight', calendar.item.now);
  8709. }
  8710. // The keycode to movement mapping.
  8711. calendar.key = {
  8712. 40: 7,
  8713. // Down
  8714. 38: -7,
  8715. // Up
  8716. 39: function () {
  8717. return isRTL() ? -1 : 1;
  8718. },
  8719. // Right
  8720. 37: function () {
  8721. return isRTL() ? 1 : -1;
  8722. },
  8723. // Left
  8724. go: function (timeChange) {
  8725. var highlightedObject = calendar.item.highlight
  8726. , targetDate = new Date(highlightedObject.year, highlightedObject.month, highlightedObject.date + timeChange);
  8727. calendar.set('highlight', targetDate, {
  8728. interval: timeChange
  8729. });
  8730. this.render();
  8731. }
  8732. // Bind some picker events.
  8733. };
  8734. picker.on('render', function () {
  8735. picker.$root.find('.' + settings.klass.selectMonth).on('change', function () {
  8736. var value = this.value;
  8737. if (value) {
  8738. picker.set('highlight', [picker.get('view').year, value, picker.get('highlight').date]);
  8739. picker.$root.find('.' + settings.klass.selectMonth).trigger('focus');
  8740. }
  8741. });
  8742. picker.$root.find('.' + settings.klass.selectYear).on('change', function () {
  8743. var value = this.value;
  8744. if (value) {
  8745. picker.set('highlight', [value, picker.get('view').month, picker.get('highlight').date]);
  8746. picker.$root.find('.' + settings.klass.selectYear).trigger('focus');
  8747. }
  8748. });
  8749. }, 1).on('open', function () {
  8750. var includeToday = '';
  8751. if (calendar.disabled(calendar.get('now'))) {
  8752. includeToday = ':not(.' + settings.klass.buttonToday + ')';
  8753. }
  8754. picker.$root.find('button' + includeToday + ', select').attr('disabled', false);
  8755. }, 1).on('close', function () {
  8756. picker.$root.find('button, select').attr('disabled', true);
  8757. }, 1);
  8758. }
  8759. //DatePicker
  8760. /**
  8761. * Set a datepicker item object.
  8762. */
  8763. DatePicker.prototype.set = function (type, value, options) {
  8764. var calendar = this
  8765. , calendarItem = calendar.item;
  8766. // If the value is `null` just set it immediately.
  8767. if (value === null) {
  8768. if (type == 'clear')
  8769. type = 'select';
  8770. calendarItem[type] = value;
  8771. return calendar;
  8772. }
  8773. // Otherwise go through the queue of methods, and invoke the functions.
  8774. // Update this as the time unit, and set the final value as this item.
  8775. // * In the case of `enable`, keep the queue but set `disable` instead.
  8776. // And in the case of `flip`, keep the queue but set `enable` instead.
  8777. calendarItem[type == 'enable' ? 'disable' : type == 'flip' ? 'enable' : type] = calendar.queue[type].split(' ').map(function (method) {
  8778. value = calendar[method](type, value, options);
  8779. return value;
  8780. }).pop();
  8781. // Check if we need to cascade through more updates.
  8782. if (type == 'select') {
  8783. calendar.set('highlight', calendarItem.select, options);
  8784. } else if (type == 'highlight') {
  8785. calendar.set('view', calendarItem.highlight, options);
  8786. } else if (type.match(/^(flip|min|max|disable|enable)$/)) {
  8787. if (calendarItem.select && calendar.disabled(calendarItem.select)) {
  8788. calendar.set('select', calendarItem.select, options);
  8789. }
  8790. if (calendarItem.highlight && calendar.disabled(calendarItem.highlight)) {
  8791. calendar.set('highlight', calendarItem.highlight, options);
  8792. }
  8793. }
  8794. return calendar;
  8795. }
  8796. ;
  8797. //DatePicker.prototype.set
  8798. /**
  8799. * Get a datepicker item object.
  8800. */
  8801. DatePicker.prototype.get = function (type) {
  8802. return this.item[type];
  8803. }
  8804. ;
  8805. //DatePicker.prototype.get
  8806. /**
  8807. * Create a picker date object.
  8808. */
  8809. DatePicker.prototype.create = function (type, value, options) {
  8810. var isInfiniteValue, calendar = this;
  8811. // If there’s no value, use the type as the value.
  8812. value = value === undefined ? type : value;
  8813. // If it’s infinity, update the value.
  8814. if (value == -Infinity || value == Infinity) {
  8815. isInfiniteValue = value;
  8816. }
  8817. // If it’s an object, use the native date object.
  8818. else if ($.isPlainObject(value) && _.isInteger(value.pick)) {
  8819. value = value.obj;
  8820. }
  8821. // If it’s an array, convert it into a date and make sure
  8822. // that it’s a valid date – otherwise default to today.
  8823. else if ($.isArray(value)) {
  8824. value = new Date(value[0], value[1], value[2]);
  8825. value = _.isDate(value) ? value : calendar.create().obj;
  8826. }
  8827. // If it’s a number or date object, make a normalized date.
  8828. else if (_.isInteger(value) || _.isDate(value)) {
  8829. value = calendar.normalize(new Date(value), options);
  8830. }
  8831. // If it’s a literal true or any other case, set it to now.
  8832. else /*if ( value === true )*/ {
  8833. value = calendar.now(type, value, options);
  8834. }
  8835. // Return the compiled object.
  8836. return {
  8837. year: isInfiniteValue || value.getFullYear(),
  8838. month: isInfiniteValue || value.getMonth(),
  8839. date: isInfiniteValue || value.getDate(),
  8840. day: isInfiniteValue || value.getDay(),
  8841. obj: isInfiniteValue || value,
  8842. pick: isInfiniteValue || value.getTime()
  8843. };
  8844. }
  8845. ;
  8846. //DatePicker.prototype.create
  8847. /**
  8848. * Create a range limit object using an array, date object,
  8849. * literal “true”, or integer relative to another time.
  8850. */
  8851. DatePicker.prototype.createRange = function (from, to) {
  8852. var calendar = this
  8853. , createDate = function (date) {
  8854. if (date === true || $.isArray(date) || _.isDate(date)) {
  8855. return calendar.create(date);
  8856. }
  8857. return date;
  8858. };
  8859. // Create objects if possible.
  8860. if (!_.isInteger(from)) {
  8861. from = createDate(from);
  8862. }
  8863. if (!_.isInteger(to)) {
  8864. to = createDate(to);
  8865. }
  8866. // Create relative dates.
  8867. if (_.isInteger(from) && $.isPlainObject(to)) {
  8868. from = [to.year, to.month, to.date + from];
  8869. } else if (_.isInteger(to) && $.isPlainObject(from)) {
  8870. to = [from.year, from.month, from.date + to];
  8871. }
  8872. return {
  8873. from: createDate(from),
  8874. to: createDate(to)
  8875. };
  8876. }
  8877. ;
  8878. //DatePicker.prototype.createRange
  8879. /**
  8880. * Check if a date unit falls within a date range object.
  8881. */
  8882. DatePicker.prototype.withinRange = function (range, dateUnit) {
  8883. range = this.createRange(range.from, range.to);
  8884. return dateUnit.pick >= range.from.pick && dateUnit.pick <= range.to.pick;
  8885. }
  8886. ;
  8887. /**
  8888. * Check if two date range objects overlap.
  8889. */
  8890. DatePicker.prototype.overlapRanges = function (one, two) {
  8891. var calendar = this;
  8892. // Convert the ranges into comparable dates.
  8893. one = calendar.createRange(one.from, one.to);
  8894. two = calendar.createRange(two.from, two.to);
  8895. return calendar.withinRange(one, two.from) || calendar.withinRange(one, two.to) || calendar.withinRange(two, one.from) || calendar.withinRange(two, one.to);
  8896. }
  8897. ;
  8898. /**
  8899. * Get the date today.
  8900. */
  8901. DatePicker.prototype.now = function (type, value, options) {
  8902. value = new Date();
  8903. if (options && options.rel) {
  8904. value.setDate(value.getDate() + options.rel);
  8905. }
  8906. return this.normalize(value, options);
  8907. }
  8908. ;
  8909. /**
  8910. * Navigate to next/prev month.
  8911. */
  8912. DatePicker.prototype.navigate = function (type, value, options) {
  8913. var targetDateObject, targetYear, targetMonth, targetDate, isTargetArray = $.isArray(value), isTargetObject = $.isPlainObject(value), viewsetObject = this.item.view;
  8914. /*,
  8915. safety = 100*/
  8916. if (isTargetArray || isTargetObject) {
  8917. if (isTargetObject) {
  8918. targetYear = value.year;
  8919. targetMonth = value.month;
  8920. targetDate = value.date;
  8921. } else {
  8922. targetYear = +value[0];
  8923. targetMonth = +value[1];
  8924. targetDate = +value[2];
  8925. }
  8926. // If we’re navigating months but the view is in a different
  8927. // month, navigate to the view’s year and month.
  8928. if (options && options.nav && viewsetObject && viewsetObject.month !== targetMonth) {
  8929. targetYear = viewsetObject.year;
  8930. targetMonth = viewsetObject.month;
  8931. }
  8932. // Figure out the expected target year and month.
  8933. targetDateObject = new Date(targetYear, targetMonth + (options && options.nav ? options.nav : 0), 1);
  8934. targetYear = targetDateObject.getFullYear();
  8935. targetMonth = targetDateObject.getMonth();
  8936. // If the month we’re going to doesn’t have enough days,
  8937. // keep decreasing the date until we reach the month’s last date.
  8938. while (/*safety &&*/
  8939. new Date(targetYear, targetMonth, targetDate).getMonth() !== targetMonth) {
  8940. targetDate -= 1;
  8941. /*safety -= 1
  8942. if ( !safety ) {
  8943. throw 'Fell into an infinite loop while navigating to ' + new Date( targetYear, targetMonth, targetDate ) + '.'
  8944. }*/
  8945. }
  8946. value = [targetYear, targetMonth, targetDate];
  8947. }
  8948. return value;
  8949. }
  8950. ;
  8951. //DatePicker.prototype.navigate
  8952. /**
  8953. * Normalize a date by setting the hours to midnight.
  8954. */
  8955. DatePicker.prototype.normalize = function (value /*, options*/
  8956. ) {
  8957. value.setHours(0, 0, 0, 0);
  8958. return value;
  8959. }
  8960. ;
  8961. /**
  8962. * Measure the range of dates.
  8963. */
  8964. DatePicker.prototype.measure = function (type, value /*, options*/
  8965. ) {
  8966. var calendar = this;
  8967. // If it’s anything false-y, remove the limits.
  8968. if (!value) {
  8969. value = type == 'min' ? -Infinity : Infinity;
  8970. }
  8971. // If it’s a string, parse it.
  8972. else if (typeof value == 'string') {
  8973. value = calendar.parse(type, value);
  8974. }
  8975. // If it's an integer, get a date relative to today.
  8976. else if (_.isInteger(value)) {
  8977. value = calendar.now(type, value, {
  8978. rel: value
  8979. });
  8980. }
  8981. return value;
  8982. }
  8983. ;
  8984. ///DatePicker.prototype.measure
  8985. /**
  8986. * Create a viewset object based on navigation.
  8987. */
  8988. DatePicker.prototype.viewset = function (type, dateObject /*, options*/
  8989. ) {
  8990. return this.create([dateObject.year, dateObject.month, 1]);
  8991. }
  8992. ;
  8993. /**
  8994. * Validate a date as enabled and shift if needed.
  8995. */
  8996. DatePicker.prototype.validate = function (type, dateObject, options) {
  8997. var calendar = this,
  8998. // Keep a reference to the original date.
  8999. originalDateObject = dateObject,
  9000. // Make sure we have an interval.
  9001. interval = options && options.interval ? options.interval : 1,
  9002. // Check if the calendar enabled dates are inverted.
  9003. isFlippedBase = calendar.item.enable === -1,
  9004. // Check if we have any enabled dates after/before now.
  9005. hasEnabledBeforeTarget, hasEnabledAfterTarget,
  9006. // The min & max limits.
  9007. minLimitObject = calendar.item.min, maxLimitObject = calendar.item.max,
  9008. // Check if we’ve reached the limit during shifting.
  9009. reachedMin, reachedMax,
  9010. // Check if the calendar is inverted and at least one weekday is enabled.
  9011. hasEnabledWeekdays = isFlippedBase && calendar.item.disable.filter(function (value) {
  9012. // If there’s a date, check where it is relative to the target.
  9013. if ($.isArray(value)) {
  9014. var dateTime = calendar.create(value).pick;
  9015. if (dateTime < dateObject.pick)
  9016. hasEnabledBeforeTarget = true;
  9017. else if (dateTime > dateObject.pick)
  9018. hasEnabledAfterTarget = true;
  9019. }
  9020. // Return only integers for enabled weekdays.
  9021. return _.isInteger(value);
  9022. }).length;
  9023. /*,
  9024. safety = 100*/
  9025. // Cases to validate for:
  9026. // [1] Not inverted and date disabled.
  9027. // [2] Inverted and some dates enabled.
  9028. // [3] Not inverted and out of range.
  9029. //
  9030. // Cases to **not** validate for:
  9031. // • Navigating months.
  9032. // • Not inverted and date enabled.
  9033. // • Inverted and all dates disabled.
  9034. // • ..and anything else.
  9035. if (!options || !options.nav)
  9036. if (/* 1 */
  9037. !isFlippedBase && calendar.disabled(dateObject) || /* 2 */
  9038. isFlippedBase && calendar.disabled(dateObject) && (hasEnabledWeekdays || hasEnabledBeforeTarget || hasEnabledAfterTarget) || /* 3 */
  9039. !isFlippedBase && (dateObject.pick <= minLimitObject.pick || dateObject.pick >= maxLimitObject.pick)) {
  9040. // When inverted, flip the direction if there aren’t any enabled weekdays
  9041. // and there are no enabled dates in the direction of the interval.
  9042. if (isFlippedBase && !hasEnabledWeekdays && (!hasEnabledAfterTarget && interval > 0 || !hasEnabledBeforeTarget && interval < 0)) {
  9043. interval *= -1;
  9044. }
  9045. // Keep looping until we reach an enabled date.
  9046. while (/*safety &&*/
  9047. calendar.disabled(dateObject)) {
  9048. /*safety -= 1
  9049. if ( !safety ) {
  9050. throw 'Fell into an infinite loop while validating ' + dateObject.obj + '.'
  9051. }*/
  9052. // If we’ve looped into the next/prev month with a large interval, return to the original date and flatten the interval.
  9053. if (Math.abs(interval) > 1 && (dateObject.month < originalDateObject.month || dateObject.month > originalDateObject.month)) {
  9054. dateObject = originalDateObject;
  9055. interval = interval > 0 ? 1 : -1;
  9056. }
  9057. // If we’ve reached the min/max limit, reverse the direction, flatten the interval and set it to the limit.
  9058. if (dateObject.pick <= minLimitObject.pick) {
  9059. reachedMin = true;
  9060. interval = 1;
  9061. dateObject = calendar.create([minLimitObject.year, minLimitObject.month, minLimitObject.date + (dateObject.pick === minLimitObject.pick ? 0 : -1)]);
  9062. } else if (dateObject.pick >= maxLimitObject.pick) {
  9063. reachedMax = true;
  9064. interval = -1;
  9065. dateObject = calendar.create([maxLimitObject.year, maxLimitObject.month, maxLimitObject.date + (dateObject.pick === maxLimitObject.pick ? 0 : 1)]);
  9066. }
  9067. // If we’ve reached both limits, just break out of the loop.
  9068. if (reachedMin && reachedMax) {
  9069. break;
  9070. }
  9071. // Finally, create the shifted date using the interval and keep looping.
  9072. dateObject = calendar.create([dateObject.year, dateObject.month, dateObject.date + interval]);
  9073. }
  9074. }
  9075. //endif
  9076. // Return the date object settled on.
  9077. return dateObject;
  9078. }
  9079. ;
  9080. //DatePicker.prototype.validate
  9081. /**
  9082. * Check if a date is disabled.
  9083. */
  9084. DatePicker.prototype.disabled = function (dateToVerify) {
  9085. var calendar = this
  9086. ,
  9087. // Filter through the disabled dates to check if this is one.
  9088. isDisabledMatch = calendar.item.disable.filter(function (dateToDisable) {
  9089. // If the date is a number, match the weekday with 0index and `firstDay` check.
  9090. if (_.isInteger(dateToDisable)) {
  9091. return dateToVerify.day === (calendar.settings.firstDay ? dateToDisable : dateToDisable - 1) % 7;
  9092. }
  9093. // If it’s an array or a native JS date, create and match the exact date.
  9094. if ($.isArray(dateToDisable) || _.isDate(dateToDisable)) {
  9095. return dateToVerify.pick === calendar.create(dateToDisable).pick;
  9096. }
  9097. // If it’s an object, match a date within the “from” and “to” range.
  9098. if ($.isPlainObject(dateToDisable)) {
  9099. return calendar.withinRange(dateToDisable, dateToVerify);
  9100. }
  9101. });
  9102. // If this date matches a disabled date, confirm it’s not inverted.
  9103. isDisabledMatch = isDisabledMatch.length && !isDisabledMatch.filter(function (dateToDisable) {
  9104. return $.isArray(dateToDisable) && dateToDisable[3] == 'inverted' || $.isPlainObject(dateToDisable) && dateToDisable.inverted;
  9105. }).length;
  9106. // Check the calendar “enabled” flag and respectively flip the
  9107. // disabled state. Then also check if it’s beyond the min/max limits.
  9108. return calendar.item.enable === -1 ? !isDisabledMatch : isDisabledMatch || dateToVerify.pick < calendar.item.min.pick || dateToVerify.pick > calendar.item.max.pick;
  9109. }
  9110. ;
  9111. //DatePicker.prototype.disabled
  9112. /**
  9113. * Parse a string into a usable type.
  9114. */
  9115. DatePicker.prototype.parse = function (type, value, options) {
  9116. var calendar = this
  9117. , parsingObject = {};
  9118. // If it’s already parsed, we’re good.
  9119. if (!value || typeof value != 'string') {
  9120. return value;
  9121. }
  9122. // We need a `.format` to parse the value with.
  9123. if (!(options && options.format)) {
  9124. options = options || {};
  9125. options.format = calendar.settings.format;
  9126. }
  9127. // Convert the format into an array and then map through it.
  9128. calendar.formats.toArray(options.format).map(function (label) {
  9129. var // Grab the formatting label.
  9130. formattingLabel = calendar.formats[label]
  9131. ,
  9132. // The format length is from the formatting label function or the
  9133. // label length without the escaping exclamation (!) mark.
  9134. formatLength = formattingLabel ? _.trigger(formattingLabel, calendar, [value, parsingObject]) : label.replace(/^!/, '').length;
  9135. // If there's a format label, split the value up to the format length.
  9136. // Then add it to the parsing object with appropriate label.
  9137. if (formattingLabel) {
  9138. parsingObject[label] = value.substr(0, formatLength);
  9139. }
  9140. // Update the value as the substring from format length to end.
  9141. value = value.substr(formatLength);
  9142. });
  9143. // Compensate for month 0index.
  9144. return [parsingObject.yyyy || parsingObject.yy, +(parsingObject.mm || parsingObject.m) - 1, parsingObject.dd || parsingObject.d];
  9145. }
  9146. ;
  9147. //DatePicker.prototype.parse
  9148. /**
  9149. * Various formats to display the object in.
  9150. */
  9151. DatePicker.prototype.formats = function () {
  9152. // Return the length of the first word in a collection.
  9153. function getWordLengthFromCollection(string, collection, dateObject) {
  9154. // Grab the first word from the string.
  9155. var word = string.match(/\w+/)[0];
  9156. // If there's no month index, add it to the date object
  9157. if (!dateObject.mm && !dateObject.m) {
  9158. dateObject.m = collection.indexOf(word) + 1;
  9159. }
  9160. // Return the length of the word.
  9161. return word.length;
  9162. }
  9163. // Get the length of the first word in a string.
  9164. function getFirstWordLength(string) {
  9165. return string.match(/\w+/)[0].length;
  9166. }
  9167. return {
  9168. d: function (string, dateObject) {
  9169. // If there's string, then get the digits length.
  9170. // Otherwise return the selected date.
  9171. return string ? _.digits(string) : dateObject.date;
  9172. },
  9173. dd: function (string, dateObject) {
  9174. // If there's a string, then the length is always 2.
  9175. // Otherwise return the selected date with a leading zero.
  9176. return string ? 2 : _.lead(dateObject.date);
  9177. },
  9178. ddd: function (string, dateObject) {
  9179. // If there's a string, then get the length of the first word.
  9180. // Otherwise return the short selected weekday.
  9181. return string ? getFirstWordLength(string) : this.settings.weekdaysShort[dateObject.day];
  9182. },
  9183. dddd: function (string, dateObject) {
  9184. // If there's a string, then get the length of the first word.
  9185. // Otherwise return the full selected weekday.
  9186. return string ? getFirstWordLength(string) : this.settings.weekdaysFull[dateObject.day];
  9187. },
  9188. m: function (string, dateObject) {
  9189. // If there's a string, then get the length of the digits
  9190. // Otherwise return the selected month with 0index compensation.
  9191. return string ? _.digits(string) : dateObject.month + 1;
  9192. },
  9193. mm: function (string, dateObject) {
  9194. // If there's a string, then the length is always 2.
  9195. // Otherwise return the selected month with 0index and leading zero.
  9196. return string ? 2 : _.lead(dateObject.month + 1);
  9197. },
  9198. mmm: function (string, dateObject) {
  9199. var collection = this.settings.monthsShort;
  9200. // If there's a string, get length of the relevant month from the short
  9201. // months collection. Otherwise return the selected month from that collection.
  9202. return string ? getWordLengthFromCollection(string, collection, dateObject) : collection[dateObject.month];
  9203. },
  9204. mmmm: function (string, dateObject) {
  9205. var collection = this.settings.monthsFull;
  9206. // If there's a string, get length of the relevant month from the full
  9207. // months collection. Otherwise return the selected month from that collection.
  9208. return string ? getWordLengthFromCollection(string, collection, dateObject) : collection[dateObject.month];
  9209. },
  9210. yy: function (string, dateObject) {
  9211. // If there's a string, then the length is always 2.
  9212. // Otherwise return the selected year by slicing out the first 2 digits.
  9213. return string ? 2 : ('' + dateObject.year).slice(2);
  9214. },
  9215. yyyy: function (string, dateObject) {
  9216. // If there's a string, then the length is always 4.
  9217. // Otherwise return the selected year.
  9218. return string ? 4 : dateObject.year;
  9219. },
  9220. // Create an array by splitting the formatting string passed.
  9221. toArray: function (formatString) {
  9222. return formatString.split(/(d{1,4}|m{1,4}|y{4}|yy|!.)/g);
  9223. },
  9224. // Format an object into a string using the formatting options.
  9225. toString: function (formatString, itemObject) {
  9226. var calendar = this;
  9227. return calendar.formats.toArray(formatString).map(function (label) {
  9228. return _.trigger(calendar.formats[label], calendar, [0, itemObject]) || label.replace(/^!/, '');
  9229. }).join('');
  9230. }
  9231. };
  9232. }();
  9233. //DatePicker.prototype.formats
  9234. /**
  9235. * Check if two date units are the exact.
  9236. */
  9237. DatePicker.prototype.isDateExact = function (one, two) {
  9238. var calendar = this;
  9239. // When we’re working with weekdays, do a direct comparison.
  9240. if (_.isInteger(one) && _.isInteger(two) || typeof one == 'boolean' && typeof two == 'boolean') {
  9241. return one === two;
  9242. }
  9243. // When we’re working with date representations, compare the “pick” value.
  9244. if ((_.isDate(one) || $.isArray(one)) && (_.isDate(two) || $.isArray(two))) {
  9245. return calendar.create(one).pick === calendar.create(two).pick;
  9246. }
  9247. // When we’re working with range objects, compare the “from” and “to”.
  9248. if ($.isPlainObject(one) && $.isPlainObject(two)) {
  9249. return calendar.isDateExact(one.from, two.from) && calendar.isDateExact(one.to, two.to);
  9250. }
  9251. return false;
  9252. }
  9253. ;
  9254. /**
  9255. * Check if two date units overlap.
  9256. */
  9257. DatePicker.prototype.isDateOverlap = function (one, two) {
  9258. var calendar = this
  9259. , firstDay = calendar.settings.firstDay ? 1 : 0;
  9260. // When we’re working with a weekday index, compare the days.
  9261. if (_.isInteger(one) && (_.isDate(two) || $.isArray(two))) {
  9262. one = one % 7 + firstDay;
  9263. return one === calendar.create(two).day + 1;
  9264. }
  9265. if (_.isInteger(two) && (_.isDate(one) || $.isArray(one))) {
  9266. two = two % 7 + firstDay;
  9267. return two === calendar.create(one).day + 1;
  9268. }
  9269. // When we’re working with range objects, check if the ranges overlap.
  9270. if ($.isPlainObject(one) && $.isPlainObject(two)) {
  9271. return calendar.overlapRanges(one, two);
  9272. }
  9273. return false;
  9274. }
  9275. ;
  9276. /**
  9277. * Flip the “enabled” state.
  9278. */
  9279. DatePicker.prototype.flipEnable = function (val) {
  9280. var itemObject = this.item;
  9281. itemObject.enable = val || (itemObject.enable == -1 ? 1 : -1);
  9282. }
  9283. ;
  9284. /**
  9285. * Mark a collection of dates as “disabled”.
  9286. */
  9287. DatePicker.prototype.deactivate = function (type, datesToDisable) {
  9288. var calendar = this
  9289. , disabledItems = calendar.item.disable.slice(0);
  9290. // If we’re flipping, that’s all we need to do.
  9291. if (datesToDisable == 'flip') {
  9292. calendar.flipEnable();
  9293. } else if (datesToDisable === false) {
  9294. calendar.flipEnable(1);
  9295. disabledItems = [];
  9296. } else if (datesToDisable === true) {
  9297. calendar.flipEnable(-1);
  9298. disabledItems = [];
  9299. }
  9300. // Otherwise go through the dates to disable.
  9301. else {
  9302. datesToDisable.map(function (unitToDisable) {
  9303. var matchFound;
  9304. // When we have disabled items, check for matches.
  9305. // If something is matched, immediately break out.
  9306. for (var index = 0; index < disabledItems.length; index += 1) {
  9307. if (calendar.isDateExact(unitToDisable, disabledItems[index])) {
  9308. matchFound = true;
  9309. break;
  9310. }
  9311. }
  9312. // If nothing was found, add the validated unit to the collection.
  9313. if (!matchFound) {
  9314. if (_.isInteger(unitToDisable) || _.isDate(unitToDisable) || $.isArray(unitToDisable) || $.isPlainObject(unitToDisable) && unitToDisable.from && unitToDisable.to) {
  9315. disabledItems.push(unitToDisable);
  9316. }
  9317. }
  9318. });
  9319. }
  9320. // Return the updated collection.
  9321. return disabledItems;
  9322. }
  9323. ;
  9324. //DatePicker.prototype.deactivate
  9325. /**
  9326. * Mark a collection of dates as “enabled”.
  9327. */
  9328. DatePicker.prototype.activate = function (type, datesToEnable) {
  9329. var calendar = this
  9330. , disabledItems = calendar.item.disable
  9331. , disabledItemsCount = disabledItems.length;
  9332. // If we’re flipping, that’s all we need to do.
  9333. if (datesToEnable == 'flip') {
  9334. calendar.flipEnable();
  9335. } else if (datesToEnable === true) {
  9336. calendar.flipEnable(1);
  9337. disabledItems = [];
  9338. } else if (datesToEnable === false) {
  9339. calendar.flipEnable(-1);
  9340. disabledItems = [];
  9341. }
  9342. // Otherwise go through the disabled dates.
  9343. else {
  9344. datesToEnable.map(function (unitToEnable) {
  9345. var matchFound, disabledUnit, index, isExactRange;
  9346. // Go through the disabled items and try to find a match.
  9347. for (index = 0; index < disabledItemsCount; index += 1) {
  9348. disabledUnit = disabledItems[index];
  9349. // When an exact match is found, remove it from the collection.
  9350. if (calendar.isDateExact(disabledUnit, unitToEnable)) {
  9351. matchFound = disabledItems[index] = null;
  9352. isExactRange = true;
  9353. break;
  9354. }
  9355. // When an overlapped match is found, add the “inverted” state to it.
  9356. else if (calendar.isDateOverlap(disabledUnit, unitToEnable)) {
  9357. if ($.isPlainObject(unitToEnable)) {
  9358. unitToEnable.inverted = true;
  9359. matchFound = unitToEnable;
  9360. } else if ($.isArray(unitToEnable)) {
  9361. matchFound = unitToEnable;
  9362. if (!matchFound[3])
  9363. matchFound.push('inverted');
  9364. } else if (_.isDate(unitToEnable)) {
  9365. matchFound = [unitToEnable.getFullYear(), unitToEnable.getMonth(), unitToEnable.getDate(), 'inverted'];
  9366. }
  9367. break;
  9368. }
  9369. }
  9370. // If a match was found, remove a previous duplicate entry.
  9371. if (matchFound)
  9372. for (index = 0; index < disabledItemsCount; index += 1) {
  9373. if (calendar.isDateExact(disabledItems[index], unitToEnable)) {
  9374. disabledItems[index] = null;
  9375. break;
  9376. }
  9377. }
  9378. // In the event that we’re dealing with an exact range of dates,
  9379. // make sure there are no “inverted” dates because of it.
  9380. if (isExactRange)
  9381. for (index = 0; index < disabledItemsCount; index += 1) {
  9382. if (calendar.isDateOverlap(disabledItems[index], unitToEnable)) {
  9383. disabledItems[index] = null;
  9384. break;
  9385. }
  9386. }
  9387. // If something is still matched, add it into the collection.
  9388. if (matchFound) {
  9389. disabledItems.push(matchFound);
  9390. }
  9391. });
  9392. }
  9393. // Return the updated collection.
  9394. return disabledItems.filter(function (val) {
  9395. return val != null;
  9396. });
  9397. }
  9398. ;
  9399. //DatePicker.prototype.activate
  9400. /**
  9401. * Create a string for the nodes in the picker.
  9402. */
  9403. DatePicker.prototype.nodes = function (isOpen) {
  9404. var calendar = this
  9405. , settings = calendar.settings
  9406. , calendarItem = calendar.item
  9407. , nowObject = calendarItem.now
  9408. , selectedObject = calendarItem.select
  9409. , highlightedObject = calendarItem.highlight
  9410. , viewsetObject = calendarItem.view
  9411. , disabledCollection = calendarItem.disable
  9412. , minLimitObject = calendarItem.min
  9413. , maxLimitObject = calendarItem.max
  9414. ,
  9415. // Create the calendar table head using a copy of weekday labels collection.
  9416. // * We do a copy so we don't mutate the original array.
  9417. tableHead = function (collection, fullCollection) {
  9418. // If the first day should be Monday, move Sunday to the end.
  9419. if (settings.firstDay) {
  9420. collection.push(collection.shift());
  9421. fullCollection.push(fullCollection.shift());
  9422. }
  9423. // Create and return the table head group.
  9424. return _.node('thead', _.node('tr', _.group({
  9425. min: 0,
  9426. max: DAYS_IN_WEEK - 1,
  9427. i: 1,
  9428. node: 'th',
  9429. item: function (counter) {
  9430. return [collection[counter], settings.klass.weekdays, 'scope=col title="' + fullCollection[counter] + '"'];
  9431. }
  9432. })));
  9433. //endreturn
  9434. // Materialize modified
  9435. }((settings.showWeekdaysFull ? settings.weekdaysFull : settings.weekdaysLetter).slice(0), settings.weekdaysFull.slice(0))
  9436. , //tableHead
  9437. // Create the nav for next/prev month.
  9438. createMonthNav = function (next) {
  9439. // Otherwise, return the created month tag.
  9440. return _.node('div', ' ', settings.klass['nav' + (next ? 'Next' : 'Prev')] + (
  9441. // If the focused month is outside the range, disabled the button.
  9442. 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({
  9443. role: 'button',
  9444. controls: calendar.$node[0].id + '_table'
  9445. }) + ' ' + 'title="' + (next ? settings.labelMonthNext : settings.labelMonthPrev) + '"');
  9446. //endreturn
  9447. }
  9448. , //createMonthNav
  9449. // Create the month label.
  9450. //Materialize modified
  9451. createMonthLabel = function (override) {
  9452. var monthsCollection = settings.showMonthsShort ? settings.monthsShort : settings.monthsFull;
  9453. // Materialize modified
  9454. if (override == "short_months") {
  9455. monthsCollection = settings.monthsShort;
  9456. }
  9457. // If there are months to select, add a dropdown menu.
  9458. if (settings.selectMonths && override == undefined) {
  9459. return _.node('select', _.group({
  9460. min: 0,
  9461. max: 11,
  9462. i: 1,
  9463. node: 'option',
  9464. item: function (loopedMonth) {
  9465. return [
  9466. // The looped month and no classes.
  9467. monthsCollection[loopedMonth], 0,
  9468. // Set the value and selected index.
  9469. 'value=' + loopedMonth + (viewsetObject.month == loopedMonth ? ' selected' : '') + (viewsetObject.year == minLimitObject.year && loopedMonth < minLimitObject.month || viewsetObject.year == maxLimitObject.year && loopedMonth > maxLimitObject.month ? ' disabled' : '')];
  9470. }
  9471. }), settings.klass.selectMonth + ' browser-default', (isOpen ? '' : 'disabled') + ' ' + _.ariaAttr({
  9472. controls: calendar.$node[0].id + '_table'
  9473. }) + ' ' + 'title="' + settings.labelMonthSelect + '"');
  9474. }
  9475. // Materialize modified
  9476. if (override == "short_months")
  9477. if (selectedObject != null)
  9478. return monthsCollection[selectedObject.month];
  9479. else
  9480. return monthsCollection[viewsetObject.month];
  9481. // If there's a need for a month selector
  9482. return _.node('div', monthsCollection[viewsetObject.month], settings.klass.month);
  9483. }
  9484. , //createMonthLabel
  9485. // Create the year label.
  9486. // Materialize modified
  9487. createYearLabel = function (override) {
  9488. var focusedYear = viewsetObject.year
  9489. ,
  9490. // If years selector is set to a literal "true", set it to 5. Otherwise
  9491. // divide in half to get half before and half after focused year.
  9492. numberYears = settings.selectYears === true ? 5 : ~~(settings.selectYears / 2);
  9493. // If there are years to select, add a dropdown menu.
  9494. if (numberYears) {
  9495. var minYear = minLimitObject.year
  9496. , maxYear = maxLimitObject.year
  9497. , lowestYear = focusedYear - numberYears
  9498. , highestYear = focusedYear + numberYears;
  9499. // If the min year is greater than the lowest year, increase the highest year
  9500. // by the difference and set the lowest year to the min year.
  9501. if (minYear > lowestYear) {
  9502. highestYear += minYear - lowestYear;
  9503. lowestYear = minYear;
  9504. }
  9505. // If the max year is less than the highest year, decrease the lowest year
  9506. // by the lower of the two: available and needed years. Then set the
  9507. // highest year to the max year.
  9508. if (maxYear < highestYear) {
  9509. var availableYears = lowestYear - minYear
  9510. , neededYears = highestYear - maxYear;
  9511. lowestYear -= availableYears > neededYears ? neededYears : availableYears;
  9512. highestYear = maxYear;
  9513. }
  9514. if (settings.selectYears && override == undefined) {
  9515. return _.node('select', _.group({
  9516. min: lowestYear,
  9517. max: highestYear,
  9518. i: 1,
  9519. node: 'option',
  9520. item: function (loopedYear) {
  9521. return [
  9522. // The looped year and no classes.
  9523. loopedYear, 0,
  9524. // Set the value and selected index.
  9525. 'value=' + loopedYear + (focusedYear == loopedYear ? ' selected' : '')];
  9526. }
  9527. }), settings.klass.selectYear + ' browser-default', (isOpen ? '' : 'disabled') + ' ' + _.ariaAttr({
  9528. controls: calendar.$node[0].id + '_table'
  9529. }) + ' ' + 'title="' + settings.labelYearSelect + '"');
  9530. }
  9531. }
  9532. // Materialize modified
  9533. if (override === 'raw' && selectedObject != null) {
  9534. return _.node('div', selectedObject.year);
  9535. }
  9536. // Otherwise just return the year focused
  9537. return _.node('div', focusedYear, settings.klass.year);
  9538. };
  9539. //createYearLabel
  9540. // Materialize modified
  9541. createDayLabel = function () {
  9542. if (selectedObject != null)
  9543. return selectedObject.date;
  9544. else
  9545. return nowObject.date;
  9546. }
  9547. ;
  9548. createWeekdayLabel = function () {
  9549. var display_day;
  9550. if (selectedObject != null)
  9551. display_day = selectedObject.day;
  9552. else
  9553. display_day = nowObject.day;
  9554. var weekday = settings.weekdaysShort[display_day];
  9555. return weekday;
  9556. }
  9557. ;
  9558. // Create and return the entire calendar.
  9559. return _.node(// Date presentation View
  9560. 'div', _.node(// Div for Year
  9561. 'div', createYearLabel("raw"), settings.klass.year_display) + _.node('span', createWeekdayLabel() + ', ', "picker__weekday-display") + _.node(// Div for short Month
  9562. 'span', createMonthLabel("short_months") + ' ', settings.klass.month_display) + _.node(// Div for Day
  9563. 'span', createDayLabel(), settings.klass.day_display), settings.klass.date_display) + // Calendar container
  9564. _.node('div', _.node('div', _.node('div', (settings.selectYears ? createMonthLabel() + createYearLabel() : createMonthLabel() + createYearLabel()) + createMonthNav() + createMonthNav(1), settings.klass.header) + _.node('table', tableHead + _.node('tbody', _.group({
  9565. min: 0,
  9566. max: WEEKS_IN_CALENDAR - 1,
  9567. i: 1,
  9568. node: 'tr',
  9569. item: function (rowCounter) {
  9570. // If Monday is the first day and the month starts on Sunday, shift the date back a week.
  9571. var shiftDateBy = settings.firstDay && calendar.create([viewsetObject.year, viewsetObject.month, 1]).day === 0 ? -7 : 0;
  9572. return [_.group({
  9573. min: DAYS_IN_WEEK * rowCounter - viewsetObject.day + shiftDateBy + 1,
  9574. // Add 1 for weekday 0index
  9575. max: function () {
  9576. return this.min + DAYS_IN_WEEK - 1;
  9577. },
  9578. i: 1,
  9579. node: 'td',
  9580. item: function (targetDate) {
  9581. // Convert the time date from a relative date to a target date.
  9582. targetDate = calendar.create([viewsetObject.year, viewsetObject.month, targetDate + (settings.firstDay ? 1 : 0)]);
  9583. var isSelected = selectedObject && selectedObject.pick == targetDate.pick
  9584. , isHighlighted = highlightedObject && highlightedObject.pick == targetDate.pick
  9585. , isDisabled = disabledCollection && calendar.disabled(targetDate) || targetDate.pick < minLimitObject.pick || targetDate.pick > maxLimitObject.pick
  9586. , formattedDate = _.trigger(calendar.formats.toString, calendar, [settings.format, targetDate]);
  9587. return [_.node('div', targetDate.date, function (klasses) {
  9588. // Add the `infocus` or `outfocus` classes based on month in view.
  9589. klasses.push(viewsetObject.month == targetDate.month ? settings.klass.infocus : settings.klass.outfocus);
  9590. // Add the `today` class if needed.
  9591. if (nowObject.pick == targetDate.pick) {
  9592. klasses.push(settings.klass.now);
  9593. }
  9594. // Add the `selected` class if something's selected and the time matches.
  9595. if (isSelected) {
  9596. klasses.push(settings.klass.selected);
  9597. }
  9598. // Add the `highlighted` class if something's highlighted and the time matches.
  9599. if (isHighlighted) {
  9600. klasses.push(settings.klass.highlighted);
  9601. }
  9602. // Add the `disabled` class if something's disabled and the object matches.
  9603. if (isDisabled) {
  9604. klasses.push(settings.klass.disabled);
  9605. }
  9606. return klasses.join(' ');
  9607. }([settings.klass.day]), 'data-pick=' + targetDate.pick + ' ' + _.ariaAttr({
  9608. role: 'gridcell',
  9609. label: formattedDate,
  9610. selected: isSelected && calendar.$node.val() === formattedDate ? true : null,
  9611. activedescendant: isHighlighted ? true : null,
  9612. disabled: isDisabled ? true : null
  9613. }) + ' ' + (isDisabled ? '' : 'tabindex="0"')), '', _.ariaAttr({
  9614. role: 'presentation'
  9615. })];
  9616. //endreturn
  9617. }
  9618. })];
  9619. //endreturn
  9620. }
  9621. })), settings.klass.table, 'id="' + calendar.$node[0].id + '_table' + '" ' + _.ariaAttr({
  9622. role: 'grid',
  9623. controls: calendar.$node[0].id,
  9624. readonly: true
  9625. })), settings.klass.calendar_container)// end calendar
  9626. +
  9627. // * For Firefox forms to submit, make sure to set the buttons’ `type` attributes as “button”.
  9628. _.node('div', _.node('button', settings.today, "btn-flat picker__today waves-effect", 'type=button data-pick=' + nowObject.pick + (isOpen && !calendar.disabled(nowObject) ? '' : ' disabled') + ' ' + _.ariaAttr({
  9629. controls: calendar.$node[0].id
  9630. })) + _.node('button', settings.clear, "btn-flat picker__clear waves-effect", 'type=button data-clear=1' + (isOpen ? '' : ' disabled') + ' ' + _.ariaAttr({
  9631. controls: calendar.$node[0].id
  9632. })) + _.node('button', settings.close, "btn-flat picker__close waves-effect", 'type=button data-close=true ' + (isOpen ? '' : ' disabled') + ' ' + _.ariaAttr({
  9633. controls: calendar.$node[0].id
  9634. })), settings.klass.footer), 'picker__container__wrapper');
  9635. //endreturn
  9636. }
  9637. ;
  9638. //DatePicker.prototype.nodes
  9639. /**
  9640. * The date picker defaults.
  9641. */
  9642. DatePicker.defaults = function (prefix) {
  9643. return {
  9644. // The title label to use for the month nav buttons
  9645. labelMonthNext: 'Next month',
  9646. labelMonthPrev: 'Previous month',
  9647. // The title label to use for the dropdown selectors
  9648. labelMonthSelect: 'Select a month',
  9649. labelYearSelect: 'Select a year',
  9650. // Months and weekdays
  9651. monthsFull: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
  9652. monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
  9653. weekdaysFull: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
  9654. weekdaysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
  9655. // Materialize modified
  9656. weekdaysLetter: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
  9657. // Today and clear
  9658. today: 'Today',
  9659. clear: 'Clear',
  9660. close: 'Ok',
  9661. // Picker close behavior (Prevent a change in behaviour for backwards compatibility)
  9662. closeOnSelect: false,
  9663. // The format to show on the `input` element
  9664. format: 'd mmmm, yyyy',
  9665. // Classes
  9666. klass: {
  9667. table: prefix + 'table',
  9668. header: prefix + 'header',
  9669. // Materialize Added klasses
  9670. date_display: prefix + 'date-display',
  9671. day_display: prefix + 'day-display',
  9672. month_display: prefix + 'month-display',
  9673. year_display: prefix + 'year-display',
  9674. calendar_container: prefix + 'calendar-container',
  9675. // end
  9676. navPrev: prefix + 'nav--prev',
  9677. navNext: prefix + 'nav--next',
  9678. navDisabled: prefix + 'nav--disabled',
  9679. month: prefix + 'month',
  9680. year: prefix + 'year',
  9681. selectMonth: prefix + 'select--month',
  9682. selectYear: prefix + 'select--year',
  9683. weekdays: prefix + 'weekday',
  9684. day: prefix + 'day',
  9685. disabled: prefix + 'day--disabled',
  9686. selected: prefix + 'day--selected',
  9687. highlighted: prefix + 'day--highlighted',
  9688. now: prefix + 'day--today',
  9689. infocus: prefix + 'day--infocus',
  9690. outfocus: prefix + 'day--outfocus',
  9691. footer: prefix + 'footer',
  9692. buttonClear: prefix + 'button--clear',
  9693. buttonToday: prefix + 'button--today',
  9694. buttonClose: prefix + 'button--close'
  9695. }
  9696. };
  9697. }(Picker.klasses().picker + '__');
  9698. /**
  9699. * Extend the picker to add the date picker.
  9700. */
  9701. Picker.extend('pickadate', DatePicker);
  9702. });
  9703. ;/*!
  9704. * ClockPicker v0.0.7 (http://weareoutman.github.io/clockpicker/)
  9705. * Copyright 2014 Wang Shenwei.
  9706. * Licensed under MIT (https://github.com/weareoutman/clockpicker/blob/gh-pages/LICENSE)
  9707. *
  9708. * Further modified
  9709. * Copyright 2015 Ching Yaw Hao.
  9710. */
  9711. (function ($) {
  9712. var $win = $(window)
  9713. , $doc = $(document);
  9714. // Can I use inline svg ?
  9715. var svgNS = 'http://www.w3.org/2000/svg'
  9716. , svgSupported = 'SVGAngle' in window && function () {
  9717. var supported, el = document.createElement('div');
  9718. el.innerHTML = '<svg/>';
  9719. supported = (el.firstChild && el.firstChild.namespaceURI) == svgNS;
  9720. el.innerHTML = '';
  9721. return supported;
  9722. }();
  9723. // Can I use transition ?
  9724. var transitionSupported = function () {
  9725. var style = document.createElement('div').style;
  9726. return 'transition' in style || 'WebkitTransition' in style || 'MozTransition' in style || 'msTransition' in style || 'OTransition' in style;
  9727. }();
  9728. // Listen touch events in touch screen device, instead of mouse events in desktop.
  9729. var touchSupported = 'ontouchstart' in window
  9730. , mousedownEvent = 'mousedown' + (touchSupported ? ' touchstart' : '')
  9731. , mousemoveEvent = 'mousemove.clockpicker' + (touchSupported ? ' touchmove.clockpicker' : '')
  9732. , mouseupEvent = 'mouseup.clockpicker' + (touchSupported ? ' touchend.clockpicker' : '');
  9733. // Vibrate the device if supported
  9734. var vibrate = navigator.vibrate ? 'vibrate' : navigator.webkitVibrate ? 'webkitVibrate' : null;
  9735. function createSvgElement(name) {
  9736. return document.createElementNS(svgNS, name);
  9737. }
  9738. function leadingZero(num) {
  9739. return (num < 10 ? '0' : '') + num;
  9740. }
  9741. // Get a unique id
  9742. var idCounter = 0;
  9743. function uniqueId(prefix) {
  9744. var id = ++idCounter + '';
  9745. return prefix ? prefix + id : id;
  9746. }
  9747. // Clock size
  9748. var dialRadius = 135
  9749. , outerRadius = 105
  9750. ,
  9751. // innerRadius = 80 on 12 hour clock
  9752. innerRadius = 70
  9753. , tickRadius = 20
  9754. , diameter = dialRadius * 2
  9755. , duration = transitionSupported ? 350 : 1;
  9756. // Popover template
  9757. 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('');
  9758. // ClockPicker
  9759. function ClockPicker(element, options) {
  9760. var popover = $(tpl)
  9761. , plate = popover.find('.clockpicker-plate')
  9762. , holder = popover.find('.picker__holder')
  9763. , hoursView = popover.find('.clockpicker-hours')
  9764. , minutesView = popover.find('.clockpicker-minutes')
  9765. , amPmBlock = popover.find('.clockpicker-am-pm-block')
  9766. , isInput = element.prop('tagName') === 'INPUT'
  9767. , input = isInput ? element : element.find('input')
  9768. , label = $("label[for=" + input.attr("id") + "]")
  9769. , self = this;
  9770. this.id = uniqueId('cp');
  9771. this.element = element;
  9772. this.holder = holder;
  9773. this.options = options;
  9774. this.isAppended = false;
  9775. this.isShown = false;
  9776. this.currentView = 'hours';
  9777. this.isInput = isInput;
  9778. this.input = input;
  9779. this.label = label;
  9780. this.popover = popover;
  9781. this.plate = plate;
  9782. this.hoursView = hoursView;
  9783. this.minutesView = minutesView;
  9784. this.amPmBlock = amPmBlock;
  9785. this.spanHours = popover.find('.clockpicker-span-hours');
  9786. this.spanMinutes = popover.find('.clockpicker-span-minutes');
  9787. this.spanAmPm = popover.find('.clockpicker-span-am-pm');
  9788. this.footer = popover.find('.picker__footer');
  9789. this.amOrPm = "PM";
  9790. // Setup for for 12 hour clock if option is selected
  9791. if (options.twelvehour) {
  9792. if (!options.ampmclickable) {
  9793. this.spanAmPm.empty();
  9794. $('<div id="click-am">AM</div>').appendTo(this.spanAmPm);
  9795. $('<div id="click-pm">PM</div>').appendTo(this.spanAmPm);
  9796. } else {
  9797. this.spanAmPm.empty();
  9798. $('<div id="click-am">AM</div>').on("click", function () {
  9799. self.spanAmPm.children('#click-am').addClass("text-primary");
  9800. self.spanAmPm.children('#click-pm').removeClass("text-primary");
  9801. self.amOrPm = "AM";
  9802. }).appendTo(this.spanAmPm);
  9803. $('<div id="click-pm">PM</div>').on("click", function () {
  9804. self.spanAmPm.children('#click-pm').addClass("text-primary");
  9805. self.spanAmPm.children('#click-am').removeClass("text-primary");
  9806. self.amOrPm = 'PM';
  9807. }).appendTo(this.spanAmPm);
  9808. }
  9809. }
  9810. // Add buttons to footer
  9811. $('<button type="button" class="btn-flat picker__clear" tabindex="' + (options.twelvehour ? '3' : '1') + '">' + options.cleartext + '</button>').click($.proxy(this.clear, this)).appendTo(this.footer);
  9812. $('<button type="button" class="btn-flat picker__close" tabindex="' + (options.twelvehour ? '3' : '1') + '">' + options.canceltext + '</button>').click($.proxy(this.hide, this)).appendTo(this.footer);
  9813. $('<button type="button" class="btn-flat picker__close" tabindex="' + (options.twelvehour ? '3' : '1') + '">' + options.donetext + '</button>').click($.proxy(this.done, this)).appendTo(this.footer);
  9814. this.spanHours.click($.proxy(this.toggleView, this, 'hours'));
  9815. this.spanMinutes.click($.proxy(this.toggleView, this, 'minutes'));
  9816. // Show or toggle
  9817. input.on('focus.clockpicker click.clockpicker', $.proxy(this.show, this));
  9818. // Build ticks
  9819. var tickTpl = $('<div class="clockpicker-tick"></div>'), i, tick, radian, radius;
  9820. // Hours view
  9821. if (options.twelvehour) {
  9822. for (i = 1; i < 13; i += 1) {
  9823. tick = tickTpl.clone();
  9824. radian = i / 6 * Math.PI;
  9825. radius = outerRadius;
  9826. tick.css({
  9827. left: dialRadius + Math.sin(radian) * radius - tickRadius,
  9828. top: dialRadius - Math.cos(radian) * radius - tickRadius
  9829. });
  9830. tick.html(i === 0 ? '00' : i);
  9831. hoursView.append(tick);
  9832. tick.on(mousedownEvent, mousedown);
  9833. }
  9834. } else {
  9835. for (i = 0; i < 24; i += 1) {
  9836. tick = tickTpl.clone();
  9837. radian = i / 6 * Math.PI;
  9838. var inner = i > 0 && i < 13;
  9839. radius = inner ? innerRadius : outerRadius;
  9840. tick.css({
  9841. left: dialRadius + Math.sin(radian) * radius - tickRadius,
  9842. top: dialRadius - Math.cos(radian) * radius - tickRadius
  9843. });
  9844. tick.html(i === 0 ? '00' : i);
  9845. hoursView.append(tick);
  9846. tick.on(mousedownEvent, mousedown);
  9847. }
  9848. }
  9849. // Minutes view
  9850. for (i = 0; i < 60; i += 5) {
  9851. tick = tickTpl.clone();
  9852. radian = i / 30 * Math.PI;
  9853. tick.css({
  9854. left: dialRadius + Math.sin(radian) * outerRadius - tickRadius,
  9855. top: dialRadius - Math.cos(radian) * outerRadius - tickRadius
  9856. });
  9857. tick.html(leadingZero(i));
  9858. minutesView.append(tick);
  9859. tick.on(mousedownEvent, mousedown);
  9860. }
  9861. // Clicking on minutes view space
  9862. plate.on(mousedownEvent, function (e) {
  9863. if ($(e.target).closest('.clockpicker-tick').length === 0) {
  9864. mousedown(e, true);
  9865. }
  9866. });
  9867. // Mousedown or touchstart
  9868. function mousedown(e, space) {
  9869. var offset = plate.offset()
  9870. , isTouch = /^touch/.test(e.type)
  9871. , x0 = offset.left + dialRadius
  9872. , y0 = offset.top + dialRadius
  9873. , dx = (isTouch ? e.originalEvent.touches[0] : e).pageX - x0
  9874. , dy = (isTouch ? e.originalEvent.touches[0] : e).pageY - y0
  9875. , z = Math.sqrt(dx * dx + dy * dy)
  9876. , moved = false;
  9877. // When clicking on minutes view space, check the mouse position
  9878. if (space && (z < outerRadius - tickRadius || z > outerRadius + tickRadius)) {
  9879. return;
  9880. }
  9881. e.preventDefault();
  9882. // Set cursor style of body after 200ms
  9883. var movingTimer = setTimeout(function () {
  9884. self.popover.addClass('clockpicker-moving');
  9885. }, 200);
  9886. // Clock
  9887. self.setHand(dx, dy, !space, true);
  9888. // Mousemove on document
  9889. $doc.off(mousemoveEvent).on(mousemoveEvent, function (e) {
  9890. e.preventDefault();
  9891. var isTouch = /^touch/.test(e.type)
  9892. , x = (isTouch ? e.originalEvent.touches[0] : e).pageX - x0
  9893. , y = (isTouch ? e.originalEvent.touches[0] : e).pageY - y0;
  9894. if (!moved && x === dx && y === dy) {
  9895. // Clicking in chrome on windows will trigger a mousemove event
  9896. return;
  9897. }
  9898. moved = true;
  9899. self.setHand(x, y, false, true);
  9900. });
  9901. // Mouseup on document
  9902. $doc.off(mouseupEvent).on(mouseupEvent, function (e) {
  9903. $doc.off(mouseupEvent);
  9904. e.preventDefault();
  9905. var isTouch = /^touch/.test(e.type)
  9906. , x = (isTouch ? e.originalEvent.changedTouches[0] : e).pageX - x0
  9907. , y = (isTouch ? e.originalEvent.changedTouches[0] : e).pageY - y0;
  9908. if ((space || moved) && x === dx && y === dy) {
  9909. self.setHand(x, y);
  9910. }
  9911. if (self.currentView === 'hours') {
  9912. self.toggleView('minutes', duration / 2);
  9913. } else if (options.autoclose) {
  9914. self.minutesView.addClass('clockpicker-dial-out');
  9915. setTimeout(function () {
  9916. self.done();
  9917. }, duration / 2);
  9918. }
  9919. plate.prepend(canvas);
  9920. // Reset cursor style of body
  9921. clearTimeout(movingTimer);
  9922. self.popover.removeClass('clockpicker-moving');
  9923. // Unbind mousemove event
  9924. $doc.off(mousemoveEvent);
  9925. });
  9926. }
  9927. if (svgSupported) {
  9928. // Draw clock hands and others
  9929. var canvas = popover.find('.clockpicker-canvas')
  9930. , svg = createSvgElement('svg');
  9931. svg.setAttribute('class', 'clockpicker-svg');
  9932. svg.setAttribute('width', diameter);
  9933. svg.setAttribute('height', diameter);
  9934. var g = createSvgElement('g');
  9935. g.setAttribute('transform', 'translate(' + dialRadius + ',' + dialRadius + ')');
  9936. var bearing = createSvgElement('circle');
  9937. bearing.setAttribute('class', 'clockpicker-canvas-bearing');
  9938. bearing.setAttribute('cx', 0);
  9939. bearing.setAttribute('cy', 0);
  9940. bearing.setAttribute('r', 4);
  9941. var hand = createSvgElement('line');
  9942. hand.setAttribute('x1', 0);
  9943. hand.setAttribute('y1', 0);
  9944. var bg = createSvgElement('circle');
  9945. bg.setAttribute('class', 'clockpicker-canvas-bg');
  9946. bg.setAttribute('r', tickRadius);
  9947. g.appendChild(hand);
  9948. g.appendChild(bg);
  9949. g.appendChild(bearing);
  9950. svg.appendChild(g);
  9951. canvas.append(svg);
  9952. this.hand = hand;
  9953. this.bg = bg;
  9954. this.bearing = bearing;
  9955. this.g = g;
  9956. this.canvas = canvas;
  9957. }
  9958. raiseCallback(this.options.init);
  9959. }
  9960. function raiseCallback(callbackFunction) {
  9961. if (callbackFunction && typeof callbackFunction === "function")
  9962. callbackFunction();
  9963. }
  9964. // Default options
  9965. ClockPicker.DEFAULTS = {
  9966. 'default': '',
  9967. // default time, 'now' or '13:14' e.g.
  9968. fromnow: 0,
  9969. // set default time to * milliseconds from now (using with default = 'now')
  9970. donetext: 'Ok',
  9971. // done button text
  9972. cleartext: 'Clear',
  9973. canceltext: 'Cancel',
  9974. autoclose: false,
  9975. // auto close when minute is selected
  9976. ampmclickable: true,
  9977. // set am/pm button on itself
  9978. darktheme: false,
  9979. // set to dark theme
  9980. twelvehour: true,
  9981. // change to 12 hour AM/PM clock from 24 hour
  9982. vibrate: true // vibrate the device when dragging clock hand
  9983. };
  9984. // Show or hide popover
  9985. ClockPicker.prototype.toggle = function () {
  9986. this[this.isShown ? 'hide' : 'show']();
  9987. }
  9988. ;
  9989. // Set popover position
  9990. ClockPicker.prototype.locate = function () {
  9991. var element = this.element
  9992. , popover = this.popover
  9993. , offset = element.offset()
  9994. , width = element.outerWidth()
  9995. , height = element.outerHeight()
  9996. , align = this.options.align
  9997. , self = this;
  9998. popover.show();
  9999. }
  10000. ;
  10001. // Show popover
  10002. ClockPicker.prototype.show = function (e) {
  10003. // Not show again
  10004. if (this.isShown) {
  10005. return;
  10006. }
  10007. raiseCallback(this.options.beforeShow);
  10008. $(':input').each(function () {
  10009. $(this).attr('tabindex', -1);
  10010. });
  10011. var self = this;
  10012. // Initialize
  10013. this.input.blur();
  10014. this.popover.addClass('picker--opened');
  10015. this.input.addClass('picker__input picker__input--active');
  10016. $(document.body).css('overflow', 'hidden');
  10017. // Get the time
  10018. var value = ((this.input.prop('value') || this.options['default'] || '') + '').split(':');
  10019. if (this.options.twelvehour && !(typeof value[1] === 'undefined')) {
  10020. if (value[1].indexOf("AM") > 0) {
  10021. this.amOrPm = 'AM';
  10022. } else {
  10023. this.amOrPm = 'PM';
  10024. }
  10025. value[1] = value[1].replace("AM", "").replace("PM", "");
  10026. }
  10027. if (value[0] === 'now') {
  10028. var now = new Date(+new Date() + this.options.fromnow);
  10029. value = [now.getHours(), now.getMinutes()];
  10030. if (this.options.twelvehour) {
  10031. this.amOrPm = value[0] >= 12 && value[0] < 24 ? 'PM' : 'AM';
  10032. }
  10033. }
  10034. this.hours = +value[0] || 0;
  10035. this.minutes = +value[1] || 0;
  10036. this.spanHours.html(this.hours);
  10037. this.spanMinutes.html(leadingZero(this.minutes));
  10038. if (!this.isAppended) {
  10039. // Append popover to input by default
  10040. var containerEl = document.querySelector(this.options.container);
  10041. if (this.options.container && containerEl) {
  10042. containerEl.appendChild(this.popover[0]);
  10043. } else {
  10044. this.popover.insertAfter(this.input);
  10045. }
  10046. if (this.options.twelvehour) {
  10047. if (this.amOrPm === 'PM') {
  10048. this.spanAmPm.children('#click-pm').addClass("text-primary");
  10049. this.spanAmPm.children('#click-am').removeClass("text-primary");
  10050. } else {
  10051. this.spanAmPm.children('#click-am').addClass("text-primary");
  10052. this.spanAmPm.children('#click-pm').removeClass("text-primary");
  10053. }
  10054. }
  10055. // Reset position when resize
  10056. $win.on('resize.clockpicker' + this.id, function () {
  10057. if (self.isShown) {
  10058. self.locate();
  10059. }
  10060. });
  10061. this.isAppended = true;
  10062. }
  10063. // Toggle to hours view
  10064. this.toggleView('hours');
  10065. // Set position
  10066. this.locate();
  10067. this.isShown = true;
  10068. // Hide when clicking or tabbing on any element except the clock and input
  10069. $doc.on('click.clockpicker.' + this.id + ' focusin.clockpicker.' + this.id, function (e) {
  10070. var target = $(e.target);
  10071. if (target.closest(self.popover.find('.picker__wrap')).length === 0 && target.closest(self.input).length === 0) {
  10072. self.hide();
  10073. }
  10074. });
  10075. // Hide when ESC is pressed
  10076. $doc.on('keyup.clockpicker.' + this.id, function (e) {
  10077. if (e.keyCode === 27) {
  10078. self.hide();
  10079. }
  10080. });
  10081. raiseCallback(this.options.afterShow);
  10082. }
  10083. ;
  10084. // Hide popover
  10085. ClockPicker.prototype.hide = function () {
  10086. raiseCallback(this.options.beforeHide);
  10087. this.input.removeClass('picker__input picker__input--active');
  10088. this.popover.removeClass('picker--opened');
  10089. $(document.body).css('overflow', 'visible');
  10090. this.isShown = false;
  10091. $(':input').each(function (index) {
  10092. $(this).attr('tabindex', index + 1);
  10093. });
  10094. // Unbinding events on document
  10095. $doc.off('click.clockpicker.' + this.id + ' focusin.clockpicker.' + this.id);
  10096. $doc.off('keyup.clockpicker.' + this.id);
  10097. this.popover.hide();
  10098. raiseCallback(this.options.afterHide);
  10099. }
  10100. ;
  10101. // Toggle to hours or minutes view
  10102. ClockPicker.prototype.toggleView = function (view, delay) {
  10103. var raiseAfterHourSelect = false;
  10104. if (view === 'minutes' && $(this.hoursView).css("visibility") === "visible") {
  10105. raiseCallback(this.options.beforeHourSelect);
  10106. raiseAfterHourSelect = true;
  10107. }
  10108. var isHours = view === 'hours'
  10109. , nextView = isHours ? this.hoursView : this.minutesView
  10110. , hideView = isHours ? this.minutesView : this.hoursView;
  10111. this.currentView = view;
  10112. this.spanHours.toggleClass('text-primary', isHours);
  10113. this.spanMinutes.toggleClass('text-primary', !isHours);
  10114. // Let's make transitions
  10115. hideView.addClass('clockpicker-dial-out');
  10116. nextView.css('visibility', 'visible').removeClass('clockpicker-dial-out');
  10117. // Reset clock hand
  10118. this.resetClock(delay);
  10119. // After transitions ended
  10120. clearTimeout(this.toggleViewTimer);
  10121. this.toggleViewTimer = setTimeout(function () {
  10122. hideView.css('visibility', 'hidden');
  10123. }, duration);
  10124. if (raiseAfterHourSelect) {
  10125. raiseCallback(this.options.afterHourSelect);
  10126. }
  10127. }
  10128. ;
  10129. // Reset clock hand
  10130. ClockPicker.prototype.resetClock = function (delay) {
  10131. var view = this.currentView
  10132. , value = this[view]
  10133. , isHours = view === 'hours'
  10134. , unit = Math.PI / (isHours ? 6 : 30)
  10135. , radian = value * unit
  10136. , radius = isHours && value > 0 && value < 13 ? innerRadius : outerRadius
  10137. , x = Math.sin(radian) * radius
  10138. , y = -Math.cos(radian) * radius
  10139. , self = this;
  10140. if (svgSupported && delay) {
  10141. self.canvas.addClass('clockpicker-canvas-out');
  10142. setTimeout(function () {
  10143. self.canvas.removeClass('clockpicker-canvas-out');
  10144. self.setHand(x, y);
  10145. }, delay);
  10146. } else
  10147. this.setHand(x, y);
  10148. }
  10149. ;
  10150. // Set clock hand to (x, y)
  10151. ClockPicker.prototype.setHand = function (x, y, roundBy5, dragging) {
  10152. var radian = Math.atan2(x, -y), isHours = this.currentView === 'hours', unit = Math.PI / (isHours || roundBy5 ? 6 : 30), z = Math.sqrt(x * x + y * y), options = this.options, inner = isHours && z < (outerRadius + innerRadius) / 2, radius = inner ? innerRadius : outerRadius, value;
  10153. if (options.twelvehour) {
  10154. radius = outerRadius;
  10155. }
  10156. // Radian should in range [0, 2PI]
  10157. if (radian < 0) {
  10158. radian = Math.PI * 2 + radian;
  10159. }
  10160. // Get the round value
  10161. value = Math.round(radian / unit);
  10162. // Get the round radian
  10163. radian = value * unit;
  10164. // Correct the hours or minutes
  10165. if (options.twelvehour) {
  10166. if (isHours) {
  10167. if (value === 0)
  10168. value = 12;
  10169. } else {
  10170. if (roundBy5)
  10171. value *= 5;
  10172. if (value === 60)
  10173. value = 0;
  10174. }
  10175. } else {
  10176. if (isHours) {
  10177. if (value === 12)
  10178. value = 0;
  10179. value = inner ? value === 0 ? 12 : value : value === 0 ? 0 : value + 12;
  10180. } else {
  10181. if (roundBy5)
  10182. value *= 5;
  10183. if (value === 60)
  10184. value = 0;
  10185. }
  10186. }
  10187. // Once hours or minutes changed, vibrate the device
  10188. if (this[this.currentView] !== value) {
  10189. if (vibrate && this.options.vibrate) {
  10190. // Do not vibrate too frequently
  10191. if (!this.vibrateTimer) {
  10192. navigator[vibrate](10);
  10193. this.vibrateTimer = setTimeout($.proxy(function () {
  10194. this.vibrateTimer = null;
  10195. }, this), 100);
  10196. }
  10197. }
  10198. }
  10199. this[this.currentView] = value;
  10200. if (isHours) {
  10201. this['spanHours'].html(value);
  10202. } else {
  10203. this['spanMinutes'].html(leadingZero(value));
  10204. }
  10205. // If svg is not supported, just add an active class to the tick
  10206. if (!svgSupported) {
  10207. this[isHours ? 'hoursView' : 'minutesView'].find('.clockpicker-tick').each(function () {
  10208. var tick = $(this);
  10209. tick.toggleClass('active', value === +tick.html());
  10210. });
  10211. return;
  10212. }
  10213. // Set clock hand and others' position
  10214. var cx1 = Math.sin(radian) * (radius - tickRadius)
  10215. , cy1 = -Math.cos(radian) * (radius - tickRadius)
  10216. , cx2 = Math.sin(radian) * radius
  10217. , cy2 = -Math.cos(radian) * radius;
  10218. this.hand.setAttribute('x2', cx1);
  10219. this.hand.setAttribute('y2', cy1);
  10220. this.bg.setAttribute('cx', cx2);
  10221. this.bg.setAttribute('cy', cy2);
  10222. }
  10223. ;
  10224. // Hours and minutes are selected
  10225. ClockPicker.prototype.done = function () {
  10226. raiseCallback(this.options.beforeDone);
  10227. this.hide();
  10228. this.label.addClass('active');
  10229. var last = this.input.prop('value')
  10230. , value = leadingZero(this.hours) + ':' + leadingZero(this.minutes);
  10231. if (this.options.twelvehour) {
  10232. value = value + this.amOrPm;
  10233. }
  10234. this.input.prop('value', value);
  10235. if (value !== last) {
  10236. this.input.triggerHandler('change');
  10237. if (!this.isInput) {
  10238. this.element.trigger('change');
  10239. }
  10240. }
  10241. if (this.options.autoclose)
  10242. this.input.trigger('blur');
  10243. raiseCallback(this.options.afterDone);
  10244. }
  10245. ;
  10246. // Clear input field
  10247. ClockPicker.prototype.clear = function () {
  10248. this.hide();
  10249. this.label.removeClass('active');
  10250. var last = this.input.prop('value')
  10251. , value = '';
  10252. this.input.prop('value', value);
  10253. if (value !== last) {
  10254. this.input.triggerHandler('change');
  10255. if (!this.isInput) {
  10256. this.element.trigger('change');
  10257. }
  10258. }
  10259. if (this.options.autoclose) {
  10260. this.input.trigger('blur');
  10261. }
  10262. }
  10263. ;
  10264. // Remove clockpicker from input
  10265. ClockPicker.prototype.remove = function () {
  10266. this.element.removeData('clockpicker');
  10267. this.input.off('focus.clockpicker click.clockpicker');
  10268. if (this.isShown) {
  10269. this.hide();
  10270. }
  10271. if (this.isAppended) {
  10272. $win.off('resize.clockpicker' + this.id);
  10273. this.popover.remove();
  10274. }
  10275. }
  10276. ;
  10277. // Extends $.fn.clockpicker
  10278. $.fn.pickatime = function (option) {
  10279. var args = Array.prototype.slice.call(arguments, 1);
  10280. return this.each(function () {
  10281. var $this = $(this)
  10282. , data = $this.data('clockpicker');
  10283. if (!data) {
  10284. var options = $.extend({}, ClockPicker.DEFAULTS, $this.data(), typeof option == 'object' && option);
  10285. $this.data('clockpicker', new ClockPicker($this, options));
  10286. } else {
  10287. // Manual operatsions. show, hide, remove, e.g.
  10288. if (typeof data[option] === 'function') {
  10289. data[option].apply(data, args);
  10290. }
  10291. }
  10292. });
  10293. }
  10294. ;
  10295. }
  10296. )(jQuery);
  10297. ; (function ($) {
  10298. $.fn.characterCounter = function () {
  10299. return this.each(function () {
  10300. var $input = $(this);
  10301. var $counterElement = $input.parent().find('span[class="character-counter"]');
  10302. // character counter has already been added appended to the parent container
  10303. if ($counterElement.length) {
  10304. return;
  10305. }
  10306. var itHasLengthAttribute = $input.attr('data-length') !== undefined;
  10307. if (itHasLengthAttribute) {
  10308. $input.on('input', updateCounter);
  10309. $input.on('focus', updateCounter);
  10310. $input.on('blur', removeCounterElement);
  10311. addCounterElement($input);
  10312. }
  10313. });
  10314. }
  10315. ;
  10316. function updateCounter() {
  10317. var maxLength = +$(this).attr('data-length')
  10318. , actualLength = +$(this).val().length
  10319. , isValidLength = actualLength <= maxLength;
  10320. $(this).parent().find('span[class="character-counter"]').html(actualLength + '/' + maxLength);
  10321. addInputStyle(isValidLength, $(this));
  10322. }
  10323. function addCounterElement($input) {
  10324. var $counterElement = $input.parent().find('span[class="character-counter"]');
  10325. if ($counterElement.length) {
  10326. return;
  10327. }
  10328. $counterElement = $('<span/>').addClass('character-counter').css('float', 'right').css('font-size', '12px').css('height', 1);
  10329. $input.parent().append($counterElement);
  10330. }
  10331. function removeCounterElement() {
  10332. $(this).parent().find('span[class="character-counter"]').html('');
  10333. }
  10334. function addInputStyle(isValidLength, $input) {
  10335. var inputHasInvalidClass = $input.hasClass('invalid');
  10336. if (isValidLength && inputHasInvalidClass) {
  10337. $input.removeClass('invalid');
  10338. } else if (!isValidLength && !inputHasInvalidClass) {
  10339. $input.removeClass('valid');
  10340. $input.addClass('invalid');
  10341. }
  10342. }
  10343. $(document).ready(function () {
  10344. $('input, textarea').characterCounter();
  10345. });
  10346. }
  10347. )(jQuery);
  10348. ; (function ($) {
  10349. var methods = {
  10350. init: function (options) {
  10351. var defaults = {
  10352. duration: 200,
  10353. // ms
  10354. dist: -100,
  10355. // zoom scale TODO: make this more intuitive as an option
  10356. shift: 0,
  10357. // spacing for center image
  10358. padding: 0,
  10359. // Padding between non center items
  10360. fullWidth: false,
  10361. // Change to full width styles
  10362. indicators: false,
  10363. // Toggle indicators
  10364. noWrap: false,
  10365. // Don't wrap around and cycle through items.
  10366. onCycleTo: null // Callback for when a new slide is cycled to.
  10367. };
  10368. options = $.extend(defaults, options);
  10369. var namespace = Materialize.objectSelectorString($(this));
  10370. return this.each(function (i) {
  10371. var images, item_width, item_height, offset, center, pressed, dim, count, reference, referenceY, amplitude, target, velocity, scrolling, xform, frame, timestamp, ticker, dragged, vertical_dragged;
  10372. var $indicators = $('<ul class="indicators"></ul>');
  10373. var scrollingTimeout = null;
  10374. var oneTimeCallback = null;
  10375. // Initialize
  10376. var view = $(this);
  10377. var hasMultipleSlides = view.find('.carousel-item').length > 1;
  10378. var showIndicators = (view.attr('data-indicators') || options.indicators) && hasMultipleSlides;
  10379. var noWrap = view.attr('data-no-wrap') || options.noWrap || !hasMultipleSlides;
  10380. var uniqueNamespace = view.attr('data-namespace') || namespace + i;
  10381. view.attr('data-namespace', uniqueNamespace);
  10382. // Options
  10383. var setCarouselHeight = function (imageOnly) {
  10384. var firstSlide = view.find('.carousel-item.active').length ? view.find('.carousel-item.active').first() : view.find('.carousel-item').first();
  10385. var firstImage = firstSlide.find('img').first();
  10386. if (firstImage.length) {
  10387. if (firstImage[0].complete) {
  10388. // If image won't trigger the load event
  10389. var imageHeight = firstImage.height();
  10390. if (imageHeight > 0) {
  10391. view.css('height', firstImage.height());
  10392. } else {
  10393. // If image still has no height, use the natural dimensions to calculate
  10394. var naturalWidth = firstImage[0].naturalWidth;
  10395. var naturalHeight = firstImage[0].naturalHeight;
  10396. var adjustedHeight = view.width() / naturalWidth * naturalHeight;
  10397. view.css('height', adjustedHeight);
  10398. }
  10399. } else {
  10400. // Get height when image is loaded normally
  10401. firstImage.on('load', function () {
  10402. view.css('height', $(this).height());
  10403. });
  10404. }
  10405. } else if (!imageOnly) {
  10406. var slideHeight = firstSlide.height();
  10407. view.css('height', slideHeight);
  10408. }
  10409. };
  10410. if (options.fullWidth) {
  10411. options.dist = 0;
  10412. setCarouselHeight();
  10413. // Offset fixed items when indicators.
  10414. if (showIndicators) {
  10415. view.find('.carousel-fixed-item').addClass('with-indicators');
  10416. }
  10417. }
  10418. // Don't double initialize.
  10419. if (view.hasClass('initialized')) {
  10420. // Recalculate variables
  10421. $(window).trigger('resize');
  10422. // Redraw carousel.
  10423. view.trigger('carouselNext', [0.000001]);
  10424. return true;
  10425. }
  10426. view.addClass('initialized');
  10427. pressed = false;
  10428. offset = target = 0;
  10429. images = [];
  10430. item_width = view.find('.carousel-item').first().innerWidth();
  10431. item_height = view.find('.carousel-item').first().innerHeight();
  10432. dim = item_width * 2 + options.padding;
  10433. view.find('.carousel-item').each(function (i) {
  10434. images.push($(this)[0]);
  10435. if (showIndicators) {
  10436. var $indicator = $('<li class="indicator-item"></li>');
  10437. // Add active to first by default.
  10438. if (i === 0) {
  10439. $indicator.addClass('active');
  10440. }
  10441. // Handle clicks on indicators.
  10442. $indicator.click(function (e) {
  10443. e.stopPropagation();
  10444. var index = $(this).index();
  10445. cycleTo(index);
  10446. });
  10447. $indicators.append($indicator);
  10448. }
  10449. });
  10450. if (showIndicators) {
  10451. view.append($indicators);
  10452. }
  10453. count = images.length;
  10454. function setupEvents() {
  10455. if (typeof window.ontouchstart !== 'undefined') {
  10456. view.on('touchstart.carousel', tap);
  10457. view.on('touchmove.carousel', drag);
  10458. view.on('touchend.carousel', release);
  10459. }
  10460. view.on('mousedown.carousel', tap);
  10461. view.on('mousemove.carousel', drag);
  10462. view.on('mouseup.carousel', release);
  10463. view.on('mouseleave.carousel', release);
  10464. view.on('click.carousel', click);
  10465. }
  10466. function xpos(e) {
  10467. // touch event
  10468. if (e.targetTouches && e.targetTouches.length >= 1) {
  10469. return e.targetTouches[0].clientX;
  10470. }
  10471. // mouse event
  10472. return e.clientX;
  10473. }
  10474. function ypos(e) {
  10475. // touch event
  10476. if (e.targetTouches && e.targetTouches.length >= 1) {
  10477. return e.targetTouches[0].clientY;
  10478. }
  10479. // mouse event
  10480. return e.clientY;
  10481. }
  10482. function wrap(x) {
  10483. return x >= count ? x % count : x < 0 ? wrap(count + x % count) : x;
  10484. }
  10485. function scroll(x) {
  10486. // Track scrolling state
  10487. scrolling = true;
  10488. if (!view.hasClass('scrolling')) {
  10489. view.addClass('scrolling');
  10490. }
  10491. if (scrollingTimeout != null) {
  10492. window.clearTimeout(scrollingTimeout);
  10493. }
  10494. scrollingTimeout = window.setTimeout(function () {
  10495. scrolling = false;
  10496. view.removeClass('scrolling');
  10497. }, options.duration);
  10498. // Start actual scroll
  10499. var i, half, delta, dir, tween, el, alignment, xTranslation;
  10500. var lastCenter = center;
  10501. offset = typeof x === 'number' ? x : offset;
  10502. center = Math.floor((offset + dim / 2) / dim);
  10503. delta = offset - center * dim;
  10504. dir = delta < 0 ? 1 : -1;
  10505. tween = -dir * delta * 2 / dim;
  10506. half = count >> 1;
  10507. if (!options.fullWidth) {
  10508. alignment = 'translateX(' + (view[0].clientWidth - item_width) / 2 + 'px) ';
  10509. alignment += 'translateY(' + (view[0].clientHeight - item_height) / 2 + 'px)';
  10510. } else {
  10511. alignment = 'translateX(0)';
  10512. }
  10513. // Set indicator active
  10514. if (showIndicators) {
  10515. var diff = center % count;
  10516. var activeIndicator = $indicators.find('.indicator-item.active');
  10517. if (activeIndicator.index() !== diff) {
  10518. activeIndicator.removeClass('active');
  10519. $indicators.find('.indicator-item').eq(diff).addClass('active');
  10520. }
  10521. }
  10522. // center
  10523. // Don't show wrapped items.
  10524. if (!noWrap || center >= 0 && center < count) {
  10525. el = images[wrap(center)];
  10526. // Add active class to center item.
  10527. if (!$(el).hasClass('active')) {
  10528. view.find('.carousel-item').removeClass('active');
  10529. $(el).addClass('active');
  10530. }
  10531. el.style[xform] = alignment + ' translateX(' + -delta / 2 + 'px)' + ' translateX(' + dir * options.shift * tween * i + 'px)' + ' translateZ(' + options.dist * tween + 'px)';
  10532. el.style.zIndex = 0;
  10533. if (options.fullWidth) {
  10534. tweenedOpacity = 1;
  10535. } else {
  10536. tweenedOpacity = 1 - 0.2 * tween;
  10537. }
  10538. el.style.opacity = tweenedOpacity;
  10539. el.style.display = 'block';
  10540. }
  10541. for (i = 1; i <= half; ++i) {
  10542. // right side
  10543. if (options.fullWidth) {
  10544. zTranslation = options.dist;
  10545. tweenedOpacity = i === half && delta < 0 ? 1 - tween : 1;
  10546. } else {
  10547. zTranslation = options.dist * (i * 2 + tween * dir);
  10548. tweenedOpacity = 1 - 0.2 * (i * 2 + tween * dir);
  10549. }
  10550. // Don't show wrapped items.
  10551. if (!noWrap || center + i < count) {
  10552. el = images[wrap(center + i)];
  10553. el.style[xform] = alignment + ' translateX(' + (options.shift + (dim * i - delta) / 2) + 'px)' + ' translateZ(' + zTranslation + 'px)';
  10554. el.style.zIndex = -i;
  10555. el.style.opacity = tweenedOpacity;
  10556. el.style.display = 'block';
  10557. }
  10558. // left side
  10559. if (options.fullWidth) {
  10560. zTranslation = options.dist;
  10561. tweenedOpacity = i === half && delta > 0 ? 1 - tween : 1;
  10562. } else {
  10563. zTranslation = options.dist * (i * 2 - tween * dir);
  10564. tweenedOpacity = 1 - 0.2 * (i * 2 - tween * dir);
  10565. }
  10566. // Don't show wrapped items.
  10567. if (!noWrap || center - i >= 0) {
  10568. el = images[wrap(center - i)];
  10569. el.style[xform] = alignment + ' translateX(' + (-options.shift + (-dim * i - delta) / 2) + 'px)' + ' translateZ(' + zTranslation + 'px)';
  10570. el.style.zIndex = -i;
  10571. el.style.opacity = tweenedOpacity;
  10572. el.style.display = 'block';
  10573. }
  10574. }
  10575. // center
  10576. // Don't show wrapped items.
  10577. if (!noWrap || center >= 0 && center < count) {
  10578. el = images[wrap(center)];
  10579. el.style[xform] = alignment + ' translateX(' + -delta / 2 + 'px)' + ' translateX(' + dir * options.shift * tween + 'px)' + ' translateZ(' + options.dist * tween + 'px)';
  10580. el.style.zIndex = 0;
  10581. if (options.fullWidth) {
  10582. tweenedOpacity = 1;
  10583. } else {
  10584. tweenedOpacity = 1 - 0.2 * tween;
  10585. }
  10586. el.style.opacity = tweenedOpacity;
  10587. el.style.display = 'block';
  10588. }
  10589. // onCycleTo callback
  10590. if (lastCenter !== center && typeof options.onCycleTo === "function") {
  10591. var $curr_item = view.find('.carousel-item').eq(wrap(center));
  10592. options.onCycleTo.call(this, $curr_item, dragged);
  10593. }
  10594. // One time callback
  10595. if (typeof oneTimeCallback === "function") {
  10596. oneTimeCallback.call(this, $curr_item, dragged);
  10597. oneTimeCallback = null;
  10598. }
  10599. }
  10600. function track() {
  10601. var now, elapsed, delta, v;
  10602. now = Date.now();
  10603. elapsed = now - timestamp;
  10604. timestamp = now;
  10605. delta = offset - frame;
  10606. frame = offset;
  10607. v = 1000 * delta / (1 + elapsed);
  10608. velocity = 0.8 * v + 0.2 * velocity;
  10609. }
  10610. function autoScroll() {
  10611. var elapsed, delta;
  10612. if (amplitude) {
  10613. elapsed = Date.now() - timestamp;
  10614. delta = amplitude * Math.exp(-elapsed / options.duration);
  10615. if (delta > 2 || delta < -2) {
  10616. scroll(target - delta);
  10617. requestAnimationFrame(autoScroll);
  10618. } else {
  10619. scroll(target);
  10620. }
  10621. }
  10622. }
  10623. function click(e) {
  10624. // Disable clicks if carousel was dragged.
  10625. if (dragged) {
  10626. e.preventDefault();
  10627. e.stopPropagation();
  10628. return false;
  10629. } else if (!options.fullWidth) {
  10630. var clickedIndex = $(e.target).closest('.carousel-item').index();
  10631. var diff = wrap(center) - clickedIndex;
  10632. // Disable clicks if carousel was shifted by click
  10633. if (diff !== 0) {
  10634. e.preventDefault();
  10635. e.stopPropagation();
  10636. }
  10637. cycleTo(clickedIndex);
  10638. }
  10639. }
  10640. function cycleTo(n) {
  10641. var diff = center % count - n;
  10642. // Account for wraparound.
  10643. if (!noWrap) {
  10644. if (diff < 0) {
  10645. if (Math.abs(diff + count) < Math.abs(diff)) {
  10646. diff += count;
  10647. }
  10648. } else if (diff > 0) {
  10649. if (Math.abs(diff - count) < diff) {
  10650. diff -= count;
  10651. }
  10652. }
  10653. }
  10654. // Call prev or next accordingly.
  10655. if (diff < 0) {
  10656. view.trigger('carouselNext', [Math.abs(diff)]);
  10657. } else if (diff > 0) {
  10658. view.trigger('carouselPrev', [diff]);
  10659. }
  10660. }
  10661. function tap(e) {
  10662. // Fixes firefox draggable image bug
  10663. if (e.type === 'mousedown' && $(e.target).is('img')) {
  10664. e.preventDefault();
  10665. }
  10666. pressed = true;
  10667. dragged = false;
  10668. vertical_dragged = false;
  10669. reference = xpos(e);
  10670. referenceY = ypos(e);
  10671. velocity = amplitude = 0;
  10672. frame = offset;
  10673. timestamp = Date.now();
  10674. clearInterval(ticker);
  10675. ticker = setInterval(track, 100);
  10676. }
  10677. function drag(e) {
  10678. var x, delta, deltaY;
  10679. if (pressed) {
  10680. x = xpos(e);
  10681. y = ypos(e);
  10682. delta = reference - x;
  10683. deltaY = Math.abs(referenceY - y);
  10684. if (deltaY < 30 && !vertical_dragged) {
  10685. // If vertical scrolling don't allow dragging.
  10686. if (delta > 2 || delta < -2) {
  10687. dragged = true;
  10688. reference = x;
  10689. scroll(offset + delta);
  10690. }
  10691. } else if (dragged) {
  10692. // If dragging don't allow vertical scroll.
  10693. e.preventDefault();
  10694. e.stopPropagation();
  10695. return false;
  10696. } else {
  10697. // Vertical scrolling.
  10698. vertical_dragged = true;
  10699. }
  10700. }
  10701. if (dragged) {
  10702. // If dragging don't allow vertical scroll.
  10703. e.preventDefault();
  10704. e.stopPropagation();
  10705. return false;
  10706. }
  10707. }
  10708. function release(e) {
  10709. if (pressed) {
  10710. pressed = false;
  10711. } else {
  10712. return;
  10713. }
  10714. clearInterval(ticker);
  10715. target = offset;
  10716. if (velocity > 10 || velocity < -10) {
  10717. amplitude = 0.9 * velocity;
  10718. target = offset + amplitude;
  10719. }
  10720. target = Math.round(target / dim) * dim;
  10721. // No wrap of items.
  10722. if (noWrap) {
  10723. if (target >= dim * (count - 1)) {
  10724. target = dim * (count - 1);
  10725. } else if (target < 0) {
  10726. target = 0;
  10727. }
  10728. }
  10729. amplitude = target - offset;
  10730. timestamp = Date.now();
  10731. requestAnimationFrame(autoScroll);
  10732. if (dragged) {
  10733. e.preventDefault();
  10734. e.stopPropagation();
  10735. }
  10736. return false;
  10737. }
  10738. xform = 'transform';
  10739. ['webkit', 'Moz', 'O', 'ms'].every(function (prefix) {
  10740. var e = prefix + 'Transform';
  10741. if (typeof document.body.style[e] !== 'undefined') {
  10742. xform = e;
  10743. return false;
  10744. }
  10745. return true;
  10746. });
  10747. var throttledResize = Materialize.throttle(function () {
  10748. if (options.fullWidth) {
  10749. item_width = view.find('.carousel-item').first().innerWidth();
  10750. var imageHeight = view.find('.carousel-item.active').height();
  10751. dim = item_width * 2 + options.padding;
  10752. offset = center * 2 * item_width;
  10753. target = offset;
  10754. setCarouselHeight(true);
  10755. } else {
  10756. scroll();
  10757. }
  10758. }, 200);
  10759. $(window).off('resize.carousel-' + uniqueNamespace).on('resize.carousel-' + uniqueNamespace, throttledResize);
  10760. setupEvents();
  10761. scroll(offset);
  10762. $(this).on('carouselNext', function (e, n, callback) {
  10763. if (n === undefined) {
  10764. n = 1;
  10765. }
  10766. if (typeof callback === "function") {
  10767. oneTimeCallback = callback;
  10768. }
  10769. target = dim * Math.round(offset / dim) + dim * n;
  10770. if (offset !== target) {
  10771. amplitude = target - offset;
  10772. timestamp = Date.now();
  10773. requestAnimationFrame(autoScroll);
  10774. }
  10775. });
  10776. $(this).on('carouselPrev', function (e, n, callback) {
  10777. if (n === undefined) {
  10778. n = 1;
  10779. }
  10780. if (typeof callback === "function") {
  10781. oneTimeCallback = callback;
  10782. }
  10783. target = dim * Math.round(offset / dim) - dim * n;
  10784. if (offset !== target) {
  10785. amplitude = target - offset;
  10786. timestamp = Date.now();
  10787. requestAnimationFrame(autoScroll);
  10788. }
  10789. });
  10790. $(this).on('carouselSet', function (e, n, callback) {
  10791. if (n === undefined) {
  10792. n = 0;
  10793. }
  10794. if (typeof callback === "function") {
  10795. oneTimeCallback = callback;
  10796. }
  10797. cycleTo(n);
  10798. });
  10799. });
  10800. },
  10801. next: function (n, callback) {
  10802. $(this).trigger('carouselNext', [n, callback]);
  10803. },
  10804. prev: function (n, callback) {
  10805. $(this).trigger('carouselPrev', [n, callback]);
  10806. },
  10807. set: function (n, callback) {
  10808. $(this).trigger('carouselSet', [n, callback]);
  10809. },
  10810. destroy: function () {
  10811. var uniqueNamespace = $(this).attr('data-namespace');
  10812. $(this).removeAttr('data-namespace');
  10813. $(this).removeClass('initialized');
  10814. $(this).find('.indicators').remove();
  10815. // Remove event handlers
  10816. $(this).off('carouselNext carouselPrev carouselSet');
  10817. $(window).off('resize.carousel-' + uniqueNamespace);
  10818. if (typeof window.ontouchstart !== 'undefined') {
  10819. $(this).off('touchstart.carousel touchmove.carousel touchend.carousel');
  10820. }
  10821. $(this).off('mousedown.carousel mousemove.carousel mouseup.carousel mouseleave.carousel click.carousel');
  10822. }
  10823. };
  10824. $.fn.carousel = function (methodOrOptions) {
  10825. if (methods[methodOrOptions]) {
  10826. return methods[methodOrOptions].apply(this, Array.prototype.slice.call(arguments, 1));
  10827. } else if (typeof methodOrOptions === 'object' || !methodOrOptions) {
  10828. // Default to "init"
  10829. return methods.init.apply(this, arguments);
  10830. } else {
  10831. $.error('Method ' + methodOrOptions + ' does not exist on jQuery.carousel');
  10832. }
  10833. }
  10834. ;
  10835. // Plugin end
  10836. }
  10837. )(jQuery);
  10838. ; (function ($) {
  10839. var methods = {
  10840. init: function (options) {
  10841. return this.each(function () {
  10842. var origin = $('#' + $(this).attr('data-activates'));
  10843. var screen = $('body');
  10844. // Creating tap target
  10845. var tapTargetEl = $(this);
  10846. var tapTargetWrapper = tapTargetEl.parent('.tap-target-wrapper');
  10847. var tapTargetWave = tapTargetWrapper.find('.tap-target-wave');
  10848. var tapTargetOriginEl = tapTargetWrapper.find('.tap-target-origin');
  10849. var tapTargetContentEl = tapTargetEl.find('.tap-target-content');
  10850. // Creating wrapper
  10851. if (!tapTargetWrapper.length) {
  10852. tapTargetWrapper = tapTargetEl.wrap($('<div class="tap-target-wrapper"></div>')).parent();
  10853. }
  10854. // Creating content
  10855. if (!tapTargetContentEl.length) {
  10856. tapTargetContentEl = $('<div class="tap-target-content"></div>');
  10857. tapTargetEl.append(tapTargetContentEl);
  10858. }
  10859. // Creating foreground wave
  10860. if (!tapTargetWave.length) {
  10861. tapTargetWave = $('<div class="tap-target-wave"></div>');
  10862. // Creating origin
  10863. if (!tapTargetOriginEl.length) {
  10864. tapTargetOriginEl = origin.clone(true, true);
  10865. tapTargetOriginEl.addClass('tap-target-origin');
  10866. tapTargetOriginEl.removeAttr('id');
  10867. tapTargetOriginEl.removeAttr('style');
  10868. tapTargetWave.append(tapTargetOriginEl);
  10869. }
  10870. tapTargetWrapper.append(tapTargetWave);
  10871. }
  10872. // Open
  10873. var openTapTarget = function () {
  10874. if (tapTargetWrapper.is('.open')) {
  10875. return;
  10876. }
  10877. // Adding open class
  10878. tapTargetWrapper.addClass('open');
  10879. setTimeout(function () {
  10880. tapTargetOriginEl.off('click.tapTarget').on('click.tapTarget', function (e) {
  10881. closeTapTarget();
  10882. tapTargetOriginEl.off('click.tapTarget');
  10883. });
  10884. $(document).off('click.tapTarget').on('click.tapTarget', function (e) {
  10885. closeTapTarget();
  10886. $(document).off('click.tapTarget');
  10887. });
  10888. var throttledCalc = Materialize.throttle(function () {
  10889. calculateTapTarget();
  10890. }, 200);
  10891. $(window).off('resize.tapTarget').on('resize.tapTarget', throttledCalc);
  10892. }, 0);
  10893. };
  10894. // Close
  10895. var closeTapTarget = function () {
  10896. if (!tapTargetWrapper.is('.open')) {
  10897. return;
  10898. }
  10899. tapTargetWrapper.removeClass('open');
  10900. tapTargetOriginEl.off('click.tapTarget');
  10901. $(document).off('click.tapTarget');
  10902. $(window).off('resize.tapTarget');
  10903. };
  10904. // Pre calculate
  10905. var calculateTapTarget = function () {
  10906. // Element or parent is fixed position?
  10907. var isFixed = origin.css('position') === 'fixed';
  10908. if (!isFixed) {
  10909. var parents = origin.parents();
  10910. for (var i = 0; i < parents.length; i++) {
  10911. isFixed = $(parents[i]).css('position') == 'fixed';
  10912. if (isFixed) {
  10913. break;
  10914. }
  10915. }
  10916. }
  10917. // Calculating origin
  10918. var originWidth = origin.outerWidth();
  10919. var originHeight = origin.outerHeight();
  10920. var originTop = isFixed ? origin.offset().top - $(document).scrollTop() : origin.offset().top;
  10921. var originLeft = isFixed ? origin.offset().left - $(document).scrollLeft() : origin.offset().left;
  10922. // Calculating screen
  10923. var windowWidth = $(window).width();
  10924. var windowHeight = $(window).height();
  10925. var centerX = windowWidth / 2;
  10926. var centerY = windowHeight / 2;
  10927. var isLeft = originLeft <= centerX;
  10928. var isRight = originLeft > centerX;
  10929. var isTop = originTop <= centerY;
  10930. var isBottom = originTop > centerY;
  10931. var isCenterX = originLeft >= windowWidth * 0.25 && originLeft <= windowWidth * 0.75;
  10932. var isCenterY = originTop >= windowHeight * 0.25 && originTop <= windowHeight * 0.75;
  10933. // Calculating tap target
  10934. var tapTargetWidth = tapTargetEl.outerWidth();
  10935. var tapTargetHeight = tapTargetEl.outerHeight();
  10936. var tapTargetTop = originTop + originHeight / 2 - tapTargetHeight / 2;
  10937. var tapTargetLeft = originLeft + originWidth / 2 - tapTargetWidth / 2;
  10938. var tapTargetPosition = isFixed ? 'fixed' : 'absolute';
  10939. // Calculating content
  10940. var tapTargetTextWidth = isCenterX ? tapTargetWidth : tapTargetWidth / 2 + originWidth;
  10941. var tapTargetTextHeight = tapTargetHeight / 2;
  10942. var tapTargetTextTop = isTop ? tapTargetHeight / 2 : 0;
  10943. var tapTargetTextBottom = 0;
  10944. var tapTargetTextLeft = isLeft && !isCenterX ? tapTargetWidth / 2 - originWidth : 0;
  10945. var tapTargetTextRight = 0;
  10946. var tapTargetTextPadding = originWidth;
  10947. var tapTargetTextAlign = isBottom ? 'bottom' : 'top';
  10948. // Calculating wave
  10949. var tapTargetWaveWidth = originWidth > originHeight ? originWidth * 2 : originWidth * 2;
  10950. var tapTargetWaveHeight = tapTargetWaveWidth;
  10951. var tapTargetWaveTop = tapTargetHeight / 2 - tapTargetWaveHeight / 2;
  10952. var tapTargetWaveLeft = tapTargetWidth / 2 - tapTargetWaveWidth / 2;
  10953. // Setting tap target
  10954. var tapTargetWrapperCssObj = {};
  10955. tapTargetWrapperCssObj.top = isTop ? tapTargetTop : '';
  10956. tapTargetWrapperCssObj.right = isRight ? windowWidth - tapTargetLeft - tapTargetWidth : '';
  10957. tapTargetWrapperCssObj.bottom = isBottom ? windowHeight - tapTargetTop - tapTargetHeight : '';
  10958. tapTargetWrapperCssObj.left = isLeft ? tapTargetLeft : '';
  10959. tapTargetWrapperCssObj.position = tapTargetPosition;
  10960. tapTargetWrapper.css(tapTargetWrapperCssObj);
  10961. // Setting content
  10962. tapTargetContentEl.css({
  10963. width: tapTargetTextWidth,
  10964. height: tapTargetTextHeight,
  10965. top: tapTargetTextTop,
  10966. right: tapTargetTextRight,
  10967. bottom: tapTargetTextBottom,
  10968. left: tapTargetTextLeft,
  10969. padding: tapTargetTextPadding,
  10970. verticalAlign: tapTargetTextAlign
  10971. });
  10972. // Setting wave
  10973. tapTargetWave.css({
  10974. top: tapTargetWaveTop,
  10975. left: tapTargetWaveLeft,
  10976. width: tapTargetWaveWidth,
  10977. height: tapTargetWaveHeight
  10978. });
  10979. };
  10980. if (options == 'open') {
  10981. calculateTapTarget();
  10982. openTapTarget();
  10983. }
  10984. if (options == 'close')
  10985. closeTapTarget();
  10986. });
  10987. },
  10988. open: function () { },
  10989. close: function () { }
  10990. };
  10991. $.fn.tapTarget = function (methodOrOptions) {
  10992. if (methods[methodOrOptions] || typeof methodOrOptions === 'object')
  10993. return methods.init.apply(this, arguments);
  10994. $.error('Method ' + methodOrOptions + ' does not exist on jQuery.tap-target');
  10995. }
  10996. ;
  10997. }
  10998. )(jQuery);