From f23e30eee0f712f7bcc433c680ea5379a1019c7e Mon Sep 17 00:00:00 2001 From: Michael Curtis <59065704+Michael-Curtis0@users.noreply.github.com> Date: Tue, 23 Nov 2021 10:40:51 +0000 Subject: [PATCH 1/3] Add more logos GoDaddy data.world Glassdoor Shopify FirstBus --- static/logos/FirstBus.svg | Bin 0 -> 18530 bytes static/logos/Glassdoor.svg | 27 +++++++++++++++++++++++++++ static/logos/GoDaddy.svg | 3 +++ static/logos/Shopify.svg | 13 +++++++++++++ static/logos/data.world.png | Bin 0 -> 5902 bytes 5 files changed, 43 insertions(+) create mode 100644 static/logos/FirstBus.svg create mode 100644 static/logos/Glassdoor.svg create mode 100644 static/logos/GoDaddy.svg create mode 100644 static/logos/Shopify.svg create mode 100644 static/logos/data.world.png diff --git a/static/logos/FirstBus.svg b/static/logos/FirstBus.svg new file mode 100644 index 0000000000000000000000000000000000000000..e68c944b36152d2b2ef119f006396a6a83972a02 GIT binary patch literal 18530 zcmYIw1yq#V7w-oMsFWa$fFMXqN|#cD2q+Q)Qi60dbc;&I&!q9hNYF@I+_7sNr(T}WB}k)}ub=B#@G$a zCpzF3Y;rc;MY^CVD>|5jwWq(SEhb|iWyh!MmKBrlFZ!%O;r33J+r7BAe}&(`yX}}} zeDZ_&>y6NJHz>*uU)cOo=j?|P2@=n?HS~KKZm;^u#=|!8UDxE2d}E4o;saN_jhmH$ zLL6rYkMP7%J0g@MS}P8E^78V_H@L-R^T@Pa{``3Tv_fA@{fKXZ$W+8-o_>O;w!mbQ z@F_I3Fw&#oP83PLd>}=VWGPj#R-35Q>nlFeuTS z3;%ZX&4+ilnQt1$!rgcp)k1ql=rvUi(sGW=eR(Z6nHzD|ZP{kk?`b#Wegj z>w%&rgN1w_^k-6g<9K6vV@q6HefTz^tt1NFk-j0NT*ml9?W(w47JR~xizWM*hwVIC zLtKbnylq=?=j=q|-Xh)>mWt`eNw--cYh_y*R%c5oOmis;W_GTAJ;`o)9JEatP1`A-|J#Z;Svz6q^ zETi}>V-bmoh5V7@mNN|l60r+TC%;$ZrwJM9?k@0{kdP4D6g+6M7^{LF7HqgWkrptH zlYvy#sNEL0=)%3ozPEG!bVw^oAJvU5T~?>U{Is2zpjkJUq3Nbi~dbdzsM`LSpd zPIHLLThST&&ZKYwv`9*(evUUdR_{Gt0Oi;8O7|ym%d;$Zf)6%P3{G;%y{-4C z#w9jB8d-2TG??Bh?!(N>(Bfl3DSa#B9y9Y0w-6+RNXS1ur`oo_cDNP`PP^$zUB|2( z{yq+m>Voy(X-IIIBk@>P=B47j6x=4x2Bo~Po55M4uZB{R{A|q>{;}cS5Hy&rjZp25 z+drT2$ZC%VTTSgt{MyPTp(Np+%TORu7zct9A|rx`{zzB!SaHZq&Zu7#&-IpnI~(eP zG=6?|QEEn_*o9ey4Ho4@SGs?U?|*oF{E^BnR8p6*zw3#@>5JQ<{#x(|z;~%(=-F!G z@Zm3^l{*WL**t)%eyM=T)o^F8IkSrM98-)G5qJUO)o(X-mG!P}HSAK+5D{Sm#-wFq zW%r}L8Rg|Lv~3=EiW!yPCP-AmoIHX<1i8L`XrcB?CEs&9oiHMDo775xYxc6qRbiU# zQ;gIddcZa^WgOY^>7Gt|BhDRr+^hyo+N3g>_HT_b`X-Lbu!;ZN>C zQtl0phNy0J@xry<~6zJ>)VQqn>JB8Xx{eS9v@=cb1OJRF9jYq~49 z>#z!}BCcml0UtORp-K(7te~TL9!`&oboW`XPZ#Ez0V{a(f?*CM%QpUdwhug6#9=_| zwNS)u+Ini^f^qR^!3h~ab^q*|`TSFk7OAf@M-unAa)K}>1Z4i)xx(x&hkwkW&1IM3 zamYv^)~}Z3&Nmryvp@gog*;B%XF@&)clCNrhkc64&v)vEc7Kj7+s$V^K63o$P$boG z+O8kwAE@(P+-oBSH+TIboIarY{7ge)QVPirlnBGb4_3I7M?km89W}x2r1(!Fzjth% zs?Lj)b_2bZmp3~Qf(XCMPB$fanHb?5h1io8-X<|Q65~yhne6ct`KNN-yH?P|+rYdH zA(01AO{hI-=%2ypy`H95XCwV)T>rd+*|HF1`;D{WhNoT&xrYrnN_1(bE~Ayx=6*-3@fi1R%MgyYacner-r@=#@3UwEmq=d{S- zjiV31zS#>->4^O49dDISo42;rb&z@MpBo<&J-k6qN;(PbHrlyjNLKGk)bTYSGuzuq zf6y=wZE6;TgF9b;VzQj#KIJTlN< zWOYHprgxnT8~C&h+NMejSCXz5Bw!4Q3jJfIY^3Msi`|8VR;5V9UayBpNkhkmaAf_( zcX*7GaHf@NLq;a_(&yT9;64AGkUZU8Z`z(g@0m?e>%A5dDXP27%z=7t5Q@w7%^#l- z$}5YzJRBky2bnJR_|3_^-Rak zmYJzL?5B~VC^JypPQMjp{vsF4cE(&eW-;9g0eY`A)5^fhw=N&rqIbHz(Y$qXK$T%C zM9?w6MWYb?IZ@C!hRVT=sH{=MvEOK0u4#^_;LsJkY^iNPD4A@w600)0HfcCz%2^9U z_>XV!0+ed^&iOkDa`fe`^9H__M){oPm$YpBk}cdg+=k-}=jaP}?4j4Xr`1LX#({ZF z>Ai-ijpw!vD~cSCqJXMm;kOD6TyAE(ESD6&KNL1}k;Jymh;=2{@Fv+0u`Cz-^!MBI zTtH@?=fg{=JZEc@icP_pwcG^=p6H?!78b`w!gKNh4$H%;DDc#iCh=ecE-YejNRpS> z{%}!MUj9o#A$|Zwz9&A5{XFh{`PvXoUB-#@qo(ullIDK&yP7Mr{X%myq1~ev;@Y^? zvYq9ov|N2~-l@?z4e8@yO z8}e_S#f}iC3QhR>!Z8sk`V$?*(0qa>tM)I9hLse%ux+qw`!tQZAFuKHqV6`GNbdec zC2|hk0*XR0s)Q@y2mcOHB)Qbd?l zDwZr2dT1GsQ0A-DPBXJOiyoteR9Ea@F6wjn+L7e#Yk+VCp$=#;t6$>grUrbESGA`l zWA!w2ijwSXxKu8H7m`q{y>^ zDvJlIyQ^c`|LD}u|JaIwF_Nx?yjQ}#hq(c zT3Y@5LqfVOg*G9+XJ>;pGvSPoDbOoU6q9?}=ySM#O@a~XFxju+=>8#NpwvCle1_S? z)s8DYS`bCXQdE##NYQ)lxaZ2PD*$=SE}(-LHW`J3%G7#Qb_6Pb zA%Yaa==%&-U6!rJ^WHLfAO;pfKhyfwmsIHJ4fR#}+;B9)Mbsxd{#el+NWs)H#g7WbysFr%2Pw`Ty z7U?Xr23B-H#vsDoh>~7I{cQMD=`EVK;bdM9_e4T`f6hS(qokK#&Ltq6{C#YL3zfJ! zF7-_r*S*${fmIvy4JT#E*EZ2-Yf}>9nDj=+U>*ylvPy3@vGKq3_bsfVF!DHJq(zS%V7) zONHr+q`Ctl_?{8&QAB&y1%<_j?Jt0}FGg18kjDtsnw$&Os_|B#ns4d4TM7eRIdbcL zt)fMO92e7VC#b~xN9$KZnFkzk3Ycs77B)&i{Sj61#0JEh;OZ3=c=QrasL<-J1O>Lk ziJ#_iGZ|)wHh-NC%8H{0QN(~UURM!_FwfhMaPuLOo>|`{GOf8raOcVy4wFhv-agSa zZbd~=nnd~gVX6W~jGi3kmX3|fG*B#1YrYMT{tMr1HEn0y3y;(HQ5tgMJEEQgJ@2f&W4) zT3~MRIUFlHx_;^QaT%5=@IHzibsRk^ygLg`bh$4;7`51W-JdiVC4(Sd1A-u>2QuGV ze+|Kg_`{tt>1UY)p7>jGC0*H&O&TDX4pH{zQI#yGOyxFkl_J4S7cSILRy8v-&jTL_ zBgaKY4|s4lyMcc1PlpMF?Hf3(nKsG(ST`a`-u*f>&B|fqtTvcIO^TqT6o&{M$6Sbp z8~m*_$Mp=o`mXgGQP69YoyC>L1?J{RnBfectHiA;D1keqmm36JDc5Wz=lSq-9^}x< zEB2k5>ctadqP=*&;bFobM$2s(g^jC?=aaukMsPNmnM*h}iQ9zN2AP2l$_boLKSQ({ zQlZm?WsijP(Z;P0t~Op2IyU+Q*ao9+0l_uLU>U#hI-@D0m%tJOP#UX ztw0e^3Is3VKVkGTfCGIR(eA?!a87-2&8_gzQ=w+4H7tGHvS^?Wc!RkJL6HWz4+G6F zo8H=<|I?(5RAT57IF~?r{huyjnr-6h7kzPS^{nD~nTLq2n?9LseYj?tN97tT}1 z0vV}95I_~8T{s#$&;ooV91UP+3jwTquGq$zoLWp+~s>zgqH~5sNjQ$?U)i_*Ejp=FLLey?|t?~8k$iPraZZ(cXlswg>GwQ zC^+XH?c-E`yg|Qx)wVt_o#BV97&5*Tt>d&E`X39|Aw>S)kRU&qpO71wF$6;4+*D$#H{$|Mlo(ldFX9&8L%X zF4a2r3jY%k2vk)U_n(HUbVg_(q@n>IXHGuRZ(&oQ}o`M=dP z5YUi2`kIlZ;hOJVyu9nrkC8Ny%&I?WvTM79`9=D5zw2)OTkEMs1L4K?-*)o1e;CE1 zVTG5q!R{qZKZ|4sb>P$BV|jPjsOlZ=e8z~VTL6zJI)Qe1``3SP7yWfo_|m>061Pvm zrsOUZtI zkw|(CLDN_vqgxmQPtZbQ8H*VVT>HC_Ec90C*JjB-5X6c_`-u!>>7JbUTTnakPcwJJ zV|jVbf*c&#RA*v6+Pg$;Utb&!?sWgk0IJi)eTG8e|p|=dE%-q=R ze?qUGr$=ZsgE;1n+O`zhm~gY4PPanRlf6;I)>%eUfXd^LQy41u+w#}@y3}J%<1-p5 zkt;zP`F&x^Ic-cR`WtygaG<|Dh*u%qV};#3vsX2z!yFeR3F4WyfsPg998-{*H(V>@`AVtG` zXF9bm0foA_u|76CAVe!6s2t`o_5FW8E=_%TBjIajv16)GQLMpVp?sX+d}V_zRf~yj zn2)EwNI=>wm0T3eX;uBVB|xYJewCI&C-$tI>e_1TbCMiJj&Cpt z7@#Wn`8*bTQtS(4hrbq0lhOY^Q_gJwpV>anOx(fl)TvWqSTSF9OKcnn-3ERMAWj0{ zG*1CIHVB=cRKVSJ|98hMQW8i_7_ah05$Qe1Ps_XIw=W)p0frLhK8qii{OzxsaV=+6 z$iX-ZFQYlo1vRiA*ia}e*kfzC*W&sKz2S)sn^XHGk`?pSP?O@{TaGdY-f{c2)*V&l z3Cm5zL7A=pyR{1)lI$**lWp~5y@?=}BSnLYa11ke2)!XkHA|OOlyzrS_RL~P)W>ZZ z`TrPYLwzI&;jAsA@!Y<=R@rb;TjTa>p~55;z&)F?s02h6=_wF6SB6W3WvVM-#2o^& zp&65F!}&Em`=XH^Rx~rr`M_boJ8I1EKNj13Z@^i&q4Y5veRD6Xb~S$qq>`B3NI%qH z>yG+tuNcnP==pTctqwt?Sn%I|Q@_D}>4&dGGL6EM@4Jhv{MM2foc$Mi0Tnhs-J#fJ z`iCe>x1zWz4^vDn^grUKe?!lV9m*77x4nPxh?xy7ylwsOrx07W8_#4cw%+f3)9Vmo za=)19->+|t0O23}704rn6T=cb@;O&b>_8%Xu1wwnLq~|DIROcl&FKK@lubNrZVq)5 zvlziPwJZqzT=Tl$DP0|5#c;HBbn$06mkVS@^75IsaX7LZi+$CERW-f@pPdCj)qB)+FZ7qMRMsoc7k)JH&v)^ffwV?_Ulx+u_}VB)0nV{$E#L-D|00D9;L=d z%Tb{oI}HcK3G9gzrk$gFLi22m$Q8&TI6WgjzUYJRRHf;mu_8ahjsn2T6d z>VTE!P_(7h;q|l?CXFD%gLtc(mwROHYf#u%ihpQGlDDWL zQxPLFc&7{nMfo*k-p0hD4LirLS(H3V z4Fse)iwJh5xM+Z7O};re01avOCxME(?=MJl2`HwfnRKatT1`YnX$uNZUQuTYHpuDC z5o8pTV?u*EHMFn6Pa$=eUF)|wquoGbE5j_(I-UFL4-3G5Xh}P==Qs)zo!A~=ao&`I zxV21n)1sWu+QD{0F^TgL0P!Uz4PaIpNCBb^1m~JJu?xtjj>*QJKgS@+R?iC*@Ixd! zBdO#u?7fW#xgSLkB0j}8vI^cG^0okirv+Gq#sURUv1oqYOsZK>l139l#2>6u0yL9d z)GSVCj1(=ZIC;rRE|bJfz3^n^^N6Y2ZdPQ(Rb7;!sI55Xtp>b_`F8;)s?tj>K5>X( zfikxHcHL@_gq!o?6v+4x+BJSRo^gy9pf&hEpmXDs=0T+-YSn9n`faoxt*f85jU5tl zO$E|8UX>4q4SRe}X9<3~aG`}{DzT=RytXh4h@;bD@m63938`v09Dpn@TQx&W3wDG? zE>{6764~U~u$DkdFWebvp$IMt7O4bOsn=ZZQ?RINpdZ>NZBqjWrTqqN2YHr>GpsfbMcWTTb*|)1Ha91~17d!) z&mhOLG{&Fe1cboqmZksL29FW^MAd(96i1zU!(m1G37MB(KzH3kY}+6FOL2gClyKAh zoajN44%PkI%;|4h^+wWT>mWj3b|ZNFDw3s_x!%MOsylV3>29|Esx^F7x@aiWP4huj>k zB*`G-6CnGrc3g}haxV&X-RgRD%mnG}9&M%IZm<3ucIN2}V98AhMSLKeiXUH{05`60 zHq*<^s^oAjJ6*1+2?i7ZjgQd8lE5e`SYvDpe>Wl$Jm9`Oo22C4y>y50xE@F+*Q8Ve zVrE8=-D!?B5Vn|XX!;w7x;{AwV5$V5`wentn*XGe_wEO{>LZDQP{v@ z5}>m@9fGg75Sh8PvGeX9@(?pOh32xd(Xl2n7Lg})GG0Q?Ev>Mz)= z4^ST1dqNOp-i5%5K$Fe*qPbh8Yn{&dQZGe%wFK`4kT<9N4kan+4b8_mvPIr}%3*R6 z-D3*D-JitV6yZTITq!boU?9D4{Ok@fw~M@XT>r@J7*&1U)K(cjsRp^cw{U!5A3x){lyyOgv%Vwfe+VA+>{dT?!+K7g_s{>Be&g(R);__=uH#N)$UG;kMY+g1R*+z^3x6>aakFm-ptSE(F0A2 zB#nUNrPXPqs5gLsG{bcPZ1hi)-e+Q2x+S@jH#0^@#ViW`U27E*878|+ig>0BQcl%h z4yyYfNdS$zhqZlZ^?&YoG(K&E_@CYX>@Wawrm&H$4f>ZsG70!-*STFGJ|z)S(Eej) zT-|9_b}g0&-FJ0V-s&e5F-^;g8G4cL9*|aVQ-(AVu$e%zrLdV@?;N?j9O=o-V?Q48 z$BLgcd)2QE0hV%ZfTlL4{I9CG*7jB6twi4AJEc|wI=?`ziO^LLZl9f}nq|_kBNoBL z>8b{^OaD{)j}#glm_!3LT-_PRwsQQ>2Y>0?)z6^=aI^uoaeoGqsbbWbTPz2I6v~;I zrP~sA7E0^>i21*>0D#dC7cHS%q&Kv&9YJpt^=r+3VBpdd9vm?vo61PMNefOTF#p6V z%go$P7Vxc3N?g9Cm-jw}$f3MacefbzwhK@y>-_ZOZRlSN>5MR5I2Yy?z|TtDd*9tz^l595IkpafFK+KPbscE)8$msM+d7I$-Oq zdIpG+w2+F95CSHRn}}cC-6^^XPaL>>1OH&#+%j~569^7x#u}@7(ZC@N>fte!%rm(o zv~?C!+HS^Cj>RMRJIxPbULWN2Mm0bO4+zMtxqukj_9D(EroM{SF!YNKRI2SB+bFPc z*sTR7_|6e+g`rDwn*&D{VF`W431Vro!Coy3BS!R=kEr8wH^{NPEx6$RzbR^VC1?&V zTm?{i#+w#YksMlcXve*LR8wi%1-!GoBWj1*`rH(QFkyBKKqR!65?hi&7yc3l+Z{*> z4KZzCP&J^O3^kr8tGY4*^BK0wOvY`e%8?S++Uo7?=GK&;alGb+b`RY_qD~`|(#5t*F^wH?{Y> z-us94-$HnRf=H6_?0vo|177D?dBNyk#5rQa-7wZ%;8|*GR%0uMr-M_~o@-sBVsL3H z4|Uh5*&k%+8@mlCLekLM9#&a^u2OFH>UCBnSETh>794M*ZWT(pXHm@FCF@yKni>H~ zrnH^;ja#A}B1GQ$C9n0uhDTG}(VXIPoDTn>l%2?`s%vO-Oeojdl5nBT>?g8wWO%*y zjkMJkUWo&p4jvB*WLuwTdm~*;fYKKl4zT4Xu4YiLi zw&(!=Q0`x2bIeGJXb|}&0ZnG7_|{MHt9H}RNg?JWa^>b zASi|fRkIDFp>q2#30hybk?>|L4+38IZGDo9)G7<}5cEL`dP=+5!m!$4-6=$cw(>sx z1acw`UjW>IP>@4&@hR@W9%vmYf`{%1+Wo9jq=EF==2^8f2aok)qek`Q9V`hkYu&1YdieQVA>`pi;b#3&#M)`HM1 z9sIM1VwiA7EH`)NARI+p*g|18-FWT|q>>|c6*;T>_Zh})2?t=(h zT#8Cb31;_F;IE(YV+@DB?f=fffV?y<0Q1=jniYX$${wqj3SJp5=bNg2f35-$7{N-6 z&&v_>)52e!{fBpc7x|3^wQ)%6t;OIS8^@9d|JRzTMrOG&+}xxDI@HHKS^$6*B6HC0 zQ)*dIN?yC2rS$*Pt0_mmnLikZ<#ILgTw2Hdoq{~=ug`c8PQk9aruZj7PMzS+n0~B& z_kXD_fR$NN(>7ArND+8KU%=Vn?LPxXDQvAow=YiHFCLZPIPm}Z6$N4tj=Sr!ol!WZ zj6~2KLW4c;ZTftlvzpR|%K7WX&lQ*K=>2RAY3;9T++UTF3G0uU zYKXQKm;hj-{I?X}nmB@SOoyZ!WjhK%gW76TSUi6t+dyiTBu#F>RIS6AppM&#F%A8c zczh~(jA@|k4x#dUlTUt08-ym~{r@CwWDI~LPHGr6SbZfKO0XT>5AKHK()xYZw0BJj zZ+Kt1?I=OiFoTxmtNUhb7U(N5S0}NomOP?#j14BlF z!w4aXn8V}g3*H4kYt|^8=$Wrc(#|#NXHkgyqvT1ZU!xW~R`gJt5`;s*#~)pp6qsD$0I z?K^8NA0<~{^pH`QhJvP#T;znQpUuYta2Hc5`_8$x&`@cwC%d+9Iw*)q@r%p-7X1Zs zhR{E1I{@MZQb-+=F4$4k@ZvrB*f#9QFz{?R)}|KH7Ue8IN6eI_$g=~k6HkUgILwMMLCo0o3LNUig8D-(*# z$jVZ70|9BCEJDfV*e;@~v7dh3W)-eTCNk4ER&zgZT6kfYFfATNVH6S-L!08&$?(#1 zVDJO8XR?gnvdF!&)Jt=<*Mr1gG?2T5QKvNHS*_L+t$tH8QcOEob60sqOJ}>qFKSGJ z?T*+Eb$(wxDfbN&E{`N((Psk_DJcKBaz9zlr4d)bxo-%pYWt|!<7!@x&<%+sJW}6jJaEGOT+o}SYie*%m zDQ1i$Mvuk|e?sBo4P_^i^7D`u^AHP@qr>%UM8nBGoaHN63mCT5ED1=;P*@gujl;Gi zEM#uV&@S=Ku$8t>M5n4Z-S*(>*XNh+snTt2+xi*7h<;dF`puvx??he z{+OcGbtKc>-|Fs`IDN9-n(6oi8^|Zh6qR7p_psq)@dMnK z`>yHDIWL6&G3D`eW4pP=$(e*~0y^H`CZWwRd{2+zr8m>C1@EVBnU0F+D=zV3r0tGhg+v%DWFxrt*V}X6CD*I6jPDk!vQQ>)pV*j_p8~B5o8CNVAZy( zYSJZz?~hyg0QB`|>xZ8y5yS6UYX$7a#GdxmM5ij>{z5h!$<=#(z^8v05pLqUTH+(elu(|(-n%9)AM!^3+lPa3p|DbH< zzL>64vZND4Cq=*F;t#NiuiNH-L`5V(8OstseQ_hgSmZY8WS#Gyrkkr8>u;3Tq$`b- z7FAL=f1^X^2A(QH^-W^3)^xAQHH)dudX|e@meFd36{~{r7as~4eau1Y_RBhCY!H{^bsfia8sc z7e>njn)|XpF$*UPJFbo^0g1Aehs}8UwI94vDZ=O1v)RORiSKj*%}`PriAx1(2^bfl zy!fJ*;Sioq*L(UMV0Ey|-EW8cB35sbRC}p}*3b3j*SiiX_+Qe`sLlb|FI0~F9Lq({ zP*tF3_K-A(IiT|zSRl58Gd8xKp7ymf{30ep_e2&Bd_E|VO?IO|{&e^Fljm9$>N?_6 z`Bti2pg|B9;V~Ku-hNJPDuQ=VnJc)ipn9B_0o%zCwHVn?r!$?{`!`G+JQAH3pY?cS zGvaOqR+oA@=#YcLio;`n4t4F*fHcFZ7LvxbODvQsOPWbMmto{0pBxNASOjE^oHe1% zeTt=auDm8r^S6r^i``sgq=ELm{XQ;nFt-B=FQMSqB)d3|Z)ds>9f>x7Bs#RgpVF{9 zRBZ#zJdS4^W*jl!9j1SBt?!wb-S`WOZJ`^aG#PTfbJi1%$xTu}IAJ4gw!7@k4YTi6 zeasZwVLe0Vir?DTTMspJU(nugeaWR#&j`AfU-mrnqr@hu1f>% z%&OttsWkOd%IPP+Lf-yZsW<)MfmB~0U7!(;49*oa(uGg_ejr3GL_181Z@ZGRNRhp=_^7eMpfMDy@{ zdQxzz=8Y^0Hd*G-PHZp?I=BF`r`5NrXS6q4LB-s6gkEmqWa-DAxVA|nX*6)o`|fnz za=5|mI5S`}d1BZdrh4_ohH8%3Y*XaGg>dq?%^H0^>_N#ZmLIqAV6Eu1enWnOEV~O% z=*ruEnQnb&de=XGf8X2o(vBTLRCgPlLy4djym;s4h4G4rn{-u4*h}B~cihB(KG>ey z>_FeX^g}kshX)0Cf1#^+u4t8(=tq3l2ZAhlryg8GTfHYae|VTuuw{Ku|iC|lRcPbJuEW5FZMgzpo=$X2W$5D33df;F}OIlMi$jNzrd=@rwF47wYZjE zX+MI=Ms?x-ox2^m7yIYoIdBxnmbhqHRZUqfHbZi;p6h)Oa}n=dy^;h26kja)JjG2M zYO729#{_tdi~?g2)@!w_E2+Nq=b<2PnE#g4~Gvs zI{^B-qa~(Fn+zraiZp3mEz z-`$n-|NTL|gzofF#XB8IulDo`g9W9`YaqOqcG8$3Y>)eRLjcJiR%9bFNxJKgyH2m0%T0G=Nk8k3q=V@Wt3kc6uu1fNl!ih`xm4O-FRafCnoyU68(-8Br`@CBblCmVZ{_040OTc6d51R)3x`g0o3y^7e}Cgdwdky09H?U=1iM>sH`YEhr& z+;r>EG+49K#_#BG>jV3oH{rnn-qy~gCY4fr(tUN+MWCUu@ign;J`oO>taHbjN(Qlo z?*~1Seu%m_J}abB6>OAnk#~=m{vWyy_{H$@V8nu|XhVD5rD(&cZU8dpv)__Q5kHrp zo?ra9*ZLc8Yk@j{5f4Hv0<@&q^At1pqqX?Th_g4CPU;MgQ^Q~S5>>EY{TF{Bn>NcO z&#goBhG?jh%?`+`xY}D(>Mu;M{ys0+{LDlI4OMlroq7lSL-Wgpc%GD{$VRuAgpK6> zXwf*2J9|iUR5u;fwzv@d;t9d00Wdbq`0V8PbVZ0S~fzqLxU=vNC+w6)f~I z-^$P{GBb#*P+!Dp>)W)A-DD4{4tKP|ngw4Q{;2i4(Wj+<;TmbeyAUMW`uj*qo6oM_ zB3XK)H77SU6mx!*l@7U;aKj0e)ivDl;Ed@Ly@~oF3$l}Q$HotZl@8|Xn-4w>Oi77< z0k3XiJ_%yrxArT*F^a0<_#~sEaDN0|%(L?qnP}aICqxS^!n& zZ79rVOWTz>bn={*x*WW%=Kr8kQiKWn=3KeUycfWa!@u_%N!;jcuQT{wH7R3qmae0O z|Bx1NS5q4yg##WK1jAU94+0msQwm>mSRgJ(g=n?rMmu- zrJt?N^jCzpP-ighlmDb7;rIPRT4z8o<~2_hN%hE&XV`-AXKZ*2MaGNhs%x;+Z(v5B z|6fa)vp)rNR40L$5G6HcNTQeffv5;siG^3~Bf4y0D)1g)7P%Yj=MMILkl00N&}>db z<*dF1p2&(>h0-w0Ne!-;eXUZR-!;(<-v@L7hIa21JAxq#q7Bln`B{WJ+5tElp^vOo z83b-la7FgY_fIo?pTZTTkkDPCGTtq(AR1oK8KimN7?$T@WifZ2kJX zCZBbsa*xBY-xf?0Wj>}nueeKUrTUZ7U_frEz~nC^hZK9bDjnqer|JSf80dpZ3ClE& zs1P_HnL$XjI2TnfJM9w&`%G8yDDjmLBbOoeEBcHVE}^{G+~W6Q0ZA_v3Vq1DQZj@- zc=v6NZg~!fV5Zow?0RzOUV0&m0z_V4rJ>Sky_km0TcyRBF`vM=#7vda(aN2ba3$FHg6Sq|Y&8p@AL91i_9lu%sTHOA& z$X1&t4(8DjMfK*}#+MDdx!_EQ!D<7N!K>s7z|R?095{MoU1JAVxVDweOqAa$goa%F zO~6g#X4X0zCHBE&D&Xgr?Xv?NtR$?Yuk*i@PS$|qk(fA$A>N0CuyBCBiQ5YXYKmE#a2 zowzS9rw0ZD`c#H7<8J~_RAiiqK-RH#=1u?}(h)M#7 ziMTH}mu14-l)&RYSddGip%0DrCe92cJ&r9E{jEpfL2WY&2O~j=*hiJmk3^&;lYvI2 z9Q(kKrjQB3XRqT3+pBI!msnJR!+Y$J^4^D1UH$p zR!IUqC|wiF$g2FCBUrOe-D(8q9kys8P%kZgI`Ww%hBfA4&vaz45;(IuVQp}lFpX@M zsighmeEH;-=P?ye+4osad3oVau+G;VBU70pi8{-CDwLODYn5f+JPj10M4U;4PCC#v z=+7Tz3WfB8~*AUpgg6C0S`{HjO@+$#!FI|HA(0S}g4Dwb;#;one``BXq(^?#E4Z znFB^KlP>)Zf;irpQmazI+XS&*hbeFL1D@vLhR|PHRXoCF_!jNo`~%Fc%kO;_H;oXx z)6uT*PLJGBN0M64sJV7val#}-u*4a*Lq~J_Ib)ZDw8S&>x_%QpVFmQ|>7zIND)Y`6 z9n_|0ER=9Fv`zS}fq|rjHzP>*p(kl+fpVJJY&g};RWOj3R2-`5)%B%w+t?wRIDAdl_%UZ=+o-qFM~`A<2hN z;W8typS~0)P3*e-yZqcwEAm;KGkrI;>EpdWy>8hLH7JnOpqzl)aFV_g>aayWTa8=n1gXWqkfHJ>e{X z;PF}kuOvFMMI;gBgJ7wMSxfNG^J$;RY?@)f7DmJ!4IPL+=KaI>@d?41?60IZ_g+?Y zxKe{HxF-o|#}d;sQx$brPFZxMk;e?21c(IUbG$;d#ZLm^27hD>O~~|8?r43!bfBNzX1G7c%$Q_ezAv6 z3Q7E|dqRhyrP9>{B#D7{7@faldWE`cyB^h7KbfC4S0fa~7hNq<`%nRP?ah9PWX;Y6 zR~F;oLE&U()xudqj}0*F-i(cmD&JQLht|+=4?QrN z<#hQ>d}#FZg#f`KF`F#hwbkpERqv?xy%K;oAn!D;1Y^Gd z^frxYgj{v&Wcy!Sx<_g*w`Erc*9P*MUbE7B7M&iilDvX>#8>;{-0)MhaO7Z)(m8jf zuXYzYDvQqM&>`W*@b3dYMZK<4S}~dM$BN=nhszE5v#;*M)TVf}dzrGM&#|C3k9co( zn3iDkZ(sQ|;_W!bs47)in#s$G>poKiB!62;$~eT?0*|7=rO8qc?4{&zE)zHI+#h04 zsw)zu_t%D9EB#Jw`t&c#w5_D{1r!v}^ZBXt-#E*@I6CU_lk3%&o2)VJF_z6=Gck;p z%RVqr;zPt^dkWp!rp+kzLShsov}$Tyua_&9{Y`1Ee5#|M&Dgtgr>b(SDQxFm!;*9Y zTfEGSnf-?g%s>s^vC~ncY@8N8XZ0IZx7&A!;Fr=~5|{m9m*<9>f4s(#GC`7hNigx) zm<#Hxf0^#d&Oa^|;bQl;lvuLNT=NU(ns@|%=W?E!XAHK%QS0T=pBF>dUa5VahOJPv zjY{G9nuG5Oo4L6aojeJXog6ZUZq{onLd?is;|fhFlvk zPITXVX&AX!v>|FX&C8pc8|YU@i0o+G-MSrjX>TE}X#;$LPU-_z;Zo}ypLUXGo($AG z;%bST^2vQRy2%%eLvAvJ893=F&HU&6H=#IJ#?^VDhr27@r7p>a${e=0Or&;goxH}w zAFKAdvIEnUdgiTk?~RBLK5z5U^*UA$sdb}YHm#TJMY;EFG}1k{xHaZ%+K{^RjU?b^ zx>P4~t`p;?*I%ny zzWPS1G?3Zsyc(Qt=te z;5WDdJzq>%Qb$`~PjsE;$6;sDyv>Y+(R_*f>djG+f5SuTJ76EvT1{0z{EJ# z>QNhx#zh(!@1wfd^vjC`)$2E`b)+}Ndn}q7Uei^Y`=;@9>D-+O5g2mK8>j>nXFQ9` z3HQoo_>48tqnf|x;X@nfA9nMFtQwXYcGxTPKG&Ol3{Cmp6gA_>4%VaAtu4!Q#UlCt zTu*w{f?t1 zo8Sh7zSBtDWa%4j8_v3T`p6AIz0=X4wy&wCX~Nvi(oiNW)2};$+6z3!wUV89SE0*d z8B!3W`u*k9{(BwTxPv^>zpCRLx1=5EneNG_LS3y!v&fD6k0nIsA#5^uebgY=tjMIH z+No>pV@F&pDyH;J@v$UJ{4ug_#?M@OjFX}0)zSGzk~+G&v|*~J-&V2Z&6(5R3rs!A z@n!Ejy8Ed|S>iKyd{g`F*N^zrG&>8sJitHJJxDvTzQ3{{d`>&@e*%aBcm6^51zX!y zWSbWRjfiZOm~3w8YJGbmt2!NLG{zV+P)x6!iZC1W+=HhE_X)!ME^m4>``7` z(dHyarkuX87(X=uPbZ*^MzoYbO7Wx+0M$>n4izHgA8Mzfpsff0wigkfK-&?zfKJdB zpc%Xt0(Jq-6!ai%tA~HsyRM6odBM?TQ3UY|f9b=3!PLw5vp!>dw7t93j z6wt}QMEKN%G#ozA0Mvohq4EOB-)salUk|)Dd8RDS@ zqKp6)0L3fRFa1w1X!p8r#6?AR0|aQ7h}RAvsdRflL2Em-jwjKPy?17eF~)>!)~p!s z9ycC|p8&xzcrpgnV?f4$4hKLe;xj7;x*z2L;_d1Fvus0jJ4hped +image/svg+xml \ No newline at end of file diff --git a/static/logos/GoDaddy.svg b/static/logos/GoDaddy.svg new file mode 100644 index 00000000..e8ebdb00 --- /dev/null +++ b/static/logos/GoDaddy.svg @@ -0,0 +1,3 @@ + + + diff --git a/static/logos/Shopify.svg b/static/logos/Shopify.svg new file mode 100644 index 00000000..cec428c9 --- /dev/null +++ b/static/logos/Shopify.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/static/logos/data.world.png b/static/logos/data.world.png new file mode 100644 index 0000000000000000000000000000000000000000..5793577a10c414edd48b2c9ce9d1791a9fb12dca GIT binary patch literal 5902 zcmcgw`9ISS{Aa9VQ!?vqLXODPR-34G37IQq&Spcb$bDbs$kD{6wB#sqjAqUpa~~O| z93hE03rQalx>T;O@Ar@RJ|3^vDza&%x;II#-Gz&8ZOB{7UzBs746U@FL!%;JG*g` zK)f2v9t>ZT-`)w?9cV$YTplEuZ3&e%ke>|;2?0q)dOB92V@s3cF?pChLd2M2>!;h> zQxRWGJy`WZj|ksuPE{AnMt=#7UR{X3E}tZvXD_x0EVSce9thCqI^}B+Z~2iACUxc7 zuRC-HGLB>HY6nhQO57LpH_~qGP7;-C{tEmd6y? z1MetmdfFy_iKrvizwW=a9TK>`RqtKVwjv=mI;6d}j9m#qWd_8P!vBHn^^W`wa7nmU zsl9!;?_dH>{)E++W>Rk3oe|3w3T|7|F8INPmNtC4xrUlQ(tYq+J1D}pg$!+D}e{FuG0=wyOg^aep-hN{m-wSSr8b|XD;4i%;(#@PE*Yr=+&@HXX{)pR# z*K}c>E^Ku-Zhoa??s!WGIPb%|&(7D!1@x_2Zm?+~@%@6A*bB>o@KTC><;+IEE$&;+ zW^$gR%u8>@7{$k)`e;$mTK_rlcs?Lj4RsPzqrY_IB`WGW4Yl2p5bHZRTi}>s82vt& zcVE%K=^d!qHt|jjV26i@r6D^Jbc=NELjfTb*=^x_Pz__xs+&Px;RSJbvya0i<21mQ zOwhOy4`%EKVJm?GRI6uPjp#FPg%;wo?$FDkl70pM)8FADuDg0 z*_;j`G=#P1a)UwSjcT=pK9gu;8vS$oRP4K%>=s&MH%L-3HPJ7hDKp-ibm^bqrm2uc zn6z06=s!q`s$U!P9&>d%RFxw1U3&!veH?`wdR=L_<=aMf39Y+=%2!Txw#_+wWGS!f z_>?;8#L4>UjP}d zD0Uv+I7F->dLPU!y|1djBDEm5?-yD_4TQiljw5Rlik+h&mdWq7Q_f~v#FNP+kg>^a2w*t41^w#*eZU~R>zv*fgH9z=I&=&B`C{f^YQSn z9fnnPoI*9Soqk2u6);AOcmb37luv^fA4{PMOO>)xX^oF&8ja;BcEj(7P#-NAu^kxQ z3RI4>ADVAY4c}gG&;-jdiq&kE&O16Oq3IY1iru3&ld$US=cSfXivUE9P*+s~{6OM^ zz)_^uQrJzWeBBhs8x+)OecT3nP)SDQ>DO_C1gGO@e{4>DOT=SD=b%#6oy)OrsA&iu z41e0jvKu6I`G~6%3jMtZ&K00)ULoYg!rYiNVJ{nwFOy6WjQS8;+W@{Q)&|)1PASh> zJHP#haM%Iw0UK1HgL33cP z=MG#(tmsh4Sl`Fsmvfz+0!O5As6{rv(QxxrHn7(qd?1i4Du327ctm;uo!W_7EJF>G z(+P}L6S~+7&r&`$jBCjv6vMgCfM_M>bBwR3M9W1w{E5SOZfDzV@*@4Q7nDSu(eW^1zIKb=+qjsQ`lYD&^9jpO6NG0}78tsYU!#7R`e&r1Jb{Xh0t&<& zy_)@qaek^UTc6)>W=|UDg;(9CdmTmhql)8Q_T^RGbMkRW98M6<=&W zF$Z1HVS+|sK|bBo+DhHs2%zKyFPu;pN}V7F4wpT1^;Gm#_4 zV*42b4Shv;h$yAD23-CEZCj4`glc8;OKN8IWa4tb6YpWMyqPl33T2A#ViUX~R7I<| z)kE=N$4(5FvetM6biEm*#%L5~;CB+ix1=`WO<^Yb&-s)3MG0R6a(7hWx~896IcKkoknJkw-=(l$&244C2NIf zn~CWtm*&|fXQRz^@O=A{w$@xd3U~tvqTz*N*I%f2{C+HJ3L!T2U1*>!O85WyiL7>E zdh<3M$pSX^;icq4!0W=3;PDf6SsQzdLk<>@6*lY{ z{hxvX`z5Z&)?3Zhfyo!cOBv+MaFOW(wtMzi72k=K{ULR5;Lrw}SzXj41zZHizvaDK81NC{k`T~b-uE7*BaJ+WCnWOV_IgStkVHnRa$bweL6gB z9PHJ6;=izJEH!$nHVyHKV)D7){rUiia=Xf{qpjAORbvgI9xO_cn$oE28-L#!1+Mvd zba9!RQ(vl7-S;_)_M?T@5ek|3T>o6Dy31vPvZ!`Q(Dl*CFXI|wsX6QI5(?w!bf^8x z{{g1(La)amK;M~k#0snKjZfn5&yjz;rXyk#bWYOm@h7a3#}BIEj+uY{0NZAVl6&`Q z)<-a7@?g#pC-ctmd#K)u*kGN`Qd-i!ahYGNP)hG_$=G0QunaVj{BZ96ZOd?!%a6(P z2R`XR8`Z>*(^L4K7qG|!*X<~{4-V7;I@JrCQ6qH6WjZ1NQO*{S(mVG&=T|wk+9s$| zo}Y$O7}8_LjGOIIRWN5w?8jh7Y({nbU4$hXMGZF(r}Uz&Ii<8q(vHulH?g%=xmo)} z`o?LzBQ0|LDXKR|_oB=$<;TbXYj-n=^7QdSV!u*~s}tmiwnSxmMj_DynvH4Izzfthm+_L6N!p+O76;*+jRJOgakdEKcP>%t&u1Tt-K;poi39b zY8(0iqW@UQ8(XV0J&DuxZ^T4N6yVA+(bIp?Wqe!?t}>mHv!XRVW1M(|ewk4Zrr)Fe zuoXdB$WrVQb&UM@AO-{TK#hQMS%-^5mt|UUxwxwIH-nCUEJ2&3fMr--2NLn8lHGI1G+;;zl*>5$AaFbA7)_~*dfIeaqOyQHR>;(2 zy5ur+9Ny}xXbvJ_XgF3OjWwvNs0mZEK)dAq`p<2;IBxMSBz}yma3`APnya+D+3PNB zlN|F(*JQTdr-IDk;*LS{X3Gz}4fQ#ICA-Q#*L6D}m$SA@^R)Pt>s7?`P2s;iXk19$ z^3szhD8m-MIbKK_U8eyG8}7ZXs3ld<@W+pg@x5!ANkZi(C2~%O_5xFuXLl1l1LAqQ ze{d-amtT3CcT3zeEVB6TjV`rKxI^O1UWP$M_e#_cuO}X8QHpHR-AufHr0o1<|CD2S zoZ`Zg18qRR*ZurGLgt;p#1z`V-B=0TcB*sbA@DWKRnkK}#w=}s%aISLz>^33$+8Dl zeH%XRtoN(V#ut|mE9SiS$T1e-w&ywPj`Q-KBH~^ zL(FRdD1m=SUJmd=XWd3S=QtNH@@TT@z;RGe=PxgnN#|T3P^UPwl^r@tV^Bd5vGSTzz8RUU}Jh z0N_jJt#loKgutbe>PjkI5~?P-LXp+^) zW}k0vexvtC#Z;6x?eEEG1;Bg!8&h@;Mp3j~pH|lI{R8Oisv(pX@K0R&T++eMi?dGv z!T@VQQMC4{Dw~(~N5dZ#{$mQef6!4>O`?!0j^5-PLowp*HUmmd28IANVM*|rND zmSTMJ$a$!Veaz;koRl=~Np;}*cf$TIiPXySN5F(N#B$BQw$?Y{iZ2Bfyvv>%9R@Wq zg-%IYRD{((`2AtFxiQpes-tx%^nMrv>$ledN+16A`uS&VRrJxwc9mx?iU}mgnRy!^ zox~!cKe|dy`Zf7Lv=Zj0RyWJ_tAF252)oq+?j{YmSsm`*T8|u-fA;FfCc;2)K_i)4 z1ZU%etCKI26Gz;5x1!9O7^$x;i;Y#tjsnoT!I-x(#_j%fAE#&c4UL6RRixX2>w~aN z;HKo3FHzE4A#Y~Z_)&RlevF8bj=nVGkwJff*5d8$8_r7aMYK%Ddfw9U--TB_J{>j` zk$C%K^yS#@a3kl4clXW!6%94EG5u}52}ov#pc4favtT7E0bGHsvePt7OLTAeH8)<6 zE+mnRf&uB}$(P%dkW?p4bRF!viDBaEYpTf~o1@SwH{KAo^GCC65*nk34kg5(ddyVy zjh!x4AS4H4_#iP#)Ln2^q$oj3N1EaMcd5g7K1Hq{)hP$KZ1X!eTHAP8@}>-9XeZ=*cmmqk7f9#m40cW3vGyPR`(A?IZaoSRHHOCb@W&};1&(}AF zu1TS^tMv|2KFTA_=Kzj7)=Sx;byqtrzp7_~A#j(2PK&8y-6Szlt6 zJLR;1w}hb^HBFLqF@)sNs=P2flse|k1f;SLPms3eN~ ztC>f4Gk1$_D$Uq0Z>6V_oHHO9;NSgR3I7~_TEE-j&q1xw?Plb<&HB~kn2(YH+O2K( zM{IA@h#7mQ{FJqpq!wixJUooA#vk7G-s@aBRp=$y!GlTDu^x9&SA1~sCGwZ9*EN&xUjF+b{Wbef@WL@i^QtDTc2k7wdmy&sBNZM~A^l zcy)b`0_{Px-9>ORe!;J^pNxB;pl+*7-6#S-NJR}U4Ed08havh5?DWNNm)xT5gl}*S zkycB#92IaazfeB_$Wi5a`>|IkKnV;4yo#7j8w30ACbUvz4FbPOok*fnaC%#uE>hxb zypH(4=wbAXg8M2=M=#I^aOc|N<_~AY#PDD>f(kBv6;7l-%;H}clN5ZD77}`=v9Fz@ z<=EsR){YU2jZU8Vx*|UNTtpvw9ieqPN8)z+VV=DHWfA?n>m>2lVIrOLvl!DC92sc% z72p-Ic3waWxxGbo_bqO~*M0#eS(HGA_gnP;kHQndG|68aL6-%F^8W-knqH0r@1Kkb zDpAN{5-JevwM*<=%4@?C{Rt{={YEXPh#(C_V}qbtq;aJALLSMF@p__G!CDrJ%ZLl#i=)X^L()I*&wI`qtN&T z1w%GbDbxsp3Nv!Qr036rU-GR&qXcLHI&Ls<0q6xJf$a1D0ZsFHarDH6SCeyqB%#ZQ z`RLH3QkdhRd}PyKLm{btw4d?;Nh-zV*`%IP4bZw}(H1 z{K~53i@Q^MEuVWG`yLl*(Y+G1T{`jN>Z#2qV|D1lC+no*n6uK}f_-EY%~R%{v%stk nYGFU*UqngVn5m@4UwO}Wt55FkkB{E@Rtp*733_F^jxqlOolo+7 literal 0 HcmV?d00001 From 53a74602fcd0033f08f09753998c64affdae41ce Mon Sep 17 00:00:00 2001 From: Michael <59065704+Michael-Curtis0@users.noreply.github.com> Date: Tue, 23 Nov 2021 11:39:16 +0000 Subject: [PATCH 2/3] Update CSS from camelCase to kebab-case Partially solves #71 --- data/themes.json | 160 +- data/themes_schema.json | 152 +- src/debug.js | 108 +- src/main.js | 28 +- src/materialize.js | 25600 +++++++++++++++++++------------------- src/src.ejs | 428 +- src/style.scss | 1830 +-- 7 files changed, 14153 insertions(+), 14153 deletions(-) diff --git a/data/themes.json b/data/themes.json index 16c5c4e8..7ddcea12 100644 --- a/data/themes.json +++ b/data/themes.json @@ -1,80 +1,80 @@ -{ - "Vanilla":{ - "accent": "#3f51b5", - "accentRGBs": [63, 81, 181], - "lightAccent": "#7280ce", - "text": "#535353", - "background": "#fff", - "internal": "#fff", - "incorrect": "#f44336", - "correct": "#8fff66", - "inputColor": "#000", - "linkColor": "#00539b", - "highlightColor": "#eee" - }, - "Discord":{ - "accent": "#7289da", - "accentRGBs": [114, 137, 218], - "lightAccent": "#9aabe5", - "text": "#dcddde", - "background": "#2f3136", - "internal": "#393c43", - "incorrect": "#f04747", - "correct": "#43b581", - "inputColor": "#fff", - "linkColor": "#00b0f4", - "highlightColor": "#393c43" - }, - "Solarized Dark":{ - "accent": "#6c71c4", - "accentRGBs": [108, 113, 196], - "lightAccent": "#9094d3", - "text": "#93a1a1", - "background": "#073642", - "internal": "#002b36", - "incorrect": "#ce2726", - "correct": "#7c9114", - "inputColor": "#839496", - "linkColor": "#268bd2", - "highlightColor": "#002b36" - }, - "OLED":{ - "accent": "#3f51b5", - "accentRGBs": [63, 81, 181], - "lightAccent": "#6d78b5", - "text": "#d4d4d4", - "background": "#000", - "internal": "#000", - "incorrect": "#f44336", - "correct": "#8fff66", - "inputColor": "#839496", - "linkColor": "#268bd2", - "highlightColor": "#0e0e0e" - }, - "Dracula":{ - "accent": "#3f51b5", - "accentRGBs": [63, 81, 181], - "lightAccent": "#6272a4", - "text": "#bcc2cd", - "background": "#282a36", - "internal": "#343746", - "incorrect": "#f55", - "correct": "#50fa7b", - "inputColor": "#f8f8f2", - "linkColor": "#6272a4", - "highlightColor": "#343746" - }, - "Monokai":{ - "accent": "#e43265", - "accentRGBs": [228, 50, 101], - "lightAccent": "#292c3f", - "text": "#979bb0", - "background": "#11121d", - "internal": "#171926", - "incorrect": "#f5680a", - "correct": "#2fd6b5", - "inputColor": "#fff", - "linkColor": "#e53265", - "highlightColor": "#171926" - } -} +{ + "Vanilla":{ + "accent": "#3f51b5", + "accent-RGBs": [63, 81, 181], + "light-accent": "#7280ce", + "text": "#535353", + "background": "#fff", + "internal": "#fff", + "incorrect": "#f44336", + "correct": "#8fff66", + "input-color": "#000", + "link-color": "#00539b", + "highlight-color": "#eee" + }, + "Discord":{ + "accent": "#7289da", + "accent-RGBs": [114, 137, 218], + "light-accent": "#9aabe5", + "text": "#dcddde", + "background": "#2f3136", + "internal": "#393c43", + "incorrect": "#f04747", + "correct": "#43b581", + "input-color": "#fff", + "link-color": "#00b0f4", + "highlight-color": "#393c43" + }, + "Solarized Dark":{ + "accent": "#6c71c4", + "accent-RGBs": [108, 113, 196], + "light-accent": "#9094d3", + "text": "#93a1a1", + "background": "#073642", + "internal": "#002b36", + "incorrect": "#ce2726", + "correct": "#7c9114", + "input-color": "#839496", + "link-color": "#268bd2", + "highlight-color": "#002b36" + }, + "OLED":{ + "accent": "#3f51b5", + "accent-RGBs": [63, 81, 181], + "light-accent": "#6d78b5", + "text": "#d4d4d4", + "background": "#000", + "internal": "#000", + "incorrect": "#f44336", + "correct": "#8fff66", + "input-color": "#839496", + "link-color": "#268bd2", + "highlight-color": "#0e0e0e" + }, + "Dracula":{ + "accent": "#3f51b5", + "accent-RGBs": [63, 81, 181], + "light-accent": "#6272a4", + "text": "#bcc2cd", + "background": "#282a36", + "internal": "#343746", + "incorrect": "#f55", + "correct": "#50fa7b", + "input-color": "#f8f8f2", + "link-color": "#6272a4", + "highlight-color": "#343746" + }, + "Monokai":{ + "accent": "#e43265", + "accent-RGBs": [228, 50, 101], + "light-accent": "#292c3f", + "text": "#979bb0", + "background": "#11121d", + "internal": "#171926", + "incorrect": "#f5680a", + "correct": "#2fd6b5", + "input-color": "#fff", + "link-color": "#e53265", + "highlight-color": "#171926" + } +} diff --git a/data/themes_schema.json b/data/themes_schema.json index a53c5fc2..40e42742 100644 --- a/data/themes_schema.json +++ b/data/themes_schema.json @@ -1,76 +1,76 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "type": "object", - "patternProperties": { - "^[a-zA-Z0-9\\W]*$": { - "type": "object", - "properties": { - "accent": { - "type": "string", - "format": "color" - }, - "lightAccent": { - "type": "string", - "format": "color" - }, - "text": { - "type": "string", - "format": "color" - }, - "background": { - "type": "string", - "format": "color" - }, - "internal": { - "type": "string", - "format": "color" - }, - "incorrect": { - "type": "string", - "format": "color" - }, - "correct": { - "type": "string", - "format": "color" - }, - "inputColor": { - "type": "string", - "format": "color" - }, - "linkColor": { - "type": "string", - "format": "color" - }, - "highlightColor": { - "type": "string", - "format": "color" - }, - "accentRGBs": { - "type": "array", - "maxItems": 3, - "minItems": 3, - "items": { - "type": "number", - "maximum": 255, - "minimum": 0 - } - } - }, - "required": [ - "accent", - "lightAccent", - "text", - "background", - "internal", - "incorrect", - "correct", - "inputColor", - "linkColor", - "highlightColor" - ] - } - }, - "required": [ - "Vanilla" - ] -} \ No newline at end of file +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "patternProperties": { + "^[a-zA-Z0-9\\W]*$": { + "type": "object", + "properties": { + "accent": { + "type": "string", + "format": "color" + }, + "light-accent": { + "type": "string", + "format": "color" + }, + "text": { + "type": "string", + "format": "color" + }, + "background": { + "type": "string", + "format": "color" + }, + "internal": { + "type": "string", + "format": "color" + }, + "incorrect": { + "type": "string", + "format": "color" + }, + "correct": { + "type": "string", + "format": "color" + }, + "input-color": { + "type": "string", + "format": "color" + }, + "link-color": { + "type": "string", + "format": "color" + }, + "highlight-color": { + "type": "string", + "format": "color" + }, + "accent-RGBs": { + "type": "array", + "maxItems": 3, + "minItems": 3, + "items": { + "type": "number", + "maximum": 255, + "minimum": 0 + } + } + }, + "required": [ + "accent", + "light-accent", + "text", + "background", + "internal", + "incorrect", + "correct", + "input-color", + "link-color", + "highlight-color" + ] + } + }, + "required": [ + "Vanilla" + ] +} diff --git a/src/debug.js b/src/debug.js index d6a097df..40e23116 100644 --- a/src/debug.js +++ b/src/debug.js @@ -1,54 +1,54 @@ -const themeData = require('../data/themes.json') - -const debug = false - -if (debug) { - document.title += ` - Debug ${new Date().getTime()}` - console.debug('Enabling debug css') - const link = document.createElement('link') - link.setAttribute('rel', 'stylesheet') - link.setAttribute('type', 'text/css') - link.setAttribute('href', 'debug.css') - document.getElementsByTagName('head')[0].appendChild(link) - - // Add select option for an all #ff00ff theme - - themeData.testTheme = { - accent: '#ff00ff', - lightAccent: '#ff00ff', - text: '#ff00ff', - background: '#ff00ff', - internal: '#ff00ff', - incorrect: '#ff00ff', - correct: '#ff00ff', - inputColor: '#ff00ff', - linkColor: '#ff00ff', - highlightColor: '#ff00ff' - } - - const themeOption = document.createElement('option') - themeOption.onclick = "changeTheme('testTheme')" - themeOption.id = 'testTheme' - themeOption.innerHTML = 'testTheme' - document.querySelector('#options .input-field select').appendChild(themeOption) - - const css = 'a[id=testTheme]{background-color: #ff00ff !important; border: 1px ;}a[id=testTheme] i {color: #ff00ff' - const style = document.createElement('style') - style.type = 'text/css' - if (style.styleSheet) { - // This is required for IE8 and below. - style.styleSheet.cssText = css - } else { - style.appendChild(document.createTextNode(css)) - } - document.getElementsByTagName('head')[0].appendChild(style) -} - -// If running locally -if (location.hostname === 'localhost' || location.hostname === '127.0.0.1') { - // Change the page title so I can tell the tabs apart - document.title += ' - LocalHost' - - // Fix faq link - document.getElementById('faq').href += '.html' -} +const themeData = require('../data/themes.json') + +const debug = false + +if (debug) { + document.title += ` - Debug ${new Date().getTime()}` + console.debug('Enabling debug css') + const link = document.createElement('link') + link.setAttribute('rel', 'stylesheet') + link.setAttribute('type', 'text/css') + link.setAttribute('href', 'debug.css') + document.getElementsByTagName('head')[0].appendChild(link) + + // Add select option for an all #ff00ff theme + + themeData.testTheme = { + accent: '#ff00ff', + light-accent: '#ff00ff', + text: '#ff00ff', + background: '#ff00ff', + internal: '#ff00ff', + incorrect: '#ff00ff', + correct: '#ff00ff', + input-color: '#ff00ff', + link-color: '#ff00ff', + highlight-color: '#ff00ff' + } + + const themeOption = document.createElement('option') + themeOption.onclick = "changeTheme('testTheme')" + themeOption.id = 'testTheme' + themeOption.innerHTML = 'testTheme' + document.querySelector('#options .input-field select').appendChild(themeOption) + + const css = 'a[id=testTheme]{background-color: #ff00ff !important; border: 1px ;}a[id=testTheme] i {color: #ff00ff' + const style = document.createElement('style') + style.type = 'text/css' + if (style.styleSheet) { + // This is required for IE8 and below. + style.styleSheet.cssText = css + } else { + style.appendChild(document.createTextNode(css)) + } + document.getElementsByTagName('head')[0].appendChild(style) +} + +// If running locally +if (location.hostname === 'localhost' || location.hostname === '127.0.0.1') { + // Change the page title so I can tell the tabs apart + document.title += ' - LocalHost' + + // Fix faq link + document.getElementById('faq').href += '.html' +} diff --git a/src/main.js b/src/main.js index affc2e43..9b5bdee5 100644 --- a/src/main.js +++ b/src/main.js @@ -89,17 +89,17 @@ window.changeTheme = function (passedTheme) { localStorage.setItem('theme', passedTheme) - document.documentElement.style.setProperty('--accentColor', themeData[passedTheme].accent) - document.documentElement.style.setProperty('--lightAccent', themeData[passedTheme].lightAccent) - document.documentElement.style.setProperty('--textColor', themeData[passedTheme].text) - document.documentElement.style.setProperty('--backgroundColor', themeData[passedTheme].background) - document.documentElement.style.setProperty('--internalColor', themeData[passedTheme].internal) - document.documentElement.style.setProperty('--incorrectColor', themeData[passedTheme].incorrect) - document.documentElement.style.setProperty('--correctColor', themeData[passedTheme].correct) - document.documentElement.style.setProperty('--inputColor', themeData[passedTheme].inputColor) - document.documentElement.style.setProperty('--linkColor', themeData[passedTheme].linkColor) - document.documentElement.style.setProperty('--highlightColor', themeData[passedTheme].highlightColor) - document.documentElement.style.setProperty('--accentRGBs', themeData[passedTheme].accentRGBs) + document.documentElement.style.setProperty('--accent-color', themeData[passedTheme].accent) + document.documentElement.style.setProperty('--light-accent', themeData[passedTheme].light-accent) + document.documentElement.style.setProperty('--text-color', themeData[passedTheme].text) + document.documentElement.style.setProperty('--background-color', themeData[passedTheme].background) + document.documentElement.style.setProperty('--internal-color', themeData[passedTheme].internal) + document.documentElement.style.setProperty('--incorrect-color', themeData[passedTheme].incorrect) + document.documentElement.style.setProperty('--correct-color', themeData[passedTheme].correct) + document.documentElement.style.setProperty('--input-color', themeData[passedTheme].input-color) + document.documentElement.style.setProperty('--link-color', themeData[passedTheme].link-color) + document.documentElement.style.setProperty('--highlight-color', themeData[passedTheme].highlight-color) + document.documentElement.style.setProperty('--accent-RGBs', themeData[passedTheme].accent-RGBs) } // Change theme to stored before the page loads to avoid flicker. @@ -245,7 +245,7 @@ function setLogo (appName) { } // Set image - document.getElementById('logoContainer').style.display = 'flex' + document.getElementById('logo-container').style.display = 'flex' document.getElementById('logo').src = logo document.getElementById('logo').alt = appName document.getElementById('logo').title = appName @@ -545,7 +545,7 @@ function colourUnderline () { )}%, ${window.getRandomArbitrary(45, 80)}%)` document .getElementById('pass') - .style.setProperty('--accentColor', colour) + .style.setProperty('--accent-color', colour) } else { // If there's no password, reset the underline colour document.getElementById('pass').removeAttribute('style') @@ -557,7 +557,7 @@ window.appInput = function () { presetInUse = false // Clear logo - document.getElementById('logoContainer').style.display = 'none' + document.getElementById('logo-container').style.display = 'none' document.getElementById('logo').removeAttribute('src') document.getElementById('logo').removeAttribute('alt') document.getElementById('logo').removeAttribute('title') diff --git a/src/materialize.js b/src/materialize.js index e5dba309..b270714c 100644 --- a/src/materialize.js +++ b/src/materialize.js @@ -1,12800 +1,12800 @@ -var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; - -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; }; }(); - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -/*! cash-dom 1.3.5, https://github.com/kenwheeler/cash @license MIT */ -(function (factory) { - window.cash = factory(); -})(function () { - var doc = document, - win = window, - ArrayProto = Array.prototype, - slice = ArrayProto.slice, - filter = ArrayProto.filter, - push = ArrayProto.push; - - var noop = function () {}, - isFunction = function (item) { - // @see https://crbug.com/568448 - return typeof item === typeof noop && item.call; - }, - isString = function (item) { - return typeof item === typeof ""; - }; - - var idMatch = /^#[\w-]*$/, - classMatch = /^\.[\w-]*$/, - htmlMatch = /<.+>/, - singlet = /^\w+$/; - - function find(selector, context) { - context = context || doc; - var elems = classMatch.test(selector) ? context.getElementsByClassName(selector.slice(1)) : singlet.test(selector) ? context.getElementsByTagName(selector) : context.querySelectorAll(selector); - return elems; - } - - var frag; - function parseHTML(str) { - if (!frag) { - frag = doc.implementation.createHTMLDocument(null); - var base = frag.createElement("base"); - base.href = doc.location.href; - frag.head.appendChild(base); - } - - frag.body.innerHTML = str; - - return frag.body.childNodes; - } - - function onReady(fn) { - if (doc.readyState !== "loading") { - fn(); - } else { - doc.addEventListener("DOMContentLoaded", fn); - } - } - - function Init(selector, context) { - if (!selector) { - return this; - } - - // If already a cash collection, don't do any further processing - if (selector.cash && selector !== win) { - return selector; - } - - var elems = selector, - i = 0, - length; - - if (isString(selector)) { - elems = idMatch.test(selector) ? - // If an ID use the faster getElementById check - doc.getElementById(selector.slice(1)) : htmlMatch.test(selector) ? - // If HTML, parse it into real elements - parseHTML(selector) : - // else use `find` - find(selector, context); - - // If function, use as shortcut for DOM ready - } else if (isFunction(selector)) { - onReady(selector);return this; - } - - if (!elems) { - return this; - } - - // If a single DOM element is passed in or received via ID, return the single element - if (elems.nodeType || elems === win) { - this[0] = elems; - this.length = 1; - } else { - // Treat like an array and loop through each item. - length = this.length = elems.length; - for (; i < length; i++) { - this[i] = elems[i]; - } - } - - return this; - } - - function cash(selector, context) { - return new Init(selector, context); - } - - var fn = cash.fn = cash.prototype = Init.prototype = { // jshint ignore:line - cash: true, - length: 0, - push: push, - splice: ArrayProto.splice, - map: ArrayProto.map, - init: Init - }; - - Object.defineProperty(fn, "constructor", { value: cash }); - - cash.parseHTML = parseHTML; - cash.noop = noop; - cash.isFunction = isFunction; - cash.isString = isString; - - cash.extend = fn.extend = function (target) { - target = target || {}; - - var args = slice.call(arguments), - length = args.length, - i = 1; - - if (args.length === 1) { - target = this; - i = 0; - } - - for (; i < length; i++) { - if (!args[i]) { - continue; - } - for (var key in args[i]) { - if (args[i].hasOwnProperty(key)) { - target[key] = args[i][key]; - } - } - } - - return target; - }; - - function each(collection, callback) { - var l = collection.length, - i = 0; - - for (; i < l; i++) { - if (callback.call(collection[i], collection[i], i, collection) === false) { - break; - } - } - } - - function matches(el, selector) { - var m = el && (el.matches || el.webkitMatchesSelector || el.mozMatchesSelector || el.msMatchesSelector || el.oMatchesSelector); - return !!m && m.call(el, selector); - } - - function getCompareFunction(selector) { - return ( - /* Use browser's `matches` function if string */ - isString(selector) ? matches : - /* Match a cash element */ - selector.cash ? function (el) { - return selector.is(el); - } : - /* Direct comparison */ - function (el, selector) { - return el === selector; - } - ); - } - - function unique(collection) { - return cash(slice.call(collection).filter(function (item, index, self) { - return self.indexOf(item) === index; - })); - } - - cash.extend({ - merge: function (first, second) { - var len = +second.length, - i = first.length, - j = 0; - - for (; j < len; i++, j++) { - first[i] = second[j]; - } - - first.length = i; - return first; - }, - - each: each, - matches: matches, - unique: unique, - isArray: Array.isArray, - isNumeric: function (n) { - return !isNaN(parseFloat(n)) && isFinite(n); - } - - }); - - var uid = cash.uid = "_cash" + Date.now(); - - function getDataCache(node) { - return node[uid] = node[uid] || {}; - } - - function setData(node, key, value) { - return getDataCache(node)[key] = value; - } - - function getData(node, key) { - var c = getDataCache(node); - if (c[key] === undefined) { - c[key] = node.dataset ? node.dataset[key] : cash(node).attr("data-" + key); - } - return c[key]; - } - - function removeData(node, key) { - var c = getDataCache(node); - if (c) { - delete c[key]; - } else if (node.dataset) { - delete node.dataset[key]; - } else { - cash(node).removeAttr("data-" + name); - } - } - - fn.extend({ - data: function (name, value) { - if (isString(name)) { - return value === undefined ? getData(this[0], name) : this.each(function (v) { - return setData(v, name, value); - }); - } - - for (var key in name) { - this.data(key, name[key]); - } - - return this; - }, - - removeData: function (key) { - return this.each(function (v) { - return removeData(v, key); - }); - } - - }); - - var notWhiteMatch = /\S+/g; - - function getClasses(c) { - return isString(c) && c.match(notWhiteMatch); - } - - function hasClass(v, c) { - return v.classList ? v.classList.contains(c) : new RegExp("(^| )" + c + "( |$)", "gi").test(v.className); - } - - function addClass(v, c, spacedName) { - if (v.classList) { - v.classList.add(c); - } else if (spacedName.indexOf(" " + c + " ")) { - v.className += " " + c; - } - } - - function removeClass(v, c) { - if (v.classList) { - v.classList.remove(c); - } else { - v.className = v.className.replace(c, ""); - } - } - - fn.extend({ - addClass: function (c) { - var classes = getClasses(c); - - return classes ? this.each(function (v) { - var spacedName = " " + v.className + " "; - each(classes, function (c) { - addClass(v, c, spacedName); - }); - }) : this; - }, - - attr: function (name, value) { - if (!name) { - return undefined; - } - - if (isString(name)) { - if (value === undefined) { - return this[0] ? this[0].getAttribute ? this[0].getAttribute(name) : this[0][name] : undefined; - } - - return this.each(function (v) { - if (v.setAttribute) { - v.setAttribute(name, value); - } else { - v[name] = value; - } - }); - } - - for (var key in name) { - this.attr(key, name[key]); - } - - return this; - }, - - hasClass: function (c) { - var check = false, - classes = getClasses(c); - if (classes && classes.length) { - this.each(function (v) { - check = hasClass(v, classes[0]); - return !check; - }); - } - return check; - }, - - prop: function (name, value) { - if (isString(name)) { - return value === undefined ? this[0][name] : this.each(function (v) { - v[name] = value; - }); - } - - for (var key in name) { - this.prop(key, name[key]); - } - - return this; - }, - - removeAttr: function (name) { - return this.each(function (v) { - if (v.removeAttribute) { - v.removeAttribute(name); - } else { - delete v[name]; - } - }); - }, - - removeClass: function (c) { - if (!arguments.length) { - return this.attr("class", ""); - } - var classes = getClasses(c); - return classes ? this.each(function (v) { - each(classes, function (c) { - removeClass(v, c); - }); - }) : this; - }, - - removeProp: function (name) { - return this.each(function (v) { - delete v[name]; - }); - }, - - toggleClass: function (c, state) { - if (state !== undefined) { - return this[state ? "addClass" : "removeClass"](c); - } - var classes = getClasses(c); - return classes ? this.each(function (v) { - var spacedName = " " + v.className + " "; - each(classes, function (c) { - if (hasClass(v, c)) { - removeClass(v, c); - } else { - addClass(v, c, spacedName); - } - }); - }) : this; - } }); - - fn.extend({ - add: function (selector, context) { - return unique(cash.merge(this, cash(selector, context))); - }, - - each: function (callback) { - each(this, callback); - return this; - }, - - eq: function (index) { - return cash(this.get(index)); - }, - - filter: function (selector) { - if (!selector) { - return this; - } - - var comparator = isFunction(selector) ? selector : getCompareFunction(selector); - - return cash(filter.call(this, function (e) { - return comparator(e, selector); - })); - }, - - first: function () { - return this.eq(0); - }, - - get: function (index) { - if (index === undefined) { - return slice.call(this); - } - return index < 0 ? this[index + this.length] : this[index]; - }, - - index: function (elem) { - var child = elem ? cash(elem)[0] : this[0], - collection = elem ? this : cash(child).parent().children(); - return slice.call(collection).indexOf(child); - }, - - last: function () { - return this.eq(-1); - } - - }); - - var camelCase = function () { - var camelRegex = /(?:^\w|[A-Z]|\b\w)/g, - whiteSpace = /[\s-_]+/g; - return function (str) { - return str.replace(camelRegex, function (letter, index) { - return letter[index === 0 ? "toLowerCase" : "toUpperCase"](); - }).replace(whiteSpace, ""); - }; - }(); - - var getPrefixedProp = function () { - var cache = {}, - doc = document, - div = doc.createElement("div"), - style = div.style; - - return function (prop) { - prop = camelCase(prop); - if (cache[prop]) { - return cache[prop]; - } - - var ucProp = prop.charAt(0).toUpperCase() + prop.slice(1), - prefixes = ["webkit", "moz", "ms", "o"], - props = (prop + " " + prefixes.join(ucProp + " ") + ucProp).split(" "); - - each(props, function (p) { - if (p in style) { - cache[p] = prop = cache[prop] = p; - return false; - } - }); - - return cache[prop]; - }; - }(); - - cash.prefixedProp = getPrefixedProp; - cash.camelCase = camelCase; - - fn.extend({ - css: function (prop, value) { - if (isString(prop)) { - prop = getPrefixedProp(prop); - return arguments.length > 1 ? this.each(function (v) { - return v.style[prop] = value; - }) : win.getComputedStyle(this[0])[prop]; - } - - for (var key in prop) { - this.css(key, prop[key]); - } - - return this; - } - - }); - - function compute(el, prop) { - return parseInt(win.getComputedStyle(el[0], null)[prop], 10) || 0; - } - - each(["Width", "Height"], function (v) { - var lower = v.toLowerCase(); - - fn[lower] = function () { - return this[0].getBoundingClientRect()[lower]; - }; - - fn["inner" + v] = function () { - return this[0]["client" + v]; - }; - - fn["outer" + v] = function (margins) { - return this[0]["offset" + v] + (margins ? compute(this, "margin" + (v === "Width" ? "Left" : "Top")) + compute(this, "margin" + (v === "Width" ? "Right" : "Bottom")) : 0); - }; - }); - - function registerEvent(node, eventName, callback) { - var eventCache = getData(node, "_cashEvents") || setData(node, "_cashEvents", {}); - eventCache[eventName] = eventCache[eventName] || []; - eventCache[eventName].push(callback); - node.addEventListener(eventName, callback); - } - - function removeEvent(node, eventName, callback) { - var events = getData(node, "_cashEvents"), - eventCache = events && events[eventName], - index; - - if (!eventCache) { - return; - } - - if (callback) { - node.removeEventListener(eventName, callback); - index = eventCache.indexOf(callback); - if (index >= 0) { - eventCache.splice(index, 1); - } - } else { - each(eventCache, function (event) { - node.removeEventListener(eventName, event); - }); - eventCache = []; - } - } - - fn.extend({ - off: function (eventName, callback) { - return this.each(function (v) { - return removeEvent(v, eventName, callback); - }); - }, - - on: function (eventName, delegate, callback, runOnce) { - // jshint ignore:line - var originalCallback; - if (!isString(eventName)) { - for (var key in eventName) { - this.on(key, delegate, eventName[key]); - } - return this; - } - - if (isFunction(delegate)) { - callback = delegate; - delegate = null; - } - - if (eventName === "ready") { - onReady(callback); - return this; - } - - if (delegate) { - originalCallback = callback; - callback = function (e) { - var t = e.target; - while (!matches(t, delegate)) { - if (t === this || t === null) { - return t = false; - } - - t = t.parentNode; - } - - if (t) { - originalCallback.call(t, e); - } - }; - } - - return this.each(function (v) { - var finalCallback = callback; - if (runOnce) { - finalCallback = function () { - callback.apply(this, arguments); - removeEvent(v, eventName, finalCallback); - }; - } - registerEvent(v, eventName, finalCallback); - }); - }, - - one: function (eventName, delegate, callback) { - return this.on(eventName, delegate, callback, true); - }, - - ready: onReady, - - /** - * Modified - * Triggers browser event - * @param String eventName - * @param Object data - Add properties to event object - */ - trigger: function (eventName, data) { - if (document.createEvent) { - var evt = document.createEvent('HTMLEvents'); - evt.initEvent(eventName, true, false); - evt = this.extend(evt, data); - return this.each(function (v) { - return v.dispatchEvent(evt); - }); - } - } - - }); - - function encode(name, value) { - return "&" + encodeURIComponent(name) + "=" + encodeURIComponent(value).replace(/%20/g, "+"); - } - - function getSelectMultiple_(el) { - var values = []; - each(el.options, function (o) { - if (o.selected) { - values.push(o.value); - } - }); - return values.length ? values : null; - } - - function getSelectSingle_(el) { - var selectedIndex = el.selectedIndex; - return selectedIndex >= 0 ? el.options[selectedIndex].value : null; - } - - function getValue(el) { - var type = el.type; - if (!type) { - return null; - } - switch (type.toLowerCase()) { - case "select-one": - return getSelectSingle_(el); - case "select-multiple": - return getSelectMultiple_(el); - case "radio": - return el.checked ? el.value : null; - case "checkbox": - return el.checked ? el.value : null; - default: - return el.value ? el.value : null; - } - } - - fn.extend({ - serialize: function () { - var query = ""; - - each(this[0].elements || this, function (el) { - if (el.disabled || el.tagName === "FIELDSET") { - return; - } - var name = el.name; - switch (el.type.toLowerCase()) { - case "file": - case "reset": - case "submit": - case "button": - break; - case "select-multiple": - var values = getValue(el); - if (values !== null) { - each(values, function (value) { - query += encode(name, value); - }); - } - break; - default: - var value = getValue(el); - if (value !== null) { - query += encode(name, value); - } - } - }); - - return query.substr(1); - }, - - val: function (value) { - if (value === undefined) { - return getValue(this[0]); - } - - return this.each(function (v) { - return v.value = value; - }); - } - - }); - - function insertElement(el, child, prepend) { - if (prepend) { - var first = el.childNodes[0]; - el.insertBefore(child, first); - } else { - el.appendChild(child); - } - } - - function insertContent(parent, child, prepend) { - var str = isString(child); - - if (!str && child.length) { - each(child, function (v) { - return insertContent(parent, v, prepend); - }); - return; - } - - each(parent, str ? function (v) { - return v.insertAdjacentHTML(prepend ? "afterbegin" : "beforeend", child); - } : function (v, i) { - return insertElement(v, i === 0 ? child : child.cloneNode(true), prepend); - }); - } - - fn.extend({ - after: function (selector) { - cash(selector).insertAfter(this); - return this; - }, - - append: function (content) { - insertContent(this, content); - return this; - }, - - appendTo: function (parent) { - insertContent(cash(parent), this); - return this; - }, - - before: function (selector) { - cash(selector).insertBefore(this); - return this; - }, - - clone: function () { - return cash(this.map(function (v) { - return v.cloneNode(true); - })); - }, - - empty: function () { - this.html(""); - return this; - }, - - html: function (content) { - if (content === undefined) { - return this[0].innerHTML; - } - var source = content.nodeType ? content[0].outerHTML : content; - return this.each(function (v) { - return v.innerHTML = source; - }); - }, - - insertAfter: function (selector) { - var _this = this; - - cash(selector).each(function (el, i) { - var parent = el.parentNode, - sibling = el.nextSibling; - _this.each(function (v) { - parent.insertBefore(i === 0 ? v : v.cloneNode(true), sibling); - }); - }); - - return this; - }, - - insertBefore: function (selector) { - var _this2 = this; - cash(selector).each(function (el, i) { - var parent = el.parentNode; - _this2.each(function (v) { - parent.insertBefore(i === 0 ? v : v.cloneNode(true), el); - }); - }); - return this; - }, - - prepend: function (content) { - insertContent(this, content, true); - return this; - }, - - prependTo: function (parent) { - insertContent(cash(parent), this, true); - return this; - }, - - remove: function () { - return this.each(function (v) { - if (!!v.parentNode) { - return v.parentNode.removeChild(v); - } - }); - }, - - text: function (content) { - if (content === undefined) { - return this[0].textContent; - } - return this.each(function (v) { - return v.textContent = content; - }); - } - - }); - - var docEl = doc.documentElement; - - fn.extend({ - position: function () { - var el = this[0]; - return { - left: el.offsetLeft, - top: el.offsetTop - }; - }, - - offset: function () { - var rect = this[0].getBoundingClientRect(); - return { - top: rect.top + win.pageYOffset - docEl.clientTop, - left: rect.left + win.pageXOffset - docEl.clientLeft - }; - }, - - offsetParent: function () { - return cash(this[0].offsetParent); - } - - }); - - fn.extend({ - children: function (selector) { - var elems = []; - this.each(function (el) { - push.apply(elems, el.children); - }); - elems = unique(elems); - - return !selector ? elems : elems.filter(function (v) { - return matches(v, selector); - }); - }, - - closest: function (selector) { - if (!selector || this.length < 1) { - return cash(); - } - if (this.is(selector)) { - return this.filter(selector); - } - return this.parent().closest(selector); - }, - - is: function (selector) { - if (!selector) { - return false; - } - - var match = false, - comparator = getCompareFunction(selector); - - this.each(function (el) { - match = comparator(el, selector); - return !match; - }); - - return match; - }, - - find: function (selector) { - if (!selector || selector.nodeType) { - return cash(selector && this.has(selector).length ? selector : null); - } - - var elems = []; - this.each(function (el) { - push.apply(elems, find(selector, el)); - }); - - return unique(elems); - }, - - has: function (selector) { - var comparator = isString(selector) ? function (el) { - return find(selector, el).length !== 0; - } : function (el) { - return el.contains(selector); - }; - - return this.filter(comparator); - }, - - next: function () { - return cash(this[0].nextElementSibling); - }, - - not: function (selector) { - if (!selector) { - return this; - } - - var comparator = getCompareFunction(selector); - - return this.filter(function (el) { - return !comparator(el, selector); - }); - }, - - parent: function () { - var result = []; - - this.each(function (item) { - if (item && item.parentNode) { - result.push(item.parentNode); - } - }); - - return unique(result); - }, - - parents: function (selector) { - var last, - result = []; - - this.each(function (item) { - last = item; - - while (last && last.parentNode && last !== doc.body.parentNode) { - last = last.parentNode; - - if (!selector || selector && matches(last, selector)) { - result.push(last); - } - } - }); - - return unique(result); - }, - - prev: function () { - return cash(this[0].previousElementSibling); - }, - - siblings: function (selector) { - var collection = this.parent().children(selector), - el = this[0]; - - return collection.filter(function (i) { - return i !== el; - }); - } - - }); - - return cash; -}); -; -var Component = function () { - /** - * Generic constructor for all components - * @constructor - * @param {Element} el - * @param {Object} options - */ - function Component(classDef, el, options) { - _classCallCheck(this, Component); - - // Display error if el is valid HTML Element - if (!(el instanceof Element)) { - console.error(Error(el + ' is not an HTML Element')); - } - - // If exists, destroy and reinitialize in child - var ins = classDef.getInstance(el); - if (!!ins) { - ins.destroy(); - } - - this.el = el; - this.$el = cash(el); - } - - /** - * Initializes components - * @param {class} classDef - * @param {Element | NodeList | jQuery} els - * @param {Object} options - */ - - - _createClass(Component, null, [{ - key: "init", - value: function init(classDef, els, options) { - var instances = null; - if (els instanceof Element) { - instances = new classDef(els, options); - } else if (!!els && (els.jquery || els.cash || els instanceof NodeList)) { - var instancesArr = []; - for (var i = 0; i < els.length; i++) { - instancesArr.push(new classDef(els[i], options)); - } - instances = instancesArr; - } - - return instances; - } - }]); - - return Component; -}(); - -; // Required for Meteor package, the use of window prevents export by Meteor -(function (window) { - if (window.Package) { - M = {}; - } else { - window.M = {}; - } - - // Check for jQuery - M.jQueryLoaded = !!window.jQuery; -})(window); - -// AMD -if (typeof define === 'function' && define.amd) { - define('M', [], function () { - return M; - }); - - // Common JS -} else if (typeof exports !== 'undefined' && !exports.nodeType) { - if (typeof module !== 'undefined' && !module.nodeType && module.exports) { - exports = module.exports = M; - } - exports.default = M; -} - -M.version = '1.0.0'; - -M.keys = { - TAB: 9, - ENTER: 13, - ESC: 27, - ARROW_UP: 38, - ARROW_DOWN: 40 -}; - -/** - * TabPress Keydown handler - */ -M.tabPressed = false; -M.keyDown = false; -var docHandleKeydown = function (e) { - M.keyDown = true; - if (e.which === M.keys.TAB || e.which === M.keys.ARROW_DOWN || e.which === M.keys.ARROW_UP) { - M.tabPressed = true; - } -}; -var docHandleKeyup = function (e) { - M.keyDown = false; - if (e.which === M.keys.TAB || e.which === M.keys.ARROW_DOWN || e.which === M.keys.ARROW_UP) { - M.tabPressed = false; - } -}; -var docHandleFocus = function (e) { - if (M.keyDown) { - document.body.classList.add('keyboard-focused'); - } -}; -var docHandleBlur = function (e) { - document.body.classList.remove('keyboard-focused'); -}; -document.addEventListener('keydown', docHandleKeydown, true); -document.addEventListener('keyup', docHandleKeyup, true); -document.addEventListener('focus', docHandleFocus, true); -document.addEventListener('blur', docHandleBlur, true); - -/** - * Initialize jQuery wrapper for plugin - * @param {Class} plugin javascript class - * @param {string} pluginName jQuery plugin name - * @param {string} classRef Class reference name - */ -M.initializeJqueryWrapper = function (plugin, pluginName, classRef) { - jQuery.fn[pluginName] = function (methodOrOptions) { - // Call plugin method if valid method name is passed in - if (plugin.prototype[methodOrOptions]) { - var params = Array.prototype.slice.call(arguments, 1); - - // Getter methods - if (methodOrOptions.slice(0, 3) === 'get') { - var instance = this.first()[0][classRef]; - return instance[methodOrOptions].apply(instance, params); - } - - // Void methods - return this.each(function () { - var instance = this[classRef]; - instance[methodOrOptions].apply(instance, params); - }); - - // Initialize plugin if options or no argument is passed in - } else if (typeof methodOrOptions === 'object' || !methodOrOptions) { - plugin.init(this, arguments[0]); - return this; - } - - // Return error if an unrecognized method name is passed in - jQuery.error("Method " + methodOrOptions + " does not exist on jQuery." + pluginName); - }; -}; - -/** - * Automatically initialize components - * @param {Element} context DOM Element to search within for components - */ -M.AutoInit = function (context) { - // Use document.body if no context is given - var root = !!context ? context : document.body; - - var registry = { - Autocomplete: root.querySelectorAll('.autocomplete:not(.no-autoinit)'), - Carousel: root.querySelectorAll('.carousel:not(.no-autoinit)'), - Chips: root.querySelectorAll('.chips:not(.no-autoinit)'), - Collapsible: root.querySelectorAll('.collapsible:not(.no-autoinit)'), - Datepicker: root.querySelectorAll('.datepicker:not(.no-autoinit)'), - Dropdown: root.querySelectorAll('.dropdown-trigger:not(.no-autoinit)'), - Materialbox: root.querySelectorAll('.materialboxed:not(.no-autoinit)'), - Modal: root.querySelectorAll('.modal:not(.no-autoinit)'), - Parallax: root.querySelectorAll('.parallax:not(.no-autoinit)'), - Pushpin: root.querySelectorAll('.pushpin:not(.no-autoinit)'), - ScrollSpy: root.querySelectorAll('.scrollspy:not(.no-autoinit)'), - FormSelect: root.querySelectorAll('select:not(.no-autoinit)'), - Sidenav: root.querySelectorAll('.sidenav:not(.no-autoinit)'), - Tabs: root.querySelectorAll('.tabs:not(.no-autoinit)'), - TapTarget: root.querySelectorAll('.tap-target:not(.no-autoinit)'), - Timepicker: root.querySelectorAll('.timepicker:not(.no-autoinit)'), - Tooltip: root.querySelectorAll('.tooltipped:not(.no-autoinit)'), - FloatingActionButton: root.querySelectorAll('.fixed-action-btn:not(.no-autoinit)') - }; - - for (var pluginName in registry) { - var plugin = M[pluginName]; - plugin.init(registry[pluginName]); - } -}; - -/** - * Generate approximated selector string for a jQuery object - * @param {jQuery} obj jQuery object to be parsed - * @returns {string} - */ -M.objectSelectorString = function (obj) { - var tagStr = obj.prop('tagName') || ''; - var idStr = obj.attr('id') || ''; - var classStr = obj.attr('class') || ''; - return (tagStr + idStr + classStr).replace(/\s/g, ''); -}; - -// Unique Random ID -M.guid = function () { - function s4() { - return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); - } - return function () { - return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4(); - }; -}(); - -/** - * Escapes hash from special characters - * @param {string} hash String returned from this.hash - * @returns {string} - */ -M.escapeHash = function (hash) { - return hash.replace(/(:|\.|\[|\]|,|=|\/)/g, '\\$1'); -}; - -/** - * @typedef {Object} Edges - * @property {Boolean} top If the top edge was exceeded - * @property {Boolean} right If the right edge was exceeded - * @property {Boolean} bottom If the bottom edge was exceeded - * @property {Boolean} left If the left edge was exceeded - */ - -/** - * @typedef {Object} Bounding - * @property {Number} left left offset coordinate - * @property {Number} top top offset coordinate - * @property {Number} width - * @property {Number} height - */ - -/** - * Escapes hash from special characters - * @param {Element} container Container element that acts as the boundary - * @param {Bounding} bounding element bounding that is being checked - * @param {Number} offset offset from edge that counts as exceeding - * @returns {Edges} - */ -M.checkWithinContainer = function (container, bounding, offset) { - var edges = { - top: false, - right: false, - bottom: false, - left: false - }; - - var containerRect = container.getBoundingClientRect(); - // If body element is smaller than viewport, use viewport height instead. - var containerBottom = container === document.body ? Math.max(containerRect.bottom, window.innerHeight) : containerRect.bottom; - - var scrollLeft = container.scrollLeft; - var scrollTop = container.scrollTop; - - var scrolledX = bounding.left - scrollLeft; - var scrolledY = bounding.top - scrollTop; - - // Check for container and viewport for each edge - if (scrolledX < containerRect.left + offset || scrolledX < offset) { - edges.left = true; - } - - if (scrolledX + bounding.width > containerRect.right - offset || scrolledX + bounding.width > window.innerWidth - offset) { - edges.right = true; - } - - if (scrolledY < containerRect.top + offset || scrolledY < offset) { - edges.top = true; - } - - if (scrolledY + bounding.height > containerBottom - offset || scrolledY + bounding.height > window.innerHeight - offset) { - edges.bottom = true; - } - - return edges; -}; - -M.checkPossibleAlignments = function (el, container, bounding, offset) { - var canAlign = { - top: true, - right: true, - bottom: true, - left: true, - spaceOnTop: null, - spaceOnRight: null, - spaceOnBottom: null, - spaceOnLeft: null - }; - - var containerAllowsOverflow = getComputedStyle(container).overflow === 'visible'; - var containerRect = container.getBoundingClientRect(); - var containerHeight = Math.min(containerRect.height, window.innerHeight); - var containerWidth = Math.min(containerRect.width, window.innerWidth); - var elOffsetRect = el.getBoundingClientRect(); - - var scrollLeft = container.scrollLeft; - var scrollTop = container.scrollTop; - - var scrolledX = bounding.left - scrollLeft; - var scrolledYTopEdge = bounding.top - scrollTop; - var scrolledYBottomEdge = bounding.top + elOffsetRect.height - scrollTop; - - // Check for container and viewport for left - canAlign.spaceOnRight = !containerAllowsOverflow ? containerWidth - (scrolledX + bounding.width) : window.innerWidth - (elOffsetRect.left + bounding.width); - if (canAlign.spaceOnRight < 0) { - canAlign.left = false; - } - - // Check for container and viewport for Right - canAlign.spaceOnLeft = !containerAllowsOverflow ? scrolledX - bounding.width + elOffsetRect.width : elOffsetRect.right - bounding.width; - if (canAlign.spaceOnLeft < 0) { - canAlign.right = false; - } - - // Check for container and viewport for Top - canAlign.spaceOnBottom = !containerAllowsOverflow ? containerHeight - (scrolledYTopEdge + bounding.height + offset) : window.innerHeight - (elOffsetRect.top + bounding.height + offset); - if (canAlign.spaceOnBottom < 0) { - canAlign.top = false; - } - - // Check for container and viewport for Bottom - canAlign.spaceOnTop = !containerAllowsOverflow ? scrolledYBottomEdge - (bounding.height - offset) : elOffsetRect.bottom - (bounding.height + offset); - if (canAlign.spaceOnTop < 0) { - canAlign.bottom = false; - } - - return canAlign; -}; - -M.getOverflowParent = function (element) { - if (element == null) { - return null; - } - - if (element === document.body || getComputedStyle(element).overflow !== 'visible') { - return element; - } - - return M.getOverflowParent(element.parentElement); -}; - -/** - * Gets id of component from a trigger - * @param {Element} trigger trigger - * @returns {string} - */ -M.getIdFromTrigger = function (trigger) { - var id = trigger.getAttribute('data-target'); - if (!id) { - id = trigger.getAttribute('href'); - if (id) { - id = id.slice(1); - } else { - id = ''; - } - } - return id; -}; - -/** - * Multi browser support for document scroll top - * @returns {Number} - */ -M.getDocumentScrollTop = function () { - return window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0; -}; - -/** - * Multi browser support for document scroll left - * @returns {Number} - */ -M.getDocumentScrollLeft = function () { - return window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft || 0; -}; - -/** - * @typedef {Object} Edges - * @property {Boolean} top If the top edge was exceeded - * @property {Boolean} right If the right edge was exceeded - * @property {Boolean} bottom If the bottom edge was exceeded - * @property {Boolean} left If the left edge was exceeded - */ - -/** - * @typedef {Object} Bounding - * @property {Number} left left offset coordinate - * @property {Number} top top offset coordinate - * @property {Number} width - * @property {Number} height - */ - -/** - * Get time in ms - * @license https://raw.github.com/jashkenas/underscore/master/LICENSE - * @type {function} - * @return {number} - */ -var getTime = Date.now || function () { - return new Date().getTime(); -}; - -/** - * Returns a function, that, when invoked, will only be triggered at most once - * during a given window of time. Normally, the throttled function will run - * as much as it can, without ever going more than once per `wait` duration; - * but if you'd like to disable the execution on the leading edge, pass - * `{leading: false}`. To disable execution on the trailing edge, ditto. - * @license https://raw.github.com/jashkenas/underscore/master/LICENSE - * @param {function} func - * @param {number} wait - * @param {Object=} options - * @returns {Function} - */ -M.throttle = function (func, wait, options) { - var context = void 0, - args = void 0, - result = void 0; - var timeout = null; - var previous = 0; - options || (options = {}); - var later = function () { - previous = options.leading === false ? 0 : getTime(); - timeout = null; - result = func.apply(context, args); - context = args = null; - }; - return function () { - var now = getTime(); - if (!previous && options.leading === false) previous = now; - var remaining = wait - (now - previous); - context = this; - args = arguments; - if (remaining <= 0) { - clearTimeout(timeout); - timeout = null; - previous = now; - result = func.apply(context, args); - context = args = null; - } else if (!timeout && options.trailing !== false) { - timeout = setTimeout(later, remaining); - } - return result; - }; -}; - -/* Feature detection */ -var passiveIfSupported = false; -try { - window.addEventListener("test", null, Object.defineProperty({}, "passive", { - get: function () { - passiveIfSupported = { passive: false }; - } - })); -} catch (err) {} -; /* - v2.2.0 - 2017 Julian Garnier - Released under the MIT license - */ -var $jscomp = { scope: {} };$jscomp.defineProperty = "function" == typeof Object.defineProperties ? Object.defineProperty : function (e, r, p) { - if (p.get || p.set) throw new TypeError("ES3 does not support getters and setters.");e != Array.prototype && e != Object.prototype && (e[r] = p.value); -};$jscomp.getGlobal = function (e) { - return "undefined" != typeof window && window === e ? e : "undefined" != typeof global && null != global ? global : e; -};$jscomp.global = $jscomp.getGlobal(this);$jscomp.SYMBOL_PREFIX = "jscomp_symbol_"; -$jscomp.initSymbol = function () { - $jscomp.initSymbol = function () {};$jscomp.global.Symbol || ($jscomp.global.Symbol = $jscomp.Symbol); -};$jscomp.symbolCounter_ = 0;$jscomp.Symbol = function (e) { - return $jscomp.SYMBOL_PREFIX + (e || "") + $jscomp.symbolCounter_++; -}; -$jscomp.initSymbolIterator = function () { - $jscomp.initSymbol();var e = $jscomp.global.Symbol.iterator;e || (e = $jscomp.global.Symbol.iterator = $jscomp.global.Symbol("iterator"));"function" != typeof Array.prototype[e] && $jscomp.defineProperty(Array.prototype, e, { configurable: !0, writable: !0, value: function () { - return $jscomp.arrayIterator(this); - } });$jscomp.initSymbolIterator = function () {}; -};$jscomp.arrayIterator = function (e) { - var r = 0;return $jscomp.iteratorPrototype(function () { - return r < e.length ? { done: !1, value: e[r++] } : { done: !0 }; - }); -}; -$jscomp.iteratorPrototype = function (e) { - $jscomp.initSymbolIterator();e = { next: e };e[$jscomp.global.Symbol.iterator] = function () { - return this; - };return e; -};$jscomp.array = $jscomp.array || {};$jscomp.iteratorFromArray = function (e, r) { - $jscomp.initSymbolIterator();e instanceof String && (e += "");var p = 0, - m = { next: function () { - if (p < e.length) { - var u = p++;return { value: r(u, e[u]), done: !1 }; - }m.next = function () { - return { done: !0, value: void 0 }; - };return m.next(); - } };m[Symbol.iterator] = function () { - return m; - };return m; -}; -$jscomp.polyfill = function (e, r, p, m) { - if (r) { - p = $jscomp.global;e = e.split(".");for (m = 0; m < e.length - 1; m++) { - var u = e[m];u in p || (p[u] = {});p = p[u]; - }e = e[e.length - 1];m = p[e];r = r(m);r != m && null != r && $jscomp.defineProperty(p, e, { configurable: !0, writable: !0, value: r }); - } -};$jscomp.polyfill("Array.prototype.keys", function (e) { - return e ? e : function () { - return $jscomp.iteratorFromArray(this, function (e) { - return e; - }); - }; -}, "es6-impl", "es3");var $jscomp$this = this; -(function (r) { - M.anime = r(); -})(function () { - function e(a) { - if (!h.col(a)) try { - return document.querySelectorAll(a); - } catch (c) {} - }function r(a, c) { - for (var d = a.length, b = 2 <= arguments.length ? arguments[1] : void 0, f = [], n = 0; n < d; n++) { - if (n in a) { - var k = a[n];c.call(b, k, n, a) && f.push(k); - } - }return f; - }function p(a) { - return a.reduce(function (a, d) { - return a.concat(h.arr(d) ? p(d) : d); - }, []); - }function m(a) { - if (h.arr(a)) return a; - h.str(a) && (a = e(a) || a);return a instanceof NodeList || a instanceof HTMLCollection ? [].slice.call(a) : [a]; - }function u(a, c) { - return a.some(function (a) { - return a === c; - }); - }function C(a) { - var c = {}, - d;for (d in a) { - c[d] = a[d]; - }return c; - }function D(a, c) { - var d = C(a), - b;for (b in a) { - d[b] = c.hasOwnProperty(b) ? c[b] : a[b]; - }return d; - }function z(a, c) { - var d = C(a), - b;for (b in c) { - d[b] = h.und(a[b]) ? c[b] : a[b]; - }return d; - }function T(a) { - a = a.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i, function (a, c, d, k) { - return c + c + d + d + k + k; - });var c = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a); - a = parseInt(c[1], 16);var d = parseInt(c[2], 16), - c = parseInt(c[3], 16);return "rgba(" + a + "," + d + "," + c + ",1)"; - }function U(a) { - function c(a, c, b) { - 0 > b && (b += 1);1 < b && --b;return b < 1 / 6 ? a + 6 * (c - a) * b : .5 > b ? c : b < 2 / 3 ? a + (c - a) * (2 / 3 - b) * 6 : a; - }var d = /hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(a) || /hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(a);a = parseInt(d[1]) / 360;var b = parseInt(d[2]) / 100, - f = parseInt(d[3]) / 100, - d = d[4] || 1;if (0 == b) f = b = a = f;else { - var n = .5 > f ? f * (1 + b) : f + b - f * b, - k = 2 * f - n, - f = c(k, n, a + 1 / 3), - b = c(k, n, a);a = c(k, n, a - 1 / 3); - }return "rgba(" + 255 * f + "," + 255 * b + "," + 255 * a + "," + d + ")"; - }function y(a) { - if (a = /([\+\-]?[0-9#\.]+)(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/.exec(a)) return a[2]; - }function V(a) { - if (-1 < a.indexOf("translate") || "perspective" === a) return "px";if (-1 < a.indexOf("rotate") || -1 < a.indexOf("skew")) return "deg"; - }function I(a, c) { - return h.fnc(a) ? a(c.target, c.id, c.total) : a; - }function E(a, c) { - if (c in a.style) return getComputedStyle(a).getPropertyValue(c.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase()) || "0"; - }function J(a, c) { - if (h.dom(a) && u(W, c)) return "transform";if (h.dom(a) && (a.getAttribute(c) || h.svg(a) && a[c])) return "attribute";if (h.dom(a) && "transform" !== c && E(a, c)) return "css";if (null != a[c]) return "object"; - }function X(a, c) { - var d = V(c), - d = -1 < c.indexOf("scale") ? 1 : 0 + d;a = a.style.transform;if (!a) return d;for (var b = [], f = [], n = [], k = /(\w+)\((.+?)\)/g; b = k.exec(a);) { - f.push(b[1]), n.push(b[2]); - }a = r(n, function (a, b) { - return f[b] === c; - });return a.length ? a[0] : d; - }function K(a, c) { - switch (J(a, c)) {case "transform": - return X(a, c);case "css": - return E(a, c);case "attribute": - return a.getAttribute(c);}return a[c] || 0; - }function L(a, c) { - var d = /^(\*=|\+=|-=)/.exec(a);if (!d) return a;var b = y(a) || 0;c = parseFloat(c);a = parseFloat(a.replace(d[0], ""));switch (d[0][0]) {case "+": - return c + a + b;case "-": - return c - a + b;case "*": - return c * a + b;} - }function F(a, c) { - return Math.sqrt(Math.pow(c.x - a.x, 2) + Math.pow(c.y - a.y, 2)); - }function M(a) { - a = a.points;for (var c = 0, d, b = 0; b < a.numberOfItems; b++) { - var f = a.getItem(b);0 < b && (c += F(d, f));d = f; - }return c; - }function N(a) { - if (a.getTotalLength) return a.getTotalLength();switch (a.tagName.toLowerCase()) {case "circle": - return 2 * Math.PI * a.getAttribute("r");case "rect": - return 2 * a.getAttribute("width") + 2 * a.getAttribute("height");case "line": - return F({ x: a.getAttribute("x1"), y: a.getAttribute("y1") }, { x: a.getAttribute("x2"), y: a.getAttribute("y2") });case "polyline": - return M(a);case "polygon": - var c = a.points;return M(a) + F(c.getItem(c.numberOfItems - 1), c.getItem(0));} - }function Y(a, c) { - function d(b) { - b = void 0 === b ? 0 : b;return a.el.getPointAtLength(1 <= c + b ? c + b : 0); - }var b = d(), - f = d(-1), - n = d(1);switch (a.property) {case "x": - return b.x;case "y": - return b.y; - case "angle": - return 180 * Math.atan2(n.y - f.y, n.x - f.x) / Math.PI;} - }function O(a, c) { - var d = /-?\d*\.?\d+/g, - b;b = h.pth(a) ? a.totalLength : a;if (h.col(b)) { - if (h.rgb(b)) { - var f = /rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(b);b = f ? "rgba(" + f[1] + ",1)" : b; - } else b = h.hex(b) ? T(b) : h.hsl(b) ? U(b) : void 0; - } else f = (f = y(b)) ? b.substr(0, b.length - f.length) : b, b = c && !/\s/g.test(b) ? f + c : f;b += "";return { original: b, numbers: b.match(d) ? b.match(d).map(Number) : [0], strings: h.str(a) || c ? b.split(d) : [] }; - }function P(a) { - a = a ? p(h.arr(a) ? a.map(m) : m(a)) : [];return r(a, function (a, d, b) { - return b.indexOf(a) === d; - }); - }function Z(a) { - var c = P(a);return c.map(function (a, b) { - return { target: a, id: b, total: c.length }; - }); - }function aa(a, c) { - var d = C(c);if (h.arr(a)) { - var b = a.length;2 !== b || h.obj(a[0]) ? h.fnc(c.duration) || (d.duration = c.duration / b) : a = { value: a }; - }return m(a).map(function (a, b) { - b = b ? 0 : c.delay;a = h.obj(a) && !h.pth(a) ? a : { value: a };h.und(a.delay) && (a.delay = b);return a; - }).map(function (a) { - return z(a, d); - }); - }function ba(a, c) { - var d = {}, - b;for (b in a) { - var f = I(a[b], c);h.arr(f) && (f = f.map(function (a) { - return I(a, c); - }), 1 === f.length && (f = f[0]));d[b] = f; - }d.duration = parseFloat(d.duration);d.delay = parseFloat(d.delay);return d; - }function ca(a) { - return h.arr(a) ? A.apply(this, a) : Q[a]; - }function da(a, c) { - var d;return a.tweens.map(function (b) { - b = ba(b, c);var f = b.value, - e = K(c.target, a.name), - k = d ? d.to.original : e, - k = h.arr(f) ? f[0] : k, - w = L(h.arr(f) ? f[1] : f, k), - e = y(w) || y(k) || y(e);b.from = O(k, e);b.to = O(w, e);b.start = d ? d.end : a.offset;b.end = b.start + b.delay + b.duration;b.easing = ca(b.easing);b.elasticity = (1E3 - Math.min(Math.max(b.elasticity, 1), 999)) / 1E3;b.isPath = h.pth(f);b.isColor = h.col(b.from.original);b.isColor && (b.round = 1);return d = b; - }); - }function ea(a, c) { - return r(p(a.map(function (a) { - return c.map(function (b) { - var c = J(a.target, b.name);if (c) { - var d = da(b, a);b = { type: c, property: b.name, animatable: a, tweens: d, duration: d[d.length - 1].end, delay: d[0].delay }; - } else b = void 0;return b; - }); - })), function (a) { - return !h.und(a); - }); - }function R(a, c, d, b) { - var f = "delay" === a;return c.length ? (f ? Math.min : Math.max).apply(Math, c.map(function (b) { - return b[a]; - })) : f ? b.delay : d.offset + b.delay + b.duration; - }function fa(a) { - var c = D(ga, a), - d = D(S, a), - b = Z(a.targets), - f = [], - e = z(c, d), - k;for (k in a) { - e.hasOwnProperty(k) || "targets" === k || f.push({ name: k, offset: e.offset, tweens: aa(a[k], d) }); - }a = ea(b, f);return z(c, { children: [], animatables: b, animations: a, duration: R("duration", a, c, d), delay: R("delay", a, c, d) }); - }function q(a) { - function c() { - return window.Promise && new Promise(function (a) { - return p = a; - }); - }function d(a) { - return g.reversed ? g.duration - a : a; - }function b(a) { - for (var b = 0, c = {}, d = g.animations, f = d.length; b < f;) { - var e = d[b], - k = e.animatable, - h = e.tweens, - n = h.length - 1, - l = h[n];n && (l = r(h, function (b) { - return a < b.end; - })[0] || l);for (var h = Math.min(Math.max(a - l.start - l.delay, 0), l.duration) / l.duration, w = isNaN(h) ? 1 : l.easing(h, l.elasticity), h = l.to.strings, p = l.round, n = [], m = void 0, m = l.to.numbers.length, t = 0; t < m; t++) { - var x = void 0, - x = l.to.numbers[t], - q = l.from.numbers[t], - x = l.isPath ? Y(l.value, w * x) : q + w * (x - q);p && (l.isColor && 2 < t || (x = Math.round(x * p) / p));n.push(x); - }if (l = h.length) for (m = h[0], w = 0; w < l; w++) { - p = h[w + 1], t = n[w], isNaN(t) || (m = p ? m + (t + p) : m + (t + " ")); - } else m = n[0];ha[e.type](k.target, e.property, m, c, k.id);e.currentValue = m;b++; - }if (b = Object.keys(c).length) for (d = 0; d < b; d++) { - H || (H = E(document.body, "transform") ? "transform" : "-webkit-transform"), g.animatables[d].target.style[H] = c[d].join(" "); - }g.currentTime = a;g.progress = a / g.duration * 100; - }function f(a) { - if (g[a]) g[a](g); - }function e() { - g.remaining && !0 !== g.remaining && g.remaining--; - }function k(a) { - var k = g.duration, - n = g.offset, - w = n + g.delay, - r = g.currentTime, - x = g.reversed, - q = d(a);if (g.children.length) { - var u = g.children, - v = u.length; - if (q >= g.currentTime) for (var G = 0; G < v; G++) { - u[G].seek(q); - } else for (; v--;) { - u[v].seek(q); - } - }if (q >= w || !k) g.began || (g.began = !0, f("begin")), f("run");if (q > n && q < k) b(q);else if (q <= n && 0 !== r && (b(0), x && e()), q >= k && r !== k || !k) b(k), x || e();f("update");a >= k && (g.remaining ? (t = h, "alternate" === g.direction && (g.reversed = !g.reversed)) : (g.pause(), g.completed || (g.completed = !0, f("complete"), "Promise" in window && (p(), m = c()))), l = 0); - }a = void 0 === a ? {} : a;var h, - t, - l = 0, - p = null, - m = c(), - g = fa(a);g.reset = function () { - var a = g.direction, - c = g.loop;g.currentTime = 0;g.progress = 0;g.paused = !0;g.began = !1;g.completed = !1;g.reversed = "reverse" === a;g.remaining = "alternate" === a && 1 === c ? 2 : c;b(0);for (a = g.children.length; a--;) { - g.children[a].reset(); - } - };g.tick = function (a) { - h = a;t || (t = h);k((l + h - t) * q.speed); - };g.seek = function (a) { - k(d(a)); - };g.pause = function () { - var a = v.indexOf(g);-1 < a && v.splice(a, 1);g.paused = !0; - };g.play = function () { - g.paused && (g.paused = !1, t = 0, l = d(g.currentTime), v.push(g), B || ia()); - };g.reverse = function () { - g.reversed = !g.reversed;t = 0;l = d(g.currentTime); - };g.restart = function () { - g.pause(); - g.reset();g.play(); - };g.finished = m;g.reset();g.autoplay && g.play();return g; - }var ga = { update: void 0, begin: void 0, run: void 0, complete: void 0, loop: 1, direction: "normal", autoplay: !0, offset: 0 }, - S = { duration: 1E3, delay: 0, easing: "easeOutElastic", elasticity: 500, round: 0 }, - W = "translateX translateY translateZ rotate rotateX rotateY rotateZ scale scaleX scaleY scaleZ skewX skewY perspective".split(" "), - H, - h = { arr: function (a) { - return Array.isArray(a); - }, obj: function (a) { - return -1 < Object.prototype.toString.call(a).indexOf("Object"); - }, - pth: function (a) { - return h.obj(a) && a.hasOwnProperty("totalLength"); - }, svg: function (a) { - return a instanceof SVGElement; - }, dom: function (a) { - return a.nodeType || h.svg(a); - }, str: function (a) { - return "string" === typeof a; - }, fnc: function (a) { - return "function" === typeof a; - }, und: function (a) { - return "undefined" === typeof a; - }, hex: function (a) { - return (/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(a) - ); - }, rgb: function (a) { - return (/^rgb/.test(a) - ); - }, hsl: function (a) { - return (/^hsl/.test(a) - ); - }, col: function (a) { - return h.hex(a) || h.rgb(a) || h.hsl(a); - } }, - A = function () { - function a(a, d, b) { - return (((1 - 3 * b + 3 * d) * a + (3 * b - 6 * d)) * a + 3 * d) * a; - }return function (c, d, b, f) { - if (0 <= c && 1 >= c && 0 <= b && 1 >= b) { - var e = new Float32Array(11);if (c !== d || b !== f) for (var k = 0; 11 > k; ++k) { - e[k] = a(.1 * k, c, b); - }return function (k) { - if (c === d && b === f) return k;if (0 === k) return 0;if (1 === k) return 1;for (var h = 0, l = 1; 10 !== l && e[l] <= k; ++l) { - h += .1; - }--l;var l = h + (k - e[l]) / (e[l + 1] - e[l]) * .1, - n = 3 * (1 - 3 * b + 3 * c) * l * l + 2 * (3 * b - 6 * c) * l + 3 * c;if (.001 <= n) { - for (h = 0; 4 > h; ++h) { - n = 3 * (1 - 3 * b + 3 * c) * l * l + 2 * (3 * b - 6 * c) * l + 3 * c;if (0 === n) break;var m = a(l, c, b) - k, - l = l - m / n; - }k = l; - } else if (0 === n) k = l;else { - var l = h, - h = h + .1, - g = 0;do { - m = l + (h - l) / 2, n = a(m, c, b) - k, 0 < n ? h = m : l = m; - } while (1e-7 < Math.abs(n) && 10 > ++g);k = m; - }return a(k, d, f); - }; - } - }; - }(), - Q = function () { - function a(a, b) { - return 0 === a || 1 === a ? a : -Math.pow(2, 10 * (a - 1)) * Math.sin(2 * (a - 1 - b / (2 * Math.PI) * Math.asin(1)) * Math.PI / b); - }var c = "Quad Cubic Quart Quint Sine Expo Circ Back Elastic".split(" "), - d = { In: [[.55, .085, .68, .53], [.55, .055, .675, .19], [.895, .03, .685, .22], [.755, .05, .855, .06], [.47, 0, .745, .715], [.95, .05, .795, .035], [.6, .04, .98, .335], [.6, -.28, .735, .045], a], Out: [[.25, .46, .45, .94], [.215, .61, .355, 1], [.165, .84, .44, 1], [.23, 1, .32, 1], [.39, .575, .565, 1], [.19, 1, .22, 1], [.075, .82, .165, 1], [.175, .885, .32, 1.275], function (b, c) { - return 1 - a(1 - b, c); - }], InOut: [[.455, .03, .515, .955], [.645, .045, .355, 1], [.77, 0, .175, 1], [.86, 0, .07, 1], [.445, .05, .55, .95], [1, 0, 0, 1], [.785, .135, .15, .86], [.68, -.55, .265, 1.55], function (b, c) { - return .5 > b ? a(2 * b, c) / 2 : 1 - a(-2 * b + 2, c) / 2; - }] }, - b = { linear: A(.25, .25, .75, .75) }, - f = {}, - e;for (e in d) { - f.type = e, d[f.type].forEach(function (a) { - return function (d, f) { - b["ease" + a.type + c[f]] = h.fnc(d) ? d : A.apply($jscomp$this, d); - }; - }(f)), f = { type: f.type }; - }return b; - }(), - ha = { css: function (a, c, d) { - return a.style[c] = d; - }, attribute: function (a, c, d) { - return a.setAttribute(c, d); - }, object: function (a, c, d) { - return a[c] = d; - }, transform: function (a, c, d, b, f) { - b[f] || (b[f] = []);b[f].push(c + "(" + d + ")"); - } }, - v = [], - B = 0, - ia = function () { - function a() { - B = requestAnimationFrame(c); - }function c(c) { - var b = v.length;if (b) { - for (var d = 0; d < b;) { - v[d] && v[d].tick(c), d++; - }a(); - } else cancelAnimationFrame(B), B = 0; - }return a; - }();q.version = "2.2.0";q.speed = 1;q.running = v;q.remove = function (a) { - a = P(a);for (var c = v.length; c--;) { - for (var d = v[c], b = d.animations, f = b.length; f--;) { - u(a, b[f].animatable.target) && (b.splice(f, 1), b.length || d.pause()); - } - } - };q.getValue = K;q.path = function (a, c) { - var d = h.str(a) ? e(a)[0] : a, - b = c || 100;return function (a) { - return { el: d, property: a, totalLength: N(d) * (b / 100) }; - }; - };q.setDashoffset = function (a) { - var c = N(a);a.setAttribute("stroke-dasharray", c);return c; - };q.bezier = A;q.easings = Q;q.timeline = function (a) { - var c = q(a);c.pause();c.duration = 0;c.add = function (d) { - c.children.forEach(function (a) { - a.began = !0;a.completed = !0; - });m(d).forEach(function (b) { - var d = z(b, D(S, a || {}));d.targets = d.targets || a.targets;b = c.duration;var e = d.offset;d.autoplay = !1;d.direction = c.direction;d.offset = h.und(e) ? b : L(e, b);c.began = !0;c.completed = !0;c.seek(d.offset);d = q(d);d.began = !0;d.completed = !0;d.duration > b && (c.duration = d.duration);c.children.push(d); - });c.seek(0);c.reset();c.autoplay && c.restart();return c; - };return c; - };q.random = function (a, c) { - return Math.floor(Math.random() * (c - a + 1)) + a; - };return q; -}); -;(function ($, anim) { - 'use strict'; - - var _defaults = { - accordion: true, - onOpenStart: undefined, - onOpenEnd: undefined, - onCloseStart: undefined, - onCloseEnd: undefined, - inDuration: 300, - outDuration: 300 - }; - - /** - * @class - * - */ - - var Collapsible = function (_Component) { - _inherits(Collapsible, _Component); - - /** - * Construct Collapsible instance - * @constructor - * @param {Element} el - * @param {Object} options - */ - function Collapsible(el, options) { - _classCallCheck(this, Collapsible); - - var _this3 = _possibleConstructorReturn(this, (Collapsible.__proto__ || Object.getPrototypeOf(Collapsible)).call(this, Collapsible, el, options)); - - _this3.el.M_Collapsible = _this3; - - /** - * Options for the collapsible - * @member Collapsible#options - * @prop {Boolean} [accordion=false] - Type of the collapsible - * @prop {Function} onOpenStart - Callback function called before collapsible is opened - * @prop {Function} onOpenEnd - Callback function called after collapsible is opened - * @prop {Function} onCloseStart - Callback function called before collapsible is closed - * @prop {Function} onCloseEnd - Callback function called after collapsible is closed - * @prop {Number} inDuration - Transition in duration in milliseconds. - * @prop {Number} outDuration - Transition duration in milliseconds. - */ - _this3.options = $.extend({}, Collapsible.defaults, options); - - // Setup tab indices - _this3.$headers = _this3.$el.children('li').children('.collapsible-header'); - _this3.$headers.attr('tabindex', 0); - - _this3._setupEventHandlers(); - - // Open first active - var $activeBodies = _this3.$el.children('li.active').children('.collapsible-body'); - if (_this3.options.accordion) { - // Handle Accordion - $activeBodies.first().css('display', 'block'); - } else { - // Handle Expandables - $activeBodies.css('display', 'block'); - } - return _this3; - } - - _createClass(Collapsible, [{ - key: "destroy", - - - /** - * Teardown component - */ - value: function destroy() { - this._removeEventHandlers(); - this.el.M_Collapsible = undefined; - } - - /** - * Setup Event Handlers - */ - - }, { - key: "_setupEventHandlers", - value: function _setupEventHandlers() { - var _this4 = this; - - this._handleCollapsibleClickBound = this._handleCollapsibleClick.bind(this); - this._handleCollapsibleKeydownBound = this._handleCollapsibleKeydown.bind(this); - this.el.addEventListener('click', this._handleCollapsibleClickBound); - this.$headers.each(function (header) { - header.addEventListener('keydown', _this4._handleCollapsibleKeydownBound); - }); - } - - /** - * Remove Event Handlers - */ - - }, { - key: "_removeEventHandlers", - value: function _removeEventHandlers() { - var _this5 = this; - - this.el.removeEventListener('click', this._handleCollapsibleClickBound); - this.$headers.each(function (header) { - header.removeEventListener('keydown', _this5._handleCollapsibleKeydownBound); - }); - } - - /** - * Handle Collapsible Click - * @param {Event} e - */ - - }, { - key: "_handleCollapsibleClick", - value: function _handleCollapsibleClick(e) { - var $header = $(e.target).closest('.collapsible-header'); - if (e.target && $header.length) { - var $collapsible = $header.closest('.collapsible'); - if ($collapsible[0] === this.el) { - var $collapsibleLi = $header.closest('li'); - var $collapsibleLis = $collapsible.children('li'); - var isActive = $collapsibleLi[0].classList.contains('active'); - var index = $collapsibleLis.index($collapsibleLi); - - if (isActive) { - this.close(index); - } else { - this.open(index); - } - } - } - } - - /** - * Handle Collapsible Keydown - * @param {Event} e - */ - - }, { - key: "_handleCollapsibleKeydown", - value: function _handleCollapsibleKeydown(e) { - if (e.keyCode === 13) { - this._handleCollapsibleClickBound(e); - } - } - - /** - * Animate in collapsible slide - * @param {Number} index - 0th index of slide - */ - - }, { - key: "_animateIn", - value: function _animateIn(index) { - var _this6 = this; - - var $collapsibleLi = this.$el.children('li').eq(index); - if ($collapsibleLi.length) { - var $body = $collapsibleLi.children('.collapsible-body'); - - anim.remove($body[0]); - $body.css({ - display: 'block', - overflow: 'hidden', - height: 0, - paddingTop: '', - paddingBottom: '' - }); - - var pTop = $body.css('padding-top'); - var pBottom = $body.css('padding-bottom'); - var finalHeight = $body[0].scrollHeight; - $body.css({ - paddingTop: 0, - paddingBottom: 0 - }); - - anim({ - targets: $body[0], - height: finalHeight, - paddingTop: pTop, - paddingBottom: pBottom, - duration: this.options.inDuration, - easing: 'easeInOutCubic', - complete: function (anim) { - $body.css({ - overflow: '', - paddingTop: '', - paddingBottom: '', - height: '' - }); - - // onOpenEnd callback - if (typeof _this6.options.onOpenEnd === 'function') { - _this6.options.onOpenEnd.call(_this6, $collapsibleLi[0]); - } - } - }); - } - } - - /** - * Animate out collapsible slide - * @param {Number} index - 0th index of slide to open - */ - - }, { - key: "_animateOut", - value: function _animateOut(index) { - var _this7 = this; - - var $collapsibleLi = this.$el.children('li').eq(index); - if ($collapsibleLi.length) { - var $body = $collapsibleLi.children('.collapsible-body'); - anim.remove($body[0]); - $body.css('overflow', 'hidden'); - anim({ - targets: $body[0], - height: 0, - paddingTop: 0, - paddingBottom: 0, - duration: this.options.outDuration, - easing: 'easeInOutCubic', - complete: function () { - $body.css({ - height: '', - overflow: '', - padding: '', - display: '' - }); - - // onCloseEnd callback - if (typeof _this7.options.onCloseEnd === 'function') { - _this7.options.onCloseEnd.call(_this7, $collapsibleLi[0]); - } - } - }); - } - } - - /** - * Open Collapsible - * @param {Number} index - 0th index of slide - */ - - }, { - key: "open", - value: function open(index) { - var _this8 = this; - - var $collapsibleLi = this.$el.children('li').eq(index); - if ($collapsibleLi.length && !$collapsibleLi[0].classList.contains('active')) { - // onOpenStart callback - if (typeof this.options.onOpenStart === 'function') { - this.options.onOpenStart.call(this, $collapsibleLi[0]); - } - - // Handle accordion behavior - if (this.options.accordion) { - var $collapsibleLis = this.$el.children('li'); - var $activeLis = this.$el.children('li.active'); - $activeLis.each(function (el) { - var index = $collapsibleLis.index($(el)); - _this8.close(index); - }); - } - - // Animate in - $collapsibleLi[0].classList.add('active'); - this._animateIn(index); - } - } - - /** - * Close Collapsible - * @param {Number} index - 0th index of slide - */ - - }, { - key: "close", - value: function close(index) { - var $collapsibleLi = this.$el.children('li').eq(index); - if ($collapsibleLi.length && $collapsibleLi[0].classList.contains('active')) { - // onCloseStart callback - if (typeof this.options.onCloseStart === 'function') { - this.options.onCloseStart.call(this, $collapsibleLi[0]); - } - - // Animate out - $collapsibleLi[0].classList.remove('active'); - this._animateOut(index); - } - } - }], [{ - key: "init", - value: function init(els, options) { - return _get(Collapsible.__proto__ || Object.getPrototypeOf(Collapsible), "init", this).call(this, this, els, options); - } - - /** - * Get Instance - */ - - }, { - key: "getInstance", - value: function getInstance(el) { - var domElem = !!el.jquery ? el[0] : el; - return domElem.M_Collapsible; - } - }, { - key: "defaults", - get: function () { - return _defaults; - } - }]); - - return Collapsible; - }(Component); - - M.Collapsible = Collapsible; - - if (M.jQueryLoaded) { - M.initializeJqueryWrapper(Collapsible, 'collapsible', 'M_Collapsible'); - } -})(cash, M.anime); -;(function ($, anim) { - 'use strict'; - - var _defaults = { - alignment: 'left', - autoFocus: true, - constrainWidth: true, - container: null, - coverTrigger: true, - closeOnClick: true, - hover: false, - inDuration: 150, - outDuration: 250, - onOpenStart: null, - onOpenEnd: null, - onCloseStart: null, - onCloseEnd: null, - onItemClick: null - }; - - /** - * @class - */ - - var Dropdown = function (_Component2) { - _inherits(Dropdown, _Component2); - - function Dropdown(el, options) { - _classCallCheck(this, Dropdown); - - var _this9 = _possibleConstructorReturn(this, (Dropdown.__proto__ || Object.getPrototypeOf(Dropdown)).call(this, Dropdown, el, options)); - - _this9.el.M_Dropdown = _this9; - Dropdown._dropdowns.push(_this9); - - _this9.id = M.getIdFromTrigger(el); - _this9.dropdownEl = document.getElementById(_this9.id); - _this9.$dropdownEl = $(_this9.dropdownEl); - - /** - * Options for the dropdown - * @member Dropdown#options - * @prop {String} [alignment='left'] - Edge which the dropdown is aligned to - * @prop {Boolean} [autoFocus=true] - Automatically focus dropdown el for keyboard - * @prop {Boolean} [constrainWidth=true] - Constrain width to width of the button - * @prop {Element} container - Container element to attach dropdown to (optional) - * @prop {Boolean} [coverTrigger=true] - Place dropdown over trigger - * @prop {Boolean} [closeOnClick=true] - Close on click of dropdown item - * @prop {Boolean} [hover=false] - Open dropdown on hover - * @prop {Number} [inDuration=150] - Duration of open animation in ms - * @prop {Number} [outDuration=250] - Duration of close animation in ms - * @prop {Function} onOpenStart - Function called when dropdown starts opening - * @prop {Function} onOpenEnd - Function called when dropdown finishes opening - * @prop {Function} onCloseStart - Function called when dropdown starts closing - * @prop {Function} onCloseEnd - Function called when dropdown finishes closing - */ - _this9.options = $.extend({}, Dropdown.defaults, options); - - /** - * Describes open/close state of dropdown - * @type {Boolean} - */ - _this9.isOpen = false; - - /** - * Describes if dropdown content is scrollable - * @type {Boolean} - */ - _this9.isScrollable = false; - - /** - * Describes if touch moving on dropdown content - * @type {Boolean} - */ - _this9.isTouchMoving = false; - - _this9.focusedIndex = -1; - _this9.filterQuery = []; - - // Move dropdown-content after dropdown-trigger - _this9._moveDropdown(); - - _this9._makeDropdownFocusable(); - _this9._resetFilterQueryBound = _this9._resetFilterQuery.bind(_this9); - _this9._handleDocumentClickBound = _this9._handleDocumentClick.bind(_this9); - _this9._handleDocumentTouchmoveBound = _this9._handleDocumentTouchmove.bind(_this9); - _this9._handleDropdownClickBound = _this9._handleDropdownClick.bind(_this9); - _this9._handleDropdownKeydownBound = _this9._handleDropdownKeydown.bind(_this9); - _this9._handleTriggerKeydownBound = _this9._handleTriggerKeydown.bind(_this9); - _this9._setupEventHandlers(); - return _this9; - } - - _createClass(Dropdown, [{ - key: "destroy", - - - /** - * Teardown component - */ - value: function destroy() { - this._resetDropdownStyles(); - this._removeEventHandlers(); - Dropdown._dropdowns.splice(Dropdown._dropdowns.indexOf(this), 1); - this.el.M_Dropdown = undefined; - } - - /** - * Setup Event Handlers - */ - - }, { - key: "_setupEventHandlers", - value: function _setupEventHandlers() { - // Trigger keydown handler - this.el.addEventListener('keydown', this._handleTriggerKeydownBound); - - // Item click handler - this.dropdownEl.addEventListener('click', this._handleDropdownClickBound); - - // Hover event handlers - if (this.options.hover) { - this._handleMouseEnterBound = this._handleMouseEnter.bind(this); - this.el.addEventListener('mouseenter', this._handleMouseEnterBound); - this._handleMouseLeaveBound = this._handleMouseLeave.bind(this); - this.el.addEventListener('mouseleave', this._handleMouseLeaveBound); - this.dropdownEl.addEventListener('mouseleave', this._handleMouseLeaveBound); - - // Click event handlers - } else { - this._handleClickBound = this._handleClick.bind(this); - this.el.addEventListener('click', this._handleClickBound); - } - } - - /** - * Remove Event Handlers - */ - - }, { - key: "_removeEventHandlers", - value: function _removeEventHandlers() { - this.el.removeEventListener('keydown', this._handleTriggerKeydownBound); - this.dropdownEl.removeEventListener('click', this._handleDropdownClickBound); - - if (this.options.hover) { - this.el.removeEventListener('mouseenter', this._handleMouseEnterBound); - this.el.removeEventListener('mouseleave', this._handleMouseLeaveBound); - this.dropdownEl.removeEventListener('mouseleave', this._handleMouseLeaveBound); - } else { - this.el.removeEventListener('click', this._handleClickBound); - } - } - }, { - key: "_setupTemporaryEventHandlers", - value: function _setupTemporaryEventHandlers() { - // Use capture phase event handler to prevent click - document.body.addEventListener('click', this._handleDocumentClickBound, true); - document.body.addEventListener('touchend', this._handleDocumentClickBound); - document.body.addEventListener('touchmove', this._handleDocumentTouchmoveBound); - this.dropdownEl.addEventListener('keydown', this._handleDropdownKeydownBound); - } - }, { - key: "_removeTemporaryEventHandlers", - value: function _removeTemporaryEventHandlers() { - // Use capture phase event handler to prevent click - document.body.removeEventListener('click', this._handleDocumentClickBound, true); - document.body.removeEventListener('touchend', this._handleDocumentClickBound); - document.body.removeEventListener('touchmove', this._handleDocumentTouchmoveBound); - this.dropdownEl.removeEventListener('keydown', this._handleDropdownKeydownBound); - } - }, { - key: "_handleClick", - value: function _handleClick(e) { - e.preventDefault(); - this.open(); - } - }, { - key: "_handleMouseEnter", - value: function _handleMouseEnter() { - this.open(); - } - }, { - key: "_handleMouseLeave", - value: function _handleMouseLeave(e) { - var toEl = e.toElement || e.relatedTarget; - var leaveToDropdownContent = !!$(toEl).closest('.dropdown-content').length; - var leaveToActiveDropdownTrigger = false; - - var $closestTrigger = $(toEl).closest('.dropdown-trigger'); - if ($closestTrigger.length && !!$closestTrigger[0].M_Dropdown && $closestTrigger[0].M_Dropdown.isOpen) { - leaveToActiveDropdownTrigger = true; - } - - // Close hover dropdown if mouse did not leave to either active dropdown-trigger or dropdown-content - if (!leaveToActiveDropdownTrigger && !leaveToDropdownContent) { - this.close(); - } - } - }, { - key: "_handleDocumentClick", - value: function _handleDocumentClick(e) { - var _this10 = this; - - var $target = $(e.target); - if (this.options.closeOnClick && $target.closest('.dropdown-content').length && !this.isTouchMoving) { - // isTouchMoving to check if scrolling on mobile. - setTimeout(function () { - _this10.close(); - }, 0); - } else if ($target.closest('.dropdown-trigger').length || !$target.closest('.dropdown-content').length) { - setTimeout(function () { - _this10.close(); - }, 0); - } - this.isTouchMoving = false; - } - }, { - key: "_handleTriggerKeydown", - value: function _handleTriggerKeydown(e) { - // ARROW DOWN OR ENTER WHEN SELECT IS CLOSED - open Dropdown - if ((e.which === M.keys.ARROW_DOWN || e.which === M.keys.ENTER) && !this.isOpen) { - e.preventDefault(); - this.open(); - } - } - - /** - * Handle Document Touchmove - * @param {Event} e - */ - - }, { - key: "_handleDocumentTouchmove", - value: function _handleDocumentTouchmove(e) { - var $target = $(e.target); - if ($target.closest('.dropdown-content').length) { - this.isTouchMoving = true; - } - } - - /** - * Handle Dropdown Click - * @param {Event} e - */ - - }, { - key: "_handleDropdownClick", - value: function _handleDropdownClick(e) { - // onItemClick callback - if (typeof this.options.onItemClick === 'function') { - var itemEl = $(e.target).closest('li')[0]; - this.options.onItemClick.call(this, itemEl); - } - } - - /** - * Handle Dropdown Keydown - * @param {Event} e - */ - - }, { - key: "_handleDropdownKeydown", - value: function _handleDropdownKeydown(e) { - if (e.which === M.keys.TAB) { - e.preventDefault(); - this.close(); - - // Navigate down dropdown list - } else if ((e.which === M.keys.ARROW_DOWN || e.which === M.keys.ARROW_UP) && this.isOpen) { - e.preventDefault(); - var direction = e.which === M.keys.ARROW_DOWN ? 1 : -1; - var newFocusedIndex = this.focusedIndex; - var foundNewIndex = false; - do { - newFocusedIndex = newFocusedIndex + direction; - - if (!!this.dropdownEl.children[newFocusedIndex] && this.dropdownEl.children[newFocusedIndex].tabIndex !== -1) { - foundNewIndex = true; - break; - } - } while (newFocusedIndex < this.dropdownEl.children.length && newFocusedIndex >= 0); - - if (foundNewIndex) { - // Remove active class from old element - if (this.focusedIndex >= 0) this.dropdownEl.children[this.focusedIndex].classList.remove('active'); - this.focusedIndex = newFocusedIndex; - this._focusFocusedItem(); - } - - // ENTER selects choice on focused item - } else if (e.which === M.keys.ENTER && this.isOpen) { - // Search for and ") + ''; - } - }, { - key: "renderRow", - value: function renderRow(days, isRTL, isRowSelected) { - return '' + (isRTL ? days.reverse() : days).join('') + ''; - } - }, { - key: "renderTable", - value: function renderTable(opts, data, randId) { - return '
' + this.renderHead(opts) + this.renderBody(data) + '
'; - } - }, { - key: "renderHead", - value: function renderHead(opts) { - var i = void 0, - arr = []; - for (i = 0; i < 7; i++) { - arr.push("" + this.renderDayName(opts, i, true) + ""); - } - return '' + (opts.isRTL ? arr.reverse() : arr).join('') + ''; - } - }, { - key: "renderBody", - value: function renderBody(rows) { - return '' + rows.join('') + ''; - } - }, { - key: "renderTitle", - value: function renderTitle(instance, c, year, month, refYear, randId) { - var i = void 0, - j = void 0, - arr = void 0, - opts = this.options, - isMinYear = year === opts.minYear, - isMaxYear = year === opts.maxYear, - html = '
', - monthHtml = void 0, - yearHtml = void 0, - prev = true, - next = true; - - for (arr = [], i = 0; i < 12; i++) { - arr.push(''); - } - - monthHtml = ''; - - if ($.isArray(opts.yearRange)) { - i = opts.yearRange[0]; - j = opts.yearRange[1] + 1; - } else { - i = year - opts.yearRange; - j = 1 + year + opts.yearRange; - } - - for (arr = []; i < j && i <= opts.maxYear; i++) { - if (i >= opts.minYear) { - arr.push(""); - } - } - if (opts.yearRangeReverse) { - arr.reverse(); - } - - yearHtml = ""; - - var leftArrow = ''; - html += ""; - - html += '
'; - if (opts.showMonthAfterYear) { - html += yearHtml + monthHtml; - } else { - html += monthHtml + yearHtml; - } - html += '
'; - - if (isMinYear && (month === 0 || opts.minMonth >= month)) { - prev = false; - } - - if (isMaxYear && (month === 11 || opts.maxMonth <= month)) { - next = false; - } - - var rightArrow = ''; - html += ""; - - return html += '
'; - } - - /** - * refresh the HTML - */ - - }, { - key: "draw", - value: function draw(force) { - if (!this.isOpen && !force) { - return; - } - var opts = this.options, - minYear = opts.minYear, - maxYear = opts.maxYear, - minMonth = opts.minMonth, - maxMonth = opts.maxMonth, - html = '', - randId = void 0; - - if (this._y <= minYear) { - this._y = minYear; - if (!isNaN(minMonth) && this._m < minMonth) { - this._m = minMonth; - } - } - if (this._y >= maxYear) { - this._y = maxYear; - if (!isNaN(maxMonth) && this._m > maxMonth) { - this._m = maxMonth; - } - } - - randId = 'datepicker-title-' + Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 2); - - for (var c = 0; c < 1; c++) { - this._renderDateDisplay(); - html += this.renderTitle(this, c, this.calendars[c].year, this.calendars[c].month, this.calendars[0].year, randId) + this.render(this.calendars[c].year, this.calendars[c].month, randId); - } - - this.destroySelects(); - - this.calendarEl.innerHTML = html; - - // Init Materialize Select - var yearSelect = this.calendarEl.querySelector('.orig-select-year'); - var monthSelect = this.calendarEl.querySelector('.orig-select-month'); - M.FormSelect.init(yearSelect, { - classes: 'select-year', - dropdownOptions: { container: document.body, constrainWidth: false } - }); - M.FormSelect.init(monthSelect, { - classes: 'select-month', - dropdownOptions: { container: document.body, constrainWidth: false } - }); - - // Add change handlers for select - yearSelect.addEventListener('change', this._handleYearChange.bind(this)); - monthSelect.addEventListener('change', this._handleMonthChange.bind(this)); - - if (typeof this.options.onDraw === 'function') { - this.options.onDraw(this); - } - } - - /** - * Setup Event Handlers - */ - - }, { - key: "_setupEventHandlers", - value: function _setupEventHandlers() { - this._handleInputKeydownBound = this._handleInputKeydown.bind(this); - this._handleInputClickBound = this._handleInputClick.bind(this); - this._handleInputChangeBound = this._handleInputChange.bind(this); - this._handleCalendarClickBound = this._handleCalendarClick.bind(this); - this._finishSelectionBound = this._finishSelection.bind(this); - this._handleMonthChange = this._handleMonthChange.bind(this); - this._closeBound = this.close.bind(this); - - this.el.addEventListener('click', this._handleInputClickBound); - this.el.addEventListener('keydown', this._handleInputKeydownBound); - this.el.addEventListener('change', this._handleInputChangeBound); - this.calendarEl.addEventListener('click', this._handleCalendarClickBound); - this.doneBtn.addEventListener('click', this._finishSelectionBound); - this.cancelBtn.addEventListener('click', this._closeBound); - - if (this.options.showClearBtn) { - this._handleClearClickBound = this._handleClearClick.bind(this); - this.clearBtn.addEventListener('click', this._handleClearClickBound); - } - } - }, { - key: "_setupVariables", - value: function _setupVariables() { - var _this56 = this; - - this.$modalEl = $(Datepicker._template); - this.modalEl = this.$modalEl[0]; - - this.calendarEl = this.modalEl.querySelector('.datepicker-calendar'); - - this.yearTextEl = this.modalEl.querySelector('.year-text'); - this.dateTextEl = this.modalEl.querySelector('.date-text'); - if (this.options.showClearBtn) { - this.clearBtn = this.modalEl.querySelector('.datepicker-clear'); - } - this.doneBtn = this.modalEl.querySelector('.datepicker-done'); - this.cancelBtn = this.modalEl.querySelector('.datepicker-cancel'); - - this.formats = { - d: function () { - return _this56.date.getDate(); - }, - dd: function () { - var d = _this56.date.getDate(); - return (d < 10 ? '0' : '') + d; - }, - ddd: function () { - return _this56.options.i18n.weekdaysShort[_this56.date.getDay()]; - }, - dddd: function () { - return _this56.options.i18n.weekdays[_this56.date.getDay()]; - }, - m: function () { - return _this56.date.getMonth() + 1; - }, - mm: function () { - var m = _this56.date.getMonth() + 1; - return (m < 10 ? '0' : '') + m; - }, - mmm: function () { - return _this56.options.i18n.monthsShort[_this56.date.getMonth()]; - }, - mmmm: function () { - return _this56.options.i18n.months[_this56.date.getMonth()]; - }, - yy: function () { - return ('' + _this56.date.getFullYear()).slice(2); - }, - yyyy: function () { - return _this56.date.getFullYear(); - } - }; - } - - /** - * Remove Event Handlers - */ - - }, { - key: "_removeEventHandlers", - value: function _removeEventHandlers() { - this.el.removeEventListener('click', this._handleInputClickBound); - this.el.removeEventListener('keydown', this._handleInputKeydownBound); - this.el.removeEventListener('change', this._handleInputChangeBound); - this.calendarEl.removeEventListener('click', this._handleCalendarClickBound); - } - }, { - key: "_handleInputClick", - value: function _handleInputClick() { - this.open(); - } - }, { - key: "_handleInputKeydown", - value: function _handleInputKeydown(e) { - if (e.which === M.keys.ENTER) { - e.preventDefault(); - this.open(); - } - } - }, { - key: "_handleCalendarClick", - value: function _handleCalendarClick(e) { - if (!this.isOpen) { - return; - } - - var $target = $(e.target); - if (!$target.hasClass('is-disabled')) { - if ($target.hasClass('datepicker-day-button') && !$target.hasClass('is-empty') && !$target.parent().hasClass('is-disabled')) { - this.setDate(new Date(e.target.getAttribute('data-year'), e.target.getAttribute('data-month'), e.target.getAttribute('data-day'))); - if (this.options.autoClose) { - this._finishSelection(); - } - } else if ($target.closest('.month-prev').length) { - this.prevMonth(); - } else if ($target.closest('.month-next').length) { - this.nextMonth(); - } - } - } - }, { - key: "_handleClearClick", - value: function _handleClearClick() { - this.date = null; - this.setInputValue(); - this.close(); - } - }, { - key: "_handleMonthChange", - value: function _handleMonthChange(e) { - this.gotoMonth(e.target.value); - } - }, { - key: "_handleYearChange", - value: function _handleYearChange(e) { - this.gotoYear(e.target.value); - } - - /** - * change view to a specific month (zero-index, e.g. 0: January) - */ - - }, { - key: "gotoMonth", - value: function gotoMonth(month) { - if (!isNaN(month)) { - this.calendars[0].month = parseInt(month, 10); - this.adjustCalendars(); - } - } - - /** - * change view to a specific full year (e.g. "2012") - */ - - }, { - key: "gotoYear", - value: function gotoYear(year) { - if (!isNaN(year)) { - this.calendars[0].year = parseInt(year, 10); - this.adjustCalendars(); - } - } - }, { - key: "_handleInputChange", - value: function _handleInputChange(e) { - var date = void 0; - - // Prevent change event from being fired when triggered by the plugin - if (e.firedBy === this) { - return; - } - if (this.options.parse) { - date = this.options.parse(this.el.value, this.options.format); - } else { - date = new Date(Date.parse(this.el.value)); - } - - if (Datepicker._isDate(date)) { - this.setDate(date); - } - } - }, { - key: "renderDayName", - value: function renderDayName(opts, day, abbr) { - day += opts.firstDay; - while (day >= 7) { - day -= 7; - } - return abbr ? opts.i18n.weekdaysAbbrev[day] : opts.i18n.weekdays[day]; - } - - /** - * Set input value to the selected date and close Datepicker - */ - - }, { - key: "_finishSelection", - value: function _finishSelection() { - this.setInputValue(); - this.close(); - } - - /** - * Open Datepicker - */ - - }, { - key: "open", - value: function open() { - if (this.isOpen) { - return; - } - - this.isOpen = true; - if (typeof this.options.onOpen === 'function') { - this.options.onOpen.call(this); - } - this.draw(); - this.modal.open(); - return this; - } - - /** - * Close Datepicker - */ - - }, { - key: "close", - value: function close() { - if (!this.isOpen) { - return; - } - - this.isOpen = false; - if (typeof this.options.onClose === 'function') { - this.options.onClose.call(this); - } - this.modal.close(); - return this; - } - }], [{ - key: "init", - value: function init(els, options) { - return _get(Datepicker.__proto__ || Object.getPrototypeOf(Datepicker), "init", this).call(this, this, els, options); - } - }, { - key: "_isDate", - value: function _isDate(obj) { - return (/Date/.test(Object.prototype.toString.call(obj)) && !isNaN(obj.getTime()) - ); - } - }, { - key: "_isWeekend", - value: function _isWeekend(date) { - var day = date.getDay(); - return day === 0 || day === 6; - } - }, { - key: "_setToStartOfDay", - value: function _setToStartOfDay(date) { - if (Datepicker._isDate(date)) date.setHours(0, 0, 0, 0); - } - }, { - key: "_getDaysInMonth", - value: function _getDaysInMonth(year, month) { - return [31, Datepicker._isLeapYear(year) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month]; - } - }, { - key: "_isLeapYear", - value: function _isLeapYear(year) { - // solution by Matti Virkkunen: http://stackoverflow.com/a/4881951 - return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0; - } - }, { - key: "_compareDates", - value: function _compareDates(a, b) { - // weak date comparison (use setToStartOfDay(date) to ensure correct result) - return a.getTime() === b.getTime(); - } - }, { - key: "_setToStartOfDay", - value: function _setToStartOfDay(date) { - if (Datepicker._isDate(date)) date.setHours(0, 0, 0, 0); - } - - /** - * Get Instance - */ - - }, { - key: "getInstance", - value: function getInstance(el) { - var domElem = !!el.jquery ? el[0] : el; - return domElem.M_Datepicker; - } - }, { - key: "defaults", - get: function () { - return _defaults; - } - }]); - - return Datepicker; - }(Component); - - Datepicker._template = [''].join(''); - - M.Datepicker = Datepicker; - - if (M.jQueryLoaded) { - M.initializeJqueryWrapper(Datepicker, 'datepicker', 'M_Datepicker'); - } -})(cash); -;(function ($) { - 'use strict'; - - var _defaults = { - dialRadius: 135, - outerRadius: 105, - innerRadius: 70, - tickRadius: 20, - duration: 350, - container: null, - defaultTime: 'now', // default time, 'now' or '13:14' e.g. - fromNow: 0, // Millisecond offset from the defaultTime - showClearBtn: false, - - // internationalization - i18n: { - cancel: 'Cancel', - clear: 'Clear', - done: 'Ok' - }, - - autoClose: false, // auto close when minute is selected - twelveHour: true, // change to 12 hour AM/PM clock from 24 hour - vibrate: true, // vibrate the device when dragging clock hand - - // Callbacks - onOpenStart: null, - onOpenEnd: null, - onCloseStart: null, - onCloseEnd: null, - onSelect: null - }; - - /** - * @class - * - */ - - var Timepicker = function (_Component16) { - _inherits(Timepicker, _Component16); - - function Timepicker(el, options) { - _classCallCheck(this, Timepicker); - - var _this57 = _possibleConstructorReturn(this, (Timepicker.__proto__ || Object.getPrototypeOf(Timepicker)).call(this, Timepicker, el, options)); - - _this57.el.M_Timepicker = _this57; - - _this57.options = $.extend({}, Timepicker.defaults, options); - - _this57.id = M.guid(); - _this57._insertHTMLIntoDOM(); - _this57._setupModal(); - _this57._setupVariables(); - _this57._setupEventHandlers(); - - _this57._clockSetup(); - _this57._pickerSetup(); - return _this57; - } - - _createClass(Timepicker, [{ - key: "destroy", - - - /** - * Teardown component - */ - value: function destroy() { - this._removeEventHandlers(); - this.modal.destroy(); - $(this.modalEl).remove(); - this.el.M_Timepicker = undefined; - } - - /** - * Setup Event Handlers - */ - - }, { - key: "_setupEventHandlers", - value: function _setupEventHandlers() { - this._handleInputKeydownBound = this._handleInputKeydown.bind(this); - this._handleInputClickBound = this._handleInputClick.bind(this); - this._handleClockClickStartBound = this._handleClockClickStart.bind(this); - this._handleDocumentClickMoveBound = this._handleDocumentClickMove.bind(this); - this._handleDocumentClickEndBound = this._handleDocumentClickEnd.bind(this); - - this.el.addEventListener('click', this._handleInputClickBound); - this.el.addEventListener('keydown', this._handleInputKeydownBound); - this.plate.addEventListener('mousedown', this._handleClockClickStartBound); - this.plate.addEventListener('touchstart', this._handleClockClickStartBound); - - $(this.spanHours).on('click', this.showView.bind(this, 'hours')); - $(this.spanMinutes).on('click', this.showView.bind(this, 'minutes')); - } - }, { - key: "_removeEventHandlers", - value: function _removeEventHandlers() { - this.el.removeEventListener('click', this._handleInputClickBound); - this.el.removeEventListener('keydown', this._handleInputKeydownBound); - } - }, { - key: "_handleInputClick", - value: function _handleInputClick() { - this.open(); - } - }, { - key: "_handleInputKeydown", - value: function _handleInputKeydown(e) { - if (e.which === M.keys.ENTER) { - e.preventDefault(); - this.open(); - } - } - }, { - key: "_handleClockClickStart", - value: function _handleClockClickStart(e) { - e.preventDefault(); - var clockPlateBR = this.plate.getBoundingClientRect(); - var offset = { x: clockPlateBR.left, y: clockPlateBR.top }; - - this.x0 = offset.x + this.options.dialRadius; - this.y0 = offset.y + this.options.dialRadius; - this.moved = false; - var clickPos = Timepicker._Pos(e); - this.dx = clickPos.x - this.x0; - this.dy = clickPos.y - this.y0; - - // Set clock hands - this.setHand(this.dx, this.dy, false); - - // Mousemove on document - document.addEventListener('mousemove', this._handleDocumentClickMoveBound); - document.addEventListener('touchmove', this._handleDocumentClickMoveBound); - - // Mouseup on document - document.addEventListener('mouseup', this._handleDocumentClickEndBound); - document.addEventListener('touchend', this._handleDocumentClickEndBound); - } - }, { - key: "_handleDocumentClickMove", - value: function _handleDocumentClickMove(e) { - e.preventDefault(); - var clickPos = Timepicker._Pos(e); - var x = clickPos.x - this.x0; - var y = clickPos.y - this.y0; - this.moved = true; - this.setHand(x, y, false, true); - } - }, { - key: "_handleDocumentClickEnd", - value: function _handleDocumentClickEnd(e) { - var _this58 = this; - - e.preventDefault(); - document.removeEventListener('mouseup', this._handleDocumentClickEndBound); - document.removeEventListener('touchend', this._handleDocumentClickEndBound); - var clickPos = Timepicker._Pos(e); - var x = clickPos.x - this.x0; - var y = clickPos.y - this.y0; - if (this.moved && x === this.dx && y === this.dy) { - this.setHand(x, y); - } - - if (this.currentView === 'hours') { - this.showView('minutes', this.options.duration / 2); - } else if (this.options.autoClose) { - $(this.minutesView).addClass('timepicker-dial-out'); - setTimeout(function () { - _this58.done(); - }, this.options.duration / 2); - } - - if (typeof this.options.onSelect === 'function') { - this.options.onSelect.call(this, this.hours, this.minutes); - } - - // Unbind mousemove event - document.removeEventListener('mousemove', this._handleDocumentClickMoveBound); - document.removeEventListener('touchmove', this._handleDocumentClickMoveBound); - } - }, { - key: "_insertHTMLIntoDOM", - value: function _insertHTMLIntoDOM() { - this.$modalEl = $(Timepicker._template); - this.modalEl = this.$modalEl[0]; - this.modalEl.id = 'modal-' + this.id; - - // Append popover to input by default - var containerEl = document.querySelector(this.options.container); - if (this.options.container && !!containerEl) { - this.$modalEl.appendTo(containerEl); - } else { - this.$modalEl.insertBefore(this.el); - } - } - }, { - key: "_setupModal", - value: function _setupModal() { - var _this59 = this; - - this.modal = M.Modal.init(this.modalEl, { - onOpenStart: this.options.onOpenStart, - onOpenEnd: this.options.onOpenEnd, - onCloseStart: this.options.onCloseStart, - onCloseEnd: function () { - if (typeof _this59.options.onCloseEnd === 'function') { - _this59.options.onCloseEnd.call(_this59); - } - _this59.isOpen = false; - } - }); - } - }, { - key: "_setupVariables", - value: function _setupVariables() { - this.currentView = 'hours'; - this.vibrate = navigator.vibrate ? 'vibrate' : navigator.webkitVibrate ? 'webkitVibrate' : null; - - this._canvas = this.modalEl.querySelector('.timepicker-canvas'); - this.plate = this.modalEl.querySelector('.timepicker-plate'); - - this.hoursView = this.modalEl.querySelector('.timepicker-hours'); - this.minutesView = this.modalEl.querySelector('.timepicker-minutes'); - this.spanHours = this.modalEl.querySelector('.timepicker-span-hours'); - this.spanMinutes = this.modalEl.querySelector('.timepicker-span-minutes'); - this.spanAmPm = this.modalEl.querySelector('.timepicker-span-am-pm'); - this.footer = this.modalEl.querySelector('.timepicker-footer'); - this.amOrPm = 'PM'; - } - }, { - key: "_pickerSetup", - value: function _pickerSetup() { - var $clearBtn = $("").appendTo(this.footer).on('click', this.clear.bind(this)); - if (this.options.showClearBtn) { - $clearBtn.css({ visibility: '' }); - } - - var confirmationBtnsContainer = $('
'); - $('').appendTo(confirmationBtnsContainer).on('click', this.close.bind(this)); - $('').appendTo(confirmationBtnsContainer).on('click', this.done.bind(this)); - confirmationBtnsContainer.appendTo(this.footer); - } - }, { - key: "_clockSetup", - value: function _clockSetup() { - if (this.options.twelveHour) { - this.$amBtn = $('
AM
'); - this.$pmBtn = $('
PM
'); - this.$amBtn.on('click', this._handleAmPmClick.bind(this)).appendTo(this.spanAmPm); - this.$pmBtn.on('click', this._handleAmPmClick.bind(this)).appendTo(this.spanAmPm); - } - - this._buildHoursView(); - this._buildMinutesView(); - this._buildSVGClock(); - } - }, { - key: "_buildSVGClock", - value: function _buildSVGClock() { - // Draw clock hands and others - var dialRadius = this.options.dialRadius; - var tickRadius = this.options.tickRadius; - var diameter = dialRadius * 2; - - var svg = Timepicker._createSVGEl('svg'); - svg.setAttribute('class', 'timepicker-svg'); - svg.setAttribute('width', diameter); - svg.setAttribute('height', diameter); - var g = Timepicker._createSVGEl('g'); - g.setAttribute('transform', 'translate(' + dialRadius + ',' + dialRadius + ')'); - var bearing = Timepicker._createSVGEl('circle'); - bearing.setAttribute('class', 'timepicker-canvas-bearing'); - bearing.setAttribute('cx', 0); - bearing.setAttribute('cy', 0); - bearing.setAttribute('r', 4); - var hand = Timepicker._createSVGEl('line'); - hand.setAttribute('x1', 0); - hand.setAttribute('y1', 0); - var bg = Timepicker._createSVGEl('circle'); - bg.setAttribute('class', 'timepicker-canvas-bg'); - bg.setAttribute('r', tickRadius); - g.appendChild(hand); - g.appendChild(bg); - g.appendChild(bearing); - svg.appendChild(g); - this._canvas.appendChild(svg); - - this.hand = hand; - this.bg = bg; - this.bearing = bearing; - this.g = g; - } - }, { - key: "_buildHoursView", - value: function _buildHoursView() { - var $tick = $('
'); - // Hours view - if (this.options.twelveHour) { - for (var i = 1; i < 13; i += 1) { - var tick = $tick.clone(); - var radian = i / 6 * Math.PI; - var radius = this.options.outerRadius; - tick.css({ - left: this.options.dialRadius + Math.sin(radian) * radius - this.options.tickRadius + 'px', - top: this.options.dialRadius - Math.cos(radian) * radius - this.options.tickRadius + 'px' - }); - tick.html(i === 0 ? '00' : i); - this.hoursView.appendChild(tick[0]); - // tick.on(mousedownEvent, mousedown); - } - } else { - for (var _i2 = 0; _i2 < 24; _i2 += 1) { - var _tick = $tick.clone(); - var _radian = _i2 / 6 * Math.PI; - var inner = _i2 > 0 && _i2 < 13; - var _radius = inner ? this.options.innerRadius : this.options.outerRadius; - _tick.css({ - left: this.options.dialRadius + Math.sin(_radian) * _radius - this.options.tickRadius + 'px', - top: this.options.dialRadius - Math.cos(_radian) * _radius - this.options.tickRadius + 'px' - }); - _tick.html(_i2 === 0 ? '00' : _i2); - this.hoursView.appendChild(_tick[0]); - // tick.on(mousedownEvent, mousedown); - } - } - } - }, { - key: "_buildMinutesView", - value: function _buildMinutesView() { - var $tick = $('
'); - // Minutes view - for (var i = 0; i < 60; i += 5) { - var tick = $tick.clone(); - var radian = i / 30 * Math.PI; - tick.css({ - left: this.options.dialRadius + Math.sin(radian) * this.options.outerRadius - this.options.tickRadius + 'px', - top: this.options.dialRadius - Math.cos(radian) * this.options.outerRadius - this.options.tickRadius + 'px' - }); - tick.html(Timepicker._addLeadingZero(i)); - this.minutesView.appendChild(tick[0]); - } - } - }, { - key: "_handleAmPmClick", - value: function _handleAmPmClick(e) { - var $btnClicked = $(e.target); - this.amOrPm = $btnClicked.hasClass('am-btn') ? 'AM' : 'PM'; - this._updateAmPmView(); - } - }, { - key: "_updateAmPmView", - value: function _updateAmPmView() { - if (this.options.twelveHour) { - this.$amBtn.toggleClass('text-primary', this.amOrPm === 'AM'); - this.$pmBtn.toggleClass('text-primary', this.amOrPm === 'PM'); - } - } - }, { - key: "_updateTimeFromInput", - value: function _updateTimeFromInput() { - // Get the time - var value = ((this.el.value || this.options.defaultTime || '') + '').split(':'); - if (this.options.twelveHour && !(typeof value[1] === 'undefined')) { - if (value[1].toUpperCase().indexOf('AM') > 0) { - this.amOrPm = 'AM'; - } else { - this.amOrPm = 'PM'; - } - value[1] = value[1].replace('AM', '').replace('PM', ''); - } - if (value[0] === 'now') { - var now = new Date(+new Date() + this.options.fromNow); - value = [now.getHours(), now.getMinutes()]; - if (this.options.twelveHour) { - this.amOrPm = value[0] >= 12 && value[0] < 24 ? 'PM' : 'AM'; - } - } - this.hours = +value[0] || 0; - this.minutes = +value[1] || 0; - this.spanHours.innerHTML = this.hours; - this.spanMinutes.innerHTML = Timepicker._addLeadingZero(this.minutes); - - this._updateAmPmView(); - } - }, { - key: "showView", - value: function showView(view, delay) { - if (view === 'minutes' && $(this.hoursView).css('visibility') === 'visible') { - // raiseCallback(this.options.beforeHourSelect); - } - var isHours = view === 'hours', - nextView = isHours ? this.hoursView : this.minutesView, - hideView = isHours ? this.minutesView : this.hoursView; - this.currentView = view; - - $(this.spanHours).toggleClass('text-primary', isHours); - $(this.spanMinutes).toggleClass('text-primary', !isHours); - - // Transition view - hideView.classList.add('timepicker-dial-out'); - $(nextView).css('visibility', 'visible').removeClass('timepicker-dial-out'); - - // Reset clock hand - this.resetClock(delay); - - // After transitions ended - clearTimeout(this.toggleViewTimer); - this.toggleViewTimer = setTimeout(function () { - $(hideView).css('visibility', 'hidden'); - }, this.options.duration); - } - }, { - key: "resetClock", - value: function resetClock(delay) { - var view = this.currentView, - value = this[view], - isHours = view === 'hours', - unit = Math.PI / (isHours ? 6 : 30), - radian = value * unit, - radius = isHours && value > 0 && value < 13 ? this.options.innerRadius : this.options.outerRadius, - x = Math.sin(radian) * radius, - y = -Math.cos(radian) * radius, - self = this; - - if (delay) { - $(this.canvas).addClass('timepicker-canvas-out'); - setTimeout(function () { - $(self.canvas).removeClass('timepicker-canvas-out'); - self.setHand(x, y); - }, delay); - } else { - this.setHand(x, y); - } - } - }, { - key: "setHand", - value: function setHand(x, y, roundBy5) { - var _this60 = this; - - var radian = Math.atan2(x, -y), - isHours = this.currentView === 'hours', - unit = Math.PI / (isHours || roundBy5 ? 6 : 30), - z = Math.sqrt(x * x + y * y), - inner = isHours && z < (this.options.outerRadius + this.options.innerRadius) / 2, - radius = inner ? this.options.innerRadius : this.options.outerRadius; - - if (this.options.twelveHour) { - radius = this.options.outerRadius; - } - - // Radian should in range [0, 2PI] - if (radian < 0) { - radian = Math.PI * 2 + radian; - } - - // Get the round value - var value = Math.round(radian / unit); - - // Get the round radian - radian = value * unit; - - // Correct the hours or minutes - if (this.options.twelveHour) { - if (isHours) { - if (value === 0) value = 12; - } else { - if (roundBy5) value *= 5; - if (value === 60) value = 0; - } - } else { - if (isHours) { - if (value === 12) { - value = 0; - } - value = inner ? value === 0 ? 12 : value : value === 0 ? 0 : value + 12; - } else { - if (roundBy5) { - value *= 5; - } - if (value === 60) { - value = 0; - } - } - } - - // Once hours or minutes changed, vibrate the device - if (this[this.currentView] !== value) { - if (this.vibrate && this.options.vibrate) { - // Do not vibrate too frequently - if (!this.vibrateTimer) { - navigator[this.vibrate](10); - this.vibrateTimer = setTimeout(function () { - _this60.vibrateTimer = null; - }, 100); - } - } - } - - this[this.currentView] = value; - if (isHours) { - this['spanHours'].innerHTML = value; - } else { - this['spanMinutes'].innerHTML = Timepicker._addLeadingZero(value); - } - - // Set clock hand and others' position - var cx1 = Math.sin(radian) * (radius - this.options.tickRadius), - cy1 = -Math.cos(radian) * (radius - this.options.tickRadius), - cx2 = Math.sin(radian) * radius, - cy2 = -Math.cos(radian) * radius; - this.hand.setAttribute('x2', cx1); - this.hand.setAttribute('y2', cy1); - this.bg.setAttribute('cx', cx2); - this.bg.setAttribute('cy', cy2); - } - }, { - key: "open", - value: function open() { - if (this.isOpen) { - return; - } - - this.isOpen = true; - this._updateTimeFromInput(); - this.showView('hours'); - - this.modal.open(); - } - }, { - key: "close", - value: function close() { - if (!this.isOpen) { - return; - } - - this.isOpen = false; - this.modal.close(); - } - - /** - * Finish timepicker selection. - */ - - }, { - key: "done", - value: function done(e, clearValue) { - // Set input value - var last = this.el.value; - var value = clearValue ? '' : Timepicker._addLeadingZero(this.hours) + ':' + Timepicker._addLeadingZero(this.minutes); - this.time = value; - if (!clearValue && this.options.twelveHour) { - value = value + " " + this.amOrPm; - } - this.el.value = value; - - // Trigger change event - if (value !== last) { - this.$el.trigger('change'); - } - - this.close(); - this.el.focus(); - } - }, { - key: "clear", - value: function clear() { - this.done(null, true); - } - }], [{ - key: "init", - value: function init(els, options) { - return _get(Timepicker.__proto__ || Object.getPrototypeOf(Timepicker), "init", this).call(this, this, els, options); - } - }, { - key: "_addLeadingZero", - value: function _addLeadingZero(num) { - return (num < 10 ? '0' : '') + num; - } - }, { - key: "_createSVGEl", - value: function _createSVGEl(name) { - var svgNS = 'http://www.w3.org/2000/svg'; - return document.createElementNS(svgNS, name); - } - - /** - * @typedef {Object} Point - * @property {number} x The X Coordinate - * @property {number} y The Y Coordinate - */ - - /** - * Get x position of mouse or touch event - * @param {Event} e - * @return {Point} x and y location - */ - - }, { - key: "_Pos", - value: function _Pos(e) { - if (e.targetTouches && e.targetTouches.length >= 1) { - return { x: e.targetTouches[0].clientX, y: e.targetTouches[0].clientY }; - } - // mouse event - return { x: e.clientX, y: e.clientY }; - } - - /** - * Get Instance - */ - - }, { - key: "getInstance", - value: function getInstance(el) { - var domElem = !!el.jquery ? el[0] : el; - return domElem.M_Timepicker; - } - }, { - key: "defaults", - get: function () { - return _defaults; - } - }]); - - return Timepicker; - }(Component); - - Timepicker._template = [''].join(''); - - M.Timepicker = Timepicker; - - if (M.jQueryLoaded) { - M.initializeJqueryWrapper(Timepicker, 'timepicker', 'M_Timepicker'); - } -})(cash); -;(function ($) { - 'use strict'; - - var _defaults = {}; - - /** - * @class - * - */ - - var CharacterCounter = function (_Component17) { - _inherits(CharacterCounter, _Component17); - - /** - * Construct CharacterCounter instance - * @constructor - * @param {Element} el - * @param {Object} options - */ - function CharacterCounter(el, options) { - _classCallCheck(this, CharacterCounter); - - var _this61 = _possibleConstructorReturn(this, (CharacterCounter.__proto__ || Object.getPrototypeOf(CharacterCounter)).call(this, CharacterCounter, el, options)); - - _this61.el.M_CharacterCounter = _this61; - - /** - * Options for the character counter - */ - _this61.options = $.extend({}, CharacterCounter.defaults, options); - - _this61.isInvalid = false; - _this61.isValidLength = false; - _this61._setupCounter(); - _this61._setupEventHandlers(); - return _this61; - } - - _createClass(CharacterCounter, [{ - key: "destroy", - - - /** - * Teardown component - */ - value: function destroy() { - this._removeEventHandlers(); - this.el.CharacterCounter = undefined; - this._removeCounter(); - } - - /** - * Setup Event Handlers - */ - - }, { - key: "_setupEventHandlers", - value: function _setupEventHandlers() { - this._handleUpdateCounterBound = this.updateCounter.bind(this); - - this.el.addEventListener('focus', this._handleUpdateCounterBound, true); - this.el.addEventListener('input', this._handleUpdateCounterBound, true); - } - - /** - * Remove Event Handlers - */ - - }, { - key: "_removeEventHandlers", - value: function _removeEventHandlers() { - this.el.removeEventListener('focus', this._handleUpdateCounterBound, true); - this.el.removeEventListener('input', this._handleUpdateCounterBound, true); - } - - /** - * Setup counter element - */ - - }, { - key: "_setupCounter", - value: function _setupCounter() { - this.counterEl = document.createElement('span'); - $(this.counterEl).addClass('character-counter').css({ - float: 'right', - 'font-size': '12px', - height: 1 - }); - - this.$el.parent().append(this.counterEl); - } - - /** - * Remove counter element - */ - - }, { - key: "_removeCounter", - value: function _removeCounter() { - $(this.counterEl).remove(); - } - - /** - * Update counter - */ - - }, { - key: "updateCounter", - value: function updateCounter() { - var maxLength = +this.$el.attr('data-length'), - actualLength = this.el.value.length; - this.isValidLength = actualLength <= maxLength; - var counterString = actualLength; - - if (maxLength) { - counterString += '/' + maxLength; - this._validateInput(); - } - - $(this.counterEl).html(counterString); - } - - /** - * Add validation classes - */ - - }, { - key: "_validateInput", - value: function _validateInput() { - if (this.isValidLength && this.isInvalid) { - this.isInvalid = false; - this.$el.removeClass('invalid'); - } else if (!this.isValidLength && !this.isInvalid) { - this.isInvalid = true; - this.$el.removeClass('valid'); - this.$el.addClass('invalid'); - } - } - }], [{ - key: "init", - value: function init(els, options) { - return _get(CharacterCounter.__proto__ || Object.getPrototypeOf(CharacterCounter), "init", this).call(this, this, els, options); - } - - /** - * Get Instance - */ - - }, { - key: "getInstance", - value: function getInstance(el) { - var domElem = !!el.jquery ? el[0] : el; - return domElem.M_CharacterCounter; - } - }, { - key: "defaults", - get: function () { - return _defaults; - } - }]); - - return CharacterCounter; - }(Component); - - M.CharacterCounter = CharacterCounter; - - if (M.jQueryLoaded) { - M.initializeJqueryWrapper(CharacterCounter, 'characterCounter', 'M_CharacterCounter'); - } -})(cash); -;(function ($) { - 'use strict'; - - var _defaults = { - duration: 200, // ms - dist: -100, // zoom scale TODO: make this more intuitive as an option - shift: 0, // spacing for center image - padding: 0, // Padding between non center items - numVisible: 5, // Number of visible items in carousel - fullWidth: false, // Change to full width styles - indicators: false, // Toggle indicators - noWrap: false, // Don't wrap around and cycle through items. - onCycleTo: null // Callback for when a new slide is cycled to. - }; - - /** - * @class - * - */ - - var Carousel = function (_Component18) { - _inherits(Carousel, _Component18); - - /** - * Construct Carousel instance - * @constructor - * @param {Element} el - * @param {Object} options - */ - function Carousel(el, options) { - _classCallCheck(this, Carousel); - - var _this62 = _possibleConstructorReturn(this, (Carousel.__proto__ || Object.getPrototypeOf(Carousel)).call(this, Carousel, el, options)); - - _this62.el.M_Carousel = _this62; - - /** - * Options for the carousel - * @member Carousel#options - * @prop {Number} duration - * @prop {Number} dist - * @prop {Number} shift - * @prop {Number} padding - * @prop {Number} numVisible - * @prop {Boolean} fullWidth - * @prop {Boolean} indicators - * @prop {Boolean} noWrap - * @prop {Function} onCycleTo - */ - _this62.options = $.extend({}, Carousel.defaults, options); - - // Setup - _this62.hasMultipleSlides = _this62.$el.find('.carousel-item').length > 1; - _this62.showIndicators = _this62.options.indicators && _this62.hasMultipleSlides; - _this62.noWrap = _this62.options.noWrap || !_this62.hasMultipleSlides; - _this62.pressed = false; - _this62.dragged = false; - _this62.offset = _this62.target = 0; - _this62.images = []; - _this62.itemWidth = _this62.$el.find('.carousel-item').first().innerWidth(); - _this62.itemHeight = _this62.$el.find('.carousel-item').first().innerHeight(); - _this62.dim = _this62.itemWidth * 2 + _this62.options.padding || 1; // Make sure dim is non zero for divisions. - _this62._autoScrollBound = _this62._autoScroll.bind(_this62); - _this62._trackBound = _this62._track.bind(_this62); - - // Full Width carousel setup - if (_this62.options.fullWidth) { - _this62.options.dist = 0; - _this62._setCarouselHeight(); - - // Offset fixed items when indicators. - if (_this62.showIndicators) { - _this62.$el.find('.carousel-fixed-item').addClass('with-indicators'); - } - } - - // Iterate through slides - _this62.$indicators = $('
    '); - _this62.$el.find('.carousel-item').each(function (el, i) { - _this62.images.push(el); - if (_this62.showIndicators) { - var $indicator = $('
  • '); - - // Add active to first by default. - if (i === 0) { - $indicator[0].classList.add('active'); - } - - _this62.$indicators.append($indicator); - } - }); - if (_this62.showIndicators) { - _this62.$el.append(_this62.$indicators); - } - _this62.count = _this62.images.length; - - // Cap numVisible at count - _this62.options.numVisible = Math.min(_this62.count, _this62.options.numVisible); - - // Setup cross browser string - _this62.xform = 'transform'; - ['webkit', 'Moz', 'O', 'ms'].every(function (prefix) { - var e = prefix + 'Transform'; - if (typeof document.body.style[e] !== 'undefined') { - _this62.xform = e; - return false; - } - return true; - }); - - _this62._setupEventHandlers(); - _this62._scroll(_this62.offset); - return _this62; - } - - _createClass(Carousel, [{ - key: "destroy", - - - /** - * Teardown component - */ - value: function destroy() { - this._removeEventHandlers(); - this.el.M_Carousel = undefined; - } - - /** - * Setup Event Handlers - */ - - }, { - key: "_setupEventHandlers", - value: function _setupEventHandlers() { - var _this63 = this; - - this._handleCarouselTapBound = this._handleCarouselTap.bind(this); - this._handleCarouselDragBound = this._handleCarouselDrag.bind(this); - this._handleCarouselReleaseBound = this._handleCarouselRelease.bind(this); - this._handleCarouselClickBound = this._handleCarouselClick.bind(this); - - if (typeof window.ontouchstart !== 'undefined') { - this.el.addEventListener('touchstart', this._handleCarouselTapBound); - this.el.addEventListener('touchmove', this._handleCarouselDragBound); - this.el.addEventListener('touchend', this._handleCarouselReleaseBound); - } - - this.el.addEventListener('mousedown', this._handleCarouselTapBound); - this.el.addEventListener('mousemove', this._handleCarouselDragBound); - this.el.addEventListener('mouseup', this._handleCarouselReleaseBound); - this.el.addEventListener('mouseleave', this._handleCarouselReleaseBound); - this.el.addEventListener('click', this._handleCarouselClickBound); - - if (this.showIndicators && this.$indicators) { - this._handleIndicatorClickBound = this._handleIndicatorClick.bind(this); - this.$indicators.find('.indicator-item').each(function (el, i) { - el.addEventListener('click', _this63._handleIndicatorClickBound); - }); - } - - // Resize - var throttledResize = M.throttle(this._handleResize, 200); - this._handleThrottledResizeBound = throttledResize.bind(this); - - window.addEventListener('resize', this._handleThrottledResizeBound); - } - - /** - * Remove Event Handlers - */ - - }, { - key: "_removeEventHandlers", - value: function _removeEventHandlers() { - var _this64 = this; - - if (typeof window.ontouchstart !== 'undefined') { - this.el.removeEventListener('touchstart', this._handleCarouselTapBound); - this.el.removeEventListener('touchmove', this._handleCarouselDragBound); - this.el.removeEventListener('touchend', this._handleCarouselReleaseBound); - } - this.el.removeEventListener('mousedown', this._handleCarouselTapBound); - this.el.removeEventListener('mousemove', this._handleCarouselDragBound); - this.el.removeEventListener('mouseup', this._handleCarouselReleaseBound); - this.el.removeEventListener('mouseleave', this._handleCarouselReleaseBound); - this.el.removeEventListener('click', this._handleCarouselClickBound); - - if (this.showIndicators && this.$indicators) { - this.$indicators.find('.indicator-item').each(function (el, i) { - el.removeEventListener('click', _this64._handleIndicatorClickBound); - }); - } - - window.removeEventListener('resize', this._handleThrottledResizeBound); - } - - /** - * Handle Carousel Tap - * @param {Event} e - */ - - }, { - key: "_handleCarouselTap", - value: function _handleCarouselTap(e) { - // Fixes firefox draggable image bug - if (e.type === 'mousedown' && $(e.target).is('img')) { - e.preventDefault(); - } - this.pressed = true; - this.dragged = false; - this.verticalDragged = false; - this.reference = this._xpos(e); - this.referenceY = this._ypos(e); - - this.velocity = this.amplitude = 0; - this.frame = this.offset; - this.timestamp = Date.now(); - clearInterval(this.ticker); - this.ticker = setInterval(this._trackBound, 100); - } - - /** - * Handle Carousel Drag - * @param {Event} e - */ - - }, { - key: "_handleCarouselDrag", - value: function _handleCarouselDrag(e) { - var x = void 0, - y = void 0, - delta = void 0, - deltaY = void 0; - if (this.pressed) { - x = this._xpos(e); - y = this._ypos(e); - delta = this.reference - x; - deltaY = Math.abs(this.referenceY - y); - if (deltaY < 30 && !this.verticalDragged) { - // If vertical scrolling don't allow dragging. - if (delta > 2 || delta < -2) { - this.dragged = true; - this.reference = x; - this._scroll(this.offset + delta); - } - } else if (this.dragged) { - // If dragging don't allow vertical scroll. - e.preventDefault(); - e.stopPropagation(); - return false; - } else { - // Vertical scrolling. - this.verticalDragged = true; - } - } - - if (this.dragged) { - // If dragging don't allow vertical scroll. - e.preventDefault(); - e.stopPropagation(); - return false; - } - } - - /** - * Handle Carousel Release - * @param {Event} e - */ - - }, { - key: "_handleCarouselRelease", - value: function _handleCarouselRelease(e) { - if (this.pressed) { - this.pressed = false; - } else { - return; - } - - clearInterval(this.ticker); - this.target = this.offset; - if (this.velocity > 10 || this.velocity < -10) { - this.amplitude = 0.9 * this.velocity; - this.target = this.offset + this.amplitude; - } - this.target = Math.round(this.target / this.dim) * this.dim; - - // No wrap of items. - if (this.noWrap) { - if (this.target >= this.dim * (this.count - 1)) { - this.target = this.dim * (this.count - 1); - } else if (this.target < 0) { - this.target = 0; - } - } - this.amplitude = this.target - this.offset; - this.timestamp = Date.now(); - requestAnimationFrame(this._autoScrollBound); - - if (this.dragged) { - e.preventDefault(); - e.stopPropagation(); - } - return false; - } - - /** - * Handle Carousel CLick - * @param {Event} e - */ - - }, { - key: "_handleCarouselClick", - value: function _handleCarouselClick(e) { - // Disable clicks if carousel was dragged. - if (this.dragged) { - e.preventDefault(); - e.stopPropagation(); - return false; - } else if (!this.options.fullWidth) { - var clickedIndex = $(e.target).closest('.carousel-item').index(); - var diff = this._wrap(this.center) - clickedIndex; - - // Disable clicks if carousel was shifted by click - if (diff !== 0) { - e.preventDefault(); - e.stopPropagation(); - } - this._cycleTo(clickedIndex); - } - } - - /** - * Handle Indicator CLick - * @param {Event} e - */ - - }, { - key: "_handleIndicatorClick", - value: function _handleIndicatorClick(e) { - e.stopPropagation(); - - var indicator = $(e.target).closest('.indicator-item'); - if (indicator.length) { - this._cycleTo(indicator.index()); - } - } - - /** - * Handle Throttle Resize - * @param {Event} e - */ - - }, { - key: "_handleResize", - value: function _handleResize(e) { - if (this.options.fullWidth) { - this.itemWidth = this.$el.find('.carousel-item').first().innerWidth(); - this.imageHeight = this.$el.find('.carousel-item.active').height(); - this.dim = this.itemWidth * 2 + this.options.padding; - this.offset = this.center * 2 * this.itemWidth; - this.target = this.offset; - this._setCarouselHeight(true); - } else { - this._scroll(); - } - } - - /** - * Set carousel height based on first slide - * @param {Booleam} imageOnly - true for image slides - */ - - }, { - key: "_setCarouselHeight", - value: function _setCarouselHeight(imageOnly) { - var _this65 = this; - - var firstSlide = this.$el.find('.carousel-item.active').length ? this.$el.find('.carousel-item.active').first() : this.$el.find('.carousel-item').first(); - var firstImage = firstSlide.find('img').first(); - if (firstImage.length) { - if (firstImage[0].complete) { - // If image won't trigger the load event - var imageHeight = firstImage.height(); - if (imageHeight > 0) { - this.$el.css('height', imageHeight + 'px'); - } else { - // If image still has no height, use the natural dimensions to calculate - var naturalWidth = firstImage[0].naturalWidth; - var naturalHeight = firstImage[0].naturalHeight; - var adjustedHeight = this.$el.width() / naturalWidth * naturalHeight; - this.$el.css('height', adjustedHeight + 'px'); - } - } else { - // Get height when image is loaded normally - firstImage.one('load', function (el, i) { - _this65.$el.css('height', el.offsetHeight + 'px'); - }); - } - } else if (!imageOnly) { - var slideHeight = firstSlide.height(); - this.$el.css('height', slideHeight + 'px'); - } - } - - /** - * Get x position from event - * @param {Event} e - */ - - }, { - key: "_xpos", - value: function _xpos(e) { - // touch event - if (e.targetTouches && e.targetTouches.length >= 1) { - return e.targetTouches[0].clientX; - } - - // mouse event - return e.clientX; - } - - /** - * Get y position from event - * @param {Event} e - */ - - }, { - key: "_ypos", - value: function _ypos(e) { - // touch event - if (e.targetTouches && e.targetTouches.length >= 1) { - return e.targetTouches[0].clientY; - } - - // mouse event - return e.clientY; - } - - /** - * Wrap index - * @param {Number} x - */ - - }, { - key: "_wrap", - value: function _wrap(x) { - return x >= this.count ? x % this.count : x < 0 ? this._wrap(this.count + x % this.count) : x; - } - - /** - * Tracks scrolling information - */ - - }, { - key: "_track", - value: function _track() { - var now = void 0, - elapsed = void 0, - delta = void 0, - v = void 0; - - now = Date.now(); - elapsed = now - this.timestamp; - this.timestamp = now; - delta = this.offset - this.frame; - this.frame = this.offset; - - v = 1000 * delta / (1 + elapsed); - this.velocity = 0.8 * v + 0.2 * this.velocity; - } - - /** - * Auto scrolls to nearest carousel item. - */ - - }, { - key: "_autoScroll", - value: function _autoScroll() { - var elapsed = void 0, - delta = void 0; - - if (this.amplitude) { - elapsed = Date.now() - this.timestamp; - delta = this.amplitude * Math.exp(-elapsed / this.options.duration); - if (delta > 2 || delta < -2) { - this._scroll(this.target - delta); - requestAnimationFrame(this._autoScrollBound); - } else { - this._scroll(this.target); - } - } - } - - /** - * Scroll to target - * @param {Number} x - */ - - }, { - key: "_scroll", - value: function _scroll(x) { - var _this66 = this; - - // Track scrolling state - if (!this.$el.hasClass('scrolling')) { - this.el.classList.add('scrolling'); - } - if (this.scrollingTimeout != null) { - window.clearTimeout(this.scrollingTimeout); - } - this.scrollingTimeout = window.setTimeout(function () { - _this66.$el.removeClass('scrolling'); - }, this.options.duration); - - // Start actual scroll - var i = void 0, - half = void 0, - delta = void 0, - dir = void 0, - tween = void 0, - el = void 0, - alignment = void 0, - zTranslation = void 0, - tweenedOpacity = void 0, - centerTweenedOpacity = void 0; - var lastCenter = this.center; - var numVisibleOffset = 1 / this.options.numVisible; - - this.offset = typeof x === 'number' ? x : this.offset; - this.center = Math.floor((this.offset + this.dim / 2) / this.dim); - delta = this.offset - this.center * this.dim; - dir = delta < 0 ? 1 : -1; - tween = -dir * delta * 2 / this.dim; - half = this.count >> 1; - - if (this.options.fullWidth) { - alignment = 'translateX(0)'; - centerTweenedOpacity = 1; - } else { - alignment = 'translateX(' + (this.el.clientWidth - this.itemWidth) / 2 + 'px) '; - alignment += 'translateY(' + (this.el.clientHeight - this.itemHeight) / 2 + 'px)'; - centerTweenedOpacity = 1 - numVisibleOffset * tween; - } - - // Set indicator active - if (this.showIndicators) { - var diff = this.center % this.count; - var activeIndicator = this.$indicators.find('.indicator-item.active'); - if (activeIndicator.index() !== diff) { - activeIndicator.removeClass('active'); - this.$indicators.find('.indicator-item').eq(diff)[0].classList.add('active'); - } - } - - // center - // Don't show wrapped items. - if (!this.noWrap || this.center >= 0 && this.center < this.count) { - el = this.images[this._wrap(this.center)]; - - // Add active class to center item. - if (!$(el).hasClass('active')) { - this.$el.find('.carousel-item').removeClass('active'); - el.classList.add('active'); - } - var transformString = alignment + " translateX(" + -delta / 2 + "px) translateX(" + dir * this.options.shift * tween * i + "px) translateZ(" + this.options.dist * tween + "px)"; - this._updateItemStyle(el, centerTweenedOpacity, 0, transformString); - } - - for (i = 1; i <= half; ++i) { - // right side - if (this.options.fullWidth) { - zTranslation = this.options.dist; - tweenedOpacity = i === half && delta < 0 ? 1 - tween : 1; - } else { - zTranslation = this.options.dist * (i * 2 + tween * dir); - tweenedOpacity = 1 - numVisibleOffset * (i * 2 + tween * dir); - } - // Don't show wrapped items. - if (!this.noWrap || this.center + i < this.count) { - el = this.images[this._wrap(this.center + i)]; - var _transformString = alignment + " translateX(" + (this.options.shift + (this.dim * i - delta) / 2) + "px) translateZ(" + zTranslation + "px)"; - this._updateItemStyle(el, tweenedOpacity, -i, _transformString); - } - - // left side - if (this.options.fullWidth) { - zTranslation = this.options.dist; - tweenedOpacity = i === half && delta > 0 ? 1 - tween : 1; - } else { - zTranslation = this.options.dist * (i * 2 - tween * dir); - tweenedOpacity = 1 - numVisibleOffset * (i * 2 - tween * dir); - } - // Don't show wrapped items. - if (!this.noWrap || this.center - i >= 0) { - el = this.images[this._wrap(this.center - i)]; - var _transformString2 = alignment + " translateX(" + (-this.options.shift + (-this.dim * i - delta) / 2) + "px) translateZ(" + zTranslation + "px)"; - this._updateItemStyle(el, tweenedOpacity, -i, _transformString2); - } - } - - // center - // Don't show wrapped items. - if (!this.noWrap || this.center >= 0 && this.center < this.count) { - el = this.images[this._wrap(this.center)]; - var _transformString3 = alignment + " translateX(" + -delta / 2 + "px) translateX(" + dir * this.options.shift * tween + "px) translateZ(" + this.options.dist * tween + "px)"; - this._updateItemStyle(el, centerTweenedOpacity, 0, _transformString3); - } - - // onCycleTo callback - var $currItem = this.$el.find('.carousel-item').eq(this._wrap(this.center)); - if (lastCenter !== this.center && typeof this.options.onCycleTo === 'function') { - this.options.onCycleTo.call(this, $currItem[0], this.dragged); - } - - // One time callback - if (typeof this.oneTimeCallback === 'function') { - this.oneTimeCallback.call(this, $currItem[0], this.dragged); - this.oneTimeCallback = null; - } - } - - /** - * Cycle to target - * @param {Element} el - * @param {Number} opacity - * @param {Number} zIndex - * @param {String} transform - */ - - }, { - key: "_updateItemStyle", - value: function _updateItemStyle(el, opacity, zIndex, transform) { - el.style[this.xform] = transform; - el.style.zIndex = zIndex; - el.style.opacity = opacity; - el.style.visibility = 'visible'; - } - - /** - * Cycle to target - * @param {Number} n - * @param {Function} callback - */ - - }, { - key: "_cycleTo", - value: function _cycleTo(n, callback) { - var diff = this.center % this.count - n; - - // Account for wraparound. - if (!this.noWrap) { - if (diff < 0) { - if (Math.abs(diff + this.count) < Math.abs(diff)) { - diff += this.count; - } - } else if (diff > 0) { - if (Math.abs(diff - this.count) < diff) { - diff -= this.count; - } - } - } - - this.target = this.dim * Math.round(this.offset / this.dim); - // Next - if (diff < 0) { - this.target += this.dim * Math.abs(diff); - - // Prev - } else if (diff > 0) { - this.target -= this.dim * diff; - } - - // Set one time callback - if (typeof callback === 'function') { - this.oneTimeCallback = callback; - } - - // Scroll - if (this.offset !== this.target) { - this.amplitude = this.target - this.offset; - this.timestamp = Date.now(); - requestAnimationFrame(this._autoScrollBound); - } - } - - /** - * Cycle to next item - * @param {Number} [n] - */ - - }, { - key: "next", - value: function next(n) { - if (n === undefined || isNaN(n)) { - n = 1; - } - - var index = this.center + n; - if (index >= this.count || index < 0) { - if (this.noWrap) { - return; - } - - index = this._wrap(index); - } - this._cycleTo(index); - } - - /** - * Cycle to previous item - * @param {Number} [n] - */ - - }, { - key: "prev", - value: function prev(n) { - if (n === undefined || isNaN(n)) { - n = 1; - } - - var index = this.center - n; - if (index >= this.count || index < 0) { - if (this.noWrap) { - return; - } - - index = this._wrap(index); - } - - this._cycleTo(index); - } - - /** - * Cycle to nth item - * @param {Number} [n] - * @param {Function} callback - */ - - }, { - key: "set", - value: function set(n, callback) { - if (n === undefined || isNaN(n)) { - n = 0; - } - - if (n > this.count || n < 0) { - if (this.noWrap) { - return; - } - - n = this._wrap(n); - } - - this._cycleTo(n, callback); - } - }], [{ - key: "init", - value: function init(els, options) { - return _get(Carousel.__proto__ || Object.getPrototypeOf(Carousel), "init", this).call(this, this, els, options); - } - - /** - * Get Instance - */ - - }, { - key: "getInstance", - value: function getInstance(el) { - var domElem = !!el.jquery ? el[0] : el; - return domElem.M_Carousel; - } - }, { - key: "defaults", - get: function () { - return _defaults; - } - }]); - - return Carousel; - }(Component); - - M.Carousel = Carousel; - - if (M.jQueryLoaded) { - M.initializeJqueryWrapper(Carousel, 'carousel', 'M_Carousel'); - } -})(cash); -;(function ($) { - 'use strict'; - - var _defaults = { - onOpen: undefined, - onClose: undefined - }; - - /** - * @class - * - */ - - var TapTarget = function (_Component19) { - _inherits(TapTarget, _Component19); - - /** - * Construct TapTarget instance - * @constructor - * @param {Element} el - * @param {Object} options - */ - function TapTarget(el, options) { - _classCallCheck(this, TapTarget); - - var _this67 = _possibleConstructorReturn(this, (TapTarget.__proto__ || Object.getPrototypeOf(TapTarget)).call(this, TapTarget, el, options)); - - _this67.el.M_TapTarget = _this67; - - /** - * Options for the select - * @member TapTarget#options - * @prop {Function} onOpen - Callback function called when feature discovery is opened - * @prop {Function} onClose - Callback function called when feature discovery is closed - */ - _this67.options = $.extend({}, TapTarget.defaults, options); - - _this67.isOpen = false; - - // setup - _this67.$origin = $('#' + _this67.$el.attr('data-target')); - _this67._setup(); - - _this67._calculatePositioning(); - _this67._setupEventHandlers(); - return _this67; - } - - _createClass(TapTarget, [{ - key: "destroy", - - - /** - * Teardown component - */ - value: function destroy() { - this._removeEventHandlers(); - this.el.TapTarget = undefined; - } - - /** - * Setup Event Handlers - */ - - }, { - key: "_setupEventHandlers", - value: function _setupEventHandlers() { - this._handleDocumentClickBound = this._handleDocumentClick.bind(this); - this._handleTargetClickBound = this._handleTargetClick.bind(this); - this._handleOriginClickBound = this._handleOriginClick.bind(this); - - this.el.addEventListener('click', this._handleTargetClickBound); - this.originEl.addEventListener('click', this._handleOriginClickBound); - - // Resize - var throttledResize = M.throttle(this._handleResize, 200); - this._handleThrottledResizeBound = throttledResize.bind(this); - - window.addEventListener('resize', this._handleThrottledResizeBound); - } - - /** - * Remove Event Handlers - */ - - }, { - key: "_removeEventHandlers", - value: function _removeEventHandlers() { - this.el.removeEventListener('click', this._handleTargetClickBound); - this.originEl.removeEventListener('click', this._handleOriginClickBound); - window.removeEventListener('resize', this._handleThrottledResizeBound); - } - - /** - * Handle Target Click - * @param {Event} e - */ - - }, { - key: "_handleTargetClick", - value: function _handleTargetClick(e) { - this.open(); - } - - /** - * Handle Origin Click - * @param {Event} e - */ - - }, { - key: "_handleOriginClick", - value: function _handleOriginClick(e) { - this.close(); - } - - /** - * Handle Resize - * @param {Event} e - */ - - }, { - key: "_handleResize", - value: function _handleResize(e) { - this._calculatePositioning(); - } - - /** - * Handle Resize - * @param {Event} e - */ - - }, { - key: "_handleDocumentClick", - value: function _handleDocumentClick(e) { - if (!$(e.target).closest('.tap-target-wrapper').length) { - this.close(); - e.preventDefault(); - e.stopPropagation(); - } - } - - /** - * Setup Tap Target - */ - - }, { - key: "_setup", - value: function _setup() { - // Creating tap target - this.wrapper = this.$el.parent()[0]; - this.waveEl = $(this.wrapper).find('.tap-target-wave')[0]; - this.originEl = $(this.wrapper).find('.tap-target-origin')[0]; - this.contentEl = this.$el.find('.tap-target-content')[0]; - - // Creating wrapper - if (!$(this.wrapper).hasClass('.tap-target-wrapper')) { - this.wrapper = document.createElement('div'); - this.wrapper.classList.add('tap-target-wrapper'); - this.$el.before($(this.wrapper)); - this.wrapper.append(this.el); - } - - // Creating content - if (!this.contentEl) { - this.contentEl = document.createElement('div'); - this.contentEl.classList.add('tap-target-content'); - this.$el.append(this.contentEl); - } - - // Creating foreground wave - if (!this.waveEl) { - this.waveEl = document.createElement('div'); - this.waveEl.classList.add('tap-target-wave'); - - // Creating origin - if (!this.originEl) { - this.originEl = this.$origin.clone(true, true); - this.originEl.addClass('tap-target-origin'); - this.originEl.removeAttr('id'); - this.originEl.removeAttr('style'); - this.originEl = this.originEl[0]; - this.waveEl.append(this.originEl); - } - - this.wrapper.append(this.waveEl); - } - } - - /** - * Calculate positioning - */ - - }, { - key: "_calculatePositioning", - value: function _calculatePositioning() { - // Element or parent is fixed position? - var isFixed = this.$origin.css('position') === 'fixed'; - if (!isFixed) { - var parents = this.$origin.parents(); - for (var i = 0; i < parents.length; i++) { - isFixed = $(parents[i]).css('position') == 'fixed'; - if (isFixed) { - break; - } - } - } - - // Calculating origin - var originWidth = this.$origin.outerWidth(); - var originHeight = this.$origin.outerHeight(); - var originTop = isFixed ? this.$origin.offset().top - M.getDocumentScrollTop() : this.$origin.offset().top; - var originLeft = isFixed ? this.$origin.offset().left - M.getDocumentScrollLeft() : this.$origin.offset().left; - - // Calculating screen - var windowWidth = window.innerWidth; - var windowHeight = window.innerHeight; - var centerX = windowWidth / 2; - var centerY = windowHeight / 2; - var isLeft = originLeft <= centerX; - var isRight = originLeft > centerX; - var isTop = originTop <= centerY; - var isBottom = originTop > centerY; - var isCenterX = originLeft >= windowWidth * 0.25 && originLeft <= windowWidth * 0.75; - - // Calculating tap target - var tapTargetWidth = this.$el.outerWidth(); - var tapTargetHeight = this.$el.outerHeight(); - var tapTargetTop = originTop + originHeight / 2 - tapTargetHeight / 2; - var tapTargetLeft = originLeft + originWidth / 2 - tapTargetWidth / 2; - var tapTargetPosition = isFixed ? 'fixed' : 'absolute'; - - // Calculating content - var tapTargetTextWidth = isCenterX ? tapTargetWidth : tapTargetWidth / 2 + originWidth; - var tapTargetTextHeight = tapTargetHeight / 2; - var tapTargetTextTop = isTop ? tapTargetHeight / 2 : 0; - var tapTargetTextBottom = 0; - var tapTargetTextLeft = isLeft && !isCenterX ? tapTargetWidth / 2 - originWidth : 0; - var tapTargetTextRight = 0; - var tapTargetTextPadding = originWidth; - var tapTargetTextAlign = isBottom ? 'bottom' : 'top'; - - // Calculating wave - var tapTargetWaveWidth = originWidth > originHeight ? originWidth * 2 : originWidth * 2; - var tapTargetWaveHeight = tapTargetWaveWidth; - var tapTargetWaveTop = tapTargetHeight / 2 - tapTargetWaveHeight / 2; - var tapTargetWaveLeft = tapTargetWidth / 2 - tapTargetWaveWidth / 2; - - // Setting tap target - var tapTargetWrapperCssObj = {}; - tapTargetWrapperCssObj.top = isTop ? tapTargetTop + 'px' : ''; - tapTargetWrapperCssObj.right = isRight ? windowWidth - tapTargetLeft - tapTargetWidth + 'px' : ''; - tapTargetWrapperCssObj.bottom = isBottom ? windowHeight - tapTargetTop - tapTargetHeight + 'px' : ''; - tapTargetWrapperCssObj.left = isLeft ? tapTargetLeft + 'px' : ''; - tapTargetWrapperCssObj.position = tapTargetPosition; - $(this.wrapper).css(tapTargetWrapperCssObj); - - // Setting content - $(this.contentEl).css({ - width: tapTargetTextWidth + 'px', - height: tapTargetTextHeight + 'px', - top: tapTargetTextTop + 'px', - right: tapTargetTextRight + 'px', - bottom: tapTargetTextBottom + 'px', - left: tapTargetTextLeft + 'px', - padding: tapTargetTextPadding + 'px', - verticalAlign: tapTargetTextAlign - }); - - // Setting wave - $(this.waveEl).css({ - top: tapTargetWaveTop + 'px', - left: tapTargetWaveLeft + 'px', - width: tapTargetWaveWidth + 'px', - height: tapTargetWaveHeight + 'px' - }); - } - - /** - * Open TapTarget - */ - - }, { - key: "open", - value: function open() { - if (this.isOpen) { - return; - } - - // onOpen callback - if (typeof this.options.onOpen === 'function') { - this.options.onOpen.call(this, this.$origin[0]); - } - - this.isOpen = true; - this.wrapper.classList.add('open'); - - document.body.addEventListener('click', this._handleDocumentClickBound, true); - document.body.addEventListener('touchend', this._handleDocumentClickBound); - } - - /** - * Close Tap Target - */ - - }, { - key: "close", - value: function close() { - if (!this.isOpen) { - return; - } - - // onClose callback - if (typeof this.options.onClose === 'function') { - this.options.onClose.call(this, this.$origin[0]); - } - - this.isOpen = false; - this.wrapper.classList.remove('open'); - - document.body.removeEventListener('click', this._handleDocumentClickBound, true); - document.body.removeEventListener('touchend', this._handleDocumentClickBound); - } - }], [{ - key: "init", - value: function init(els, options) { - return _get(TapTarget.__proto__ || Object.getPrototypeOf(TapTarget), "init", this).call(this, this, els, options); - } - - /** - * Get Instance - */ - - }, { - key: "getInstance", - value: function getInstance(el) { - var domElem = !!el.jquery ? el[0] : el; - return domElem.M_TapTarget; - } - }, { - key: "defaults", - get: function () { - return _defaults; - } - }]); - - return TapTarget; - }(Component); - - M.TapTarget = TapTarget; - - if (M.jQueryLoaded) { - M.initializeJqueryWrapper(TapTarget, 'tapTarget', 'M_TapTarget'); - } -})(cash); -;(function ($) { - 'use strict'; - - var _defaults = { - classes: '', - dropdownOptions: {} - }; - - /** - * @class - * - */ - - var FormSelect = function (_Component20) { - _inherits(FormSelect, _Component20); - - /** - * Construct FormSelect instance - * @constructor - * @param {Element} el - * @param {Object} options - */ - function FormSelect(el, options) { - _classCallCheck(this, FormSelect); - - // Don't init if browser default version - var _this68 = _possibleConstructorReturn(this, (FormSelect.__proto__ || Object.getPrototypeOf(FormSelect)).call(this, FormSelect, el, options)); - - if (_this68.$el.hasClass('browser-default')) { - return _possibleConstructorReturn(_this68); - } - - _this68.el.M_FormSelect = _this68; - - /** - * Options for the select - * @member FormSelect#options - */ - _this68.options = $.extend({}, FormSelect.defaults, options); - - _this68.isMultiple = _this68.$el.prop('multiple'); - - // Setup - _this68.el.tabIndex = -1; - _this68._keysSelected = {}; - _this68._valueDict = {}; // Maps key to original and generated option element. - _this68._setupDropdown(); - - _this68._setupEventHandlers(); - return _this68; - } - - _createClass(FormSelect, [{ - key: "destroy", - - - /** - * Teardown component - */ - value: function destroy() { - this._removeEventHandlers(); - this._removeDropdown(); - this.el.M_FormSelect = undefined; - } - - /** - * Setup Event Handlers - */ - - }, { - key: "_setupEventHandlers", - value: function _setupEventHandlers() { - var _this69 = this; - - this._handleSelectChangeBound = this._handleSelectChange.bind(this); - this._handleOptionClickBound = this._handleOptionClick.bind(this); - this._handleInputClickBound = this._handleInputClick.bind(this); - - $(this.dropdownOptions).find('li:not(.optgroup)').each(function (el) { - el.addEventListener('click', _this69._handleOptionClickBound); - }); - this.el.addEventListener('change', this._handleSelectChangeBound); - this.input.addEventListener('click', this._handleInputClickBound); - } - - /** - * Remove Event Handlers - */ - - }, { - key: "_removeEventHandlers", - value: function _removeEventHandlers() { - var _this70 = this; - - $(this.dropdownOptions).find('li:not(.optgroup)').each(function (el) { - el.removeEventListener('click', _this70._handleOptionClickBound); - }); - this.el.removeEventListener('change', this._handleSelectChangeBound); - this.input.removeEventListener('click', this._handleInputClickBound); - } - - /** - * Handle Select Change - * @param {Event} e - */ - - }, { - key: "_handleSelectChange", - value: function _handleSelectChange(e) { - this._setValueToInput(); - } - - /** - * Handle Option Click - * @param {Event} e - */ - - }, { - key: "_handleOptionClick", - value: function _handleOptionClick(e) { - e.preventDefault(); - var optionEl = $(e.target).closest('li')[0]; - this._selectOption(optionEl); - e.stopPropagation(); - } - }, { - key: "_selectOption", - value: function _selectOption(optionEl) { - var key = optionEl.id; - if (!$(optionEl).hasClass('disabled') && !$(optionEl).hasClass('optgroup') && key.length) { - var selected = true; - - if (this.isMultiple) { - // Deselect placeholder option if still selected. - var placeholderOption = $(this.dropdownOptions).find('li.disabled.selected'); - if (placeholderOption.length) { - placeholderOption.removeClass('selected'); - placeholderOption.find('input[type="checkbox"]').prop('checked', false); - this._toggleEntryFromArray(placeholderOption[0].id); - } - selected = this._toggleEntryFromArray(key); - } else { - $(this.dropdownOptions).find('li').removeClass('selected'); - $(optionEl).toggleClass('selected', selected); - this._keysSelected = {}; - this._keysSelected[optionEl.id] = true; - } - - // Set selected on original select option - // Only trigger if selected state changed - var prevSelected = $(this._valueDict[key].el).prop('selected'); - if (prevSelected !== selected) { - $(this._valueDict[key].el).prop('selected', selected); - this.$el.trigger('change'); - } - } - - if (!this.isMultiple) { - this.dropdown.close(); - } - } - - /** - * Handle Input Click - */ - - }, { - key: "_handleInputClick", - value: function _handleInputClick() { - if (this.dropdown && this.dropdown.isOpen) { - this._setValueToInput(); - this._setSelectedStates(); - } - } - - /** - * Setup dropdown - */ - - }, { - key: "_setupDropdown", - value: function _setupDropdown() { - var _this71 = this; - - this.wrapper = document.createElement('div'); - $(this.wrapper).addClass('select-wrapper ' + this.options.classes); - this.$el.before($(this.wrapper)); - // Move actual select element into overflow hidden wrapper - var $hideSelect = $('
    '); - $(this.wrapper).append($hideSelect); - $hideSelect[0].appendChild(this.el); - - if (this.el.disabled) { - this.wrapper.classList.add('disabled'); - } - - // Create dropdown - this.$selectOptions = this.$el.children('option, optgroup'); - this.dropdownOptions = document.createElement('ul'); - this.dropdownOptions.id = "select-options-" + M.guid(); - $(this.dropdownOptions).addClass('dropdown-content select-dropdown ' + (this.isMultiple ? 'multiple-select-dropdown' : '')); - - // Create dropdown structure. - if (this.$selectOptions.length) { - this.$selectOptions.each(function (el) { - if ($(el).is('option')) { - // Direct descendant option. - var optionEl = void 0; - if (_this71.isMultiple) { - optionEl = _this71._appendOptionWithIcon(_this71.$el, el, 'multiple'); - } else { - optionEl = _this71._appendOptionWithIcon(_this71.$el, el); - } - - _this71._addOptionToValueDict(el, optionEl); - } else if ($(el).is('optgroup')) { - // Optgroup. - var selectOptions = $(el).children('option'); - $(_this71.dropdownOptions).append($('
  • ' + el.getAttribute('label') + '
  • ')[0]); - - selectOptions.each(function (el) { - var optionEl = _this71._appendOptionWithIcon(_this71.$el, el, 'optgroup-option'); - _this71._addOptionToValueDict(el, optionEl); - }); - } - }); - } - - $(this.wrapper).append(this.dropdownOptions); - - // Add input dropdown - this.input = document.createElement('input'); - $(this.input).addClass('select-dropdown dropdown-trigger'); - this.input.setAttribute('type', 'text'); - this.input.setAttribute('readonly', 'true'); - this.input.setAttribute('data-target', this.dropdownOptions.id); - if (this.el.disabled) { - $(this.input).prop('disabled', 'true'); - } - - $(this.wrapper).prepend(this.input); - this._setValueToInput(); - - // Add caret - var dropdownIcon = $(''); - $(this.wrapper).prepend(dropdownIcon[0]); - - // Initialize dropdown - if (!this.el.disabled) { - var dropdownOptions = $.extend({}, this.options.dropdownOptions); - var userOnOpenEnd = dropdownOptions.onOpenEnd; - - // Add callback for centering selected option when dropdown content is scrollable - dropdownOptions.onOpenEnd = function (el) { - var selectedOption = $(_this71.dropdownOptions).find('.selected').first(); - - if (selectedOption.length) { - // Focus selected option in dropdown - M.keyDown = true; - _this71.dropdown.focusedIndex = selectedOption.index(); - _this71.dropdown._focusFocusedItem(); - M.keyDown = false; - - // Handle scrolling to selected option - if (_this71.dropdown.isScrollable) { - var scrollOffset = selectedOption[0].getBoundingClientRect().top - _this71.dropdownOptions.getBoundingClientRect().top; // scroll to selected option - scrollOffset -= _this71.dropdownOptions.clientHeight / 2; // center in dropdown - _this71.dropdownOptions.scrollTop = scrollOffset; - } - } - - // Handle user declared onOpenEnd if needed - if (userOnOpenEnd && typeof userOnOpenEnd === 'function') { - userOnOpenEnd.call(_this71.dropdown, _this71.el); - } - }; - - // Prevent dropdown from closing too early - dropdownOptions.closeOnClick = false; - - this.dropdown = M.Dropdown.init(this.input, dropdownOptions); - } - - // Add initial selections - this._setSelectedStates(); - } - - /** - * Add option to value dict - * @param {Element} el original option element - * @param {Element} optionEl generated option element - */ - - }, { - key: "_addOptionToValueDict", - value: function _addOptionToValueDict(el, optionEl) { - var index = Object.keys(this._valueDict).length; - var key = this.dropdownOptions.id + index; - var obj = {}; - optionEl.id = key; - - obj.el = el; - obj.optionEl = optionEl; - this._valueDict[key] = obj; - } - - /** - * Remove dropdown - */ - - }, { - key: "_removeDropdown", - value: function _removeDropdown() { - $(this.wrapper).find('.caret').remove(); - $(this.input).remove(); - $(this.dropdownOptions).remove(); - $(this.wrapper).before(this.$el); - $(this.wrapper).remove(); - } - - /** - * Setup dropdown - * @param {Element} select select element - * @param {Element} option option element from select - * @param {String} type - * @return {Element} option element added - */ - - }, { - key: "_appendOptionWithIcon", - value: function _appendOptionWithIcon(select, option, type) { - // Add disabled attr if disabled - var disabledClass = option.disabled ? 'disabled ' : ''; - var optgroupClass = type === 'optgroup-option' ? 'optgroup-option ' : ''; - var multipleCheckbox = this.isMultiple ? "" : option.innerHTML; - var liEl = $('
  • '); - var spanEl = $(''); - spanEl.html(multipleCheckbox); - liEl.addClass(disabledClass + " " + optgroupClass); - liEl.append(spanEl); - - // add icons - var iconUrl = option.getAttribute('data-icon'); - if (!!iconUrl) { - var imgEl = $("\"\""); - liEl.prepend(imgEl); - } - - // Check for multiple type. - $(this.dropdownOptions).append(liEl[0]); - return liEl[0]; - } - - /** - * Toggle entry from option - * @param {String} key Option key - * @return {Boolean} if entry was added or removed - */ - - }, { - key: "_toggleEntryFromArray", - value: function _toggleEntryFromArray(key) { - var notAdded = !this._keysSelected.hasOwnProperty(key); - var $optionLi = $(this._valueDict[key].optionEl); - - if (notAdded) { - this._keysSelected[key] = true; - } else { - delete this._keysSelected[key]; - } - - $optionLi.toggleClass('selected', notAdded); - - // Set checkbox checked value - $optionLi.find('input[type="checkbox"]').prop('checked', notAdded); - - // use notAdded instead of true (to detect if the option is selected or not) - $optionLi.prop('selected', notAdded); - - return notAdded; - } - - /** - * Set text value to input - */ - - }, { - key: "_setValueToInput", - value: function _setValueToInput() { - var values = []; - var options = this.$el.find('option'); - - options.each(function (el) { - if ($(el).prop('selected')) { - var text = $(el).text().trim(); - values.push(text); - } - }); - - if (!values.length) { - var firstDisabled = this.$el.find('option:disabled').eq(0); - if (firstDisabled.length && firstDisabled[0].value === '') { - values.push(firstDisabled.text()); - } - } - - this.input.value = values.join(', '); - } - - /** - * Set selected state of dropdown to match actual select element - */ - - }, { - key: "_setSelectedStates", - value: function _setSelectedStates() { - this._keysSelected = {}; - - for (var key in this._valueDict) { - var option = this._valueDict[key]; - var optionIsSelected = $(option.el).prop('selected'); - $(option.optionEl).find('input[type="checkbox"]').prop('checked', optionIsSelected); - if (optionIsSelected) { - this._activateOption($(this.dropdownOptions), $(option.optionEl)); - this._keysSelected[key] = true; - } else { - $(option.optionEl).removeClass('selected'); - } - } - } - - /** - * Make option as selected and scroll to selected position - * @param {jQuery} collection Select options jQuery element - * @param {Element} newOption element of the new option - */ - - }, { - key: "_activateOption", - value: function _activateOption(collection, newOption) { - if (newOption) { - if (!this.isMultiple) { - collection.find('li.selected').removeClass('selected'); - } - var option = $(newOption); - option.addClass('selected'); - } - } - - /** - * Get Selected Values - * @return {Array} Array of selected values - */ - - }, { - key: "getSelectedValues", - value: function getSelectedValues() { - var selectedValues = []; - for (var key in this._keysSelected) { - selectedValues.push(this._valueDict[key].el.value); - } - return selectedValues; - } - }], [{ - key: "init", - value: function init(els, options) { - return _get(FormSelect.__proto__ || Object.getPrototypeOf(FormSelect), "init", this).call(this, this, els, options); - } - - /** - * Get Instance - */ - - }, { - key: "getInstance", - value: function getInstance(el) { - var domElem = !!el.jquery ? el[0] : el; - return domElem.M_FormSelect; - } - }, { - key: "defaults", - get: function () { - return _defaults; - } - }]); - - return FormSelect; - }(Component); - - M.FormSelect = FormSelect; - - if (M.jQueryLoaded) { - M.initializeJqueryWrapper(FormSelect, 'formSelect', 'M_FormSelect'); - } -})(cash); -;(function ($, anim) { - 'use strict'; - - var _defaults = {}; - - /** - * @class - * - */ - - var Range = function (_Component21) { - _inherits(Range, _Component21); - - /** - * Construct Range instance - * @constructor - * @param {Element} el - * @param {Object} options - */ - function Range(el, options) { - _classCallCheck(this, Range); - - var _this72 = _possibleConstructorReturn(this, (Range.__proto__ || Object.getPrototypeOf(Range)).call(this, Range, el, options)); - - _this72.el.M_Range = _this72; - - /** - * Options for the range - * @member Range#options - */ - _this72.options = $.extend({}, Range.defaults, options); - - _this72._mousedown = false; - - // Setup - _this72._setupThumb(); - - _this72._setupEventHandlers(); - return _this72; - } - - _createClass(Range, [{ - key: "destroy", - - - /** - * Teardown component - */ - value: function destroy() { - this._removeEventHandlers(); - this._removeThumb(); - this.el.M_Range = undefined; - } - - /** - * Setup Event Handlers - */ - - }, { - key: "_setupEventHandlers", - value: function _setupEventHandlers() { - this._handleRangeChangeBound = this._handleRangeChange.bind(this); - this._handleRangeMousedownTouchstartBound = this._handleRangeMousedownTouchstart.bind(this); - this._handleRangeInputMousemoveTouchmoveBound = this._handleRangeInputMousemoveTouchmove.bind(this); - this._handleRangeMouseupTouchendBound = this._handleRangeMouseupTouchend.bind(this); - this._handleRangeBlurMouseoutTouchleaveBound = this._handleRangeBlurMouseoutTouchleave.bind(this); - - this.el.addEventListener('change', this._handleRangeChangeBound); - - this.el.addEventListener('mousedown', this._handleRangeMousedownTouchstartBound); - this.el.addEventListener('touchstart', this._handleRangeMousedownTouchstartBound); - - this.el.addEventListener('input', this._handleRangeInputMousemoveTouchmoveBound); - this.el.addEventListener('mousemove', this._handleRangeInputMousemoveTouchmoveBound); - this.el.addEventListener('touchmove', this._handleRangeInputMousemoveTouchmoveBound); - - this.el.addEventListener('mouseup', this._handleRangeMouseupTouchendBound); - this.el.addEventListener('touchend', this._handleRangeMouseupTouchendBound); - - this.el.addEventListener('blur', this._handleRangeBlurMouseoutTouchleaveBound); - this.el.addEventListener('mouseout', this._handleRangeBlurMouseoutTouchleaveBound); - this.el.addEventListener('touchleave', this._handleRangeBlurMouseoutTouchleaveBound); - } - - /** - * Remove Event Handlers - */ - - }, { - key: "_removeEventHandlers", - value: function _removeEventHandlers() { - this.el.removeEventListener('change', this._handleRangeChangeBound); - - this.el.removeEventListener('mousedown', this._handleRangeMousedownTouchstartBound); - this.el.removeEventListener('touchstart', this._handleRangeMousedownTouchstartBound); - - this.el.removeEventListener('input', this._handleRangeInputMousemoveTouchmoveBound); - this.el.removeEventListener('mousemove', this._handleRangeInputMousemoveTouchmoveBound); - this.el.removeEventListener('touchmove', this._handleRangeInputMousemoveTouchmoveBound); - - this.el.removeEventListener('mouseup', this._handleRangeMouseupTouchendBound); - this.el.removeEventListener('touchend', this._handleRangeMouseupTouchendBound); - - this.el.removeEventListener('blur', this._handleRangeBlurMouseoutTouchleaveBound); - this.el.removeEventListener('mouseout', this._handleRangeBlurMouseoutTouchleaveBound); - this.el.removeEventListener('touchleave', this._handleRangeBlurMouseoutTouchleaveBound); - } - - /** - * Handle Range Change - * @param {Event} e - */ - - }, { - key: "_handleRangeChange", - value: function _handleRangeChange() { - $(this.value).html(this.$el.val()); - - if (!$(this.thumb).hasClass('active')) { - this._showRangeBubble(); - } - - var offsetLeft = this._calcRangeOffset(); - $(this.thumb).addClass('active').css('left', offsetLeft + 'px'); - } - - /** - * Handle Range Mousedown and Touchstart - * @param {Event} e - */ - - }, { - key: "_handleRangeMousedownTouchstart", - value: function _handleRangeMousedownTouchstart(e) { - // Set indicator value - $(this.value).html(this.$el.val()); - - this._mousedown = true; - this.$el.addClass('active'); - - if (!$(this.thumb).hasClass('active')) { - this._showRangeBubble(); - } - - if (e.type !== 'input') { - var offsetLeft = this._calcRangeOffset(); - $(this.thumb).addClass('active').css('left', offsetLeft + 'px'); - } - } - - /** - * Handle Range Input, Mousemove and Touchmove - */ - - }, { - key: "_handleRangeInputMousemoveTouchmove", - value: function _handleRangeInputMousemoveTouchmove() { - if (this._mousedown) { - if (!$(this.thumb).hasClass('active')) { - this._showRangeBubble(); - } - - var offsetLeft = this._calcRangeOffset(); - $(this.thumb).addClass('active').css('left', offsetLeft + 'px'); - $(this.value).html(this.$el.val()); - } - } - - /** - * Handle Range Mouseup and Touchend - */ - - }, { - key: "_handleRangeMouseupTouchend", - value: function _handleRangeMouseupTouchend() { - this._mousedown = false; - this.$el.removeClass('active'); - } - - /** - * Handle Range Blur, Mouseout and Touchleave - */ - - }, { - key: "_handleRangeBlurMouseoutTouchleave", - value: function _handleRangeBlurMouseoutTouchleave() { - if (!this._mousedown) { - var paddingLeft = parseInt(this.$el.css('padding-left')); - var marginLeft = 7 + paddingLeft + 'px'; - - if ($(this.thumb).hasClass('active')) { - anim.remove(this.thumb); - anim({ - targets: this.thumb, - height: 0, - width: 0, - top: 10, - easing: 'easeOutQuad', - marginLeft: marginLeft, - duration: 100 - }); - } - $(this.thumb).removeClass('active'); - } - } - - /** - * Setup dropdown - */ - - }, { - key: "_setupThumb", - value: function _setupThumb() { - this.thumb = document.createElement('span'); - this.value = document.createElement('span'); - $(this.thumb).addClass('thumb'); - $(this.value).addClass('value'); - $(this.thumb).append(this.value); - this.$el.after(this.thumb); - } - - /** - * Remove dropdown - */ - - }, { - key: "_removeThumb", - value: function _removeThumb() { - $(this.thumb).remove(); - } - - /** - * morph thumb into bubble - */ - - }, { - key: "_showRangeBubble", - value: function _showRangeBubble() { - var paddingLeft = parseInt($(this.thumb).parent().css('padding-left')); - var marginLeft = -7 + paddingLeft + 'px'; // TODO: fix magic number? - anim.remove(this.thumb); - anim({ - targets: this.thumb, - height: 30, - width: 30, - top: -30, - marginLeft: marginLeft, - duration: 300, - easing: 'easeOutQuint' - }); - } - - /** - * Calculate the offset of the thumb - * @return {Number} offset in pixels - */ - - }, { - key: "_calcRangeOffset", - value: function _calcRangeOffset() { - var width = this.$el.width() - 15; - var max = parseFloat(this.$el.attr('max')) || 100; // Range default max - var min = parseFloat(this.$el.attr('min')) || 0; // Range default min - var percent = (parseFloat(this.$el.val()) - min) / (max - min); - return percent * width; - } - }], [{ - key: "init", - value: function init(els, options) { - return _get(Range.__proto__ || Object.getPrototypeOf(Range), "init", this).call(this, this, els, options); - } - - /** - * Get Instance - */ - - }, { - key: "getInstance", - value: function getInstance(el) { - var domElem = !!el.jquery ? el[0] : el; - return domElem.M_Range; - } - }, { - key: "defaults", - get: function () { - return _defaults; - } - }]); - - return Range; - }(Component); - - M.Range = Range; - - if (M.jQueryLoaded) { - M.initializeJqueryWrapper(Range, 'range', 'M_Range'); - } - - Range.init($('input[type=range]')); -})(cash, M.anime); - -//# sourceMappingURL=materialize_concat.js.map -//# sourceMappingURL=materialize.js.map +var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; + +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; }; }(); + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +/*! cash-dom 1.3.5, https://github.com/kenwheeler/cash @license MIT */ +(function (factory) { + window.cash = factory(); +})(function () { + var doc = document, + win = window, + ArrayProto = Array.prototype, + slice = ArrayProto.slice, + filter = ArrayProto.filter, + push = ArrayProto.push; + + var noop = function () {}, + isFunction = function (item) { + // @see https://crbug.com/568448 + return typeof item === typeof noop && item.call; + }, + isString = function (item) { + return typeof item === typeof ""; + }; + + var idMatch = /^#[\w-]*$/, + classMatch = /^\.[\w-]*$/, + htmlMatch = /<.+>/, + singlet = /^\w+$/; + + function find(selector, context) { + context = context || doc; + var elems = classMatch.test(selector) ? context.getElementsByClassName(selector.slice(1)) : singlet.test(selector) ? context.getElementsByTagName(selector) : context.querySelectorAll(selector); + return elems; + } + + var frag; + function parseHTML(str) { + if (!frag) { + frag = doc.implementation.createHTMLDocument(null); + var base = frag.createElement("base"); + base.href = doc.location.href; + frag.head.appendChild(base); + } + + frag.body.innerHTML = str; + + return frag.body.childNodes; + } + + function onReady(fn) { + if (doc.readyState !== "loading") { + fn(); + } else { + doc.addEventListener("DOMContentLoaded", fn); + } + } + + function Init(selector, context) { + if (!selector) { + return this; + } + + // If already a cash collection, don't do any further processing + if (selector.cash && selector !== win) { + return selector; + } + + var elems = selector, + i = 0, + length; + + if (isString(selector)) { + elems = idMatch.test(selector) ? + // If an ID use the faster getElementById check + doc.getElementById(selector.slice(1)) : htmlMatch.test(selector) ? + // If HTML, parse it into real elements + parseHTML(selector) : + // else use `find` + find(selector, context); + + // If function, use as shortcut for DOM ready + } else if (isFunction(selector)) { + onReady(selector);return this; + } + + if (!elems) { + return this; + } + + // If a single DOM element is passed in or received via ID, return the single element + if (elems.nodeType || elems === win) { + this[0] = elems; + this.length = 1; + } else { + // Treat like an array and loop through each item. + length = this.length = elems.length; + for (; i < length; i++) { + this[i] = elems[i]; + } + } + + return this; + } + + function cash(selector, context) { + return new Init(selector, context); + } + + var fn = cash.fn = cash.prototype = Init.prototype = { // jshint ignore:line + cash: true, + length: 0, + push: push, + splice: ArrayProto.splice, + map: ArrayProto.map, + init: Init + }; + + Object.defineProperty(fn, "constructor", { value: cash }); + + cash.parseHTML = parseHTML; + cash.noop = noop; + cash.isFunction = isFunction; + cash.isString = isString; + + cash.extend = fn.extend = function (target) { + target = target || {}; + + var args = slice.call(arguments), + length = args.length, + i = 1; + + if (args.length === 1) { + target = this; + i = 0; + } + + for (; i < length; i++) { + if (!args[i]) { + continue; + } + for (var key in args[i]) { + if (args[i].hasOwnProperty(key)) { + target[key] = args[i][key]; + } + } + } + + return target; + }; + + function each(collection, callback) { + var l = collection.length, + i = 0; + + for (; i < l; i++) { + if (callback.call(collection[i], collection[i], i, collection) === false) { + break; + } + } + } + + function matches(el, selector) { + var m = el && (el.matches || el.webkitMatchesSelector || el.mozMatchesSelector || el.msMatchesSelector || el.oMatchesSelector); + return !!m && m.call(el, selector); + } + + function getCompareFunction(selector) { + return ( + /* Use browser's `matches` function if string */ + isString(selector) ? matches : + /* Match a cash element */ + selector.cash ? function (el) { + return selector.is(el); + } : + /* Direct comparison */ + function (el, selector) { + return el === selector; + } + ); + } + + function unique(collection) { + return cash(slice.call(collection).filter(function (item, index, self) { + return self.indexOf(item) === index; + })); + } + + cash.extend({ + merge: function (first, second) { + var len = +second.length, + i = first.length, + j = 0; + + for (; j < len; i++, j++) { + first[i] = second[j]; + } + + first.length = i; + return first; + }, + + each: each, + matches: matches, + unique: unique, + isArray: Array.isArray, + isNumeric: function (n) { + return !isNaN(parseFloat(n)) && isFinite(n); + } + + }); + + var uid = cash.uid = "_cash" + Date.now(); + + function getDataCache(node) { + return node[uid] = node[uid] || {}; + } + + function setData(node, key, value) { + return getDataCache(node)[key] = value; + } + + function getData(node, key) { + var c = getDataCache(node); + if (c[key] === undefined) { + c[key] = node.dataset ? node.dataset[key] : cash(node).attr("data-" + key); + } + return c[key]; + } + + function removeData(node, key) { + var c = getDataCache(node); + if (c) { + delete c[key]; + } else if (node.dataset) { + delete node.dataset[key]; + } else { + cash(node).removeAttr("data-" + name); + } + } + + fn.extend({ + data: function (name, value) { + if (isString(name)) { + return value === undefined ? getData(this[0], name) : this.each(function (v) { + return setData(v, name, value); + }); + } + + for (var key in name) { + this.data(key, name[key]); + } + + return this; + }, + + removeData: function (key) { + return this.each(function (v) { + return removeData(v, key); + }); + } + + }); + + var notWhiteMatch = /\S+/g; + + function getClasses(c) { + return isString(c) && c.match(notWhiteMatch); + } + + function hasClass(v, c) { + return v.classList ? v.classList.contains(c) : new RegExp("(^| )" + c + "( |$)", "gi").test(v.className); + } + + function addClass(v, c, spacedName) { + if (v.classList) { + v.classList.add(c); + } else if (spacedName.indexOf(" " + c + " ")) { + v.className += " " + c; + } + } + + function removeClass(v, c) { + if (v.classList) { + v.classList.remove(c); + } else { + v.className = v.className.replace(c, ""); + } + } + + fn.extend({ + addClass: function (c) { + var classes = getClasses(c); + + return classes ? this.each(function (v) { + var spacedName = " " + v.className + " "; + each(classes, function (c) { + addClass(v, c, spacedName); + }); + }) : this; + }, + + attr: function (name, value) { + if (!name) { + return undefined; + } + + if (isString(name)) { + if (value === undefined) { + return this[0] ? this[0].getAttribute ? this[0].getAttribute(name) : this[0][name] : undefined; + } + + return this.each(function (v) { + if (v.setAttribute) { + v.setAttribute(name, value); + } else { + v[name] = value; + } + }); + } + + for (var key in name) { + this.attr(key, name[key]); + } + + return this; + }, + + hasClass: function (c) { + var check = false, + classes = getClasses(c); + if (classes && classes.length) { + this.each(function (v) { + check = hasClass(v, classes[0]); + return !check; + }); + } + return check; + }, + + prop: function (name, value) { + if (isString(name)) { + return value === undefined ? this[0][name] : this.each(function (v) { + v[name] = value; + }); + } + + for (var key in name) { + this.prop(key, name[key]); + } + + return this; + }, + + removeAttr: function (name) { + return this.each(function (v) { + if (v.removeAttribute) { + v.removeAttribute(name); + } else { + delete v[name]; + } + }); + }, + + removeClass: function (c) { + if (!arguments.length) { + return this.attr("class", ""); + } + var classes = getClasses(c); + return classes ? this.each(function (v) { + each(classes, function (c) { + removeClass(v, c); + }); + }) : this; + }, + + removeProp: function (name) { + return this.each(function (v) { + delete v[name]; + }); + }, + + toggleClass: function (c, state) { + if (state !== undefined) { + return this[state ? "addClass" : "removeClass"](c); + } + var classes = getClasses(c); + return classes ? this.each(function (v) { + var spacedName = " " + v.className + " "; + each(classes, function (c) { + if (hasClass(v, c)) { + removeClass(v, c); + } else { + addClass(v, c, spacedName); + } + }); + }) : this; + } }); + + fn.extend({ + add: function (selector, context) { + return unique(cash.merge(this, cash(selector, context))); + }, + + each: function (callback) { + each(this, callback); + return this; + }, + + eq: function (index) { + return cash(this.get(index)); + }, + + filter: function (selector) { + if (!selector) { + return this; + } + + var comparator = isFunction(selector) ? selector : getCompareFunction(selector); + + return cash(filter.call(this, function (e) { + return comparator(e, selector); + })); + }, + + first: function () { + return this.eq(0); + }, + + get: function (index) { + if (index === undefined) { + return slice.call(this); + } + return index < 0 ? this[index + this.length] : this[index]; + }, + + index: function (elem) { + var child = elem ? cash(elem)[0] : this[0], + collection = elem ? this : cash(child).parent().children(); + return slice.call(collection).indexOf(child); + }, + + last: function () { + return this.eq(-1); + } + + }); + + var camelCase = function () { + var camelRegex = /(?:^\w|[A-Z]|\b\w)/g, + whiteSpace = /[\s-_]+/g; + return function (str) { + return str.replace(camelRegex, function (letter, index) { + return letter[index === 0 ? "toLowerCase" : "toUpperCase"](); + }).replace(whiteSpace, ""); + }; + }(); + + var getPrefixedProp = function () { + var cache = {}, + doc = document, + div = doc.createElement("div"), + style = div.style; + + return function (prop) { + prop = camelCase(prop); + if (cache[prop]) { + return cache[prop]; + } + + var ucProp = prop.charAt(0).toUpperCase() + prop.slice(1), + prefixes = ["webkit", "moz", "ms", "o"], + props = (prop + " " + prefixes.join(ucProp + " ") + ucProp).split(" "); + + each(props, function (p) { + if (p in style) { + cache[p] = prop = cache[prop] = p; + return false; + } + }); + + return cache[prop]; + }; + }(); + + cash.prefixedProp = getPrefixedProp; + cash.camelCase = camelCase; + + fn.extend({ + css: function (prop, value) { + if (isString(prop)) { + prop = getPrefixedProp(prop); + return arguments.length > 1 ? this.each(function (v) { + return v.style[prop] = value; + }) : win.getComputedStyle(this[0])[prop]; + } + + for (var key in prop) { + this.css(key, prop[key]); + } + + return this; + } + + }); + + function compute(el, prop) { + return parseInt(win.getComputedStyle(el[0], null)[prop], 10) || 0; + } + + each(["Width", "Height"], function (v) { + var lower = v.toLowerCase(); + + fn[lower] = function () { + return this[0].getBoundingClientRect()[lower]; + }; + + fn["inner" + v] = function () { + return this[0]["client" + v]; + }; + + fn["outer" + v] = function (margins) { + return this[0]["offset" + v] + (margins ? compute(this, "margin" + (v === "Width" ? "Left" : "Top")) + compute(this, "margin" + (v === "Width" ? "Right" : "Bottom")) : 0); + }; + }); + + function registerEvent(node, eventName, callback) { + var eventCache = getData(node, "_cashEvents") || setData(node, "_cashEvents", {}); + eventCache[eventName] = eventCache[eventName] || []; + eventCache[eventName].push(callback); + node.addEventListener(eventName, callback); + } + + function removeEvent(node, eventName, callback) { + var events = getData(node, "_cashEvents"), + eventCache = events && events[eventName], + index; + + if (!eventCache) { + return; + } + + if (callback) { + node.removeEventListener(eventName, callback); + index = eventCache.indexOf(callback); + if (index >= 0) { + eventCache.splice(index, 1); + } + } else { + each(eventCache, function (event) { + node.removeEventListener(eventName, event); + }); + eventCache = []; + } + } + + fn.extend({ + off: function (eventName, callback) { + return this.each(function (v) { + return removeEvent(v, eventName, callback); + }); + }, + + on: function (eventName, delegate, callback, runOnce) { + // jshint ignore:line + var originalCallback; + if (!isString(eventName)) { + for (var key in eventName) { + this.on(key, delegate, eventName[key]); + } + return this; + } + + if (isFunction(delegate)) { + callback = delegate; + delegate = null; + } + + if (eventName === "ready") { + onReady(callback); + return this; + } + + if (delegate) { + originalCallback = callback; + callback = function (e) { + var t = e.target; + while (!matches(t, delegate)) { + if (t === this || t === null) { + return t = false; + } + + t = t.parentNode; + } + + if (t) { + originalCallback.call(t, e); + } + }; + } + + return this.each(function (v) { + var finalCallback = callback; + if (runOnce) { + finalCallback = function () { + callback.apply(this, arguments); + removeEvent(v, eventName, finalCallback); + }; + } + registerEvent(v, eventName, finalCallback); + }); + }, + + one: function (eventName, delegate, callback) { + return this.on(eventName, delegate, callback, true); + }, + + ready: onReady, + + /** + * Modified + * Triggers browser event + * @param String eventName + * @param Object data - Add properties to event object + */ + trigger: function (eventName, data) { + if (document.createEvent) { + var evt = document.createEvent('HTMLEvents'); + evt.initEvent(eventName, true, false); + evt = this.extend(evt, data); + return this.each(function (v) { + return v.dispatchEvent(evt); + }); + } + } + + }); + + function encode(name, value) { + return "&" + encodeURIComponent(name) + "=" + encodeURIComponent(value).replace(/%20/g, "+"); + } + + function getSelectMultiple_(el) { + var values = []; + each(el.options, function (o) { + if (o.selected) { + values.push(o.value); + } + }); + return values.length ? values : null; + } + + function getSelectSingle_(el) { + var selectedIndex = el.selectedIndex; + return selectedIndex >= 0 ? el.options[selectedIndex].value : null; + } + + function getValue(el) { + var type = el.type; + if (!type) { + return null; + } + switch (type.toLowerCase()) { + case "select-one": + return getSelectSingle_(el); + case "select-multiple": + return getSelectMultiple_(el); + case "radio": + return el.checked ? el.value : null; + case "checkbox": + return el.checked ? el.value : null; + default: + return el.value ? el.value : null; + } + } + + fn.extend({ + serialize: function () { + var query = ""; + + each(this[0].elements || this, function (el) { + if (el.disabled || el.tagName === "FIELDSET") { + return; + } + var name = el.name; + switch (el.type.toLowerCase()) { + case "file": + case "reset": + case "submit": + case "button": + break; + case "select-multiple": + var values = getValue(el); + if (values !== null) { + each(values, function (value) { + query += encode(name, value); + }); + } + break; + default: + var value = getValue(el); + if (value !== null) { + query += encode(name, value); + } + } + }); + + return query.substr(1); + }, + + val: function (value) { + if (value === undefined) { + return getValue(this[0]); + } + + return this.each(function (v) { + return v.value = value; + }); + } + + }); + + function insertElement(el, child, prepend) { + if (prepend) { + var first = el.childNodes[0]; + el.insertBefore(child, first); + } else { + el.appendChild(child); + } + } + + function insertContent(parent, child, prepend) { + var str = isString(child); + + if (!str && child.length) { + each(child, function (v) { + return insertContent(parent, v, prepend); + }); + return; + } + + each(parent, str ? function (v) { + return v.insertAdjacentHTML(prepend ? "afterbegin" : "beforeend", child); + } : function (v, i) { + return insertElement(v, i === 0 ? child : child.cloneNode(true), prepend); + }); + } + + fn.extend({ + after: function (selector) { + cash(selector).insertAfter(this); + return this; + }, + + append: function (content) { + insertContent(this, content); + return this; + }, + + appendTo: function (parent) { + insertContent(cash(parent), this); + return this; + }, + + before: function (selector) { + cash(selector).insertBefore(this); + return this; + }, + + clone: function () { + return cash(this.map(function (v) { + return v.cloneNode(true); + })); + }, + + empty: function () { + this.html(""); + return this; + }, + + html: function (content) { + if (content === undefined) { + return this[0].innerHTML; + } + var source = content.nodeType ? content[0].outerHTML : content; + return this.each(function (v) { + return v.innerHTML = source; + }); + }, + + insertAfter: function (selector) { + var _this = this; + + cash(selector).each(function (el, i) { + var parent = el.parentNode, + sibling = el.nextSibling; + _this.each(function (v) { + parent.insertBefore(i === 0 ? v : v.cloneNode(true), sibling); + }); + }); + + return this; + }, + + insertBefore: function (selector) { + var _this2 = this; + cash(selector).each(function (el, i) { + var parent = el.parentNode; + _this2.each(function (v) { + parent.insertBefore(i === 0 ? v : v.cloneNode(true), el); + }); + }); + return this; + }, + + prepend: function (content) { + insertContent(this, content, true); + return this; + }, + + prependTo: function (parent) { + insertContent(cash(parent), this, true); + return this; + }, + + remove: function () { + return this.each(function (v) { + if (!!v.parentNode) { + return v.parentNode.removeChild(v); + } + }); + }, + + text: function (content) { + if (content === undefined) { + return this[0].textContent; + } + return this.each(function (v) { + return v.textContent = content; + }); + } + + }); + + var docEl = doc.documentElement; + + fn.extend({ + position: function () { + var el = this[0]; + return { + left: el.offsetLeft, + top: el.offsetTop + }; + }, + + offset: function () { + var rect = this[0].getBoundingClientRect(); + return { + top: rect.top + win.pageYOffset - docEl.clientTop, + left: rect.left + win.pageXOffset - docEl.clientLeft + }; + }, + + offsetParent: function () { + return cash(this[0].offsetParent); + } + + }); + + fn.extend({ + children: function (selector) { + var elems = []; + this.each(function (el) { + push.apply(elems, el.children); + }); + elems = unique(elems); + + return !selector ? elems : elems.filter(function (v) { + return matches(v, selector); + }); + }, + + closest: function (selector) { + if (!selector || this.length < 1) { + return cash(); + } + if (this.is(selector)) { + return this.filter(selector); + } + return this.parent().closest(selector); + }, + + is: function (selector) { + if (!selector) { + return false; + } + + var match = false, + comparator = getCompareFunction(selector); + + this.each(function (el) { + match = comparator(el, selector); + return !match; + }); + + return match; + }, + + find: function (selector) { + if (!selector || selector.nodeType) { + return cash(selector && this.has(selector).length ? selector : null); + } + + var elems = []; + this.each(function (el) { + push.apply(elems, find(selector, el)); + }); + + return unique(elems); + }, + + has: function (selector) { + var comparator = isString(selector) ? function (el) { + return find(selector, el).length !== 0; + } : function (el) { + return el.contains(selector); + }; + + return this.filter(comparator); + }, + + next: function () { + return cash(this[0].nextElementSibling); + }, + + not: function (selector) { + if (!selector) { + return this; + } + + var comparator = getCompareFunction(selector); + + return this.filter(function (el) { + return !comparator(el, selector); + }); + }, + + parent: function () { + var result = []; + + this.each(function (item) { + if (item && item.parentNode) { + result.push(item.parentNode); + } + }); + + return unique(result); + }, + + parents: function (selector) { + var last, + result = []; + + this.each(function (item) { + last = item; + + while (last && last.parentNode && last !== doc.body.parentNode) { + last = last.parentNode; + + if (!selector || selector && matches(last, selector)) { + result.push(last); + } + } + }); + + return unique(result); + }, + + prev: function () { + return cash(this[0].previousElementSibling); + }, + + siblings: function (selector) { + var collection = this.parent().children(selector), + el = this[0]; + + return collection.filter(function (i) { + return i !== el; + }); + } + + }); + + return cash; +}); +; +var Component = function () { + /** + * Generic constructor for all components + * @constructor + * @param {Element} el + * @param {Object} options + */ + function Component(classDef, el, options) { + _classCallCheck(this, Component); + + // Display error if el is valid HTML Element + if (!(el instanceof Element)) { + console.error(Error(el + ' is not an HTML Element')); + } + + // If exists, destroy and reinitialize in child + var ins = classDef.getInstance(el); + if (!!ins) { + ins.destroy(); + } + + this.el = el; + this.$el = cash(el); + } + + /** + * Initializes components + * @param {class} classDef + * @param {Element | NodeList | jQuery} els + * @param {Object} options + */ + + + _createClass(Component, null, [{ + key: "init", + value: function init(classDef, els, options) { + var instances = null; + if (els instanceof Element) { + instances = new classDef(els, options); + } else if (!!els && (els.jquery || els.cash || els instanceof NodeList)) { + var instancesArr = []; + for (var i = 0; i < els.length; i++) { + instancesArr.push(new classDef(els[i], options)); + } + instances = instancesArr; + } + + return instances; + } + }]); + + return Component; +}(); + +; // Required for Meteor package, the use of window prevents export by Meteor +(function (window) { + if (window.Package) { + M = {}; + } else { + window.M = {}; + } + + // Check for jQuery + M.jQueryLoaded = !!window.jQuery; +})(window); + +// AMD +if (typeof define === 'function' && define.amd) { + define('M', [], function () { + return M; + }); + + // Common JS +} else if (typeof exports !== 'undefined' && !exports.nodeType) { + if (typeof module !== 'undefined' && !module.nodeType && module.exports) { + exports = module.exports = M; + } + exports.default = M; +} + +M.version = '1.0.0'; + +M.keys = { + TAB: 9, + ENTER: 13, + ESC: 27, + ARROW_UP: 38, + ARROW_DOWN: 40 +}; + +/** + * TabPress Keydown handler + */ +M.tabPressed = false; +M.keyDown = false; +var docHandleKeydown = function (e) { + M.keyDown = true; + if (e.which === M.keys.TAB || e.which === M.keys.ARROW_DOWN || e.which === M.keys.ARROW_UP) { + M.tabPressed = true; + } +}; +var docHandleKeyup = function (e) { + M.keyDown = false; + if (e.which === M.keys.TAB || e.which === M.keys.ARROW_DOWN || e.which === M.keys.ARROW_UP) { + M.tabPressed = false; + } +}; +var docHandleFocus = function (e) { + if (M.keyDown) { + document.body.classList.add('keyboard-focused'); + } +}; +var docHandleBlur = function (e) { + document.body.classList.remove('keyboard-focused'); +}; +document.addEventListener('keydown', docHandleKeydown, true); +document.addEventListener('keyup', docHandleKeyup, true); +document.addEventListener('focus', docHandleFocus, true); +document.addEventListener('blur', docHandleBlur, true); + +/** + * Initialize jQuery wrapper for plugin + * @param {Class} plugin javascript class + * @param {string} pluginName jQuery plugin name + * @param {string} classRef Class reference name + */ +M.initializeJqueryWrapper = function (plugin, pluginName, classRef) { + jQuery.fn[pluginName] = function (methodOrOptions) { + // Call plugin method if valid method name is passed in + if (plugin.prototype[methodOrOptions]) { + var params = Array.prototype.slice.call(arguments, 1); + + // Getter methods + if (methodOrOptions.slice(0, 3) === 'get') { + var instance = this.first()[0][classRef]; + return instance[methodOrOptions].apply(instance, params); + } + + // Void methods + return this.each(function () { + var instance = this[classRef]; + instance[methodOrOptions].apply(instance, params); + }); + + // Initialize plugin if options or no argument is passed in + } else if (typeof methodOrOptions === 'object' || !methodOrOptions) { + plugin.init(this, arguments[0]); + return this; + } + + // Return error if an unrecognized method name is passed in + jQuery.error("Method " + methodOrOptions + " does not exist on jQuery." + pluginName); + }; +}; + +/** + * Automatically initialize components + * @param {Element} context DOM Element to search within for components + */ +M.AutoInit = function (context) { + // Use document.body if no context is given + var root = !!context ? context : document.body; + + var registry = { + Autocomplete: root.querySelectorAll('.autocomplete:not(.no-autoinit)'), + Carousel: root.querySelectorAll('.carousel:not(.no-autoinit)'), + Chips: root.querySelectorAll('.chips:not(.no-autoinit)'), + Collapsible: root.querySelectorAll('.collapsible:not(.no-autoinit)'), + Datepicker: root.querySelectorAll('.datepicker:not(.no-autoinit)'), + Dropdown: root.querySelectorAll('.dropdown-trigger:not(.no-autoinit)'), + Materialbox: root.querySelectorAll('.materialboxed:not(.no-autoinit)'), + Modal: root.querySelectorAll('.modal:not(.no-autoinit)'), + Parallax: root.querySelectorAll('.parallax:not(.no-autoinit)'), + Pushpin: root.querySelectorAll('.pushpin:not(.no-autoinit)'), + ScrollSpy: root.querySelectorAll('.scrollspy:not(.no-autoinit)'), + FormSelect: root.querySelectorAll('select:not(.no-autoinit)'), + Sidenav: root.querySelectorAll('.sidenav:not(.no-autoinit)'), + Tabs: root.querySelectorAll('.tabs:not(.no-autoinit)'), + TapTarget: root.querySelectorAll('.tap-target:not(.no-autoinit)'), + Timepicker: root.querySelectorAll('.timepicker:not(.no-autoinit)'), + Tooltip: root.querySelectorAll('.tooltipped:not(.no-autoinit)'), + FloatingActionButton: root.querySelectorAll('.fixed-action-btn:not(.no-autoinit)') + }; + + for (var pluginName in registry) { + var plugin = M[pluginName]; + plugin.init(registry[pluginName]); + } +}; + +/** + * Generate approximated selector string for a jQuery object + * @param {jQuery} obj jQuery object to be parsed + * @returns {string} + */ +M.objectSelectorString = function (obj) { + var tagStr = obj.prop('tagName') || ''; + var idStr = obj.attr('id') || ''; + var classStr = obj.attr('class') || ''; + return (tagStr + idStr + classStr).replace(/\s/g, ''); +}; + +// Unique Random ID +M.guid = function () { + function s4() { + return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); + } + return function () { + return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4(); + }; +}(); + +/** + * Escapes hash from special characters + * @param {string} hash String returned from this.hash + * @returns {string} + */ +M.escapeHash = function (hash) { + return hash.replace(/(:|\.|\[|\]|,|=|\/)/g, '\\$1'); +}; + +/** + * @typedef {Object} Edges + * @property {Boolean} top If the top edge was exceeded + * @property {Boolean} right If the right edge was exceeded + * @property {Boolean} bottom If the bottom edge was exceeded + * @property {Boolean} left If the left edge was exceeded + */ + +/** + * @typedef {Object} Bounding + * @property {Number} left left offset coordinate + * @property {Number} top top offset coordinate + * @property {Number} width + * @property {Number} height + */ + +/** + * Escapes hash from special characters + * @param {Element} container Container element that acts as the boundary + * @param {Bounding} bounding element bounding that is being checked + * @param {Number} offset offset from edge that counts as exceeding + * @returns {Edges} + */ +M.checkWithinContainer = function (container, bounding, offset) { + var edges = { + top: false, + right: false, + bottom: false, + left: false + }; + + var containerRect = container.getBoundingClientRect(); + // If body element is smaller than viewport, use viewport height instead. + var containerBottom = container === document.body ? Math.max(containerRect.bottom, window.innerHeight) : containerRect.bottom; + + var scrollLeft = container.scrollLeft; + var scrollTop = container.scrollTop; + + var scrolledX = bounding.left - scrollLeft; + var scrolledY = bounding.top - scrollTop; + + // Check for container and viewport for each edge + if (scrolledX < containerRect.left + offset || scrolledX < offset) { + edges.left = true; + } + + if (scrolledX + bounding.width > containerRect.right - offset || scrolledX + bounding.width > window.innerWidth - offset) { + edges.right = true; + } + + if (scrolledY < containerRect.top + offset || scrolledY < offset) { + edges.top = true; + } + + if (scrolledY + bounding.height > containerBottom - offset || scrolledY + bounding.height > window.innerHeight - offset) { + edges.bottom = true; + } + + return edges; +}; + +M.checkPossibleAlignments = function (el, container, bounding, offset) { + var canAlign = { + top: true, + right: true, + bottom: true, + left: true, + spaceOnTop: null, + spaceOnRight: null, + spaceOnBottom: null, + spaceOnLeft: null + }; + + var containerAllowsOverflow = getComputedStyle(container).overflow === 'visible'; + var containerRect = container.getBoundingClientRect(); + var containerHeight = Math.min(containerRect.height, window.innerHeight); + var containerWidth = Math.min(containerRect.width, window.innerWidth); + var elOffsetRect = el.getBoundingClientRect(); + + var scrollLeft = container.scrollLeft; + var scrollTop = container.scrollTop; + + var scrolledX = bounding.left - scrollLeft; + var scrolledYTopEdge = bounding.top - scrollTop; + var scrolledYBottomEdge = bounding.top + elOffsetRect.height - scrollTop; + + // Check for container and viewport for left + canAlign.spaceOnRight = !containerAllowsOverflow ? containerWidth - (scrolledX + bounding.width) : window.innerWidth - (elOffsetRect.left + bounding.width); + if (canAlign.spaceOnRight < 0) { + canAlign.left = false; + } + + // Check for container and viewport for Right + canAlign.spaceOnLeft = !containerAllowsOverflow ? scrolledX - bounding.width + elOffsetRect.width : elOffsetRect.right - bounding.width; + if (canAlign.spaceOnLeft < 0) { + canAlign.right = false; + } + + // Check for container and viewport for Top + canAlign.spaceOnBottom = !containerAllowsOverflow ? containerHeight - (scrolledYTopEdge + bounding.height + offset) : window.innerHeight - (elOffsetRect.top + bounding.height + offset); + if (canAlign.spaceOnBottom < 0) { + canAlign.top = false; + } + + // Check for container and viewport for Bottom + canAlign.spaceOnTop = !containerAllowsOverflow ? scrolledYBottomEdge - (bounding.height - offset) : elOffsetRect.bottom - (bounding.height + offset); + if (canAlign.spaceOnTop < 0) { + canAlign.bottom = false; + } + + return canAlign; +}; + +M.getOverflowParent = function (element) { + if (element == null) { + return null; + } + + if (element === document.body || getComputedStyle(element).overflow !== 'visible') { + return element; + } + + return M.getOverflowParent(element.parentElement); +}; + +/** + * Gets id of component from a trigger + * @param {Element} trigger trigger + * @returns {string} + */ +M.getIdFromTrigger = function (trigger) { + var id = trigger.getAttribute('data-target'); + if (!id) { + id = trigger.getAttribute('href'); + if (id) { + id = id.slice(1); + } else { + id = ''; + } + } + return id; +}; + +/** + * Multi browser support for document scroll top + * @returns {Number} + */ +M.getDocumentScrollTop = function () { + return window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0; +}; + +/** + * Multi browser support for document scroll left + * @returns {Number} + */ +M.getDocumentScrollLeft = function () { + return window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft || 0; +}; + +/** + * @typedef {Object} Edges + * @property {Boolean} top If the top edge was exceeded + * @property {Boolean} right If the right edge was exceeded + * @property {Boolean} bottom If the bottom edge was exceeded + * @property {Boolean} left If the left edge was exceeded + */ + +/** + * @typedef {Object} Bounding + * @property {Number} left left offset coordinate + * @property {Number} top top offset coordinate + * @property {Number} width + * @property {Number} height + */ + +/** + * Get time in ms + * @license https://raw.github.com/jashkenas/underscore/master/LICENSE + * @type {function} + * @return {number} + */ +var getTime = Date.now || function () { + return new Date().getTime(); +}; + +/** + * Returns a function, that, when invoked, will only be triggered at most once + * during a given window of time. Normally, the throttled function will run + * as much as it can, without ever going more than once per `wait` duration; + * but if you'd like to disable the execution on the leading edge, pass + * `{leading: false}`. To disable execution on the trailing edge, ditto. + * @license https://raw.github.com/jashkenas/underscore/master/LICENSE + * @param {function} func + * @param {number} wait + * @param {Object=} options + * @returns {Function} + */ +M.throttle = function (func, wait, options) { + var context = void 0, + args = void 0, + result = void 0; + var timeout = null; + var previous = 0; + options || (options = {}); + var later = function () { + previous = options.leading === false ? 0 : getTime(); + timeout = null; + result = func.apply(context, args); + context = args = null; + }; + return function () { + var now = getTime(); + if (!previous && options.leading === false) previous = now; + var remaining = wait - (now - previous); + context = this; + args = arguments; + if (remaining <= 0) { + clearTimeout(timeout); + timeout = null; + previous = now; + result = func.apply(context, args); + context = args = null; + } else if (!timeout && options.trailing !== false) { + timeout = setTimeout(later, remaining); + } + return result; + }; +}; + +/* Feature detection */ +var passiveIfSupported = false; +try { + window.addEventListener("test", null, Object.defineProperty({}, "passive", { + get: function () { + passiveIfSupported = { passive: false }; + } + })); +} catch (err) {} +; /* + v2.2.0 + 2017 Julian Garnier + Released under the MIT license + */ +var $jscomp = { scope: {} };$jscomp.defineProperty = "function" == typeof Object.defineProperties ? Object.defineProperty : function (e, r, p) { + if (p.get || p.set) throw new TypeError("ES3 does not support getters and setters.");e != Array.prototype && e != Object.prototype && (e[r] = p.value); +};$jscomp.getGlobal = function (e) { + return "undefined" != typeof window && window === e ? e : "undefined" != typeof global && null != global ? global : e; +};$jscomp.global = $jscomp.getGlobal(this);$jscomp.SYMBOL_PREFIX = "jscomp_symbol_"; +$jscomp.initSymbol = function () { + $jscomp.initSymbol = function () {};$jscomp.global.Symbol || ($jscomp.global.Symbol = $jscomp.Symbol); +};$jscomp.symbolCounter_ = 0;$jscomp.Symbol = function (e) { + return $jscomp.SYMBOL_PREFIX + (e || "") + $jscomp.symbolCounter_++; +}; +$jscomp.initSymbolIterator = function () { + $jscomp.initSymbol();var e = $jscomp.global.Symbol.iterator;e || (e = $jscomp.global.Symbol.iterator = $jscomp.global.Symbol("iterator"));"function" != typeof Array.prototype[e] && $jscomp.defineProperty(Array.prototype, e, { configurable: !0, writable: !0, value: function () { + return $jscomp.arrayIterator(this); + } });$jscomp.initSymbolIterator = function () {}; +};$jscomp.arrayIterator = function (e) { + var r = 0;return $jscomp.iteratorPrototype(function () { + return r < e.length ? { done: !1, value: e[r++] } : { done: !0 }; + }); +}; +$jscomp.iteratorPrototype = function (e) { + $jscomp.initSymbolIterator();e = { next: e };e[$jscomp.global.Symbol.iterator] = function () { + return this; + };return e; +};$jscomp.array = $jscomp.array || {};$jscomp.iteratorFromArray = function (e, r) { + $jscomp.initSymbolIterator();e instanceof String && (e += "");var p = 0, + m = { next: function () { + if (p < e.length) { + var u = p++;return { value: r(u, e[u]), done: !1 }; + }m.next = function () { + return { done: !0, value: void 0 }; + };return m.next(); + } };m[Symbol.iterator] = function () { + return m; + };return m; +}; +$jscomp.polyfill = function (e, r, p, m) { + if (r) { + p = $jscomp.global;e = e.split(".");for (m = 0; m < e.length - 1; m++) { + var u = e[m];u in p || (p[u] = {});p = p[u]; + }e = e[e.length - 1];m = p[e];r = r(m);r != m && null != r && $jscomp.defineProperty(p, e, { configurable: !0, writable: !0, value: r }); + } +};$jscomp.polyfill("Array.prototype.keys", function (e) { + return e ? e : function () { + return $jscomp.iteratorFromArray(this, function (e) { + return e; + }); + }; +}, "es6-impl", "es3");var $jscomp$this = this; +(function (r) { + M.anime = r(); +})(function () { + function e(a) { + if (!h.col(a)) try { + return document.querySelectorAll(a); + } catch (c) {} + }function r(a, c) { + for (var d = a.length, b = 2 <= arguments.length ? arguments[1] : void 0, f = [], n = 0; n < d; n++) { + if (n in a) { + var k = a[n];c.call(b, k, n, a) && f.push(k); + } + }return f; + }function p(a) { + return a.reduce(function (a, d) { + return a.concat(h.arr(d) ? p(d) : d); + }, []); + }function m(a) { + if (h.arr(a)) return a; + h.str(a) && (a = e(a) || a);return a instanceof NodeList || a instanceof HTMLCollection ? [].slice.call(a) : [a]; + }function u(a, c) { + return a.some(function (a) { + return a === c; + }); + }function C(a) { + var c = {}, + d;for (d in a) { + c[d] = a[d]; + }return c; + }function D(a, c) { + var d = C(a), + b;for (b in a) { + d[b] = c.hasOwnProperty(b) ? c[b] : a[b]; + }return d; + }function z(a, c) { + var d = C(a), + b;for (b in c) { + d[b] = h.und(a[b]) ? c[b] : a[b]; + }return d; + }function T(a) { + a = a.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i, function (a, c, d, k) { + return c + c + d + d + k + k; + });var c = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a); + a = parseInt(c[1], 16);var d = parseInt(c[2], 16), + c = parseInt(c[3], 16);return "rgba(" + a + "," + d + "," + c + ",1)"; + }function U(a) { + function c(a, c, b) { + 0 > b && (b += 1);1 < b && --b;return b < 1 / 6 ? a + 6 * (c - a) * b : .5 > b ? c : b < 2 / 3 ? a + (c - a) * (2 / 3 - b) * 6 : a; + }var d = /hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(a) || /hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(a);a = parseInt(d[1]) / 360;var b = parseInt(d[2]) / 100, + f = parseInt(d[3]) / 100, + d = d[4] || 1;if (0 == b) f = b = a = f;else { + var n = .5 > f ? f * (1 + b) : f + b - f * b, + k = 2 * f - n, + f = c(k, n, a + 1 / 3), + b = c(k, n, a);a = c(k, n, a - 1 / 3); + }return "rgba(" + 255 * f + "," + 255 * b + "," + 255 * a + "," + d + ")"; + }function y(a) { + if (a = /([\+\-]?[0-9#\.]+)(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/.exec(a)) return a[2]; + }function V(a) { + if (-1 < a.indexOf("translate") || "perspective" === a) return "px";if (-1 < a.indexOf("rotate") || -1 < a.indexOf("skew")) return "deg"; + }function I(a, c) { + return h.fnc(a) ? a(c.target, c.id, c.total) : a; + }function E(a, c) { + if (c in a.style) return getComputedStyle(a).getPropertyValue(c.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase()) || "0"; + }function J(a, c) { + if (h.dom(a) && u(W, c)) return "transform";if (h.dom(a) && (a.getAttribute(c) || h.svg(a) && a[c])) return "attribute";if (h.dom(a) && "transform" !== c && E(a, c)) return "css";if (null != a[c]) return "object"; + }function X(a, c) { + var d = V(c), + d = -1 < c.indexOf("scale") ? 1 : 0 + d;a = a.style.transform;if (!a) return d;for (var b = [], f = [], n = [], k = /(\w+)\((.+?)\)/g; b = k.exec(a);) { + f.push(b[1]), n.push(b[2]); + }a = r(n, function (a, b) { + return f[b] === c; + });return a.length ? a[0] : d; + }function K(a, c) { + switch (J(a, c)) {case "transform": + return X(a, c);case "css": + return E(a, c);case "attribute": + return a.getAttribute(c);}return a[c] || 0; + }function L(a, c) { + var d = /^(\*=|\+=|-=)/.exec(a);if (!d) return a;var b = y(a) || 0;c = parseFloat(c);a = parseFloat(a.replace(d[0], ""));switch (d[0][0]) {case "+": + return c + a + b;case "-": + return c - a + b;case "*": + return c * a + b;} + }function F(a, c) { + return Math.sqrt(Math.pow(c.x - a.x, 2) + Math.pow(c.y - a.y, 2)); + }function M(a) { + a = a.points;for (var c = 0, d, b = 0; b < a.numberOfItems; b++) { + var f = a.getItem(b);0 < b && (c += F(d, f));d = f; + }return c; + }function N(a) { + if (a.getTotalLength) return a.getTotalLength();switch (a.tagName.toLowerCase()) {case "circle": + return 2 * Math.PI * a.getAttribute("r");case "rect": + return 2 * a.getAttribute("width") + 2 * a.getAttribute("height");case "line": + return F({ x: a.getAttribute("x1"), y: a.getAttribute("y1") }, { x: a.getAttribute("x2"), y: a.getAttribute("y2") });case "polyline": + return M(a);case "polygon": + var c = a.points;return M(a) + F(c.getItem(c.numberOfItems - 1), c.getItem(0));} + }function Y(a, c) { + function d(b) { + b = void 0 === b ? 0 : b;return a.el.getPointAtLength(1 <= c + b ? c + b : 0); + }var b = d(), + f = d(-1), + n = d(1);switch (a.property) {case "x": + return b.x;case "y": + return b.y; + case "angle": + return 180 * Math.atan2(n.y - f.y, n.x - f.x) / Math.PI;} + }function O(a, c) { + var d = /-?\d*\.?\d+/g, + b;b = h.pth(a) ? a.totalLength : a;if (h.col(b)) { + if (h.rgb(b)) { + var f = /rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(b);b = f ? "rgba(" + f[1] + ",1)" : b; + } else b = h.hex(b) ? T(b) : h.hsl(b) ? U(b) : void 0; + } else f = (f = y(b)) ? b.substr(0, b.length - f.length) : b, b = c && !/\s/g.test(b) ? f + c : f;b += "";return { original: b, numbers: b.match(d) ? b.match(d).map(Number) : [0], strings: h.str(a) || c ? b.split(d) : [] }; + }function P(a) { + a = a ? p(h.arr(a) ? a.map(m) : m(a)) : [];return r(a, function (a, d, b) { + return b.indexOf(a) === d; + }); + }function Z(a) { + var c = P(a);return c.map(function (a, b) { + return { target: a, id: b, total: c.length }; + }); + }function aa(a, c) { + var d = C(c);if (h.arr(a)) { + var b = a.length;2 !== b || h.obj(a[0]) ? h.fnc(c.duration) || (d.duration = c.duration / b) : a = { value: a }; + }return m(a).map(function (a, b) { + b = b ? 0 : c.delay;a = h.obj(a) && !h.pth(a) ? a : { value: a };h.und(a.delay) && (a.delay = b);return a; + }).map(function (a) { + return z(a, d); + }); + }function ba(a, c) { + var d = {}, + b;for (b in a) { + var f = I(a[b], c);h.arr(f) && (f = f.map(function (a) { + return I(a, c); + }), 1 === f.length && (f = f[0]));d[b] = f; + }d.duration = parseFloat(d.duration);d.delay = parseFloat(d.delay);return d; + }function ca(a) { + return h.arr(a) ? A.apply(this, a) : Q[a]; + }function da(a, c) { + var d;return a.tweens.map(function (b) { + b = ba(b, c);var f = b.value, + e = K(c.target, a.name), + k = d ? d.to.original : e, + k = h.arr(f) ? f[0] : k, + w = L(h.arr(f) ? f[1] : f, k), + e = y(w) || y(k) || y(e);b.from = O(k, e);b.to = O(w, e);b.start = d ? d.end : a.offset;b.end = b.start + b.delay + b.duration;b.easing = ca(b.easing);b.elasticity = (1E3 - Math.min(Math.max(b.elasticity, 1), 999)) / 1E3;b.isPath = h.pth(f);b.isColor = h.col(b.from.original);b.isColor && (b.round = 1);return d = b; + }); + }function ea(a, c) { + return r(p(a.map(function (a) { + return c.map(function (b) { + var c = J(a.target, b.name);if (c) { + var d = da(b, a);b = { type: c, property: b.name, animatable: a, tweens: d, duration: d[d.length - 1].end, delay: d[0].delay }; + } else b = void 0;return b; + }); + })), function (a) { + return !h.und(a); + }); + }function R(a, c, d, b) { + var f = "delay" === a;return c.length ? (f ? Math.min : Math.max).apply(Math, c.map(function (b) { + return b[a]; + })) : f ? b.delay : d.offset + b.delay + b.duration; + }function fa(a) { + var c = D(ga, a), + d = D(S, a), + b = Z(a.targets), + f = [], + e = z(c, d), + k;for (k in a) { + e.hasOwnProperty(k) || "targets" === k || f.push({ name: k, offset: e.offset, tweens: aa(a[k], d) }); + }a = ea(b, f);return z(c, { children: [], animatables: b, animations: a, duration: R("duration", a, c, d), delay: R("delay", a, c, d) }); + }function q(a) { + function c() { + return window.Promise && new Promise(function (a) { + return p = a; + }); + }function d(a) { + return g.reversed ? g.duration - a : a; + }function b(a) { + for (var b = 0, c = {}, d = g.animations, f = d.length; b < f;) { + var e = d[b], + k = e.animatable, + h = e.tweens, + n = h.length - 1, + l = h[n];n && (l = r(h, function (b) { + return a < b.end; + })[0] || l);for (var h = Math.min(Math.max(a - l.start - l.delay, 0), l.duration) / l.duration, w = isNaN(h) ? 1 : l.easing(h, l.elasticity), h = l.to.strings, p = l.round, n = [], m = void 0, m = l.to.numbers.length, t = 0; t < m; t++) { + var x = void 0, + x = l.to.numbers[t], + q = l.from.numbers[t], + x = l.isPath ? Y(l.value, w * x) : q + w * (x - q);p && (l.isColor && 2 < t || (x = Math.round(x * p) / p));n.push(x); + }if (l = h.length) for (m = h[0], w = 0; w < l; w++) { + p = h[w + 1], t = n[w], isNaN(t) || (m = p ? m + (t + p) : m + (t + " ")); + } else m = n[0];ha[e.type](k.target, e.property, m, c, k.id);e.currentValue = m;b++; + }if (b = Object.keys(c).length) for (d = 0; d < b; d++) { + H || (H = E(document.body, "transform") ? "transform" : "-webkit-transform"), g.animatables[d].target.style[H] = c[d].join(" "); + }g.currentTime = a;g.progress = a / g.duration * 100; + }function f(a) { + if (g[a]) g[a](g); + }function e() { + g.remaining && !0 !== g.remaining && g.remaining--; + }function k(a) { + var k = g.duration, + n = g.offset, + w = n + g.delay, + r = g.currentTime, + x = g.reversed, + q = d(a);if (g.children.length) { + var u = g.children, + v = u.length; + if (q >= g.currentTime) for (var G = 0; G < v; G++) { + u[G].seek(q); + } else for (; v--;) { + u[v].seek(q); + } + }if (q >= w || !k) g.began || (g.began = !0, f("begin")), f("run");if (q > n && q < k) b(q);else if (q <= n && 0 !== r && (b(0), x && e()), q >= k && r !== k || !k) b(k), x || e();f("update");a >= k && (g.remaining ? (t = h, "alternate" === g.direction && (g.reversed = !g.reversed)) : (g.pause(), g.completed || (g.completed = !0, f("complete"), "Promise" in window && (p(), m = c()))), l = 0); + }a = void 0 === a ? {} : a;var h, + t, + l = 0, + p = null, + m = c(), + g = fa(a);g.reset = function () { + var a = g.direction, + c = g.loop;g.currentTime = 0;g.progress = 0;g.paused = !0;g.began = !1;g.completed = !1;g.reversed = "reverse" === a;g.remaining = "alternate" === a && 1 === c ? 2 : c;b(0);for (a = g.children.length; a--;) { + g.children[a].reset(); + } + };g.tick = function (a) { + h = a;t || (t = h);k((l + h - t) * q.speed); + };g.seek = function (a) { + k(d(a)); + };g.pause = function () { + var a = v.indexOf(g);-1 < a && v.splice(a, 1);g.paused = !0; + };g.play = function () { + g.paused && (g.paused = !1, t = 0, l = d(g.currentTime), v.push(g), B || ia()); + };g.reverse = function () { + g.reversed = !g.reversed;t = 0;l = d(g.currentTime); + };g.restart = function () { + g.pause(); + g.reset();g.play(); + };g.finished = m;g.reset();g.autoplay && g.play();return g; + }var ga = { update: void 0, begin: void 0, run: void 0, complete: void 0, loop: 1, direction: "normal", autoplay: !0, offset: 0 }, + S = { duration: 1E3, delay: 0, easing: "easeOutElastic", elasticity: 500, round: 0 }, + W = "translateX translateY translateZ rotate rotateX rotateY rotateZ scale scaleX scaleY scaleZ skewX skewY perspective".split(" "), + H, + h = { arr: function (a) { + return Array.isArray(a); + }, obj: function (a) { + return -1 < Object.prototype.toString.call(a).indexOf("Object"); + }, + pth: function (a) { + return h.obj(a) && a.hasOwnProperty("totalLength"); + }, svg: function (a) { + return a instanceof SVGElement; + }, dom: function (a) { + return a.nodeType || h.svg(a); + }, str: function (a) { + return "string" === typeof a; + }, fnc: function (a) { + return "function" === typeof a; + }, und: function (a) { + return "undefined" === typeof a; + }, hex: function (a) { + return (/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(a) + ); + }, rgb: function (a) { + return (/^rgb/.test(a) + ); + }, hsl: function (a) { + return (/^hsl/.test(a) + ); + }, col: function (a) { + return h.hex(a) || h.rgb(a) || h.hsl(a); + } }, + A = function () { + function a(a, d, b) { + return (((1 - 3 * b + 3 * d) * a + (3 * b - 6 * d)) * a + 3 * d) * a; + }return function (c, d, b, f) { + if (0 <= c && 1 >= c && 0 <= b && 1 >= b) { + var e = new Float32Array(11);if (c !== d || b !== f) for (var k = 0; 11 > k; ++k) { + e[k] = a(.1 * k, c, b); + }return function (k) { + if (c === d && b === f) return k;if (0 === k) return 0;if (1 === k) return 1;for (var h = 0, l = 1; 10 !== l && e[l] <= k; ++l) { + h += .1; + }--l;var l = h + (k - e[l]) / (e[l + 1] - e[l]) * .1, + n = 3 * (1 - 3 * b + 3 * c) * l * l + 2 * (3 * b - 6 * c) * l + 3 * c;if (.001 <= n) { + for (h = 0; 4 > h; ++h) { + n = 3 * (1 - 3 * b + 3 * c) * l * l + 2 * (3 * b - 6 * c) * l + 3 * c;if (0 === n) break;var m = a(l, c, b) - k, + l = l - m / n; + }k = l; + } else if (0 === n) k = l;else { + var l = h, + h = h + .1, + g = 0;do { + m = l + (h - l) / 2, n = a(m, c, b) - k, 0 < n ? h = m : l = m; + } while (1e-7 < Math.abs(n) && 10 > ++g);k = m; + }return a(k, d, f); + }; + } + }; + }(), + Q = function () { + function a(a, b) { + return 0 === a || 1 === a ? a : -Math.pow(2, 10 * (a - 1)) * Math.sin(2 * (a - 1 - b / (2 * Math.PI) * Math.asin(1)) * Math.PI / b); + }var c = "Quad Cubic Quart Quint Sine Expo Circ Back Elastic".split(" "), + d = { In: [[.55, .085, .68, .53], [.55, .055, .675, .19], [.895, .03, .685, .22], [.755, .05, .855, .06], [.47, 0, .745, .715], [.95, .05, .795, .035], [.6, .04, .98, .335], [.6, -.28, .735, .045], a], Out: [[.25, .46, .45, .94], [.215, .61, .355, 1], [.165, .84, .44, 1], [.23, 1, .32, 1], [.39, .575, .565, 1], [.19, 1, .22, 1], [.075, .82, .165, 1], [.175, .885, .32, 1.275], function (b, c) { + return 1 - a(1 - b, c); + }], InOut: [[.455, .03, .515, .955], [.645, .045, .355, 1], [.77, 0, .175, 1], [.86, 0, .07, 1], [.445, .05, .55, .95], [1, 0, 0, 1], [.785, .135, .15, .86], [.68, -.55, .265, 1.55], function (b, c) { + return .5 > b ? a(2 * b, c) / 2 : 1 - a(-2 * b + 2, c) / 2; + }] }, + b = { linear: A(.25, .25, .75, .75) }, + f = {}, + e;for (e in d) { + f.type = e, d[f.type].forEach(function (a) { + return function (d, f) { + b["ease" + a.type + c[f]] = h.fnc(d) ? d : A.apply($jscomp$this, d); + }; + }(f)), f = { type: f.type }; + }return b; + }(), + ha = { css: function (a, c, d) { + return a.style[c] = d; + }, attribute: function (a, c, d) { + return a.setAttribute(c, d); + }, object: function (a, c, d) { + return a[c] = d; + }, transform: function (a, c, d, b, f) { + b[f] || (b[f] = []);b[f].push(c + "(" + d + ")"); + } }, + v = [], + B = 0, + ia = function () { + function a() { + B = requestAnimationFrame(c); + }function c(c) { + var b = v.length;if (b) { + for (var d = 0; d < b;) { + v[d] && v[d].tick(c), d++; + }a(); + } else cancelAnimationFrame(B), B = 0; + }return a; + }();q.version = "2.2.0";q.speed = 1;q.running = v;q.remove = function (a) { + a = P(a);for (var c = v.length; c--;) { + for (var d = v[c], b = d.animations, f = b.length; f--;) { + u(a, b[f].animatable.target) && (b.splice(f, 1), b.length || d.pause()); + } + } + };q.getValue = K;q.path = function (a, c) { + var d = h.str(a) ? e(a)[0] : a, + b = c || 100;return function (a) { + return { el: d, property: a, totalLength: N(d) * (b / 100) }; + }; + };q.setDashoffset = function (a) { + var c = N(a);a.setAttribute("stroke-dasharray", c);return c; + };q.bezier = A;q.easings = Q;q.timeline = function (a) { + var c = q(a);c.pause();c.duration = 0;c.add = function (d) { + c.children.forEach(function (a) { + a.began = !0;a.completed = !0; + });m(d).forEach(function (b) { + var d = z(b, D(S, a || {}));d.targets = d.targets || a.targets;b = c.duration;var e = d.offset;d.autoplay = !1;d.direction = c.direction;d.offset = h.und(e) ? b : L(e, b);c.began = !0;c.completed = !0;c.seek(d.offset);d = q(d);d.began = !0;d.completed = !0;d.duration > b && (c.duration = d.duration);c.children.push(d); + });c.seek(0);c.reset();c.autoplay && c.restart();return c; + };return c; + };q.random = function (a, c) { + return Math.floor(Math.random() * (c - a + 1)) + a; + };return q; +}); +;(function ($, anim) { + 'use strict'; + + var _defaults = { + accordion: true, + onOpenStart: undefined, + onOpenEnd: undefined, + onCloseStart: undefined, + onCloseEnd: undefined, + inDuration: 300, + outDuration: 300 + }; + + /** + * @class + * + */ + + var Collapsible = function (_Component) { + _inherits(Collapsible, _Component); + + /** + * Construct Collapsible instance + * @constructor + * @param {Element} el + * @param {Object} options + */ + function Collapsible(el, options) { + _classCallCheck(this, Collapsible); + + var _this3 = _possibleConstructorReturn(this, (Collapsible.__proto__ || Object.getPrototypeOf(Collapsible)).call(this, Collapsible, el, options)); + + _this3.el.M_Collapsible = _this3; + + /** + * Options for the collapsible + * @member Collapsible#options + * @prop {Boolean} [accordion=false] - Type of the collapsible + * @prop {Function} onOpenStart - Callback function called before collapsible is opened + * @prop {Function} onOpenEnd - Callback function called after collapsible is opened + * @prop {Function} onCloseStart - Callback function called before collapsible is closed + * @prop {Function} onCloseEnd - Callback function called after collapsible is closed + * @prop {Number} inDuration - Transition in duration in milliseconds. + * @prop {Number} outDuration - Transition duration in milliseconds. + */ + _this3.options = $.extend({}, Collapsible.defaults, options); + + // Setup tab indices + _this3.$headers = _this3.$el.children('li').children('.collapsible-header'); + _this3.$headers.attr('tabindex', 0); + + _this3._setupEventHandlers(); + + // Open first active + var $activeBodies = _this3.$el.children('li.active').children('.collapsible-body'); + if (_this3.options.accordion) { + // Handle Accordion + $activeBodies.first().css('display', 'block'); + } else { + // Handle Expandables + $activeBodies.css('display', 'block'); + } + return _this3; + } + + _createClass(Collapsible, [{ + key: "destroy", + + + /** + * Teardown component + */ + value: function destroy() { + this._removeEventHandlers(); + this.el.M_Collapsible = undefined; + } + + /** + * Setup Event Handlers + */ + + }, { + key: "_setupEventHandlers", + value: function _setupEventHandlers() { + var _this4 = this; + + this._handleCollapsibleClickBound = this._handleCollapsibleClick.bind(this); + this._handleCollapsibleKeydownBound = this._handleCollapsibleKeydown.bind(this); + this.el.addEventListener('click', this._handleCollapsibleClickBound); + this.$headers.each(function (header) { + header.addEventListener('keydown', _this4._handleCollapsibleKeydownBound); + }); + } + + /** + * Remove Event Handlers + */ + + }, { + key: "_removeEventHandlers", + value: function _removeEventHandlers() { + var _this5 = this; + + this.el.removeEventListener('click', this._handleCollapsibleClickBound); + this.$headers.each(function (header) { + header.removeEventListener('keydown', _this5._handleCollapsibleKeydownBound); + }); + } + + /** + * Handle Collapsible Click + * @param {Event} e + */ + + }, { + key: "_handleCollapsibleClick", + value: function _handleCollapsibleClick(e) { + var $header = $(e.target).closest('.collapsible-header'); + if (e.target && $header.length) { + var $collapsible = $header.closest('.collapsible'); + if ($collapsible[0] === this.el) { + var $collapsibleLi = $header.closest('li'); + var $collapsibleLis = $collapsible.children('li'); + var isActive = $collapsibleLi[0].classList.contains('active'); + var index = $collapsibleLis.index($collapsibleLi); + + if (isActive) { + this.close(index); + } else { + this.open(index); + } + } + } + } + + /** + * Handle Collapsible Keydown + * @param {Event} e + */ + + }, { + key: "_handleCollapsibleKeydown", + value: function _handleCollapsibleKeydown(e) { + if (e.keyCode === 13) { + this._handleCollapsibleClickBound(e); + } + } + + /** + * Animate in collapsible slide + * @param {Number} index - 0th index of slide + */ + + }, { + key: "_animateIn", + value: function _animateIn(index) { + var _this6 = this; + + var $collapsibleLi = this.$el.children('li').eq(index); + if ($collapsibleLi.length) { + var $body = $collapsibleLi.children('.collapsible-body'); + + anim.remove($body[0]); + $body.css({ + display: 'block', + overflow: 'hidden', + height: 0, + paddingTop: '', + paddingBottom: '' + }); + + var pTop = $body.css('padding-top'); + var pBottom = $body.css('padding-bottom'); + var finalHeight = $body[0].scrollHeight; + $body.css({ + paddingTop: 0, + paddingBottom: 0 + }); + + anim({ + targets: $body[0], + height: finalHeight, + paddingTop: pTop, + paddingBottom: pBottom, + duration: this.options.inDuration, + easing: 'easeInOutCubic', + complete: function (anim) { + $body.css({ + overflow: '', + paddingTop: '', + paddingBottom: '', + height: '' + }); + + // onOpenEnd callback + if (typeof _this6.options.onOpenEnd === 'function') { + _this6.options.onOpenEnd.call(_this6, $collapsibleLi[0]); + } + } + }); + } + } + + /** + * Animate out collapsible slide + * @param {Number} index - 0th index of slide to open + */ + + }, { + key: "_animateOut", + value: function _animateOut(index) { + var _this7 = this; + + var $collapsibleLi = this.$el.children('li').eq(index); + if ($collapsibleLi.length) { + var $body = $collapsibleLi.children('.collapsible-body'); + anim.remove($body[0]); + $body.css('overflow', 'hidden'); + anim({ + targets: $body[0], + height: 0, + paddingTop: 0, + paddingBottom: 0, + duration: this.options.outDuration, + easing: 'easeInOutCubic', + complete: function () { + $body.css({ + height: '', + overflow: '', + padding: '', + display: '' + }); + + // onCloseEnd callback + if (typeof _this7.options.onCloseEnd === 'function') { + _this7.options.onCloseEnd.call(_this7, $collapsibleLi[0]); + } + } + }); + } + } + + /** + * Open Collapsible + * @param {Number} index - 0th index of slide + */ + + }, { + key: "open", + value: function open(index) { + var _this8 = this; + + var $collapsibleLi = this.$el.children('li').eq(index); + if ($collapsibleLi.length && !$collapsibleLi[0].classList.contains('active')) { + // onOpenStart callback + if (typeof this.options.onOpenStart === 'function') { + this.options.onOpenStart.call(this, $collapsibleLi[0]); + } + + // Handle accordion behavior + if (this.options.accordion) { + var $collapsibleLis = this.$el.children('li'); + var $activeLis = this.$el.children('li.active'); + $activeLis.each(function (el) { + var index = $collapsibleLis.index($(el)); + _this8.close(index); + }); + } + + // Animate in + $collapsibleLi[0].classList.add('active'); + this._animateIn(index); + } + } + + /** + * Close Collapsible + * @param {Number} index - 0th index of slide + */ + + }, { + key: "close", + value: function close(index) { + var $collapsibleLi = this.$el.children('li').eq(index); + if ($collapsibleLi.length && $collapsibleLi[0].classList.contains('active')) { + // onCloseStart callback + if (typeof this.options.onCloseStart === 'function') { + this.options.onCloseStart.call(this, $collapsibleLi[0]); + } + + // Animate out + $collapsibleLi[0].classList.remove('active'); + this._animateOut(index); + } + } + }], [{ + key: "init", + value: function init(els, options) { + return _get(Collapsible.__proto__ || Object.getPrototypeOf(Collapsible), "init", this).call(this, this, els, options); + } + + /** + * Get Instance + */ + + }, { + key: "getInstance", + value: function getInstance(el) { + var domElem = !!el.jquery ? el[0] : el; + return domElem.M_Collapsible; + } + }, { + key: "defaults", + get: function () { + return _defaults; + } + }]); + + return Collapsible; + }(Component); + + M.Collapsible = Collapsible; + + if (M.jQueryLoaded) { + M.initializeJqueryWrapper(Collapsible, 'collapsible', 'M_Collapsible'); + } +})(cash, M.anime); +;(function ($, anim) { + 'use strict'; + + var _defaults = { + alignment: 'left', + autoFocus: true, + constrainWidth: true, + container: null, + coverTrigger: true, + closeOnClick: true, + hover: false, + inDuration: 150, + outDuration: 250, + onOpenStart: null, + onOpenEnd: null, + onCloseStart: null, + onCloseEnd: null, + onItemClick: null + }; + + /** + * @class + */ + + var Dropdown = function (_Component2) { + _inherits(Dropdown, _Component2); + + function Dropdown(el, options) { + _classCallCheck(this, Dropdown); + + var _this9 = _possibleConstructorReturn(this, (Dropdown.__proto__ || Object.getPrototypeOf(Dropdown)).call(this, Dropdown, el, options)); + + _this9.el.M_Dropdown = _this9; + Dropdown._dropdowns.push(_this9); + + _this9.id = M.getIdFromTrigger(el); + _this9.dropdownEl = document.getElementById(_this9.id); + _this9.$dropdownEl = $(_this9.dropdownEl); + + /** + * Options for the dropdown + * @member Dropdown#options + * @prop {String} [alignment='left'] - Edge which the dropdown is aligned to + * @prop {Boolean} [autoFocus=true] - Automatically focus dropdown el for keyboard + * @prop {Boolean} [constrainWidth=true] - Constrain width to width of the button + * @prop {Element} container - Container element to attach dropdown to (optional) + * @prop {Boolean} [coverTrigger=true] - Place dropdown over trigger + * @prop {Boolean} [closeOnClick=true] - Close on click of dropdown item + * @prop {Boolean} [hover=false] - Open dropdown on hover + * @prop {Number} [inDuration=150] - Duration of open animation in ms + * @prop {Number} [outDuration=250] - Duration of close animation in ms + * @prop {Function} onOpenStart - Function called when dropdown starts opening + * @prop {Function} onOpenEnd - Function called when dropdown finishes opening + * @prop {Function} onCloseStart - Function called when dropdown starts closing + * @prop {Function} onCloseEnd - Function called when dropdown finishes closing + */ + _this9.options = $.extend({}, Dropdown.defaults, options); + + /** + * Describes open/close state of dropdown + * @type {Boolean} + */ + _this9.isOpen = false; + + /** + * Describes if dropdown content is scrollable + * @type {Boolean} + */ + _this9.isScrollable = false; + + /** + * Describes if touch moving on dropdown content + * @type {Boolean} + */ + _this9.isTouchMoving = false; + + _this9.focusedIndex = -1; + _this9.filterQuery = []; + + // Move dropdown-content after dropdown-trigger + _this9._moveDropdown(); + + _this9._makeDropdownFocusable(); + _this9._resetFilterQueryBound = _this9._resetFilterQuery.bind(_this9); + _this9._handleDocumentClickBound = _this9._handleDocumentClick.bind(_this9); + _this9._handleDocumentTouchmoveBound = _this9._handleDocumentTouchmove.bind(_this9); + _this9._handleDropdownClickBound = _this9._handleDropdownClick.bind(_this9); + _this9._handleDropdownKeydownBound = _this9._handleDropdownKeydown.bind(_this9); + _this9._handleTriggerKeydownBound = _this9._handleTriggerKeydown.bind(_this9); + _this9._setupEventHandlers(); + return _this9; + } + + _createClass(Dropdown, [{ + key: "destroy", + + + /** + * Teardown component + */ + value: function destroy() { + this._resetDropdownStyles(); + this._removeEventHandlers(); + Dropdown._dropdowns.splice(Dropdown._dropdowns.indexOf(this), 1); + this.el.M_Dropdown = undefined; + } + + /** + * Setup Event Handlers + */ + + }, { + key: "_setupEventHandlers", + value: function _setupEventHandlers() { + // Trigger keydown handler + this.el.addEventListener('keydown', this._handleTriggerKeydownBound); + + // Item click handler + this.dropdownEl.addEventListener('click', this._handleDropdownClickBound); + + // Hover event handlers + if (this.options.hover) { + this._handleMouseEnterBound = this._handleMouseEnter.bind(this); + this.el.addEventListener('mouseenter', this._handleMouseEnterBound); + this._handleMouseLeaveBound = this._handleMouseLeave.bind(this); + this.el.addEventListener('mouseleave', this._handleMouseLeaveBound); + this.dropdownEl.addEventListener('mouseleave', this._handleMouseLeaveBound); + + // Click event handlers + } else { + this._handleClickBound = this._handleClick.bind(this); + this.el.addEventListener('click', this._handleClickBound); + } + } + + /** + * Remove Event Handlers + */ + + }, { + key: "_removeEventHandlers", + value: function _removeEventHandlers() { + this.el.removeEventListener('keydown', this._handleTriggerKeydownBound); + this.dropdownEl.removeEventListener('click', this._handleDropdownClickBound); + + if (this.options.hover) { + this.el.removeEventListener('mouseenter', this._handleMouseEnterBound); + this.el.removeEventListener('mouseleave', this._handleMouseLeaveBound); + this.dropdownEl.removeEventListener('mouseleave', this._handleMouseLeaveBound); + } else { + this.el.removeEventListener('click', this._handleClickBound); + } + } + }, { + key: "_setupTemporaryEventHandlers", + value: function _setupTemporaryEventHandlers() { + // Use capture phase event handler to prevent click + document.body.addEventListener('click', this._handleDocumentClickBound, true); + document.body.addEventListener('touchend', this._handleDocumentClickBound); + document.body.addEventListener('touchmove', this._handleDocumentTouchmoveBound); + this.dropdownEl.addEventListener('keydown', this._handleDropdownKeydownBound); + } + }, { + key: "_removeTemporaryEventHandlers", + value: function _removeTemporaryEventHandlers() { + // Use capture phase event handler to prevent click + document.body.removeEventListener('click', this._handleDocumentClickBound, true); + document.body.removeEventListener('touchend', this._handleDocumentClickBound); + document.body.removeEventListener('touchmove', this._handleDocumentTouchmoveBound); + this.dropdownEl.removeEventListener('keydown', this._handleDropdownKeydownBound); + } + }, { + key: "_handleClick", + value: function _handleClick(e) { + e.preventDefault(); + this.open(); + } + }, { + key: "_handleMouseEnter", + value: function _handleMouseEnter() { + this.open(); + } + }, { + key: "_handleMouseLeave", + value: function _handleMouseLeave(e) { + var toEl = e.toElement || e.relatedTarget; + var leaveToDropdownContent = !!$(toEl).closest('.dropdown-content').length; + var leaveToActiveDropdownTrigger = false; + + var $closestTrigger = $(toEl).closest('.dropdown-trigger'); + if ($closestTrigger.length && !!$closestTrigger[0].M_Dropdown && $closestTrigger[0].M_Dropdown.isOpen) { + leaveToActiveDropdownTrigger = true; + } + + // Close hover dropdown if mouse did not leave to either active dropdown-trigger or dropdown-content + if (!leaveToActiveDropdownTrigger && !leaveToDropdownContent) { + this.close(); + } + } + }, { + key: "_handleDocumentClick", + value: function _handleDocumentClick(e) { + var _this10 = this; + + var $target = $(e.target); + if (this.options.closeOnClick && $target.closest('.dropdown-content').length && !this.isTouchMoving) { + // isTouchMoving to check if scrolling on mobile. + setTimeout(function () { + _this10.close(); + }, 0); + } else if ($target.closest('.dropdown-trigger').length || !$target.closest('.dropdown-content').length) { + setTimeout(function () { + _this10.close(); + }, 0); + } + this.isTouchMoving = false; + } + }, { + key: "_handleTriggerKeydown", + value: function _handleTriggerKeydown(e) { + // ARROW DOWN OR ENTER WHEN SELECT IS CLOSED - open Dropdown + if ((e.which === M.keys.ARROW_DOWN || e.which === M.keys.ENTER) && !this.isOpen) { + e.preventDefault(); + this.open(); + } + } + + /** + * Handle Document Touchmove + * @param {Event} e + */ + + }, { + key: "_handleDocumentTouchmove", + value: function _handleDocumentTouchmove(e) { + var $target = $(e.target); + if ($target.closest('.dropdown-content').length) { + this.isTouchMoving = true; + } + } + + /** + * Handle Dropdown Click + * @param {Event} e + */ + + }, { + key: "_handleDropdownClick", + value: function _handleDropdownClick(e) { + // onItemClick callback + if (typeof this.options.onItemClick === 'function') { + var itemEl = $(e.target).closest('li')[0]; + this.options.onItemClick.call(this, itemEl); + } + } + + /** + * Handle Dropdown Keydown + * @param {Event} e + */ + + }, { + key: "_handleDropdownKeydown", + value: function _handleDropdownKeydown(e) { + if (e.which === M.keys.TAB) { + e.preventDefault(); + this.close(); + + // Navigate down dropdown list + } else if ((e.which === M.keys.ARROW_DOWN || e.which === M.keys.ARROW_UP) && this.isOpen) { + e.preventDefault(); + var direction = e.which === M.keys.ARROW_DOWN ? 1 : -1; + var newFocusedIndex = this.focusedIndex; + var foundNewIndex = false; + do { + newFocusedIndex = newFocusedIndex + direction; + + if (!!this.dropdownEl.children[newFocusedIndex] && this.dropdownEl.children[newFocusedIndex].tabIndex !== -1) { + foundNewIndex = true; + break; + } + } while (newFocusedIndex < this.dropdownEl.children.length && newFocusedIndex >= 0); + + if (foundNewIndex) { + // Remove active class from old element + if (this.focusedIndex >= 0) this.dropdownEl.children[this.focusedIndex].classList.remove('active'); + this.focusedIndex = newFocusedIndex; + this._focusFocusedItem(); + } + + // ENTER selects choice on focused item + } else if (e.which === M.keys.ENTER && this.isOpen) { + // Search for
    and ") + ''; + } + }, { + key: "renderRow", + value: function renderRow(days, isRTL, isRowSelected) { + return '' + (isRTL ? days.reverse() : days).join('') + ''; + } + }, { + key: "renderTable", + value: function renderTable(opts, data, randId) { + return '
    ' + this.renderHead(opts) + this.renderBody(data) + '
    '; + } + }, { + key: "renderHead", + value: function renderHead(opts) { + var i = void 0, + arr = []; + for (i = 0; i < 7; i++) { + arr.push("" + this.renderDayName(opts, i, true) + ""); + } + return '' + (opts.isRTL ? arr.reverse() : arr).join('') + ''; + } + }, { + key: "renderBody", + value: function renderBody(rows) { + return '' + rows.join('') + ''; + } + }, { + key: "renderTitle", + value: function renderTitle(instance, c, year, month, refYear, randId) { + var i = void 0, + j = void 0, + arr = void 0, + opts = this.options, + isMinYear = year === opts.minYear, + isMaxYear = year === opts.maxYear, + html = '
    ', + monthHtml = void 0, + yearHtml = void 0, + prev = true, + next = true; + + for (arr = [], i = 0; i < 12; i++) { + arr.push(''); + } + + monthHtml = ''; + + if ($.isArray(opts.yearRange)) { + i = opts.yearRange[0]; + j = opts.yearRange[1] + 1; + } else { + i = year - opts.yearRange; + j = 1 + year + opts.yearRange; + } + + for (arr = []; i < j && i <= opts.maxYear; i++) { + if (i >= opts.minYear) { + arr.push(""); + } + } + if (opts.yearRangeReverse) { + arr.reverse(); + } + + yearHtml = ""; + + var leftArrow = ''; + html += ""; + + html += '
    '; + if (opts.showMonthAfterYear) { + html += yearHtml + monthHtml; + } else { + html += monthHtml + yearHtml; + } + html += '
    '; + + if (isMinYear && (month === 0 || opts.minMonth >= month)) { + prev = false; + } + + if (isMaxYear && (month === 11 || opts.maxMonth <= month)) { + next = false; + } + + var rightArrow = ''; + html += ""; + + return html += '
    '; + } + + /** + * refresh the HTML + */ + + }, { + key: "draw", + value: function draw(force) { + if (!this.isOpen && !force) { + return; + } + var opts = this.options, + minYear = opts.minYear, + maxYear = opts.maxYear, + minMonth = opts.minMonth, + maxMonth = opts.maxMonth, + html = '', + randId = void 0; + + if (this._y <= minYear) { + this._y = minYear; + if (!isNaN(minMonth) && this._m < minMonth) { + this._m = minMonth; + } + } + if (this._y >= maxYear) { + this._y = maxYear; + if (!isNaN(maxMonth) && this._m > maxMonth) { + this._m = maxMonth; + } + } + + randId = 'datepicker-title-' + Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 2); + + for (var c = 0; c < 1; c++) { + this._renderDateDisplay(); + html += this.renderTitle(this, c, this.calendars[c].year, this.calendars[c].month, this.calendars[0].year, randId) + this.render(this.calendars[c].year, this.calendars[c].month, randId); + } + + this.destroySelects(); + + this.calendarEl.innerHTML = html; + + // Init Materialize Select + var yearSelect = this.calendarEl.querySelector('.orig-select-year'); + var monthSelect = this.calendarEl.querySelector('.orig-select-month'); + M.FormSelect.init(yearSelect, { + classes: 'select-year', + dropdownOptions: { container: document.body, constrainWidth: false } + }); + M.FormSelect.init(monthSelect, { + classes: 'select-month', + dropdownOptions: { container: document.body, constrainWidth: false } + }); + + // Add change handlers for select + yearSelect.addEventListener('change', this._handleYearChange.bind(this)); + monthSelect.addEventListener('change', this._handleMonthChange.bind(this)); + + if (typeof this.options.onDraw === 'function') { + this.options.onDraw(this); + } + } + + /** + * Setup Event Handlers + */ + + }, { + key: "_setupEventHandlers", + value: function _setupEventHandlers() { + this._handleInputKeydownBound = this._handleInputKeydown.bind(this); + this._handleInputClickBound = this._handleInputClick.bind(this); + this._handleInputChangeBound = this._handleInputChange.bind(this); + this._handleCalendarClickBound = this._handleCalendarClick.bind(this); + this._finishSelectionBound = this._finishSelection.bind(this); + this._handleMonthChange = this._handleMonthChange.bind(this); + this._closeBound = this.close.bind(this); + + this.el.addEventListener('click', this._handleInputClickBound); + this.el.addEventListener('keydown', this._handleInputKeydownBound); + this.el.addEventListener('change', this._handleInputChangeBound); + this.calendarEl.addEventListener('click', this._handleCalendarClickBound); + this.doneBtn.addEventListener('click', this._finishSelectionBound); + this.cancelBtn.addEventListener('click', this._closeBound); + + if (this.options.showClearBtn) { + this._handleClearClickBound = this._handleClearClick.bind(this); + this.clearBtn.addEventListener('click', this._handleClearClickBound); + } + } + }, { + key: "_setupVariables", + value: function _setupVariables() { + var _this56 = this; + + this.$modalEl = $(Datepicker._template); + this.modalEl = this.$modalEl[0]; + + this.calendarEl = this.modalEl.querySelector('.datepicker-calendar'); + + this.yearTextEl = this.modalEl.querySelector('.year-text'); + this.dateTextEl = this.modalEl.querySelector('.date-text'); + if (this.options.showClearBtn) { + this.clearBtn = this.modalEl.querySelector('.datepicker-clear'); + } + this.doneBtn = this.modalEl.querySelector('.datepicker-done'); + this.cancelBtn = this.modalEl.querySelector('.datepicker-cancel'); + + this.formats = { + d: function () { + return _this56.date.getDate(); + }, + dd: function () { + var d = _this56.date.getDate(); + return (d < 10 ? '0' : '') + d; + }, + ddd: function () { + return _this56.options.i18n.weekdaysShort[_this56.date.getDay()]; + }, + dddd: function () { + return _this56.options.i18n.weekdays[_this56.date.getDay()]; + }, + m: function () { + return _this56.date.getMonth() + 1; + }, + mm: function () { + var m = _this56.date.getMonth() + 1; + return (m < 10 ? '0' : '') + m; + }, + mmm: function () { + return _this56.options.i18n.monthsShort[_this56.date.getMonth()]; + }, + mmmm: function () { + return _this56.options.i18n.months[_this56.date.getMonth()]; + }, + yy: function () { + return ('' + _this56.date.getFullYear()).slice(2); + }, + yyyy: function () { + return _this56.date.getFullYear(); + } + }; + } + + /** + * Remove Event Handlers + */ + + }, { + key: "_removeEventHandlers", + value: function _removeEventHandlers() { + this.el.removeEventListener('click', this._handleInputClickBound); + this.el.removeEventListener('keydown', this._handleInputKeydownBound); + this.el.removeEventListener('change', this._handleInputChangeBound); + this.calendarEl.removeEventListener('click', this._handleCalendarClickBound); + } + }, { + key: "_handleInputClick", + value: function _handleInputClick() { + this.open(); + } + }, { + key: "_handleInputKeydown", + value: function _handleInputKeydown(e) { + if (e.which === M.keys.ENTER) { + e.preventDefault(); + this.open(); + } + } + }, { + key: "_handleCalendarClick", + value: function _handleCalendarClick(e) { + if (!this.isOpen) { + return; + } + + var $target = $(e.target); + if (!$target.hasClass('is-disabled')) { + if ($target.hasClass('datepicker-day-button') && !$target.hasClass('is-empty') && !$target.parent().hasClass('is-disabled')) { + this.setDate(new Date(e.target.getAttribute('data-year'), e.target.getAttribute('data-month'), e.target.getAttribute('data-day'))); + if (this.options.autoClose) { + this._finishSelection(); + } + } else if ($target.closest('.month-prev').length) { + this.prevMonth(); + } else if ($target.closest('.month-next').length) { + this.nextMonth(); + } + } + } + }, { + key: "_handleClearClick", + value: function _handleClearClick() { + this.date = null; + this.setInputValue(); + this.close(); + } + }, { + key: "_handleMonthChange", + value: function _handleMonthChange(e) { + this.gotoMonth(e.target.value); + } + }, { + key: "_handleYearChange", + value: function _handleYearChange(e) { + this.gotoYear(e.target.value); + } + + /** + * change view to a specific month (zero-index, e.g. 0: January) + */ + + }, { + key: "gotoMonth", + value: function gotoMonth(month) { + if (!isNaN(month)) { + this.calendars[0].month = parseInt(month, 10); + this.adjustCalendars(); + } + } + + /** + * change view to a specific full year (e.g. "2012") + */ + + }, { + key: "gotoYear", + value: function gotoYear(year) { + if (!isNaN(year)) { + this.calendars[0].year = parseInt(year, 10); + this.adjustCalendars(); + } + } + }, { + key: "_handleInputChange", + value: function _handleInputChange(e) { + var date = void 0; + + // Prevent change event from being fired when triggered by the plugin + if (e.firedBy === this) { + return; + } + if (this.options.parse) { + date = this.options.parse(this.el.value, this.options.format); + } else { + date = new Date(Date.parse(this.el.value)); + } + + if (Datepicker._isDate(date)) { + this.setDate(date); + } + } + }, { + key: "renderDayName", + value: function renderDayName(opts, day, abbr) { + day += opts.firstDay; + while (day >= 7) { + day -= 7; + } + return abbr ? opts.i18n.weekdaysAbbrev[day] : opts.i18n.weekdays[day]; + } + + /** + * Set input value to the selected date and close Datepicker + */ + + }, { + key: "_finishSelection", + value: function _finishSelection() { + this.setInputValue(); + this.close(); + } + + /** + * Open Datepicker + */ + + }, { + key: "open", + value: function open() { + if (this.isOpen) { + return; + } + + this.isOpen = true; + if (typeof this.options.onOpen === 'function') { + this.options.onOpen.call(this); + } + this.draw(); + this.modal.open(); + return this; + } + + /** + * Close Datepicker + */ + + }, { + key: "close", + value: function close() { + if (!this.isOpen) { + return; + } + + this.isOpen = false; + if (typeof this.options.onClose === 'function') { + this.options.onClose.call(this); + } + this.modal.close(); + return this; + } + }], [{ + key: "init", + value: function init(els, options) { + return _get(Datepicker.__proto__ || Object.getPrototypeOf(Datepicker), "init", this).call(this, this, els, options); + } + }, { + key: "_isDate", + value: function _isDate(obj) { + return (/Date/.test(Object.prototype.toString.call(obj)) && !isNaN(obj.getTime()) + ); + } + }, { + key: "_isWeekend", + value: function _isWeekend(date) { + var day = date.getDay(); + return day === 0 || day === 6; + } + }, { + key: "_setToStartOfDay", + value: function _setToStartOfDay(date) { + if (Datepicker._isDate(date)) date.setHours(0, 0, 0, 0); + } + }, { + key: "_getDaysInMonth", + value: function _getDaysInMonth(year, month) { + return [31, Datepicker._isLeapYear(year) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month]; + } + }, { + key: "_isLeapYear", + value: function _isLeapYear(year) { + // solution by Matti Virkkunen: http://stackoverflow.com/a/4881951 + return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0; + } + }, { + key: "_compareDates", + value: function _compareDates(a, b) { + // weak date comparison (use setToStartOfDay(date) to ensure correct result) + return a.getTime() === b.getTime(); + } + }, { + key: "_setToStartOfDay", + value: function _setToStartOfDay(date) { + if (Datepicker._isDate(date)) date.setHours(0, 0, 0, 0); + } + + /** + * Get Instance + */ + + }, { + key: "getInstance", + value: function getInstance(el) { + var domElem = !!el.jquery ? el[0] : el; + return domElem.M_Datepicker; + } + }, { + key: "defaults", + get: function () { + return _defaults; + } + }]); + + return Datepicker; + }(Component); + + Datepicker._template = [''].join(''); + + M.Datepicker = Datepicker; + + if (M.jQueryLoaded) { + M.initializeJqueryWrapper(Datepicker, 'datepicker', 'M_Datepicker'); + } +})(cash); +;(function ($) { + 'use strict'; + + var _defaults = { + dialRadius: 135, + outerRadius: 105, + innerRadius: 70, + tickRadius: 20, + duration: 350, + container: null, + defaultTime: 'now', // default time, 'now' or '13:14' e.g. + fromNow: 0, // Millisecond offset from the defaultTime + showClearBtn: false, + + // internationalization + i18n: { + cancel: 'Cancel', + clear: 'Clear', + done: 'Ok' + }, + + autoClose: false, // auto close when minute is selected + twelveHour: true, // change to 12 hour AM/PM clock from 24 hour + vibrate: true, // vibrate the device when dragging clock hand + + // Callbacks + onOpenStart: null, + onOpenEnd: null, + onCloseStart: null, + onCloseEnd: null, + onSelect: null + }; + + /** + * @class + * + */ + + var Timepicker = function (_Component16) { + _inherits(Timepicker, _Component16); + + function Timepicker(el, options) { + _classCallCheck(this, Timepicker); + + var _this57 = _possibleConstructorReturn(this, (Timepicker.__proto__ || Object.getPrototypeOf(Timepicker)).call(this, Timepicker, el, options)); + + _this57.el.M_Timepicker = _this57; + + _this57.options = $.extend({}, Timepicker.defaults, options); + + _this57.id = M.guid(); + _this57._insertHTMLIntoDOM(); + _this57._setupModal(); + _this57._setupVariables(); + _this57._setupEventHandlers(); + + _this57._clockSetup(); + _this57._pickerSetup(); + return _this57; + } + + _createClass(Timepicker, [{ + key: "destroy", + + + /** + * Teardown component + */ + value: function destroy() { + this._removeEventHandlers(); + this.modal.destroy(); + $(this.modalEl).remove(); + this.el.M_Timepicker = undefined; + } + + /** + * Setup Event Handlers + */ + + }, { + key: "_setupEventHandlers", + value: function _setupEventHandlers() { + this._handleInputKeydownBound = this._handleInputKeydown.bind(this); + this._handleInputClickBound = this._handleInputClick.bind(this); + this._handleClockClickStartBound = this._handleClockClickStart.bind(this); + this._handleDocumentClickMoveBound = this._handleDocumentClickMove.bind(this); + this._handleDocumentClickEndBound = this._handleDocumentClickEnd.bind(this); + + this.el.addEventListener('click', this._handleInputClickBound); + this.el.addEventListener('keydown', this._handleInputKeydownBound); + this.plate.addEventListener('mousedown', this._handleClockClickStartBound); + this.plate.addEventListener('touchstart', this._handleClockClickStartBound); + + $(this.spanHours).on('click', this.showView.bind(this, 'hours')); + $(this.spanMinutes).on('click', this.showView.bind(this, 'minutes')); + } + }, { + key: "_removeEventHandlers", + value: function _removeEventHandlers() { + this.el.removeEventListener('click', this._handleInputClickBound); + this.el.removeEventListener('keydown', this._handleInputKeydownBound); + } + }, { + key: "_handleInputClick", + value: function _handleInputClick() { + this.open(); + } + }, { + key: "_handleInputKeydown", + value: function _handleInputKeydown(e) { + if (e.which === M.keys.ENTER) { + e.preventDefault(); + this.open(); + } + } + }, { + key: "_handleClockClickStart", + value: function _handleClockClickStart(e) { + e.preventDefault(); + var clockPlateBR = this.plate.getBoundingClientRect(); + var offset = { x: clockPlateBR.left, y: clockPlateBR.top }; + + this.x0 = offset.x + this.options.dialRadius; + this.y0 = offset.y + this.options.dialRadius; + this.moved = false; + var clickPos = Timepicker._Pos(e); + this.dx = clickPos.x - this.x0; + this.dy = clickPos.y - this.y0; + + // Set clock hands + this.setHand(this.dx, this.dy, false); + + // Mousemove on document + document.addEventListener('mousemove', this._handleDocumentClickMoveBound); + document.addEventListener('touchmove', this._handleDocumentClickMoveBound); + + // Mouseup on document + document.addEventListener('mouseup', this._handleDocumentClickEndBound); + document.addEventListener('touchend', this._handleDocumentClickEndBound); + } + }, { + key: "_handleDocumentClickMove", + value: function _handleDocumentClickMove(e) { + e.preventDefault(); + var clickPos = Timepicker._Pos(e); + var x = clickPos.x - this.x0; + var y = clickPos.y - this.y0; + this.moved = true; + this.setHand(x, y, false, true); + } + }, { + key: "_handleDocumentClickEnd", + value: function _handleDocumentClickEnd(e) { + var _this58 = this; + + e.preventDefault(); + document.removeEventListener('mouseup', this._handleDocumentClickEndBound); + document.removeEventListener('touchend', this._handleDocumentClickEndBound); + var clickPos = Timepicker._Pos(e); + var x = clickPos.x - this.x0; + var y = clickPos.y - this.y0; + if (this.moved && x === this.dx && y === this.dy) { + this.setHand(x, y); + } + + if (this.currentView === 'hours') { + this.showView('minutes', this.options.duration / 2); + } else if (this.options.autoClose) { + $(this.minutesView).addClass('timepicker-dial-out'); + setTimeout(function () { + _this58.done(); + }, this.options.duration / 2); + } + + if (typeof this.options.onSelect === 'function') { + this.options.onSelect.call(this, this.hours, this.minutes); + } + + // Unbind mousemove event + document.removeEventListener('mousemove', this._handleDocumentClickMoveBound); + document.removeEventListener('touchmove', this._handleDocumentClickMoveBound); + } + }, { + key: "_insertHTMLIntoDOM", + value: function _insertHTMLIntoDOM() { + this.$modalEl = $(Timepicker._template); + this.modalEl = this.$modalEl[0]; + this.modalEl.id = 'modal-' + this.id; + + // Append popover to input by default + var containerEl = document.querySelector(this.options.container); + if (this.options.container && !!containerEl) { + this.$modalEl.appendTo(containerEl); + } else { + this.$modalEl.insertBefore(this.el); + } + } + }, { + key: "_setupModal", + value: function _setupModal() { + var _this59 = this; + + this.modal = M.Modal.init(this.modalEl, { + onOpenStart: this.options.onOpenStart, + onOpenEnd: this.options.onOpenEnd, + onCloseStart: this.options.onCloseStart, + onCloseEnd: function () { + if (typeof _this59.options.onCloseEnd === 'function') { + _this59.options.onCloseEnd.call(_this59); + } + _this59.isOpen = false; + } + }); + } + }, { + key: "_setupVariables", + value: function _setupVariables() { + this.currentView = 'hours'; + this.vibrate = navigator.vibrate ? 'vibrate' : navigator.webkitVibrate ? 'webkitVibrate' : null; + + this._canvas = this.modalEl.querySelector('.timepicker-canvas'); + this.plate = this.modalEl.querySelector('.timepicker-plate'); + + this.hoursView = this.modalEl.querySelector('.timepicker-hours'); + this.minutesView = this.modalEl.querySelector('.timepicker-minutes'); + this.spanHours = this.modalEl.querySelector('.timepicker-span-hours'); + this.spanMinutes = this.modalEl.querySelector('.timepicker-span-minutes'); + this.spanAmPm = this.modalEl.querySelector('.timepicker-span-am-pm'); + this.footer = this.modalEl.querySelector('.timepicker-footer'); + this.amOrPm = 'PM'; + } + }, { + key: "_pickerSetup", + value: function _pickerSetup() { + var $clearBtn = $("").appendTo(this.footer).on('click', this.clear.bind(this)); + if (this.options.showClearBtn) { + $clearBtn.css({ visibility: '' }); + } + + var confirmationBtnsContainer = $('
    '); + $('').appendTo(confirmationBtnsContainer).on('click', this.close.bind(this)); + $('').appendTo(confirmationBtnsContainer).on('click', this.done.bind(this)); + confirmationBtnsContainer.appendTo(this.footer); + } + }, { + key: "_clockSetup", + value: function _clockSetup() { + if (this.options.twelveHour) { + this.$amBtn = $('
    AM
    '); + this.$pmBtn = $('
    PM
    '); + this.$amBtn.on('click', this._handleAmPmClick.bind(this)).appendTo(this.spanAmPm); + this.$pmBtn.on('click', this._handleAmPmClick.bind(this)).appendTo(this.spanAmPm); + } + + this._buildHoursView(); + this._buildMinutesView(); + this._buildSVGClock(); + } + }, { + key: "_buildSVGClock", + value: function _buildSVGClock() { + // Draw clock hands and others + var dialRadius = this.options.dialRadius; + var tickRadius = this.options.tickRadius; + var diameter = dialRadius * 2; + + var svg = Timepicker._createSVGEl('svg'); + svg.setAttribute('class', 'timepicker-svg'); + svg.setAttribute('width', diameter); + svg.setAttribute('height', diameter); + var g = Timepicker._createSVGEl('g'); + g.setAttribute('transform', 'translate(' + dialRadius + ',' + dialRadius + ')'); + var bearing = Timepicker._createSVGEl('circle'); + bearing.setAttribute('class', 'timepicker-canvas-bearing'); + bearing.setAttribute('cx', 0); + bearing.setAttribute('cy', 0); + bearing.setAttribute('r', 4); + var hand = Timepicker._createSVGEl('line'); + hand.setAttribute('x1', 0); + hand.setAttribute('y1', 0); + var bg = Timepicker._createSVGEl('circle'); + bg.setAttribute('class', 'timepicker-canvas-bg'); + bg.setAttribute('r', tickRadius); + g.appendChild(hand); + g.appendChild(bg); + g.appendChild(bearing); + svg.appendChild(g); + this._canvas.appendChild(svg); + + this.hand = hand; + this.bg = bg; + this.bearing = bearing; + this.g = g; + } + }, { + key: "_buildHoursView", + value: function _buildHoursView() { + var $tick = $('
    '); + // Hours view + if (this.options.twelveHour) { + for (var i = 1; i < 13; i += 1) { + var tick = $tick.clone(); + var radian = i / 6 * Math.PI; + var radius = this.options.outerRadius; + tick.css({ + left: this.options.dialRadius + Math.sin(radian) * radius - this.options.tickRadius + 'px', + top: this.options.dialRadius - Math.cos(radian) * radius - this.options.tickRadius + 'px' + }); + tick.html(i === 0 ? '00' : i); + this.hoursView.appendChild(tick[0]); + // tick.on(mousedownEvent, mousedown); + } + } else { + for (var _i2 = 0; _i2 < 24; _i2 += 1) { + var _tick = $tick.clone(); + var _radian = _i2 / 6 * Math.PI; + var inner = _i2 > 0 && _i2 < 13; + var _radius = inner ? this.options.innerRadius : this.options.outerRadius; + _tick.css({ + left: this.options.dialRadius + Math.sin(_radian) * _radius - this.options.tickRadius + 'px', + top: this.options.dialRadius - Math.cos(_radian) * _radius - this.options.tickRadius + 'px' + }); + _tick.html(_i2 === 0 ? '00' : _i2); + this.hoursView.appendChild(_tick[0]); + // tick.on(mousedownEvent, mousedown); + } + } + } + }, { + key: "_buildMinutesView", + value: function _buildMinutesView() { + var $tick = $('
    '); + // Minutes view + for (var i = 0; i < 60; i += 5) { + var tick = $tick.clone(); + var radian = i / 30 * Math.PI; + tick.css({ + left: this.options.dialRadius + Math.sin(radian) * this.options.outerRadius - this.options.tickRadius + 'px', + top: this.options.dialRadius - Math.cos(radian) * this.options.outerRadius - this.options.tickRadius + 'px' + }); + tick.html(Timepicker._addLeadingZero(i)); + this.minutesView.appendChild(tick[0]); + } + } + }, { + key: "_handleAmPmClick", + value: function _handleAmPmClick(e) { + var $btnClicked = $(e.target); + this.amOrPm = $btnClicked.hasClass('am-btn') ? 'AM' : 'PM'; + this._updateAmPmView(); + } + }, { + key: "_updateAmPmView", + value: function _updateAmPmView() { + if (this.options.twelveHour) { + this.$amBtn.toggleClass('text-primary', this.amOrPm === 'AM'); + this.$pmBtn.toggleClass('text-primary', this.amOrPm === 'PM'); + } + } + }, { + key: "_updateTimeFromInput", + value: function _updateTimeFromInput() { + // Get the time + var value = ((this.el.value || this.options.defaultTime || '') + '').split(':'); + if (this.options.twelveHour && !(typeof value[1] === 'undefined')) { + if (value[1].toUpperCase().indexOf('AM') > 0) { + this.amOrPm = 'AM'; + } else { + this.amOrPm = 'PM'; + } + value[1] = value[1].replace('AM', '').replace('PM', ''); + } + if (value[0] === 'now') { + var now = new Date(+new Date() + this.options.fromNow); + value = [now.getHours(), now.getMinutes()]; + if (this.options.twelveHour) { + this.amOrPm = value[0] >= 12 && value[0] < 24 ? 'PM' : 'AM'; + } + } + this.hours = +value[0] || 0; + this.minutes = +value[1] || 0; + this.spanHours.innerHTML = this.hours; + this.spanMinutes.innerHTML = Timepicker._addLeadingZero(this.minutes); + + this._updateAmPmView(); + } + }, { + key: "showView", + value: function showView(view, delay) { + if (view === 'minutes' && $(this.hoursView).css('visibility') === 'visible') { + // raiseCallback(this.options.beforeHourSelect); + } + var isHours = view === 'hours', + nextView = isHours ? this.hoursView : this.minutesView, + hideView = isHours ? this.minutesView : this.hoursView; + this.currentView = view; + + $(this.spanHours).toggleClass('text-primary', isHours); + $(this.spanMinutes).toggleClass('text-primary', !isHours); + + // Transition view + hideView.classList.add('timepicker-dial-out'); + $(nextView).css('visibility', 'visible').removeClass('timepicker-dial-out'); + + // Reset clock hand + this.resetClock(delay); + + // After transitions ended + clearTimeout(this.toggleViewTimer); + this.toggleViewTimer = setTimeout(function () { + $(hideView).css('visibility', 'hidden'); + }, this.options.duration); + } + }, { + key: "resetClock", + value: function resetClock(delay) { + var view = this.currentView, + value = this[view], + isHours = view === 'hours', + unit = Math.PI / (isHours ? 6 : 30), + radian = value * unit, + radius = isHours && value > 0 && value < 13 ? this.options.innerRadius : this.options.outerRadius, + x = Math.sin(radian) * radius, + y = -Math.cos(radian) * radius, + self = this; + + if (delay) { + $(this.canvas).addClass('timepicker-canvas-out'); + setTimeout(function () { + $(self.canvas).removeClass('timepicker-canvas-out'); + self.setHand(x, y); + }, delay); + } else { + this.setHand(x, y); + } + } + }, { + key: "setHand", + value: function setHand(x, y, roundBy5) { + var _this60 = this; + + var radian = Math.atan2(x, -y), + isHours = this.currentView === 'hours', + unit = Math.PI / (isHours || roundBy5 ? 6 : 30), + z = Math.sqrt(x * x + y * y), + inner = isHours && z < (this.options.outerRadius + this.options.innerRadius) / 2, + radius = inner ? this.options.innerRadius : this.options.outerRadius; + + if (this.options.twelveHour) { + radius = this.options.outerRadius; + } + + // Radian should in range [0, 2PI] + if (radian < 0) { + radian = Math.PI * 2 + radian; + } + + // Get the round value + var value = Math.round(radian / unit); + + // Get the round radian + radian = value * unit; + + // Correct the hours or minutes + if (this.options.twelveHour) { + if (isHours) { + if (value === 0) value = 12; + } else { + if (roundBy5) value *= 5; + if (value === 60) value = 0; + } + } else { + if (isHours) { + if (value === 12) { + value = 0; + } + value = inner ? value === 0 ? 12 : value : value === 0 ? 0 : value + 12; + } else { + if (roundBy5) { + value *= 5; + } + if (value === 60) { + value = 0; + } + } + } + + // Once hours or minutes changed, vibrate the device + if (this[this.currentView] !== value) { + if (this.vibrate && this.options.vibrate) { + // Do not vibrate too frequently + if (!this.vibrateTimer) { + navigator[this.vibrate](10); + this.vibrateTimer = setTimeout(function () { + _this60.vibrateTimer = null; + }, 100); + } + } + } + + this[this.currentView] = value; + if (isHours) { + this['spanHours'].innerHTML = value; + } else { + this['spanMinutes'].innerHTML = Timepicker._addLeadingZero(value); + } + + // Set clock hand and others' position + var cx1 = Math.sin(radian) * (radius - this.options.tickRadius), + cy1 = -Math.cos(radian) * (radius - this.options.tickRadius), + cx2 = Math.sin(radian) * radius, + cy2 = -Math.cos(radian) * radius; + this.hand.setAttribute('x2', cx1); + this.hand.setAttribute('y2', cy1); + this.bg.setAttribute('cx', cx2); + this.bg.setAttribute('cy', cy2); + } + }, { + key: "open", + value: function open() { + if (this.isOpen) { + return; + } + + this.isOpen = true; + this._updateTimeFromInput(); + this.showView('hours'); + + this.modal.open(); + } + }, { + key: "close", + value: function close() { + if (!this.isOpen) { + return; + } + + this.isOpen = false; + this.modal.close(); + } + + /** + * Finish timepicker selection. + */ + + }, { + key: "done", + value: function done(e, clearValue) { + // Set input value + var last = this.el.value; + var value = clearValue ? '' : Timepicker._addLeadingZero(this.hours) + ':' + Timepicker._addLeadingZero(this.minutes); + this.time = value; + if (!clearValue && this.options.twelveHour) { + value = value + " " + this.amOrPm; + } + this.el.value = value; + + // Trigger change event + if (value !== last) { + this.$el.trigger('change'); + } + + this.close(); + this.el.focus(); + } + }, { + key: "clear", + value: function clear() { + this.done(null, true); + } + }], [{ + key: "init", + value: function init(els, options) { + return _get(Timepicker.__proto__ || Object.getPrototypeOf(Timepicker), "init", this).call(this, this, els, options); + } + }, { + key: "_addLeadingZero", + value: function _addLeadingZero(num) { + return (num < 10 ? '0' : '') + num; + } + }, { + key: "_createSVGEl", + value: function _createSVGEl(name) { + var svgNS = 'http://www.w3.org/2000/svg'; + return document.createElementNS(svgNS, name); + } + + /** + * @typedef {Object} Point + * @property {number} x The X Coordinate + * @property {number} y The Y Coordinate + */ + + /** + * Get x position of mouse or touch event + * @param {Event} e + * @return {Point} x and y location + */ + + }, { + key: "_Pos", + value: function _Pos(e) { + if (e.targetTouches && e.targetTouches.length >= 1) { + return { x: e.targetTouches[0].clientX, y: e.targetTouches[0].clientY }; + } + // mouse event + return { x: e.clientX, y: e.clientY }; + } + + /** + * Get Instance + */ + + }, { + key: "getInstance", + value: function getInstance(el) { + var domElem = !!el.jquery ? el[0] : el; + return domElem.M_Timepicker; + } + }, { + key: "defaults", + get: function () { + return _defaults; + } + }]); + + return Timepicker; + }(Component); + + Timepicker._template = [''].join(''); + + M.Timepicker = Timepicker; + + if (M.jQueryLoaded) { + M.initializeJqueryWrapper(Timepicker, 'timepicker', 'M_Timepicker'); + } +})(cash); +;(function ($) { + 'use strict'; + + var _defaults = {}; + + /** + * @class + * + */ + + var CharacterCounter = function (_Component17) { + _inherits(CharacterCounter, _Component17); + + /** + * Construct CharacterCounter instance + * @constructor + * @param {Element} el + * @param {Object} options + */ + function CharacterCounter(el, options) { + _classCallCheck(this, CharacterCounter); + + var _this61 = _possibleConstructorReturn(this, (CharacterCounter.__proto__ || Object.getPrototypeOf(CharacterCounter)).call(this, CharacterCounter, el, options)); + + _this61.el.M_CharacterCounter = _this61; + + /** + * Options for the character counter + */ + _this61.options = $.extend({}, CharacterCounter.defaults, options); + + _this61.isInvalid = false; + _this61.isValidLength = false; + _this61._setupCounter(); + _this61._setupEventHandlers(); + return _this61; + } + + _createClass(CharacterCounter, [{ + key: "destroy", + + + /** + * Teardown component + */ + value: function destroy() { + this._removeEventHandlers(); + this.el.CharacterCounter = undefined; + this._removeCounter(); + } + + /** + * Setup Event Handlers + */ + + }, { + key: "_setupEventHandlers", + value: function _setupEventHandlers() { + this._handleUpdateCounterBound = this.updateCounter.bind(this); + + this.el.addEventListener('focus', this._handleUpdateCounterBound, true); + this.el.addEventListener('input', this._handleUpdateCounterBound, true); + } + + /** + * Remove Event Handlers + */ + + }, { + key: "_removeEventHandlers", + value: function _removeEventHandlers() { + this.el.removeEventListener('focus', this._handleUpdateCounterBound, true); + this.el.removeEventListener('input', this._handleUpdateCounterBound, true); + } + + /** + * Setup counter element + */ + + }, { + key: "_setupCounter", + value: function _setupCounter() { + this.counterEl = document.createElement('span'); + $(this.counterEl).addClass('character-counter').css({ + float: 'right', + 'font-size': '12px', + height: 1 + }); + + this.$el.parent().append(this.counterEl); + } + + /** + * Remove counter element + */ + + }, { + key: "_removeCounter", + value: function _removeCounter() { + $(this.counterEl).remove(); + } + + /** + * Update counter + */ + + }, { + key: "updateCounter", + value: function updateCounter() { + var maxLength = +this.$el.attr('data-length'), + actualLength = this.el.value.length; + this.isValidLength = actualLength <= maxLength; + var counterString = actualLength; + + if (maxLength) { + counterString += '/' + maxLength; + this._validateInput(); + } + + $(this.counterEl).html(counterString); + } + + /** + * Add validation classes + */ + + }, { + key: "_validateInput", + value: function _validateInput() { + if (this.isValidLength && this.isInvalid) { + this.isInvalid = false; + this.$el.removeClass('invalid'); + } else if (!this.isValidLength && !this.isInvalid) { + this.isInvalid = true; + this.$el.removeClass('valid'); + this.$el.addClass('invalid'); + } + } + }], [{ + key: "init", + value: function init(els, options) { + return _get(CharacterCounter.__proto__ || Object.getPrototypeOf(CharacterCounter), "init", this).call(this, this, els, options); + } + + /** + * Get Instance + */ + + }, { + key: "getInstance", + value: function getInstance(el) { + var domElem = !!el.jquery ? el[0] : el; + return domElem.M_CharacterCounter; + } + }, { + key: "defaults", + get: function () { + return _defaults; + } + }]); + + return CharacterCounter; + }(Component); + + M.CharacterCounter = CharacterCounter; + + if (M.jQueryLoaded) { + M.initializeJqueryWrapper(CharacterCounter, 'characterCounter', 'M_CharacterCounter'); + } +})(cash); +;(function ($) { + 'use strict'; + + var _defaults = { + duration: 200, // ms + dist: -100, // zoom scale TODO: make this more intuitive as an option + shift: 0, // spacing for center image + padding: 0, // Padding between non center items + numVisible: 5, // Number of visible items in carousel + fullWidth: false, // Change to full width styles + indicators: false, // Toggle indicators + noWrap: false, // Don't wrap around and cycle through items. + onCycleTo: null // Callback for when a new slide is cycled to. + }; + + /** + * @class + * + */ + + var Carousel = function (_Component18) { + _inherits(Carousel, _Component18); + + /** + * Construct Carousel instance + * @constructor + * @param {Element} el + * @param {Object} options + */ + function Carousel(el, options) { + _classCallCheck(this, Carousel); + + var _this62 = _possibleConstructorReturn(this, (Carousel.__proto__ || Object.getPrototypeOf(Carousel)).call(this, Carousel, el, options)); + + _this62.el.M_Carousel = _this62; + + /** + * Options for the carousel + * @member Carousel#options + * @prop {Number} duration + * @prop {Number} dist + * @prop {Number} shift + * @prop {Number} padding + * @prop {Number} numVisible + * @prop {Boolean} fullWidth + * @prop {Boolean} indicators + * @prop {Boolean} noWrap + * @prop {Function} onCycleTo + */ + _this62.options = $.extend({}, Carousel.defaults, options); + + // Setup + _this62.hasMultipleSlides = _this62.$el.find('.carousel-item').length > 1; + _this62.showIndicators = _this62.options.indicators && _this62.hasMultipleSlides; + _this62.noWrap = _this62.options.noWrap || !_this62.hasMultipleSlides; + _this62.pressed = false; + _this62.dragged = false; + _this62.offset = _this62.target = 0; + _this62.images = []; + _this62.itemWidth = _this62.$el.find('.carousel-item').first().innerWidth(); + _this62.itemHeight = _this62.$el.find('.carousel-item').first().innerHeight(); + _this62.dim = _this62.itemWidth * 2 + _this62.options.padding || 1; // Make sure dim is non zero for divisions. + _this62._autoScrollBound = _this62._autoScroll.bind(_this62); + _this62._trackBound = _this62._track.bind(_this62); + + // Full Width carousel setup + if (_this62.options.fullWidth) { + _this62.options.dist = 0; + _this62._setCarouselHeight(); + + // Offset fixed items when indicators. + if (_this62.showIndicators) { + _this62.$el.find('.carousel-fixed-item').addClass('with-indicators'); + } + } + + // Iterate through slides + _this62.$indicators = $('
      '); + _this62.$el.find('.carousel-item').each(function (el, i) { + _this62.images.push(el); + if (_this62.showIndicators) { + var $indicator = $('
    • '); + + // Add active to first by default. + if (i === 0) { + $indicator[0].classList.add('active'); + } + + _this62.$indicators.append($indicator); + } + }); + if (_this62.showIndicators) { + _this62.$el.append(_this62.$indicators); + } + _this62.count = _this62.images.length; + + // Cap numVisible at count + _this62.options.numVisible = Math.min(_this62.count, _this62.options.numVisible); + + // Setup cross browser string + _this62.xform = 'transform'; + ['webkit', 'Moz', 'O', 'ms'].every(function (prefix) { + var e = prefix + 'Transform'; + if (typeof document.body.style[e] !== 'undefined') { + _this62.xform = e; + return false; + } + return true; + }); + + _this62._setupEventHandlers(); + _this62._scroll(_this62.offset); + return _this62; + } + + _createClass(Carousel, [{ + key: "destroy", + + + /** + * Teardown component + */ + value: function destroy() { + this._removeEventHandlers(); + this.el.M_Carousel = undefined; + } + + /** + * Setup Event Handlers + */ + + }, { + key: "_setupEventHandlers", + value: function _setupEventHandlers() { + var _this63 = this; + + this._handleCarouselTapBound = this._handleCarouselTap.bind(this); + this._handleCarouselDragBound = this._handleCarouselDrag.bind(this); + this._handleCarouselReleaseBound = this._handleCarouselRelease.bind(this); + this._handleCarouselClickBound = this._handleCarouselClick.bind(this); + + if (typeof window.ontouchstart !== 'undefined') { + this.el.addEventListener('touchstart', this._handleCarouselTapBound); + this.el.addEventListener('touchmove', this._handleCarouselDragBound); + this.el.addEventListener('touchend', this._handleCarouselReleaseBound); + } + + this.el.addEventListener('mousedown', this._handleCarouselTapBound); + this.el.addEventListener('mousemove', this._handleCarouselDragBound); + this.el.addEventListener('mouseup', this._handleCarouselReleaseBound); + this.el.addEventListener('mouseleave', this._handleCarouselReleaseBound); + this.el.addEventListener('click', this._handleCarouselClickBound); + + if (this.showIndicators && this.$indicators) { + this._handleIndicatorClickBound = this._handleIndicatorClick.bind(this); + this.$indicators.find('.indicator-item').each(function (el, i) { + el.addEventListener('click', _this63._handleIndicatorClickBound); + }); + } + + // Resize + var throttledResize = M.throttle(this._handleResize, 200); + this._handleThrottledResizeBound = throttledResize.bind(this); + + window.addEventListener('resize', this._handleThrottledResizeBound); + } + + /** + * Remove Event Handlers + */ + + }, { + key: "_removeEventHandlers", + value: function _removeEventHandlers() { + var _this64 = this; + + if (typeof window.ontouchstart !== 'undefined') { + this.el.removeEventListener('touchstart', this._handleCarouselTapBound); + this.el.removeEventListener('touchmove', this._handleCarouselDragBound); + this.el.removeEventListener('touchend', this._handleCarouselReleaseBound); + } + this.el.removeEventListener('mousedown', this._handleCarouselTapBound); + this.el.removeEventListener('mousemove', this._handleCarouselDragBound); + this.el.removeEventListener('mouseup', this._handleCarouselReleaseBound); + this.el.removeEventListener('mouseleave', this._handleCarouselReleaseBound); + this.el.removeEventListener('click', this._handleCarouselClickBound); + + if (this.showIndicators && this.$indicators) { + this.$indicators.find('.indicator-item').each(function (el, i) { + el.removeEventListener('click', _this64._handleIndicatorClickBound); + }); + } + + window.removeEventListener('resize', this._handleThrottledResizeBound); + } + + /** + * Handle Carousel Tap + * @param {Event} e + */ + + }, { + key: "_handleCarouselTap", + value: function _handleCarouselTap(e) { + // Fixes firefox draggable image bug + if (e.type === 'mousedown' && $(e.target).is('img')) { + e.preventDefault(); + } + this.pressed = true; + this.dragged = false; + this.verticalDragged = false; + this.reference = this._xpos(e); + this.referenceY = this._ypos(e); + + this.velocity = this.amplitude = 0; + this.frame = this.offset; + this.timestamp = Date.now(); + clearInterval(this.ticker); + this.ticker = setInterval(this._trackBound, 100); + } + + /** + * Handle Carousel Drag + * @param {Event} e + */ + + }, { + key: "_handleCarouselDrag", + value: function _handleCarouselDrag(e) { + var x = void 0, + y = void 0, + delta = void 0, + deltaY = void 0; + if (this.pressed) { + x = this._xpos(e); + y = this._ypos(e); + delta = this.reference - x; + deltaY = Math.abs(this.referenceY - y); + if (deltaY < 30 && !this.verticalDragged) { + // If vertical scrolling don't allow dragging. + if (delta > 2 || delta < -2) { + this.dragged = true; + this.reference = x; + this._scroll(this.offset + delta); + } + } else if (this.dragged) { + // If dragging don't allow vertical scroll. + e.preventDefault(); + e.stopPropagation(); + return false; + } else { + // Vertical scrolling. + this.verticalDragged = true; + } + } + + if (this.dragged) { + // If dragging don't allow vertical scroll. + e.preventDefault(); + e.stopPropagation(); + return false; + } + } + + /** + * Handle Carousel Release + * @param {Event} e + */ + + }, { + key: "_handleCarouselRelease", + value: function _handleCarouselRelease(e) { + if (this.pressed) { + this.pressed = false; + } else { + return; + } + + clearInterval(this.ticker); + this.target = this.offset; + if (this.velocity > 10 || this.velocity < -10) { + this.amplitude = 0.9 * this.velocity; + this.target = this.offset + this.amplitude; + } + this.target = Math.round(this.target / this.dim) * this.dim; + + // No wrap of items. + if (this.noWrap) { + if (this.target >= this.dim * (this.count - 1)) { + this.target = this.dim * (this.count - 1); + } else if (this.target < 0) { + this.target = 0; + } + } + this.amplitude = this.target - this.offset; + this.timestamp = Date.now(); + requestAnimationFrame(this._autoScrollBound); + + if (this.dragged) { + e.preventDefault(); + e.stopPropagation(); + } + return false; + } + + /** + * Handle Carousel CLick + * @param {Event} e + */ + + }, { + key: "_handleCarouselClick", + value: function _handleCarouselClick(e) { + // Disable clicks if carousel was dragged. + if (this.dragged) { + e.preventDefault(); + e.stopPropagation(); + return false; + } else if (!this.options.fullWidth) { + var clickedIndex = $(e.target).closest('.carousel-item').index(); + var diff = this._wrap(this.center) - clickedIndex; + + // Disable clicks if carousel was shifted by click + if (diff !== 0) { + e.preventDefault(); + e.stopPropagation(); + } + this._cycleTo(clickedIndex); + } + } + + /** + * Handle Indicator CLick + * @param {Event} e + */ + + }, { + key: "_handleIndicatorClick", + value: function _handleIndicatorClick(e) { + e.stopPropagation(); + + var indicator = $(e.target).closest('.indicator-item'); + if (indicator.length) { + this._cycleTo(indicator.index()); + } + } + + /** + * Handle Throttle Resize + * @param {Event} e + */ + + }, { + key: "_handleResize", + value: function _handleResize(e) { + if (this.options.fullWidth) { + this.itemWidth = this.$el.find('.carousel-item').first().innerWidth(); + this.imageHeight = this.$el.find('.carousel-item.active').height(); + this.dim = this.itemWidth * 2 + this.options.padding; + this.offset = this.center * 2 * this.itemWidth; + this.target = this.offset; + this._setCarouselHeight(true); + } else { + this._scroll(); + } + } + + /** + * Set carousel height based on first slide + * @param {Booleam} imageOnly - true for image slides + */ + + }, { + key: "_setCarouselHeight", + value: function _setCarouselHeight(imageOnly) { + var _this65 = this; + + var firstSlide = this.$el.find('.carousel-item.active').length ? this.$el.find('.carousel-item.active').first() : this.$el.find('.carousel-item').first(); + var firstImage = firstSlide.find('img').first(); + if (firstImage.length) { + if (firstImage[0].complete) { + // If image won't trigger the load event + var imageHeight = firstImage.height(); + if (imageHeight > 0) { + this.$el.css('height', imageHeight + 'px'); + } else { + // If image still has no height, use the natural dimensions to calculate + var naturalWidth = firstImage[0].naturalWidth; + var naturalHeight = firstImage[0].naturalHeight; + var adjustedHeight = this.$el.width() / naturalWidth * naturalHeight; + this.$el.css('height', adjustedHeight + 'px'); + } + } else { + // Get height when image is loaded normally + firstImage.one('load', function (el, i) { + _this65.$el.css('height', el.offsetHeight + 'px'); + }); + } + } else if (!imageOnly) { + var slideHeight = firstSlide.height(); + this.$el.css('height', slideHeight + 'px'); + } + } + + /** + * Get x position from event + * @param {Event} e + */ + + }, { + key: "_xpos", + value: function _xpos(e) { + // touch event + if (e.targetTouches && e.targetTouches.length >= 1) { + return e.targetTouches[0].clientX; + } + + // mouse event + return e.clientX; + } + + /** + * Get y position from event + * @param {Event} e + */ + + }, { + key: "_ypos", + value: function _ypos(e) { + // touch event + if (e.targetTouches && e.targetTouches.length >= 1) { + return e.targetTouches[0].clientY; + } + + // mouse event + return e.clientY; + } + + /** + * Wrap index + * @param {Number} x + */ + + }, { + key: "_wrap", + value: function _wrap(x) { + return x >= this.count ? x % this.count : x < 0 ? this._wrap(this.count + x % this.count) : x; + } + + /** + * Tracks scrolling information + */ + + }, { + key: "_track", + value: function _track() { + var now = void 0, + elapsed = void 0, + delta = void 0, + v = void 0; + + now = Date.now(); + elapsed = now - this.timestamp; + this.timestamp = now; + delta = this.offset - this.frame; + this.frame = this.offset; + + v = 1000 * delta / (1 + elapsed); + this.velocity = 0.8 * v + 0.2 * this.velocity; + } + + /** + * Auto scrolls to nearest carousel item. + */ + + }, { + key: "_autoScroll", + value: function _autoScroll() { + var elapsed = void 0, + delta = void 0; + + if (this.amplitude) { + elapsed = Date.now() - this.timestamp; + delta = this.amplitude * Math.exp(-elapsed / this.options.duration); + if (delta > 2 || delta < -2) { + this._scroll(this.target - delta); + requestAnimationFrame(this._autoScrollBound); + } else { + this._scroll(this.target); + } + } + } + + /** + * Scroll to target + * @param {Number} x + */ + + }, { + key: "_scroll", + value: function _scroll(x) { + var _this66 = this; + + // Track scrolling state + if (!this.$el.hasClass('scrolling')) { + this.el.classList.add('scrolling'); + } + if (this.scrollingTimeout != null) { + window.clearTimeout(this.scrollingTimeout); + } + this.scrollingTimeout = window.setTimeout(function () { + _this66.$el.removeClass('scrolling'); + }, this.options.duration); + + // Start actual scroll + var i = void 0, + half = void 0, + delta = void 0, + dir = void 0, + tween = void 0, + el = void 0, + alignment = void 0, + zTranslation = void 0, + tweenedOpacity = void 0, + centerTweenedOpacity = void 0; + var lastCenter = this.center; + var numVisibleOffset = 1 / this.options.numVisible; + + this.offset = typeof x === 'number' ? x : this.offset; + this.center = Math.floor((this.offset + this.dim / 2) / this.dim); + delta = this.offset - this.center * this.dim; + dir = delta < 0 ? 1 : -1; + tween = -dir * delta * 2 / this.dim; + half = this.count >> 1; + + if (this.options.fullWidth) { + alignment = 'translateX(0)'; + centerTweenedOpacity = 1; + } else { + alignment = 'translateX(' + (this.el.clientWidth - this.itemWidth) / 2 + 'px) '; + alignment += 'translateY(' + (this.el.clientHeight - this.itemHeight) / 2 + 'px)'; + centerTweenedOpacity = 1 - numVisibleOffset * tween; + } + + // Set indicator active + if (this.showIndicators) { + var diff = this.center % this.count; + var activeIndicator = this.$indicators.find('.indicator-item.active'); + if (activeIndicator.index() !== diff) { + activeIndicator.removeClass('active'); + this.$indicators.find('.indicator-item').eq(diff)[0].classList.add('active'); + } + } + + // center + // Don't show wrapped items. + if (!this.noWrap || this.center >= 0 && this.center < this.count) { + el = this.images[this._wrap(this.center)]; + + // Add active class to center item. + if (!$(el).hasClass('active')) { + this.$el.find('.carousel-item').removeClass('active'); + el.classList.add('active'); + } + var transformString = alignment + " translateX(" + -delta / 2 + "px) translateX(" + dir * this.options.shift * tween * i + "px) translateZ(" + this.options.dist * tween + "px)"; + this._updateItemStyle(el, centerTweenedOpacity, 0, transformString); + } + + for (i = 1; i <= half; ++i) { + // right side + if (this.options.fullWidth) { + zTranslation = this.options.dist; + tweenedOpacity = i === half && delta < 0 ? 1 - tween : 1; + } else { + zTranslation = this.options.dist * (i * 2 + tween * dir); + tweenedOpacity = 1 - numVisibleOffset * (i * 2 + tween * dir); + } + // Don't show wrapped items. + if (!this.noWrap || this.center + i < this.count) { + el = this.images[this._wrap(this.center + i)]; + var _transformString = alignment + " translateX(" + (this.options.shift + (this.dim * i - delta) / 2) + "px) translateZ(" + zTranslation + "px)"; + this._updateItemStyle(el, tweenedOpacity, -i, _transformString); + } + + // left side + if (this.options.fullWidth) { + zTranslation = this.options.dist; + tweenedOpacity = i === half && delta > 0 ? 1 - tween : 1; + } else { + zTranslation = this.options.dist * (i * 2 - tween * dir); + tweenedOpacity = 1 - numVisibleOffset * (i * 2 - tween * dir); + } + // Don't show wrapped items. + if (!this.noWrap || this.center - i >= 0) { + el = this.images[this._wrap(this.center - i)]; + var _transformString2 = alignment + " translateX(" + (-this.options.shift + (-this.dim * i - delta) / 2) + "px) translateZ(" + zTranslation + "px)"; + this._updateItemStyle(el, tweenedOpacity, -i, _transformString2); + } + } + + // center + // Don't show wrapped items. + if (!this.noWrap || this.center >= 0 && this.center < this.count) { + el = this.images[this._wrap(this.center)]; + var _transformString3 = alignment + " translateX(" + -delta / 2 + "px) translateX(" + dir * this.options.shift * tween + "px) translateZ(" + this.options.dist * tween + "px)"; + this._updateItemStyle(el, centerTweenedOpacity, 0, _transformString3); + } + + // onCycleTo callback + var $currItem = this.$el.find('.carousel-item').eq(this._wrap(this.center)); + if (lastCenter !== this.center && typeof this.options.onCycleTo === 'function') { + this.options.onCycleTo.call(this, $currItem[0], this.dragged); + } + + // One time callback + if (typeof this.oneTimeCallback === 'function') { + this.oneTimeCallback.call(this, $currItem[0], this.dragged); + this.oneTimeCallback = null; + } + } + + /** + * Cycle to target + * @param {Element} el + * @param {Number} opacity + * @param {Number} zIndex + * @param {String} transform + */ + + }, { + key: "_updateItemStyle", + value: function _updateItemStyle(el, opacity, zIndex, transform) { + el.style[this.xform] = transform; + el.style.zIndex = zIndex; + el.style.opacity = opacity; + el.style.visibility = 'visible'; + } + + /** + * Cycle to target + * @param {Number} n + * @param {Function} callback + */ + + }, { + key: "_cycleTo", + value: function _cycleTo(n, callback) { + var diff = this.center % this.count - n; + + // Account for wraparound. + if (!this.noWrap) { + if (diff < 0) { + if (Math.abs(diff + this.count) < Math.abs(diff)) { + diff += this.count; + } + } else if (diff > 0) { + if (Math.abs(diff - this.count) < diff) { + diff -= this.count; + } + } + } + + this.target = this.dim * Math.round(this.offset / this.dim); + // Next + if (diff < 0) { + this.target += this.dim * Math.abs(diff); + + // Prev + } else if (diff > 0) { + this.target -= this.dim * diff; + } + + // Set one time callback + if (typeof callback === 'function') { + this.oneTimeCallback = callback; + } + + // Scroll + if (this.offset !== this.target) { + this.amplitude = this.target - this.offset; + this.timestamp = Date.now(); + requestAnimationFrame(this._autoScrollBound); + } + } + + /** + * Cycle to next item + * @param {Number} [n] + */ + + }, { + key: "next", + value: function next(n) { + if (n === undefined || isNaN(n)) { + n = 1; + } + + var index = this.center + n; + if (index >= this.count || index < 0) { + if (this.noWrap) { + return; + } + + index = this._wrap(index); + } + this._cycleTo(index); + } + + /** + * Cycle to previous item + * @param {Number} [n] + */ + + }, { + key: "prev", + value: function prev(n) { + if (n === undefined || isNaN(n)) { + n = 1; + } + + var index = this.center - n; + if (index >= this.count || index < 0) { + if (this.noWrap) { + return; + } + + index = this._wrap(index); + } + + this._cycleTo(index); + } + + /** + * Cycle to nth item + * @param {Number} [n] + * @param {Function} callback + */ + + }, { + key: "set", + value: function set(n, callback) { + if (n === undefined || isNaN(n)) { + n = 0; + } + + if (n > this.count || n < 0) { + if (this.noWrap) { + return; + } + + n = this._wrap(n); + } + + this._cycleTo(n, callback); + } + }], [{ + key: "init", + value: function init(els, options) { + return _get(Carousel.__proto__ || Object.getPrototypeOf(Carousel), "init", this).call(this, this, els, options); + } + + /** + * Get Instance + */ + + }, { + key: "getInstance", + value: function getInstance(el) { + var domElem = !!el.jquery ? el[0] : el; + return domElem.M_Carousel; + } + }, { + key: "defaults", + get: function () { + return _defaults; + } + }]); + + return Carousel; + }(Component); + + M.Carousel = Carousel; + + if (M.jQueryLoaded) { + M.initializeJqueryWrapper(Carousel, 'carousel', 'M_Carousel'); + } +})(cash); +;(function ($) { + 'use strict'; + + var _defaults = { + onOpen: undefined, + onClose: undefined + }; + + /** + * @class + * + */ + + var TapTarget = function (_Component19) { + _inherits(TapTarget, _Component19); + + /** + * Construct TapTarget instance + * @constructor + * @param {Element} el + * @param {Object} options + */ + function TapTarget(el, options) { + _classCallCheck(this, TapTarget); + + var _this67 = _possibleConstructorReturn(this, (TapTarget.__proto__ || Object.getPrototypeOf(TapTarget)).call(this, TapTarget, el, options)); + + _this67.el.M_TapTarget = _this67; + + /** + * Options for the select + * @member TapTarget#options + * @prop {Function} onOpen - Callback function called when feature discovery is opened + * @prop {Function} onClose - Callback function called when feature discovery is closed + */ + _this67.options = $.extend({}, TapTarget.defaults, options); + + _this67.isOpen = false; + + // setup + _this67.$origin = $('#' + _this67.$el.attr('data-target')); + _this67._setup(); + + _this67._calculatePositioning(); + _this67._setupEventHandlers(); + return _this67; + } + + _createClass(TapTarget, [{ + key: "destroy", + + + /** + * Teardown component + */ + value: function destroy() { + this._removeEventHandlers(); + this.el.TapTarget = undefined; + } + + /** + * Setup Event Handlers + */ + + }, { + key: "_setupEventHandlers", + value: function _setupEventHandlers() { + this._handleDocumentClickBound = this._handleDocumentClick.bind(this); + this._handleTargetClickBound = this._handleTargetClick.bind(this); + this._handleOriginClickBound = this._handleOriginClick.bind(this); + + this.el.addEventListener('click', this._handleTargetClickBound); + this.originEl.addEventListener('click', this._handleOriginClickBound); + + // Resize + var throttledResize = M.throttle(this._handleResize, 200); + this._handleThrottledResizeBound = throttledResize.bind(this); + + window.addEventListener('resize', this._handleThrottledResizeBound); + } + + /** + * Remove Event Handlers + */ + + }, { + key: "_removeEventHandlers", + value: function _removeEventHandlers() { + this.el.removeEventListener('click', this._handleTargetClickBound); + this.originEl.removeEventListener('click', this._handleOriginClickBound); + window.removeEventListener('resize', this._handleThrottledResizeBound); + } + + /** + * Handle Target Click + * @param {Event} e + */ + + }, { + key: "_handleTargetClick", + value: function _handleTargetClick(e) { + this.open(); + } + + /** + * Handle Origin Click + * @param {Event} e + */ + + }, { + key: "_handleOriginClick", + value: function _handleOriginClick(e) { + this.close(); + } + + /** + * Handle Resize + * @param {Event} e + */ + + }, { + key: "_handleResize", + value: function _handleResize(e) { + this._calculatePositioning(); + } + + /** + * Handle Resize + * @param {Event} e + */ + + }, { + key: "_handleDocumentClick", + value: function _handleDocumentClick(e) { + if (!$(e.target).closest('.tap-target-wrapper').length) { + this.close(); + e.preventDefault(); + e.stopPropagation(); + } + } + + /** + * Setup Tap Target + */ + + }, { + key: "_setup", + value: function _setup() { + // Creating tap target + this.wrapper = this.$el.parent()[0]; + this.waveEl = $(this.wrapper).find('.tap-target-wave')[0]; + this.originEl = $(this.wrapper).find('.tap-target-origin')[0]; + this.contentEl = this.$el.find('.tap-target-content')[0]; + + // Creating wrapper + if (!$(this.wrapper).hasClass('.tap-target-wrapper')) { + this.wrapper = document.createElement('div'); + this.wrapper.classList.add('tap-target-wrapper'); + this.$el.before($(this.wrapper)); + this.wrapper.append(this.el); + } + + // Creating content + if (!this.contentEl) { + this.contentEl = document.createElement('div'); + this.contentEl.classList.add('tap-target-content'); + this.$el.append(this.contentEl); + } + + // Creating foreground wave + if (!this.waveEl) { + this.waveEl = document.createElement('div'); + this.waveEl.classList.add('tap-target-wave'); + + // Creating origin + if (!this.originEl) { + this.originEl = this.$origin.clone(true, true); + this.originEl.addClass('tap-target-origin'); + this.originEl.removeAttr('id'); + this.originEl.removeAttr('style'); + this.originEl = this.originEl[0]; + this.waveEl.append(this.originEl); + } + + this.wrapper.append(this.waveEl); + } + } + + /** + * Calculate positioning + */ + + }, { + key: "_calculatePositioning", + value: function _calculatePositioning() { + // Element or parent is fixed position? + var isFixed = this.$origin.css('position') === 'fixed'; + if (!isFixed) { + var parents = this.$origin.parents(); + for (var i = 0; i < parents.length; i++) { + isFixed = $(parents[i]).css('position') == 'fixed'; + if (isFixed) { + break; + } + } + } + + // Calculating origin + var originWidth = this.$origin.outerWidth(); + var originHeight = this.$origin.outerHeight(); + var originTop = isFixed ? this.$origin.offset().top - M.getDocumentScrollTop() : this.$origin.offset().top; + var originLeft = isFixed ? this.$origin.offset().left - M.getDocumentScrollLeft() : this.$origin.offset().left; + + // Calculating screen + var windowWidth = window.innerWidth; + var windowHeight = window.innerHeight; + var centerX = windowWidth / 2; + var centerY = windowHeight / 2; + var isLeft = originLeft <= centerX; + var isRight = originLeft > centerX; + var isTop = originTop <= centerY; + var isBottom = originTop > centerY; + var isCenterX = originLeft >= windowWidth * 0.25 && originLeft <= windowWidth * 0.75; + + // Calculating tap target + var tapTargetWidth = this.$el.outerWidth(); + var tapTargetHeight = this.$el.outerHeight(); + var tapTargetTop = originTop + originHeight / 2 - tapTargetHeight / 2; + var tapTargetLeft = originLeft + originWidth / 2 - tapTargetWidth / 2; + var tapTargetPosition = isFixed ? 'fixed' : 'absolute'; + + // Calculating content + var tapTargetTextWidth = isCenterX ? tapTargetWidth : tapTargetWidth / 2 + originWidth; + var tapTargetTextHeight = tapTargetHeight / 2; + var tapTargetTextTop = isTop ? tapTargetHeight / 2 : 0; + var tapTargetTextBottom = 0; + var tapTargetTextLeft = isLeft && !isCenterX ? tapTargetWidth / 2 - originWidth : 0; + var tapTargetTextRight = 0; + var tapTargetTextPadding = originWidth; + var tapTargetTextAlign = isBottom ? 'bottom' : 'top'; + + // Calculating wave + var tapTargetWaveWidth = originWidth > originHeight ? originWidth * 2 : originWidth * 2; + var tapTargetWaveHeight = tapTargetWaveWidth; + var tapTargetWaveTop = tapTargetHeight / 2 - tapTargetWaveHeight / 2; + var tapTargetWaveLeft = tapTargetWidth / 2 - tapTargetWaveWidth / 2; + + // Setting tap target + var tapTargetWrapperCssObj = {}; + tapTargetWrapperCssObj.top = isTop ? tapTargetTop + 'px' : ''; + tapTargetWrapperCssObj.right = isRight ? windowWidth - tapTargetLeft - tapTargetWidth + 'px' : ''; + tapTargetWrapperCssObj.bottom = isBottom ? windowHeight - tapTargetTop - tapTargetHeight + 'px' : ''; + tapTargetWrapperCssObj.left = isLeft ? tapTargetLeft + 'px' : ''; + tapTargetWrapperCssObj.position = tapTargetPosition; + $(this.wrapper).css(tapTargetWrapperCssObj); + + // Setting content + $(this.contentEl).css({ + width: tapTargetTextWidth + 'px', + height: tapTargetTextHeight + 'px', + top: tapTargetTextTop + 'px', + right: tapTargetTextRight + 'px', + bottom: tapTargetTextBottom + 'px', + left: tapTargetTextLeft + 'px', + padding: tapTargetTextPadding + 'px', + verticalAlign: tapTargetTextAlign + }); + + // Setting wave + $(this.waveEl).css({ + top: tapTargetWaveTop + 'px', + left: tapTargetWaveLeft + 'px', + width: tapTargetWaveWidth + 'px', + height: tapTargetWaveHeight + 'px' + }); + } + + /** + * Open TapTarget + */ + + }, { + key: "open", + value: function open() { + if (this.isOpen) { + return; + } + + // onOpen callback + if (typeof this.options.onOpen === 'function') { + this.options.onOpen.call(this, this.$origin[0]); + } + + this.isOpen = true; + this.wrapper.classList.add('open'); + + document.body.addEventListener('click', this._handleDocumentClickBound, true); + document.body.addEventListener('touchend', this._handleDocumentClickBound); + } + + /** + * Close Tap Target + */ + + }, { + key: "close", + value: function close() { + if (!this.isOpen) { + return; + } + + // onClose callback + if (typeof this.options.onClose === 'function') { + this.options.onClose.call(this, this.$origin[0]); + } + + this.isOpen = false; + this.wrapper.classList.remove('open'); + + document.body.removeEventListener('click', this._handleDocumentClickBound, true); + document.body.removeEventListener('touchend', this._handleDocumentClickBound); + } + }], [{ + key: "init", + value: function init(els, options) { + return _get(TapTarget.__proto__ || Object.getPrototypeOf(TapTarget), "init", this).call(this, this, els, options); + } + + /** + * Get Instance + */ + + }, { + key: "getInstance", + value: function getInstance(el) { + var domElem = !!el.jquery ? el[0] : el; + return domElem.M_TapTarget; + } + }, { + key: "defaults", + get: function () { + return _defaults; + } + }]); + + return TapTarget; + }(Component); + + M.TapTarget = TapTarget; + + if (M.jQueryLoaded) { + M.initializeJqueryWrapper(TapTarget, 'tapTarget', 'M_TapTarget'); + } +})(cash); +;(function ($) { + 'use strict'; + + var _defaults = { + classes: '', + dropdownOptions: {} + }; + + /** + * @class + * + */ + + var FormSelect = function (_Component20) { + _inherits(FormSelect, _Component20); + + /** + * Construct FormSelect instance + * @constructor + * @param {Element} el + * @param {Object} options + */ + function FormSelect(el, options) { + _classCallCheck(this, FormSelect); + + // Don't init if browser default version + var _this68 = _possibleConstructorReturn(this, (FormSelect.__proto__ || Object.getPrototypeOf(FormSelect)).call(this, FormSelect, el, options)); + + if (_this68.$el.hasClass('browser-default')) { + return _possibleConstructorReturn(_this68); + } + + _this68.el.M_FormSelect = _this68; + + /** + * Options for the select + * @member FormSelect#options + */ + _this68.options = $.extend({}, FormSelect.defaults, options); + + _this68.isMultiple = _this68.$el.prop('multiple'); + + // Setup + _this68.el.tabIndex = -1; + _this68._keysSelected = {}; + _this68._valueDict = {}; // Maps key to original and generated option element. + _this68._setupDropdown(); + + _this68._setupEventHandlers(); + return _this68; + } + + _createClass(FormSelect, [{ + key: "destroy", + + + /** + * Teardown component + */ + value: function destroy() { + this._removeEventHandlers(); + this._removeDropdown(); + this.el.M_FormSelect = undefined; + } + + /** + * Setup Event Handlers + */ + + }, { + key: "_setupEventHandlers", + value: function _setupEventHandlers() { + var _this69 = this; + + this._handleSelectChangeBound = this._handleSelectChange.bind(this); + this._handleOptionClickBound = this._handleOptionClick.bind(this); + this._handleInputClickBound = this._handleInputClick.bind(this); + + $(this.dropdownOptions).find('li:not(.optgroup)').each(function (el) { + el.addEventListener('click', _this69._handleOptionClickBound); + }); + this.el.addEventListener('change', this._handleSelectChangeBound); + this.input.addEventListener('click', this._handleInputClickBound); + } + + /** + * Remove Event Handlers + */ + + }, { + key: "_removeEventHandlers", + value: function _removeEventHandlers() { + var _this70 = this; + + $(this.dropdownOptions).find('li:not(.optgroup)').each(function (el) { + el.removeEventListener('click', _this70._handleOptionClickBound); + }); + this.el.removeEventListener('change', this._handleSelectChangeBound); + this.input.removeEventListener('click', this._handleInputClickBound); + } + + /** + * Handle Select Change + * @param {Event} e + */ + + }, { + key: "_handleSelectChange", + value: function _handleSelectChange(e) { + this._setValueToInput(); + } + + /** + * Handle Option Click + * @param {Event} e + */ + + }, { + key: "_handleOptionClick", + value: function _handleOptionClick(e) { + e.preventDefault(); + var optionEl = $(e.target).closest('li')[0]; + this._selectOption(optionEl); + e.stopPropagation(); + } + }, { + key: "_selectOption", + value: function _selectOption(optionEl) { + var key = optionEl.id; + if (!$(optionEl).hasClass('disabled') && !$(optionEl).hasClass('optgroup') && key.length) { + var selected = true; + + if (this.isMultiple) { + // Deselect placeholder option if still selected. + var placeholderOption = $(this.dropdownOptions).find('li.disabled.selected'); + if (placeholderOption.length) { + placeholderOption.removeClass('selected'); + placeholderOption.find('input[type="checkbox"]').prop('checked', false); + this._toggleEntryFromArray(placeholderOption[0].id); + } + selected = this._toggleEntryFromArray(key); + } else { + $(this.dropdownOptions).find('li').removeClass('selected'); + $(optionEl).toggleClass('selected', selected); + this._keysSelected = {}; + this._keysSelected[optionEl.id] = true; + } + + // Set selected on original select option + // Only trigger if selected state changed + var prevSelected = $(this._valueDict[key].el).prop('selected'); + if (prevSelected !== selected) { + $(this._valueDict[key].el).prop('selected', selected); + this.$el.trigger('change'); + } + } + + if (!this.isMultiple) { + this.dropdown.close(); + } + } + + /** + * Handle Input Click + */ + + }, { + key: "_handleInputClick", + value: function _handleInputClick() { + if (this.dropdown && this.dropdown.isOpen) { + this._setValueToInput(); + this._setSelectedStates(); + } + } + + /** + * Setup dropdown + */ + + }, { + key: "_setupDropdown", + value: function _setupDropdown() { + var _this71 = this; + + this.wrapper = document.createElement('div'); + $(this.wrapper).addClass('select-wrapper ' + this.options.classes); + this.$el.before($(this.wrapper)); + // Move actual select element into overflow hidden wrapper + var $hideSelect = $('
      '); + $(this.wrapper).append($hideSelect); + $hideSelect[0].appendChild(this.el); + + if (this.el.disabled) { + this.wrapper.classList.add('disabled'); + } + + // Create dropdown + this.$selectOptions = this.$el.children('option, optgroup'); + this.dropdownOptions = document.createElement('ul'); + this.dropdownOptions.id = "select-options-" + M.guid(); + $(this.dropdownOptions).addClass('dropdown-content select-dropdown ' + (this.isMultiple ? 'multiple-select-dropdown' : '')); + + // Create dropdown structure. + if (this.$selectOptions.length) { + this.$selectOptions.each(function (el) { + if ($(el).is('option')) { + // Direct descendant option. + var optionEl = void 0; + if (_this71.isMultiple) { + optionEl = _this71._appendOptionWithIcon(_this71.$el, el, 'multiple'); + } else { + optionEl = _this71._appendOptionWithIcon(_this71.$el, el); + } + + _this71._addOptionToValueDict(el, optionEl); + } else if ($(el).is('optgroup')) { + // Optgroup. + var selectOptions = $(el).children('option'); + $(_this71.dropdownOptions).append($('
    • ' + el.getAttribute('label') + '
    • ')[0]); + + selectOptions.each(function (el) { + var optionEl = _this71._appendOptionWithIcon(_this71.$el, el, 'optgroup-option'); + _this71._addOptionToValueDict(el, optionEl); + }); + } + }); + } + + $(this.wrapper).append(this.dropdownOptions); + + // Add input dropdown + this.input = document.createElement('input'); + $(this.input).addClass('select-dropdown dropdown-trigger'); + this.input.setAttribute('type', 'text'); + this.input.setAttribute('readonly', 'true'); + this.input.setAttribute('data-target', this.dropdownOptions.id); + if (this.el.disabled) { + $(this.input).prop('disabled', 'true'); + } + + $(this.wrapper).prepend(this.input); + this._setValueToInput(); + + // Add caret + var dropdownIcon = $(''); + $(this.wrapper).prepend(dropdownIcon[0]); + + // Initialize dropdown + if (!this.el.disabled) { + var dropdownOptions = $.extend({}, this.options.dropdownOptions); + var userOnOpenEnd = dropdownOptions.onOpenEnd; + + // Add callback for centering selected option when dropdown content is scrollable + dropdownOptions.onOpenEnd = function (el) { + var selectedOption = $(_this71.dropdownOptions).find('.selected').first(); + + if (selectedOption.length) { + // Focus selected option in dropdown + M.keyDown = true; + _this71.dropdown.focusedIndex = selectedOption.index(); + _this71.dropdown._focusFocusedItem(); + M.keyDown = false; + + // Handle scrolling to selected option + if (_this71.dropdown.isScrollable) { + var scrollOffset = selectedOption[0].getBoundingClientRect().top - _this71.dropdownOptions.getBoundingClientRect().top; // scroll to selected option + scrollOffset -= _this71.dropdownOptions.clientHeight / 2; // center in dropdown + _this71.dropdownOptions.scrollTop = scrollOffset; + } + } + + // Handle user declared onOpenEnd if needed + if (userOnOpenEnd && typeof userOnOpenEnd === 'function') { + userOnOpenEnd.call(_this71.dropdown, _this71.el); + } + }; + + // Prevent dropdown from closing too early + dropdownOptions.closeOnClick = false; + + this.dropdown = M.Dropdown.init(this.input, dropdownOptions); + } + + // Add initial selections + this._setSelectedStates(); + } + + /** + * Add option to value dict + * @param {Element} el original option element + * @param {Element} optionEl generated option element + */ + + }, { + key: "_addOptionToValueDict", + value: function _addOptionToValueDict(el, optionEl) { + var index = Object.keys(this._valueDict).length; + var key = this.dropdownOptions.id + index; + var obj = {}; + optionEl.id = key; + + obj.el = el; + obj.optionEl = optionEl; + this._valueDict[key] = obj; + } + + /** + * Remove dropdown + */ + + }, { + key: "_removeDropdown", + value: function _removeDropdown() { + $(this.wrapper).find('.caret').remove(); + $(this.input).remove(); + $(this.dropdownOptions).remove(); + $(this.wrapper).before(this.$el); + $(this.wrapper).remove(); + } + + /** + * Setup dropdown + * @param {Element} select select element + * @param {Element} option option element from select + * @param {String} type + * @return {Element} option element added + */ + + }, { + key: "_appendOptionWithIcon", + value: function _appendOptionWithIcon(select, option, type) { + // Add disabled attr if disabled + var disabledClass = option.disabled ? 'disabled ' : ''; + var optgroupClass = type === 'optgroup-option' ? 'optgroup-option ' : ''; + var multipleCheckbox = this.isMultiple ? "" : option.innerHTML; + var liEl = $('
    • '); + var spanEl = $(''); + spanEl.html(multipleCheckbox); + liEl.addClass(disabledClass + " " + optgroupClass); + liEl.append(spanEl); + + // add icons + var iconUrl = option.getAttribute('data-icon'); + if (!!iconUrl) { + var imgEl = $("\"\""); + liEl.prepend(imgEl); + } + + // Check for multiple type. + $(this.dropdownOptions).append(liEl[0]); + return liEl[0]; + } + + /** + * Toggle entry from option + * @param {String} key Option key + * @return {Boolean} if entry was added or removed + */ + + }, { + key: "_toggleEntryFromArray", + value: function _toggleEntryFromArray(key) { + var notAdded = !this._keysSelected.hasOwnProperty(key); + var $optionLi = $(this._valueDict[key].optionEl); + + if (notAdded) { + this._keysSelected[key] = true; + } else { + delete this._keysSelected[key]; + } + + $optionLi.toggleClass('selected', notAdded); + + // Set checkbox checked value + $optionLi.find('input[type="checkbox"]').prop('checked', notAdded); + + // use notAdded instead of true (to detect if the option is selected or not) + $optionLi.prop('selected', notAdded); + + return notAdded; + } + + /** + * Set text value to input + */ + + }, { + key: "_setValueToInput", + value: function _setValueToInput() { + var values = []; + var options = this.$el.find('option'); + + options.each(function (el) { + if ($(el).prop('selected')) { + var text = $(el).text().trim(); + values.push(text); + } + }); + + if (!values.length) { + var firstDisabled = this.$el.find('option:disabled').eq(0); + if (firstDisabled.length && firstDisabled[0].value === '') { + values.push(firstDisabled.text()); + } + } + + this.input.value = values.join(', '); + } + + /** + * Set selected state of dropdown to match actual select element + */ + + }, { + key: "_setSelectedStates", + value: function _setSelectedStates() { + this._keysSelected = {}; + + for (var key in this._valueDict) { + var option = this._valueDict[key]; + var optionIsSelected = $(option.el).prop('selected'); + $(option.optionEl).find('input[type="checkbox"]').prop('checked', optionIsSelected); + if (optionIsSelected) { + this._activateOption($(this.dropdownOptions), $(option.optionEl)); + this._keysSelected[key] = true; + } else { + $(option.optionEl).removeClass('selected'); + } + } + } + + /** + * Make option as selected and scroll to selected position + * @param {jQuery} collection Select options jQuery element + * @param {Element} newOption element of the new option + */ + + }, { + key: "_activateOption", + value: function _activateOption(collection, newOption) { + if (newOption) { + if (!this.isMultiple) { + collection.find('li.selected').removeClass('selected'); + } + var option = $(newOption); + option.addClass('selected'); + } + } + + /** + * Get Selected Values + * @return {Array} Array of selected values + */ + + }, { + key: "getSelectedValues", + value: function getSelectedValues() { + var selectedValues = []; + for (var key in this._keysSelected) { + selectedValues.push(this._valueDict[key].el.value); + } + return selectedValues; + } + }], [{ + key: "init", + value: function init(els, options) { + return _get(FormSelect.__proto__ || Object.getPrototypeOf(FormSelect), "init", this).call(this, this, els, options); + } + + /** + * Get Instance + */ + + }, { + key: "getInstance", + value: function getInstance(el) { + var domElem = !!el.jquery ? el[0] : el; + return domElem.M_FormSelect; + } + }, { + key: "defaults", + get: function () { + return _defaults; + } + }]); + + return FormSelect; + }(Component); + + M.FormSelect = FormSelect; + + if (M.jQueryLoaded) { + M.initializeJqueryWrapper(FormSelect, 'formSelect', 'M_FormSelect'); + } +})(cash); +;(function ($, anim) { + 'use strict'; + + var _defaults = {}; + + /** + * @class + * + */ + + var Range = function (_Component21) { + _inherits(Range, _Component21); + + /** + * Construct Range instance + * @constructor + * @param {Element} el + * @param {Object} options + */ + function Range(el, options) { + _classCallCheck(this, Range); + + var _this72 = _possibleConstructorReturn(this, (Range.__proto__ || Object.getPrototypeOf(Range)).call(this, Range, el, options)); + + _this72.el.M_Range = _this72; + + /** + * Options for the range + * @member Range#options + */ + _this72.options = $.extend({}, Range.defaults, options); + + _this72._mousedown = false; + + // Setup + _this72._setupThumb(); + + _this72._setupEventHandlers(); + return _this72; + } + + _createClass(Range, [{ + key: "destroy", + + + /** + * Teardown component + */ + value: function destroy() { + this._removeEventHandlers(); + this._removeThumb(); + this.el.M_Range = undefined; + } + + /** + * Setup Event Handlers + */ + + }, { + key: "_setupEventHandlers", + value: function _setupEventHandlers() { + this._handleRangeChangeBound = this._handleRangeChange.bind(this); + this._handleRangeMousedownTouchstartBound = this._handleRangeMousedownTouchstart.bind(this); + this._handleRangeInputMousemoveTouchmoveBound = this._handleRangeInputMousemoveTouchmove.bind(this); + this._handleRangeMouseupTouchendBound = this._handleRangeMouseupTouchend.bind(this); + this._handleRangeBlurMouseoutTouchleaveBound = this._handleRangeBlurMouseoutTouchleave.bind(this); + + this.el.addEventListener('change', this._handleRangeChangeBound); + + this.el.addEventListener('mousedown', this._handleRangeMousedownTouchstartBound); + this.el.addEventListener('touchstart', this._handleRangeMousedownTouchstartBound); + + this.el.addEventListener('input', this._handleRangeInputMousemoveTouchmoveBound); + this.el.addEventListener('mousemove', this._handleRangeInputMousemoveTouchmoveBound); + this.el.addEventListener('touchmove', this._handleRangeInputMousemoveTouchmoveBound); + + this.el.addEventListener('mouseup', this._handleRangeMouseupTouchendBound); + this.el.addEventListener('touchend', this._handleRangeMouseupTouchendBound); + + this.el.addEventListener('blur', this._handleRangeBlurMouseoutTouchleaveBound); + this.el.addEventListener('mouseout', this._handleRangeBlurMouseoutTouchleaveBound); + this.el.addEventListener('touchleave', this._handleRangeBlurMouseoutTouchleaveBound); + } + + /** + * Remove Event Handlers + */ + + }, { + key: "_removeEventHandlers", + value: function _removeEventHandlers() { + this.el.removeEventListener('change', this._handleRangeChangeBound); + + this.el.removeEventListener('mousedown', this._handleRangeMousedownTouchstartBound); + this.el.removeEventListener('touchstart', this._handleRangeMousedownTouchstartBound); + + this.el.removeEventListener('input', this._handleRangeInputMousemoveTouchmoveBound); + this.el.removeEventListener('mousemove', this._handleRangeInputMousemoveTouchmoveBound); + this.el.removeEventListener('touchmove', this._handleRangeInputMousemoveTouchmoveBound); + + this.el.removeEventListener('mouseup', this._handleRangeMouseupTouchendBound); + this.el.removeEventListener('touchend', this._handleRangeMouseupTouchendBound); + + this.el.removeEventListener('blur', this._handleRangeBlurMouseoutTouchleaveBound); + this.el.removeEventListener('mouseout', this._handleRangeBlurMouseoutTouchleaveBound); + this.el.removeEventListener('touchleave', this._handleRangeBlurMouseoutTouchleaveBound); + } + + /** + * Handle Range Change + * @param {Event} e + */ + + }, { + key: "_handleRangeChange", + value: function _handleRangeChange() { + $(this.value).html(this.$el.val()); + + if (!$(this.thumb).hasClass('active')) { + this._showRangeBubble(); + } + + var offsetLeft = this._calcRangeOffset(); + $(this.thumb).addClass('active').css('left', offsetLeft + 'px'); + } + + /** + * Handle Range Mousedown and Touchstart + * @param {Event} e + */ + + }, { + key: "_handleRangeMousedownTouchstart", + value: function _handleRangeMousedownTouchstart(e) { + // Set indicator value + $(this.value).html(this.$el.val()); + + this._mousedown = true; + this.$el.addClass('active'); + + if (!$(this.thumb).hasClass('active')) { + this._showRangeBubble(); + } + + if (e.type !== 'input') { + var offsetLeft = this._calcRangeOffset(); + $(this.thumb).addClass('active').css('left', offsetLeft + 'px'); + } + } + + /** + * Handle Range Input, Mousemove and Touchmove + */ + + }, { + key: "_handleRangeInputMousemoveTouchmove", + value: function _handleRangeInputMousemoveTouchmove() { + if (this._mousedown) { + if (!$(this.thumb).hasClass('active')) { + this._showRangeBubble(); + } + + var offsetLeft = this._calcRangeOffset(); + $(this.thumb).addClass('active').css('left', offsetLeft + 'px'); + $(this.value).html(this.$el.val()); + } + } + + /** + * Handle Range Mouseup and Touchend + */ + + }, { + key: "_handleRangeMouseupTouchend", + value: function _handleRangeMouseupTouchend() { + this._mousedown = false; + this.$el.removeClass('active'); + } + + /** + * Handle Range Blur, Mouseout and Touchleave + */ + + }, { + key: "_handleRangeBlurMouseoutTouchleave", + value: function _handleRangeBlurMouseoutTouchleave() { + if (!this._mousedown) { + var paddingLeft = parseInt(this.$el.css('padding-left')); + var marginLeft = 7 + paddingLeft + 'px'; + + if ($(this.thumb).hasClass('active')) { + anim.remove(this.thumb); + anim({ + targets: this.thumb, + height: 0, + width: 0, + top: 10, + easing: 'easeOutQuad', + marginLeft: marginLeft, + duration: 100 + }); + } + $(this.thumb).removeClass('active'); + } + } + + /** + * Setup dropdown + */ + + }, { + key: "_setupThumb", + value: function _setupThumb() { + this.thumb = document.createElement('span'); + this.value = document.createElement('span'); + $(this.thumb).addClass('thumb'); + $(this.value).addClass('value'); + $(this.thumb).append(this.value); + this.$el.after(this.thumb); + } + + /** + * Remove dropdown + */ + + }, { + key: "_removeThumb", + value: function _removeThumb() { + $(this.thumb).remove(); + } + + /** + * morph thumb into bubble + */ + + }, { + key: "_showRangeBubble", + value: function _showRangeBubble() { + var paddingLeft = parseInt($(this.thumb).parent().css('padding-left')); + var marginLeft = -7 + paddingLeft + 'px'; // TODO: fix magic number? + anim.remove(this.thumb); + anim({ + targets: this.thumb, + height: 30, + width: 30, + top: -30, + marginLeft: marginLeft, + duration: 300, + easing: 'easeOutQuint' + }); + } + + /** + * Calculate the offset of the thumb + * @return {Number} offset in pixels + */ + + }, { + key: "_calcRangeOffset", + value: function _calcRangeOffset() { + var width = this.$el.width() - 15; + var max = parseFloat(this.$el.attr('max')) || 100; // Range default max + var min = parseFloat(this.$el.attr('min')) || 0; // Range default min + var percent = (parseFloat(this.$el.val()) - min) / (max - min); + return percent * width; + } + }], [{ + key: "init", + value: function init(els, options) { + return _get(Range.__proto__ || Object.getPrototypeOf(Range), "init", this).call(this, this, els, options); + } + + /** + * Get Instance + */ + + }, { + key: "getInstance", + value: function getInstance(el) { + var domElem = !!el.jquery ? el[0] : el; + return domElem.M_Range; + } + }, { + key: "defaults", + get: function () { + return _defaults; + } + }]); + + return Range; + }(Component); + + M.Range = Range; + + if (M.jQueryLoaded) { + M.initializeJqueryWrapper(Range, 'range', 'M_Range'); + } + + Range.init($('input[type=range]')); +})(cash, M.anime); + +//# sourceMappingURL=materialize_concat.js.map +//# sourceMappingURL=materialize.js.map diff --git a/src/src.ejs b/src/src.ejs index f2a17a4a..07518e52 100644 --- a/src/src.ejs +++ b/src/src.ejs @@ -1,214 +1,214 @@ - - - - - - - - Cloverleaf - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      - - - - -
      -
      - -
      - - -
      - -
      -
      - -
      - - -
      - -
      - -
      - -
      - - -
      - - <%= hint %> - - - -
      - -
      - - - - - -
      -
      - - - - - - - - - - - - - - \ No newline at end of file + + + + + + + + Cloverleaf + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      +
      + +
      + + +
      + +
      +
      + +
      + + +
      + +
      + +
      + +
      + + +
      + + <%= hint %> + + + +
      + +
      + + + + + +
      +
      + + + + + + + + + + + + + + diff --git a/src/style.scss b/src/style.scss index f2303c7c..ca9da3ca 100644 --- a/src/style.scss +++ b/src/style.scss @@ -1,915 +1,915 @@ -@charset "UTF-8"; - -// Import only what you need from Materialize - -@import "node_modules/@materializecss/materialize/sass/components/normalize"; - -// Color -@import "node_modules/@materializecss/materialize/sass/components/color-variables"; - -$accentColor: #3f51b5; -$lightAccent: lighten($accentColor, 15%); -$textColor: #535353; -$backgroundColor: #fff; -$internalColor: #fff; -$incorrectColor: #f44336; -$correctColor: #8fff66; -$inputColor: #000; -$linkColor: #00539b; -$highlightColor: #eee; - -$secondary-color: $accentColor; - -$select-background: $internalColor; -$switch-checked-lever-bg: $lightAccent; -$sidenav-bg-color: $backgroundColor; -$button-raised-background: $accentColor; -$tabs-underline-color: $accentColor; -$tabs-text-color: $inputColor; -$tabs-bg-color: $internalColor; -$input-border-color: $textColor; -$link-color: $linkColor; - -// Variables; -@import "node_modules/@materializecss/materialize/sass/components/variables"; - -$toast-action-color: $link-color; -$toast-action-color: var(--linkColor); -$toast-color: $internalColor; -$toast-color: var(--internalColor); -$toast-text-color: $textColor; -$toast-text-color: var(--textColor); - -// Components -@import "node_modules/@materializecss/materialize/sass/components/global"; -@import "node_modules/@materializecss/materialize/sass/components/grid"; -@import "node_modules/@materializecss/materialize/sass/components/typography"; -@import "node_modules/@materializecss/materialize/sass/components/toast"; -@import "node_modules/@materializecss/materialize/sass/components/tabs"; -@import "node_modules/@materializecss/materialize/sass/components/tooltip"; -@import "node_modules/@materializecss/materialize/sass/components/buttons"; -@import "node_modules/@materializecss/materialize/sass/components/dropdown"; -@import "node_modules/@materializecss/materialize/sass/components/waves"; -@import "node_modules/@materializecss/materialize/sass/components/sidenav"; -// Form parts -@import "node_modules/@materializecss/materialize/sass/components/forms/switches.scss"; -@import "node_modules/@materializecss/materialize/sass/components/forms/select.scss"; -@import "node_modules/@materializecss/materialize/sass/components/forms/input-fields.scss"; - - - -/* Material Icons */ -@font-face { - font-family: 'Material Icons'; - font-style: normal; - font-weight: 400; - /* For IE6-8 */ - src: url(material-design-icons-iconfont/dist/fonts/MaterialIcons-Regular.eot); - src: local('Material Icons'), - local('MaterialIcons-Regular'), - url(material-design-icons-iconfont/dist/fonts/MaterialIcons-Regular.woff2) format('woff2'), - url(material-design-icons-iconfont/dist/fonts/MaterialIcons-Regular.woff) format('woff'), - url(material-design-icons-iconfont/dist/fonts/MaterialIcons-Regular.ttf) format('truetype'); - font-display: swap; -} - -.material-icons { - font-family: 'Material Icons'; - font-weight: normal; - font-style: normal; - /* Preferred icon size */ - font-size: 24px; - display: inline-block; - line-height: 1; - text-transform: none; - letter-spacing: normal; - word-wrap: normal; - white-space: nowrap; - direction: ltr; - /* Support for all WebKit browsers. */ - -webkit-font-smoothing: antialiased; - /* Support for Safari and Chrome. */ - text-rendering: optimizeLegibility; - -moz-osx-font-smoothing: grayscale; - /* Support for IE. */ - font-feature-settings: 'liga'; - user-select: none; - font-display: block; -} - -@font-face { - font-family: 'Roboto Mono'; - font-style: normal; - font-weight: 400; - src: local('Roboto Mono'), local('RobotoMono-Regular'), url(../fonts/RobotoMono-Regular.ttf) format('truetype'); - font-display: swap; -} - -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 300; - src: local('Roboto Light'), local('Roboto-Light'), url(../fonts/Roboto-Light.ttf) format('truetype'); - font-display: swap; -} - -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 400; - src: local('Roboto'), local('Roboto-Regular'), url(../fonts/Roboto-Regular.ttf) format('truetype'); - font-display: swap; -} - -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 500; - src: local('Roboto Medium'), local('Roboto-Medium'), url(../fonts/Roboto-Medium.ttf) format('truetype'); - font-display: swap; -} - -:root { - --accentColor: #{$accentColor}; - --lightAccent: #{$lightAccent}; - --textColor: #{$textColor}; - --backgroundColor: #{$backgroundColor}; - --internalColor: #{$internalColor}; - --incorrectColor: #{$incorrectColor}; - --correctColor: #{$correctColor}; - --inputColor: #{$inputColor}; - --linkColor: #{$linkColor}; - --highlightColor: #{$highlightColor}; -} - -html, -body { - height: 100% !important; - color: $inputColor; - color: var(--inputColor); - caret-color: $accentColor; - caret-color: var(--accentColor); - text-align: center; - overflow-x: hidden; -} - -* { - transition: background-color .3s ease, color .3s ease; -} - -body { - font-family: 'Roboto', sans-serif; - font-weight: 300; - margin: 0; - display: flex; - justify-content: center; - align-items: center; - background-color: $backgroundColor; - background-color: var(--backgroundColor); -} - -#box { - text-align: center; - max-width: calc(100% - (30px + 10em)); - max-height: 100%; - margin: auto; /* This helps with compatibility */ - grid-row: 1; -} - -label, -.input-field>label { - color: $textColor; - color: var(--textColor); - font-size: 1.5rem; - transition: transform .3s ease-out, -webkit-transform .3s ease-out, background-color .3s ease, color .3s ease; -} - -.input-field { - margin-bottom: 0; -} - -.input-field input[type=text], -.input-field input[type=number], -.input-field input[type=password] { - border-bottom: 1px solid $textColor; - border-bottom: 1px solid var(--textColor); - transition: border .3s ease-out, background-color .3s ease, color .3s ease; -} - -/* label underline focus color */ -.input-field input[type=text]:focus, -.input-field input[type=number]:focus, -.input-field input[type=password]:focus { - border-bottom: 1px solid $accentColor !important; - border-bottom: 1px solid var(--accentColor) !important; - box-shadow: 0 1px 0 0 $accentColor !important; - box-shadow: 0 1px 0 0 var(--accentColor) !important; -} - -input[type=text]:not(#result):not(.select-dropdown), -input[type=number]:not(#length-pref), -input[type=password]:not(#result) { - font-size: 3rem !important; - height: 1.2em !important; - box-sizing: content-box; - font-family: 'Roboto', sans-serif; - font-weight: 300; -} - -input[type=number] { - margin-bottom: 0; - overflow: scroll -} - -#back { - box-shadow: 0 0.26em 0.65em 0 rgba(0, 0, 0, 0.2); - background-color: $internalColor; - background-color: var(--internalColor); - border-radius: 0.325em; - padding: 0.975em; - padding-top: 1.5em; - margin: 2em 0; - max-height: 100%; -} - -#result { - font-family: 'Roboto Mono', monospace; - font-size: 2rem; - padding: 0.9rem 0; - min-height: 1em; - min-width: 20%; - border: none; - text-align: center; - margin: 0; - width: 100%; - color: $inputColor; - color: var(--inputColor); -} - -// Colour fix -#result::placeholder { - color: $inputColor !important; - color: var(--inputColor) !important; - opacity: 1; -} - -#copy { - display: block; - margin: auto; -} - -.hint { - float: left; - color: $textColor; - color: var(--textColor); - width: 100%; - text-align: left; -} - -input, -textarea { - font-size: 1.56rem; - padding: 0.65rem; - color: $inputColor !important; - color: var(--inputColor) !important; - margin: 0 0 0.8rem 0 !important; -} - -input#length { - margin: 0 !important; - height: 1em; /* To stop the input wiggling on firefox */ -} - -#faq { - float: right; - cursor: help; - font-weight: 500; - margin-top: 0.4em; -} - -.cf:before, -.cf:after { - content: " "; - display: table; -} - -.cf:after { - clear: both; -} - -ul.autocomplete-content.dropdown-content { - background: $backgroundColor; - background: var(--backgroundColor); - position: absolute !important; - width: calc(100% - 3rem); - max-height: calc(82% * 4); /* 82% seems to work out as one row */ - overflow-y: auto; - overflow-x: hidden; - top: -.1em; - margin-top: 0; -} - -ul.autocomplete-content.dropdown-content li { - height: 3em; - min-height: 0; -} - -/* Presets */ -.dropdown-content li:hover, -.dropdown-content li.active, -.dropdown-content li.selected, -/* Theme selection */ -body.keyboard-focused .select-dropdown.dropdown-content li:focus, -.select-dropdown.dropdown-content li.selected { - background: $highlightColor; - background: var(--highlightColor); -} - -ul.autocomplete-content.dropdown-content li img.right.circle { - overflow: hidden; - background: #fff; - width: calc(20% - 0.66em); - height: 100%; - padding: 0.33em; - margin: 0; -} - -ul.autocomplete-content.dropdown-content span { - /* display: inline-flex; */ - align-items: center; - white-space: nowrap; - max-width: 70%; - height: 100%; - /* vertical-align: middle; */ - font-size: 1em; - padding: 0.875em 1em; - overflow: hidden; - /* To allow scaling */ - line-height: 1.57em; -} - -ul.autocomplete-content.dropdown-content span:not(.highlight) { - color: $textColor; - color: var(--textColor); - overflow-x: hidden; -} - -ul.autocomplete-content.dropdown-content span .highlight { - max-width: 100%; - color: $textColor; - color: var(--textColor); - font-weight: 400; - overflow: visible; - padding: 0; -} - -.dropdown-content::-webkit-scrollbar { - width: 17px !important; - background-color: #fff !important; -} - -.dropdown-content::-webkit-scrollbar-track { - width: 17px; - background-color: #fff !important; -} - -.dropdown-content::-webkit-scrollbar-thumb { - border-radius: 100px; - width: 17px; - background-color: rgba(0, 0, 0, 0.5); -} - -/*If I keep the rounded element, the twitter bird's beak gets cut :-;*/ -.circle { - object-fit: scale-down; - border-radius: 0; -} - -#back .switch { - padding-bottom: 1.3rem; -} - -input[type=checkbox]:checked:not(:disabled)~.lever:active::before, -input[type=checkbox]:checked:not(:disabled).tabbed:focus~.lever::before { - transform: scale(2.4); - background-color: rgba($accentColor, 0.3); - background-color: rgba(var(--accentRGBs), 0.3); -} - -/*Switch knob*/ -.switch label input[type=checkbox]:checked+.lever:after { - background-color: $accentColor; - background-color: var(--accentColor); -} - -/*Switch backing*/ -.switch label input[type=checkbox]:checked+.lever { - background-color: $lightAccent; - background-color: var(--lightAccent); -} - -#passTogglelever { - left: -4px; /* Centering the toggle */ -} - -.icon { - font-size: 1.4em !important; - color: $textColor; - color: var(--textColor); - transition: color .2s; - cursor: pointer; -} - -.icon:hover { - color: $lightAccent; - color: var(--lightAccent); -} - -.icon:active { - color: $accentColor; - color: var(--accentColor); -} - -.input-field label:not(.label-icon).active { - -webkit-transform: translateY(-1em) scale(0.8); - transform: translateY(-1em) scale(0.8); - -webkit-transform-origin: 0 0; - transform-origin: 0 0; -} - -.toast { - font-weight: 400 -} - -/* Negative toasts get this */ -.toast.warning { - color: $inputColor; - color: var(--inputColor); - background-color: $incorrectColor; - background-color: var(--incorrectColor); -} - -/* Positive toasts get this */ -.toast.success { - background-color: $correctColor; - background-color: var(--correctColor); - color: #000; -} - -#jsBanner { - position: absolute; - width: 100%; - height: 100%; - text-align: center; - background-color: rgba(0, 0, 0, 0.5); - display: flex; - align-items: center; - justify-content: center; - font-weight: 500; - font-size: 10vmin; - top: 0; - left: 0; - color: $backgroundColor; - color: var(--backgroundColor); - -webkit-text-stroke-width: 0.05em !important; - -webkit-text-stroke-color: $textColor !important; - -webkit-text-stroke-color: var(--textColor) !important; - padding: 10px; -} - -#jsBanner a { - color: $backgroundColor; - color: var(--backgroundColor); - -webkit-text-stroke: 3px $textColor; - -webkit-text-stroke: 3px var(--textColor); - text-decoration: underline; -} - -#logo { - max-width: 100%; - max-height: 100%; -} - -#app { - margin-bottom: 0.55em !important; - width: calc(100% - 3.6rem) !important; - padding-right: 1.2em !important; - align-self: flex-end; - display: block; - white-space: nowrap; -} - -ul:empty { - display: none; -} - -/* Disable Edge's show/hide since we made one */ -::-ms-reveal { - display: none; -} - -/* For portrait logos so they don't oversize */ -#logoContainer { - margin-right: 5px; - background: #fff; - padding: 3px; - border-radius: 5px; - height: calc(3rem + 0.1em); - display: none; - justify-content: center; - align-items: center; - top: 0; -} - -input[type="radio"] { - margin: 0; - width: 0; - height: 0; - padding: 0; -} - -input[type="radio"]:checked+label::before { - box-shadow: 0 0 3px 1px $textColor; - box-shadow: 0 0 3px 1px var(--textColor); -} - -label:focus { - outline: none; -} - -.github-corner { - fill: $accentColor; - fill: var(--accentColor); - color: $backgroundColor; - color: var(--backgroundColor); - position: absolute; - top: 0; - border: 0; - right: 0; -} - -.github-corner:hover .octo-arm { - animation: octocat-wave 560ms ease-in-out; -} - -@keyframes octocat-wave { - - 0%, - 100% { - transform: rotate(0); - } - - 20%, - 60% { - transform: rotate(-25deg); - } - - 40%, - 80% { - transform: rotate(10deg); - } -} -.tabs { - background-color: $internalColor; - background-color: var(--internalColor); - cursor: pointer; - overflow-x: hidden; - z-index: 995; -} - -.tabs .tab a, -.tabs .tab a:hover { - color: $textColor; - color: var(--textColor); - font-size: 1em; - padding: 0 .5em; -} - -.tabs .tab a:focus, -.tabs .tab a:focus.active { - background-color: $backgroundColor; - background-color: var(--backgroundColor); -} - -.tabs .tab a.active { - color: $inputColor; - color: var(--inputColor); - font-weight: 400; -} - -.tabs .indicator { - background: $accentColor; - background-color: var(--accentColor) -} - -.btn { - height: 2.4em; - line-height: 2.4em; - font-family: 'Roboto', sans-serif; - font-weight: 300; - font-size: 1rem; - padding: 0 2rem; - background: $accentColor; - background: var(--accentColor); -} - -.btn:focus, -.btn:hover { - background: $accentColor; - background: var(--accentColor); -} - -.switch label .lever { - height: 0.933em; - width: 2.4em; -} - -.switch label .lever::before, -.switch label .lever::after { - height: 1.33em; - width: 1.33em; -} - -.switch label input[type="checkbox"]:checked+.lever::before, -.switch label input[type="checkbox"]:checked+.lever::after { - left: 1.4em; -} - -.switch label .lever::before, -.switch label .lever::after { - top: -0.2em; -} - -.material-tooltip { - max-width: 7em; -} - -/* If the device can't hover, don't show tooltips */ -@media (hover: none) { - .material-tooltip { - display: none; - } -} - -.material-tooltip { - background-color: $internalColor; - background-color: var(--internalColor); - box-shadow: 0 0.26em 0.65em 0 rgba(0, 0, 0, 0.2); - color: $textColor; - color: var(--textColor); -} - -/* In the future focus-visable should be used. See https://caniuse.com/?#search=css-focus-visible */ -.btn:focus, -.btn-large:focus, -.btn-small:focus, -.btn-floating:focus, -.btn-large:focus, -.btn-small:focus, -.btn-flat:focus { - outline: rgb(77, 144, 254) auto 5px; - outline-color: rgb(77, 144, 254); - outline-style: auto; - outline-width: 5px; -} - -/* Always show arrows on the number inputs */ -input[type=number]::-webkit-inner-spin-button, -input[type=number]::-webkit-outer-spin-button { - opacity: 1; -} - -ul.tabs li.tab a i.material-icons { - vertical-align: middle; - color: $incorrectColor; - color: var(--incorrectColor); -} - -/* Normal size */ -.btn-floating { - width: 2.86rem; - height: 2.86rem; -} - -.btn-floating i { - font-size: 1.6rem; - line-height: 2.86rem; - display: block; - top: 0; -} - -/* Large size */ -.btn-floating.btn-large { - width: 4rem; - height: 4rem; -} - -.btn-floating.btn-large i { - font-size: 2rem; - line-height: 4rem; -} - -/* If we're on a small/mobile device */ -@media only all and (max-width:40em) { - - body { - background-color: var(--internalColor); - } - - #back { - /* Ditch loads of padding */ - margin: 0; - box-shadow: none; - - min-height: 100%; - border-radius: 0; - } - - #box { - width: 100VW; - max-width: 100VW; - min-height: 100%; - } - - /* Install icon */ - #install-icon { - padding-right: .5vw; - } - - /* Normal size */ - .btn-floating { - width: 10vw; - height: 10vw; - } - - .btn-floating i { - font-size: 5vw; - line-height: 10vw; - } - - /* Large size */ - .btn-floating.btn-large { - width: 15vw; - height: 15vw; - } - - .btn-floating.btn-large i { - font-size: 7.5vw; - line-height: 15vw; - } - - .github-corner { - color: $internalColor; - color: var(--internalColor); - } -} - -/* If it won't fit vertically */ -@media only all and (max-height:600px ) and (min-width:40em) { - html { - /* Drop the font size */ - font-size: 2vh; - } -} - -.sidenav { - background-color: $backgroundColor; - background-color: var(--backgroundColor); - width: 350px; - max-width: 100%; - overflow-y: hidden; - padding-bottom: 0; -} - -.sidenav li>a { - font-weight: 300; -} - -/* Shows warning icons properly */ -.sidenav li>a>i, -.sidenav li>a>[class^="mdi-"], -.sidenav li>a li>a>[class*="mdi-"], -.sidenav li>a>i.material-icons { - margin: 0; - float: none; -} - -#settings { - position: absolute; - left: 1vw; - bottom: 1vw; - display: block; -} - -#settings a i.material-icons { - display: block; - font-size: 2.5em; - color: $textColor; - color: var(--textColor); -} - -.sidenav label:not([for=length-pref]) { - font-size: 1rem; - top: -33px; -} - -#options { - padding: 10px; - // padding-top: 0; - display: grid; - height: calc(100% - 8px); - grid-template-rows: repeat(12, 1fr); - // grid-template-rows: repeat(auto-fill, minmax(70px, 1fr)) - // grid-auto-rows: repeat(min-content, 60px) ; -} - -.sidenav .dropdown-content { - background: $backgroundColor; - background: var(--backgroundColor); -} - -.sidenav .dropdown-content li>a, -.dropdown-content li>span { - color: $inputColor; - color: var(--inputColor); -} - -select { - background-color: $internalColor; - background-color: var(--internalColor); - - border: 1px solid $textColor; - border: 1px solid var(--textColor); - border-radius: 3px; - - color: $inputColor; - color: var(--inputColor); -} - -select:focus { - border: 1px solid $lightAccent; - border: 1px solid var(--lightAccent); - outline: none; -} - -#options div.input-field { - margin-top: 2.5rem; -} - -#options a { - margin-top: 1rem; -} - -.btn i { - vertical-align: top; -} - -.drag-target { - left: 0; -} - -.sidenav .switch label { - font-size: 1.2em; -} - -.sidenav { - place-content: center; -} - -#theme-container { - grid-row: 1; -} - -#session-container { - grid-row: 3; - padding-bottom: 0; -} - -#footer { - grid-row: last-line; -} - -#install-container { - display: grid; - grid-template-columns: 1fr calc(2.4em + 10px); - align-content: stretch; -} - -#close { - cursor: pointer; - align-self: end; - justify-self: flex-end; - font-size: 2.4em; - color: $inputColor; - color: var(--inputColor); -} - -a { - color: $linkColor; - color: var(--linkColor); -} - -#length-pref { - font-size: 2em; - font-weight: 300; -} \ No newline at end of file +@charset "UTF-8"; + +// Import only what you need from Materialize + +@import "node_modules/@materializecss/materialize/sass/components/normalize"; + +// Color +@import "node_modules/@materializecss/materialize/sass/components/color-variables"; + +$accent-color: #3f51b5; +$light-accent: lighten($accent-color, 15%); +$text-color: #535353; +$background-color: #fff; +$internal-color: #fff; +$incorrect-color: #f44336; +$correct-color: #8fff66; +$input-color: #000; +$link-color: #00539b; +$highlight-color: #eee; + +$secondary-color: $accent-color; + +$select-background: $internal-color; +$switch-checked-lever-bg: $light-accent; +$sidenav-bg-color: $background-color; +$button-raised-background: $accent-color; +$tabs-underline-color: $accent-color; +$tabs-text-color: $input-color; +$tabs-bg-color: $internal-color; +$input-border-color: $text-color; +$link-color: $link-color; + +// Variables; +@import "node_modules/@materializecss/materialize/sass/components/variables"; + +$toast-action-color: $link-color; +$toast-action-color: var(--link-color); +$toast-color: $internal-color; +$toast-color: var(--internal-color); +$toast-text-color: $text-color; +$toast-text-color: var(--text-color); + +// Components +@import "node_modules/@materializecss/materialize/sass/components/global"; +@import "node_modules/@materializecss/materialize/sass/components/grid"; +@import "node_modules/@materializecss/materialize/sass/components/typography"; +@import "node_modules/@materializecss/materialize/sass/components/toast"; +@import "node_modules/@materializecss/materialize/sass/components/tabs"; +@import "node_modules/@materializecss/materialize/sass/components/tooltip"; +@import "node_modules/@materializecss/materialize/sass/components/buttons"; +@import "node_modules/@materializecss/materialize/sass/components/dropdown"; +@import "node_modules/@materializecss/materialize/sass/components/waves"; +@import "node_modules/@materializecss/materialize/sass/components/sidenav"; +// Form parts +@import "node_modules/@materializecss/materialize/sass/components/forms/switches.scss"; +@import "node_modules/@materializecss/materialize/sass/components/forms/select.scss"; +@import "node_modules/@materializecss/materialize/sass/components/forms/input-fields.scss"; + + + +/* Material Icons */ +@font-face { + font-family: 'Material Icons'; + font-style: normal; + font-weight: 400; + /* For IE6-8 */ + src: url(material-design-icons-iconfont/dist/fonts/MaterialIcons-Regular.eot); + src: local('Material Icons'), + local('MaterialIcons-Regular'), + url(material-design-icons-iconfont/dist/fonts/MaterialIcons-Regular.woff2) format('woff2'), + url(material-design-icons-iconfont/dist/fonts/MaterialIcons-Regular.woff) format('woff'), + url(material-design-icons-iconfont/dist/fonts/MaterialIcons-Regular.ttf) format('truetype'); + font-display: swap; +} + +.material-icons { + font-family: 'Material Icons'; + font-weight: normal; + font-style: normal; + /* Preferred icon size */ + font-size: 24px; + display: inline-block; + line-height: 1; + text-transform: none; + letter-spacing: normal; + word-wrap: normal; + white-space: nowrap; + direction: ltr; + /* Support for all WebKit browsers. */ + -webkit-font-smoothing: antialiased; + /* Support for Safari and Chrome. */ + text-rendering: optimizeLegibility; + -moz-osx-font-smoothing: grayscale; + /* Support for IE. */ + font-feature-settings: 'liga'; + user-select: none; + font-display: block; +} + +@font-face { + font-family: 'Roboto Mono'; + font-style: normal; + font-weight: 400; + src: local('Roboto Mono'), local('RobotoMono-Regular'), url(../fonts/RobotoMono-Regular.ttf) format('truetype'); + font-display: swap; +} + +@font-face { + font-family: 'Roboto'; + font-style: normal; + font-weight: 300; + src: local('Roboto Light'), local('Roboto-Light'), url(../fonts/Roboto-Light.ttf) format('truetype'); + font-display: swap; +} + +@font-face { + font-family: 'Roboto'; + font-style: normal; + font-weight: 400; + src: local('Roboto'), local('Roboto-Regular'), url(../fonts/Roboto-Regular.ttf) format('truetype'); + font-display: swap; +} + +@font-face { + font-family: 'Roboto'; + font-style: normal; + font-weight: 500; + src: local('Roboto Medium'), local('Roboto-Medium'), url(../fonts/Roboto-Medium.ttf) format('truetype'); + font-display: swap; +} + +:root { + --accent-color: #{$accent-color}; + --light-accent: #{$light-accent}; + --text-color: #{$text-color}; + --background-color: #{$background-color}; + --internal-color: #{$internal-color}; + --incorrect-color: #{$incorrect-color}; + --correct-color: #{$correct-color}; + --input-color: #{$input-color}; + --link-color: #{$link-color}; + --highlight-color: #{$highlight-color}; +} + +html, +body { + height: 100% !important; + color: $input-color; + color: var(--input-color); + caret-color: $accent-color; + caret-color: var(--accent-color); + text-align: center; + overflow-x: hidden; +} + +* { + transition: background-color .3s ease, color .3s ease; +} + +body { + font-family: 'Roboto', sans-serif; + font-weight: 300; + margin: 0; + display: flex; + justify-content: center; + align-items: center; + background-color: $background-color; + background-color: var(--background-color); +} + +#box { + text-align: center; + max-width: calc(100% - (30px + 10em)); + max-height: 100%; + margin: auto; /* This helps with compatibility */ + grid-row: 1; +} + +label, +.input-field>label { + color: $text-color; + color: var(--text-color); + font-size: 1.5rem; + transition: transform .3s ease-out, -webkit-transform .3s ease-out, background-color .3s ease, color .3s ease; +} + +.input-field { + margin-bottom: 0; +} + +.input-field input[type=text], +.input-field input[type=number], +.input-field input[type=password] { + border-bottom: 1px solid $text-color; + border-bottom: 1px solid var(--text-color); + transition: border .3s ease-out, background-color .3s ease, color .3s ease; +} + +/* label underline focus color */ +.input-field input[type=text]:focus, +.input-field input[type=number]:focus, +.input-field input[type=password]:focus { + border-bottom: 1px solid $accent-color !important; + border-bottom: 1px solid var(--accent-color) !important; + box-shadow: 0 1px 0 0 $accent-color !important; + box-shadow: 0 1px 0 0 var(--accent-color) !important; +} + +input[type=text]:not(#result):not(.select-dropdown), +input[type=number]:not(#length-pref), +input[type=password]:not(#result) { + font-size: 3rem !important; + height: 1.2em !important; + box-sizing: content-box; + font-family: 'Roboto', sans-serif; + font-weight: 300; +} + +input[type=number] { + margin-bottom: 0; + overflow: scroll +} + +#back { + box-shadow: 0 0.26em 0.65em 0 rgba(0, 0, 0, 0.2); + background-color: $internal-color; + background-color: var(--internal-color); + border-radius: 0.325em; + padding: 0.975em; + padding-top: 1.5em; + margin: 2em 0; + max-height: 100%; +} + +#result { + font-family: 'Roboto Mono', monospace; + font-size: 2rem; + padding: 0.9rem 0; + min-height: 1em; + min-width: 20%; + border: none; + text-align: center; + margin: 0; + width: 100%; + color: $input-color; + color: var(--input-color); +} + +// Colour fix +#result::placeholder { + color: $input-color !important; + color: var(--input-color) !important; + opacity: 1; +} + +#copy { + display: block; + margin: auto; +} + +.hint { + float: left; + color: $text-color; + color: var(--text-color); + width: 100%; + text-align: left; +} + +input, +textarea { + font-size: 1.56rem; + padding: 0.65rem; + color: $input-color !important; + color: var(--input-color) !important; + margin: 0 0 0.8rem 0 !important; +} + +input#length { + margin: 0 !important; + height: 1em; /* To stop the input wiggling on firefox */ +} + +#faq { + float: right; + cursor: help; + font-weight: 500; + margin-top: 0.4em; +} + +.cf:before, +.cf:after { + content: " "; + display: table; +} + +.cf:after { + clear: both; +} + +ul.autocomplete-content.dropdown-content { + background: $background-color; + background: var(--background-color); + position: absolute !important; + width: calc(100% - 3rem); + max-height: calc(82% * 4); /* 82% seems to work out as one row */ + overflow-y: auto; + overflow-x: hidden; + top: -.1em; + margin-top: 0; +} + +ul.autocomplete-content.dropdown-content li { + height: 3em; + min-height: 0; +} + +/* Presets */ +.dropdown-content li:hover, +.dropdown-content li.active, +.dropdown-content li.selected, +/* Theme selection */ +body.keyboard-focused .select-dropdown.dropdown-content li:focus, +.select-dropdown.dropdown-content li.selected { + background: $highlight-color; + background: var(--highlight-color); +} + +ul.autocomplete-content.dropdown-content li img.right.circle { + overflow: hidden; + background: #fff; + width: calc(20% - 0.66em); + height: 100%; + padding: 0.33em; + margin: 0; +} + +ul.autocomplete-content.dropdown-content span { + /* display: inline-flex; */ + align-items: center; + white-space: nowrap; + max-width: 70%; + height: 100%; + /* vertical-align: middle; */ + font-size: 1em; + padding: 0.875em 1em; + overflow: hidden; + /* To allow scaling */ + line-height: 1.57em; +} + +ul.autocomplete-content.dropdown-content span:not(.highlight) { + color: $text-color; + color: var(--text-color); + overflow-x: hidden; +} + +ul.autocomplete-content.dropdown-content span .highlight { + max-width: 100%; + color: $text-color; + color: var(--text-color); + font-weight: 400; + overflow: visible; + padding: 0; +} + +.dropdown-content::-webkit-scrollbar { + width: 17px !important; + background-color: #fff !important; +} + +.dropdown-content::-webkit-scrollbar-track { + width: 17px; + background-color: #fff !important; +} + +.dropdown-content::-webkit-scrollbar-thumb { + border-radius: 100px; + width: 17px; + background-color: rgba(0, 0, 0, 0.5); +} + +/*If I keep the rounded element, the twitter bird's beak gets cut :-;*/ +.circle { + object-fit: scale-down; + border-radius: 0; +} + +#back .switch { + padding-bottom: 1.3rem; +} + +input[type=checkbox]:checked:not(:disabled)~.lever:active::before, +input[type=checkbox]:checked:not(:disabled).tabbed:focus~.lever::before { + transform: scale(2.4); + background-color: rgba($accent-color, 0.3); + background-color: rgba(var(--accent-RGBs), 0.3); +} + +/*Switch knob*/ +.switch label input[type=checkbox]:checked+.lever:after { + background-color: $accent-color; + background-color: var(--accent-color); +} + +/*Switch backing*/ +.switch label input[type=checkbox]:checked+.lever { + background-color: $light-accent; + background-color: var(--light-accent); +} + +#passTogglelever { + left: -4px; /* Centering the toggle */ +} + +.icon { + font-size: 1.4em !important; + color: $text-color; + color: var(--text-color); + transition: color .2s; + cursor: pointer; +} + +.icon:hover { + color: $light-accent; + color: var(--light-accent); +} + +.icon:active { + color: $accent-color; + color: var(--accent-color); +} + +.input-field label:not(.label-icon).active { + -webkit-transform: translateY(-1em) scale(0.8); + transform: translateY(-1em) scale(0.8); + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.toast { + font-weight: 400 +} + +/* Negative toasts get this */ +.toast.warning { + color: $input-color; + color: var(--input-color); + background-color: $incorrect-color; + background-color: var(--incorrect-color); +} + +/* Positive toasts get this */ +.toast.success { + background-color: $correct-color; + background-color: var(--correct-color); + color: #000; +} + +#jsBanner { + position: absolute; + width: 100%; + height: 100%; + text-align: center; + background-color: rgba(0, 0, 0, 0.5); + display: flex; + align-items: center; + justify-content: center; + font-weight: 500; + font-size: 10vmin; + top: 0; + left: 0; + color: $background-color; + color: var(--background-color); + -webkit-text-stroke-width: 0.05em !important; + -webkit-text-stroke-color: $text-color !important; + -webkit-text-stroke-color: var(--text-color) !important; + padding: 10px; +} + +#jsBanner a { + color: $background-color; + color: var(--background-color); + -webkit-text-stroke: 3px $text-color; + -webkit-text-stroke: 3px var(--text-color); + text-decoration: underline; +} + +#logo { + max-width: 100%; + max-height: 100%; +} + +#app { + margin-bottom: 0.55em !important; + width: calc(100% - 3.6rem) !important; + padding-right: 1.2em !important; + align-self: flex-end; + display: block; + white-space: nowrap; +} + +ul:empty { + display: none; +} + +/* Disable Edge's show/hide since we made one */ +::-ms-reveal { + display: none; +} + +/* For portrait logos so they don't oversize */ +#logo-container { + margin-right: 5px; + background: #fff; + padding: 3px; + border-radius: 5px; + height: calc(3rem + 0.1em); + display: none; + justify-content: center; + align-items: center; + top: 0; +} + +input[type="radio"] { + margin: 0; + width: 0; + height: 0; + padding: 0; +} + +input[type="radio"]:checked+label::before { + box-shadow: 0 0 3px 1px $text-color; + box-shadow: 0 0 3px 1px var(--text-color); +} + +label:focus { + outline: none; +} + +.github-corner { + fill: $accent-color; + fill: var(--accent-color); + color: $background-color; + color: var(--background-color); + position: absolute; + top: 0; + border: 0; + right: 0; +} + +.github-corner:hover .octo-arm { + animation: octocat-wave 560ms ease-in-out; +} + +@keyframes octocat-wave { + + 0%, + 100% { + transform: rotate(0); + } + + 20%, + 60% { + transform: rotate(-25deg); + } + + 40%, + 80% { + transform: rotate(10deg); + } +} +.tabs { + background-color: $internal-color; + background-color: var(--internal-color); + cursor: pointer; + overflow-x: hidden; + z-index: 995; +} + +.tabs .tab a, +.tabs .tab a:hover { + color: $text-color; + color: var(--text-color); + font-size: 1em; + padding: 0 .5em; +} + +.tabs .tab a:focus, +.tabs .tab a:focus.active { + background-color: $background-color; + background-color: var(--background-color); +} + +.tabs .tab a.active { + color: $input-color; + color: var(--input-color); + font-weight: 400; +} + +.tabs .indicator { + background: $accent-color; + background-color: var(--accent-color) +} + +.btn { + height: 2.4em; + line-height: 2.4em; + font-family: 'Roboto', sans-serif; + font-weight: 300; + font-size: 1rem; + padding: 0 2rem; + background: $accent-color; + background: var(--accent-color); +} + +.btn:focus, +.btn:hover { + background: $accent-color; + background: var(--accent-color); +} + +.switch label .lever { + height: 0.933em; + width: 2.4em; +} + +.switch label .lever::before, +.switch label .lever::after { + height: 1.33em; + width: 1.33em; +} + +.switch label input[type="checkbox"]:checked+.lever::before, +.switch label input[type="checkbox"]:checked+.lever::after { + left: 1.4em; +} + +.switch label .lever::before, +.switch label .lever::after { + top: -0.2em; +} + +.material-tooltip { + max-width: 7em; +} + +/* If the device can't hover, don't show tooltips */ +@media (hover: none) { + .material-tooltip { + display: none; + } +} + +.material-tooltip { + background-color: $internal-color; + background-color: var(--internal-color); + box-shadow: 0 0.26em 0.65em 0 rgba(0, 0, 0, 0.2); + color: $text-color; + color: var(--text-color); +} + +/* In the future focus-visable should be used. See https://caniuse.com/?#search=css-focus-visible */ +.btn:focus, +.btn-large:focus, +.btn-small:focus, +.btn-floating:focus, +.btn-large:focus, +.btn-small:focus, +.btn-flat:focus { + outline: rgb(77, 144, 254) auto 5px; + outline-color: rgb(77, 144, 254); + outline-style: auto; + outline-width: 5px; +} + +/* Always show arrows on the number inputs */ +input[type=number]::-webkit-inner-spin-button, +input[type=number]::-webkit-outer-spin-button { + opacity: 1; +} + +ul.tabs li.tab a i.material-icons { + vertical-align: middle; + color: $incorrect-color; + color: var(--incorrect-color); +} + +/* Normal size */ +.btn-floating { + width: 2.86rem; + height: 2.86rem; +} + +.btn-floating i { + font-size: 1.6rem; + line-height: 2.86rem; + display: block; + top: 0; +} + +/* Large size */ +.btn-floating.btn-large { + width: 4rem; + height: 4rem; +} + +.btn-floating.btn-large i { + font-size: 2rem; + line-height: 4rem; +} + +/* If we're on a small/mobile device */ +@media only all and (max-width:40em) { + + body { + background-color: var(--internal-color); + } + + #back { + /* Ditch loads of padding */ + margin: 0; + box-shadow: none; + + min-height: 100%; + border-radius: 0; + } + + #box { + width: 100VW; + max-width: 100VW; + min-height: 100%; + } + + /* Install icon */ + #install-icon { + padding-right: .5vw; + } + + /* Normal size */ + .btn-floating { + width: 10vw; + height: 10vw; + } + + .btn-floating i { + font-size: 5vw; + line-height: 10vw; + } + + /* Large size */ + .btn-floating.btn-large { + width: 15vw; + height: 15vw; + } + + .btn-floating.btn-large i { + font-size: 7.5vw; + line-height: 15vw; + } + + .github-corner { + color: $internal-color; + color: var(--internal-color); + } +} + +/* If it won't fit vertically */ +@media only all and (max-height:600px ) and (min-width:40em) { + html { + /* Drop the font size */ + font-size: 2vh; + } +} + +.sidenav { + background-color: $background-color; + background-color: var(--background-color); + width: 350px; + max-width: 100%; + overflow-y: hidden; + padding-bottom: 0; +} + +.sidenav li>a { + font-weight: 300; +} + +/* Shows warning icons properly */ +.sidenav li>a>i, +.sidenav li>a>[class^="mdi-"], +.sidenav li>a li>a>[class*="mdi-"], +.sidenav li>a>i.material-icons { + margin: 0; + float: none; +} + +#settings { + position: absolute; + left: 1vw; + bottom: 1vw; + display: block; +} + +#settings a i.material-icons { + display: block; + font-size: 2.5em; + color: $text-color; + color: var(--text-color); +} + +.sidenav label:not([for=length-pref]) { + font-size: 1rem; + top: -33px; +} + +#options { + padding: 10px; + // padding-top: 0; + display: grid; + height: calc(100% - 8px); + grid-template-rows: repeat(12, 1fr); + // grid-template-rows: repeat(auto-fill, minmax(70px, 1fr)) + // grid-auto-rows: repeat(min-content, 60px) ; +} + +.sidenav .dropdown-content { + background: $background-color; + background: var(--background-color); +} + +.sidenav .dropdown-content li>a, +.dropdown-content li>span { + color: $input-color; + color: var(--input-color); +} + +select { + background-color: $internal-color; + background-color: var(--internal-color); + + border: 1px solid $text-color; + border: 1px solid var(--text-color); + border-radius: 3px; + + color: $input-color; + color: var(--input-color); +} + +select:focus { + border: 1px solid $light-accent; + border: 1px solid var(--light-accent); + outline: none; +} + +#options div.input-field { + margin-top: 2.5rem; +} + +#options a { + margin-top: 1rem; +} + +.btn i { + vertical-align: top; +} + +.drag-target { + left: 0; +} + +.sidenav .switch label { + font-size: 1.2em; +} + +.sidenav { + place-content: center; +} + +#theme-container { + grid-row: 1; +} + +#session-container { + grid-row: 3; + padding-bottom: 0; +} + +#footer { + grid-row: last-line; +} + +#install-container { + display: grid; + grid-template-columns: 1fr calc(2.4em + 10px); + align-content: stretch; +} + +#close { + cursor: pointer; + align-self: end; + justify-self: flex-end; + font-size: 2.4em; + color: $input-color; + color: var(--input-color); +} + +a { + color: $link-color; + color: var(--link-color); +} + +#length-pref { + font-size: 2em; + font-weight: 300; +} From 716f36ae115e9cb24576990807d367c9b364b1a0 Mon Sep 17 00:00:00 2001 From: Michael <59065704+Michael-Curtis0@users.noreply.github.com> Date: Tue, 23 Nov 2021 11:42:39 +0000 Subject: [PATCH 3/3] Update CSS from camelCase to kebab-case Partially solves #71 --- data/themes.json | 160 +- data/themes_schema.json | 152 +- src/debug.js | 108 +- src/main.js | 28 +- src/materialize.js | 25600 +++++++++++++++++++------------------- src/src.ejs | 428 +- src/style.scss | 1830 +-- 7 files changed, 14153 insertions(+), 14153 deletions(-) diff --git a/data/themes.json b/data/themes.json index 7ddcea12..16c5c4e8 100644 --- a/data/themes.json +++ b/data/themes.json @@ -1,80 +1,80 @@ -{ - "Vanilla":{ - "accent": "#3f51b5", - "accent-RGBs": [63, 81, 181], - "light-accent": "#7280ce", - "text": "#535353", - "background": "#fff", - "internal": "#fff", - "incorrect": "#f44336", - "correct": "#8fff66", - "input-color": "#000", - "link-color": "#00539b", - "highlight-color": "#eee" - }, - "Discord":{ - "accent": "#7289da", - "accent-RGBs": [114, 137, 218], - "light-accent": "#9aabe5", - "text": "#dcddde", - "background": "#2f3136", - "internal": "#393c43", - "incorrect": "#f04747", - "correct": "#43b581", - "input-color": "#fff", - "link-color": "#00b0f4", - "highlight-color": "#393c43" - }, - "Solarized Dark":{ - "accent": "#6c71c4", - "accent-RGBs": [108, 113, 196], - "light-accent": "#9094d3", - "text": "#93a1a1", - "background": "#073642", - "internal": "#002b36", - "incorrect": "#ce2726", - "correct": "#7c9114", - "input-color": "#839496", - "link-color": "#268bd2", - "highlight-color": "#002b36" - }, - "OLED":{ - "accent": "#3f51b5", - "accent-RGBs": [63, 81, 181], - "light-accent": "#6d78b5", - "text": "#d4d4d4", - "background": "#000", - "internal": "#000", - "incorrect": "#f44336", - "correct": "#8fff66", - "input-color": "#839496", - "link-color": "#268bd2", - "highlight-color": "#0e0e0e" - }, - "Dracula":{ - "accent": "#3f51b5", - "accent-RGBs": [63, 81, 181], - "light-accent": "#6272a4", - "text": "#bcc2cd", - "background": "#282a36", - "internal": "#343746", - "incorrect": "#f55", - "correct": "#50fa7b", - "input-color": "#f8f8f2", - "link-color": "#6272a4", - "highlight-color": "#343746" - }, - "Monokai":{ - "accent": "#e43265", - "accent-RGBs": [228, 50, 101], - "light-accent": "#292c3f", - "text": "#979bb0", - "background": "#11121d", - "internal": "#171926", - "incorrect": "#f5680a", - "correct": "#2fd6b5", - "input-color": "#fff", - "link-color": "#e53265", - "highlight-color": "#171926" - } -} +{ + "Vanilla":{ + "accent": "#3f51b5", + "accentRGBs": [63, 81, 181], + "lightAccent": "#7280ce", + "text": "#535353", + "background": "#fff", + "internal": "#fff", + "incorrect": "#f44336", + "correct": "#8fff66", + "inputColor": "#000", + "linkColor": "#00539b", + "highlightColor": "#eee" + }, + "Discord":{ + "accent": "#7289da", + "accentRGBs": [114, 137, 218], + "lightAccent": "#9aabe5", + "text": "#dcddde", + "background": "#2f3136", + "internal": "#393c43", + "incorrect": "#f04747", + "correct": "#43b581", + "inputColor": "#fff", + "linkColor": "#00b0f4", + "highlightColor": "#393c43" + }, + "Solarized Dark":{ + "accent": "#6c71c4", + "accentRGBs": [108, 113, 196], + "lightAccent": "#9094d3", + "text": "#93a1a1", + "background": "#073642", + "internal": "#002b36", + "incorrect": "#ce2726", + "correct": "#7c9114", + "inputColor": "#839496", + "linkColor": "#268bd2", + "highlightColor": "#002b36" + }, + "OLED":{ + "accent": "#3f51b5", + "accentRGBs": [63, 81, 181], + "lightAccent": "#6d78b5", + "text": "#d4d4d4", + "background": "#000", + "internal": "#000", + "incorrect": "#f44336", + "correct": "#8fff66", + "inputColor": "#839496", + "linkColor": "#268bd2", + "highlightColor": "#0e0e0e" + }, + "Dracula":{ + "accent": "#3f51b5", + "accentRGBs": [63, 81, 181], + "lightAccent": "#6272a4", + "text": "#bcc2cd", + "background": "#282a36", + "internal": "#343746", + "incorrect": "#f55", + "correct": "#50fa7b", + "inputColor": "#f8f8f2", + "linkColor": "#6272a4", + "highlightColor": "#343746" + }, + "Monokai":{ + "accent": "#e43265", + "accentRGBs": [228, 50, 101], + "lightAccent": "#292c3f", + "text": "#979bb0", + "background": "#11121d", + "internal": "#171926", + "incorrect": "#f5680a", + "correct": "#2fd6b5", + "inputColor": "#fff", + "linkColor": "#e53265", + "highlightColor": "#171926" + } +} diff --git a/data/themes_schema.json b/data/themes_schema.json index 40e42742..a53c5fc2 100644 --- a/data/themes_schema.json +++ b/data/themes_schema.json @@ -1,76 +1,76 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "type": "object", - "patternProperties": { - "^[a-zA-Z0-9\\W]*$": { - "type": "object", - "properties": { - "accent": { - "type": "string", - "format": "color" - }, - "light-accent": { - "type": "string", - "format": "color" - }, - "text": { - "type": "string", - "format": "color" - }, - "background": { - "type": "string", - "format": "color" - }, - "internal": { - "type": "string", - "format": "color" - }, - "incorrect": { - "type": "string", - "format": "color" - }, - "correct": { - "type": "string", - "format": "color" - }, - "input-color": { - "type": "string", - "format": "color" - }, - "link-color": { - "type": "string", - "format": "color" - }, - "highlight-color": { - "type": "string", - "format": "color" - }, - "accent-RGBs": { - "type": "array", - "maxItems": 3, - "minItems": 3, - "items": { - "type": "number", - "maximum": 255, - "minimum": 0 - } - } - }, - "required": [ - "accent", - "light-accent", - "text", - "background", - "internal", - "incorrect", - "correct", - "input-color", - "link-color", - "highlight-color" - ] - } - }, - "required": [ - "Vanilla" - ] -} +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "patternProperties": { + "^[a-zA-Z0-9\\W]*$": { + "type": "object", + "properties": { + "accent": { + "type": "string", + "format": "color" + }, + "lightAccent": { + "type": "string", + "format": "color" + }, + "text": { + "type": "string", + "format": "color" + }, + "background": { + "type": "string", + "format": "color" + }, + "internal": { + "type": "string", + "format": "color" + }, + "incorrect": { + "type": "string", + "format": "color" + }, + "correct": { + "type": "string", + "format": "color" + }, + "inputColor": { + "type": "string", + "format": "color" + }, + "linkColor": { + "type": "string", + "format": "color" + }, + "highlightColor": { + "type": "string", + "format": "color" + }, + "accentRGBs": { + "type": "array", + "maxItems": 3, + "minItems": 3, + "items": { + "type": "number", + "maximum": 255, + "minimum": 0 + } + } + }, + "required": [ + "accent", + "lightAccent", + "text", + "background", + "internal", + "incorrect", + "correct", + "inputColor", + "linkColor", + "highlightColor" + ] + } + }, + "required": [ + "Vanilla" + ] +} \ No newline at end of file diff --git a/src/debug.js b/src/debug.js index 40e23116..d6a097df 100644 --- a/src/debug.js +++ b/src/debug.js @@ -1,54 +1,54 @@ -const themeData = require('../data/themes.json') - -const debug = false - -if (debug) { - document.title += ` - Debug ${new Date().getTime()}` - console.debug('Enabling debug css') - const link = document.createElement('link') - link.setAttribute('rel', 'stylesheet') - link.setAttribute('type', 'text/css') - link.setAttribute('href', 'debug.css') - document.getElementsByTagName('head')[0].appendChild(link) - - // Add select option for an all #ff00ff theme - - themeData.testTheme = { - accent: '#ff00ff', - light-accent: '#ff00ff', - text: '#ff00ff', - background: '#ff00ff', - internal: '#ff00ff', - incorrect: '#ff00ff', - correct: '#ff00ff', - input-color: '#ff00ff', - link-color: '#ff00ff', - highlight-color: '#ff00ff' - } - - const themeOption = document.createElement('option') - themeOption.onclick = "changeTheme('testTheme')" - themeOption.id = 'testTheme' - themeOption.innerHTML = 'testTheme' - document.querySelector('#options .input-field select').appendChild(themeOption) - - const css = 'a[id=testTheme]{background-color: #ff00ff !important; border: 1px ;}a[id=testTheme] i {color: #ff00ff' - const style = document.createElement('style') - style.type = 'text/css' - if (style.styleSheet) { - // This is required for IE8 and below. - style.styleSheet.cssText = css - } else { - style.appendChild(document.createTextNode(css)) - } - document.getElementsByTagName('head')[0].appendChild(style) -} - -// If running locally -if (location.hostname === 'localhost' || location.hostname === '127.0.0.1') { - // Change the page title so I can tell the tabs apart - document.title += ' - LocalHost' - - // Fix faq link - document.getElementById('faq').href += '.html' -} +const themeData = require('../data/themes.json') + +const debug = false + +if (debug) { + document.title += ` - Debug ${new Date().getTime()}` + console.debug('Enabling debug css') + const link = document.createElement('link') + link.setAttribute('rel', 'stylesheet') + link.setAttribute('type', 'text/css') + link.setAttribute('href', 'debug.css') + document.getElementsByTagName('head')[0].appendChild(link) + + // Add select option for an all #ff00ff theme + + themeData.testTheme = { + accent: '#ff00ff', + lightAccent: '#ff00ff', + text: '#ff00ff', + background: '#ff00ff', + internal: '#ff00ff', + incorrect: '#ff00ff', + correct: '#ff00ff', + inputColor: '#ff00ff', + linkColor: '#ff00ff', + highlightColor: '#ff00ff' + } + + const themeOption = document.createElement('option') + themeOption.onclick = "changeTheme('testTheme')" + themeOption.id = 'testTheme' + themeOption.innerHTML = 'testTheme' + document.querySelector('#options .input-field select').appendChild(themeOption) + + const css = 'a[id=testTheme]{background-color: #ff00ff !important; border: 1px ;}a[id=testTheme] i {color: #ff00ff' + const style = document.createElement('style') + style.type = 'text/css' + if (style.styleSheet) { + // This is required for IE8 and below. + style.styleSheet.cssText = css + } else { + style.appendChild(document.createTextNode(css)) + } + document.getElementsByTagName('head')[0].appendChild(style) +} + +// If running locally +if (location.hostname === 'localhost' || location.hostname === '127.0.0.1') { + // Change the page title so I can tell the tabs apart + document.title += ' - LocalHost' + + // Fix faq link + document.getElementById('faq').href += '.html' +} diff --git a/src/main.js b/src/main.js index 9b5bdee5..affc2e43 100644 --- a/src/main.js +++ b/src/main.js @@ -89,17 +89,17 @@ window.changeTheme = function (passedTheme) { localStorage.setItem('theme', passedTheme) - document.documentElement.style.setProperty('--accent-color', themeData[passedTheme].accent) - document.documentElement.style.setProperty('--light-accent', themeData[passedTheme].light-accent) - document.documentElement.style.setProperty('--text-color', themeData[passedTheme].text) - document.documentElement.style.setProperty('--background-color', themeData[passedTheme].background) - document.documentElement.style.setProperty('--internal-color', themeData[passedTheme].internal) - document.documentElement.style.setProperty('--incorrect-color', themeData[passedTheme].incorrect) - document.documentElement.style.setProperty('--correct-color', themeData[passedTheme].correct) - document.documentElement.style.setProperty('--input-color', themeData[passedTheme].input-color) - document.documentElement.style.setProperty('--link-color', themeData[passedTheme].link-color) - document.documentElement.style.setProperty('--highlight-color', themeData[passedTheme].highlight-color) - document.documentElement.style.setProperty('--accent-RGBs', themeData[passedTheme].accent-RGBs) + document.documentElement.style.setProperty('--accentColor', themeData[passedTheme].accent) + document.documentElement.style.setProperty('--lightAccent', themeData[passedTheme].lightAccent) + document.documentElement.style.setProperty('--textColor', themeData[passedTheme].text) + document.documentElement.style.setProperty('--backgroundColor', themeData[passedTheme].background) + document.documentElement.style.setProperty('--internalColor', themeData[passedTheme].internal) + document.documentElement.style.setProperty('--incorrectColor', themeData[passedTheme].incorrect) + document.documentElement.style.setProperty('--correctColor', themeData[passedTheme].correct) + document.documentElement.style.setProperty('--inputColor', themeData[passedTheme].inputColor) + document.documentElement.style.setProperty('--linkColor', themeData[passedTheme].linkColor) + document.documentElement.style.setProperty('--highlightColor', themeData[passedTheme].highlightColor) + document.documentElement.style.setProperty('--accentRGBs', themeData[passedTheme].accentRGBs) } // Change theme to stored before the page loads to avoid flicker. @@ -245,7 +245,7 @@ function setLogo (appName) { } // Set image - document.getElementById('logo-container').style.display = 'flex' + document.getElementById('logoContainer').style.display = 'flex' document.getElementById('logo').src = logo document.getElementById('logo').alt = appName document.getElementById('logo').title = appName @@ -545,7 +545,7 @@ function colourUnderline () { )}%, ${window.getRandomArbitrary(45, 80)}%)` document .getElementById('pass') - .style.setProperty('--accent-color', colour) + .style.setProperty('--accentColor', colour) } else { // If there's no password, reset the underline colour document.getElementById('pass').removeAttribute('style') @@ -557,7 +557,7 @@ window.appInput = function () { presetInUse = false // Clear logo - document.getElementById('logo-container').style.display = 'none' + document.getElementById('logoContainer').style.display = 'none' document.getElementById('logo').removeAttribute('src') document.getElementById('logo').removeAttribute('alt') document.getElementById('logo').removeAttribute('title') diff --git a/src/materialize.js b/src/materialize.js index b270714c..e5dba309 100644 --- a/src/materialize.js +++ b/src/materialize.js @@ -1,12800 +1,12800 @@ -var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; - -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; }; }(); - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -/*! cash-dom 1.3.5, https://github.com/kenwheeler/cash @license MIT */ -(function (factory) { - window.cash = factory(); -})(function () { - var doc = document, - win = window, - ArrayProto = Array.prototype, - slice = ArrayProto.slice, - filter = ArrayProto.filter, - push = ArrayProto.push; - - var noop = function () {}, - isFunction = function (item) { - // @see https://crbug.com/568448 - return typeof item === typeof noop && item.call; - }, - isString = function (item) { - return typeof item === typeof ""; - }; - - var idMatch = /^#[\w-]*$/, - classMatch = /^\.[\w-]*$/, - htmlMatch = /<.+>/, - singlet = /^\w+$/; - - function find(selector, context) { - context = context || doc; - var elems = classMatch.test(selector) ? context.getElementsByClassName(selector.slice(1)) : singlet.test(selector) ? context.getElementsByTagName(selector) : context.querySelectorAll(selector); - return elems; - } - - var frag; - function parseHTML(str) { - if (!frag) { - frag = doc.implementation.createHTMLDocument(null); - var base = frag.createElement("base"); - base.href = doc.location.href; - frag.head.appendChild(base); - } - - frag.body.innerHTML = str; - - return frag.body.childNodes; - } - - function onReady(fn) { - if (doc.readyState !== "loading") { - fn(); - } else { - doc.addEventListener("DOMContentLoaded", fn); - } - } - - function Init(selector, context) { - if (!selector) { - return this; - } - - // If already a cash collection, don't do any further processing - if (selector.cash && selector !== win) { - return selector; - } - - var elems = selector, - i = 0, - length; - - if (isString(selector)) { - elems = idMatch.test(selector) ? - // If an ID use the faster getElementById check - doc.getElementById(selector.slice(1)) : htmlMatch.test(selector) ? - // If HTML, parse it into real elements - parseHTML(selector) : - // else use `find` - find(selector, context); - - // If function, use as shortcut for DOM ready - } else if (isFunction(selector)) { - onReady(selector);return this; - } - - if (!elems) { - return this; - } - - // If a single DOM element is passed in or received via ID, return the single element - if (elems.nodeType || elems === win) { - this[0] = elems; - this.length = 1; - } else { - // Treat like an array and loop through each item. - length = this.length = elems.length; - for (; i < length; i++) { - this[i] = elems[i]; - } - } - - return this; - } - - function cash(selector, context) { - return new Init(selector, context); - } - - var fn = cash.fn = cash.prototype = Init.prototype = { // jshint ignore:line - cash: true, - length: 0, - push: push, - splice: ArrayProto.splice, - map: ArrayProto.map, - init: Init - }; - - Object.defineProperty(fn, "constructor", { value: cash }); - - cash.parseHTML = parseHTML; - cash.noop = noop; - cash.isFunction = isFunction; - cash.isString = isString; - - cash.extend = fn.extend = function (target) { - target = target || {}; - - var args = slice.call(arguments), - length = args.length, - i = 1; - - if (args.length === 1) { - target = this; - i = 0; - } - - for (; i < length; i++) { - if (!args[i]) { - continue; - } - for (var key in args[i]) { - if (args[i].hasOwnProperty(key)) { - target[key] = args[i][key]; - } - } - } - - return target; - }; - - function each(collection, callback) { - var l = collection.length, - i = 0; - - for (; i < l; i++) { - if (callback.call(collection[i], collection[i], i, collection) === false) { - break; - } - } - } - - function matches(el, selector) { - var m = el && (el.matches || el.webkitMatchesSelector || el.mozMatchesSelector || el.msMatchesSelector || el.oMatchesSelector); - return !!m && m.call(el, selector); - } - - function getCompareFunction(selector) { - return ( - /* Use browser's `matches` function if string */ - isString(selector) ? matches : - /* Match a cash element */ - selector.cash ? function (el) { - return selector.is(el); - } : - /* Direct comparison */ - function (el, selector) { - return el === selector; - } - ); - } - - function unique(collection) { - return cash(slice.call(collection).filter(function (item, index, self) { - return self.indexOf(item) === index; - })); - } - - cash.extend({ - merge: function (first, second) { - var len = +second.length, - i = first.length, - j = 0; - - for (; j < len; i++, j++) { - first[i] = second[j]; - } - - first.length = i; - return first; - }, - - each: each, - matches: matches, - unique: unique, - isArray: Array.isArray, - isNumeric: function (n) { - return !isNaN(parseFloat(n)) && isFinite(n); - } - - }); - - var uid = cash.uid = "_cash" + Date.now(); - - function getDataCache(node) { - return node[uid] = node[uid] || {}; - } - - function setData(node, key, value) { - return getDataCache(node)[key] = value; - } - - function getData(node, key) { - var c = getDataCache(node); - if (c[key] === undefined) { - c[key] = node.dataset ? node.dataset[key] : cash(node).attr("data-" + key); - } - return c[key]; - } - - function removeData(node, key) { - var c = getDataCache(node); - if (c) { - delete c[key]; - } else if (node.dataset) { - delete node.dataset[key]; - } else { - cash(node).removeAttr("data-" + name); - } - } - - fn.extend({ - data: function (name, value) { - if (isString(name)) { - return value === undefined ? getData(this[0], name) : this.each(function (v) { - return setData(v, name, value); - }); - } - - for (var key in name) { - this.data(key, name[key]); - } - - return this; - }, - - removeData: function (key) { - return this.each(function (v) { - return removeData(v, key); - }); - } - - }); - - var notWhiteMatch = /\S+/g; - - function getClasses(c) { - return isString(c) && c.match(notWhiteMatch); - } - - function hasClass(v, c) { - return v.classList ? v.classList.contains(c) : new RegExp("(^| )" + c + "( |$)", "gi").test(v.className); - } - - function addClass(v, c, spacedName) { - if (v.classList) { - v.classList.add(c); - } else if (spacedName.indexOf(" " + c + " ")) { - v.className += " " + c; - } - } - - function removeClass(v, c) { - if (v.classList) { - v.classList.remove(c); - } else { - v.className = v.className.replace(c, ""); - } - } - - fn.extend({ - addClass: function (c) { - var classes = getClasses(c); - - return classes ? this.each(function (v) { - var spacedName = " " + v.className + " "; - each(classes, function (c) { - addClass(v, c, spacedName); - }); - }) : this; - }, - - attr: function (name, value) { - if (!name) { - return undefined; - } - - if (isString(name)) { - if (value === undefined) { - return this[0] ? this[0].getAttribute ? this[0].getAttribute(name) : this[0][name] : undefined; - } - - return this.each(function (v) { - if (v.setAttribute) { - v.setAttribute(name, value); - } else { - v[name] = value; - } - }); - } - - for (var key in name) { - this.attr(key, name[key]); - } - - return this; - }, - - hasClass: function (c) { - var check = false, - classes = getClasses(c); - if (classes && classes.length) { - this.each(function (v) { - check = hasClass(v, classes[0]); - return !check; - }); - } - return check; - }, - - prop: function (name, value) { - if (isString(name)) { - return value === undefined ? this[0][name] : this.each(function (v) { - v[name] = value; - }); - } - - for (var key in name) { - this.prop(key, name[key]); - } - - return this; - }, - - removeAttr: function (name) { - return this.each(function (v) { - if (v.removeAttribute) { - v.removeAttribute(name); - } else { - delete v[name]; - } - }); - }, - - removeClass: function (c) { - if (!arguments.length) { - return this.attr("class", ""); - } - var classes = getClasses(c); - return classes ? this.each(function (v) { - each(classes, function (c) { - removeClass(v, c); - }); - }) : this; - }, - - removeProp: function (name) { - return this.each(function (v) { - delete v[name]; - }); - }, - - toggleClass: function (c, state) { - if (state !== undefined) { - return this[state ? "addClass" : "removeClass"](c); - } - var classes = getClasses(c); - return classes ? this.each(function (v) { - var spacedName = " " + v.className + " "; - each(classes, function (c) { - if (hasClass(v, c)) { - removeClass(v, c); - } else { - addClass(v, c, spacedName); - } - }); - }) : this; - } }); - - fn.extend({ - add: function (selector, context) { - return unique(cash.merge(this, cash(selector, context))); - }, - - each: function (callback) { - each(this, callback); - return this; - }, - - eq: function (index) { - return cash(this.get(index)); - }, - - filter: function (selector) { - if (!selector) { - return this; - } - - var comparator = isFunction(selector) ? selector : getCompareFunction(selector); - - return cash(filter.call(this, function (e) { - return comparator(e, selector); - })); - }, - - first: function () { - return this.eq(0); - }, - - get: function (index) { - if (index === undefined) { - return slice.call(this); - } - return index < 0 ? this[index + this.length] : this[index]; - }, - - index: function (elem) { - var child = elem ? cash(elem)[0] : this[0], - collection = elem ? this : cash(child).parent().children(); - return slice.call(collection).indexOf(child); - }, - - last: function () { - return this.eq(-1); - } - - }); - - var camelCase = function () { - var camelRegex = /(?:^\w|[A-Z]|\b\w)/g, - whiteSpace = /[\s-_]+/g; - return function (str) { - return str.replace(camelRegex, function (letter, index) { - return letter[index === 0 ? "toLowerCase" : "toUpperCase"](); - }).replace(whiteSpace, ""); - }; - }(); - - var getPrefixedProp = function () { - var cache = {}, - doc = document, - div = doc.createElement("div"), - style = div.style; - - return function (prop) { - prop = camelCase(prop); - if (cache[prop]) { - return cache[prop]; - } - - var ucProp = prop.charAt(0).toUpperCase() + prop.slice(1), - prefixes = ["webkit", "moz", "ms", "o"], - props = (prop + " " + prefixes.join(ucProp + " ") + ucProp).split(" "); - - each(props, function (p) { - if (p in style) { - cache[p] = prop = cache[prop] = p; - return false; - } - }); - - return cache[prop]; - }; - }(); - - cash.prefixedProp = getPrefixedProp; - cash.camelCase = camelCase; - - fn.extend({ - css: function (prop, value) { - if (isString(prop)) { - prop = getPrefixedProp(prop); - return arguments.length > 1 ? this.each(function (v) { - return v.style[prop] = value; - }) : win.getComputedStyle(this[0])[prop]; - } - - for (var key in prop) { - this.css(key, prop[key]); - } - - return this; - } - - }); - - function compute(el, prop) { - return parseInt(win.getComputedStyle(el[0], null)[prop], 10) || 0; - } - - each(["Width", "Height"], function (v) { - var lower = v.toLowerCase(); - - fn[lower] = function () { - return this[0].getBoundingClientRect()[lower]; - }; - - fn["inner" + v] = function () { - return this[0]["client" + v]; - }; - - fn["outer" + v] = function (margins) { - return this[0]["offset" + v] + (margins ? compute(this, "margin" + (v === "Width" ? "Left" : "Top")) + compute(this, "margin" + (v === "Width" ? "Right" : "Bottom")) : 0); - }; - }); - - function registerEvent(node, eventName, callback) { - var eventCache = getData(node, "_cashEvents") || setData(node, "_cashEvents", {}); - eventCache[eventName] = eventCache[eventName] || []; - eventCache[eventName].push(callback); - node.addEventListener(eventName, callback); - } - - function removeEvent(node, eventName, callback) { - var events = getData(node, "_cashEvents"), - eventCache = events && events[eventName], - index; - - if (!eventCache) { - return; - } - - if (callback) { - node.removeEventListener(eventName, callback); - index = eventCache.indexOf(callback); - if (index >= 0) { - eventCache.splice(index, 1); - } - } else { - each(eventCache, function (event) { - node.removeEventListener(eventName, event); - }); - eventCache = []; - } - } - - fn.extend({ - off: function (eventName, callback) { - return this.each(function (v) { - return removeEvent(v, eventName, callback); - }); - }, - - on: function (eventName, delegate, callback, runOnce) { - // jshint ignore:line - var originalCallback; - if (!isString(eventName)) { - for (var key in eventName) { - this.on(key, delegate, eventName[key]); - } - return this; - } - - if (isFunction(delegate)) { - callback = delegate; - delegate = null; - } - - if (eventName === "ready") { - onReady(callback); - return this; - } - - if (delegate) { - originalCallback = callback; - callback = function (e) { - var t = e.target; - while (!matches(t, delegate)) { - if (t === this || t === null) { - return t = false; - } - - t = t.parentNode; - } - - if (t) { - originalCallback.call(t, e); - } - }; - } - - return this.each(function (v) { - var finalCallback = callback; - if (runOnce) { - finalCallback = function () { - callback.apply(this, arguments); - removeEvent(v, eventName, finalCallback); - }; - } - registerEvent(v, eventName, finalCallback); - }); - }, - - one: function (eventName, delegate, callback) { - return this.on(eventName, delegate, callback, true); - }, - - ready: onReady, - - /** - * Modified - * Triggers browser event - * @param String eventName - * @param Object data - Add properties to event object - */ - trigger: function (eventName, data) { - if (document.createEvent) { - var evt = document.createEvent('HTMLEvents'); - evt.initEvent(eventName, true, false); - evt = this.extend(evt, data); - return this.each(function (v) { - return v.dispatchEvent(evt); - }); - } - } - - }); - - function encode(name, value) { - return "&" + encodeURIComponent(name) + "=" + encodeURIComponent(value).replace(/%20/g, "+"); - } - - function getSelectMultiple_(el) { - var values = []; - each(el.options, function (o) { - if (o.selected) { - values.push(o.value); - } - }); - return values.length ? values : null; - } - - function getSelectSingle_(el) { - var selectedIndex = el.selectedIndex; - return selectedIndex >= 0 ? el.options[selectedIndex].value : null; - } - - function getValue(el) { - var type = el.type; - if (!type) { - return null; - } - switch (type.toLowerCase()) { - case "select-one": - return getSelectSingle_(el); - case "select-multiple": - return getSelectMultiple_(el); - case "radio": - return el.checked ? el.value : null; - case "checkbox": - return el.checked ? el.value : null; - default: - return el.value ? el.value : null; - } - } - - fn.extend({ - serialize: function () { - var query = ""; - - each(this[0].elements || this, function (el) { - if (el.disabled || el.tagName === "FIELDSET") { - return; - } - var name = el.name; - switch (el.type.toLowerCase()) { - case "file": - case "reset": - case "submit": - case "button": - break; - case "select-multiple": - var values = getValue(el); - if (values !== null) { - each(values, function (value) { - query += encode(name, value); - }); - } - break; - default: - var value = getValue(el); - if (value !== null) { - query += encode(name, value); - } - } - }); - - return query.substr(1); - }, - - val: function (value) { - if (value === undefined) { - return getValue(this[0]); - } - - return this.each(function (v) { - return v.value = value; - }); - } - - }); - - function insertElement(el, child, prepend) { - if (prepend) { - var first = el.childNodes[0]; - el.insertBefore(child, first); - } else { - el.appendChild(child); - } - } - - function insertContent(parent, child, prepend) { - var str = isString(child); - - if (!str && child.length) { - each(child, function (v) { - return insertContent(parent, v, prepend); - }); - return; - } - - each(parent, str ? function (v) { - return v.insertAdjacentHTML(prepend ? "afterbegin" : "beforeend", child); - } : function (v, i) { - return insertElement(v, i === 0 ? child : child.cloneNode(true), prepend); - }); - } - - fn.extend({ - after: function (selector) { - cash(selector).insertAfter(this); - return this; - }, - - append: function (content) { - insertContent(this, content); - return this; - }, - - appendTo: function (parent) { - insertContent(cash(parent), this); - return this; - }, - - before: function (selector) { - cash(selector).insertBefore(this); - return this; - }, - - clone: function () { - return cash(this.map(function (v) { - return v.cloneNode(true); - })); - }, - - empty: function () { - this.html(""); - return this; - }, - - html: function (content) { - if (content === undefined) { - return this[0].innerHTML; - } - var source = content.nodeType ? content[0].outerHTML : content; - return this.each(function (v) { - return v.innerHTML = source; - }); - }, - - insertAfter: function (selector) { - var _this = this; - - cash(selector).each(function (el, i) { - var parent = el.parentNode, - sibling = el.nextSibling; - _this.each(function (v) { - parent.insertBefore(i === 0 ? v : v.cloneNode(true), sibling); - }); - }); - - return this; - }, - - insertBefore: function (selector) { - var _this2 = this; - cash(selector).each(function (el, i) { - var parent = el.parentNode; - _this2.each(function (v) { - parent.insertBefore(i === 0 ? v : v.cloneNode(true), el); - }); - }); - return this; - }, - - prepend: function (content) { - insertContent(this, content, true); - return this; - }, - - prependTo: function (parent) { - insertContent(cash(parent), this, true); - return this; - }, - - remove: function () { - return this.each(function (v) { - if (!!v.parentNode) { - return v.parentNode.removeChild(v); - } - }); - }, - - text: function (content) { - if (content === undefined) { - return this[0].textContent; - } - return this.each(function (v) { - return v.textContent = content; - }); - } - - }); - - var docEl = doc.documentElement; - - fn.extend({ - position: function () { - var el = this[0]; - return { - left: el.offsetLeft, - top: el.offsetTop - }; - }, - - offset: function () { - var rect = this[0].getBoundingClientRect(); - return { - top: rect.top + win.pageYOffset - docEl.clientTop, - left: rect.left + win.pageXOffset - docEl.clientLeft - }; - }, - - offsetParent: function () { - return cash(this[0].offsetParent); - } - - }); - - fn.extend({ - children: function (selector) { - var elems = []; - this.each(function (el) { - push.apply(elems, el.children); - }); - elems = unique(elems); - - return !selector ? elems : elems.filter(function (v) { - return matches(v, selector); - }); - }, - - closest: function (selector) { - if (!selector || this.length < 1) { - return cash(); - } - if (this.is(selector)) { - return this.filter(selector); - } - return this.parent().closest(selector); - }, - - is: function (selector) { - if (!selector) { - return false; - } - - var match = false, - comparator = getCompareFunction(selector); - - this.each(function (el) { - match = comparator(el, selector); - return !match; - }); - - return match; - }, - - find: function (selector) { - if (!selector || selector.nodeType) { - return cash(selector && this.has(selector).length ? selector : null); - } - - var elems = []; - this.each(function (el) { - push.apply(elems, find(selector, el)); - }); - - return unique(elems); - }, - - has: function (selector) { - var comparator = isString(selector) ? function (el) { - return find(selector, el).length !== 0; - } : function (el) { - return el.contains(selector); - }; - - return this.filter(comparator); - }, - - next: function () { - return cash(this[0].nextElementSibling); - }, - - not: function (selector) { - if (!selector) { - return this; - } - - var comparator = getCompareFunction(selector); - - return this.filter(function (el) { - return !comparator(el, selector); - }); - }, - - parent: function () { - var result = []; - - this.each(function (item) { - if (item && item.parentNode) { - result.push(item.parentNode); - } - }); - - return unique(result); - }, - - parents: function (selector) { - var last, - result = []; - - this.each(function (item) { - last = item; - - while (last && last.parentNode && last !== doc.body.parentNode) { - last = last.parentNode; - - if (!selector || selector && matches(last, selector)) { - result.push(last); - } - } - }); - - return unique(result); - }, - - prev: function () { - return cash(this[0].previousElementSibling); - }, - - siblings: function (selector) { - var collection = this.parent().children(selector), - el = this[0]; - - return collection.filter(function (i) { - return i !== el; - }); - } - - }); - - return cash; -}); -; -var Component = function () { - /** - * Generic constructor for all components - * @constructor - * @param {Element} el - * @param {Object} options - */ - function Component(classDef, el, options) { - _classCallCheck(this, Component); - - // Display error if el is valid HTML Element - if (!(el instanceof Element)) { - console.error(Error(el + ' is not an HTML Element')); - } - - // If exists, destroy and reinitialize in child - var ins = classDef.getInstance(el); - if (!!ins) { - ins.destroy(); - } - - this.el = el; - this.$el = cash(el); - } - - /** - * Initializes components - * @param {class} classDef - * @param {Element | NodeList | jQuery} els - * @param {Object} options - */ - - - _createClass(Component, null, [{ - key: "init", - value: function init(classDef, els, options) { - var instances = null; - if (els instanceof Element) { - instances = new classDef(els, options); - } else if (!!els && (els.jquery || els.cash || els instanceof NodeList)) { - var instancesArr = []; - for (var i = 0; i < els.length; i++) { - instancesArr.push(new classDef(els[i], options)); - } - instances = instancesArr; - } - - return instances; - } - }]); - - return Component; -}(); - -; // Required for Meteor package, the use of window prevents export by Meteor -(function (window) { - if (window.Package) { - M = {}; - } else { - window.M = {}; - } - - // Check for jQuery - M.jQueryLoaded = !!window.jQuery; -})(window); - -// AMD -if (typeof define === 'function' && define.amd) { - define('M', [], function () { - return M; - }); - - // Common JS -} else if (typeof exports !== 'undefined' && !exports.nodeType) { - if (typeof module !== 'undefined' && !module.nodeType && module.exports) { - exports = module.exports = M; - } - exports.default = M; -} - -M.version = '1.0.0'; - -M.keys = { - TAB: 9, - ENTER: 13, - ESC: 27, - ARROW_UP: 38, - ARROW_DOWN: 40 -}; - -/** - * TabPress Keydown handler - */ -M.tabPressed = false; -M.keyDown = false; -var docHandleKeydown = function (e) { - M.keyDown = true; - if (e.which === M.keys.TAB || e.which === M.keys.ARROW_DOWN || e.which === M.keys.ARROW_UP) { - M.tabPressed = true; - } -}; -var docHandleKeyup = function (e) { - M.keyDown = false; - if (e.which === M.keys.TAB || e.which === M.keys.ARROW_DOWN || e.which === M.keys.ARROW_UP) { - M.tabPressed = false; - } -}; -var docHandleFocus = function (e) { - if (M.keyDown) { - document.body.classList.add('keyboard-focused'); - } -}; -var docHandleBlur = function (e) { - document.body.classList.remove('keyboard-focused'); -}; -document.addEventListener('keydown', docHandleKeydown, true); -document.addEventListener('keyup', docHandleKeyup, true); -document.addEventListener('focus', docHandleFocus, true); -document.addEventListener('blur', docHandleBlur, true); - -/** - * Initialize jQuery wrapper for plugin - * @param {Class} plugin javascript class - * @param {string} pluginName jQuery plugin name - * @param {string} classRef Class reference name - */ -M.initializeJqueryWrapper = function (plugin, pluginName, classRef) { - jQuery.fn[pluginName] = function (methodOrOptions) { - // Call plugin method if valid method name is passed in - if (plugin.prototype[methodOrOptions]) { - var params = Array.prototype.slice.call(arguments, 1); - - // Getter methods - if (methodOrOptions.slice(0, 3) === 'get') { - var instance = this.first()[0][classRef]; - return instance[methodOrOptions].apply(instance, params); - } - - // Void methods - return this.each(function () { - var instance = this[classRef]; - instance[methodOrOptions].apply(instance, params); - }); - - // Initialize plugin if options or no argument is passed in - } else if (typeof methodOrOptions === 'object' || !methodOrOptions) { - plugin.init(this, arguments[0]); - return this; - } - - // Return error if an unrecognized method name is passed in - jQuery.error("Method " + methodOrOptions + " does not exist on jQuery." + pluginName); - }; -}; - -/** - * Automatically initialize components - * @param {Element} context DOM Element to search within for components - */ -M.AutoInit = function (context) { - // Use document.body if no context is given - var root = !!context ? context : document.body; - - var registry = { - Autocomplete: root.querySelectorAll('.autocomplete:not(.no-autoinit)'), - Carousel: root.querySelectorAll('.carousel:not(.no-autoinit)'), - Chips: root.querySelectorAll('.chips:not(.no-autoinit)'), - Collapsible: root.querySelectorAll('.collapsible:not(.no-autoinit)'), - Datepicker: root.querySelectorAll('.datepicker:not(.no-autoinit)'), - Dropdown: root.querySelectorAll('.dropdown-trigger:not(.no-autoinit)'), - Materialbox: root.querySelectorAll('.materialboxed:not(.no-autoinit)'), - Modal: root.querySelectorAll('.modal:not(.no-autoinit)'), - Parallax: root.querySelectorAll('.parallax:not(.no-autoinit)'), - Pushpin: root.querySelectorAll('.pushpin:not(.no-autoinit)'), - ScrollSpy: root.querySelectorAll('.scrollspy:not(.no-autoinit)'), - FormSelect: root.querySelectorAll('select:not(.no-autoinit)'), - Sidenav: root.querySelectorAll('.sidenav:not(.no-autoinit)'), - Tabs: root.querySelectorAll('.tabs:not(.no-autoinit)'), - TapTarget: root.querySelectorAll('.tap-target:not(.no-autoinit)'), - Timepicker: root.querySelectorAll('.timepicker:not(.no-autoinit)'), - Tooltip: root.querySelectorAll('.tooltipped:not(.no-autoinit)'), - FloatingActionButton: root.querySelectorAll('.fixed-action-btn:not(.no-autoinit)') - }; - - for (var pluginName in registry) { - var plugin = M[pluginName]; - plugin.init(registry[pluginName]); - } -}; - -/** - * Generate approximated selector string for a jQuery object - * @param {jQuery} obj jQuery object to be parsed - * @returns {string} - */ -M.objectSelectorString = function (obj) { - var tagStr = obj.prop('tagName') || ''; - var idStr = obj.attr('id') || ''; - var classStr = obj.attr('class') || ''; - return (tagStr + idStr + classStr).replace(/\s/g, ''); -}; - -// Unique Random ID -M.guid = function () { - function s4() { - return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); - } - return function () { - return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4(); - }; -}(); - -/** - * Escapes hash from special characters - * @param {string} hash String returned from this.hash - * @returns {string} - */ -M.escapeHash = function (hash) { - return hash.replace(/(:|\.|\[|\]|,|=|\/)/g, '\\$1'); -}; - -/** - * @typedef {Object} Edges - * @property {Boolean} top If the top edge was exceeded - * @property {Boolean} right If the right edge was exceeded - * @property {Boolean} bottom If the bottom edge was exceeded - * @property {Boolean} left If the left edge was exceeded - */ - -/** - * @typedef {Object} Bounding - * @property {Number} left left offset coordinate - * @property {Number} top top offset coordinate - * @property {Number} width - * @property {Number} height - */ - -/** - * Escapes hash from special characters - * @param {Element} container Container element that acts as the boundary - * @param {Bounding} bounding element bounding that is being checked - * @param {Number} offset offset from edge that counts as exceeding - * @returns {Edges} - */ -M.checkWithinContainer = function (container, bounding, offset) { - var edges = { - top: false, - right: false, - bottom: false, - left: false - }; - - var containerRect = container.getBoundingClientRect(); - // If body element is smaller than viewport, use viewport height instead. - var containerBottom = container === document.body ? Math.max(containerRect.bottom, window.innerHeight) : containerRect.bottom; - - var scrollLeft = container.scrollLeft; - var scrollTop = container.scrollTop; - - var scrolledX = bounding.left - scrollLeft; - var scrolledY = bounding.top - scrollTop; - - // Check for container and viewport for each edge - if (scrolledX < containerRect.left + offset || scrolledX < offset) { - edges.left = true; - } - - if (scrolledX + bounding.width > containerRect.right - offset || scrolledX + bounding.width > window.innerWidth - offset) { - edges.right = true; - } - - if (scrolledY < containerRect.top + offset || scrolledY < offset) { - edges.top = true; - } - - if (scrolledY + bounding.height > containerBottom - offset || scrolledY + bounding.height > window.innerHeight - offset) { - edges.bottom = true; - } - - return edges; -}; - -M.checkPossibleAlignments = function (el, container, bounding, offset) { - var canAlign = { - top: true, - right: true, - bottom: true, - left: true, - spaceOnTop: null, - spaceOnRight: null, - spaceOnBottom: null, - spaceOnLeft: null - }; - - var containerAllowsOverflow = getComputedStyle(container).overflow === 'visible'; - var containerRect = container.getBoundingClientRect(); - var containerHeight = Math.min(containerRect.height, window.innerHeight); - var containerWidth = Math.min(containerRect.width, window.innerWidth); - var elOffsetRect = el.getBoundingClientRect(); - - var scrollLeft = container.scrollLeft; - var scrollTop = container.scrollTop; - - var scrolledX = bounding.left - scrollLeft; - var scrolledYTopEdge = bounding.top - scrollTop; - var scrolledYBottomEdge = bounding.top + elOffsetRect.height - scrollTop; - - // Check for container and viewport for left - canAlign.spaceOnRight = !containerAllowsOverflow ? containerWidth - (scrolledX + bounding.width) : window.innerWidth - (elOffsetRect.left + bounding.width); - if (canAlign.spaceOnRight < 0) { - canAlign.left = false; - } - - // Check for container and viewport for Right - canAlign.spaceOnLeft = !containerAllowsOverflow ? scrolledX - bounding.width + elOffsetRect.width : elOffsetRect.right - bounding.width; - if (canAlign.spaceOnLeft < 0) { - canAlign.right = false; - } - - // Check for container and viewport for Top - canAlign.spaceOnBottom = !containerAllowsOverflow ? containerHeight - (scrolledYTopEdge + bounding.height + offset) : window.innerHeight - (elOffsetRect.top + bounding.height + offset); - if (canAlign.spaceOnBottom < 0) { - canAlign.top = false; - } - - // Check for container and viewport for Bottom - canAlign.spaceOnTop = !containerAllowsOverflow ? scrolledYBottomEdge - (bounding.height - offset) : elOffsetRect.bottom - (bounding.height + offset); - if (canAlign.spaceOnTop < 0) { - canAlign.bottom = false; - } - - return canAlign; -}; - -M.getOverflowParent = function (element) { - if (element == null) { - return null; - } - - if (element === document.body || getComputedStyle(element).overflow !== 'visible') { - return element; - } - - return M.getOverflowParent(element.parentElement); -}; - -/** - * Gets id of component from a trigger - * @param {Element} trigger trigger - * @returns {string} - */ -M.getIdFromTrigger = function (trigger) { - var id = trigger.getAttribute('data-target'); - if (!id) { - id = trigger.getAttribute('href'); - if (id) { - id = id.slice(1); - } else { - id = ''; - } - } - return id; -}; - -/** - * Multi browser support for document scroll top - * @returns {Number} - */ -M.getDocumentScrollTop = function () { - return window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0; -}; - -/** - * Multi browser support for document scroll left - * @returns {Number} - */ -M.getDocumentScrollLeft = function () { - return window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft || 0; -}; - -/** - * @typedef {Object} Edges - * @property {Boolean} top If the top edge was exceeded - * @property {Boolean} right If the right edge was exceeded - * @property {Boolean} bottom If the bottom edge was exceeded - * @property {Boolean} left If the left edge was exceeded - */ - -/** - * @typedef {Object} Bounding - * @property {Number} left left offset coordinate - * @property {Number} top top offset coordinate - * @property {Number} width - * @property {Number} height - */ - -/** - * Get time in ms - * @license https://raw.github.com/jashkenas/underscore/master/LICENSE - * @type {function} - * @return {number} - */ -var getTime = Date.now || function () { - return new Date().getTime(); -}; - -/** - * Returns a function, that, when invoked, will only be triggered at most once - * during a given window of time. Normally, the throttled function will run - * as much as it can, without ever going more than once per `wait` duration; - * but if you'd like to disable the execution on the leading edge, pass - * `{leading: false}`. To disable execution on the trailing edge, ditto. - * @license https://raw.github.com/jashkenas/underscore/master/LICENSE - * @param {function} func - * @param {number} wait - * @param {Object=} options - * @returns {Function} - */ -M.throttle = function (func, wait, options) { - var context = void 0, - args = void 0, - result = void 0; - var timeout = null; - var previous = 0; - options || (options = {}); - var later = function () { - previous = options.leading === false ? 0 : getTime(); - timeout = null; - result = func.apply(context, args); - context = args = null; - }; - return function () { - var now = getTime(); - if (!previous && options.leading === false) previous = now; - var remaining = wait - (now - previous); - context = this; - args = arguments; - if (remaining <= 0) { - clearTimeout(timeout); - timeout = null; - previous = now; - result = func.apply(context, args); - context = args = null; - } else if (!timeout && options.trailing !== false) { - timeout = setTimeout(later, remaining); - } - return result; - }; -}; - -/* Feature detection */ -var passiveIfSupported = false; -try { - window.addEventListener("test", null, Object.defineProperty({}, "passive", { - get: function () { - passiveIfSupported = { passive: false }; - } - })); -} catch (err) {} -; /* - v2.2.0 - 2017 Julian Garnier - Released under the MIT license - */ -var $jscomp = { scope: {} };$jscomp.defineProperty = "function" == typeof Object.defineProperties ? Object.defineProperty : function (e, r, p) { - if (p.get || p.set) throw new TypeError("ES3 does not support getters and setters.");e != Array.prototype && e != Object.prototype && (e[r] = p.value); -};$jscomp.getGlobal = function (e) { - return "undefined" != typeof window && window === e ? e : "undefined" != typeof global && null != global ? global : e; -};$jscomp.global = $jscomp.getGlobal(this);$jscomp.SYMBOL_PREFIX = "jscomp_symbol_"; -$jscomp.initSymbol = function () { - $jscomp.initSymbol = function () {};$jscomp.global.Symbol || ($jscomp.global.Symbol = $jscomp.Symbol); -};$jscomp.symbolCounter_ = 0;$jscomp.Symbol = function (e) { - return $jscomp.SYMBOL_PREFIX + (e || "") + $jscomp.symbolCounter_++; -}; -$jscomp.initSymbolIterator = function () { - $jscomp.initSymbol();var e = $jscomp.global.Symbol.iterator;e || (e = $jscomp.global.Symbol.iterator = $jscomp.global.Symbol("iterator"));"function" != typeof Array.prototype[e] && $jscomp.defineProperty(Array.prototype, e, { configurable: !0, writable: !0, value: function () { - return $jscomp.arrayIterator(this); - } });$jscomp.initSymbolIterator = function () {}; -};$jscomp.arrayIterator = function (e) { - var r = 0;return $jscomp.iteratorPrototype(function () { - return r < e.length ? { done: !1, value: e[r++] } : { done: !0 }; - }); -}; -$jscomp.iteratorPrototype = function (e) { - $jscomp.initSymbolIterator();e = { next: e };e[$jscomp.global.Symbol.iterator] = function () { - return this; - };return e; -};$jscomp.array = $jscomp.array || {};$jscomp.iteratorFromArray = function (e, r) { - $jscomp.initSymbolIterator();e instanceof String && (e += "");var p = 0, - m = { next: function () { - if (p < e.length) { - var u = p++;return { value: r(u, e[u]), done: !1 }; - }m.next = function () { - return { done: !0, value: void 0 }; - };return m.next(); - } };m[Symbol.iterator] = function () { - return m; - };return m; -}; -$jscomp.polyfill = function (e, r, p, m) { - if (r) { - p = $jscomp.global;e = e.split(".");for (m = 0; m < e.length - 1; m++) { - var u = e[m];u in p || (p[u] = {});p = p[u]; - }e = e[e.length - 1];m = p[e];r = r(m);r != m && null != r && $jscomp.defineProperty(p, e, { configurable: !0, writable: !0, value: r }); - } -};$jscomp.polyfill("Array.prototype.keys", function (e) { - return e ? e : function () { - return $jscomp.iteratorFromArray(this, function (e) { - return e; - }); - }; -}, "es6-impl", "es3");var $jscomp$this = this; -(function (r) { - M.anime = r(); -})(function () { - function e(a) { - if (!h.col(a)) try { - return document.querySelectorAll(a); - } catch (c) {} - }function r(a, c) { - for (var d = a.length, b = 2 <= arguments.length ? arguments[1] : void 0, f = [], n = 0; n < d; n++) { - if (n in a) { - var k = a[n];c.call(b, k, n, a) && f.push(k); - } - }return f; - }function p(a) { - return a.reduce(function (a, d) { - return a.concat(h.arr(d) ? p(d) : d); - }, []); - }function m(a) { - if (h.arr(a)) return a; - h.str(a) && (a = e(a) || a);return a instanceof NodeList || a instanceof HTMLCollection ? [].slice.call(a) : [a]; - }function u(a, c) { - return a.some(function (a) { - return a === c; - }); - }function C(a) { - var c = {}, - d;for (d in a) { - c[d] = a[d]; - }return c; - }function D(a, c) { - var d = C(a), - b;for (b in a) { - d[b] = c.hasOwnProperty(b) ? c[b] : a[b]; - }return d; - }function z(a, c) { - var d = C(a), - b;for (b in c) { - d[b] = h.und(a[b]) ? c[b] : a[b]; - }return d; - }function T(a) { - a = a.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i, function (a, c, d, k) { - return c + c + d + d + k + k; - });var c = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a); - a = parseInt(c[1], 16);var d = parseInt(c[2], 16), - c = parseInt(c[3], 16);return "rgba(" + a + "," + d + "," + c + ",1)"; - }function U(a) { - function c(a, c, b) { - 0 > b && (b += 1);1 < b && --b;return b < 1 / 6 ? a + 6 * (c - a) * b : .5 > b ? c : b < 2 / 3 ? a + (c - a) * (2 / 3 - b) * 6 : a; - }var d = /hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(a) || /hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(a);a = parseInt(d[1]) / 360;var b = parseInt(d[2]) / 100, - f = parseInt(d[3]) / 100, - d = d[4] || 1;if (0 == b) f = b = a = f;else { - var n = .5 > f ? f * (1 + b) : f + b - f * b, - k = 2 * f - n, - f = c(k, n, a + 1 / 3), - b = c(k, n, a);a = c(k, n, a - 1 / 3); - }return "rgba(" + 255 * f + "," + 255 * b + "," + 255 * a + "," + d + ")"; - }function y(a) { - if (a = /([\+\-]?[0-9#\.]+)(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/.exec(a)) return a[2]; - }function V(a) { - if (-1 < a.indexOf("translate") || "perspective" === a) return "px";if (-1 < a.indexOf("rotate") || -1 < a.indexOf("skew")) return "deg"; - }function I(a, c) { - return h.fnc(a) ? a(c.target, c.id, c.total) : a; - }function E(a, c) { - if (c in a.style) return getComputedStyle(a).getPropertyValue(c.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase()) || "0"; - }function J(a, c) { - if (h.dom(a) && u(W, c)) return "transform";if (h.dom(a) && (a.getAttribute(c) || h.svg(a) && a[c])) return "attribute";if (h.dom(a) && "transform" !== c && E(a, c)) return "css";if (null != a[c]) return "object"; - }function X(a, c) { - var d = V(c), - d = -1 < c.indexOf("scale") ? 1 : 0 + d;a = a.style.transform;if (!a) return d;for (var b = [], f = [], n = [], k = /(\w+)\((.+?)\)/g; b = k.exec(a);) { - f.push(b[1]), n.push(b[2]); - }a = r(n, function (a, b) { - return f[b] === c; - });return a.length ? a[0] : d; - }function K(a, c) { - switch (J(a, c)) {case "transform": - return X(a, c);case "css": - return E(a, c);case "attribute": - return a.getAttribute(c);}return a[c] || 0; - }function L(a, c) { - var d = /^(\*=|\+=|-=)/.exec(a);if (!d) return a;var b = y(a) || 0;c = parseFloat(c);a = parseFloat(a.replace(d[0], ""));switch (d[0][0]) {case "+": - return c + a + b;case "-": - return c - a + b;case "*": - return c * a + b;} - }function F(a, c) { - return Math.sqrt(Math.pow(c.x - a.x, 2) + Math.pow(c.y - a.y, 2)); - }function M(a) { - a = a.points;for (var c = 0, d, b = 0; b < a.numberOfItems; b++) { - var f = a.getItem(b);0 < b && (c += F(d, f));d = f; - }return c; - }function N(a) { - if (a.getTotalLength) return a.getTotalLength();switch (a.tagName.toLowerCase()) {case "circle": - return 2 * Math.PI * a.getAttribute("r");case "rect": - return 2 * a.getAttribute("width") + 2 * a.getAttribute("height");case "line": - return F({ x: a.getAttribute("x1"), y: a.getAttribute("y1") }, { x: a.getAttribute("x2"), y: a.getAttribute("y2") });case "polyline": - return M(a);case "polygon": - var c = a.points;return M(a) + F(c.getItem(c.numberOfItems - 1), c.getItem(0));} - }function Y(a, c) { - function d(b) { - b = void 0 === b ? 0 : b;return a.el.getPointAtLength(1 <= c + b ? c + b : 0); - }var b = d(), - f = d(-1), - n = d(1);switch (a.property) {case "x": - return b.x;case "y": - return b.y; - case "angle": - return 180 * Math.atan2(n.y - f.y, n.x - f.x) / Math.PI;} - }function O(a, c) { - var d = /-?\d*\.?\d+/g, - b;b = h.pth(a) ? a.totalLength : a;if (h.col(b)) { - if (h.rgb(b)) { - var f = /rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(b);b = f ? "rgba(" + f[1] + ",1)" : b; - } else b = h.hex(b) ? T(b) : h.hsl(b) ? U(b) : void 0; - } else f = (f = y(b)) ? b.substr(0, b.length - f.length) : b, b = c && !/\s/g.test(b) ? f + c : f;b += "";return { original: b, numbers: b.match(d) ? b.match(d).map(Number) : [0], strings: h.str(a) || c ? b.split(d) : [] }; - }function P(a) { - a = a ? p(h.arr(a) ? a.map(m) : m(a)) : [];return r(a, function (a, d, b) { - return b.indexOf(a) === d; - }); - }function Z(a) { - var c = P(a);return c.map(function (a, b) { - return { target: a, id: b, total: c.length }; - }); - }function aa(a, c) { - var d = C(c);if (h.arr(a)) { - var b = a.length;2 !== b || h.obj(a[0]) ? h.fnc(c.duration) || (d.duration = c.duration / b) : a = { value: a }; - }return m(a).map(function (a, b) { - b = b ? 0 : c.delay;a = h.obj(a) && !h.pth(a) ? a : { value: a };h.und(a.delay) && (a.delay = b);return a; - }).map(function (a) { - return z(a, d); - }); - }function ba(a, c) { - var d = {}, - b;for (b in a) { - var f = I(a[b], c);h.arr(f) && (f = f.map(function (a) { - return I(a, c); - }), 1 === f.length && (f = f[0]));d[b] = f; - }d.duration = parseFloat(d.duration);d.delay = parseFloat(d.delay);return d; - }function ca(a) { - return h.arr(a) ? A.apply(this, a) : Q[a]; - }function da(a, c) { - var d;return a.tweens.map(function (b) { - b = ba(b, c);var f = b.value, - e = K(c.target, a.name), - k = d ? d.to.original : e, - k = h.arr(f) ? f[0] : k, - w = L(h.arr(f) ? f[1] : f, k), - e = y(w) || y(k) || y(e);b.from = O(k, e);b.to = O(w, e);b.start = d ? d.end : a.offset;b.end = b.start + b.delay + b.duration;b.easing = ca(b.easing);b.elasticity = (1E3 - Math.min(Math.max(b.elasticity, 1), 999)) / 1E3;b.isPath = h.pth(f);b.isColor = h.col(b.from.original);b.isColor && (b.round = 1);return d = b; - }); - }function ea(a, c) { - return r(p(a.map(function (a) { - return c.map(function (b) { - var c = J(a.target, b.name);if (c) { - var d = da(b, a);b = { type: c, property: b.name, animatable: a, tweens: d, duration: d[d.length - 1].end, delay: d[0].delay }; - } else b = void 0;return b; - }); - })), function (a) { - return !h.und(a); - }); - }function R(a, c, d, b) { - var f = "delay" === a;return c.length ? (f ? Math.min : Math.max).apply(Math, c.map(function (b) { - return b[a]; - })) : f ? b.delay : d.offset + b.delay + b.duration; - }function fa(a) { - var c = D(ga, a), - d = D(S, a), - b = Z(a.targets), - f = [], - e = z(c, d), - k;for (k in a) { - e.hasOwnProperty(k) || "targets" === k || f.push({ name: k, offset: e.offset, tweens: aa(a[k], d) }); - }a = ea(b, f);return z(c, { children: [], animatables: b, animations: a, duration: R("duration", a, c, d), delay: R("delay", a, c, d) }); - }function q(a) { - function c() { - return window.Promise && new Promise(function (a) { - return p = a; - }); - }function d(a) { - return g.reversed ? g.duration - a : a; - }function b(a) { - for (var b = 0, c = {}, d = g.animations, f = d.length; b < f;) { - var e = d[b], - k = e.animatable, - h = e.tweens, - n = h.length - 1, - l = h[n];n && (l = r(h, function (b) { - return a < b.end; - })[0] || l);for (var h = Math.min(Math.max(a - l.start - l.delay, 0), l.duration) / l.duration, w = isNaN(h) ? 1 : l.easing(h, l.elasticity), h = l.to.strings, p = l.round, n = [], m = void 0, m = l.to.numbers.length, t = 0; t < m; t++) { - var x = void 0, - x = l.to.numbers[t], - q = l.from.numbers[t], - x = l.isPath ? Y(l.value, w * x) : q + w * (x - q);p && (l.isColor && 2 < t || (x = Math.round(x * p) / p));n.push(x); - }if (l = h.length) for (m = h[0], w = 0; w < l; w++) { - p = h[w + 1], t = n[w], isNaN(t) || (m = p ? m + (t + p) : m + (t + " ")); - } else m = n[0];ha[e.type](k.target, e.property, m, c, k.id);e.currentValue = m;b++; - }if (b = Object.keys(c).length) for (d = 0; d < b; d++) { - H || (H = E(document.body, "transform") ? "transform" : "-webkit-transform"), g.animatables[d].target.style[H] = c[d].join(" "); - }g.currentTime = a;g.progress = a / g.duration * 100; - }function f(a) { - if (g[a]) g[a](g); - }function e() { - g.remaining && !0 !== g.remaining && g.remaining--; - }function k(a) { - var k = g.duration, - n = g.offset, - w = n + g.delay, - r = g.currentTime, - x = g.reversed, - q = d(a);if (g.children.length) { - var u = g.children, - v = u.length; - if (q >= g.currentTime) for (var G = 0; G < v; G++) { - u[G].seek(q); - } else for (; v--;) { - u[v].seek(q); - } - }if (q >= w || !k) g.began || (g.began = !0, f("begin")), f("run");if (q > n && q < k) b(q);else if (q <= n && 0 !== r && (b(0), x && e()), q >= k && r !== k || !k) b(k), x || e();f("update");a >= k && (g.remaining ? (t = h, "alternate" === g.direction && (g.reversed = !g.reversed)) : (g.pause(), g.completed || (g.completed = !0, f("complete"), "Promise" in window && (p(), m = c()))), l = 0); - }a = void 0 === a ? {} : a;var h, - t, - l = 0, - p = null, - m = c(), - g = fa(a);g.reset = function () { - var a = g.direction, - c = g.loop;g.currentTime = 0;g.progress = 0;g.paused = !0;g.began = !1;g.completed = !1;g.reversed = "reverse" === a;g.remaining = "alternate" === a && 1 === c ? 2 : c;b(0);for (a = g.children.length; a--;) { - g.children[a].reset(); - } - };g.tick = function (a) { - h = a;t || (t = h);k((l + h - t) * q.speed); - };g.seek = function (a) { - k(d(a)); - };g.pause = function () { - var a = v.indexOf(g);-1 < a && v.splice(a, 1);g.paused = !0; - };g.play = function () { - g.paused && (g.paused = !1, t = 0, l = d(g.currentTime), v.push(g), B || ia()); - };g.reverse = function () { - g.reversed = !g.reversed;t = 0;l = d(g.currentTime); - };g.restart = function () { - g.pause(); - g.reset();g.play(); - };g.finished = m;g.reset();g.autoplay && g.play();return g; - }var ga = { update: void 0, begin: void 0, run: void 0, complete: void 0, loop: 1, direction: "normal", autoplay: !0, offset: 0 }, - S = { duration: 1E3, delay: 0, easing: "easeOutElastic", elasticity: 500, round: 0 }, - W = "translateX translateY translateZ rotate rotateX rotateY rotateZ scale scaleX scaleY scaleZ skewX skewY perspective".split(" "), - H, - h = { arr: function (a) { - return Array.isArray(a); - }, obj: function (a) { - return -1 < Object.prototype.toString.call(a).indexOf("Object"); - }, - pth: function (a) { - return h.obj(a) && a.hasOwnProperty("totalLength"); - }, svg: function (a) { - return a instanceof SVGElement; - }, dom: function (a) { - return a.nodeType || h.svg(a); - }, str: function (a) { - return "string" === typeof a; - }, fnc: function (a) { - return "function" === typeof a; - }, und: function (a) { - return "undefined" === typeof a; - }, hex: function (a) { - return (/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(a) - ); - }, rgb: function (a) { - return (/^rgb/.test(a) - ); - }, hsl: function (a) { - return (/^hsl/.test(a) - ); - }, col: function (a) { - return h.hex(a) || h.rgb(a) || h.hsl(a); - } }, - A = function () { - function a(a, d, b) { - return (((1 - 3 * b + 3 * d) * a + (3 * b - 6 * d)) * a + 3 * d) * a; - }return function (c, d, b, f) { - if (0 <= c && 1 >= c && 0 <= b && 1 >= b) { - var e = new Float32Array(11);if (c !== d || b !== f) for (var k = 0; 11 > k; ++k) { - e[k] = a(.1 * k, c, b); - }return function (k) { - if (c === d && b === f) return k;if (0 === k) return 0;if (1 === k) return 1;for (var h = 0, l = 1; 10 !== l && e[l] <= k; ++l) { - h += .1; - }--l;var l = h + (k - e[l]) / (e[l + 1] - e[l]) * .1, - n = 3 * (1 - 3 * b + 3 * c) * l * l + 2 * (3 * b - 6 * c) * l + 3 * c;if (.001 <= n) { - for (h = 0; 4 > h; ++h) { - n = 3 * (1 - 3 * b + 3 * c) * l * l + 2 * (3 * b - 6 * c) * l + 3 * c;if (0 === n) break;var m = a(l, c, b) - k, - l = l - m / n; - }k = l; - } else if (0 === n) k = l;else { - var l = h, - h = h + .1, - g = 0;do { - m = l + (h - l) / 2, n = a(m, c, b) - k, 0 < n ? h = m : l = m; - } while (1e-7 < Math.abs(n) && 10 > ++g);k = m; - }return a(k, d, f); - }; - } - }; - }(), - Q = function () { - function a(a, b) { - return 0 === a || 1 === a ? a : -Math.pow(2, 10 * (a - 1)) * Math.sin(2 * (a - 1 - b / (2 * Math.PI) * Math.asin(1)) * Math.PI / b); - }var c = "Quad Cubic Quart Quint Sine Expo Circ Back Elastic".split(" "), - d = { In: [[.55, .085, .68, .53], [.55, .055, .675, .19], [.895, .03, .685, .22], [.755, .05, .855, .06], [.47, 0, .745, .715], [.95, .05, .795, .035], [.6, .04, .98, .335], [.6, -.28, .735, .045], a], Out: [[.25, .46, .45, .94], [.215, .61, .355, 1], [.165, .84, .44, 1], [.23, 1, .32, 1], [.39, .575, .565, 1], [.19, 1, .22, 1], [.075, .82, .165, 1], [.175, .885, .32, 1.275], function (b, c) { - return 1 - a(1 - b, c); - }], InOut: [[.455, .03, .515, .955], [.645, .045, .355, 1], [.77, 0, .175, 1], [.86, 0, .07, 1], [.445, .05, .55, .95], [1, 0, 0, 1], [.785, .135, .15, .86], [.68, -.55, .265, 1.55], function (b, c) { - return .5 > b ? a(2 * b, c) / 2 : 1 - a(-2 * b + 2, c) / 2; - }] }, - b = { linear: A(.25, .25, .75, .75) }, - f = {}, - e;for (e in d) { - f.type = e, d[f.type].forEach(function (a) { - return function (d, f) { - b["ease" + a.type + c[f]] = h.fnc(d) ? d : A.apply($jscomp$this, d); - }; - }(f)), f = { type: f.type }; - }return b; - }(), - ha = { css: function (a, c, d) { - return a.style[c] = d; - }, attribute: function (a, c, d) { - return a.setAttribute(c, d); - }, object: function (a, c, d) { - return a[c] = d; - }, transform: function (a, c, d, b, f) { - b[f] || (b[f] = []);b[f].push(c + "(" + d + ")"); - } }, - v = [], - B = 0, - ia = function () { - function a() { - B = requestAnimationFrame(c); - }function c(c) { - var b = v.length;if (b) { - for (var d = 0; d < b;) { - v[d] && v[d].tick(c), d++; - }a(); - } else cancelAnimationFrame(B), B = 0; - }return a; - }();q.version = "2.2.0";q.speed = 1;q.running = v;q.remove = function (a) { - a = P(a);for (var c = v.length; c--;) { - for (var d = v[c], b = d.animations, f = b.length; f--;) { - u(a, b[f].animatable.target) && (b.splice(f, 1), b.length || d.pause()); - } - } - };q.getValue = K;q.path = function (a, c) { - var d = h.str(a) ? e(a)[0] : a, - b = c || 100;return function (a) { - return { el: d, property: a, totalLength: N(d) * (b / 100) }; - }; - };q.setDashoffset = function (a) { - var c = N(a);a.setAttribute("stroke-dasharray", c);return c; - };q.bezier = A;q.easings = Q;q.timeline = function (a) { - var c = q(a);c.pause();c.duration = 0;c.add = function (d) { - c.children.forEach(function (a) { - a.began = !0;a.completed = !0; - });m(d).forEach(function (b) { - var d = z(b, D(S, a || {}));d.targets = d.targets || a.targets;b = c.duration;var e = d.offset;d.autoplay = !1;d.direction = c.direction;d.offset = h.und(e) ? b : L(e, b);c.began = !0;c.completed = !0;c.seek(d.offset);d = q(d);d.began = !0;d.completed = !0;d.duration > b && (c.duration = d.duration);c.children.push(d); - });c.seek(0);c.reset();c.autoplay && c.restart();return c; - };return c; - };q.random = function (a, c) { - return Math.floor(Math.random() * (c - a + 1)) + a; - };return q; -}); -;(function ($, anim) { - 'use strict'; - - var _defaults = { - accordion: true, - onOpenStart: undefined, - onOpenEnd: undefined, - onCloseStart: undefined, - onCloseEnd: undefined, - inDuration: 300, - outDuration: 300 - }; - - /** - * @class - * - */ - - var Collapsible = function (_Component) { - _inherits(Collapsible, _Component); - - /** - * Construct Collapsible instance - * @constructor - * @param {Element} el - * @param {Object} options - */ - function Collapsible(el, options) { - _classCallCheck(this, Collapsible); - - var _this3 = _possibleConstructorReturn(this, (Collapsible.__proto__ || Object.getPrototypeOf(Collapsible)).call(this, Collapsible, el, options)); - - _this3.el.M_Collapsible = _this3; - - /** - * Options for the collapsible - * @member Collapsible#options - * @prop {Boolean} [accordion=false] - Type of the collapsible - * @prop {Function} onOpenStart - Callback function called before collapsible is opened - * @prop {Function} onOpenEnd - Callback function called after collapsible is opened - * @prop {Function} onCloseStart - Callback function called before collapsible is closed - * @prop {Function} onCloseEnd - Callback function called after collapsible is closed - * @prop {Number} inDuration - Transition in duration in milliseconds. - * @prop {Number} outDuration - Transition duration in milliseconds. - */ - _this3.options = $.extend({}, Collapsible.defaults, options); - - // Setup tab indices - _this3.$headers = _this3.$el.children('li').children('.collapsible-header'); - _this3.$headers.attr('tabindex', 0); - - _this3._setupEventHandlers(); - - // Open first active - var $activeBodies = _this3.$el.children('li.active').children('.collapsible-body'); - if (_this3.options.accordion) { - // Handle Accordion - $activeBodies.first().css('display', 'block'); - } else { - // Handle Expandables - $activeBodies.css('display', 'block'); - } - return _this3; - } - - _createClass(Collapsible, [{ - key: "destroy", - - - /** - * Teardown component - */ - value: function destroy() { - this._removeEventHandlers(); - this.el.M_Collapsible = undefined; - } - - /** - * Setup Event Handlers - */ - - }, { - key: "_setupEventHandlers", - value: function _setupEventHandlers() { - var _this4 = this; - - this._handleCollapsibleClickBound = this._handleCollapsibleClick.bind(this); - this._handleCollapsibleKeydownBound = this._handleCollapsibleKeydown.bind(this); - this.el.addEventListener('click', this._handleCollapsibleClickBound); - this.$headers.each(function (header) { - header.addEventListener('keydown', _this4._handleCollapsibleKeydownBound); - }); - } - - /** - * Remove Event Handlers - */ - - }, { - key: "_removeEventHandlers", - value: function _removeEventHandlers() { - var _this5 = this; - - this.el.removeEventListener('click', this._handleCollapsibleClickBound); - this.$headers.each(function (header) { - header.removeEventListener('keydown', _this5._handleCollapsibleKeydownBound); - }); - } - - /** - * Handle Collapsible Click - * @param {Event} e - */ - - }, { - key: "_handleCollapsibleClick", - value: function _handleCollapsibleClick(e) { - var $header = $(e.target).closest('.collapsible-header'); - if (e.target && $header.length) { - var $collapsible = $header.closest('.collapsible'); - if ($collapsible[0] === this.el) { - var $collapsibleLi = $header.closest('li'); - var $collapsibleLis = $collapsible.children('li'); - var isActive = $collapsibleLi[0].classList.contains('active'); - var index = $collapsibleLis.index($collapsibleLi); - - if (isActive) { - this.close(index); - } else { - this.open(index); - } - } - } - } - - /** - * Handle Collapsible Keydown - * @param {Event} e - */ - - }, { - key: "_handleCollapsibleKeydown", - value: function _handleCollapsibleKeydown(e) { - if (e.keyCode === 13) { - this._handleCollapsibleClickBound(e); - } - } - - /** - * Animate in collapsible slide - * @param {Number} index - 0th index of slide - */ - - }, { - key: "_animateIn", - value: function _animateIn(index) { - var _this6 = this; - - var $collapsibleLi = this.$el.children('li').eq(index); - if ($collapsibleLi.length) { - var $body = $collapsibleLi.children('.collapsible-body'); - - anim.remove($body[0]); - $body.css({ - display: 'block', - overflow: 'hidden', - height: 0, - paddingTop: '', - paddingBottom: '' - }); - - var pTop = $body.css('padding-top'); - var pBottom = $body.css('padding-bottom'); - var finalHeight = $body[0].scrollHeight; - $body.css({ - paddingTop: 0, - paddingBottom: 0 - }); - - anim({ - targets: $body[0], - height: finalHeight, - paddingTop: pTop, - paddingBottom: pBottom, - duration: this.options.inDuration, - easing: 'easeInOutCubic', - complete: function (anim) { - $body.css({ - overflow: '', - paddingTop: '', - paddingBottom: '', - height: '' - }); - - // onOpenEnd callback - if (typeof _this6.options.onOpenEnd === 'function') { - _this6.options.onOpenEnd.call(_this6, $collapsibleLi[0]); - } - } - }); - } - } - - /** - * Animate out collapsible slide - * @param {Number} index - 0th index of slide to open - */ - - }, { - key: "_animateOut", - value: function _animateOut(index) { - var _this7 = this; - - var $collapsibleLi = this.$el.children('li').eq(index); - if ($collapsibleLi.length) { - var $body = $collapsibleLi.children('.collapsible-body'); - anim.remove($body[0]); - $body.css('overflow', 'hidden'); - anim({ - targets: $body[0], - height: 0, - paddingTop: 0, - paddingBottom: 0, - duration: this.options.outDuration, - easing: 'easeInOutCubic', - complete: function () { - $body.css({ - height: '', - overflow: '', - padding: '', - display: '' - }); - - // onCloseEnd callback - if (typeof _this7.options.onCloseEnd === 'function') { - _this7.options.onCloseEnd.call(_this7, $collapsibleLi[0]); - } - } - }); - } - } - - /** - * Open Collapsible - * @param {Number} index - 0th index of slide - */ - - }, { - key: "open", - value: function open(index) { - var _this8 = this; - - var $collapsibleLi = this.$el.children('li').eq(index); - if ($collapsibleLi.length && !$collapsibleLi[0].classList.contains('active')) { - // onOpenStart callback - if (typeof this.options.onOpenStart === 'function') { - this.options.onOpenStart.call(this, $collapsibleLi[0]); - } - - // Handle accordion behavior - if (this.options.accordion) { - var $collapsibleLis = this.$el.children('li'); - var $activeLis = this.$el.children('li.active'); - $activeLis.each(function (el) { - var index = $collapsibleLis.index($(el)); - _this8.close(index); - }); - } - - // Animate in - $collapsibleLi[0].classList.add('active'); - this._animateIn(index); - } - } - - /** - * Close Collapsible - * @param {Number} index - 0th index of slide - */ - - }, { - key: "close", - value: function close(index) { - var $collapsibleLi = this.$el.children('li').eq(index); - if ($collapsibleLi.length && $collapsibleLi[0].classList.contains('active')) { - // onCloseStart callback - if (typeof this.options.onCloseStart === 'function') { - this.options.onCloseStart.call(this, $collapsibleLi[0]); - } - - // Animate out - $collapsibleLi[0].classList.remove('active'); - this._animateOut(index); - } - } - }], [{ - key: "init", - value: function init(els, options) { - return _get(Collapsible.__proto__ || Object.getPrototypeOf(Collapsible), "init", this).call(this, this, els, options); - } - - /** - * Get Instance - */ - - }, { - key: "getInstance", - value: function getInstance(el) { - var domElem = !!el.jquery ? el[0] : el; - return domElem.M_Collapsible; - } - }, { - key: "defaults", - get: function () { - return _defaults; - } - }]); - - return Collapsible; - }(Component); - - M.Collapsible = Collapsible; - - if (M.jQueryLoaded) { - M.initializeJqueryWrapper(Collapsible, 'collapsible', 'M_Collapsible'); - } -})(cash, M.anime); -;(function ($, anim) { - 'use strict'; - - var _defaults = { - alignment: 'left', - autoFocus: true, - constrainWidth: true, - container: null, - coverTrigger: true, - closeOnClick: true, - hover: false, - inDuration: 150, - outDuration: 250, - onOpenStart: null, - onOpenEnd: null, - onCloseStart: null, - onCloseEnd: null, - onItemClick: null - }; - - /** - * @class - */ - - var Dropdown = function (_Component2) { - _inherits(Dropdown, _Component2); - - function Dropdown(el, options) { - _classCallCheck(this, Dropdown); - - var _this9 = _possibleConstructorReturn(this, (Dropdown.__proto__ || Object.getPrototypeOf(Dropdown)).call(this, Dropdown, el, options)); - - _this9.el.M_Dropdown = _this9; - Dropdown._dropdowns.push(_this9); - - _this9.id = M.getIdFromTrigger(el); - _this9.dropdownEl = document.getElementById(_this9.id); - _this9.$dropdownEl = $(_this9.dropdownEl); - - /** - * Options for the dropdown - * @member Dropdown#options - * @prop {String} [alignment='left'] - Edge which the dropdown is aligned to - * @prop {Boolean} [autoFocus=true] - Automatically focus dropdown el for keyboard - * @prop {Boolean} [constrainWidth=true] - Constrain width to width of the button - * @prop {Element} container - Container element to attach dropdown to (optional) - * @prop {Boolean} [coverTrigger=true] - Place dropdown over trigger - * @prop {Boolean} [closeOnClick=true] - Close on click of dropdown item - * @prop {Boolean} [hover=false] - Open dropdown on hover - * @prop {Number} [inDuration=150] - Duration of open animation in ms - * @prop {Number} [outDuration=250] - Duration of close animation in ms - * @prop {Function} onOpenStart - Function called when dropdown starts opening - * @prop {Function} onOpenEnd - Function called when dropdown finishes opening - * @prop {Function} onCloseStart - Function called when dropdown starts closing - * @prop {Function} onCloseEnd - Function called when dropdown finishes closing - */ - _this9.options = $.extend({}, Dropdown.defaults, options); - - /** - * Describes open/close state of dropdown - * @type {Boolean} - */ - _this9.isOpen = false; - - /** - * Describes if dropdown content is scrollable - * @type {Boolean} - */ - _this9.isScrollable = false; - - /** - * Describes if touch moving on dropdown content - * @type {Boolean} - */ - _this9.isTouchMoving = false; - - _this9.focusedIndex = -1; - _this9.filterQuery = []; - - // Move dropdown-content after dropdown-trigger - _this9._moveDropdown(); - - _this9._makeDropdownFocusable(); - _this9._resetFilterQueryBound = _this9._resetFilterQuery.bind(_this9); - _this9._handleDocumentClickBound = _this9._handleDocumentClick.bind(_this9); - _this9._handleDocumentTouchmoveBound = _this9._handleDocumentTouchmove.bind(_this9); - _this9._handleDropdownClickBound = _this9._handleDropdownClick.bind(_this9); - _this9._handleDropdownKeydownBound = _this9._handleDropdownKeydown.bind(_this9); - _this9._handleTriggerKeydownBound = _this9._handleTriggerKeydown.bind(_this9); - _this9._setupEventHandlers(); - return _this9; - } - - _createClass(Dropdown, [{ - key: "destroy", - - - /** - * Teardown component - */ - value: function destroy() { - this._resetDropdownStyles(); - this._removeEventHandlers(); - Dropdown._dropdowns.splice(Dropdown._dropdowns.indexOf(this), 1); - this.el.M_Dropdown = undefined; - } - - /** - * Setup Event Handlers - */ - - }, { - key: "_setupEventHandlers", - value: function _setupEventHandlers() { - // Trigger keydown handler - this.el.addEventListener('keydown', this._handleTriggerKeydownBound); - - // Item click handler - this.dropdownEl.addEventListener('click', this._handleDropdownClickBound); - - // Hover event handlers - if (this.options.hover) { - this._handleMouseEnterBound = this._handleMouseEnter.bind(this); - this.el.addEventListener('mouseenter', this._handleMouseEnterBound); - this._handleMouseLeaveBound = this._handleMouseLeave.bind(this); - this.el.addEventListener('mouseleave', this._handleMouseLeaveBound); - this.dropdownEl.addEventListener('mouseleave', this._handleMouseLeaveBound); - - // Click event handlers - } else { - this._handleClickBound = this._handleClick.bind(this); - this.el.addEventListener('click', this._handleClickBound); - } - } - - /** - * Remove Event Handlers - */ - - }, { - key: "_removeEventHandlers", - value: function _removeEventHandlers() { - this.el.removeEventListener('keydown', this._handleTriggerKeydownBound); - this.dropdownEl.removeEventListener('click', this._handleDropdownClickBound); - - if (this.options.hover) { - this.el.removeEventListener('mouseenter', this._handleMouseEnterBound); - this.el.removeEventListener('mouseleave', this._handleMouseLeaveBound); - this.dropdownEl.removeEventListener('mouseleave', this._handleMouseLeaveBound); - } else { - this.el.removeEventListener('click', this._handleClickBound); - } - } - }, { - key: "_setupTemporaryEventHandlers", - value: function _setupTemporaryEventHandlers() { - // Use capture phase event handler to prevent click - document.body.addEventListener('click', this._handleDocumentClickBound, true); - document.body.addEventListener('touchend', this._handleDocumentClickBound); - document.body.addEventListener('touchmove', this._handleDocumentTouchmoveBound); - this.dropdownEl.addEventListener('keydown', this._handleDropdownKeydownBound); - } - }, { - key: "_removeTemporaryEventHandlers", - value: function _removeTemporaryEventHandlers() { - // Use capture phase event handler to prevent click - document.body.removeEventListener('click', this._handleDocumentClickBound, true); - document.body.removeEventListener('touchend', this._handleDocumentClickBound); - document.body.removeEventListener('touchmove', this._handleDocumentTouchmoveBound); - this.dropdownEl.removeEventListener('keydown', this._handleDropdownKeydownBound); - } - }, { - key: "_handleClick", - value: function _handleClick(e) { - e.preventDefault(); - this.open(); - } - }, { - key: "_handleMouseEnter", - value: function _handleMouseEnter() { - this.open(); - } - }, { - key: "_handleMouseLeave", - value: function _handleMouseLeave(e) { - var toEl = e.toElement || e.relatedTarget; - var leaveToDropdownContent = !!$(toEl).closest('.dropdown-content').length; - var leaveToActiveDropdownTrigger = false; - - var $closestTrigger = $(toEl).closest('.dropdown-trigger'); - if ($closestTrigger.length && !!$closestTrigger[0].M_Dropdown && $closestTrigger[0].M_Dropdown.isOpen) { - leaveToActiveDropdownTrigger = true; - } - - // Close hover dropdown if mouse did not leave to either active dropdown-trigger or dropdown-content - if (!leaveToActiveDropdownTrigger && !leaveToDropdownContent) { - this.close(); - } - } - }, { - key: "_handleDocumentClick", - value: function _handleDocumentClick(e) { - var _this10 = this; - - var $target = $(e.target); - if (this.options.closeOnClick && $target.closest('.dropdown-content').length && !this.isTouchMoving) { - // isTouchMoving to check if scrolling on mobile. - setTimeout(function () { - _this10.close(); - }, 0); - } else if ($target.closest('.dropdown-trigger').length || !$target.closest('.dropdown-content').length) { - setTimeout(function () { - _this10.close(); - }, 0); - } - this.isTouchMoving = false; - } - }, { - key: "_handleTriggerKeydown", - value: function _handleTriggerKeydown(e) { - // ARROW DOWN OR ENTER WHEN SELECT IS CLOSED - open Dropdown - if ((e.which === M.keys.ARROW_DOWN || e.which === M.keys.ENTER) && !this.isOpen) { - e.preventDefault(); - this.open(); - } - } - - /** - * Handle Document Touchmove - * @param {Event} e - */ - - }, { - key: "_handleDocumentTouchmove", - value: function _handleDocumentTouchmove(e) { - var $target = $(e.target); - if ($target.closest('.dropdown-content').length) { - this.isTouchMoving = true; - } - } - - /** - * Handle Dropdown Click - * @param {Event} e - */ - - }, { - key: "_handleDropdownClick", - value: function _handleDropdownClick(e) { - // onItemClick callback - if (typeof this.options.onItemClick === 'function') { - var itemEl = $(e.target).closest('li')[0]; - this.options.onItemClick.call(this, itemEl); - } - } - - /** - * Handle Dropdown Keydown - * @param {Event} e - */ - - }, { - key: "_handleDropdownKeydown", - value: function _handleDropdownKeydown(e) { - if (e.which === M.keys.TAB) { - e.preventDefault(); - this.close(); - - // Navigate down dropdown list - } else if ((e.which === M.keys.ARROW_DOWN || e.which === M.keys.ARROW_UP) && this.isOpen) { - e.preventDefault(); - var direction = e.which === M.keys.ARROW_DOWN ? 1 : -1; - var newFocusedIndex = this.focusedIndex; - var foundNewIndex = false; - do { - newFocusedIndex = newFocusedIndex + direction; - - if (!!this.dropdownEl.children[newFocusedIndex] && this.dropdownEl.children[newFocusedIndex].tabIndex !== -1) { - foundNewIndex = true; - break; - } - } while (newFocusedIndex < this.dropdownEl.children.length && newFocusedIndex >= 0); - - if (foundNewIndex) { - // Remove active class from old element - if (this.focusedIndex >= 0) this.dropdownEl.children[this.focusedIndex].classList.remove('active'); - this.focusedIndex = newFocusedIndex; - this._focusFocusedItem(); - } - - // ENTER selects choice on focused item - } else if (e.which === M.keys.ENTER && this.isOpen) { - // Search for and ") + ''; - } - }, { - key: "renderRow", - value: function renderRow(days, isRTL, isRowSelected) { - return '' + (isRTL ? days.reverse() : days).join('') + ''; - } - }, { - key: "renderTable", - value: function renderTable(opts, data, randId) { - return '
      ' + this.renderHead(opts) + this.renderBody(data) + '
      '; - } - }, { - key: "renderHead", - value: function renderHead(opts) { - var i = void 0, - arr = []; - for (i = 0; i < 7; i++) { - arr.push("" + this.renderDayName(opts, i, true) + ""); - } - return '' + (opts.isRTL ? arr.reverse() : arr).join('') + ''; - } - }, { - key: "renderBody", - value: function renderBody(rows) { - return '' + rows.join('') + ''; - } - }, { - key: "renderTitle", - value: function renderTitle(instance, c, year, month, refYear, randId) { - var i = void 0, - j = void 0, - arr = void 0, - opts = this.options, - isMinYear = year === opts.minYear, - isMaxYear = year === opts.maxYear, - html = '
      ', - monthHtml = void 0, - yearHtml = void 0, - prev = true, - next = true; - - for (arr = [], i = 0; i < 12; i++) { - arr.push(''); - } - - monthHtml = ''; - - if ($.isArray(opts.yearRange)) { - i = opts.yearRange[0]; - j = opts.yearRange[1] + 1; - } else { - i = year - opts.yearRange; - j = 1 + year + opts.yearRange; - } - - for (arr = []; i < j && i <= opts.maxYear; i++) { - if (i >= opts.minYear) { - arr.push(""); - } - } - if (opts.yearRangeReverse) { - arr.reverse(); - } - - yearHtml = ""; - - var leftArrow = ''; - html += ""; - - html += '
      '; - if (opts.showMonthAfterYear) { - html += yearHtml + monthHtml; - } else { - html += monthHtml + yearHtml; - } - html += '
      '; - - if (isMinYear && (month === 0 || opts.minMonth >= month)) { - prev = false; - } - - if (isMaxYear && (month === 11 || opts.maxMonth <= month)) { - next = false; - } - - var rightArrow = ''; - html += ""; - - return html += '
      '; - } - - /** - * refresh the HTML - */ - - }, { - key: "draw", - value: function draw(force) { - if (!this.isOpen && !force) { - return; - } - var opts = this.options, - minYear = opts.minYear, - maxYear = opts.maxYear, - minMonth = opts.minMonth, - maxMonth = opts.maxMonth, - html = '', - randId = void 0; - - if (this._y <= minYear) { - this._y = minYear; - if (!isNaN(minMonth) && this._m < minMonth) { - this._m = minMonth; - } - } - if (this._y >= maxYear) { - this._y = maxYear; - if (!isNaN(maxMonth) && this._m > maxMonth) { - this._m = maxMonth; - } - } - - randId = 'datepicker-title-' + Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 2); - - for (var c = 0; c < 1; c++) { - this._renderDateDisplay(); - html += this.renderTitle(this, c, this.calendars[c].year, this.calendars[c].month, this.calendars[0].year, randId) + this.render(this.calendars[c].year, this.calendars[c].month, randId); - } - - this.destroySelects(); - - this.calendarEl.innerHTML = html; - - // Init Materialize Select - var yearSelect = this.calendarEl.querySelector('.orig-select-year'); - var monthSelect = this.calendarEl.querySelector('.orig-select-month'); - M.FormSelect.init(yearSelect, { - classes: 'select-year', - dropdownOptions: { container: document.body, constrainWidth: false } - }); - M.FormSelect.init(monthSelect, { - classes: 'select-month', - dropdownOptions: { container: document.body, constrainWidth: false } - }); - - // Add change handlers for select - yearSelect.addEventListener('change', this._handleYearChange.bind(this)); - monthSelect.addEventListener('change', this._handleMonthChange.bind(this)); - - if (typeof this.options.onDraw === 'function') { - this.options.onDraw(this); - } - } - - /** - * Setup Event Handlers - */ - - }, { - key: "_setupEventHandlers", - value: function _setupEventHandlers() { - this._handleInputKeydownBound = this._handleInputKeydown.bind(this); - this._handleInputClickBound = this._handleInputClick.bind(this); - this._handleInputChangeBound = this._handleInputChange.bind(this); - this._handleCalendarClickBound = this._handleCalendarClick.bind(this); - this._finishSelectionBound = this._finishSelection.bind(this); - this._handleMonthChange = this._handleMonthChange.bind(this); - this._closeBound = this.close.bind(this); - - this.el.addEventListener('click', this._handleInputClickBound); - this.el.addEventListener('keydown', this._handleInputKeydownBound); - this.el.addEventListener('change', this._handleInputChangeBound); - this.calendarEl.addEventListener('click', this._handleCalendarClickBound); - this.doneBtn.addEventListener('click', this._finishSelectionBound); - this.cancelBtn.addEventListener('click', this._closeBound); - - if (this.options.showClearBtn) { - this._handleClearClickBound = this._handleClearClick.bind(this); - this.clearBtn.addEventListener('click', this._handleClearClickBound); - } - } - }, { - key: "_setupVariables", - value: function _setupVariables() { - var _this56 = this; - - this.$modalEl = $(Datepicker._template); - this.modalEl = this.$modalEl[0]; - - this.calendarEl = this.modalEl.querySelector('.datepicker-calendar'); - - this.yearTextEl = this.modalEl.querySelector('.year-text'); - this.dateTextEl = this.modalEl.querySelector('.date-text'); - if (this.options.showClearBtn) { - this.clearBtn = this.modalEl.querySelector('.datepicker-clear'); - } - this.doneBtn = this.modalEl.querySelector('.datepicker-done'); - this.cancelBtn = this.modalEl.querySelector('.datepicker-cancel'); - - this.formats = { - d: function () { - return _this56.date.getDate(); - }, - dd: function () { - var d = _this56.date.getDate(); - return (d < 10 ? '0' : '') + d; - }, - ddd: function () { - return _this56.options.i18n.weekdaysShort[_this56.date.getDay()]; - }, - dddd: function () { - return _this56.options.i18n.weekdays[_this56.date.getDay()]; - }, - m: function () { - return _this56.date.getMonth() + 1; - }, - mm: function () { - var m = _this56.date.getMonth() + 1; - return (m < 10 ? '0' : '') + m; - }, - mmm: function () { - return _this56.options.i18n.monthsShort[_this56.date.getMonth()]; - }, - mmmm: function () { - return _this56.options.i18n.months[_this56.date.getMonth()]; - }, - yy: function () { - return ('' + _this56.date.getFullYear()).slice(2); - }, - yyyy: function () { - return _this56.date.getFullYear(); - } - }; - } - - /** - * Remove Event Handlers - */ - - }, { - key: "_removeEventHandlers", - value: function _removeEventHandlers() { - this.el.removeEventListener('click', this._handleInputClickBound); - this.el.removeEventListener('keydown', this._handleInputKeydownBound); - this.el.removeEventListener('change', this._handleInputChangeBound); - this.calendarEl.removeEventListener('click', this._handleCalendarClickBound); - } - }, { - key: "_handleInputClick", - value: function _handleInputClick() { - this.open(); - } - }, { - key: "_handleInputKeydown", - value: function _handleInputKeydown(e) { - if (e.which === M.keys.ENTER) { - e.preventDefault(); - this.open(); - } - } - }, { - key: "_handleCalendarClick", - value: function _handleCalendarClick(e) { - if (!this.isOpen) { - return; - } - - var $target = $(e.target); - if (!$target.hasClass('is-disabled')) { - if ($target.hasClass('datepicker-day-button') && !$target.hasClass('is-empty') && !$target.parent().hasClass('is-disabled')) { - this.setDate(new Date(e.target.getAttribute('data-year'), e.target.getAttribute('data-month'), e.target.getAttribute('data-day'))); - if (this.options.autoClose) { - this._finishSelection(); - } - } else if ($target.closest('.month-prev').length) { - this.prevMonth(); - } else if ($target.closest('.month-next').length) { - this.nextMonth(); - } - } - } - }, { - key: "_handleClearClick", - value: function _handleClearClick() { - this.date = null; - this.setInputValue(); - this.close(); - } - }, { - key: "_handleMonthChange", - value: function _handleMonthChange(e) { - this.gotoMonth(e.target.value); - } - }, { - key: "_handleYearChange", - value: function _handleYearChange(e) { - this.gotoYear(e.target.value); - } - - /** - * change view to a specific month (zero-index, e.g. 0: January) - */ - - }, { - key: "gotoMonth", - value: function gotoMonth(month) { - if (!isNaN(month)) { - this.calendars[0].month = parseInt(month, 10); - this.adjustCalendars(); - } - } - - /** - * change view to a specific full year (e.g. "2012") - */ - - }, { - key: "gotoYear", - value: function gotoYear(year) { - if (!isNaN(year)) { - this.calendars[0].year = parseInt(year, 10); - this.adjustCalendars(); - } - } - }, { - key: "_handleInputChange", - value: function _handleInputChange(e) { - var date = void 0; - - // Prevent change event from being fired when triggered by the plugin - if (e.firedBy === this) { - return; - } - if (this.options.parse) { - date = this.options.parse(this.el.value, this.options.format); - } else { - date = new Date(Date.parse(this.el.value)); - } - - if (Datepicker._isDate(date)) { - this.setDate(date); - } - } - }, { - key: "renderDayName", - value: function renderDayName(opts, day, abbr) { - day += opts.firstDay; - while (day >= 7) { - day -= 7; - } - return abbr ? opts.i18n.weekdaysAbbrev[day] : opts.i18n.weekdays[day]; - } - - /** - * Set input value to the selected date and close Datepicker - */ - - }, { - key: "_finishSelection", - value: function _finishSelection() { - this.setInputValue(); - this.close(); - } - - /** - * Open Datepicker - */ - - }, { - key: "open", - value: function open() { - if (this.isOpen) { - return; - } - - this.isOpen = true; - if (typeof this.options.onOpen === 'function') { - this.options.onOpen.call(this); - } - this.draw(); - this.modal.open(); - return this; - } - - /** - * Close Datepicker - */ - - }, { - key: "close", - value: function close() { - if (!this.isOpen) { - return; - } - - this.isOpen = false; - if (typeof this.options.onClose === 'function') { - this.options.onClose.call(this); - } - this.modal.close(); - return this; - } - }], [{ - key: "init", - value: function init(els, options) { - return _get(Datepicker.__proto__ || Object.getPrototypeOf(Datepicker), "init", this).call(this, this, els, options); - } - }, { - key: "_isDate", - value: function _isDate(obj) { - return (/Date/.test(Object.prototype.toString.call(obj)) && !isNaN(obj.getTime()) - ); - } - }, { - key: "_isWeekend", - value: function _isWeekend(date) { - var day = date.getDay(); - return day === 0 || day === 6; - } - }, { - key: "_setToStartOfDay", - value: function _setToStartOfDay(date) { - if (Datepicker._isDate(date)) date.setHours(0, 0, 0, 0); - } - }, { - key: "_getDaysInMonth", - value: function _getDaysInMonth(year, month) { - return [31, Datepicker._isLeapYear(year) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month]; - } - }, { - key: "_isLeapYear", - value: function _isLeapYear(year) { - // solution by Matti Virkkunen: http://stackoverflow.com/a/4881951 - return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0; - } - }, { - key: "_compareDates", - value: function _compareDates(a, b) { - // weak date comparison (use setToStartOfDay(date) to ensure correct result) - return a.getTime() === b.getTime(); - } - }, { - key: "_setToStartOfDay", - value: function _setToStartOfDay(date) { - if (Datepicker._isDate(date)) date.setHours(0, 0, 0, 0); - } - - /** - * Get Instance - */ - - }, { - key: "getInstance", - value: function getInstance(el) { - var domElem = !!el.jquery ? el[0] : el; - return domElem.M_Datepicker; - } - }, { - key: "defaults", - get: function () { - return _defaults; - } - }]); - - return Datepicker; - }(Component); - - Datepicker._template = [''].join(''); - - M.Datepicker = Datepicker; - - if (M.jQueryLoaded) { - M.initializeJqueryWrapper(Datepicker, 'datepicker', 'M_Datepicker'); - } -})(cash); -;(function ($) { - 'use strict'; - - var _defaults = { - dialRadius: 135, - outerRadius: 105, - innerRadius: 70, - tickRadius: 20, - duration: 350, - container: null, - defaultTime: 'now', // default time, 'now' or '13:14' e.g. - fromNow: 0, // Millisecond offset from the defaultTime - showClearBtn: false, - - // internationalization - i18n: { - cancel: 'Cancel', - clear: 'Clear', - done: 'Ok' - }, - - autoClose: false, // auto close when minute is selected - twelveHour: true, // change to 12 hour AM/PM clock from 24 hour - vibrate: true, // vibrate the device when dragging clock hand - - // Callbacks - onOpenStart: null, - onOpenEnd: null, - onCloseStart: null, - onCloseEnd: null, - onSelect: null - }; - - /** - * @class - * - */ - - var Timepicker = function (_Component16) { - _inherits(Timepicker, _Component16); - - function Timepicker(el, options) { - _classCallCheck(this, Timepicker); - - var _this57 = _possibleConstructorReturn(this, (Timepicker.__proto__ || Object.getPrototypeOf(Timepicker)).call(this, Timepicker, el, options)); - - _this57.el.M_Timepicker = _this57; - - _this57.options = $.extend({}, Timepicker.defaults, options); - - _this57.id = M.guid(); - _this57._insertHTMLIntoDOM(); - _this57._setupModal(); - _this57._setupVariables(); - _this57._setupEventHandlers(); - - _this57._clockSetup(); - _this57._pickerSetup(); - return _this57; - } - - _createClass(Timepicker, [{ - key: "destroy", - - - /** - * Teardown component - */ - value: function destroy() { - this._removeEventHandlers(); - this.modal.destroy(); - $(this.modalEl).remove(); - this.el.M_Timepicker = undefined; - } - - /** - * Setup Event Handlers - */ - - }, { - key: "_setupEventHandlers", - value: function _setupEventHandlers() { - this._handleInputKeydownBound = this._handleInputKeydown.bind(this); - this._handleInputClickBound = this._handleInputClick.bind(this); - this._handleClockClickStartBound = this._handleClockClickStart.bind(this); - this._handleDocumentClickMoveBound = this._handleDocumentClickMove.bind(this); - this._handleDocumentClickEndBound = this._handleDocumentClickEnd.bind(this); - - this.el.addEventListener('click', this._handleInputClickBound); - this.el.addEventListener('keydown', this._handleInputKeydownBound); - this.plate.addEventListener('mousedown', this._handleClockClickStartBound); - this.plate.addEventListener('touchstart', this._handleClockClickStartBound); - - $(this.spanHours).on('click', this.showView.bind(this, 'hours')); - $(this.spanMinutes).on('click', this.showView.bind(this, 'minutes')); - } - }, { - key: "_removeEventHandlers", - value: function _removeEventHandlers() { - this.el.removeEventListener('click', this._handleInputClickBound); - this.el.removeEventListener('keydown', this._handleInputKeydownBound); - } - }, { - key: "_handleInputClick", - value: function _handleInputClick() { - this.open(); - } - }, { - key: "_handleInputKeydown", - value: function _handleInputKeydown(e) { - if (e.which === M.keys.ENTER) { - e.preventDefault(); - this.open(); - } - } - }, { - key: "_handleClockClickStart", - value: function _handleClockClickStart(e) { - e.preventDefault(); - var clockPlateBR = this.plate.getBoundingClientRect(); - var offset = { x: clockPlateBR.left, y: clockPlateBR.top }; - - this.x0 = offset.x + this.options.dialRadius; - this.y0 = offset.y + this.options.dialRadius; - this.moved = false; - var clickPos = Timepicker._Pos(e); - this.dx = clickPos.x - this.x0; - this.dy = clickPos.y - this.y0; - - // Set clock hands - this.setHand(this.dx, this.dy, false); - - // Mousemove on document - document.addEventListener('mousemove', this._handleDocumentClickMoveBound); - document.addEventListener('touchmove', this._handleDocumentClickMoveBound); - - // Mouseup on document - document.addEventListener('mouseup', this._handleDocumentClickEndBound); - document.addEventListener('touchend', this._handleDocumentClickEndBound); - } - }, { - key: "_handleDocumentClickMove", - value: function _handleDocumentClickMove(e) { - e.preventDefault(); - var clickPos = Timepicker._Pos(e); - var x = clickPos.x - this.x0; - var y = clickPos.y - this.y0; - this.moved = true; - this.setHand(x, y, false, true); - } - }, { - key: "_handleDocumentClickEnd", - value: function _handleDocumentClickEnd(e) { - var _this58 = this; - - e.preventDefault(); - document.removeEventListener('mouseup', this._handleDocumentClickEndBound); - document.removeEventListener('touchend', this._handleDocumentClickEndBound); - var clickPos = Timepicker._Pos(e); - var x = clickPos.x - this.x0; - var y = clickPos.y - this.y0; - if (this.moved && x === this.dx && y === this.dy) { - this.setHand(x, y); - } - - if (this.currentView === 'hours') { - this.showView('minutes', this.options.duration / 2); - } else if (this.options.autoClose) { - $(this.minutesView).addClass('timepicker-dial-out'); - setTimeout(function () { - _this58.done(); - }, this.options.duration / 2); - } - - if (typeof this.options.onSelect === 'function') { - this.options.onSelect.call(this, this.hours, this.minutes); - } - - // Unbind mousemove event - document.removeEventListener('mousemove', this._handleDocumentClickMoveBound); - document.removeEventListener('touchmove', this._handleDocumentClickMoveBound); - } - }, { - key: "_insertHTMLIntoDOM", - value: function _insertHTMLIntoDOM() { - this.$modalEl = $(Timepicker._template); - this.modalEl = this.$modalEl[0]; - this.modalEl.id = 'modal-' + this.id; - - // Append popover to input by default - var containerEl = document.querySelector(this.options.container); - if (this.options.container && !!containerEl) { - this.$modalEl.appendTo(containerEl); - } else { - this.$modalEl.insertBefore(this.el); - } - } - }, { - key: "_setupModal", - value: function _setupModal() { - var _this59 = this; - - this.modal = M.Modal.init(this.modalEl, { - onOpenStart: this.options.onOpenStart, - onOpenEnd: this.options.onOpenEnd, - onCloseStart: this.options.onCloseStart, - onCloseEnd: function () { - if (typeof _this59.options.onCloseEnd === 'function') { - _this59.options.onCloseEnd.call(_this59); - } - _this59.isOpen = false; - } - }); - } - }, { - key: "_setupVariables", - value: function _setupVariables() { - this.currentView = 'hours'; - this.vibrate = navigator.vibrate ? 'vibrate' : navigator.webkitVibrate ? 'webkitVibrate' : null; - - this._canvas = this.modalEl.querySelector('.timepicker-canvas'); - this.plate = this.modalEl.querySelector('.timepicker-plate'); - - this.hoursView = this.modalEl.querySelector('.timepicker-hours'); - this.minutesView = this.modalEl.querySelector('.timepicker-minutes'); - this.spanHours = this.modalEl.querySelector('.timepicker-span-hours'); - this.spanMinutes = this.modalEl.querySelector('.timepicker-span-minutes'); - this.spanAmPm = this.modalEl.querySelector('.timepicker-span-am-pm'); - this.footer = this.modalEl.querySelector('.timepicker-footer'); - this.amOrPm = 'PM'; - } - }, { - key: "_pickerSetup", - value: function _pickerSetup() { - var $clearBtn = $("").appendTo(this.footer).on('click', this.clear.bind(this)); - if (this.options.showClearBtn) { - $clearBtn.css({ visibility: '' }); - } - - var confirmationBtnsContainer = $('
      '); - $('').appendTo(confirmationBtnsContainer).on('click', this.close.bind(this)); - $('').appendTo(confirmationBtnsContainer).on('click', this.done.bind(this)); - confirmationBtnsContainer.appendTo(this.footer); - } - }, { - key: "_clockSetup", - value: function _clockSetup() { - if (this.options.twelveHour) { - this.$amBtn = $('
      AM
      '); - this.$pmBtn = $('
      PM
      '); - this.$amBtn.on('click', this._handleAmPmClick.bind(this)).appendTo(this.spanAmPm); - this.$pmBtn.on('click', this._handleAmPmClick.bind(this)).appendTo(this.spanAmPm); - } - - this._buildHoursView(); - this._buildMinutesView(); - this._buildSVGClock(); - } - }, { - key: "_buildSVGClock", - value: function _buildSVGClock() { - // Draw clock hands and others - var dialRadius = this.options.dialRadius; - var tickRadius = this.options.tickRadius; - var diameter = dialRadius * 2; - - var svg = Timepicker._createSVGEl('svg'); - svg.setAttribute('class', 'timepicker-svg'); - svg.setAttribute('width', diameter); - svg.setAttribute('height', diameter); - var g = Timepicker._createSVGEl('g'); - g.setAttribute('transform', 'translate(' + dialRadius + ',' + dialRadius + ')'); - var bearing = Timepicker._createSVGEl('circle'); - bearing.setAttribute('class', 'timepicker-canvas-bearing'); - bearing.setAttribute('cx', 0); - bearing.setAttribute('cy', 0); - bearing.setAttribute('r', 4); - var hand = Timepicker._createSVGEl('line'); - hand.setAttribute('x1', 0); - hand.setAttribute('y1', 0); - var bg = Timepicker._createSVGEl('circle'); - bg.setAttribute('class', 'timepicker-canvas-bg'); - bg.setAttribute('r', tickRadius); - g.appendChild(hand); - g.appendChild(bg); - g.appendChild(bearing); - svg.appendChild(g); - this._canvas.appendChild(svg); - - this.hand = hand; - this.bg = bg; - this.bearing = bearing; - this.g = g; - } - }, { - key: "_buildHoursView", - value: function _buildHoursView() { - var $tick = $('
      '); - // Hours view - if (this.options.twelveHour) { - for (var i = 1; i < 13; i += 1) { - var tick = $tick.clone(); - var radian = i / 6 * Math.PI; - var radius = this.options.outerRadius; - tick.css({ - left: this.options.dialRadius + Math.sin(radian) * radius - this.options.tickRadius + 'px', - top: this.options.dialRadius - Math.cos(radian) * radius - this.options.tickRadius + 'px' - }); - tick.html(i === 0 ? '00' : i); - this.hoursView.appendChild(tick[0]); - // tick.on(mousedownEvent, mousedown); - } - } else { - for (var _i2 = 0; _i2 < 24; _i2 += 1) { - var _tick = $tick.clone(); - var _radian = _i2 / 6 * Math.PI; - var inner = _i2 > 0 && _i2 < 13; - var _radius = inner ? this.options.innerRadius : this.options.outerRadius; - _tick.css({ - left: this.options.dialRadius + Math.sin(_radian) * _radius - this.options.tickRadius + 'px', - top: this.options.dialRadius - Math.cos(_radian) * _radius - this.options.tickRadius + 'px' - }); - _tick.html(_i2 === 0 ? '00' : _i2); - this.hoursView.appendChild(_tick[0]); - // tick.on(mousedownEvent, mousedown); - } - } - } - }, { - key: "_buildMinutesView", - value: function _buildMinutesView() { - var $tick = $('
      '); - // Minutes view - for (var i = 0; i < 60; i += 5) { - var tick = $tick.clone(); - var radian = i / 30 * Math.PI; - tick.css({ - left: this.options.dialRadius + Math.sin(radian) * this.options.outerRadius - this.options.tickRadius + 'px', - top: this.options.dialRadius - Math.cos(radian) * this.options.outerRadius - this.options.tickRadius + 'px' - }); - tick.html(Timepicker._addLeadingZero(i)); - this.minutesView.appendChild(tick[0]); - } - } - }, { - key: "_handleAmPmClick", - value: function _handleAmPmClick(e) { - var $btnClicked = $(e.target); - this.amOrPm = $btnClicked.hasClass('am-btn') ? 'AM' : 'PM'; - this._updateAmPmView(); - } - }, { - key: "_updateAmPmView", - value: function _updateAmPmView() { - if (this.options.twelveHour) { - this.$amBtn.toggleClass('text-primary', this.amOrPm === 'AM'); - this.$pmBtn.toggleClass('text-primary', this.amOrPm === 'PM'); - } - } - }, { - key: "_updateTimeFromInput", - value: function _updateTimeFromInput() { - // Get the time - var value = ((this.el.value || this.options.defaultTime || '') + '').split(':'); - if (this.options.twelveHour && !(typeof value[1] === 'undefined')) { - if (value[1].toUpperCase().indexOf('AM') > 0) { - this.amOrPm = 'AM'; - } else { - this.amOrPm = 'PM'; - } - value[1] = value[1].replace('AM', '').replace('PM', ''); - } - if (value[0] === 'now') { - var now = new Date(+new Date() + this.options.fromNow); - value = [now.getHours(), now.getMinutes()]; - if (this.options.twelveHour) { - this.amOrPm = value[0] >= 12 && value[0] < 24 ? 'PM' : 'AM'; - } - } - this.hours = +value[0] || 0; - this.minutes = +value[1] || 0; - this.spanHours.innerHTML = this.hours; - this.spanMinutes.innerHTML = Timepicker._addLeadingZero(this.minutes); - - this._updateAmPmView(); - } - }, { - key: "showView", - value: function showView(view, delay) { - if (view === 'minutes' && $(this.hoursView).css('visibility') === 'visible') { - // raiseCallback(this.options.beforeHourSelect); - } - var isHours = view === 'hours', - nextView = isHours ? this.hoursView : this.minutesView, - hideView = isHours ? this.minutesView : this.hoursView; - this.currentView = view; - - $(this.spanHours).toggleClass('text-primary', isHours); - $(this.spanMinutes).toggleClass('text-primary', !isHours); - - // Transition view - hideView.classList.add('timepicker-dial-out'); - $(nextView).css('visibility', 'visible').removeClass('timepicker-dial-out'); - - // Reset clock hand - this.resetClock(delay); - - // After transitions ended - clearTimeout(this.toggleViewTimer); - this.toggleViewTimer = setTimeout(function () { - $(hideView).css('visibility', 'hidden'); - }, this.options.duration); - } - }, { - key: "resetClock", - value: function resetClock(delay) { - var view = this.currentView, - value = this[view], - isHours = view === 'hours', - unit = Math.PI / (isHours ? 6 : 30), - radian = value * unit, - radius = isHours && value > 0 && value < 13 ? this.options.innerRadius : this.options.outerRadius, - x = Math.sin(radian) * radius, - y = -Math.cos(radian) * radius, - self = this; - - if (delay) { - $(this.canvas).addClass('timepicker-canvas-out'); - setTimeout(function () { - $(self.canvas).removeClass('timepicker-canvas-out'); - self.setHand(x, y); - }, delay); - } else { - this.setHand(x, y); - } - } - }, { - key: "setHand", - value: function setHand(x, y, roundBy5) { - var _this60 = this; - - var radian = Math.atan2(x, -y), - isHours = this.currentView === 'hours', - unit = Math.PI / (isHours || roundBy5 ? 6 : 30), - z = Math.sqrt(x * x + y * y), - inner = isHours && z < (this.options.outerRadius + this.options.innerRadius) / 2, - radius = inner ? this.options.innerRadius : this.options.outerRadius; - - if (this.options.twelveHour) { - radius = this.options.outerRadius; - } - - // Radian should in range [0, 2PI] - if (radian < 0) { - radian = Math.PI * 2 + radian; - } - - // Get the round value - var value = Math.round(radian / unit); - - // Get the round radian - radian = value * unit; - - // Correct the hours or minutes - if (this.options.twelveHour) { - if (isHours) { - if (value === 0) value = 12; - } else { - if (roundBy5) value *= 5; - if (value === 60) value = 0; - } - } else { - if (isHours) { - if (value === 12) { - value = 0; - } - value = inner ? value === 0 ? 12 : value : value === 0 ? 0 : value + 12; - } else { - if (roundBy5) { - value *= 5; - } - if (value === 60) { - value = 0; - } - } - } - - // Once hours or minutes changed, vibrate the device - if (this[this.currentView] !== value) { - if (this.vibrate && this.options.vibrate) { - // Do not vibrate too frequently - if (!this.vibrateTimer) { - navigator[this.vibrate](10); - this.vibrateTimer = setTimeout(function () { - _this60.vibrateTimer = null; - }, 100); - } - } - } - - this[this.currentView] = value; - if (isHours) { - this['spanHours'].innerHTML = value; - } else { - this['spanMinutes'].innerHTML = Timepicker._addLeadingZero(value); - } - - // Set clock hand and others' position - var cx1 = Math.sin(radian) * (radius - this.options.tickRadius), - cy1 = -Math.cos(radian) * (radius - this.options.tickRadius), - cx2 = Math.sin(radian) * radius, - cy2 = -Math.cos(radian) * radius; - this.hand.setAttribute('x2', cx1); - this.hand.setAttribute('y2', cy1); - this.bg.setAttribute('cx', cx2); - this.bg.setAttribute('cy', cy2); - } - }, { - key: "open", - value: function open() { - if (this.isOpen) { - return; - } - - this.isOpen = true; - this._updateTimeFromInput(); - this.showView('hours'); - - this.modal.open(); - } - }, { - key: "close", - value: function close() { - if (!this.isOpen) { - return; - } - - this.isOpen = false; - this.modal.close(); - } - - /** - * Finish timepicker selection. - */ - - }, { - key: "done", - value: function done(e, clearValue) { - // Set input value - var last = this.el.value; - var value = clearValue ? '' : Timepicker._addLeadingZero(this.hours) + ':' + Timepicker._addLeadingZero(this.minutes); - this.time = value; - if (!clearValue && this.options.twelveHour) { - value = value + " " + this.amOrPm; - } - this.el.value = value; - - // Trigger change event - if (value !== last) { - this.$el.trigger('change'); - } - - this.close(); - this.el.focus(); - } - }, { - key: "clear", - value: function clear() { - this.done(null, true); - } - }], [{ - key: "init", - value: function init(els, options) { - return _get(Timepicker.__proto__ || Object.getPrototypeOf(Timepicker), "init", this).call(this, this, els, options); - } - }, { - key: "_addLeadingZero", - value: function _addLeadingZero(num) { - return (num < 10 ? '0' : '') + num; - } - }, { - key: "_createSVGEl", - value: function _createSVGEl(name) { - var svgNS = 'http://www.w3.org/2000/svg'; - return document.createElementNS(svgNS, name); - } - - /** - * @typedef {Object} Point - * @property {number} x The X Coordinate - * @property {number} y The Y Coordinate - */ - - /** - * Get x position of mouse or touch event - * @param {Event} e - * @return {Point} x and y location - */ - - }, { - key: "_Pos", - value: function _Pos(e) { - if (e.targetTouches && e.targetTouches.length >= 1) { - return { x: e.targetTouches[0].clientX, y: e.targetTouches[0].clientY }; - } - // mouse event - return { x: e.clientX, y: e.clientY }; - } - - /** - * Get Instance - */ - - }, { - key: "getInstance", - value: function getInstance(el) { - var domElem = !!el.jquery ? el[0] : el; - return domElem.M_Timepicker; - } - }, { - key: "defaults", - get: function () { - return _defaults; - } - }]); - - return Timepicker; - }(Component); - - Timepicker._template = [''].join(''); - - M.Timepicker = Timepicker; - - if (M.jQueryLoaded) { - M.initializeJqueryWrapper(Timepicker, 'timepicker', 'M_Timepicker'); - } -})(cash); -;(function ($) { - 'use strict'; - - var _defaults = {}; - - /** - * @class - * - */ - - var CharacterCounter = function (_Component17) { - _inherits(CharacterCounter, _Component17); - - /** - * Construct CharacterCounter instance - * @constructor - * @param {Element} el - * @param {Object} options - */ - function CharacterCounter(el, options) { - _classCallCheck(this, CharacterCounter); - - var _this61 = _possibleConstructorReturn(this, (CharacterCounter.__proto__ || Object.getPrototypeOf(CharacterCounter)).call(this, CharacterCounter, el, options)); - - _this61.el.M_CharacterCounter = _this61; - - /** - * Options for the character counter - */ - _this61.options = $.extend({}, CharacterCounter.defaults, options); - - _this61.isInvalid = false; - _this61.isValidLength = false; - _this61._setupCounter(); - _this61._setupEventHandlers(); - return _this61; - } - - _createClass(CharacterCounter, [{ - key: "destroy", - - - /** - * Teardown component - */ - value: function destroy() { - this._removeEventHandlers(); - this.el.CharacterCounter = undefined; - this._removeCounter(); - } - - /** - * Setup Event Handlers - */ - - }, { - key: "_setupEventHandlers", - value: function _setupEventHandlers() { - this._handleUpdateCounterBound = this.updateCounter.bind(this); - - this.el.addEventListener('focus', this._handleUpdateCounterBound, true); - this.el.addEventListener('input', this._handleUpdateCounterBound, true); - } - - /** - * Remove Event Handlers - */ - - }, { - key: "_removeEventHandlers", - value: function _removeEventHandlers() { - this.el.removeEventListener('focus', this._handleUpdateCounterBound, true); - this.el.removeEventListener('input', this._handleUpdateCounterBound, true); - } - - /** - * Setup counter element - */ - - }, { - key: "_setupCounter", - value: function _setupCounter() { - this.counterEl = document.createElement('span'); - $(this.counterEl).addClass('character-counter').css({ - float: 'right', - 'font-size': '12px', - height: 1 - }); - - this.$el.parent().append(this.counterEl); - } - - /** - * Remove counter element - */ - - }, { - key: "_removeCounter", - value: function _removeCounter() { - $(this.counterEl).remove(); - } - - /** - * Update counter - */ - - }, { - key: "updateCounter", - value: function updateCounter() { - var maxLength = +this.$el.attr('data-length'), - actualLength = this.el.value.length; - this.isValidLength = actualLength <= maxLength; - var counterString = actualLength; - - if (maxLength) { - counterString += '/' + maxLength; - this._validateInput(); - } - - $(this.counterEl).html(counterString); - } - - /** - * Add validation classes - */ - - }, { - key: "_validateInput", - value: function _validateInput() { - if (this.isValidLength && this.isInvalid) { - this.isInvalid = false; - this.$el.removeClass('invalid'); - } else if (!this.isValidLength && !this.isInvalid) { - this.isInvalid = true; - this.$el.removeClass('valid'); - this.$el.addClass('invalid'); - } - } - }], [{ - key: "init", - value: function init(els, options) { - return _get(CharacterCounter.__proto__ || Object.getPrototypeOf(CharacterCounter), "init", this).call(this, this, els, options); - } - - /** - * Get Instance - */ - - }, { - key: "getInstance", - value: function getInstance(el) { - var domElem = !!el.jquery ? el[0] : el; - return domElem.M_CharacterCounter; - } - }, { - key: "defaults", - get: function () { - return _defaults; - } - }]); - - return CharacterCounter; - }(Component); - - M.CharacterCounter = CharacterCounter; - - if (M.jQueryLoaded) { - M.initializeJqueryWrapper(CharacterCounter, 'characterCounter', 'M_CharacterCounter'); - } -})(cash); -;(function ($) { - 'use strict'; - - var _defaults = { - duration: 200, // ms - dist: -100, // zoom scale TODO: make this more intuitive as an option - shift: 0, // spacing for center image - padding: 0, // Padding between non center items - numVisible: 5, // Number of visible items in carousel - fullWidth: false, // Change to full width styles - indicators: false, // Toggle indicators - noWrap: false, // Don't wrap around and cycle through items. - onCycleTo: null // Callback for when a new slide is cycled to. - }; - - /** - * @class - * - */ - - var Carousel = function (_Component18) { - _inherits(Carousel, _Component18); - - /** - * Construct Carousel instance - * @constructor - * @param {Element} el - * @param {Object} options - */ - function Carousel(el, options) { - _classCallCheck(this, Carousel); - - var _this62 = _possibleConstructorReturn(this, (Carousel.__proto__ || Object.getPrototypeOf(Carousel)).call(this, Carousel, el, options)); - - _this62.el.M_Carousel = _this62; - - /** - * Options for the carousel - * @member Carousel#options - * @prop {Number} duration - * @prop {Number} dist - * @prop {Number} shift - * @prop {Number} padding - * @prop {Number} numVisible - * @prop {Boolean} fullWidth - * @prop {Boolean} indicators - * @prop {Boolean} noWrap - * @prop {Function} onCycleTo - */ - _this62.options = $.extend({}, Carousel.defaults, options); - - // Setup - _this62.hasMultipleSlides = _this62.$el.find('.carousel-item').length > 1; - _this62.showIndicators = _this62.options.indicators && _this62.hasMultipleSlides; - _this62.noWrap = _this62.options.noWrap || !_this62.hasMultipleSlides; - _this62.pressed = false; - _this62.dragged = false; - _this62.offset = _this62.target = 0; - _this62.images = []; - _this62.itemWidth = _this62.$el.find('.carousel-item').first().innerWidth(); - _this62.itemHeight = _this62.$el.find('.carousel-item').first().innerHeight(); - _this62.dim = _this62.itemWidth * 2 + _this62.options.padding || 1; // Make sure dim is non zero for divisions. - _this62._autoScrollBound = _this62._autoScroll.bind(_this62); - _this62._trackBound = _this62._track.bind(_this62); - - // Full Width carousel setup - if (_this62.options.fullWidth) { - _this62.options.dist = 0; - _this62._setCarouselHeight(); - - // Offset fixed items when indicators. - if (_this62.showIndicators) { - _this62.$el.find('.carousel-fixed-item').addClass('with-indicators'); - } - } - - // Iterate through slides - _this62.$indicators = $('
        '); - _this62.$el.find('.carousel-item').each(function (el, i) { - _this62.images.push(el); - if (_this62.showIndicators) { - var $indicator = $('
      • '); - - // Add active to first by default. - if (i === 0) { - $indicator[0].classList.add('active'); - } - - _this62.$indicators.append($indicator); - } - }); - if (_this62.showIndicators) { - _this62.$el.append(_this62.$indicators); - } - _this62.count = _this62.images.length; - - // Cap numVisible at count - _this62.options.numVisible = Math.min(_this62.count, _this62.options.numVisible); - - // Setup cross browser string - _this62.xform = 'transform'; - ['webkit', 'Moz', 'O', 'ms'].every(function (prefix) { - var e = prefix + 'Transform'; - if (typeof document.body.style[e] !== 'undefined') { - _this62.xform = e; - return false; - } - return true; - }); - - _this62._setupEventHandlers(); - _this62._scroll(_this62.offset); - return _this62; - } - - _createClass(Carousel, [{ - key: "destroy", - - - /** - * Teardown component - */ - value: function destroy() { - this._removeEventHandlers(); - this.el.M_Carousel = undefined; - } - - /** - * Setup Event Handlers - */ - - }, { - key: "_setupEventHandlers", - value: function _setupEventHandlers() { - var _this63 = this; - - this._handleCarouselTapBound = this._handleCarouselTap.bind(this); - this._handleCarouselDragBound = this._handleCarouselDrag.bind(this); - this._handleCarouselReleaseBound = this._handleCarouselRelease.bind(this); - this._handleCarouselClickBound = this._handleCarouselClick.bind(this); - - if (typeof window.ontouchstart !== 'undefined') { - this.el.addEventListener('touchstart', this._handleCarouselTapBound); - this.el.addEventListener('touchmove', this._handleCarouselDragBound); - this.el.addEventListener('touchend', this._handleCarouselReleaseBound); - } - - this.el.addEventListener('mousedown', this._handleCarouselTapBound); - this.el.addEventListener('mousemove', this._handleCarouselDragBound); - this.el.addEventListener('mouseup', this._handleCarouselReleaseBound); - this.el.addEventListener('mouseleave', this._handleCarouselReleaseBound); - this.el.addEventListener('click', this._handleCarouselClickBound); - - if (this.showIndicators && this.$indicators) { - this._handleIndicatorClickBound = this._handleIndicatorClick.bind(this); - this.$indicators.find('.indicator-item').each(function (el, i) { - el.addEventListener('click', _this63._handleIndicatorClickBound); - }); - } - - // Resize - var throttledResize = M.throttle(this._handleResize, 200); - this._handleThrottledResizeBound = throttledResize.bind(this); - - window.addEventListener('resize', this._handleThrottledResizeBound); - } - - /** - * Remove Event Handlers - */ - - }, { - key: "_removeEventHandlers", - value: function _removeEventHandlers() { - var _this64 = this; - - if (typeof window.ontouchstart !== 'undefined') { - this.el.removeEventListener('touchstart', this._handleCarouselTapBound); - this.el.removeEventListener('touchmove', this._handleCarouselDragBound); - this.el.removeEventListener('touchend', this._handleCarouselReleaseBound); - } - this.el.removeEventListener('mousedown', this._handleCarouselTapBound); - this.el.removeEventListener('mousemove', this._handleCarouselDragBound); - this.el.removeEventListener('mouseup', this._handleCarouselReleaseBound); - this.el.removeEventListener('mouseleave', this._handleCarouselReleaseBound); - this.el.removeEventListener('click', this._handleCarouselClickBound); - - if (this.showIndicators && this.$indicators) { - this.$indicators.find('.indicator-item').each(function (el, i) { - el.removeEventListener('click', _this64._handleIndicatorClickBound); - }); - } - - window.removeEventListener('resize', this._handleThrottledResizeBound); - } - - /** - * Handle Carousel Tap - * @param {Event} e - */ - - }, { - key: "_handleCarouselTap", - value: function _handleCarouselTap(e) { - // Fixes firefox draggable image bug - if (e.type === 'mousedown' && $(e.target).is('img')) { - e.preventDefault(); - } - this.pressed = true; - this.dragged = false; - this.verticalDragged = false; - this.reference = this._xpos(e); - this.referenceY = this._ypos(e); - - this.velocity = this.amplitude = 0; - this.frame = this.offset; - this.timestamp = Date.now(); - clearInterval(this.ticker); - this.ticker = setInterval(this._trackBound, 100); - } - - /** - * Handle Carousel Drag - * @param {Event} e - */ - - }, { - key: "_handleCarouselDrag", - value: function _handleCarouselDrag(e) { - var x = void 0, - y = void 0, - delta = void 0, - deltaY = void 0; - if (this.pressed) { - x = this._xpos(e); - y = this._ypos(e); - delta = this.reference - x; - deltaY = Math.abs(this.referenceY - y); - if (deltaY < 30 && !this.verticalDragged) { - // If vertical scrolling don't allow dragging. - if (delta > 2 || delta < -2) { - this.dragged = true; - this.reference = x; - this._scroll(this.offset + delta); - } - } else if (this.dragged) { - // If dragging don't allow vertical scroll. - e.preventDefault(); - e.stopPropagation(); - return false; - } else { - // Vertical scrolling. - this.verticalDragged = true; - } - } - - if (this.dragged) { - // If dragging don't allow vertical scroll. - e.preventDefault(); - e.stopPropagation(); - return false; - } - } - - /** - * Handle Carousel Release - * @param {Event} e - */ - - }, { - key: "_handleCarouselRelease", - value: function _handleCarouselRelease(e) { - if (this.pressed) { - this.pressed = false; - } else { - return; - } - - clearInterval(this.ticker); - this.target = this.offset; - if (this.velocity > 10 || this.velocity < -10) { - this.amplitude = 0.9 * this.velocity; - this.target = this.offset + this.amplitude; - } - this.target = Math.round(this.target / this.dim) * this.dim; - - // No wrap of items. - if (this.noWrap) { - if (this.target >= this.dim * (this.count - 1)) { - this.target = this.dim * (this.count - 1); - } else if (this.target < 0) { - this.target = 0; - } - } - this.amplitude = this.target - this.offset; - this.timestamp = Date.now(); - requestAnimationFrame(this._autoScrollBound); - - if (this.dragged) { - e.preventDefault(); - e.stopPropagation(); - } - return false; - } - - /** - * Handle Carousel CLick - * @param {Event} e - */ - - }, { - key: "_handleCarouselClick", - value: function _handleCarouselClick(e) { - // Disable clicks if carousel was dragged. - if (this.dragged) { - e.preventDefault(); - e.stopPropagation(); - return false; - } else if (!this.options.fullWidth) { - var clickedIndex = $(e.target).closest('.carousel-item').index(); - var diff = this._wrap(this.center) - clickedIndex; - - // Disable clicks if carousel was shifted by click - if (diff !== 0) { - e.preventDefault(); - e.stopPropagation(); - } - this._cycleTo(clickedIndex); - } - } - - /** - * Handle Indicator CLick - * @param {Event} e - */ - - }, { - key: "_handleIndicatorClick", - value: function _handleIndicatorClick(e) { - e.stopPropagation(); - - var indicator = $(e.target).closest('.indicator-item'); - if (indicator.length) { - this._cycleTo(indicator.index()); - } - } - - /** - * Handle Throttle Resize - * @param {Event} e - */ - - }, { - key: "_handleResize", - value: function _handleResize(e) { - if (this.options.fullWidth) { - this.itemWidth = this.$el.find('.carousel-item').first().innerWidth(); - this.imageHeight = this.$el.find('.carousel-item.active').height(); - this.dim = this.itemWidth * 2 + this.options.padding; - this.offset = this.center * 2 * this.itemWidth; - this.target = this.offset; - this._setCarouselHeight(true); - } else { - this._scroll(); - } - } - - /** - * Set carousel height based on first slide - * @param {Booleam} imageOnly - true for image slides - */ - - }, { - key: "_setCarouselHeight", - value: function _setCarouselHeight(imageOnly) { - var _this65 = this; - - var firstSlide = this.$el.find('.carousel-item.active').length ? this.$el.find('.carousel-item.active').first() : this.$el.find('.carousel-item').first(); - var firstImage = firstSlide.find('img').first(); - if (firstImage.length) { - if (firstImage[0].complete) { - // If image won't trigger the load event - var imageHeight = firstImage.height(); - if (imageHeight > 0) { - this.$el.css('height', imageHeight + 'px'); - } else { - // If image still has no height, use the natural dimensions to calculate - var naturalWidth = firstImage[0].naturalWidth; - var naturalHeight = firstImage[0].naturalHeight; - var adjustedHeight = this.$el.width() / naturalWidth * naturalHeight; - this.$el.css('height', adjustedHeight + 'px'); - } - } else { - // Get height when image is loaded normally - firstImage.one('load', function (el, i) { - _this65.$el.css('height', el.offsetHeight + 'px'); - }); - } - } else if (!imageOnly) { - var slideHeight = firstSlide.height(); - this.$el.css('height', slideHeight + 'px'); - } - } - - /** - * Get x position from event - * @param {Event} e - */ - - }, { - key: "_xpos", - value: function _xpos(e) { - // touch event - if (e.targetTouches && e.targetTouches.length >= 1) { - return e.targetTouches[0].clientX; - } - - // mouse event - return e.clientX; - } - - /** - * Get y position from event - * @param {Event} e - */ - - }, { - key: "_ypos", - value: function _ypos(e) { - // touch event - if (e.targetTouches && e.targetTouches.length >= 1) { - return e.targetTouches[0].clientY; - } - - // mouse event - return e.clientY; - } - - /** - * Wrap index - * @param {Number} x - */ - - }, { - key: "_wrap", - value: function _wrap(x) { - return x >= this.count ? x % this.count : x < 0 ? this._wrap(this.count + x % this.count) : x; - } - - /** - * Tracks scrolling information - */ - - }, { - key: "_track", - value: function _track() { - var now = void 0, - elapsed = void 0, - delta = void 0, - v = void 0; - - now = Date.now(); - elapsed = now - this.timestamp; - this.timestamp = now; - delta = this.offset - this.frame; - this.frame = this.offset; - - v = 1000 * delta / (1 + elapsed); - this.velocity = 0.8 * v + 0.2 * this.velocity; - } - - /** - * Auto scrolls to nearest carousel item. - */ - - }, { - key: "_autoScroll", - value: function _autoScroll() { - var elapsed = void 0, - delta = void 0; - - if (this.amplitude) { - elapsed = Date.now() - this.timestamp; - delta = this.amplitude * Math.exp(-elapsed / this.options.duration); - if (delta > 2 || delta < -2) { - this._scroll(this.target - delta); - requestAnimationFrame(this._autoScrollBound); - } else { - this._scroll(this.target); - } - } - } - - /** - * Scroll to target - * @param {Number} x - */ - - }, { - key: "_scroll", - value: function _scroll(x) { - var _this66 = this; - - // Track scrolling state - if (!this.$el.hasClass('scrolling')) { - this.el.classList.add('scrolling'); - } - if (this.scrollingTimeout != null) { - window.clearTimeout(this.scrollingTimeout); - } - this.scrollingTimeout = window.setTimeout(function () { - _this66.$el.removeClass('scrolling'); - }, this.options.duration); - - // Start actual scroll - var i = void 0, - half = void 0, - delta = void 0, - dir = void 0, - tween = void 0, - el = void 0, - alignment = void 0, - zTranslation = void 0, - tweenedOpacity = void 0, - centerTweenedOpacity = void 0; - var lastCenter = this.center; - var numVisibleOffset = 1 / this.options.numVisible; - - this.offset = typeof x === 'number' ? x : this.offset; - this.center = Math.floor((this.offset + this.dim / 2) / this.dim); - delta = this.offset - this.center * this.dim; - dir = delta < 0 ? 1 : -1; - tween = -dir * delta * 2 / this.dim; - half = this.count >> 1; - - if (this.options.fullWidth) { - alignment = 'translateX(0)'; - centerTweenedOpacity = 1; - } else { - alignment = 'translateX(' + (this.el.clientWidth - this.itemWidth) / 2 + 'px) '; - alignment += 'translateY(' + (this.el.clientHeight - this.itemHeight) / 2 + 'px)'; - centerTweenedOpacity = 1 - numVisibleOffset * tween; - } - - // Set indicator active - if (this.showIndicators) { - var diff = this.center % this.count; - var activeIndicator = this.$indicators.find('.indicator-item.active'); - if (activeIndicator.index() !== diff) { - activeIndicator.removeClass('active'); - this.$indicators.find('.indicator-item').eq(diff)[0].classList.add('active'); - } - } - - // center - // Don't show wrapped items. - if (!this.noWrap || this.center >= 0 && this.center < this.count) { - el = this.images[this._wrap(this.center)]; - - // Add active class to center item. - if (!$(el).hasClass('active')) { - this.$el.find('.carousel-item').removeClass('active'); - el.classList.add('active'); - } - var transformString = alignment + " translateX(" + -delta / 2 + "px) translateX(" + dir * this.options.shift * tween * i + "px) translateZ(" + this.options.dist * tween + "px)"; - this._updateItemStyle(el, centerTweenedOpacity, 0, transformString); - } - - for (i = 1; i <= half; ++i) { - // right side - if (this.options.fullWidth) { - zTranslation = this.options.dist; - tweenedOpacity = i === half && delta < 0 ? 1 - tween : 1; - } else { - zTranslation = this.options.dist * (i * 2 + tween * dir); - tweenedOpacity = 1 - numVisibleOffset * (i * 2 + tween * dir); - } - // Don't show wrapped items. - if (!this.noWrap || this.center + i < this.count) { - el = this.images[this._wrap(this.center + i)]; - var _transformString = alignment + " translateX(" + (this.options.shift + (this.dim * i - delta) / 2) + "px) translateZ(" + zTranslation + "px)"; - this._updateItemStyle(el, tweenedOpacity, -i, _transformString); - } - - // left side - if (this.options.fullWidth) { - zTranslation = this.options.dist; - tweenedOpacity = i === half && delta > 0 ? 1 - tween : 1; - } else { - zTranslation = this.options.dist * (i * 2 - tween * dir); - tweenedOpacity = 1 - numVisibleOffset * (i * 2 - tween * dir); - } - // Don't show wrapped items. - if (!this.noWrap || this.center - i >= 0) { - el = this.images[this._wrap(this.center - i)]; - var _transformString2 = alignment + " translateX(" + (-this.options.shift + (-this.dim * i - delta) / 2) + "px) translateZ(" + zTranslation + "px)"; - this._updateItemStyle(el, tweenedOpacity, -i, _transformString2); - } - } - - // center - // Don't show wrapped items. - if (!this.noWrap || this.center >= 0 && this.center < this.count) { - el = this.images[this._wrap(this.center)]; - var _transformString3 = alignment + " translateX(" + -delta / 2 + "px) translateX(" + dir * this.options.shift * tween + "px) translateZ(" + this.options.dist * tween + "px)"; - this._updateItemStyle(el, centerTweenedOpacity, 0, _transformString3); - } - - // onCycleTo callback - var $currItem = this.$el.find('.carousel-item').eq(this._wrap(this.center)); - if (lastCenter !== this.center && typeof this.options.onCycleTo === 'function') { - this.options.onCycleTo.call(this, $currItem[0], this.dragged); - } - - // One time callback - if (typeof this.oneTimeCallback === 'function') { - this.oneTimeCallback.call(this, $currItem[0], this.dragged); - this.oneTimeCallback = null; - } - } - - /** - * Cycle to target - * @param {Element} el - * @param {Number} opacity - * @param {Number} zIndex - * @param {String} transform - */ - - }, { - key: "_updateItemStyle", - value: function _updateItemStyle(el, opacity, zIndex, transform) { - el.style[this.xform] = transform; - el.style.zIndex = zIndex; - el.style.opacity = opacity; - el.style.visibility = 'visible'; - } - - /** - * Cycle to target - * @param {Number} n - * @param {Function} callback - */ - - }, { - key: "_cycleTo", - value: function _cycleTo(n, callback) { - var diff = this.center % this.count - n; - - // Account for wraparound. - if (!this.noWrap) { - if (diff < 0) { - if (Math.abs(diff + this.count) < Math.abs(diff)) { - diff += this.count; - } - } else if (diff > 0) { - if (Math.abs(diff - this.count) < diff) { - diff -= this.count; - } - } - } - - this.target = this.dim * Math.round(this.offset / this.dim); - // Next - if (diff < 0) { - this.target += this.dim * Math.abs(diff); - - // Prev - } else if (diff > 0) { - this.target -= this.dim * diff; - } - - // Set one time callback - if (typeof callback === 'function') { - this.oneTimeCallback = callback; - } - - // Scroll - if (this.offset !== this.target) { - this.amplitude = this.target - this.offset; - this.timestamp = Date.now(); - requestAnimationFrame(this._autoScrollBound); - } - } - - /** - * Cycle to next item - * @param {Number} [n] - */ - - }, { - key: "next", - value: function next(n) { - if (n === undefined || isNaN(n)) { - n = 1; - } - - var index = this.center + n; - if (index >= this.count || index < 0) { - if (this.noWrap) { - return; - } - - index = this._wrap(index); - } - this._cycleTo(index); - } - - /** - * Cycle to previous item - * @param {Number} [n] - */ - - }, { - key: "prev", - value: function prev(n) { - if (n === undefined || isNaN(n)) { - n = 1; - } - - var index = this.center - n; - if (index >= this.count || index < 0) { - if (this.noWrap) { - return; - } - - index = this._wrap(index); - } - - this._cycleTo(index); - } - - /** - * Cycle to nth item - * @param {Number} [n] - * @param {Function} callback - */ - - }, { - key: "set", - value: function set(n, callback) { - if (n === undefined || isNaN(n)) { - n = 0; - } - - if (n > this.count || n < 0) { - if (this.noWrap) { - return; - } - - n = this._wrap(n); - } - - this._cycleTo(n, callback); - } - }], [{ - key: "init", - value: function init(els, options) { - return _get(Carousel.__proto__ || Object.getPrototypeOf(Carousel), "init", this).call(this, this, els, options); - } - - /** - * Get Instance - */ - - }, { - key: "getInstance", - value: function getInstance(el) { - var domElem = !!el.jquery ? el[0] : el; - return domElem.M_Carousel; - } - }, { - key: "defaults", - get: function () { - return _defaults; - } - }]); - - return Carousel; - }(Component); - - M.Carousel = Carousel; - - if (M.jQueryLoaded) { - M.initializeJqueryWrapper(Carousel, 'carousel', 'M_Carousel'); - } -})(cash); -;(function ($) { - 'use strict'; - - var _defaults = { - onOpen: undefined, - onClose: undefined - }; - - /** - * @class - * - */ - - var TapTarget = function (_Component19) { - _inherits(TapTarget, _Component19); - - /** - * Construct TapTarget instance - * @constructor - * @param {Element} el - * @param {Object} options - */ - function TapTarget(el, options) { - _classCallCheck(this, TapTarget); - - var _this67 = _possibleConstructorReturn(this, (TapTarget.__proto__ || Object.getPrototypeOf(TapTarget)).call(this, TapTarget, el, options)); - - _this67.el.M_TapTarget = _this67; - - /** - * Options for the select - * @member TapTarget#options - * @prop {Function} onOpen - Callback function called when feature discovery is opened - * @prop {Function} onClose - Callback function called when feature discovery is closed - */ - _this67.options = $.extend({}, TapTarget.defaults, options); - - _this67.isOpen = false; - - // setup - _this67.$origin = $('#' + _this67.$el.attr('data-target')); - _this67._setup(); - - _this67._calculatePositioning(); - _this67._setupEventHandlers(); - return _this67; - } - - _createClass(TapTarget, [{ - key: "destroy", - - - /** - * Teardown component - */ - value: function destroy() { - this._removeEventHandlers(); - this.el.TapTarget = undefined; - } - - /** - * Setup Event Handlers - */ - - }, { - key: "_setupEventHandlers", - value: function _setupEventHandlers() { - this._handleDocumentClickBound = this._handleDocumentClick.bind(this); - this._handleTargetClickBound = this._handleTargetClick.bind(this); - this._handleOriginClickBound = this._handleOriginClick.bind(this); - - this.el.addEventListener('click', this._handleTargetClickBound); - this.originEl.addEventListener('click', this._handleOriginClickBound); - - // Resize - var throttledResize = M.throttle(this._handleResize, 200); - this._handleThrottledResizeBound = throttledResize.bind(this); - - window.addEventListener('resize', this._handleThrottledResizeBound); - } - - /** - * Remove Event Handlers - */ - - }, { - key: "_removeEventHandlers", - value: function _removeEventHandlers() { - this.el.removeEventListener('click', this._handleTargetClickBound); - this.originEl.removeEventListener('click', this._handleOriginClickBound); - window.removeEventListener('resize', this._handleThrottledResizeBound); - } - - /** - * Handle Target Click - * @param {Event} e - */ - - }, { - key: "_handleTargetClick", - value: function _handleTargetClick(e) { - this.open(); - } - - /** - * Handle Origin Click - * @param {Event} e - */ - - }, { - key: "_handleOriginClick", - value: function _handleOriginClick(e) { - this.close(); - } - - /** - * Handle Resize - * @param {Event} e - */ - - }, { - key: "_handleResize", - value: function _handleResize(e) { - this._calculatePositioning(); - } - - /** - * Handle Resize - * @param {Event} e - */ - - }, { - key: "_handleDocumentClick", - value: function _handleDocumentClick(e) { - if (!$(e.target).closest('.tap-target-wrapper').length) { - this.close(); - e.preventDefault(); - e.stopPropagation(); - } - } - - /** - * Setup Tap Target - */ - - }, { - key: "_setup", - value: function _setup() { - // Creating tap target - this.wrapper = this.$el.parent()[0]; - this.waveEl = $(this.wrapper).find('.tap-target-wave')[0]; - this.originEl = $(this.wrapper).find('.tap-target-origin')[0]; - this.contentEl = this.$el.find('.tap-target-content')[0]; - - // Creating wrapper - if (!$(this.wrapper).hasClass('.tap-target-wrapper')) { - this.wrapper = document.createElement('div'); - this.wrapper.classList.add('tap-target-wrapper'); - this.$el.before($(this.wrapper)); - this.wrapper.append(this.el); - } - - // Creating content - if (!this.contentEl) { - this.contentEl = document.createElement('div'); - this.contentEl.classList.add('tap-target-content'); - this.$el.append(this.contentEl); - } - - // Creating foreground wave - if (!this.waveEl) { - this.waveEl = document.createElement('div'); - this.waveEl.classList.add('tap-target-wave'); - - // Creating origin - if (!this.originEl) { - this.originEl = this.$origin.clone(true, true); - this.originEl.addClass('tap-target-origin'); - this.originEl.removeAttr('id'); - this.originEl.removeAttr('style'); - this.originEl = this.originEl[0]; - this.waveEl.append(this.originEl); - } - - this.wrapper.append(this.waveEl); - } - } - - /** - * Calculate positioning - */ - - }, { - key: "_calculatePositioning", - value: function _calculatePositioning() { - // Element or parent is fixed position? - var isFixed = this.$origin.css('position') === 'fixed'; - if (!isFixed) { - var parents = this.$origin.parents(); - for (var i = 0; i < parents.length; i++) { - isFixed = $(parents[i]).css('position') == 'fixed'; - if (isFixed) { - break; - } - } - } - - // Calculating origin - var originWidth = this.$origin.outerWidth(); - var originHeight = this.$origin.outerHeight(); - var originTop = isFixed ? this.$origin.offset().top - M.getDocumentScrollTop() : this.$origin.offset().top; - var originLeft = isFixed ? this.$origin.offset().left - M.getDocumentScrollLeft() : this.$origin.offset().left; - - // Calculating screen - var windowWidth = window.innerWidth; - var windowHeight = window.innerHeight; - var centerX = windowWidth / 2; - var centerY = windowHeight / 2; - var isLeft = originLeft <= centerX; - var isRight = originLeft > centerX; - var isTop = originTop <= centerY; - var isBottom = originTop > centerY; - var isCenterX = originLeft >= windowWidth * 0.25 && originLeft <= windowWidth * 0.75; - - // Calculating tap target - var tapTargetWidth = this.$el.outerWidth(); - var tapTargetHeight = this.$el.outerHeight(); - var tapTargetTop = originTop + originHeight / 2 - tapTargetHeight / 2; - var tapTargetLeft = originLeft + originWidth / 2 - tapTargetWidth / 2; - var tapTargetPosition = isFixed ? 'fixed' : 'absolute'; - - // Calculating content - var tapTargetTextWidth = isCenterX ? tapTargetWidth : tapTargetWidth / 2 + originWidth; - var tapTargetTextHeight = tapTargetHeight / 2; - var tapTargetTextTop = isTop ? tapTargetHeight / 2 : 0; - var tapTargetTextBottom = 0; - var tapTargetTextLeft = isLeft && !isCenterX ? tapTargetWidth / 2 - originWidth : 0; - var tapTargetTextRight = 0; - var tapTargetTextPadding = originWidth; - var tapTargetTextAlign = isBottom ? 'bottom' : 'top'; - - // Calculating wave - var tapTargetWaveWidth = originWidth > originHeight ? originWidth * 2 : originWidth * 2; - var tapTargetWaveHeight = tapTargetWaveWidth; - var tapTargetWaveTop = tapTargetHeight / 2 - tapTargetWaveHeight / 2; - var tapTargetWaveLeft = tapTargetWidth / 2 - tapTargetWaveWidth / 2; - - // Setting tap target - var tapTargetWrapperCssObj = {}; - tapTargetWrapperCssObj.top = isTop ? tapTargetTop + 'px' : ''; - tapTargetWrapperCssObj.right = isRight ? windowWidth - tapTargetLeft - tapTargetWidth + 'px' : ''; - tapTargetWrapperCssObj.bottom = isBottom ? windowHeight - tapTargetTop - tapTargetHeight + 'px' : ''; - tapTargetWrapperCssObj.left = isLeft ? tapTargetLeft + 'px' : ''; - tapTargetWrapperCssObj.position = tapTargetPosition; - $(this.wrapper).css(tapTargetWrapperCssObj); - - // Setting content - $(this.contentEl).css({ - width: tapTargetTextWidth + 'px', - height: tapTargetTextHeight + 'px', - top: tapTargetTextTop + 'px', - right: tapTargetTextRight + 'px', - bottom: tapTargetTextBottom + 'px', - left: tapTargetTextLeft + 'px', - padding: tapTargetTextPadding + 'px', - verticalAlign: tapTargetTextAlign - }); - - // Setting wave - $(this.waveEl).css({ - top: tapTargetWaveTop + 'px', - left: tapTargetWaveLeft + 'px', - width: tapTargetWaveWidth + 'px', - height: tapTargetWaveHeight + 'px' - }); - } - - /** - * Open TapTarget - */ - - }, { - key: "open", - value: function open() { - if (this.isOpen) { - return; - } - - // onOpen callback - if (typeof this.options.onOpen === 'function') { - this.options.onOpen.call(this, this.$origin[0]); - } - - this.isOpen = true; - this.wrapper.classList.add('open'); - - document.body.addEventListener('click', this._handleDocumentClickBound, true); - document.body.addEventListener('touchend', this._handleDocumentClickBound); - } - - /** - * Close Tap Target - */ - - }, { - key: "close", - value: function close() { - if (!this.isOpen) { - return; - } - - // onClose callback - if (typeof this.options.onClose === 'function') { - this.options.onClose.call(this, this.$origin[0]); - } - - this.isOpen = false; - this.wrapper.classList.remove('open'); - - document.body.removeEventListener('click', this._handleDocumentClickBound, true); - document.body.removeEventListener('touchend', this._handleDocumentClickBound); - } - }], [{ - key: "init", - value: function init(els, options) { - return _get(TapTarget.__proto__ || Object.getPrototypeOf(TapTarget), "init", this).call(this, this, els, options); - } - - /** - * Get Instance - */ - - }, { - key: "getInstance", - value: function getInstance(el) { - var domElem = !!el.jquery ? el[0] : el; - return domElem.M_TapTarget; - } - }, { - key: "defaults", - get: function () { - return _defaults; - } - }]); - - return TapTarget; - }(Component); - - M.TapTarget = TapTarget; - - if (M.jQueryLoaded) { - M.initializeJqueryWrapper(TapTarget, 'tapTarget', 'M_TapTarget'); - } -})(cash); -;(function ($) { - 'use strict'; - - var _defaults = { - classes: '', - dropdownOptions: {} - }; - - /** - * @class - * - */ - - var FormSelect = function (_Component20) { - _inherits(FormSelect, _Component20); - - /** - * Construct FormSelect instance - * @constructor - * @param {Element} el - * @param {Object} options - */ - function FormSelect(el, options) { - _classCallCheck(this, FormSelect); - - // Don't init if browser default version - var _this68 = _possibleConstructorReturn(this, (FormSelect.__proto__ || Object.getPrototypeOf(FormSelect)).call(this, FormSelect, el, options)); - - if (_this68.$el.hasClass('browser-default')) { - return _possibleConstructorReturn(_this68); - } - - _this68.el.M_FormSelect = _this68; - - /** - * Options for the select - * @member FormSelect#options - */ - _this68.options = $.extend({}, FormSelect.defaults, options); - - _this68.isMultiple = _this68.$el.prop('multiple'); - - // Setup - _this68.el.tabIndex = -1; - _this68._keysSelected = {}; - _this68._valueDict = {}; // Maps key to original and generated option element. - _this68._setupDropdown(); - - _this68._setupEventHandlers(); - return _this68; - } - - _createClass(FormSelect, [{ - key: "destroy", - - - /** - * Teardown component - */ - value: function destroy() { - this._removeEventHandlers(); - this._removeDropdown(); - this.el.M_FormSelect = undefined; - } - - /** - * Setup Event Handlers - */ - - }, { - key: "_setupEventHandlers", - value: function _setupEventHandlers() { - var _this69 = this; - - this._handleSelectChangeBound = this._handleSelectChange.bind(this); - this._handleOptionClickBound = this._handleOptionClick.bind(this); - this._handleInputClickBound = this._handleInputClick.bind(this); - - $(this.dropdownOptions).find('li:not(.optgroup)').each(function (el) { - el.addEventListener('click', _this69._handleOptionClickBound); - }); - this.el.addEventListener('change', this._handleSelectChangeBound); - this.input.addEventListener('click', this._handleInputClickBound); - } - - /** - * Remove Event Handlers - */ - - }, { - key: "_removeEventHandlers", - value: function _removeEventHandlers() { - var _this70 = this; - - $(this.dropdownOptions).find('li:not(.optgroup)').each(function (el) { - el.removeEventListener('click', _this70._handleOptionClickBound); - }); - this.el.removeEventListener('change', this._handleSelectChangeBound); - this.input.removeEventListener('click', this._handleInputClickBound); - } - - /** - * Handle Select Change - * @param {Event} e - */ - - }, { - key: "_handleSelectChange", - value: function _handleSelectChange(e) { - this._setValueToInput(); - } - - /** - * Handle Option Click - * @param {Event} e - */ - - }, { - key: "_handleOptionClick", - value: function _handleOptionClick(e) { - e.preventDefault(); - var optionEl = $(e.target).closest('li')[0]; - this._selectOption(optionEl); - e.stopPropagation(); - } - }, { - key: "_selectOption", - value: function _selectOption(optionEl) { - var key = optionEl.id; - if (!$(optionEl).hasClass('disabled') && !$(optionEl).hasClass('optgroup') && key.length) { - var selected = true; - - if (this.isMultiple) { - // Deselect placeholder option if still selected. - var placeholderOption = $(this.dropdownOptions).find('li.disabled.selected'); - if (placeholderOption.length) { - placeholderOption.removeClass('selected'); - placeholderOption.find('input[type="checkbox"]').prop('checked', false); - this._toggleEntryFromArray(placeholderOption[0].id); - } - selected = this._toggleEntryFromArray(key); - } else { - $(this.dropdownOptions).find('li').removeClass('selected'); - $(optionEl).toggleClass('selected', selected); - this._keysSelected = {}; - this._keysSelected[optionEl.id] = true; - } - - // Set selected on original select option - // Only trigger if selected state changed - var prevSelected = $(this._valueDict[key].el).prop('selected'); - if (prevSelected !== selected) { - $(this._valueDict[key].el).prop('selected', selected); - this.$el.trigger('change'); - } - } - - if (!this.isMultiple) { - this.dropdown.close(); - } - } - - /** - * Handle Input Click - */ - - }, { - key: "_handleInputClick", - value: function _handleInputClick() { - if (this.dropdown && this.dropdown.isOpen) { - this._setValueToInput(); - this._setSelectedStates(); - } - } - - /** - * Setup dropdown - */ - - }, { - key: "_setupDropdown", - value: function _setupDropdown() { - var _this71 = this; - - this.wrapper = document.createElement('div'); - $(this.wrapper).addClass('select-wrapper ' + this.options.classes); - this.$el.before($(this.wrapper)); - // Move actual select element into overflow hidden wrapper - var $hideSelect = $('
        '); - $(this.wrapper).append($hideSelect); - $hideSelect[0].appendChild(this.el); - - if (this.el.disabled) { - this.wrapper.classList.add('disabled'); - } - - // Create dropdown - this.$selectOptions = this.$el.children('option, optgroup'); - this.dropdownOptions = document.createElement('ul'); - this.dropdownOptions.id = "select-options-" + M.guid(); - $(this.dropdownOptions).addClass('dropdown-content select-dropdown ' + (this.isMultiple ? 'multiple-select-dropdown' : '')); - - // Create dropdown structure. - if (this.$selectOptions.length) { - this.$selectOptions.each(function (el) { - if ($(el).is('option')) { - // Direct descendant option. - var optionEl = void 0; - if (_this71.isMultiple) { - optionEl = _this71._appendOptionWithIcon(_this71.$el, el, 'multiple'); - } else { - optionEl = _this71._appendOptionWithIcon(_this71.$el, el); - } - - _this71._addOptionToValueDict(el, optionEl); - } else if ($(el).is('optgroup')) { - // Optgroup. - var selectOptions = $(el).children('option'); - $(_this71.dropdownOptions).append($('
      • ' + el.getAttribute('label') + '
      • ')[0]); - - selectOptions.each(function (el) { - var optionEl = _this71._appendOptionWithIcon(_this71.$el, el, 'optgroup-option'); - _this71._addOptionToValueDict(el, optionEl); - }); - } - }); - } - - $(this.wrapper).append(this.dropdownOptions); - - // Add input dropdown - this.input = document.createElement('input'); - $(this.input).addClass('select-dropdown dropdown-trigger'); - this.input.setAttribute('type', 'text'); - this.input.setAttribute('readonly', 'true'); - this.input.setAttribute('data-target', this.dropdownOptions.id); - if (this.el.disabled) { - $(this.input).prop('disabled', 'true'); - } - - $(this.wrapper).prepend(this.input); - this._setValueToInput(); - - // Add caret - var dropdownIcon = $(''); - $(this.wrapper).prepend(dropdownIcon[0]); - - // Initialize dropdown - if (!this.el.disabled) { - var dropdownOptions = $.extend({}, this.options.dropdownOptions); - var userOnOpenEnd = dropdownOptions.onOpenEnd; - - // Add callback for centering selected option when dropdown content is scrollable - dropdownOptions.onOpenEnd = function (el) { - var selectedOption = $(_this71.dropdownOptions).find('.selected').first(); - - if (selectedOption.length) { - // Focus selected option in dropdown - M.keyDown = true; - _this71.dropdown.focusedIndex = selectedOption.index(); - _this71.dropdown._focusFocusedItem(); - M.keyDown = false; - - // Handle scrolling to selected option - if (_this71.dropdown.isScrollable) { - var scrollOffset = selectedOption[0].getBoundingClientRect().top - _this71.dropdownOptions.getBoundingClientRect().top; // scroll to selected option - scrollOffset -= _this71.dropdownOptions.clientHeight / 2; // center in dropdown - _this71.dropdownOptions.scrollTop = scrollOffset; - } - } - - // Handle user declared onOpenEnd if needed - if (userOnOpenEnd && typeof userOnOpenEnd === 'function') { - userOnOpenEnd.call(_this71.dropdown, _this71.el); - } - }; - - // Prevent dropdown from closing too early - dropdownOptions.closeOnClick = false; - - this.dropdown = M.Dropdown.init(this.input, dropdownOptions); - } - - // Add initial selections - this._setSelectedStates(); - } - - /** - * Add option to value dict - * @param {Element} el original option element - * @param {Element} optionEl generated option element - */ - - }, { - key: "_addOptionToValueDict", - value: function _addOptionToValueDict(el, optionEl) { - var index = Object.keys(this._valueDict).length; - var key = this.dropdownOptions.id + index; - var obj = {}; - optionEl.id = key; - - obj.el = el; - obj.optionEl = optionEl; - this._valueDict[key] = obj; - } - - /** - * Remove dropdown - */ - - }, { - key: "_removeDropdown", - value: function _removeDropdown() { - $(this.wrapper).find('.caret').remove(); - $(this.input).remove(); - $(this.dropdownOptions).remove(); - $(this.wrapper).before(this.$el); - $(this.wrapper).remove(); - } - - /** - * Setup dropdown - * @param {Element} select select element - * @param {Element} option option element from select - * @param {String} type - * @return {Element} option element added - */ - - }, { - key: "_appendOptionWithIcon", - value: function _appendOptionWithIcon(select, option, type) { - // Add disabled attr if disabled - var disabledClass = option.disabled ? 'disabled ' : ''; - var optgroupClass = type === 'optgroup-option' ? 'optgroup-option ' : ''; - var multipleCheckbox = this.isMultiple ? "" : option.innerHTML; - var liEl = $('
      • '); - var spanEl = $(''); - spanEl.html(multipleCheckbox); - liEl.addClass(disabledClass + " " + optgroupClass); - liEl.append(spanEl); - - // add icons - var iconUrl = option.getAttribute('data-icon'); - if (!!iconUrl) { - var imgEl = $("\"\""); - liEl.prepend(imgEl); - } - - // Check for multiple type. - $(this.dropdownOptions).append(liEl[0]); - return liEl[0]; - } - - /** - * Toggle entry from option - * @param {String} key Option key - * @return {Boolean} if entry was added or removed - */ - - }, { - key: "_toggleEntryFromArray", - value: function _toggleEntryFromArray(key) { - var notAdded = !this._keysSelected.hasOwnProperty(key); - var $optionLi = $(this._valueDict[key].optionEl); - - if (notAdded) { - this._keysSelected[key] = true; - } else { - delete this._keysSelected[key]; - } - - $optionLi.toggleClass('selected', notAdded); - - // Set checkbox checked value - $optionLi.find('input[type="checkbox"]').prop('checked', notAdded); - - // use notAdded instead of true (to detect if the option is selected or not) - $optionLi.prop('selected', notAdded); - - return notAdded; - } - - /** - * Set text value to input - */ - - }, { - key: "_setValueToInput", - value: function _setValueToInput() { - var values = []; - var options = this.$el.find('option'); - - options.each(function (el) { - if ($(el).prop('selected')) { - var text = $(el).text().trim(); - values.push(text); - } - }); - - if (!values.length) { - var firstDisabled = this.$el.find('option:disabled').eq(0); - if (firstDisabled.length && firstDisabled[0].value === '') { - values.push(firstDisabled.text()); - } - } - - this.input.value = values.join(', '); - } - - /** - * Set selected state of dropdown to match actual select element - */ - - }, { - key: "_setSelectedStates", - value: function _setSelectedStates() { - this._keysSelected = {}; - - for (var key in this._valueDict) { - var option = this._valueDict[key]; - var optionIsSelected = $(option.el).prop('selected'); - $(option.optionEl).find('input[type="checkbox"]').prop('checked', optionIsSelected); - if (optionIsSelected) { - this._activateOption($(this.dropdownOptions), $(option.optionEl)); - this._keysSelected[key] = true; - } else { - $(option.optionEl).removeClass('selected'); - } - } - } - - /** - * Make option as selected and scroll to selected position - * @param {jQuery} collection Select options jQuery element - * @param {Element} newOption element of the new option - */ - - }, { - key: "_activateOption", - value: function _activateOption(collection, newOption) { - if (newOption) { - if (!this.isMultiple) { - collection.find('li.selected').removeClass('selected'); - } - var option = $(newOption); - option.addClass('selected'); - } - } - - /** - * Get Selected Values - * @return {Array} Array of selected values - */ - - }, { - key: "getSelectedValues", - value: function getSelectedValues() { - var selectedValues = []; - for (var key in this._keysSelected) { - selectedValues.push(this._valueDict[key].el.value); - } - return selectedValues; - } - }], [{ - key: "init", - value: function init(els, options) { - return _get(FormSelect.__proto__ || Object.getPrototypeOf(FormSelect), "init", this).call(this, this, els, options); - } - - /** - * Get Instance - */ - - }, { - key: "getInstance", - value: function getInstance(el) { - var domElem = !!el.jquery ? el[0] : el; - return domElem.M_FormSelect; - } - }, { - key: "defaults", - get: function () { - return _defaults; - } - }]); - - return FormSelect; - }(Component); - - M.FormSelect = FormSelect; - - if (M.jQueryLoaded) { - M.initializeJqueryWrapper(FormSelect, 'formSelect', 'M_FormSelect'); - } -})(cash); -;(function ($, anim) { - 'use strict'; - - var _defaults = {}; - - /** - * @class - * - */ - - var Range = function (_Component21) { - _inherits(Range, _Component21); - - /** - * Construct Range instance - * @constructor - * @param {Element} el - * @param {Object} options - */ - function Range(el, options) { - _classCallCheck(this, Range); - - var _this72 = _possibleConstructorReturn(this, (Range.__proto__ || Object.getPrototypeOf(Range)).call(this, Range, el, options)); - - _this72.el.M_Range = _this72; - - /** - * Options for the range - * @member Range#options - */ - _this72.options = $.extend({}, Range.defaults, options); - - _this72._mousedown = false; - - // Setup - _this72._setupThumb(); - - _this72._setupEventHandlers(); - return _this72; - } - - _createClass(Range, [{ - key: "destroy", - - - /** - * Teardown component - */ - value: function destroy() { - this._removeEventHandlers(); - this._removeThumb(); - this.el.M_Range = undefined; - } - - /** - * Setup Event Handlers - */ - - }, { - key: "_setupEventHandlers", - value: function _setupEventHandlers() { - this._handleRangeChangeBound = this._handleRangeChange.bind(this); - this._handleRangeMousedownTouchstartBound = this._handleRangeMousedownTouchstart.bind(this); - this._handleRangeInputMousemoveTouchmoveBound = this._handleRangeInputMousemoveTouchmove.bind(this); - this._handleRangeMouseupTouchendBound = this._handleRangeMouseupTouchend.bind(this); - this._handleRangeBlurMouseoutTouchleaveBound = this._handleRangeBlurMouseoutTouchleave.bind(this); - - this.el.addEventListener('change', this._handleRangeChangeBound); - - this.el.addEventListener('mousedown', this._handleRangeMousedownTouchstartBound); - this.el.addEventListener('touchstart', this._handleRangeMousedownTouchstartBound); - - this.el.addEventListener('input', this._handleRangeInputMousemoveTouchmoveBound); - this.el.addEventListener('mousemove', this._handleRangeInputMousemoveTouchmoveBound); - this.el.addEventListener('touchmove', this._handleRangeInputMousemoveTouchmoveBound); - - this.el.addEventListener('mouseup', this._handleRangeMouseupTouchendBound); - this.el.addEventListener('touchend', this._handleRangeMouseupTouchendBound); - - this.el.addEventListener('blur', this._handleRangeBlurMouseoutTouchleaveBound); - this.el.addEventListener('mouseout', this._handleRangeBlurMouseoutTouchleaveBound); - this.el.addEventListener('touchleave', this._handleRangeBlurMouseoutTouchleaveBound); - } - - /** - * Remove Event Handlers - */ - - }, { - key: "_removeEventHandlers", - value: function _removeEventHandlers() { - this.el.removeEventListener('change', this._handleRangeChangeBound); - - this.el.removeEventListener('mousedown', this._handleRangeMousedownTouchstartBound); - this.el.removeEventListener('touchstart', this._handleRangeMousedownTouchstartBound); - - this.el.removeEventListener('input', this._handleRangeInputMousemoveTouchmoveBound); - this.el.removeEventListener('mousemove', this._handleRangeInputMousemoveTouchmoveBound); - this.el.removeEventListener('touchmove', this._handleRangeInputMousemoveTouchmoveBound); - - this.el.removeEventListener('mouseup', this._handleRangeMouseupTouchendBound); - this.el.removeEventListener('touchend', this._handleRangeMouseupTouchendBound); - - this.el.removeEventListener('blur', this._handleRangeBlurMouseoutTouchleaveBound); - this.el.removeEventListener('mouseout', this._handleRangeBlurMouseoutTouchleaveBound); - this.el.removeEventListener('touchleave', this._handleRangeBlurMouseoutTouchleaveBound); - } - - /** - * Handle Range Change - * @param {Event} e - */ - - }, { - key: "_handleRangeChange", - value: function _handleRangeChange() { - $(this.value).html(this.$el.val()); - - if (!$(this.thumb).hasClass('active')) { - this._showRangeBubble(); - } - - var offsetLeft = this._calcRangeOffset(); - $(this.thumb).addClass('active').css('left', offsetLeft + 'px'); - } - - /** - * Handle Range Mousedown and Touchstart - * @param {Event} e - */ - - }, { - key: "_handleRangeMousedownTouchstart", - value: function _handleRangeMousedownTouchstart(e) { - // Set indicator value - $(this.value).html(this.$el.val()); - - this._mousedown = true; - this.$el.addClass('active'); - - if (!$(this.thumb).hasClass('active')) { - this._showRangeBubble(); - } - - if (e.type !== 'input') { - var offsetLeft = this._calcRangeOffset(); - $(this.thumb).addClass('active').css('left', offsetLeft + 'px'); - } - } - - /** - * Handle Range Input, Mousemove and Touchmove - */ - - }, { - key: "_handleRangeInputMousemoveTouchmove", - value: function _handleRangeInputMousemoveTouchmove() { - if (this._mousedown) { - if (!$(this.thumb).hasClass('active')) { - this._showRangeBubble(); - } - - var offsetLeft = this._calcRangeOffset(); - $(this.thumb).addClass('active').css('left', offsetLeft + 'px'); - $(this.value).html(this.$el.val()); - } - } - - /** - * Handle Range Mouseup and Touchend - */ - - }, { - key: "_handleRangeMouseupTouchend", - value: function _handleRangeMouseupTouchend() { - this._mousedown = false; - this.$el.removeClass('active'); - } - - /** - * Handle Range Blur, Mouseout and Touchleave - */ - - }, { - key: "_handleRangeBlurMouseoutTouchleave", - value: function _handleRangeBlurMouseoutTouchleave() { - if (!this._mousedown) { - var paddingLeft = parseInt(this.$el.css('padding-left')); - var marginLeft = 7 + paddingLeft + 'px'; - - if ($(this.thumb).hasClass('active')) { - anim.remove(this.thumb); - anim({ - targets: this.thumb, - height: 0, - width: 0, - top: 10, - easing: 'easeOutQuad', - marginLeft: marginLeft, - duration: 100 - }); - } - $(this.thumb).removeClass('active'); - } - } - - /** - * Setup dropdown - */ - - }, { - key: "_setupThumb", - value: function _setupThumb() { - this.thumb = document.createElement('span'); - this.value = document.createElement('span'); - $(this.thumb).addClass('thumb'); - $(this.value).addClass('value'); - $(this.thumb).append(this.value); - this.$el.after(this.thumb); - } - - /** - * Remove dropdown - */ - - }, { - key: "_removeThumb", - value: function _removeThumb() { - $(this.thumb).remove(); - } - - /** - * morph thumb into bubble - */ - - }, { - key: "_showRangeBubble", - value: function _showRangeBubble() { - var paddingLeft = parseInt($(this.thumb).parent().css('padding-left')); - var marginLeft = -7 + paddingLeft + 'px'; // TODO: fix magic number? - anim.remove(this.thumb); - anim({ - targets: this.thumb, - height: 30, - width: 30, - top: -30, - marginLeft: marginLeft, - duration: 300, - easing: 'easeOutQuint' - }); - } - - /** - * Calculate the offset of the thumb - * @return {Number} offset in pixels - */ - - }, { - key: "_calcRangeOffset", - value: function _calcRangeOffset() { - var width = this.$el.width() - 15; - var max = parseFloat(this.$el.attr('max')) || 100; // Range default max - var min = parseFloat(this.$el.attr('min')) || 0; // Range default min - var percent = (parseFloat(this.$el.val()) - min) / (max - min); - return percent * width; - } - }], [{ - key: "init", - value: function init(els, options) { - return _get(Range.__proto__ || Object.getPrototypeOf(Range), "init", this).call(this, this, els, options); - } - - /** - * Get Instance - */ - - }, { - key: "getInstance", - value: function getInstance(el) { - var domElem = !!el.jquery ? el[0] : el; - return domElem.M_Range; - } - }, { - key: "defaults", - get: function () { - return _defaults; - } - }]); - - return Range; - }(Component); - - M.Range = Range; - - if (M.jQueryLoaded) { - M.initializeJqueryWrapper(Range, 'range', 'M_Range'); - } - - Range.init($('input[type=range]')); -})(cash, M.anime); - -//# sourceMappingURL=materialize_concat.js.map -//# sourceMappingURL=materialize.js.map +var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; + +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; }; }(); + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +/*! cash-dom 1.3.5, https://github.com/kenwheeler/cash @license MIT */ +(function (factory) { + window.cash = factory(); +})(function () { + var doc = document, + win = window, + ArrayProto = Array.prototype, + slice = ArrayProto.slice, + filter = ArrayProto.filter, + push = ArrayProto.push; + + var noop = function () {}, + isFunction = function (item) { + // @see https://crbug.com/568448 + return typeof item === typeof noop && item.call; + }, + isString = function (item) { + return typeof item === typeof ""; + }; + + var idMatch = /^#[\w-]*$/, + classMatch = /^\.[\w-]*$/, + htmlMatch = /<.+>/, + singlet = /^\w+$/; + + function find(selector, context) { + context = context || doc; + var elems = classMatch.test(selector) ? context.getElementsByClassName(selector.slice(1)) : singlet.test(selector) ? context.getElementsByTagName(selector) : context.querySelectorAll(selector); + return elems; + } + + var frag; + function parseHTML(str) { + if (!frag) { + frag = doc.implementation.createHTMLDocument(null); + var base = frag.createElement("base"); + base.href = doc.location.href; + frag.head.appendChild(base); + } + + frag.body.innerHTML = str; + + return frag.body.childNodes; + } + + function onReady(fn) { + if (doc.readyState !== "loading") { + fn(); + } else { + doc.addEventListener("DOMContentLoaded", fn); + } + } + + function Init(selector, context) { + if (!selector) { + return this; + } + + // If already a cash collection, don't do any further processing + if (selector.cash && selector !== win) { + return selector; + } + + var elems = selector, + i = 0, + length; + + if (isString(selector)) { + elems = idMatch.test(selector) ? + // If an ID use the faster getElementById check + doc.getElementById(selector.slice(1)) : htmlMatch.test(selector) ? + // If HTML, parse it into real elements + parseHTML(selector) : + // else use `find` + find(selector, context); + + // If function, use as shortcut for DOM ready + } else if (isFunction(selector)) { + onReady(selector);return this; + } + + if (!elems) { + return this; + } + + // If a single DOM element is passed in or received via ID, return the single element + if (elems.nodeType || elems === win) { + this[0] = elems; + this.length = 1; + } else { + // Treat like an array and loop through each item. + length = this.length = elems.length; + for (; i < length; i++) { + this[i] = elems[i]; + } + } + + return this; + } + + function cash(selector, context) { + return new Init(selector, context); + } + + var fn = cash.fn = cash.prototype = Init.prototype = { // jshint ignore:line + cash: true, + length: 0, + push: push, + splice: ArrayProto.splice, + map: ArrayProto.map, + init: Init + }; + + Object.defineProperty(fn, "constructor", { value: cash }); + + cash.parseHTML = parseHTML; + cash.noop = noop; + cash.isFunction = isFunction; + cash.isString = isString; + + cash.extend = fn.extend = function (target) { + target = target || {}; + + var args = slice.call(arguments), + length = args.length, + i = 1; + + if (args.length === 1) { + target = this; + i = 0; + } + + for (; i < length; i++) { + if (!args[i]) { + continue; + } + for (var key in args[i]) { + if (args[i].hasOwnProperty(key)) { + target[key] = args[i][key]; + } + } + } + + return target; + }; + + function each(collection, callback) { + var l = collection.length, + i = 0; + + for (; i < l; i++) { + if (callback.call(collection[i], collection[i], i, collection) === false) { + break; + } + } + } + + function matches(el, selector) { + var m = el && (el.matches || el.webkitMatchesSelector || el.mozMatchesSelector || el.msMatchesSelector || el.oMatchesSelector); + return !!m && m.call(el, selector); + } + + function getCompareFunction(selector) { + return ( + /* Use browser's `matches` function if string */ + isString(selector) ? matches : + /* Match a cash element */ + selector.cash ? function (el) { + return selector.is(el); + } : + /* Direct comparison */ + function (el, selector) { + return el === selector; + } + ); + } + + function unique(collection) { + return cash(slice.call(collection).filter(function (item, index, self) { + return self.indexOf(item) === index; + })); + } + + cash.extend({ + merge: function (first, second) { + var len = +second.length, + i = first.length, + j = 0; + + for (; j < len; i++, j++) { + first[i] = second[j]; + } + + first.length = i; + return first; + }, + + each: each, + matches: matches, + unique: unique, + isArray: Array.isArray, + isNumeric: function (n) { + return !isNaN(parseFloat(n)) && isFinite(n); + } + + }); + + var uid = cash.uid = "_cash" + Date.now(); + + function getDataCache(node) { + return node[uid] = node[uid] || {}; + } + + function setData(node, key, value) { + return getDataCache(node)[key] = value; + } + + function getData(node, key) { + var c = getDataCache(node); + if (c[key] === undefined) { + c[key] = node.dataset ? node.dataset[key] : cash(node).attr("data-" + key); + } + return c[key]; + } + + function removeData(node, key) { + var c = getDataCache(node); + if (c) { + delete c[key]; + } else if (node.dataset) { + delete node.dataset[key]; + } else { + cash(node).removeAttr("data-" + name); + } + } + + fn.extend({ + data: function (name, value) { + if (isString(name)) { + return value === undefined ? getData(this[0], name) : this.each(function (v) { + return setData(v, name, value); + }); + } + + for (var key in name) { + this.data(key, name[key]); + } + + return this; + }, + + removeData: function (key) { + return this.each(function (v) { + return removeData(v, key); + }); + } + + }); + + var notWhiteMatch = /\S+/g; + + function getClasses(c) { + return isString(c) && c.match(notWhiteMatch); + } + + function hasClass(v, c) { + return v.classList ? v.classList.contains(c) : new RegExp("(^| )" + c + "( |$)", "gi").test(v.className); + } + + function addClass(v, c, spacedName) { + if (v.classList) { + v.classList.add(c); + } else if (spacedName.indexOf(" " + c + " ")) { + v.className += " " + c; + } + } + + function removeClass(v, c) { + if (v.classList) { + v.classList.remove(c); + } else { + v.className = v.className.replace(c, ""); + } + } + + fn.extend({ + addClass: function (c) { + var classes = getClasses(c); + + return classes ? this.each(function (v) { + var spacedName = " " + v.className + " "; + each(classes, function (c) { + addClass(v, c, spacedName); + }); + }) : this; + }, + + attr: function (name, value) { + if (!name) { + return undefined; + } + + if (isString(name)) { + if (value === undefined) { + return this[0] ? this[0].getAttribute ? this[0].getAttribute(name) : this[0][name] : undefined; + } + + return this.each(function (v) { + if (v.setAttribute) { + v.setAttribute(name, value); + } else { + v[name] = value; + } + }); + } + + for (var key in name) { + this.attr(key, name[key]); + } + + return this; + }, + + hasClass: function (c) { + var check = false, + classes = getClasses(c); + if (classes && classes.length) { + this.each(function (v) { + check = hasClass(v, classes[0]); + return !check; + }); + } + return check; + }, + + prop: function (name, value) { + if (isString(name)) { + return value === undefined ? this[0][name] : this.each(function (v) { + v[name] = value; + }); + } + + for (var key in name) { + this.prop(key, name[key]); + } + + return this; + }, + + removeAttr: function (name) { + return this.each(function (v) { + if (v.removeAttribute) { + v.removeAttribute(name); + } else { + delete v[name]; + } + }); + }, + + removeClass: function (c) { + if (!arguments.length) { + return this.attr("class", ""); + } + var classes = getClasses(c); + return classes ? this.each(function (v) { + each(classes, function (c) { + removeClass(v, c); + }); + }) : this; + }, + + removeProp: function (name) { + return this.each(function (v) { + delete v[name]; + }); + }, + + toggleClass: function (c, state) { + if (state !== undefined) { + return this[state ? "addClass" : "removeClass"](c); + } + var classes = getClasses(c); + return classes ? this.each(function (v) { + var spacedName = " " + v.className + " "; + each(classes, function (c) { + if (hasClass(v, c)) { + removeClass(v, c); + } else { + addClass(v, c, spacedName); + } + }); + }) : this; + } }); + + fn.extend({ + add: function (selector, context) { + return unique(cash.merge(this, cash(selector, context))); + }, + + each: function (callback) { + each(this, callback); + return this; + }, + + eq: function (index) { + return cash(this.get(index)); + }, + + filter: function (selector) { + if (!selector) { + return this; + } + + var comparator = isFunction(selector) ? selector : getCompareFunction(selector); + + return cash(filter.call(this, function (e) { + return comparator(e, selector); + })); + }, + + first: function () { + return this.eq(0); + }, + + get: function (index) { + if (index === undefined) { + return slice.call(this); + } + return index < 0 ? this[index + this.length] : this[index]; + }, + + index: function (elem) { + var child = elem ? cash(elem)[0] : this[0], + collection = elem ? this : cash(child).parent().children(); + return slice.call(collection).indexOf(child); + }, + + last: function () { + return this.eq(-1); + } + + }); + + var camelCase = function () { + var camelRegex = /(?:^\w|[A-Z]|\b\w)/g, + whiteSpace = /[\s-_]+/g; + return function (str) { + return str.replace(camelRegex, function (letter, index) { + return letter[index === 0 ? "toLowerCase" : "toUpperCase"](); + }).replace(whiteSpace, ""); + }; + }(); + + var getPrefixedProp = function () { + var cache = {}, + doc = document, + div = doc.createElement("div"), + style = div.style; + + return function (prop) { + prop = camelCase(prop); + if (cache[prop]) { + return cache[prop]; + } + + var ucProp = prop.charAt(0).toUpperCase() + prop.slice(1), + prefixes = ["webkit", "moz", "ms", "o"], + props = (prop + " " + prefixes.join(ucProp + " ") + ucProp).split(" "); + + each(props, function (p) { + if (p in style) { + cache[p] = prop = cache[prop] = p; + return false; + } + }); + + return cache[prop]; + }; + }(); + + cash.prefixedProp = getPrefixedProp; + cash.camelCase = camelCase; + + fn.extend({ + css: function (prop, value) { + if (isString(prop)) { + prop = getPrefixedProp(prop); + return arguments.length > 1 ? this.each(function (v) { + return v.style[prop] = value; + }) : win.getComputedStyle(this[0])[prop]; + } + + for (var key in prop) { + this.css(key, prop[key]); + } + + return this; + } + + }); + + function compute(el, prop) { + return parseInt(win.getComputedStyle(el[0], null)[prop], 10) || 0; + } + + each(["Width", "Height"], function (v) { + var lower = v.toLowerCase(); + + fn[lower] = function () { + return this[0].getBoundingClientRect()[lower]; + }; + + fn["inner" + v] = function () { + return this[0]["client" + v]; + }; + + fn["outer" + v] = function (margins) { + return this[0]["offset" + v] + (margins ? compute(this, "margin" + (v === "Width" ? "Left" : "Top")) + compute(this, "margin" + (v === "Width" ? "Right" : "Bottom")) : 0); + }; + }); + + function registerEvent(node, eventName, callback) { + var eventCache = getData(node, "_cashEvents") || setData(node, "_cashEvents", {}); + eventCache[eventName] = eventCache[eventName] || []; + eventCache[eventName].push(callback); + node.addEventListener(eventName, callback); + } + + function removeEvent(node, eventName, callback) { + var events = getData(node, "_cashEvents"), + eventCache = events && events[eventName], + index; + + if (!eventCache) { + return; + } + + if (callback) { + node.removeEventListener(eventName, callback); + index = eventCache.indexOf(callback); + if (index >= 0) { + eventCache.splice(index, 1); + } + } else { + each(eventCache, function (event) { + node.removeEventListener(eventName, event); + }); + eventCache = []; + } + } + + fn.extend({ + off: function (eventName, callback) { + return this.each(function (v) { + return removeEvent(v, eventName, callback); + }); + }, + + on: function (eventName, delegate, callback, runOnce) { + // jshint ignore:line + var originalCallback; + if (!isString(eventName)) { + for (var key in eventName) { + this.on(key, delegate, eventName[key]); + } + return this; + } + + if (isFunction(delegate)) { + callback = delegate; + delegate = null; + } + + if (eventName === "ready") { + onReady(callback); + return this; + } + + if (delegate) { + originalCallback = callback; + callback = function (e) { + var t = e.target; + while (!matches(t, delegate)) { + if (t === this || t === null) { + return t = false; + } + + t = t.parentNode; + } + + if (t) { + originalCallback.call(t, e); + } + }; + } + + return this.each(function (v) { + var finalCallback = callback; + if (runOnce) { + finalCallback = function () { + callback.apply(this, arguments); + removeEvent(v, eventName, finalCallback); + }; + } + registerEvent(v, eventName, finalCallback); + }); + }, + + one: function (eventName, delegate, callback) { + return this.on(eventName, delegate, callback, true); + }, + + ready: onReady, + + /** + * Modified + * Triggers browser event + * @param String eventName + * @param Object data - Add properties to event object + */ + trigger: function (eventName, data) { + if (document.createEvent) { + var evt = document.createEvent('HTMLEvents'); + evt.initEvent(eventName, true, false); + evt = this.extend(evt, data); + return this.each(function (v) { + return v.dispatchEvent(evt); + }); + } + } + + }); + + function encode(name, value) { + return "&" + encodeURIComponent(name) + "=" + encodeURIComponent(value).replace(/%20/g, "+"); + } + + function getSelectMultiple_(el) { + var values = []; + each(el.options, function (o) { + if (o.selected) { + values.push(o.value); + } + }); + return values.length ? values : null; + } + + function getSelectSingle_(el) { + var selectedIndex = el.selectedIndex; + return selectedIndex >= 0 ? el.options[selectedIndex].value : null; + } + + function getValue(el) { + var type = el.type; + if (!type) { + return null; + } + switch (type.toLowerCase()) { + case "select-one": + return getSelectSingle_(el); + case "select-multiple": + return getSelectMultiple_(el); + case "radio": + return el.checked ? el.value : null; + case "checkbox": + return el.checked ? el.value : null; + default: + return el.value ? el.value : null; + } + } + + fn.extend({ + serialize: function () { + var query = ""; + + each(this[0].elements || this, function (el) { + if (el.disabled || el.tagName === "FIELDSET") { + return; + } + var name = el.name; + switch (el.type.toLowerCase()) { + case "file": + case "reset": + case "submit": + case "button": + break; + case "select-multiple": + var values = getValue(el); + if (values !== null) { + each(values, function (value) { + query += encode(name, value); + }); + } + break; + default: + var value = getValue(el); + if (value !== null) { + query += encode(name, value); + } + } + }); + + return query.substr(1); + }, + + val: function (value) { + if (value === undefined) { + return getValue(this[0]); + } + + return this.each(function (v) { + return v.value = value; + }); + } + + }); + + function insertElement(el, child, prepend) { + if (prepend) { + var first = el.childNodes[0]; + el.insertBefore(child, first); + } else { + el.appendChild(child); + } + } + + function insertContent(parent, child, prepend) { + var str = isString(child); + + if (!str && child.length) { + each(child, function (v) { + return insertContent(parent, v, prepend); + }); + return; + } + + each(parent, str ? function (v) { + return v.insertAdjacentHTML(prepend ? "afterbegin" : "beforeend", child); + } : function (v, i) { + return insertElement(v, i === 0 ? child : child.cloneNode(true), prepend); + }); + } + + fn.extend({ + after: function (selector) { + cash(selector).insertAfter(this); + return this; + }, + + append: function (content) { + insertContent(this, content); + return this; + }, + + appendTo: function (parent) { + insertContent(cash(parent), this); + return this; + }, + + before: function (selector) { + cash(selector).insertBefore(this); + return this; + }, + + clone: function () { + return cash(this.map(function (v) { + return v.cloneNode(true); + })); + }, + + empty: function () { + this.html(""); + return this; + }, + + html: function (content) { + if (content === undefined) { + return this[0].innerHTML; + } + var source = content.nodeType ? content[0].outerHTML : content; + return this.each(function (v) { + return v.innerHTML = source; + }); + }, + + insertAfter: function (selector) { + var _this = this; + + cash(selector).each(function (el, i) { + var parent = el.parentNode, + sibling = el.nextSibling; + _this.each(function (v) { + parent.insertBefore(i === 0 ? v : v.cloneNode(true), sibling); + }); + }); + + return this; + }, + + insertBefore: function (selector) { + var _this2 = this; + cash(selector).each(function (el, i) { + var parent = el.parentNode; + _this2.each(function (v) { + parent.insertBefore(i === 0 ? v : v.cloneNode(true), el); + }); + }); + return this; + }, + + prepend: function (content) { + insertContent(this, content, true); + return this; + }, + + prependTo: function (parent) { + insertContent(cash(parent), this, true); + return this; + }, + + remove: function () { + return this.each(function (v) { + if (!!v.parentNode) { + return v.parentNode.removeChild(v); + } + }); + }, + + text: function (content) { + if (content === undefined) { + return this[0].textContent; + } + return this.each(function (v) { + return v.textContent = content; + }); + } + + }); + + var docEl = doc.documentElement; + + fn.extend({ + position: function () { + var el = this[0]; + return { + left: el.offsetLeft, + top: el.offsetTop + }; + }, + + offset: function () { + var rect = this[0].getBoundingClientRect(); + return { + top: rect.top + win.pageYOffset - docEl.clientTop, + left: rect.left + win.pageXOffset - docEl.clientLeft + }; + }, + + offsetParent: function () { + return cash(this[0].offsetParent); + } + + }); + + fn.extend({ + children: function (selector) { + var elems = []; + this.each(function (el) { + push.apply(elems, el.children); + }); + elems = unique(elems); + + return !selector ? elems : elems.filter(function (v) { + return matches(v, selector); + }); + }, + + closest: function (selector) { + if (!selector || this.length < 1) { + return cash(); + } + if (this.is(selector)) { + return this.filter(selector); + } + return this.parent().closest(selector); + }, + + is: function (selector) { + if (!selector) { + return false; + } + + var match = false, + comparator = getCompareFunction(selector); + + this.each(function (el) { + match = comparator(el, selector); + return !match; + }); + + return match; + }, + + find: function (selector) { + if (!selector || selector.nodeType) { + return cash(selector && this.has(selector).length ? selector : null); + } + + var elems = []; + this.each(function (el) { + push.apply(elems, find(selector, el)); + }); + + return unique(elems); + }, + + has: function (selector) { + var comparator = isString(selector) ? function (el) { + return find(selector, el).length !== 0; + } : function (el) { + return el.contains(selector); + }; + + return this.filter(comparator); + }, + + next: function () { + return cash(this[0].nextElementSibling); + }, + + not: function (selector) { + if (!selector) { + return this; + } + + var comparator = getCompareFunction(selector); + + return this.filter(function (el) { + return !comparator(el, selector); + }); + }, + + parent: function () { + var result = []; + + this.each(function (item) { + if (item && item.parentNode) { + result.push(item.parentNode); + } + }); + + return unique(result); + }, + + parents: function (selector) { + var last, + result = []; + + this.each(function (item) { + last = item; + + while (last && last.parentNode && last !== doc.body.parentNode) { + last = last.parentNode; + + if (!selector || selector && matches(last, selector)) { + result.push(last); + } + } + }); + + return unique(result); + }, + + prev: function () { + return cash(this[0].previousElementSibling); + }, + + siblings: function (selector) { + var collection = this.parent().children(selector), + el = this[0]; + + return collection.filter(function (i) { + return i !== el; + }); + } + + }); + + return cash; +}); +; +var Component = function () { + /** + * Generic constructor for all components + * @constructor + * @param {Element} el + * @param {Object} options + */ + function Component(classDef, el, options) { + _classCallCheck(this, Component); + + // Display error if el is valid HTML Element + if (!(el instanceof Element)) { + console.error(Error(el + ' is not an HTML Element')); + } + + // If exists, destroy and reinitialize in child + var ins = classDef.getInstance(el); + if (!!ins) { + ins.destroy(); + } + + this.el = el; + this.$el = cash(el); + } + + /** + * Initializes components + * @param {class} classDef + * @param {Element | NodeList | jQuery} els + * @param {Object} options + */ + + + _createClass(Component, null, [{ + key: "init", + value: function init(classDef, els, options) { + var instances = null; + if (els instanceof Element) { + instances = new classDef(els, options); + } else if (!!els && (els.jquery || els.cash || els instanceof NodeList)) { + var instancesArr = []; + for (var i = 0; i < els.length; i++) { + instancesArr.push(new classDef(els[i], options)); + } + instances = instancesArr; + } + + return instances; + } + }]); + + return Component; +}(); + +; // Required for Meteor package, the use of window prevents export by Meteor +(function (window) { + if (window.Package) { + M = {}; + } else { + window.M = {}; + } + + // Check for jQuery + M.jQueryLoaded = !!window.jQuery; +})(window); + +// AMD +if (typeof define === 'function' && define.amd) { + define('M', [], function () { + return M; + }); + + // Common JS +} else if (typeof exports !== 'undefined' && !exports.nodeType) { + if (typeof module !== 'undefined' && !module.nodeType && module.exports) { + exports = module.exports = M; + } + exports.default = M; +} + +M.version = '1.0.0'; + +M.keys = { + TAB: 9, + ENTER: 13, + ESC: 27, + ARROW_UP: 38, + ARROW_DOWN: 40 +}; + +/** + * TabPress Keydown handler + */ +M.tabPressed = false; +M.keyDown = false; +var docHandleKeydown = function (e) { + M.keyDown = true; + if (e.which === M.keys.TAB || e.which === M.keys.ARROW_DOWN || e.which === M.keys.ARROW_UP) { + M.tabPressed = true; + } +}; +var docHandleKeyup = function (e) { + M.keyDown = false; + if (e.which === M.keys.TAB || e.which === M.keys.ARROW_DOWN || e.which === M.keys.ARROW_UP) { + M.tabPressed = false; + } +}; +var docHandleFocus = function (e) { + if (M.keyDown) { + document.body.classList.add('keyboard-focused'); + } +}; +var docHandleBlur = function (e) { + document.body.classList.remove('keyboard-focused'); +}; +document.addEventListener('keydown', docHandleKeydown, true); +document.addEventListener('keyup', docHandleKeyup, true); +document.addEventListener('focus', docHandleFocus, true); +document.addEventListener('blur', docHandleBlur, true); + +/** + * Initialize jQuery wrapper for plugin + * @param {Class} plugin javascript class + * @param {string} pluginName jQuery plugin name + * @param {string} classRef Class reference name + */ +M.initializeJqueryWrapper = function (plugin, pluginName, classRef) { + jQuery.fn[pluginName] = function (methodOrOptions) { + // Call plugin method if valid method name is passed in + if (plugin.prototype[methodOrOptions]) { + var params = Array.prototype.slice.call(arguments, 1); + + // Getter methods + if (methodOrOptions.slice(0, 3) === 'get') { + var instance = this.first()[0][classRef]; + return instance[methodOrOptions].apply(instance, params); + } + + // Void methods + return this.each(function () { + var instance = this[classRef]; + instance[methodOrOptions].apply(instance, params); + }); + + // Initialize plugin if options or no argument is passed in + } else if (typeof methodOrOptions === 'object' || !methodOrOptions) { + plugin.init(this, arguments[0]); + return this; + } + + // Return error if an unrecognized method name is passed in + jQuery.error("Method " + methodOrOptions + " does not exist on jQuery." + pluginName); + }; +}; + +/** + * Automatically initialize components + * @param {Element} context DOM Element to search within for components + */ +M.AutoInit = function (context) { + // Use document.body if no context is given + var root = !!context ? context : document.body; + + var registry = { + Autocomplete: root.querySelectorAll('.autocomplete:not(.no-autoinit)'), + Carousel: root.querySelectorAll('.carousel:not(.no-autoinit)'), + Chips: root.querySelectorAll('.chips:not(.no-autoinit)'), + Collapsible: root.querySelectorAll('.collapsible:not(.no-autoinit)'), + Datepicker: root.querySelectorAll('.datepicker:not(.no-autoinit)'), + Dropdown: root.querySelectorAll('.dropdown-trigger:not(.no-autoinit)'), + Materialbox: root.querySelectorAll('.materialboxed:not(.no-autoinit)'), + Modal: root.querySelectorAll('.modal:not(.no-autoinit)'), + Parallax: root.querySelectorAll('.parallax:not(.no-autoinit)'), + Pushpin: root.querySelectorAll('.pushpin:not(.no-autoinit)'), + ScrollSpy: root.querySelectorAll('.scrollspy:not(.no-autoinit)'), + FormSelect: root.querySelectorAll('select:not(.no-autoinit)'), + Sidenav: root.querySelectorAll('.sidenav:not(.no-autoinit)'), + Tabs: root.querySelectorAll('.tabs:not(.no-autoinit)'), + TapTarget: root.querySelectorAll('.tap-target:not(.no-autoinit)'), + Timepicker: root.querySelectorAll('.timepicker:not(.no-autoinit)'), + Tooltip: root.querySelectorAll('.tooltipped:not(.no-autoinit)'), + FloatingActionButton: root.querySelectorAll('.fixed-action-btn:not(.no-autoinit)') + }; + + for (var pluginName in registry) { + var plugin = M[pluginName]; + plugin.init(registry[pluginName]); + } +}; + +/** + * Generate approximated selector string for a jQuery object + * @param {jQuery} obj jQuery object to be parsed + * @returns {string} + */ +M.objectSelectorString = function (obj) { + var tagStr = obj.prop('tagName') || ''; + var idStr = obj.attr('id') || ''; + var classStr = obj.attr('class') || ''; + return (tagStr + idStr + classStr).replace(/\s/g, ''); +}; + +// Unique Random ID +M.guid = function () { + function s4() { + return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); + } + return function () { + return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4(); + }; +}(); + +/** + * Escapes hash from special characters + * @param {string} hash String returned from this.hash + * @returns {string} + */ +M.escapeHash = function (hash) { + return hash.replace(/(:|\.|\[|\]|,|=|\/)/g, '\\$1'); +}; + +/** + * @typedef {Object} Edges + * @property {Boolean} top If the top edge was exceeded + * @property {Boolean} right If the right edge was exceeded + * @property {Boolean} bottom If the bottom edge was exceeded + * @property {Boolean} left If the left edge was exceeded + */ + +/** + * @typedef {Object} Bounding + * @property {Number} left left offset coordinate + * @property {Number} top top offset coordinate + * @property {Number} width + * @property {Number} height + */ + +/** + * Escapes hash from special characters + * @param {Element} container Container element that acts as the boundary + * @param {Bounding} bounding element bounding that is being checked + * @param {Number} offset offset from edge that counts as exceeding + * @returns {Edges} + */ +M.checkWithinContainer = function (container, bounding, offset) { + var edges = { + top: false, + right: false, + bottom: false, + left: false + }; + + var containerRect = container.getBoundingClientRect(); + // If body element is smaller than viewport, use viewport height instead. + var containerBottom = container === document.body ? Math.max(containerRect.bottom, window.innerHeight) : containerRect.bottom; + + var scrollLeft = container.scrollLeft; + var scrollTop = container.scrollTop; + + var scrolledX = bounding.left - scrollLeft; + var scrolledY = bounding.top - scrollTop; + + // Check for container and viewport for each edge + if (scrolledX < containerRect.left + offset || scrolledX < offset) { + edges.left = true; + } + + if (scrolledX + bounding.width > containerRect.right - offset || scrolledX + bounding.width > window.innerWidth - offset) { + edges.right = true; + } + + if (scrolledY < containerRect.top + offset || scrolledY < offset) { + edges.top = true; + } + + if (scrolledY + bounding.height > containerBottom - offset || scrolledY + bounding.height > window.innerHeight - offset) { + edges.bottom = true; + } + + return edges; +}; + +M.checkPossibleAlignments = function (el, container, bounding, offset) { + var canAlign = { + top: true, + right: true, + bottom: true, + left: true, + spaceOnTop: null, + spaceOnRight: null, + spaceOnBottom: null, + spaceOnLeft: null + }; + + var containerAllowsOverflow = getComputedStyle(container).overflow === 'visible'; + var containerRect = container.getBoundingClientRect(); + var containerHeight = Math.min(containerRect.height, window.innerHeight); + var containerWidth = Math.min(containerRect.width, window.innerWidth); + var elOffsetRect = el.getBoundingClientRect(); + + var scrollLeft = container.scrollLeft; + var scrollTop = container.scrollTop; + + var scrolledX = bounding.left - scrollLeft; + var scrolledYTopEdge = bounding.top - scrollTop; + var scrolledYBottomEdge = bounding.top + elOffsetRect.height - scrollTop; + + // Check for container and viewport for left + canAlign.spaceOnRight = !containerAllowsOverflow ? containerWidth - (scrolledX + bounding.width) : window.innerWidth - (elOffsetRect.left + bounding.width); + if (canAlign.spaceOnRight < 0) { + canAlign.left = false; + } + + // Check for container and viewport for Right + canAlign.spaceOnLeft = !containerAllowsOverflow ? scrolledX - bounding.width + elOffsetRect.width : elOffsetRect.right - bounding.width; + if (canAlign.spaceOnLeft < 0) { + canAlign.right = false; + } + + // Check for container and viewport for Top + canAlign.spaceOnBottom = !containerAllowsOverflow ? containerHeight - (scrolledYTopEdge + bounding.height + offset) : window.innerHeight - (elOffsetRect.top + bounding.height + offset); + if (canAlign.spaceOnBottom < 0) { + canAlign.top = false; + } + + // Check for container and viewport for Bottom + canAlign.spaceOnTop = !containerAllowsOverflow ? scrolledYBottomEdge - (bounding.height - offset) : elOffsetRect.bottom - (bounding.height + offset); + if (canAlign.spaceOnTop < 0) { + canAlign.bottom = false; + } + + return canAlign; +}; + +M.getOverflowParent = function (element) { + if (element == null) { + return null; + } + + if (element === document.body || getComputedStyle(element).overflow !== 'visible') { + return element; + } + + return M.getOverflowParent(element.parentElement); +}; + +/** + * Gets id of component from a trigger + * @param {Element} trigger trigger + * @returns {string} + */ +M.getIdFromTrigger = function (trigger) { + var id = trigger.getAttribute('data-target'); + if (!id) { + id = trigger.getAttribute('href'); + if (id) { + id = id.slice(1); + } else { + id = ''; + } + } + return id; +}; + +/** + * Multi browser support for document scroll top + * @returns {Number} + */ +M.getDocumentScrollTop = function () { + return window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0; +}; + +/** + * Multi browser support for document scroll left + * @returns {Number} + */ +M.getDocumentScrollLeft = function () { + return window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft || 0; +}; + +/** + * @typedef {Object} Edges + * @property {Boolean} top If the top edge was exceeded + * @property {Boolean} right If the right edge was exceeded + * @property {Boolean} bottom If the bottom edge was exceeded + * @property {Boolean} left If the left edge was exceeded + */ + +/** + * @typedef {Object} Bounding + * @property {Number} left left offset coordinate + * @property {Number} top top offset coordinate + * @property {Number} width + * @property {Number} height + */ + +/** + * Get time in ms + * @license https://raw.github.com/jashkenas/underscore/master/LICENSE + * @type {function} + * @return {number} + */ +var getTime = Date.now || function () { + return new Date().getTime(); +}; + +/** + * Returns a function, that, when invoked, will only be triggered at most once + * during a given window of time. Normally, the throttled function will run + * as much as it can, without ever going more than once per `wait` duration; + * but if you'd like to disable the execution on the leading edge, pass + * `{leading: false}`. To disable execution on the trailing edge, ditto. + * @license https://raw.github.com/jashkenas/underscore/master/LICENSE + * @param {function} func + * @param {number} wait + * @param {Object=} options + * @returns {Function} + */ +M.throttle = function (func, wait, options) { + var context = void 0, + args = void 0, + result = void 0; + var timeout = null; + var previous = 0; + options || (options = {}); + var later = function () { + previous = options.leading === false ? 0 : getTime(); + timeout = null; + result = func.apply(context, args); + context = args = null; + }; + return function () { + var now = getTime(); + if (!previous && options.leading === false) previous = now; + var remaining = wait - (now - previous); + context = this; + args = arguments; + if (remaining <= 0) { + clearTimeout(timeout); + timeout = null; + previous = now; + result = func.apply(context, args); + context = args = null; + } else if (!timeout && options.trailing !== false) { + timeout = setTimeout(later, remaining); + } + return result; + }; +}; + +/* Feature detection */ +var passiveIfSupported = false; +try { + window.addEventListener("test", null, Object.defineProperty({}, "passive", { + get: function () { + passiveIfSupported = { passive: false }; + } + })); +} catch (err) {} +; /* + v2.2.0 + 2017 Julian Garnier + Released under the MIT license + */ +var $jscomp = { scope: {} };$jscomp.defineProperty = "function" == typeof Object.defineProperties ? Object.defineProperty : function (e, r, p) { + if (p.get || p.set) throw new TypeError("ES3 does not support getters and setters.");e != Array.prototype && e != Object.prototype && (e[r] = p.value); +};$jscomp.getGlobal = function (e) { + return "undefined" != typeof window && window === e ? e : "undefined" != typeof global && null != global ? global : e; +};$jscomp.global = $jscomp.getGlobal(this);$jscomp.SYMBOL_PREFIX = "jscomp_symbol_"; +$jscomp.initSymbol = function () { + $jscomp.initSymbol = function () {};$jscomp.global.Symbol || ($jscomp.global.Symbol = $jscomp.Symbol); +};$jscomp.symbolCounter_ = 0;$jscomp.Symbol = function (e) { + return $jscomp.SYMBOL_PREFIX + (e || "") + $jscomp.symbolCounter_++; +}; +$jscomp.initSymbolIterator = function () { + $jscomp.initSymbol();var e = $jscomp.global.Symbol.iterator;e || (e = $jscomp.global.Symbol.iterator = $jscomp.global.Symbol("iterator"));"function" != typeof Array.prototype[e] && $jscomp.defineProperty(Array.prototype, e, { configurable: !0, writable: !0, value: function () { + return $jscomp.arrayIterator(this); + } });$jscomp.initSymbolIterator = function () {}; +};$jscomp.arrayIterator = function (e) { + var r = 0;return $jscomp.iteratorPrototype(function () { + return r < e.length ? { done: !1, value: e[r++] } : { done: !0 }; + }); +}; +$jscomp.iteratorPrototype = function (e) { + $jscomp.initSymbolIterator();e = { next: e };e[$jscomp.global.Symbol.iterator] = function () { + return this; + };return e; +};$jscomp.array = $jscomp.array || {};$jscomp.iteratorFromArray = function (e, r) { + $jscomp.initSymbolIterator();e instanceof String && (e += "");var p = 0, + m = { next: function () { + if (p < e.length) { + var u = p++;return { value: r(u, e[u]), done: !1 }; + }m.next = function () { + return { done: !0, value: void 0 }; + };return m.next(); + } };m[Symbol.iterator] = function () { + return m; + };return m; +}; +$jscomp.polyfill = function (e, r, p, m) { + if (r) { + p = $jscomp.global;e = e.split(".");for (m = 0; m < e.length - 1; m++) { + var u = e[m];u in p || (p[u] = {});p = p[u]; + }e = e[e.length - 1];m = p[e];r = r(m);r != m && null != r && $jscomp.defineProperty(p, e, { configurable: !0, writable: !0, value: r }); + } +};$jscomp.polyfill("Array.prototype.keys", function (e) { + return e ? e : function () { + return $jscomp.iteratorFromArray(this, function (e) { + return e; + }); + }; +}, "es6-impl", "es3");var $jscomp$this = this; +(function (r) { + M.anime = r(); +})(function () { + function e(a) { + if (!h.col(a)) try { + return document.querySelectorAll(a); + } catch (c) {} + }function r(a, c) { + for (var d = a.length, b = 2 <= arguments.length ? arguments[1] : void 0, f = [], n = 0; n < d; n++) { + if (n in a) { + var k = a[n];c.call(b, k, n, a) && f.push(k); + } + }return f; + }function p(a) { + return a.reduce(function (a, d) { + return a.concat(h.arr(d) ? p(d) : d); + }, []); + }function m(a) { + if (h.arr(a)) return a; + h.str(a) && (a = e(a) || a);return a instanceof NodeList || a instanceof HTMLCollection ? [].slice.call(a) : [a]; + }function u(a, c) { + return a.some(function (a) { + return a === c; + }); + }function C(a) { + var c = {}, + d;for (d in a) { + c[d] = a[d]; + }return c; + }function D(a, c) { + var d = C(a), + b;for (b in a) { + d[b] = c.hasOwnProperty(b) ? c[b] : a[b]; + }return d; + }function z(a, c) { + var d = C(a), + b;for (b in c) { + d[b] = h.und(a[b]) ? c[b] : a[b]; + }return d; + }function T(a) { + a = a.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i, function (a, c, d, k) { + return c + c + d + d + k + k; + });var c = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a); + a = parseInt(c[1], 16);var d = parseInt(c[2], 16), + c = parseInt(c[3], 16);return "rgba(" + a + "," + d + "," + c + ",1)"; + }function U(a) { + function c(a, c, b) { + 0 > b && (b += 1);1 < b && --b;return b < 1 / 6 ? a + 6 * (c - a) * b : .5 > b ? c : b < 2 / 3 ? a + (c - a) * (2 / 3 - b) * 6 : a; + }var d = /hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(a) || /hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(a);a = parseInt(d[1]) / 360;var b = parseInt(d[2]) / 100, + f = parseInt(d[3]) / 100, + d = d[4] || 1;if (0 == b) f = b = a = f;else { + var n = .5 > f ? f * (1 + b) : f + b - f * b, + k = 2 * f - n, + f = c(k, n, a + 1 / 3), + b = c(k, n, a);a = c(k, n, a - 1 / 3); + }return "rgba(" + 255 * f + "," + 255 * b + "," + 255 * a + "," + d + ")"; + }function y(a) { + if (a = /([\+\-]?[0-9#\.]+)(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/.exec(a)) return a[2]; + }function V(a) { + if (-1 < a.indexOf("translate") || "perspective" === a) return "px";if (-1 < a.indexOf("rotate") || -1 < a.indexOf("skew")) return "deg"; + }function I(a, c) { + return h.fnc(a) ? a(c.target, c.id, c.total) : a; + }function E(a, c) { + if (c in a.style) return getComputedStyle(a).getPropertyValue(c.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase()) || "0"; + }function J(a, c) { + if (h.dom(a) && u(W, c)) return "transform";if (h.dom(a) && (a.getAttribute(c) || h.svg(a) && a[c])) return "attribute";if (h.dom(a) && "transform" !== c && E(a, c)) return "css";if (null != a[c]) return "object"; + }function X(a, c) { + var d = V(c), + d = -1 < c.indexOf("scale") ? 1 : 0 + d;a = a.style.transform;if (!a) return d;for (var b = [], f = [], n = [], k = /(\w+)\((.+?)\)/g; b = k.exec(a);) { + f.push(b[1]), n.push(b[2]); + }a = r(n, function (a, b) { + return f[b] === c; + });return a.length ? a[0] : d; + }function K(a, c) { + switch (J(a, c)) {case "transform": + return X(a, c);case "css": + return E(a, c);case "attribute": + return a.getAttribute(c);}return a[c] || 0; + }function L(a, c) { + var d = /^(\*=|\+=|-=)/.exec(a);if (!d) return a;var b = y(a) || 0;c = parseFloat(c);a = parseFloat(a.replace(d[0], ""));switch (d[0][0]) {case "+": + return c + a + b;case "-": + return c - a + b;case "*": + return c * a + b;} + }function F(a, c) { + return Math.sqrt(Math.pow(c.x - a.x, 2) + Math.pow(c.y - a.y, 2)); + }function M(a) { + a = a.points;for (var c = 0, d, b = 0; b < a.numberOfItems; b++) { + var f = a.getItem(b);0 < b && (c += F(d, f));d = f; + }return c; + }function N(a) { + if (a.getTotalLength) return a.getTotalLength();switch (a.tagName.toLowerCase()) {case "circle": + return 2 * Math.PI * a.getAttribute("r");case "rect": + return 2 * a.getAttribute("width") + 2 * a.getAttribute("height");case "line": + return F({ x: a.getAttribute("x1"), y: a.getAttribute("y1") }, { x: a.getAttribute("x2"), y: a.getAttribute("y2") });case "polyline": + return M(a);case "polygon": + var c = a.points;return M(a) + F(c.getItem(c.numberOfItems - 1), c.getItem(0));} + }function Y(a, c) { + function d(b) { + b = void 0 === b ? 0 : b;return a.el.getPointAtLength(1 <= c + b ? c + b : 0); + }var b = d(), + f = d(-1), + n = d(1);switch (a.property) {case "x": + return b.x;case "y": + return b.y; + case "angle": + return 180 * Math.atan2(n.y - f.y, n.x - f.x) / Math.PI;} + }function O(a, c) { + var d = /-?\d*\.?\d+/g, + b;b = h.pth(a) ? a.totalLength : a;if (h.col(b)) { + if (h.rgb(b)) { + var f = /rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(b);b = f ? "rgba(" + f[1] + ",1)" : b; + } else b = h.hex(b) ? T(b) : h.hsl(b) ? U(b) : void 0; + } else f = (f = y(b)) ? b.substr(0, b.length - f.length) : b, b = c && !/\s/g.test(b) ? f + c : f;b += "";return { original: b, numbers: b.match(d) ? b.match(d).map(Number) : [0], strings: h.str(a) || c ? b.split(d) : [] }; + }function P(a) { + a = a ? p(h.arr(a) ? a.map(m) : m(a)) : [];return r(a, function (a, d, b) { + return b.indexOf(a) === d; + }); + }function Z(a) { + var c = P(a);return c.map(function (a, b) { + return { target: a, id: b, total: c.length }; + }); + }function aa(a, c) { + var d = C(c);if (h.arr(a)) { + var b = a.length;2 !== b || h.obj(a[0]) ? h.fnc(c.duration) || (d.duration = c.duration / b) : a = { value: a }; + }return m(a).map(function (a, b) { + b = b ? 0 : c.delay;a = h.obj(a) && !h.pth(a) ? a : { value: a };h.und(a.delay) && (a.delay = b);return a; + }).map(function (a) { + return z(a, d); + }); + }function ba(a, c) { + var d = {}, + b;for (b in a) { + var f = I(a[b], c);h.arr(f) && (f = f.map(function (a) { + return I(a, c); + }), 1 === f.length && (f = f[0]));d[b] = f; + }d.duration = parseFloat(d.duration);d.delay = parseFloat(d.delay);return d; + }function ca(a) { + return h.arr(a) ? A.apply(this, a) : Q[a]; + }function da(a, c) { + var d;return a.tweens.map(function (b) { + b = ba(b, c);var f = b.value, + e = K(c.target, a.name), + k = d ? d.to.original : e, + k = h.arr(f) ? f[0] : k, + w = L(h.arr(f) ? f[1] : f, k), + e = y(w) || y(k) || y(e);b.from = O(k, e);b.to = O(w, e);b.start = d ? d.end : a.offset;b.end = b.start + b.delay + b.duration;b.easing = ca(b.easing);b.elasticity = (1E3 - Math.min(Math.max(b.elasticity, 1), 999)) / 1E3;b.isPath = h.pth(f);b.isColor = h.col(b.from.original);b.isColor && (b.round = 1);return d = b; + }); + }function ea(a, c) { + return r(p(a.map(function (a) { + return c.map(function (b) { + var c = J(a.target, b.name);if (c) { + var d = da(b, a);b = { type: c, property: b.name, animatable: a, tweens: d, duration: d[d.length - 1].end, delay: d[0].delay }; + } else b = void 0;return b; + }); + })), function (a) { + return !h.und(a); + }); + }function R(a, c, d, b) { + var f = "delay" === a;return c.length ? (f ? Math.min : Math.max).apply(Math, c.map(function (b) { + return b[a]; + })) : f ? b.delay : d.offset + b.delay + b.duration; + }function fa(a) { + var c = D(ga, a), + d = D(S, a), + b = Z(a.targets), + f = [], + e = z(c, d), + k;for (k in a) { + e.hasOwnProperty(k) || "targets" === k || f.push({ name: k, offset: e.offset, tweens: aa(a[k], d) }); + }a = ea(b, f);return z(c, { children: [], animatables: b, animations: a, duration: R("duration", a, c, d), delay: R("delay", a, c, d) }); + }function q(a) { + function c() { + return window.Promise && new Promise(function (a) { + return p = a; + }); + }function d(a) { + return g.reversed ? g.duration - a : a; + }function b(a) { + for (var b = 0, c = {}, d = g.animations, f = d.length; b < f;) { + var e = d[b], + k = e.animatable, + h = e.tweens, + n = h.length - 1, + l = h[n];n && (l = r(h, function (b) { + return a < b.end; + })[0] || l);for (var h = Math.min(Math.max(a - l.start - l.delay, 0), l.duration) / l.duration, w = isNaN(h) ? 1 : l.easing(h, l.elasticity), h = l.to.strings, p = l.round, n = [], m = void 0, m = l.to.numbers.length, t = 0; t < m; t++) { + var x = void 0, + x = l.to.numbers[t], + q = l.from.numbers[t], + x = l.isPath ? Y(l.value, w * x) : q + w * (x - q);p && (l.isColor && 2 < t || (x = Math.round(x * p) / p));n.push(x); + }if (l = h.length) for (m = h[0], w = 0; w < l; w++) { + p = h[w + 1], t = n[w], isNaN(t) || (m = p ? m + (t + p) : m + (t + " ")); + } else m = n[0];ha[e.type](k.target, e.property, m, c, k.id);e.currentValue = m;b++; + }if (b = Object.keys(c).length) for (d = 0; d < b; d++) { + H || (H = E(document.body, "transform") ? "transform" : "-webkit-transform"), g.animatables[d].target.style[H] = c[d].join(" "); + }g.currentTime = a;g.progress = a / g.duration * 100; + }function f(a) { + if (g[a]) g[a](g); + }function e() { + g.remaining && !0 !== g.remaining && g.remaining--; + }function k(a) { + var k = g.duration, + n = g.offset, + w = n + g.delay, + r = g.currentTime, + x = g.reversed, + q = d(a);if (g.children.length) { + var u = g.children, + v = u.length; + if (q >= g.currentTime) for (var G = 0; G < v; G++) { + u[G].seek(q); + } else for (; v--;) { + u[v].seek(q); + } + }if (q >= w || !k) g.began || (g.began = !0, f("begin")), f("run");if (q > n && q < k) b(q);else if (q <= n && 0 !== r && (b(0), x && e()), q >= k && r !== k || !k) b(k), x || e();f("update");a >= k && (g.remaining ? (t = h, "alternate" === g.direction && (g.reversed = !g.reversed)) : (g.pause(), g.completed || (g.completed = !0, f("complete"), "Promise" in window && (p(), m = c()))), l = 0); + }a = void 0 === a ? {} : a;var h, + t, + l = 0, + p = null, + m = c(), + g = fa(a);g.reset = function () { + var a = g.direction, + c = g.loop;g.currentTime = 0;g.progress = 0;g.paused = !0;g.began = !1;g.completed = !1;g.reversed = "reverse" === a;g.remaining = "alternate" === a && 1 === c ? 2 : c;b(0);for (a = g.children.length; a--;) { + g.children[a].reset(); + } + };g.tick = function (a) { + h = a;t || (t = h);k((l + h - t) * q.speed); + };g.seek = function (a) { + k(d(a)); + };g.pause = function () { + var a = v.indexOf(g);-1 < a && v.splice(a, 1);g.paused = !0; + };g.play = function () { + g.paused && (g.paused = !1, t = 0, l = d(g.currentTime), v.push(g), B || ia()); + };g.reverse = function () { + g.reversed = !g.reversed;t = 0;l = d(g.currentTime); + };g.restart = function () { + g.pause(); + g.reset();g.play(); + };g.finished = m;g.reset();g.autoplay && g.play();return g; + }var ga = { update: void 0, begin: void 0, run: void 0, complete: void 0, loop: 1, direction: "normal", autoplay: !0, offset: 0 }, + S = { duration: 1E3, delay: 0, easing: "easeOutElastic", elasticity: 500, round: 0 }, + W = "translateX translateY translateZ rotate rotateX rotateY rotateZ scale scaleX scaleY scaleZ skewX skewY perspective".split(" "), + H, + h = { arr: function (a) { + return Array.isArray(a); + }, obj: function (a) { + return -1 < Object.prototype.toString.call(a).indexOf("Object"); + }, + pth: function (a) { + return h.obj(a) && a.hasOwnProperty("totalLength"); + }, svg: function (a) { + return a instanceof SVGElement; + }, dom: function (a) { + return a.nodeType || h.svg(a); + }, str: function (a) { + return "string" === typeof a; + }, fnc: function (a) { + return "function" === typeof a; + }, und: function (a) { + return "undefined" === typeof a; + }, hex: function (a) { + return (/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(a) + ); + }, rgb: function (a) { + return (/^rgb/.test(a) + ); + }, hsl: function (a) { + return (/^hsl/.test(a) + ); + }, col: function (a) { + return h.hex(a) || h.rgb(a) || h.hsl(a); + } }, + A = function () { + function a(a, d, b) { + return (((1 - 3 * b + 3 * d) * a + (3 * b - 6 * d)) * a + 3 * d) * a; + }return function (c, d, b, f) { + if (0 <= c && 1 >= c && 0 <= b && 1 >= b) { + var e = new Float32Array(11);if (c !== d || b !== f) for (var k = 0; 11 > k; ++k) { + e[k] = a(.1 * k, c, b); + }return function (k) { + if (c === d && b === f) return k;if (0 === k) return 0;if (1 === k) return 1;for (var h = 0, l = 1; 10 !== l && e[l] <= k; ++l) { + h += .1; + }--l;var l = h + (k - e[l]) / (e[l + 1] - e[l]) * .1, + n = 3 * (1 - 3 * b + 3 * c) * l * l + 2 * (3 * b - 6 * c) * l + 3 * c;if (.001 <= n) { + for (h = 0; 4 > h; ++h) { + n = 3 * (1 - 3 * b + 3 * c) * l * l + 2 * (3 * b - 6 * c) * l + 3 * c;if (0 === n) break;var m = a(l, c, b) - k, + l = l - m / n; + }k = l; + } else if (0 === n) k = l;else { + var l = h, + h = h + .1, + g = 0;do { + m = l + (h - l) / 2, n = a(m, c, b) - k, 0 < n ? h = m : l = m; + } while (1e-7 < Math.abs(n) && 10 > ++g);k = m; + }return a(k, d, f); + }; + } + }; + }(), + Q = function () { + function a(a, b) { + return 0 === a || 1 === a ? a : -Math.pow(2, 10 * (a - 1)) * Math.sin(2 * (a - 1 - b / (2 * Math.PI) * Math.asin(1)) * Math.PI / b); + }var c = "Quad Cubic Quart Quint Sine Expo Circ Back Elastic".split(" "), + d = { In: [[.55, .085, .68, .53], [.55, .055, .675, .19], [.895, .03, .685, .22], [.755, .05, .855, .06], [.47, 0, .745, .715], [.95, .05, .795, .035], [.6, .04, .98, .335], [.6, -.28, .735, .045], a], Out: [[.25, .46, .45, .94], [.215, .61, .355, 1], [.165, .84, .44, 1], [.23, 1, .32, 1], [.39, .575, .565, 1], [.19, 1, .22, 1], [.075, .82, .165, 1], [.175, .885, .32, 1.275], function (b, c) { + return 1 - a(1 - b, c); + }], InOut: [[.455, .03, .515, .955], [.645, .045, .355, 1], [.77, 0, .175, 1], [.86, 0, .07, 1], [.445, .05, .55, .95], [1, 0, 0, 1], [.785, .135, .15, .86], [.68, -.55, .265, 1.55], function (b, c) { + return .5 > b ? a(2 * b, c) / 2 : 1 - a(-2 * b + 2, c) / 2; + }] }, + b = { linear: A(.25, .25, .75, .75) }, + f = {}, + e;for (e in d) { + f.type = e, d[f.type].forEach(function (a) { + return function (d, f) { + b["ease" + a.type + c[f]] = h.fnc(d) ? d : A.apply($jscomp$this, d); + }; + }(f)), f = { type: f.type }; + }return b; + }(), + ha = { css: function (a, c, d) { + return a.style[c] = d; + }, attribute: function (a, c, d) { + return a.setAttribute(c, d); + }, object: function (a, c, d) { + return a[c] = d; + }, transform: function (a, c, d, b, f) { + b[f] || (b[f] = []);b[f].push(c + "(" + d + ")"); + } }, + v = [], + B = 0, + ia = function () { + function a() { + B = requestAnimationFrame(c); + }function c(c) { + var b = v.length;if (b) { + for (var d = 0; d < b;) { + v[d] && v[d].tick(c), d++; + }a(); + } else cancelAnimationFrame(B), B = 0; + }return a; + }();q.version = "2.2.0";q.speed = 1;q.running = v;q.remove = function (a) { + a = P(a);for (var c = v.length; c--;) { + for (var d = v[c], b = d.animations, f = b.length; f--;) { + u(a, b[f].animatable.target) && (b.splice(f, 1), b.length || d.pause()); + } + } + };q.getValue = K;q.path = function (a, c) { + var d = h.str(a) ? e(a)[0] : a, + b = c || 100;return function (a) { + return { el: d, property: a, totalLength: N(d) * (b / 100) }; + }; + };q.setDashoffset = function (a) { + var c = N(a);a.setAttribute("stroke-dasharray", c);return c; + };q.bezier = A;q.easings = Q;q.timeline = function (a) { + var c = q(a);c.pause();c.duration = 0;c.add = function (d) { + c.children.forEach(function (a) { + a.began = !0;a.completed = !0; + });m(d).forEach(function (b) { + var d = z(b, D(S, a || {}));d.targets = d.targets || a.targets;b = c.duration;var e = d.offset;d.autoplay = !1;d.direction = c.direction;d.offset = h.und(e) ? b : L(e, b);c.began = !0;c.completed = !0;c.seek(d.offset);d = q(d);d.began = !0;d.completed = !0;d.duration > b && (c.duration = d.duration);c.children.push(d); + });c.seek(0);c.reset();c.autoplay && c.restart();return c; + };return c; + };q.random = function (a, c) { + return Math.floor(Math.random() * (c - a + 1)) + a; + };return q; +}); +;(function ($, anim) { + 'use strict'; + + var _defaults = { + accordion: true, + onOpenStart: undefined, + onOpenEnd: undefined, + onCloseStart: undefined, + onCloseEnd: undefined, + inDuration: 300, + outDuration: 300 + }; + + /** + * @class + * + */ + + var Collapsible = function (_Component) { + _inherits(Collapsible, _Component); + + /** + * Construct Collapsible instance + * @constructor + * @param {Element} el + * @param {Object} options + */ + function Collapsible(el, options) { + _classCallCheck(this, Collapsible); + + var _this3 = _possibleConstructorReturn(this, (Collapsible.__proto__ || Object.getPrototypeOf(Collapsible)).call(this, Collapsible, el, options)); + + _this3.el.M_Collapsible = _this3; + + /** + * Options for the collapsible + * @member Collapsible#options + * @prop {Boolean} [accordion=false] - Type of the collapsible + * @prop {Function} onOpenStart - Callback function called before collapsible is opened + * @prop {Function} onOpenEnd - Callback function called after collapsible is opened + * @prop {Function} onCloseStart - Callback function called before collapsible is closed + * @prop {Function} onCloseEnd - Callback function called after collapsible is closed + * @prop {Number} inDuration - Transition in duration in milliseconds. + * @prop {Number} outDuration - Transition duration in milliseconds. + */ + _this3.options = $.extend({}, Collapsible.defaults, options); + + // Setup tab indices + _this3.$headers = _this3.$el.children('li').children('.collapsible-header'); + _this3.$headers.attr('tabindex', 0); + + _this3._setupEventHandlers(); + + // Open first active + var $activeBodies = _this3.$el.children('li.active').children('.collapsible-body'); + if (_this3.options.accordion) { + // Handle Accordion + $activeBodies.first().css('display', 'block'); + } else { + // Handle Expandables + $activeBodies.css('display', 'block'); + } + return _this3; + } + + _createClass(Collapsible, [{ + key: "destroy", + + + /** + * Teardown component + */ + value: function destroy() { + this._removeEventHandlers(); + this.el.M_Collapsible = undefined; + } + + /** + * Setup Event Handlers + */ + + }, { + key: "_setupEventHandlers", + value: function _setupEventHandlers() { + var _this4 = this; + + this._handleCollapsibleClickBound = this._handleCollapsibleClick.bind(this); + this._handleCollapsibleKeydownBound = this._handleCollapsibleKeydown.bind(this); + this.el.addEventListener('click', this._handleCollapsibleClickBound); + this.$headers.each(function (header) { + header.addEventListener('keydown', _this4._handleCollapsibleKeydownBound); + }); + } + + /** + * Remove Event Handlers + */ + + }, { + key: "_removeEventHandlers", + value: function _removeEventHandlers() { + var _this5 = this; + + this.el.removeEventListener('click', this._handleCollapsibleClickBound); + this.$headers.each(function (header) { + header.removeEventListener('keydown', _this5._handleCollapsibleKeydownBound); + }); + } + + /** + * Handle Collapsible Click + * @param {Event} e + */ + + }, { + key: "_handleCollapsibleClick", + value: function _handleCollapsibleClick(e) { + var $header = $(e.target).closest('.collapsible-header'); + if (e.target && $header.length) { + var $collapsible = $header.closest('.collapsible'); + if ($collapsible[0] === this.el) { + var $collapsibleLi = $header.closest('li'); + var $collapsibleLis = $collapsible.children('li'); + var isActive = $collapsibleLi[0].classList.contains('active'); + var index = $collapsibleLis.index($collapsibleLi); + + if (isActive) { + this.close(index); + } else { + this.open(index); + } + } + } + } + + /** + * Handle Collapsible Keydown + * @param {Event} e + */ + + }, { + key: "_handleCollapsibleKeydown", + value: function _handleCollapsibleKeydown(e) { + if (e.keyCode === 13) { + this._handleCollapsibleClickBound(e); + } + } + + /** + * Animate in collapsible slide + * @param {Number} index - 0th index of slide + */ + + }, { + key: "_animateIn", + value: function _animateIn(index) { + var _this6 = this; + + var $collapsibleLi = this.$el.children('li').eq(index); + if ($collapsibleLi.length) { + var $body = $collapsibleLi.children('.collapsible-body'); + + anim.remove($body[0]); + $body.css({ + display: 'block', + overflow: 'hidden', + height: 0, + paddingTop: '', + paddingBottom: '' + }); + + var pTop = $body.css('padding-top'); + var pBottom = $body.css('padding-bottom'); + var finalHeight = $body[0].scrollHeight; + $body.css({ + paddingTop: 0, + paddingBottom: 0 + }); + + anim({ + targets: $body[0], + height: finalHeight, + paddingTop: pTop, + paddingBottom: pBottom, + duration: this.options.inDuration, + easing: 'easeInOutCubic', + complete: function (anim) { + $body.css({ + overflow: '', + paddingTop: '', + paddingBottom: '', + height: '' + }); + + // onOpenEnd callback + if (typeof _this6.options.onOpenEnd === 'function') { + _this6.options.onOpenEnd.call(_this6, $collapsibleLi[0]); + } + } + }); + } + } + + /** + * Animate out collapsible slide + * @param {Number} index - 0th index of slide to open + */ + + }, { + key: "_animateOut", + value: function _animateOut(index) { + var _this7 = this; + + var $collapsibleLi = this.$el.children('li').eq(index); + if ($collapsibleLi.length) { + var $body = $collapsibleLi.children('.collapsible-body'); + anim.remove($body[0]); + $body.css('overflow', 'hidden'); + anim({ + targets: $body[0], + height: 0, + paddingTop: 0, + paddingBottom: 0, + duration: this.options.outDuration, + easing: 'easeInOutCubic', + complete: function () { + $body.css({ + height: '', + overflow: '', + padding: '', + display: '' + }); + + // onCloseEnd callback + if (typeof _this7.options.onCloseEnd === 'function') { + _this7.options.onCloseEnd.call(_this7, $collapsibleLi[0]); + } + } + }); + } + } + + /** + * Open Collapsible + * @param {Number} index - 0th index of slide + */ + + }, { + key: "open", + value: function open(index) { + var _this8 = this; + + var $collapsibleLi = this.$el.children('li').eq(index); + if ($collapsibleLi.length && !$collapsibleLi[0].classList.contains('active')) { + // onOpenStart callback + if (typeof this.options.onOpenStart === 'function') { + this.options.onOpenStart.call(this, $collapsibleLi[0]); + } + + // Handle accordion behavior + if (this.options.accordion) { + var $collapsibleLis = this.$el.children('li'); + var $activeLis = this.$el.children('li.active'); + $activeLis.each(function (el) { + var index = $collapsibleLis.index($(el)); + _this8.close(index); + }); + } + + // Animate in + $collapsibleLi[0].classList.add('active'); + this._animateIn(index); + } + } + + /** + * Close Collapsible + * @param {Number} index - 0th index of slide + */ + + }, { + key: "close", + value: function close(index) { + var $collapsibleLi = this.$el.children('li').eq(index); + if ($collapsibleLi.length && $collapsibleLi[0].classList.contains('active')) { + // onCloseStart callback + if (typeof this.options.onCloseStart === 'function') { + this.options.onCloseStart.call(this, $collapsibleLi[0]); + } + + // Animate out + $collapsibleLi[0].classList.remove('active'); + this._animateOut(index); + } + } + }], [{ + key: "init", + value: function init(els, options) { + return _get(Collapsible.__proto__ || Object.getPrototypeOf(Collapsible), "init", this).call(this, this, els, options); + } + + /** + * Get Instance + */ + + }, { + key: "getInstance", + value: function getInstance(el) { + var domElem = !!el.jquery ? el[0] : el; + return domElem.M_Collapsible; + } + }, { + key: "defaults", + get: function () { + return _defaults; + } + }]); + + return Collapsible; + }(Component); + + M.Collapsible = Collapsible; + + if (M.jQueryLoaded) { + M.initializeJqueryWrapper(Collapsible, 'collapsible', 'M_Collapsible'); + } +})(cash, M.anime); +;(function ($, anim) { + 'use strict'; + + var _defaults = { + alignment: 'left', + autoFocus: true, + constrainWidth: true, + container: null, + coverTrigger: true, + closeOnClick: true, + hover: false, + inDuration: 150, + outDuration: 250, + onOpenStart: null, + onOpenEnd: null, + onCloseStart: null, + onCloseEnd: null, + onItemClick: null + }; + + /** + * @class + */ + + var Dropdown = function (_Component2) { + _inherits(Dropdown, _Component2); + + function Dropdown(el, options) { + _classCallCheck(this, Dropdown); + + var _this9 = _possibleConstructorReturn(this, (Dropdown.__proto__ || Object.getPrototypeOf(Dropdown)).call(this, Dropdown, el, options)); + + _this9.el.M_Dropdown = _this9; + Dropdown._dropdowns.push(_this9); + + _this9.id = M.getIdFromTrigger(el); + _this9.dropdownEl = document.getElementById(_this9.id); + _this9.$dropdownEl = $(_this9.dropdownEl); + + /** + * Options for the dropdown + * @member Dropdown#options + * @prop {String} [alignment='left'] - Edge which the dropdown is aligned to + * @prop {Boolean} [autoFocus=true] - Automatically focus dropdown el for keyboard + * @prop {Boolean} [constrainWidth=true] - Constrain width to width of the button + * @prop {Element} container - Container element to attach dropdown to (optional) + * @prop {Boolean} [coverTrigger=true] - Place dropdown over trigger + * @prop {Boolean} [closeOnClick=true] - Close on click of dropdown item + * @prop {Boolean} [hover=false] - Open dropdown on hover + * @prop {Number} [inDuration=150] - Duration of open animation in ms + * @prop {Number} [outDuration=250] - Duration of close animation in ms + * @prop {Function} onOpenStart - Function called when dropdown starts opening + * @prop {Function} onOpenEnd - Function called when dropdown finishes opening + * @prop {Function} onCloseStart - Function called when dropdown starts closing + * @prop {Function} onCloseEnd - Function called when dropdown finishes closing + */ + _this9.options = $.extend({}, Dropdown.defaults, options); + + /** + * Describes open/close state of dropdown + * @type {Boolean} + */ + _this9.isOpen = false; + + /** + * Describes if dropdown content is scrollable + * @type {Boolean} + */ + _this9.isScrollable = false; + + /** + * Describes if touch moving on dropdown content + * @type {Boolean} + */ + _this9.isTouchMoving = false; + + _this9.focusedIndex = -1; + _this9.filterQuery = []; + + // Move dropdown-content after dropdown-trigger + _this9._moveDropdown(); + + _this9._makeDropdownFocusable(); + _this9._resetFilterQueryBound = _this9._resetFilterQuery.bind(_this9); + _this9._handleDocumentClickBound = _this9._handleDocumentClick.bind(_this9); + _this9._handleDocumentTouchmoveBound = _this9._handleDocumentTouchmove.bind(_this9); + _this9._handleDropdownClickBound = _this9._handleDropdownClick.bind(_this9); + _this9._handleDropdownKeydownBound = _this9._handleDropdownKeydown.bind(_this9); + _this9._handleTriggerKeydownBound = _this9._handleTriggerKeydown.bind(_this9); + _this9._setupEventHandlers(); + return _this9; + } + + _createClass(Dropdown, [{ + key: "destroy", + + + /** + * Teardown component + */ + value: function destroy() { + this._resetDropdownStyles(); + this._removeEventHandlers(); + Dropdown._dropdowns.splice(Dropdown._dropdowns.indexOf(this), 1); + this.el.M_Dropdown = undefined; + } + + /** + * Setup Event Handlers + */ + + }, { + key: "_setupEventHandlers", + value: function _setupEventHandlers() { + // Trigger keydown handler + this.el.addEventListener('keydown', this._handleTriggerKeydownBound); + + // Item click handler + this.dropdownEl.addEventListener('click', this._handleDropdownClickBound); + + // Hover event handlers + if (this.options.hover) { + this._handleMouseEnterBound = this._handleMouseEnter.bind(this); + this.el.addEventListener('mouseenter', this._handleMouseEnterBound); + this._handleMouseLeaveBound = this._handleMouseLeave.bind(this); + this.el.addEventListener('mouseleave', this._handleMouseLeaveBound); + this.dropdownEl.addEventListener('mouseleave', this._handleMouseLeaveBound); + + // Click event handlers + } else { + this._handleClickBound = this._handleClick.bind(this); + this.el.addEventListener('click', this._handleClickBound); + } + } + + /** + * Remove Event Handlers + */ + + }, { + key: "_removeEventHandlers", + value: function _removeEventHandlers() { + this.el.removeEventListener('keydown', this._handleTriggerKeydownBound); + this.dropdownEl.removeEventListener('click', this._handleDropdownClickBound); + + if (this.options.hover) { + this.el.removeEventListener('mouseenter', this._handleMouseEnterBound); + this.el.removeEventListener('mouseleave', this._handleMouseLeaveBound); + this.dropdownEl.removeEventListener('mouseleave', this._handleMouseLeaveBound); + } else { + this.el.removeEventListener('click', this._handleClickBound); + } + } + }, { + key: "_setupTemporaryEventHandlers", + value: function _setupTemporaryEventHandlers() { + // Use capture phase event handler to prevent click + document.body.addEventListener('click', this._handleDocumentClickBound, true); + document.body.addEventListener('touchend', this._handleDocumentClickBound); + document.body.addEventListener('touchmove', this._handleDocumentTouchmoveBound); + this.dropdownEl.addEventListener('keydown', this._handleDropdownKeydownBound); + } + }, { + key: "_removeTemporaryEventHandlers", + value: function _removeTemporaryEventHandlers() { + // Use capture phase event handler to prevent click + document.body.removeEventListener('click', this._handleDocumentClickBound, true); + document.body.removeEventListener('touchend', this._handleDocumentClickBound); + document.body.removeEventListener('touchmove', this._handleDocumentTouchmoveBound); + this.dropdownEl.removeEventListener('keydown', this._handleDropdownKeydownBound); + } + }, { + key: "_handleClick", + value: function _handleClick(e) { + e.preventDefault(); + this.open(); + } + }, { + key: "_handleMouseEnter", + value: function _handleMouseEnter() { + this.open(); + } + }, { + key: "_handleMouseLeave", + value: function _handleMouseLeave(e) { + var toEl = e.toElement || e.relatedTarget; + var leaveToDropdownContent = !!$(toEl).closest('.dropdown-content').length; + var leaveToActiveDropdownTrigger = false; + + var $closestTrigger = $(toEl).closest('.dropdown-trigger'); + if ($closestTrigger.length && !!$closestTrigger[0].M_Dropdown && $closestTrigger[0].M_Dropdown.isOpen) { + leaveToActiveDropdownTrigger = true; + } + + // Close hover dropdown if mouse did not leave to either active dropdown-trigger or dropdown-content + if (!leaveToActiveDropdownTrigger && !leaveToDropdownContent) { + this.close(); + } + } + }, { + key: "_handleDocumentClick", + value: function _handleDocumentClick(e) { + var _this10 = this; + + var $target = $(e.target); + if (this.options.closeOnClick && $target.closest('.dropdown-content').length && !this.isTouchMoving) { + // isTouchMoving to check if scrolling on mobile. + setTimeout(function () { + _this10.close(); + }, 0); + } else if ($target.closest('.dropdown-trigger').length || !$target.closest('.dropdown-content').length) { + setTimeout(function () { + _this10.close(); + }, 0); + } + this.isTouchMoving = false; + } + }, { + key: "_handleTriggerKeydown", + value: function _handleTriggerKeydown(e) { + // ARROW DOWN OR ENTER WHEN SELECT IS CLOSED - open Dropdown + if ((e.which === M.keys.ARROW_DOWN || e.which === M.keys.ENTER) && !this.isOpen) { + e.preventDefault(); + this.open(); + } + } + + /** + * Handle Document Touchmove + * @param {Event} e + */ + + }, { + key: "_handleDocumentTouchmove", + value: function _handleDocumentTouchmove(e) { + var $target = $(e.target); + if ($target.closest('.dropdown-content').length) { + this.isTouchMoving = true; + } + } + + /** + * Handle Dropdown Click + * @param {Event} e + */ + + }, { + key: "_handleDropdownClick", + value: function _handleDropdownClick(e) { + // onItemClick callback + if (typeof this.options.onItemClick === 'function') { + var itemEl = $(e.target).closest('li')[0]; + this.options.onItemClick.call(this, itemEl); + } + } + + /** + * Handle Dropdown Keydown + * @param {Event} e + */ + + }, { + key: "_handleDropdownKeydown", + value: function _handleDropdownKeydown(e) { + if (e.which === M.keys.TAB) { + e.preventDefault(); + this.close(); + + // Navigate down dropdown list + } else if ((e.which === M.keys.ARROW_DOWN || e.which === M.keys.ARROW_UP) && this.isOpen) { + e.preventDefault(); + var direction = e.which === M.keys.ARROW_DOWN ? 1 : -1; + var newFocusedIndex = this.focusedIndex; + var foundNewIndex = false; + do { + newFocusedIndex = newFocusedIndex + direction; + + if (!!this.dropdownEl.children[newFocusedIndex] && this.dropdownEl.children[newFocusedIndex].tabIndex !== -1) { + foundNewIndex = true; + break; + } + } while (newFocusedIndex < this.dropdownEl.children.length && newFocusedIndex >= 0); + + if (foundNewIndex) { + // Remove active class from old element + if (this.focusedIndex >= 0) this.dropdownEl.children[this.focusedIndex].classList.remove('active'); + this.focusedIndex = newFocusedIndex; + this._focusFocusedItem(); + } + + // ENTER selects choice on focused item + } else if (e.which === M.keys.ENTER && this.isOpen) { + // Search for
        and ") + ''; + } + }, { + key: "renderRow", + value: function renderRow(days, isRTL, isRowSelected) { + return '' + (isRTL ? days.reverse() : days).join('') + ''; + } + }, { + key: "renderTable", + value: function renderTable(opts, data, randId) { + return '
        ' + this.renderHead(opts) + this.renderBody(data) + '
        '; + } + }, { + key: "renderHead", + value: function renderHead(opts) { + var i = void 0, + arr = []; + for (i = 0; i < 7; i++) { + arr.push("" + this.renderDayName(opts, i, true) + ""); + } + return '' + (opts.isRTL ? arr.reverse() : arr).join('') + ''; + } + }, { + key: "renderBody", + value: function renderBody(rows) { + return '' + rows.join('') + ''; + } + }, { + key: "renderTitle", + value: function renderTitle(instance, c, year, month, refYear, randId) { + var i = void 0, + j = void 0, + arr = void 0, + opts = this.options, + isMinYear = year === opts.minYear, + isMaxYear = year === opts.maxYear, + html = '
        ', + monthHtml = void 0, + yearHtml = void 0, + prev = true, + next = true; + + for (arr = [], i = 0; i < 12; i++) { + arr.push(''); + } + + monthHtml = ''; + + if ($.isArray(opts.yearRange)) { + i = opts.yearRange[0]; + j = opts.yearRange[1] + 1; + } else { + i = year - opts.yearRange; + j = 1 + year + opts.yearRange; + } + + for (arr = []; i < j && i <= opts.maxYear; i++) { + if (i >= opts.minYear) { + arr.push(""); + } + } + if (opts.yearRangeReverse) { + arr.reverse(); + } + + yearHtml = ""; + + var leftArrow = ''; + html += ""; + + html += '
        '; + if (opts.showMonthAfterYear) { + html += yearHtml + monthHtml; + } else { + html += monthHtml + yearHtml; + } + html += '
        '; + + if (isMinYear && (month === 0 || opts.minMonth >= month)) { + prev = false; + } + + if (isMaxYear && (month === 11 || opts.maxMonth <= month)) { + next = false; + } + + var rightArrow = ''; + html += ""; + + return html += '
        '; + } + + /** + * refresh the HTML + */ + + }, { + key: "draw", + value: function draw(force) { + if (!this.isOpen && !force) { + return; + } + var opts = this.options, + minYear = opts.minYear, + maxYear = opts.maxYear, + minMonth = opts.minMonth, + maxMonth = opts.maxMonth, + html = '', + randId = void 0; + + if (this._y <= minYear) { + this._y = minYear; + if (!isNaN(minMonth) && this._m < minMonth) { + this._m = minMonth; + } + } + if (this._y >= maxYear) { + this._y = maxYear; + if (!isNaN(maxMonth) && this._m > maxMonth) { + this._m = maxMonth; + } + } + + randId = 'datepicker-title-' + Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 2); + + for (var c = 0; c < 1; c++) { + this._renderDateDisplay(); + html += this.renderTitle(this, c, this.calendars[c].year, this.calendars[c].month, this.calendars[0].year, randId) + this.render(this.calendars[c].year, this.calendars[c].month, randId); + } + + this.destroySelects(); + + this.calendarEl.innerHTML = html; + + // Init Materialize Select + var yearSelect = this.calendarEl.querySelector('.orig-select-year'); + var monthSelect = this.calendarEl.querySelector('.orig-select-month'); + M.FormSelect.init(yearSelect, { + classes: 'select-year', + dropdownOptions: { container: document.body, constrainWidth: false } + }); + M.FormSelect.init(monthSelect, { + classes: 'select-month', + dropdownOptions: { container: document.body, constrainWidth: false } + }); + + // Add change handlers for select + yearSelect.addEventListener('change', this._handleYearChange.bind(this)); + monthSelect.addEventListener('change', this._handleMonthChange.bind(this)); + + if (typeof this.options.onDraw === 'function') { + this.options.onDraw(this); + } + } + + /** + * Setup Event Handlers + */ + + }, { + key: "_setupEventHandlers", + value: function _setupEventHandlers() { + this._handleInputKeydownBound = this._handleInputKeydown.bind(this); + this._handleInputClickBound = this._handleInputClick.bind(this); + this._handleInputChangeBound = this._handleInputChange.bind(this); + this._handleCalendarClickBound = this._handleCalendarClick.bind(this); + this._finishSelectionBound = this._finishSelection.bind(this); + this._handleMonthChange = this._handleMonthChange.bind(this); + this._closeBound = this.close.bind(this); + + this.el.addEventListener('click', this._handleInputClickBound); + this.el.addEventListener('keydown', this._handleInputKeydownBound); + this.el.addEventListener('change', this._handleInputChangeBound); + this.calendarEl.addEventListener('click', this._handleCalendarClickBound); + this.doneBtn.addEventListener('click', this._finishSelectionBound); + this.cancelBtn.addEventListener('click', this._closeBound); + + if (this.options.showClearBtn) { + this._handleClearClickBound = this._handleClearClick.bind(this); + this.clearBtn.addEventListener('click', this._handleClearClickBound); + } + } + }, { + key: "_setupVariables", + value: function _setupVariables() { + var _this56 = this; + + this.$modalEl = $(Datepicker._template); + this.modalEl = this.$modalEl[0]; + + this.calendarEl = this.modalEl.querySelector('.datepicker-calendar'); + + this.yearTextEl = this.modalEl.querySelector('.year-text'); + this.dateTextEl = this.modalEl.querySelector('.date-text'); + if (this.options.showClearBtn) { + this.clearBtn = this.modalEl.querySelector('.datepicker-clear'); + } + this.doneBtn = this.modalEl.querySelector('.datepicker-done'); + this.cancelBtn = this.modalEl.querySelector('.datepicker-cancel'); + + this.formats = { + d: function () { + return _this56.date.getDate(); + }, + dd: function () { + var d = _this56.date.getDate(); + return (d < 10 ? '0' : '') + d; + }, + ddd: function () { + return _this56.options.i18n.weekdaysShort[_this56.date.getDay()]; + }, + dddd: function () { + return _this56.options.i18n.weekdays[_this56.date.getDay()]; + }, + m: function () { + return _this56.date.getMonth() + 1; + }, + mm: function () { + var m = _this56.date.getMonth() + 1; + return (m < 10 ? '0' : '') + m; + }, + mmm: function () { + return _this56.options.i18n.monthsShort[_this56.date.getMonth()]; + }, + mmmm: function () { + return _this56.options.i18n.months[_this56.date.getMonth()]; + }, + yy: function () { + return ('' + _this56.date.getFullYear()).slice(2); + }, + yyyy: function () { + return _this56.date.getFullYear(); + } + }; + } + + /** + * Remove Event Handlers + */ + + }, { + key: "_removeEventHandlers", + value: function _removeEventHandlers() { + this.el.removeEventListener('click', this._handleInputClickBound); + this.el.removeEventListener('keydown', this._handleInputKeydownBound); + this.el.removeEventListener('change', this._handleInputChangeBound); + this.calendarEl.removeEventListener('click', this._handleCalendarClickBound); + } + }, { + key: "_handleInputClick", + value: function _handleInputClick() { + this.open(); + } + }, { + key: "_handleInputKeydown", + value: function _handleInputKeydown(e) { + if (e.which === M.keys.ENTER) { + e.preventDefault(); + this.open(); + } + } + }, { + key: "_handleCalendarClick", + value: function _handleCalendarClick(e) { + if (!this.isOpen) { + return; + } + + var $target = $(e.target); + if (!$target.hasClass('is-disabled')) { + if ($target.hasClass('datepicker-day-button') && !$target.hasClass('is-empty') && !$target.parent().hasClass('is-disabled')) { + this.setDate(new Date(e.target.getAttribute('data-year'), e.target.getAttribute('data-month'), e.target.getAttribute('data-day'))); + if (this.options.autoClose) { + this._finishSelection(); + } + } else if ($target.closest('.month-prev').length) { + this.prevMonth(); + } else if ($target.closest('.month-next').length) { + this.nextMonth(); + } + } + } + }, { + key: "_handleClearClick", + value: function _handleClearClick() { + this.date = null; + this.setInputValue(); + this.close(); + } + }, { + key: "_handleMonthChange", + value: function _handleMonthChange(e) { + this.gotoMonth(e.target.value); + } + }, { + key: "_handleYearChange", + value: function _handleYearChange(e) { + this.gotoYear(e.target.value); + } + + /** + * change view to a specific month (zero-index, e.g. 0: January) + */ + + }, { + key: "gotoMonth", + value: function gotoMonth(month) { + if (!isNaN(month)) { + this.calendars[0].month = parseInt(month, 10); + this.adjustCalendars(); + } + } + + /** + * change view to a specific full year (e.g. "2012") + */ + + }, { + key: "gotoYear", + value: function gotoYear(year) { + if (!isNaN(year)) { + this.calendars[0].year = parseInt(year, 10); + this.adjustCalendars(); + } + } + }, { + key: "_handleInputChange", + value: function _handleInputChange(e) { + var date = void 0; + + // Prevent change event from being fired when triggered by the plugin + if (e.firedBy === this) { + return; + } + if (this.options.parse) { + date = this.options.parse(this.el.value, this.options.format); + } else { + date = new Date(Date.parse(this.el.value)); + } + + if (Datepicker._isDate(date)) { + this.setDate(date); + } + } + }, { + key: "renderDayName", + value: function renderDayName(opts, day, abbr) { + day += opts.firstDay; + while (day >= 7) { + day -= 7; + } + return abbr ? opts.i18n.weekdaysAbbrev[day] : opts.i18n.weekdays[day]; + } + + /** + * Set input value to the selected date and close Datepicker + */ + + }, { + key: "_finishSelection", + value: function _finishSelection() { + this.setInputValue(); + this.close(); + } + + /** + * Open Datepicker + */ + + }, { + key: "open", + value: function open() { + if (this.isOpen) { + return; + } + + this.isOpen = true; + if (typeof this.options.onOpen === 'function') { + this.options.onOpen.call(this); + } + this.draw(); + this.modal.open(); + return this; + } + + /** + * Close Datepicker + */ + + }, { + key: "close", + value: function close() { + if (!this.isOpen) { + return; + } + + this.isOpen = false; + if (typeof this.options.onClose === 'function') { + this.options.onClose.call(this); + } + this.modal.close(); + return this; + } + }], [{ + key: "init", + value: function init(els, options) { + return _get(Datepicker.__proto__ || Object.getPrototypeOf(Datepicker), "init", this).call(this, this, els, options); + } + }, { + key: "_isDate", + value: function _isDate(obj) { + return (/Date/.test(Object.prototype.toString.call(obj)) && !isNaN(obj.getTime()) + ); + } + }, { + key: "_isWeekend", + value: function _isWeekend(date) { + var day = date.getDay(); + return day === 0 || day === 6; + } + }, { + key: "_setToStartOfDay", + value: function _setToStartOfDay(date) { + if (Datepicker._isDate(date)) date.setHours(0, 0, 0, 0); + } + }, { + key: "_getDaysInMonth", + value: function _getDaysInMonth(year, month) { + return [31, Datepicker._isLeapYear(year) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month]; + } + }, { + key: "_isLeapYear", + value: function _isLeapYear(year) { + // solution by Matti Virkkunen: http://stackoverflow.com/a/4881951 + return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0; + } + }, { + key: "_compareDates", + value: function _compareDates(a, b) { + // weak date comparison (use setToStartOfDay(date) to ensure correct result) + return a.getTime() === b.getTime(); + } + }, { + key: "_setToStartOfDay", + value: function _setToStartOfDay(date) { + if (Datepicker._isDate(date)) date.setHours(0, 0, 0, 0); + } + + /** + * Get Instance + */ + + }, { + key: "getInstance", + value: function getInstance(el) { + var domElem = !!el.jquery ? el[0] : el; + return domElem.M_Datepicker; + } + }, { + key: "defaults", + get: function () { + return _defaults; + } + }]); + + return Datepicker; + }(Component); + + Datepicker._template = [''].join(''); + + M.Datepicker = Datepicker; + + if (M.jQueryLoaded) { + M.initializeJqueryWrapper(Datepicker, 'datepicker', 'M_Datepicker'); + } +})(cash); +;(function ($) { + 'use strict'; + + var _defaults = { + dialRadius: 135, + outerRadius: 105, + innerRadius: 70, + tickRadius: 20, + duration: 350, + container: null, + defaultTime: 'now', // default time, 'now' or '13:14' e.g. + fromNow: 0, // Millisecond offset from the defaultTime + showClearBtn: false, + + // internationalization + i18n: { + cancel: 'Cancel', + clear: 'Clear', + done: 'Ok' + }, + + autoClose: false, // auto close when minute is selected + twelveHour: true, // change to 12 hour AM/PM clock from 24 hour + vibrate: true, // vibrate the device when dragging clock hand + + // Callbacks + onOpenStart: null, + onOpenEnd: null, + onCloseStart: null, + onCloseEnd: null, + onSelect: null + }; + + /** + * @class + * + */ + + var Timepicker = function (_Component16) { + _inherits(Timepicker, _Component16); + + function Timepicker(el, options) { + _classCallCheck(this, Timepicker); + + var _this57 = _possibleConstructorReturn(this, (Timepicker.__proto__ || Object.getPrototypeOf(Timepicker)).call(this, Timepicker, el, options)); + + _this57.el.M_Timepicker = _this57; + + _this57.options = $.extend({}, Timepicker.defaults, options); + + _this57.id = M.guid(); + _this57._insertHTMLIntoDOM(); + _this57._setupModal(); + _this57._setupVariables(); + _this57._setupEventHandlers(); + + _this57._clockSetup(); + _this57._pickerSetup(); + return _this57; + } + + _createClass(Timepicker, [{ + key: "destroy", + + + /** + * Teardown component + */ + value: function destroy() { + this._removeEventHandlers(); + this.modal.destroy(); + $(this.modalEl).remove(); + this.el.M_Timepicker = undefined; + } + + /** + * Setup Event Handlers + */ + + }, { + key: "_setupEventHandlers", + value: function _setupEventHandlers() { + this._handleInputKeydownBound = this._handleInputKeydown.bind(this); + this._handleInputClickBound = this._handleInputClick.bind(this); + this._handleClockClickStartBound = this._handleClockClickStart.bind(this); + this._handleDocumentClickMoveBound = this._handleDocumentClickMove.bind(this); + this._handleDocumentClickEndBound = this._handleDocumentClickEnd.bind(this); + + this.el.addEventListener('click', this._handleInputClickBound); + this.el.addEventListener('keydown', this._handleInputKeydownBound); + this.plate.addEventListener('mousedown', this._handleClockClickStartBound); + this.plate.addEventListener('touchstart', this._handleClockClickStartBound); + + $(this.spanHours).on('click', this.showView.bind(this, 'hours')); + $(this.spanMinutes).on('click', this.showView.bind(this, 'minutes')); + } + }, { + key: "_removeEventHandlers", + value: function _removeEventHandlers() { + this.el.removeEventListener('click', this._handleInputClickBound); + this.el.removeEventListener('keydown', this._handleInputKeydownBound); + } + }, { + key: "_handleInputClick", + value: function _handleInputClick() { + this.open(); + } + }, { + key: "_handleInputKeydown", + value: function _handleInputKeydown(e) { + if (e.which === M.keys.ENTER) { + e.preventDefault(); + this.open(); + } + } + }, { + key: "_handleClockClickStart", + value: function _handleClockClickStart(e) { + e.preventDefault(); + var clockPlateBR = this.plate.getBoundingClientRect(); + var offset = { x: clockPlateBR.left, y: clockPlateBR.top }; + + this.x0 = offset.x + this.options.dialRadius; + this.y0 = offset.y + this.options.dialRadius; + this.moved = false; + var clickPos = Timepicker._Pos(e); + this.dx = clickPos.x - this.x0; + this.dy = clickPos.y - this.y0; + + // Set clock hands + this.setHand(this.dx, this.dy, false); + + // Mousemove on document + document.addEventListener('mousemove', this._handleDocumentClickMoveBound); + document.addEventListener('touchmove', this._handleDocumentClickMoveBound); + + // Mouseup on document + document.addEventListener('mouseup', this._handleDocumentClickEndBound); + document.addEventListener('touchend', this._handleDocumentClickEndBound); + } + }, { + key: "_handleDocumentClickMove", + value: function _handleDocumentClickMove(e) { + e.preventDefault(); + var clickPos = Timepicker._Pos(e); + var x = clickPos.x - this.x0; + var y = clickPos.y - this.y0; + this.moved = true; + this.setHand(x, y, false, true); + } + }, { + key: "_handleDocumentClickEnd", + value: function _handleDocumentClickEnd(e) { + var _this58 = this; + + e.preventDefault(); + document.removeEventListener('mouseup', this._handleDocumentClickEndBound); + document.removeEventListener('touchend', this._handleDocumentClickEndBound); + var clickPos = Timepicker._Pos(e); + var x = clickPos.x - this.x0; + var y = clickPos.y - this.y0; + if (this.moved && x === this.dx && y === this.dy) { + this.setHand(x, y); + } + + if (this.currentView === 'hours') { + this.showView('minutes', this.options.duration / 2); + } else if (this.options.autoClose) { + $(this.minutesView).addClass('timepicker-dial-out'); + setTimeout(function () { + _this58.done(); + }, this.options.duration / 2); + } + + if (typeof this.options.onSelect === 'function') { + this.options.onSelect.call(this, this.hours, this.minutes); + } + + // Unbind mousemove event + document.removeEventListener('mousemove', this._handleDocumentClickMoveBound); + document.removeEventListener('touchmove', this._handleDocumentClickMoveBound); + } + }, { + key: "_insertHTMLIntoDOM", + value: function _insertHTMLIntoDOM() { + this.$modalEl = $(Timepicker._template); + this.modalEl = this.$modalEl[0]; + this.modalEl.id = 'modal-' + this.id; + + // Append popover to input by default + var containerEl = document.querySelector(this.options.container); + if (this.options.container && !!containerEl) { + this.$modalEl.appendTo(containerEl); + } else { + this.$modalEl.insertBefore(this.el); + } + } + }, { + key: "_setupModal", + value: function _setupModal() { + var _this59 = this; + + this.modal = M.Modal.init(this.modalEl, { + onOpenStart: this.options.onOpenStart, + onOpenEnd: this.options.onOpenEnd, + onCloseStart: this.options.onCloseStart, + onCloseEnd: function () { + if (typeof _this59.options.onCloseEnd === 'function') { + _this59.options.onCloseEnd.call(_this59); + } + _this59.isOpen = false; + } + }); + } + }, { + key: "_setupVariables", + value: function _setupVariables() { + this.currentView = 'hours'; + this.vibrate = navigator.vibrate ? 'vibrate' : navigator.webkitVibrate ? 'webkitVibrate' : null; + + this._canvas = this.modalEl.querySelector('.timepicker-canvas'); + this.plate = this.modalEl.querySelector('.timepicker-plate'); + + this.hoursView = this.modalEl.querySelector('.timepicker-hours'); + this.minutesView = this.modalEl.querySelector('.timepicker-minutes'); + this.spanHours = this.modalEl.querySelector('.timepicker-span-hours'); + this.spanMinutes = this.modalEl.querySelector('.timepicker-span-minutes'); + this.spanAmPm = this.modalEl.querySelector('.timepicker-span-am-pm'); + this.footer = this.modalEl.querySelector('.timepicker-footer'); + this.amOrPm = 'PM'; + } + }, { + key: "_pickerSetup", + value: function _pickerSetup() { + var $clearBtn = $("").appendTo(this.footer).on('click', this.clear.bind(this)); + if (this.options.showClearBtn) { + $clearBtn.css({ visibility: '' }); + } + + var confirmationBtnsContainer = $('
        '); + $('').appendTo(confirmationBtnsContainer).on('click', this.close.bind(this)); + $('').appendTo(confirmationBtnsContainer).on('click', this.done.bind(this)); + confirmationBtnsContainer.appendTo(this.footer); + } + }, { + key: "_clockSetup", + value: function _clockSetup() { + if (this.options.twelveHour) { + this.$amBtn = $('
        AM
        '); + this.$pmBtn = $('
        PM
        '); + this.$amBtn.on('click', this._handleAmPmClick.bind(this)).appendTo(this.spanAmPm); + this.$pmBtn.on('click', this._handleAmPmClick.bind(this)).appendTo(this.spanAmPm); + } + + this._buildHoursView(); + this._buildMinutesView(); + this._buildSVGClock(); + } + }, { + key: "_buildSVGClock", + value: function _buildSVGClock() { + // Draw clock hands and others + var dialRadius = this.options.dialRadius; + var tickRadius = this.options.tickRadius; + var diameter = dialRadius * 2; + + var svg = Timepicker._createSVGEl('svg'); + svg.setAttribute('class', 'timepicker-svg'); + svg.setAttribute('width', diameter); + svg.setAttribute('height', diameter); + var g = Timepicker._createSVGEl('g'); + g.setAttribute('transform', 'translate(' + dialRadius + ',' + dialRadius + ')'); + var bearing = Timepicker._createSVGEl('circle'); + bearing.setAttribute('class', 'timepicker-canvas-bearing'); + bearing.setAttribute('cx', 0); + bearing.setAttribute('cy', 0); + bearing.setAttribute('r', 4); + var hand = Timepicker._createSVGEl('line'); + hand.setAttribute('x1', 0); + hand.setAttribute('y1', 0); + var bg = Timepicker._createSVGEl('circle'); + bg.setAttribute('class', 'timepicker-canvas-bg'); + bg.setAttribute('r', tickRadius); + g.appendChild(hand); + g.appendChild(bg); + g.appendChild(bearing); + svg.appendChild(g); + this._canvas.appendChild(svg); + + this.hand = hand; + this.bg = bg; + this.bearing = bearing; + this.g = g; + } + }, { + key: "_buildHoursView", + value: function _buildHoursView() { + var $tick = $('
        '); + // Hours view + if (this.options.twelveHour) { + for (var i = 1; i < 13; i += 1) { + var tick = $tick.clone(); + var radian = i / 6 * Math.PI; + var radius = this.options.outerRadius; + tick.css({ + left: this.options.dialRadius + Math.sin(radian) * radius - this.options.tickRadius + 'px', + top: this.options.dialRadius - Math.cos(radian) * radius - this.options.tickRadius + 'px' + }); + tick.html(i === 0 ? '00' : i); + this.hoursView.appendChild(tick[0]); + // tick.on(mousedownEvent, mousedown); + } + } else { + for (var _i2 = 0; _i2 < 24; _i2 += 1) { + var _tick = $tick.clone(); + var _radian = _i2 / 6 * Math.PI; + var inner = _i2 > 0 && _i2 < 13; + var _radius = inner ? this.options.innerRadius : this.options.outerRadius; + _tick.css({ + left: this.options.dialRadius + Math.sin(_radian) * _radius - this.options.tickRadius + 'px', + top: this.options.dialRadius - Math.cos(_radian) * _radius - this.options.tickRadius + 'px' + }); + _tick.html(_i2 === 0 ? '00' : _i2); + this.hoursView.appendChild(_tick[0]); + // tick.on(mousedownEvent, mousedown); + } + } + } + }, { + key: "_buildMinutesView", + value: function _buildMinutesView() { + var $tick = $('
        '); + // Minutes view + for (var i = 0; i < 60; i += 5) { + var tick = $tick.clone(); + var radian = i / 30 * Math.PI; + tick.css({ + left: this.options.dialRadius + Math.sin(radian) * this.options.outerRadius - this.options.tickRadius + 'px', + top: this.options.dialRadius - Math.cos(radian) * this.options.outerRadius - this.options.tickRadius + 'px' + }); + tick.html(Timepicker._addLeadingZero(i)); + this.minutesView.appendChild(tick[0]); + } + } + }, { + key: "_handleAmPmClick", + value: function _handleAmPmClick(e) { + var $btnClicked = $(e.target); + this.amOrPm = $btnClicked.hasClass('am-btn') ? 'AM' : 'PM'; + this._updateAmPmView(); + } + }, { + key: "_updateAmPmView", + value: function _updateAmPmView() { + if (this.options.twelveHour) { + this.$amBtn.toggleClass('text-primary', this.amOrPm === 'AM'); + this.$pmBtn.toggleClass('text-primary', this.amOrPm === 'PM'); + } + } + }, { + key: "_updateTimeFromInput", + value: function _updateTimeFromInput() { + // Get the time + var value = ((this.el.value || this.options.defaultTime || '') + '').split(':'); + if (this.options.twelveHour && !(typeof value[1] === 'undefined')) { + if (value[1].toUpperCase().indexOf('AM') > 0) { + this.amOrPm = 'AM'; + } else { + this.amOrPm = 'PM'; + } + value[1] = value[1].replace('AM', '').replace('PM', ''); + } + if (value[0] === 'now') { + var now = new Date(+new Date() + this.options.fromNow); + value = [now.getHours(), now.getMinutes()]; + if (this.options.twelveHour) { + this.amOrPm = value[0] >= 12 && value[0] < 24 ? 'PM' : 'AM'; + } + } + this.hours = +value[0] || 0; + this.minutes = +value[1] || 0; + this.spanHours.innerHTML = this.hours; + this.spanMinutes.innerHTML = Timepicker._addLeadingZero(this.minutes); + + this._updateAmPmView(); + } + }, { + key: "showView", + value: function showView(view, delay) { + if (view === 'minutes' && $(this.hoursView).css('visibility') === 'visible') { + // raiseCallback(this.options.beforeHourSelect); + } + var isHours = view === 'hours', + nextView = isHours ? this.hoursView : this.minutesView, + hideView = isHours ? this.minutesView : this.hoursView; + this.currentView = view; + + $(this.spanHours).toggleClass('text-primary', isHours); + $(this.spanMinutes).toggleClass('text-primary', !isHours); + + // Transition view + hideView.classList.add('timepicker-dial-out'); + $(nextView).css('visibility', 'visible').removeClass('timepicker-dial-out'); + + // Reset clock hand + this.resetClock(delay); + + // After transitions ended + clearTimeout(this.toggleViewTimer); + this.toggleViewTimer = setTimeout(function () { + $(hideView).css('visibility', 'hidden'); + }, this.options.duration); + } + }, { + key: "resetClock", + value: function resetClock(delay) { + var view = this.currentView, + value = this[view], + isHours = view === 'hours', + unit = Math.PI / (isHours ? 6 : 30), + radian = value * unit, + radius = isHours && value > 0 && value < 13 ? this.options.innerRadius : this.options.outerRadius, + x = Math.sin(radian) * radius, + y = -Math.cos(radian) * radius, + self = this; + + if (delay) { + $(this.canvas).addClass('timepicker-canvas-out'); + setTimeout(function () { + $(self.canvas).removeClass('timepicker-canvas-out'); + self.setHand(x, y); + }, delay); + } else { + this.setHand(x, y); + } + } + }, { + key: "setHand", + value: function setHand(x, y, roundBy5) { + var _this60 = this; + + var radian = Math.atan2(x, -y), + isHours = this.currentView === 'hours', + unit = Math.PI / (isHours || roundBy5 ? 6 : 30), + z = Math.sqrt(x * x + y * y), + inner = isHours && z < (this.options.outerRadius + this.options.innerRadius) / 2, + radius = inner ? this.options.innerRadius : this.options.outerRadius; + + if (this.options.twelveHour) { + radius = this.options.outerRadius; + } + + // Radian should in range [0, 2PI] + if (radian < 0) { + radian = Math.PI * 2 + radian; + } + + // Get the round value + var value = Math.round(radian / unit); + + // Get the round radian + radian = value * unit; + + // Correct the hours or minutes + if (this.options.twelveHour) { + if (isHours) { + if (value === 0) value = 12; + } else { + if (roundBy5) value *= 5; + if (value === 60) value = 0; + } + } else { + if (isHours) { + if (value === 12) { + value = 0; + } + value = inner ? value === 0 ? 12 : value : value === 0 ? 0 : value + 12; + } else { + if (roundBy5) { + value *= 5; + } + if (value === 60) { + value = 0; + } + } + } + + // Once hours or minutes changed, vibrate the device + if (this[this.currentView] !== value) { + if (this.vibrate && this.options.vibrate) { + // Do not vibrate too frequently + if (!this.vibrateTimer) { + navigator[this.vibrate](10); + this.vibrateTimer = setTimeout(function () { + _this60.vibrateTimer = null; + }, 100); + } + } + } + + this[this.currentView] = value; + if (isHours) { + this['spanHours'].innerHTML = value; + } else { + this['spanMinutes'].innerHTML = Timepicker._addLeadingZero(value); + } + + // Set clock hand and others' position + var cx1 = Math.sin(radian) * (radius - this.options.tickRadius), + cy1 = -Math.cos(radian) * (radius - this.options.tickRadius), + cx2 = Math.sin(radian) * radius, + cy2 = -Math.cos(radian) * radius; + this.hand.setAttribute('x2', cx1); + this.hand.setAttribute('y2', cy1); + this.bg.setAttribute('cx', cx2); + this.bg.setAttribute('cy', cy2); + } + }, { + key: "open", + value: function open() { + if (this.isOpen) { + return; + } + + this.isOpen = true; + this._updateTimeFromInput(); + this.showView('hours'); + + this.modal.open(); + } + }, { + key: "close", + value: function close() { + if (!this.isOpen) { + return; + } + + this.isOpen = false; + this.modal.close(); + } + + /** + * Finish timepicker selection. + */ + + }, { + key: "done", + value: function done(e, clearValue) { + // Set input value + var last = this.el.value; + var value = clearValue ? '' : Timepicker._addLeadingZero(this.hours) + ':' + Timepicker._addLeadingZero(this.minutes); + this.time = value; + if (!clearValue && this.options.twelveHour) { + value = value + " " + this.amOrPm; + } + this.el.value = value; + + // Trigger change event + if (value !== last) { + this.$el.trigger('change'); + } + + this.close(); + this.el.focus(); + } + }, { + key: "clear", + value: function clear() { + this.done(null, true); + } + }], [{ + key: "init", + value: function init(els, options) { + return _get(Timepicker.__proto__ || Object.getPrototypeOf(Timepicker), "init", this).call(this, this, els, options); + } + }, { + key: "_addLeadingZero", + value: function _addLeadingZero(num) { + return (num < 10 ? '0' : '') + num; + } + }, { + key: "_createSVGEl", + value: function _createSVGEl(name) { + var svgNS = 'http://www.w3.org/2000/svg'; + return document.createElementNS(svgNS, name); + } + + /** + * @typedef {Object} Point + * @property {number} x The X Coordinate + * @property {number} y The Y Coordinate + */ + + /** + * Get x position of mouse or touch event + * @param {Event} e + * @return {Point} x and y location + */ + + }, { + key: "_Pos", + value: function _Pos(e) { + if (e.targetTouches && e.targetTouches.length >= 1) { + return { x: e.targetTouches[0].clientX, y: e.targetTouches[0].clientY }; + } + // mouse event + return { x: e.clientX, y: e.clientY }; + } + + /** + * Get Instance + */ + + }, { + key: "getInstance", + value: function getInstance(el) { + var domElem = !!el.jquery ? el[0] : el; + return domElem.M_Timepicker; + } + }, { + key: "defaults", + get: function () { + return _defaults; + } + }]); + + return Timepicker; + }(Component); + + Timepicker._template = [''].join(''); + + M.Timepicker = Timepicker; + + if (M.jQueryLoaded) { + M.initializeJqueryWrapper(Timepicker, 'timepicker', 'M_Timepicker'); + } +})(cash); +;(function ($) { + 'use strict'; + + var _defaults = {}; + + /** + * @class + * + */ + + var CharacterCounter = function (_Component17) { + _inherits(CharacterCounter, _Component17); + + /** + * Construct CharacterCounter instance + * @constructor + * @param {Element} el + * @param {Object} options + */ + function CharacterCounter(el, options) { + _classCallCheck(this, CharacterCounter); + + var _this61 = _possibleConstructorReturn(this, (CharacterCounter.__proto__ || Object.getPrototypeOf(CharacterCounter)).call(this, CharacterCounter, el, options)); + + _this61.el.M_CharacterCounter = _this61; + + /** + * Options for the character counter + */ + _this61.options = $.extend({}, CharacterCounter.defaults, options); + + _this61.isInvalid = false; + _this61.isValidLength = false; + _this61._setupCounter(); + _this61._setupEventHandlers(); + return _this61; + } + + _createClass(CharacterCounter, [{ + key: "destroy", + + + /** + * Teardown component + */ + value: function destroy() { + this._removeEventHandlers(); + this.el.CharacterCounter = undefined; + this._removeCounter(); + } + + /** + * Setup Event Handlers + */ + + }, { + key: "_setupEventHandlers", + value: function _setupEventHandlers() { + this._handleUpdateCounterBound = this.updateCounter.bind(this); + + this.el.addEventListener('focus', this._handleUpdateCounterBound, true); + this.el.addEventListener('input', this._handleUpdateCounterBound, true); + } + + /** + * Remove Event Handlers + */ + + }, { + key: "_removeEventHandlers", + value: function _removeEventHandlers() { + this.el.removeEventListener('focus', this._handleUpdateCounterBound, true); + this.el.removeEventListener('input', this._handleUpdateCounterBound, true); + } + + /** + * Setup counter element + */ + + }, { + key: "_setupCounter", + value: function _setupCounter() { + this.counterEl = document.createElement('span'); + $(this.counterEl).addClass('character-counter').css({ + float: 'right', + 'font-size': '12px', + height: 1 + }); + + this.$el.parent().append(this.counterEl); + } + + /** + * Remove counter element + */ + + }, { + key: "_removeCounter", + value: function _removeCounter() { + $(this.counterEl).remove(); + } + + /** + * Update counter + */ + + }, { + key: "updateCounter", + value: function updateCounter() { + var maxLength = +this.$el.attr('data-length'), + actualLength = this.el.value.length; + this.isValidLength = actualLength <= maxLength; + var counterString = actualLength; + + if (maxLength) { + counterString += '/' + maxLength; + this._validateInput(); + } + + $(this.counterEl).html(counterString); + } + + /** + * Add validation classes + */ + + }, { + key: "_validateInput", + value: function _validateInput() { + if (this.isValidLength && this.isInvalid) { + this.isInvalid = false; + this.$el.removeClass('invalid'); + } else if (!this.isValidLength && !this.isInvalid) { + this.isInvalid = true; + this.$el.removeClass('valid'); + this.$el.addClass('invalid'); + } + } + }], [{ + key: "init", + value: function init(els, options) { + return _get(CharacterCounter.__proto__ || Object.getPrototypeOf(CharacterCounter), "init", this).call(this, this, els, options); + } + + /** + * Get Instance + */ + + }, { + key: "getInstance", + value: function getInstance(el) { + var domElem = !!el.jquery ? el[0] : el; + return domElem.M_CharacterCounter; + } + }, { + key: "defaults", + get: function () { + return _defaults; + } + }]); + + return CharacterCounter; + }(Component); + + M.CharacterCounter = CharacterCounter; + + if (M.jQueryLoaded) { + M.initializeJqueryWrapper(CharacterCounter, 'characterCounter', 'M_CharacterCounter'); + } +})(cash); +;(function ($) { + 'use strict'; + + var _defaults = { + duration: 200, // ms + dist: -100, // zoom scale TODO: make this more intuitive as an option + shift: 0, // spacing for center image + padding: 0, // Padding between non center items + numVisible: 5, // Number of visible items in carousel + fullWidth: false, // Change to full width styles + indicators: false, // Toggle indicators + noWrap: false, // Don't wrap around and cycle through items. + onCycleTo: null // Callback for when a new slide is cycled to. + }; + + /** + * @class + * + */ + + var Carousel = function (_Component18) { + _inherits(Carousel, _Component18); + + /** + * Construct Carousel instance + * @constructor + * @param {Element} el + * @param {Object} options + */ + function Carousel(el, options) { + _classCallCheck(this, Carousel); + + var _this62 = _possibleConstructorReturn(this, (Carousel.__proto__ || Object.getPrototypeOf(Carousel)).call(this, Carousel, el, options)); + + _this62.el.M_Carousel = _this62; + + /** + * Options for the carousel + * @member Carousel#options + * @prop {Number} duration + * @prop {Number} dist + * @prop {Number} shift + * @prop {Number} padding + * @prop {Number} numVisible + * @prop {Boolean} fullWidth + * @prop {Boolean} indicators + * @prop {Boolean} noWrap + * @prop {Function} onCycleTo + */ + _this62.options = $.extend({}, Carousel.defaults, options); + + // Setup + _this62.hasMultipleSlides = _this62.$el.find('.carousel-item').length > 1; + _this62.showIndicators = _this62.options.indicators && _this62.hasMultipleSlides; + _this62.noWrap = _this62.options.noWrap || !_this62.hasMultipleSlides; + _this62.pressed = false; + _this62.dragged = false; + _this62.offset = _this62.target = 0; + _this62.images = []; + _this62.itemWidth = _this62.$el.find('.carousel-item').first().innerWidth(); + _this62.itemHeight = _this62.$el.find('.carousel-item').first().innerHeight(); + _this62.dim = _this62.itemWidth * 2 + _this62.options.padding || 1; // Make sure dim is non zero for divisions. + _this62._autoScrollBound = _this62._autoScroll.bind(_this62); + _this62._trackBound = _this62._track.bind(_this62); + + // Full Width carousel setup + if (_this62.options.fullWidth) { + _this62.options.dist = 0; + _this62._setCarouselHeight(); + + // Offset fixed items when indicators. + if (_this62.showIndicators) { + _this62.$el.find('.carousel-fixed-item').addClass('with-indicators'); + } + } + + // Iterate through slides + _this62.$indicators = $('
          '); + _this62.$el.find('.carousel-item').each(function (el, i) { + _this62.images.push(el); + if (_this62.showIndicators) { + var $indicator = $('
        • '); + + // Add active to first by default. + if (i === 0) { + $indicator[0].classList.add('active'); + } + + _this62.$indicators.append($indicator); + } + }); + if (_this62.showIndicators) { + _this62.$el.append(_this62.$indicators); + } + _this62.count = _this62.images.length; + + // Cap numVisible at count + _this62.options.numVisible = Math.min(_this62.count, _this62.options.numVisible); + + // Setup cross browser string + _this62.xform = 'transform'; + ['webkit', 'Moz', 'O', 'ms'].every(function (prefix) { + var e = prefix + 'Transform'; + if (typeof document.body.style[e] !== 'undefined') { + _this62.xform = e; + return false; + } + return true; + }); + + _this62._setupEventHandlers(); + _this62._scroll(_this62.offset); + return _this62; + } + + _createClass(Carousel, [{ + key: "destroy", + + + /** + * Teardown component + */ + value: function destroy() { + this._removeEventHandlers(); + this.el.M_Carousel = undefined; + } + + /** + * Setup Event Handlers + */ + + }, { + key: "_setupEventHandlers", + value: function _setupEventHandlers() { + var _this63 = this; + + this._handleCarouselTapBound = this._handleCarouselTap.bind(this); + this._handleCarouselDragBound = this._handleCarouselDrag.bind(this); + this._handleCarouselReleaseBound = this._handleCarouselRelease.bind(this); + this._handleCarouselClickBound = this._handleCarouselClick.bind(this); + + if (typeof window.ontouchstart !== 'undefined') { + this.el.addEventListener('touchstart', this._handleCarouselTapBound); + this.el.addEventListener('touchmove', this._handleCarouselDragBound); + this.el.addEventListener('touchend', this._handleCarouselReleaseBound); + } + + this.el.addEventListener('mousedown', this._handleCarouselTapBound); + this.el.addEventListener('mousemove', this._handleCarouselDragBound); + this.el.addEventListener('mouseup', this._handleCarouselReleaseBound); + this.el.addEventListener('mouseleave', this._handleCarouselReleaseBound); + this.el.addEventListener('click', this._handleCarouselClickBound); + + if (this.showIndicators && this.$indicators) { + this._handleIndicatorClickBound = this._handleIndicatorClick.bind(this); + this.$indicators.find('.indicator-item').each(function (el, i) { + el.addEventListener('click', _this63._handleIndicatorClickBound); + }); + } + + // Resize + var throttledResize = M.throttle(this._handleResize, 200); + this._handleThrottledResizeBound = throttledResize.bind(this); + + window.addEventListener('resize', this._handleThrottledResizeBound); + } + + /** + * Remove Event Handlers + */ + + }, { + key: "_removeEventHandlers", + value: function _removeEventHandlers() { + var _this64 = this; + + if (typeof window.ontouchstart !== 'undefined') { + this.el.removeEventListener('touchstart', this._handleCarouselTapBound); + this.el.removeEventListener('touchmove', this._handleCarouselDragBound); + this.el.removeEventListener('touchend', this._handleCarouselReleaseBound); + } + this.el.removeEventListener('mousedown', this._handleCarouselTapBound); + this.el.removeEventListener('mousemove', this._handleCarouselDragBound); + this.el.removeEventListener('mouseup', this._handleCarouselReleaseBound); + this.el.removeEventListener('mouseleave', this._handleCarouselReleaseBound); + this.el.removeEventListener('click', this._handleCarouselClickBound); + + if (this.showIndicators && this.$indicators) { + this.$indicators.find('.indicator-item').each(function (el, i) { + el.removeEventListener('click', _this64._handleIndicatorClickBound); + }); + } + + window.removeEventListener('resize', this._handleThrottledResizeBound); + } + + /** + * Handle Carousel Tap + * @param {Event} e + */ + + }, { + key: "_handleCarouselTap", + value: function _handleCarouselTap(e) { + // Fixes firefox draggable image bug + if (e.type === 'mousedown' && $(e.target).is('img')) { + e.preventDefault(); + } + this.pressed = true; + this.dragged = false; + this.verticalDragged = false; + this.reference = this._xpos(e); + this.referenceY = this._ypos(e); + + this.velocity = this.amplitude = 0; + this.frame = this.offset; + this.timestamp = Date.now(); + clearInterval(this.ticker); + this.ticker = setInterval(this._trackBound, 100); + } + + /** + * Handle Carousel Drag + * @param {Event} e + */ + + }, { + key: "_handleCarouselDrag", + value: function _handleCarouselDrag(e) { + var x = void 0, + y = void 0, + delta = void 0, + deltaY = void 0; + if (this.pressed) { + x = this._xpos(e); + y = this._ypos(e); + delta = this.reference - x; + deltaY = Math.abs(this.referenceY - y); + if (deltaY < 30 && !this.verticalDragged) { + // If vertical scrolling don't allow dragging. + if (delta > 2 || delta < -2) { + this.dragged = true; + this.reference = x; + this._scroll(this.offset + delta); + } + } else if (this.dragged) { + // If dragging don't allow vertical scroll. + e.preventDefault(); + e.stopPropagation(); + return false; + } else { + // Vertical scrolling. + this.verticalDragged = true; + } + } + + if (this.dragged) { + // If dragging don't allow vertical scroll. + e.preventDefault(); + e.stopPropagation(); + return false; + } + } + + /** + * Handle Carousel Release + * @param {Event} e + */ + + }, { + key: "_handleCarouselRelease", + value: function _handleCarouselRelease(e) { + if (this.pressed) { + this.pressed = false; + } else { + return; + } + + clearInterval(this.ticker); + this.target = this.offset; + if (this.velocity > 10 || this.velocity < -10) { + this.amplitude = 0.9 * this.velocity; + this.target = this.offset + this.amplitude; + } + this.target = Math.round(this.target / this.dim) * this.dim; + + // No wrap of items. + if (this.noWrap) { + if (this.target >= this.dim * (this.count - 1)) { + this.target = this.dim * (this.count - 1); + } else if (this.target < 0) { + this.target = 0; + } + } + this.amplitude = this.target - this.offset; + this.timestamp = Date.now(); + requestAnimationFrame(this._autoScrollBound); + + if (this.dragged) { + e.preventDefault(); + e.stopPropagation(); + } + return false; + } + + /** + * Handle Carousel CLick + * @param {Event} e + */ + + }, { + key: "_handleCarouselClick", + value: function _handleCarouselClick(e) { + // Disable clicks if carousel was dragged. + if (this.dragged) { + e.preventDefault(); + e.stopPropagation(); + return false; + } else if (!this.options.fullWidth) { + var clickedIndex = $(e.target).closest('.carousel-item').index(); + var diff = this._wrap(this.center) - clickedIndex; + + // Disable clicks if carousel was shifted by click + if (diff !== 0) { + e.preventDefault(); + e.stopPropagation(); + } + this._cycleTo(clickedIndex); + } + } + + /** + * Handle Indicator CLick + * @param {Event} e + */ + + }, { + key: "_handleIndicatorClick", + value: function _handleIndicatorClick(e) { + e.stopPropagation(); + + var indicator = $(e.target).closest('.indicator-item'); + if (indicator.length) { + this._cycleTo(indicator.index()); + } + } + + /** + * Handle Throttle Resize + * @param {Event} e + */ + + }, { + key: "_handleResize", + value: function _handleResize(e) { + if (this.options.fullWidth) { + this.itemWidth = this.$el.find('.carousel-item').first().innerWidth(); + this.imageHeight = this.$el.find('.carousel-item.active').height(); + this.dim = this.itemWidth * 2 + this.options.padding; + this.offset = this.center * 2 * this.itemWidth; + this.target = this.offset; + this._setCarouselHeight(true); + } else { + this._scroll(); + } + } + + /** + * Set carousel height based on first slide + * @param {Booleam} imageOnly - true for image slides + */ + + }, { + key: "_setCarouselHeight", + value: function _setCarouselHeight(imageOnly) { + var _this65 = this; + + var firstSlide = this.$el.find('.carousel-item.active').length ? this.$el.find('.carousel-item.active').first() : this.$el.find('.carousel-item').first(); + var firstImage = firstSlide.find('img').first(); + if (firstImage.length) { + if (firstImage[0].complete) { + // If image won't trigger the load event + var imageHeight = firstImage.height(); + if (imageHeight > 0) { + this.$el.css('height', imageHeight + 'px'); + } else { + // If image still has no height, use the natural dimensions to calculate + var naturalWidth = firstImage[0].naturalWidth; + var naturalHeight = firstImage[0].naturalHeight; + var adjustedHeight = this.$el.width() / naturalWidth * naturalHeight; + this.$el.css('height', adjustedHeight + 'px'); + } + } else { + // Get height when image is loaded normally + firstImage.one('load', function (el, i) { + _this65.$el.css('height', el.offsetHeight + 'px'); + }); + } + } else if (!imageOnly) { + var slideHeight = firstSlide.height(); + this.$el.css('height', slideHeight + 'px'); + } + } + + /** + * Get x position from event + * @param {Event} e + */ + + }, { + key: "_xpos", + value: function _xpos(e) { + // touch event + if (e.targetTouches && e.targetTouches.length >= 1) { + return e.targetTouches[0].clientX; + } + + // mouse event + return e.clientX; + } + + /** + * Get y position from event + * @param {Event} e + */ + + }, { + key: "_ypos", + value: function _ypos(e) { + // touch event + if (e.targetTouches && e.targetTouches.length >= 1) { + return e.targetTouches[0].clientY; + } + + // mouse event + return e.clientY; + } + + /** + * Wrap index + * @param {Number} x + */ + + }, { + key: "_wrap", + value: function _wrap(x) { + return x >= this.count ? x % this.count : x < 0 ? this._wrap(this.count + x % this.count) : x; + } + + /** + * Tracks scrolling information + */ + + }, { + key: "_track", + value: function _track() { + var now = void 0, + elapsed = void 0, + delta = void 0, + v = void 0; + + now = Date.now(); + elapsed = now - this.timestamp; + this.timestamp = now; + delta = this.offset - this.frame; + this.frame = this.offset; + + v = 1000 * delta / (1 + elapsed); + this.velocity = 0.8 * v + 0.2 * this.velocity; + } + + /** + * Auto scrolls to nearest carousel item. + */ + + }, { + key: "_autoScroll", + value: function _autoScroll() { + var elapsed = void 0, + delta = void 0; + + if (this.amplitude) { + elapsed = Date.now() - this.timestamp; + delta = this.amplitude * Math.exp(-elapsed / this.options.duration); + if (delta > 2 || delta < -2) { + this._scroll(this.target - delta); + requestAnimationFrame(this._autoScrollBound); + } else { + this._scroll(this.target); + } + } + } + + /** + * Scroll to target + * @param {Number} x + */ + + }, { + key: "_scroll", + value: function _scroll(x) { + var _this66 = this; + + // Track scrolling state + if (!this.$el.hasClass('scrolling')) { + this.el.classList.add('scrolling'); + } + if (this.scrollingTimeout != null) { + window.clearTimeout(this.scrollingTimeout); + } + this.scrollingTimeout = window.setTimeout(function () { + _this66.$el.removeClass('scrolling'); + }, this.options.duration); + + // Start actual scroll + var i = void 0, + half = void 0, + delta = void 0, + dir = void 0, + tween = void 0, + el = void 0, + alignment = void 0, + zTranslation = void 0, + tweenedOpacity = void 0, + centerTweenedOpacity = void 0; + var lastCenter = this.center; + var numVisibleOffset = 1 / this.options.numVisible; + + this.offset = typeof x === 'number' ? x : this.offset; + this.center = Math.floor((this.offset + this.dim / 2) / this.dim); + delta = this.offset - this.center * this.dim; + dir = delta < 0 ? 1 : -1; + tween = -dir * delta * 2 / this.dim; + half = this.count >> 1; + + if (this.options.fullWidth) { + alignment = 'translateX(0)'; + centerTweenedOpacity = 1; + } else { + alignment = 'translateX(' + (this.el.clientWidth - this.itemWidth) / 2 + 'px) '; + alignment += 'translateY(' + (this.el.clientHeight - this.itemHeight) / 2 + 'px)'; + centerTweenedOpacity = 1 - numVisibleOffset * tween; + } + + // Set indicator active + if (this.showIndicators) { + var diff = this.center % this.count; + var activeIndicator = this.$indicators.find('.indicator-item.active'); + if (activeIndicator.index() !== diff) { + activeIndicator.removeClass('active'); + this.$indicators.find('.indicator-item').eq(diff)[0].classList.add('active'); + } + } + + // center + // Don't show wrapped items. + if (!this.noWrap || this.center >= 0 && this.center < this.count) { + el = this.images[this._wrap(this.center)]; + + // Add active class to center item. + if (!$(el).hasClass('active')) { + this.$el.find('.carousel-item').removeClass('active'); + el.classList.add('active'); + } + var transformString = alignment + " translateX(" + -delta / 2 + "px) translateX(" + dir * this.options.shift * tween * i + "px) translateZ(" + this.options.dist * tween + "px)"; + this._updateItemStyle(el, centerTweenedOpacity, 0, transformString); + } + + for (i = 1; i <= half; ++i) { + // right side + if (this.options.fullWidth) { + zTranslation = this.options.dist; + tweenedOpacity = i === half && delta < 0 ? 1 - tween : 1; + } else { + zTranslation = this.options.dist * (i * 2 + tween * dir); + tweenedOpacity = 1 - numVisibleOffset * (i * 2 + tween * dir); + } + // Don't show wrapped items. + if (!this.noWrap || this.center + i < this.count) { + el = this.images[this._wrap(this.center + i)]; + var _transformString = alignment + " translateX(" + (this.options.shift + (this.dim * i - delta) / 2) + "px) translateZ(" + zTranslation + "px)"; + this._updateItemStyle(el, tweenedOpacity, -i, _transformString); + } + + // left side + if (this.options.fullWidth) { + zTranslation = this.options.dist; + tweenedOpacity = i === half && delta > 0 ? 1 - tween : 1; + } else { + zTranslation = this.options.dist * (i * 2 - tween * dir); + tweenedOpacity = 1 - numVisibleOffset * (i * 2 - tween * dir); + } + // Don't show wrapped items. + if (!this.noWrap || this.center - i >= 0) { + el = this.images[this._wrap(this.center - i)]; + var _transformString2 = alignment + " translateX(" + (-this.options.shift + (-this.dim * i - delta) / 2) + "px) translateZ(" + zTranslation + "px)"; + this._updateItemStyle(el, tweenedOpacity, -i, _transformString2); + } + } + + // center + // Don't show wrapped items. + if (!this.noWrap || this.center >= 0 && this.center < this.count) { + el = this.images[this._wrap(this.center)]; + var _transformString3 = alignment + " translateX(" + -delta / 2 + "px) translateX(" + dir * this.options.shift * tween + "px) translateZ(" + this.options.dist * tween + "px)"; + this._updateItemStyle(el, centerTweenedOpacity, 0, _transformString3); + } + + // onCycleTo callback + var $currItem = this.$el.find('.carousel-item').eq(this._wrap(this.center)); + if (lastCenter !== this.center && typeof this.options.onCycleTo === 'function') { + this.options.onCycleTo.call(this, $currItem[0], this.dragged); + } + + // One time callback + if (typeof this.oneTimeCallback === 'function') { + this.oneTimeCallback.call(this, $currItem[0], this.dragged); + this.oneTimeCallback = null; + } + } + + /** + * Cycle to target + * @param {Element} el + * @param {Number} opacity + * @param {Number} zIndex + * @param {String} transform + */ + + }, { + key: "_updateItemStyle", + value: function _updateItemStyle(el, opacity, zIndex, transform) { + el.style[this.xform] = transform; + el.style.zIndex = zIndex; + el.style.opacity = opacity; + el.style.visibility = 'visible'; + } + + /** + * Cycle to target + * @param {Number} n + * @param {Function} callback + */ + + }, { + key: "_cycleTo", + value: function _cycleTo(n, callback) { + var diff = this.center % this.count - n; + + // Account for wraparound. + if (!this.noWrap) { + if (diff < 0) { + if (Math.abs(diff + this.count) < Math.abs(diff)) { + diff += this.count; + } + } else if (diff > 0) { + if (Math.abs(diff - this.count) < diff) { + diff -= this.count; + } + } + } + + this.target = this.dim * Math.round(this.offset / this.dim); + // Next + if (diff < 0) { + this.target += this.dim * Math.abs(diff); + + // Prev + } else if (diff > 0) { + this.target -= this.dim * diff; + } + + // Set one time callback + if (typeof callback === 'function') { + this.oneTimeCallback = callback; + } + + // Scroll + if (this.offset !== this.target) { + this.amplitude = this.target - this.offset; + this.timestamp = Date.now(); + requestAnimationFrame(this._autoScrollBound); + } + } + + /** + * Cycle to next item + * @param {Number} [n] + */ + + }, { + key: "next", + value: function next(n) { + if (n === undefined || isNaN(n)) { + n = 1; + } + + var index = this.center + n; + if (index >= this.count || index < 0) { + if (this.noWrap) { + return; + } + + index = this._wrap(index); + } + this._cycleTo(index); + } + + /** + * Cycle to previous item + * @param {Number} [n] + */ + + }, { + key: "prev", + value: function prev(n) { + if (n === undefined || isNaN(n)) { + n = 1; + } + + var index = this.center - n; + if (index >= this.count || index < 0) { + if (this.noWrap) { + return; + } + + index = this._wrap(index); + } + + this._cycleTo(index); + } + + /** + * Cycle to nth item + * @param {Number} [n] + * @param {Function} callback + */ + + }, { + key: "set", + value: function set(n, callback) { + if (n === undefined || isNaN(n)) { + n = 0; + } + + if (n > this.count || n < 0) { + if (this.noWrap) { + return; + } + + n = this._wrap(n); + } + + this._cycleTo(n, callback); + } + }], [{ + key: "init", + value: function init(els, options) { + return _get(Carousel.__proto__ || Object.getPrototypeOf(Carousel), "init", this).call(this, this, els, options); + } + + /** + * Get Instance + */ + + }, { + key: "getInstance", + value: function getInstance(el) { + var domElem = !!el.jquery ? el[0] : el; + return domElem.M_Carousel; + } + }, { + key: "defaults", + get: function () { + return _defaults; + } + }]); + + return Carousel; + }(Component); + + M.Carousel = Carousel; + + if (M.jQueryLoaded) { + M.initializeJqueryWrapper(Carousel, 'carousel', 'M_Carousel'); + } +})(cash); +;(function ($) { + 'use strict'; + + var _defaults = { + onOpen: undefined, + onClose: undefined + }; + + /** + * @class + * + */ + + var TapTarget = function (_Component19) { + _inherits(TapTarget, _Component19); + + /** + * Construct TapTarget instance + * @constructor + * @param {Element} el + * @param {Object} options + */ + function TapTarget(el, options) { + _classCallCheck(this, TapTarget); + + var _this67 = _possibleConstructorReturn(this, (TapTarget.__proto__ || Object.getPrototypeOf(TapTarget)).call(this, TapTarget, el, options)); + + _this67.el.M_TapTarget = _this67; + + /** + * Options for the select + * @member TapTarget#options + * @prop {Function} onOpen - Callback function called when feature discovery is opened + * @prop {Function} onClose - Callback function called when feature discovery is closed + */ + _this67.options = $.extend({}, TapTarget.defaults, options); + + _this67.isOpen = false; + + // setup + _this67.$origin = $('#' + _this67.$el.attr('data-target')); + _this67._setup(); + + _this67._calculatePositioning(); + _this67._setupEventHandlers(); + return _this67; + } + + _createClass(TapTarget, [{ + key: "destroy", + + + /** + * Teardown component + */ + value: function destroy() { + this._removeEventHandlers(); + this.el.TapTarget = undefined; + } + + /** + * Setup Event Handlers + */ + + }, { + key: "_setupEventHandlers", + value: function _setupEventHandlers() { + this._handleDocumentClickBound = this._handleDocumentClick.bind(this); + this._handleTargetClickBound = this._handleTargetClick.bind(this); + this._handleOriginClickBound = this._handleOriginClick.bind(this); + + this.el.addEventListener('click', this._handleTargetClickBound); + this.originEl.addEventListener('click', this._handleOriginClickBound); + + // Resize + var throttledResize = M.throttle(this._handleResize, 200); + this._handleThrottledResizeBound = throttledResize.bind(this); + + window.addEventListener('resize', this._handleThrottledResizeBound); + } + + /** + * Remove Event Handlers + */ + + }, { + key: "_removeEventHandlers", + value: function _removeEventHandlers() { + this.el.removeEventListener('click', this._handleTargetClickBound); + this.originEl.removeEventListener('click', this._handleOriginClickBound); + window.removeEventListener('resize', this._handleThrottledResizeBound); + } + + /** + * Handle Target Click + * @param {Event} e + */ + + }, { + key: "_handleTargetClick", + value: function _handleTargetClick(e) { + this.open(); + } + + /** + * Handle Origin Click + * @param {Event} e + */ + + }, { + key: "_handleOriginClick", + value: function _handleOriginClick(e) { + this.close(); + } + + /** + * Handle Resize + * @param {Event} e + */ + + }, { + key: "_handleResize", + value: function _handleResize(e) { + this._calculatePositioning(); + } + + /** + * Handle Resize + * @param {Event} e + */ + + }, { + key: "_handleDocumentClick", + value: function _handleDocumentClick(e) { + if (!$(e.target).closest('.tap-target-wrapper').length) { + this.close(); + e.preventDefault(); + e.stopPropagation(); + } + } + + /** + * Setup Tap Target + */ + + }, { + key: "_setup", + value: function _setup() { + // Creating tap target + this.wrapper = this.$el.parent()[0]; + this.waveEl = $(this.wrapper).find('.tap-target-wave')[0]; + this.originEl = $(this.wrapper).find('.tap-target-origin')[0]; + this.contentEl = this.$el.find('.tap-target-content')[0]; + + // Creating wrapper + if (!$(this.wrapper).hasClass('.tap-target-wrapper')) { + this.wrapper = document.createElement('div'); + this.wrapper.classList.add('tap-target-wrapper'); + this.$el.before($(this.wrapper)); + this.wrapper.append(this.el); + } + + // Creating content + if (!this.contentEl) { + this.contentEl = document.createElement('div'); + this.contentEl.classList.add('tap-target-content'); + this.$el.append(this.contentEl); + } + + // Creating foreground wave + if (!this.waveEl) { + this.waveEl = document.createElement('div'); + this.waveEl.classList.add('tap-target-wave'); + + // Creating origin + if (!this.originEl) { + this.originEl = this.$origin.clone(true, true); + this.originEl.addClass('tap-target-origin'); + this.originEl.removeAttr('id'); + this.originEl.removeAttr('style'); + this.originEl = this.originEl[0]; + this.waveEl.append(this.originEl); + } + + this.wrapper.append(this.waveEl); + } + } + + /** + * Calculate positioning + */ + + }, { + key: "_calculatePositioning", + value: function _calculatePositioning() { + // Element or parent is fixed position? + var isFixed = this.$origin.css('position') === 'fixed'; + if (!isFixed) { + var parents = this.$origin.parents(); + for (var i = 0; i < parents.length; i++) { + isFixed = $(parents[i]).css('position') == 'fixed'; + if (isFixed) { + break; + } + } + } + + // Calculating origin + var originWidth = this.$origin.outerWidth(); + var originHeight = this.$origin.outerHeight(); + var originTop = isFixed ? this.$origin.offset().top - M.getDocumentScrollTop() : this.$origin.offset().top; + var originLeft = isFixed ? this.$origin.offset().left - M.getDocumentScrollLeft() : this.$origin.offset().left; + + // Calculating screen + var windowWidth = window.innerWidth; + var windowHeight = window.innerHeight; + var centerX = windowWidth / 2; + var centerY = windowHeight / 2; + var isLeft = originLeft <= centerX; + var isRight = originLeft > centerX; + var isTop = originTop <= centerY; + var isBottom = originTop > centerY; + var isCenterX = originLeft >= windowWidth * 0.25 && originLeft <= windowWidth * 0.75; + + // Calculating tap target + var tapTargetWidth = this.$el.outerWidth(); + var tapTargetHeight = this.$el.outerHeight(); + var tapTargetTop = originTop + originHeight / 2 - tapTargetHeight / 2; + var tapTargetLeft = originLeft + originWidth / 2 - tapTargetWidth / 2; + var tapTargetPosition = isFixed ? 'fixed' : 'absolute'; + + // Calculating content + var tapTargetTextWidth = isCenterX ? tapTargetWidth : tapTargetWidth / 2 + originWidth; + var tapTargetTextHeight = tapTargetHeight / 2; + var tapTargetTextTop = isTop ? tapTargetHeight / 2 : 0; + var tapTargetTextBottom = 0; + var tapTargetTextLeft = isLeft && !isCenterX ? tapTargetWidth / 2 - originWidth : 0; + var tapTargetTextRight = 0; + var tapTargetTextPadding = originWidth; + var tapTargetTextAlign = isBottom ? 'bottom' : 'top'; + + // Calculating wave + var tapTargetWaveWidth = originWidth > originHeight ? originWidth * 2 : originWidth * 2; + var tapTargetWaveHeight = tapTargetWaveWidth; + var tapTargetWaveTop = tapTargetHeight / 2 - tapTargetWaveHeight / 2; + var tapTargetWaveLeft = tapTargetWidth / 2 - tapTargetWaveWidth / 2; + + // Setting tap target + var tapTargetWrapperCssObj = {}; + tapTargetWrapperCssObj.top = isTop ? tapTargetTop + 'px' : ''; + tapTargetWrapperCssObj.right = isRight ? windowWidth - tapTargetLeft - tapTargetWidth + 'px' : ''; + tapTargetWrapperCssObj.bottom = isBottom ? windowHeight - tapTargetTop - tapTargetHeight + 'px' : ''; + tapTargetWrapperCssObj.left = isLeft ? tapTargetLeft + 'px' : ''; + tapTargetWrapperCssObj.position = tapTargetPosition; + $(this.wrapper).css(tapTargetWrapperCssObj); + + // Setting content + $(this.contentEl).css({ + width: tapTargetTextWidth + 'px', + height: tapTargetTextHeight + 'px', + top: tapTargetTextTop + 'px', + right: tapTargetTextRight + 'px', + bottom: tapTargetTextBottom + 'px', + left: tapTargetTextLeft + 'px', + padding: tapTargetTextPadding + 'px', + verticalAlign: tapTargetTextAlign + }); + + // Setting wave + $(this.waveEl).css({ + top: tapTargetWaveTop + 'px', + left: tapTargetWaveLeft + 'px', + width: tapTargetWaveWidth + 'px', + height: tapTargetWaveHeight + 'px' + }); + } + + /** + * Open TapTarget + */ + + }, { + key: "open", + value: function open() { + if (this.isOpen) { + return; + } + + // onOpen callback + if (typeof this.options.onOpen === 'function') { + this.options.onOpen.call(this, this.$origin[0]); + } + + this.isOpen = true; + this.wrapper.classList.add('open'); + + document.body.addEventListener('click', this._handleDocumentClickBound, true); + document.body.addEventListener('touchend', this._handleDocumentClickBound); + } + + /** + * Close Tap Target + */ + + }, { + key: "close", + value: function close() { + if (!this.isOpen) { + return; + } + + // onClose callback + if (typeof this.options.onClose === 'function') { + this.options.onClose.call(this, this.$origin[0]); + } + + this.isOpen = false; + this.wrapper.classList.remove('open'); + + document.body.removeEventListener('click', this._handleDocumentClickBound, true); + document.body.removeEventListener('touchend', this._handleDocumentClickBound); + } + }], [{ + key: "init", + value: function init(els, options) { + return _get(TapTarget.__proto__ || Object.getPrototypeOf(TapTarget), "init", this).call(this, this, els, options); + } + + /** + * Get Instance + */ + + }, { + key: "getInstance", + value: function getInstance(el) { + var domElem = !!el.jquery ? el[0] : el; + return domElem.M_TapTarget; + } + }, { + key: "defaults", + get: function () { + return _defaults; + } + }]); + + return TapTarget; + }(Component); + + M.TapTarget = TapTarget; + + if (M.jQueryLoaded) { + M.initializeJqueryWrapper(TapTarget, 'tapTarget', 'M_TapTarget'); + } +})(cash); +;(function ($) { + 'use strict'; + + var _defaults = { + classes: '', + dropdownOptions: {} + }; + + /** + * @class + * + */ + + var FormSelect = function (_Component20) { + _inherits(FormSelect, _Component20); + + /** + * Construct FormSelect instance + * @constructor + * @param {Element} el + * @param {Object} options + */ + function FormSelect(el, options) { + _classCallCheck(this, FormSelect); + + // Don't init if browser default version + var _this68 = _possibleConstructorReturn(this, (FormSelect.__proto__ || Object.getPrototypeOf(FormSelect)).call(this, FormSelect, el, options)); + + if (_this68.$el.hasClass('browser-default')) { + return _possibleConstructorReturn(_this68); + } + + _this68.el.M_FormSelect = _this68; + + /** + * Options for the select + * @member FormSelect#options + */ + _this68.options = $.extend({}, FormSelect.defaults, options); + + _this68.isMultiple = _this68.$el.prop('multiple'); + + // Setup + _this68.el.tabIndex = -1; + _this68._keysSelected = {}; + _this68._valueDict = {}; // Maps key to original and generated option element. + _this68._setupDropdown(); + + _this68._setupEventHandlers(); + return _this68; + } + + _createClass(FormSelect, [{ + key: "destroy", + + + /** + * Teardown component + */ + value: function destroy() { + this._removeEventHandlers(); + this._removeDropdown(); + this.el.M_FormSelect = undefined; + } + + /** + * Setup Event Handlers + */ + + }, { + key: "_setupEventHandlers", + value: function _setupEventHandlers() { + var _this69 = this; + + this._handleSelectChangeBound = this._handleSelectChange.bind(this); + this._handleOptionClickBound = this._handleOptionClick.bind(this); + this._handleInputClickBound = this._handleInputClick.bind(this); + + $(this.dropdownOptions).find('li:not(.optgroup)').each(function (el) { + el.addEventListener('click', _this69._handleOptionClickBound); + }); + this.el.addEventListener('change', this._handleSelectChangeBound); + this.input.addEventListener('click', this._handleInputClickBound); + } + + /** + * Remove Event Handlers + */ + + }, { + key: "_removeEventHandlers", + value: function _removeEventHandlers() { + var _this70 = this; + + $(this.dropdownOptions).find('li:not(.optgroup)').each(function (el) { + el.removeEventListener('click', _this70._handleOptionClickBound); + }); + this.el.removeEventListener('change', this._handleSelectChangeBound); + this.input.removeEventListener('click', this._handleInputClickBound); + } + + /** + * Handle Select Change + * @param {Event} e + */ + + }, { + key: "_handleSelectChange", + value: function _handleSelectChange(e) { + this._setValueToInput(); + } + + /** + * Handle Option Click + * @param {Event} e + */ + + }, { + key: "_handleOptionClick", + value: function _handleOptionClick(e) { + e.preventDefault(); + var optionEl = $(e.target).closest('li')[0]; + this._selectOption(optionEl); + e.stopPropagation(); + } + }, { + key: "_selectOption", + value: function _selectOption(optionEl) { + var key = optionEl.id; + if (!$(optionEl).hasClass('disabled') && !$(optionEl).hasClass('optgroup') && key.length) { + var selected = true; + + if (this.isMultiple) { + // Deselect placeholder option if still selected. + var placeholderOption = $(this.dropdownOptions).find('li.disabled.selected'); + if (placeholderOption.length) { + placeholderOption.removeClass('selected'); + placeholderOption.find('input[type="checkbox"]').prop('checked', false); + this._toggleEntryFromArray(placeholderOption[0].id); + } + selected = this._toggleEntryFromArray(key); + } else { + $(this.dropdownOptions).find('li').removeClass('selected'); + $(optionEl).toggleClass('selected', selected); + this._keysSelected = {}; + this._keysSelected[optionEl.id] = true; + } + + // Set selected on original select option + // Only trigger if selected state changed + var prevSelected = $(this._valueDict[key].el).prop('selected'); + if (prevSelected !== selected) { + $(this._valueDict[key].el).prop('selected', selected); + this.$el.trigger('change'); + } + } + + if (!this.isMultiple) { + this.dropdown.close(); + } + } + + /** + * Handle Input Click + */ + + }, { + key: "_handleInputClick", + value: function _handleInputClick() { + if (this.dropdown && this.dropdown.isOpen) { + this._setValueToInput(); + this._setSelectedStates(); + } + } + + /** + * Setup dropdown + */ + + }, { + key: "_setupDropdown", + value: function _setupDropdown() { + var _this71 = this; + + this.wrapper = document.createElement('div'); + $(this.wrapper).addClass('select-wrapper ' + this.options.classes); + this.$el.before($(this.wrapper)); + // Move actual select element into overflow hidden wrapper + var $hideSelect = $('
          '); + $(this.wrapper).append($hideSelect); + $hideSelect[0].appendChild(this.el); + + if (this.el.disabled) { + this.wrapper.classList.add('disabled'); + } + + // Create dropdown + this.$selectOptions = this.$el.children('option, optgroup'); + this.dropdownOptions = document.createElement('ul'); + this.dropdownOptions.id = "select-options-" + M.guid(); + $(this.dropdownOptions).addClass('dropdown-content select-dropdown ' + (this.isMultiple ? 'multiple-select-dropdown' : '')); + + // Create dropdown structure. + if (this.$selectOptions.length) { + this.$selectOptions.each(function (el) { + if ($(el).is('option')) { + // Direct descendant option. + var optionEl = void 0; + if (_this71.isMultiple) { + optionEl = _this71._appendOptionWithIcon(_this71.$el, el, 'multiple'); + } else { + optionEl = _this71._appendOptionWithIcon(_this71.$el, el); + } + + _this71._addOptionToValueDict(el, optionEl); + } else if ($(el).is('optgroup')) { + // Optgroup. + var selectOptions = $(el).children('option'); + $(_this71.dropdownOptions).append($('
        • ' + el.getAttribute('label') + '
        • ')[0]); + + selectOptions.each(function (el) { + var optionEl = _this71._appendOptionWithIcon(_this71.$el, el, 'optgroup-option'); + _this71._addOptionToValueDict(el, optionEl); + }); + } + }); + } + + $(this.wrapper).append(this.dropdownOptions); + + // Add input dropdown + this.input = document.createElement('input'); + $(this.input).addClass('select-dropdown dropdown-trigger'); + this.input.setAttribute('type', 'text'); + this.input.setAttribute('readonly', 'true'); + this.input.setAttribute('data-target', this.dropdownOptions.id); + if (this.el.disabled) { + $(this.input).prop('disabled', 'true'); + } + + $(this.wrapper).prepend(this.input); + this._setValueToInput(); + + // Add caret + var dropdownIcon = $(''); + $(this.wrapper).prepend(dropdownIcon[0]); + + // Initialize dropdown + if (!this.el.disabled) { + var dropdownOptions = $.extend({}, this.options.dropdownOptions); + var userOnOpenEnd = dropdownOptions.onOpenEnd; + + // Add callback for centering selected option when dropdown content is scrollable + dropdownOptions.onOpenEnd = function (el) { + var selectedOption = $(_this71.dropdownOptions).find('.selected').first(); + + if (selectedOption.length) { + // Focus selected option in dropdown + M.keyDown = true; + _this71.dropdown.focusedIndex = selectedOption.index(); + _this71.dropdown._focusFocusedItem(); + M.keyDown = false; + + // Handle scrolling to selected option + if (_this71.dropdown.isScrollable) { + var scrollOffset = selectedOption[0].getBoundingClientRect().top - _this71.dropdownOptions.getBoundingClientRect().top; // scroll to selected option + scrollOffset -= _this71.dropdownOptions.clientHeight / 2; // center in dropdown + _this71.dropdownOptions.scrollTop = scrollOffset; + } + } + + // Handle user declared onOpenEnd if needed + if (userOnOpenEnd && typeof userOnOpenEnd === 'function') { + userOnOpenEnd.call(_this71.dropdown, _this71.el); + } + }; + + // Prevent dropdown from closing too early + dropdownOptions.closeOnClick = false; + + this.dropdown = M.Dropdown.init(this.input, dropdownOptions); + } + + // Add initial selections + this._setSelectedStates(); + } + + /** + * Add option to value dict + * @param {Element} el original option element + * @param {Element} optionEl generated option element + */ + + }, { + key: "_addOptionToValueDict", + value: function _addOptionToValueDict(el, optionEl) { + var index = Object.keys(this._valueDict).length; + var key = this.dropdownOptions.id + index; + var obj = {}; + optionEl.id = key; + + obj.el = el; + obj.optionEl = optionEl; + this._valueDict[key] = obj; + } + + /** + * Remove dropdown + */ + + }, { + key: "_removeDropdown", + value: function _removeDropdown() { + $(this.wrapper).find('.caret').remove(); + $(this.input).remove(); + $(this.dropdownOptions).remove(); + $(this.wrapper).before(this.$el); + $(this.wrapper).remove(); + } + + /** + * Setup dropdown + * @param {Element} select select element + * @param {Element} option option element from select + * @param {String} type + * @return {Element} option element added + */ + + }, { + key: "_appendOptionWithIcon", + value: function _appendOptionWithIcon(select, option, type) { + // Add disabled attr if disabled + var disabledClass = option.disabled ? 'disabled ' : ''; + var optgroupClass = type === 'optgroup-option' ? 'optgroup-option ' : ''; + var multipleCheckbox = this.isMultiple ? "" : option.innerHTML; + var liEl = $('
        • '); + var spanEl = $(''); + spanEl.html(multipleCheckbox); + liEl.addClass(disabledClass + " " + optgroupClass); + liEl.append(spanEl); + + // add icons + var iconUrl = option.getAttribute('data-icon'); + if (!!iconUrl) { + var imgEl = $("\"\""); + liEl.prepend(imgEl); + } + + // Check for multiple type. + $(this.dropdownOptions).append(liEl[0]); + return liEl[0]; + } + + /** + * Toggle entry from option + * @param {String} key Option key + * @return {Boolean} if entry was added or removed + */ + + }, { + key: "_toggleEntryFromArray", + value: function _toggleEntryFromArray(key) { + var notAdded = !this._keysSelected.hasOwnProperty(key); + var $optionLi = $(this._valueDict[key].optionEl); + + if (notAdded) { + this._keysSelected[key] = true; + } else { + delete this._keysSelected[key]; + } + + $optionLi.toggleClass('selected', notAdded); + + // Set checkbox checked value + $optionLi.find('input[type="checkbox"]').prop('checked', notAdded); + + // use notAdded instead of true (to detect if the option is selected or not) + $optionLi.prop('selected', notAdded); + + return notAdded; + } + + /** + * Set text value to input + */ + + }, { + key: "_setValueToInput", + value: function _setValueToInput() { + var values = []; + var options = this.$el.find('option'); + + options.each(function (el) { + if ($(el).prop('selected')) { + var text = $(el).text().trim(); + values.push(text); + } + }); + + if (!values.length) { + var firstDisabled = this.$el.find('option:disabled').eq(0); + if (firstDisabled.length && firstDisabled[0].value === '') { + values.push(firstDisabled.text()); + } + } + + this.input.value = values.join(', '); + } + + /** + * Set selected state of dropdown to match actual select element + */ + + }, { + key: "_setSelectedStates", + value: function _setSelectedStates() { + this._keysSelected = {}; + + for (var key in this._valueDict) { + var option = this._valueDict[key]; + var optionIsSelected = $(option.el).prop('selected'); + $(option.optionEl).find('input[type="checkbox"]').prop('checked', optionIsSelected); + if (optionIsSelected) { + this._activateOption($(this.dropdownOptions), $(option.optionEl)); + this._keysSelected[key] = true; + } else { + $(option.optionEl).removeClass('selected'); + } + } + } + + /** + * Make option as selected and scroll to selected position + * @param {jQuery} collection Select options jQuery element + * @param {Element} newOption element of the new option + */ + + }, { + key: "_activateOption", + value: function _activateOption(collection, newOption) { + if (newOption) { + if (!this.isMultiple) { + collection.find('li.selected').removeClass('selected'); + } + var option = $(newOption); + option.addClass('selected'); + } + } + + /** + * Get Selected Values + * @return {Array} Array of selected values + */ + + }, { + key: "getSelectedValues", + value: function getSelectedValues() { + var selectedValues = []; + for (var key in this._keysSelected) { + selectedValues.push(this._valueDict[key].el.value); + } + return selectedValues; + } + }], [{ + key: "init", + value: function init(els, options) { + return _get(FormSelect.__proto__ || Object.getPrototypeOf(FormSelect), "init", this).call(this, this, els, options); + } + + /** + * Get Instance + */ + + }, { + key: "getInstance", + value: function getInstance(el) { + var domElem = !!el.jquery ? el[0] : el; + return domElem.M_FormSelect; + } + }, { + key: "defaults", + get: function () { + return _defaults; + } + }]); + + return FormSelect; + }(Component); + + M.FormSelect = FormSelect; + + if (M.jQueryLoaded) { + M.initializeJqueryWrapper(FormSelect, 'formSelect', 'M_FormSelect'); + } +})(cash); +;(function ($, anim) { + 'use strict'; + + var _defaults = {}; + + /** + * @class + * + */ + + var Range = function (_Component21) { + _inherits(Range, _Component21); + + /** + * Construct Range instance + * @constructor + * @param {Element} el + * @param {Object} options + */ + function Range(el, options) { + _classCallCheck(this, Range); + + var _this72 = _possibleConstructorReturn(this, (Range.__proto__ || Object.getPrototypeOf(Range)).call(this, Range, el, options)); + + _this72.el.M_Range = _this72; + + /** + * Options for the range + * @member Range#options + */ + _this72.options = $.extend({}, Range.defaults, options); + + _this72._mousedown = false; + + // Setup + _this72._setupThumb(); + + _this72._setupEventHandlers(); + return _this72; + } + + _createClass(Range, [{ + key: "destroy", + + + /** + * Teardown component + */ + value: function destroy() { + this._removeEventHandlers(); + this._removeThumb(); + this.el.M_Range = undefined; + } + + /** + * Setup Event Handlers + */ + + }, { + key: "_setupEventHandlers", + value: function _setupEventHandlers() { + this._handleRangeChangeBound = this._handleRangeChange.bind(this); + this._handleRangeMousedownTouchstartBound = this._handleRangeMousedownTouchstart.bind(this); + this._handleRangeInputMousemoveTouchmoveBound = this._handleRangeInputMousemoveTouchmove.bind(this); + this._handleRangeMouseupTouchendBound = this._handleRangeMouseupTouchend.bind(this); + this._handleRangeBlurMouseoutTouchleaveBound = this._handleRangeBlurMouseoutTouchleave.bind(this); + + this.el.addEventListener('change', this._handleRangeChangeBound); + + this.el.addEventListener('mousedown', this._handleRangeMousedownTouchstartBound); + this.el.addEventListener('touchstart', this._handleRangeMousedownTouchstartBound); + + this.el.addEventListener('input', this._handleRangeInputMousemoveTouchmoveBound); + this.el.addEventListener('mousemove', this._handleRangeInputMousemoveTouchmoveBound); + this.el.addEventListener('touchmove', this._handleRangeInputMousemoveTouchmoveBound); + + this.el.addEventListener('mouseup', this._handleRangeMouseupTouchendBound); + this.el.addEventListener('touchend', this._handleRangeMouseupTouchendBound); + + this.el.addEventListener('blur', this._handleRangeBlurMouseoutTouchleaveBound); + this.el.addEventListener('mouseout', this._handleRangeBlurMouseoutTouchleaveBound); + this.el.addEventListener('touchleave', this._handleRangeBlurMouseoutTouchleaveBound); + } + + /** + * Remove Event Handlers + */ + + }, { + key: "_removeEventHandlers", + value: function _removeEventHandlers() { + this.el.removeEventListener('change', this._handleRangeChangeBound); + + this.el.removeEventListener('mousedown', this._handleRangeMousedownTouchstartBound); + this.el.removeEventListener('touchstart', this._handleRangeMousedownTouchstartBound); + + this.el.removeEventListener('input', this._handleRangeInputMousemoveTouchmoveBound); + this.el.removeEventListener('mousemove', this._handleRangeInputMousemoveTouchmoveBound); + this.el.removeEventListener('touchmove', this._handleRangeInputMousemoveTouchmoveBound); + + this.el.removeEventListener('mouseup', this._handleRangeMouseupTouchendBound); + this.el.removeEventListener('touchend', this._handleRangeMouseupTouchendBound); + + this.el.removeEventListener('blur', this._handleRangeBlurMouseoutTouchleaveBound); + this.el.removeEventListener('mouseout', this._handleRangeBlurMouseoutTouchleaveBound); + this.el.removeEventListener('touchleave', this._handleRangeBlurMouseoutTouchleaveBound); + } + + /** + * Handle Range Change + * @param {Event} e + */ + + }, { + key: "_handleRangeChange", + value: function _handleRangeChange() { + $(this.value).html(this.$el.val()); + + if (!$(this.thumb).hasClass('active')) { + this._showRangeBubble(); + } + + var offsetLeft = this._calcRangeOffset(); + $(this.thumb).addClass('active').css('left', offsetLeft + 'px'); + } + + /** + * Handle Range Mousedown and Touchstart + * @param {Event} e + */ + + }, { + key: "_handleRangeMousedownTouchstart", + value: function _handleRangeMousedownTouchstart(e) { + // Set indicator value + $(this.value).html(this.$el.val()); + + this._mousedown = true; + this.$el.addClass('active'); + + if (!$(this.thumb).hasClass('active')) { + this._showRangeBubble(); + } + + if (e.type !== 'input') { + var offsetLeft = this._calcRangeOffset(); + $(this.thumb).addClass('active').css('left', offsetLeft + 'px'); + } + } + + /** + * Handle Range Input, Mousemove and Touchmove + */ + + }, { + key: "_handleRangeInputMousemoveTouchmove", + value: function _handleRangeInputMousemoveTouchmove() { + if (this._mousedown) { + if (!$(this.thumb).hasClass('active')) { + this._showRangeBubble(); + } + + var offsetLeft = this._calcRangeOffset(); + $(this.thumb).addClass('active').css('left', offsetLeft + 'px'); + $(this.value).html(this.$el.val()); + } + } + + /** + * Handle Range Mouseup and Touchend + */ + + }, { + key: "_handleRangeMouseupTouchend", + value: function _handleRangeMouseupTouchend() { + this._mousedown = false; + this.$el.removeClass('active'); + } + + /** + * Handle Range Blur, Mouseout and Touchleave + */ + + }, { + key: "_handleRangeBlurMouseoutTouchleave", + value: function _handleRangeBlurMouseoutTouchleave() { + if (!this._mousedown) { + var paddingLeft = parseInt(this.$el.css('padding-left')); + var marginLeft = 7 + paddingLeft + 'px'; + + if ($(this.thumb).hasClass('active')) { + anim.remove(this.thumb); + anim({ + targets: this.thumb, + height: 0, + width: 0, + top: 10, + easing: 'easeOutQuad', + marginLeft: marginLeft, + duration: 100 + }); + } + $(this.thumb).removeClass('active'); + } + } + + /** + * Setup dropdown + */ + + }, { + key: "_setupThumb", + value: function _setupThumb() { + this.thumb = document.createElement('span'); + this.value = document.createElement('span'); + $(this.thumb).addClass('thumb'); + $(this.value).addClass('value'); + $(this.thumb).append(this.value); + this.$el.after(this.thumb); + } + + /** + * Remove dropdown + */ + + }, { + key: "_removeThumb", + value: function _removeThumb() { + $(this.thumb).remove(); + } + + /** + * morph thumb into bubble + */ + + }, { + key: "_showRangeBubble", + value: function _showRangeBubble() { + var paddingLeft = parseInt($(this.thumb).parent().css('padding-left')); + var marginLeft = -7 + paddingLeft + 'px'; // TODO: fix magic number? + anim.remove(this.thumb); + anim({ + targets: this.thumb, + height: 30, + width: 30, + top: -30, + marginLeft: marginLeft, + duration: 300, + easing: 'easeOutQuint' + }); + } + + /** + * Calculate the offset of the thumb + * @return {Number} offset in pixels + */ + + }, { + key: "_calcRangeOffset", + value: function _calcRangeOffset() { + var width = this.$el.width() - 15; + var max = parseFloat(this.$el.attr('max')) || 100; // Range default max + var min = parseFloat(this.$el.attr('min')) || 0; // Range default min + var percent = (parseFloat(this.$el.val()) - min) / (max - min); + return percent * width; + } + }], [{ + key: "init", + value: function init(els, options) { + return _get(Range.__proto__ || Object.getPrototypeOf(Range), "init", this).call(this, this, els, options); + } + + /** + * Get Instance + */ + + }, { + key: "getInstance", + value: function getInstance(el) { + var domElem = !!el.jquery ? el[0] : el; + return domElem.M_Range; + } + }, { + key: "defaults", + get: function () { + return _defaults; + } + }]); + + return Range; + }(Component); + + M.Range = Range; + + if (M.jQueryLoaded) { + M.initializeJqueryWrapper(Range, 'range', 'M_Range'); + } + + Range.init($('input[type=range]')); +})(cash, M.anime); + +//# sourceMappingURL=materialize_concat.js.map +//# sourceMappingURL=materialize.js.map diff --git a/src/src.ejs b/src/src.ejs index 07518e52..f2a17a4a 100644 --- a/src/src.ejs +++ b/src/src.ejs @@ -1,214 +1,214 @@ - - - - - - - - Cloverleaf - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
          - - - - -
          -
          - -
          - - -
          - -
          -
          - -
          - - -
          - -
          - -
          - -
          - - -
          - - <%= hint %> - - - -
          - -
          - - - - - -
          -
          - - - - - - - - - - - - - - + + + + + + + + Cloverleaf + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
          +
          + +
          + + +
          + +
          +
          + +
          + + +
          + +
          + +
          + +
          + + +
          + + <%= hint %> + + + +
          + +
          + + + + + +
          +
          + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/style.scss b/src/style.scss index ca9da3ca..f2303c7c 100644 --- a/src/style.scss +++ b/src/style.scss @@ -1,915 +1,915 @@ -@charset "UTF-8"; - -// Import only what you need from Materialize - -@import "node_modules/@materializecss/materialize/sass/components/normalize"; - -// Color -@import "node_modules/@materializecss/materialize/sass/components/color-variables"; - -$accent-color: #3f51b5; -$light-accent: lighten($accent-color, 15%); -$text-color: #535353; -$background-color: #fff; -$internal-color: #fff; -$incorrect-color: #f44336; -$correct-color: #8fff66; -$input-color: #000; -$link-color: #00539b; -$highlight-color: #eee; - -$secondary-color: $accent-color; - -$select-background: $internal-color; -$switch-checked-lever-bg: $light-accent; -$sidenav-bg-color: $background-color; -$button-raised-background: $accent-color; -$tabs-underline-color: $accent-color; -$tabs-text-color: $input-color; -$tabs-bg-color: $internal-color; -$input-border-color: $text-color; -$link-color: $link-color; - -// Variables; -@import "node_modules/@materializecss/materialize/sass/components/variables"; - -$toast-action-color: $link-color; -$toast-action-color: var(--link-color); -$toast-color: $internal-color; -$toast-color: var(--internal-color); -$toast-text-color: $text-color; -$toast-text-color: var(--text-color); - -// Components -@import "node_modules/@materializecss/materialize/sass/components/global"; -@import "node_modules/@materializecss/materialize/sass/components/grid"; -@import "node_modules/@materializecss/materialize/sass/components/typography"; -@import "node_modules/@materializecss/materialize/sass/components/toast"; -@import "node_modules/@materializecss/materialize/sass/components/tabs"; -@import "node_modules/@materializecss/materialize/sass/components/tooltip"; -@import "node_modules/@materializecss/materialize/sass/components/buttons"; -@import "node_modules/@materializecss/materialize/sass/components/dropdown"; -@import "node_modules/@materializecss/materialize/sass/components/waves"; -@import "node_modules/@materializecss/materialize/sass/components/sidenav"; -// Form parts -@import "node_modules/@materializecss/materialize/sass/components/forms/switches.scss"; -@import "node_modules/@materializecss/materialize/sass/components/forms/select.scss"; -@import "node_modules/@materializecss/materialize/sass/components/forms/input-fields.scss"; - - - -/* Material Icons */ -@font-face { - font-family: 'Material Icons'; - font-style: normal; - font-weight: 400; - /* For IE6-8 */ - src: url(material-design-icons-iconfont/dist/fonts/MaterialIcons-Regular.eot); - src: local('Material Icons'), - local('MaterialIcons-Regular'), - url(material-design-icons-iconfont/dist/fonts/MaterialIcons-Regular.woff2) format('woff2'), - url(material-design-icons-iconfont/dist/fonts/MaterialIcons-Regular.woff) format('woff'), - url(material-design-icons-iconfont/dist/fonts/MaterialIcons-Regular.ttf) format('truetype'); - font-display: swap; -} - -.material-icons { - font-family: 'Material Icons'; - font-weight: normal; - font-style: normal; - /* Preferred icon size */ - font-size: 24px; - display: inline-block; - line-height: 1; - text-transform: none; - letter-spacing: normal; - word-wrap: normal; - white-space: nowrap; - direction: ltr; - /* Support for all WebKit browsers. */ - -webkit-font-smoothing: antialiased; - /* Support for Safari and Chrome. */ - text-rendering: optimizeLegibility; - -moz-osx-font-smoothing: grayscale; - /* Support for IE. */ - font-feature-settings: 'liga'; - user-select: none; - font-display: block; -} - -@font-face { - font-family: 'Roboto Mono'; - font-style: normal; - font-weight: 400; - src: local('Roboto Mono'), local('RobotoMono-Regular'), url(../fonts/RobotoMono-Regular.ttf) format('truetype'); - font-display: swap; -} - -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 300; - src: local('Roboto Light'), local('Roboto-Light'), url(../fonts/Roboto-Light.ttf) format('truetype'); - font-display: swap; -} - -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 400; - src: local('Roboto'), local('Roboto-Regular'), url(../fonts/Roboto-Regular.ttf) format('truetype'); - font-display: swap; -} - -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 500; - src: local('Roboto Medium'), local('Roboto-Medium'), url(../fonts/Roboto-Medium.ttf) format('truetype'); - font-display: swap; -} - -:root { - --accent-color: #{$accent-color}; - --light-accent: #{$light-accent}; - --text-color: #{$text-color}; - --background-color: #{$background-color}; - --internal-color: #{$internal-color}; - --incorrect-color: #{$incorrect-color}; - --correct-color: #{$correct-color}; - --input-color: #{$input-color}; - --link-color: #{$link-color}; - --highlight-color: #{$highlight-color}; -} - -html, -body { - height: 100% !important; - color: $input-color; - color: var(--input-color); - caret-color: $accent-color; - caret-color: var(--accent-color); - text-align: center; - overflow-x: hidden; -} - -* { - transition: background-color .3s ease, color .3s ease; -} - -body { - font-family: 'Roboto', sans-serif; - font-weight: 300; - margin: 0; - display: flex; - justify-content: center; - align-items: center; - background-color: $background-color; - background-color: var(--background-color); -} - -#box { - text-align: center; - max-width: calc(100% - (30px + 10em)); - max-height: 100%; - margin: auto; /* This helps with compatibility */ - grid-row: 1; -} - -label, -.input-field>label { - color: $text-color; - color: var(--text-color); - font-size: 1.5rem; - transition: transform .3s ease-out, -webkit-transform .3s ease-out, background-color .3s ease, color .3s ease; -} - -.input-field { - margin-bottom: 0; -} - -.input-field input[type=text], -.input-field input[type=number], -.input-field input[type=password] { - border-bottom: 1px solid $text-color; - border-bottom: 1px solid var(--text-color); - transition: border .3s ease-out, background-color .3s ease, color .3s ease; -} - -/* label underline focus color */ -.input-field input[type=text]:focus, -.input-field input[type=number]:focus, -.input-field input[type=password]:focus { - border-bottom: 1px solid $accent-color !important; - border-bottom: 1px solid var(--accent-color) !important; - box-shadow: 0 1px 0 0 $accent-color !important; - box-shadow: 0 1px 0 0 var(--accent-color) !important; -} - -input[type=text]:not(#result):not(.select-dropdown), -input[type=number]:not(#length-pref), -input[type=password]:not(#result) { - font-size: 3rem !important; - height: 1.2em !important; - box-sizing: content-box; - font-family: 'Roboto', sans-serif; - font-weight: 300; -} - -input[type=number] { - margin-bottom: 0; - overflow: scroll -} - -#back { - box-shadow: 0 0.26em 0.65em 0 rgba(0, 0, 0, 0.2); - background-color: $internal-color; - background-color: var(--internal-color); - border-radius: 0.325em; - padding: 0.975em; - padding-top: 1.5em; - margin: 2em 0; - max-height: 100%; -} - -#result { - font-family: 'Roboto Mono', monospace; - font-size: 2rem; - padding: 0.9rem 0; - min-height: 1em; - min-width: 20%; - border: none; - text-align: center; - margin: 0; - width: 100%; - color: $input-color; - color: var(--input-color); -} - -// Colour fix -#result::placeholder { - color: $input-color !important; - color: var(--input-color) !important; - opacity: 1; -} - -#copy { - display: block; - margin: auto; -} - -.hint { - float: left; - color: $text-color; - color: var(--text-color); - width: 100%; - text-align: left; -} - -input, -textarea { - font-size: 1.56rem; - padding: 0.65rem; - color: $input-color !important; - color: var(--input-color) !important; - margin: 0 0 0.8rem 0 !important; -} - -input#length { - margin: 0 !important; - height: 1em; /* To stop the input wiggling on firefox */ -} - -#faq { - float: right; - cursor: help; - font-weight: 500; - margin-top: 0.4em; -} - -.cf:before, -.cf:after { - content: " "; - display: table; -} - -.cf:after { - clear: both; -} - -ul.autocomplete-content.dropdown-content { - background: $background-color; - background: var(--background-color); - position: absolute !important; - width: calc(100% - 3rem); - max-height: calc(82% * 4); /* 82% seems to work out as one row */ - overflow-y: auto; - overflow-x: hidden; - top: -.1em; - margin-top: 0; -} - -ul.autocomplete-content.dropdown-content li { - height: 3em; - min-height: 0; -} - -/* Presets */ -.dropdown-content li:hover, -.dropdown-content li.active, -.dropdown-content li.selected, -/* Theme selection */ -body.keyboard-focused .select-dropdown.dropdown-content li:focus, -.select-dropdown.dropdown-content li.selected { - background: $highlight-color; - background: var(--highlight-color); -} - -ul.autocomplete-content.dropdown-content li img.right.circle { - overflow: hidden; - background: #fff; - width: calc(20% - 0.66em); - height: 100%; - padding: 0.33em; - margin: 0; -} - -ul.autocomplete-content.dropdown-content span { - /* display: inline-flex; */ - align-items: center; - white-space: nowrap; - max-width: 70%; - height: 100%; - /* vertical-align: middle; */ - font-size: 1em; - padding: 0.875em 1em; - overflow: hidden; - /* To allow scaling */ - line-height: 1.57em; -} - -ul.autocomplete-content.dropdown-content span:not(.highlight) { - color: $text-color; - color: var(--text-color); - overflow-x: hidden; -} - -ul.autocomplete-content.dropdown-content span .highlight { - max-width: 100%; - color: $text-color; - color: var(--text-color); - font-weight: 400; - overflow: visible; - padding: 0; -} - -.dropdown-content::-webkit-scrollbar { - width: 17px !important; - background-color: #fff !important; -} - -.dropdown-content::-webkit-scrollbar-track { - width: 17px; - background-color: #fff !important; -} - -.dropdown-content::-webkit-scrollbar-thumb { - border-radius: 100px; - width: 17px; - background-color: rgba(0, 0, 0, 0.5); -} - -/*If I keep the rounded element, the twitter bird's beak gets cut :-;*/ -.circle { - object-fit: scale-down; - border-radius: 0; -} - -#back .switch { - padding-bottom: 1.3rem; -} - -input[type=checkbox]:checked:not(:disabled)~.lever:active::before, -input[type=checkbox]:checked:not(:disabled).tabbed:focus~.lever::before { - transform: scale(2.4); - background-color: rgba($accent-color, 0.3); - background-color: rgba(var(--accent-RGBs), 0.3); -} - -/*Switch knob*/ -.switch label input[type=checkbox]:checked+.lever:after { - background-color: $accent-color; - background-color: var(--accent-color); -} - -/*Switch backing*/ -.switch label input[type=checkbox]:checked+.lever { - background-color: $light-accent; - background-color: var(--light-accent); -} - -#passTogglelever { - left: -4px; /* Centering the toggle */ -} - -.icon { - font-size: 1.4em !important; - color: $text-color; - color: var(--text-color); - transition: color .2s; - cursor: pointer; -} - -.icon:hover { - color: $light-accent; - color: var(--light-accent); -} - -.icon:active { - color: $accent-color; - color: var(--accent-color); -} - -.input-field label:not(.label-icon).active { - -webkit-transform: translateY(-1em) scale(0.8); - transform: translateY(-1em) scale(0.8); - -webkit-transform-origin: 0 0; - transform-origin: 0 0; -} - -.toast { - font-weight: 400 -} - -/* Negative toasts get this */ -.toast.warning { - color: $input-color; - color: var(--input-color); - background-color: $incorrect-color; - background-color: var(--incorrect-color); -} - -/* Positive toasts get this */ -.toast.success { - background-color: $correct-color; - background-color: var(--correct-color); - color: #000; -} - -#jsBanner { - position: absolute; - width: 100%; - height: 100%; - text-align: center; - background-color: rgba(0, 0, 0, 0.5); - display: flex; - align-items: center; - justify-content: center; - font-weight: 500; - font-size: 10vmin; - top: 0; - left: 0; - color: $background-color; - color: var(--background-color); - -webkit-text-stroke-width: 0.05em !important; - -webkit-text-stroke-color: $text-color !important; - -webkit-text-stroke-color: var(--text-color) !important; - padding: 10px; -} - -#jsBanner a { - color: $background-color; - color: var(--background-color); - -webkit-text-stroke: 3px $text-color; - -webkit-text-stroke: 3px var(--text-color); - text-decoration: underline; -} - -#logo { - max-width: 100%; - max-height: 100%; -} - -#app { - margin-bottom: 0.55em !important; - width: calc(100% - 3.6rem) !important; - padding-right: 1.2em !important; - align-self: flex-end; - display: block; - white-space: nowrap; -} - -ul:empty { - display: none; -} - -/* Disable Edge's show/hide since we made one */ -::-ms-reveal { - display: none; -} - -/* For portrait logos so they don't oversize */ -#logo-container { - margin-right: 5px; - background: #fff; - padding: 3px; - border-radius: 5px; - height: calc(3rem + 0.1em); - display: none; - justify-content: center; - align-items: center; - top: 0; -} - -input[type="radio"] { - margin: 0; - width: 0; - height: 0; - padding: 0; -} - -input[type="radio"]:checked+label::before { - box-shadow: 0 0 3px 1px $text-color; - box-shadow: 0 0 3px 1px var(--text-color); -} - -label:focus { - outline: none; -} - -.github-corner { - fill: $accent-color; - fill: var(--accent-color); - color: $background-color; - color: var(--background-color); - position: absolute; - top: 0; - border: 0; - right: 0; -} - -.github-corner:hover .octo-arm { - animation: octocat-wave 560ms ease-in-out; -} - -@keyframes octocat-wave { - - 0%, - 100% { - transform: rotate(0); - } - - 20%, - 60% { - transform: rotate(-25deg); - } - - 40%, - 80% { - transform: rotate(10deg); - } -} -.tabs { - background-color: $internal-color; - background-color: var(--internal-color); - cursor: pointer; - overflow-x: hidden; - z-index: 995; -} - -.tabs .tab a, -.tabs .tab a:hover { - color: $text-color; - color: var(--text-color); - font-size: 1em; - padding: 0 .5em; -} - -.tabs .tab a:focus, -.tabs .tab a:focus.active { - background-color: $background-color; - background-color: var(--background-color); -} - -.tabs .tab a.active { - color: $input-color; - color: var(--input-color); - font-weight: 400; -} - -.tabs .indicator { - background: $accent-color; - background-color: var(--accent-color) -} - -.btn { - height: 2.4em; - line-height: 2.4em; - font-family: 'Roboto', sans-serif; - font-weight: 300; - font-size: 1rem; - padding: 0 2rem; - background: $accent-color; - background: var(--accent-color); -} - -.btn:focus, -.btn:hover { - background: $accent-color; - background: var(--accent-color); -} - -.switch label .lever { - height: 0.933em; - width: 2.4em; -} - -.switch label .lever::before, -.switch label .lever::after { - height: 1.33em; - width: 1.33em; -} - -.switch label input[type="checkbox"]:checked+.lever::before, -.switch label input[type="checkbox"]:checked+.lever::after { - left: 1.4em; -} - -.switch label .lever::before, -.switch label .lever::after { - top: -0.2em; -} - -.material-tooltip { - max-width: 7em; -} - -/* If the device can't hover, don't show tooltips */ -@media (hover: none) { - .material-tooltip { - display: none; - } -} - -.material-tooltip { - background-color: $internal-color; - background-color: var(--internal-color); - box-shadow: 0 0.26em 0.65em 0 rgba(0, 0, 0, 0.2); - color: $text-color; - color: var(--text-color); -} - -/* In the future focus-visable should be used. See https://caniuse.com/?#search=css-focus-visible */ -.btn:focus, -.btn-large:focus, -.btn-small:focus, -.btn-floating:focus, -.btn-large:focus, -.btn-small:focus, -.btn-flat:focus { - outline: rgb(77, 144, 254) auto 5px; - outline-color: rgb(77, 144, 254); - outline-style: auto; - outline-width: 5px; -} - -/* Always show arrows on the number inputs */ -input[type=number]::-webkit-inner-spin-button, -input[type=number]::-webkit-outer-spin-button { - opacity: 1; -} - -ul.tabs li.tab a i.material-icons { - vertical-align: middle; - color: $incorrect-color; - color: var(--incorrect-color); -} - -/* Normal size */ -.btn-floating { - width: 2.86rem; - height: 2.86rem; -} - -.btn-floating i { - font-size: 1.6rem; - line-height: 2.86rem; - display: block; - top: 0; -} - -/* Large size */ -.btn-floating.btn-large { - width: 4rem; - height: 4rem; -} - -.btn-floating.btn-large i { - font-size: 2rem; - line-height: 4rem; -} - -/* If we're on a small/mobile device */ -@media only all and (max-width:40em) { - - body { - background-color: var(--internal-color); - } - - #back { - /* Ditch loads of padding */ - margin: 0; - box-shadow: none; - - min-height: 100%; - border-radius: 0; - } - - #box { - width: 100VW; - max-width: 100VW; - min-height: 100%; - } - - /* Install icon */ - #install-icon { - padding-right: .5vw; - } - - /* Normal size */ - .btn-floating { - width: 10vw; - height: 10vw; - } - - .btn-floating i { - font-size: 5vw; - line-height: 10vw; - } - - /* Large size */ - .btn-floating.btn-large { - width: 15vw; - height: 15vw; - } - - .btn-floating.btn-large i { - font-size: 7.5vw; - line-height: 15vw; - } - - .github-corner { - color: $internal-color; - color: var(--internal-color); - } -} - -/* If it won't fit vertically */ -@media only all and (max-height:600px ) and (min-width:40em) { - html { - /* Drop the font size */ - font-size: 2vh; - } -} - -.sidenav { - background-color: $background-color; - background-color: var(--background-color); - width: 350px; - max-width: 100%; - overflow-y: hidden; - padding-bottom: 0; -} - -.sidenav li>a { - font-weight: 300; -} - -/* Shows warning icons properly */ -.sidenav li>a>i, -.sidenav li>a>[class^="mdi-"], -.sidenav li>a li>a>[class*="mdi-"], -.sidenav li>a>i.material-icons { - margin: 0; - float: none; -} - -#settings { - position: absolute; - left: 1vw; - bottom: 1vw; - display: block; -} - -#settings a i.material-icons { - display: block; - font-size: 2.5em; - color: $text-color; - color: var(--text-color); -} - -.sidenav label:not([for=length-pref]) { - font-size: 1rem; - top: -33px; -} - -#options { - padding: 10px; - // padding-top: 0; - display: grid; - height: calc(100% - 8px); - grid-template-rows: repeat(12, 1fr); - // grid-template-rows: repeat(auto-fill, minmax(70px, 1fr)) - // grid-auto-rows: repeat(min-content, 60px) ; -} - -.sidenav .dropdown-content { - background: $background-color; - background: var(--background-color); -} - -.sidenav .dropdown-content li>a, -.dropdown-content li>span { - color: $input-color; - color: var(--input-color); -} - -select { - background-color: $internal-color; - background-color: var(--internal-color); - - border: 1px solid $text-color; - border: 1px solid var(--text-color); - border-radius: 3px; - - color: $input-color; - color: var(--input-color); -} - -select:focus { - border: 1px solid $light-accent; - border: 1px solid var(--light-accent); - outline: none; -} - -#options div.input-field { - margin-top: 2.5rem; -} - -#options a { - margin-top: 1rem; -} - -.btn i { - vertical-align: top; -} - -.drag-target { - left: 0; -} - -.sidenav .switch label { - font-size: 1.2em; -} - -.sidenav { - place-content: center; -} - -#theme-container { - grid-row: 1; -} - -#session-container { - grid-row: 3; - padding-bottom: 0; -} - -#footer { - grid-row: last-line; -} - -#install-container { - display: grid; - grid-template-columns: 1fr calc(2.4em + 10px); - align-content: stretch; -} - -#close { - cursor: pointer; - align-self: end; - justify-self: flex-end; - font-size: 2.4em; - color: $input-color; - color: var(--input-color); -} - -a { - color: $link-color; - color: var(--link-color); -} - -#length-pref { - font-size: 2em; - font-weight: 300; -} +@charset "UTF-8"; + +// Import only what you need from Materialize + +@import "node_modules/@materializecss/materialize/sass/components/normalize"; + +// Color +@import "node_modules/@materializecss/materialize/sass/components/color-variables"; + +$accentColor: #3f51b5; +$lightAccent: lighten($accentColor, 15%); +$textColor: #535353; +$backgroundColor: #fff; +$internalColor: #fff; +$incorrectColor: #f44336; +$correctColor: #8fff66; +$inputColor: #000; +$linkColor: #00539b; +$highlightColor: #eee; + +$secondary-color: $accentColor; + +$select-background: $internalColor; +$switch-checked-lever-bg: $lightAccent; +$sidenav-bg-color: $backgroundColor; +$button-raised-background: $accentColor; +$tabs-underline-color: $accentColor; +$tabs-text-color: $inputColor; +$tabs-bg-color: $internalColor; +$input-border-color: $textColor; +$link-color: $linkColor; + +// Variables; +@import "node_modules/@materializecss/materialize/sass/components/variables"; + +$toast-action-color: $link-color; +$toast-action-color: var(--linkColor); +$toast-color: $internalColor; +$toast-color: var(--internalColor); +$toast-text-color: $textColor; +$toast-text-color: var(--textColor); + +// Components +@import "node_modules/@materializecss/materialize/sass/components/global"; +@import "node_modules/@materializecss/materialize/sass/components/grid"; +@import "node_modules/@materializecss/materialize/sass/components/typography"; +@import "node_modules/@materializecss/materialize/sass/components/toast"; +@import "node_modules/@materializecss/materialize/sass/components/tabs"; +@import "node_modules/@materializecss/materialize/sass/components/tooltip"; +@import "node_modules/@materializecss/materialize/sass/components/buttons"; +@import "node_modules/@materializecss/materialize/sass/components/dropdown"; +@import "node_modules/@materializecss/materialize/sass/components/waves"; +@import "node_modules/@materializecss/materialize/sass/components/sidenav"; +// Form parts +@import "node_modules/@materializecss/materialize/sass/components/forms/switches.scss"; +@import "node_modules/@materializecss/materialize/sass/components/forms/select.scss"; +@import "node_modules/@materializecss/materialize/sass/components/forms/input-fields.scss"; + + + +/* Material Icons */ +@font-face { + font-family: 'Material Icons'; + font-style: normal; + font-weight: 400; + /* For IE6-8 */ + src: url(material-design-icons-iconfont/dist/fonts/MaterialIcons-Regular.eot); + src: local('Material Icons'), + local('MaterialIcons-Regular'), + url(material-design-icons-iconfont/dist/fonts/MaterialIcons-Regular.woff2) format('woff2'), + url(material-design-icons-iconfont/dist/fonts/MaterialIcons-Regular.woff) format('woff'), + url(material-design-icons-iconfont/dist/fonts/MaterialIcons-Regular.ttf) format('truetype'); + font-display: swap; +} + +.material-icons { + font-family: 'Material Icons'; + font-weight: normal; + font-style: normal; + /* Preferred icon size */ + font-size: 24px; + display: inline-block; + line-height: 1; + text-transform: none; + letter-spacing: normal; + word-wrap: normal; + white-space: nowrap; + direction: ltr; + /* Support for all WebKit browsers. */ + -webkit-font-smoothing: antialiased; + /* Support for Safari and Chrome. */ + text-rendering: optimizeLegibility; + -moz-osx-font-smoothing: grayscale; + /* Support for IE. */ + font-feature-settings: 'liga'; + user-select: none; + font-display: block; +} + +@font-face { + font-family: 'Roboto Mono'; + font-style: normal; + font-weight: 400; + src: local('Roboto Mono'), local('RobotoMono-Regular'), url(../fonts/RobotoMono-Regular.ttf) format('truetype'); + font-display: swap; +} + +@font-face { + font-family: 'Roboto'; + font-style: normal; + font-weight: 300; + src: local('Roboto Light'), local('Roboto-Light'), url(../fonts/Roboto-Light.ttf) format('truetype'); + font-display: swap; +} + +@font-face { + font-family: 'Roboto'; + font-style: normal; + font-weight: 400; + src: local('Roboto'), local('Roboto-Regular'), url(../fonts/Roboto-Regular.ttf) format('truetype'); + font-display: swap; +} + +@font-face { + font-family: 'Roboto'; + font-style: normal; + font-weight: 500; + src: local('Roboto Medium'), local('Roboto-Medium'), url(../fonts/Roboto-Medium.ttf) format('truetype'); + font-display: swap; +} + +:root { + --accentColor: #{$accentColor}; + --lightAccent: #{$lightAccent}; + --textColor: #{$textColor}; + --backgroundColor: #{$backgroundColor}; + --internalColor: #{$internalColor}; + --incorrectColor: #{$incorrectColor}; + --correctColor: #{$correctColor}; + --inputColor: #{$inputColor}; + --linkColor: #{$linkColor}; + --highlightColor: #{$highlightColor}; +} + +html, +body { + height: 100% !important; + color: $inputColor; + color: var(--inputColor); + caret-color: $accentColor; + caret-color: var(--accentColor); + text-align: center; + overflow-x: hidden; +} + +* { + transition: background-color .3s ease, color .3s ease; +} + +body { + font-family: 'Roboto', sans-serif; + font-weight: 300; + margin: 0; + display: flex; + justify-content: center; + align-items: center; + background-color: $backgroundColor; + background-color: var(--backgroundColor); +} + +#box { + text-align: center; + max-width: calc(100% - (30px + 10em)); + max-height: 100%; + margin: auto; /* This helps with compatibility */ + grid-row: 1; +} + +label, +.input-field>label { + color: $textColor; + color: var(--textColor); + font-size: 1.5rem; + transition: transform .3s ease-out, -webkit-transform .3s ease-out, background-color .3s ease, color .3s ease; +} + +.input-field { + margin-bottom: 0; +} + +.input-field input[type=text], +.input-field input[type=number], +.input-field input[type=password] { + border-bottom: 1px solid $textColor; + border-bottom: 1px solid var(--textColor); + transition: border .3s ease-out, background-color .3s ease, color .3s ease; +} + +/* label underline focus color */ +.input-field input[type=text]:focus, +.input-field input[type=number]:focus, +.input-field input[type=password]:focus { + border-bottom: 1px solid $accentColor !important; + border-bottom: 1px solid var(--accentColor) !important; + box-shadow: 0 1px 0 0 $accentColor !important; + box-shadow: 0 1px 0 0 var(--accentColor) !important; +} + +input[type=text]:not(#result):not(.select-dropdown), +input[type=number]:not(#length-pref), +input[type=password]:not(#result) { + font-size: 3rem !important; + height: 1.2em !important; + box-sizing: content-box; + font-family: 'Roboto', sans-serif; + font-weight: 300; +} + +input[type=number] { + margin-bottom: 0; + overflow: scroll +} + +#back { + box-shadow: 0 0.26em 0.65em 0 rgba(0, 0, 0, 0.2); + background-color: $internalColor; + background-color: var(--internalColor); + border-radius: 0.325em; + padding: 0.975em; + padding-top: 1.5em; + margin: 2em 0; + max-height: 100%; +} + +#result { + font-family: 'Roboto Mono', monospace; + font-size: 2rem; + padding: 0.9rem 0; + min-height: 1em; + min-width: 20%; + border: none; + text-align: center; + margin: 0; + width: 100%; + color: $inputColor; + color: var(--inputColor); +} + +// Colour fix +#result::placeholder { + color: $inputColor !important; + color: var(--inputColor) !important; + opacity: 1; +} + +#copy { + display: block; + margin: auto; +} + +.hint { + float: left; + color: $textColor; + color: var(--textColor); + width: 100%; + text-align: left; +} + +input, +textarea { + font-size: 1.56rem; + padding: 0.65rem; + color: $inputColor !important; + color: var(--inputColor) !important; + margin: 0 0 0.8rem 0 !important; +} + +input#length { + margin: 0 !important; + height: 1em; /* To stop the input wiggling on firefox */ +} + +#faq { + float: right; + cursor: help; + font-weight: 500; + margin-top: 0.4em; +} + +.cf:before, +.cf:after { + content: " "; + display: table; +} + +.cf:after { + clear: both; +} + +ul.autocomplete-content.dropdown-content { + background: $backgroundColor; + background: var(--backgroundColor); + position: absolute !important; + width: calc(100% - 3rem); + max-height: calc(82% * 4); /* 82% seems to work out as one row */ + overflow-y: auto; + overflow-x: hidden; + top: -.1em; + margin-top: 0; +} + +ul.autocomplete-content.dropdown-content li { + height: 3em; + min-height: 0; +} + +/* Presets */ +.dropdown-content li:hover, +.dropdown-content li.active, +.dropdown-content li.selected, +/* Theme selection */ +body.keyboard-focused .select-dropdown.dropdown-content li:focus, +.select-dropdown.dropdown-content li.selected { + background: $highlightColor; + background: var(--highlightColor); +} + +ul.autocomplete-content.dropdown-content li img.right.circle { + overflow: hidden; + background: #fff; + width: calc(20% - 0.66em); + height: 100%; + padding: 0.33em; + margin: 0; +} + +ul.autocomplete-content.dropdown-content span { + /* display: inline-flex; */ + align-items: center; + white-space: nowrap; + max-width: 70%; + height: 100%; + /* vertical-align: middle; */ + font-size: 1em; + padding: 0.875em 1em; + overflow: hidden; + /* To allow scaling */ + line-height: 1.57em; +} + +ul.autocomplete-content.dropdown-content span:not(.highlight) { + color: $textColor; + color: var(--textColor); + overflow-x: hidden; +} + +ul.autocomplete-content.dropdown-content span .highlight { + max-width: 100%; + color: $textColor; + color: var(--textColor); + font-weight: 400; + overflow: visible; + padding: 0; +} + +.dropdown-content::-webkit-scrollbar { + width: 17px !important; + background-color: #fff !important; +} + +.dropdown-content::-webkit-scrollbar-track { + width: 17px; + background-color: #fff !important; +} + +.dropdown-content::-webkit-scrollbar-thumb { + border-radius: 100px; + width: 17px; + background-color: rgba(0, 0, 0, 0.5); +} + +/*If I keep the rounded element, the twitter bird's beak gets cut :-;*/ +.circle { + object-fit: scale-down; + border-radius: 0; +} + +#back .switch { + padding-bottom: 1.3rem; +} + +input[type=checkbox]:checked:not(:disabled)~.lever:active::before, +input[type=checkbox]:checked:not(:disabled).tabbed:focus~.lever::before { + transform: scale(2.4); + background-color: rgba($accentColor, 0.3); + background-color: rgba(var(--accentRGBs), 0.3); +} + +/*Switch knob*/ +.switch label input[type=checkbox]:checked+.lever:after { + background-color: $accentColor; + background-color: var(--accentColor); +} + +/*Switch backing*/ +.switch label input[type=checkbox]:checked+.lever { + background-color: $lightAccent; + background-color: var(--lightAccent); +} + +#passTogglelever { + left: -4px; /* Centering the toggle */ +} + +.icon { + font-size: 1.4em !important; + color: $textColor; + color: var(--textColor); + transition: color .2s; + cursor: pointer; +} + +.icon:hover { + color: $lightAccent; + color: var(--lightAccent); +} + +.icon:active { + color: $accentColor; + color: var(--accentColor); +} + +.input-field label:not(.label-icon).active { + -webkit-transform: translateY(-1em) scale(0.8); + transform: translateY(-1em) scale(0.8); + -webkit-transform-origin: 0 0; + transform-origin: 0 0; +} + +.toast { + font-weight: 400 +} + +/* Negative toasts get this */ +.toast.warning { + color: $inputColor; + color: var(--inputColor); + background-color: $incorrectColor; + background-color: var(--incorrectColor); +} + +/* Positive toasts get this */ +.toast.success { + background-color: $correctColor; + background-color: var(--correctColor); + color: #000; +} + +#jsBanner { + position: absolute; + width: 100%; + height: 100%; + text-align: center; + background-color: rgba(0, 0, 0, 0.5); + display: flex; + align-items: center; + justify-content: center; + font-weight: 500; + font-size: 10vmin; + top: 0; + left: 0; + color: $backgroundColor; + color: var(--backgroundColor); + -webkit-text-stroke-width: 0.05em !important; + -webkit-text-stroke-color: $textColor !important; + -webkit-text-stroke-color: var(--textColor) !important; + padding: 10px; +} + +#jsBanner a { + color: $backgroundColor; + color: var(--backgroundColor); + -webkit-text-stroke: 3px $textColor; + -webkit-text-stroke: 3px var(--textColor); + text-decoration: underline; +} + +#logo { + max-width: 100%; + max-height: 100%; +} + +#app { + margin-bottom: 0.55em !important; + width: calc(100% - 3.6rem) !important; + padding-right: 1.2em !important; + align-self: flex-end; + display: block; + white-space: nowrap; +} + +ul:empty { + display: none; +} + +/* Disable Edge's show/hide since we made one */ +::-ms-reveal { + display: none; +} + +/* For portrait logos so they don't oversize */ +#logoContainer { + margin-right: 5px; + background: #fff; + padding: 3px; + border-radius: 5px; + height: calc(3rem + 0.1em); + display: none; + justify-content: center; + align-items: center; + top: 0; +} + +input[type="radio"] { + margin: 0; + width: 0; + height: 0; + padding: 0; +} + +input[type="radio"]:checked+label::before { + box-shadow: 0 0 3px 1px $textColor; + box-shadow: 0 0 3px 1px var(--textColor); +} + +label:focus { + outline: none; +} + +.github-corner { + fill: $accentColor; + fill: var(--accentColor); + color: $backgroundColor; + color: var(--backgroundColor); + position: absolute; + top: 0; + border: 0; + right: 0; +} + +.github-corner:hover .octo-arm { + animation: octocat-wave 560ms ease-in-out; +} + +@keyframes octocat-wave { + + 0%, + 100% { + transform: rotate(0); + } + + 20%, + 60% { + transform: rotate(-25deg); + } + + 40%, + 80% { + transform: rotate(10deg); + } +} +.tabs { + background-color: $internalColor; + background-color: var(--internalColor); + cursor: pointer; + overflow-x: hidden; + z-index: 995; +} + +.tabs .tab a, +.tabs .tab a:hover { + color: $textColor; + color: var(--textColor); + font-size: 1em; + padding: 0 .5em; +} + +.tabs .tab a:focus, +.tabs .tab a:focus.active { + background-color: $backgroundColor; + background-color: var(--backgroundColor); +} + +.tabs .tab a.active { + color: $inputColor; + color: var(--inputColor); + font-weight: 400; +} + +.tabs .indicator { + background: $accentColor; + background-color: var(--accentColor) +} + +.btn { + height: 2.4em; + line-height: 2.4em; + font-family: 'Roboto', sans-serif; + font-weight: 300; + font-size: 1rem; + padding: 0 2rem; + background: $accentColor; + background: var(--accentColor); +} + +.btn:focus, +.btn:hover { + background: $accentColor; + background: var(--accentColor); +} + +.switch label .lever { + height: 0.933em; + width: 2.4em; +} + +.switch label .lever::before, +.switch label .lever::after { + height: 1.33em; + width: 1.33em; +} + +.switch label input[type="checkbox"]:checked+.lever::before, +.switch label input[type="checkbox"]:checked+.lever::after { + left: 1.4em; +} + +.switch label .lever::before, +.switch label .lever::after { + top: -0.2em; +} + +.material-tooltip { + max-width: 7em; +} + +/* If the device can't hover, don't show tooltips */ +@media (hover: none) { + .material-tooltip { + display: none; + } +} + +.material-tooltip { + background-color: $internalColor; + background-color: var(--internalColor); + box-shadow: 0 0.26em 0.65em 0 rgba(0, 0, 0, 0.2); + color: $textColor; + color: var(--textColor); +} + +/* In the future focus-visable should be used. See https://caniuse.com/?#search=css-focus-visible */ +.btn:focus, +.btn-large:focus, +.btn-small:focus, +.btn-floating:focus, +.btn-large:focus, +.btn-small:focus, +.btn-flat:focus { + outline: rgb(77, 144, 254) auto 5px; + outline-color: rgb(77, 144, 254); + outline-style: auto; + outline-width: 5px; +} + +/* Always show arrows on the number inputs */ +input[type=number]::-webkit-inner-spin-button, +input[type=number]::-webkit-outer-spin-button { + opacity: 1; +} + +ul.tabs li.tab a i.material-icons { + vertical-align: middle; + color: $incorrectColor; + color: var(--incorrectColor); +} + +/* Normal size */ +.btn-floating { + width: 2.86rem; + height: 2.86rem; +} + +.btn-floating i { + font-size: 1.6rem; + line-height: 2.86rem; + display: block; + top: 0; +} + +/* Large size */ +.btn-floating.btn-large { + width: 4rem; + height: 4rem; +} + +.btn-floating.btn-large i { + font-size: 2rem; + line-height: 4rem; +} + +/* If we're on a small/mobile device */ +@media only all and (max-width:40em) { + + body { + background-color: var(--internalColor); + } + + #back { + /* Ditch loads of padding */ + margin: 0; + box-shadow: none; + + min-height: 100%; + border-radius: 0; + } + + #box { + width: 100VW; + max-width: 100VW; + min-height: 100%; + } + + /* Install icon */ + #install-icon { + padding-right: .5vw; + } + + /* Normal size */ + .btn-floating { + width: 10vw; + height: 10vw; + } + + .btn-floating i { + font-size: 5vw; + line-height: 10vw; + } + + /* Large size */ + .btn-floating.btn-large { + width: 15vw; + height: 15vw; + } + + .btn-floating.btn-large i { + font-size: 7.5vw; + line-height: 15vw; + } + + .github-corner { + color: $internalColor; + color: var(--internalColor); + } +} + +/* If it won't fit vertically */ +@media only all and (max-height:600px ) and (min-width:40em) { + html { + /* Drop the font size */ + font-size: 2vh; + } +} + +.sidenav { + background-color: $backgroundColor; + background-color: var(--backgroundColor); + width: 350px; + max-width: 100%; + overflow-y: hidden; + padding-bottom: 0; +} + +.sidenav li>a { + font-weight: 300; +} + +/* Shows warning icons properly */ +.sidenav li>a>i, +.sidenav li>a>[class^="mdi-"], +.sidenav li>a li>a>[class*="mdi-"], +.sidenav li>a>i.material-icons { + margin: 0; + float: none; +} + +#settings { + position: absolute; + left: 1vw; + bottom: 1vw; + display: block; +} + +#settings a i.material-icons { + display: block; + font-size: 2.5em; + color: $textColor; + color: var(--textColor); +} + +.sidenav label:not([for=length-pref]) { + font-size: 1rem; + top: -33px; +} + +#options { + padding: 10px; + // padding-top: 0; + display: grid; + height: calc(100% - 8px); + grid-template-rows: repeat(12, 1fr); + // grid-template-rows: repeat(auto-fill, minmax(70px, 1fr)) + // grid-auto-rows: repeat(min-content, 60px) ; +} + +.sidenav .dropdown-content { + background: $backgroundColor; + background: var(--backgroundColor); +} + +.sidenav .dropdown-content li>a, +.dropdown-content li>span { + color: $inputColor; + color: var(--inputColor); +} + +select { + background-color: $internalColor; + background-color: var(--internalColor); + + border: 1px solid $textColor; + border: 1px solid var(--textColor); + border-radius: 3px; + + color: $inputColor; + color: var(--inputColor); +} + +select:focus { + border: 1px solid $lightAccent; + border: 1px solid var(--lightAccent); + outline: none; +} + +#options div.input-field { + margin-top: 2.5rem; +} + +#options a { + margin-top: 1rem; +} + +.btn i { + vertical-align: top; +} + +.drag-target { + left: 0; +} + +.sidenav .switch label { + font-size: 1.2em; +} + +.sidenav { + place-content: center; +} + +#theme-container { + grid-row: 1; +} + +#session-container { + grid-row: 3; + padding-bottom: 0; +} + +#footer { + grid-row: last-line; +} + +#install-container { + display: grid; + grid-template-columns: 1fr calc(2.4em + 10px); + align-content: stretch; +} + +#close { + cursor: pointer; + align-self: end; + justify-self: flex-end; + font-size: 2.4em; + color: $inputColor; + color: var(--inputColor); +} + +a { + color: $linkColor; + color: var(--linkColor); +} + +#length-pref { + font-size: 2em; + font-weight: 300; +} \ No newline at end of file