materialize.js 368 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163
  1. /*!
  2. * Materialize v0.100.2 (http://materializecss.com)
  3. * Copyright 2014-2017 Materialize
  4. * MIT License (https://raw.githubusercontent.com/Dogfalo/materialize/master/LICENSE)
  5. */
  6. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  7. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8. // Check for jQuery.
  9. if (typeof jQuery === 'undefined') {
  10. // Check if require is a defined function.
  11. if (typeof require === 'function') {
  12. jQuery = $ = require('jquery');
  13. // Else use the dollar sign alias.
  14. } else {
  15. jQuery = $;
  16. }
  17. }
  18. ; /*
  19. * jQuery Easing v1.4.0 - http://gsgd.co.uk/sandbox/jquery/easing/
  20. * Open source under the BSD License.
  21. * Copyright © 2008 George McGinley Smith
  22. * All rights reserved.
  23. * https://raw.github.com/gdsmith/jquery-easing/master/LICENSE
  24. */
  25. (function (factory) {
  26. if (typeof define === "function" && define.amd) {
  27. define(['jquery'], function ($) {
  28. return factory($);
  29. });
  30. } else if (typeof module === "object" && typeof module.exports === "object") {
  31. exports = factory(require('jquery'));
  32. } else {
  33. factory(jQuery);
  34. }
  35. })(function ($) {
  36. // Preserve the original jQuery "swing" easing as "jswing"
  37. $.easing['jswing'] = $.easing['swing'];
  38. var pow = Math.pow,
  39. sqrt = Math.sqrt,
  40. sin = Math.sin,
  41. cos = Math.cos,
  42. PI = Math.PI,
  43. c1 = 1.70158,
  44. c2 = c1 * 1.525,
  45. c3 = c1 + 1,
  46. c4 = 2 * PI / 3,
  47. c5 = 2 * PI / 4.5;
  48. // x is the fraction of animation progress, in the range 0..1
  49. function bounceOut(x) {
  50. var n1 = 7.5625,
  51. d1 = 2.75;
  52. if (x < 1 / d1) {
  53. return n1 * x * x;
  54. } else if (x < 2 / d1) {
  55. return n1 * (x -= 1.5 / d1) * x + .75;
  56. } else if (x < 2.5 / d1) {
  57. return n1 * (x -= 2.25 / d1) * x + .9375;
  58. } else {
  59. return n1 * (x -= 2.625 / d1) * x + .984375;
  60. }
  61. }
  62. $.extend($.easing, {
  63. def: 'easeOutQuad',
  64. swing: function (x) {
  65. return $.easing[$.easing.def](x);
  66. },
  67. easeInQuad: function (x) {
  68. return x * x;
  69. },
  70. easeOutQuad: function (x) {
  71. return 1 - (1 - x) * (1 - x);
  72. },
  73. easeInOutQuad: function (x) {
  74. return x < 0.5 ? 2 * x * x : 1 - pow(-2 * x + 2, 2) / 2;
  75. },
  76. easeInCubic: function (x) {
  77. return x * x * x;
  78. },
  79. easeOutCubic: function (x) {
  80. return 1 - pow(1 - x, 3);
  81. },
  82. easeInOutCubic: function (x) {
  83. return x < 0.5 ? 4 * x * x * x : 1 - pow(-2 * x + 2, 3) / 2;
  84. },
  85. easeInQuart: function (x) {
  86. return x * x * x * x;
  87. },
  88. easeOutQuart: function (x) {
  89. return 1 - pow(1 - x, 4);
  90. },
  91. easeInOutQuart: function (x) {
  92. return x < 0.5 ? 8 * x * x * x * x : 1 - pow(-2 * x + 2, 4) / 2;
  93. },
  94. easeInQuint: function (x) {
  95. return x * x * x * x * x;
  96. },
  97. easeOutQuint: function (x) {
  98. return 1 - pow(1 - x, 5);
  99. },
  100. easeInOutQuint: function (x) {
  101. return x < 0.5 ? 16 * x * x * x * x * x : 1 - pow(-2 * x + 2, 5) / 2;
  102. },
  103. easeInSine: function (x) {
  104. return 1 - cos(x * PI / 2);
  105. },
  106. easeOutSine: function (x) {
  107. return sin(x * PI / 2);
  108. },
  109. easeInOutSine: function (x) {
  110. return -(cos(PI * x) - 1) / 2;
  111. },
  112. easeInExpo: function (x) {
  113. return x === 0 ? 0 : pow(2, 10 * x - 10);
  114. },
  115. easeOutExpo: function (x) {
  116. return x === 1 ? 1 : 1 - pow(2, -10 * x);
  117. },
  118. easeInOutExpo: function (x) {
  119. return x === 0 ? 0 : x === 1 ? 1 : x < 0.5 ? pow(2, 20 * x - 10) / 2 : (2 - pow(2, -20 * x + 10)) / 2;
  120. },
  121. easeInCirc: function (x) {
  122. return 1 - sqrt(1 - pow(x, 2));
  123. },
  124. easeOutCirc: function (x) {
  125. return sqrt(1 - pow(x - 1, 2));
  126. },
  127. easeInOutCirc: function (x) {
  128. return x < 0.5 ? (1 - sqrt(1 - pow(2 * x, 2))) / 2 : (sqrt(1 - pow(-2 * x + 2, 2)) + 1) / 2;
  129. },
  130. easeInElastic: function (x) {
  131. return x === 0 ? 0 : x === 1 ? 1 : -pow(2, 10 * x - 10) * sin((x * 10 - 10.75) * c4);
  132. },
  133. easeOutElastic: function (x) {
  134. return x === 0 ? 0 : x === 1 ? 1 : pow(2, -10 * x) * sin((x * 10 - 0.75) * c4) + 1;
  135. },
  136. easeInOutElastic: function (x) {
  137. return x === 0 ? 0 : x === 1 ? 1 : x < 0.5 ? -(pow(2, 20 * x - 10) * sin((20 * x - 11.125) * c5)) / 2 : pow(2, -20 * x + 10) * sin((20 * x - 11.125) * c5) / 2 + 1;
  138. },
  139. easeInBack: function (x) {
  140. return c3 * x * x * x - c1 * x * x;
  141. },
  142. easeOutBack: function (x) {
  143. return 1 + c3 * pow(x - 1, 3) + c1 * pow(x - 1, 2);
  144. },
  145. easeInOutBack: function (x) {
  146. return x < 0.5 ? pow(2 * x, 2) * ((c2 + 1) * 2 * x - c2) / 2 : (pow(2 * x - 2, 2) * ((c2 + 1) * (x * 2 - 2) + c2) + 2) / 2;
  147. },
  148. easeInBounce: function (x) {
  149. return 1 - bounceOut(1 - x);
  150. },
  151. easeOutBounce: bounceOut,
  152. easeInOutBounce: function (x) {
  153. return x < 0.5 ? (1 - bounceOut(1 - 2 * x)) / 2 : (1 + bounceOut(2 * x - 1)) / 2;
  154. }
  155. });
  156. });; // Custom Easing
  157. jQuery.extend(jQuery.easing, {
  158. easeInOutMaterial: function (x, t, b, c, d) {
  159. if ((t /= d / 2) < 1) return c / 2 * t * t + b;
  160. return c / 4 * ((t -= 2) * t * t + 2) + b;
  161. }
  162. });; /*! VelocityJS.org (1.2.3). (C) 2014 Julian Shapiro. MIT @license: en.wikipedia.org/wiki/MIT_License */
  163. /*! VelocityJS.org jQuery Shim (1.0.1). (C) 2014 The jQuery Foundation. MIT @license: en.wikipedia.org/wiki/MIT_License. */
  164. /*! Note that this has been modified by Materialize to confirm that Velocity is not already being imported. */
  165. jQuery.Velocity ? console.log("Velocity is already loaded. You may be needlessly importing Velocity again; note that Materialize includes Velocity.") : (!function (e) {
  166. function t(e) {
  167. var t = e.length,
  168. a = r.type(e); return "function" === a || r.isWindow(e) ? !1 : 1 === e.nodeType && t ? !0 : "array" === a || 0 === t || "number" == typeof t && t > 0 && t - 1 in e;
  169. } if (!e.jQuery) {
  170. var r = function (e, t) {
  171. return new r.fn.init(e, t);
  172. }; r.isWindow = function (e) {
  173. return null != e && e == e.window;
  174. }, r.type = function (e) {
  175. return null == e ? e + "" : "object" == typeof e || "function" == typeof e ? n[i.call(e)] || "object" : typeof e;
  176. }, r.isArray = Array.isArray || function (e) {
  177. return "array" === r.type(e);
  178. }, r.isPlainObject = function (e) {
  179. var t; if (!e || "object" !== r.type(e) || e.nodeType || r.isWindow(e)) return !1; try {
  180. if (e.constructor && !o.call(e, "constructor") && !o.call(e.constructor.prototype, "isPrototypeOf")) return !1;
  181. } catch (a) {
  182. return !1;
  183. } for (t in e) { } return void 0 === t || o.call(e, t);
  184. }, r.each = function (e, r, a) {
  185. var n,
  186. o = 0,
  187. i = e.length,
  188. s = t(e); if (a) {
  189. if (s) for (; i > o && (n = r.apply(e[o], a), n !== !1); o++) { } else for (o in e) {
  190. if (n = r.apply(e[o], a), n === !1) break;
  191. }
  192. } else if (s) for (; i > o && (n = r.call(e[o], o, e[o]), n !== !1); o++) { } else for (o in e) {
  193. if (n = r.call(e[o], o, e[o]), n === !1) break;
  194. } return e;
  195. }, r.data = function (e, t, n) {
  196. if (void 0 === n) {
  197. var o = e[r.expando],
  198. i = o && a[o]; if (void 0 === t) return i; if (i && t in i) return i[t];
  199. } else if (void 0 !== t) {
  200. var o = e[r.expando] || (e[r.expando] = ++r.uuid); return a[o] = a[o] || {}, a[o][t] = n, n;
  201. }
  202. }, r.removeData = function (e, t) {
  203. var n = e[r.expando],
  204. o = n && a[n]; o && r.each(t, function (e, t) {
  205. delete o[t];
  206. });
  207. }, r.extend = function () {
  208. var e,
  209. t,
  210. a,
  211. n,
  212. o,
  213. i,
  214. s = arguments[0] || {},
  215. l = 1,
  216. u = arguments.length,
  217. c = !1; for ("boolean" == typeof s && (c = s, s = arguments[l] || {}, l++), "object" != typeof s && "function" !== r.type(s) && (s = {}), l === u && (s = this, l--); u > l; l++) {
  218. if (null != (o = arguments[l])) for (n in o) {
  219. e = s[n], a = o[n], s !== a && (c && a && (r.isPlainObject(a) || (t = r.isArray(a))) ? (t ? (t = !1, i = e && r.isArray(e) ? e : []) : i = e && r.isPlainObject(e) ? e : {}, s[n] = r.extend(c, i, a)) : void 0 !== a && (s[n] = a));
  220. }
  221. } return s;
  222. }, r.queue = function (e, a, n) {
  223. function o(e, r) {
  224. var a = r || []; return null != e && (t(Object(e)) ? !function (e, t) {
  225. for (var r = +t.length, a = 0, n = e.length; r > a;) {
  226. e[n++] = t[a++];
  227. } if (r !== r) for (; void 0 !== t[a];) {
  228. e[n++] = t[a++];
  229. } return e.length = n, e;
  230. }(a, "string" == typeof e ? [e] : e) : [].push.call(a, e)), a;
  231. } if (e) {
  232. a = (a || "fx") + "queue"; var i = r.data(e, a); return n ? (!i || r.isArray(n) ? i = r.data(e, a, o(n)) : i.push(n), i) : i || [];
  233. }
  234. }, r.dequeue = function (e, t) {
  235. r.each(e.nodeType ? [e] : e, function (e, a) {
  236. t = t || "fx"; var n = r.queue(a, t),
  237. o = n.shift(); "inprogress" === o && (o = n.shift()), o && ("fx" === t && n.unshift("inprogress"), o.call(a, function () {
  238. r.dequeue(a, t);
  239. }));
  240. });
  241. }, r.fn = r.prototype = {
  242. init: function (e) {
  243. if (e.nodeType) return this[0] = e, this; throw new Error("Not a DOM node.");
  244. }, offset: function () {
  245. var t = this[0].getBoundingClientRect ? this[0].getBoundingClientRect() : { top: 0, left: 0 }; return { top: t.top + (e.pageYOffset || document.scrollTop || 0) - (document.clientTop || 0), left: t.left + (e.pageXOffset || document.scrollLeft || 0) - (document.clientLeft || 0) };
  246. }, position: function () {
  247. function e() {
  248. for (var e = this.offsetParent || document; e && "html" === !e.nodeType.toLowerCase && "static" === e.style.position;) {
  249. e = e.offsetParent;
  250. } return e || document;
  251. } var t = this[0],
  252. e = e.apply(t),
  253. a = this.offset(),
  254. n = /^(?:body|html)$/i.test(e.nodeName) ? { top: 0, left: 0 } : r(e).offset(); return a.top -= parseFloat(t.style.marginTop) || 0, a.left -= parseFloat(t.style.marginLeft) || 0, e.style && (n.top += parseFloat(e.style.borderTopWidth) || 0, n.left += parseFloat(e.style.borderLeftWidth) || 0), { top: a.top - n.top, left: a.left - n.left };
  255. }
  256. }; var a = {}; r.expando = "velocity" + new Date().getTime(), r.uuid = 0; for (var n = {}, o = n.hasOwnProperty, i = n.toString, s = "Boolean Number String Function Array Date RegExp Object Error".split(" "), l = 0; l < s.length; l++) {
  257. n["[object " + s[l] + "]"] = s[l].toLowerCase();
  258. } r.fn.init.prototype = r.fn, e.Velocity = { Utilities: r };
  259. }
  260. }(window), function (e) {
  261. "object" == typeof module && "object" == typeof module.exports ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : e();
  262. }(function () {
  263. return function (e, t, r, a) {
  264. function n(e) {
  265. for (var t = -1, r = e ? e.length : 0, a = []; ++t < r;) {
  266. var n = e[t]; n && a.push(n);
  267. } return a;
  268. } function o(e) {
  269. return m.isWrapped(e) ? e = [].slice.call(e) : m.isNode(e) && (e = [e]), e;
  270. } function i(e) {
  271. var t = f.data(e, "velocity"); return null === t ? a : t;
  272. } function s(e) {
  273. return function (t) {
  274. return Math.round(t * e) * (1 / e);
  275. };
  276. } function l(e, r, a, n) {
  277. function o(e, t) {
  278. return 1 - 3 * t + 3 * e;
  279. } function i(e, t) {
  280. return 3 * t - 6 * e;
  281. } function s(e) {
  282. return 3 * e;
  283. } function l(e, t, r) {
  284. return ((o(t, r) * e + i(t, r)) * e + s(t)) * e;
  285. } function u(e, t, r) {
  286. return 3 * o(t, r) * e * e + 2 * i(t, r) * e + s(t);
  287. } function c(t, r) {
  288. for (var n = 0; m > n; ++n) {
  289. var o = u(r, e, a); if (0 === o) return r; var i = l(r, e, a) - t; r -= i / o;
  290. } return r;
  291. } function p() {
  292. for (var t = 0; b > t; ++t) {
  293. w[t] = l(t * x, e, a);
  294. }
  295. } function f(t, r, n) {
  296. var o,
  297. i,
  298. s = 0; do {
  299. i = r + (n - r) / 2, o = l(i, e, a) - t, o > 0 ? n = i : r = i;
  300. } while (Math.abs(o) > h && ++s < v); return i;
  301. } function d(t) {
  302. for (var r = 0, n = 1, o = b - 1; n != o && w[n] <= t; ++n) {
  303. r += x;
  304. } --n; var i = (t - w[n]) / (w[n + 1] - w[n]),
  305. s = r + i * x,
  306. l = u(s, e, a); return l >= y ? c(t, s) : 0 == l ? s : f(t, r, r + x);
  307. } function g() {
  308. V = !0, (e != r || a != n) && p();
  309. } var m = 4,
  310. y = .001,
  311. h = 1e-7,
  312. v = 10,
  313. b = 11,
  314. x = 1 / (b - 1),
  315. S = "Float32Array" in t; if (4 !== arguments.length) return !1; for (var P = 0; 4 > P; ++P) {
  316. if ("number" != typeof arguments[P] || isNaN(arguments[P]) || !isFinite(arguments[P])) return !1;
  317. } e = Math.min(e, 1), a = Math.min(a, 1), e = Math.max(e, 0), a = Math.max(a, 0); var w = S ? new Float32Array(b) : new Array(b),
  318. V = !1,
  319. C = function (t) {
  320. return V || g(), e === r && a === n ? t : 0 === t ? 0 : 1 === t ? 1 : l(d(t), r, n);
  321. }; C.getControlPoints = function () {
  322. return [{ x: e, y: r }, { x: a, y: n }];
  323. }; var T = "generateBezier(" + [e, r, a, n] + ")"; return C.toString = function () {
  324. return T;
  325. }, C;
  326. } function u(e, t) {
  327. var r = e; return m.isString(e) ? b.Easings[e] || (r = !1) : r = m.isArray(e) && 1 === e.length ? s.apply(null, e) : m.isArray(e) && 2 === e.length ? x.apply(null, e.concat([t])) : m.isArray(e) && 4 === e.length ? l.apply(null, e) : !1, r === !1 && (r = b.Easings[b.defaults.easing] ? b.defaults.easing : v), r;
  328. } function c(e) {
  329. if (e) {
  330. var t = new Date().getTime(),
  331. r = b.State.calls.length; r > 1e4 && (b.State.calls = n(b.State.calls)); for (var o = 0; r > o; o++) {
  332. if (b.State.calls[o]) {
  333. var s = b.State.calls[o],
  334. l = s[0],
  335. u = s[2],
  336. d = s[3],
  337. g = !!d,
  338. y = null; d || (d = b.State.calls[o][3] = t - 16); for (var h = Math.min((t - d) / u.duration, 1), v = 0, x = l.length; x > v; v++) {
  339. var P = l[v],
  340. V = P.element; if (i(V)) {
  341. var C = !1; if (u.display !== a && null !== u.display && "none" !== u.display) {
  342. if ("flex" === u.display) {
  343. var T = ["-webkit-box", "-moz-box", "-ms-flexbox", "-webkit-flex"]; f.each(T, function (e, t) {
  344. S.setPropertyValue(V, "display", t);
  345. });
  346. } S.setPropertyValue(V, "display", u.display);
  347. } u.visibility !== a && "hidden" !== u.visibility && S.setPropertyValue(V, "visibility", u.visibility); for (var k in P) {
  348. if ("element" !== k) {
  349. var A,
  350. F = P[k],
  351. j = m.isString(F.easing) ? b.Easings[F.easing] : F.easing; if (1 === h) A = F.endValue; else {
  352. var E = F.endValue - F.startValue; if (A = F.startValue + E * j(h, u, E), !g && A === F.currentValue) continue;
  353. } if (F.currentValue = A, "tween" === k) y = A; else {
  354. if (S.Hooks.registered[k]) {
  355. var H = S.Hooks.getRoot(k),
  356. N = i(V).rootPropertyValueCache[H]; N && (F.rootPropertyValue = N);
  357. } var L = S.setPropertyValue(V, k, F.currentValue + (0 === parseFloat(A) ? "" : F.unitType), F.rootPropertyValue, F.scrollData); S.Hooks.registered[k] && (i(V).rootPropertyValueCache[H] = S.Normalizations.registered[H] ? S.Normalizations.registered[H]("extract", null, L[1]) : L[1]), "transform" === L[0] && (C = !0);
  358. }
  359. }
  360. } u.mobileHA && i(V).transformCache.translate3d === a && (i(V).transformCache.translate3d = "(0px, 0px, 0px)", C = !0), C && S.flushTransformCache(V);
  361. }
  362. } u.display !== a && "none" !== u.display && (b.State.calls[o][2].display = !1), u.visibility !== a && "hidden" !== u.visibility && (b.State.calls[o][2].visibility = !1), u.progress && u.progress.call(s[1], s[1], h, Math.max(0, d + u.duration - t), d, y), 1 === h && p(o);
  363. }
  364. }
  365. } b.State.isTicking && w(c);
  366. } function p(e, t) {
  367. if (!b.State.calls[e]) return !1; for (var r = b.State.calls[e][0], n = b.State.calls[e][1], o = b.State.calls[e][2], s = b.State.calls[e][4], l = !1, u = 0, c = r.length; c > u; u++) {
  368. var p = r[u].element; if (t || o.loop || ("none" === o.display && S.setPropertyValue(p, "display", o.display), "hidden" === o.visibility && S.setPropertyValue(p, "visibility", o.visibility)), o.loop !== !0 && (f.queue(p)[1] === a || !/\.velocityQueueEntryFlag/i.test(f.queue(p)[1])) && i(p)) {
  369. i(p).isAnimating = !1, i(p).rootPropertyValueCache = {}; var d = !1; f.each(S.Lists.transforms3D, function (e, t) {
  370. var r = /^scale/.test(t) ? 1 : 0,
  371. n = i(p).transformCache[t]; i(p).transformCache[t] !== a && new RegExp("^\\(" + r + "[^.]").test(n) && (d = !0, delete i(p).transformCache[t]);
  372. }), o.mobileHA && (d = !0, delete i(p).transformCache.translate3d), d && S.flushTransformCache(p), S.Values.removeClass(p, "velocity-animating");
  373. } if (!t && o.complete && !o.loop && u === c - 1) try {
  374. o.complete.call(n, n);
  375. } catch (g) {
  376. setTimeout(function () {
  377. throw g;
  378. }, 1);
  379. } s && o.loop !== !0 && s(n), i(p) && o.loop === !0 && !t && (f.each(i(p).tweensContainer, function (e, t) {
  380. /^rotate/.test(e) && 360 === parseFloat(t.endValue) && (t.endValue = 0, t.startValue = 360), /^backgroundPosition/.test(e) && 100 === parseFloat(t.endValue) && "%" === t.unitType && (t.endValue = 0, t.startValue = 100);
  381. }), b(p, "reverse", { loop: !0, delay: o.delay })), o.queue !== !1 && f.dequeue(p, o.queue);
  382. } b.State.calls[e] = !1; for (var m = 0, y = b.State.calls.length; y > m; m++) {
  383. if (b.State.calls[m] !== !1) {
  384. l = !0; break;
  385. }
  386. } l === !1 && (b.State.isTicking = !1, delete b.State.calls, b.State.calls = []);
  387. } var f,
  388. d = function () {
  389. if (r.documentMode) return r.documentMode; for (var e = 7; e > 4; e--) {
  390. var t = r.createElement("div"); if (t.innerHTML = "<!--[if IE " + e + "]><span></span><![endif]-->", t.getElementsByTagName("span").length) return t = null, e;
  391. } return a;
  392. }(),
  393. g = function () {
  394. var e = 0; return t.webkitRequestAnimationFrame || t.mozRequestAnimationFrame || function (t) {
  395. var r,
  396. a = new Date().getTime(); return r = Math.max(0, 16 - (a - e)), e = a + r, setTimeout(function () {
  397. t(a + r);
  398. }, r);
  399. };
  400. }(),
  401. m = {
  402. isString: function (e) {
  403. return "string" == typeof e;
  404. }, isArray: Array.isArray || function (e) {
  405. return "[object Array]" === Object.prototype.toString.call(e);
  406. }, isFunction: function (e) {
  407. return "[object Function]" === Object.prototype.toString.call(e);
  408. }, isNode: function (e) {
  409. return e && e.nodeType;
  410. }, isNodeList: function (e) {
  411. 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);
  412. }, isWrapped: function (e) {
  413. return e && (e.jquery || t.Zepto && t.Zepto.zepto.isZ(e));
  414. }, isSVG: function (e) {
  415. return t.SVGElement && e instanceof t.SVGElement;
  416. }, isEmptyObject: function (e) {
  417. for (var t in e) {
  418. return !1;
  419. } return !0;
  420. }
  421. },
  422. y = !1; if (e.fn && e.fn.jquery ? (f = e, y = !0) : f = t.Velocity.Utilities, 8 >= d && !y) throw new Error("Velocity: IE8 and below require jQuery to be loaded before Velocity."); if (7 >= d) return void (jQuery.fn.velocity = jQuery.fn.animate); var h = 400,
  423. v = "swing",
  424. b = {
  425. State: { isMobile: /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent), isAndroid: /Android/i.test(navigator.userAgent), isGingerbread: /Android 2\.3\.[3-7]/i.test(navigator.userAgent), isChrome: t.chrome, isFirefox: /Firefox/i.test(navigator.userAgent), prefixElement: r.createElement("div"), prefixMatches: {}, scrollAnchor: null, scrollPropertyLeft: null, scrollPropertyTop: null, isTicking: !1, calls: [] }, CSS: {}, Utilities: f, Redirects: {}, Easings: {}, Promise: t.Promise, defaults: { queue: "", duration: h, easing: v, begin: a, complete: a, progress: a, display: a, visibility: a, loop: !1, delay: !1, mobileHA: !0, _cacheValues: !0 }, init: function (e) {
  426. f.data(e, "velocity", { isSVG: m.isSVG(e), isAnimating: !1, computedStyle: null, tweensContainer: null, rootPropertyValueCache: {}, transformCache: {} });
  427. }, hook: null, mock: !1, version: { major: 1, minor: 2, patch: 2 }, debug: !1
  428. }; t.pageYOffset !== a ? (b.State.scrollAnchor = t, b.State.scrollPropertyLeft = "pageXOffset", b.State.scrollPropertyTop = "pageYOffset") : (b.State.scrollAnchor = r.documentElement || r.body.parentNode || r.body, b.State.scrollPropertyLeft = "scrollLeft", b.State.scrollPropertyTop = "scrollTop"); var x = function () {
  429. function e(e) {
  430. return -e.tension * e.x - e.friction * e.v;
  431. } function t(t, r, a) {
  432. var n = { x: t.x + a.dx * r, v: t.v + a.dv * r, tension: t.tension, friction: t.friction }; return { dx: n.v, dv: e(n) };
  433. } function r(r, a) {
  434. var n = { dx: r.v, dv: e(r) },
  435. o = t(r, .5 * a, n),
  436. i = t(r, .5 * a, o),
  437. s = t(r, a, i),
  438. l = 1 / 6 * (n.dx + 2 * (o.dx + i.dx) + s.dx),
  439. u = 1 / 6 * (n.dv + 2 * (o.dv + i.dv) + s.dv); return r.x = r.x + l * a, r.v = r.v + u * a, r;
  440. } return function a(e, t, n) {
  441. var o,
  442. i,
  443. s,
  444. l = { x: -1, v: 0, tension: null, friction: null },
  445. u = [0],
  446. c = 0,
  447. p = 1e-4,
  448. f = .016; for (e = parseFloat(e) || 500, t = parseFloat(t) || 20, n = n || null, l.tension = e, l.friction = t, o = null !== n, o ? (c = a(e, t), i = c / n * f) : i = f; s = r(s || l, i), u.push(1 + s.x), c += 16, Math.abs(s.x) > p && Math.abs(s.v) > p;) { } return o ? function (e) {
  449. return u[e * (u.length - 1) | 0];
  450. } : c;
  451. };
  452. }(); b.Easings = {
  453. linear: function (e) {
  454. return e;
  455. }, swing: function (e) {
  456. return .5 - Math.cos(e * Math.PI) / 2;
  457. }, spring: function (e) {
  458. return 1 - Math.cos(4.5 * e * Math.PI) * Math.exp(6 * -e);
  459. }
  460. }, 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) {
  461. b.Easings[t[0]] = l.apply(null, t[1]);
  462. }); var S = b.CSS = {
  463. RegEx: { isHex: /^#([A-f\d]{3}){1,2}$/i, valueUnwrap: /^[A-z]+\((.*)\)$/i, wrappedValueAlreadyExtracted: /[0-9.]+ [0-9.]+ [0-9.]+( [0-9.]+)?/, valueSplit: /([A-z]+\(.+\))|(([A-z0-9#-.]+?)(?=\s|$))/gi }, Lists: { colors: ["fill", "stroke", "stopColor", "color", "backgroundColor", "borderColor", "borderTopColor", "borderRightColor", "borderBottomColor", "borderLeftColor", "outlineColor"], transformsBase: ["translateX", "translateY", "scale", "scaleX", "scaleY", "skewX", "skewY", "rotateZ"], transforms3D: ["transformPerspective", "translateZ", "scaleZ", "rotateX", "rotateY"] }, Hooks: {
  464. templates: { textShadow: ["Color X Y Blur", "black 0px 0px 0px"], boxShadow: ["Color X Y Blur Spread", "black 0px 0px 0px 0px"], clip: ["Top Right Bottom Left", "0px 0px 0px 0px"], backgroundPosition: ["X Y", "0% 0%"], transformOrigin: ["X Y Z", "50% 50% 0px"], perspectiveOrigin: ["X Y", "50% 50%"] }, registered: {}, register: function () {
  465. for (var e = 0; e < S.Lists.colors.length; e++) {
  466. var t = "color" === S.Lists.colors[e] ? "0 0 0 1" : "255 255 255 1"; S.Hooks.templates[S.Lists.colors[e]] = ["Red Green Blue Alpha", t];
  467. } var r, a, n; if (d) for (r in S.Hooks.templates) {
  468. a = S.Hooks.templates[r], n = a[0].split(" "); var o = a[1].match(S.RegEx.valueSplit); "Color" === n[0] && (n.push(n.shift()), o.push(o.shift()), S.Hooks.templates[r] = [n.join(" "), o.join(" ")]);
  469. } for (r in S.Hooks.templates) {
  470. a = S.Hooks.templates[r], n = a[0].split(" "); for (var e in n) {
  471. var i = r + n[e],
  472. s = e; S.Hooks.registered[i] = [r, s];
  473. }
  474. }
  475. }, getRoot: function (e) {
  476. var t = S.Hooks.registered[e]; return t ? t[0] : e;
  477. }, cleanRootPropertyValue: function (e, t) {
  478. return S.RegEx.valueUnwrap.test(t) && (t = t.match(S.RegEx.valueUnwrap)[1]), S.Values.isCSSNullValue(t) && (t = S.Hooks.templates[e][1]), t;
  479. }, extractValue: function (e, t) {
  480. var r = S.Hooks.registered[e]; if (r) {
  481. var a = r[0],
  482. n = r[1]; return t = S.Hooks.cleanRootPropertyValue(a, t), t.toString().match(S.RegEx.valueSplit)[n];
  483. } return t;
  484. }, injectValue: function (e, t, r) {
  485. var a = S.Hooks.registered[e]; if (a) {
  486. var n,
  487. o,
  488. i = a[0],
  489. s = a[1]; return r = S.Hooks.cleanRootPropertyValue(i, r), n = r.toString().match(S.RegEx.valueSplit), n[s] = t, o = n.join(" ");
  490. } return r;
  491. }
  492. }, Normalizations: {
  493. registered: {
  494. clip: function (e, t, r) {
  495. switch (e) {
  496. case "name":
  497. return "clip"; case "extract":
  498. var a; return S.RegEx.wrappedValueAlreadyExtracted.test(r) ? a = r : (a = r.toString().match(S.RegEx.valueUnwrap), a = a ? a[1].replace(/,(\s+)?/g, " ") : r), a; case "inject":
  499. return "rect(" + r + ")";
  500. }
  501. }, blur: function (e, t, r) {
  502. switch (e) {
  503. case "name":
  504. return b.State.isFirefox ? "filter" : "-webkit-filter"; case "extract":
  505. var a = parseFloat(r); if (!a && 0 !== a) {
  506. var n = r.toString().match(/blur\(([0-9]+[A-z]+)\)/i); a = n ? n[1] : 0;
  507. } return a; case "inject":
  508. return parseFloat(r) ? "blur(" + r + ")" : "none";
  509. }
  510. }, opacity: function (e, t, r) {
  511. if (8 >= d) switch (e) {
  512. case "name":
  513. return "filter"; case "extract":
  514. var a = r.toString().match(/alpha\(opacity=(.*)\)/i); return r = a ? a[1] / 100 : 1; case "inject":
  515. return t.style.zoom = 1, parseFloat(r) >= 1 ? "" : "alpha(opacity=" + parseInt(100 * parseFloat(r), 10) + ")";
  516. } else switch (e) {
  517. case "name":
  518. return "opacity"; case "extract":
  519. return r; case "inject":
  520. return r;
  521. }
  522. }
  523. }, register: function () {
  524. 9 >= d || b.State.isGingerbread || (S.Lists.transformsBase = S.Lists.transformsBase.concat(S.Lists.transforms3D)); for (var e = 0; e < S.Lists.transformsBase.length; e++) {
  525. !function () {
  526. var t = S.Lists.transformsBase[e]; S.Normalizations.registered[t] = function (e, r, n) {
  527. switch (e) {
  528. case "name":
  529. return "transform"; case "extract":
  530. return i(r) === a || i(r).transformCache[t] === a ? /^scale/i.test(t) ? 1 : 0 : i(r).transformCache[t].replace(/[()]/g, ""); case "inject":
  531. var o = !1; switch (t.substr(0, t.length - 1)) {
  532. case "translate":
  533. o = !/(%|px|em|rem|vw|vh|\d)$/i.test(n); break; case "scal": case "scale":
  534. b.State.isAndroid && i(r).transformCache[t] === a && 1 > n && (n = 1), o = !/(\d)$/i.test(n); break; case "skew":
  535. o = !/(deg|\d)$/i.test(n); break; case "rotate":
  536. o = !/(deg|\d)$/i.test(n);
  537. }return o || (i(r).transformCache[t] = "(" + n + ")"), i(r).transformCache[t];
  538. }
  539. };
  540. }();
  541. } for (var e = 0; e < S.Lists.colors.length; e++) {
  542. !function () {
  543. var t = S.Lists.colors[e]; S.Normalizations.registered[t] = function (e, r, n) {
  544. switch (e) {
  545. case "name":
  546. return t; case "extract":
  547. var o; if (S.RegEx.wrappedValueAlreadyExtracted.test(n)) o = n; else {
  548. var i,
  549. s = { black: "rgb(0, 0, 0)", blue: "rgb(0, 0, 255)", gray: "rgb(128, 128, 128)", green: "rgb(0, 128, 0)", red: "rgb(255, 0, 0)", white: "rgb(255, 255, 255)" }; /^[A-z]+$/i.test(n) ? i = s[n] !== a ? s[n] : s.black : S.RegEx.isHex.test(n) ? i = "rgb(" + S.Values.hexToRgb(n).join(" ") + ")" : /^rgba?\(/i.test(n) || (i = s.black), o = (i || n).toString().match(S.RegEx.valueUnwrap)[1].replace(/,(\s+)?/g, " ");
  550. } return 8 >= d || 3 !== o.split(" ").length || (o += " 1"), o; case "inject":
  551. return 8 >= d ? 4 === n.split(" ").length && (n = n.split(/\s+/).slice(0, 3).join(" ")) : 3 === n.split(" ").length && (n += " 1"), (8 >= d ? "rgb" : "rgba") + "(" + n.replace(/\s+/g, ",").replace(/\.(\d)+(?=,)/g, "") + ")";
  552. }
  553. };
  554. }();
  555. }
  556. }
  557. }, Names: {
  558. camelCase: function (e) {
  559. return e.replace(/-(\w)/g, function (e, t) {
  560. return t.toUpperCase();
  561. });
  562. }, SVGAttribute: function (e) {
  563. var t = "width|height|x|y|cx|cy|r|rx|ry|x1|x2|y1|y2"; return (d || b.State.isAndroid && !b.State.isChrome) && (t += "|transform"), new RegExp("^(" + t + ")$", "i").test(e);
  564. }, prefixCheck: function (e) {
  565. if (b.State.prefixMatches[e]) return [b.State.prefixMatches[e], !0]; for (var t = ["", "Webkit", "Moz", "ms", "O"], r = 0, a = t.length; a > r; r++) {
  566. var n; if (n = 0 === r ? e : t[r] + e.replace(/^\w/, function (e) {
  567. return e.toUpperCase();
  568. }), m.isString(b.State.prefixElement.style[n])) return b.State.prefixMatches[e] = n, [n, !0];
  569. } return [e, !1];
  570. }
  571. }, Values: {
  572. hexToRgb: function (e) {
  573. var t,
  574. r = /^#?([a-f\d])([a-f\d])([a-f\d])$/i,
  575. a = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i; return e = e.replace(r, function (e, t, r, a) {
  576. return t + t + r + r + a + a;
  577. }), t = a.exec(e), t ? [parseInt(t[1], 16), parseInt(t[2], 16), parseInt(t[3], 16)] : [0, 0, 0];
  578. }, isCSSNullValue: function (e) {
  579. return 0 == e || /^(none|auto|transparent|(rgba\(0, ?0, ?0, ?0\)))$/i.test(e);
  580. }, getUnitType: function (e) {
  581. 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"
  582. );
  583. }, getDisplayType: function (e) {
  584. var t = e && e.tagName.toString().toLowerCase(); return (/^(b|big|i|small|tt|abbr|acronym|cite|code|dfn|em|kbd|strong|samp|var|a|bdo|br|img|map|object|q|script|span|sub|sup|button|input|label|select|textarea)$/i.test(t) ? "inline" : /^(li)$/i.test(t) ? "list-item" : /^(tr)$/i.test(t) ? "table-row" : /^(table)$/i.test(t) ? "table" : /^(tbody)$/i.test(t) ? "table-row-group" : "block"
  585. );
  586. }, addClass: function (e, t) {
  587. e.classList ? e.classList.add(t) : e.className += (e.className.length ? " " : "") + t;
  588. }, removeClass: function (e, t) {
  589. e.classList ? e.classList.remove(t) : e.className = e.className.toString().replace(new RegExp("(^|\\s)" + t.split(" ").join("|") + "(\\s|$)", "gi"), " ");
  590. }
  591. }, getPropertyValue: function (e, r, n, o) {
  592. function s(e, r) {
  593. function n() {
  594. u && S.setPropertyValue(e, "display", "none");
  595. } var l = 0; if (8 >= d) l = f.css(e, r); else {
  596. var u = !1; if (/^(width|height)$/.test(r) && 0 === S.getPropertyValue(e, "display") && (u = !0, S.setPropertyValue(e, "display", S.Values.getDisplayType(e))), !o) {
  597. if ("height" === r && "border-box" !== S.getPropertyValue(e, "boxSizing").toString().toLowerCase()) {
  598. var c = e.offsetHeight - (parseFloat(S.getPropertyValue(e, "borderTopWidth")) || 0) - (parseFloat(S.getPropertyValue(e, "borderBottomWidth")) || 0) - (parseFloat(S.getPropertyValue(e, "paddingTop")) || 0) - (parseFloat(S.getPropertyValue(e, "paddingBottom")) || 0); return n(), c;
  599. } if ("width" === r && "border-box" !== S.getPropertyValue(e, "boxSizing").toString().toLowerCase()) {
  600. var p = e.offsetWidth - (parseFloat(S.getPropertyValue(e, "borderLeftWidth")) || 0) - (parseFloat(S.getPropertyValue(e, "borderRightWidth")) || 0) - (parseFloat(S.getPropertyValue(e, "paddingLeft")) || 0) - (parseFloat(S.getPropertyValue(e, "paddingRight")) || 0); return n(), p;
  601. }
  602. } var g; g = i(e) === a ? t.getComputedStyle(e, null) : i(e).computedStyle ? i(e).computedStyle : i(e).computedStyle = t.getComputedStyle(e, null), "borderColor" === r && (r = "borderTopColor"), l = 9 === d && "filter" === r ? g.getPropertyValue(r) : g[r], ("" === l || null === l) && (l = e.style[r]), n();
  603. } if ("auto" === l && /^(top|right|bottom|left)$/i.test(r)) {
  604. var m = s(e, "position"); ("fixed" === m || "absolute" === m && /top|left/i.test(r)) && (l = f(e).position()[r] + "px");
  605. } return l;
  606. } var l; if (S.Hooks.registered[r]) {
  607. var u = r,
  608. c = S.Hooks.getRoot(u); n === a && (n = S.getPropertyValue(e, S.Names.prefixCheck(c)[0])), S.Normalizations.registered[c] && (n = S.Normalizations.registered[c]("extract", e, n)), l = S.Hooks.extractValue(u, n);
  609. } else if (S.Normalizations.registered[r]) {
  610. var p, g; p = S.Normalizations.registered[r]("name", e), "transform" !== p && (g = s(e, S.Names.prefixCheck(p)[0]), S.Values.isCSSNullValue(g) && S.Hooks.templates[r] && (g = S.Hooks.templates[r][1])), l = S.Normalizations.registered[r]("extract", e, g);
  611. } if (!/^[\d-]/.test(l)) if (i(e) && i(e).isSVG && S.Names.SVGAttribute(r)) {
  612. if (/^(height|width)$/i.test(r)) try {
  613. l = e.getBBox()[r];
  614. } catch (m) {
  615. l = 0;
  616. } else l = e.getAttribute(r);
  617. } else l = s(e, S.Names.prefixCheck(r)[0]); return S.Values.isCSSNullValue(l) && (l = 0), b.debug >= 2 && console.log("Get " + r + ": " + l), l;
  618. }, setPropertyValue: function (e, r, a, n, o) {
  619. var s = r; if ("scroll" === r) o.container ? o.container["scroll" + o.direction] = a : "Left" === o.direction ? t.scrollTo(a, o.alternateValue) : t.scrollTo(o.alternateValue, a); else if (S.Normalizations.registered[r] && "transform" === S.Normalizations.registered[r]("name", e)) S.Normalizations.registered[r]("inject", e, a), s = "transform", a = i(e).transformCache[r]; else {
  620. if (S.Hooks.registered[r]) {
  621. var l = r,
  622. u = S.Hooks.getRoot(r); n = n || S.getPropertyValue(e, u), a = S.Hooks.injectValue(l, a, n), r = u;
  623. } if (S.Normalizations.registered[r] && (a = S.Normalizations.registered[r]("inject", e, a), r = S.Normalizations.registered[r]("name", e)), s = S.Names.prefixCheck(r)[0], 8 >= d) try {
  624. e.style[s] = a;
  625. } catch (c) {
  626. b.debug && console.log("Browser does not support [" + a + "] for [" + s + "]");
  627. } else i(e) && i(e).isSVG && S.Names.SVGAttribute(r) ? e.setAttribute(r, a) : e.style[s] = a; b.debug >= 2 && console.log("Set " + r + " (" + s + "): " + a);
  628. } return [s, a];
  629. }, flushTransformCache: function (e) {
  630. function t(t) {
  631. return parseFloat(S.getPropertyValue(e, t));
  632. } var r = ""; if ((d || b.State.isAndroid && !b.State.isChrome) && i(e).isSVG) {
  633. var a = { translate: [t("translateX"), t("translateY")], skewX: [t("skewX")], skewY: [t("skewY")], scale: 1 !== t("scale") ? [t("scale"), t("scale")] : [t("scaleX"), t("scaleY")], rotate: [t("rotateZ"), 0, 0] }; f.each(i(e).transformCache, function (e) {
  634. /^translate/i.test(e) ? e = "translate" : /^scale/i.test(e) ? e = "scale" : /^rotate/i.test(e) && (e = "rotate"), a[e] && (r += e + "(" + a[e].join(" ") + ") ", delete a[e]);
  635. });
  636. } else {
  637. var n, o; f.each(i(e).transformCache, function (t) {
  638. return n = i(e).transformCache[t], "transformPerspective" === t ? (o = n, !0) : (9 === d && "rotateZ" === t && (t = "rotate"), void (r += t + n + " "));
  639. }), o && (r = "perspective" + o + " " + r);
  640. } S.setPropertyValue(e, "transform", r);
  641. }
  642. }; S.Hooks.register(), S.Normalizations.register(), b.hook = function (e, t, r) {
  643. var n = a; return e = o(e), f.each(e, function (e, o) {
  644. if (i(o) === a && b.init(o), r === a) n === a && (n = b.CSS.getPropertyValue(o, t)); else {
  645. var s = b.CSS.setPropertyValue(o, t, r); "transform" === s[0] && b.CSS.flushTransformCache(o), n = s;
  646. }
  647. }), n;
  648. }; var P = function () {
  649. function e() {
  650. return s ? k.promise || null : l;
  651. } function n() {
  652. function e(e) {
  653. function p(e, t) {
  654. var r = a,
  655. n = a,
  656. i = a; return m.isArray(e) ? (r = e[0], !m.isArray(e[1]) && /^[\d-]/.test(e[1]) || m.isFunction(e[1]) || S.RegEx.isHex.test(e[1]) ? i = e[1] : (m.isString(e[1]) && !S.RegEx.isHex.test(e[1]) || m.isArray(e[1])) && (n = t ? e[1] : u(e[1], s.duration), e[2] !== a && (i = e[2]))) : r = e, t || (n = n || s.easing), m.isFunction(r) && (r = r.call(o, V, w)), m.isFunction(i) && (i = i.call(o, V, w)), [r || 0, n, i];
  657. } function d(e, t) {
  658. var r, a; return a = (t || "0").toString().toLowerCase().replace(/[%A-z]+$/, function (e) {
  659. return r = e, "";
  660. }), r || (r = S.Values.getUnitType(e)), [a, r];
  661. } function h() {
  662. var e = { myParent: o.parentNode || r.body, position: S.getPropertyValue(o, "position"), fontSize: S.getPropertyValue(o, "fontSize") },
  663. a = e.position === L.lastPosition && e.myParent === L.lastParent,
  664. n = e.fontSize === L.lastFontSize; L.lastParent = e.myParent, L.lastPosition = e.position, L.lastFontSize = e.fontSize; var s = 100,
  665. l = {}; if (n && a) l.emToPx = L.lastEmToPx, l.percentToPxWidth = L.lastPercentToPxWidth, l.percentToPxHeight = L.lastPercentToPxHeight; else {
  666. var u = i(o).isSVG ? r.createElementNS("http://www.w3.org/2000/svg", "rect") : r.createElement("div"); b.init(u), e.myParent.appendChild(u), f.each(["overflow", "overflowX", "overflowY"], function (e, t) {
  667. b.CSS.setPropertyValue(u, t, "hidden");
  668. }), b.CSS.setPropertyValue(u, "position", e.position), b.CSS.setPropertyValue(u, "fontSize", e.fontSize), b.CSS.setPropertyValue(u, "boxSizing", "content-box"), f.each(["minWidth", "maxWidth", "width", "minHeight", "maxHeight", "height"], function (e, t) {
  669. b.CSS.setPropertyValue(u, t, s + "%");
  670. }), b.CSS.setPropertyValue(u, "paddingLeft", s + "em"), l.percentToPxWidth = L.lastPercentToPxWidth = (parseFloat(S.getPropertyValue(u, "width", null, !0)) || 1) / s, l.percentToPxHeight = L.lastPercentToPxHeight = (parseFloat(S.getPropertyValue(u, "height", null, !0)) || 1) / s, l.emToPx = L.lastEmToPx = (parseFloat(S.getPropertyValue(u, "paddingLeft")) || 1) / s, e.myParent.removeChild(u);
  671. } return null === L.remToPx && (L.remToPx = parseFloat(S.getPropertyValue(r.body, "fontSize")) || 16), null === L.vwToPx && (L.vwToPx = parseFloat(t.innerWidth) / 100, L.vhToPx = parseFloat(t.innerHeight) / 100), l.remToPx = L.remToPx, l.vwToPx = L.vwToPx, l.vhToPx = L.vhToPx, b.debug >= 1 && console.log("Unit ratios: " + JSON.stringify(l), o), l;
  672. } if (s.begin && 0 === V) try {
  673. s.begin.call(g, g);
  674. } catch (x) {
  675. setTimeout(function () {
  676. throw x;
  677. }, 1);
  678. } if ("scroll" === A) {
  679. var P,
  680. C,
  681. T,
  682. F = /^x$/i.test(s.axis) ? "Left" : "Top",
  683. j = parseFloat(s.offset) || 0; s.container ? m.isWrapped(s.container) || m.isNode(s.container) ? (s.container = s.container[0] || s.container, P = s.container["scroll" + F], T = P + f(o).position()[F.toLowerCase()] + j) : s.container = null : (P = b.State.scrollAnchor[b.State["scrollProperty" + F]], C = b.State.scrollAnchor[b.State["scrollProperty" + ("Left" === F ? "Top" : "Left")]], T = f(o).offset()[F.toLowerCase()] + j), l = { scroll: { rootPropertyValue: !1, startValue: P, currentValue: P, endValue: T, unitType: "", easing: s.easing, scrollData: { container: s.container, direction: F, alternateValue: C } }, element: o }, b.debug && console.log("tweensContainer (scroll): ", l.scroll, o);
  684. } else if ("reverse" === A) {
  685. if (!i(o).tweensContainer) return void f.dequeue(o, s.queue); "none" === i(o).opts.display && (i(o).opts.display = "auto"), "hidden" === i(o).opts.visibility && (i(o).opts.visibility = "visible"), i(o).opts.loop = !1, i(o).opts.begin = null, i(o).opts.complete = null, v.easing || delete s.easing, v.duration || delete s.duration, s = f.extend({}, i(o).opts, s); var E = f.extend(!0, {}, i(o).tweensContainer); for (var H in E) {
  686. if ("element" !== H) {
  687. var N = E[H].startValue; E[H].startValue = E[H].currentValue = E[H].endValue, E[H].endValue = N, m.isEmptyObject(v) || (E[H].easing = s.easing), b.debug && console.log("reverse tweensContainer (" + H + "): " + JSON.stringify(E[H]), o);
  688. }
  689. } l = E;
  690. } else if ("start" === A) {
  691. var E; i(o).tweensContainer && i(o).isAnimating === !0 && (E = i(o).tweensContainer), f.each(y, function (e, t) {
  692. if (RegExp("^" + S.Lists.colors.join("$|^") + "$").test(e)) {
  693. var r = p(t, !0),
  694. n = r[0],
  695. o = r[1],
  696. i = r[2]; if (S.RegEx.isHex.test(n)) {
  697. for (var s = ["Red", "Green", "Blue"], l = S.Values.hexToRgb(n), u = i ? S.Values.hexToRgb(i) : a, c = 0; c < s.length; c++) {
  698. var f = [l[c]]; o && f.push(o), u !== a && f.push(u[c]), y[e + s[c]] = f;
  699. } delete y[e];
  700. }
  701. }
  702. }); for (var z in y) {
  703. var O = p(y[z]),
  704. q = O[0],
  705. $ = O[1],
  706. M = O[2]; z = S.Names.camelCase(z); var I = S.Hooks.getRoot(z),
  707. B = !1; if (i(o).isSVG || "tween" === I || S.Names.prefixCheck(I)[1] !== !1 || S.Normalizations.registered[I] !== a) {
  708. (s.display !== a && null !== s.display && "none" !== s.display || s.visibility !== a && "hidden" !== s.visibility) && /opacity|filter/.test(z) && !M && 0 !== q && (M = 0), s._cacheValues && E && E[z] ? (M === a && (M = E[z].endValue + E[z].unitType), B = i(o).rootPropertyValueCache[I]) : S.Hooks.registered[z] ? M === a ? (B = S.getPropertyValue(o, I), M = S.getPropertyValue(o, z, B)) : B = S.Hooks.templates[I][1] : M === a && (M = S.getPropertyValue(o, z)); var W,
  709. G,
  710. Y,
  711. D = !1; if (W = d(z, M), M = W[0], Y = W[1], W = d(z, q), q = W[0].replace(/^([+-\/*])=/, function (e, t) {
  712. return D = t, "";
  713. }), G = W[1], M = parseFloat(M) || 0, q = parseFloat(q) || 0, "%" === G && (/^(fontSize|lineHeight)$/.test(z) ? (q /= 100, G = "em") : /^scale/.test(z) ? (q /= 100, G = "") : /(Red|Green|Blue)$/i.test(z) && (q = q / 100 * 255, G = "")), /[\/*]/.test(D)) G = Y; else if (Y !== G && 0 !== M) if (0 === q) G = Y; else {
  714. n = n || h(); var Q = /margin|padding|left|right|width|text|word|letter/i.test(z) || /X$/.test(z) || "x" === z ? "x" : "y"; switch (Y) {
  715. case "%":
  716. M *= "x" === Q ? n.percentToPxWidth : n.percentToPxHeight; break; case "px":
  717. break; default:
  718. M *= n[Y + "ToPx"];
  719. }switch (G) {
  720. case "%":
  721. M *= 1 / ("x" === Q ? n.percentToPxWidth : n.percentToPxHeight); break; case "px":
  722. break; default:
  723. M *= 1 / n[G + "ToPx"];
  724. }
  725. } switch (D) {
  726. case "+":
  727. q = M + q; break; case "-":
  728. q = M - q; break; case "*":
  729. q = M * q; break; case "/":
  730. q = M / q;
  731. }l[z] = { rootPropertyValue: B, startValue: M, currentValue: M, endValue: q, unitType: G, easing: $ }, b.debug && console.log("tweensContainer (" + z + "): " + JSON.stringify(l[z]), o);
  732. } else b.debug && console.log("Skipping [" + I + "] due to a lack of browser support.");
  733. } l.element = o;
  734. } l.element && (S.Values.addClass(o, "velocity-animating"), R.push(l), "" === s.queue && (i(o).tweensContainer = l, i(o).opts = s), i(o).isAnimating = !0, V === w - 1 ? (b.State.calls.push([R, g, s, null, k.resolver]), b.State.isTicking === !1 && (b.State.isTicking = !0, c())) : V++);
  735. } var n,
  736. o = this,
  737. s = f.extend({}, b.defaults, v),
  738. l = {}; switch (i(o) === a && b.init(o), parseFloat(s.delay) && s.queue !== !1 && f.queue(o, s.queue, function (e) {
  739. b.velocityQueueEntryFlag = !0, i(o).delayTimer = { setTimeout: setTimeout(e, parseFloat(s.delay)), next: e };
  740. }), s.duration.toString().toLowerCase()) {
  741. case "fast":
  742. s.duration = 200; break; case "normal":
  743. s.duration = h; break; case "slow":
  744. s.duration = 600; break; default:
  745. s.duration = parseFloat(s.duration) || 1;
  746. }b.mock !== !1 && (b.mock === !0 ? s.duration = s.delay = 1 : (s.duration *= parseFloat(b.mock) || 1, s.delay *= parseFloat(b.mock) || 1)), s.easing = u(s.easing, s.duration), s.begin && !m.isFunction(s.begin) && (s.begin = null), s.progress && !m.isFunction(s.progress) && (s.progress = null), s.complete && !m.isFunction(s.complete) && (s.complete = null), s.display !== a && null !== s.display && (s.display = s.display.toString().toLowerCase(), "auto" === s.display && (s.display = b.CSS.Values.getDisplayType(o))), s.visibility !== a && null !== s.visibility && (s.visibility = s.visibility.toString().toLowerCase()), s.mobileHA = s.mobileHA && b.State.isMobile && !b.State.isGingerbread, s.queue === !1 ? s.delay ? setTimeout(e, s.delay) : e() : f.queue(o, s.queue, function (t, r) {
  747. return r === !0 ? (k.promise && k.resolver(g), !0) : (b.velocityQueueEntryFlag = !0, void e(t));
  748. }), "" !== s.queue && "fx" !== s.queue || "inprogress" === f.queue(o)[0] || f.dequeue(o);
  749. } var s,
  750. l,
  751. d,
  752. g,
  753. y,
  754. v,
  755. x = arguments[0] && (arguments[0].p || f.isPlainObject(arguments[0].properties) && !arguments[0].properties.names || m.isString(arguments[0].properties)); if (m.isWrapped(this) ? (s = !1, d = 0, g = this, l = this) : (s = !0, d = 1, g = x ? arguments[0].elements || arguments[0].e : arguments[0]), g = o(g)) {
  756. x ? (y = arguments[0].properties || arguments[0].p, v = arguments[0].options || arguments[0].o) : (y = arguments[d], v = arguments[d + 1]); var w = g.length,
  757. V = 0; if (!/^(stop|finish)$/i.test(y) && !f.isPlainObject(v)) {
  758. var C = d + 1; v = {}; for (var T = C; T < arguments.length; T++) {
  759. 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];
  760. }
  761. } var k = { promise: null, resolver: null, rejecter: null }; s && b.Promise && (k.promise = new b.Promise(function (e, t) {
  762. k.resolver = e, k.rejecter = t;
  763. })); var A; switch (y) {
  764. case "scroll":
  765. A = "scroll"; break; case "reverse":
  766. A = "reverse"; break; case "finish": case "stop":
  767. f.each(g, function (e, t) {
  768. i(t) && i(t).delayTimer && (clearTimeout(i(t).delayTimer.setTimeout), i(t).delayTimer.next && i(t).delayTimer.next(), delete i(t).delayTimer);
  769. }); var F = []; return f.each(b.State.calls, function (e, t) {
  770. t && f.each(t[1], function (r, n) {
  771. var o = v === a ? "" : v; return o === !0 || t[2].queue === o || v === a && t[2].queue === !1 ? void f.each(g, function (r, a) {
  772. a === n && ((v === !0 || m.isString(v)) && (f.each(f.queue(a, m.isString(v) ? v : ""), function (e, t) {
  773. m.isFunction(t) && t(null, !0);
  774. }), f.queue(a, m.isString(v) ? v : "", [])), "stop" === y ? (i(a) && i(a).tweensContainer && o !== !1 && f.each(i(a).tweensContainer, function (e, t) {
  775. t.endValue = t.currentValue;
  776. }), F.push(e)) : "finish" === y && (t[2].duration = 1));
  777. }) : !0;
  778. });
  779. }), "stop" === y && (f.each(F, function (e, t) {
  780. p(t, !0);
  781. }), k.promise && k.resolver(g)), e(); default:
  782. if (!f.isPlainObject(y) || m.isEmptyObject(y)) {
  783. if (m.isString(y) && b.Redirects[y]) {
  784. var j = f.extend({}, v),
  785. E = j.duration,
  786. H = j.delay || 0; return j.backwards === !0 && (g = f.extend(!0, [], g).reverse()), f.each(g, function (e, t) {
  787. parseFloat(j.stagger) ? j.delay = H + parseFloat(j.stagger) * e : m.isFunction(j.stagger) && (j.delay = H + j.stagger.call(t, e, w)), j.drag && (j.duration = parseFloat(E) || (/^(callout|transition)/.test(y) ? 1e3 : h), j.duration = Math.max(j.duration * (j.backwards ? 1 - e / w : (e + 1) / w), .75 * j.duration, 200)), b.Redirects[y].call(t, t, j || {}, e, w, g, k.promise ? k : a);
  788. }), e();
  789. } var N = "Velocity: First argument (" + y + ") was not a property map, a known action, or a registered redirect. Aborting."; return k.promise ? k.rejecter(new Error(N)) : console.log(N), e();
  790. } A = "start";
  791. }var L = { lastParent: null, lastPosition: null, lastFontSize: null, lastPercentToPxWidth: null, lastPercentToPxHeight: null, lastEmToPx: null, remToPx: null, vwToPx: null, vhToPx: null },
  792. R = []; f.each(g, function (e, t) {
  793. m.isNode(t) && n.call(t);
  794. }); var z,
  795. j = f.extend({}, b.defaults, v); if (j.loop = parseInt(j.loop), z = 2 * j.loop - 1, j.loop) for (var O = 0; z > O; O++) {
  796. var q = { delay: j.delay, progress: j.progress }; O === z - 1 && (q.display = j.display, q.visibility = j.visibility, q.complete = j.complete), P(g, "reverse", q);
  797. } return e();
  798. }
  799. }; b = f.extend(P, b), b.animate = P; var w = t.requestAnimationFrame || g; return b.State.isMobile || r.hidden === a || r.addEventListener("visibilitychange", function () {
  800. r.hidden ? (w = function (e) {
  801. return setTimeout(function () {
  802. e(!0);
  803. }, 16);
  804. }, c()) : w = t.requestAnimationFrame || g;
  805. }), e.Velocity = b, e !== t && (e.fn.velocity = P, e.fn.velocity.defaults = b.defaults), f.each(["Down", "Up"], function (e, t) {
  806. b.Redirects["slide" + t] = function (e, r, n, o, i, s) {
  807. var l = f.extend({}, r),
  808. u = l.begin,
  809. c = l.complete,
  810. p = { height: "", marginTop: "", marginBottom: "", paddingTop: "", paddingBottom: "" },
  811. d = {}; l.display === a && (l.display = "Down" === t ? "inline" === b.CSS.Values.getDisplayType(e) ? "inline-block" : "block" : "none"), l.begin = function () {
  812. u && u.call(i, i); for (var r in p) {
  813. d[r] = e.style[r]; var a = b.CSS.getPropertyValue(e, r); p[r] = "Down" === t ? [a, 0] : [0, a];
  814. } d.overflow = e.style.overflow, e.style.overflow = "hidden";
  815. }, l.complete = function () {
  816. for (var t in d) {
  817. e.style[t] = d[t];
  818. } c && c.call(i, i), s && s.resolver(i);
  819. }, b(e, p, l);
  820. };
  821. }), f.each(["In", "Out"], function (e, t) {
  822. b.Redirects["fade" + t] = function (e, r, n, o, i, s) {
  823. var l = f.extend({}, r),
  824. u = { opacity: "In" === t ? 1 : 0 },
  825. c = l.complete; l.complete = n !== o - 1 ? l.begin = null : function () {
  826. c && c.call(i, i), s && s.resolver(i);
  827. }, l.display === a && (l.display = "In" === t ? "auto" : "none"), b(this, u, l);
  828. };
  829. }), b;
  830. }(window.jQuery || window.Zepto || window, window, document);
  831. }));
  832. ; !function (a, b, c, d) {
  833. "use strict";
  834. function k(a, b, c) {
  835. return setTimeout(q(a, c), b);
  836. } function l(a, b, c) {
  837. return Array.isArray(a) ? (m(a, c[b], c), !0) : !1;
  838. } function m(a, b, c) {
  839. var e; if (a) if (a.forEach) a.forEach(b, c); else if (a.length !== d) for (e = 0; e < a.length;) {
  840. b.call(c, a[e], e, a), e++;
  841. } else for (e in a) {
  842. a.hasOwnProperty(e) && b.call(c, a[e], e, a);
  843. }
  844. } function n(a, b, c) {
  845. for (var e = Object.keys(b), f = 0; f < e.length;) {
  846. (!c || c && a[e[f]] === d) && (a[e[f]] = b[e[f]]), f++;
  847. } return a;
  848. } function o(a, b) {
  849. return n(a, b, !0);
  850. } function p(a, b, c) {
  851. var e,
  852. d = b.prototype; e = a.prototype = Object.create(d), e.constructor = a, e._super = d, c && n(e, c);
  853. } function q(a, b) {
  854. return function () {
  855. return a.apply(b, arguments);
  856. };
  857. } function r(a, b) {
  858. return typeof a == g ? a.apply(b ? b[0] || d : d, b) : a;
  859. } function s(a, b) {
  860. return a === d ? b : a;
  861. } function t(a, b, c) {
  862. m(x(b), function (b) {
  863. a.addEventListener(b, c, !1);
  864. });
  865. } function u(a, b, c) {
  866. m(x(b), function (b) {
  867. a.removeEventListener(b, c, !1);
  868. });
  869. } function v(a, b) {
  870. for (; a;) {
  871. if (a == b) return !0; a = a.parentNode;
  872. } return !1;
  873. } function w(a, b) {
  874. return a.indexOf(b) > -1;
  875. } function x(a) {
  876. return a.trim().split(/\s+/g);
  877. } function y(a, b, c) {
  878. if (a.indexOf && !c) return a.indexOf(b); for (var d = 0; d < a.length;) {
  879. if (c && a[d][c] == b || !c && a[d] === b) return d; d++;
  880. } return -1;
  881. } function z(a) {
  882. return Array.prototype.slice.call(a, 0);
  883. } function A(a, b, c) {
  884. for (var d = [], e = [], f = 0; f < a.length;) {
  885. var g = b ? a[f][b] : a[f]; y(e, g) < 0 && d.push(a[f]), e[f] = g, f++;
  886. } return c && (d = b ? d.sort(function (a, c) {
  887. return a[b] > c[b];
  888. }) : d.sort()), d;
  889. } function B(a, b) {
  890. for (var c, f, g = b[0].toUpperCase() + b.slice(1), h = 0; h < e.length;) {
  891. if (c = e[h], f = c ? c + g : b, f in a) return f; h++;
  892. } return d;
  893. } function D() {
  894. return C++;
  895. } function E(a) {
  896. var b = a.ownerDocument; return b.defaultView || b.parentWindow;
  897. } function ab(a, b) {
  898. var c = this; this.manager = a, this.callback = b, this.element = a.element, this.target = a.options.inputTarget, this.domHandler = function (b) {
  899. r(a.options.enable, [a]) && c.handler(b);
  900. }, this.init();
  901. } function bb(a) {
  902. var b,
  903. c = a.options.inputClass; return b = c ? c : H ? wb : I ? Eb : G ? Gb : rb, new b(a, cb);
  904. } function cb(a, b, c) {
  905. var d = c.pointers.length,
  906. e = c.changedPointers.length,
  907. f = b & O && 0 === d - e,
  908. g = b & (Q | R) && 0 === d - e; c.isFirst = !!f, c.isFinal = !!g, f && (a.session = {}), c.eventType = b, db(a, c), a.emit("hammer.input", c), a.recognize(c), a.session.prevInput = c;
  909. } function db(a, b) {
  910. var c = a.session,
  911. d = b.pointers,
  912. e = d.length; c.firstInput || (c.firstInput = gb(b)), e > 1 && !c.firstMultiple ? c.firstMultiple = gb(b) : 1 === e && (c.firstMultiple = !1); var f = c.firstInput,
  913. g = c.firstMultiple,
  914. h = g ? g.center : f.center,
  915. i = b.center = hb(d); b.timeStamp = j(), b.deltaTime = b.timeStamp - f.timeStamp, b.angle = lb(h, i), b.distance = kb(h, i), eb(c, b), b.offsetDirection = jb(b.deltaX, b.deltaY), b.scale = g ? nb(g.pointers, d) : 1, b.rotation = g ? mb(g.pointers, d) : 0, fb(c, b); var k = a.element; v(b.srcEvent.target, k) && (k = b.srcEvent.target), b.target = k;
  916. } function eb(a, b) {
  917. var c = b.center,
  918. d = a.offsetDelta || {},
  919. e = a.prevDelta || {},
  920. f = a.prevInput || {}; (b.eventType === O || f.eventType === Q) && (e = a.prevDelta = { x: f.deltaX || 0, y: f.deltaY || 0 }, d = a.offsetDelta = { x: c.x, y: c.y }), b.deltaX = e.x + (c.x - d.x), b.deltaY = e.y + (c.y - d.y);
  921. } function fb(a, b) {
  922. var f,
  923. g,
  924. h,
  925. j,
  926. c = a.lastInterval || b,
  927. e = b.timeStamp - c.timeStamp; if (b.eventType != R && (e > N || c.velocity === d)) {
  928. var k = c.deltaX - b.deltaX,
  929. l = c.deltaY - b.deltaY,
  930. m = ib(e, k, l); g = m.x, h = m.y, f = i(m.x) > i(m.y) ? m.x : m.y, j = jb(k, l), a.lastInterval = b;
  931. } else f = c.velocity, g = c.velocityX, h = c.velocityY, j = c.direction; b.velocity = f, b.velocityX = g, b.velocityY = h, b.direction = j;
  932. } function gb(a) {
  933. for (var b = [], c = 0; c < a.pointers.length;) {
  934. b[c] = { clientX: h(a.pointers[c].clientX), clientY: h(a.pointers[c].clientY) }, c++;
  935. } return { timeStamp: j(), pointers: b, center: hb(b), deltaX: a.deltaX, deltaY: a.deltaY };
  936. } function hb(a) {
  937. var b = a.length; if (1 === b) return { x: h(a[0].clientX), y: h(a[0].clientY) }; for (var c = 0, d = 0, e = 0; b > e;) {
  938. c += a[e].clientX, d += a[e].clientY, e++;
  939. } return { x: h(c / b), y: h(d / b) };
  940. } function ib(a, b, c) {
  941. return { x: b / a || 0, y: c / a || 0 };
  942. } function jb(a, b) {
  943. return a === b ? S : i(a) >= i(b) ? a > 0 ? T : U : b > 0 ? V : W;
  944. } function kb(a, b, c) {
  945. c || (c = $); var d = b[c[0]] - a[c[0]],
  946. e = b[c[1]] - a[c[1]]; return Math.sqrt(d * d + e * e);
  947. } function lb(a, b, c) {
  948. c || (c = $); var d = b[c[0]] - a[c[0]],
  949. e = b[c[1]] - a[c[1]]; return 180 * Math.atan2(e, d) / Math.PI;
  950. } function mb(a, b) {
  951. return lb(b[1], b[0], _) - lb(a[1], a[0], _);
  952. } function nb(a, b) {
  953. return kb(b[0], b[1], _) / kb(a[0], a[1], _);
  954. } function rb() {
  955. this.evEl = pb, this.evWin = qb, this.allow = !0, this.pressed = !1, ab.apply(this, arguments);
  956. } function wb() {
  957. this.evEl = ub, this.evWin = vb, ab.apply(this, arguments), this.store = this.manager.session.pointerEvents = [];
  958. } function Ab() {
  959. this.evTarget = yb, this.evWin = zb, this.started = !1, ab.apply(this, arguments);
  960. } function Bb(a, b) {
  961. var c = z(a.touches),
  962. d = z(a.changedTouches); return b & (Q | R) && (c = A(c.concat(d), "identifier", !0)), [c, d];
  963. } function Eb() {
  964. this.evTarget = Db, this.targetIds = {}, ab.apply(this, arguments);
  965. } function Fb(a, b) {
  966. var c = z(a.touches),
  967. d = this.targetIds; if (b & (O | P) && 1 === c.length) return d[c[0].identifier] = !0, [c, c]; var e,
  968. f,
  969. g = z(a.changedTouches),
  970. h = [],
  971. i = this.target; if (f = c.filter(function (a) {
  972. return v(a.target, i);
  973. }), b === O) for (e = 0; e < f.length;) {
  974. d[f[e].identifier] = !0, e++;
  975. } for (e = 0; e < g.length;) {
  976. d[g[e].identifier] && h.push(g[e]), b & (Q | R) && delete d[g[e].identifier], e++;
  977. } return h.length ? [A(f.concat(h), "identifier", !0), h] : void 0;
  978. } function Gb() {
  979. ab.apply(this, arguments); var a = q(this.handler, this); this.touch = new Eb(this.manager, a), this.mouse = new rb(this.manager, a);
  980. } function Pb(a, b) {
  981. this.manager = a, this.set(b);
  982. } function Qb(a) {
  983. if (w(a, Mb)) return Mb; var b = w(a, Nb),
  984. c = w(a, Ob); return b && c ? Nb + " " + Ob : b || c ? b ? Nb : Ob : w(a, Lb) ? Lb : Kb;
  985. } function Yb(a) {
  986. this.id = D(), this.manager = null, this.options = o(a || {}, this.defaults), this.options.enable = s(this.options.enable, !0), this.state = Rb, this.simultaneous = {}, this.requireFail = [];
  987. } function Zb(a) {
  988. return a & Wb ? "cancel" : a & Ub ? "end" : a & Tb ? "move" : a & Sb ? "start" : "";
  989. } function $b(a) {
  990. return a == W ? "down" : a == V ? "up" : a == T ? "left" : a == U ? "right" : "";
  991. } function _b(a, b) {
  992. var c = b.manager; return c ? c.get(a) : a;
  993. } function ac() {
  994. Yb.apply(this, arguments);
  995. } function bc() {
  996. ac.apply(this, arguments), this.pX = null, this.pY = null;
  997. } function cc() {
  998. ac.apply(this, arguments);
  999. } function dc() {
  1000. Yb.apply(this, arguments), this._timer = null, this._input = null;
  1001. } function ec() {
  1002. ac.apply(this, arguments);
  1003. } function fc() {
  1004. ac.apply(this, arguments);
  1005. } function gc() {
  1006. Yb.apply(this, arguments), this.pTime = !1, this.pCenter = !1, this._timer = null, this._input = null, this.count = 0;
  1007. } function hc(a, b) {
  1008. return b = b || {}, b.recognizers = s(b.recognizers, hc.defaults.preset), new kc(a, b);
  1009. } function kc(a, b) {
  1010. b = b || {}, this.options = o(b, hc.defaults), this.options.inputTarget = this.options.inputTarget || a, this.handlers = {}, this.session = {}, this.recognizers = [], this.element = a, this.input = bb(this), this.touchAction = new Pb(this, this.options.touchAction), lc(this, !0), m(b.recognizers, function (a) {
  1011. var b = this.add(new a[0](a[1])); a[2] && b.recognizeWith(a[2]), a[3] && b.requireFailure(a[3]);
  1012. }, this);
  1013. } function lc(a, b) {
  1014. var c = a.element; m(a.options.cssProps, function (a, d) {
  1015. c.style[B(c.style, d)] = b ? a : "";
  1016. });
  1017. } function mc(a, c) {
  1018. var d = b.createEvent("Event"); d.initEvent(a, !0, !0), d.gesture = c, c.target.dispatchEvent(d);
  1019. } var e = ["", "webkit", "moz", "MS", "ms", "o"],
  1020. f = b.createElement("div"),
  1021. g = "function",
  1022. h = Math.round,
  1023. i = Math.abs,
  1024. j = Date.now,
  1025. C = 1,
  1026. F = /mobile|tablet|ip(ad|hone|od)|android/i,
  1027. G = "ontouchstart" in a,
  1028. H = B(a, "PointerEvent") !== d,
  1029. I = G && F.test(navigator.userAgent),
  1030. J = "touch",
  1031. K = "pen",
  1032. L = "mouse",
  1033. M = "kinect",
  1034. N = 25,
  1035. O = 1,
  1036. P = 2,
  1037. Q = 4,
  1038. R = 8,
  1039. S = 1,
  1040. T = 2,
  1041. U = 4,
  1042. V = 8,
  1043. W = 16,
  1044. X = T | U,
  1045. Y = V | W,
  1046. Z = X | Y,
  1047. $ = ["x", "y"],
  1048. _ = ["clientX", "clientY"]; ab.prototype = {
  1049. handler: function () { }, init: function () {
  1050. this.evEl && t(this.element, this.evEl, this.domHandler), this.evTarget && t(this.target, this.evTarget, this.domHandler), this.evWin && t(E(this.element), this.evWin, this.domHandler);
  1051. }, destroy: function () {
  1052. this.evEl && u(this.element, this.evEl, this.domHandler), this.evTarget && u(this.target, this.evTarget, this.domHandler), this.evWin && u(E(this.element), this.evWin, this.domHandler);
  1053. }
  1054. }; var ob = { mousedown: O, mousemove: P, mouseup: Q },
  1055. pb = "mousedown",
  1056. qb = "mousemove mouseup"; p(rb, ab, {
  1057. handler: function (a) {
  1058. var b = ob[a.type]; b & O && 0 === a.button && (this.pressed = !0), b & P && 1 !== a.which && (b = Q), this.pressed && this.allow && (b & Q && (this.pressed = !1), this.callback(this.manager, b, { pointers: [a], changedPointers: [a], pointerType: L, srcEvent: a }));
  1059. }
  1060. }); var sb = { pointerdown: O, pointermove: P, pointerup: Q, pointercancel: R, pointerout: R },
  1061. tb = { 2: J, 3: K, 4: L, 5: M },
  1062. ub = "pointerdown",
  1063. vb = "pointermove pointerup pointercancel"; a.MSPointerEvent && (ub = "MSPointerDown", vb = "MSPointerMove MSPointerUp MSPointerCancel"), p(wb, ab, {
  1064. handler: function (a) {
  1065. var b = this.store,
  1066. c = !1,
  1067. d = a.type.toLowerCase().replace("ms", ""),
  1068. e = sb[d],
  1069. f = tb[a.pointerType] || a.pointerType,
  1070. g = f == J,
  1071. h = y(b, a.pointerId, "pointerId"); e & O && (0 === a.button || g) ? 0 > h && (b.push(a), h = b.length - 1) : e & (Q | R) && (c = !0), 0 > h || (b[h] = a, this.callback(this.manager, e, { pointers: b, changedPointers: [a], pointerType: f, srcEvent: a }), c && b.splice(h, 1));
  1072. }
  1073. }); var xb = { touchstart: O, touchmove: P, touchend: Q, touchcancel: R },
  1074. yb = "touchstart",
  1075. zb = "touchstart touchmove touchend touchcancel"; p(Ab, ab, {
  1076. handler: function (a) {
  1077. var b = xb[a.type]; if (b === O && (this.started = !0), this.started) {
  1078. var c = Bb.call(this, a, b); b & (Q | R) && 0 === c[0].length - c[1].length && (this.started = !1), this.callback(this.manager, b, { pointers: c[0], changedPointers: c[1], pointerType: J, srcEvent: a });
  1079. }
  1080. }
  1081. }); var Cb = { touchstart: O, touchmove: P, touchend: Q, touchcancel: R },
  1082. Db = "touchstart touchmove touchend touchcancel"; p(Eb, ab, {
  1083. handler: function (a) {
  1084. var b = Cb[a.type],
  1085. c = Fb.call(this, a, b); c && this.callback(this.manager, b, { pointers: c[0], changedPointers: c[1], pointerType: J, srcEvent: a });
  1086. }
  1087. }), p(Gb, ab, {
  1088. handler: function (a, b, c) {
  1089. var d = c.pointerType == J,
  1090. e = c.pointerType == L; if (d) this.mouse.allow = !1; else if (e && !this.mouse.allow) return; b & (Q | R) && (this.mouse.allow = !0), this.callback(a, b, c);
  1091. }, destroy: function () {
  1092. this.touch.destroy(), this.mouse.destroy();
  1093. }
  1094. }); var Hb = B(f.style, "touchAction"),
  1095. Ib = Hb !== d,
  1096. Jb = "compute",
  1097. Kb = "auto",
  1098. Lb = "manipulation",
  1099. Mb = "none",
  1100. Nb = "pan-x",
  1101. Ob = "pan-y"; Pb.prototype = {
  1102. set: function (a) {
  1103. a == Jb && (a = this.compute()), Ib && (this.manager.element.style[Hb] = a), this.actions = a.toLowerCase().trim();
  1104. }, update: function () {
  1105. this.set(this.manager.options.touchAction);
  1106. }, compute: function () {
  1107. var a = []; return m(this.manager.recognizers, function (b) {
  1108. r(b.options.enable, [b]) && (a = a.concat(b.getTouchAction()));
  1109. }), Qb(a.join(" "));
  1110. }, preventDefaults: function (a) {
  1111. if (!Ib) {
  1112. var b = a.srcEvent,
  1113. c = a.offsetDirection; if (this.manager.session.prevented) return b.preventDefault(), void 0; var d = this.actions,
  1114. e = w(d, Mb),
  1115. f = w(d, Ob),
  1116. g = w(d, Nb); return e || f && c & X || g && c & Y ? this.preventSrc(b) : void 0;
  1117. }
  1118. }, preventSrc: function (a) {
  1119. this.manager.session.prevented = !0, a.preventDefault();
  1120. }
  1121. }; var Rb = 1,
  1122. Sb = 2,
  1123. Tb = 4,
  1124. Ub = 8,
  1125. Vb = Ub,
  1126. Wb = 16,
  1127. Xb = 32; Yb.prototype = {
  1128. defaults: {}, set: function (a) {
  1129. return n(this.options, a), this.manager && this.manager.touchAction.update(), this;
  1130. }, recognizeWith: function (a) {
  1131. if (l(a, "recognizeWith", this)) return this; var b = this.simultaneous; return a = _b(a, this), b[a.id] || (b[a.id] = a, a.recognizeWith(this)), this;
  1132. }, dropRecognizeWith: function (a) {
  1133. return l(a, "dropRecognizeWith", this) ? this : (a = _b(a, this), delete this.simultaneous[a.id], this);
  1134. }, requireFailure: function (a) {
  1135. if (l(a, "requireFailure", this)) return this; var b = this.requireFail; return a = _b(a, this), -1 === y(b, a) && (b.push(a), a.requireFailure(this)), this;
  1136. }, dropRequireFailure: function (a) {
  1137. if (l(a, "dropRequireFailure", this)) return this; a = _b(a, this); var b = y(this.requireFail, a); return b > -1 && this.requireFail.splice(b, 1), this;
  1138. }, hasRequireFailures: function () {
  1139. return this.requireFail.length > 0;
  1140. }, canRecognizeWith: function (a) {
  1141. return !!this.simultaneous[a.id];
  1142. }, emit: function (a) {
  1143. function d(d) {
  1144. b.manager.emit(b.options.event + (d ? Zb(c) : ""), a);
  1145. } var b = this,
  1146. c = this.state; Ub > c && d(!0), d(), c >= Ub && d(!0);
  1147. }, tryEmit: function (a) {
  1148. return this.canEmit() ? this.emit(a) : (this.state = Xb, void 0);
  1149. }, canEmit: function () {
  1150. for (var a = 0; a < this.requireFail.length;) {
  1151. if (!(this.requireFail[a].state & (Xb | Rb))) return !1; a++;
  1152. } return !0;
  1153. }, recognize: function (a) {
  1154. var b = n({}, a); return r(this.options.enable, [this, b]) ? (this.state & (Vb | Wb | Xb) && (this.state = Rb), this.state = this.process(b), this.state & (Sb | Tb | Ub | Wb) && this.tryEmit(b), void 0) : (this.reset(), this.state = Xb, void 0);
  1155. }, process: function () { }, getTouchAction: function () { }, reset: function () { }
  1156. }, p(ac, Yb, {
  1157. defaults: { pointers: 1 }, attrTest: function (a) {
  1158. var b = this.options.pointers; return 0 === b || a.pointers.length === b;
  1159. }, process: function (a) {
  1160. var b = this.state,
  1161. c = a.eventType,
  1162. d = b & (Sb | Tb),
  1163. e = this.attrTest(a); return d && (c & R || !e) ? b | Wb : d || e ? c & Q ? b | Ub : b & Sb ? b | Tb : Sb : Xb;
  1164. }
  1165. }), p(bc, ac, {
  1166. defaults: { event: "pan", threshold: 10, pointers: 1, direction: Z }, getTouchAction: function () {
  1167. var a = this.options.direction,
  1168. b = []; return a & X && b.push(Ob), a & Y && b.push(Nb), b;
  1169. }, directionTest: function (a) {
  1170. var b = this.options,
  1171. c = !0,
  1172. d = a.distance,
  1173. e = a.direction,
  1174. f = a.deltaX,
  1175. g = a.deltaY; return e & b.direction || (b.direction & X ? (e = 0 === f ? S : 0 > f ? T : U, c = f != this.pX, d = Math.abs(a.deltaX)) : (e = 0 === g ? S : 0 > g ? V : W, c = g != this.pY, d = Math.abs(a.deltaY))), a.direction = e, c && d > b.threshold && e & b.direction;
  1176. }, attrTest: function (a) {
  1177. return ac.prototype.attrTest.call(this, a) && (this.state & Sb || !(this.state & Sb) && this.directionTest(a));
  1178. }, emit: function (a) {
  1179. this.pX = a.deltaX, this.pY = a.deltaY; var b = $b(a.direction); b && this.manager.emit(this.options.event + b, a), this._super.emit.call(this, a);
  1180. }
  1181. }), p(cc, ac, {
  1182. defaults: { event: "pinch", threshold: 0, pointers: 2 }, getTouchAction: function () {
  1183. return [Mb];
  1184. }, attrTest: function (a) {
  1185. return this._super.attrTest.call(this, a) && (Math.abs(a.scale - 1) > this.options.threshold || this.state & Sb);
  1186. }, emit: function (a) {
  1187. if (this._super.emit.call(this, a), 1 !== a.scale) {
  1188. var b = a.scale < 1 ? "in" : "out"; this.manager.emit(this.options.event + b, a);
  1189. }
  1190. }
  1191. }), p(dc, Yb, {
  1192. defaults: { event: "press", pointers: 1, time: 500, threshold: 5 }, getTouchAction: function () {
  1193. return [Kb];
  1194. }, process: function (a) {
  1195. var b = this.options,
  1196. c = a.pointers.length === b.pointers,
  1197. d = a.distance < b.threshold,
  1198. e = a.deltaTime > b.time; if (this._input = a, !d || !c || a.eventType & (Q | R) && !e) this.reset(); else if (a.eventType & O) this.reset(), this._timer = k(function () {
  1199. this.state = Vb, this.tryEmit();
  1200. }, b.time, this); else if (a.eventType & Q) return Vb; return Xb;
  1201. }, reset: function () {
  1202. clearTimeout(this._timer);
  1203. }, emit: function (a) {
  1204. this.state === Vb && (a && a.eventType & Q ? this.manager.emit(this.options.event + "up", a) : (this._input.timeStamp = j(), this.manager.emit(this.options.event, this._input)));
  1205. }
  1206. }), p(ec, ac, {
  1207. defaults: { event: "rotate", threshold: 0, pointers: 2 }, getTouchAction: function () {
  1208. return [Mb];
  1209. }, attrTest: function (a) {
  1210. return this._super.attrTest.call(this, a) && (Math.abs(a.rotation) > this.options.threshold || this.state & Sb);
  1211. }
  1212. }), p(fc, ac, {
  1213. defaults: { event: "swipe", threshold: 10, velocity: .65, direction: X | Y, pointers: 1 }, getTouchAction: function () {
  1214. return bc.prototype.getTouchAction.call(this);
  1215. }, attrTest: function (a) {
  1216. var c,
  1217. b = this.options.direction; return b & (X | Y) ? c = a.velocity : b & X ? c = a.velocityX : b & Y && (c = a.velocityY), this._super.attrTest.call(this, a) && b & a.direction && a.distance > this.options.threshold && i(c) > this.options.velocity && a.eventType & Q;
  1218. }, emit: function (a) {
  1219. var b = $b(a.direction); b && this.manager.emit(this.options.event + b, a), this.manager.emit(this.options.event, a);
  1220. }
  1221. }), p(gc, Yb, {
  1222. defaults: { event: "tap", pointers: 1, taps: 1, interval: 300, time: 250, threshold: 2, posThreshold: 10 }, getTouchAction: function () {
  1223. return [Lb];
  1224. }, process: function (a) {
  1225. var b = this.options,
  1226. c = a.pointers.length === b.pointers,
  1227. d = a.distance < b.threshold,
  1228. e = a.deltaTime < b.time; if (this.reset(), a.eventType & O && 0 === this.count) return this.failTimeout(); if (d && e && c) {
  1229. if (a.eventType != Q) return this.failTimeout(); var f = this.pTime ? a.timeStamp - this.pTime < b.interval : !0,
  1230. g = !this.pCenter || kb(this.pCenter, a.center) < b.posThreshold; this.pTime = a.timeStamp, this.pCenter = a.center, g && f ? this.count += 1 : this.count = 1, this._input = a; var h = this.count % b.taps; if (0 === h) return this.hasRequireFailures() ? (this._timer = k(function () {
  1231. this.state = Vb, this.tryEmit();
  1232. }, b.interval, this), Sb) : Vb;
  1233. } return Xb;
  1234. }, failTimeout: function () {
  1235. return this._timer = k(function () {
  1236. this.state = Xb;
  1237. }, this.options.interval, this), Xb;
  1238. }, reset: function () {
  1239. clearTimeout(this._timer);
  1240. }, emit: function () {
  1241. this.state == Vb && (this._input.tapCount = this.count, this.manager.emit(this.options.event, this._input));
  1242. }
  1243. }), hc.VERSION = "2.0.4", hc.defaults = { domEvents: !1, touchAction: Jb, enable: !0, inputTarget: null, inputClass: null, preset: [[ec, { enable: !1 }], [cc, { enable: !1 }, ["rotate"]], [fc, { direction: X }], [bc, { direction: X }, ["swipe"]], [gc], [gc, { event: "doubletap", taps: 2 }, ["tap"]], [dc]], cssProps: { userSelect: "default", touchSelect: "none", touchCallout: "none", contentZooming: "none", userDrag: "none", tapHighlightColor: "rgba(0,0,0,0)" } }; var ic = 1,
  1244. jc = 2; kc.prototype = {
  1245. set: function (a) {
  1246. return n(this.options, a), a.touchAction && this.touchAction.update(), a.inputTarget && (this.input.destroy(), this.input.target = a.inputTarget, this.input.init()), this;
  1247. }, stop: function (a) {
  1248. this.session.stopped = a ? jc : ic;
  1249. }, recognize: function (a) {
  1250. var b = this.session; if (!b.stopped) {
  1251. this.touchAction.preventDefaults(a); var c,
  1252. d = this.recognizers,
  1253. e = b.curRecognizer; (!e || e && e.state & Vb) && (e = b.curRecognizer = null); for (var f = 0; f < d.length;) {
  1254. c = d[f], b.stopped === jc || e && c != e && !c.canRecognizeWith(e) ? c.reset() : c.recognize(a), !e && c.state & (Sb | Tb | Ub) && (e = b.curRecognizer = c), f++;
  1255. }
  1256. }
  1257. }, get: function (a) {
  1258. if (a instanceof Yb) return a; for (var b = this.recognizers, c = 0; c < b.length; c++) {
  1259. if (b[c].options.event == a) return b[c];
  1260. } return null;
  1261. }, add: function (a) {
  1262. if (l(a, "add", this)) return this; var b = this.get(a.options.event); return b && this.remove(b), this.recognizers.push(a), a.manager = this, this.touchAction.update(), a;
  1263. }, remove: function (a) {
  1264. if (l(a, "remove", this)) return this; var b = this.recognizers; return a = this.get(a), b.splice(y(b, a), 1), this.touchAction.update(), this;
  1265. }, on: function (a, b) {
  1266. var c = this.handlers; return m(x(a), function (a) {
  1267. c[a] = c[a] || [], c[a].push(b);
  1268. }), this;
  1269. }, off: function (a, b) {
  1270. var c = this.handlers; return m(x(a), function (a) {
  1271. b ? c[a].splice(y(c[a], b), 1) : delete c[a];
  1272. }), this;
  1273. }, emit: function (a, b) {
  1274. this.options.domEvents && mc(a, b); var c = this.handlers[a] && this.handlers[a].slice(); if (c && c.length) {
  1275. b.type = a, b.preventDefault = function () {
  1276. b.srcEvent.preventDefault();
  1277. }; for (var d = 0; d < c.length;) {
  1278. c[d](b), d++;
  1279. }
  1280. }
  1281. }, destroy: function () {
  1282. this.element && lc(this, !1), this.handlers = {}, this.session = {}, this.input.destroy(), this.element = null;
  1283. }
  1284. }, n(hc, { INPUT_START: O, INPUT_MOVE: P, INPUT_END: Q, INPUT_CANCEL: R, STATE_POSSIBLE: Rb, STATE_BEGAN: Sb, STATE_CHANGED: Tb, STATE_ENDED: Ub, STATE_RECOGNIZED: Vb, STATE_CANCELLED: Wb, STATE_FAILED: Xb, DIRECTION_NONE: S, DIRECTION_LEFT: T, DIRECTION_RIGHT: U, DIRECTION_UP: V, DIRECTION_DOWN: W, DIRECTION_HORIZONTAL: X, DIRECTION_VERTICAL: Y, DIRECTION_ALL: Z, Manager: kc, Input: ab, TouchAction: Pb, TouchInput: Eb, MouseInput: rb, PointerEventInput: wb, TouchMouseInput: Gb, SingleTouchInput: Ab, Recognizer: Yb, AttrRecognizer: ac, Tap: gc, Pan: bc, Swipe: fc, Pinch: cc, Rotate: ec, Press: dc, on: t, off: u, each: m, merge: o, extend: n, inherit: p, bindFn: q, prefixed: B }), typeof define == g && define.amd ? define(function () {
  1285. return hc;
  1286. }) : "undefined" != typeof module && module.exports ? module.exports = hc : a[c] = hc;
  1287. }(window, document, "Hammer");; (function (factory) {
  1288. if (typeof define === 'function' && define.amd) {
  1289. define(['jquery', 'hammerjs'], factory);
  1290. } else if (typeof exports === 'object') {
  1291. factory(require('jquery'), require('hammerjs'));
  1292. } else {
  1293. factory(jQuery, Hammer);
  1294. }
  1295. })(function ($, Hammer) {
  1296. function hammerify(el, options) {
  1297. var $el = $(el);
  1298. if (!$el.data("hammer")) {
  1299. $el.data("hammer", new Hammer($el[0], options));
  1300. }
  1301. }
  1302. $.fn.hammer = function (options) {
  1303. return this.each(function () {
  1304. hammerify(this, options);
  1305. });
  1306. };
  1307. // extend the emit method to also trigger jQuery events
  1308. Hammer.Manager.prototype.emit = function (originalEmit) {
  1309. return function (type, data) {
  1310. originalEmit.call(this, type, data);
  1311. $(this.element).trigger({
  1312. type: type,
  1313. gesture: data
  1314. });
  1315. };
  1316. }(Hammer.Manager.prototype.emit);
  1317. });
  1318. ; // Required for Meteor package, the use of window prevents export by Meteor
  1319. (function (window) {
  1320. if (window.Package) {
  1321. Materialize = {};
  1322. } else {
  1323. window.Materialize = {};
  1324. }
  1325. })(window);
  1326. if (typeof exports !== 'undefined' && !exports.nodeType) {
  1327. if (typeof module !== 'undefined' && !module.nodeType && module.exports) {
  1328. exports = module.exports = Materialize;
  1329. }
  1330. exports.default = Materialize;
  1331. }
  1332. /*
  1333. * raf.js
  1334. * https://github.com/ngryman/raf.js
  1335. *
  1336. * original requestAnimationFrame polyfill by Erik Möller
  1337. * inspired from paul_irish gist and post
  1338. *
  1339. * Copyright (c) 2013 ngryman
  1340. * Licensed under the MIT license.
  1341. */
  1342. (function (window) {
  1343. var lastTime = 0,
  1344. vendors = ['webkit', 'moz'],
  1345. requestAnimationFrame = window.requestAnimationFrame,
  1346. cancelAnimationFrame = window.cancelAnimationFrame,
  1347. i = vendors.length;
  1348. // try to un-prefix existing raf
  1349. while (--i >= 0 && !requestAnimationFrame) {
  1350. requestAnimationFrame = window[vendors[i] + 'RequestAnimationFrame'];
  1351. cancelAnimationFrame = window[vendors[i] + 'CancelRequestAnimationFrame'];
  1352. }
  1353. // polyfill with setTimeout fallback
  1354. // heavily inspired from @darius gist mod: https://gist.github.com/paulirish/1579671#comment-837945
  1355. if (!requestAnimationFrame || !cancelAnimationFrame) {
  1356. requestAnimationFrame = function (callback) {
  1357. var now = +Date.now(),
  1358. nextTime = Math.max(lastTime + 16, now);
  1359. return setTimeout(function () {
  1360. callback(lastTime = nextTime);
  1361. }, nextTime - now);
  1362. };
  1363. cancelAnimationFrame = clearTimeout;
  1364. }
  1365. // export to window
  1366. window.requestAnimationFrame = requestAnimationFrame;
  1367. window.cancelAnimationFrame = cancelAnimationFrame;
  1368. })(window);
  1369. /**
  1370. * Generate approximated selector string for a jQuery object
  1371. * @param {jQuery} obj jQuery object to be parsed
  1372. * @returns {string}
  1373. */
  1374. Materialize.objectSelectorString = function (obj) {
  1375. var tagStr = obj.prop('tagName') || '';
  1376. var idStr = obj.attr('id') || '';
  1377. var classStr = obj.attr('class') || '';
  1378. return (tagStr + idStr + classStr).replace(/\s/g, '');
  1379. };
  1380. // Unique Random ID
  1381. Materialize.guid = function () {
  1382. function s4() {
  1383. return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
  1384. }
  1385. return function () {
  1386. return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
  1387. };
  1388. }();
  1389. /**
  1390. * Escapes hash from special characters
  1391. * @param {string} hash String returned from this.hash
  1392. * @returns {string}
  1393. */
  1394. Materialize.escapeHash = function (hash) {
  1395. return hash.replace(/(:|\.|\[|\]|,|=)/g, "\\$1");
  1396. };
  1397. Materialize.elementOrParentIsFixed = function (element) {
  1398. var $element = $(element);
  1399. var $checkElements = $element.add($element.parents());
  1400. var isFixed = false;
  1401. $checkElements.each(function () {
  1402. if ($(this).css("position") === "fixed") {
  1403. isFixed = true;
  1404. return false;
  1405. }
  1406. });
  1407. return isFixed;
  1408. };
  1409. /**
  1410. * Get time in ms
  1411. * @license https://raw.github.com/jashkenas/underscore/master/LICENSE
  1412. * @type {function}
  1413. * @return {number}
  1414. */
  1415. var getTime = Date.now || function () {
  1416. return new Date().getTime();
  1417. };
  1418. /**
  1419. * Returns a function, that, when invoked, will only be triggered at most once
  1420. * during a given window of time. Normally, the throttled function will run
  1421. * as much as it can, without ever going more than once per `wait` duration;
  1422. * but if you'd like to disable the execution on the leading edge, pass
  1423. * `{leading: false}`. To disable execution on the trailing edge, ditto.
  1424. * @license https://raw.github.com/jashkenas/underscore/master/LICENSE
  1425. * @param {function} func
  1426. * @param {number} wait
  1427. * @param {Object=} options
  1428. * @returns {Function}
  1429. */
  1430. Materialize.throttle = function (func, wait, options) {
  1431. var context, args, result;
  1432. var timeout = null;
  1433. var previous = 0;
  1434. options || (options = {});
  1435. var later = function () {
  1436. previous = options.leading === false ? 0 : getTime();
  1437. timeout = null;
  1438. result = func.apply(context, args);
  1439. context = args = null;
  1440. };
  1441. return function () {
  1442. var now = getTime();
  1443. if (!previous && options.leading === false) previous = now;
  1444. var remaining = wait - (now - previous);
  1445. context = this;
  1446. args = arguments;
  1447. if (remaining <= 0) {
  1448. clearTimeout(timeout);
  1449. timeout = null;
  1450. previous = now;
  1451. result = func.apply(context, args);
  1452. context = args = null;
  1453. } else if (!timeout && options.trailing !== false) {
  1454. timeout = setTimeout(later, remaining);
  1455. }
  1456. return result;
  1457. };
  1458. };
  1459. // Velocity has conflicts when loaded with jQuery, this will check for it
  1460. // First, check if in noConflict mode
  1461. var Vel;
  1462. if (jQuery) {
  1463. Vel = jQuery.Velocity;
  1464. } else if ($) {
  1465. Vel = $.Velocity;
  1466. } else {
  1467. Vel = Velocity;
  1468. }
  1469. if (Vel) {
  1470. Materialize.Vel = Vel;
  1471. } else {
  1472. Materialize.Vel = Velocity;
  1473. }
  1474. ; (function ($) {
  1475. $.fn.collapsible = function (options, methodParam) {
  1476. var defaults = {
  1477. accordion: undefined,
  1478. onOpen: undefined,
  1479. onClose: undefined
  1480. };
  1481. var methodName = options;
  1482. options = $.extend(defaults, options);
  1483. return this.each(function () {
  1484. var $this = $(this);
  1485. var $panel_headers = $(this).find('> li > .collapsible-header');
  1486. var collapsible_type = $this.data("collapsible");
  1487. /****************
  1488. Helper Functions
  1489. ****************/
  1490. // Accordion Open
  1491. function accordionOpen(object) {
  1492. $panel_headers = $this.find('> li > .collapsible-header');
  1493. if (object.hasClass('active')) {
  1494. object.parent().addClass('active');
  1495. } else {
  1496. object.parent().removeClass('active');
  1497. }
  1498. if (object.parent().hasClass('active')) {
  1499. object.siblings('.collapsible-body').stop(true, false).slideDown({
  1500. duration: 350, easing: "easeOutQuart", queue: false, complete: function () {
  1501. $(this).css('height', '');
  1502. }
  1503. });
  1504. } else {
  1505. object.siblings('.collapsible-body').stop(true, false).slideUp({
  1506. duration: 350, easing: "easeOutQuart", queue: false, complete: function () {
  1507. $(this).css('height', '');
  1508. }
  1509. });
  1510. }
  1511. $panel_headers.not(object).removeClass('active').parent().removeClass('active');
  1512. // Close previously open accordion elements.
  1513. $panel_headers.not(object).parent().children('.collapsible-body').stop(true, false).each(function () {
  1514. if ($(this).is(':visible')) {
  1515. $(this).slideUp({
  1516. duration: 350,
  1517. easing: "easeOutQuart",
  1518. queue: false,
  1519. complete: function () {
  1520. $(this).css('height', '');
  1521. execCallbacks($(this).siblings('.collapsible-header'));
  1522. }
  1523. });
  1524. }
  1525. });
  1526. }
  1527. // Expandable Open
  1528. function expandableOpen(object) {
  1529. if (object.hasClass('active')) {
  1530. object.parent().addClass('active');
  1531. } else {
  1532. object.parent().removeClass('active');
  1533. }
  1534. if (object.parent().hasClass('active')) {
  1535. object.siblings('.collapsible-body').stop(true, false).slideDown({
  1536. duration: 350, easing: "easeOutQuart", queue: false, complete: function () {
  1537. $(this).css('height', '');
  1538. }
  1539. });
  1540. } else {
  1541. object.siblings('.collapsible-body').stop(true, false).slideUp({
  1542. duration: 350, easing: "easeOutQuart", queue: false, complete: function () {
  1543. $(this).css('height', '');
  1544. }
  1545. });
  1546. }
  1547. }
  1548. // Open collapsible. object: .collapsible-header
  1549. function collapsibleOpen(object, noToggle) {
  1550. if (!noToggle) {
  1551. object.toggleClass('active');
  1552. }
  1553. if (options.accordion || collapsible_type === "accordion" || collapsible_type === undefined) {
  1554. // Handle Accordion
  1555. accordionOpen(object);
  1556. } else {
  1557. // Handle Expandables
  1558. expandableOpen(object);
  1559. }
  1560. execCallbacks(object);
  1561. }
  1562. // Handle callbacks
  1563. function execCallbacks(object) {
  1564. if (object.hasClass('active')) {
  1565. if (typeof options.onOpen === "function") {
  1566. options.onOpen.call(this, object.parent());
  1567. }
  1568. } else {
  1569. if (typeof options.onClose === "function") {
  1570. options.onClose.call(this, object.parent());
  1571. }
  1572. }
  1573. }
  1574. /**
  1575. * Check if object is children of panel header
  1576. * @param {Object} object Jquery object
  1577. * @return {Boolean} true if it is children
  1578. */
  1579. function isChildrenOfPanelHeader(object) {
  1580. var panelHeader = getPanelHeader(object);
  1581. return panelHeader.length > 0;
  1582. }
  1583. /**
  1584. * Get panel header from a children element
  1585. * @param {Object} object Jquery object
  1586. * @return {Object} panel header object
  1587. */
  1588. function getPanelHeader(object) {
  1589. return object.closest('li > .collapsible-header');
  1590. }
  1591. // Turn off any existing event handlers
  1592. function removeEventHandlers() {
  1593. $this.off('click.collapse', '> li > .collapsible-header');
  1594. }
  1595. /***** End Helper Functions *****/
  1596. // Methods
  1597. if (methodName === 'destroy') {
  1598. removeEventHandlers();
  1599. return;
  1600. } else if (methodParam >= 0 && methodParam < $panel_headers.length) {
  1601. var $curr_header = $panel_headers.eq(methodParam);
  1602. if ($curr_header.length && (methodName === 'open' || methodName === 'close' && $curr_header.hasClass('active'))) {
  1603. collapsibleOpen($curr_header);
  1604. }
  1605. return;
  1606. }
  1607. removeEventHandlers();
  1608. // Add click handler to only direct collapsible header children
  1609. $this.on('click.collapse', '> li > .collapsible-header', function (e) {
  1610. var element = $(e.target);
  1611. if (isChildrenOfPanelHeader(element)) {
  1612. element = getPanelHeader(element);
  1613. }
  1614. collapsibleOpen(element);
  1615. });
  1616. // Open first active
  1617. if (options.accordion || collapsible_type === "accordion" || collapsible_type === undefined) {
  1618. // Handle Accordion
  1619. collapsibleOpen($panel_headers.filter('.active').first(), true);
  1620. } else {
  1621. // Handle Expandables
  1622. $panel_headers.filter('.active').each(function () {
  1623. collapsibleOpen($(this), true);
  1624. });
  1625. }
  1626. });
  1627. };
  1628. $(document).ready(function () {
  1629. $('.collapsible').collapsible();
  1630. });
  1631. })(jQuery);; (function ($) {
  1632. // Add posibility to scroll to selected option
  1633. // usefull for select for example
  1634. $.fn.scrollTo = function (elem) {
  1635. $(this).scrollTop($(this).scrollTop() - $(this).offset().top + $(elem).offset().top);
  1636. return this;
  1637. };
  1638. $.fn.dropdown = function (options) {
  1639. var defaults = {
  1640. inDuration: 300,
  1641. outDuration: 225,
  1642. constrainWidth: true, // Constrains width of dropdown to the activator
  1643. hover: false,
  1644. gutter: 0, // Spacing from edge
  1645. belowOrigin: false,
  1646. alignment: 'left',
  1647. stopPropagation: false
  1648. };
  1649. // Open dropdown.
  1650. if (options === "open") {
  1651. this.each(function () {
  1652. $(this).trigger('open');
  1653. });
  1654. return false;
  1655. }
  1656. // Close dropdown.
  1657. if (options === "close") {
  1658. this.each(function () {
  1659. $(this).trigger('close');
  1660. });
  1661. return false;
  1662. }
  1663. this.each(function () {
  1664. var origin = $(this);
  1665. var curr_options = $.extend({}, defaults, options);
  1666. var isFocused = false;
  1667. // Dropdown menu
  1668. var activates = $("#" + origin.attr('data-activates'));
  1669. function updateOptions() {
  1670. if (origin.data('induration') !== undefined) curr_options.inDuration = origin.data('induration');
  1671. if (origin.data('outduration') !== undefined) curr_options.outDuration = origin.data('outduration');
  1672. if (origin.data('constrainwidth') !== undefined) curr_options.constrainWidth = origin.data('constrainwidth');
  1673. if (origin.data('hover') !== undefined) curr_options.hover = origin.data('hover');
  1674. if (origin.data('gutter') !== undefined) curr_options.gutter = origin.data('gutter');
  1675. if (origin.data('beloworigin') !== undefined) curr_options.belowOrigin = origin.data('beloworigin');
  1676. if (origin.data('alignment') !== undefined) curr_options.alignment = origin.data('alignment');
  1677. if (origin.data('stoppropagation') !== undefined) curr_options.stopPropagation = origin.data('stoppropagation');
  1678. }
  1679. updateOptions();
  1680. // Attach dropdown to its activator
  1681. origin.after(activates);
  1682. /*
  1683. Helper function to position and resize dropdown.
  1684. Used in hover and click handler.
  1685. */
  1686. function placeDropdown(eventType) {
  1687. // Check for simultaneous focus and click events.
  1688. if (eventType === 'focus') {
  1689. isFocused = true;
  1690. }
  1691. // Check html data attributes
  1692. updateOptions();
  1693. // Set Dropdown state
  1694. activates.addClass('active');
  1695. origin.addClass('active');
  1696. var originWidth = origin[0].getBoundingClientRect().width;
  1697. // Constrain width
  1698. if (curr_options.constrainWidth === true) {
  1699. activates.css('width', originWidth);
  1700. } else {
  1701. activates.css('white-space', 'nowrap');
  1702. }
  1703. // Offscreen detection
  1704. var windowHeight = window.innerHeight;
  1705. var originHeight = origin.innerHeight();
  1706. var offsetLeft = origin.offset().left;
  1707. var offsetTop = origin.offset().top - $(window).scrollTop();
  1708. var currAlignment = curr_options.alignment;
  1709. var gutterSpacing = 0;
  1710. var leftPosition = 0;
  1711. // Below Origin
  1712. var verticalOffset = 0;
  1713. if (curr_options.belowOrigin === true) {
  1714. verticalOffset = originHeight;
  1715. }
  1716. // Check for scrolling positioned container.
  1717. var scrollYOffset = 0;
  1718. var scrollXOffset = 0;
  1719. var wrapper = origin.parent();
  1720. if (!wrapper.is('body')) {
  1721. if (wrapper[0].scrollHeight > wrapper[0].clientHeight) {
  1722. scrollYOffset = wrapper[0].scrollTop;
  1723. }
  1724. if (wrapper[0].scrollWidth > wrapper[0].clientWidth) {
  1725. scrollXOffset = wrapper[0].scrollLeft;
  1726. }
  1727. }
  1728. if (offsetLeft + activates.innerWidth() > $(window).width()) {
  1729. // Dropdown goes past screen on right, force right alignment
  1730. currAlignment = 'right';
  1731. } else if (offsetLeft - activates.innerWidth() + origin.innerWidth() < 0) {
  1732. // Dropdown goes past screen on left, force left alignment
  1733. currAlignment = 'left';
  1734. }
  1735. // Vertical bottom offscreen detection
  1736. if (offsetTop + activates.innerHeight() > windowHeight) {
  1737. // If going upwards still goes offscreen, just crop height of dropdown.
  1738. if (offsetTop + originHeight - activates.innerHeight() < 0) {
  1739. var adjustedHeight = windowHeight - offsetTop - verticalOffset;
  1740. activates.css('max-height', adjustedHeight);
  1741. } else {
  1742. // Flow upwards.
  1743. if (!verticalOffset) {
  1744. verticalOffset += originHeight;
  1745. }
  1746. verticalOffset -= activates.innerHeight();
  1747. }
  1748. }
  1749. // Handle edge alignment
  1750. if (currAlignment === 'left') {
  1751. gutterSpacing = curr_options.gutter;
  1752. leftPosition = origin.position().left + gutterSpacing;
  1753. } else if (currAlignment === 'right') {
  1754. // Material icons fix
  1755. activates.stop(true, true).css({
  1756. opacity: 0,
  1757. left: 0
  1758. });
  1759. var offsetRight = origin.position().left + originWidth - activates.width();
  1760. gutterSpacing = -curr_options.gutter;
  1761. leftPosition = offsetRight + gutterSpacing;
  1762. }
  1763. // Position dropdown
  1764. activates.css({
  1765. position: 'absolute',
  1766. top: origin.position().top + verticalOffset + scrollYOffset == 0 ? 64 : origin.position().top + verticalOffset + scrollYOffset,
  1767. left: leftPosition + scrollXOffset
  1768. });
  1769. // Show dropdown
  1770. activates.slideDown({
  1771. queue: false,
  1772. duration: curr_options.inDuration,
  1773. easing: 'easeOutCubic',
  1774. complete: function () {
  1775. $(this).css('height', '');
  1776. }
  1777. }).animate({ opacity: 1 }, { queue: false, duration: curr_options.inDuration, easing: 'easeOutSine' });
  1778. // Add click close handler to document
  1779. setTimeout(function () {
  1780. $(document).on('click.' + activates.attr('id'), function (e) {
  1781. hideDropdown();
  1782. $(document).off('click.' + activates.attr('id'));
  1783. });
  1784. }, 0);
  1785. }
  1786. function hideDropdown() {
  1787. // Check for simultaneous focus and click events.
  1788. isFocused = false;
  1789. activates.fadeOut(curr_options.outDuration);
  1790. activates.removeClass('active');
  1791. origin.removeClass('active');
  1792. $(document).off('click.' + activates.attr('id'));
  1793. setTimeout(function () {
  1794. activates.css('max-height', '');
  1795. }, curr_options.outDuration);
  1796. }
  1797. // Hover
  1798. if (curr_options.hover) {
  1799. var open = false;
  1800. origin.off('click.' + origin.attr('id'));
  1801. // Hover handler to show dropdown
  1802. origin.on('mouseenter', function (e) {
  1803. // Mouse over
  1804. if (open === false) {
  1805. placeDropdown();
  1806. open = true;
  1807. }
  1808. });
  1809. origin.on('mouseleave', function (e) {
  1810. // If hover on origin then to something other than dropdown content, then close
  1811. var toEl = e.toElement || e.relatedTarget; // added browser compatibility for target element
  1812. if (!$(toEl).closest('.dropdown-content').is(activates)) {
  1813. activates.stop(true, true);
  1814. hideDropdown();
  1815. open = false;
  1816. }
  1817. });
  1818. activates.on('mouseleave', function (e) {
  1819. // Mouse out
  1820. var toEl = e.toElement || e.relatedTarget;
  1821. if (!$(toEl).closest('.dropdown-button').is(origin)) {
  1822. activates.stop(true, true);
  1823. hideDropdown();
  1824. open = false;
  1825. }
  1826. });
  1827. // Click
  1828. } else {
  1829. // Click handler to show dropdown
  1830. origin.off('click.' + origin.attr('id'));
  1831. origin.on('click.' + origin.attr('id'), function (e) {
  1832. if (!isFocused) {
  1833. if (origin[0] == e.currentTarget && !origin.hasClass('active') && $(e.target).closest('.dropdown-content').length === 0) {
  1834. e.preventDefault(); // Prevents button click from moving window
  1835. if (curr_options.stopPropagation) {
  1836. e.stopPropagation();
  1837. }
  1838. placeDropdown('click');
  1839. }
  1840. // If origin is clicked and menu is open, close menu
  1841. else if (origin.hasClass('active')) {
  1842. hideDropdown();
  1843. $(document).off('click.' + activates.attr('id'));
  1844. }
  1845. }
  1846. });
  1847. } // End else
  1848. // Listen to open and close event - useful for select component
  1849. origin.on('open', function (e, eventType) {
  1850. placeDropdown(eventType);
  1851. });
  1852. origin.on('close', hideDropdown);
  1853. });
  1854. }; // End dropdown plugin
  1855. $(document).ready(function () {
  1856. $('.dropdown-button').dropdown();
  1857. });
  1858. })(jQuery);
  1859. ; (function ($, Vel) {
  1860. 'use strict';
  1861. var _defaults = {
  1862. opacity: 0.5,
  1863. inDuration: 250,
  1864. outDuration: 250,
  1865. ready: undefined,
  1866. complete: undefined,
  1867. dismissible: true,
  1868. startingTop: '4%',
  1869. endingTop: '10%'
  1870. };
  1871. /**
  1872. * @class
  1873. *
  1874. */
  1875. var Modal = function () {
  1876. /**
  1877. * Construct Modal instance and set up overlay
  1878. * @constructor
  1879. * @param {jQuery} $el
  1880. * @param {Object} options
  1881. */
  1882. function Modal($el, options) {
  1883. _classCallCheck(this, Modal);
  1884. // If exists, destroy and reinitialize
  1885. if (!!$el[0].M_Modal) {
  1886. $el[0].M_Modal.destroy();
  1887. }
  1888. /**
  1889. * The jQuery element
  1890. * @type {jQuery}
  1891. */
  1892. this.$el = $el;
  1893. /**
  1894. * Options for the modal
  1895. * @member Modal#options
  1896. * @prop {Number} [opacity=0.5] - Opacity of the modal overlay
  1897. * @prop {Number} [inDuration=250] - Length in ms of enter transition
  1898. * @prop {Number} [outDuration=250] - Length in ms of exit transition
  1899. * @prop {Function} ready - Callback function called when modal is finished entering
  1900. * @prop {Function} complete - Callback function called when modal is finished exiting
  1901. * @prop {Boolean} [dismissible=true] - Allow modal to be dismissed by keyboard or overlay click
  1902. * @prop {String} [startingTop='4%'] - startingTop
  1903. * @prop {String} [endingTop='10%'] - endingTop
  1904. */
  1905. this.options = $.extend({}, Modal.defaults, options);
  1906. /**
  1907. * Describes open/close state of modal
  1908. * @type {Boolean}
  1909. */
  1910. this.isOpen = false;
  1911. this.$el[0].M_Modal = this;
  1912. this.id = $el.attr('id');
  1913. this.openingTrigger = undefined;
  1914. this.$overlay = $('<div class="modal-overlay"></div>');
  1915. Modal._increment++;
  1916. Modal._count++;
  1917. this.$overlay[0].style.zIndex = 1000 + Modal._increment * 2;
  1918. this.$el[0].style.zIndex = 1000 + Modal._increment * 2 + 1;
  1919. this.setupEventHandlers();
  1920. }
  1921. _createClass(Modal, [{
  1922. key: 'getInstance',
  1923. /**
  1924. * Get Instance
  1925. */
  1926. value: function getInstance() {
  1927. return this;
  1928. }
  1929. /**
  1930. * Teardown component
  1931. */
  1932. }, {
  1933. key: 'destroy',
  1934. value: function destroy() {
  1935. this.removeEventHandlers();
  1936. this.$el[0].removeAttribute('style');
  1937. if (!!this.$overlay[0].parentNode) {
  1938. this.$overlay[0].parentNode.removeChild(this.$overlay[0]);
  1939. }
  1940. this.$el[0].M_Modal = undefined;
  1941. Modal._count--;
  1942. }
  1943. /**
  1944. * Setup Event Handlers
  1945. */
  1946. }, {
  1947. key: 'setupEventHandlers',
  1948. value: function setupEventHandlers() {
  1949. this.handleOverlayClickBound = this.handleOverlayClick.bind(this);
  1950. this.handleModalCloseClickBound = this.handleModalCloseClick.bind(this);
  1951. if (Modal._count === 1) {
  1952. document.body.addEventListener('click', this.handleTriggerClick);
  1953. }
  1954. this.$overlay[0].addEventListener('click', this.handleOverlayClickBound);
  1955. this.$el[0].addEventListener('click', this.handleModalCloseClickBound);
  1956. }
  1957. /**
  1958. * Remove Event Handlers
  1959. */
  1960. }, {
  1961. key: 'removeEventHandlers',
  1962. value: function removeEventHandlers() {
  1963. if (Modal._count === 0) {
  1964. document.body.removeEventListener('click', this.handleTriggerClick);
  1965. }
  1966. this.$overlay[0].removeEventListener('click', this.handleOverlayClickBound);
  1967. this.$el[0].removeEventListener('click', this.handleModalCloseClickBound);
  1968. }
  1969. /**
  1970. * Handle Trigger Click
  1971. * @param {Event} e
  1972. */
  1973. }, {
  1974. key: 'handleTriggerClick',
  1975. value: function handleTriggerClick(e) {
  1976. var $trigger = $(e.target).closest('.modal-trigger');
  1977. if (e.target && $trigger.length) {
  1978. var modalId = $trigger[0].getAttribute('href');
  1979. if (modalId) {
  1980. modalId = modalId.slice(1);
  1981. } else {
  1982. modalId = $trigger[0].getAttribute('data-target');
  1983. }
  1984. var modalInstance = document.getElementById(modalId).M_Modal;
  1985. if (modalInstance) {
  1986. modalInstance.open($trigger);
  1987. }
  1988. e.preventDefault();
  1989. }
  1990. }
  1991. /**
  1992. * Handle Overlay Click
  1993. */
  1994. }, {
  1995. key: 'handleOverlayClick',
  1996. value: function handleOverlayClick() {
  1997. if (this.options.dismissible) {
  1998. this.close();
  1999. }
  2000. }
  2001. /**
  2002. * Handle Modal Close Click
  2003. * @param {Event} e
  2004. */
  2005. }, {
  2006. key: 'handleModalCloseClick',
  2007. value: function handleModalCloseClick(e) {
  2008. var $closeTrigger = $(e.target).closest('.modal-close');
  2009. if (e.target && $closeTrigger.length) {
  2010. this.close();
  2011. }
  2012. }
  2013. /**
  2014. * Handle Keydown
  2015. * @param {Event} e
  2016. */
  2017. }, {
  2018. key: 'handleKeydown',
  2019. value: function handleKeydown(e) {
  2020. // ESC key
  2021. if (e.keyCode === 27 && this.options.dismissible) {
  2022. this.close();
  2023. }
  2024. }
  2025. /**
  2026. * Animate in modal
  2027. */
  2028. }, {
  2029. key: 'animateIn',
  2030. value: function animateIn() {
  2031. var _this = this;
  2032. // Set initial styles
  2033. $.extend(this.$el[0].style, {
  2034. display: 'block',
  2035. opacity: 0
  2036. });
  2037. $.extend(this.$overlay[0].style, {
  2038. display: 'block',
  2039. opacity: 0
  2040. });
  2041. // Animate overlay
  2042. Vel(this.$overlay[0], { opacity: this.options.opacity }, { duration: this.options.inDuration, queue: false, ease: 'easeOutCubic' });
  2043. // Define modal animation options
  2044. var enterVelocityOptions = {
  2045. duration: this.options.inDuration,
  2046. queue: false,
  2047. ease: 'easeOutCubic',
  2048. // Handle modal ready callback
  2049. complete: function () {
  2050. if (typeof _this.options.ready === 'function') {
  2051. _this.options.ready.call(_this, _this.$el, _this.openingTrigger);
  2052. }
  2053. }
  2054. };
  2055. // Bottom sheet animation
  2056. if (this.$el[0].classList.contains('bottom-sheet')) {
  2057. Vel(this.$el[0], { bottom: 0, opacity: 1 }, enterVelocityOptions);
  2058. // Normal modal animation
  2059. } else {
  2060. Vel.hook(this.$el[0], 'scaleX', 0.7);
  2061. this.$el[0].style.top = this.options.startingTop;
  2062. Vel(this.$el[0], { top: this.options.endingTop, opacity: 1, scaleX: 1 }, enterVelocityOptions);
  2063. }
  2064. }
  2065. /**
  2066. * Animate out modal
  2067. */
  2068. }, {
  2069. key: 'animateOut',
  2070. value: function animateOut() {
  2071. var _this2 = this;
  2072. // Animate overlay
  2073. Vel(this.$overlay[0], { opacity: 0 }, { duration: this.options.outDuration, queue: false, ease: 'easeOutQuart' });
  2074. // Define modal animation options
  2075. var exitVelocityOptions = {
  2076. duration: this.options.outDuration,
  2077. queue: false,
  2078. ease: 'easeOutCubic',
  2079. // Handle modal ready callback
  2080. complete: function () {
  2081. _this2.$el[0].style.display = 'none';
  2082. // Call complete callback
  2083. if (typeof _this2.options.complete === 'function') {
  2084. _this2.options.complete.call(_this2, _this2.$el);
  2085. }
  2086. _this2.$overlay[0].parentNode.removeChild(_this2.$overlay[0]);
  2087. }
  2088. };
  2089. // Bottom sheet animation
  2090. if (this.$el[0].classList.contains('bottom-sheet')) {
  2091. Vel(this.$el[0], { bottom: '-100%', opacity: 0 }, exitVelocityOptions);
  2092. // Normal modal animation
  2093. } else {
  2094. Vel(this.$el[0], { top: this.options.startingTop, opacity: 0, scaleX: 0.7 }, exitVelocityOptions);
  2095. }
  2096. }
  2097. /**
  2098. * Open Modal
  2099. * @param {jQuery} [$trigger]
  2100. */
  2101. }, {
  2102. key: 'open',
  2103. value: function open($trigger) {
  2104. if (this.isOpen) {
  2105. return;
  2106. }
  2107. this.isOpen = true;
  2108. var body = document.body;
  2109. body.style.overflow = 'hidden';
  2110. this.$el[0].classList.add('open');
  2111. body.appendChild(this.$overlay[0]);
  2112. // Set opening trigger, undefined indicates modal was opened by javascript
  2113. this.openingTrigger = !!$trigger ? $trigger : undefined;
  2114. if (this.options.dismissible) {
  2115. this.handleKeydownBound = this.handleKeydown.bind(this);
  2116. document.addEventListener('keydown', this.handleKeydownBound);
  2117. }
  2118. this.animateIn();
  2119. return this;
  2120. }
  2121. /**
  2122. * Close Modal
  2123. */
  2124. }, {
  2125. key: 'close',
  2126. value: function close() {
  2127. if (!this.isOpen) {
  2128. return;
  2129. }
  2130. this.isOpen = false;
  2131. this.$el[0].classList.remove('open');
  2132. document.body.style.overflow = '';
  2133. if (this.options.dismissible) {
  2134. document.removeEventListener('keydown', this.handleKeydownBound);
  2135. }
  2136. this.animateOut();
  2137. return this;
  2138. }
  2139. }], [{
  2140. key: 'init',
  2141. value: function init($els, options) {
  2142. var arr = [];
  2143. $els.each(function () {
  2144. arr.push(new Modal($(this), options));
  2145. });
  2146. return arr;
  2147. }
  2148. }, {
  2149. key: 'defaults',
  2150. get: function () {
  2151. return _defaults;
  2152. }
  2153. }]);
  2154. return Modal;
  2155. }();
  2156. /**
  2157. * @static
  2158. * @memberof Modal
  2159. */
  2160. Modal._increment = 0;
  2161. /**
  2162. * @static
  2163. * @memberof Modal
  2164. */
  2165. Modal._count = 0;
  2166. Materialize.Modal = Modal;
  2167. $.fn.modal = function (methodOrOptions) {
  2168. // Call plugin method if valid method name is passed in
  2169. if (Modal.prototype[methodOrOptions]) {
  2170. // Getter methods
  2171. if (methodOrOptions.slice(0, 3) === 'get') {
  2172. return this.first()[0].M_Modal[methodOrOptions]();
  2173. // Void methods
  2174. } else {
  2175. return this.each(function () {
  2176. this.M_Modal[methodOrOptions]();
  2177. });
  2178. }
  2179. // Initialize plugin if options or no argument is passed in
  2180. } else if (typeof methodOrOptions === 'object' || !methodOrOptions) {
  2181. Modal.init(this, arguments[0]);
  2182. return this;
  2183. // Return error if an unrecognized method name is passed in
  2184. } else {
  2185. $.error('Method ' + methodOrOptions + ' does not exist on jQuery.modal');
  2186. }
  2187. };
  2188. })(jQuery, Materialize.Vel);
  2189. ; (function ($) {
  2190. $.fn.materialbox = function () {
  2191. return this.each(function () {
  2192. if ($(this).hasClass('initialized')) {
  2193. return;
  2194. }
  2195. $(this).addClass('initialized');
  2196. var overlayActive = false;
  2197. var doneAnimating = true;
  2198. var inDuration = 275;
  2199. var outDuration = 200;
  2200. var origin = $(this);
  2201. var placeholder = $('<div></div>').addClass('material-placeholder');
  2202. var originalWidth = 0;
  2203. var originalHeight = 0;
  2204. var ancestorsChanged;
  2205. var ancestor;
  2206. var originInlineStyles = origin.attr('style');
  2207. origin.wrap(placeholder);
  2208. // Start click handler
  2209. origin.on('click', function () {
  2210. var placeholder = origin.parent('.material-placeholder');
  2211. var windowWidth = window.innerWidth;
  2212. var windowHeight = window.innerHeight;
  2213. var originalWidth = origin.width();
  2214. var originalHeight = origin.height();
  2215. // If already modal, return to original
  2216. if (doneAnimating === false) {
  2217. returnToOriginal();
  2218. return false;
  2219. } else if (overlayActive && doneAnimating === true) {
  2220. returnToOriginal();
  2221. return false;
  2222. }
  2223. // Set states
  2224. doneAnimating = false;
  2225. origin.addClass('active');
  2226. overlayActive = true;
  2227. // Set positioning for placeholder
  2228. placeholder.css({
  2229. width: placeholder[0].getBoundingClientRect().width,
  2230. height: placeholder[0].getBoundingClientRect().height,
  2231. position: 'relative',
  2232. top: 0,
  2233. left: 0
  2234. });
  2235. // Find ancestor with overflow: hidden; and remove it
  2236. ancestorsChanged = undefined;
  2237. ancestor = placeholder[0].parentNode;
  2238. var count = 0;
  2239. while (ancestor !== null && !$(ancestor).is(document)) {
  2240. var curr = $(ancestor);
  2241. if (curr.css('overflow') !== 'visible') {
  2242. curr.css('overflow', 'visible');
  2243. if (ancestorsChanged === undefined) {
  2244. ancestorsChanged = curr;
  2245. } else {
  2246. ancestorsChanged = ancestorsChanged.add(curr);
  2247. }
  2248. }
  2249. ancestor = ancestor.parentNode;
  2250. }
  2251. // Set css on origin
  2252. origin.css({
  2253. position: 'absolute',
  2254. 'z-index': 1000,
  2255. 'will-change': 'left, top, width, height'
  2256. }).data('width', originalWidth).data('height', originalHeight);
  2257. // Add overlay
  2258. var overlay = $('<div id="materialbox-overlay"></div>').css({
  2259. opacity: 0
  2260. }).click(function () {
  2261. if (doneAnimating === true) returnToOriginal();
  2262. });
  2263. // Put before in origin image to preserve z-index layering.
  2264. origin.before(overlay);
  2265. // Set dimensions if needed
  2266. var overlayOffset = overlay[0].getBoundingClientRect();
  2267. overlay.css({
  2268. width: windowWidth,
  2269. height: windowHeight,
  2270. left: -1 * overlayOffset.left,
  2271. top: -1 * overlayOffset.top
  2272. });
  2273. // Animate Overlay
  2274. overlay.velocity({ opacity: 1 }, { duration: inDuration, queue: false, easing: 'easeOutQuad' });
  2275. // Add and animate caption if it exists
  2276. if (origin.data('caption') !== "") {
  2277. var $photo_caption = $('<div class="materialbox-caption"></div>');
  2278. $photo_caption.text(origin.data('caption'));
  2279. $('body').append($photo_caption);
  2280. $photo_caption.css({ "display": "inline" });
  2281. $photo_caption.velocity({ opacity: 1 }, { duration: inDuration, queue: false, easing: 'easeOutQuad' });
  2282. }
  2283. // Resize Image
  2284. var ratio = 0;
  2285. var widthPercent = originalWidth / windowWidth;
  2286. var heightPercent = originalHeight / windowHeight;
  2287. var newWidth = 0;
  2288. var newHeight = 0;
  2289. if (widthPercent > heightPercent) {
  2290. ratio = originalHeight / originalWidth;
  2291. newWidth = windowWidth * 0.9;
  2292. newHeight = windowWidth * 0.9 * ratio;
  2293. } else {
  2294. ratio = originalWidth / originalHeight;
  2295. newWidth = windowHeight * 0.9 * ratio;
  2296. newHeight = windowHeight * 0.9;
  2297. }
  2298. // Animate image + set z-index
  2299. if (origin.hasClass('responsive-img')) {
  2300. origin.velocity({ 'max-width': newWidth, 'width': originalWidth }, {
  2301. duration: 0, queue: false,
  2302. complete: function () {
  2303. origin.css({ left: 0, top: 0 }).velocity({
  2304. height: newHeight,
  2305. width: newWidth,
  2306. left: $(document).scrollLeft() + windowWidth / 2 - origin.parent('.material-placeholder').offset().left - newWidth / 2,
  2307. top: $(document).scrollTop() + windowHeight / 2 - origin.parent('.material-placeholder').offset().top - newHeight / 2
  2308. }, {
  2309. duration: inDuration,
  2310. queue: false,
  2311. easing: 'easeOutQuad',
  2312. complete: function () {
  2313. doneAnimating = true;
  2314. }
  2315. });
  2316. } // End Complete
  2317. }); // End Velocity
  2318. } else {
  2319. origin.css('left', 0).css('top', 0).velocity({
  2320. height: newHeight,
  2321. width: newWidth,
  2322. left: $(document).scrollLeft() + windowWidth / 2 - origin.parent('.material-placeholder').offset().left - newWidth / 2,
  2323. top: $(document).scrollTop() + windowHeight / 2 - origin.parent('.material-placeholder').offset().top - newHeight / 2
  2324. }, {
  2325. duration: inDuration,
  2326. queue: false,
  2327. easing: 'easeOutQuad',
  2328. complete: function () {
  2329. doneAnimating = true;
  2330. }
  2331. }); // End Velocity
  2332. }
  2333. // Handle Exit triggers
  2334. $(window).on('scroll.materialbox', function () {
  2335. if (overlayActive) {
  2336. returnToOriginal();
  2337. }
  2338. });
  2339. $(window).on('resize.materialbox', function () {
  2340. if (overlayActive) {
  2341. returnToOriginal();
  2342. }
  2343. });
  2344. $(document).on('keyup.materialbox', function (e) {
  2345. // ESC key
  2346. if (e.keyCode === 27 && doneAnimating === true && overlayActive) {
  2347. returnToOriginal();
  2348. }
  2349. });
  2350. }); // End click handler
  2351. // This function returns the modaled image to the original spot
  2352. function returnToOriginal() {
  2353. doneAnimating = false;
  2354. var placeholder = origin.parent('.material-placeholder');
  2355. var windowWidth = window.innerWidth;
  2356. var windowHeight = window.innerHeight;
  2357. var originalWidth = origin.data('width');
  2358. var originalHeight = origin.data('height');
  2359. origin.velocity("stop", true);
  2360. $('#materialbox-overlay').velocity("stop", true);
  2361. $('.materialbox-caption').velocity("stop", true);
  2362. // disable exit handlers
  2363. $(window).off('scroll.materialbox');
  2364. $(document).off('keyup.materialbox');
  2365. $(window).off('resize.materialbox');
  2366. $('#materialbox-overlay').velocity({ opacity: 0 }, {
  2367. duration: outDuration, // Delay prevents animation overlapping
  2368. queue: false, easing: 'easeOutQuad',
  2369. complete: function () {
  2370. // Remove Overlay
  2371. overlayActive = false;
  2372. $(this).remove();
  2373. }
  2374. });
  2375. // Resize Image
  2376. origin.velocity({
  2377. width: originalWidth,
  2378. height: originalHeight,
  2379. left: 0,
  2380. top: 0
  2381. }, {
  2382. duration: outDuration,
  2383. queue: false, easing: 'easeOutQuad',
  2384. complete: function () {
  2385. placeholder.css({
  2386. height: '',
  2387. width: '',
  2388. position: '',
  2389. top: '',
  2390. left: ''
  2391. });
  2392. origin.removeAttr('style');
  2393. origin.attr('style', originInlineStyles);
  2394. // Remove class
  2395. origin.removeClass('active');
  2396. doneAnimating = true;
  2397. // Remove overflow overrides on ancestors
  2398. if (ancestorsChanged) {
  2399. ancestorsChanged.css('overflow', '');
  2400. }
  2401. }
  2402. });
  2403. // Remove Caption + reset css settings on image
  2404. $('.materialbox-caption').velocity({ opacity: 0 }, {
  2405. duration: outDuration, // Delay prevents animation overlapping
  2406. queue: false, easing: 'easeOutQuad',
  2407. complete: function () {
  2408. $(this).remove();
  2409. }
  2410. });
  2411. }
  2412. });
  2413. };
  2414. $(document).ready(function () {
  2415. $('.materialboxed').materialbox();
  2416. });
  2417. })(jQuery);
  2418. ; (function ($) {
  2419. $.fn.parallax = function () {
  2420. var window_width = $(window).width();
  2421. // Parallax Scripts
  2422. return this.each(function (i) {
  2423. var $this = $(this);
  2424. $this.addClass('parallax');
  2425. function updateParallax(initial) {
  2426. var container_height;
  2427. if (window_width < 601) {
  2428. container_height = $this.height() > 0 ? $this.height() : $this.children("img").height();
  2429. } else {
  2430. container_height = $this.height() > 0 ? $this.height() : 500;
  2431. }
  2432. var $img = $this.children("img").first();
  2433. var img_height = $img.height();
  2434. var parallax_dist = img_height - container_height;
  2435. var bottom = $this.offset().top + container_height;
  2436. var top = $this.offset().top;
  2437. var scrollTop = $(window).scrollTop();
  2438. var windowHeight = window.innerHeight;
  2439. var windowBottom = scrollTop + windowHeight;
  2440. var percentScrolled = (windowBottom - top) / (container_height + windowHeight);
  2441. var parallax = Math.round(parallax_dist * percentScrolled);
  2442. if (initial) {
  2443. $img.css('display', 'block');
  2444. }
  2445. if (bottom > scrollTop && top < scrollTop + windowHeight) {
  2446. $img.css('transform', "translate3D(-50%," + parallax + "px, 0)");
  2447. }
  2448. }
  2449. // Wait for image load
  2450. $this.children("img").one("load", function () {
  2451. updateParallax(true);
  2452. }).each(function () {
  2453. if (this.complete) $(this).trigger("load");
  2454. });
  2455. $(window).scroll(function () {
  2456. window_width = $(window).width();
  2457. updateParallax(false);
  2458. });
  2459. $(window).resize(function () {
  2460. window_width = $(window).width();
  2461. updateParallax(false);
  2462. });
  2463. });
  2464. };
  2465. })(jQuery);
  2466. ; (function ($) {
  2467. var methods = {
  2468. init: function (options) {
  2469. var defaults = {
  2470. onShow: null,
  2471. swipeable: false,
  2472. responsiveThreshold: Infinity // breakpoint for swipeable
  2473. };
  2474. options = $.extend(defaults, options);
  2475. var namespace = Materialize.objectSelectorString($(this));
  2476. return this.each(function (i) {
  2477. var uniqueNamespace = namespace + i;
  2478. // For each set of tabs, we want to keep track of
  2479. // which tab is active and its associated content
  2480. var $this = $(this),
  2481. window_width = $(window).width();
  2482. var $active,
  2483. $content,
  2484. $links = $this.find('li.tab a'),
  2485. $tabs_width = $this.width(),
  2486. $tabs_content = $(),
  2487. $tabs_wrapper,
  2488. $tab_width = Math.max($tabs_width, $this[0].scrollWidth) / $links.length,
  2489. $indicator,
  2490. index = 0,
  2491. prev_index = 0,
  2492. clicked = false,
  2493. clickedTimeout,
  2494. transition = 300;
  2495. // Finds right attribute for indicator based on active tab.
  2496. // el: jQuery Object
  2497. var calcRightPos = function (el) {
  2498. return Math.ceil($tabs_width - el.position().left - el[0].getBoundingClientRect().width - $this.scrollLeft());
  2499. };
  2500. // Finds left attribute for indicator based on active tab.
  2501. // el: jQuery Object
  2502. var calcLeftPos = function (el) {
  2503. return Math.floor(el.position().left + $this.scrollLeft());
  2504. };
  2505. // Animates Indicator to active tab.
  2506. // prev_index: Number
  2507. var animateIndicator = function (prev_index) {
  2508. if (index - prev_index >= 0) {
  2509. $indicator.velocity({ "right": calcRightPos($active) }, { duration: transition, queue: false, easing: 'easeOutQuad' });
  2510. $indicator.velocity({ "left": calcLeftPos($active) }, { duration: transition, queue: false, easing: 'easeOutQuad', delay: 90 });
  2511. } else {
  2512. $indicator.velocity({ "left": calcLeftPos($active) }, { duration: transition, queue: false, easing: 'easeOutQuad' });
  2513. $indicator.velocity({ "right": calcRightPos($active) }, { duration: transition, queue: false, easing: 'easeOutQuad', delay: 90 });
  2514. }
  2515. };
  2516. // Change swipeable according to responsive threshold
  2517. if (options.swipeable) {
  2518. if (window_width > options.responsiveThreshold) {
  2519. options.swipeable = false;
  2520. }
  2521. }
  2522. // If the location.hash matches one of the links, use that as the active tab.
  2523. $active = $($links.filter('[href="' + location.hash + '"]'));
  2524. // If no match is found, use the first link or any with class 'active' as the initial active tab.
  2525. if ($active.length === 0) {
  2526. $active = $(this).find('li.tab a.active').first();
  2527. }
  2528. if ($active.length === 0) {
  2529. $active = $(this).find('li.tab a').first();
  2530. }
  2531. $active.addClass('active');
  2532. index = $links.index($active);
  2533. if (index < 0) {
  2534. index = 0;
  2535. }
  2536. if ($active[0] !== undefined) {
  2537. $content = $($active[0].hash);
  2538. $content.addClass('active');
  2539. }
  2540. // append indicator then set indicator width to tab width
  2541. if (!$this.find('.indicator').length) {
  2542. $this.append('<li class="indicator"></li>');
  2543. }
  2544. $indicator = $this.find('.indicator');
  2545. // we make sure that the indicator is at the end of the tabs
  2546. $this.append($indicator);
  2547. if ($this.is(":visible")) {
  2548. // $indicator.css({"right": $tabs_width - ((index + 1) * $tab_width)});
  2549. // $indicator.css({"left": index * $tab_width});
  2550. setTimeout(function () {
  2551. $indicator.css({ "right": calcRightPos($active) });
  2552. $indicator.css({ "left": calcLeftPos($active) });
  2553. }, 0);
  2554. }
  2555. $(window).off('resize.tabs-' + uniqueNamespace).on('resize.tabs-' + uniqueNamespace, function () {
  2556. $tabs_width = $this.width();
  2557. $tab_width = Math.max($tabs_width, $this[0].scrollWidth) / $links.length;
  2558. if (index < 0) {
  2559. index = 0;
  2560. }
  2561. if ($tab_width !== 0 && $tabs_width !== 0) {
  2562. $indicator.css({ "right": calcRightPos($active) });
  2563. $indicator.css({ "left": calcLeftPos($active) });
  2564. }
  2565. });
  2566. // Initialize Tabs Content.
  2567. if (options.swipeable) {
  2568. // TODO: Duplicate calls with swipeable? handle multiple div wrapping.
  2569. $links.each(function () {
  2570. var $curr_content = $(Materialize.escapeHash(this.hash));
  2571. $curr_content.addClass('carousel-item');
  2572. $tabs_content = $tabs_content.add($curr_content);
  2573. });
  2574. $tabs_wrapper = $tabs_content.wrapAll('<div class="tabs-content carousel"></div>');
  2575. $tabs_content.css('display', '');
  2576. $('.tabs-content.carousel').carousel({
  2577. fullWidth: true,
  2578. noWrap: true,
  2579. onCycleTo: function (item) {
  2580. if (!clicked) {
  2581. var prev_index = index;
  2582. index = $tabs_wrapper.index(item);
  2583. $active.removeClass('active');
  2584. $active = $links.eq(index);
  2585. $active.addClass('active');
  2586. animateIndicator(prev_index);
  2587. if (typeof options.onShow === "function") {
  2588. options.onShow.call($this[0], $content);
  2589. }
  2590. }
  2591. }
  2592. });
  2593. } else {
  2594. // Hide the remaining content
  2595. $links.not($active).each(function () {
  2596. $(Materialize.escapeHash(this.hash)).hide();
  2597. });
  2598. }
  2599. // Bind the click event handler
  2600. $this.off('click.tabs').on('click.tabs', 'a', function (e) {
  2601. if ($(this).parent().hasClass('disabled')) {
  2602. e.preventDefault();
  2603. return;
  2604. }
  2605. // Act as regular link if target attribute is specified.
  2606. if (!!$(this).attr("target")) {
  2607. return;
  2608. }
  2609. clicked = true;
  2610. $tabs_width = $this.width();
  2611. $tab_width = Math.max($tabs_width, $this[0].scrollWidth) / $links.length;
  2612. // Make the old tab inactive.
  2613. $active.removeClass('active');
  2614. var $oldContent = $content;
  2615. // Update the variables with the new link and content
  2616. $active = $(this);
  2617. $content = $(Materialize.escapeHash(this.hash));
  2618. $links = $this.find('li.tab a');
  2619. var activeRect = $active.position();
  2620. // Make the tab active.
  2621. $active.addClass('active');
  2622. prev_index = index;
  2623. index = $links.index($(this));
  2624. if (index < 0) {
  2625. index = 0;
  2626. }
  2627. // Change url to current tab
  2628. // window.location.hash = $active.attr('href');
  2629. // Swap content
  2630. if (options.swipeable) {
  2631. if ($tabs_content.length) {
  2632. $tabs_content.carousel('set', index, function () {
  2633. if (typeof options.onShow === "function") {
  2634. options.onShow.call($this[0], $content);
  2635. }
  2636. });
  2637. }
  2638. } else {
  2639. if ($content !== undefined) {
  2640. $content.show();
  2641. $content.addClass('active');
  2642. if (typeof options.onShow === "function") {
  2643. options.onShow.call(this, $content);
  2644. }
  2645. }
  2646. if ($oldContent !== undefined && !$oldContent.is($content)) {
  2647. $oldContent.hide();
  2648. $oldContent.removeClass('active');
  2649. }
  2650. }
  2651. // Reset clicked state
  2652. clickedTimeout = setTimeout(function () {
  2653. clicked = false;
  2654. }, transition);
  2655. // Update indicator
  2656. animateIndicator(prev_index);
  2657. // Prevent the anchor's default click action
  2658. e.preventDefault();
  2659. });
  2660. });
  2661. },
  2662. select_tab: function (id) {
  2663. this.find('a[href="#' + id + '"]').trigger('click');
  2664. }
  2665. };
  2666. $.fn.tabs = function (methodOrOptions) {
  2667. if (methods[methodOrOptions]) {
  2668. return methods[methodOrOptions].apply(this, Array.prototype.slice.call(arguments, 1));
  2669. } else if (typeof methodOrOptions === 'object' || !methodOrOptions) {
  2670. // Default to "init"
  2671. return methods.init.apply(this, arguments);
  2672. } else {
  2673. $.error('Method ' + methodOrOptions + ' does not exist on jQuery.tabs');
  2674. }
  2675. };
  2676. $(document).ready(function () {
  2677. $('ul.tabs').tabs();
  2678. });
  2679. })(jQuery);
  2680. ; (function ($) {
  2681. $.fn.tooltip = function (options) {
  2682. var timeout = null,
  2683. margin = 5;
  2684. // Defaults
  2685. var defaults = {
  2686. delay: 350,
  2687. tooltip: '',
  2688. position: 'bottom',
  2689. html: false
  2690. };
  2691. // Remove tooltip from the activator
  2692. if (options === "remove") {
  2693. this.each(function () {
  2694. $('#' + $(this).attr('data-tooltip-id')).remove();
  2695. $(this).removeAttr('data-tooltip-id');
  2696. $(this).off('mouseenter.tooltip mouseleave.tooltip');
  2697. });
  2698. return false;
  2699. }
  2700. options = $.extend(defaults, options);
  2701. return this.each(function () {
  2702. var tooltipId = Materialize.guid();
  2703. var origin = $(this);
  2704. // Destroy old tooltip
  2705. if (origin.attr('data-tooltip-id')) {
  2706. $('#' + origin.attr('data-tooltip-id')).remove();
  2707. }
  2708. origin.attr('data-tooltip-id', tooltipId);
  2709. // Get attributes.
  2710. var allowHtml, tooltipDelay, tooltipPosition, tooltipText, tooltipEl, backdrop;
  2711. var setAttributes = function () {
  2712. allowHtml = origin.attr('data-html') ? origin.attr('data-html') === 'true' : options.html;
  2713. tooltipDelay = origin.attr('data-delay');
  2714. tooltipDelay = tooltipDelay === undefined || tooltipDelay === '' ? options.delay : tooltipDelay;
  2715. tooltipPosition = origin.attr('data-position');
  2716. tooltipPosition = tooltipPosition === undefined || tooltipPosition === '' ? options.position : tooltipPosition;
  2717. tooltipText = origin.attr('data-tooltip');
  2718. tooltipText = tooltipText === undefined || tooltipText === '' ? options.tooltip : tooltipText;
  2719. };
  2720. setAttributes();
  2721. var renderTooltipEl = function () {
  2722. var tooltip = $('<div class="material-tooltip"></div>');
  2723. // Create Text span
  2724. if (allowHtml) {
  2725. tooltipText = $('<span></span>').html(tooltipText);
  2726. } else {
  2727. tooltipText = $('<span></span>').text(tooltipText);
  2728. }
  2729. // Create tooltip
  2730. tooltip.append(tooltipText).appendTo($('body')).attr('id', tooltipId);
  2731. // Create backdrop
  2732. backdrop = $('<div class="backdrop"></div>');
  2733. backdrop.appendTo(tooltip);
  2734. return tooltip;
  2735. };
  2736. tooltipEl = renderTooltipEl();
  2737. // Destroy previously binded events
  2738. origin.off('mouseenter.tooltip mouseleave.tooltip');
  2739. // Mouse In
  2740. var started = false,
  2741. timeoutRef;
  2742. origin.on({
  2743. 'mouseenter.tooltip': function (e) {
  2744. var showTooltip = function () {
  2745. setAttributes();
  2746. started = true;
  2747. tooltipEl.velocity('stop');
  2748. backdrop.velocity('stop');
  2749. tooltipEl.css({ visibility: 'visible', left: '0px', top: '0px' });
  2750. // Tooltip positioning
  2751. var originWidth = origin.outerWidth();
  2752. var originHeight = origin.outerHeight();
  2753. var tooltipHeight = tooltipEl.outerHeight();
  2754. var tooltipWidth = tooltipEl.outerWidth();
  2755. var tooltipVerticalMovement = '0px';
  2756. var tooltipHorizontalMovement = '0px';
  2757. var backdropOffsetWidth = backdrop[0].offsetWidth;
  2758. var backdropOffsetHeight = backdrop[0].offsetHeight;
  2759. var scaleXFactor = 8;
  2760. var scaleYFactor = 8;
  2761. var scaleFactor = 0;
  2762. var targetTop, targetLeft, newCoordinates;
  2763. if (tooltipPosition === "top") {
  2764. // Top Position
  2765. targetTop = origin.offset().top - tooltipHeight - margin;
  2766. targetLeft = origin.offset().left + originWidth / 2 - tooltipWidth / 2;
  2767. newCoordinates = repositionWithinScreen(targetLeft, targetTop, tooltipWidth, tooltipHeight);
  2768. tooltipVerticalMovement = '-10px';
  2769. backdrop.css({
  2770. bottom: 0,
  2771. left: 0,
  2772. borderRadius: '14px 14px 0 0',
  2773. transformOrigin: '50% 100%',
  2774. marginTop: tooltipHeight,
  2775. marginLeft: tooltipWidth / 2 - backdropOffsetWidth / 2
  2776. });
  2777. }
  2778. // Left Position
  2779. else if (tooltipPosition === "left") {
  2780. targetTop = origin.offset().top + originHeight / 2 - tooltipHeight / 2;
  2781. targetLeft = origin.offset().left - tooltipWidth - margin;
  2782. newCoordinates = repositionWithinScreen(targetLeft, targetTop, tooltipWidth, tooltipHeight);
  2783. tooltipHorizontalMovement = '-10px';
  2784. backdrop.css({
  2785. top: '-7px',
  2786. right: 0,
  2787. width: '14px',
  2788. height: '14px',
  2789. borderRadius: '14px 0 0 14px',
  2790. transformOrigin: '95% 50%',
  2791. marginTop: tooltipHeight / 2,
  2792. marginLeft: tooltipWidth
  2793. });
  2794. }
  2795. // Right Position
  2796. else if (tooltipPosition === "right") {
  2797. targetTop = origin.offset().top + originHeight / 2 - tooltipHeight / 2;
  2798. targetLeft = origin.offset().left + originWidth + margin;
  2799. newCoordinates = repositionWithinScreen(targetLeft, targetTop, tooltipWidth, tooltipHeight);
  2800. tooltipHorizontalMovement = '+10px';
  2801. backdrop.css({
  2802. top: '-7px',
  2803. left: 0,
  2804. width: '14px',
  2805. height: '14px',
  2806. borderRadius: '0 14px 14px 0',
  2807. transformOrigin: '5% 50%',
  2808. marginTop: tooltipHeight / 2,
  2809. marginLeft: '0px'
  2810. });
  2811. } else {
  2812. // Bottom Position
  2813. targetTop = origin.offset().top + origin.outerHeight() + margin;
  2814. targetLeft = origin.offset().left + originWidth / 2 - tooltipWidth / 2;
  2815. newCoordinates = repositionWithinScreen(targetLeft, targetTop, tooltipWidth, tooltipHeight);
  2816. tooltipVerticalMovement = '+10px';
  2817. backdrop.css({
  2818. top: 0,
  2819. left: 0,
  2820. marginLeft: tooltipWidth / 2 - backdropOffsetWidth / 2
  2821. });
  2822. }
  2823. // Set tooptip css placement
  2824. tooltipEl.css({
  2825. top: newCoordinates.y,
  2826. left: newCoordinates.x
  2827. });
  2828. // Calculate Scale to fill
  2829. scaleXFactor = Math.SQRT2 * tooltipWidth / parseInt(backdropOffsetWidth);
  2830. scaleYFactor = Math.SQRT2 * tooltipHeight / parseInt(backdropOffsetHeight);
  2831. scaleFactor = Math.max(scaleXFactor, scaleYFactor);
  2832. tooltipEl.velocity({ translateY: tooltipVerticalMovement, translateX: tooltipHorizontalMovement }, { duration: 350, queue: false }).velocity({ opacity: 1 }, { duration: 300, delay: 50, queue: false });
  2833. backdrop.css({ visibility: 'visible' }).velocity({ opacity: 1 }, { duration: 55, delay: 0, queue: false }).velocity({ scaleX: scaleFactor, scaleY: scaleFactor }, { duration: 300, delay: 0, queue: false, easing: 'easeInOutQuad' });
  2834. };
  2835. timeoutRef = setTimeout(showTooltip, tooltipDelay); // End Interval
  2836. // Mouse Out
  2837. },
  2838. 'mouseleave.tooltip': function () {
  2839. // Reset State
  2840. started = false;
  2841. clearTimeout(timeoutRef);
  2842. // Animate back
  2843. setTimeout(function () {
  2844. if (started !== true) {
  2845. tooltipEl.velocity({
  2846. opacity: 0, translateY: 0, translateX: 0
  2847. }, { duration: 225, queue: false });
  2848. backdrop.velocity({ opacity: 0, scaleX: 1, scaleY: 1 }, {
  2849. duration: 225,
  2850. queue: false,
  2851. complete: function () {
  2852. backdrop.css({ visibility: 'hidden' });
  2853. tooltipEl.css({ visibility: 'hidden' });
  2854. started = false;
  2855. }
  2856. });
  2857. }
  2858. }, 225);
  2859. }
  2860. });
  2861. });
  2862. };
  2863. var repositionWithinScreen = function (x, y, width, height) {
  2864. var newX = x;
  2865. var newY = y;
  2866. if (newX < 0) {
  2867. newX = 4;
  2868. } else if (newX + width > window.innerWidth) {
  2869. newX -= newX + width - window.innerWidth;
  2870. }
  2871. if (newY < 0) {
  2872. newY = 4;
  2873. } else if (newY + height > window.innerHeight + $(window).scrollTop) {
  2874. newY -= newY + height - window.innerHeight;
  2875. }
  2876. return { x: newX, y: newY };
  2877. };
  2878. $(document).ready(function () {
  2879. $('.tooltipped').tooltip();
  2880. });
  2881. })(jQuery);
  2882. ; /*!
  2883. * Waves v0.6.4
  2884. * http://fian.my.id/Waves
  2885. *
  2886. * Copyright 2014 Alfiana E. Sibuea and other contributors
  2887. * Released under the MIT license
  2888. * https://github.com/fians/Waves/blob/master/LICENSE
  2889. */
  2890. ; (function (window) {
  2891. 'use strict';
  2892. var Waves = Waves || {};
  2893. var $$ = document.querySelectorAll.bind(document);
  2894. // Find exact position of element
  2895. function isWindow(obj) {
  2896. return obj !== null && obj === obj.window;
  2897. }
  2898. function getWindow(elem) {
  2899. return isWindow(elem) ? elem : elem.nodeType === 9 && elem.defaultView;
  2900. }
  2901. function offset(elem) {
  2902. var docElem,
  2903. win,
  2904. box = { top: 0, left: 0 },
  2905. doc = elem && elem.ownerDocument;
  2906. docElem = doc.documentElement;
  2907. if (typeof elem.getBoundingClientRect !== typeof undefined) {
  2908. box = elem.getBoundingClientRect();
  2909. }
  2910. win = getWindow(doc);
  2911. return {
  2912. top: box.top + win.pageYOffset - docElem.clientTop,
  2913. left: box.left + win.pageXOffset - docElem.clientLeft
  2914. };
  2915. }
  2916. function convertStyle(obj) {
  2917. var style = '';
  2918. for (var a in obj) {
  2919. if (obj.hasOwnProperty(a)) {
  2920. style += a + ':' + obj[a] + ';';
  2921. }
  2922. }
  2923. return style;
  2924. }
  2925. var Effect = {
  2926. // Effect delay
  2927. duration: 750,
  2928. show: function (e, element) {
  2929. if ($('.waves-ripple')[0]) {
  2930. $('.waves-ripple')[0].remove();
  2931. }
  2932. // Disable right click
  2933. if (e.button === 2) {
  2934. return false;
  2935. }
  2936. var el = element || this;
  2937. // Create ripple
  2938. var ripple = document.createElement('div');
  2939. ripple.className = 'waves-ripple';
  2940. el.appendChild(ripple);
  2941. // Get click coordinate and element witdh
  2942. var pos = offset(el);
  2943. var relativeY = e.pageY - pos.top;
  2944. var relativeX = e.pageX - pos.left;
  2945. var scale = 'scale(' + el.clientWidth / 100 * 10 + ')';
  2946. // Support for touch devices
  2947. if ('touches' in e) {
  2948. relativeY = e.touches[0].pageY - pos.top;
  2949. relativeX = e.touches[0].pageX - pos.left;
  2950. }
  2951. // Attach data to element
  2952. ripple.setAttribute('data-hold', Date.now());
  2953. ripple.setAttribute('data-scale', scale);
  2954. ripple.setAttribute('data-x', relativeX);
  2955. ripple.setAttribute('data-y', relativeY);
  2956. // Set ripple position
  2957. var rippleStyle = {
  2958. 'top': relativeY + 'px',
  2959. 'left': relativeX + 'px'
  2960. };
  2961. ripple.className = ripple.className + ' waves-notransition';
  2962. ripple.setAttribute('style', convertStyle(rippleStyle));
  2963. ripple.className = ripple.className.replace('waves-notransition', '');
  2964. // Scale the ripple
  2965. rippleStyle['-webkit-transform'] = scale;
  2966. rippleStyle['-moz-transform'] = scale;
  2967. rippleStyle['-ms-transform'] = scale;
  2968. rippleStyle['-o-transform'] = scale;
  2969. rippleStyle.transform = scale;
  2970. rippleStyle.opacity = '1';
  2971. rippleStyle['-webkit-transition-duration'] = Effect.duration + 'ms';
  2972. rippleStyle['-moz-transition-duration'] = Effect.duration + 'ms';
  2973. rippleStyle['-o-transition-duration'] = Effect.duration + 'ms';
  2974. rippleStyle['transition-duration'] = Effect.duration + 'ms';
  2975. rippleStyle['-webkit-transition-timing-function'] = 'cubic-bezier(0.250, 0.460, 0.450, 0.940)';
  2976. rippleStyle['-moz-transition-timing-function'] = 'cubic-bezier(0.250, 0.460, 0.450, 0.940)';
  2977. rippleStyle['-o-transition-timing-function'] = 'cubic-bezier(0.250, 0.460, 0.450, 0.940)';
  2978. rippleStyle['transition-timing-function'] = 'cubic-bezier(0.250, 0.460, 0.450, 0.940)';
  2979. ripple.setAttribute('style', convertStyle(rippleStyle));
  2980. },
  2981. hide: function (e) {
  2982. TouchHandler.touchup(e);
  2983. var el = this;
  2984. var width = el.clientWidth * 1.4;
  2985. // Get first ripple
  2986. var ripple = null;
  2987. var ripples = el.getElementsByClassName('waves-ripple');
  2988. if (ripples.length > 0) {
  2989. ripple = ripples[ripples.length - 1];
  2990. ripples[1] ? ripples[1].remove() : '';
  2991. } else {
  2992. return false;
  2993. }
  2994. var relativeX = ripple.getAttribute('data-x');
  2995. var relativeY = ripple.getAttribute('data-y');
  2996. var scale = ripple.getAttribute('data-scale');
  2997. // Get delay beetween mousedown and mouse leave
  2998. var diff = Date.now() - Number(ripple.getAttribute('data-hold'));
  2999. var delay = 350 - diff;
  3000. if (delay < 0) {
  3001. delay = 0;
  3002. }
  3003. // Fade out ripple after delay
  3004. setTimeout(function () {
  3005. var style = {
  3006. 'top': relativeY + 'px',
  3007. 'left': relativeX + 'px',
  3008. 'opacity': '0',
  3009. // Duration
  3010. '-webkit-transition-duration': Effect.duration + 'ms',
  3011. '-moz-transition-duration': Effect.duration + 'ms',
  3012. '-o-transition-duration': Effect.duration + 'ms',
  3013. 'transition-duration': Effect.duration + 'ms',
  3014. '-webkit-transform': scale,
  3015. '-moz-transform': scale,
  3016. '-ms-transform': scale,
  3017. '-o-transform': scale,
  3018. 'transform': scale
  3019. };
  3020. ripple.setAttribute('style', convertStyle(style));
  3021. setTimeout(function () {
  3022. try {
  3023. el.removeChild(ripple);
  3024. } catch (e) {
  3025. return false;
  3026. }
  3027. }, Effect.duration);
  3028. }, delay);
  3029. },
  3030. // Little hack to make <input> can perform waves effect
  3031. wrapInput: function (elements) {
  3032. for (var a = 0; a < elements.length; a++) {
  3033. var el = elements[a];
  3034. if (el.tagName.toLowerCase() === 'input') {
  3035. var parent = el.parentNode;
  3036. // If input already have parent just pass through
  3037. if (parent.tagName.toLowerCase() === 'i' && parent.className.indexOf('waves-effect') !== -1) {
  3038. continue;
  3039. }
  3040. // Put element class and style to the specified parent
  3041. var wrapper = document.createElement('i');
  3042. wrapper.className = el.className + ' waves-input-wrapper';
  3043. var elementStyle = el.getAttribute('style');
  3044. if (!elementStyle) {
  3045. elementStyle = '';
  3046. }
  3047. wrapper.setAttribute('style', elementStyle);
  3048. el.className = 'waves-button-input';
  3049. el.removeAttribute('style');
  3050. // Put element as child
  3051. parent.replaceChild(wrapper, el);
  3052. wrapper.appendChild(el);
  3053. }
  3054. }
  3055. }
  3056. };
  3057. /**
  3058. * Disable mousedown event for 500ms during and after touch
  3059. */
  3060. var TouchHandler = {
  3061. /* uses an integer rather than bool so there's no issues with
  3062. * needing to clear timeouts if another touch event occurred
  3063. * within the 500ms. Cannot mouseup between touchstart and
  3064. * touchend, nor in the 500ms after touchend. */
  3065. touches: 0,
  3066. allowEvent: function (e) {
  3067. var allow = true;
  3068. if (e.type === 'touchstart') {
  3069. TouchHandler.touches += 1; //push
  3070. } else if (e.type === 'touchend' || e.type === 'touchcancel') {
  3071. setTimeout(function () {
  3072. if (TouchHandler.touches > 0) {
  3073. TouchHandler.touches -= 1; //pop after 500ms
  3074. }
  3075. }, 500);
  3076. } else if (e.type === 'mousedown' && TouchHandler.touches > 0) {
  3077. allow = false;
  3078. }
  3079. return allow;
  3080. },
  3081. touchup: function (e) {
  3082. TouchHandler.allowEvent(e);
  3083. }
  3084. };
  3085. /**
  3086. * Delegated click handler for .waves-effect element.
  3087. * returns null when .waves-effect element not in "click tree"
  3088. */
  3089. function getWavesEffectElement(e) {
  3090. if (TouchHandler.allowEvent(e) === false) {
  3091. return null;
  3092. }
  3093. var element = null;
  3094. var target = e.target || e.srcElement;
  3095. while (target.parentNode !== null) {
  3096. if (!(target instanceof SVGElement) && target.className.indexOf('waves-effect') !== -1) {
  3097. element = target;
  3098. break;
  3099. }
  3100. target = target.parentNode;
  3101. }
  3102. return element;
  3103. }
  3104. /**
  3105. * Bubble the click and show effect if .waves-effect elem was found
  3106. */
  3107. function showEffect(e) {
  3108. var element = getWavesEffectElement(e);
  3109. if (element !== null) {
  3110. Effect.show(e, element);
  3111. if ('ontouchstart' in window) {
  3112. element.addEventListener('touchend', Effect.hide, false);
  3113. element.addEventListener('touchcancel', Effect.hide, false);
  3114. }
  3115. element.addEventListener('mouseup', Effect.hide, false);
  3116. element.addEventListener('mouseleave', Effect.hide, false);
  3117. element.addEventListener('dragend', Effect.hide, false);
  3118. }
  3119. }
  3120. Waves.displayEffect = function (options) {
  3121. options = options || {};
  3122. if ('duration' in options) {
  3123. Effect.duration = options.duration;
  3124. }
  3125. //Wrap input inside <i> tag
  3126. Effect.wrapInput($$('.waves-effect'));
  3127. if ('ontouchstart' in window) {
  3128. document.body.addEventListener('touchstart', showEffect, false);
  3129. }
  3130. document.body.addEventListener('mousedown', showEffect, false);
  3131. };
  3132. /**
  3133. * Attach Waves to an input element (or any element which doesn't
  3134. * bubble mouseup/mousedown events).
  3135. * Intended to be used with dynamically loaded forms/inputs, or
  3136. * where the user doesn't want a delegated click handler.
  3137. */
  3138. Waves.attach = function (element) {
  3139. //FUTURE: automatically add waves classes and allow users
  3140. // to specify them with an options param? Eg. light/classic/button
  3141. if (element.tagName.toLowerCase() === 'input') {
  3142. Effect.wrapInput([element]);
  3143. element = element.parentNode;
  3144. }
  3145. if ('ontouchstart' in window) {
  3146. element.addEventListener('touchstart', showEffect, false);
  3147. }
  3148. element.addEventListener('mousedown', showEffect, false);
  3149. };
  3150. window.Waves = Waves;
  3151. document.addEventListener('DOMContentLoaded', function () {
  3152. Waves.displayEffect();
  3153. }, false);
  3154. })(window);
  3155. ; (function ($, Vel) {
  3156. 'use strict';
  3157. var _defaults = {
  3158. displayLength: Infinity,
  3159. inDuration: 300,
  3160. outDuration: 375,
  3161. className: undefined,
  3162. completeCallback: undefined,
  3163. activationPercent: 0.8
  3164. };
  3165. var Toast = function () {
  3166. function Toast(message, displayLength, className, completeCallback) {
  3167. _classCallCheck(this, Toast);
  3168. if (!message) {
  3169. return;
  3170. }
  3171. /**
  3172. * Options for the toast
  3173. * @member Toast#options
  3174. */
  3175. this.options = {
  3176. displayLength: displayLength,
  3177. className: className,
  3178. completeCallback: completeCallback
  3179. };
  3180. this.options = $.extend({}, Toast.defaults, this.options);
  3181. this.message = message;
  3182. /**
  3183. * Describes current pan state toast
  3184. * @type {Boolean}
  3185. */
  3186. this.panning = false;
  3187. /**
  3188. * Time remaining until toast is removed
  3189. */
  3190. this.timeRemaining = this.options.displayLength;
  3191. if (Toast._toasts.length === 0) {
  3192. Toast._createContainer();
  3193. }
  3194. // Create new toast
  3195. Toast._toasts.push(this);
  3196. var toastElement = this.createToast();
  3197. toastElement.M_Toast = this;
  3198. this.el = toastElement;
  3199. this._animateIn();
  3200. this.setTimer();
  3201. }
  3202. _createClass(Toast, [{
  3203. key: 'createToast',
  3204. /**
  3205. * Create toast and append it to toast container
  3206. */
  3207. value: function createToast() {
  3208. var toast = document.createElement('div');
  3209. toast.classList.add('toast');
  3210. // Add custom classes onto toast
  3211. if (this.options.className) {
  3212. var classes = this.options.className.split(' ');
  3213. var i = void 0,
  3214. count = void 0;
  3215. for (i = 0, count = classes.length; i < count; i++) {
  3216. toast.classList.add(classes[i]);
  3217. }
  3218. }
  3219. // Set content
  3220. 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') {
  3221. toast.appendChild(this.message);
  3222. // Check if it is jQuery object
  3223. } else if (this.message instanceof jQuery) {
  3224. $(toast).append(this.message);
  3225. // Insert as text;
  3226. } else {
  3227. toast.innerHTML = this.message;
  3228. }
  3229. // Append toasft
  3230. Toast._container.appendChild(toast);
  3231. return toast;
  3232. }
  3233. /**
  3234. * Animate in toast
  3235. */
  3236. }, {
  3237. key: '_animateIn',
  3238. value: function _animateIn() {
  3239. // Animate toast in
  3240. Vel(this.el, { top: 0, opacity: 1 }, {
  3241. duration: 300,
  3242. easing: 'easeOutCubic',
  3243. queue: false
  3244. });
  3245. }
  3246. /**
  3247. * Create setInterval which automatically removes toast when timeRemaining >= 0
  3248. * has been reached
  3249. */
  3250. }, {
  3251. key: 'setTimer',
  3252. value: function setTimer() {
  3253. var _this3 = this;
  3254. if (this.timeRemaining !== Infinity) {
  3255. this.counterInterval = setInterval(function () {
  3256. // If toast is not being dragged, decrease its time remaining
  3257. if (!_this3.panning) {
  3258. _this3.timeRemaining -= 20;
  3259. }
  3260. // Animate toast out
  3261. if (_this3.timeRemaining <= 0) {
  3262. _this3.remove();
  3263. }
  3264. }, 20);
  3265. }
  3266. }
  3267. /**
  3268. * Dismiss toast with animation
  3269. */
  3270. }, {
  3271. key: 'remove',
  3272. value: function remove() {
  3273. var _this4 = this;
  3274. window.clearInterval(this.counterInterval);
  3275. var activationDistance = this.el.offsetWidth * this.options.activationPercent;
  3276. if (this.wasSwiped) {
  3277. this.el.style.transition = 'transform .05s, opacity .05s';
  3278. this.el.style.transform = 'translateX(' + activationDistance + 'px)';
  3279. this.el.style.opacity = 0;
  3280. }
  3281. Vel(this.el, { opacity: 0, marginTop: '-40px' }, {
  3282. duration: this.options.outDuration,
  3283. easing: 'easeOutExpo',
  3284. queue: false,
  3285. complete: function () {
  3286. // Call the optional callback
  3287. if (typeof _this4.options.completeCallback === 'function') {
  3288. _this4.options.completeCallback();
  3289. }
  3290. // Remove toast from DOM
  3291. _this4.el.parentNode.removeChild(_this4.el);
  3292. Toast._toasts.splice(Toast._toasts.indexOf(_this4), 1);
  3293. if (Toast._toasts.length === 0) {
  3294. Toast._removeContainer();
  3295. }
  3296. }
  3297. });
  3298. }
  3299. }], [{
  3300. key: '_createContainer',
  3301. /**
  3302. * Append toast container and add event handlers
  3303. */
  3304. value: function _createContainer() {
  3305. var container = document.createElement('div');
  3306. container.setAttribute('id', 'toast-container');
  3307. // Add event handler
  3308. container.addEventListener('touchstart', Toast._onDragStart);
  3309. container.addEventListener('touchmove', Toast._onDragMove);
  3310. container.addEventListener('touchend', Toast._onDragEnd);
  3311. container.addEventListener('mousedown', Toast._onDragStart);
  3312. document.addEventListener('mousemove', Toast._onDragMove);
  3313. document.addEventListener('mouseup', Toast._onDragEnd);
  3314. document.body.appendChild(container);
  3315. Toast._container = container;
  3316. }
  3317. /**
  3318. * Remove toast container and event handlers
  3319. */
  3320. }, {
  3321. key: '_removeContainer',
  3322. value: function _removeContainer() {
  3323. // Add event handler
  3324. document.removeEventListener('mousemove', Toast._onDragMove);
  3325. document.removeEventListener('mouseup', Toast._onDragEnd);
  3326. Toast._container.parentNode.removeChild(Toast._container);
  3327. Toast._container = null;
  3328. }
  3329. /**
  3330. * Begin drag handler
  3331. * @param {Event} e
  3332. */
  3333. }, {
  3334. key: '_onDragStart',
  3335. value: function _onDragStart(e) {
  3336. if (e.target && $(e.target).closest('.toast').length) {
  3337. var $toast = $(e.target).closest('.toast');
  3338. var toast = $toast[0].M_Toast;
  3339. toast.panning = true;
  3340. Toast._draggedToast = toast;
  3341. toast.el.classList.add('panning');
  3342. toast.el.style.transition = '';
  3343. toast.startingXPos = Toast._xPos(e);
  3344. toast.time = Date.now();
  3345. toast.xPos = Toast._xPos(e);
  3346. }
  3347. }
  3348. /**
  3349. * Drag move handler
  3350. * @param {Event} e
  3351. */
  3352. }, {
  3353. key: '_onDragMove',
  3354. value: function _onDragMove(e) {
  3355. if (!!Toast._draggedToast) {
  3356. e.preventDefault();
  3357. var toast = Toast._draggedToast;
  3358. toast.deltaX = Math.abs(toast.xPos - Toast._xPos(e));
  3359. toast.xPos = Toast._xPos(e);
  3360. toast.velocityX = toast.deltaX / (Date.now() - toast.time);
  3361. toast.time = Date.now();
  3362. var totalDeltaX = toast.xPos - toast.startingXPos;
  3363. var activationDistance = toast.el.offsetWidth * toast.options.activationPercent;
  3364. toast.el.style.transform = 'translateX(' + totalDeltaX + 'px)';
  3365. toast.el.style.opacity = 1 - Math.abs(totalDeltaX / activationDistance);
  3366. }
  3367. }
  3368. /**
  3369. * End drag handler
  3370. * @param {Event} e
  3371. */
  3372. }, {
  3373. key: '_onDragEnd',
  3374. value: function _onDragEnd(e) {
  3375. if (!!Toast._draggedToast) {
  3376. var toast = Toast._draggedToast;
  3377. toast.panning = false;
  3378. toast.el.classList.remove('panning');
  3379. var totalDeltaX = toast.xPos - toast.startingXPos;
  3380. var activationDistance = toast.el.offsetWidth * toast.options.activationPercent;
  3381. var shouldBeDismissed = Math.abs(totalDeltaX) > activationDistance || toast.velocityX > 1;
  3382. // Remove toast
  3383. if (shouldBeDismissed) {
  3384. toast.wasSwiped = true;
  3385. toast.remove();
  3386. // Animate toast back to original position
  3387. } else {
  3388. toast.el.style.transition = 'transform .2s, opacity .2s';
  3389. toast.el.style.transform = '';
  3390. toast.el.style.opacity = '';
  3391. }
  3392. Toast._draggedToast = null;
  3393. }
  3394. }
  3395. /**
  3396. * Get x position of mouse or touch event
  3397. * @param {Event} e
  3398. */
  3399. }, {
  3400. key: '_xPos',
  3401. value: function _xPos(e) {
  3402. if (e.targetTouches && e.targetTouches.length >= 1) {
  3403. return e.targetTouches[0].clientX;
  3404. }
  3405. // mouse event
  3406. return e.clientX;
  3407. }
  3408. /**
  3409. * Remove all toasts
  3410. */
  3411. }, {
  3412. key: 'removeAll',
  3413. value: function removeAll() {
  3414. for (var toastIndex in Toast._toasts) {
  3415. Toast._toasts[toastIndex].remove();
  3416. }
  3417. }
  3418. }, {
  3419. key: 'defaults',
  3420. get: function () {
  3421. return _defaults;
  3422. }
  3423. }]);
  3424. return Toast;
  3425. }();
  3426. /**
  3427. * @static
  3428. * @memberof Toast
  3429. * @type {Array.<Toast>}
  3430. */
  3431. Toast._toasts = [];
  3432. /**
  3433. * @static
  3434. * @memberof Toast
  3435. */
  3436. Toast._container = null;
  3437. /**
  3438. * @static
  3439. * @memberof Toast
  3440. * @type {Toast}
  3441. */
  3442. Toast._draggedToast = null;
  3443. Materialize.Toast = Toast;
  3444. Materialize.toast = function (message, displayLength, className, completeCallback) {
  3445. return new Toast(message, displayLength, className, completeCallback);
  3446. };
  3447. })(jQuery, Materialize.Vel);
  3448. ; (function ($) {
  3449. var methods = {
  3450. init: function (options) {
  3451. var defaults = {
  3452. menuWidth: 300,
  3453. edge: 'left',
  3454. closeOnClick: false,
  3455. draggable: true,
  3456. onOpen: null,
  3457. onClose: null
  3458. };
  3459. options = $.extend(defaults, options);
  3460. $(this).each(function () {
  3461. var $this = $(this);
  3462. var menuId = $this.attr('data-activates');
  3463. var menu = $("#" + menuId);
  3464. // Set to width
  3465. if (options.menuWidth != 300) {
  3466. menu.css('width', options.menuWidth);
  3467. }
  3468. // Add Touch Area
  3469. var $dragTarget = $('.drag-target[data-sidenav="' + menuId + '"]');
  3470. if (options.draggable) {
  3471. // Regenerate dragTarget
  3472. if ($dragTarget.length) {
  3473. $dragTarget.remove();
  3474. }
  3475. $dragTarget = $('<div class="drag-target"></div>').attr('data-sidenav', menuId);
  3476. $('body').append($dragTarget);
  3477. } else {
  3478. $dragTarget = $();
  3479. }
  3480. if (options.edge == 'left') {
  3481. menu.css('transform', 'translateX(-100%)');
  3482. $dragTarget.css({ 'left': 0 }); // Add Touch Area
  3483. } else {
  3484. menu.addClass('right-aligned') // Change text-alignment to right
  3485. .css('transform', 'translateX(100%)');
  3486. $dragTarget.css({ 'right': 0 }); // Add Touch Area
  3487. }
  3488. // If fixed sidenav, bring menu out
  3489. if (menu.hasClass('fixed')) {
  3490. if (window.innerWidth > 992) {
  3491. menu.css('transform', 'translateX(0)');
  3492. }
  3493. }
  3494. // Window resize to reset on large screens fixed
  3495. if (menu.hasClass('fixed')) {
  3496. $(window).resize(function () {
  3497. if (window.innerWidth > 992) {
  3498. // Close menu if window is resized bigger than 992 and user has fixed sidenav
  3499. if ($('#sidenav-overlay').length !== 0 && menuOut) {
  3500. removeMenu(true);
  3501. } else {
  3502. // menu.removeAttr('style');
  3503. menu.css('transform', 'translateX(0%)');
  3504. // menu.css('width', options.menuWidth);
  3505. }
  3506. } else if (menuOut === false) {
  3507. if (options.edge === 'left') {
  3508. menu.css('transform', 'translateX(-100%)');
  3509. } else {
  3510. menu.css('transform', 'translateX(100%)');
  3511. }
  3512. }
  3513. });
  3514. }
  3515. // if closeOnClick, then add close event for all a tags in side sideNav
  3516. if (options.closeOnClick === true) {
  3517. menu.on("click.itemclick", "a:not(.collapsible-header)", function () {
  3518. if (!(window.innerWidth > 992 && menu.hasClass('fixed'))) {
  3519. removeMenu();
  3520. }
  3521. });
  3522. }
  3523. var removeMenu = function (restoreNav) {
  3524. panning = false;
  3525. menuOut = false;
  3526. // Reenable scrolling
  3527. $('body').css({
  3528. overflow: '',
  3529. width: ''
  3530. });
  3531. $('#sidenav-overlay').velocity({ opacity: 0 }, {
  3532. duration: 200,
  3533. queue: false, easing: 'easeOutQuad',
  3534. complete: function () {
  3535. $(this).remove();
  3536. }
  3537. });
  3538. if (options.edge === 'left') {
  3539. // Reset phantom div
  3540. $dragTarget.css({ width: '', right: '', left: '0' });
  3541. menu.velocity({ 'translateX': '-100%' }, {
  3542. duration: 200,
  3543. queue: false,
  3544. easing: 'easeOutCubic',
  3545. complete: function () {
  3546. if (restoreNav === true) {
  3547. // Restore Fixed sidenav
  3548. menu.removeAttr('style');
  3549. menu.css('width', options.menuWidth);
  3550. }
  3551. }
  3552. });
  3553. } else {
  3554. // Reset phantom div
  3555. $dragTarget.css({ width: '', right: '0', left: '' });
  3556. menu.velocity({ 'translateX': '100%' }, {
  3557. duration: 200,
  3558. queue: false,
  3559. easing: 'easeOutCubic',
  3560. complete: function () {
  3561. if (restoreNav === true) {
  3562. // Restore Fixed sidenav
  3563. menu.removeAttr('style');
  3564. menu.css('width', options.menuWidth);
  3565. }
  3566. }
  3567. });
  3568. }
  3569. // Callback
  3570. if (typeof options.onClose === 'function') {
  3571. options.onClose.call(this, menu);
  3572. }
  3573. };
  3574. // Touch Event
  3575. var panning = false;
  3576. var menuOut = false;
  3577. if (options.draggable) {
  3578. $dragTarget.on('click', function () {
  3579. if (menuOut) {
  3580. removeMenu();
  3581. }
  3582. });
  3583. $dragTarget.hammer({
  3584. prevent_default: false
  3585. }).on('pan', function (e) {
  3586. if (e.gesture.pointerType == "touch") {
  3587. var direction = e.gesture.direction;
  3588. var x = e.gesture.center.x;
  3589. var y = e.gesture.center.y;
  3590. var velocityX = e.gesture.velocityX;
  3591. // Vertical scroll bugfix
  3592. if (x === 0 && y === 0) {
  3593. return;
  3594. }
  3595. // Disable Scrolling
  3596. var $body = $('body');
  3597. var $overlay = $('#sidenav-overlay');
  3598. var oldWidth = $body.innerWidth();
  3599. $body.css('overflow', 'hidden');
  3600. $body.width(oldWidth);
  3601. // If overlay does not exist, create one and if it is clicked, close menu
  3602. if ($overlay.length === 0) {
  3603. $overlay = $('<div id="sidenav-overlay"></div>');
  3604. $overlay.css('opacity', 0).click(function () {
  3605. removeMenu();
  3606. });
  3607. // Run 'onOpen' when sidenav is opened via touch/swipe if applicable
  3608. if (typeof options.onOpen === 'function') {
  3609. options.onOpen.call(this, menu);
  3610. }
  3611. $('body').append($overlay);
  3612. }
  3613. // Keep within boundaries
  3614. if (options.edge === 'left') {
  3615. if (x > options.menuWidth) {
  3616. x = options.menuWidth;
  3617. } else if (x < 0) {
  3618. x = 0;
  3619. }
  3620. }
  3621. if (options.edge === 'left') {
  3622. // Left Direction
  3623. if (x < options.menuWidth / 2) {
  3624. menuOut = false;
  3625. }
  3626. // Right Direction
  3627. else if (x >= options.menuWidth / 2) {
  3628. menuOut = true;
  3629. }
  3630. menu.css('transform', 'translateX(' + (x - options.menuWidth) + 'px)');
  3631. } else {
  3632. // Left Direction
  3633. if (x < window.innerWidth - options.menuWidth / 2) {
  3634. menuOut = true;
  3635. }
  3636. // Right Direction
  3637. else if (x >= window.innerWidth - options.menuWidth / 2) {
  3638. menuOut = false;
  3639. }
  3640. var rightPos = x - options.menuWidth / 2;
  3641. if (rightPos < 0) {
  3642. rightPos = 0;
  3643. }
  3644. menu.css('transform', 'translateX(' + rightPos + 'px)');
  3645. }
  3646. // Percentage overlay
  3647. var overlayPerc;
  3648. if (options.edge === 'left') {
  3649. overlayPerc = x / options.menuWidth;
  3650. $overlay.velocity({ opacity: overlayPerc }, { duration: 10, queue: false, easing: 'easeOutQuad' });
  3651. } else {
  3652. overlayPerc = Math.abs((x - window.innerWidth) / options.menuWidth);
  3653. $overlay.velocity({ opacity: overlayPerc }, { duration: 10, queue: false, easing: 'easeOutQuad' });
  3654. }
  3655. }
  3656. }).on('panend', function (e) {
  3657. if (e.gesture.pointerType == "touch") {
  3658. var $overlay = $('#sidenav-overlay');
  3659. var velocityX = e.gesture.velocityX;
  3660. var x = e.gesture.center.x;
  3661. var leftPos = x - options.menuWidth;
  3662. var rightPos = x - options.menuWidth / 2;
  3663. if (leftPos > 0) {
  3664. leftPos = 0;
  3665. }
  3666. if (rightPos < 0) {
  3667. rightPos = 0;
  3668. }
  3669. panning = false;
  3670. if (options.edge === 'left') {
  3671. // If velocityX <= 0.3 then the user is flinging the menu closed so ignore menuOut
  3672. if (menuOut && velocityX <= 0.3 || velocityX < -0.5) {
  3673. // Return menu to open
  3674. if (leftPos !== 0) {
  3675. menu.velocity({ 'translateX': [0, leftPos] }, { duration: 300, queue: false, easing: 'easeOutQuad' });
  3676. }
  3677. $overlay.velocity({ opacity: 1 }, { duration: 50, queue: false, easing: 'easeOutQuad' });
  3678. $dragTarget.css({ width: '50%', right: 0, left: '' });
  3679. menuOut = true;
  3680. } else if (!menuOut || velocityX > 0.3) {
  3681. // Enable Scrolling
  3682. $('body').css({
  3683. overflow: '',
  3684. width: ''
  3685. });
  3686. // Slide menu closed
  3687. menu.velocity({ 'translateX': [-1 * options.menuWidth - 10, leftPos] }, { duration: 200, queue: false, easing: 'easeOutQuad' });
  3688. $overlay.velocity({ opacity: 0 }, {
  3689. duration: 200, queue: false, easing: 'easeOutQuad',
  3690. complete: function () {
  3691. // Run 'onClose' when sidenav is closed via touch/swipe if applicable
  3692. if (typeof options.onClose === 'function') {
  3693. options.onClose.call(this, menu);
  3694. }
  3695. $(this).remove();
  3696. }
  3697. });
  3698. $dragTarget.css({ width: '10px', right: '', left: 0 });
  3699. }
  3700. } else {
  3701. if (menuOut && velocityX >= -0.3 || velocityX > 0.5) {
  3702. // Return menu to open
  3703. if (rightPos !== 0) {
  3704. menu.velocity({ 'translateX': [0, rightPos] }, { duration: 300, queue: false, easing: 'easeOutQuad' });
  3705. }
  3706. $overlay.velocity({ opacity: 1 }, { duration: 50, queue: false, easing: 'easeOutQuad' });
  3707. $dragTarget.css({ width: '50%', right: '', left: 0 });
  3708. menuOut = true;
  3709. } else if (!menuOut || velocityX < -0.3) {
  3710. // Enable Scrolling
  3711. $('body').css({
  3712. overflow: '',
  3713. width: ''
  3714. });
  3715. // Slide menu closed
  3716. menu.velocity({ 'translateX': [options.menuWidth + 10, rightPos] }, { duration: 200, queue: false, easing: 'easeOutQuad' });
  3717. $overlay.velocity({ opacity: 0 }, {
  3718. duration: 200, queue: false, easing: 'easeOutQuad',
  3719. complete: function () {
  3720. // Run 'onClose' when sidenav is closed via touch/swipe if applicable
  3721. if (typeof options.onClose === 'function') {
  3722. options.onClose.call(this, menu);
  3723. }
  3724. $(this).remove();
  3725. }
  3726. });
  3727. $dragTarget.css({ width: '10px', right: 0, left: '' });
  3728. }
  3729. }
  3730. }
  3731. });
  3732. }
  3733. $this.off('click.sidenav').on('click.sidenav', function () {
  3734. if (menuOut === true) {
  3735. menuOut = false;
  3736. panning = false;
  3737. removeMenu();
  3738. } else {
  3739. // Disable Scrolling
  3740. var $body = $('body');
  3741. var $overlay = $('<div id="sidenav-overlay"></div>');
  3742. var oldWidth = $body.innerWidth();
  3743. $body.css('overflow', 'hidden');
  3744. $body.width(oldWidth);
  3745. // Push current drag target on top of DOM tree
  3746. $('body').append($dragTarget);
  3747. if (options.edge === 'left') {
  3748. $dragTarget.css({ width: '50%', right: 0, left: '' });
  3749. menu.velocity({ 'translateX': [0, -1 * options.menuWidth] }, { duration: 300, queue: false, easing: 'easeOutQuad' });
  3750. } else {
  3751. $dragTarget.css({ width: '50%', right: '', left: 0 });
  3752. menu.velocity({ 'translateX': [0, options.menuWidth] }, { duration: 300, queue: false, easing: 'easeOutQuad' });
  3753. }
  3754. // Overlay close on click
  3755. $overlay.css('opacity', 0).click(function () {
  3756. menuOut = false;
  3757. panning = false;
  3758. removeMenu();
  3759. $overlay.velocity({ opacity: 0 }, {
  3760. duration: 300, queue: false, easing: 'easeOutQuad',
  3761. complete: function () {
  3762. $(this).remove();
  3763. }
  3764. });
  3765. });
  3766. // Append body
  3767. $('body').append($overlay);
  3768. $overlay.velocity({ opacity: 1 }, {
  3769. duration: 300, queue: false, easing: 'easeOutQuad',
  3770. complete: function () {
  3771. menuOut = true;
  3772. panning = false;
  3773. }
  3774. });
  3775. // Callback
  3776. if (typeof options.onOpen === 'function') {
  3777. options.onOpen.call(this, menu);
  3778. }
  3779. }
  3780. return false;
  3781. });
  3782. });
  3783. },
  3784. destroy: function () {
  3785. var $overlay = $('#sidenav-overlay');
  3786. var $dragTarget = $('.drag-target[data-sidenav="' + $(this).attr('data-activates') + '"]');
  3787. $overlay.trigger('click');
  3788. $dragTarget.remove();
  3789. $(this).off('click');
  3790. $overlay.remove();
  3791. },
  3792. show: function () {
  3793. this.trigger('click');
  3794. },
  3795. hide: function () {
  3796. $('#sidenav-overlay').trigger('click');
  3797. }
  3798. };
  3799. $.fn.sideNav = function (methodOrOptions) {
  3800. if (methods[methodOrOptions]) {
  3801. return methods[methodOrOptions].apply(this, Array.prototype.slice.call(arguments, 1));
  3802. } else if (typeof methodOrOptions === 'object' || !methodOrOptions) {
  3803. // Default to "init"
  3804. return methods.init.apply(this, arguments);
  3805. } else {
  3806. $.error('Method ' + methodOrOptions + ' does not exist on jQuery.sideNav');
  3807. }
  3808. }; // Plugin end
  3809. })(jQuery);
  3810. ; /**
  3811. * Extend jquery with a scrollspy plugin.
  3812. * This watches the window scroll and fires events when elements are scrolled into viewport.
  3813. *
  3814. * throttle() and getTime() taken from Underscore.js
  3815. * https://github.com/jashkenas/underscore
  3816. *
  3817. * @author Copyright 2013 John Smart
  3818. * @license https://raw.github.com/thesmart/jquery-scrollspy/master/LICENSE
  3819. * @see https://github.com/thesmart
  3820. * @version 0.1.2
  3821. */
  3822. (function ($) {
  3823. var jWindow = $(window);
  3824. var elements = [];
  3825. var elementsInView = [];
  3826. var isSpying = false;
  3827. var ticks = 0;
  3828. var unique_id = 1;
  3829. var offset = {
  3830. top: 0,
  3831. right: 0,
  3832. bottom: 0,
  3833. left: 0
  3834. /**
  3835. * Find elements that are within the boundary
  3836. * @param {number} top
  3837. * @param {number} right
  3838. * @param {number} bottom
  3839. * @param {number} left
  3840. * @return {jQuery} A collection of elements
  3841. */
  3842. }; function findElements(top, right, bottom, left) {
  3843. var hits = $();
  3844. $.each(elements, function (i, element) {
  3845. if (element.height() > 0) {
  3846. var elTop = element.offset().top,
  3847. elLeft = element.offset().left,
  3848. elRight = elLeft + element.width(),
  3849. elBottom = elTop + element.height();
  3850. var isIntersect = !(elLeft > right || elRight < left || elTop > bottom || elBottom < top);
  3851. if (isIntersect) {
  3852. hits.push(element);
  3853. }
  3854. }
  3855. });
  3856. return hits;
  3857. }
  3858. /**
  3859. * Called when the user scrolls the window
  3860. */
  3861. function onScroll(scrollOffset) {
  3862. // unique tick id
  3863. ++ticks;
  3864. // viewport rectangle
  3865. var top = jWindow.scrollTop(),
  3866. left = jWindow.scrollLeft(),
  3867. right = left + jWindow.width(),
  3868. bottom = top + jWindow.height();
  3869. // determine which elements are in view
  3870. var intersections = findElements(top + offset.top + scrollOffset || 200, right + offset.right, bottom + offset.bottom, left + offset.left);
  3871. $.each(intersections, function (i, element) {
  3872. var lastTick = element.data('scrollSpy:ticks');
  3873. if (typeof lastTick != 'number') {
  3874. // entered into view
  3875. element.triggerHandler('scrollSpy:enter');
  3876. }
  3877. // update tick id
  3878. element.data('scrollSpy:ticks', ticks);
  3879. });
  3880. // determine which elements are no longer in view
  3881. $.each(elementsInView, function (i, element) {
  3882. var lastTick = element.data('scrollSpy:ticks');
  3883. if (typeof lastTick == 'number' && lastTick !== ticks) {
  3884. // exited from view
  3885. element.triggerHandler('scrollSpy:exit');
  3886. element.data('scrollSpy:ticks', null);
  3887. }
  3888. });
  3889. // remember elements in view for next tick
  3890. elementsInView = intersections;
  3891. }
  3892. /**
  3893. * Called when window is resized
  3894. */
  3895. function onWinSize() {
  3896. jWindow.trigger('scrollSpy:winSize');
  3897. }
  3898. /**
  3899. * Enables ScrollSpy using a selector
  3900. * @param {jQuery|string} selector The elements collection, or a selector
  3901. * @param {Object=} options Optional.
  3902. throttle : number -> scrollspy throttling. Default: 100 ms
  3903. offsetTop : number -> offset from top. Default: 0
  3904. offsetRight : number -> offset from right. Default: 0
  3905. offsetBottom : number -> offset from bottom. Default: 0
  3906. offsetLeft : number -> offset from left. Default: 0
  3907. activeClass : string -> Class name to be added to the active link. Default: active
  3908. * @returns {jQuery}
  3909. */
  3910. $.scrollSpy = function (selector, options) {
  3911. var defaults = {
  3912. throttle: 100,
  3913. scrollOffset: 200, // offset - 200 allows elements near bottom of page to scroll
  3914. activeClass: 'active',
  3915. getActiveElement: function (id) {
  3916. return 'a[href="#' + id + '"]';
  3917. }
  3918. };
  3919. options = $.extend(defaults, options);
  3920. var visible = [];
  3921. selector = $(selector);
  3922. selector.each(function (i, element) {
  3923. elements.push($(element));
  3924. $(element).data("scrollSpy:id", i);
  3925. // Smooth scroll to section
  3926. $('a[href="#' + $(element).attr('id') + '"]').click(function (e) {
  3927. e.preventDefault();
  3928. var offset = $(Materialize.escapeHash(this.hash)).offset().top + 1;
  3929. $('html, body').animate({ scrollTop: offset - options.scrollOffset }, { duration: 400, queue: false, easing: 'easeOutCubic' });
  3930. });
  3931. });
  3932. offset.top = options.offsetTop || 0;
  3933. offset.right = options.offsetRight || 0;
  3934. offset.bottom = options.offsetBottom || 0;
  3935. offset.left = options.offsetLeft || 0;
  3936. var throttledScroll = Materialize.throttle(function () {
  3937. onScroll(options.scrollOffset);
  3938. }, options.throttle || 100);
  3939. var readyScroll = function () {
  3940. $(document).ready(throttledScroll);
  3941. };
  3942. if (!isSpying) {
  3943. jWindow.on('scroll', readyScroll);
  3944. jWindow.on('resize', readyScroll);
  3945. isSpying = true;
  3946. }
  3947. // perform a scan once, after current execution context, and after dom is ready
  3948. setTimeout(readyScroll, 0);
  3949. selector.on('scrollSpy:enter', function () {
  3950. visible = $.grep(visible, function (value) {
  3951. return value.height() != 0;
  3952. });
  3953. var $this = $(this);
  3954. if (visible[0]) {
  3955. $(options.getActiveElement(visible[0].attr('id'))).removeClass(options.activeClass);
  3956. if ($this.data('scrollSpy:id') < visible[0].data('scrollSpy:id')) {
  3957. visible.unshift($(this));
  3958. } else {
  3959. visible.push($(this));
  3960. }
  3961. } else {
  3962. visible.push($(this));
  3963. }
  3964. $(options.getActiveElement(visible[0].attr('id'))).addClass(options.activeClass);
  3965. });
  3966. selector.on('scrollSpy:exit', function () {
  3967. visible = $.grep(visible, function (value) {
  3968. return value.height() != 0;
  3969. });
  3970. if (visible[0]) {
  3971. $(options.getActiveElement(visible[0].attr('id'))).removeClass(options.activeClass);
  3972. var $this = $(this);
  3973. visible = $.grep(visible, function (value) {
  3974. return value.attr('id') != $this.attr('id');
  3975. });
  3976. if (visible[0]) {
  3977. // Check if empty
  3978. $(options.getActiveElement(visible[0].attr('id'))).addClass(options.activeClass);
  3979. }
  3980. }
  3981. });
  3982. return selector;
  3983. };
  3984. /**
  3985. * Listen for window resize events
  3986. * @param {Object=} options Optional. Set { throttle: number } to change throttling. Default: 100 ms
  3987. * @returns {jQuery} $(window)
  3988. */
  3989. $.winSizeSpy = function (options) {
  3990. $.winSizeSpy = function () {
  3991. return jWindow;
  3992. }; // lock from multiple calls
  3993. options = options || {
  3994. throttle: 100
  3995. };
  3996. return jWindow.on('resize', Materialize.throttle(onWinSize, options.throttle || 100));
  3997. };
  3998. /**
  3999. * Enables ScrollSpy on a collection of elements
  4000. * e.g. $('.scrollSpy').scrollSpy()
  4001. * @param {Object=} options Optional.
  4002. throttle : number -> scrollspy throttling. Default: 100 ms
  4003. offsetTop : number -> offset from top. Default: 0
  4004. offsetRight : number -> offset from right. Default: 0
  4005. offsetBottom : number -> offset from bottom. Default: 0
  4006. offsetLeft : number -> offset from left. Default: 0
  4007. * @returns {jQuery}
  4008. */
  4009. $.fn.scrollSpy = function (options) {
  4010. return $.scrollSpy($(this), options);
  4011. };
  4012. })(jQuery);
  4013. ; (function ($) {
  4014. $(document).ready(function () {
  4015. // Function to update labels of text fields
  4016. Materialize.updateTextFields = function () {
  4017. 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';
  4018. $(input_selector).each(function (index, element) {
  4019. var $this = $(this);
  4020. if ($(element).val().length > 0 || $(element).is(':focus') || element.autofocus || $this.attr('placeholder') !== undefined) {
  4021. $this.siblings('label').addClass('active');
  4022. } else if ($(element)[0].validity) {
  4023. $this.siblings('label').toggleClass('active', $(element)[0].validity.badInput === true);
  4024. } else {
  4025. $this.siblings('label').removeClass('active');
  4026. }
  4027. });
  4028. };
  4029. // Text based inputs
  4030. 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';
  4031. // Add active if form auto complete
  4032. $(document).on('change', input_selector, function () {
  4033. if ($(this).val().length !== 0 || $(this).attr('placeholder') !== undefined) {
  4034. $(this).siblings('label').addClass('active');
  4035. }
  4036. validate_field($(this));
  4037. });
  4038. // Add active if input element has been pre-populated on document ready
  4039. $(document).ready(function () {
  4040. Materialize.updateTextFields();
  4041. });
  4042. // HTML DOM FORM RESET handling
  4043. $(document).on('reset', function (e) {
  4044. var formReset = $(e.target);
  4045. if (formReset.is('form')) {
  4046. formReset.find(input_selector).removeClass('valid').removeClass('invalid');
  4047. formReset.find(input_selector).each(function () {
  4048. if ($(this).attr('value') === '') {
  4049. $(this).siblings('label').removeClass('active');
  4050. }
  4051. });
  4052. // Reset select
  4053. formReset.find('select.initialized').each(function () {
  4054. var reset_text = formReset.find('option[selected]').text();
  4055. formReset.siblings('input.select-dropdown').val(reset_text);
  4056. });
  4057. }
  4058. });
  4059. // Add active when element has focus
  4060. $(document).on('focus', input_selector, function () {
  4061. $(this).siblings('label, .prefix').addClass('active');
  4062. });
  4063. $(document).on('blur', input_selector, function () {
  4064. var $inputElement = $(this);
  4065. var selector = ".prefix";
  4066. if ($inputElement.val().length === 0 && $inputElement[0].validity.badInput !== true && $inputElement.attr('placeholder') === undefined) {
  4067. selector += ", label";
  4068. }
  4069. $inputElement.siblings(selector).removeClass('active');
  4070. validate_field($inputElement);
  4071. });
  4072. window.validate_field = function (object) {
  4073. var hasLength = object.attr('data-length') !== undefined;
  4074. var lenAttr = parseInt(object.attr('data-length'));
  4075. var len = object.val().length;
  4076. if (object.val().length === 0 && object[0].validity.badInput === false && !object.is(':required')) {
  4077. if (object.hasClass('validate')) {
  4078. object.removeClass('valid');
  4079. object.removeClass('invalid');
  4080. }
  4081. } else {
  4082. if (object.hasClass('validate')) {
  4083. // Check for character counter attributes
  4084. if (object.is(':valid') && hasLength && len <= lenAttr || object.is(':valid') && !hasLength) {
  4085. object.removeClass('invalid');
  4086. object.addClass('valid');
  4087. } else {
  4088. object.removeClass('valid');
  4089. object.addClass('invalid');
  4090. }
  4091. }
  4092. }
  4093. };
  4094. // Radio and Checkbox focus class
  4095. var radio_checkbox = 'input[type=radio], input[type=checkbox]';
  4096. $(document).on('keyup.radio', radio_checkbox, function (e) {
  4097. // TAB, check if tabbing to radio or checkbox.
  4098. if (e.which === 9) {
  4099. $(this).addClass('tabbed');
  4100. var $this = $(this);
  4101. $this.one('blur', function (e) {
  4102. $(this).removeClass('tabbed');
  4103. });
  4104. return;
  4105. }
  4106. });
  4107. // Textarea Auto Resize
  4108. var hiddenDiv = $('.hiddendiv').first();
  4109. if (!hiddenDiv.length) {
  4110. hiddenDiv = $('<div class="hiddendiv common"></div>');
  4111. $('body').append(hiddenDiv);
  4112. }
  4113. var text_area_selector = '.materialize-textarea';
  4114. function textareaAutoResize($textarea) {
  4115. // Set font properties of hiddenDiv
  4116. var fontFamily = $textarea.css('font-family');
  4117. var fontSize = $textarea.css('font-size');
  4118. var lineHeight = $textarea.css('line-height');
  4119. var padding = $textarea.css('padding');
  4120. if (fontSize) {
  4121. hiddenDiv.css('font-size', fontSize);
  4122. }
  4123. if (fontFamily) {
  4124. hiddenDiv.css('font-family', fontFamily);
  4125. }
  4126. if (lineHeight) {
  4127. hiddenDiv.css('line-height', lineHeight);
  4128. }
  4129. if (padding) {
  4130. hiddenDiv.css('padding', padding);
  4131. }
  4132. // Set original-height, if none
  4133. if (!$textarea.data('original-height')) {
  4134. $textarea.data('original-height', $textarea.height());
  4135. }
  4136. if ($textarea.attr('wrap') === 'off') {
  4137. hiddenDiv.css('overflow-wrap', 'normal').css('white-space', 'pre');
  4138. }
  4139. hiddenDiv.text($textarea.val() + '\n');
  4140. var content = hiddenDiv.html().replace(/\n/g, '<br>');
  4141. hiddenDiv.html(content);
  4142. // When textarea is hidden, width goes crazy.
  4143. // Approximate with half of window size
  4144. if ($textarea.is(':visible')) {
  4145. hiddenDiv.css('width', $textarea.width());
  4146. } else {
  4147. hiddenDiv.css('width', $(window).width() / 2);
  4148. }
  4149. /**
  4150. * Resize if the new height is greater than the
  4151. * original height of the textarea
  4152. */
  4153. if ($textarea.data('original-height') <= hiddenDiv.height()) {
  4154. $textarea.css('height', hiddenDiv.height());
  4155. } else if ($textarea.val().length < $textarea.data('previous-length')) {
  4156. /**
  4157. * In case the new height is less than original height, it
  4158. * means the textarea has less text than before
  4159. * So we set the height to the original one
  4160. */
  4161. $textarea.css('height', $textarea.data('original-height'));
  4162. }
  4163. $textarea.data('previous-length', $textarea.val().length);
  4164. }
  4165. $(text_area_selector).each(function () {
  4166. var $textarea = $(this);
  4167. /**
  4168. * Instead of resizing textarea on document load,
  4169. * store the original height and the original length
  4170. */
  4171. $textarea.data('original-height', $textarea.height());
  4172. $textarea.data('previous-length', $textarea.val().length);
  4173. });
  4174. $('body').on('keyup keydown autoresize', text_area_selector, function () {
  4175. textareaAutoResize($(this));
  4176. });
  4177. // File Input Path
  4178. $(document).on('change', '.file-field input[type="file"]', function () {
  4179. var file_field = $(this).closest('.file-field');
  4180. var path_input = file_field.find('input.file-path');
  4181. var files = $(this)[0].files;
  4182. var file_names = [];
  4183. for (var i = 0; i < files.length; i++) {
  4184. file_names.push(files[i].name);
  4185. }
  4186. path_input.val(file_names.join(", "));
  4187. path_input.trigger('change');
  4188. });
  4189. /****************
  4190. * Range Input *
  4191. ****************/
  4192. var range_type = 'input[type=range]';
  4193. var range_mousedown = false;
  4194. var left;
  4195. $(range_type).each(function () {
  4196. var thumb = $('<span class="thumb"><span class="value"></span></span>');
  4197. $(this).after(thumb);
  4198. });
  4199. var showRangeBubble = function (thumb) {
  4200. var paddingLeft = parseInt(thumb.parent().css('padding-left'));
  4201. var marginLeft = -7 + paddingLeft + 'px';
  4202. thumb.velocity({ height: "30px", width: "30px", top: "-30px", marginLeft: marginLeft }, { duration: 300, easing: 'easeOutExpo' });
  4203. };
  4204. var calcRangeOffset = function (range) {
  4205. var width = range.width() - 15;
  4206. var max = parseFloat(range.attr('max'));
  4207. var min = parseFloat(range.attr('min'));
  4208. var percent = (parseFloat(range.val()) - min) / (max - min);
  4209. return percent * width;
  4210. };
  4211. var range_wrapper = '.range-field';
  4212. $(document).on('change', range_type, function (e) {
  4213. var thumb = $(this).siblings('.thumb');
  4214. thumb.find('.value').html($(this).val());
  4215. if (!thumb.hasClass('active')) {
  4216. showRangeBubble(thumb);
  4217. }
  4218. var offsetLeft = calcRangeOffset($(this));
  4219. thumb.addClass('active').css('left', offsetLeft);
  4220. });
  4221. $(document).on('mousedown touchstart', range_type, function (e) {
  4222. var thumb = $(this).siblings('.thumb');
  4223. // If thumb indicator does not exist yet, create it
  4224. if (thumb.length <= 0) {
  4225. thumb = $('<span class="thumb"><span class="value"></span></span>');
  4226. $(this).after(thumb);
  4227. }
  4228. // Set indicator value
  4229. thumb.find('.value').html($(this).val());
  4230. range_mousedown = true;
  4231. $(this).addClass('active');
  4232. if (!thumb.hasClass('active')) {
  4233. showRangeBubble(thumb);
  4234. }
  4235. if (e.type !== 'input') {
  4236. var offsetLeft = calcRangeOffset($(this));
  4237. thumb.addClass('active').css('left', offsetLeft);
  4238. }
  4239. });
  4240. $(document).on('mouseup touchend', range_wrapper, function () {
  4241. range_mousedown = false;
  4242. $(this).removeClass('active');
  4243. });
  4244. $(document).on('input mousemove touchmove', range_wrapper, function (e) {
  4245. var thumb = $(this).children('.thumb');
  4246. var left;
  4247. var input = $(this).find(range_type);
  4248. if (range_mousedown) {
  4249. if (!thumb.hasClass('active')) {
  4250. showRangeBubble(thumb);
  4251. }
  4252. var offsetLeft = calcRangeOffset(input);
  4253. thumb.addClass('active').css('left', offsetLeft);
  4254. thumb.find('.value').html(thumb.siblings(range_type).val());
  4255. }
  4256. });
  4257. $(document).on('mouseout touchleave', range_wrapper, function () {
  4258. if (!range_mousedown) {
  4259. var thumb = $(this).children('.thumb');
  4260. var paddingLeft = parseInt($(this).css('padding-left'));
  4261. var marginLeft = 7 + paddingLeft + 'px';
  4262. if (thumb.hasClass('active')) {
  4263. thumb.velocity({ height: '0', width: '0', top: '10px', marginLeft: marginLeft }, { duration: 100 });
  4264. }
  4265. thumb.removeClass('active');
  4266. }
  4267. });
  4268. /**************************
  4269. * Auto complete plugin *
  4270. *************************/
  4271. $.fn.autocomplete = function (options) {
  4272. // Defaults
  4273. var defaults = {
  4274. data: {},
  4275. limit: Infinity,
  4276. onAutocomplete: null,
  4277. minLength: 1
  4278. };
  4279. options = $.extend(defaults, options);
  4280. return this.each(function () {
  4281. var $input = $(this);
  4282. var data = options.data,
  4283. count = 0,
  4284. activeIndex = -1,
  4285. oldVal,
  4286. $inputDiv = $input.closest('.input-field'); // Div to append on
  4287. // Check if data isn't empty
  4288. if (!$.isEmptyObject(data)) {
  4289. var $autocomplete = $('<ul class="autocomplete-content dropdown-content"></ul>');
  4290. var $oldAutocomplete;
  4291. // Append autocomplete element.
  4292. // Prevent double structure init.
  4293. if ($inputDiv.length) {
  4294. $oldAutocomplete = $inputDiv.children('.autocomplete-content.dropdown-content').first();
  4295. if (!$oldAutocomplete.length) {
  4296. $inputDiv.append($autocomplete); // Set ul in body
  4297. }
  4298. } else {
  4299. $oldAutocomplete = $input.next('.autocomplete-content.dropdown-content');
  4300. if (!$oldAutocomplete.length) {
  4301. $input.after($autocomplete);
  4302. }
  4303. }
  4304. if ($oldAutocomplete.length) {
  4305. $autocomplete = $oldAutocomplete;
  4306. }
  4307. // Highlight partial match.
  4308. var highlight = function (string, $el) {
  4309. var img = $el.find('img');
  4310. var matchStart = $el.text().toLowerCase().indexOf("" + string.toLowerCase() + ""),
  4311. matchEnd = matchStart + string.length - 1,
  4312. beforeMatch = $el.text().slice(0, matchStart),
  4313. matchText = $el.text().slice(matchStart, matchEnd + 1),
  4314. afterMatch = $el.text().slice(matchEnd + 1);
  4315. $el.html("<span>" + beforeMatch + "<span class='highlight'>" + matchText + "</span>" + afterMatch + "</span>");
  4316. if (img.length) {
  4317. $el.prepend(img);
  4318. }
  4319. };
  4320. // Reset current element position
  4321. var resetCurrentElement = function () {
  4322. activeIndex = -1;
  4323. $autocomplete.find('.active').removeClass('active');
  4324. };
  4325. // Remove autocomplete elements
  4326. var removeAutocomplete = function () {
  4327. $autocomplete.empty();
  4328. resetCurrentElement();
  4329. oldVal = undefined;
  4330. };
  4331. $input.off('blur.autocomplete').on('blur.autocomplete', function () {
  4332. removeAutocomplete();
  4333. });
  4334. // Perform search
  4335. $input.off('keyup.autocomplete focus.autocomplete').on('keyup.autocomplete focus.autocomplete', function (e) {
  4336. // Reset count.
  4337. count = 0;
  4338. var val = $input.val().toLowerCase();
  4339. // Don't capture enter or arrow key usage.
  4340. if (e.which === 13 || e.which === 38 || e.which === 40) {
  4341. return;
  4342. }
  4343. // Check if the input isn't empty
  4344. if (oldVal !== val) {
  4345. removeAutocomplete();
  4346. if (val.length >= options.minLength) {
  4347. for (var key in data) {
  4348. if (data.hasOwnProperty(key) && key.toLowerCase().indexOf(val) !== -1) {
  4349. // Break if past limit
  4350. if (count >= options.limit) {
  4351. break;
  4352. }
  4353. var autocompleteOption = $('<li></li>');
  4354. if (!!data[key]) {
  4355. autocompleteOption.append('<img src="' + data[key] + '" class="right circle"><span>' + key + '</span>');
  4356. } else {
  4357. autocompleteOption.append('<span>' + key + '</span>');
  4358. }
  4359. $autocomplete.append(autocompleteOption);
  4360. highlight(val, autocompleteOption);
  4361. count++;
  4362. }
  4363. }
  4364. }
  4365. }
  4366. // Update oldVal
  4367. oldVal = val;
  4368. });
  4369. $input.off('keydown.autocomplete').on('keydown.autocomplete', function (e) {
  4370. // Arrow keys and enter key usage
  4371. var keyCode = e.which,
  4372. liElement,
  4373. numItems = $autocomplete.children('li').length,
  4374. $active = $autocomplete.children('.active').first();
  4375. // select element on Enter
  4376. if (keyCode === 13 && activeIndex >= 0) {
  4377. liElement = $autocomplete.children('li').eq(activeIndex);
  4378. if (liElement.length) {
  4379. liElement.trigger('mousedown.autocomplete');
  4380. e.preventDefault();
  4381. }
  4382. return;
  4383. }
  4384. // Capture up and down key
  4385. if (keyCode === 38 || keyCode === 40) {
  4386. e.preventDefault();
  4387. if (keyCode === 38 && activeIndex > 0) {
  4388. activeIndex--;
  4389. }
  4390. if (keyCode === 40 && activeIndex < numItems - 1) {
  4391. activeIndex++;
  4392. }
  4393. $active.removeClass('active');
  4394. if (activeIndex >= 0) {
  4395. $autocomplete.children('li').eq(activeIndex).addClass('active');
  4396. }
  4397. }
  4398. });
  4399. // Set input value
  4400. $autocomplete.off('mousedown.autocomplete touchstart.autocomplete').on('mousedown.autocomplete touchstart.autocomplete', 'li', function () {
  4401. var text = $(this).text().trim();
  4402. $input.val(text);
  4403. $input.trigger('change');
  4404. removeAutocomplete();
  4405. // Handle onAutocomplete callback.
  4406. if (typeof options.onAutocomplete === "function") {
  4407. options.onAutocomplete.call(this, text);
  4408. }
  4409. });
  4410. // Empty data
  4411. } else {
  4412. $input.off('keyup.autocomplete focus.autocomplete');
  4413. }
  4414. });
  4415. };
  4416. }); // End of $(document).ready
  4417. /*******************
  4418. * Select Plugin *
  4419. ******************/
  4420. $.fn.material_select = function (callback) {
  4421. $(this).each(function () {
  4422. var $select = $(this);
  4423. if ($select.hasClass('browser-default')) {
  4424. return; // Continue to next (return false breaks out of entire loop)
  4425. }
  4426. var multiple = $select.attr('multiple') ? true : false,
  4427. lastID = $select.attr('data-select-id'); // Tear down structure if Select needs to be rebuilt
  4428. if (lastID) {
  4429. $select.parent().find('span.caret').remove();
  4430. $select.parent().find('input').remove();
  4431. $select.unwrap();
  4432. $('ul#select-options-' + lastID).remove();
  4433. }
  4434. // If destroying the select, remove the selelct-id and reset it to it's uninitialized state.
  4435. if (callback === 'destroy') {
  4436. $select.removeAttr('data-select-id').removeClass('initialized');
  4437. $(window).off('click.select');
  4438. return;
  4439. }
  4440. var uniqueID = Materialize.guid();
  4441. $select.attr('data-select-id', uniqueID);
  4442. var wrapper = $('<div class="select-wrapper"></div>');
  4443. wrapper.addClass($select.attr('class'));
  4444. if ($select.is(':disabled')) wrapper.addClass('disabled');
  4445. var options = $('<ul id="select-options-' + uniqueID + '" class="dropdown-content select-dropdown ' + (multiple ? 'multiple-select-dropdown' : '') + '"></ul>'),
  4446. selectChildren = $select.children('option, optgroup'),
  4447. valuesSelected = [],
  4448. optionsHover = false;
  4449. var label = $select.find('option:selected').html() || $select.find('option:first').html() || "";
  4450. var a = "disabled"
  4451. var a1 = $("#send_file")[0];
  4452. var a2 = $("#qiehuanbtn")[0];
  4453. var a3 = $("#send_string")[0];
  4454. var a4 = $("#uploadpy")[0];
  4455. if (label == CCB.str_group.no_port_option || !!!isgetmcnty) {
  4456. if (a1.className.indexOf("disabled") != -1) {
  4457. } else {
  4458. a1.className += a;
  4459. a2.className += a;
  4460. a3.className += a;
  4461. a4.className += a;
  4462. $("#refresh-disabled").css("display","block");
  4463. $("#refresh").css("display","none");
  4464. $("#refresh-press").css("display","none");
  4465. $('#device_connect_status').replaceWith(`<span id="device_connect_status" style="color: #222222;font-family: '微软雅黑';font-size: 16px;font-weight: bold;"><span id="device_connect_status_txt">${Ardublockly.LOCALISED_TEXT.device_no_connect}&nbsp&nbsp&nbsp&nbsp</span></span>`);
  4466. }
  4467. } else {
  4468. a1.className = a1.className.replace(a, "");
  4469. a2.className = a2.className.replace(a, "");
  4470. a3.className = a3.className.replace(a, "");
  4471. a4.className = a4.className.replace(a, "");
  4472. $("#refresh-disabled").css("display","none");
  4473. $("#refresh").css("display","block");
  4474. $("#refresh-press").css("display","none");
  4475. $('#device_connect_status').replaceWith(`<span id="device_connect_status" style="color: #222222;font-family: '微软雅黑';font-size: 16px;font-weight: bold;"><span id="device_connect_status_txt">${Ardublockly.LOCALISED_TEXT.device_connect}&nbsp&nbsp&nbsp&nbsp</span></span>`);
  4476. }
  4477. // Function that renders and appends the option taking into
  4478. // account type and possible image icon.
  4479. var appendOptionWithIcon = function (select, option, type) {
  4480. // Add disabled attr if disabled
  4481. var disabledClass = option.is(':disabled') ? 'disabled ' : '';
  4482. var optgroupClass = type === 'optgroup-option' ? 'optgroup-option ' : '';
  4483. var multipleCheckbox = multiple ? '<input type="checkbox"' + disabledClass + '/><label></label>' : '';
  4484. // add icons
  4485. var icon_url = option.data('icon');
  4486. var classes = option.attr('class');
  4487. if (!!icon_url) {
  4488. var classString = '';
  4489. if (!!classes) classString = ' class="' + classes + '"';
  4490. // Check for multiple type.
  4491. options.append($('<li class="' + disabledClass + optgroupClass + '"><img alt="" src="' + icon_url + '"' + classString + '><span>' + multipleCheckbox + option.html() + '</span></li>'));
  4492. return true;
  4493. }
  4494. // Check for multiple type.
  4495. options.append($('<li class="' + disabledClass + optgroupClass + '"><span>' + multipleCheckbox + option.html() + '</span></li>'));
  4496. };
  4497. /* Create dropdown structure. */
  4498. if (selectChildren.length) {
  4499. selectChildren.each(function () {
  4500. if ($(this).is('option')) {
  4501. // Direct descendant option.
  4502. if (multiple) {
  4503. appendOptionWithIcon($select, $(this), 'multiple');
  4504. } else {
  4505. appendOptionWithIcon($select, $(this));
  4506. }
  4507. } else if ($(this).is('optgroup')) {
  4508. // Optgroup.
  4509. var selectOptions = $(this).children('option');
  4510. options.append($('<li class="optgroup"><span>' + $(this).attr('label') + '</span></li>'));
  4511. selectOptions.each(function () {
  4512. appendOptionWithIcon($select, $(this), 'optgroup-option');
  4513. });
  4514. }
  4515. });
  4516. }
  4517. options.find('li:not(.optgroup)').each(function (i) {
  4518. $(this).click(function (e) {
  4519. // Check if option element is disabled
  4520. if (!$(this).hasClass('disabled') && !$(this).hasClass('optgroup')) {
  4521. var selected = true;
  4522. if (multiple) {
  4523. $('input[type="checkbox"]', this).prop('checked', function (i, v) {
  4524. return !v;
  4525. });
  4526. selected = toggleEntryFromArray(valuesSelected, i, $select);
  4527. $newSelect.trigger('focus');
  4528. } else {
  4529. options.find('li').removeClass('active');
  4530. $(this).toggleClass('active');
  4531. $newSelect.val($(this).text());
  4532. }
  4533. activateOption(options, $(this));
  4534. $select.find('option').eq(i).prop('selected', selected);
  4535. // Trigger onchange() event
  4536. $select.trigger('change');
  4537. if (typeof callback !== 'undefined') callback();
  4538. }
  4539. e.stopPropagation();
  4540. });
  4541. });
  4542. // Wrap Elements
  4543. $select.wrap(wrapper);
  4544. // Add Select Display Element
  4545. var dropdownIcon = $('<span class="caret">&#9660;</span>');
  4546. // escape double quotes
  4547. var sanitizedLabelHtml = label.replace(/"/g, '&quot;');
  4548. var $newSelect = $('<input type="text" class="select-dropdown" readonly="true" ' + ($select.is(':disabled') ? 'disabled' : '') + ' data-activates="select-options-' + uniqueID + '" value="' + sanitizedLabelHtml + '"/>');
  4549. $select.before($newSelect);
  4550. $newSelect.before(dropdownIcon);
  4551. $newSelect.after(options);
  4552. // Check if section element is disabled
  4553. if (!$select.is(':disabled')) {
  4554. $newSelect.dropdown({ 'hover': false });
  4555. }
  4556. // Copy tabindex
  4557. if ($select.attr('tabindex')) {
  4558. $($newSelect[0]).attr('tabindex', $select.attr('tabindex'));
  4559. }
  4560. $select.addClass('initialized');
  4561. $newSelect.on({
  4562. 'focus': function () {
  4563. if ($('ul.select-dropdown').not(options[0]).is(':visible')) {
  4564. $('input.select-dropdown').trigger('close');
  4565. $(window).off('click.select');
  4566. }
  4567. if (!options.is(':visible')) {
  4568. $(this).trigger('open', ['focus']);
  4569. var label = $(this).val();
  4570. if (multiple && label.indexOf(',') >= 0) {
  4571. label = label.split(',')[0];
  4572. }
  4573. var selectedOption = options.find('li').filter(function () {
  4574. return $(this).text().toLowerCase() === label.toLowerCase();
  4575. })[0];
  4576. activateOption(options, selectedOption, true);
  4577. $(window).off('click.select').on('click.select', function () {
  4578. multiple && (optionsHover || $newSelect.trigger('close'));
  4579. $(window).off('click.select');
  4580. });
  4581. }
  4582. },
  4583. 'click': function (e) {
  4584. e.stopPropagation();
  4585. }
  4586. });
  4587. $newSelect.on('blur', function () {
  4588. if (!multiple) {
  4589. $(this).trigger('close');
  4590. $(window).off('click.select');
  4591. }
  4592. options.find('li.selected').removeClass('selected');
  4593. });
  4594. options.hover(function () {
  4595. optionsHover = true;
  4596. }, function () {
  4597. optionsHover = false;
  4598. });
  4599. // Add initial multiple selections.
  4600. if (multiple) {
  4601. $select.find("option:selected:not(:disabled)").each(function () {
  4602. var index = this.index;
  4603. toggleEntryFromArray(valuesSelected, index, $select);
  4604. options.find("li:not(.optgroup)").eq(index).find(":checkbox").prop("checked", true);
  4605. });
  4606. }
  4607. /**
  4608. * Make option as selected and scroll to selected position
  4609. * @param {jQuery} collection Select options jQuery element
  4610. * @param {Element} newOption element of the new option
  4611. * @param {Boolean} firstActivation If on first activation of select
  4612. */
  4613. var activateOption = function (collection, newOption, firstActivation) {
  4614. if (newOption) {
  4615. collection.find('li.selected').removeClass('selected');
  4616. var option = $(newOption);
  4617. option.addClass('selected');
  4618. if (!multiple || !!firstActivation) {
  4619. options.scrollTo(option);
  4620. }
  4621. }
  4622. };
  4623. // Allow user to search by typing
  4624. // this array is cleared after 1 second
  4625. var filterQuery = [],
  4626. onKeyDown = function (e) {
  4627. // TAB - switch to another input
  4628. if (e.which == 9) {
  4629. $newSelect.trigger('close');
  4630. return;
  4631. }
  4632. // ARROW DOWN WHEN SELECT IS CLOSED - open select options
  4633. if (e.which == 40 && !options.is(':visible')) {
  4634. $newSelect.trigger('open');
  4635. return;
  4636. }
  4637. // ENTER WHEN SELECT IS CLOSED - submit form
  4638. if (e.which == 13 && !options.is(':visible')) {
  4639. return;
  4640. }
  4641. e.preventDefault();
  4642. // CASE WHEN USER TYPE LETTERS
  4643. var letter = String.fromCharCode(e.which).toLowerCase(),
  4644. nonLetters = [9, 13, 27, 38, 40];
  4645. if (letter && nonLetters.indexOf(e.which) === -1) {
  4646. filterQuery.push(letter);
  4647. var string = filterQuery.join(''),
  4648. newOption = options.find('li').filter(function () {
  4649. return $(this).text().toLowerCase().indexOf(string) === 0;
  4650. })[0];
  4651. if (newOption) {
  4652. activateOption(options, newOption);
  4653. }
  4654. }
  4655. // ENTER - select option and close when select options are opened
  4656. if (e.which == 13) {
  4657. var activeOption = options.find('li.selected:not(.disabled)')[0];
  4658. if (activeOption) {
  4659. $(activeOption).trigger('click');
  4660. if (!multiple) {
  4661. $newSelect.trigger('close');
  4662. }
  4663. }
  4664. }
  4665. // ARROW DOWN - move to next not disabled option
  4666. if (e.which == 40) {
  4667. if (options.find('li.selected').length) {
  4668. newOption = options.find('li.selected').next('li:not(.disabled)')[0];
  4669. } else {
  4670. newOption = options.find('li:not(.disabled)')[0];
  4671. }
  4672. activateOption(options, newOption);
  4673. }
  4674. // ESC - close options
  4675. if (e.which == 27) {
  4676. $newSelect.trigger('close');
  4677. }
  4678. // ARROW UP - move to previous not disabled option
  4679. if (e.which == 38) {
  4680. newOption = options.find('li.selected').prev('li:not(.disabled)')[0];
  4681. if (newOption) activateOption(options, newOption);
  4682. }
  4683. // Automaticaly clean filter query so user can search again by starting letters
  4684. setTimeout(function () {
  4685. filterQuery = [];
  4686. }, 1000);
  4687. };
  4688. $newSelect.on('keydown', onKeyDown);
  4689. });
  4690. function toggleEntryFromArray(entriesArray, entryIndex, select) {
  4691. var index = entriesArray.indexOf(entryIndex),
  4692. notAdded = index === -1;
  4693. if (notAdded) {
  4694. entriesArray.push(entryIndex);
  4695. } else {
  4696. entriesArray.splice(index, 1);
  4697. }
  4698. select.siblings('ul.dropdown-content').find('li:not(.optgroup)').eq(entryIndex).toggleClass('active');
  4699. // use notAdded instead of true (to detect if the option is selected or not)
  4700. select.find('option').eq(entryIndex).prop('selected', notAdded);
  4701. setValueToInput(entriesArray, select);
  4702. return notAdded;
  4703. }
  4704. function setValueToInput(entriesArray, select) {
  4705. var value = '';
  4706. for (var i = 0, count = entriesArray.length; i < count; i++) {
  4707. var text = select.find('option').eq(entriesArray[i]).text();
  4708. i === 0 ? value += text : value += ', ' + text;
  4709. }
  4710. if (value === '') {
  4711. value = select.find('option:disabled').eq(0).text();
  4712. }
  4713. select.siblings('input.select-dropdown').val(value);
  4714. }
  4715. };
  4716. })(jQuery);
  4717. ; (function ($) {
  4718. var methods = {
  4719. init: function (options) {
  4720. var defaults = {
  4721. indicators: true,
  4722. height: 400,
  4723. transition: 500,
  4724. interval: 6000
  4725. };
  4726. options = $.extend(defaults, options);
  4727. return this.each(function () {
  4728. // For each slider, we want to keep track of
  4729. // which slide is active and its associated content
  4730. var $this = $(this);
  4731. var $slider = $this.find('ul.slides').first();
  4732. var $slides = $slider.find('> li');
  4733. var $active_index = $slider.find('.active').index();
  4734. var $active, $indicators, $interval;
  4735. if ($active_index != -1) {
  4736. $active = $slides.eq($active_index);
  4737. }
  4738. // Transitions the caption depending on alignment
  4739. function captionTransition(caption, duration) {
  4740. if (caption.hasClass("center-align")) {
  4741. caption.velocity({ opacity: 0, translateY: -100 }, { duration: duration, queue: false });
  4742. } else if (caption.hasClass("right-align")) {
  4743. caption.velocity({ opacity: 0, translateX: 100 }, { duration: duration, queue: false });
  4744. } else if (caption.hasClass("left-align")) {
  4745. caption.velocity({ opacity: 0, translateX: -100 }, { duration: duration, queue: false });
  4746. }
  4747. }
  4748. // This function will transition the slide to any index of the next slide
  4749. function moveToSlide(index) {
  4750. // Wrap around indices.
  4751. if (index >= $slides.length) index = 0; else if (index < 0) index = $slides.length - 1;
  4752. $active_index = $slider.find('.active').index();
  4753. // Only do if index changes
  4754. if ($active_index != index) {
  4755. $active = $slides.eq($active_index);
  4756. $caption = $active.find('.caption');
  4757. $active.removeClass('active');
  4758. $active.velocity({ opacity: 0 }, {
  4759. duration: options.transition, queue: false, easing: 'easeOutQuad',
  4760. complete: function () {
  4761. $slides.not('.active').velocity({ opacity: 0, translateX: 0, translateY: 0 }, { duration: 0, queue: false });
  4762. }
  4763. });
  4764. captionTransition($caption, options.transition);
  4765. // Update indicators
  4766. if (options.indicators) {
  4767. $indicators.eq($active_index).removeClass('active');
  4768. }
  4769. $slides.eq(index).velocity({ opacity: 1 }, { duration: options.transition, queue: false, easing: 'easeOutQuad' });
  4770. $slides.eq(index).find('.caption').velocity({ opacity: 1, translateX: 0, translateY: 0 }, { duration: options.transition, delay: options.transition, queue: false, easing: 'easeOutQuad' });
  4771. $slides.eq(index).addClass('active');
  4772. // Update indicators
  4773. if (options.indicators) {
  4774. $indicators.eq(index).addClass('active');
  4775. }
  4776. }
  4777. }
  4778. // Set height of slider
  4779. // If fullscreen, do nothing
  4780. if (!$this.hasClass('fullscreen')) {
  4781. if (options.indicators) {
  4782. // Add height if indicators are present
  4783. $this.height(options.height + 40);
  4784. } else {
  4785. $this.height(options.height);
  4786. }
  4787. $slider.height(options.height);
  4788. }
  4789. // Set initial positions of captions
  4790. $slides.find('.caption').each(function () {
  4791. captionTransition($(this), 0);
  4792. });
  4793. // Move img src into background-image
  4794. $slides.find('img').each(function () {
  4795. var placeholderBase64 = 'data:image/gif;base64,R0lGODlhAQABAIABAP///wAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';
  4796. if ($(this).attr('src') !== placeholderBase64) {
  4797. $(this).css('background-image', 'url("' + $(this).attr('src') + '")');
  4798. $(this).attr('src', placeholderBase64);
  4799. }
  4800. });
  4801. // dynamically add indicators
  4802. if (options.indicators) {
  4803. $indicators = $('<ul class="indicators"></ul>');
  4804. $slides.each(function (index) {
  4805. var $indicator = $('<li class="indicator-item"></li>');
  4806. // Handle clicks on indicators
  4807. $indicator.click(function () {
  4808. var $parent = $slider.parent();
  4809. var curr_index = $parent.find($(this)).index();
  4810. moveToSlide(curr_index);
  4811. // reset interval
  4812. clearInterval($interval);
  4813. $interval = setInterval(function () {
  4814. $active_index = $slider.find('.active').index();
  4815. if ($slides.length == $active_index + 1) $active_index = 0; // loop to start
  4816. else $active_index += 1;
  4817. moveToSlide($active_index);
  4818. }, options.transition + options.interval);
  4819. });
  4820. $indicators.append($indicator);
  4821. });
  4822. $this.append($indicators);
  4823. $indicators = $this.find('ul.indicators').find('li.indicator-item');
  4824. }
  4825. if ($active) {
  4826. $active.show();
  4827. } else {
  4828. $slides.first().addClass('active').velocity({ opacity: 1 }, { duration: options.transition, queue: false, easing: 'easeOutQuad' });
  4829. $active_index = 0;
  4830. $active = $slides.eq($active_index);
  4831. // Update indicators
  4832. if (options.indicators) {
  4833. $indicators.eq($active_index).addClass('active');
  4834. }
  4835. }
  4836. // Adjust height to current slide
  4837. $active.find('img').each(function () {
  4838. $active.find('.caption').velocity({ opacity: 1, translateX: 0, translateY: 0 }, { duration: options.transition, queue: false, easing: 'easeOutQuad' });
  4839. });
  4840. // auto scroll
  4841. $interval = setInterval(function () {
  4842. $active_index = $slider.find('.active').index();
  4843. moveToSlide($active_index + 1);
  4844. }, options.transition + options.interval);
  4845. // HammerJS, Swipe navigation
  4846. // Touch Event
  4847. var panning = false;
  4848. var swipeLeft = false;
  4849. var swipeRight = false;
  4850. $this.hammer({
  4851. prevent_default: false
  4852. }).on('pan', function (e) {
  4853. if (e.gesture.pointerType === "touch") {
  4854. // reset interval
  4855. clearInterval($interval);
  4856. var direction = e.gesture.direction;
  4857. var x = e.gesture.deltaX;
  4858. var velocityX = e.gesture.velocityX;
  4859. var velocityY = e.gesture.velocityY;
  4860. $curr_slide = $slider.find('.active');
  4861. if (Math.abs(velocityX) > Math.abs(velocityY)) {
  4862. $curr_slide.velocity({
  4863. translateX: x
  4864. }, { duration: 50, queue: false, easing: 'easeOutQuad' });
  4865. }
  4866. // Swipe Left
  4867. if (direction === 4 && (x > $this.innerWidth() / 2 || velocityX < -0.65)) {
  4868. swipeRight = true;
  4869. }
  4870. // Swipe Right
  4871. else if (direction === 2 && (x < -1 * $this.innerWidth() / 2 || velocityX > 0.65)) {
  4872. swipeLeft = true;
  4873. }
  4874. // Make Slide Behind active slide visible
  4875. var next_slide;
  4876. if (swipeLeft) {
  4877. next_slide = $curr_slide.next();
  4878. if (next_slide.length === 0) {
  4879. next_slide = $slides.first();
  4880. }
  4881. next_slide.velocity({
  4882. opacity: 1
  4883. }, { duration: 300, queue: false, easing: 'easeOutQuad' });
  4884. }
  4885. if (swipeRight) {
  4886. next_slide = $curr_slide.prev();
  4887. if (next_slide.length === 0) {
  4888. next_slide = $slides.last();
  4889. }
  4890. next_slide.velocity({
  4891. opacity: 1
  4892. }, { duration: 300, queue: false, easing: 'easeOutQuad' });
  4893. }
  4894. }
  4895. }).on('panend', function (e) {
  4896. if (e.gesture.pointerType === "touch") {
  4897. $curr_slide = $slider.find('.active');
  4898. panning = false;
  4899. curr_index = $slider.find('.active').index();
  4900. if (!swipeRight && !swipeLeft || $slides.length <= 1) {
  4901. // Return to original spot
  4902. $curr_slide.velocity({
  4903. translateX: 0
  4904. }, { duration: 300, queue: false, easing: 'easeOutQuad' });
  4905. } else if (swipeLeft) {
  4906. moveToSlide(curr_index + 1);
  4907. $curr_slide.velocity({ translateX: -1 * $this.innerWidth() }, {
  4908. duration: 300, queue: false, easing: 'easeOutQuad',
  4909. complete: function () {
  4910. $curr_slide.velocity({ opacity: 0, translateX: 0 }, { duration: 0, queue: false });
  4911. }
  4912. });
  4913. } else if (swipeRight) {
  4914. moveToSlide(curr_index - 1);
  4915. $curr_slide.velocity({ translateX: $this.innerWidth() }, {
  4916. duration: 300, queue: false, easing: 'easeOutQuad',
  4917. complete: function () {
  4918. $curr_slide.velocity({ opacity: 0, translateX: 0 }, { duration: 0, queue: false });
  4919. }
  4920. });
  4921. }
  4922. swipeLeft = false;
  4923. swipeRight = false;
  4924. // Restart interval
  4925. clearInterval($interval);
  4926. $interval = setInterval(function () {
  4927. $active_index = $slider.find('.active').index();
  4928. if ($slides.length == $active_index + 1) $active_index = 0; // loop to start
  4929. else $active_index += 1;
  4930. moveToSlide($active_index);
  4931. }, options.transition + options.interval);
  4932. }
  4933. });
  4934. $this.on('sliderPause', function () {
  4935. clearInterval($interval);
  4936. });
  4937. $this.on('sliderStart', function () {
  4938. clearInterval($interval);
  4939. $interval = setInterval(function () {
  4940. $active_index = $slider.find('.active').index();
  4941. if ($slides.length == $active_index + 1) $active_index = 0; // loop to start
  4942. else $active_index += 1;
  4943. moveToSlide($active_index);
  4944. }, options.transition + options.interval);
  4945. });
  4946. $this.on('sliderNext', function () {
  4947. $active_index = $slider.find('.active').index();
  4948. moveToSlide($active_index + 1);
  4949. });
  4950. $this.on('sliderPrev', function () {
  4951. $active_index = $slider.find('.active').index();
  4952. moveToSlide($active_index - 1);
  4953. });
  4954. });
  4955. },
  4956. pause: function () {
  4957. $(this).trigger('sliderPause');
  4958. },
  4959. start: function () {
  4960. $(this).trigger('sliderStart');
  4961. },
  4962. next: function () {
  4963. $(this).trigger('sliderNext');
  4964. },
  4965. prev: function () {
  4966. $(this).trigger('sliderPrev');
  4967. }
  4968. };
  4969. $.fn.slider = function (methodOrOptions) {
  4970. if (methods[methodOrOptions]) {
  4971. return methods[methodOrOptions].apply(this, Array.prototype.slice.call(arguments, 1));
  4972. } else if (typeof methodOrOptions === 'object' || !methodOrOptions) {
  4973. // Default to "init"
  4974. return methods.init.apply(this, arguments);
  4975. } else {
  4976. $.error('Method ' + methodOrOptions + ' does not exist on jQuery.tooltip');
  4977. }
  4978. }; // Plugin end
  4979. })(jQuery);
  4980. ; (function ($) {
  4981. $(document).ready(function () {
  4982. $(document).on('click.card', '.card', function (e) {
  4983. if ($(this).find('> .card-reveal').length) {
  4984. var $card = $(e.target).closest('.card');
  4985. if ($card.data('initialOverflow') === undefined) {
  4986. $card.data('initialOverflow', $card.css('overflow') === undefined ? '' : $card.css('overflow'));
  4987. }
  4988. if ($(e.target).is($('.card-reveal .card-title>i'))) {
  4989. // Make Reveal animate down and display none
  4990. $(this).find('.card-reveal').velocity({ translateY: 0 }, {
  4991. duration: 225,
  4992. queue: false,
  4993. easing: 'easeInOutQuad',
  4994. complete: function () {
  4995. $(this).css({ display: 'none' });
  4996. $card.css('overflow', $card.data('initialOverflow'));
  4997. }
  4998. });
  4999. } else if ($(e.target).is($('.card .activator')) || $(e.target).is($('.card .activator i'))) {
  5000. $card.css('overflow', 'hidden');
  5001. $(this).find('.card-reveal').css({ display: 'block' }).velocity("stop", false).velocity({ translateY: '-100%' }, { duration: 300, queue: false, easing: 'easeInOutQuad' });
  5002. }
  5003. }
  5004. });
  5005. });
  5006. })(jQuery);
  5007. ; (function ($) {
  5008. var materialChipsDefaults = {
  5009. data: [],
  5010. placeholder: '',
  5011. secondaryPlaceholder: '',
  5012. autocompleteOptions: {}
  5013. };
  5014. $(document).ready(function () {
  5015. // Handle removal of static chips.
  5016. $(document).on('click', '.chip .close', function (e) {
  5017. var $chips = $(this).closest('.chips');
  5018. if ($chips.attr('data-initialized')) {
  5019. return;
  5020. }
  5021. $(this).closest('.chip').remove();
  5022. });
  5023. });
  5024. $.fn.material_chip = function (options) {
  5025. var self = this;
  5026. this.$el = $(this);
  5027. this.$document = $(document);
  5028. this.SELS = {
  5029. CHIPS: '.chips',
  5030. CHIP: '.chip',
  5031. INPUT: 'input',
  5032. DELETE: '.material-icons',
  5033. SELECTED_CHIP: '.selected'
  5034. };
  5035. if ('data' === options) {
  5036. return this.$el.data('chips');
  5037. }
  5038. var curr_options = $.extend({}, materialChipsDefaults, options);
  5039. self.hasAutocomplete = !$.isEmptyObject(curr_options.autocompleteOptions.data);
  5040. // Initialize
  5041. this.init = function () {
  5042. var i = 0;
  5043. var chips;
  5044. self.$el.each(function () {
  5045. var $chips = $(this);
  5046. var chipId = Materialize.guid();
  5047. self.chipId = chipId;
  5048. if (!curr_options.data || !(curr_options.data instanceof Array)) {
  5049. curr_options.data = [];
  5050. }
  5051. $chips.data('chips', curr_options.data);
  5052. $chips.attr('data-index', i);
  5053. $chips.attr('data-initialized', true);
  5054. if (!$chips.hasClass(self.SELS.CHIPS)) {
  5055. $chips.addClass('chips');
  5056. }
  5057. self.chips($chips, chipId);
  5058. i++;
  5059. });
  5060. };
  5061. this.handleEvents = function () {
  5062. var SELS = self.SELS;
  5063. self.$document.off('click.chips-focus', SELS.CHIPS).on('click.chips-focus', SELS.CHIPS, function (e) {
  5064. $(e.target).find(SELS.INPUT).focus();
  5065. });
  5066. self.$document.off('click.chips-select', SELS.CHIP).on('click.chips-select', SELS.CHIP, function (e) {
  5067. var $chip = $(e.target);
  5068. if ($chip.length) {
  5069. var wasSelected = $chip.hasClass('selected');
  5070. var $chips = $chip.closest(SELS.CHIPS);
  5071. $(SELS.CHIP).removeClass('selected');
  5072. if (!wasSelected) {
  5073. self.selectChip($chip.index(), $chips);
  5074. }
  5075. }
  5076. });
  5077. self.$document.off('keydown.chips').on('keydown.chips', function (e) {
  5078. if ($(e.target).is('input, textarea')) {
  5079. return;
  5080. }
  5081. // delete
  5082. var $chip = self.$document.find(SELS.CHIP + SELS.SELECTED_CHIP);
  5083. var $chips = $chip.closest(SELS.CHIPS);
  5084. var length = $chip.siblings(SELS.CHIP).length;
  5085. var index;
  5086. if (!$chip.length) {
  5087. return;
  5088. }
  5089. if (e.which === 8 || e.which === 46) {
  5090. e.preventDefault();
  5091. index = $chip.index();
  5092. self.deleteChip(index, $chips);
  5093. var selectIndex = null;
  5094. if (index + 1 < length) {
  5095. selectIndex = index;
  5096. } else if (index === length || index + 1 === length) {
  5097. selectIndex = length - 1;
  5098. }
  5099. if (selectIndex < 0) selectIndex = null;
  5100. if (null !== selectIndex) {
  5101. self.selectChip(selectIndex, $chips);
  5102. }
  5103. if (!length) $chips.find('input').focus();
  5104. // left
  5105. } else if (e.which === 37) {
  5106. index = $chip.index() - 1;
  5107. if (index < 0) {
  5108. return;
  5109. }
  5110. $(SELS.CHIP).removeClass('selected');
  5111. self.selectChip(index, $chips);
  5112. // right
  5113. } else if (e.which === 39) {
  5114. index = $chip.index() + 1;
  5115. $(SELS.CHIP).removeClass('selected');
  5116. if (index > length) {
  5117. $chips.find('input').focus();
  5118. return;
  5119. }
  5120. self.selectChip(index, $chips);
  5121. }
  5122. });
  5123. self.$document.off('focusin.chips', SELS.CHIPS + ' ' + SELS.INPUT).on('focusin.chips', SELS.CHIPS + ' ' + SELS.INPUT, function (e) {
  5124. var $currChips = $(e.target).closest(SELS.CHIPS);
  5125. $currChips.addClass('focus');
  5126. $currChips.siblings('label, .prefix').addClass('active');
  5127. $(SELS.CHIP).removeClass('selected');
  5128. });
  5129. self.$document.off('focusout.chips', SELS.CHIPS + ' ' + SELS.INPUT).on('focusout.chips', SELS.CHIPS + ' ' + SELS.INPUT, function (e) {
  5130. var $currChips = $(e.target).closest(SELS.CHIPS);
  5131. $currChips.removeClass('focus');
  5132. // Remove active if empty
  5133. if ($currChips.data('chips') === undefined || !$currChips.data('chips').length) {
  5134. $currChips.siblings('label').removeClass('active');
  5135. }
  5136. $currChips.siblings('.prefix').removeClass('active');
  5137. });
  5138. self.$document.off('keydown.chips-add', SELS.CHIPS + ' ' + SELS.INPUT).on('keydown.chips-add', SELS.CHIPS + ' ' + SELS.INPUT, function (e) {
  5139. var $target = $(e.target);
  5140. var $chips = $target.closest(SELS.CHIPS);
  5141. var chipsLength = $chips.children(SELS.CHIP).length;
  5142. // enter
  5143. if (13 === e.which) {
  5144. // Override enter if autocompleting.
  5145. if (self.hasAutocomplete && $chips.find('.autocomplete-content.dropdown-content').length && $chips.find('.autocomplete-content.dropdown-content').children().length) {
  5146. return;
  5147. }
  5148. e.preventDefault();
  5149. self.addChip({ tag: $target.val() }, $chips);
  5150. $target.val('');
  5151. return;
  5152. }
  5153. // delete or left
  5154. if ((8 === e.keyCode || 37 === e.keyCode) && '' === $target.val() && chipsLength) {
  5155. e.preventDefault();
  5156. self.selectChip(chipsLength - 1, $chips);
  5157. $target.blur();
  5158. return;
  5159. }
  5160. });
  5161. // Click on delete icon in chip.
  5162. self.$document.off('click.chips-delete', SELS.CHIPS + ' ' + SELS.DELETE).on('click.chips-delete', SELS.CHIPS + ' ' + SELS.DELETE, function (e) {
  5163. var $target = $(e.target);
  5164. var $chips = $target.closest(SELS.CHIPS);
  5165. var $chip = $target.closest(SELS.CHIP);
  5166. e.stopPropagation();
  5167. self.deleteChip($chip.index(), $chips);
  5168. $chips.find('input').focus();
  5169. });
  5170. };
  5171. this.chips = function ($chips, chipId) {
  5172. $chips.empty();
  5173. $chips.data('chips').forEach(function (elem) {
  5174. $chips.append(self.renderChip(elem));
  5175. });
  5176. $chips.append($('<input id="' + chipId + '" class="input" placeholder="">'));
  5177. self.setPlaceholder($chips);
  5178. // Set for attribute for label
  5179. var label = $chips.next('label');
  5180. if (label.length) {
  5181. label.attr('for', chipId);
  5182. if ($chips.data('chips') !== undefined && $chips.data('chips').length) {
  5183. label.addClass('active');
  5184. }
  5185. }
  5186. // Setup autocomplete if needed.
  5187. var input = $('#' + chipId);
  5188. if (self.hasAutocomplete) {
  5189. curr_options.autocompleteOptions.onAutocomplete = function (val) {
  5190. self.addChip({ tag: val }, $chips);
  5191. input.val('');
  5192. input.focus();
  5193. };
  5194. input.autocomplete(curr_options.autocompleteOptions);
  5195. }
  5196. };
  5197. /**
  5198. * Render chip jQuery element.
  5199. * @param {Object} elem
  5200. * @return {jQuery}
  5201. */
  5202. this.renderChip = function (elem) {
  5203. if (!elem.tag) return;
  5204. var $renderedChip = $('<div class="chip"></div>');
  5205. $renderedChip.text(elem.tag);
  5206. if (elem.image) {
  5207. $renderedChip.prepend($('<img />').attr('src', elem.image));
  5208. }
  5209. $renderedChip.append($('<i class="material-icons close">close</i>'));
  5210. return $renderedChip;
  5211. };
  5212. this.setPlaceholder = function ($chips) {
  5213. if ($chips.data('chips') !== undefined && !$chips.data('chips').length && curr_options.placeholder) {
  5214. $chips.find('input').prop('placeholder', curr_options.placeholder);
  5215. } else if (($chips.data('chips') === undefined || !!$chips.data('chips').length) && curr_options.secondaryPlaceholder) {
  5216. $chips.find('input').prop('placeholder', curr_options.secondaryPlaceholder);
  5217. }
  5218. };
  5219. this.isValid = function ($chips, elem) {
  5220. var chips = $chips.data('chips');
  5221. var exists = false;
  5222. for (var i = 0; i < chips.length; i++) {
  5223. if (chips[i].tag === elem.tag) {
  5224. exists = true;
  5225. return;
  5226. }
  5227. }
  5228. return '' !== elem.tag && !exists;
  5229. };
  5230. this.addChip = function (elem, $chips) {
  5231. if (!self.isValid($chips, elem)) {
  5232. return;
  5233. }
  5234. var $renderedChip = self.renderChip(elem);
  5235. var newData = [];
  5236. var oldData = $chips.data('chips');
  5237. for (var i = 0; i < oldData.length; i++) {
  5238. newData.push(oldData[i]);
  5239. }
  5240. newData.push(elem);
  5241. $chips.data('chips', newData);
  5242. $renderedChip.insertBefore($chips.find('input'));
  5243. $chips.trigger('chip.add', elem);
  5244. self.setPlaceholder($chips);
  5245. };
  5246. this.deleteChip = function (chipIndex, $chips) {
  5247. var chip = $chips.data('chips')[chipIndex];
  5248. $chips.find('.chip').eq(chipIndex).remove();
  5249. var newData = [];
  5250. var oldData = $chips.data('chips');
  5251. for (var i = 0; i < oldData.length; i++) {
  5252. if (i !== chipIndex) {
  5253. newData.push(oldData[i]);
  5254. }
  5255. }
  5256. $chips.data('chips', newData);
  5257. $chips.trigger('chip.delete', chip);
  5258. self.setPlaceholder($chips);
  5259. };
  5260. this.selectChip = function (chipIndex, $chips) {
  5261. var $chip = $chips.find('.chip').eq(chipIndex);
  5262. if ($chip && false === $chip.hasClass('selected')) {
  5263. $chip.addClass('selected');
  5264. $chips.trigger('chip.select', $chips.data('chips')[chipIndex]);
  5265. }
  5266. };
  5267. this.getChipsElement = function (index, $chips) {
  5268. return $chips.eq(index);
  5269. };
  5270. // init
  5271. this.init();
  5272. this.handleEvents();
  5273. };
  5274. })(jQuery);
  5275. ; (function ($) {
  5276. $.fn.pushpin = function (options) {
  5277. // Defaults
  5278. var defaults = {
  5279. top: 0,
  5280. bottom: Infinity,
  5281. offset: 0
  5282. };
  5283. // Remove pushpin event and classes
  5284. if (options === "remove") {
  5285. this.each(function () {
  5286. if (id = $(this).data('pushpin-id')) {
  5287. $(window).off('scroll.' + id);
  5288. $(this).removeData('pushpin-id').removeClass('pin-top pinned pin-bottom').removeAttr('style');
  5289. }
  5290. });
  5291. return false;
  5292. }
  5293. options = $.extend(defaults, options);
  5294. $index = 0;
  5295. return this.each(function () {
  5296. var $uniqueId = Materialize.guid(),
  5297. $this = $(this),
  5298. $original_offset = $(this).offset().top;
  5299. function removePinClasses(object) {
  5300. object.removeClass('pin-top');
  5301. object.removeClass('pinned');
  5302. object.removeClass('pin-bottom');
  5303. }
  5304. function updateElements(objects, scrolled) {
  5305. objects.each(function () {
  5306. // Add position fixed (because its between top and bottom)
  5307. if (options.top <= scrolled && options.bottom >= scrolled && !$(this).hasClass('pinned')) {
  5308. removePinClasses($(this));
  5309. $(this).css('top', options.offset);
  5310. $(this).addClass('pinned');
  5311. }
  5312. // Add pin-top (when scrolled position is above top)
  5313. if (scrolled < options.top && !$(this).hasClass('pin-top')) {
  5314. removePinClasses($(this));
  5315. $(this).css('top', 0);
  5316. $(this).addClass('pin-top');
  5317. }
  5318. // Add pin-bottom (when scrolled position is below bottom)
  5319. if (scrolled > options.bottom && !$(this).hasClass('pin-bottom')) {
  5320. removePinClasses($(this));
  5321. $(this).addClass('pin-bottom');
  5322. $(this).css('top', options.bottom - $original_offset);
  5323. }
  5324. });
  5325. }
  5326. $(this).data('pushpin-id', $uniqueId);
  5327. updateElements($this, $(window).scrollTop());
  5328. $(window).on('scroll.' + $uniqueId, function () {
  5329. var $scrolled = $(window).scrollTop() + options.offset;
  5330. updateElements($this, $scrolled);
  5331. });
  5332. });
  5333. };
  5334. })(jQuery);; (function ($) {
  5335. $(document).ready(function () {
  5336. // jQuery reverse
  5337. $.fn.reverse = [].reverse;
  5338. // Hover behaviour: make sure this doesn't work on .click-to-toggle FABs!
  5339. $(document).on('mouseenter.fixedActionBtn', '.fixed-action-btn:not(.click-to-toggle):not(.toolbar)', function (e) {
  5340. var $this = $(this);
  5341. openFABMenu($this);
  5342. });
  5343. $(document).on('mouseleave.fixedActionBtn', '.fixed-action-btn:not(.click-to-toggle):not(.toolbar)', function (e) {
  5344. var $this = $(this);
  5345. closeFABMenu($this);
  5346. });
  5347. // Toggle-on-click behaviour.
  5348. $(document).on('click.fabClickToggle', '.fixed-action-btn.click-to-toggle > a', function (e) {
  5349. var $this = $(this);
  5350. var $menu = $this.parent();
  5351. if ($menu.hasClass('active')) {
  5352. closeFABMenu($menu);
  5353. } else {
  5354. openFABMenu($menu);
  5355. }
  5356. });
  5357. // Toolbar transition behaviour.
  5358. $(document).on('click.fabToolbar', '.fixed-action-btn.toolbar > a', function (e) {
  5359. var $this = $(this);
  5360. var $menu = $this.parent();
  5361. FABtoToolbar($menu);
  5362. });
  5363. });
  5364. $.fn.extend({
  5365. openFAB: function () {
  5366. openFABMenu($(this));
  5367. },
  5368. closeFAB: function () {
  5369. closeFABMenu($(this));
  5370. },
  5371. openToolbar: function () {
  5372. FABtoToolbar($(this));
  5373. },
  5374. closeToolbar: function () {
  5375. toolbarToFAB($(this));
  5376. }
  5377. });
  5378. var openFABMenu = function (btn) {
  5379. var $this = btn;
  5380. if ($this.hasClass('active') === false) {
  5381. // Get direction option
  5382. var horizontal = $this.hasClass('horizontal');
  5383. var offsetY, offsetX;
  5384. if (horizontal === true) {
  5385. offsetX = 40;
  5386. } else {
  5387. offsetY = 40;
  5388. }
  5389. $this.addClass('active');
  5390. $this.find('ul .btn-floating').velocity({ scaleY: ".4", scaleX: ".4", translateY: offsetY + 'px', translateX: offsetX + 'px' }, { duration: 0 });
  5391. var time = 0;
  5392. $this.find('ul .btn-floating').reverse().each(function () {
  5393. $(this).velocity({ opacity: "1", scaleX: "1", scaleY: "1", translateY: "0", translateX: '0' }, { duration: 80, delay: time });
  5394. time += 40;
  5395. });
  5396. }
  5397. };
  5398. var closeFABMenu = function (btn) {
  5399. var $this = btn;
  5400. // Get direction option
  5401. var horizontal = $this.hasClass('horizontal');
  5402. var offsetY, offsetX;
  5403. if (horizontal === true) {
  5404. offsetX = 40;
  5405. } else {
  5406. offsetY = 40;
  5407. }
  5408. $this.removeClass('active');
  5409. var time = 0;
  5410. $this.find('ul .btn-floating').velocity("stop", true);
  5411. $this.find('ul .btn-floating').velocity({ opacity: "0", scaleX: ".4", scaleY: ".4", translateY: offsetY + 'px', translateX: offsetX + 'px' }, { duration: 80 });
  5412. };
  5413. /**
  5414. * Transform FAB into toolbar
  5415. * @param {Object} object jQuery object
  5416. */
  5417. var FABtoToolbar = function (btn) {
  5418. if (btn.attr('data-open') === "true") {
  5419. return;
  5420. }
  5421. var offsetX, offsetY, scaleFactor;
  5422. var windowWidth = window.innerWidth;
  5423. var windowHeight = window.innerHeight;
  5424. var btnRect = btn[0].getBoundingClientRect();
  5425. var anchor = btn.find('> a').first();
  5426. var menu = btn.find('> ul').first();
  5427. var backdrop = $('<div class="fab-backdrop"></div>');
  5428. var fabColor = anchor.css('background-color');
  5429. anchor.append(backdrop);
  5430. offsetX = btnRect.left - windowWidth / 2 + btnRect.width / 2;
  5431. offsetY = windowHeight - btnRect.bottom;
  5432. scaleFactor = windowWidth / backdrop.width();
  5433. btn.attr('data-origin-bottom', btnRect.bottom);
  5434. btn.attr('data-origin-left', btnRect.left);
  5435. btn.attr('data-origin-width', btnRect.width);
  5436. // Set initial state
  5437. btn.addClass('active');
  5438. btn.attr('data-open', true);
  5439. btn.css({
  5440. 'text-align': 'center',
  5441. width: '100%',
  5442. bottom: 0,
  5443. left: 0,
  5444. transform: 'translateX(' + offsetX + 'px)',
  5445. transition: 'none'
  5446. });
  5447. anchor.css({
  5448. transform: 'translateY(' + -offsetY + 'px)',
  5449. transition: 'none'
  5450. });
  5451. backdrop.css({
  5452. 'background-color': fabColor
  5453. });
  5454. setTimeout(function () {
  5455. btn.css({
  5456. transform: '',
  5457. transition: 'transform .2s cubic-bezier(0.550, 0.085, 0.680, 0.530), background-color 0s linear .2s'
  5458. });
  5459. anchor.css({
  5460. overflow: 'visible',
  5461. transform: '',
  5462. transition: 'transform .2s'
  5463. });
  5464. setTimeout(function () {
  5465. btn.css({
  5466. overflow: 'hidden',
  5467. 'background-color': fabColor
  5468. });
  5469. backdrop.css({
  5470. transform: 'scale(' + scaleFactor + ')',
  5471. transition: 'transform .2s cubic-bezier(0.550, 0.055, 0.675, 0.190)'
  5472. });
  5473. menu.find('> li > a').css({
  5474. opacity: 1
  5475. });
  5476. // Scroll to close.
  5477. $(window).on('scroll.fabToolbarClose', function () {
  5478. toolbarToFAB(btn);
  5479. $(window).off('scroll.fabToolbarClose');
  5480. $(document).off('click.fabToolbarClose');
  5481. });
  5482. $(document).on('click.fabToolbarClose', function (e) {
  5483. if (!$(e.target).closest(menu).length) {
  5484. toolbarToFAB(btn);
  5485. $(window).off('scroll.fabToolbarClose');
  5486. $(document).off('click.fabToolbarClose');
  5487. }
  5488. });
  5489. }, 100);
  5490. }, 0);
  5491. };
  5492. /**
  5493. * Transform toolbar back into FAB
  5494. * @param {Object} object jQuery object
  5495. */
  5496. var toolbarToFAB = function (btn) {
  5497. if (btn.attr('data-open') !== "true") {
  5498. return;
  5499. }
  5500. var offsetX, offsetY, scaleFactor;
  5501. var windowWidth = window.innerWidth;
  5502. var windowHeight = window.innerHeight;
  5503. var btnWidth = btn.attr('data-origin-width');
  5504. var btnBottom = btn.attr('data-origin-bottom');
  5505. var btnLeft = btn.attr('data-origin-left');
  5506. var anchor = btn.find('> .btn-floating').first();
  5507. var menu = btn.find('> ul').first();
  5508. var backdrop = btn.find('.fab-backdrop');
  5509. var fabColor = anchor.css('background-color');
  5510. offsetX = btnLeft - windowWidth / 2 + btnWidth / 2;
  5511. offsetY = windowHeight - btnBottom;
  5512. scaleFactor = windowWidth / backdrop.width();
  5513. // Hide backdrop
  5514. btn.removeClass('active');
  5515. btn.attr('data-open', false);
  5516. btn.css({
  5517. 'background-color': 'transparent',
  5518. transition: 'none'
  5519. });
  5520. anchor.css({
  5521. transition: 'none'
  5522. });
  5523. backdrop.css({
  5524. transform: 'scale(0)',
  5525. 'background-color': fabColor
  5526. });
  5527. menu.find('> li > a').css({
  5528. opacity: ''
  5529. });
  5530. setTimeout(function () {
  5531. backdrop.remove();
  5532. // Set initial state.
  5533. btn.css({
  5534. 'text-align': '',
  5535. width: '',
  5536. bottom: '',
  5537. left: '',
  5538. overflow: '',
  5539. 'background-color': '',
  5540. transform: 'translate3d(' + -offsetX + 'px,0,0)'
  5541. });
  5542. anchor.css({
  5543. overflow: '',
  5544. transform: 'translate3d(0,' + offsetY + 'px,0)'
  5545. });
  5546. setTimeout(function () {
  5547. btn.css({
  5548. transform: 'translate3d(0,0,0)',
  5549. transition: 'transform .2s'
  5550. });
  5551. anchor.css({
  5552. transform: 'translate3d(0,0,0)',
  5553. transition: 'transform .2s cubic-bezier(0.550, 0.055, 0.675, 0.190)'
  5554. });
  5555. }, 20);
  5556. }, 200);
  5557. };
  5558. })(jQuery);
  5559. ; (function ($) {
  5560. // Image transition function
  5561. Materialize.fadeInImage = function (selectorOrEl) {
  5562. var element;
  5563. if (typeof selectorOrEl === 'string') {
  5564. element = $(selectorOrEl);
  5565. } else if (typeof selectorOrEl === 'object') {
  5566. element = selectorOrEl;
  5567. } else {
  5568. return;
  5569. }
  5570. element.css({ opacity: 0 });
  5571. $(element).velocity({ opacity: 1 }, {
  5572. duration: 650,
  5573. queue: false,
  5574. easing: 'easeOutSine'
  5575. });
  5576. $(element).velocity({ opacity: 1 }, {
  5577. duration: 1300,
  5578. queue: false,
  5579. easing: 'swing',
  5580. step: function (now, fx) {
  5581. fx.start = 100;
  5582. var grayscale_setting = now / 100;
  5583. var brightness_setting = 150 - (100 - now) / 1.75;
  5584. if (brightness_setting < 100) {
  5585. brightness_setting = 100;
  5586. }
  5587. if (now >= 0) {
  5588. $(this).css({
  5589. "-webkit-filter": "grayscale(" + grayscale_setting + ")" + "brightness(" + brightness_setting + "%)",
  5590. "filter": "grayscale(" + grayscale_setting + ")" + "brightness(" + brightness_setting + "%)"
  5591. });
  5592. }
  5593. }
  5594. });
  5595. };
  5596. // Horizontal staggered list
  5597. Materialize.showStaggeredList = function (selectorOrEl) {
  5598. var element;
  5599. if (typeof selectorOrEl === 'string') {
  5600. element = $(selectorOrEl);
  5601. } else if (typeof selectorOrEl === 'object') {
  5602. element = selectorOrEl;
  5603. } else {
  5604. return;
  5605. }
  5606. var time = 0;
  5607. element.find('li').velocity({ translateX: "-100px" }, { duration: 0 });
  5608. element.find('li').each(function () {
  5609. $(this).velocity({ opacity: "1", translateX: "0" }, { duration: 800, delay: time, easing: [60, 10] });
  5610. time += 120;
  5611. });
  5612. };
  5613. $(document).ready(function () {
  5614. // Hardcoded .staggered-list scrollFire
  5615. // var staggeredListOptions = [];
  5616. // $('ul.staggered-list').each(function (i) {
  5617. // var label = 'scrollFire-' + i;
  5618. // $(this).addClass(label);
  5619. // staggeredListOptions.push(
  5620. // {selector: 'ul.staggered-list.' + label,
  5621. // offset: 200,
  5622. // callback: 'showStaggeredList("ul.staggered-list.' + label + '")'});
  5623. // });
  5624. // scrollFire(staggeredListOptions);
  5625. // HammerJS, Swipe navigation
  5626. // Touch Event
  5627. var swipeLeft = false;
  5628. var swipeRight = false;
  5629. // Dismissible Collections
  5630. $('.dismissable').each(function () {
  5631. $(this).hammer({
  5632. prevent_default: false
  5633. }).on('pan', function (e) {
  5634. if (e.gesture.pointerType === "touch") {
  5635. var $this = $(this);
  5636. var direction = e.gesture.direction;
  5637. var x = e.gesture.deltaX;
  5638. var velocityX = e.gesture.velocityX;
  5639. $this.velocity({
  5640. translateX: x
  5641. }, { duration: 50, queue: false, easing: 'easeOutQuad' });
  5642. // Swipe Left
  5643. if (direction === 4 && (x > $this.innerWidth() / 2 || velocityX < -0.75)) {
  5644. swipeLeft = true;
  5645. }
  5646. // Swipe Right
  5647. if (direction === 2 && (x < -1 * $this.innerWidth() / 2 || velocityX > 0.75)) {
  5648. swipeRight = true;
  5649. }
  5650. }
  5651. }).on('panend', function (e) {
  5652. // Reset if collection is moved back into original position
  5653. if (Math.abs(e.gesture.deltaX) < $(this).innerWidth() / 2) {
  5654. swipeRight = false;
  5655. swipeLeft = false;
  5656. }
  5657. if (e.gesture.pointerType === "touch") {
  5658. var $this = $(this);
  5659. if (swipeLeft || swipeRight) {
  5660. var fullWidth;
  5661. if (swipeLeft) {
  5662. fullWidth = $this.innerWidth();
  5663. } else {
  5664. fullWidth = -1 * $this.innerWidth();
  5665. }
  5666. $this.velocity({
  5667. translateX: fullWidth
  5668. }, {
  5669. duration: 100, queue: false, easing: 'easeOutQuad', complete: function () {
  5670. $this.css('border', 'none');
  5671. $this.velocity({
  5672. height: 0, padding: 0
  5673. }, {
  5674. duration: 200, queue: false, easing: 'easeOutQuad', complete: function () {
  5675. $this.remove();
  5676. }
  5677. });
  5678. }
  5679. });
  5680. } else {
  5681. $this.velocity({
  5682. translateX: 0
  5683. }, { duration: 100, queue: false, easing: 'easeOutQuad' });
  5684. }
  5685. swipeLeft = false;
  5686. swipeRight = false;
  5687. }
  5688. });
  5689. });
  5690. // time = 0
  5691. // // Vertical Staggered list
  5692. // $('ul.staggered-list.vertical li').velocity(
  5693. // { translateY: "100px"},
  5694. // { duration: 0 });
  5695. // $('ul.staggered-list.vertical li').each(function() {
  5696. // $(this).velocity(
  5697. // { opacity: "1", translateY: "0"},
  5698. // { duration: 800, delay: time, easing: [60, 25] });
  5699. // time += 120;
  5700. // });
  5701. // // Fade in and Scale
  5702. // $('.fade-in.scale').velocity(
  5703. // { scaleX: .4, scaleY: .4, translateX: -600},
  5704. // { duration: 0});
  5705. // $('.fade-in').each(function() {
  5706. // $(this).velocity(
  5707. // { opacity: "1", scaleX: 1, scaleY: 1, translateX: 0},
  5708. // { duration: 800, easing: [60, 10] });
  5709. // });
  5710. });
  5711. })(jQuery);
  5712. ; (function ($) {
  5713. var scrollFireEventsHandled = false;
  5714. // Input: Array of JSON objects {selector, offset, callback}
  5715. Materialize.scrollFire = function (options) {
  5716. var onScroll = function () {
  5717. var windowScroll = window.pageYOffset + window.innerHeight;
  5718. for (var i = 0; i < options.length; i++) {
  5719. // Get options from each line
  5720. var value = options[i];
  5721. var selector = value.selector,
  5722. offset = value.offset,
  5723. callback = value.callback;
  5724. var currentElement = document.querySelector(selector);
  5725. if (currentElement !== null) {
  5726. var elementOffset = currentElement.getBoundingClientRect().top + window.pageYOffset;
  5727. if (windowScroll > elementOffset + offset) {
  5728. if (value.done !== true) {
  5729. if (typeof callback === 'function') {
  5730. callback.call(this, currentElement);
  5731. } else if (typeof callback === 'string') {
  5732. var callbackFunc = new Function(callback);
  5733. callbackFunc(currentElement);
  5734. }
  5735. value.done = true;
  5736. }
  5737. }
  5738. }
  5739. }
  5740. };
  5741. var throttledScroll = Materialize.throttle(function () {
  5742. onScroll();
  5743. }, options.throttle || 100);
  5744. if (!scrollFireEventsHandled) {
  5745. window.addEventListener("scroll", throttledScroll);
  5746. window.addEventListener("resize", throttledScroll);
  5747. scrollFireEventsHandled = true;
  5748. }
  5749. // perform a scan once, after current execution context, and after dom is ready
  5750. setTimeout(throttledScroll, 0);
  5751. };
  5752. })(jQuery);
  5753. ; /*!
  5754. * pickadate.js v3.5.0, 2014/04/13
  5755. * By Amsul, http://amsul.ca
  5756. * Hosted on http://amsul.github.io/pickadate.js
  5757. * Licensed under MIT
  5758. */
  5759. (function (factory) {
  5760. Materialize.Picker = factory(jQuery);
  5761. })(function ($) {
  5762. var $window = $(window);
  5763. var $document = $(document);
  5764. var $html = $(document.documentElement);
  5765. /**
  5766. * The picker constructor that creates a blank picker.
  5767. */
  5768. function PickerConstructor(ELEMENT, NAME, COMPONENT, OPTIONS) {
  5769. // If there’s no element, return the picker constructor.
  5770. if (!ELEMENT) return PickerConstructor;
  5771. var IS_DEFAULT_THEME = false,
  5772. // The state of the picker.
  5773. STATE = {
  5774. id: ELEMENT.id || 'P' + Math.abs(~~(Math.random() * new Date()))
  5775. },
  5776. // Merge the defaults and options passed.
  5777. SETTINGS = COMPONENT ? $.extend(true, {}, COMPONENT.defaults, OPTIONS) : OPTIONS || {},
  5778. // Merge the default classes with the settings classes.
  5779. CLASSES = $.extend({}, PickerConstructor.klasses(), SETTINGS.klass),
  5780. // The element node wrapper into a jQuery object.
  5781. $ELEMENT = $(ELEMENT),
  5782. // Pseudo picker constructor.
  5783. PickerInstance = function () {
  5784. return this.start();
  5785. },
  5786. // The picker prototype.
  5787. P = PickerInstance.prototype = {
  5788. constructor: PickerInstance,
  5789. $node: $ELEMENT,
  5790. /**
  5791. * Initialize everything
  5792. */
  5793. start: function () {
  5794. // If it’s already started, do nothing.
  5795. if (STATE && STATE.start) return P;
  5796. // Update the picker states.
  5797. STATE.methods = {};
  5798. STATE.start = true;
  5799. STATE.open = false;
  5800. STATE.type = ELEMENT.type;
  5801. // Confirm focus state, convert into text input to remove UA stylings,
  5802. // and set as readonly to prevent keyboard popup.
  5803. ELEMENT.autofocus = ELEMENT == getActiveElement();
  5804. ELEMENT.readOnly = !SETTINGS.editable;
  5805. ELEMENT.id = ELEMENT.id || STATE.id;
  5806. if (ELEMENT.type != 'text') {
  5807. ELEMENT.type = 'text';
  5808. }
  5809. // Create a new picker component with the settings.
  5810. P.component = new COMPONENT(P, SETTINGS);
  5811. // Create the picker root with a holder and then prepare it.
  5812. P.$root = $(PickerConstructor._.node('div', createWrappedComponent(), CLASSES.picker, 'id="' + ELEMENT.id + '_root" tabindex="0"'));
  5813. prepareElementRoot();
  5814. // If there’s a format for the hidden input element, create the element.
  5815. if (SETTINGS.formatSubmit) {
  5816. prepareElementHidden();
  5817. }
  5818. // Prepare the input element.
  5819. prepareElement();
  5820. // Insert the root as specified in the settings.
  5821. if (SETTINGS.container) $(SETTINGS.container).append(P.$root); else $ELEMENT.before(P.$root);
  5822. // Bind the default component and settings events.
  5823. P.on({
  5824. start: P.component.onStart,
  5825. render: P.component.onRender,
  5826. stop: P.component.onStop,
  5827. open: P.component.onOpen,
  5828. close: P.component.onClose,
  5829. set: P.component.onSet
  5830. }).on({
  5831. start: SETTINGS.onStart,
  5832. render: SETTINGS.onRender,
  5833. stop: SETTINGS.onStop,
  5834. open: SETTINGS.onOpen,
  5835. close: SETTINGS.onClose,
  5836. set: SETTINGS.onSet
  5837. });
  5838. // Once we’re all set, check the theme in use.
  5839. IS_DEFAULT_THEME = isUsingDefaultTheme(P.$root.children()[0]);
  5840. // If the element has autofocus, open the picker.
  5841. if (ELEMENT.autofocus) {
  5842. P.open();
  5843. }
  5844. // Trigger queued the “start” and “render” events.
  5845. return P.trigger('start').trigger('render');
  5846. }, //start
  5847. /**
  5848. * Render a new picker
  5849. */
  5850. render: function (entireComponent) {
  5851. // Insert a new component holder in the root or box.
  5852. if (entireComponent) P.$root.html(createWrappedComponent()); else P.$root.find('.' + CLASSES.box).html(P.component.nodes(STATE.open));
  5853. // Trigger the queued “render” events.
  5854. return P.trigger('render');
  5855. }, //render
  5856. /**
  5857. * Destroy everything
  5858. */
  5859. stop: function () {
  5860. // If it’s already stopped, do nothing.
  5861. if (!STATE.start) return P;
  5862. // Then close the picker.
  5863. P.close();
  5864. // Remove the hidden field.
  5865. if (P._hidden) {
  5866. P._hidden.parentNode.removeChild(P._hidden);
  5867. }
  5868. // Remove the root.
  5869. P.$root.remove();
  5870. // Remove the input class, remove the stored data, and unbind
  5871. // the events (after a tick for IE - see `P.close`).
  5872. $ELEMENT.removeClass(CLASSES.input).removeData(NAME);
  5873. setTimeout(function () {
  5874. $ELEMENT.off('.' + STATE.id);
  5875. }, 0);
  5876. // Restore the element state
  5877. ELEMENT.type = STATE.type;
  5878. ELEMENT.readOnly = false;
  5879. // Trigger the queued “stop” events.
  5880. P.trigger('stop');
  5881. // Reset the picker states.
  5882. STATE.methods = {};
  5883. STATE.start = false;
  5884. return P;
  5885. }, //stop
  5886. /**
  5887. * Open up the picker
  5888. */
  5889. open: function (dontGiveFocus) {
  5890. // If it’s already open, do nothing.
  5891. if (STATE.open) return P;
  5892. // Add the “active” class.
  5893. $ELEMENT.addClass(CLASSES.active);
  5894. aria(ELEMENT, 'expanded', true);
  5895. // * A Firefox bug, when `html` has `overflow:hidden`, results in
  5896. // killing transitions :(. So add the “opened” state on the next tick.
  5897. // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=625289
  5898. setTimeout(function () {
  5899. // Add the “opened” class to the picker root.
  5900. P.$root.addClass(CLASSES.opened);
  5901. aria(P.$root[0], 'hidden', false);
  5902. }, 0);
  5903. // If we have to give focus, bind the element and doc events.
  5904. if (dontGiveFocus !== false) {
  5905. // Set it as open.
  5906. STATE.open = true;
  5907. // Prevent the page from scrolling.
  5908. if (IS_DEFAULT_THEME) {
  5909. $html.css('overflow', 'hidden').css('padding-right', '+=' + getScrollbarWidth());
  5910. }
  5911. // Pass focus to the root element’s jQuery object.
  5912. // * Workaround for iOS8 to bring the picker’s root into view.
  5913. P.$root.eq(0).focus();
  5914. // Bind the document events.
  5915. $document.on('click.' + STATE.id + ' focusin.' + STATE.id, function (event) {
  5916. var target = event.target;
  5917. // If the target of the event is not the element, close the picker picker.
  5918. // * Don’t worry about clicks or focusins on the root because those don’t bubble up.
  5919. // Also, for Firefox, a click on an `option` element bubbles up directly
  5920. // to the doc. So make sure the target wasn't the doc.
  5921. // * In Firefox stopPropagation() doesn’t prevent right-click events from bubbling,
  5922. // which causes the picker to unexpectedly close when right-clicking it. So make
  5923. // sure the event wasn’t a right-click.
  5924. if (target != ELEMENT && target != document && event.which != 3) {
  5925. // If the target was the holder that covers the screen,
  5926. // keep the element focused to maintain tabindex.
  5927. P.close(target === P.$root.children()[0]);
  5928. }
  5929. }).on('keydown.' + STATE.id, function (event) {
  5930. var
  5931. // Get the keycode.
  5932. keycode = event.keyCode,
  5933. // Translate that to a selection change.
  5934. keycodeToMove = P.component.key[keycode],
  5935. // Grab the target.
  5936. target = event.target;
  5937. // On escape, close the picker and give focus.
  5938. if (keycode == 27) {
  5939. P.close(true);
  5940. }
  5941. // Check if there is a key movement or “enter” keypress on the element.
  5942. else if (target == P.$root[0] && (keycodeToMove || keycode == 13)) {
  5943. // Prevent the default action to stop page movement.
  5944. event.preventDefault();
  5945. // Trigger the key movement action.
  5946. if (keycodeToMove) {
  5947. PickerConstructor._.trigger(P.component.key.go, P, [PickerConstructor._.trigger(keycodeToMove)]);
  5948. }
  5949. // On “enter”, if the highlighted item isn’t disabled, set the value and close.
  5950. else if (!P.$root.find('.' + CLASSES.highlighted).hasClass(CLASSES.disabled)) {
  5951. P.set('select', P.component.item.highlight);
  5952. if (SETTINGS.closeOnSelect) {
  5953. P.close(true);
  5954. }
  5955. }
  5956. }
  5957. // If the target is within the root and “enter” is pressed,
  5958. // prevent the default action and trigger a click on the target instead.
  5959. else if ($.contains(P.$root[0], target) && keycode == 13) {
  5960. event.preventDefault();
  5961. target.click();
  5962. }
  5963. });
  5964. }
  5965. // Trigger the queued “open” events.
  5966. return P.trigger('open');
  5967. }, //open
  5968. /**
  5969. * Close the picker
  5970. */
  5971. close: function (giveFocus) {
  5972. // If we need to give focus, do it before changing states.
  5973. if (giveFocus) {
  5974. // ....ah yes! It would’ve been incomplete without a crazy workaround for IE :|
  5975. // The focus is triggered *after* the close has completed - causing it
  5976. // to open again. So unbind and rebind the event at the next tick.
  5977. P.$root.off('focus.toOpen').eq(0).focus();
  5978. setTimeout(function () {
  5979. P.$root.on('focus.toOpen', handleFocusToOpenEvent);
  5980. }, 0);
  5981. }
  5982. // Remove the “active” class.
  5983. $ELEMENT.removeClass(CLASSES.active);
  5984. aria(ELEMENT, 'expanded', false);
  5985. // * A Firefox bug, when `html` has `overflow:hidden`, results in
  5986. // killing transitions :(. So remove the “opened” state on the next tick.
  5987. // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=625289
  5988. setTimeout(function () {
  5989. // Remove the “opened” and “focused” class from the picker root.
  5990. P.$root.removeClass(CLASSES.opened + ' ' + CLASSES.focused);
  5991. aria(P.$root[0], 'hidden', true);
  5992. }, 0);
  5993. // If it’s already closed, do nothing more.
  5994. if (!STATE.open) return P;
  5995. // Set it as closed.
  5996. STATE.open = false;
  5997. // Allow the page to scroll.
  5998. if (IS_DEFAULT_THEME) {
  5999. $html.css('overflow', '').css('padding-right', '-=' + getScrollbarWidth());
  6000. }
  6001. // Unbind the document events.
  6002. $document.off('.' + STATE.id);
  6003. // Trigger the queued “close” events.
  6004. return P.trigger('close');
  6005. }, //close
  6006. /**
  6007. * Clear the values
  6008. */
  6009. clear: function (options) {
  6010. return P.set('clear', null, options);
  6011. }, //clear
  6012. /**
  6013. * Set something
  6014. */
  6015. set: function (thing, value, options) {
  6016. var thingItem,
  6017. thingValue,
  6018. thingIsObject = $.isPlainObject(thing),
  6019. thingObject = thingIsObject ? thing : {};
  6020. // Make sure we have usable options.
  6021. options = thingIsObject && $.isPlainObject(value) ? value : options || {};
  6022. if (thing) {
  6023. // If the thing isn’t an object, make it one.
  6024. if (!thingIsObject) {
  6025. thingObject[thing] = value;
  6026. }
  6027. // Go through the things of items to set.
  6028. for (thingItem in thingObject) {
  6029. // Grab the value of the thing.
  6030. thingValue = thingObject[thingItem];
  6031. // First, if the item exists and there’s a value, set it.
  6032. if (thingItem in P.component.item) {
  6033. if (thingValue === undefined) thingValue = null;
  6034. P.component.set(thingItem, thingValue, options);
  6035. }
  6036. // Then, check to update the element value and broadcast a change.
  6037. if (thingItem == 'select' || thingItem == 'clear') {
  6038. $ELEMENT.val(thingItem == 'clear' ? '' : P.get(thingItem, SETTINGS.format)).trigger('change');
  6039. }
  6040. }
  6041. // Render a new picker.
  6042. P.render();
  6043. }
  6044. // When the method isn’t muted, trigger queued “set” events and pass the `thingObject`.
  6045. return options.muted ? P : P.trigger('set', thingObject);
  6046. }, //set
  6047. /**
  6048. * Get something
  6049. */
  6050. get: function (thing, format) {
  6051. // Make sure there’s something to get.
  6052. thing = thing || 'value';
  6053. // If a picker state exists, return that.
  6054. if (STATE[thing] != null) {
  6055. return STATE[thing];
  6056. }
  6057. // Return the submission value, if that.
  6058. if (thing == 'valueSubmit') {
  6059. if (P._hidden) {
  6060. return P._hidden.value;
  6061. }
  6062. thing = 'value';
  6063. }
  6064. // Return the value, if that.
  6065. if (thing == 'value') {
  6066. return ELEMENT.value;
  6067. }
  6068. // Check if a component item exists, return that.
  6069. if (thing in P.component.item) {
  6070. if (typeof format == 'string') {
  6071. var thingValue = P.component.get(thing);
  6072. return thingValue ? PickerConstructor._.trigger(P.component.formats.toString, P.component, [format, thingValue]) : '';
  6073. }
  6074. return P.component.get(thing);
  6075. }
  6076. }, //get
  6077. /**
  6078. * Bind events on the things.
  6079. */
  6080. on: function (thing, method, internal) {
  6081. var thingName,
  6082. thingMethod,
  6083. thingIsObject = $.isPlainObject(thing),
  6084. thingObject = thingIsObject ? thing : {};
  6085. if (thing) {
  6086. // If the thing isn’t an object, make it one.
  6087. if (!thingIsObject) {
  6088. thingObject[thing] = method;
  6089. }
  6090. // Go through the things to bind to.
  6091. for (thingName in thingObject) {
  6092. // Grab the method of the thing.
  6093. thingMethod = thingObject[thingName];
  6094. // If it was an internal binding, prefix it.
  6095. if (internal) {
  6096. thingName = '_' + thingName;
  6097. }
  6098. // Make sure the thing methods collection exists.
  6099. STATE.methods[thingName] = STATE.methods[thingName] || [];
  6100. // Add the method to the relative method collection.
  6101. STATE.methods[thingName].push(thingMethod);
  6102. }
  6103. }
  6104. return P;
  6105. }, //on
  6106. /**
  6107. * Unbind events on the things.
  6108. */
  6109. off: function () {
  6110. var i,
  6111. thingName,
  6112. names = arguments;
  6113. for (i = 0, namesCount = names.length; i < namesCount; i += 1) {
  6114. thingName = names[i];
  6115. if (thingName in STATE.methods) {
  6116. delete STATE.methods[thingName];
  6117. }
  6118. }
  6119. return P;
  6120. },
  6121. /**
  6122. * Fire off method events.
  6123. */
  6124. trigger: function (name, data) {
  6125. var _trigger = function (name) {
  6126. var methodList = STATE.methods[name];
  6127. if (methodList) {
  6128. methodList.map(function (method) {
  6129. PickerConstructor._.trigger(method, P, [data]);
  6130. });
  6131. }
  6132. };
  6133. _trigger('_' + name);
  6134. _trigger(name);
  6135. return P;
  6136. } //trigger
  6137. //PickerInstance.prototype
  6138. /**
  6139. * Wrap the picker holder components together.
  6140. */
  6141. }; function createWrappedComponent() {
  6142. // Create a picker wrapper holder
  6143. return PickerConstructor._.node('div',
  6144. // Create a picker wrapper node
  6145. PickerConstructor._.node('div',
  6146. // Create a picker frame
  6147. PickerConstructor._.node('div',
  6148. // Create a picker box node
  6149. PickerConstructor._.node('div',
  6150. // Create the components nodes.
  6151. P.component.nodes(STATE.open),
  6152. // The picker box class
  6153. CLASSES.box),
  6154. // Picker wrap class
  6155. CLASSES.wrap),
  6156. // Picker frame class
  6157. CLASSES.frame),
  6158. // Picker holder class
  6159. CLASSES.holder); //endreturn
  6160. } //createWrappedComponent
  6161. /**
  6162. * Prepare the input element with all bindings.
  6163. */
  6164. function prepareElement() {
  6165. $ELEMENT.
  6166. // Store the picker data by component name.
  6167. data(NAME, P).
  6168. // Add the “input” class name.
  6169. addClass(CLASSES.input).
  6170. // Remove the tabindex.
  6171. attr('tabindex', -1).
  6172. // If there’s a `data-value`, update the value of the element.
  6173. val($ELEMENT.data('value') ? P.get('select', SETTINGS.format) : ELEMENT.value);
  6174. // Only bind keydown events if the element isn’t editable.
  6175. if (!SETTINGS.editable) {
  6176. $ELEMENT.
  6177. // On focus/click, focus onto the root to open it up.
  6178. on('focus.' + STATE.id + ' click.' + STATE.id, function (event) {
  6179. event.preventDefault();
  6180. P.$root.eq(0).focus();
  6181. }).
  6182. // Handle keyboard event based on the picker being opened or not.
  6183. on('keydown.' + STATE.id, handleKeydownEvent);
  6184. }
  6185. // Update the aria attributes.
  6186. aria(ELEMENT, {
  6187. haspopup: true,
  6188. expanded: false,
  6189. readonly: false,
  6190. owns: ELEMENT.id + '_root'
  6191. });
  6192. }
  6193. /**
  6194. * Prepare the root picker element with all bindings.
  6195. */
  6196. function prepareElementRoot() {
  6197. P.$root.on({
  6198. // For iOS8.
  6199. keydown: handleKeydownEvent,
  6200. // When something within the root is focused, stop from bubbling
  6201. // to the doc and remove the “focused” state from the root.
  6202. focusin: function (event) {
  6203. P.$root.removeClass(CLASSES.focused);
  6204. event.stopPropagation();
  6205. },
  6206. // When something within the root holder is clicked, stop it
  6207. // from bubbling to the doc.
  6208. 'mousedown click': function (event) {
  6209. var target = event.target;
  6210. // Make sure the target isn’t the root holder so it can bubble up.
  6211. if (target != P.$root.children()[0]) {
  6212. event.stopPropagation();
  6213. // * For mousedown events, cancel the default action in order to
  6214. // prevent cases where focus is shifted onto external elements
  6215. // when using things like jQuery mobile or MagnificPopup (ref: #249 & #120).
  6216. // Also, for Firefox, don’t prevent action on the `option` element.
  6217. if (event.type == 'mousedown' && !$(target).is('input, select, textarea, button, option')) {
  6218. event.preventDefault();
  6219. // Re-focus onto the root so that users can click away
  6220. // from elements focused within the picker.
  6221. P.$root.eq(0).focus();
  6222. }
  6223. }
  6224. }
  6225. }).
  6226. // Add/remove the “target” class on focus and blur.
  6227. on({
  6228. focus: function () {
  6229. $ELEMENT.addClass(CLASSES.target);
  6230. },
  6231. blur: function () {
  6232. $ELEMENT.removeClass(CLASSES.target);
  6233. }
  6234. }).
  6235. // Open the picker and adjust the root “focused” state
  6236. on('focus.toOpen', handleFocusToOpenEvent).
  6237. // If there’s a click on an actionable element, carry out the actions.
  6238. on('click', '[data-pick], [data-nav], [data-clear], [data-close]', function () {
  6239. var $target = $(this),
  6240. targetData = $target.data(),
  6241. targetDisabled = $target.hasClass(CLASSES.navDisabled) || $target.hasClass(CLASSES.disabled),
  6242. // * For IE, non-focusable elements can be active elements as well
  6243. // (http://stackoverflow.com/a/2684561).
  6244. activeElement = getActiveElement();
  6245. activeElement = activeElement && (activeElement.type || activeElement.href) && activeElement;
  6246. // If it’s disabled or nothing inside is actively focused, re-focus the element.
  6247. if (targetDisabled || activeElement && !$.contains(P.$root[0], activeElement)) {
  6248. P.$root.eq(0).focus();
  6249. }
  6250. // If something is superficially changed, update the `highlight` based on the `nav`.
  6251. if (!targetDisabled && targetData.nav) {
  6252. P.set('highlight', P.component.item.highlight, { nav: targetData.nav });
  6253. }
  6254. // If something is picked, set `select` then close with focus.
  6255. else if (!targetDisabled && 'pick' in targetData) {
  6256. P.set('select', targetData.pick);
  6257. if (SETTINGS.closeOnSelect) {
  6258. P.close(true);
  6259. }
  6260. }
  6261. // If a “clear” button is pressed, empty the values and close with focus.
  6262. else if (targetData.clear) {
  6263. P.clear();
  6264. if (SETTINGS.closeOnSelect) {
  6265. P.close(true);
  6266. }
  6267. } else if (targetData.close) {
  6268. P.close(true);
  6269. }
  6270. }); //P.$root
  6271. aria(P.$root[0], 'hidden', true);
  6272. }
  6273. /**
  6274. * Prepare the hidden input element along with all bindings.
  6275. */
  6276. function prepareElementHidden() {
  6277. var name;
  6278. if (SETTINGS.hiddenName === true) {
  6279. name = ELEMENT.name;
  6280. ELEMENT.name = '';
  6281. } else {
  6282. name = [typeof SETTINGS.hiddenPrefix == 'string' ? SETTINGS.hiddenPrefix : '', typeof SETTINGS.hiddenSuffix == 'string' ? SETTINGS.hiddenSuffix : '_submit'];
  6283. name = name[0] + ELEMENT.name + name[1];
  6284. }
  6285. P._hidden = $('<input ' + 'type=hidden ' +
  6286. // Create the name using the original input’s with a prefix and suffix.
  6287. 'name="' + name + '"' + (
  6288. // If the element has a value, set the hidden value as well.
  6289. $ELEMENT.data('value') || ELEMENT.value ? ' value="' + P.get('select', SETTINGS.formatSubmit) + '"' : '') + '>')[0];
  6290. $ELEMENT.
  6291. // If the value changes, update the hidden input with the correct format.
  6292. on('change.' + STATE.id, function () {
  6293. P._hidden.value = ELEMENT.value ? P.get('select', SETTINGS.formatSubmit) : '';
  6294. });
  6295. // Insert the hidden input as specified in the settings.
  6296. if (SETTINGS.container) $(SETTINGS.container).append(P._hidden); else $ELEMENT.before(P._hidden);
  6297. }
  6298. // For iOS8.
  6299. function handleKeydownEvent(event) {
  6300. var keycode = event.keyCode,
  6301. // Check if one of the delete keys was pressed.
  6302. isKeycodeDelete = /^(8|46)$/.test(keycode);
  6303. // For some reason IE clears the input value on “escape”.
  6304. if (keycode == 27) {
  6305. P.close();
  6306. return false;
  6307. }
  6308. // Check if `space` or `delete` was pressed or the picker is closed with a key movement.
  6309. if (keycode == 32 || isKeycodeDelete || !STATE.open && P.component.key[keycode]) {
  6310. // Prevent it from moving the page and bubbling to doc.
  6311. event.preventDefault();
  6312. event.stopPropagation();
  6313. // If `delete` was pressed, clear the values and close the picker.
  6314. // Otherwise open the picker.
  6315. if (isKeycodeDelete) {
  6316. P.clear().close();
  6317. } else {
  6318. P.open();
  6319. }
  6320. }
  6321. }
  6322. // Separated for IE
  6323. function handleFocusToOpenEvent(event) {
  6324. // Stop the event from propagating to the doc.
  6325. event.stopPropagation();
  6326. // If it’s a focus event, add the “focused” class to the root.
  6327. if (event.type == 'focus') {
  6328. P.$root.addClass(CLASSES.focused);
  6329. }
  6330. // And then finally open the picker.
  6331. P.open();
  6332. }
  6333. // Return a new picker instance.
  6334. return new PickerInstance();
  6335. } //PickerConstructor
  6336. /**
  6337. * The default classes and prefix to use for the HTML classes.
  6338. */
  6339. PickerConstructor.klasses = function (prefix) {
  6340. prefix = prefix || 'picker';
  6341. return {
  6342. picker: prefix,
  6343. opened: prefix + '--opened',
  6344. focused: prefix + '--focused',
  6345. input: prefix + '__input',
  6346. active: prefix + '__input--active',
  6347. target: prefix + '__input--target',
  6348. holder: prefix + '__holder',
  6349. frame: prefix + '__frame',
  6350. wrap: prefix + '__wrap',
  6351. box: prefix + '__box'
  6352. };
  6353. }; //PickerConstructor.klasses
  6354. /**
  6355. * Check if the default theme is being used.
  6356. */
  6357. function isUsingDefaultTheme(element) {
  6358. var theme,
  6359. prop = 'position';
  6360. // For IE.
  6361. if (element.currentStyle) {
  6362. theme = element.currentStyle[prop];
  6363. }
  6364. // For normal browsers.
  6365. else if (window.getComputedStyle) {
  6366. theme = getComputedStyle(element)[prop];
  6367. }
  6368. return theme == 'fixed';
  6369. }
  6370. /**
  6371. * Get the width of the browser’s scrollbar.
  6372. * Taken from: https://github.com/VodkaBears/Remodal/blob/master/src/jquery.remodal.js
  6373. */
  6374. function getScrollbarWidth() {
  6375. if ($html.height() <= $window.height()) {
  6376. return 0;
  6377. }
  6378. var $outer = $('<div style="visibility:hidden;width:100px" />').appendTo('body');
  6379. // Get the width without scrollbars.
  6380. var widthWithoutScroll = $outer[0].offsetWidth;
  6381. // Force adding scrollbars.
  6382. $outer.css('overflow', 'scroll');
  6383. // Add the inner div.
  6384. var $inner = $('<div style="width:100%" />').appendTo($outer);
  6385. // Get the width with scrollbars.
  6386. var widthWithScroll = $inner[0].offsetWidth;
  6387. // Remove the divs.
  6388. $outer.remove();
  6389. // Return the difference between the widths.
  6390. return widthWithoutScroll - widthWithScroll;
  6391. }
  6392. /**
  6393. * PickerConstructor helper methods.
  6394. */
  6395. PickerConstructor._ = {
  6396. /**
  6397. * Create a group of nodes. Expects:
  6398. * `
  6399. {
  6400. min: {Integer},
  6401. max: {Integer},
  6402. i: {Integer},
  6403. node: {String},
  6404. item: {Function}
  6405. }
  6406. * `
  6407. */
  6408. group: function (groupObject) {
  6409. var
  6410. // Scope for the looped object
  6411. loopObjectScope,
  6412. // Create the nodes list
  6413. nodesList = '',
  6414. // The counter starts from the `min`
  6415. counter = PickerConstructor._.trigger(groupObject.min, groupObject);
  6416. // Loop from the `min` to `max`, incrementing by `i`
  6417. for (; counter <= PickerConstructor._.trigger(groupObject.max, groupObject, [counter]); counter += groupObject.i) {
  6418. // Trigger the `item` function within scope of the object
  6419. loopObjectScope = PickerConstructor._.trigger(groupObject.item, groupObject, [counter]);
  6420. // Splice the subgroup and create nodes out of the sub nodes
  6421. nodesList += PickerConstructor._.node(groupObject.node, loopObjectScope[0], // the node
  6422. loopObjectScope[1], // the classes
  6423. loopObjectScope[2] // the attributes
  6424. );
  6425. }
  6426. // Return the list of nodes
  6427. return nodesList;
  6428. }, //group
  6429. /**
  6430. * Create a dom node string
  6431. */
  6432. node: function (wrapper, item, klass, attribute) {
  6433. // If the item is false-y, just return an empty string
  6434. if (!item) return '';
  6435. // If the item is an array, do a join
  6436. item = $.isArray(item) ? item.join('') : item;
  6437. // Check for the class
  6438. klass = klass ? ' class="' + klass + '"' : '';
  6439. // Check for any attributes
  6440. attribute = attribute ? ' ' + attribute : '';
  6441. // Return the wrapped item
  6442. return '<' + wrapper + klass + attribute + '>' + item + '</' + wrapper + '>';
  6443. }, //node
  6444. /**
  6445. * Lead numbers below 10 with a zero.
  6446. */
  6447. lead: function (number) {
  6448. return (number < 10 ? '0' : '') + number;
  6449. },
  6450. /**
  6451. * Trigger a function otherwise return the value.
  6452. */
  6453. trigger: function (callback, scope, args) {
  6454. return typeof callback == 'function' ? callback.apply(scope, args || []) : callback;
  6455. },
  6456. /**
  6457. * If the second character is a digit, length is 2 otherwise 1.
  6458. */
  6459. digits: function (string) {
  6460. return (/\d/.test(string[1]) ? 2 : 1
  6461. );
  6462. },
  6463. /**
  6464. * Tell if something is a date object.
  6465. */
  6466. isDate: function (value) {
  6467. return {}.toString.call(value).indexOf('Date') > -1 && this.isInteger(value.getDate());
  6468. },
  6469. /**
  6470. * Tell if something is an integer.
  6471. */
  6472. isInteger: function (value) {
  6473. return {}.toString.call(value).indexOf('Number') > -1 && value % 1 === 0;
  6474. },
  6475. /**
  6476. * Create ARIA attribute strings.
  6477. */
  6478. ariaAttr: ariaAttr //PickerConstructor._
  6479. /**
  6480. * Extend the picker with a component and defaults.
  6481. */
  6482. }; PickerConstructor.extend = function (name, Component) {
  6483. // Extend jQuery.
  6484. $.fn[name] = function (options, action) {
  6485. // Grab the component data.
  6486. var componentData = this.data(name);
  6487. // If the picker is requested, return the data object.
  6488. if (options == 'picker') {
  6489. return componentData;
  6490. }
  6491. // If the component data exists and `options` is a string, carry out the action.
  6492. if (componentData && typeof options == 'string') {
  6493. return PickerConstructor._.trigger(componentData[options], componentData, [action]);
  6494. }
  6495. // Otherwise go through each matched element and if the component
  6496. // doesn’t exist, create a new picker using `this` element
  6497. // and merging the defaults and options with a deep copy.
  6498. return this.each(function () {
  6499. var $this = $(this);
  6500. if (!$this.data(name)) {
  6501. new PickerConstructor(this, name, Component, options);
  6502. }
  6503. });
  6504. };
  6505. // Set the defaults.
  6506. $.fn[name].defaults = Component.defaults;
  6507. }; //PickerConstructor.extend
  6508. function aria(element, attribute, value) {
  6509. if ($.isPlainObject(attribute)) {
  6510. for (var key in attribute) {
  6511. ariaSet(element, key, attribute[key]);
  6512. }
  6513. } else {
  6514. ariaSet(element, attribute, value);
  6515. }
  6516. }
  6517. function ariaSet(element, attribute, value) {
  6518. element.setAttribute((attribute == 'role' ? '' : 'aria-') + attribute, value);
  6519. }
  6520. function ariaAttr(attribute, data) {
  6521. if (!$.isPlainObject(attribute)) {
  6522. attribute = { attribute: data };
  6523. }
  6524. data = '';
  6525. for (var key in attribute) {
  6526. var attr = (key == 'role' ? '' : 'aria-') + key,
  6527. attrVal = attribute[key];
  6528. data += attrVal == null ? '' : attr + '="' + attribute[key] + '"';
  6529. }
  6530. return data;
  6531. }
  6532. // IE8 bug throws an error for activeElements within iframes.
  6533. function getActiveElement() {
  6534. try {
  6535. return document.activeElement;
  6536. } catch (err) { }
  6537. }
  6538. // Expose the picker constructor.
  6539. return PickerConstructor;
  6540. });
  6541. ; /*!
  6542. * Date picker for pickadate.js v3.5.0
  6543. * http://amsul.github.io/pickadate.js/date.htm
  6544. */
  6545. (function (factory) {
  6546. factory(Materialize.Picker, jQuery);
  6547. })(function (Picker, $) {
  6548. /**
  6549. * Globals and constants
  6550. */
  6551. var DAYS_IN_WEEK = 7,
  6552. WEEKS_IN_CALENDAR = 6,
  6553. _ = Picker._;
  6554. /**
  6555. * The date picker constructor
  6556. */
  6557. function DatePicker(picker, settings) {
  6558. var calendar = this,
  6559. element = picker.$node[0],
  6560. elementValue = element.value,
  6561. elementDataValue = picker.$node.data('value'),
  6562. valueString = elementDataValue || elementValue,
  6563. formatString = elementDataValue ? settings.formatSubmit : settings.format,
  6564. isRTL = function () {
  6565. return element.currentStyle ?
  6566. // For IE.
  6567. element.currentStyle.direction == 'rtl' :
  6568. // For normal browsers.
  6569. getComputedStyle(picker.$root[0]).direction == 'rtl';
  6570. };
  6571. calendar.settings = settings;
  6572. calendar.$node = picker.$node;
  6573. // The queue of methods that will be used to build item objects.
  6574. calendar.queue = {
  6575. min: 'measure create',
  6576. max: 'measure create',
  6577. now: 'now create',
  6578. select: 'parse create validate',
  6579. highlight: 'parse navigate create validate',
  6580. view: 'parse create validate viewset',
  6581. disable: 'deactivate',
  6582. enable: 'activate'
  6583. // The component's item object.
  6584. }; calendar.item = {};
  6585. calendar.item.clear = null;
  6586. calendar.item.disable = (settings.disable || []).slice(0);
  6587. calendar.item.enable = -function (collectionDisabled) {
  6588. return collectionDisabled[0] === true ? collectionDisabled.shift() : -1;
  6589. }(calendar.item.disable);
  6590. calendar.set('min', settings.min).set('max', settings.max).set('now');
  6591. // When there’s a value, set the `select`, which in turn
  6592. // also sets the `highlight` and `view`.
  6593. if (valueString) {
  6594. calendar.set('select', valueString, { format: formatString });
  6595. }
  6596. // If there’s no value, default to highlighting “today”.
  6597. else {
  6598. calendar.set('select', null).set('highlight', calendar.item.now);
  6599. }
  6600. // The keycode to movement mapping.
  6601. calendar.key = {
  6602. 40: 7, // Down
  6603. 38: -7, // Up
  6604. 39: function () {
  6605. return isRTL() ? -1 : 1;
  6606. }, // Right
  6607. 37: function () {
  6608. return isRTL() ? 1 : -1;
  6609. }, // Left
  6610. go: function (timeChange) {
  6611. var highlightedObject = calendar.item.highlight,
  6612. targetDate = new Date(highlightedObject.year, highlightedObject.month, highlightedObject.date + timeChange);
  6613. calendar.set('highlight', targetDate, { interval: timeChange });
  6614. this.render();
  6615. }
  6616. // Bind some picker events.
  6617. }; picker.on('render', function () {
  6618. picker.$root.find('.' + settings.klass.selectMonth).on('change', function () {
  6619. var value = this.value;
  6620. if (value) {
  6621. picker.set('highlight', [picker.get('view').year, value, picker.get('highlight').date]);
  6622. picker.$root.find('.' + settings.klass.selectMonth).trigger('focus');
  6623. }
  6624. });
  6625. picker.$root.find('.' + settings.klass.selectYear).on('change', function () {
  6626. var value = this.value;
  6627. if (value) {
  6628. picker.set('highlight', [value, picker.get('view').month, picker.get('highlight').date]);
  6629. picker.$root.find('.' + settings.klass.selectYear).trigger('focus');
  6630. }
  6631. });
  6632. }, 1).on('open', function () {
  6633. var includeToday = '';
  6634. if (calendar.disabled(calendar.get('now'))) {
  6635. includeToday = ':not(.' + settings.klass.buttonToday + ')';
  6636. }
  6637. picker.$root.find('button' + includeToday + ', select').attr('disabled', false);
  6638. }, 1).on('close', function () {
  6639. picker.$root.find('button, select').attr('disabled', true);
  6640. }, 1);
  6641. } //DatePicker
  6642. /**
  6643. * Set a datepicker item object.
  6644. */
  6645. DatePicker.prototype.set = function (type, value, options) {
  6646. var calendar = this,
  6647. calendarItem = calendar.item;
  6648. // If the value is `null` just set it immediately.
  6649. if (value === null) {
  6650. if (type == 'clear') type = 'select';
  6651. calendarItem[type] = value;
  6652. return calendar;
  6653. }
  6654. // Otherwise go through the queue of methods, and invoke the functions.
  6655. // Update this as the time unit, and set the final value as this item.
  6656. // * In the case of `enable`, keep the queue but set `disable` instead.
  6657. // And in the case of `flip`, keep the queue but set `enable` instead.
  6658. calendarItem[type == 'enable' ? 'disable' : type == 'flip' ? 'enable' : type] = calendar.queue[type].split(' ').map(function (method) {
  6659. value = calendar[method](type, value, options);
  6660. return value;
  6661. }).pop();
  6662. // Check if we need to cascade through more updates.
  6663. if (type == 'select') {
  6664. calendar.set('highlight', calendarItem.select, options);
  6665. } else if (type == 'highlight') {
  6666. calendar.set('view', calendarItem.highlight, options);
  6667. } else if (type.match(/^(flip|min|max|disable|enable)$/)) {
  6668. if (calendarItem.select && calendar.disabled(calendarItem.select)) {
  6669. calendar.set('select', calendarItem.select, options);
  6670. }
  6671. if (calendarItem.highlight && calendar.disabled(calendarItem.highlight)) {
  6672. calendar.set('highlight', calendarItem.highlight, options);
  6673. }
  6674. }
  6675. return calendar;
  6676. }; //DatePicker.prototype.set
  6677. /**
  6678. * Get a datepicker item object.
  6679. */
  6680. DatePicker.prototype.get = function (type) {
  6681. return this.item[type];
  6682. }; //DatePicker.prototype.get
  6683. /**
  6684. * Create a picker date object.
  6685. */
  6686. DatePicker.prototype.create = function (type, value, options) {
  6687. var isInfiniteValue,
  6688. calendar = this;
  6689. // If there’s no value, use the type as the value.
  6690. value = value === undefined ? type : value;
  6691. // If it’s infinity, update the value.
  6692. if (value == -Infinity || value == Infinity) {
  6693. isInfiniteValue = value;
  6694. }
  6695. // If it’s an object, use the native date object.
  6696. else if ($.isPlainObject(value) && _.isInteger(value.pick)) {
  6697. value = value.obj;
  6698. }
  6699. // If it’s an array, convert it into a date and make sure
  6700. // that it’s a valid date – otherwise default to today.
  6701. else if ($.isArray(value)) {
  6702. value = new Date(value[0], value[1], value[2]);
  6703. value = _.isDate(value) ? value : calendar.create().obj;
  6704. }
  6705. // If it’s a number or date object, make a normalized date.
  6706. else if (_.isInteger(value) || _.isDate(value)) {
  6707. value = calendar.normalize(new Date(value), options);
  6708. }
  6709. // If it’s a literal true or any other case, set it to now.
  6710. else /*if ( value === true )*/ {
  6711. value = calendar.now(type, value, options);
  6712. }
  6713. // Return the compiled object.
  6714. return {
  6715. year: isInfiniteValue || value.getFullYear(),
  6716. month: isInfiniteValue || value.getMonth(),
  6717. date: isInfiniteValue || value.getDate(),
  6718. day: isInfiniteValue || value.getDay(),
  6719. obj: isInfiniteValue || value,
  6720. pick: isInfiniteValue || value.getTime()
  6721. };
  6722. }; //DatePicker.prototype.create
  6723. /**
  6724. * Create a range limit object using an array, date object,
  6725. * literal “true”, or integer relative to another time.
  6726. */
  6727. DatePicker.prototype.createRange = function (from, to) {
  6728. var calendar = this,
  6729. createDate = function (date) {
  6730. if (date === true || $.isArray(date) || _.isDate(date)) {
  6731. return calendar.create(date);
  6732. }
  6733. return date;
  6734. };
  6735. // Create objects if possible.
  6736. if (!_.isInteger(from)) {
  6737. from = createDate(from);
  6738. }
  6739. if (!_.isInteger(to)) {
  6740. to = createDate(to);
  6741. }
  6742. // Create relative dates.
  6743. if (_.isInteger(from) && $.isPlainObject(to)) {
  6744. from = [to.year, to.month, to.date + from];
  6745. } else if (_.isInteger(to) && $.isPlainObject(from)) {
  6746. to = [from.year, from.month, from.date + to];
  6747. }
  6748. return {
  6749. from: createDate(from),
  6750. to: createDate(to)
  6751. };
  6752. }; //DatePicker.prototype.createRange
  6753. /**
  6754. * Check if a date unit falls within a date range object.
  6755. */
  6756. DatePicker.prototype.withinRange = function (range, dateUnit) {
  6757. range = this.createRange(range.from, range.to);
  6758. return dateUnit.pick >= range.from.pick && dateUnit.pick <= range.to.pick;
  6759. };
  6760. /**
  6761. * Check if two date range objects overlap.
  6762. */
  6763. DatePicker.prototype.overlapRanges = function (one, two) {
  6764. var calendar = this;
  6765. // Convert the ranges into comparable dates.
  6766. one = calendar.createRange(one.from, one.to);
  6767. two = calendar.createRange(two.from, two.to);
  6768. return calendar.withinRange(one, two.from) || calendar.withinRange(one, two.to) || calendar.withinRange(two, one.from) || calendar.withinRange(two, one.to);
  6769. };
  6770. /**
  6771. * Get the date today.
  6772. */
  6773. DatePicker.prototype.now = function (type, value, options) {
  6774. value = new Date();
  6775. if (options && options.rel) {
  6776. value.setDate(value.getDate() + options.rel);
  6777. }
  6778. return this.normalize(value, options);
  6779. };
  6780. /**
  6781. * Navigate to next/prev month.
  6782. */
  6783. DatePicker.prototype.navigate = function (type, value, options) {
  6784. var targetDateObject,
  6785. targetYear,
  6786. targetMonth,
  6787. targetDate,
  6788. isTargetArray = $.isArray(value),
  6789. isTargetObject = $.isPlainObject(value),
  6790. viewsetObject = this.item.view; /*,
  6791. safety = 100*/
  6792. if (isTargetArray || isTargetObject) {
  6793. if (isTargetObject) {
  6794. targetYear = value.year;
  6795. targetMonth = value.month;
  6796. targetDate = value.date;
  6797. } else {
  6798. targetYear = +value[0];
  6799. targetMonth = +value[1];
  6800. targetDate = +value[2];
  6801. }
  6802. // If we’re navigating months but the view is in a different
  6803. // month, navigate to the view’s year and month.
  6804. if (options && options.nav && viewsetObject && viewsetObject.month !== targetMonth) {
  6805. targetYear = viewsetObject.year;
  6806. targetMonth = viewsetObject.month;
  6807. }
  6808. // Figure out the expected target year and month.
  6809. targetDateObject = new Date(targetYear, targetMonth + (options && options.nav ? options.nav : 0), 1);
  6810. targetYear = targetDateObject.getFullYear();
  6811. targetMonth = targetDateObject.getMonth();
  6812. // If the month we’re going to doesn’t have enough days,
  6813. // keep decreasing the date until we reach the month’s last date.
  6814. while ( /*safety &&*/new Date(targetYear, targetMonth, targetDate).getMonth() !== targetMonth) {
  6815. targetDate -= 1;
  6816. /*safety -= 1
  6817. if ( !safety ) {
  6818. throw 'Fell into an infinite loop while navigating to ' + new Date( targetYear, targetMonth, targetDate ) + '.'
  6819. }*/
  6820. }
  6821. value = [targetYear, targetMonth, targetDate];
  6822. }
  6823. return value;
  6824. }; //DatePicker.prototype.navigate
  6825. /**
  6826. * Normalize a date by setting the hours to midnight.
  6827. */
  6828. DatePicker.prototype.normalize = function (value /*, options*/) {
  6829. value.setHours(0, 0, 0, 0);
  6830. return value;
  6831. };
  6832. /**
  6833. * Measure the range of dates.
  6834. */
  6835. DatePicker.prototype.measure = function (type, value /*, options*/) {
  6836. var calendar = this;
  6837. // If it’s anything false-y, remove the limits.
  6838. if (!value) {
  6839. value = type == 'min' ? -Infinity : Infinity;
  6840. }
  6841. // If it’s a string, parse it.
  6842. else if (typeof value == 'string') {
  6843. value = calendar.parse(type, value);
  6844. }
  6845. // If it's an integer, get a date relative to today.
  6846. else if (_.isInteger(value)) {
  6847. value = calendar.now(type, value, { rel: value });
  6848. }
  6849. return value;
  6850. }; ///DatePicker.prototype.measure
  6851. /**
  6852. * Create a viewset object based on navigation.
  6853. */
  6854. DatePicker.prototype.viewset = function (type, dateObject /*, options*/) {
  6855. return this.create([dateObject.year, dateObject.month, 1]);
  6856. };
  6857. /**
  6858. * Validate a date as enabled and shift if needed.
  6859. */
  6860. DatePicker.prototype.validate = function (type, dateObject, options) {
  6861. var calendar = this,
  6862. // Keep a reference to the original date.
  6863. originalDateObject = dateObject,
  6864. // Make sure we have an interval.
  6865. interval = options && options.interval ? options.interval : 1,
  6866. // Check if the calendar enabled dates are inverted.
  6867. isFlippedBase = calendar.item.enable === -1,
  6868. // Check if we have any enabled dates after/before now.
  6869. hasEnabledBeforeTarget,
  6870. hasEnabledAfterTarget,
  6871. // The min & max limits.
  6872. minLimitObject = calendar.item.min,
  6873. maxLimitObject = calendar.item.max,
  6874. // Check if we’ve reached the limit during shifting.
  6875. reachedMin,
  6876. reachedMax,
  6877. // Check if the calendar is inverted and at least one weekday is enabled.
  6878. hasEnabledWeekdays = isFlippedBase && calendar.item.disable.filter(function (value) {
  6879. // If there’s a date, check where it is relative to the target.
  6880. if ($.isArray(value)) {
  6881. var dateTime = calendar.create(value).pick;
  6882. if (dateTime < dateObject.pick) hasEnabledBeforeTarget = true; else if (dateTime > dateObject.pick) hasEnabledAfterTarget = true;
  6883. }
  6884. // Return only integers for enabled weekdays.
  6885. return _.isInteger(value);
  6886. }).length; /*,
  6887. safety = 100*/
  6888. // Cases to validate for:
  6889. // [1] Not inverted and date disabled.
  6890. // [2] Inverted and some dates enabled.
  6891. // [3] Not inverted and out of range.
  6892. //
  6893. // Cases to **not** validate for:
  6894. // • Navigating months.
  6895. // • Not inverted and date enabled.
  6896. // • Inverted and all dates disabled.
  6897. // • ..and anything else.
  6898. if (!options || !options.nav) if (
  6899. /* 1 */!isFlippedBase && calendar.disabled(dateObject) ||
  6900. /* 2 */isFlippedBase && calendar.disabled(dateObject) && (hasEnabledWeekdays || hasEnabledBeforeTarget || hasEnabledAfterTarget) ||
  6901. /* 3 */ !isFlippedBase && (dateObject.pick <= minLimitObject.pick || dateObject.pick >= maxLimitObject.pick)) {
  6902. // When inverted, flip the direction if there aren’t any enabled weekdays
  6903. // and there are no enabled dates in the direction of the interval.
  6904. if (isFlippedBase && !hasEnabledWeekdays && (!hasEnabledAfterTarget && interval > 0 || !hasEnabledBeforeTarget && interval < 0)) {
  6905. interval *= -1;
  6906. }
  6907. // Keep looping until we reach an enabled date.
  6908. while ( /*safety &&*/calendar.disabled(dateObject)) {
  6909. /*safety -= 1
  6910. if ( !safety ) {
  6911. throw 'Fell into an infinite loop while validating ' + dateObject.obj + '.'
  6912. }*/
  6913. // If we’ve looped into the next/prev month with a large interval, return to the original date and flatten the interval.
  6914. if (Math.abs(interval) > 1 && (dateObject.month < originalDateObject.month || dateObject.month > originalDateObject.month)) {
  6915. dateObject = originalDateObject;
  6916. interval = interval > 0 ? 1 : -1;
  6917. }
  6918. // If we’ve reached the min/max limit, reverse the direction, flatten the interval and set it to the limit.
  6919. if (dateObject.pick <= minLimitObject.pick) {
  6920. reachedMin = true;
  6921. interval = 1;
  6922. dateObject = calendar.create([minLimitObject.year, minLimitObject.month, minLimitObject.date + (dateObject.pick === minLimitObject.pick ? 0 : -1)]);
  6923. } else if (dateObject.pick >= maxLimitObject.pick) {
  6924. reachedMax = true;
  6925. interval = -1;
  6926. dateObject = calendar.create([maxLimitObject.year, maxLimitObject.month, maxLimitObject.date + (dateObject.pick === maxLimitObject.pick ? 0 : 1)]);
  6927. }
  6928. // If we’ve reached both limits, just break out of the loop.
  6929. if (reachedMin && reachedMax) {
  6930. break;
  6931. }
  6932. // Finally, create the shifted date using the interval and keep looping.
  6933. dateObject = calendar.create([dateObject.year, dateObject.month, dateObject.date + interval]);
  6934. }
  6935. } //endif
  6936. // Return the date object settled on.
  6937. return dateObject;
  6938. }; //DatePicker.prototype.validate
  6939. /**
  6940. * Check if a date is disabled.
  6941. */
  6942. DatePicker.prototype.disabled = function (dateToVerify) {
  6943. var calendar = this,
  6944. // Filter through the disabled dates to check if this is one.
  6945. isDisabledMatch = calendar.item.disable.filter(function (dateToDisable) {
  6946. // If the date is a number, match the weekday with 0index and `firstDay` check.
  6947. if (_.isInteger(dateToDisable)) {
  6948. return dateToVerify.day === (calendar.settings.firstDay ? dateToDisable : dateToDisable - 1) % 7;
  6949. }
  6950. // If it’s an array or a native JS date, create and match the exact date.
  6951. if ($.isArray(dateToDisable) || _.isDate(dateToDisable)) {
  6952. return dateToVerify.pick === calendar.create(dateToDisable).pick;
  6953. }
  6954. // If it’s an object, match a date within the “from” and “to” range.
  6955. if ($.isPlainObject(dateToDisable)) {
  6956. return calendar.withinRange(dateToDisable, dateToVerify);
  6957. }
  6958. });
  6959. // If this date matches a disabled date, confirm it’s not inverted.
  6960. isDisabledMatch = isDisabledMatch.length && !isDisabledMatch.filter(function (dateToDisable) {
  6961. return $.isArray(dateToDisable) && dateToDisable[3] == 'inverted' || $.isPlainObject(dateToDisable) && dateToDisable.inverted;
  6962. }).length;
  6963. // Check the calendar “enabled” flag and respectively flip the
  6964. // disabled state. Then also check if it’s beyond the min/max limits.
  6965. return calendar.item.enable === -1 ? !isDisabledMatch : isDisabledMatch || dateToVerify.pick < calendar.item.min.pick || dateToVerify.pick > calendar.item.max.pick;
  6966. }; //DatePicker.prototype.disabled
  6967. /**
  6968. * Parse a string into a usable type.
  6969. */
  6970. DatePicker.prototype.parse = function (type, value, options) {
  6971. var calendar = this,
  6972. parsingObject = {};
  6973. // If it’s already parsed, we’re good.
  6974. if (!value || typeof value != 'string') {
  6975. return value;
  6976. }
  6977. // We need a `.format` to parse the value with.
  6978. if (!(options && options.format)) {
  6979. options = options || {};
  6980. options.format = calendar.settings.format;
  6981. }
  6982. // Convert the format into an array and then map through it.
  6983. calendar.formats.toArray(options.format).map(function (label) {
  6984. var
  6985. // Grab the formatting label.
  6986. formattingLabel = calendar.formats[label],
  6987. // The format length is from the formatting label function or the
  6988. // label length without the escaping exclamation (!) mark.
  6989. formatLength = formattingLabel ? _.trigger(formattingLabel, calendar, [value, parsingObject]) : label.replace(/^!/, '').length;
  6990. // If there's a format label, split the value up to the format length.
  6991. // Then add it to the parsing object with appropriate label.
  6992. if (formattingLabel) {
  6993. parsingObject[label] = value.substr(0, formatLength);
  6994. }
  6995. // Update the value as the substring from format length to end.
  6996. value = value.substr(formatLength);
  6997. });
  6998. // Compensate for month 0index.
  6999. return [parsingObject.yyyy || parsingObject.yy, +(parsingObject.mm || parsingObject.m) - 1, parsingObject.dd || parsingObject.d];
  7000. }; //DatePicker.prototype.parse
  7001. /**
  7002. * Various formats to display the object in.
  7003. */
  7004. DatePicker.prototype.formats = function () {
  7005. // Return the length of the first word in a collection.
  7006. function getWordLengthFromCollection(string, collection, dateObject) {
  7007. // Grab the first word from the string.
  7008. var word = string.match(/\w+/)[0];
  7009. // If there's no month index, add it to the date object
  7010. if (!dateObject.mm && !dateObject.m) {
  7011. dateObject.m = collection.indexOf(word) + 1;
  7012. }
  7013. // Return the length of the word.
  7014. return word.length;
  7015. }
  7016. // Get the length of the first word in a string.
  7017. function getFirstWordLength(string) {
  7018. return string.match(/\w+/)[0].length;
  7019. }
  7020. return {
  7021. d: function (string, dateObject) {
  7022. // If there's string, then get the digits length.
  7023. // Otherwise return the selected date.
  7024. return string ? _.digits(string) : dateObject.date;
  7025. },
  7026. dd: function (string, dateObject) {
  7027. // If there's a string, then the length is always 2.
  7028. // Otherwise return the selected date with a leading zero.
  7029. return string ? 2 : _.lead(dateObject.date);
  7030. },
  7031. ddd: function (string, dateObject) {
  7032. // If there's a string, then get the length of the first word.
  7033. // Otherwise return the short selected weekday.
  7034. return string ? getFirstWordLength(string) : this.settings.weekdaysShort[dateObject.day];
  7035. },
  7036. dddd: function (string, dateObject) {
  7037. // If there's a string, then get the length of the first word.
  7038. // Otherwise return the full selected weekday.
  7039. return string ? getFirstWordLength(string) : this.settings.weekdaysFull[dateObject.day];
  7040. },
  7041. m: function (string, dateObject) {
  7042. // If there's a string, then get the length of the digits
  7043. // Otherwise return the selected month with 0index compensation.
  7044. return string ? _.digits(string) : dateObject.month + 1;
  7045. },
  7046. mm: function (string, dateObject) {
  7047. // If there's a string, then the length is always 2.
  7048. // Otherwise return the selected month with 0index and leading zero.
  7049. return string ? 2 : _.lead(dateObject.month + 1);
  7050. },
  7051. mmm: function (string, dateObject) {
  7052. var collection = this.settings.monthsShort;
  7053. // If there's a string, get length of the relevant month from the short
  7054. // months collection. Otherwise return the selected month from that collection.
  7055. return string ? getWordLengthFromCollection(string, collection, dateObject) : collection[dateObject.month];
  7056. },
  7057. mmmm: function (string, dateObject) {
  7058. var collection = this.settings.monthsFull;
  7059. // If there's a string, get length of the relevant month from the full
  7060. // months collection. Otherwise return the selected month from that collection.
  7061. return string ? getWordLengthFromCollection(string, collection, dateObject) : collection[dateObject.month];
  7062. },
  7063. yy: function (string, dateObject) {
  7064. // If there's a string, then the length is always 2.
  7065. // Otherwise return the selected year by slicing out the first 2 digits.
  7066. return string ? 2 : ('' + dateObject.year).slice(2);
  7067. },
  7068. yyyy: function (string, dateObject) {
  7069. // If there's a string, then the length is always 4.
  7070. // Otherwise return the selected year.
  7071. return string ? 4 : dateObject.year;
  7072. },
  7073. // Create an array by splitting the formatting string passed.
  7074. toArray: function (formatString) {
  7075. return formatString.split(/(d{1,4}|m{1,4}|y{4}|yy|!.)/g);
  7076. },
  7077. // Format an object into a string using the formatting options.
  7078. toString: function (formatString, itemObject) {
  7079. var calendar = this;
  7080. return calendar.formats.toArray(formatString).map(function (label) {
  7081. return _.trigger(calendar.formats[label], calendar, [0, itemObject]) || label.replace(/^!/, '');
  7082. }).join('');
  7083. }
  7084. };
  7085. }(); //DatePicker.prototype.formats
  7086. /**
  7087. * Check if two date units are the exact.
  7088. */
  7089. DatePicker.prototype.isDateExact = function (one, two) {
  7090. var calendar = this;
  7091. // When we’re working with weekdays, do a direct comparison.
  7092. if (_.isInteger(one) && _.isInteger(two) || typeof one == 'boolean' && typeof two == 'boolean') {
  7093. return one === two;
  7094. }
  7095. // When we’re working with date representations, compare the “pick” value.
  7096. if ((_.isDate(one) || $.isArray(one)) && (_.isDate(two) || $.isArray(two))) {
  7097. return calendar.create(one).pick === calendar.create(two).pick;
  7098. }
  7099. // When we’re working with range objects, compare the “from” and “to”.
  7100. if ($.isPlainObject(one) && $.isPlainObject(two)) {
  7101. return calendar.isDateExact(one.from, two.from) && calendar.isDateExact(one.to, two.to);
  7102. }
  7103. return false;
  7104. };
  7105. /**
  7106. * Check if two date units overlap.
  7107. */
  7108. DatePicker.prototype.isDateOverlap = function (one, two) {
  7109. var calendar = this,
  7110. firstDay = calendar.settings.firstDay ? 1 : 0;
  7111. // When we’re working with a weekday index, compare the days.
  7112. if (_.isInteger(one) && (_.isDate(two) || $.isArray(two))) {
  7113. one = one % 7 + firstDay;
  7114. return one === calendar.create(two).day + 1;
  7115. }
  7116. if (_.isInteger(two) && (_.isDate(one) || $.isArray(one))) {
  7117. two = two % 7 + firstDay;
  7118. return two === calendar.create(one).day + 1;
  7119. }
  7120. // When we’re working with range objects, check if the ranges overlap.
  7121. if ($.isPlainObject(one) && $.isPlainObject(two)) {
  7122. return calendar.overlapRanges(one, two);
  7123. }
  7124. return false;
  7125. };
  7126. /**
  7127. * Flip the “enabled” state.
  7128. */
  7129. DatePicker.prototype.flipEnable = function (val) {
  7130. var itemObject = this.item;
  7131. itemObject.enable = val || (itemObject.enable == -1 ? 1 : -1);
  7132. };
  7133. /**
  7134. * Mark a collection of dates as “disabled”.
  7135. */
  7136. DatePicker.prototype.deactivate = function (type, datesToDisable) {
  7137. var calendar = this,
  7138. disabledItems = calendar.item.disable.slice(0);
  7139. // If we’re flipping, that’s all we need to do.
  7140. if (datesToDisable == 'flip') {
  7141. calendar.flipEnable();
  7142. } else if (datesToDisable === false) {
  7143. calendar.flipEnable(1);
  7144. disabledItems = [];
  7145. } else if (datesToDisable === true) {
  7146. calendar.flipEnable(-1);
  7147. disabledItems = [];
  7148. }
  7149. // Otherwise go through the dates to disable.
  7150. else {
  7151. datesToDisable.map(function (unitToDisable) {
  7152. var matchFound;
  7153. // When we have disabled items, check for matches.
  7154. // If something is matched, immediately break out.
  7155. for (var index = 0; index < disabledItems.length; index += 1) {
  7156. if (calendar.isDateExact(unitToDisable, disabledItems[index])) {
  7157. matchFound = true;
  7158. break;
  7159. }
  7160. }
  7161. // If nothing was found, add the validated unit to the collection.
  7162. if (!matchFound) {
  7163. if (_.isInteger(unitToDisable) || _.isDate(unitToDisable) || $.isArray(unitToDisable) || $.isPlainObject(unitToDisable) && unitToDisable.from && unitToDisable.to) {
  7164. disabledItems.push(unitToDisable);
  7165. }
  7166. }
  7167. });
  7168. }
  7169. // Return the updated collection.
  7170. return disabledItems;
  7171. }; //DatePicker.prototype.deactivate
  7172. /**
  7173. * Mark a collection of dates as “enabled”.
  7174. */
  7175. DatePicker.prototype.activate = function (type, datesToEnable) {
  7176. var calendar = this,
  7177. disabledItems = calendar.item.disable,
  7178. disabledItemsCount = disabledItems.length;
  7179. // If we’re flipping, that’s all we need to do.
  7180. if (datesToEnable == 'flip') {
  7181. calendar.flipEnable();
  7182. } else if (datesToEnable === true) {
  7183. calendar.flipEnable(1);
  7184. disabledItems = [];
  7185. } else if (datesToEnable === false) {
  7186. calendar.flipEnable(-1);
  7187. disabledItems = [];
  7188. }
  7189. // Otherwise go through the disabled dates.
  7190. else {
  7191. datesToEnable.map(function (unitToEnable) {
  7192. var matchFound, disabledUnit, index, isExactRange;
  7193. // Go through the disabled items and try to find a match.
  7194. for (index = 0; index < disabledItemsCount; index += 1) {
  7195. disabledUnit = disabledItems[index];
  7196. // When an exact match is found, remove it from the collection.
  7197. if (calendar.isDateExact(disabledUnit, unitToEnable)) {
  7198. matchFound = disabledItems[index] = null;
  7199. isExactRange = true;
  7200. break;
  7201. }
  7202. // When an overlapped match is found, add the “inverted” state to it.
  7203. else if (calendar.isDateOverlap(disabledUnit, unitToEnable)) {
  7204. if ($.isPlainObject(unitToEnable)) {
  7205. unitToEnable.inverted = true;
  7206. matchFound = unitToEnable;
  7207. } else if ($.isArray(unitToEnable)) {
  7208. matchFound = unitToEnable;
  7209. if (!matchFound[3]) matchFound.push('inverted');
  7210. } else if (_.isDate(unitToEnable)) {
  7211. matchFound = [unitToEnable.getFullYear(), unitToEnable.getMonth(), unitToEnable.getDate(), 'inverted'];
  7212. }
  7213. break;
  7214. }
  7215. }
  7216. // If a match was found, remove a previous duplicate entry.
  7217. if (matchFound) for (index = 0; index < disabledItemsCount; index += 1) {
  7218. if (calendar.isDateExact(disabledItems[index], unitToEnable)) {
  7219. disabledItems[index] = null;
  7220. break;
  7221. }
  7222. }
  7223. // In the event that we’re dealing with an exact range of dates,
  7224. // make sure there are no “inverted” dates because of it.
  7225. if (isExactRange) for (index = 0; index < disabledItemsCount; index += 1) {
  7226. if (calendar.isDateOverlap(disabledItems[index], unitToEnable)) {
  7227. disabledItems[index] = null;
  7228. break;
  7229. }
  7230. }
  7231. // If something is still matched, add it into the collection.
  7232. if (matchFound) {
  7233. disabledItems.push(matchFound);
  7234. }
  7235. });
  7236. }
  7237. // Return the updated collection.
  7238. return disabledItems.filter(function (val) {
  7239. return val != null;
  7240. });
  7241. }; //DatePicker.prototype.activate
  7242. /**
  7243. * Create a string for the nodes in the picker.
  7244. */
  7245. DatePicker.prototype.nodes = function (isOpen) {
  7246. var calendar = this,
  7247. settings = calendar.settings,
  7248. calendarItem = calendar.item,
  7249. nowObject = calendarItem.now,
  7250. selectedObject = calendarItem.select,
  7251. highlightedObject = calendarItem.highlight,
  7252. viewsetObject = calendarItem.view,
  7253. disabledCollection = calendarItem.disable,
  7254. minLimitObject = calendarItem.min,
  7255. maxLimitObject = calendarItem.max,
  7256. // Create the calendar table head using a copy of weekday labels collection.
  7257. // * We do a copy so we don't mutate the original array.
  7258. tableHead = function (collection, fullCollection) {
  7259. // If the first day should be Monday, move Sunday to the end.
  7260. if (settings.firstDay) {
  7261. collection.push(collection.shift());
  7262. fullCollection.push(fullCollection.shift());
  7263. }
  7264. // Create and return the table head group.
  7265. return _.node('thead', _.node('tr', _.group({
  7266. min: 0,
  7267. max: DAYS_IN_WEEK - 1,
  7268. i: 1,
  7269. node: 'th',
  7270. item: function (counter) {
  7271. return [collection[counter], settings.klass.weekdays, 'scope=col title="' + fullCollection[counter] + '"'];
  7272. }
  7273. }))); //endreturn
  7274. // Materialize modified
  7275. }((settings.showWeekdaysFull ? settings.weekdaysFull : settings.weekdaysLetter).slice(0), settings.weekdaysFull.slice(0)),
  7276. //tableHead
  7277. // Create the nav for next/prev month.
  7278. createMonthNav = function (next) {
  7279. // Otherwise, return the created month tag.
  7280. return _.node('div', ' ', settings.klass['nav' + (next ? 'Next' : 'Prev')] + (
  7281. // If the focused month is outside the range, disabled the button.
  7282. 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({
  7283. role: 'button',
  7284. controls: calendar.$node[0].id + '_table'
  7285. }) + ' ' + 'title="' + (next ? settings.labelMonthNext : settings.labelMonthPrev) + '"'); //endreturn
  7286. },
  7287. //createMonthNav
  7288. // Create the month label.
  7289. //Materialize modified
  7290. createMonthLabel = function (override) {
  7291. var monthsCollection = settings.showMonthsShort ? settings.monthsShort : settings.monthsFull;
  7292. // Materialize modified
  7293. if (override == "short_months") {
  7294. monthsCollection = settings.monthsShort;
  7295. }
  7296. // If there are months to select, add a dropdown menu.
  7297. if (settings.selectMonths && override == undefined) {
  7298. return _.node('select', _.group({
  7299. min: 0,
  7300. max: 11,
  7301. i: 1,
  7302. node: 'option',
  7303. item: function (loopedMonth) {
  7304. return [
  7305. // The looped month and no classes.
  7306. monthsCollection[loopedMonth], 0,
  7307. // Set the value and selected index.
  7308. 'value=' + loopedMonth + (viewsetObject.month == loopedMonth ? ' selected' : '') + (viewsetObject.year == minLimitObject.year && loopedMonth < minLimitObject.month || viewsetObject.year == maxLimitObject.year && loopedMonth > maxLimitObject.month ? ' disabled' : '')];
  7309. }
  7310. }), settings.klass.selectMonth + ' browser-default', (isOpen ? '' : 'disabled') + ' ' + _.ariaAttr({ controls: calendar.$node[0].id + '_table' }) + ' ' + 'title="' + settings.labelMonthSelect + '"');
  7311. }
  7312. // Materialize modified
  7313. if (override == "short_months") if (selectedObject != null) return monthsCollection[selectedObject.month]; else return monthsCollection[viewsetObject.month];
  7314. // If there's a need for a month selector
  7315. return _.node('div', monthsCollection[viewsetObject.month], settings.klass.month);
  7316. },
  7317. //createMonthLabel
  7318. // Create the year label.
  7319. // Materialize modified
  7320. createYearLabel = function (override) {
  7321. var focusedYear = viewsetObject.year,
  7322. // If years selector is set to a literal "true", set it to 5. Otherwise
  7323. // divide in half to get half before and half after focused year.
  7324. numberYears = settings.selectYears === true ? 5 : ~~(settings.selectYears / 2);
  7325. // If there are years to select, add a dropdown menu.
  7326. if (numberYears) {
  7327. var minYear = minLimitObject.year,
  7328. maxYear = maxLimitObject.year,
  7329. lowestYear = focusedYear - numberYears,
  7330. highestYear = focusedYear + numberYears;
  7331. // If the min year is greater than the lowest year, increase the highest year
  7332. // by the difference and set the lowest year to the min year.
  7333. if (minYear > lowestYear) {
  7334. highestYear += minYear - lowestYear;
  7335. lowestYear = minYear;
  7336. }
  7337. // If the max year is less than the highest year, decrease the lowest year
  7338. // by the lower of the two: available and needed years. Then set the
  7339. // highest year to the max year.
  7340. if (maxYear < highestYear) {
  7341. var availableYears = lowestYear - minYear,
  7342. neededYears = highestYear - maxYear;
  7343. lowestYear -= availableYears > neededYears ? neededYears : availableYears;
  7344. highestYear = maxYear;
  7345. }
  7346. if (settings.selectYears && override == undefined) {
  7347. return _.node('select', _.group({
  7348. min: lowestYear,
  7349. max: highestYear,
  7350. i: 1,
  7351. node: 'option',
  7352. item: function (loopedYear) {
  7353. return [
  7354. // The looped year and no classes.
  7355. loopedYear, 0,
  7356. // Set the value and selected index.
  7357. 'value=' + loopedYear + (focusedYear == loopedYear ? ' selected' : '')];
  7358. }
  7359. }), settings.klass.selectYear + ' browser-default', (isOpen ? '' : 'disabled') + ' ' + _.ariaAttr({ controls: calendar.$node[0].id + '_table' }) + ' ' + 'title="' + settings.labelYearSelect + '"');
  7360. }
  7361. }
  7362. // Materialize modified
  7363. if (override === 'raw' && selectedObject != null) {
  7364. return _.node('div', selectedObject.year);
  7365. }
  7366. // Otherwise just return the year focused
  7367. return _.node('div', focusedYear, settings.klass.year);
  7368. }; //createYearLabel
  7369. // Materialize modified
  7370. createDayLabel = function () {
  7371. if (selectedObject != null) return selectedObject.date; else return nowObject.date;
  7372. };
  7373. createWeekdayLabel = function () {
  7374. var display_day;
  7375. if (selectedObject != null) display_day = selectedObject.day; else display_day = nowObject.day;
  7376. var weekday = settings.weekdaysShort[display_day];
  7377. return weekday;
  7378. };
  7379. // Create and return the entire calendar.
  7380. return _.node(
  7381. // Date presentation View
  7382. 'div', _.node(
  7383. // Div for Year
  7384. 'div', createYearLabel("raw"), settings.klass.year_display) + _.node('span', createWeekdayLabel() + ', ', "picker__weekday-display") + _.node(
  7385. // Div for short Month
  7386. 'span', createMonthLabel("short_months") + ' ', settings.klass.month_display) + _.node(
  7387. // Div for Day
  7388. 'span', createDayLabel(), settings.klass.day_display), settings.klass.date_display) +
  7389. // Calendar container
  7390. _.node('div', _.node('div', _.node('div', (settings.selectYears ? createMonthLabel() + createYearLabel() : createMonthLabel() + createYearLabel()) + createMonthNav() + createMonthNav(1), settings.klass.header) + _.node('table', tableHead + _.node('tbody', _.group({
  7391. min: 0,
  7392. max: WEEKS_IN_CALENDAR - 1,
  7393. i: 1,
  7394. node: 'tr',
  7395. item: function (rowCounter) {
  7396. // If Monday is the first day and the month starts on Sunday, shift the date back a week.
  7397. var shiftDateBy = settings.firstDay && calendar.create([viewsetObject.year, viewsetObject.month, 1]).day === 0 ? -7 : 0;
  7398. return [_.group({
  7399. min: DAYS_IN_WEEK * rowCounter - viewsetObject.day + shiftDateBy + 1, // Add 1 for weekday 0index
  7400. max: function () {
  7401. return this.min + DAYS_IN_WEEK - 1;
  7402. },
  7403. i: 1,
  7404. node: 'td',
  7405. item: function (targetDate) {
  7406. // Convert the time date from a relative date to a target date.
  7407. targetDate = calendar.create([viewsetObject.year, viewsetObject.month, targetDate + (settings.firstDay ? 1 : 0)]);
  7408. var isSelected = selectedObject && selectedObject.pick == targetDate.pick,
  7409. isHighlighted = highlightedObject && highlightedObject.pick == targetDate.pick,
  7410. isDisabled = disabledCollection && calendar.disabled(targetDate) || targetDate.pick < minLimitObject.pick || targetDate.pick > maxLimitObject.pick,
  7411. formattedDate = _.trigger(calendar.formats.toString, calendar, [settings.format, targetDate]);
  7412. return [_.node('div', targetDate.date, function (klasses) {
  7413. // Add the `infocus` or `outfocus` classes based on month in view.
  7414. klasses.push(viewsetObject.month == targetDate.month ? settings.klass.infocus : settings.klass.outfocus);
  7415. // Add the `today` class if needed.
  7416. if (nowObject.pick == targetDate.pick) {
  7417. klasses.push(settings.klass.now);
  7418. }
  7419. // Add the `selected` class if something's selected and the time matches.
  7420. if (isSelected) {
  7421. klasses.push(settings.klass.selected);
  7422. }
  7423. // Add the `highlighted` class if something's highlighted and the time matches.
  7424. if (isHighlighted) {
  7425. klasses.push(settings.klass.highlighted);
  7426. }
  7427. // Add the `disabled` class if something's disabled and the object matches.
  7428. if (isDisabled) {
  7429. klasses.push(settings.klass.disabled);
  7430. }
  7431. return klasses.join(' ');
  7432. }([settings.klass.day]), 'data-pick=' + targetDate.pick + ' ' + _.ariaAttr({
  7433. role: 'gridcell',
  7434. label: formattedDate,
  7435. selected: isSelected && calendar.$node.val() === formattedDate ? true : null,
  7436. activedescendant: isHighlighted ? true : null,
  7437. disabled: isDisabled ? true : null
  7438. }) + ' ' + (isDisabled ? '' : 'tabindex="0"')), '', _.ariaAttr({ role: 'presentation' })]; //endreturn
  7439. }
  7440. })]; //endreturn
  7441. }
  7442. })), settings.klass.table, 'id="' + calendar.$node[0].id + '_table' + '" ' + _.ariaAttr({
  7443. role: 'grid',
  7444. controls: calendar.$node[0].id,
  7445. readonly: true
  7446. })), settings.klass.calendar_container) // end calendar
  7447. +
  7448. // * For Firefox forms to submit, make sure to set the buttons’ `type` attributes as “button”.
  7449. _.node('div', _.node('button', settings.today, "btn-flat picker__today waves-effect", 'type=button data-pick=' + nowObject.pick + (isOpen && !calendar.disabled(nowObject) ? '' : ' disabled') + ' ' + _.ariaAttr({ controls: calendar.$node[0].id })) + _.node('button', settings.clear, "btn-flat picker__clear waves-effect", 'type=button data-clear=1' + (isOpen ? '' : ' disabled') + ' ' + _.ariaAttr({ controls: calendar.$node[0].id })) + _.node('button', settings.close, "btn-flat picker__close waves-effect", 'type=button data-close=true ' + (isOpen ? '' : ' disabled') + ' ' + _.ariaAttr({ controls: calendar.$node[0].id })), settings.klass.footer), 'picker__container__wrapper'); //endreturn
  7450. }; //DatePicker.prototype.nodes
  7451. /**
  7452. * The date picker defaults.
  7453. */
  7454. DatePicker.defaults = function (prefix) {
  7455. return {
  7456. // The title label to use for the month nav buttons
  7457. labelMonthNext: 'Next month',
  7458. labelMonthPrev: 'Previous month',
  7459. // The title label to use for the dropdown selectors
  7460. labelMonthSelect: 'Select a month',
  7461. labelYearSelect: 'Select a year',
  7462. // Months and weekdays
  7463. monthsFull: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
  7464. monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
  7465. weekdaysFull: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
  7466. weekdaysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
  7467. // Materialize modified
  7468. weekdaysLetter: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
  7469. // Today and clear
  7470. today: 'Today',
  7471. clear: 'Clear',
  7472. close: 'Ok',
  7473. // Picker close behavior (Prevent a change in behaviour for backwards compatibility)
  7474. closeOnSelect: false,
  7475. // The format to show on the `input` element
  7476. format: 'd mmmm, yyyy',
  7477. // Classes
  7478. klass: {
  7479. table: prefix + 'table',
  7480. header: prefix + 'header',
  7481. // Materialize Added klasses
  7482. date_display: prefix + 'date-display',
  7483. day_display: prefix + 'day-display',
  7484. month_display: prefix + 'month-display',
  7485. year_display: prefix + 'year-display',
  7486. calendar_container: prefix + 'calendar-container',
  7487. // end
  7488. navPrev: prefix + 'nav--prev',
  7489. navNext: prefix + 'nav--next',
  7490. navDisabled: prefix + 'nav--disabled',
  7491. month: prefix + 'month',
  7492. year: prefix + 'year',
  7493. selectMonth: prefix + 'select--month',
  7494. selectYear: prefix + 'select--year',
  7495. weekdays: prefix + 'weekday',
  7496. day: prefix + 'day',
  7497. disabled: prefix + 'day--disabled',
  7498. selected: prefix + 'day--selected',
  7499. highlighted: prefix + 'day--highlighted',
  7500. now: prefix + 'day--today',
  7501. infocus: prefix + 'day--infocus',
  7502. outfocus: prefix + 'day--outfocus',
  7503. footer: prefix + 'footer',
  7504. buttonClear: prefix + 'button--clear',
  7505. buttonToday: prefix + 'button--today',
  7506. buttonClose: prefix + 'button--close'
  7507. }
  7508. };
  7509. }(Picker.klasses().picker + '__');
  7510. /**
  7511. * Extend the picker to add the date picker.
  7512. */
  7513. Picker.extend('pickadate', DatePicker);
  7514. });
  7515. ; /*!
  7516. * ClockPicker v0.0.7 (http://weareoutman.github.io/clockpicker/)
  7517. * Copyright 2014 Wang Shenwei.
  7518. * Licensed under MIT (https://github.com/weareoutman/clockpicker/blob/gh-pages/LICENSE)
  7519. *
  7520. * Further modified
  7521. * Copyright 2015 Ching Yaw Hao.
  7522. */
  7523. (function ($) {
  7524. var $win = $(window),
  7525. $doc = $(document);
  7526. // Can I use inline svg ?
  7527. var svgNS = 'http://www.w3.org/2000/svg',
  7528. svgSupported = 'SVGAngle' in window && function () {
  7529. var supported,
  7530. el = document.createElement('div');
  7531. el.innerHTML = '<svg/>';
  7532. supported = (el.firstChild && el.firstChild.namespaceURI) == svgNS;
  7533. el.innerHTML = '';
  7534. return supported;
  7535. }();
  7536. // Can I use transition ?
  7537. var transitionSupported = function () {
  7538. var style = document.createElement('div').style;
  7539. return 'transition' in style || 'WebkitTransition' in style || 'MozTransition' in style || 'msTransition' in style || 'OTransition' in style;
  7540. }();
  7541. // Listen touch events in touch screen device, instead of mouse events in desktop.
  7542. var touchSupported = 'ontouchstart' in window,
  7543. mousedownEvent = 'mousedown' + (touchSupported ? ' touchstart' : ''),
  7544. mousemoveEvent = 'mousemove.clockpicker' + (touchSupported ? ' touchmove.clockpicker' : ''),
  7545. mouseupEvent = 'mouseup.clockpicker' + (touchSupported ? ' touchend.clockpicker' : '');
  7546. // Vibrate the device if supported
  7547. var vibrate = navigator.vibrate ? 'vibrate' : navigator.webkitVibrate ? 'webkitVibrate' : null;
  7548. function createSvgElement(name) {
  7549. return document.createElementNS(svgNS, name);
  7550. }
  7551. function leadingZero(num) {
  7552. return (num < 10 ? '0' : '') + num;
  7553. }
  7554. // Get a unique id
  7555. var idCounter = 0;
  7556. function uniqueId(prefix) {
  7557. var id = ++idCounter + '';
  7558. return prefix ? prefix + id : id;
  7559. }
  7560. // Clock size
  7561. var dialRadius = 135,
  7562. outerRadius = 105,
  7563. // innerRadius = 80 on 12 hour clock
  7564. innerRadius = 70,
  7565. tickRadius = 20,
  7566. diameter = dialRadius * 2,
  7567. duration = transitionSupported ? 350 : 1;
  7568. // Popover template
  7569. 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('');
  7570. // ClockPicker
  7571. function ClockPicker(element, options) {
  7572. var popover = $(tpl),
  7573. plate = popover.find('.clockpicker-plate'),
  7574. holder = popover.find('.picker__holder'),
  7575. hoursView = popover.find('.clockpicker-hours'),
  7576. minutesView = popover.find('.clockpicker-minutes'),
  7577. amPmBlock = popover.find('.clockpicker-am-pm-block'),
  7578. isInput = element.prop('tagName') === 'INPUT',
  7579. input = isInput ? element : element.find('input'),
  7580. label = $("label[for=" + input.attr("id") + "]"),
  7581. self = this;
  7582. this.id = uniqueId('cp');
  7583. this.element = element;
  7584. this.holder = holder;
  7585. this.options = options;
  7586. this.isAppended = false;
  7587. this.isShown = false;
  7588. this.currentView = 'hours';
  7589. this.isInput = isInput;
  7590. this.input = input;
  7591. this.label = label;
  7592. this.popover = popover;
  7593. this.plate = plate;
  7594. this.hoursView = hoursView;
  7595. this.minutesView = minutesView;
  7596. this.amPmBlock = amPmBlock;
  7597. this.spanHours = popover.find('.clockpicker-span-hours');
  7598. this.spanMinutes = popover.find('.clockpicker-span-minutes');
  7599. this.spanAmPm = popover.find('.clockpicker-span-am-pm');
  7600. this.footer = popover.find('.picker__footer');
  7601. this.amOrPm = "PM";
  7602. // Setup for for 12 hour clock if option is selected
  7603. if (options.twelvehour) {
  7604. if (!options.ampmclickable) {
  7605. this.spanAmPm.empty();
  7606. $('<div id="click-am">AM</div>').appendTo(this.spanAmPm);
  7607. $('<div id="click-pm">PM</div>').appendTo(this.spanAmPm);
  7608. } else {
  7609. this.spanAmPm.empty();
  7610. $('<div id="click-am">AM</div>').on("click", function () {
  7611. self.spanAmPm.children('#click-am').addClass("text-primary");
  7612. self.spanAmPm.children('#click-pm').removeClass("text-primary");
  7613. self.amOrPm = "AM";
  7614. }).appendTo(this.spanAmPm);
  7615. $('<div id="click-pm">PM</div>').on("click", function () {
  7616. self.spanAmPm.children('#click-pm').addClass("text-primary");
  7617. self.spanAmPm.children('#click-am').removeClass("text-primary");
  7618. self.amOrPm = 'PM';
  7619. }).appendTo(this.spanAmPm);
  7620. }
  7621. }
  7622. // Add buttons to footer
  7623. $('<button type="button" class="btn-flat picker__clear" tabindex="' + (options.twelvehour ? '3' : '1') + '">' + options.cleartext + '</button>').click($.proxy(this.clear, this)).appendTo(this.footer);
  7624. $('<button type="button" class="btn-flat picker__close" tabindex="' + (options.twelvehour ? '3' : '1') + '">' + options.canceltext + '</button>').click($.proxy(this.hide, this)).appendTo(this.footer);
  7625. $('<button type="button" class="btn-flat picker__close" tabindex="' + (options.twelvehour ? '3' : '1') + '">' + options.donetext + '</button>').click($.proxy(this.done, this)).appendTo(this.footer);
  7626. this.spanHours.click($.proxy(this.toggleView, this, 'hours'));
  7627. this.spanMinutes.click($.proxy(this.toggleView, this, 'minutes'));
  7628. // Show or toggle
  7629. input.on('focus.clockpicker click.clockpicker', $.proxy(this.show, this));
  7630. // Build ticks
  7631. var tickTpl = $('<div class="clockpicker-tick"></div>'),
  7632. i,
  7633. tick,
  7634. radian,
  7635. radius;
  7636. // Hours view
  7637. if (options.twelvehour) {
  7638. for (i = 1; i < 13; i += 1) {
  7639. tick = tickTpl.clone();
  7640. radian = i / 6 * Math.PI;
  7641. radius = outerRadius;
  7642. tick.css({
  7643. left: dialRadius + Math.sin(radian) * radius - tickRadius,
  7644. top: dialRadius - Math.cos(radian) * radius - tickRadius
  7645. });
  7646. tick.html(i === 0 ? '00' : i);
  7647. hoursView.append(tick);
  7648. tick.on(mousedownEvent, mousedown);
  7649. }
  7650. } else {
  7651. for (i = 0; i < 24; i += 1) {
  7652. tick = tickTpl.clone();
  7653. radian = i / 6 * Math.PI;
  7654. var inner = i > 0 && i < 13;
  7655. radius = inner ? innerRadius : outerRadius;
  7656. tick.css({
  7657. left: dialRadius + Math.sin(radian) * radius - tickRadius,
  7658. top: dialRadius - Math.cos(radian) * radius - tickRadius
  7659. });
  7660. tick.html(i === 0 ? '00' : i);
  7661. hoursView.append(tick);
  7662. tick.on(mousedownEvent, mousedown);
  7663. }
  7664. }
  7665. // Minutes view
  7666. for (i = 0; i < 60; i += 5) {
  7667. tick = tickTpl.clone();
  7668. radian = i / 30 * Math.PI;
  7669. tick.css({
  7670. left: dialRadius + Math.sin(radian) * outerRadius - tickRadius,
  7671. top: dialRadius - Math.cos(radian) * outerRadius - tickRadius
  7672. });
  7673. tick.html(leadingZero(i));
  7674. minutesView.append(tick);
  7675. tick.on(mousedownEvent, mousedown);
  7676. }
  7677. // Clicking on minutes view space
  7678. plate.on(mousedownEvent, function (e) {
  7679. if ($(e.target).closest('.clockpicker-tick').length === 0) {
  7680. mousedown(e, true);
  7681. }
  7682. });
  7683. // Mousedown or touchstart
  7684. function mousedown(e, space) {
  7685. var offset = plate.offset(),
  7686. isTouch = /^touch/.test(e.type),
  7687. x0 = offset.left + dialRadius,
  7688. y0 = offset.top + dialRadius,
  7689. dx = (isTouch ? e.originalEvent.touches[0] : e).pageX - x0,
  7690. dy = (isTouch ? e.originalEvent.touches[0] : e).pageY - y0,
  7691. z = Math.sqrt(dx * dx + dy * dy),
  7692. moved = false;
  7693. // When clicking on minutes view space, check the mouse position
  7694. if (space && (z < outerRadius - tickRadius || z > outerRadius + tickRadius)) {
  7695. return;
  7696. }
  7697. e.preventDefault();
  7698. // Set cursor style of body after 200ms
  7699. var movingTimer = setTimeout(function () {
  7700. self.popover.addClass('clockpicker-moving');
  7701. }, 200);
  7702. // Clock
  7703. self.setHand(dx, dy, !space, true);
  7704. // Mousemove on document
  7705. $doc.off(mousemoveEvent).on(mousemoveEvent, function (e) {
  7706. e.preventDefault();
  7707. var isTouch = /^touch/.test(e.type),
  7708. x = (isTouch ? e.originalEvent.touches[0] : e).pageX - x0,
  7709. y = (isTouch ? e.originalEvent.touches[0] : e).pageY - y0;
  7710. if (!moved && x === dx && y === dy) {
  7711. // Clicking in chrome on windows will trigger a mousemove event
  7712. return;
  7713. }
  7714. moved = true;
  7715. self.setHand(x, y, false, true);
  7716. });
  7717. // Mouseup on document
  7718. $doc.off(mouseupEvent).on(mouseupEvent, function (e) {
  7719. $doc.off(mouseupEvent);
  7720. e.preventDefault();
  7721. var isTouch = /^touch/.test(e.type),
  7722. x = (isTouch ? e.originalEvent.changedTouches[0] : e).pageX - x0,
  7723. y = (isTouch ? e.originalEvent.changedTouches[0] : e).pageY - y0;
  7724. if ((space || moved) && x === dx && y === dy) {
  7725. self.setHand(x, y);
  7726. }
  7727. if (self.currentView === 'hours') {
  7728. self.toggleView('minutes', duration / 2);
  7729. } else if (options.autoclose) {
  7730. self.minutesView.addClass('clockpicker-dial-out');
  7731. setTimeout(function () {
  7732. self.done();
  7733. }, duration / 2);
  7734. }
  7735. plate.prepend(canvas);
  7736. // Reset cursor style of body
  7737. clearTimeout(movingTimer);
  7738. self.popover.removeClass('clockpicker-moving');
  7739. // Unbind mousemove event
  7740. $doc.off(mousemoveEvent);
  7741. });
  7742. }
  7743. if (svgSupported) {
  7744. // Draw clock hands and others
  7745. var canvas = popover.find('.clockpicker-canvas'),
  7746. svg = createSvgElement('svg');
  7747. svg.setAttribute('class', 'clockpicker-svg');
  7748. svg.setAttribute('width', diameter);
  7749. svg.setAttribute('height', diameter);
  7750. var g = createSvgElement('g');
  7751. g.setAttribute('transform', 'translate(' + dialRadius + ',' + dialRadius + ')');
  7752. var bearing = createSvgElement('circle');
  7753. bearing.setAttribute('class', 'clockpicker-canvas-bearing');
  7754. bearing.setAttribute('cx', 0);
  7755. bearing.setAttribute('cy', 0);
  7756. bearing.setAttribute('r', 4);
  7757. var hand = createSvgElement('line');
  7758. hand.setAttribute('x1', 0);
  7759. hand.setAttribute('y1', 0);
  7760. var bg = createSvgElement('circle');
  7761. bg.setAttribute('class', 'clockpicker-canvas-bg');
  7762. bg.setAttribute('r', tickRadius);
  7763. g.appendChild(hand);
  7764. g.appendChild(bg);
  7765. g.appendChild(bearing);
  7766. svg.appendChild(g);
  7767. canvas.append(svg);
  7768. this.hand = hand;
  7769. this.bg = bg;
  7770. this.bearing = bearing;
  7771. this.g = g;
  7772. this.canvas = canvas;
  7773. }
  7774. raiseCallback(this.options.init);
  7775. }
  7776. function raiseCallback(callbackFunction) {
  7777. if (callbackFunction && typeof callbackFunction === "function") callbackFunction();
  7778. }
  7779. // Default options
  7780. ClockPicker.DEFAULTS = {
  7781. 'default': '', // default time, 'now' or '13:14' e.g.
  7782. fromnow: 0, // set default time to * milliseconds from now (using with default = 'now')
  7783. donetext: 'Ok', // done button text
  7784. cleartext: 'Clear',
  7785. canceltext: 'Cancel',
  7786. autoclose: false, // auto close when minute is selected
  7787. ampmclickable: true, // set am/pm button on itself
  7788. darktheme: false, // set to dark theme
  7789. twelvehour: true, // change to 12 hour AM/PM clock from 24 hour
  7790. vibrate: true // vibrate the device when dragging clock hand
  7791. };
  7792. // Show or hide popover
  7793. ClockPicker.prototype.toggle = function () {
  7794. this[this.isShown ? 'hide' : 'show']();
  7795. };
  7796. // Set popover position
  7797. ClockPicker.prototype.locate = function () {
  7798. var element = this.element,
  7799. popover = this.popover,
  7800. offset = element.offset(),
  7801. width = element.outerWidth(),
  7802. height = element.outerHeight(),
  7803. align = this.options.align,
  7804. self = this;
  7805. popover.show();
  7806. };
  7807. // Show popover
  7808. ClockPicker.prototype.show = function (e) {
  7809. // Not show again
  7810. if (this.isShown) {
  7811. return;
  7812. }
  7813. raiseCallback(this.options.beforeShow);
  7814. $(':input').each(function () {
  7815. $(this).attr('tabindex', -1);
  7816. });
  7817. var self = this;
  7818. // Initialize
  7819. this.input.blur();
  7820. this.popover.addClass('picker--opened');
  7821. this.input.addClass('picker__input picker__input--active');
  7822. $(document.body).css('overflow', 'hidden');
  7823. // Get the time
  7824. var value = ((this.input.prop('value') || this.options['default'] || '') + '').split(':');
  7825. if (this.options.twelvehour && !(typeof value[1] === 'undefined')) {
  7826. if (value[1].indexOf("AM") > 0) {
  7827. this.amOrPm = 'AM';
  7828. } else {
  7829. this.amOrPm = 'PM';
  7830. }
  7831. value[1] = value[1].replace("AM", "").replace("PM", "");
  7832. }
  7833. if (value[0] === 'now') {
  7834. var now = new Date(+new Date() + this.options.fromnow);
  7835. value = [now.getHours(), now.getMinutes()];
  7836. if (this.options.twelvehour) {
  7837. this.amOrPm = value[0] >= 12 && value[0] < 24 ? 'PM' : 'AM';
  7838. }
  7839. }
  7840. this.hours = +value[0] || 0;
  7841. this.minutes = +value[1] || 0;
  7842. this.spanHours.html(this.hours);
  7843. this.spanMinutes.html(leadingZero(this.minutes));
  7844. if (!this.isAppended) {
  7845. // Append popover to input by default
  7846. var containerEl = document.querySelector(this.options.container);
  7847. if (this.options.container && containerEl) {
  7848. containerEl.appendChild(this.popover[0]);
  7849. } else {
  7850. this.popover.insertAfter(this.input);
  7851. }
  7852. if (this.options.twelvehour) {
  7853. if (this.amOrPm === 'PM') {
  7854. this.spanAmPm.children('#click-pm').addClass("text-primary");
  7855. this.spanAmPm.children('#click-am').removeClass("text-primary");
  7856. } else {
  7857. this.spanAmPm.children('#click-am').addClass("text-primary");
  7858. this.spanAmPm.children('#click-pm').removeClass("text-primary");
  7859. }
  7860. }
  7861. // Reset position when resize
  7862. $win.on('resize.clockpicker' + this.id, function () {
  7863. if (self.isShown) {
  7864. self.locate();
  7865. }
  7866. });
  7867. this.isAppended = true;
  7868. }
  7869. // Toggle to hours view
  7870. this.toggleView('hours');
  7871. // Set position
  7872. this.locate();
  7873. this.isShown = true;
  7874. // Hide when clicking or tabbing on any element except the clock and input
  7875. $doc.on('click.clockpicker.' + this.id + ' focusin.clockpicker.' + this.id, function (e) {
  7876. var target = $(e.target);
  7877. if (target.closest(self.popover.find('.picker__wrap')).length === 0 && target.closest(self.input).length === 0) {
  7878. self.hide();
  7879. }
  7880. });
  7881. // Hide when ESC is pressed
  7882. $doc.on('keyup.clockpicker.' + this.id, function (e) {
  7883. if (e.keyCode === 27) {
  7884. self.hide();
  7885. }
  7886. });
  7887. raiseCallback(this.options.afterShow);
  7888. };
  7889. // Hide popover
  7890. ClockPicker.prototype.hide = function () {
  7891. raiseCallback(this.options.beforeHide);
  7892. this.input.removeClass('picker__input picker__input--active');
  7893. this.popover.removeClass('picker--opened');
  7894. $(document.body).css('overflow', 'visible');
  7895. this.isShown = false;
  7896. $(':input').each(function (index) {
  7897. $(this).attr('tabindex', index + 1);
  7898. });
  7899. // Unbinding events on document
  7900. $doc.off('click.clockpicker.' + this.id + ' focusin.clockpicker.' + this.id);
  7901. $doc.off('keyup.clockpicker.' + this.id);
  7902. this.popover.hide();
  7903. raiseCallback(this.options.afterHide);
  7904. };
  7905. // Toggle to hours or minutes view
  7906. ClockPicker.prototype.toggleView = function (view, delay) {
  7907. var raiseAfterHourSelect = false;
  7908. if (view === 'minutes' && $(this.hoursView).css("visibility") === "visible") {
  7909. raiseCallback(this.options.beforeHourSelect);
  7910. raiseAfterHourSelect = true;
  7911. }
  7912. var isHours = view === 'hours',
  7913. nextView = isHours ? this.hoursView : this.minutesView,
  7914. hideView = isHours ? this.minutesView : this.hoursView;
  7915. this.currentView = view;
  7916. this.spanHours.toggleClass('text-primary', isHours);
  7917. this.spanMinutes.toggleClass('text-primary', !isHours);
  7918. // Let's make transitions
  7919. hideView.addClass('clockpicker-dial-out');
  7920. nextView.css('visibility', 'visible').removeClass('clockpicker-dial-out');
  7921. // Reset clock hand
  7922. this.resetClock(delay);
  7923. // After transitions ended
  7924. clearTimeout(this.toggleViewTimer);
  7925. this.toggleViewTimer = setTimeout(function () {
  7926. hideView.css('visibility', 'hidden');
  7927. }, duration);
  7928. if (raiseAfterHourSelect) {
  7929. raiseCallback(this.options.afterHourSelect);
  7930. }
  7931. };
  7932. // Reset clock hand
  7933. ClockPicker.prototype.resetClock = function (delay) {
  7934. var view = this.currentView,
  7935. value = this[view],
  7936. isHours = view === 'hours',
  7937. unit = Math.PI / (isHours ? 6 : 30),
  7938. radian = value * unit,
  7939. radius = isHours && value > 0 && value < 13 ? innerRadius : outerRadius,
  7940. x = Math.sin(radian) * radius,
  7941. y = -Math.cos(radian) * radius,
  7942. self = this;
  7943. if (svgSupported && delay) {
  7944. self.canvas.addClass('clockpicker-canvas-out');
  7945. setTimeout(function () {
  7946. self.canvas.removeClass('clockpicker-canvas-out');
  7947. self.setHand(x, y);
  7948. }, delay);
  7949. } else this.setHand(x, y);
  7950. };
  7951. // Set clock hand to (x, y)
  7952. ClockPicker.prototype.setHand = function (x, y, roundBy5, dragging) {
  7953. var radian = Math.atan2(x, -y),
  7954. isHours = this.currentView === 'hours',
  7955. unit = Math.PI / (isHours || roundBy5 ? 6 : 30),
  7956. z = Math.sqrt(x * x + y * y),
  7957. options = this.options,
  7958. inner = isHours && z < (outerRadius + innerRadius) / 2,
  7959. radius = inner ? innerRadius : outerRadius,
  7960. value;
  7961. if (options.twelvehour) {
  7962. radius = outerRadius;
  7963. }
  7964. // Radian should in range [0, 2PI]
  7965. if (radian < 0) {
  7966. radian = Math.PI * 2 + radian;
  7967. }
  7968. // Get the round value
  7969. value = Math.round(radian / unit);
  7970. // Get the round radian
  7971. radian = value * unit;
  7972. // Correct the hours or minutes
  7973. if (options.twelvehour) {
  7974. if (isHours) {
  7975. if (value === 0) value = 12;
  7976. } else {
  7977. if (roundBy5) value *= 5;
  7978. if (value === 60) value = 0;
  7979. }
  7980. } else {
  7981. if (isHours) {
  7982. if (value === 12) value = 0;
  7983. value = inner ? value === 0 ? 12 : value : value === 0 ? 0 : value + 12;
  7984. } else {
  7985. if (roundBy5) value *= 5;
  7986. if (value === 60) value = 0;
  7987. }
  7988. }
  7989. // Once hours or minutes changed, vibrate the device
  7990. if (this[this.currentView] !== value) {
  7991. if (vibrate && this.options.vibrate) {
  7992. // Do not vibrate too frequently
  7993. if (!this.vibrateTimer) {
  7994. navigator[vibrate](10);
  7995. this.vibrateTimer = setTimeout($.proxy(function () {
  7996. this.vibrateTimer = null;
  7997. }, this), 100);
  7998. }
  7999. }
  8000. }
  8001. this[this.currentView] = value;
  8002. if (isHours) {
  8003. this['spanHours'].html(value);
  8004. } else {
  8005. this['spanMinutes'].html(leadingZero(value));
  8006. }
  8007. // If svg is not supported, just add an active class to the tick
  8008. if (!svgSupported) {
  8009. this[isHours ? 'hoursView' : 'minutesView'].find('.clockpicker-tick').each(function () {
  8010. var tick = $(this);
  8011. tick.toggleClass('active', value === +tick.html());
  8012. });
  8013. return;
  8014. }
  8015. // Set clock hand and others' position
  8016. var cx1 = Math.sin(radian) * (radius - tickRadius),
  8017. cy1 = -Math.cos(radian) * (radius - tickRadius),
  8018. cx2 = Math.sin(radian) * radius,
  8019. cy2 = -Math.cos(radian) * radius;
  8020. this.hand.setAttribute('x2', cx1);
  8021. this.hand.setAttribute('y2', cy1);
  8022. this.bg.setAttribute('cx', cx2);
  8023. this.bg.setAttribute('cy', cy2);
  8024. };
  8025. // Hours and minutes are selected
  8026. ClockPicker.prototype.done = function () {
  8027. raiseCallback(this.options.beforeDone);
  8028. this.hide();
  8029. this.label.addClass('active');
  8030. var last = this.input.prop('value'),
  8031. value = leadingZero(this.hours) + ':' + leadingZero(this.minutes);
  8032. if (this.options.twelvehour) {
  8033. value = value + this.amOrPm;
  8034. }
  8035. this.input.prop('value', value);
  8036. if (value !== last) {
  8037. this.input.triggerHandler('change');
  8038. if (!this.isInput) {
  8039. this.element.trigger('change');
  8040. }
  8041. }
  8042. if (this.options.autoclose) this.input.trigger('blur');
  8043. raiseCallback(this.options.afterDone);
  8044. };
  8045. // Clear input field
  8046. ClockPicker.prototype.clear = function () {
  8047. this.hide();
  8048. this.label.removeClass('active');
  8049. var last = this.input.prop('value'),
  8050. value = '';
  8051. this.input.prop('value', value);
  8052. if (value !== last) {
  8053. this.input.triggerHandler('change');
  8054. if (!this.isInput) {
  8055. this.element.trigger('change');
  8056. }
  8057. }
  8058. if (this.options.autoclose) {
  8059. this.input.trigger('blur');
  8060. }
  8061. };
  8062. // Remove clockpicker from input
  8063. ClockPicker.prototype.remove = function () {
  8064. this.element.removeData('clockpicker');
  8065. this.input.off('focus.clockpicker click.clockpicker');
  8066. if (this.isShown) {
  8067. this.hide();
  8068. }
  8069. if (this.isAppended) {
  8070. $win.off('resize.clockpicker' + this.id);
  8071. this.popover.remove();
  8072. }
  8073. };
  8074. // Extends $.fn.clockpicker
  8075. $.fn.pickatime = function (option) {
  8076. var args = Array.prototype.slice.call(arguments, 1);
  8077. return this.each(function () {
  8078. var $this = $(this),
  8079. data = $this.data('clockpicker');
  8080. if (!data) {
  8081. var options = $.extend({}, ClockPicker.DEFAULTS, $this.data(), typeof option == 'object' && option);
  8082. $this.data('clockpicker', new ClockPicker($this, options));
  8083. } else {
  8084. // Manual operatsions. show, hide, remove, e.g.
  8085. if (typeof data[option] === 'function') {
  8086. data[option].apply(data, args);
  8087. }
  8088. }
  8089. });
  8090. };
  8091. })(jQuery);
  8092. ; (function ($) {
  8093. $.fn.characterCounter = function () {
  8094. return this.each(function () {
  8095. var $input = $(this);
  8096. var $counterElement = $input.parent().find('span[class="character-counter"]');
  8097. // character counter has already been added appended to the parent container
  8098. if ($counterElement.length) {
  8099. return;
  8100. }
  8101. var itHasLengthAttribute = $input.attr('data-length') !== undefined;
  8102. if (itHasLengthAttribute) {
  8103. $input.on('input', updateCounter);
  8104. $input.on('focus', updateCounter);
  8105. $input.on('blur', removeCounterElement);
  8106. addCounterElement($input);
  8107. }
  8108. });
  8109. };
  8110. function updateCounter() {
  8111. var maxLength = +$(this).attr('data-length'),
  8112. actualLength = +$(this).val().length,
  8113. isValidLength = actualLength <= maxLength;
  8114. $(this).parent().find('span[class="character-counter"]').html(actualLength + '/' + maxLength);
  8115. addInputStyle(isValidLength, $(this));
  8116. }
  8117. function addCounterElement($input) {
  8118. var $counterElement = $input.parent().find('span[class="character-counter"]');
  8119. if ($counterElement.length) {
  8120. return;
  8121. }
  8122. $counterElement = $('<span/>').addClass('character-counter').css('float', 'right').css('font-size', '12px').css('height', 1);
  8123. $input.parent().append($counterElement);
  8124. }
  8125. function removeCounterElement() {
  8126. $(this).parent().find('span[class="character-counter"]').html('');
  8127. }
  8128. function addInputStyle(isValidLength, $input) {
  8129. var inputHasInvalidClass = $input.hasClass('invalid');
  8130. if (isValidLength && inputHasInvalidClass) {
  8131. $input.removeClass('invalid');
  8132. } else if (!isValidLength && !inputHasInvalidClass) {
  8133. $input.removeClass('valid');
  8134. $input.addClass('invalid');
  8135. }
  8136. }
  8137. $(document).ready(function () {
  8138. $('input, textarea').characterCounter();
  8139. });
  8140. })(jQuery);
  8141. ; (function ($) {
  8142. var methods = {
  8143. init: function (options) {
  8144. var defaults = {
  8145. duration: 200, // ms
  8146. dist: -100, // zoom scale TODO: make this more intuitive as an option
  8147. shift: 0, // spacing for center image
  8148. padding: 0, // Padding between non center items
  8149. fullWidth: false, // Change to full width styles
  8150. indicators: false, // Toggle indicators
  8151. noWrap: false, // Don't wrap around and cycle through items.
  8152. onCycleTo: null // Callback for when a new slide is cycled to.
  8153. };
  8154. options = $.extend(defaults, options);
  8155. var namespace = Materialize.objectSelectorString($(this));
  8156. return this.each(function (i) {
  8157. var images, item_width, item_height, offset, center, pressed, dim, count, reference, referenceY, amplitude, target, velocity, scrolling, xform, frame, timestamp, ticker, dragged, vertical_dragged;
  8158. var $indicators = $('<ul class="indicators"></ul>');
  8159. var scrollingTimeout = null;
  8160. var oneTimeCallback = null;
  8161. // Initialize
  8162. var view = $(this);
  8163. var hasMultipleSlides = view.find('.carousel-item').length > 1;
  8164. var showIndicators = (view.attr('data-indicators') || options.indicators) && hasMultipleSlides;
  8165. var noWrap = view.attr('data-no-wrap') || options.noWrap || !hasMultipleSlides;
  8166. var uniqueNamespace = view.attr('data-namespace') || namespace + i;
  8167. view.attr('data-namespace', uniqueNamespace);
  8168. // Options
  8169. var setCarouselHeight = function (imageOnly) {
  8170. var firstSlide = view.find('.carousel-item.active').length ? view.find('.carousel-item.active').first() : view.find('.carousel-item').first();
  8171. var firstImage = firstSlide.find('img').first();
  8172. if (firstImage.length) {
  8173. if (firstImage[0].complete) {
  8174. // If image won't trigger the load event
  8175. var imageHeight = firstImage.height();
  8176. if (imageHeight > 0) {
  8177. view.css('height', firstImage.height());
  8178. } else {
  8179. // If image still has no height, use the natural dimensions to calculate
  8180. var naturalWidth = firstImage[0].naturalWidth;
  8181. var naturalHeight = firstImage[0].naturalHeight;
  8182. var adjustedHeight = view.width() / naturalWidth * naturalHeight;
  8183. view.css('height', adjustedHeight);
  8184. }
  8185. } else {
  8186. // Get height when image is loaded normally
  8187. firstImage.on('load', function () {
  8188. view.css('height', $(this).height());
  8189. });
  8190. }
  8191. } else if (!imageOnly) {
  8192. var slideHeight = firstSlide.height();
  8193. view.css('height', slideHeight);
  8194. }
  8195. };
  8196. if (options.fullWidth) {
  8197. options.dist = 0;
  8198. setCarouselHeight();
  8199. // Offset fixed items when indicators.
  8200. if (showIndicators) {
  8201. view.find('.carousel-fixed-item').addClass('with-indicators');
  8202. }
  8203. }
  8204. // Don't double initialize.
  8205. if (view.hasClass('initialized')) {
  8206. // Recalculate variables
  8207. $(window).trigger('resize');
  8208. // Redraw carousel.
  8209. view.trigger('carouselNext', [0.000001]);
  8210. return true;
  8211. }
  8212. view.addClass('initialized');
  8213. pressed = false;
  8214. offset = target = 0;
  8215. images = [];
  8216. item_width = view.find('.carousel-item').first().innerWidth();
  8217. item_height = view.find('.carousel-item').first().innerHeight();
  8218. dim = item_width * 2 + options.padding;
  8219. view.find('.carousel-item').each(function (i) {
  8220. images.push($(this)[0]);
  8221. if (showIndicators) {
  8222. var $indicator = $('<li class="indicator-item"></li>');
  8223. // Add active to first by default.
  8224. if (i === 0) {
  8225. $indicator.addClass('active');
  8226. }
  8227. // Handle clicks on indicators.
  8228. $indicator.click(function (e) {
  8229. e.stopPropagation();
  8230. var index = $(this).index();
  8231. cycleTo(index);
  8232. });
  8233. $indicators.append($indicator);
  8234. }
  8235. });
  8236. if (showIndicators) {
  8237. view.append($indicators);
  8238. }
  8239. count = images.length;
  8240. function setupEvents() {
  8241. if (typeof window.ontouchstart !== 'undefined') {
  8242. view.on('touchstart.carousel', tap);
  8243. view.on('touchmove.carousel', drag);
  8244. view.on('touchend.carousel', release);
  8245. }
  8246. view.on('mousedown.carousel', tap);
  8247. view.on('mousemove.carousel', drag);
  8248. view.on('mouseup.carousel', release);
  8249. view.on('mouseleave.carousel', release);
  8250. view.on('click.carousel', click);
  8251. }
  8252. function xpos(e) {
  8253. // touch event
  8254. if (e.targetTouches && e.targetTouches.length >= 1) {
  8255. return e.targetTouches[0].clientX;
  8256. }
  8257. // mouse event
  8258. return e.clientX;
  8259. }
  8260. function ypos(e) {
  8261. // touch event
  8262. if (e.targetTouches && e.targetTouches.length >= 1) {
  8263. return e.targetTouches[0].clientY;
  8264. }
  8265. // mouse event
  8266. return e.clientY;
  8267. }
  8268. function wrap(x) {
  8269. return x >= count ? x % count : x < 0 ? wrap(count + x % count) : x;
  8270. }
  8271. function scroll(x) {
  8272. // Track scrolling state
  8273. scrolling = true;
  8274. if (!view.hasClass('scrolling')) {
  8275. view.addClass('scrolling');
  8276. }
  8277. if (scrollingTimeout != null) {
  8278. window.clearTimeout(scrollingTimeout);
  8279. }
  8280. scrollingTimeout = window.setTimeout(function () {
  8281. scrolling = false;
  8282. view.removeClass('scrolling');
  8283. }, options.duration);
  8284. // Start actual scroll
  8285. var i, half, delta, dir, tween, el, alignment, xTranslation;
  8286. var lastCenter = center;
  8287. offset = typeof x === 'number' ? x : offset;
  8288. center = Math.floor((offset + dim / 2) / dim);
  8289. delta = offset - center * dim;
  8290. dir = delta < 0 ? 1 : -1;
  8291. tween = -dir * delta * 2 / dim;
  8292. half = count >> 1;
  8293. if (!options.fullWidth) {
  8294. alignment = 'translateX(' + (view[0].clientWidth - item_width) / 2 + 'px) ';
  8295. alignment += 'translateY(' + (view[0].clientHeight - item_height) / 2 + 'px)';
  8296. } else {
  8297. alignment = 'translateX(0)';
  8298. }
  8299. // Set indicator active
  8300. if (showIndicators) {
  8301. var diff = center % count;
  8302. var activeIndicator = $indicators.find('.indicator-item.active');
  8303. if (activeIndicator.index() !== diff) {
  8304. activeIndicator.removeClass('active');
  8305. $indicators.find('.indicator-item').eq(diff).addClass('active');
  8306. }
  8307. }
  8308. // center
  8309. // Don't show wrapped items.
  8310. if (!noWrap || center >= 0 && center < count) {
  8311. el = images[wrap(center)];
  8312. // Add active class to center item.
  8313. if (!$(el).hasClass('active')) {
  8314. view.find('.carousel-item').removeClass('active');
  8315. $(el).addClass('active');
  8316. }
  8317. el.style[xform] = alignment + ' translateX(' + -delta / 2 + 'px)' + ' translateX(' + dir * options.shift * tween * i + 'px)' + ' translateZ(' + options.dist * tween + 'px)';
  8318. el.style.zIndex = 0;
  8319. if (options.fullWidth) {
  8320. tweenedOpacity = 1;
  8321. } else {
  8322. tweenedOpacity = 1 - 0.2 * tween;
  8323. }
  8324. el.style.opacity = tweenedOpacity;
  8325. el.style.display = 'block';
  8326. }
  8327. for (i = 1; i <= half; ++i) {
  8328. // right side
  8329. if (options.fullWidth) {
  8330. zTranslation = options.dist;
  8331. tweenedOpacity = i === half && delta < 0 ? 1 - tween : 1;
  8332. } else {
  8333. zTranslation = options.dist * (i * 2 + tween * dir);
  8334. tweenedOpacity = 1 - 0.2 * (i * 2 + tween * dir);
  8335. }
  8336. // Don't show wrapped items.
  8337. if (!noWrap || center + i < count) {
  8338. el = images[wrap(center + i)];
  8339. el.style[xform] = alignment + ' translateX(' + (options.shift + (dim * i - delta) / 2) + 'px)' + ' translateZ(' + zTranslation + 'px)';
  8340. el.style.zIndex = -i;
  8341. el.style.opacity = tweenedOpacity;
  8342. el.style.display = 'block';
  8343. }
  8344. // left side
  8345. if (options.fullWidth) {
  8346. zTranslation = options.dist;
  8347. tweenedOpacity = i === half && delta > 0 ? 1 - tween : 1;
  8348. } else {
  8349. zTranslation = options.dist * (i * 2 - tween * dir);
  8350. tweenedOpacity = 1 - 0.2 * (i * 2 - tween * dir);
  8351. }
  8352. // Don't show wrapped items.
  8353. if (!noWrap || center - i >= 0) {
  8354. el = images[wrap(center - i)];
  8355. el.style[xform] = alignment + ' translateX(' + (-options.shift + (-dim * i - delta) / 2) + 'px)' + ' translateZ(' + zTranslation + 'px)';
  8356. el.style.zIndex = -i;
  8357. el.style.opacity = tweenedOpacity;
  8358. el.style.display = 'block';
  8359. }
  8360. }
  8361. // center
  8362. // Don't show wrapped items.
  8363. if (!noWrap || center >= 0 && center < count) {
  8364. el = images[wrap(center)];
  8365. el.style[xform] = alignment + ' translateX(' + -delta / 2 + 'px)' + ' translateX(' + dir * options.shift * tween + 'px)' + ' translateZ(' + options.dist * tween + 'px)';
  8366. el.style.zIndex = 0;
  8367. if (options.fullWidth) {
  8368. tweenedOpacity = 1;
  8369. } else {
  8370. tweenedOpacity = 1 - 0.2 * tween;
  8371. }
  8372. el.style.opacity = tweenedOpacity;
  8373. el.style.display = 'block';
  8374. }
  8375. // onCycleTo callback
  8376. if (lastCenter !== center && typeof options.onCycleTo === "function") {
  8377. var $curr_item = view.find('.carousel-item').eq(wrap(center));
  8378. options.onCycleTo.call(this, $curr_item, dragged);
  8379. }
  8380. // One time callback
  8381. if (typeof oneTimeCallback === "function") {
  8382. oneTimeCallback.call(this, $curr_item, dragged);
  8383. oneTimeCallback = null;
  8384. }
  8385. }
  8386. function track() {
  8387. var now, elapsed, delta, v;
  8388. now = Date.now();
  8389. elapsed = now - timestamp;
  8390. timestamp = now;
  8391. delta = offset - frame;
  8392. frame = offset;
  8393. v = 1000 * delta / (1 + elapsed);
  8394. velocity = 0.8 * v + 0.2 * velocity;
  8395. }
  8396. function autoScroll() {
  8397. var elapsed, delta;
  8398. if (amplitude) {
  8399. elapsed = Date.now() - timestamp;
  8400. delta = amplitude * Math.exp(-elapsed / options.duration);
  8401. if (delta > 2 || delta < -2) {
  8402. scroll(target - delta);
  8403. requestAnimationFrame(autoScroll);
  8404. } else {
  8405. scroll(target);
  8406. }
  8407. }
  8408. }
  8409. function click(e) {
  8410. // Disable clicks if carousel was dragged.
  8411. if (dragged) {
  8412. e.preventDefault();
  8413. e.stopPropagation();
  8414. return false;
  8415. } else if (!options.fullWidth) {
  8416. var clickedIndex = $(e.target).closest('.carousel-item').index();
  8417. var diff = wrap(center) - clickedIndex;
  8418. // Disable clicks if carousel was shifted by click
  8419. if (diff !== 0) {
  8420. e.preventDefault();
  8421. e.stopPropagation();
  8422. }
  8423. cycleTo(clickedIndex);
  8424. }
  8425. }
  8426. function cycleTo(n) {
  8427. var diff = center % count - n;
  8428. // Account for wraparound.
  8429. if (!noWrap) {
  8430. if (diff < 0) {
  8431. if (Math.abs(diff + count) < Math.abs(diff)) {
  8432. diff += count;
  8433. }
  8434. } else if (diff > 0) {
  8435. if (Math.abs(diff - count) < diff) {
  8436. diff -= count;
  8437. }
  8438. }
  8439. }
  8440. // Call prev or next accordingly.
  8441. if (diff < 0) {
  8442. view.trigger('carouselNext', [Math.abs(diff)]);
  8443. } else if (diff > 0) {
  8444. view.trigger('carouselPrev', [diff]);
  8445. }
  8446. }
  8447. function tap(e) {
  8448. // Fixes firefox draggable image bug
  8449. if (e.type === 'mousedown' && $(e.target).is('img')) {
  8450. e.preventDefault();
  8451. }
  8452. pressed = true;
  8453. dragged = false;
  8454. vertical_dragged = false;
  8455. reference = xpos(e);
  8456. referenceY = ypos(e);
  8457. velocity = amplitude = 0;
  8458. frame = offset;
  8459. timestamp = Date.now();
  8460. clearInterval(ticker);
  8461. ticker = setInterval(track, 100);
  8462. }
  8463. function drag(e) {
  8464. var x, delta, deltaY;
  8465. if (pressed) {
  8466. x = xpos(e);
  8467. y = ypos(e);
  8468. delta = reference - x;
  8469. deltaY = Math.abs(referenceY - y);
  8470. if (deltaY < 30 && !vertical_dragged) {
  8471. // If vertical scrolling don't allow dragging.
  8472. if (delta > 2 || delta < -2) {
  8473. dragged = true;
  8474. reference = x;
  8475. scroll(offset + delta);
  8476. }
  8477. } else if (dragged) {
  8478. // If dragging don't allow vertical scroll.
  8479. e.preventDefault();
  8480. e.stopPropagation();
  8481. return false;
  8482. } else {
  8483. // Vertical scrolling.
  8484. vertical_dragged = true;
  8485. }
  8486. }
  8487. if (dragged) {
  8488. // If dragging don't allow vertical scroll.
  8489. e.preventDefault();
  8490. e.stopPropagation();
  8491. return false;
  8492. }
  8493. }
  8494. function release(e) {
  8495. if (pressed) {
  8496. pressed = false;
  8497. } else {
  8498. return;
  8499. }
  8500. clearInterval(ticker);
  8501. target = offset;
  8502. if (velocity > 10 || velocity < -10) {
  8503. amplitude = 0.9 * velocity;
  8504. target = offset + amplitude;
  8505. }
  8506. target = Math.round(target / dim) * dim;
  8507. // No wrap of items.
  8508. if (noWrap) {
  8509. if (target >= dim * (count - 1)) {
  8510. target = dim * (count - 1);
  8511. } else if (target < 0) {
  8512. target = 0;
  8513. }
  8514. }
  8515. amplitude = target - offset;
  8516. timestamp = Date.now();
  8517. requestAnimationFrame(autoScroll);
  8518. if (dragged) {
  8519. e.preventDefault();
  8520. e.stopPropagation();
  8521. }
  8522. return false;
  8523. }
  8524. xform = 'transform';
  8525. ['webkit', 'Moz', 'O', 'ms'].every(function (prefix) {
  8526. var e = prefix + 'Transform';
  8527. if (typeof document.body.style[e] !== 'undefined') {
  8528. xform = e;
  8529. return false;
  8530. }
  8531. return true;
  8532. });
  8533. var throttledResize = Materialize.throttle(function () {
  8534. if (options.fullWidth) {
  8535. item_width = view.find('.carousel-item').first().innerWidth();
  8536. var imageHeight = view.find('.carousel-item.active').height();
  8537. dim = item_width * 2 + options.padding;
  8538. offset = center * 2 * item_width;
  8539. target = offset;
  8540. setCarouselHeight(true);
  8541. } else {
  8542. scroll();
  8543. }
  8544. }, 200);
  8545. $(window).off('resize.carousel-' + uniqueNamespace).on('resize.carousel-' + uniqueNamespace, throttledResize);
  8546. setupEvents();
  8547. scroll(offset);
  8548. $(this).on('carouselNext', function (e, n, callback) {
  8549. if (n === undefined) {
  8550. n = 1;
  8551. }
  8552. if (typeof callback === "function") {
  8553. oneTimeCallback = callback;
  8554. }
  8555. target = dim * Math.round(offset / dim) + dim * n;
  8556. if (offset !== target) {
  8557. amplitude = target - offset;
  8558. timestamp = Date.now();
  8559. requestAnimationFrame(autoScroll);
  8560. }
  8561. });
  8562. $(this).on('carouselPrev', function (e, n, callback) {
  8563. if (n === undefined) {
  8564. n = 1;
  8565. }
  8566. if (typeof callback === "function") {
  8567. oneTimeCallback = callback;
  8568. }
  8569. target = dim * Math.round(offset / dim) - dim * n;
  8570. if (offset !== target) {
  8571. amplitude = target - offset;
  8572. timestamp = Date.now();
  8573. requestAnimationFrame(autoScroll);
  8574. }
  8575. });
  8576. $(this).on('carouselSet', function (e, n, callback) {
  8577. if (n === undefined) {
  8578. n = 0;
  8579. }
  8580. if (typeof callback === "function") {
  8581. oneTimeCallback = callback;
  8582. }
  8583. cycleTo(n);
  8584. });
  8585. });
  8586. },
  8587. next: function (n, callback) {
  8588. $(this).trigger('carouselNext', [n, callback]);
  8589. },
  8590. prev: function (n, callback) {
  8591. $(this).trigger('carouselPrev', [n, callback]);
  8592. },
  8593. set: function (n, callback) {
  8594. $(this).trigger('carouselSet', [n, callback]);
  8595. },
  8596. destroy: function () {
  8597. var uniqueNamespace = $(this).attr('data-namespace');
  8598. $(this).removeAttr('data-namespace');
  8599. $(this).removeClass('initialized');
  8600. $(this).find('.indicators').remove();
  8601. // Remove event handlers
  8602. $(this).off('carouselNext carouselPrev carouselSet');
  8603. $(window).off('resize.carousel-' + uniqueNamespace);
  8604. if (typeof window.ontouchstart !== 'undefined') {
  8605. $(this).off('touchstart.carousel touchmove.carousel touchend.carousel');
  8606. }
  8607. $(this).off('mousedown.carousel mousemove.carousel mouseup.carousel mouseleave.carousel click.carousel');
  8608. }
  8609. };
  8610. $.fn.carousel = function (methodOrOptions) {
  8611. if (methods[methodOrOptions]) {
  8612. return methods[methodOrOptions].apply(this, Array.prototype.slice.call(arguments, 1));
  8613. } else if (typeof methodOrOptions === 'object' || !methodOrOptions) {
  8614. // Default to "init"
  8615. return methods.init.apply(this, arguments);
  8616. } else {
  8617. $.error('Method ' + methodOrOptions + ' does not exist on jQuery.carousel');
  8618. }
  8619. }; // Plugin end
  8620. })(jQuery);
  8621. ; (function ($) {
  8622. var methods = {
  8623. init: function (options) {
  8624. return this.each(function () {
  8625. var origin = $('#' + $(this).attr('data-activates'));
  8626. var screen = $('body');
  8627. // Creating tap target
  8628. var tapTargetEl = $(this);
  8629. var tapTargetWrapper = tapTargetEl.parent('.tap-target-wrapper');
  8630. var tapTargetWave = tapTargetWrapper.find('.tap-target-wave');
  8631. var tapTargetOriginEl = tapTargetWrapper.find('.tap-target-origin');
  8632. var tapTargetContentEl = tapTargetEl.find('.tap-target-content');
  8633. // Creating wrapper
  8634. if (!tapTargetWrapper.length) {
  8635. tapTargetWrapper = tapTargetEl.wrap($('<div class="tap-target-wrapper"></div>')).parent();
  8636. }
  8637. // Creating content
  8638. if (!tapTargetContentEl.length) {
  8639. tapTargetContentEl = $('<div class="tap-target-content"></div>');
  8640. tapTargetEl.append(tapTargetContentEl);
  8641. }
  8642. // Creating foreground wave
  8643. if (!tapTargetWave.length) {
  8644. tapTargetWave = $('<div class="tap-target-wave"></div>');
  8645. // Creating origin
  8646. if (!tapTargetOriginEl.length) {
  8647. tapTargetOriginEl = origin.clone(true, true);
  8648. tapTargetOriginEl.addClass('tap-target-origin');
  8649. tapTargetOriginEl.removeAttr('id');
  8650. tapTargetOriginEl.removeAttr('style');
  8651. tapTargetWave.append(tapTargetOriginEl);
  8652. }
  8653. tapTargetWrapper.append(tapTargetWave);
  8654. }
  8655. // Open
  8656. var openTapTarget = function () {
  8657. if (tapTargetWrapper.is('.open')) {
  8658. return;
  8659. }
  8660. // Adding open class
  8661. tapTargetWrapper.addClass('open');
  8662. setTimeout(function () {
  8663. tapTargetOriginEl.off('click.tapTarget').on('click.tapTarget', function (e) {
  8664. closeTapTarget();
  8665. tapTargetOriginEl.off('click.tapTarget');
  8666. });
  8667. $(document).off('click.tapTarget').on('click.tapTarget', function (e) {
  8668. closeTapTarget();
  8669. $(document).off('click.tapTarget');
  8670. });
  8671. var throttledCalc = Materialize.throttle(function () {
  8672. calculateTapTarget();
  8673. }, 200);
  8674. $(window).off('resize.tapTarget').on('resize.tapTarget', throttledCalc);
  8675. }, 0);
  8676. };
  8677. // Close
  8678. var closeTapTarget = function () {
  8679. if (!tapTargetWrapper.is('.open')) {
  8680. return;
  8681. }
  8682. tapTargetWrapper.removeClass('open');
  8683. tapTargetOriginEl.off('click.tapTarget');
  8684. $(document).off('click.tapTarget');
  8685. $(window).off('resize.tapTarget');
  8686. };
  8687. // Pre calculate
  8688. var calculateTapTarget = function () {
  8689. // Element or parent is fixed position?
  8690. var isFixed = origin.css('position') === 'fixed';
  8691. if (!isFixed) {
  8692. var parents = origin.parents();
  8693. for (var i = 0; i < parents.length; i++) {
  8694. isFixed = $(parents[i]).css('position') == 'fixed';
  8695. if (isFixed) {
  8696. break;
  8697. }
  8698. }
  8699. }
  8700. // Calculating origin
  8701. var originWidth = origin.outerWidth();
  8702. var originHeight = origin.outerHeight();
  8703. var originTop = isFixed ? origin.offset().top - $(document).scrollTop() : origin.offset().top;
  8704. var originLeft = isFixed ? origin.offset().left - $(document).scrollLeft() : origin.offset().left;
  8705. // Calculating screen
  8706. var windowWidth = $(window).width();
  8707. var windowHeight = $(window).height();
  8708. var centerX = windowWidth / 2;
  8709. var centerY = windowHeight / 2;
  8710. var isLeft = originLeft <= centerX;
  8711. var isRight = originLeft > centerX;
  8712. var isTop = originTop <= centerY;
  8713. var isBottom = originTop > centerY;
  8714. var isCenterX = originLeft >= windowWidth * 0.25 && originLeft <= windowWidth * 0.75;
  8715. var isCenterY = originTop >= windowHeight * 0.25 && originTop <= windowHeight * 0.75;
  8716. // Calculating tap target
  8717. var tapTargetWidth = tapTargetEl.outerWidth();
  8718. var tapTargetHeight = tapTargetEl.outerHeight();
  8719. var tapTargetTop = originTop + originHeight / 2 - tapTargetHeight / 2;
  8720. var tapTargetLeft = originLeft + originWidth / 2 - tapTargetWidth / 2;
  8721. var tapTargetPosition = isFixed ? 'fixed' : 'absolute';
  8722. // Calculating content
  8723. var tapTargetTextWidth = isCenterX ? tapTargetWidth : tapTargetWidth / 2 + originWidth;
  8724. var tapTargetTextHeight = tapTargetHeight / 2;
  8725. var tapTargetTextTop = isTop ? tapTargetHeight / 2 : 0;
  8726. var tapTargetTextBottom = 0;
  8727. var tapTargetTextLeft = isLeft && !isCenterX ? tapTargetWidth / 2 - originWidth : 0;
  8728. var tapTargetTextRight = 0;
  8729. var tapTargetTextPadding = originWidth;
  8730. var tapTargetTextAlign = isBottom ? 'bottom' : 'top';
  8731. // Calculating wave
  8732. var tapTargetWaveWidth = originWidth > originHeight ? originWidth * 2 : originWidth * 2;
  8733. var tapTargetWaveHeight = tapTargetWaveWidth;
  8734. var tapTargetWaveTop = tapTargetHeight / 2 - tapTargetWaveHeight / 2;
  8735. var tapTargetWaveLeft = tapTargetWidth / 2 - tapTargetWaveWidth / 2;
  8736. // Setting tap target
  8737. var tapTargetWrapperCssObj = {};
  8738. tapTargetWrapperCssObj.top = isTop ? tapTargetTop : '';
  8739. tapTargetWrapperCssObj.right = isRight ? windowWidth - tapTargetLeft - tapTargetWidth : '';
  8740. tapTargetWrapperCssObj.bottom = isBottom ? windowHeight - tapTargetTop - tapTargetHeight : '';
  8741. tapTargetWrapperCssObj.left = isLeft ? tapTargetLeft : '';
  8742. tapTargetWrapperCssObj.position = tapTargetPosition;
  8743. tapTargetWrapper.css(tapTargetWrapperCssObj);
  8744. // Setting content
  8745. tapTargetContentEl.css({
  8746. width: tapTargetTextWidth,
  8747. height: tapTargetTextHeight,
  8748. top: tapTargetTextTop,
  8749. right: tapTargetTextRight,
  8750. bottom: tapTargetTextBottom,
  8751. left: tapTargetTextLeft,
  8752. padding: tapTargetTextPadding,
  8753. verticalAlign: tapTargetTextAlign
  8754. });
  8755. // Setting wave
  8756. tapTargetWave.css({
  8757. top: tapTargetWaveTop,
  8758. left: tapTargetWaveLeft,
  8759. width: tapTargetWaveWidth,
  8760. height: tapTargetWaveHeight
  8761. });
  8762. };
  8763. if (options == 'open') {
  8764. calculateTapTarget();
  8765. openTapTarget();
  8766. }
  8767. if (options == 'close') closeTapTarget();
  8768. });
  8769. },
  8770. open: function () { },
  8771. close: function () { }
  8772. };
  8773. $.fn.tapTarget = function (methodOrOptions) {
  8774. if (methods[methodOrOptions] || typeof methodOrOptions === 'object') return methods.init.apply(this, arguments);
  8775. $.error('Method ' + methodOrOptions + ' does not exist on jQuery.tap-target');
  8776. };
  8777. })(jQuery);