From a40b0e2e4cf76727260db83854c6fca80474e6f4 Mon Sep 17 00:00:00 2001 From: Diego Rojas Date: Sat, 25 Mar 2017 11:25:05 -0300 Subject: [PATCH] =?UTF-8?q?finalizada=20adi=C3=A7=C3=A3o=20da=20se=C3=A7?= =?UTF-8?q?=C3=A3o=20galeria=20e=20atualizados=20alguns=20arquivos=20e=20f?= =?UTF-8?q?uncionalidades=20do=20projeto=20original?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/css/admin.css | 134 +- assets/css/customizer.css | 27 +- assets/css/font-awesome.css | 4 +- assets/fonts/lg.eot | Bin 0 -> 2904 bytes assets/fonts/lg.svg | 42 + assets/fonts/lg.ttf | Bin 0 -> 2760 bytes assets/fonts/lg.woff | Bin 0 -> 2836 bytes assets/images/loading.gif | Bin 0 -> 4178 bytes assets/js/customizer.js | 1679 ++++++++-------- assets/js/lightgallery.js | 2341 +++++++++++++---------- assets/js/plugins.js | 736 +++---- assets/js/theme.js | 772 ++++++-- assets/sass/_contents.scss | 8 +- assets/sass/_document.scss | 5 + assets/sass/_elements.scss | 45 + assets/sass/_external_plugins.scss | 112 ++ assets/sass/_sections.scss | 407 +++- assets/sass/_structure.scss | 1058 +++++----- assets/sass/style.scss | 2 +- functions.php | 41 + inc/customizer-controls.php | 133 +- languages/en_US.pot | 60 +- languages/pt_BR.mo | Bin 21446 -> 21586 bytes languages/pt_BR.po | 58 +- section-parts/section-videolightbox.php | 50 +- style.css | 135 +- 26 files changed, 4536 insertions(+), 3313 deletions(-) create mode 100755 assets/fonts/lg.eot create mode 100755 assets/fonts/lg.svg create mode 100755 assets/fonts/lg.ttf create mode 100755 assets/fonts/lg.woff create mode 100644 assets/images/loading.gif diff --git a/assets/css/admin.css b/assets/css/admin.css index ec7bede..0783a41 100755 --- a/assets/css/admin.css +++ b/assets/css/admin.css @@ -132,117 +132,51 @@ color: #d54e21; } -/* =Gallery styles. --------------------------------------------------------------- */ - -.odin-gallery-images .image, -.odin-gallery-images .add, -.odin-gallery-images .wc-metabox-sortable-placeholder { - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; - background: none repeat scroll 0 0 #F7F7F7; - border: 1px solid #D5D5D5; - -webkit-border-radius: 2px; - -moz-border-radius: 2px; - border-radius: 2px; - cursor: move; - float: left; - height: 150px; - margin: 9px 9px 0 0; - overflow: hidden; - position: relative; - width: 150px; -} - -.odin-gallery-images img { - height: 150px; - width: 150px; -} - -.odin-gallery-images .wc-metabox-sortable-placeholder { - border: 4px dashed #ddd; -} - -.odin-form-table .description { - display: block; +.theme_info_boxed { + background: #FFFFFF; + text-align: center; + padding: 20px 30px 20px 30px; + box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.1); } - - -/* =Image upload --------------------------------------------------------------- */ - -.odin-upload-image { +.demo-import-boxed { + background: #fff none repeat scroll 0 0; + box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.1); + font-size: 14px; + line-height: 2.1em; + margin-bottom: 25px; + max-width: 1050px; + overflow: auto; + padding: 0 12px; position: relative; - width: 150px; + border-left: 4px solid #0085ba; } -.odin-upload-image .preview { - display: block; - float: none; - margin-bottom: 5px; +/* Recommend plugins */ +.recommend-plugins > h3 { + margin-bottom: 20px; } - -.odin-upload-image .default-image { - display: none; -} - -/* =Image and Plupload common --------------------------------------------------------------- */ - -.odin-gallery-images .image .actions, -.odin-upload-image .actions { - display: none; - padding: 2px; - position: absolute; - margin: 0; - right: 0; - top: 0; -} - -.odin-gallery-images .image:hover > .actions, -.odin-upload-image:hover > .actions { +.rcp::after { + clear: both; + content: ""; display: block; } - -.odin-gallery-images .image .actions li, -.odin-upload-image .actions li { - background: #eee; - border: 1px solid #ddd; - -webkit-border-radius: 2px; - -moz-border-radius: 2px; - border-radius: 2px; - float: right; - margin: 0 0 0 2px; - padding: 1px; - text-align: center; +.rcp { + border-top: 1px solid rgba(0, 0, 0, 0.1); + margin-left: -25px; + margin-right: -25px; + padding: 20px 25px 10px; } - -.odin-gallery-images .image .actions li:hover, -.odin-upload-image .actions li:hover { - background: #ddd; +.rcp h4 { + margin: 0px; } - -.odin-gallery-images .image .actions li a, -.odin-upload-image .actions li a { +.rcp a { text-decoration: none; } - -.odin-gallery-images .image .actions li a:hover, -.odin-upload-image .actions li a:hover { - text-decoration: none; +.rcp .action-btn { + display: inline-block; } - -.odin-gallery-images .image .actions .delete, -.odin-upload-image .actions .delete { - color: #d00; +.rcp .plugin-detail { + margin-left: 10px; + margin-right: 10px; } -/* =Separator --------------------------------------------------------------- */ - -.odin-metabox-separator { - border-bottom: 1px solid #fff; - border-top: 1px solid #dfdfdf; - display: block; -} diff --git a/assets/css/customizer.css b/assets/css/customizer.css index 0b1b95f..ee9adc8 100755 --- a/assets/css/customizer.css +++ b/assets/css/customizer.css @@ -1,3 +1,12 @@ +li[id*="accordion-panel-onepress"] > .accordion-section-title{ + padding-left: 30px; +} +li#accordion-panel-onepress_options > .accordion-section-title, +li#accordion-panel-onepress_typo > .accordion-section-title +{ + padding-left: 14px; +} + .theme-action-count { padding: 0 6px; display: inline-block; @@ -84,13 +93,16 @@ .repeatable-customize-control.show-display-field-only .widget-content .item{ display: none; } + +/* .section-videolightbox .item-bg_video, .section-videolightbox .item-bg_video, .section-videolightbox .item-bg_video_webm, .section-videolightbox .item-enable_parallax, -.section-videolightbox .item-bg_video_ogv{ +.section-videolightbox .item-bg_video_ogv { display: none; } +*/ .repeatable-customize-control.show-display-field-only .widget-content .item.item-show_section{ display: block; @@ -115,9 +127,10 @@ body .wp-full-overlay{ z-index: 9999; } -.wp-js-editor-active textarea{ +.wp-js-editor-active textarea, .onepress-editor-added textarea{ display: none; } + .wp-js-editor-preview { background-color: #fff; border: 1px solid #ddd; @@ -229,7 +242,7 @@ body .wp-full-overlay{ max-width: 257px; } -.customize-control-alpha-color .wp-picker-open .wp-picker-input-wrap { +.customize-control-alpha-color .wp-picker-open + .wp-picker-input-wrap { width: 100%; } @@ -345,6 +358,7 @@ body .wp-full-overlay{ } } + /* Customizer ICON Picker */ .icon-wrapper { border: 1px solid #cccccc; @@ -473,5 +487,8 @@ body .wp-full-overlay{ -webkit-transform: translateY(0); /* Safari */ transform: translateY(0); - } -} \ No newline at end of file + } + +} + + diff --git a/assets/css/font-awesome.css b/assets/css/font-awesome.css index b61faf1..ee906a8 100755 --- a/assets/css/font-awesome.css +++ b/assets/css/font-awesome.css @@ -1832,7 +1832,7 @@ content: "\f23e"; } .fa-battery-4:before, -.fa-battery:before,, +.fa-battery:before, .fa-battery-full:before { content: "\f240"; } @@ -2334,4 +2334,4 @@ margin: 0; overflow: visible; clip: auto; -} \ No newline at end of file +} diff --git a/assets/fonts/lg.eot b/assets/fonts/lg.eot new file mode 100755 index 0000000000000000000000000000000000000000..1eb39169ca7a41fa2d0b5e6b699b164cba839abb GIT binary patch literal 2904 zcmai0O>A355T1Q6v76*MiJf0U+SqX&QwQQSu45<#LWNo)CBn4N7OD{7xW;zn*p}@` z%>l{17g31xkMYLrK8hbczz-Rv^cy0A!G& zKnhf(H03BuPC86eG!0F24p?^HMP-s{`i;~6nH~oX0Qmv!z4&r0|K<1dr(rY-`EoK= z%wz0@d=2BiWM=jK>y6^)kiR2pe>;_ko$WYK{f)@l5B+QkfOT2^8S(<;gQ?}x`B}1D zfXsg8GP!uH4?H7xX?-EJZ^SNRPd4f8xvYur5 z7jcQ&p<9!F0`ieDioYlzI@qp-1k&D1b3{81`9|Xg&BjFY>Gpy+ieQeas+nus9`TE7_ZlUg^6c)7>>mHA(!hM%$1WI?i3tCS8zy(guF1B&h-g@dILD36-le9P*=+8g{X*XnyA#H)B*bl?D=$#5tE-x-X$@jV1B)So0Aw^>0~~sggr2Y3=H9g)E@5cHOU3 z!Aun%G__h)rHERsX>cQ|fEg?Exsq}3zbc%!0h+z{9tJ3&$?#-MtI~ z#^o?1QPda3_gwgSP+0FpxH?x=7E+}*L8VeSd|Z(P8$~ypCTs|!apib8Tr%uZ3)t3{ zocM0?8Pytk=ze%aF2c9DnR!AUlRoW&OSBq}>Zk}iz_1gsh zgE)%@VUGTPf{kL5*V)S+>NPY5#?v52%@)D9iN+(hirEzv#-qf@St6@=(Zpqvgx}=b zz=us9CwkY91$fZJJ84AVhSy_t(Q{-mc^h{33zP50y>u0_XyYsu`q<BW%*6$j7HNT0&JYRa z@`-FQw^E2FrgDWO(uzY)6#a|ys_u@{GLp)HOCWR+VL50V(iHdt0vic1!ukZ7A5rE> zjV21kbS~>WJT?9QuScU?Mt>@iT*<@=dmo;L>O?MEawZemL?Kp6oOLd(I_KlL#au2s pMJJF$7Ugmx501|Zk3mk*Szt@Fihf=%;vy{Bb_yqiUtf=*{{ZoLH + + + + + +{ + "fontFamily": "lg", + "majorVersion": 1, + "minorVersion": 0, + "fontURL": "https://github.com/sachinchoolur/lightGallery", + "copyright": "sachin", + "license": "MLT", + "licenseURL": "http://opensource.org/licenses/MIT", + "version": "Version 1.0", + "fontId": "lg", + "psName": "lg", + "subFamily": "Regular", + "fullName": "lg", + "description": "Font generated by IcoMoon." +} + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/fonts/lg.ttf b/assets/fonts/lg.ttf new file mode 100755 index 0000000000000000000000000000000000000000..d33b8e5e8612e0059a83354aa4b80782acf7af14 GIT binary patch literal 2760 zcmai0O>7%Q6n?Xt*iEudV&|8TCU#uM)PXpS>ljL*p+YT@5@Fi)9x4Pl?qa8Myq4`q z%>l{17lA~9MjR?QpvqaHs$7uZ&?7=zP@PB|fRJ1eNIjs!p~yDh%&t?nQrmH6=Kan4 zzIi)48)8J%MP-s{=Jm7T*&YuK!15jXJE_%V{_}4a&JwXv=vUIoVjgoZ^c$EDq_gYq z-fR>Rs`gC+LgN4`o(M7w5=v2|CX+pEXj+j=KlG zg3j|ztR^q!X@usXSD|}z$yNQ{*VmSy-zAc6=8a+rJkdI@b3e)Q&+J2Lhi^mr5ta|E znf*l(*1_Xi8UyVI+dR>pN50j#Me{N`oV*sz<`n`*<9!r9YnDaSD7Dc=*hf$enL1(f z?u_gl+==YucRt?v`}fAKYtPfDH5wwzecu(~Q}*1##~OR%e~$k#etZ1W@zVJ4m@-DA zHRNmMAriCLWh|v2}OE?VOFxMUMt2{S!{d zK>yHS-|W!fK)=)Bp9oGykH+Tu5F>@O@?{|Mj{tIaw#6R>2@h_%L&BQH7lM~FyE~Gf{?)QFcPuN!#>{ygx56>5BIPNe4IO@ZMr0f zq%FLu#GFIUpfeZ?#)e{Y=+2$v%|B_QDZzv_2})qUc(1TVJjotw%VNj-PnPjV%jO~$ z$6aZ|qFhVwa>gE4ecRJ_UFZRcK1qYtEOt24dQ|c5mN#HWOdL7YXaVU75n;6d>w zZ}Kb;v|h_&+4wT(n%xtax6%2`d&TbD#(SA}v9c3)*ciPbd^=vJ!wM9 zO8A-z)LwcSXP&nvJE7RaAnV@e=Aid&nTc47vqVnzqHUK+VqsfugB-VIoap^L4%nl% zy^}^5Zg_#!MbDALmR)$d*KD~P_tJIftc|l&=p$QZD2Zgt5_Pkawk%T{J7UXikk8n1 zI}Ng@Y}o;O%$7UpD9hV&7oDSsExW+x3tR4{SLugrnzEG6luG&Hv2ZxOQp&6?Pp6F4 za50(6tmIM|!^o}`!r2wXoK9x5dSRV1RKhP$MLI@d{L-`nJwt1>Ow*JigH~ZJQWA0o zzMPm1*t3W!z?X$JE%Ka3R2DxS_H_%hb>-5cN=vjzDrX3SMqbYqjkQ8bpEe3<&`Lqq zi{YgOb)S|+$^bzf&_%#<&=j<3$OQmf1h|F!b@VV$7D(0fLUF~&d5=ub;3LgB6~WX% zn3s-V`HWRAYdoW;*Rsh1ok3t47+GwkV7X2ixso@n=k!9dq@VXLuX`6##*$&=rs-IluxJgur1R%#syKtB}8)QX`B%L-`8W>|FhvLHvj+t literal 0 HcmV?d00001 diff --git a/assets/fonts/lg.woff b/assets/fonts/lg.woff new file mode 100755 index 0000000000000000000000000000000000000000..bd370be88d40b733dbacc2e04819ed6b02e3c292 GIT binary patch literal 2836 zcmai0O>7%Q6n?Yo*iEudV&|8TCU)G!)PcCI>jX-HP@$AaiE7%l4;6wsuCY@&-pF=D zb3k(MMIce25eEbZgq&4Xl_MN_tPmGeClUuBBo_oy52$b`*yek)n~+wt9p}xw`QF?2 zy?HY`o3~F*Pm>_D)-G!0vE`OEXZ`+m>P+|uk=O_H980^Gx>JkEC16?1udsaf^~{+} zvdGv!n6ocSM<%!O7Lnp0YI>dJMx*#iHk~|Arh}FM@ZU4|7ZUX)2#wOaq$&_YIbNUwt~aWE4wS z=iOaD6`HF4Al|1Y_^c}5Vg8;qir*r+JAUiD_!!JDgo{c$W_GHX>;Tps{&pJTvoP{l<|c(6LVH$F{1J>FiSkXZ zlS*-PYgls^Jw-2I#eQC%hu7!l1$wZ;h|7a@NBqvc;E12=VHr4250^-k#aeV^baW(I zk4HyGMnr=j{$Gw`{t$D?o$F0Gv#^F~_SpK4d@kZ@OxQz7m zA&^)*==WcMdp+T0cdw|x#<>gHpi62ctlD|ld z9Vfq+p2YbJ;QU1+-6}*tCL`Se9{n~Jv2mqhnr2-$b<=DRD<)J7aS)It(gGZIGzC53 zp4i#DCa`+INdgSfKquk`qRbTN-Y+2~QPs<3y;?6<%jK%FUM<)4a#a^k12%y_G**Oj z56J8TQICwPRPdyZ2&P`G>PlR%)=Y#ERltmu`CO?~rkB+Vs9`HA!QY7hXBOopM;^Ql z{5W>e;O=D*u`Y*Rg%Y6z{w~CxMT^N^#Hv$OZ8lqa4Xsp)#ZG97V5h{!jte`&X;?cE zi@2o*PfmO{g{*4zK5#!gBo`6d*vLI5kFk*X*c|vCh5Y>Y!pfWN$N!{O2Um-3 zhi*;p9p!Dp-%8xJvf&x|J;6qCQ`b1keXYZ?SQtNsdBT=B#tjIMEEQWAV=1%9CtGlb z4bmHQmHrYP;#J&5S4CCaQ-+nCat$8L+CeYk%yZkxPEPEuN3`wc=A?IRT}WRmXN6qi zc^g+r5n)?*K#$ovPV{aZC-A6^w@|;p4KKM`=^1j`x*NOusjau+-v1JF;ovMa`oPu& zN}|}hLT%!Nt*hh^hi%;f{j{w&QIB}S)}6p7ZM}t#iX~fbrLz>VbvLs4+}7LZ75X-p zp&VthrP5OISU8+nC}o%D$5X~)xR^|37xJmBVdRzz;oJgzP9}4?bYX?ERKjnGigb*^ z_+@AT^DHgXJdIO|3|a(Qq$Kn#Y!+89VRW7SPoz5)hk_9>q#|$`fSW3Y%O&j@= zFO$xv3&~RYyl;NRHXt**i^&?!oH}0 zVv8`e0RaK80&d`?Z36*iUj-FyMFqqi)E@2WcD(VbLQN8&V4`Ec~70+`9IIU zO6KYA>=Mocc)%|J;Nal!`SWKdC#TJuH;Y7~)vH$r1qGFql&DmyRjXD>BoaqQ$DEv; zqM{<1Ocog#xqtuuwQJYL#l^|x^4{LwmX?;r#>SH;Pww8md(E0P?d|O~H8t1mBdqf{z^zw6Ea;Zfm9(aLazUF6Q~N`U_>OviLj*?xJAF9-noS(qB@VP)jZk;Qde`RI4J zomp;!mCEUz`sG2{2ts=A_p>ReD0U@nNF=^VG<@jxW?=~bUrYxWq9oDIEeE6vB48jL zP_pAuR0>C!9r_laD}yEUtpH4=GQ7k@gaHCU2(FBaVJqsLxyTz<6b22CuT{E7FAFK;waGV5c?oEp13xTW znXAXYYw>FVeMPA7&7B@iENw{XX~v4d)Z;$<^_d|trG~=WXBdkdce(EJa6BB^>wnzx zSUB;=l$hz^FO=3slADhvZA?q$of-ojB@=@-S~1WJT^gPIY?$%$30dIy=G4qe&#qh~ z!a$ctJtdJMw;yO*Y!72+^%3K2cRw1?KRWJ@6|3U>#l_>Jel$v|fb9K>K{R;lM7CNoB-> z$s&B4|1KydK%%cNF2>kLgE1UOkeV1m0vVE|f!JglR-1TK1k*Mdm^F}QTQ42VqBE}> zh6i1W3S7`&N~8qVY~N=*jG7d08XV&EI-T8?nFu!F-|ne(a_VvXTRRDPjAlokW
X}UWz08V_@o{j+otpay;*D-dGqNeK?82 zSFiTSQS#Yy(sZh>b1?x_Iy(PWMH{Xk&4b<6p#R2H>n8GFv%E#oV`YvN?= zi_Obrz;S0auSuLkk*;)Eea!7-D#HgoG~1%;`pTlr$kwA!SYv5Hb@s^k`eOGwCzk~a z44pOVeyM09!0A4!9JF%*RvIcs?0x)!z;|x15(61ONWg9>jWbY25)o6#90_S zBkzEJL8RDZAq4FO;<9}JBqP(rhmMv(Xt-=w0?w;n2+Q-Z6JZz1SQXy*rYdhb#A}!T z6jm<9(+ASK13}iUG1jK@cW-*Ls1F`enRoB@hW$MGfZ0Ddlw3JJcD3*I<=4UYBq&Kt zdx6n~Ga+iBn-)^siIr{;g+XqZQ3(60A^lh*h0mcm_&wr77U#cT_l<5Df>f?+4i9vL z+H$SSIIb6^k{*fy-@`Bc+~D^sK#prh?9&+!^R)o0Dnm#Dn#%l)L$ew;bK@$f)1YzT z+tcPYU#s;ihbknaK_3TLkDl1k{!x-r`d;9_C<`NZMtg|=+Y#TCty4@sQ&cI=!%D)= z9g)}MM`aQ>a(H^>oacx1S*Z@_zKbOhJ7cLsvpk8eL5ybc84 zmawSM^R1<-C>oW@M4Qk3n1B$!P-z@{|3$f@OCci~ElxA}5VEL`UcY6JhC;zeQ^I6O zZC>Pl&5mL`RG|d`rv2lD<&){98$3NqC1+G=nF+gtx>wTy@W#^Yr%uefE>$4HyrTKY z76s%`4(T6s>vp_k<;yp-3GM8@CAfWp<4n6{@DEGk|KBf7+fm!Ebh4 z9~)86xSCIKdQPWWo!iT(AM3`W%;sLBk^3>M=j(KZR z4$o>R27`PC%ZWGxgJPQa2o@)t*EZ;LMMRMRZl@3{^JAI4Rw|VF<~>aL=ZoPVFtYAk zN2naA?`#;M>vhY7@?NQKLvl$pp+#m=Y4+A~k%(^e+;GXHDi2sU4OBge4Kso;(wa23 z=aEuEvV|SqSaFX4iB&*s?4)oNK}LMKcv%5SKuho48->H#2L7ClkPwYn`8wp;D}&T( zzOQcq@F&0fH>M~Z)cXq7NoQeO1BJ9DT)a9oskWcVLi9T-Qx?|Ioll@~ttfy;FNL8Sm}6CV{U%4WtvMXoBArxt^}(4HL?*dKs8~ zAXmyu(qDL>>lr|hu|2A4SzL8v$2W_nen4qQ%sI|NVJbug?bx|e37DQJ#-fXZ!a_-;JeW;taBCZunjBFR`G}lFa*K7F(I){-27070Ix>pF{Sn~Z3BZ(m@Q~E&SIDL@U9UV&o|?gi zZ;gy6;}icj7~20a5QLc3QEGVWmee*C#F*(|pUwa>(y6>YXtX{Q-K58J1o#S7_BT6& z4nGTs=xWn_z{_<3ZA){<9aRBUsa@Gr-fzsXnVZMYJGw_P8jBxOHD|vAutqo}pvZ2; z!VuRbn0j;tXuH_IbJSJ~=q38?+M9e>;BUXb6!~9=*@?_aJFRx!CNL={0=#T(^v5l# zMpcZ{c>>@Q!$8LMF*`TF`MHy_*RtwEL0FQ6RIt7a1!U}C0dUd?Gi zM$X1StY`6#kv}nv=O_i`-co(z5@!t{3BBQHb+2PyoW-{|P8+I@GIuz_y7aZ^0&g^J z1J>6cAe6LatWY?g`uJ>xo; literal 0 HcmV?d00001 diff --git a/assets/js/customizer.js b/assets/js/customizer.js index bf7136b..c2808b3 100755 --- a/assets/js/customizer.js +++ b/assets/js/customizer.js @@ -274,9 +274,8 @@ $( '.alpha-color-control', control.container ).alphaColorPicker( { clear: function(event, ui){ - }, + } }); - } }); @@ -284,302 +283,6 @@ } )( wp.customize, jQuery ); -// WP EDITOR plugin ----------------------------- -(function ( $ ) { - - window._wpEditor = { - init: function( id , content, settings ){ - var _id = '__wp_mce_editor__'; - var _tpl = $( '#_wp-mce-editor-tpl').html(); - if ( typeof content === "undefined" ){ - content = ''; - } - - if ( typeof window.tinyMCEPreInit.mceInit[ _id ] !== "undefined" ) { - - var tmceInit = _.clone( window.tinyMCEPreInit.mceInit[_id] ); - var qtInit = _.clone( window.tinyMCEPreInit.qtInit[_id] ); - - tmceInit = $.extend( tmceInit , settings.tinymce ); - qtInit = $.extend( qtInit , settings.qtag ); - - var tpl = _tpl.replace( new RegExp(_id,"g"), id ); - var template = $( tpl ); - template.find( 'textarea').removeAttr( 'rows').removeAttr( 'cols' ); - $( "#"+id ).replaceWith( template ); - // set content - $( '#'+id ).val( content ); - - $wrap = tinymce.$( '#wp-' + id + '-wrap' ); - - tmceInit.body_class = tmceInit.body_class.replace(new RegExp(_id,"g"), id ); - tmceInit.selector = tmceInit.selector.replace(new RegExp(_id,"g"), id ); - tmceInit.cache_suffix = ''; - - $wrap.removeClass( 'html-active').addClass( 'tmce-active' ); - - tmceInit.init_instance_callback = function( editor ){ - - if ( typeof settings === 'object' ) { - if ( typeof settings.mod === 'string' && settings.mod === 'html' ){ - //console.log( settings.mod ); - switchEditors.go( id, settings.mod ); - } - // editor.theme.resizeTo('100%', 500); - if( typeof settings.init_instance_callback === "function" ) { - settings.init_instance_callback( editor ); - } - - if (settings.sync_id !== '') { - if (typeof settings.sync_id === 'string') { - editor.on('keyup change', function (e) { - var html = editor.getContent( { format: 'raw' } ); - html = _wpEditor.removep( html ); - $('#' + settings.sync_id).val( html ).trigger('change'); - }); - } else { - editor.on('keyup change', function (e) { - var html = editor.getContent( { format: 'raw' } ); - html = _wpEditor.removep( html ); - settings.sync_id.val( html ).trigger('change'); - }); - } - - $( 'textarea#'+id ).on( 'keyup change', function(){ - var v = $( this).val(); - if ( typeof settings.sync_id === 'string' ) { - $('#' + settings.sync_id).val( v ).trigger('change'); - } else { - settings.sync_id.val( v ).trigger('change'); - } - } ); - - - } - } - }; - - - //console.log( tmceInit ); - tmceInit.plugins = tmceInit.plugins.replace('fullscreen,', ''); - tinyMCEPreInit.mceInit[ id ] = tmceInit; - //console.log( tmceInit ); - - qtInit.id = id; - tinyMCEPreInit.qtInit[ id ] = qtInit; - - if ( $wrap.hasClass( 'tmce-active' ) || ! tinyMCEPreInit.qtInit.hasOwnProperty( id ) ) { - tinymce.init( tmceInit ); - if ( ! window.wpActiveEditor ) { - window.wpActiveEditor = id; - } - } - - if ( typeof quicktags !== 'undefined' ) { - - /** - * Reset quicktags - * This is crazy condition - * Maybe this is a bug ? - * see wp-includes/js/quicktags.js line 252 - */ - if( QTags.instances['0'] ) { - QTags.instances['0'] = false; - } - quicktags( qtInit ); - if ( ! window.wpActiveEditor ) { - window.wpActiveEditor = id; - } - - } - - } - }, - - /** - * Replace paragraphs with double line breaks - * @see wp-admin/js/editor.js - */ - removep: function ( html ) { - return window.switchEditors._wp_Nop( html ); - }, - - sync: function(){ - // - }, - - remove: function( id ){ - var content = ''; - var editor = false; - if ( editor = tinymce.get(id) ) { - content = editor.getContent( { format: 'raw' } ); - content = _wpEditor.removep( content ); - editor.remove(); - } else { - content = $( '#'+id ).val(); - } - - if ( $( '#wp-' + id + '-wrap').length > 0 ) { - window._wpEditorBackUp = window._wpEditorBackUp || {}; - if ( typeof window._wpEditorBackUp[ id ] !== "undefined" ) { - $( '#wp-' + id + '-wrap').replaceWith( window._wpEditorBackUp[ id ] ); - } - } - - $( '#'+id ).val( content ); - } - - }; - - - $.fn.wp_js_editor = function( options ) { - - // This is the easiest way to have default options. - if ( options !== 'remove' ) { - options = $.extend({ - sync_id: "", // sync to another text area - tinymce: {}, // tinymce setting - qtag: {}, // quick tag settings - mod: '', // quick tag settings - init_instance_callback: function(){} // quick tag settings - }, options ); - } else{ - options = 'remove'; - } - - return this.each( function( ) { - var edit_area = $( this ); - edit_area.uniqueId(); - // Make sure edit area have a id attribute - var id = edit_area.attr( 'id' ) || ''; - if ( id === '' ){ - return ; - } - - if ( 'remove' !== options ) { - if ( ! options.mod ){ - options.mod = edit_area.attr( 'data-editor-mod' ) || ''; - } - - window._wpEditorBackUp = window._wpEditorBackUp || {}; - window._wpEditorBackUp[ id ] = edit_area; - window._wpEditor.init( id, edit_area.val(), options ); - } else { - window._wpEditor.remove( id ); - } - - }); - - }; - -}( jQuery )); - - - - -// WP EDITOR Customizer ----------------------------- - -( function( api , $ ) { - api.controlConstructor['wp_editor'] = api.Control.extend( { - ready: function() { - var control = this; - control.editing_area = $( '.wp-js-editor-textarea' , control.container ); - control.editing_area.uniqueId(); - control.editing_id = control.editing_area.attr( 'id' ) || ''; - control.editor_id = 'wpe-for-'+control.editing_id; - control.preview = $( '
'); - control.editing_editor = $( ''); - var content = control.editing_area.val(); - // Load default value - $( 'textarea', control.editing_editor).val( content ); - control.preview.html( window.switchEditors._wp_Autop( content ) ); - - $( 'body' ).on( 'click', '#customize-controls, .customize-section-back', function( e ) { - if ( ! $( e.target ).is( control.preview ) ) { - /// e.preventDefault(); // Keep this AFTER the key filter above - control.editing_editor.removeClass( 'wpe-active' ); - $( '.wp-js-editor-preview').removeClass( 'wpe-focus'); - } - } ); - - control._init(); - - $( window ) .on( 'resize', function(){ - control._resize(); - } ); - - }, - - _init: function( ){ - - var control = this; - $( 'body .wp-full-overlay').append( control.editing_editor ); - - $( 'textarea', control.editing_editor).attr( 'data-editor-mod', ( control.editing_area.attr( 'data-editor-mod' ) || '' ) ) .wp_js_editor( { - sync_id: control.editing_area, - init_instance_callback: function( editor ){ - var w = $( '#wp-'+control.editor_id+ '-wrap' ); - $( '.wp-editor-tabs', w).append( '' ); - $( '.wp-editor-tabs', w).append( '' ); - $( '.wp-editor-tabs', w).append( '' ); - w.on( 'click', '.close-wp-editor', function( e ) { - e.preventDefault(); - control.editing_editor.removeClass( 'wpe-active' ); - $( '.wp-js-editor-preview').removeClass( 'wpe-focus'); - } ); - $( '.preview-wp-editor', w ).hover( function(){ - w.closest( '.modal-wp-js-editor').css( { opacity: 0 } ); - }, function(){ - w.closest( '.modal-wp-js-editor').css( { opacity: 1 } ); - } ); - w.on( 'click', '.fullscreen-wp-editor', function( e ) { - e.preventDefault(); - w.closest( '.modal-wp-js-editor').toggleClass( 'fullscreen' ); - setTimeout( function(){ - $( window ).resize(); - }, 600 ); - } ); - } - } ); - control.editing_area.on( 'change', function() { - control.preview.html( window.switchEditors._wp_Autop( $( this).val() ) ); - }); - - control.preview.on( 'click', function( e ){ - $( '.modal-wp-js-editor').removeClass( 'wpe-active' ); - control.editing_editor.toggleClass( 'wpe-active' ); - tinyMCE.get( control.editor_id ).focus(); - control.preview.addClass( 'wpe-focus' ); - control._resize(); - return false; - } ); - - control.container.find( '.wp-js-editor').addClass( 'wp-js-editor-active' ); - control.preview.insertBefore( control.editing_area ); - control.container.on( 'click', '.wp-js-editor-preview', function( e ){ - e.preventDefault(); - } ); - - }, - - _resize: function(){ - var control = this; - var w = $( '#wp-'+control.editor_id+ '-wrap'); - var height = w.innerHeight(); - var tb_h = w.find( '.mce-toolbar-grp' ).eq( 0 ).height(); - tb_h += w.find( '.wp-editor-tools' ).eq( 0 ).height(); - tb_h += 50; - //var width = $( window ).width(); - var editor = tinymce.get( control.editor_id ); - control.editing_editor.width( '' ); - editor.theme.resizeTo( '100%', height - tb_h ); - w.find( 'textarea.wp-editor-area').height( height - tb_h ); - } - - } ); - -} )( wp.customize, jQuery ); - // WP REPEATERABLE Customizer ----------------------------- ( function( api , $ ) { @@ -587,7 +290,9 @@ api.controlConstructor['repeatable'] = api.Control.extend( { ready: function() { var control = this; - control._init(); + setTimeout( function(){ + control._init(); + } , 2500 ); }, eval: function(valueIs, valueShould, operator) { @@ -633,7 +338,6 @@ } $context.addClass( 'conditionized' ); - $context.on( 'change condition_check', 'input, select, textarea', function( e ) { var id = $( this ).attr( 'data-live-id' ) || ''; @@ -674,624 +378,945 @@ * Current support one level only */ $('input, select, textarea', $context ).trigger( 'condition_check' ); - - }, - remove_editor: function( $context ){ - $( '.editor-added', $context).each( function(){ - var id = $(this).attr( 'id' ) || ''; - var editor_id = 'wpe-for-'+id; - try { - editor = tinymce.get( editor_id ); - if ( editor ) { - editor.remove(); + remove_editor: function( $context ){}, + editor: function( $textarea ){ }, - } - $( '#wrap-'+editor_id ).remove(); - $( '#wrap-'+id ).remove(); + _init: function() { + var control = this; - if ( typeof tinyMCEPreInit.mceInit[ editor_id ] !== "undefined" ) { - delete tinyMCEPreInit.mceInit[ editor_id ]; - } - - if ( typeof tinyMCEPreInit.qtInit[ editor_id ] !== "undefined" ) { - delete tinyMCEPreInit.qtInit[ editor_id ]; - } - - } catch (e) { - - } - - } ); - }, - - editor: function( $textarea ){ - var control = this; - if ( $textarea.hasClass( 'editor-added' ) ){ - return; - } - $textarea.addClass( 'editor-added' ); - $textarea.hide(); - - var settings = {}; - settings.editing_area = $textarea; - settings.container = $textarea.closest( '.item-editor' ); - - settings.editing_area.uniqueId(); - settings.editing_id = settings.editing_area.attr( 'id' ) || ''; - // settings.editing_id = 'editor-' + Math.random().toString(36).substr(2, 9); - $textarea.attr( 'id', settings.editing_id ); - - settings.editor_id = 'wpef-'+settings.editing_id; - settings.preview = $( '
'); - settings.editing_editor = $( ''); - var content = settings.editing_area.val(); - // Load default value - $( 'textarea', settings.editing_editor).val( content ); - settings.preview.html( window.switchEditors._wp_Autop( content ) ); - - $( 'body' ).on( 'click', '#customize-controls, .customize-section-back', function( e ) { - if ( ! $( e.target ).is( settings.preview ) ) { - /// e.preventDefault(); // Keep this AFTER the key filter above - settings.editing_editor.removeClass( 'wpe-active' ); - $( '.wp-js-editor-preview').removeClass( 'wpe-focus' ); - } - } ); + var default_data = control.params.fields; - //---- - settings._init = function() { - $('body .wp-full-overlay').append(settings.editing_editor); - - $('textarea', settings.editing_editor).wp_js_editor({ - sync_id: settings.editing_area, - init_instance_callback: function (editor) { - var w = $('#wp-' + settings.editor_id + '-wrap'); - $( '.wp-editor-tabs', w).append( '' ); - $( '.wp-editor-tabs', w).append( '' ); - $('.wp-editor-tabs', w).append(''); - w.on('click', '.close-wp-editor', function (e) { - e.preventDefault(); - settings.editing_editor.removeClass('wpe-active'); - $( '.wp-js-editor-preview').removeClass( 'wpe-focus' ); - }); - - $( '.preview-wp-editor', w ).hover( function(){ - w.closest( '.modal-wp-js-editor').css( { opacity: 0 } ); - }, function(){ - w.closest( '.modal-wp-js-editor').css( { opacity: 1 } ); - } ); - w.on( 'click', '.fullscreen-wp-editor', function( e ) { - e.preventDefault(); - w.closest( '.modal-wp-js-editor').toggleClass( 'fullscreen' ); - setTimeout( function(){ - $( window ).resize(); - }, 600 ); - } ); - } - }); - settings.editing_area.on('change', function () { - settings.preview.html( window.switchEditors._wp_Autop( $( this).val() ) ); - }); - - settings.preview.on('click', function (e) { - $( '.wp-js-editor-preview').removeClass( 'wpe-focus' ); - $('.modal-wp-js-editor').removeClass('wpe-active'); - settings.editing_editor.toggleClass('wpe-active'); - tinyMCE.get(settings.editor_id).focus(); - settings.preview.addClass( 'wpe-focus' ); - settings._resize(); - return false; - }); - - settings.container.find('.item-editor').addClass('wp-js-editor-active'); - settings.preview.insertBefore(settings.editing_area); - settings.container.on('click', '.wp-js-editor-preview', function (e) { - e.preventDefault(); - }); - }; - - - //---- - settings._resize = function(){ - var w = $( '#wp-'+settings.editor_id+ '-wrap' ); - var height = w.innerHeight(); - var tb_h = w.find( '.mce-toolbar-grp' ).eq( 0 ).height(); - tb_h += w.find( '.wp-editor-tools' ).eq( 0 ).height(); - tb_h += 50; - var editor = tinymce.get( settings.editor_id ); - settings.editing_editor.width( '' ); - editor.theme.resizeTo( '100%', height - tb_h ); - w.find( 'textarea.wp-editor-area').height( height - tb_h ); - }; - - - settings._init(); - $( window ) .on( 'resize', function(){ - settings._resize(); - } ); - - }, + var values; + try { + if ( typeof control.params.value == 'string' ) { + values = JSON.parse(control.params.value); + } else { + values = control.params.value; + } + } catch (e) { + values = {}; + } + var max_item = 0; // unlimited + var limited_mg = control.params.limited_msg || ''; - _init: function(){ - var control = this; - - //var container = control.container; - var default_data = control.params.fields; + if (!isNaN(parseInt(control.params.max_item))) { + max_item = parseInt(control.params.max_item); + } - var values; - try { - values = JSON.parse( control.params.value ) ; - }catch ( e ) { - values = {}; - } - //if ( control.id == 'onepress_section_order_styling' ){ - //console.log( values ); - //} + if (control.params.changeable === 'no') { + // control.container.addClass( 'no-changeable' ); + } - var max_item = 0; // unlimited - var limited_mg = control.params.limited_msg || ''; + /** + * Toggle show/hide item + */ + control.container.on('click', '.widget .widget-action, .widget .repeat-control-close, .widget-title', function (e) { + e.preventDefault(); + var p = $(this).closest('.widget'); + + if (p.hasClass('explained')) { + //console.log( 'has: explained' ); + $('.widget-inside', p).slideUp(200, 'linear', function () { + $('.widget-inside', p).removeClass('show').addClass('hide'); + p.removeClass('explained'); + }); + } else { + // console.log( 'No: explained' ); + $('.widget-inside', p).slideDown(200, 'linear', function () { + $('.widget-inside', p).removeClass('hide').addClass('show'); + p.addClass('explained'); + }); + } + }); + + /** + * Remove repeater item + */ + control.container.on('click', '.repeat-control-remove', function (e) { + e.preventDefault(); + var $context = $(this).closest('.repeatable-customize-control'); + $("body").trigger("repeat-control-remove-item", [$context]); + control.remove_editor($context); + $context.remove(); + control.rename(); + control.updateValue(); + control._check_max_item(); + }); + + /** + * Get customizer control data + * + * @returns {*} + */ + control.getData = function () { + var f = $('.form-data', control.container); + var data = $('input, textarea, select', f).serialize(); + return JSON.stringify(data); + }; + + /** + * Update repeater value + */ + control.updateValue = function () { + var data = control.getData(); + //$("[data-hidden-value]", control.container).val(data); + //$("[data-hidden-value]", control.container).trigger('change'); + + control.setting.set( data ); + }; + + /** + * Rename repeater item + */ + control.rename = function () { + $('.list-repeatable li', control.container).each( function (index) { + var li = $(this); + $('input, textarea, select', li).each(function () { + var input = $(this); + var name = input.attr('data-repeat-name') || undefined; + if (typeof name !== "undefined") { + name = name.replace(/__i__/g, index); + input.attr('name', name); + } + }); + + }); + }; + + + if ( ! window._upload_fame ) { + window._upload_fame = wp.media({ + title: wp.media.view.l10n.addMedia, + multiple: false, + //library: {type: 'all' }, + //button : { text : 'Insert' } + }); + } - if ( ! isNaN( parseInt( control.params.max_item ) ) ) { - max_item = parseInt( control.params.max_item ); - } + window._upload_fame.on('close', function () { + // get selections and save to hidden input plus other AJAX stuff etc. + var selection = window._upload_fame.state().get('selection'); + // console.log(selection); + }); + + window.media_current = {}; + window.media_btn = {}; + + window._upload_fame.on('select', function () { + // Grab our attachment selection and construct a JSON representation of the model. + var media_attachment = window._upload_fame.state().get('selection').first().toJSON(); + $('.image_id', window.media_current).val(media_attachment.id); + var preview, img_url; + img_url = media_attachment.url; + $('.current', window.media_current).removeClass('hide').addClass('show'); + $('.image_url', window.media_current).val(img_url); + if (media_attachment.type == 'image') { + preview = ''; + $('.thumbnail-image', window.media_current).html(preview); + } + $('.remove-button', window.media_current).show(); + $('.image_id', window.media_current).trigger('change'); + try { + window.media_btn.text(window.media_btn.attr('data-change-txt')); + } catch ( e ){ + + } + + }); + + + control.handleMedia = function ($context) { + $('.item-media', $context).each(function () { + var _item = $(this); + // when remove item + $('.remove-button', _item).on('click', function (e) { + e.preventDefault(); + $('.image_id, .image_url', _item).val(''); + $('.thumbnail-image', _item).html(''); + $('.current', _item).removeClass('show').addClass('hide'); + $(this).hide(); + $('.upload-button', _item).text($('.upload-button', _item).attr('data-add-txt')); + $('.image_id', _item).trigger('change'); + }); + + // when upload item + $('.upload-button, .attachment-media-view', _item).on('click', function (e) { + e.preventDefault(); + window.media_current = _item; + window.media_btn = $(this); + window._upload_fame.open(); + }); + }); + }; + + /** + * Init color picker + * + * @param $context + */ + control.colorPicker = function ($context) { + // Add Color Picker to all inputs that have 'color-field' class + $('.c-color', $context).wpColorPicker({ + change: function (event, ui) { + control.updateValue(); + }, + clear: function (event, ui) { + control.updateValue(); + } + }); + + $('.c-coloralpha', $context).each(function () { + var input = $(this); + var c = input.val(); + c = c.replace('#', ''); + input.removeAttr('value'); + input.prop('value', c); + input.alphaColorPicker({ + change: function (event, ui) { + control.updateValue(); + }, + clear: function (event, ui) { + control.updateValue(); + }, + }); + }); + }; + + /** + * Live title events + * + * @param $context + */ + control.actions = function ($context) { + if (control.params.live_title_id) { + + if (!$context.attr('data-title-format')) { + $context.attr('data-title-format', control.params.title_format); + } + + var format = $context.attr('data-title-format') || ''; + // Custom for special ID + if (control.id === 'onepress_section_order_styling') { + if ($context.find('input.add_by').val() !== 'click') { + format = '[live_title]'; + } + } + + // Live title + if (control.params.live_title_id && $("[data-live-id='" + control.params.live_title_id + "']", $context).length > 0) { + var v = ''; + + if ($("[data-live-id='" + control.params.live_title_id + "']", $context).is('.select-one')) { + v = $("[data-live-id='" + control.params.live_title_id + "']", $context).find('option:selected').eq(0).text(); + } else { + v = $("[data-live-id='" + control.params.live_title_id + "']", $context).eq(0).val(); + } + + if (v == '') { + v = control.params.default_empty_title; + } + + if (format !== '') { + v = format.replace('[live_title]', v); + } + + $('.widget-title .live-title', $context).text(v); + + $context.on('keyup change', "[data-live-id='" + control.params.live_title_id + "']", function () { + var v = ''; + + var format = $context.attr('data-title-format') || ''; + // custom for special ID + if (control.id === 'onepress_section_order_styling') { + if ($context.find('input.add_by').val() !== 'click') { + format = '[live_title]'; + } + } + + if ($(this).is('.select-one')) { + v = $(this).find('option:selected').eq(0).text(); + } else { + v = $(this).val(); + } + + if (v == '') { + v = control.params.default_empty_title; + } + + if (format !== '') { + v = format.replace('[live_title]', v); + } + + $('.widget-title .live-title', $context).text(v); + }); + + } else { + + } + + } else { + //$('.widget-title .live-title', $context).text( control.params.title_format ); + } + + }; + + + /** + * Check limit number item + * + * @private + */ + control._check_max_item = function () { + var n = $('.list-repeatable > li.repeatable-customize-control', control.container).length; + //console.log( n ); + if (n >= max_item) { + $('.repeatable-actions', control.container).hide(); + if ($('.limited-msg', control.container).length <= 0) { + if (limited_mg !== '') { + var msg = $('

'); + msg.html(limited_mg); + msg.insertAfter($('.repeatable-actions', control.container)); + msg.show(); + } + } else { + $('.limited-msg', control.container).show(); + } + + } else { + $('.repeatable-actions', control.container).show(); + $('.limited-msg', control.container).hide(); + } + }; + + /** + * Function that loads the Mustache template + */ + control.repeaterTemplate = _.memoize(function () { + var compiled, + /* + * Underscore's default ERB-style templates are incompatible with PHP + * when asp_tags is enabled, so WordPress uses Mustache-inspired templating syntax. + * + * @see trac ticket #22344. + */ + options = { + evaluate: /<#([\s\S]+?)#>/g, + interpolate: /\{\{\{([\s\S]+?)\}\}\}/g, + escape: /\{\{([^\}]+?)\}\}(?!\})/g, + variable: 'data' + }; + + return function (data) { + if (typeof window.repeater_item_tpl === "undefined") { + window.repeater_item_tpl = $('#repeatable-js-item-tpl').html(); + } + compiled = _.template(window.repeater_item_tpl, null, options); + return compiled(data); + }; + }); + control.template = control.repeaterTemplate(); + + + /** + * Init item events + * + * @param $context + */ + control.intItem = function ($context) { + control.rename(); + control.conditionize($context); + control.colorPicker($context); + control.handleMedia($context); + //Special check element + $('[data-live-id="section_id"]', $context).each(function () { + $(this).closest('.repeatable-customize-control').addClass('section-' + $(this).val()); + if ($(this).val() === 'map') { + $context.addClass('show-display-field-only'); + } + }); + + // Custom for special IDs + if ( control.id === 'onepress_section_order_styling' ) { + if ($context.find('input.add_by').val() !== 'click') { + $context.addClass('no-changeable'); + // Remove because we never use + $('.item-editor textarea', $context).remove(); + } else { + $context.find('.item-title').removeClass('item-hidden '); + $context.find('.item-title input[type="hidden"]').attr('type', 'text'); + $context.find('.item-section_id').removeClass('item-hidden '); + $context.find('.item-section_id input[type="hidden"]').attr('type', 'text'); + } + } + + // Setup editor + $('.item-editor textarea', $context).each(function () { + control.editor($(this)); + }); + + // Setup editor + $('body').trigger('repeater-control-init-item', [$context]); + + }; + + /** + * Drag to sort items + */ + $(".list-repeatable", control.container).sortable({ + handle: ".widget-title", + //containment: ".customize-control-repeatable", + containment: control.container, + /// placeholder: "sortable-placeholder", + update: function (event, ui) { + control.rename(); + control.updateValue(); + } + }); + + + /** + * Create existing items + */ + + _templateData = $.extend(true, {}, control.params.fields); + var _templateData; + + $.each( values, function ( i, _values ) { + + _values = values[i]; + if ( _values ) { + for (var j in _values) { + if (_templateData.hasOwnProperty(j) && _values.hasOwnProperty(j)) { + _templateData[j].value = _values[j]; + } + } + } + + var $html = $( control.template( _templateData) ); + $('.list-repeatable', control.container).append($html); + control.intItem($html); + control.actions($html); + }); - if ( control.params.changeable === 'no' ) { - // control.container.addClass( 'no-changeable' ); - } /** - * Toggle show/hide item + * Add new item */ - control.container.on( 'click', '.widget .widget-action, .widget .repeat-control-close, .widget-title', function( e ){ - e.preventDefault(); - var p = $( this ).closest( '.widget' ); - - if ( p.hasClass( 'explained' ) ) { - //console.log( 'has: explained' ); - $( '.widget-inside', p ).slideUp( 200, 'linear', function(){ - $( '.widget-inside', p ).removeClass( 'show').addClass('hide'); - p.removeClass( 'explained' ); - } ); - } else { - // console.log( 'No: explained' ); - $( '.widget-inside', p ).slideDown( 200, 'linear', function(){ - $( '.widget-inside', p ).removeClass( 'hide').addClass('show'); - p.addClass( 'explained' ); - } ); - } - - } ); + control.container.on( 'click', '.add-new-repeat-item', function(){ + var $html = $( control.template( default_data ) ); + $( '.list-repeatable', control.container ).append( $html ); - /** - * Remove repeater item - */ - control.container.on( 'click', '.repeat-control-remove' , function( e ){ - e.preventDefault(); - var $context = $( this ).closest( '.repeatable-customize-control' ); - control.remove_editor( $context ); + // add unique ID for section if id_key is set + if ( control.params.id_key !== '' ){ + $html.find( '.item-'+control.params.id_key).find( 'input').val( 'sid'+( new Date().getTime() ) ); + } + $html.find( 'input.add_by').val( 'click' ); - $context.remove(); - control.rename(); + control.intItem( $html ); + control.actions( $html ); control.updateValue(); control._check_max_item(); } ); /** - * Get customizer control data - * - * @returns {*} - */ - control.getData = function ( ){ - var f = $( '.form-data', control.container ); - var data = $( 'input, textarea, select', f ).serialize(); - //console.log( data ); - return JSON.stringify( data ) ; - }; - - /** - * Update repeater value + * Update repeater data when any events fire. */ - control.updateValue = function(){ - var data = control.getData(); - //console.log( data ); - $( "[data-hidden-value]", control.container ).val( data ); - $( "[data-hidden-value]", control.container ).trigger( 'change' ); - }; + $( '.list-repeatable', control.container ).on( 'keyup change color_change', 'input, select, textarea', function( e ) { + control.updateValue(); + }); - /** - * Rename repeater item - */ - control.rename = function(){ - $( '.list-repeatable li', control.container ).each( function( index ) { - var li = $( this ); - $( 'input, textarea, select', li ).each( function(){ - var input = $( this ); - var name = input.attr( 'data-repeat-name' ) || undefined; - if( typeof name !== "undefined" ) { - name = name.replace(/__i__/g, index ); - input.attr( 'name', name ); - } - } ); + control._check_max_item(); - } ); - }; + } + } ); - var frame = wp.media({ - title: wp.media.view.l10n.addMedia, - multiple: false, - //library: {type: 'all' }, - //button : { text : 'Insert' } - }); +} )( wp.customize, jQuery ); - frame.on('close', function () { - // get selections and save to hidden input plus other AJAX stuff etc. - var selection = frame.state().get('selection'); - // console.log(selection); - }); +/** + * WP EDITOR plugin + */ +(function ( $ ) { - control.media_current = {}; - control.media_btn = {}; - frame.on( 'select', function () { - // Grab our attachment selection and construct a JSON representation of the model. - var media_attachment = frame.state().get('selection').first().toJSON(); - $( '.image_id', control.media_current ).val( media_attachment.id ); - var preview, img_url; - img_url = media_attachment.url; - $( '.current', control.media_current ).removeClass( 'hide').addClass( 'show' ); - $( '.image_url', control.media_current ).val( img_url ); - if ( media_attachment.type == 'image' ) { - preview = ''; - $('.thumbnail-image', control.media_current ).html(preview); - } - $('.remove-button', control.media_current ).show(); - $( '.image_id', control.media_current ).trigger( 'change' ); - control.media_btn.text( control.media_btn.attr( 'data-change-txt' ) ); - }); + window._wpEditor = { + init: function( id , content, settings ){ + var _id = '__wp_mce_editor__'; + var _tpl = $( '#_wp-mce-editor-tpl').html(); + if ( typeof content === "undefined" ){ + content = ''; + } + if ( typeof window.tinyMCEPreInit.mceInit[ _id ] !== "undefined" ) { - control.handleMedia = function( $context ) { - $('.item-media', $context ).each( function(){ - var _item = $( this ); - // when remove item - $( '.remove-button', _item ).on( 'click', function( e ){ - e.preventDefault(); - $( '.image_id, .image_url', _item ).val( '' ); - $( '.thumbnail-image', _item ).html( '' ); - $( '.current', _item ).removeClass( 'show' ).addClass( 'hide' ); - $( this).hide(); - $('.upload-button', _item ).text( $('.upload-button', _item ).attr( 'data-add-txt' ) ); - $( '.image_id', _item ).trigger( 'change' ); - } ); - - // when upload item - $('.upload-button, .attachment-media-view', _item ).on('click', function ( e ) { - e.preventDefault(); - control.media_current = _item; - control.media_btn = $( this ); - frame.open(); - }); - } ); - }; + var tmceInit = _.clone( window.tinyMCEPreInit.mceInit[_id] ); + var qtInit = _.clone( window.tinyMCEPreInit.qtInit[_id] ); - /** - * Init color picker - * - * @param $context - */ - control.colorPicker = function( $context ){ - // Add Color Picker to all inputs that have 'color-field' class - - - $('.c-color', $context).wpColorPicker( { - change: function(event, ui){ - control.updateValue(); - }, - clear: function(event, ui){ - control.updateValue(); - }, - }); - - $('.c-coloralpha', $context ).each( function(){ - var input = $( this); - var c = input.val(); - c = c.replace( '#', '' ); - input.removeAttr( 'value'); - input.prop( 'value', c ); - input.alphaColorPicker( { - change: function(event, ui){ - control.updateValue(); - }, - clear: function(event, ui){ - control.updateValue(); - }, - }); - } ); + tmceInit = $.extend( tmceInit , settings.tinymce ); + qtInit = $.extend( qtInit , settings.qtag ); + var tpl = _tpl.replace( new RegExp(_id,"g"), id ); + var template = $( tpl ); + template.find( 'textarea').removeAttr( 'rows').removeAttr( 'cols' ); + $( "#"+id ).replaceWith( template ); + // set content + $( '#'+id ).val( content ); + + $wrap = tinymce.$( '#wp-' + id + '-wrap' ); + + tmceInit.body_class = tmceInit.body_class.replace(new RegExp(_id,"g"), id ); + tmceInit.selector = tmceInit.selector.replace(new RegExp(_id,"g"), id ); + tmceInit.cache_suffix = ''; + + $wrap.removeClass( 'html-active').addClass( 'tmce-active' ); + + tmceInit.init_instance_callback = function( editor ){ + if ( typeof settings === 'object' ) { + if ( typeof settings.mod === 'string' && settings.mod === 'html' ){ + //console.log( settings.mod ); + switchEditors.go( id, settings.mod ); + } + // editor.theme.resizeTo('100%', 500); + if( typeof settings.init_instance_callback === "function" ) { + settings.init_instance_callback( editor ); + } + + if (settings.sync_id !== '') { + if (typeof settings.sync_id === 'string') { + editor.on('keyup change', function (e) { + var html = editor.getContent( { format: 'raw' } ); + html = _wpEditor.removep( html ); + $('#' + settings.sync_id).val( html ).trigger('change'); + }); + } else { + editor.on('keyup change', function (e) { + var html = editor.getContent( { format: 'raw' } ); + html = _wpEditor.removep( html ); + settings.sync_id.val( html ).trigger('change'); + }); + } + + $( 'textarea#'+id ).on( 'keyup change', function(){ + var v = $( this).val(); + if ( typeof settings.sync_id === 'string' ) { + $('#' + settings.sync_id).val( v ).trigger('change'); + } else { + settings.sync_id.val( v ).trigger('change'); + } + } ); + + } + } + }; - }; + tmceInit.plugins = tmceInit.plugins.replace('fullscreen,', ''); + tinyMCEPreInit.mceInit[ id ] = tmceInit; + + qtInit.id = id; + tinyMCEPreInit.qtInit[ id ] = qtInit; + + if ( $wrap.hasClass( 'tmce-active' ) || ! tinyMCEPreInit.qtInit.hasOwnProperty( id ) ) { + tinymce.init( tmceInit ); + if ( ! window.wpActiveEditor ) { + window.wpActiveEditor = id; + } + } + + if ( typeof quicktags !== 'undefined' ) { + + /** + * Reset quicktags + * This is crazy condition + * Maybe this is a bug ? + * see wp-includes/js/quicktags.js line 252 + */ + if( QTags.instances['0'] ) { + QTags.instances['0'] = false; + } + quicktags( qtInit ); + if ( ! window.wpActiveEditor ) { + window.wpActiveEditor = id; + } + + } - /** - * Live title events - * - * @param $context - */ - control.actions = function( $context ){ - if ( control.params.live_title_id ) { + } + }, + + /** + * Replace paragraphs with double line breaks + * @see wp-admin/js/editor.js + */ + removep: function ( html ) { + return window.switchEditors._wp_Nop( html ); + }, + + sync: function(){ + // + }, + + remove: function( id ){ + var content = ''; + var editor = false; + if ( editor = tinymce.get(id) ) { + content = editor.getContent( { format: 'raw' } ); + content = _wpEditor.removep( content ); + editor.remove(); + } else { + content = $( '#'+id ).val(); + } - if( ! $context.attr( 'data-title-format' ) ) { - $context.attr( 'data-title-format', control.params.title_format ); - } + if ( $( '#wp-' + id + '-wrap').length > 0 ) { + window._wpEditorBackUp = window._wpEditorBackUp || {}; + if ( typeof window._wpEditorBackUp[ id ] !== "undefined" ) { + $( '#wp-' + id + '-wrap').replaceWith( window._wpEditorBackUp[ id ] ); + } + } - var format = $context.attr( 'data-title-format' ) || ''; - // Custom for special ID - if ( control.id === 'onepress_section_order_styling' ) { - if ( $context.find( 'input.add_by').val() !== 'click' ) { - format = '[live_title]'; - } - } + $( '#'+id ).val( content ); + } - // Live title - if ( control.params.live_title_id && $( "[data-live-id='"+ control.params.live_title_id+"']", $context ).length > 0 ) { - var v = ''; + }; - if ( $("[data-live-id='" + control.params.live_title_id + "']", $context).is( '.select-one' ) ){ - v = $("[data-live-id='" + control.params.live_title_id + "']", $context ).find('option:selected').eq(0).text(); - } else { - v = $("[data-live-id='" + control.params.live_title_id + "']", $context).eq(0).val(); - } - if ( v == '' ) { - v = control.params.default_empty_title; - } + $.fn.wp_js_editor = function( options ) { - if ( format !== '') { - v = format.replace('[live_title]', v); - } + // This is the easiest way to have default options. + if ( options !== 'remove' ) { + options = $.extend({ + sync_id: "", // sync to another text area + tinymce: {}, // tinymce setting + qtag: {}, // quick tag settings + mod: '', // quick tag settings + init_instance_callback: function(){} // quick tag settings + }, options ); + } else{ + options = 'remove'; + } + return this.each( function( ) { + var edit_area = $( this ); - $('.widget-title .live-title', $context).text( v ); + edit_area.uniqueId(); + // Make sure edit area have a id attribute + var id = edit_area.attr( 'id' ) || ''; + if ( id === '' ){ + return ; + } - $context.on('keyup change', "[data-live-id='" + control.params.live_title_id + "']", function () { - var v = ''; + if ( 'remove' !== options ) { + if ( ! options.mod ){ + options.mod = edit_area.attr( 'data-editor-mod' ) || ''; + } + window._wpEditorBackUp = window._wpEditorBackUp || {}; + window._wpEditorBackUp[ id ] = edit_area; + window._wpEditor.init( id, edit_area.val(), options ); + } else { + window._wpEditor.remove( id ); + } - var format = $context.attr( 'data-title-format' ) || ''; - // custom for special ID - if ( control.id === 'onepress_section_order_styling' ) { - if ( $context.find( 'input.add_by').val() !== 'click' ) { - format = '[live_title]'; - } - } + }); - if ( $(this).is( '.select-one' ) ){ - v = $(this).find('option:selected').eq( 0 ).text(); - } else { - v = $(this).val(); - } + }; - if (v == '') { - v = control.params.default_empty_title; - } +}( jQuery )); - if ( format !== '' ) { - v = format.replace('[live_title]', v); - } - $('.widget-title .live-title', $context).text(v); - }); +jQuery( document ).ready( function( $ ){ + + function _the_editor( container ){ + var _editor = { + ready: function( container ) { + + var control = this; + control.container = container; + control.container.addClass( 'onepress-editor-added' ); + control.editing_area = $( 'textarea' , control.container ); + if ( control.editing_area.hasClass( 'wp-editor-added' ) ) { + return false; + } + + control.editing_area.uniqueId(); + control.editing_area.addClass('wp-editor-added'); + control.editing_id = control.editing_area.attr( 'id' ) || false; + if ( ! control.editing_id ) { + return false; + } + control.editor_id = 'wpe-for-'+control.editing_id; + control.preview = $( '

'); + control.editing_editor = $( ''); + var content = control.editing_area.val(); + // Load default value + $( 'textarea', control.editing_editor).val( content ); + try { + control.preview.html( window.switchEditors._wp_Autop( content ) ); + } catch ( e ) { + + } + + $( 'body' ).on( 'click', '#customize-controls, .customize-section-back', function( e ) { + if ( ! $( e.target ).is( control.preview ) ) { + /// e.preventDefault(); // Keep this AFTER the key filter above + control.editing_editor.removeClass( 'wpe-active' ); + $( '.wp-js-editor-preview').removeClass( 'wpe-focus'); + } + } ); + + control._init(); + + $( window ) .on( 'resize', function(){ + control._resize(); + } ); + + }, + + _init: function( ){ + + var control = this; + $( 'body .wp-full-overlay').append( control.editing_editor ); + + $( 'textarea', control.editing_editor).attr( 'data-editor-mod', ( control.editing_area.attr( 'data-editor-mod' ) || '' ) ) .wp_js_editor( { + sync_id: control.editing_area, + init_instance_callback: function( editor ) { + var w = $( '#wp-'+control.editor_id+ '-wrap' ); + $( '.wp-editor-tabs', w).append( '' ); + $( '.wp-editor-tabs', w).append( '' ); + $( '.wp-editor-tabs', w).append( '' ); + w.on( 'click', '.close-wp-editor', function( e ) { + e.preventDefault(); + control.editing_editor.removeClass( 'wpe-active' ); + $( '.wp-js-editor-preview').removeClass( 'wpe-focus'); + } ); + $( '.preview-wp-editor', w ).hover( function(){ + w.closest( '.modal-wp-js-editor').css( { opacity: 0 } ); + }, function(){ + w.closest( '.modal-wp-js-editor').css( { opacity: 1 } ); + } ); + w.on( 'click', '.fullscreen-wp-editor', function( e ) { + e.preventDefault(); + w.closest( '.modal-wp-js-editor').toggleClass( 'fullscreen' ); + setTimeout( function(){ + $( window ).resize(); + }, 600 ); + } ); + } + } ); + + + control.editing_area.on( 'change', function() { + control.preview.html( window.switchEditors._wp_Autop( $( this).val() ) ); + }); + + control.preview.on( 'click', function( e ){ + $( '.modal-wp-js-editor').removeClass( 'wpe-active' ); + control.editing_editor.toggleClass( 'wpe-active' ); + tinyMCE.get( control.editor_id ).focus(); + control.preview.addClass( 'wpe-focus' ); + control._resize(); + return false; + } ); + + control.container.find( '.wp-js-editor').addClass( 'wp-js-editor-active' ); + control.preview.insertBefore( control.editing_area ); + control.container.on( 'click', '.wp-js-editor-preview', function( e ){ + e.preventDefault(); + } ); + + }, + + _resize: function(){ + var control = this; + var w = $( '#wp-'+control.editor_id+ '-wrap'); + var height = w.innerHeight(); + var tb_h = w.find( '.mce-toolbar-grp' ).eq( 0 ).height(); + tb_h += w.find( '.wp-editor-tools' ).eq( 0 ).height(); + tb_h += 50; + //var width = $( window ).width(); + var editor = tinymce.get( control.editor_id ); + control.editing_editor.width( '' ); + editor.theme.resizeTo( '100%', height - tb_h ); + w.find( 'textarea.wp-editor-area').height( height - tb_h ); + } - } else { + }; - } + _editor.ready( container ); - } else { - //console.log( control.params.title_format ); - //$('.widget-title .live-title', $context).text( control.params.title_format ); - } + } - }; + function _remove_editor( $context ){ + $( 'textarea', $context ).each( function(){ + var id = $(this).attr( 'id' ) || ''; + var editor_id = 'wpe-for-'+id; + try { + var editor = tinymce.get( editor_id ); + if ( editor ) { + editor.remove(); + } + $( '#wrap-'+editor_id ).remove(); + $( '#wrap-'+id ).remove(); + if ( typeof tinyMCEPreInit.mceInit[ editor_id ] !== "undefined" ) { + delete tinyMCEPreInit.mceInit[ editor_id ]; + } - /** - * Check max item - * - * @private - */ - control._check_max_item = function(){ - var n = $( '.list-repeatable > li.repeatable-customize-control', control.container).length; - //console.log( n ); - if ( n>= max_item ) { - $( '.repeatable-actions', control.container ).hide(); - if ( $( '.limited-msg', control.container).length <= 0 ) { - if ( limited_mg !== '' ) { - var msg = $( '

' ); - msg.html( limited_mg ); - msg.insertAfter( $( '.repeatable-actions', control.container ) ); - msg.show(); - } - } else { - $( '.limited-msg', control.container ).show(); - } + if ( typeof tinyMCEPreInit.qtInit[ editor_id ] !== "undefined" ) { + delete tinyMCEPreInit.qtInit[ editor_id ]; + } - } else { - $( '.repeatable-actions', control.container ).show(); - $( '.limited-msg', control.container ).hide(); - } - //console.log( max_item ); - }; + } catch (e) { + } - /** - * Function that loads the Mustache template - */ - control.repeaterTemplate = _.memoize(function () { - var compiled, - /* - * Underscore's default ERB-style templates are incompatible with PHP - * when asp_tags is enabled, so WordPress uses Mustache-inspired templating syntax. - * - * @see trac ticket #22344. - */ - options = { - evaluate: /<#([\s\S]+?)#>/g, - interpolate: /\{\{\{([\s\S]+?)\}\}\}/g, - escape: /\{\{([^\}]+?)\}\}(?!\})/g, - variable: 'data' - }; - - return function ( data ) { - compiled = _.template( control.container.find('.repeatable-js-template').first().html(), null, options); - return compiled( data ); - }; - }); + } ); + } - control.template = control.repeaterTemplate(); + var _is_init_editors = {}; + $( 'body' ).on( 'click', '#customize-theme-controls .accordion-section', function( e ){ + //e.preventDefault(); + var section = $( this ); + var id = section.attr( 'id' ) || ''; + if ( id ) { + if ( typeof _is_init_editors[ id ] === "undefined" ) { + _is_init_editors[ id ] = true; - /** - * Init item events - * - * @param $context - */ - control.intItem = function( $context ){ - control.rename(); - control.conditionize( $context ); - control.colorPicker( $context ); - control.handleMedia( $context ); - //Special check element - $( '[data-live-id="section_id"]', $context ).each( function(){ - // $context.addClass( 'section-'+$( this ).val() ); - $( this).closest( '.repeatable-customize-control').addClass( 'section-'+$( this ).val() ); - if ( $( this ).val() === 'map' ) { - // console.log( $( this).val() ); - $context.addClass( 'show-display-field-only' ); - } - } ); + setTimeout( function() { + if ( $( '.wp-js-editor', section ).length > 0 ) { + $( '.wp-js-editor', section ).each( function(){ + _the_editor( $( this ) ); + } ); + } + if ( $( '.repeatable-customize-control:not(.no-changeable) .item-editor', section ).length > 0 ) { + $( '.repeatable-customize-control:not(.no-changeable) .item-editor', section ).each( function(){ + _the_editor( $( this ) ); + } ); + } + }, 10 ); - // Custom for special ID - if ( control.id === 'onepress_section_order_styling' ) { - if ( $context.find( 'input.add_by').val() !== 'click' ) { - $context.addClass( 'no-changeable' ); - $( '.item-editor textarea', $context).addClass( 'editor-added' ); + } + } + } ); - } else { - $context.find( '.item-title').removeClass( 'item-hidden ' ); - $context.find( '.item-title input[type="hidden"]').attr( 'type', 'text' ); - $context.find( '.item-section_id').removeClass( 'item-hidden ' ); - $context.find( '.item-section_id input[type="hidden"]').attr( 'type', 'text' ); - } - } + // Check section when focus + if ( _wpCustomizeSettings.autofocus ) { + if ( _wpCustomizeSettings.autofocus.section ) { + var id = "sub-accordion-section-"+_wpCustomizeSettings.autofocus.section ; + _is_init_editors[ id ] = true; + var section = $( '#'+id ); + setTimeout( function(){ + if ( $( '.wp-js-editor', section ).length > 0 ) { + $( '.wp-js-editor', section ).each( function(){ + _the_editor( $( this ) ); + } ); + } - // Setup editor - $( '.item-editor textarea', $context ).each( function(){ - control.editor( $( this ) ); - } ); + if ( $( '.repeatable-customize-control:not(.no-changeable) .item-editor', section ).length > 0 ) { + $( '.repeatable-customize-control:not(.no-changeable) .item-editor', section ).each( function(){ + _the_editor( $( this ) ); + } ); + } + }, 1000 ); - }; + } else if ( _wpCustomizeSettings.autofocus.panel ) { - /** - * Drag to sort items - */ - $( ".list-repeatable", control.container ).sortable({ - handle: ".widget-title", - //containment: ".customize-control-repeatable", - containment: control.container, - /// placeholder: "sortable-placeholder", - update: function( event, ui ) { - control.rename(); - control.updateValue(); - } - }); + } + } - /** - * Create existing items - */ - if ( values.length ) { - var _templateData, _values; - for (var i = 0; i < values.length; i++) { + $( 'body' ).on( 'repeater-control-init-item', function( e, container ){ + $( '.item-editor', container ).each( function(){ + _the_editor( $( this ) ); + } ); + } ); - _templateData = $.extend( true, {}, control.params.fields ); + $( 'body' ).on( 'repeat-control-remove-item', function( e, container ){ + _remove_editor( container ); + } ); - _values = values[i]; - if ( values[i] ) { - for ( var j in _values ) { - if ( _templateData.hasOwnProperty( j ) && _values.hasOwnProperty( j ) ) { - _templateData[ j ].value = _values[j]; - } - } - } +} ); - var $html = $( control.template( _templateData ) ); - $( '.list-repeatable', control.container ).append( $html ); - control.intItem( $html ); - control.actions( $html ); - } - } +jQuery( window ).ready( function( $ ){ - /** - * Add new item - */ - control.container.on( 'click', '.add-new-repeat-item', function(){ - var $html = $( control.template( default_data ) ); - $( '.list-repeatable', control.container ).append( $html ); + if ( typeof onepress_customizer_settings !== "undefined" ) { + if (onepress_customizer_settings.number_action > 0) { + $('.control-section-themes h3.accordion-section-title').append('' + onepress_customizer_settings.number_action + ''); + } + } - // add unique ID for section if id_key is set - if ( control.params.id_key !== '' ){ - $html.find( '.item-'+control.params.id_key).find( 'input').val( 'sid'+( new Date().getTime() ) ); - } - $html.find( 'input.add_by').val( 'click' ); - control.intItem( $html ); - control.actions( $html ); - control.updateValue(); - control._check_max_item(); - } ); + /** + * For Hero layout content settings + */ + $( 'select[data-customize-setting-link="onepress_hero_layout"]').on( 'change on_custom_load', function(){ + var v = $( this).val() || ''; - /** - * Update repeater data when any events fire. - */ - $( '.list-repeatable', control.container ).on( 'keyup change color_change', 'input, select, textarea', function( e ) { - control.updateValue(); - }); + $( "li[id^='customize-control-onepress_hcl']").hide(); + $( "li[id^='customize-control-onepress_hcl"+v+"']").show(); - control._check_max_item(); + } ); + $( 'select[data-customize-setting-link="onepress_hero_layout"]').trigger( 'on_custom_load' ); - } - } ); + /** + * For Gallery content settings + */ + $( 'select[data-customize-setting-link="onepress_gallery_source"]').on( 'change on_custom_load', function(){ + var v = $( this).val() || ''; -} )( wp.customize, jQuery ); + $( "li[id^='customize-control-onepress_gallery_source_']").hide(); + $( "li[id^='customize-control-onepress_gallery_api_']").hide(); + $( "li[id^='customize-control-onepress_gallery_settings_']").hide(); + $( "li[id^='customize-control-onepress_gallery_source_"+v+"']").show(); + $( "li[id^='customize-control-onepress_gallery_api_"+v+"']").show(); + $( "li[id^='customize-control-onepress_gallery_settings_"+v+"']").show(); + } ); + $( 'select[data-customize-setting-link="onepress_gallery_source"]').trigger( 'on_custom_load' ); + + /** + * For Gallery display settings + */ + $( 'select[data-customize-setting-link="onepress_gallery_display"]').on( 'change on_custom_load', function(){ + var v = $( this).val() || ''; + switch ( v ) { + case 'slider': + $( "#customize-control-onepress_g_row_height, #customize-control-onepress_g_col, #customize-control-onepress_g_spacing").hide(); + break; + case 'justified': + $( "#customize-control-onepress_g_col, #customize-control-onepress_g_spacing").hide(); + $( "#customize-control-onepress_g_row_height").show(); + break; + case 'carousel': + $( "#customize-control-onepress_g_row_height, #customize-control-onepress_g_col").hide(); + $( "#customize-control-onepress_g_col, #customize-control-onepress_g_spacing").show(); + break; + case 'masonry': + $( "#customize-control-onepress_g_row_height").hide(); + $( "#customize-control-onepress_g_col, #customize-control-onepress_g_spacing").show(); + break; + default: + $( "#customize-control-onepress_g_row_height").hide(); + $( "#customize-control-onepress_g_col, #customize-control-onepress_g_spacing").show(); -jQuery( window ).ready( function( $ ){ - if ( typeof onepress_customizer_settings !== "undefined" ) { - if (onepress_customizer_settings.number_action > 0) { - $('.control-section-themes h3.accordion-section-title').append('' + onepress_customizer_settings.number_action + ''); } - } - /** - * For Hero layout content settings - */ - $( 'select[data-customize-setting-link="onepress_hero_layout"]').on( 'change on_custom_load', function(){ - var v = $( this).val() || ''; + } ); + $( 'select[data-customize-setting-link="onepress_gallery_display"]').trigger( 'on_custom_load' ); + +} ); + - $( "li[id^='customize-control-onepress_hcl']").hide(); - $( "li[id^='customize-control-onepress_hcl"+v+"']").show(); - } ); - $( 'select[data-customize-setting-link="onepress_hero_layout"]').trigger( 'on_custom_load' ); -} ); /** * Icon picker diff --git a/assets/js/lightgallery.js b/assets/js/lightgallery.js index 4301fb3..5c310d0 100755 --- a/assets/js/lightgallery.js +++ b/assets/js/lightgallery.js @@ -1,1337 +1,1648 @@ -/*! lightgallery - v1.3.3 - 2016-09-24 -* http://sachinchoolur.github.io/lightGallery/ -* Copyright (c) 2016 Sachin N; Licensed Apache 2.0 */ +/*! lightgallery - v1.3.9 - 2017-02-05 + * http://sachinchoolur.github.io/lightGallery/ + * Copyright (c) 2017 Sachin N; Licensed GPLv3 */ (function (root, factory) { - if (typeof define === 'function' && define.amd) { - // AMD. Register as an anonymous module unless amdModuleId is set - define(["jquery"], function (a0) { - return (factory(a0)); - }); - } else if (typeof exports === 'object') { - // Node. Does not work with strict CommonJS, but - // only CommonJS-like environments that support module.exports, - // like Node. - module.exports = factory(require("jquery")); - } else { - factory(jQuery); - } -}(this, function (jquery) { - - -(function( $ ){ - 'use strict'; - - var defaults = { - - mode: 'lg-slide', - - // Ex : 'ease' - cssEasing: 'ease', - - //'for jquery animation' - easing: 'linear', - speed: 600, - height: '100%', - width: '100%', - addClass: '', - startClass: 'lg-start-zoom', - backdropDuration: 150, - hideBarsDelay: 6000, - - useLeft: false, - - closable: true, - loop: true, - escKey: true, - keyPress: true, - controls: true, - slideEndAnimatoin: true, - hideControlOnEnd: false, - mousewheel: true, - - getCaptionFromTitleOrAlt: true, - - // .lg-item || '.lg-sub-html' - appendSubHtmlTo: '.lg-sub-html', - - subHtmlSelectorRelative: false, - - /** - * @desc number of preload slides - * will exicute only after the current slide is fully loaded. - * - * @ex you clicked on 4th image and if preload = 1 then 3rd slide and 5th - * slide will be loaded in the background after the 4th slide is fully loaded.. - * if preload is 2 then 2nd 3rd 5th 6th slides will be preloaded.. ... ... - * - */ - preload: 1, - showAfterLoad: true, - selector: '', - selectWithin: '', - nextHtml: '', - prevHtml: '', - - // 0, 1 - index: false, - - iframeMaxWidth: '100%', - - download: true, - counter: true, - appendCounterTo: '.lg-toolbar', - - swipeThreshold: 50, - enableSwipe: true, - enableDrag: true, - - dynamic: false, - dynamicEl: [], - galleryId: 1 - }; + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module unless amdModuleId is set + define(['jquery'], function (a0) { + return (factory(a0)); + }); + } else if (typeof exports === 'object') { + // Node. Does not work with strict CommonJS, but + // only CommonJS-like environments that support module.exports, + // like Node. + module.exports = factory(require('jquery')); + } else { + factory(root["jQuery"]); + } +}(this, function ($) { + + (function() { + 'use strict'; + + var defaults = { + + mode: 'lg-slide', + + // Ex : 'ease' + cssEasing: 'ease', + + //'for jquery animation' + easing: 'linear', + speed: 600, + height: '100%', + width: '100%', + addClass: '', + startClass: 'lg-start-zoom', + backdropDuration: 150, + hideBarsDelay: 6000, + + useLeft: false, + + closable: true, + loop: true, + escKey: true, + keyPress: true, + controls: true, + slideEndAnimatoin: true, + hideControlOnEnd: false, + mousewheel: true, + + getCaptionFromTitleOrAlt: true, + + // .lg-item || '.lg-sub-html' + appendSubHtmlTo: '.lg-sub-html', + + subHtmlSelectorRelative: false, + + /** + * @desc number of preload slides + * will exicute only after the current slide is fully loaded. + * + * @ex you clicked on 4th image and if preload = 1 then 3rd slide and 5th + * slide will be loaded in the background after the 4th slide is fully loaded.. + * if preload is 2 then 2nd 3rd 5th 6th slides will be preloaded.. ... ... + * + */ + preload: 1, + showAfterLoad: true, + selector: '', + selectWithin: '', + nextHtml: '', + prevHtml: '', + + // 0, 1 + index: false, + + iframeMaxWidth: '100%', + + download: true, + counter: true, + appendCounterTo: '.lg-toolbar', + + swipeThreshold: 50, + enableSwipe: true, + enableDrag: true, + + dynamic: false, + dynamicEl: [], + galleryId: 1 + }; - function Plugin(element, options) { + function Plugin(element, options) { - // Current lightGallery element - this.el = element; + // Current lightGallery element + this.el = element; - // Current jquery element - this.$el = $(element); + // Current jquery element + this.$el = $(element); - // lightGallery settings - this.s = $.extend({}, defaults, options); + // lightGallery settings + this.s = $.extend({}, defaults, options); - // When using dynamic mode, ensure dynamicEl is an array - if (this.s.dynamic && this.s.dynamicEl !== 'undefined' && this.s.dynamicEl.constructor === Array && !this.s.dynamicEl.length) { - throw ('When using dynamic mode, you must also define dynamicEl as an Array.'); - } + // When using dynamic mode, ensure dynamicEl is an array + if (this.s.dynamic && this.s.dynamicEl !== 'undefined' && this.s.dynamicEl.constructor === Array && !this.s.dynamicEl.length) { + throw ('When using dynamic mode, you must also define dynamicEl as an Array.'); + } - // lightGallery modules - this.modules = {}; + // lightGallery modules + this.modules = {}; - // false when lightgallery complete first slide; - this.lGalleryOn = false; + // false when lightgallery complete first slide; + this.lGalleryOn = false; - this.lgBusy = false; + this.lgBusy = false; - // Timeout function for hiding controls; - this.hideBartimeout = false; + // Timeout function for hiding controls; + this.hideBartimeout = false; - // To determine browser supports for touch events; - this.isTouch = ('ontouchstart' in document.documentElement); + // To determine browser supports for touch events; + this.isTouch = ('ontouchstart' in document.documentElement); - // Disable hideControlOnEnd if sildeEndAnimation is true - if (this.s.slideEndAnimatoin) { - this.s.hideControlOnEnd = false; - } + // Disable hideControlOnEnd if sildeEndAnimation is true + if (this.s.slideEndAnimatoin) { + this.s.hideControlOnEnd = false; + } - // Gallery items - if (this.s.dynamic) { - this.$items = this.s.dynamicEl; - } else { - if (this.s.selector === 'this') { - this.$items = this.$el; - } else if (this.s.selector !== '') { - if (this.s.selectWithin) { - this.$items = $(this.s.selectWithin).find(this.s.selector); + // Gallery items + if (this.s.dynamic) { + this.$items = this.s.dynamicEl; + } else { + if (this.s.selector === 'this') { + this.$items = this.$el; + } else if (this.s.selector !== '') { + if (this.s.selectWithin) { + this.$items = $(this.s.selectWithin).find(this.s.selector); + } else { + this.$items = this.$el.find($(this.s.selector)); + } } else { - this.$items = this.$el.find($(this.s.selector)); + this.$items = this.$el.children(); } - } else { - this.$items = this.$el.children(); } - } - - // .lg-item - this.$slide = ''; - - // .lg-outer - this.$outer = ''; - this.init(); - - return this; - } + // .lg-item + this.$slide = ''; - Plugin.prototype.init = function() { + // .lg-outer + this.$outer = ''; - var _this = this; + this.init(); - // s.preload should not be more than $item.length - if (_this.s.preload > _this.$items.length) { - _this.s.preload = _this.$items.length; + return this; } - // if dynamic option is enabled execute immediately - var _hash = window.location.hash; - if (_hash.indexOf('lg=' + this.s.galleryId) > 0) { + Plugin.prototype.init = function() { - _this.index = parseInt(_hash.split('&slide=')[1], 10); + var _this = this; - $('body').addClass('lg-from-hash'); - if (!$('body').hasClass('lg-on')) { - setTimeout(function() { - _this.build(_this.index); - }); - $('body').addClass('lg-on'); + // s.preload should not be more than $item.length + if (_this.s.preload > _this.$items.length) { + _this.s.preload = _this.$items.length; } - } - if (_this.s.dynamic) { + // if dynamic option is enabled execute immediately + var _hash = window.location.hash; + if (_hash.indexOf('lg=' + this.s.galleryId) > 0) { - _this.$el.trigger('onBeforeOpen.lg'); + _this.index = parseInt(_hash.split('&slide=')[1], 10); - _this.index = _this.s.index || 0; + $('body').addClass('lg-from-hash'); + if (!$('body').hasClass('lg-on')) { + setTimeout(function() { + _this.build(_this.index); + }); - // prevent accidental double execution - if (!$('body').hasClass('lg-on')) { - setTimeout(function() { - _this.build(_this.index); $('body').addClass('lg-on'); - }); + } } - } else { - - // Using different namespace for click because click event should not unbind if selector is same object('this') - _this.$items.on('click.lgcustom', function(event) { - // For IE8 - try { - event.preventDefault(); - event.preventDefault(); - } catch (er) { - event.returnValue = false; - } + if (_this.s.dynamic) { _this.$el.trigger('onBeforeOpen.lg'); - _this.index = _this.s.index || _this.$items.index(this); + _this.index = _this.s.index || 0; // prevent accidental double execution if (!$('body').hasClass('lg-on')) { - _this.build(_this.index); - $('body').addClass('lg-on'); + setTimeout(function() { + _this.build(_this.index); + $('body').addClass('lg-on'); + }); } - }); - } + } else { - }; + // Using different namespace for click because click event should not unbind if selector is same object('this') + _this.$items.on('click.lgcustom', function(event) { - Plugin.prototype.build = function(index) { + // For IE8 + try { + event.preventDefault(); + event.preventDefault(); + } catch (er) { + event.returnValue = false; + } - var _this = this; + _this.$el.trigger('onBeforeOpen.lg'); - _this.structure(); + _this.index = _this.s.index || _this.$items.index(this); - // module constructor - $.each($.fn.lightGallery.modules, function(key) { - _this.modules[key] = new $.fn.lightGallery.modules[key](_this.el); - }); + // prevent accidental double execution + if (!$('body').hasClass('lg-on')) { + _this.build(_this.index); + $('body').addClass('lg-on'); + } + }); + } + + }; - // initiate slide function - _this.slide(index, false, false); + Plugin.prototype.build = function(index) { - if (_this.s.keyPress) { - _this.keyPress(); - } + var _this = this; - if (_this.$items.length > 1) { + _this.structure(); - _this.arrow(); + // module constructor + $.each($.fn.lightGallery.modules, function(key) { + _this.modules[key] = new $.fn.lightGallery.modules[key](_this.el); + }); - setTimeout(function() { - _this.enableDrag(); - _this.enableSwipe(); - }, 50); + // initiate slide function + _this.slide(index, false, false, false); - if (_this.s.mousewheel) { - _this.mousewheel(); + if (_this.s.keyPress) { + _this.keyPress(); } - } - _this.counter(); + if (_this.$items.length > 1) { - _this.closeGallery(); + _this.arrow(); - _this.$el.trigger('onAfterOpen.lg'); + setTimeout(function() { + _this.enableDrag(); + _this.enableSwipe(); + }, 50); - // Hide controllers if mouse doesn't move for some period - _this.$outer.on('mousemove.lg click.lg touchstart.lg', function() { + if (_this.s.mousewheel) { + _this.mousewheel(); + } + } - _this.$outer.removeClass('lg-hide-items'); + _this.counter(); - clearTimeout(_this.hideBartimeout); + _this.closeGallery(); - // Timeout will be cleared on each slide movement also - _this.hideBartimeout = setTimeout(function() { - _this.$outer.addClass('lg-hide-items'); - }, _this.s.hideBarsDelay); + _this.$el.trigger('onAfterOpen.lg'); - }); + // Hide controllers if mouse doesn't move for some period + _this.$outer.on('mousemove.lg click.lg touchstart.lg', function() { - }; + _this.$outer.removeClass('lg-hide-items'); - Plugin.prototype.structure = function() { - var list = ''; - var controls = ''; - var i = 0; - var subHtmlCont = ''; - var template; - var _this = this; + clearTimeout(_this.hideBartimeout); - $('body').append('

'); - $('.lg-backdrop').css('transition-duration', this.s.backdropDuration + 'ms'); + // Timeout will be cleared on each slide movement also + _this.hideBartimeout = setTimeout(function() { + _this.$outer.addClass('lg-hide-items'); + }, _this.s.hideBarsDelay); - // Create gallery items - for (i = 0; i < this.$items.length; i++) { - list += '
'; - } + }); - // Create controlls - if (this.s.controls && this.$items.length > 1) { - controls = '
' + - '
' + this.s.prevHtml + '
' + - '
' + this.s.nextHtml + '
' + - '
'; - } + _this.$outer.trigger('mousemove.lg'); - if (this.s.appendSubHtmlTo === '.lg-sub-html') { - subHtmlCont = '
'; - } + }; - template = '
' + - '
' + - '
' + list + '
' + - '
' + - '' + - '
' + - controls + - subHtmlCont + - '
' + - '
'; - - $('body').append(template); - this.$outer = $('.lg-outer'); - this.$slide = this.$outer.find('.lg-item'); - - if (this.s.useLeft) { - this.$outer.addClass('lg-use-left'); - - // Set mode lg-slide if use left is true; - this.s.mode = 'lg-slide'; - } else { - this.$outer.addClass('lg-use-css3'); - } + Plugin.prototype.structure = function() { + var list = ''; + var controls = ''; + var i = 0; + var subHtmlCont = ''; + var template; + var _this = this; - // For fixed height gallery - _this.setTop(); - $(window).on('resize.lg orientationchange.lg', function() { - setTimeout(function() { - _this.setTop(); - }, 100); - }); + $('body').append('
'); + $('.lg-backdrop').css('transition-duration', this.s.backdropDuration + 'ms'); - // add class lg-current to remove initial transition - this.$slide.eq(this.index).addClass('lg-current'); + // Create gallery items + for (i = 0; i < this.$items.length; i++) { + list += '
'; + } - // add Class for css support and transition mode - if (this.doCss()) { - this.$outer.addClass('lg-css3'); - } else { - this.$outer.addClass('lg-css'); + // Create controlls + if (this.s.controls && this.$items.length > 1) { + controls = '
' + + '
' + this.s.prevHtml + '
' + + '
' + this.s.nextHtml + '
' + + '
'; + } - // Set speed 0 because no animation will happen if browser doesn't support css3 - this.s.speed = 0; - } + if (this.s.appendSubHtmlTo === '.lg-sub-html') { + subHtmlCont = '
'; + } - this.$outer.addClass(this.s.mode); + template = '
' + + '
' + + '
' + list + '
' + + '
' + + '' + + '
' + + controls + + subHtmlCont + + '
' + + '
'; - if (this.s.enableDrag && this.$items.length > 1) { - this.$outer.addClass('lg-grab'); - } + $('body').append(template); + this.$outer = $('.lg-outer'); + this.$slide = this.$outer.find('.lg-item'); - if (this.s.showAfterLoad) { - this.$outer.addClass('lg-show-after-load'); - } + if (this.s.useLeft) { + this.$outer.addClass('lg-use-left'); - if (this.doCss()) { - var $inner = this.$outer.find('.lg-inner'); - $inner.css('transition-timing-function', this.s.cssEasing); - $inner.css('transition-duration', this.s.speed + 'ms'); - } + // Set mode lg-slide if use left is true; + this.s.mode = 'lg-slide'; + } else { + this.$outer.addClass('lg-use-css3'); + } - $('.lg-backdrop').addClass('in'); + // For fixed height gallery + _this.setTop(); + $(window).on('resize.lg orientationchange.lg', function() { + setTimeout(function() { + _this.setTop(); + }, 100); + }); - setTimeout(function() { - _this.$outer.addClass('lg-visible'); - }, this.s.backdropDuration); + // add class lg-current to remove initial transition + this.$slide.eq(this.index).addClass('lg-current'); - if (this.s.download) { - this.$outer.find('.lg-toolbar').append(''); - } + // add Class for css support and transition mode + if (this.doCss()) { + this.$outer.addClass('lg-css3'); + } else { + this.$outer.addClass('lg-css'); - // Store the current scroll top value to scroll back after closing the gallery.. - this.prevScrollTop = $(window).scrollTop(); + // Set speed 0 because no animation will happen if browser doesn't support css3 + this.s.speed = 0; + } - }; + this.$outer.addClass(this.s.mode); - // For fixed height gallery - Plugin.prototype.setTop = function() { - if (this.s.height !== '100%') { - var wH = $(window).height(); - var top = (wH - parseInt(this.s.height, 10)) / 2; - var $lGallery = this.$outer.find('.lg'); - if (wH >= parseInt(this.s.height, 10)) { - $lGallery.css('top', top + 'px'); - } else { - $lGallery.css('top', '0px'); + if (this.s.enableDrag && this.$items.length > 1) { + this.$outer.addClass('lg-grab'); } - } - }; - // Find css3 support - Plugin.prototype.doCss = function() { - // check for css animation support - var support = function() { - var transition = ['transition', 'MozTransition', 'WebkitTransition', 'OTransition', 'msTransition', 'KhtmlTransition']; - var root = document.documentElement; - var i = 0; - for (i = 0; i < transition.length; i++) { - if (transition[i] in root.style) { - return true; - } + if (this.s.showAfterLoad) { + this.$outer.addClass('lg-show-after-load'); } - }; - - if (support()) { - return true; - } - return false; - }; + if (this.doCss()) { + var $inner = this.$outer.find('.lg-inner'); + $inner.css('transition-timing-function', this.s.cssEasing); + $inner.css('transition-duration', this.s.speed + 'ms'); + } - /** - * @desc Check the given src is video - * @param {String} src - * @return {Object} video type - * Ex:{ youtube : ["//www.youtube.com/watch?v=c0asJgSyxcY", "c0asJgSyxcY"] } - */ - Plugin.prototype.isVideo = function(src, index) { - - var html; - if (this.s.dynamic) { - html = this.s.dynamicEl[index].html; - } else { - html = this.$items.eq(index).attr('data-html'); - } + setTimeout(function() { + $('.lg-backdrop').addClass('in'); + }); - if (!src && html) { - return { - html5: true - }; - } + setTimeout(function() { + _this.$outer.addClass('lg-visible'); + }, this.s.backdropDuration); - var youtube = src.match(/\/\/(?:www\.)?youtu(?:\.be|be\.com)\/(?:watch\?v=|embed\/)?([a-z0-9\-\_\%]+)/i); - var vimeo = src.match(/\/\/(?:www\.)?vimeo.com\/([0-9a-z\-_]+)/i); - var dailymotion = src.match(/\/\/(?:www\.)?dai.ly\/([0-9a-z\-_]+)/i); - var vk = src.match(/\/\/(?:www\.)?(?:vk\.com|vkontakte\.ru)\/(?:video_ext\.php\?)(.*)/i); + if (this.s.download) { + this.$outer.find('.lg-toolbar').append(''); + } - if (youtube) { - return { - youtube: youtube - }; - } else if (vimeo) { - return { - vimeo: vimeo - }; - } else if (dailymotion) { - return { - dailymotion: dailymotion - }; - } else if (vk) { - return { - vk: vk - }; - } - }; + // Store the current scroll top value to scroll back after closing the gallery.. + this.prevScrollTop = $(window).scrollTop(); - /** - * @desc Create image counter - * Ex: 1/10 - */ - Plugin.prototype.counter = function() { - if (this.s.counter) { - $(this.s.appendCounterTo).append('
' + (parseInt(this.index, 10) + 1) + ' / ' + this.$items.length + '
'); - } - }; + }; - /** - * @desc add sub-html into the slide - * @param {Number} index - index of the slide - */ - Plugin.prototype.addHtml = function(index) { - var subHtml = null; - var subHtmlUrl; - var $currentEle; - if (this.s.dynamic) { - if (this.s.dynamicEl[index].subHtmlUrl) { - subHtmlUrl = this.s.dynamicEl[index].subHtmlUrl; - } else { - subHtml = this.s.dynamicEl[index].subHtml; - } - } else { - $currentEle = this.$items.eq(index); - if ($currentEle.attr('data-sub-html-url')) { - subHtmlUrl = $currentEle.attr('data-sub-html-url'); - } else { - subHtml = $currentEle.attr('data-sub-html'); - if (this.s.getCaptionFromTitleOrAlt && !subHtml) { - subHtml = $currentEle.attr('title') || $currentEle.find('img').first().attr('alt'); + // For fixed height gallery + Plugin.prototype.setTop = function() { + if (this.s.height !== '100%') { + var wH = $(window).height(); + var top = (wH - parseInt(this.s.height, 10)) / 2; + var $lGallery = this.$outer.find('.lg'); + if (wH >= parseInt(this.s.height, 10)) { + $lGallery.css('top', top + 'px'); + } else { + $lGallery.css('top', '0px'); } } - } - - if (!subHtmlUrl) { - if (typeof subHtml !== 'undefined' && subHtml !== null) { + }; - // get first letter of subhtml - // if first letter starts with . or # get the html form the jQuery object - var fL = subHtml.substring(0, 1); - if (fL === '.' || fL === '#') { - if (this.s.subHtmlSelectorRelative && !this.s.dynamic) { - subHtml = $currentEle.find(subHtml).html(); - } else { - subHtml = $(subHtml).html(); + // Find css3 support + Plugin.prototype.doCss = function() { + // check for css animation support + var support = function() { + var transition = ['transition', 'MozTransition', 'WebkitTransition', 'OTransition', 'msTransition', 'KhtmlTransition']; + var root = document.documentElement; + var i = 0; + for (i = 0; i < transition.length; i++) { + if (transition[i] in root.style) { + return true; } } - } else { - subHtml = ''; - } - } - - if (this.s.appendSubHtmlTo === '.lg-sub-html') { + }; - if (subHtmlUrl) { - this.$outer.find(this.s.appendSubHtmlTo).load(subHtmlUrl); - } else { - this.$outer.find(this.s.appendSubHtmlTo).html(subHtml); + if (support()) { + return true; } - } else { + return false; + }; - if (subHtmlUrl) { - this.$slide.eq(index).load(subHtmlUrl); - } else { - this.$slide.eq(index).append(subHtml); - } - } + /** + * @desc Check the given src is video + * @param {String} src + * @return {Object} video type + * Ex:{ youtube : ["//www.youtube.com/watch?v=c0asJgSyxcY", "c0asJgSyxcY"] } + */ + Plugin.prototype.isVideo = function(src, index) { - // Add lg-empty-html class if title doesn't exist - if (typeof subHtml !== 'undefined' && subHtml !== null) { - if (subHtml === '') { - this.$outer.find(this.s.appendSubHtmlTo).addClass('lg-empty-html'); + var html; + if (this.s.dynamic) { + html = this.s.dynamicEl[index].html; } else { - this.$outer.find(this.s.appendSubHtmlTo).removeClass('lg-empty-html'); + html = this.$items.eq(index).attr('data-html'); } - } - this.$el.trigger('onAfterAppendSubHtml.lg', [index]); - }; + if (!src && html) { + return { + html5: true + }; + } - /** - * @desc Preload slides - * @param {Number} index - index of the slide - */ - Plugin.prototype.preload = function(index) { - var i = 1; - var j = 1; - for (i = 1; i <= this.s.preload; i++) { - if (i >= this.$items.length - index) { - break; + var youtube = src.match(/\/\/(?:www\.)?youtu(?:\.be|be\.com)\/(?:watch\?v=|embed\/)?([a-z0-9\-\_\%]+)/i); + var vimeo = src.match(/\/\/(?:www\.)?vimeo.com\/([0-9a-z\-_]+)/i); + var dailymotion = src.match(/\/\/(?:www\.)?dai.ly\/([0-9a-z\-_]+)/i); + var vk = src.match(/\/\/(?:www\.)?(?:vk\.com|vkontakte\.ru)\/(?:video_ext\.php\?)(.*)/i); + + if (youtube) { + return { + youtube: youtube + }; + } else if (vimeo) { + return { + vimeo: vimeo + }; + } else if (dailymotion) { + return { + dailymotion: dailymotion + }; + } else if (vk) { + return { + vk: vk + }; } + }; - this.loadContent(index + i, false, 0); - } + /** + * @desc Create image counter + * Ex: 1/10 + */ + Plugin.prototype.counter = function() { + if (this.s.counter) { + $(this.s.appendCounterTo).append('
' + (parseInt(this.index, 10) + 1) + ' / ' + this.$items.length + '
'); + } + }; - for (j = 1; j <= this.s.preload; j++) { - if (index - j < 0) { - break; + /** + * @desc add sub-html into the slide + * @param {Number} index - index of the slide + */ + Plugin.prototype.addHtml = function(index) { + var subHtml = null; + var subHtmlUrl; + var $currentEle; + if (this.s.dynamic) { + if (this.s.dynamicEl[index].subHtmlUrl) { + subHtmlUrl = this.s.dynamicEl[index].subHtmlUrl; + } else { + subHtml = this.s.dynamicEl[index].subHtml; + } + } else { + $currentEle = this.$items.eq(index); + if ($currentEle.attr('data-sub-html-url')) { + subHtmlUrl = $currentEle.attr('data-sub-html-url'); + } else { + subHtml = $currentEle.attr('data-sub-html'); + if (this.s.getCaptionFromTitleOrAlt && !subHtml) { + subHtml = $currentEle.attr('title') || $currentEle.find('img').first().attr('alt'); + } + } } - this.loadContent(index - j, false, 0); - } - }; + if (!subHtmlUrl) { + if (typeof subHtml !== 'undefined' && subHtml !== null) { + + // get first letter of subhtml + // if first letter starts with . or # get the html form the jQuery object + var fL = subHtml.substring(0, 1); + if (fL === '.' || fL === '#') { + if (this.s.subHtmlSelectorRelative && !this.s.dynamic) { + subHtml = $currentEle.find(subHtml).html(); + } else { + subHtml = $(subHtml).html(); + } + } + } else { + subHtml = ''; + } + } - /** - * @desc Load slide content into slide. - * @param {Number} index - index of the slide. - * @param {Boolean} rec - if true call loadcontent() function again. - * @param {Boolean} delay - delay for adding complete class. it is 0 except first time. - */ - Plugin.prototype.loadContent = function(index, rec, delay) { + if (this.s.appendSubHtmlTo === '.lg-sub-html') { - var _this = this; - var _hasPoster = false; - var _$img; - var _src; - var _poster; - var _srcset; - var _sizes; - var _html; - var getResponsiveSrc = function(srcItms) { - var rsWidth = []; - var rsSrc = []; - for (var i = 0; i < srcItms.length; i++) { - var __src = srcItms[i].split(' '); - - // Manage empty space - if (__src[0] === '') { - __src.splice(0, 1); + if (subHtmlUrl) { + this.$outer.find(this.s.appendSubHtmlTo).load(subHtmlUrl); + } else { + this.$outer.find(this.s.appendSubHtmlTo).html(subHtml); } - rsSrc.push(__src[0]); - rsWidth.push(__src[1]); + } else { + + if (subHtmlUrl) { + this.$slide.eq(index).load(subHtmlUrl); + } else { + this.$slide.eq(index).append(subHtml); + } } - var wWidth = $(window).width(); - for (var j = 0; j < rsWidth.length; j++) { - if (parseInt(rsWidth[j], 10) > wWidth) { - _src = rsSrc[j]; - break; + // Add lg-empty-html class if title doesn't exist + if (typeof subHtml !== 'undefined' && subHtml !== null) { + if (subHtml === '') { + this.$outer.find(this.s.appendSubHtmlTo).addClass('lg-empty-html'); + } else { + this.$outer.find(this.s.appendSubHtmlTo).removeClass('lg-empty-html'); } } + + this.$el.trigger('onAfterAppendSubHtml.lg', [index]); }; - if (_this.s.dynamic) { + /** + * @desc Preload slides + * @param {Number} index - index of the slide + */ + Plugin.prototype.preload = function(index) { + var i = 1; + var j = 1; + for (i = 1; i <= this.s.preload; i++) { + if (i >= this.$items.length - index) { + break; + } - if (_this.s.dynamicEl[index].poster) { - _hasPoster = true; - _poster = _this.s.dynamicEl[index].poster; + this.loadContent(index + i, false, 0); } - _html = _this.s.dynamicEl[index].html; - _src = _this.s.dynamicEl[index].src; + for (j = 1; j <= this.s.preload; j++) { + if (index - j < 0) { + break; + } - if (_this.s.dynamicEl[index].responsive) { - var srcDyItms = _this.s.dynamicEl[index].responsive.split(','); - getResponsiveSrc(srcDyItms); + this.loadContent(index - j, false, 0); } + }; - _srcset = _this.s.dynamicEl[index].srcset; - _sizes = _this.s.dynamicEl[index].sizes; + /** + * @desc Load slide content into slide. + * @param {Number} index - index of the slide. + * @param {Boolean} rec - if true call loadcontent() function again. + * @param {Boolean} delay - delay for adding complete class. it is 0 except first time. + */ + Plugin.prototype.loadContent = function(index, rec, delay) { + + var _this = this; + var _hasPoster = false; + var _$img; + var _src; + var _poster; + var _srcset; + var _sizes; + var _html; + var getResponsiveSrc = function(srcItms) { + var rsWidth = []; + var rsSrc = []; + for (var i = 0; i < srcItms.length; i++) { + var __src = srcItms[i].split(' '); + + // Manage empty space + if (__src[0] === '') { + __src.splice(0, 1); + } - } else { + rsSrc.push(__src[0]); + rsWidth.push(__src[1]); + } - if (_this.$items.eq(index).attr('data-poster')) { - _hasPoster = true; - _poster = _this.$items.eq(index).attr('data-poster'); - } + var wWidth = $(window).width(); + for (var j = 0; j < rsWidth.length; j++) { + if (parseInt(rsWidth[j], 10) > wWidth) { + _src = rsSrc[j]; + break; + } + } + }; - _html = _this.$items.eq(index).attr('data-html'); - _src = _this.$items.eq(index).attr('href') || _this.$items.eq(index).attr('data-src'); + if (_this.s.dynamic) { - if (_this.$items.eq(index).attr('data-responsive')) { - var srcItms = _this.$items.eq(index).attr('data-responsive').split(','); - getResponsiveSrc(srcItms); - } + if (_this.s.dynamicEl[index].poster) { + _hasPoster = true; + _poster = _this.s.dynamicEl[index].poster; + } - _srcset = _this.$items.eq(index).attr('data-srcset'); - _sizes = _this.$items.eq(index).attr('data-sizes'); + _html = _this.s.dynamicEl[index].html; + _src = _this.s.dynamicEl[index].src; - } + if (_this.s.dynamicEl[index].responsive) { + var srcDyItms = _this.s.dynamicEl[index].responsive.split(','); + getResponsiveSrc(srcDyItms); + } - //if (_src || _srcset || _sizes || _poster) { + _srcset = _this.s.dynamicEl[index].srcset; + _sizes = _this.s.dynamicEl[index].sizes; - var iframe = false; - if (_this.s.dynamic) { - if (_this.s.dynamicEl[index].iframe) { - iframe = true; - } - } else { - if (_this.$items.eq(index).attr('data-iframe') === 'true') { - iframe = true; - } - } + } else { - var _isVideo = _this.isVideo(_src, index); - if (!_this.$slide.eq(index).hasClass('lg-loaded')) { - if (iframe) { - _this.$slide.eq(index).prepend('
'); - } else if (_hasPoster) { - var videoClass = ''; - if (_isVideo && _isVideo.youtube) { - videoClass = 'lg-has-youtube'; - } else if (_isVideo && _isVideo.vimeo) { - videoClass = 'lg-has-vimeo'; - } else { - videoClass = 'lg-has-html5'; + if (_this.$items.eq(index).attr('data-poster')) { + _hasPoster = true; + _poster = _this.$items.eq(index).attr('data-poster'); } - _this.$slide.eq(index).prepend('
'); + _html = _this.$items.eq(index).attr('data-html'); + _src = _this.$items.eq(index).attr('href') || _this.$items.eq(index).attr('data-src'); - } else if (_isVideo) { - _this.$slide.eq(index).prepend('
'); - _this.$el.trigger('hasVideo.lg', [index, _src, _html]); - } else { - _this.$slide.eq(index).prepend('
'); - } + if (_this.$items.eq(index).attr('data-responsive')) { + var srcItms = _this.$items.eq(index).attr('data-responsive').split(','); + getResponsiveSrc(srcItms); + } - _this.$el.trigger('onAferAppendSlide.lg', [index]); + _srcset = _this.$items.eq(index).attr('data-srcset'); + _sizes = _this.$items.eq(index).attr('data-sizes'); - _$img = _this.$slide.eq(index).find('.lg-object'); - if (_sizes) { - _$img.attr('sizes', _sizes); } - if (_srcset) { - _$img.attr('srcset', _srcset); - try { - picturefill({ - elements: [_$img[0]] - }); - } catch (e) { - console.error('Make sure you have included Picturefill version 2'); - } - } + //if (_src || _srcset || _sizes || _poster) { - if (this.s.appendSubHtmlTo !== '.lg-sub-html') { - _this.addHtml(index); + var iframe = false; + if (_this.s.dynamic) { + if (_this.s.dynamicEl[index].iframe) { + iframe = true; + } + } else { + if (_this.$items.eq(index).attr('data-iframe') === 'true') { + iframe = true; + } } - _this.$slide.eq(index).addClass('lg-loaded'); - } + var _isVideo = _this.isVideo(_src, index); + if (!_this.$slide.eq(index).hasClass('lg-loaded')) { + if (iframe) { + _this.$slide.eq(index).prepend('
'); + } else if (_hasPoster) { + var videoClass = ''; + if (_isVideo && _isVideo.youtube) { + videoClass = 'lg-has-youtube'; + } else if (_isVideo && _isVideo.vimeo) { + videoClass = 'lg-has-vimeo'; + } else { + videoClass = 'lg-has-html5'; + } - _this.$slide.eq(index).find('.lg-object').on('load.lg error.lg', function() { + _this.$slide.eq(index).prepend('
'); - // For first time add some delay for displaying the start animation. - var _speed = 0; + } else if (_isVideo) { + _this.$slide.eq(index).prepend('
'); + _this.$el.trigger('hasVideo.lg', [index, _src, _html]); + } else { + _this.$slide.eq(index).prepend('
'); + } - // Do not change the delay value because it is required for zoom plugin. - // If gallery opened from direct url (hash) speed value should be 0 - if (delay && !$('body').hasClass('lg-from-hash')) { - _speed = delay; - } + _this.$el.trigger('onAferAppendSlide.lg', [index]); - setTimeout(function() { - _this.$slide.eq(index).addClass('lg-complete'); - _this.$el.trigger('onSlideItemLoad.lg', [index, delay || 0]); - }, _speed); + _$img = _this.$slide.eq(index).find('.lg-object'); + if (_sizes) { + _$img.attr('sizes', _sizes); + } - }); + if (_srcset) { + _$img.attr('srcset', _srcset); + try { + picturefill({ + elements: [_$img[0]] + }); + } catch (e) { + console.error('Make sure you have included Picturefill version 2'); + } + } - // @todo check load state for html5 videos - if (_isVideo && _isVideo.html5 && !_hasPoster) { - _this.$slide.eq(index).addClass('lg-complete'); - } + if (this.s.appendSubHtmlTo !== '.lg-sub-html') { + _this.addHtml(index); + } - if (rec === true) { - if (!_this.$slide.eq(index).hasClass('lg-complete')) { - _this.$slide.eq(index).find('.lg-object').on('load.lg error.lg', function() { - _this.preload(index); - }); - } else { - _this.preload(index); + _this.$slide.eq(index).addClass('lg-loaded'); } - } - //} - }; + _this.$slide.eq(index).find('.lg-object').on('load.lg error.lg', function() { - /** - * @desc slide function for lightgallery - ** Slide() gets call on start - ** ** Set lg.on true once slide() function gets called. - ** Call loadContent() on slide() function inside setTimeout - ** ** On first slide we do not want any animation like slide of fade - ** ** So on first slide( if lg.on if false that is first slide) loadContent() should start loading immediately - ** ** Else loadContent() should wait for the transition to complete. - ** ** So set timeout s.speed + 50 - <=> ** loadContent() will load slide content in to the particular slide - ** ** It has recursion (rec) parameter. if rec === true loadContent() will call preload() function. - ** ** preload will execute only when the previous slide is fully loaded (images iframe) - ** ** avoid simultaneous image load - <=> ** Preload() will check for s.preload value and call loadContent() again accoring to preload value - ** loadContent() <====> Preload(); - - * @param {Number} index - index of the slide - * @param {Boolean} fromTouch - true if slide function called via touch event or mouse drag - * @param {Boolean} fromThumb - true if slide function called via thumbnail click - */ - Plugin.prototype.slide = function(index, fromTouch, fromThumb) { - - var _prevIndex = this.$outer.find('.lg-current').index(); - var _this = this; - - // Prevent if multiple call - // Required for hsh plugin - if (_this.lGalleryOn && (_prevIndex === index)) { - return; - } + // For first time add some delay for displaying the start animation. + var _speed = 0; - var _length = this.$slide.length; - var _time = _this.lGalleryOn ? this.s.speed : 0; - var _next = false; - var _prev = false; + // Do not change the delay value because it is required for zoom plugin. + // If gallery opened from direct url (hash) speed value should be 0 + if (delay && !$('body').hasClass('lg-from-hash')) { + _speed = delay; + } - if (!_this.lgBusy) { + setTimeout(function() { + _this.$slide.eq(index).addClass('lg-complete'); + _this.$el.trigger('onSlideItemLoad.lg', [index, delay || 0]); + }, _speed); - if (this.s.download) { - var _src; - if (_this.s.dynamic) { - _src = _this.s.dynamicEl[index].downloadUrl !== false && (_this.s.dynamicEl[index].downloadUrl || _this.s.dynamicEl[index].src); - } else { - _src = _this.$items.eq(index).attr('data-download-url') !== 'false' && (_this.$items.eq(index).attr('data-download-url') || _this.$items.eq(index).attr('href') || _this.$items.eq(index).attr('data-src')); + }); - } + // @todo check load state for html5 videos + if (_isVideo && _isVideo.html5 && !_hasPoster) { + _this.$slide.eq(index).addClass('lg-complete'); + } - if (_src) { - $('#lg-download').attr('href', _src); - _this.$outer.removeClass('lg-hide-download'); + if (rec === true) { + if (!_this.$slide.eq(index).hasClass('lg-complete')) { + _this.$slide.eq(index).find('.lg-object').on('load.lg error.lg', function() { + _this.preload(index); + }); } else { - _this.$outer.addClass('lg-hide-download'); + _this.preload(index); } } - this.$el.trigger('onBeforeSlide.lg', [_prevIndex, index, fromTouch, fromThumb]); - - _this.lgBusy = true; + //} + }; - clearTimeout(_this.hideBartimeout); + /** + * @desc slide function for lightgallery + ** Slide() gets call on start + ** ** Set lg.on true once slide() function gets called. + ** Call loadContent() on slide() function inside setTimeout + ** ** On first slide we do not want any animation like slide of fade + ** ** So on first slide( if lg.on if false that is first slide) loadContent() should start loading immediately + ** ** Else loadContent() should wait for the transition to complete. + ** ** So set timeout s.speed + 50 + <=> ** loadContent() will load slide content in to the particular slide + ** ** It has recursion (rec) parameter. if rec === true loadContent() will call preload() function. + ** ** preload will execute only when the previous slide is fully loaded (images iframe) + ** ** avoid simultaneous image load + <=> ** Preload() will check for s.preload value and call loadContent() again accoring to preload value + ** loadContent() <====> Preload(); + + * @param {Number} index - index of the slide + * @param {Boolean} fromTouch - true if slide function called via touch event or mouse drag + * @param {Boolean} fromThumb - true if slide function called via thumbnail click + * @param {String} direction - Direction of the slide(next/prev) + */ + Plugin.prototype.slide = function(index, fromTouch, fromThumb, direction) { - // Add title if this.s.appendSubHtmlTo === lg-sub-html - if (this.s.appendSubHtmlTo === '.lg-sub-html') { + var _prevIndex = this.$outer.find('.lg-current').index(); + var _this = this; - // wait for slide animation to complete - setTimeout(function() { - _this.addHtml(index); - }, _time); + // Prevent if multiple call + // Required for hsh plugin + if (_this.lGalleryOn && (_prevIndex === index)) { + return; } - this.arrowDisable(index); + var _length = this.$slide.length; + var _time = _this.lGalleryOn ? this.s.speed : 0; - if (!fromTouch) { + if (!_this.lgBusy) { - // remove all transitions - _this.$outer.addClass('lg-no-trans'); - - this.$slide.removeClass('lg-prev-slide lg-next-slide'); + if (this.s.download) { + var _src; + if (_this.s.dynamic) { + _src = _this.s.dynamicEl[index].downloadUrl !== false && (_this.s.dynamicEl[index].downloadUrl || _this.s.dynamicEl[index].src); + } else { + _src = _this.$items.eq(index).attr('data-download-url') !== 'false' && (_this.$items.eq(index).attr('data-download-url') || _this.$items.eq(index).attr('href') || _this.$items.eq(index).attr('data-src')); - if (index < _prevIndex) { - _prev = true; - if ((index === 0) && (_prevIndex === _length - 1) && !fromThumb) { - _prev = false; - _next = true; } - } else if (index > _prevIndex) { - _next = true; - if ((index === _length - 1) && (_prevIndex === 0) && !fromThumb) { - _prev = true; - _next = false; + + if (_src) { + $('#lg-download').attr('href', _src); + _this.$outer.removeClass('lg-hide-download'); + } else { + _this.$outer.addClass('lg-hide-download'); } } - if (_prev) { + this.$el.trigger('onBeforeSlide.lg', [_prevIndex, index, fromTouch, fromThumb]); + + _this.lgBusy = true; + + clearTimeout(_this.hideBartimeout); - //prevslide - this.$slide.eq(index).addClass('lg-prev-slide'); - this.$slide.eq(_prevIndex).addClass('lg-next-slide'); - } else if (_next) { + // Add title if this.s.appendSubHtmlTo === lg-sub-html + if (this.s.appendSubHtmlTo === '.lg-sub-html') { - // next slide - this.$slide.eq(index).addClass('lg-next-slide'); - this.$slide.eq(_prevIndex).addClass('lg-prev-slide'); + // wait for slide animation to complete + setTimeout(function() { + _this.addHtml(index); + }, _time); } - // give 50 ms for browser to add/remove class - setTimeout(function() { - _this.$slide.removeClass('lg-current'); + this.arrowDisable(index); - //_this.$slide.eq(_prevIndex).removeClass('lg-current'); - _this.$slide.eq(index).addClass('lg-current'); + if (!direction) { + if (index < _prevIndex) { + direction = 'prev'; + } else if (index > _prevIndex) { + direction = 'next'; + } + } - // reset all transitions - _this.$outer.removeClass('lg-no-trans'); - }, 50); - } else { + if (!fromTouch) { + + // remove all transitions + _this.$outer.addClass('lg-no-trans'); - var touchPrev = index - 1; - var touchNext = index + 1; + this.$slide.removeClass('lg-prev-slide lg-next-slide'); - if ((index === 0) && (_prevIndex === _length - 1)) { + if (direction === 'prev') { - // next slide - touchNext = 0; - touchPrev = _length - 1; - } else if ((index === _length - 1) && (_prevIndex === 0)) { + //prevslide + this.$slide.eq(index).addClass('lg-prev-slide'); + this.$slide.eq(_prevIndex).addClass('lg-next-slide'); + } else { + + // next slide + this.$slide.eq(index).addClass('lg-next-slide'); + this.$slide.eq(_prevIndex).addClass('lg-prev-slide'); + } + + // give 50 ms for browser to add/remove class + setTimeout(function() { + _this.$slide.removeClass('lg-current'); + + //_this.$slide.eq(_prevIndex).removeClass('lg-current'); + _this.$slide.eq(index).addClass('lg-current'); + + // reset all transitions + _this.$outer.removeClass('lg-no-trans'); + }, 50); + } else { - // prev slide - touchNext = 0; - touchPrev = _length - 1; + this.$slide.removeClass('lg-prev-slide lg-current lg-next-slide'); + var touchPrev; + var touchNext; + if (_length > 2) { + touchPrev = index - 1; + touchNext = index + 1; + + if ((index === 0) && (_prevIndex === _length - 1)) { + + // next slide + touchNext = 0; + touchPrev = _length - 1; + } else if ((index === _length - 1) && (_prevIndex === 0)) { + + // prev slide + touchNext = 0; + touchPrev = _length - 1; + } + + } else { + touchPrev = 0; + touchNext = 1; + } + + if (direction === 'prev') { + _this.$slide.eq(touchNext).addClass('lg-next-slide'); + } else { + _this.$slide.eq(touchPrev).addClass('lg-prev-slide'); + } + + _this.$slide.eq(index).addClass('lg-current'); } - this.$slide.removeClass('lg-prev-slide lg-current lg-next-slide'); - _this.$slide.eq(touchPrev).addClass('lg-prev-slide'); - _this.$slide.eq(touchNext).addClass('lg-next-slide'); - _this.$slide.eq(index).addClass('lg-current'); - } + if (_this.lGalleryOn) { + setTimeout(function() { + _this.loadContent(index, true, 0); + }, this.s.speed + 50); - if (_this.lGalleryOn) { - setTimeout(function() { - _this.loadContent(index, true, 0); - }, this.s.speed + 50); + setTimeout(function() { + _this.lgBusy = false; + _this.$el.trigger('onAfterSlide.lg', [_prevIndex, index, fromTouch, fromThumb]); + }, this.s.speed); + + } else { + _this.loadContent(index, true, _this.s.backdropDuration); - setTimeout(function() { _this.lgBusy = false; _this.$el.trigger('onAfterSlide.lg', [_prevIndex, index, fromTouch, fromThumb]); - }, this.s.speed); + } - } else { - _this.loadContent(index, true, _this.s.backdropDuration); + _this.lGalleryOn = true; - _this.lgBusy = false; - _this.$el.trigger('onAfterSlide.lg', [_prevIndex, index, fromTouch, fromThumb]); - } - - _this.lGalleryOn = true; + if (this.s.counter) { + $('#lg-counter-current').text(index + 1); + } - if (this.s.counter) { - $('#lg-counter-current').text(index + 1); } - } + }; - }; + /** + * @desc Go to next slide + * @param {Boolean} fromTouch - true if slide function called via touch event + */ + Plugin.prototype.goToNextSlide = function(fromTouch) { + var _this = this; + var _loop = _this.s.loop; + if (fromTouch && _this.$slide.length < 3) { + _loop = false; + } - /** - * @desc Go to next slide - * @param {Boolean} fromTouch - true if slide function called via touch event - */ - Plugin.prototype.goToNextSlide = function(fromTouch) { - var _this = this; - if (!_this.lgBusy) { - if ((_this.index + 1) < _this.$slide.length) { - _this.index++; - _this.$el.trigger('onBeforeNextSlide.lg', [_this.index]); - _this.slide(_this.index, fromTouch, false); - } else { - if (_this.s.loop) { - _this.index = 0; + if (!_this.lgBusy) { + if ((_this.index + 1) < _this.$slide.length) { + _this.index++; _this.$el.trigger('onBeforeNextSlide.lg', [_this.index]); - _this.slide(_this.index, fromTouch, false); - } else if (_this.s.slideEndAnimatoin) { - _this.$outer.addClass('lg-right-end'); - setTimeout(function() { - _this.$outer.removeClass('lg-right-end'); - }, 400); + _this.slide(_this.index, fromTouch, false, 'next'); + } else { + if (_loop) { + _this.index = 0; + _this.$el.trigger('onBeforeNextSlide.lg', [_this.index]); + _this.slide(_this.index, fromTouch, false, 'next'); + } else if (_this.s.slideEndAnimatoin && !fromTouch) { + _this.$outer.addClass('lg-right-end'); + setTimeout(function() { + _this.$outer.removeClass('lg-right-end'); + }, 400); + } } } - } - }; + }; - /** - * @desc Go to previous slide - * @param {Boolean} fromTouch - true if slide function called via touch event - */ - Plugin.prototype.goToPrevSlide = function(fromTouch) { - var _this = this; - if (!_this.lgBusy) { - if (_this.index > 0) { - _this.index--; - _this.$el.trigger('onBeforePrevSlide.lg', [_this.index, fromTouch]); - _this.slide(_this.index, fromTouch, false); - } else { - if (_this.s.loop) { - _this.index = _this.$items.length - 1; + /** + * @desc Go to previous slide + * @param {Boolean} fromTouch - true if slide function called via touch event + */ + Plugin.prototype.goToPrevSlide = function(fromTouch) { + var _this = this; + var _loop = _this.s.loop; + if (fromTouch && _this.$slide.length < 3) { + _loop = false; + } + + if (!_this.lgBusy) { + if (_this.index > 0) { + _this.index--; _this.$el.trigger('onBeforePrevSlide.lg', [_this.index, fromTouch]); - _this.slide(_this.index, fromTouch, false); - } else if (_this.s.slideEndAnimatoin) { - _this.$outer.addClass('lg-left-end'); - setTimeout(function() { - _this.$outer.removeClass('lg-left-end'); - }, 400); + _this.slide(_this.index, fromTouch, false, 'prev'); + } else { + if (_loop) { + _this.index = _this.$items.length - 1; + _this.$el.trigger('onBeforePrevSlide.lg', [_this.index, fromTouch]); + _this.slide(_this.index, fromTouch, false, 'prev'); + } else if (_this.s.slideEndAnimatoin && !fromTouch) { + _this.$outer.addClass('lg-left-end'); + setTimeout(function() { + _this.$outer.removeClass('lg-left-end'); + }, 400); + } } } - } - }; + }; - Plugin.prototype.keyPress = function() { - var _this = this; - if (this.$items.length > 1) { - $(window).on('keyup.lg', function(e) { - if (_this.$items.length > 1) { - if (e.keyCode === 37) { - e.preventDefault(); - _this.goToPrevSlide(); + Plugin.prototype.keyPress = function() { + var _this = this; + if (this.$items.length > 1) { + $(window).on('keyup.lg', function(e) { + if (_this.$items.length > 1) { + if (e.keyCode === 37) { + e.preventDefault(); + _this.goToPrevSlide(); + } + + if (e.keyCode === 39) { + e.preventDefault(); + _this.goToNextSlide(); + } } + }); + } - if (e.keyCode === 39) { - e.preventDefault(); - _this.goToNextSlide(); + $(window).on('keydown.lg', function(e) { + if (_this.s.escKey === true && e.keyCode === 27) { + e.preventDefault(); + if (!_this.$outer.hasClass('lg-thumb-open')) { + _this.destroy(); + } else { + _this.$outer.removeClass('lg-thumb-open'); } } }); - } + }; - $(window).on('keydown.lg', function(e) { - if (_this.s.escKey === true && e.keyCode === 27) { - e.preventDefault(); - if (!_this.$outer.hasClass('lg-thumb-open')) { - _this.destroy(); + Plugin.prototype.arrow = function() { + var _this = this; + this.$outer.find('.lg-prev').on('click.lg', function() { + _this.goToPrevSlide(); + }); + + this.$outer.find('.lg-next').on('click.lg', function() { + _this.goToNextSlide(); + }); + }; + + Plugin.prototype.arrowDisable = function(index) { + + // Disable arrows if s.hideControlOnEnd is true + if (!this.s.loop && this.s.hideControlOnEnd) { + if ((index + 1) < this.$slide.length) { + this.$outer.find('.lg-next').removeAttr('disabled').removeClass('disabled'); + } else { + this.$outer.find('.lg-next').attr('disabled', 'disabled').addClass('disabled'); + } + + if (index > 0) { + this.$outer.find('.lg-prev').removeAttr('disabled').removeClass('disabled'); } else { - _this.$outer.removeClass('lg-thumb-open'); + this.$outer.find('.lg-prev').attr('disabled', 'disabled').addClass('disabled'); } } - }); - }; + }; - Plugin.prototype.arrow = function() { - var _this = this; - this.$outer.find('.lg-prev').on('click.lg', function() { - _this.goToPrevSlide(); - }); + Plugin.prototype.setTranslate = function($el, xValue, yValue) { + // jQuery supports Automatic CSS prefixing since jQuery 1.8.0 + if (this.s.useLeft) { + $el.css('left', xValue); + } else { + $el.css({ + transform: 'translate3d(' + (xValue) + 'px, ' + yValue + 'px, 0px)' + }); + } + }; - this.$outer.find('.lg-next').on('click.lg', function() { - _this.goToNextSlide(); - }); - }; + Plugin.prototype.touchMove = function(startCoords, endCoords) { - Plugin.prototype.arrowDisable = function(index) { + var distance = endCoords - startCoords; - // Disable arrows if s.hideControlOnEnd is true - if (!this.s.loop && this.s.hideControlOnEnd) { - if ((index + 1) < this.$slide.length) { - this.$outer.find('.lg-next').removeAttr('disabled').removeClass('disabled'); - } else { - this.$outer.find('.lg-next').attr('disabled', 'disabled').addClass('disabled'); - } + if (Math.abs(distance) > 15) { + // reset opacity and transition duration + this.$outer.addClass('lg-dragging'); - if (index > 0) { - this.$outer.find('.lg-prev').removeAttr('disabled').removeClass('disabled'); - } else { - this.$outer.find('.lg-prev').attr('disabled', 'disabled').addClass('disabled'); + // move current slide + this.setTranslate(this.$slide.eq(this.index), distance, 0); + + // move next and prev slide with current slide + this.setTranslate($('.lg-prev-slide'), -this.$slide.eq(this.index).width() + distance, 0); + this.setTranslate($('.lg-next-slide'), this.$slide.eq(this.index).width() + distance, 0); } - } - }; + }; - Plugin.prototype.setTranslate = function($el, xValue, yValue) { - // jQuery supports Automatic CSS prefixing since jQuery 1.8.0 - if (this.s.useLeft) { - $el.css('left', xValue); - } else { - $el.css({ - transform: 'translate3d(' + (xValue) + 'px, ' + yValue + 'px, 0px)' - }); - } - }; + Plugin.prototype.touchEnd = function(distance) { + var _this = this; - Plugin.prototype.touchMove = function(startCoords, endCoords) { + // keep slide animation for any mode while dragg/swipe + if (_this.s.mode !== 'lg-slide') { + _this.$outer.addClass('lg-slide'); + } - var distance = endCoords - startCoords; + this.$slide.not('.lg-current, .lg-prev-slide, .lg-next-slide').css('opacity', '0'); - if (Math.abs(distance) > 15) { - // reset opacity and transition duration - this.$outer.addClass('lg-dragging'); + // set transition duration + setTimeout(function() { + _this.$outer.removeClass('lg-dragging'); + if ((distance < 0) && (Math.abs(distance) > _this.s.swipeThreshold)) { + _this.goToNextSlide(true); + } else if ((distance > 0) && (Math.abs(distance) > _this.s.swipeThreshold)) { + _this.goToPrevSlide(true); + } else if (Math.abs(distance) < 5) { + + // Trigger click if distance is less than 5 pix + _this.$el.trigger('onSlideClick.lg'); + } - // move current slide - this.setTranslate(this.$slide.eq(this.index), distance, 0); + _this.$slide.removeAttr('style'); + }); - // move next and prev slide with current slide - this.setTranslate($('.lg-prev-slide'), -this.$slide.eq(this.index).width() + distance, 0); - this.setTranslate($('.lg-next-slide'), this.$slide.eq(this.index).width() + distance, 0); - } - }; + // remove slide class once drag/swipe is completed if mode is not slide + setTimeout(function() { + if (!_this.$outer.hasClass('lg-dragging') && _this.s.mode !== 'lg-slide') { + _this.$outer.removeClass('lg-slide'); + } + }, _this.s.speed + 100); - Plugin.prototype.touchEnd = function(distance) { - var _this = this; + }; - // keep slide animation for any mode while dragg/swipe - if (_this.s.mode !== 'lg-slide') { - _this.$outer.addClass('lg-slide'); - } + Plugin.prototype.enableSwipe = function() { + var _this = this; + var startCoords = 0; + var endCoords = 0; + var isMoved = false; - this.$slide.not('.lg-current, .lg-prev-slide, .lg-next-slide').css('opacity', '0'); + if (_this.s.enableSwipe && _this.isTouch && _this.doCss()) { - // set transition duration - setTimeout(function() { - _this.$outer.removeClass('lg-dragging'); - if ((distance < 0) && (Math.abs(distance) > _this.s.swipeThreshold)) { - _this.goToNextSlide(true); - } else if ((distance > 0) && (Math.abs(distance) > _this.s.swipeThreshold)) { - _this.goToPrevSlide(true); - } else if (Math.abs(distance) < 5) { + _this.$slide.on('touchstart.lg', function(e) { + if (!_this.$outer.hasClass('lg-zoomed') && !_this.lgBusy) { + e.preventDefault(); + _this.manageSwipeClass(); + startCoords = e.originalEvent.targetTouches[0].pageX; + } + }); - // Trigger click if distance is less than 5 pix - _this.$el.trigger('onSlideClick.lg'); + _this.$slide.on('touchmove.lg', function(e) { + if (!_this.$outer.hasClass('lg-zoomed')) { + e.preventDefault(); + endCoords = e.originalEvent.targetTouches[0].pageX; + _this.touchMove(startCoords, endCoords); + isMoved = true; + } + }); + + _this.$slide.on('touchend.lg', function() { + if (!_this.$outer.hasClass('lg-zoomed')) { + if (isMoved) { + isMoved = false; + _this.touchEnd(endCoords - startCoords); + } else { + _this.$el.trigger('onSlideClick.lg'); + } + } + }); } - _this.$slide.removeAttr('style'); - }); + }; - // remove slide class once drag/swipe is completed if mode is not slide - setTimeout(function() { - if (!_this.$outer.hasClass('lg-dragging') && _this.s.mode !== 'lg-slide') { - _this.$outer.removeClass('lg-slide'); - } - }, _this.s.speed + 100); + Plugin.prototype.enableDrag = function() { + var _this = this; + var startCoords = 0; + var endCoords = 0; + var isDraging = false; + var isMoved = false; + if (_this.s.enableDrag && !_this.isTouch && _this.doCss()) { + _this.$slide.on('mousedown.lg', function(e) { + // execute only on .lg-object + if (!_this.$outer.hasClass('lg-zoomed')) { + if ($(e.target).hasClass('lg-object') || $(e.target).hasClass('lg-video-play')) { + e.preventDefault(); - }; + if (!_this.lgBusy) { + _this.manageSwipeClass(); + startCoords = e.pageX; + isDraging = true; - Plugin.prototype.enableSwipe = function() { - var _this = this; - var startCoords = 0; - var endCoords = 0; - var isMoved = false; + // ** Fix for webkit cursor issue https://code.google.com/p/chromium/issues/detail?id=26723 + _this.$outer.scrollLeft += 1; + _this.$outer.scrollLeft -= 1; - if (_this.s.enableSwipe && _this.isTouch && _this.doCss()) { + // * - _this.$slide.on('touchstart.lg', function(e) { - if (!_this.$outer.hasClass('lg-zoomed') && !_this.lgBusy) { - e.preventDefault(); - _this.manageSwipeClass(); - startCoords = e.originalEvent.targetTouches[0].pageX; - } - }); + _this.$outer.removeClass('lg-grab').addClass('lg-grabbing'); - _this.$slide.on('touchmove.lg', function(e) { - if (!_this.$outer.hasClass('lg-zoomed')) { - e.preventDefault(); - endCoords = e.originalEvent.targetTouches[0].pageX; - _this.touchMove(startCoords, endCoords); - isMoved = true; - } - }); + _this.$el.trigger('onDragstart.lg'); + } + + } + } + }); - _this.$slide.on('touchend.lg', function() { - if (!_this.$outer.hasClass('lg-zoomed')) { + $(window).on('mousemove.lg', function(e) { + if (isDraging) { + isMoved = true; + endCoords = e.pageX; + _this.touchMove(startCoords, endCoords); + _this.$el.trigger('onDragmove.lg'); + } + }); + + $(window).on('mouseup.lg', function(e) { if (isMoved) { isMoved = false; _this.touchEnd(endCoords - startCoords); - } else { + _this.$el.trigger('onDragend.lg'); + } else if ($(e.target).hasClass('lg-object') || $(e.target).hasClass('lg-video-play')) { _this.$el.trigger('onSlideClick.lg'); } + + // Prevent execution on click + if (isDraging) { + isDraging = false; + _this.$outer.removeClass('lg-grabbing').addClass('lg-grab'); + } + }); + + } + }; + + Plugin.prototype.manageSwipeClass = function() { + var _touchNext = this.index + 1; + var _touchPrev = this.index - 1; + if (this.s.loop && this.$slide.length > 2) { + if (this.index === 0) { + _touchPrev = this.$slide.length - 1; + } else if (this.index === this.$slide.length - 1) { + _touchNext = 0; + } + } + + this.$slide.removeClass('lg-next-slide lg-prev-slide'); + if (_touchPrev > -1) { + this.$slide.eq(_touchPrev).addClass('lg-prev-slide'); + } + + this.$slide.eq(_touchNext).addClass('lg-next-slide'); + }; + + Plugin.prototype.mousewheel = function() { + var _this = this; + _this.$outer.on('mousewheel.lg', function(e) { + + if (!e.deltaY) { + return; + } + + if (e.deltaY > 0) { + _this.goToPrevSlide(); + } else { + _this.goToNextSlide(); } + + e.preventDefault(); }); - } - }; + }; - Plugin.prototype.enableDrag = function() { - var _this = this; - var startCoords = 0; - var endCoords = 0; - var isDraging = false; - var isMoved = false; - if (_this.s.enableDrag && !_this.isTouch && _this.doCss()) { - _this.$slide.on('mousedown.lg', function(e) { - // execute only on .lg-object - if (!_this.$outer.hasClass('lg-zoomed')) { - if ($(e.target).hasClass('lg-object') || $(e.target).hasClass('lg-video-play')) { - e.preventDefault(); + Plugin.prototype.closeGallery = function() { - if (!_this.lgBusy) { - _this.manageSwipeClass(); - startCoords = e.pageX; - isDraging = true; + var _this = this; + var mousedown = false; + this.$outer.find('.lg-close').on('click.lg', function() { + _this.destroy(); + }); - // ** Fix for webkit cursor issue https://code.google.com/p/chromium/issues/detail?id=26723 - _this.$outer.scrollLeft += 1; - _this.$outer.scrollLeft -= 1; + if (_this.s.closable) { - // * + // If you drag the slide and release outside gallery gets close on chrome + // for preventing this check mousedown and mouseup happened on .lg-item or lg-outer + _this.$outer.on('mousedown.lg', function(e) { - _this.$outer.removeClass('lg-grab').addClass('lg-grabbing'); + if ($(e.target).is('.lg-outer') || $(e.target).is('.lg-item ') || $(e.target).is('.lg-img-wrap')) { + mousedown = true; + } else { + mousedown = false; + } - _this.$el.trigger('onDragstart.lg'); - } + }); + + _this.$outer.on('mouseup.lg', function(e) { + if ($(e.target).is('.lg-outer') || $(e.target).is('.lg-item ') || $(e.target).is('.lg-img-wrap') && mousedown) { + if (!_this.$outer.hasClass('lg-dragging')) { + _this.destroy(); + } } + + }); + + } + + }; + + Plugin.prototype.destroy = function(d) { + + var _this = this; + + if (!d) { + _this.$el.trigger('onBeforeClose.lg'); + $(window).scrollTop(_this.prevScrollTop); + } + + + /** + * if d is false or undefined destroy will only close the gallery + * plugins instance remains with the element + * + * if d is true destroy will completely remove the plugin + */ + + if (d) { + if (!_this.s.dynamic) { + // only when not using dynamic mode is $items a jquery collection + this.$items.off('click.lg click.lgcustom'); } - }); - $(window).on('mousemove.lg', function(e) { - if (isDraging) { - isMoved = true; - endCoords = e.pageX; - _this.touchMove(startCoords, endCoords); - _this.$el.trigger('onDragmove.lg'); + $.removeData(_this.el, 'lightGallery'); + } + + // Unbind all events added by lightGallery + this.$el.off('.lg.tm'); + + // Distroy all lightGallery modules + $.each($.fn.lightGallery.modules, function(key) { + if (_this.modules[key]) { + _this.modules[key].destroy(); } }); - $(window).on('mouseup.lg', function(e) { - if (isMoved) { - isMoved = false; - _this.touchEnd(endCoords - startCoords); - _this.$el.trigger('onDragend.lg'); - } else if ($(e.target).hasClass('lg-object') || $(e.target).hasClass('lg-video-play')) { - _this.$el.trigger('onSlideClick.lg'); + this.lGalleryOn = false; + + clearTimeout(_this.hideBartimeout); + this.hideBartimeout = false; + $(window).off('.lg'); + $('body').removeClass('lg-on lg-from-hash'); + + if (_this.$outer) { + _this.$outer.removeClass('lg-visible'); + } + + $('.lg-backdrop').removeClass('in'); + + setTimeout(function() { + if (_this.$outer) { + _this.$outer.remove(); } - // Prevent execution on click - if (isDraging) { - isDraging = false; - _this.$outer.removeClass('lg-grabbing').addClass('lg-grab'); + $('.lg-backdrop').remove(); + + if (!d) { + _this.$el.trigger('onCloseAfter.lg'); + } + + }, _this.s.backdropDuration + 50); + }; + + $.fn.lightGallery = function(options) { + return this.each(function() { + if (!$.data(this, 'lightGallery')) { + $.data(this, 'lightGallery', new Plugin(this, options)); + } else { + try { + $(this).data('lightGallery').init(); + } catch (err) { + console.error('lightGallery has not initiated properly'); + } } }); + }; - } + $.fn.lightGallery.modules = {}; + + })(); + + +})); + + + + +(function($, window, document, undefined) { + + 'use strict'; + + var defaults = { + videoMaxWidth: '855px', + youtubePlayerParams: false, + vimeoPlayerParams: false, + dailymotionPlayerParams: false, + vkPlayerParams: false, + videojs: false, + videojsOptions: {} }; - Plugin.prototype.manageSwipeClass = function() { - var touchNext = this.index + 1; - var touchPrev = this.index - 1; - var length = this.$slide.length; - if (this.s.loop) { - if (this.index === 0) { - touchPrev = length - 1; - } else if (this.index === length - 1) { - touchNext = 0; - } - } + var Video = function(element) { - this.$slide.removeClass('lg-next-slide lg-prev-slide'); - if (touchPrev > -1) { - this.$slide.eq(touchPrev).addClass('lg-prev-slide'); - } + this.core = $(element).data('lightGallery'); - this.$slide.eq(touchNext).addClass('lg-next-slide'); + this.$el = $(element); + this.core.s = $.extend({}, defaults, this.core.s); + this.videoLoaded = false; + + this.init(); + + return this; }; - Plugin.prototype.mousewheel = function() { + Video.prototype.init = function() { var _this = this; - _this.$outer.on('mousewheel.lg', function(e) { - if (!e.deltaY) { - return; - } - - if (e.deltaY > 0) { - _this.goToPrevSlide(); - } else { - _this.goToNextSlide(); + // Event triggered when video url found without poster + _this.core.$el.on('hasVideo.lg.tm', function(event, index, src, html) { + _this.core.$slide.eq(index).find('.lg-video').append(_this.loadVideo(src, 'lg-object', true, index, html)); + if (html) { + if (_this.core.s.videojs) { + try { + videojs(_this.core.$slide.eq(index).find('.lg-html5').get(0), _this.core.s.videojsOptions, function() { + if (!_this.videoLoaded) { + this.play(); + } + }); + } catch (e) { + console.error('Make sure you have included videojs'); + } + } else { + _this.core.$slide.eq(index).find('.lg-html5').get(0).play(); + } } + }); - e.preventDefault(); + // Set max width for video + _this.core.$el.on('onAferAppendSlide.lg.tm', function(event, index) { + _this.core.$slide.eq(index).find('.lg-video-cont').css('max-width', _this.core.s.videoMaxWidth); + _this.videoLoaded = true; }); - }; + var loadOnClick = function($el) { + // check slide has poster + if ($el.find('.lg-object').hasClass('lg-has-poster') && $el.find('.lg-object').is(':visible')) { + + // check already video element present + if (!$el.hasClass('lg-has-video')) { + + $el.addClass('lg-video-playing lg-has-video'); + + var _src; + var _html; + var _loadVideo = function(_src, _html) { + + $el.find('.lg-video').append(_this.loadVideo(_src, '', false, _this.core.index, _html)); + + if (_html) { + if (_this.core.s.videojs) { + try { + videojs(_this.core.$slide.eq(_this.core.index).find('.lg-html5').get(0), _this.core.s.videojsOptions, function() { + this.play(); + }); + } catch (e) { + console.error('Make sure you have included videojs'); + } + } else { + _this.core.$slide.eq(_this.core.index).find('.lg-html5').get(0).play(); + } + } - Plugin.prototype.closeGallery = function() { + }; - var _this = this; - var mousedown = false; - this.$outer.find('.lg-close').on('click.lg', function() { - _this.destroy(); - }); + if (_this.core.s.dynamic) { - if (_this.s.closable) { + _src = _this.core.s.dynamicEl[_this.core.index].src; + _html = _this.core.s.dynamicEl[_this.core.index].html; - // If you drag the slide and release outside gallery gets close on chrome - // for preventing this check mousedown and mouseup happened on .lg-item or lg-outer - _this.$outer.on('mousedown.lg', function(e) { + _loadVideo(_src, _html); - if ($(e.target).is('.lg-outer') || $(e.target).is('.lg-item ') || $(e.target).is('.lg-img-wrap')) { - mousedown = true; - } else { - mousedown = false; - } + } else { - }); + _src = _this.core.$items.eq(_this.core.index).attr('href') || _this.core.$items.eq(_this.core.index).attr('data-src'); + _html = _this.core.$items.eq(_this.core.index).attr('data-html'); - _this.$outer.on('mouseup.lg', function(e) { + _loadVideo(_src, _html); - if ($(e.target).is('.lg-outer') || $(e.target).is('.lg-item ') || $(e.target).is('.lg-img-wrap') && mousedown) { - if (!_this.$outer.hasClass('lg-dragging')) { - _this.destroy(); } + + var $tempImg = $el.find('.lg-object'); + $el.find('.lg-video').append($tempImg); + + // @todo loading icon for html5 videos also + // for showing the loading indicator while loading video + if (!$el.find('.lg-video-object').hasClass('lg-html5')) { + $el.removeClass('lg-complete'); + $el.find('.lg-video-object').on('load.lg error.lg', function() { + $el.addClass('lg-complete'); + }); + } + + } else { + + var youtubePlayer = $el.find('.lg-youtube').get(0); + var vimeoPlayer = $el.find('.lg-vimeo').get(0); + var dailymotionPlayer = $el.find('.lg-dailymotion').get(0); + var html5Player = $el.find('.lg-html5').get(0); + if (youtubePlayer) { + youtubePlayer.contentWindow.postMessage('{"event":"command","func":"playVideo","args":""}', '*'); + } else if (vimeoPlayer) { + try { + $f(vimeoPlayer).api('play'); + } catch (e) { + console.error('Make sure you have included froogaloop2 js'); + } + } else if (dailymotionPlayer) { + dailymotionPlayer.contentWindow.postMessage('play', '*'); + + } else if (html5Player) { + if (_this.core.s.videojs) { + try { + videojs(html5Player).play(); + } catch (e) { + console.error('Make sure you have included videojs'); + } + } else { + html5Player.play(); + } + } + + $el.addClass('lg-video-playing'); + } + } + }; + if (_this.core.doCss() && _this.core.$items.length > 1 && ((_this.core.s.enableSwipe && _this.core.isTouch) || (_this.core.s.enableDrag && !_this.core.isTouch))) { + _this.core.$el.on('onSlideClick.lg.tm', function() { + var $el = _this.core.$slide.eq(_this.core.index); + loadOnClick($el); }); + } else { + // For IE 9 and bellow + _this.core.$slide.on('click.lg', function() { + loadOnClick($(this)); + }); } - }; + _this.core.$el.on('onBeforeSlide.lg.tm', function(event, prevIndex, index) { + + var $videoSlide = _this.core.$slide.eq(prevIndex); + var youtubePlayer = $videoSlide.find('.lg-youtube').get(0); + var vimeoPlayer = $videoSlide.find('.lg-vimeo').get(0); + var dailymotionPlayer = $videoSlide.find('.lg-dailymotion').get(0); + var vkPlayer = $videoSlide.find('.lg-vk').get(0); + var html5Player = $videoSlide.find('.lg-html5').get(0); + if (youtubePlayer) { + youtubePlayer.contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}', '*'); + } else if (vimeoPlayer) { + try { + $f(vimeoPlayer).api('pause'); + } catch (e) { + console.error('Make sure you have included froogaloop2 js'); + } + } else if (dailymotionPlayer) { + dailymotionPlayer.contentWindow.postMessage('pause', '*'); + + } else if (html5Player) { + if (_this.core.s.videojs) { + try { + videojs(html5Player).pause(); + } catch (e) { + console.error('Make sure you have included videojs'); + } + } else { + html5Player.pause(); + } + } if (vkPlayer) { + $(vkPlayer).attr('src', $(vkPlayer).attr('src').replace('&autoplay', '&noplay')); + } + + var _src; + if (_this.core.s.dynamic) { + _src = _this.core.s.dynamicEl[index].src; + } else { + _src = _this.core.$items.eq(index).attr('href') || _this.core.$items.eq(index).attr('data-src'); - Plugin.prototype.destroy = function(d) { + } - var _this = this; + var _isVideo = _this.core.isVideo(_src, index) || {}; + if (_isVideo.youtube || _isVideo.vimeo || _isVideo.dailymotion || _isVideo.vk) { + _this.core.$outer.addClass('lg-hide-download'); + } - if (!d) { - _this.$el.trigger('onBeforeClose.lg'); - } + //$videoSlide.addClass('lg-complete'); - $(window).scrollTop(_this.prevScrollTop); + }); - /** - * if d is false or undefined destroy will only close the gallery - * plugins instance remains with the element - * - * if d is true destroy will completely remove the plugin - */ + _this.core.$el.on('onAfterSlide.lg.tm', function(event, prevIndex) { + _this.core.$slide.eq(prevIndex).removeClass('lg-video-playing'); + }); + }; - if (d) { - if (!_this.s.dynamic) { - // only when not using dynamic mode is $items a jquery collection - this.$items.off('click.lg click.lgcustom'); - } + Video.prototype.loadVideo = function(src, addClass, noposter, index, html) { + var video = ''; + var autoplay = 1; + var a = ''; + var isVideo = this.core.isVideo(src, index) || {}; - $.removeData(_this.el, 'lightGallery'); + // Enable autoplay for first video if poster doesn't exist + if (noposter) { + if (this.videoLoaded) { + autoplay = 0; + } else { + autoplay = 1; + } } - // Unbind all events added by lightGallery - this.$el.off('.lg.tm'); + if (isVideo.youtube) { - // Distroy all lightGallery modules - $.each($.fn.lightGallery.modules, function(key) { - if (_this.modules[key]) { - _this.modules[key].destroy(); + a = '?wmode=opaque&autoplay=' + autoplay + '&enablejsapi=1'; + if (this.core.s.youtubePlayerParams) { + a = a + '&' + $.param(this.core.s.youtubePlayerParams); } - }); - this.lGalleryOn = false; + video = ''; - clearTimeout(_this.hideBartimeout); - this.hideBartimeout = false; - $(window).off('.lg'); - $('body').removeClass('lg-on lg-from-hash'); + } else if (isVideo.vimeo) { - if (_this.$outer) { - _this.$outer.removeClass('lg-visible'); - } + a = '?autoplay=' + autoplay + '&api=1'; + if (this.core.s.vimeoPlayerParams) { + a = a + '&' + $.param(this.core.s.vimeoPlayerParams); + } - $('.lg-backdrop').removeClass('in'); + video = ''; - setTimeout(function() { - if (_this.$outer) { - _this.$outer.remove(); + } else if (isVideo.dailymotion) { + + a = '?wmode=opaque&autoplay=' + autoplay + '&api=postMessage'; + if (this.core.s.dailymotionPlayerParams) { + a = a + '&' + $.param(this.core.s.dailymotionPlayerParams); } - $('.lg-backdrop').remove(); + video = ''; - if (!d) { - _this.$el.trigger('onCloseAfter.lg'); + } else if (isVideo.html5) { + var fL = html.substring(0, 1); + if (fL === '.' || fL === '#') { + html = $(html).html(); } - }, _this.s.backdropDuration + 50); - }; + video = html; - $.fn.lightGallery = function(options) { - return this.each(function() { - if (!$.data(this, 'lightGallery')) { - $.data(this, 'lightGallery', new Plugin(this, options)); - } else { - try { - $(this).data('lightGallery').init(); - } catch (err) { - console.error('lightGallery has not initiated properly'); - } + } else if (isVideo.vk) { + + a = '&autoplay=' + autoplay; + if (this.core.s.vkPlayerParams) { + a = a + '&' + $.param(this.core.s.vkPlayerParams); } - }); - }; - $.fn.lightGallery.modules = {}; + video = ''; + + } -})( jQuery ); + return video; + }; + Video.prototype.destroy = function() { + this.videoLoaded = false; + }; -})); + $.fn.lightGallery.modules.video = Video; + +})(jQuery, window, document); diff --git a/assets/js/plugins.js b/assets/js/plugins.js index 21c1ff2..42b694c 100755 --- a/assets/js/plugins.js +++ b/assets/js/plugins.js @@ -8,10 +8,8 @@ */ !function(a){a.fn.fitVids=function(b){var c={customSelector:null},d=document.createElement("div"),e=document.getElementsByTagName("base")[0]||document.getElementsByTagName("script")[0];return d.className="fit-vids-style",d.innerHTML="­",e.parentNode.insertBefore(d,e),b&&a.extend(c,b),this.each(function(){var b=["iframe[src*='player.vimeo.com']","iframe[src*='www.youtube.com']","iframe[src*='www.kickstarter.com']","object","embed"];c.customSelector&&b.push(c.customSelector);var d=a(this).find(b.join(","));d.each(function(){var b=a(this);if(!("embed"==this.tagName.toLowerCase()&&b.parent("object").length||b.parent(".fluid-width-video-wrapper").length)){var c="object"==this.tagName.toLowerCase()?b.attr("height"):b.height(),d=c/b.width();if(!b.attr("id")){var e="fitvid"+Math.floor(999999*Math.random());b.attr("id",e)}b.wrap('
').parent(".fluid-width-video-wrapper").css("padding-top",100*d+"%"),b.removeAttr("height").removeAttr("width")}})})}}(jQuery); -/*! Magnific Popup - v1.0.0 - 2015-01-03 -* http://dimsemenov.com/plugins/magnific-popup/ -* Copyright (c) 2015 Dmitry Semenov; */ -!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):window.jQuery||window.Zepto)}(function(a){var b,c,d,e,f,g,h="Close",i="BeforeClose",j="AfterClose",k="BeforeAppend",l="MarkupParse",m="Open",n="Change",o="mfp",p="."+o,q="mfp-ready",r="mfp-removing",s="mfp-prevent-close",t=function(){},u=!!window.jQuery,v=a(window),w=function(a,c){b.ev.on(o+a+p,c)},x=function(b,c,d,e){var f=document.createElement("div");return f.className="mfp-"+b,d&&(f.innerHTML=d),e?c&&c.appendChild(f):(f=a(f),c&&f.appendTo(c)),f},y=function(c,d){b.ev.triggerHandler(o+c,d),b.st.callbacks&&(c=c.charAt(0).toLowerCase()+c.slice(1),b.st.callbacks[c]&&b.st.callbacks[c].apply(b,a.isArray(d)?d:[d]))},z=function(c){return c===g&&b.currTemplate.closeBtn||(b.currTemplate.closeBtn=a(b.st.closeMarkup.replace("%title%",b.st.tClose)),g=c),b.currTemplate.closeBtn},A=function(){a.magnificPopup.instance||(b=new t,b.init(),a.magnificPopup.instance=b)},B=function(){var a=document.createElement("p").style,b=["ms","O","Moz","Webkit"];if(void 0!==a.transition)return!0;for(;b.length;)if(b.pop()+"Transition"in a)return!0;return!1};t.prototype={constructor:t,init:function(){var c=navigator.appVersion;b.isIE7=-1!==c.indexOf("MSIE 7."),b.isIE8=-1!==c.indexOf("MSIE 8."),b.isLowIE=b.isIE7||b.isIE8,b.isAndroid=/android/gi.test(c),b.isIOS=/iphone|ipad|ipod/gi.test(c),b.supportsTransition=B(),b.probablyMobile=b.isAndroid||b.isIOS||/(Opera Mini)|Kindle|webOS|BlackBerry|(Opera Mobi)|(Windows Phone)|IEMobile/i.test(navigator.userAgent),d=a(document),b.popupsCache={}},open:function(c){var e;if(c.isObj===!1){b.items=c.items.toArray(),b.index=0;var g,h=c.items;for(e=0;e(a||v.height())},_setFocus:function(){(b.st.focus?b.content.find(b.st.focus).eq(0):b.wrap).focus()},_onFocusIn:function(c){return c.target===b.wrap[0]||a.contains(b.wrap[0],c.target)?void 0:(b._setFocus(),!1)},_parseMarkup:function(b,c,d){var e;d.data&&(c=a.extend(d.data,c)),y(l,[b,c,d]),a.each(c,function(a,c){if(void 0===c||c===!1)return!0;if(e=a.split("_"),e.length>1){var d=b.find(p+"-"+e[0]);if(d.length>0){var f=e[1];"replaceWith"===f?d[0]!==c[0]&&d.replaceWith(c):"img"===f?d.is("img")?d.attr("src",c):d.replaceWith(''):d.attr(e[1],c)}}else b.find(p+"-"+a).html(c)})},_getScrollbarSize:function(){if(void 0===b.scrollbarSize){var a=document.createElement("div");a.style.cssText="width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;",document.body.appendChild(a),b.scrollbarSize=a.offsetWidth-a.clientWidth,document.body.removeChild(a)}return b.scrollbarSize}},a.magnificPopup={instance:null,proto:t.prototype,modules:[],open:function(b,c){return A(),b=b?a.extend(!0,{},b):{},b.isObj=!0,b.index=c||0,this.instance.open(b)},close:function(){return a.magnificPopup.instance&&a.magnificPopup.instance.close()},registerModule:function(b,c){c.options&&(a.magnificPopup.defaults[b]=c.options),a.extend(this.proto,c.proto),this.modules.push(b)},defaults:{disableOn:0,key:null,midClick:!1,mainClass:"",preloader:!0,focus:"",closeOnContentClick:!1,closeOnBgClick:!0,closeBtnInside:!0,showCloseBtn:!0,enableEscapeKey:!0,modal:!1,alignTop:!1,removalDelay:0,prependTo:null,fixedContentPos:"auto",fixedBgPos:"auto",overflowY:"auto",closeMarkup:'',tClose:"Close (Esc)",tLoading:"Loading..."}},a.fn.magnificPopup=function(c){A();var d=a(this);if("string"==typeof c)if("open"===c){var e,f=u?d.data("magnificPopup"):d[0].magnificPopup,g=parseInt(arguments[1],10)||0;f.items?e=f.items[g]:(e=d,f.delegate&&(e=e.find(f.delegate)),e=e.eq(g)),b._openClick({mfpEl:e},d,f)}else b.isOpen&&b[c].apply(b,Array.prototype.slice.call(arguments,1));else c=a.extend(!0,{},c),u?d.data("magnificPopup",c):d[0].magnificPopup=c,b.addGroup(d,c);return d};var C,D,E,F="inline",G=function(){E&&(D.after(E.addClass(C)).detach(),E=null)};a.magnificPopup.registerModule(F,{options:{hiddenClass:"hide",markup:"",tNotFound:"Content not found"},proto:{initInline:function(){b.types.push(F),w(h+"."+F,function(){G()})},getInline:function(c,d){if(G(),c.src){var e=b.st.inline,f=a(c.src);if(f.length){var g=f[0].parentNode;g&&g.tagName&&(D||(C=e.hiddenClass,D=x(C),C="mfp-"+C),E=f.after(D).detach().removeClass(C)),b.updateStatus("ready")}else b.updateStatus("error",e.tNotFound),f=a("
");return c.inlineElement=f,f}return b.updateStatus("ready"),b._parseMarkup(d,{},c),d}}});var H,I="ajax",J=function(){H&&a(document.body).removeClass(H)},K=function(){J(),b.req&&b.req.abort()};a.magnificPopup.registerModule(I,{options:{settings:null,cursor:"mfp-ajax-cur",tError:'The content could not be loaded.'},proto:{initAjax:function(){b.types.push(I),H=b.st.ajax.cursor,w(h+"."+I,K),w("BeforeChange."+I,K)},getAjax:function(c){H&&a(document.body).addClass(H),b.updateStatus("loading");var d=a.extend({url:c.src,success:function(d,e,f){var g={data:d,xhr:f};y("ParseAjax",g),b.appendContent(a(g.data),I),c.finished=!0,J(),b._setFocus(),setTimeout(function(){b.wrap.addClass(q)},16),b.updateStatus("ready"),y("AjaxContentAdded")},error:function(){J(),c.finished=c.loadError=!0,b.updateStatus("error",b.st.ajax.tError.replace("%url%",c.src))}},b.st.ajax.settings);return b.req=a.ajax(d),""}}});var L,M=function(c){if(c.data&&void 0!==c.data.title)return c.data.title;var d=b.st.image.titleSrc;if(d){if(a.isFunction(d))return d.call(b,c);if(c.el)return c.el.attr(d)||""}return""};a.magnificPopup.registerModule("image",{options:{markup:'
',cursor:"mfp-zoom-out-cur",titleSrc:"title",verticalFit:!0,tError:'The image could not be loaded.'},proto:{initImage:function(){var c=b.st.image,d=".image";b.types.push("image"),w(m+d,function(){"image"===b.currItem.type&&c.cursor&&a(document.body).addClass(c.cursor)}),w(h+d,function(){c.cursor&&a(document.body).removeClass(c.cursor),v.off("resize"+p)}),w("Resize"+d,b.resizeImage),b.isLowIE&&w("AfterChange",b.resizeImage)},resizeImage:function(){var a=b.currItem;if(a&&a.img&&b.st.image.verticalFit){var c=0;b.isLowIE&&(c=parseInt(a.img.css("padding-top"),10)+parseInt(a.img.css("padding-bottom"),10)),a.img.css("max-height",b.wH-c)}},_onImageHasSize:function(a){a.img&&(a.hasSize=!0,L&&clearInterval(L),a.isCheckingImgSize=!1,y("ImageHasSize",a),a.imgHidden&&(b.content&&b.content.removeClass("mfp-loading"),a.imgHidden=!1))},findImageSize:function(a){var c=0,d=a.img[0],e=function(f){L&&clearInterval(L),L=setInterval(function(){return d.naturalWidth>0?void b._onImageHasSize(a):(c>200&&clearInterval(L),c++,void(3===c?e(10):40===c?e(50):100===c&&e(500)))},f)};e(1)},getImage:function(c,d){var e=0,f=function(){c&&(c.img[0].complete?(c.img.off(".mfploader"),c===b.currItem&&(b._onImageHasSize(c),b.updateStatus("ready")),c.hasSize=!0,c.loaded=!0,y("ImageLoadComplete")):(e++,200>e?setTimeout(f,100):g()))},g=function(){c&&(c.img.off(".mfploader"),c===b.currItem&&(b._onImageHasSize(c),b.updateStatus("error",h.tError.replace("%url%",c.src))),c.hasSize=!0,c.loaded=!0,c.loadError=!0)},h=b.st.image,i=d.find(".mfp-img");if(i.length){var j=document.createElement("img");j.className="mfp-img",c.el&&c.el.find("img").length&&(j.alt=c.el.find("img").attr("alt")),c.img=a(j).on("load.mfploader",f).on("error.mfploader",g),j.src=c.src,i.is("img")&&(c.img=c.img.clone()),j=c.img[0],j.naturalWidth>0?c.hasSize=!0:j.width||(c.hasSize=!1)}return b._parseMarkup(d,{title:M(c),img_replaceWith:c.img},c),b.resizeImage(),c.hasSize?(L&&clearInterval(L),c.loadError?(d.addClass("mfp-loading"),b.updateStatus("error",h.tError.replace("%url%",c.src))):(d.removeClass("mfp-loading"),b.updateStatus("ready")),d):(b.updateStatus("loading"),c.loading=!0,c.hasSize||(c.imgHidden=!0,d.addClass("mfp-loading"),b.findImageSize(c)),d)}}});var N,O=function(){return void 0===N&&(N=void 0!==document.createElement("p").style.MozTransform),N};a.magnificPopup.registerModule("zoom",{options:{enabled:!1,easing:"ease-in-out",duration:300,opener:function(a){return a.is("img")?a:a.find("img")}},proto:{initZoom:function(){var a,c=b.st.zoom,d=".zoom";if(c.enabled&&b.supportsTransition){var e,f,g=c.duration,j=function(a){var b=a.clone().removeAttr("style").removeAttr("class").addClass("mfp-animated-image"),d="all "+c.duration/1e3+"s "+c.easing,e={position:"fixed",zIndex:9999,left:0,top:0,"-webkit-backface-visibility":"hidden"},f="transition";return e["-webkit-"+f]=e["-moz-"+f]=e["-o-"+f]=e[f]=d,b.css(e),b},k=function(){b.content.css("visibility","visible")};w("BuildControls"+d,function(){if(b._allowZoom()){if(clearTimeout(e),b.content.css("visibility","hidden"),a=b._getItemToZoom(),!a)return void k();f=j(a),f.css(b._getOffset()),b.wrap.append(f),e=setTimeout(function(){f.css(b._getOffset(!0)),e=setTimeout(function(){k(),setTimeout(function(){f.remove(),a=f=null,y("ZoomAnimationEnded")},16)},g)},16)}}),w(i+d,function(){if(b._allowZoom()){if(clearTimeout(e),b.st.removalDelay=g,!a){if(a=b._getItemToZoom(),!a)return;f=j(a)}f.css(b._getOffset(!0)),b.wrap.append(f),b.content.css("visibility","hidden"),setTimeout(function(){f.css(b._getOffset())},16)}}),w(h+d,function(){b._allowZoom()&&(k(),f&&f.remove(),a=null)})}},_allowZoom:function(){return"image"===b.currItem.type},_getItemToZoom:function(){return b.currItem.hasSize?b.currItem.img:!1},_getOffset:function(c){var d;d=c?b.currItem.img:b.st.zoom.opener(b.currItem.el||b.currItem);var e=d.offset(),f=parseInt(d.css("padding-top"),10),g=parseInt(d.css("padding-bottom"),10);e.top-=a(window).scrollTop()-f;var h={width:d.width(),height:(u?d.innerHeight():d[0].offsetHeight)-g-f};return O()?h["-moz-transform"]=h.transform="translate("+e.left+"px,"+e.top+"px)":(h.left=e.left,h.top=e.top),h}}});var P="iframe",Q="//about:blank",R=function(a){if(b.currTemplate[P]){var c=b.currTemplate[P].find("iframe");c.length&&(a||(c[0].src=Q),b.isIE8&&c.css("display",a?"block":"none"))}};a.magnificPopup.registerModule(P,{options:{markup:'
',srcAction:"iframe_src",patterns:{youtube:{index:"youtube.com",id:"v=",src:"//www.youtube.com/embed/%id%?autoplay=1"},vimeo:{index:"vimeo.com/",id:"/",src:"//player.vimeo.com/video/%id%?autoplay=1"},gmaps:{index:"//maps.google.",src:"%id%&output=embed"}}},proto:{initIframe:function(){b.types.push(P),w("BeforeChange",function(a,b,c){b!==c&&(b===P?R():c===P&&R(!0))}),w(h+"."+P,function(){R()})},getIframe:function(c,d){var e=c.src,f=b.st.iframe;a.each(f.patterns,function(){return e.indexOf(this.index)>-1?(this.id&&(e="string"==typeof this.id?e.substr(e.lastIndexOf(this.id)+this.id.length,e.length):this.id.call(this,e)),e=this.src.replace("%id%",e),!1):void 0});var g={};return f.srcAction&&(g[f.srcAction]=e),b._parseMarkup(d,g,c),b.updateStatus("ready"),d}}});var S=function(a){var c=b.items.length;return a>c-1?a-c:0>a?c+a:a},T=function(a,b,c){return a.replace(/%curr%/gi,b+1).replace(/%total%/gi,c)};a.magnificPopup.registerModule("gallery",{options:{enabled:!1,arrowMarkup:'',preload:[0,2],navigateByImgClick:!0,arrows:!0,tPrev:"Previous (Left arrow key)",tNext:"Next (Right arrow key)",tCounter:"%curr% of %total%"},proto:{initGallery:function(){var c=b.st.gallery,e=".mfp-gallery",g=Boolean(a.fn.mfpFastClick);return b.direction=!0,c&&c.enabled?(f+=" mfp-gallery",w(m+e,function(){c.navigateByImgClick&&b.wrap.on("click"+e,".mfp-img",function(){return b.items.length>1?(b.next(),!1):void 0}),d.on("keydown"+e,function(a){37===a.keyCode?b.prev():39===a.keyCode&&b.next()})}),w("UpdateStatus"+e,function(a,c){c.text&&(c.text=T(c.text,b.currItem.index,b.items.length))}),w(l+e,function(a,d,e,f){var g=b.items.length;e.counter=g>1?T(c.tCounter,f.index,g):""}),w("BuildControls"+e,function(){if(b.items.length>1&&c.arrows&&!b.arrowLeft){var d=c.arrowMarkup,e=b.arrowLeft=a(d.replace(/%title%/gi,c.tPrev).replace(/%dir%/gi,"left")).addClass(s),f=b.arrowRight=a(d.replace(/%title%/gi,c.tNext).replace(/%dir%/gi,"right")).addClass(s),h=g?"mfpFastClick":"click";e[h](function(){b.prev()}),f[h](function(){b.next()}),b.isIE7&&(x("b",e[0],!1,!0),x("a",e[0],!1,!0),x("b",f[0],!1,!0),x("a",f[0],!1,!0)),b.container.append(e.add(f))}}),w(n+e,function(){b._preloadTimeout&&clearTimeout(b._preloadTimeout),b._preloadTimeout=setTimeout(function(){b.preloadNearbyImages(),b._preloadTimeout=null},16)}),void w(h+e,function(){d.off(e),b.wrap.off("click"+e),b.arrowLeft&&g&&b.arrowLeft.add(b.arrowRight).destroyMfpFastClick(),b.arrowRight=b.arrowLeft=null})):!1},next:function(){b.direction=!0,b.index=S(b.index+1),b.updateItemHTML()},prev:function(){b.direction=!1,b.index=S(b.index-1),b.updateItemHTML()},goTo:function(a){b.direction=a>=b.index,b.index=a,b.updateItemHTML()},preloadNearbyImages:function(){var a,c=b.st.gallery.preload,d=Math.min(c[0],b.items.length),e=Math.min(c[1],b.items.length);for(a=1;a<=(b.direction?e:d);a++)b._preloadItem(b.index+a);for(a=1;a<=(b.direction?d:e);a++)b._preloadItem(b.index-a)},_preloadItem:function(c){if(c=S(c),!b.items[c].preloaded){var d=b.items[c];d.parsed||(d=b.parseEl(c)),y("LazyLoad",d),"image"===d.type&&(d.img=a('').on("load.mfploader",function(){d.hasSize=!0}).on("error.mfploader",function(){d.hasSize=!0,d.loadError=!0,y("LazyLoadError",d)}).attr("src",d.src)),d.preloaded=!0}}}});var U="retina";a.magnificPopup.registerModule(U,{options:{replaceSrc:function(a){return a.src.replace(/\.\w+$/,function(a){return"@2x"+a})},ratio:1},proto:{initRetina:function(){if(window.devicePixelRatio>1){var a=b.st.retina,c=a.ratio;c=isNaN(c)?c():c,c>1&&(w("ImageHasSize."+U,function(a,b){b.img.css({"max-width":b.img[0].naturalWidth/c,width:"100%"})}),w("ElementParse."+U,function(b,d){d.src=a.replaceSrc(d,c)}))}}}}),function(){var b=1e3,c="ontouchstart"in window,d=function(){v.off("touchmove"+f+" touchend"+f)},e="mfpFastClick",f="."+e;a.fn.mfpFastClick=function(e){return a(this).each(function(){var g,h=a(this);if(c){var i,j,k,l,m,n;h.on("touchstart"+f,function(a){l=!1,n=1,m=a.originalEvent?a.originalEvent.touches[0]:a.touches[0],j=m.clientX,k=m.clientY,v.on("touchmove"+f,function(a){m=a.originalEvent?a.originalEvent.touches:a.touches,n=m.length,m=m[0],(Math.abs(m.clientX-j)>10||Math.abs(m.clientY-k)>10)&&(l=!0,d())}).on("touchend"+f,function(a){d(),l||n>1||(g=!0,a.preventDefault(),clearTimeout(i),i=setTimeout(function(){g=!1},b),e())})})}h.on("click"+f,function(){g||e()})})},a.fn.destroyMfpFastClick=function(){a(this).off("touchstart"+f+" click"+f),c&&v.off("touchmove"+f+" touchend"+f)}}(),A()}); + + /*! @@ -149,425 +147,321 @@ })( jQuery ); +/*! + * imagesLoaded PACKAGED v4.1.1 + * JavaScript is all like "You images are done yet or what?" + * MIT License + */ +!function(t,e){"function"==typeof define&&define.amd?define("ev-emitter/ev-emitter",e):"object"==typeof module&&module.exports?module.exports=e():t.EvEmitter=e()}("undefined"!=typeof window?window:this,function(){function t(){}var e=t.prototype;return e.on=function(t,e){if(t&&e){var i=this._events=this._events||{},n=i[t]=i[t]||[];return-1==n.indexOf(e)&&n.push(e),this}},e.once=function(t,e){if(t&&e){this.on(t,e);var i=this._onceEvents=this._onceEvents||{},n=i[t]=i[t]||{};return n[e]=!0,this}},e.off=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){var n=i.indexOf(e);return-1!=n&&i.splice(n,1),this}},e.emitEvent=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){var n=0,o=i[n];e=e||[];for(var r=this._onceEvents&&this._onceEvents[t];o;){var s=r&&r[o];s&&(this.off(t,o),delete r[o]),o.apply(this,e),n+=s?0:1,o=i[n]}return this}},t}),function(t,e){"use strict";"function"==typeof define&&define.amd?define(["ev-emitter/ev-emitter"],function(i){return e(t,i)}):"object"==typeof module&&module.exports?module.exports=e(t,require("ev-emitter")):t.imagesLoaded=e(t,t.EvEmitter)}(window,function(t,e){function i(t,e){for(var i in e)t[i]=e[i];return t}function n(t){var e=[];if(Array.isArray(t))e=t;else if("number"==typeof t.length)for(var i=0;ib.$items.length&&(b.s.preload=b.$items.length);var c=window.location.hash;c.indexOf("lg="+this.s.galleryId)>0&&(b.index=parseInt(c.split("&slide=")[1],10),a("body").addClass("lg-from-hash"),a("body").hasClass("lg-on")||(setTimeout(function(){b.build(b.index)}),a("body").addClass("lg-on"))),b.s.dynamic?(b.$el.trigger("onBeforeOpen.lg"),b.index=b.s.index||0,a("body").hasClass("lg-on")||setTimeout(function(){b.build(b.index),a("body").addClass("lg-on")})):b.$items.on("click.lgcustom",function(c){try{c.preventDefault(),c.preventDefault()}catch(a){c.returnValue=!1}b.$el.trigger("onBeforeOpen.lg"),b.index=b.s.index||b.$items.index(this),a("body").hasClass("lg-on")||(b.build(b.index),a("body").addClass("lg-on"))})},b.prototype.build=function(b){var c=this;c.structure(),a.each(a.fn.lightGallery.modules,function(b){c.modules[b]=new a.fn.lightGallery.modules[b](c.el)}),c.slide(b,!1,!1,!1),c.s.keyPress&&c.keyPress(),c.$items.length>1&&(c.arrow(),setTimeout(function(){c.enableDrag(),c.enableSwipe()},50),c.s.mousewheel&&c.mousewheel()),c.counter(),c.closeGallery(),c.$el.trigger("onAfterOpen.lg"),c.$outer.on("mousemove.lg click.lg touchstart.lg",function(){c.$outer.removeClass("lg-hide-items"),clearTimeout(c.hideBartimeout),c.hideBartimeout=setTimeout(function(){c.$outer.addClass("lg-hide-items")},c.s.hideBarsDelay)}),c.$outer.trigger("mousemove.lg")},b.prototype.structure=function(){var b,c="",d="",e=0,f="",g=this;for(a("body").append('
'),a(".lg-backdrop").css("transition-duration",this.s.backdropDuration+"ms"),e=0;e
';if(this.s.controls&&this.$items.length>1&&(d='
'+this.s.prevHtml+'
'+this.s.nextHtml+"
"),".lg-sub-html"===this.s.appendSubHtmlTo&&(f='
'),b='
'+c+'
'+d+f+"
",a("body").append(b),this.$outer=a(".lg-outer"),this.$slide=this.$outer.find(".lg-item"),this.s.useLeft?(this.$outer.addClass("lg-use-left"),this.s.mode="lg-slide"):this.$outer.addClass("lg-use-css3"),g.setTop(),a(window).on("resize.lg orientationchange.lg",function(){setTimeout(function(){g.setTop()},100)}),this.$slide.eq(this.index).addClass("lg-current"),this.doCss()?this.$outer.addClass("lg-css3"):(this.$outer.addClass("lg-css"),this.s.speed=0),this.$outer.addClass(this.s.mode),this.s.enableDrag&&this.$items.length>1&&this.$outer.addClass("lg-grab"),this.s.showAfterLoad&&this.$outer.addClass("lg-show-after-load"),this.doCss()){var h=this.$outer.find(".lg-inner");h.css("transition-timing-function",this.s.cssEasing),h.css("transition-duration",this.s.speed+"ms")}setTimeout(function(){a(".lg-backdrop").addClass("in")}),setTimeout(function(){g.$outer.addClass("lg-visible")},this.s.backdropDuration),this.s.download&&this.$outer.find(".lg-toolbar").append(''),this.prevScrollTop=a(window).scrollTop()},b.prototype.setTop=function(){if("100%"!==this.s.height){var b=a(window).height(),c=(b-parseInt(this.s.height,10))/2,d=this.$outer.find(".lg");b>=parseInt(this.s.height,10)?d.css("top",c+"px"):d.css("top","0px")}},b.prototype.doCss=function(){var a=function(){var a=["transition","MozTransition","WebkitTransition","OTransition","msTransition","KhtmlTransition"],b=document.documentElement,c=0;for(c=0;c'+(parseInt(this.index,10)+1)+' / '+this.$items.length+"")},b.prototype.addHtml=function(b){var c,d,e=null;if(this.s.dynamic?this.s.dynamicEl[b].subHtmlUrl?c=this.s.dynamicEl[b].subHtmlUrl:e=this.s.dynamicEl[b].subHtml:(d=this.$items.eq(b),d.attr("data-sub-html-url")?c=d.attr("data-sub-html-url"):(e=d.attr("data-sub-html"),this.s.getCaptionFromTitleOrAlt&&!e&&(e=d.attr("title")||d.find("img").first().attr("alt")))),!c)if("undefined"!=typeof e&&null!==e){var f=e.substring(0,1);"."!==f&&"#"!==f||(e=this.s.subHtmlSelectorRelative&&!this.s.dynamic?d.find(e).html():a(e).html())}else e="";".lg-sub-html"===this.s.appendSubHtmlTo?c?this.$outer.find(this.s.appendSubHtmlTo).load(c):this.$outer.find(this.s.appendSubHtmlTo).html(e):c?this.$slide.eq(b).load(c):this.$slide.eq(b).append(e),"undefined"!=typeof e&&null!==e&&(""===e?this.$outer.find(this.s.appendSubHtmlTo).addClass("lg-empty-html"):this.$outer.find(this.s.appendSubHtmlTo).removeClass("lg-empty-html")),this.$el.trigger("onAfterAppendSubHtml.lg",[b])},b.prototype.preload=function(a){var b=1,c=1;for(b=1;b<=this.s.preload&&!(b>=this.$items.length-a);b++)this.loadContent(a+b,!1,0);for(c=1;c<=this.s.preload&&!(a-c<0);c++)this.loadContent(a-c,!1,0)},b.prototype.loadContent=function(b,c,d){var e,f,g,h,i,j,k=this,l=!1,m=function(b){for(var c=[],d=[],e=0;eh){f=d[i];break}};if(k.s.dynamic){if(k.s.dynamicEl[b].poster&&(l=!0,g=k.s.dynamicEl[b].poster),j=k.s.dynamicEl[b].html,f=k.s.dynamicEl[b].src,k.s.dynamicEl[b].responsive){var n=k.s.dynamicEl[b].responsive.split(",");m(n)}h=k.s.dynamicEl[b].srcset,i=k.s.dynamicEl[b].sizes}else{if(k.$items.eq(b).attr("data-poster")&&(l=!0,g=k.$items.eq(b).attr("data-poster")),j=k.$items.eq(b).attr("data-html"),f=k.$items.eq(b).attr("href")||k.$items.eq(b).attr("data-src"),k.$items.eq(b).attr("data-responsive")){var o=k.$items.eq(b).attr("data-responsive").split(",");m(o)}h=k.$items.eq(b).attr("data-srcset"),i=k.$items.eq(b).attr("data-sizes")}var p=!1;k.s.dynamic?k.s.dynamicEl[b].iframe&&(p=!0):"true"===k.$items.eq(b).attr("data-iframe")&&(p=!0);var q=k.isVideo(f,b);if(!k.$slide.eq(b).hasClass("lg-loaded")){if(p)k.$slide.eq(b).prepend('
');else if(l){var r="";r=q&&q.youtube?"lg-has-youtube":q&&q.vimeo?"lg-has-vimeo":"lg-has-html5",k.$slide.eq(b).prepend('
')}else q?(k.$slide.eq(b).prepend('
'),k.$el.trigger("hasVideo.lg",[b,f,j])):k.$slide.eq(b).prepend('
');if(k.$el.trigger("onAferAppendSlide.lg",[b]),e=k.$slide.eq(b).find(".lg-object"),i&&e.attr("sizes",i),h){e.attr("srcset",h);try{picturefill({elements:[e[0]]})}catch(a){console.error("Make sure you have included Picturefill version 2")}}".lg-sub-html"!==this.s.appendSubHtmlTo&&k.addHtml(b),k.$slide.eq(b).addClass("lg-loaded")}k.$slide.eq(b).find(".lg-object").on("load.lg error.lg",function(){var c=0;d&&!a("body").hasClass("lg-from-hash")&&(c=d),setTimeout(function(){k.$slide.eq(b).addClass("lg-complete"),k.$el.trigger("onSlideItemLoad.lg",[b,d||0])},c)}),q&&q.html5&&!l&&k.$slide.eq(b).addClass("lg-complete"),c===!0&&(k.$slide.eq(b).hasClass("lg-complete")?k.preload(b):k.$slide.eq(b).find(".lg-object").on("load.lg error.lg",function(){k.preload(b)}))},b.prototype.slide=function(b,c,d,e){var f=this.$outer.find(".lg-current").index(),g=this;if(!g.lGalleryOn||f!==b){var h=this.$slide.length,i=g.lGalleryOn?this.s.speed:0;if(!g.lgBusy){if(this.s.download){var j;j=g.s.dynamic?g.s.dynamicEl[b].downloadUrl!==!1&&(g.s.dynamicEl[b].downloadUrl||g.s.dynamicEl[b].src):"false"!==g.$items.eq(b).attr("data-download-url")&&(g.$items.eq(b).attr("data-download-url")||g.$items.eq(b).attr("href")||g.$items.eq(b).attr("data-src")),j?(a("#lg-download").attr("href",j),g.$outer.removeClass("lg-hide-download")):g.$outer.addClass("lg-hide-download")}if(this.$el.trigger("onBeforeSlide.lg",[f,b,c,d]),g.lgBusy=!0,clearTimeout(g.hideBartimeout),".lg-sub-html"===this.s.appendSubHtmlTo&&setTimeout(function(){g.addHtml(b)},i),this.arrowDisable(b),e||(bf&&(e="next")),c){this.$slide.removeClass("lg-prev-slide lg-current lg-next-slide");var k,l;h>2?(k=b-1,l=b+1,0===b&&f===h-1?(l=0,k=h-1):b===h-1&&0===f&&(l=0,k=h-1)):(k=0,l=1),"prev"===e?g.$slide.eq(l).addClass("lg-next-slide"):g.$slide.eq(k).addClass("lg-prev-slide"),g.$slide.eq(b).addClass("lg-current")}else g.$outer.addClass("lg-no-trans"),this.$slide.removeClass("lg-prev-slide lg-next-slide"),"prev"===e?(this.$slide.eq(b).addClass("lg-prev-slide"),this.$slide.eq(f).addClass("lg-next-slide")):(this.$slide.eq(b).addClass("lg-next-slide"),this.$slide.eq(f).addClass("lg-prev-slide")),setTimeout(function(){g.$slide.removeClass("lg-current"),g.$slide.eq(b).addClass("lg-current"),g.$outer.removeClass("lg-no-trans")},50);g.lGalleryOn?(setTimeout(function(){g.loadContent(b,!0,0)},this.s.speed+50),setTimeout(function(){g.lgBusy=!1,g.$el.trigger("onAfterSlide.lg",[f,b,c,d])},this.s.speed)):(g.loadContent(b,!0,g.s.backdropDuration),g.lgBusy=!1,g.$el.trigger("onAfterSlide.lg",[f,b,c,d])),g.lGalleryOn=!0,this.s.counter&&a("#lg-counter-current").text(b+1)}}},b.prototype.goToNextSlide=function(a){var b=this,c=b.s.loop;a&&b.$slide.length<3&&(c=!1),b.lgBusy||(b.index+10?(b.index--,b.$el.trigger("onBeforePrevSlide.lg",[b.index,a]),b.slide(b.index,a,!1,"prev")):c?(b.index=b.$items.length-1,b.$el.trigger("onBeforePrevSlide.lg",[b.index,a]),b.slide(b.index,a,!1,"prev")):b.s.slideEndAnimatoin&&!a&&(b.$outer.addClass("lg-left-end"),setTimeout(function(){b.$outer.removeClass("lg-left-end")},400)))},b.prototype.keyPress=function(){var b=this;this.$items.length>1&&a(window).on("keyup.lg",function(a){b.$items.length>1&&(37===a.keyCode&&(a.preventDefault(),b.goToPrevSlide()),39===a.keyCode&&(a.preventDefault(),b.goToNextSlide()))}),a(window).on("keydown.lg",function(a){b.s.escKey===!0&&27===a.keyCode&&(a.preventDefault(),b.$outer.hasClass("lg-thumb-open")?b.$outer.removeClass("lg-thumb-open"):b.destroy())})},b.prototype.arrow=function(){var a=this;this.$outer.find(".lg-prev").on("click.lg",function(){a.goToPrevSlide()}),this.$outer.find(".lg-next").on("click.lg",function(){a.goToNextSlide()})},b.prototype.arrowDisable=function(a){!this.s.loop&&this.s.hideControlOnEnd&&(a+10?this.$outer.find(".lg-prev").removeAttr("disabled").removeClass("disabled"):this.$outer.find(".lg-prev").attr("disabled","disabled").addClass("disabled"))},b.prototype.setTranslate=function(a,b,c){this.s.useLeft?a.css("left",b):a.css({transform:"translate3d("+b+"px, "+c+"px, 0px)"})},b.prototype.touchMove=function(b,c){var d=c-b;Math.abs(d)>15&&(this.$outer.addClass("lg-dragging"),this.setTranslate(this.$slide.eq(this.index),d,0),this.setTranslate(a(".lg-prev-slide"),-this.$slide.eq(this.index).width()+d,0),this.setTranslate(a(".lg-next-slide"),this.$slide.eq(this.index).width()+d,0))},b.prototype.touchEnd=function(a){var b=this;"lg-slide"!==b.s.mode&&b.$outer.addClass("lg-slide"),this.$slide.not(".lg-current, .lg-prev-slide, .lg-next-slide").css("opacity","0"),setTimeout(function(){b.$outer.removeClass("lg-dragging"),a<0&&Math.abs(a)>b.s.swipeThreshold?b.goToNextSlide(!0):a>0&&Math.abs(a)>b.s.swipeThreshold?b.goToPrevSlide(!0):Math.abs(a)<5&&b.$el.trigger("onSlideClick.lg"),b.$slide.removeAttr("style")}),setTimeout(function(){b.$outer.hasClass("lg-dragging")||"lg-slide"===b.s.mode||b.$outer.removeClass("lg-slide")},b.s.speed+100)},b.prototype.enableSwipe=function(){var a=this,b=0,c=0,d=!1;a.s.enableSwipe&&a.isTouch&&a.doCss()&&(a.$slide.on("touchstart.lg",function(c){a.$outer.hasClass("lg-zoomed")||a.lgBusy||(c.preventDefault(),a.manageSwipeClass(),b=c.originalEvent.targetTouches[0].pageX)}),a.$slide.on("touchmove.lg",function(e){a.$outer.hasClass("lg-zoomed")||(e.preventDefault(),c=e.originalEvent.targetTouches[0].pageX,a.touchMove(b,c),d=!0)}),a.$slide.on("touchend.lg",function(){a.$outer.hasClass("lg-zoomed")||(d?(d=!1,a.touchEnd(c-b)):a.$el.trigger("onSlideClick.lg"))}))},b.prototype.enableDrag=function(){var b=this,c=0,d=0,e=!1,f=!1;b.s.enableDrag&&!b.isTouch&&b.doCss()&&(b.$slide.on("mousedown.lg",function(d){b.$outer.hasClass("lg-zoomed")||(a(d.target).hasClass("lg-object")||a(d.target).hasClass("lg-video-play"))&&(d.preventDefault(),b.lgBusy||(b.manageSwipeClass(),c=d.pageX,e=!0,b.$outer.scrollLeft+=1,b.$outer.scrollLeft-=1,b.$outer.removeClass("lg-grab").addClass("lg-grabbing"),b.$el.trigger("onDragstart.lg")))}),a(window).on("mousemove.lg",function(a){e&&(f=!0,d=a.pageX,b.touchMove(c,d),b.$el.trigger("onDragmove.lg"))}),a(window).on("mouseup.lg",function(g){f?(f=!1,b.touchEnd(d-c),b.$el.trigger("onDragend.lg")):(a(g.target).hasClass("lg-object")||a(g.target).hasClass("lg-video-play"))&&b.$el.trigger("onSlideClick.lg"),e&&(e=!1,b.$outer.removeClass("lg-grabbing").addClass("lg-grab"))}))},b.prototype.manageSwipeClass=function(){var a=this.index+1,b=this.index-1;this.s.loop&&this.$slide.length>2&&(0===this.index?b=this.$slide.length-1:this.index===this.$slide.length-1&&(a=0)),this.$slide.removeClass("lg-next-slide lg-prev-slide"),b>-1&&this.$slide.eq(b).addClass("lg-prev-slide"),this.$slide.eq(a).addClass("lg-next-slide")},b.prototype.mousewheel=function(){var a=this;a.$outer.on("mousewheel.lg",function(b){b.deltaY&&(b.deltaY>0?a.goToPrevSlide():a.goToNextSlide(),b.preventDefault())})},b.prototype.closeGallery=function(){var b=this,c=!1;this.$outer.find(".lg-close").on("click.lg",function(){b.destroy()}),b.s.closable&&(b.$outer.on("mousedown.lg",function(b){c=!!(a(b.target).is(".lg-outer")||a(b.target).is(".lg-item ")||a(b.target).is(".lg-img-wrap"))}),b.$outer.on("mouseup.lg",function(d){(a(d.target).is(".lg-outer")||a(d.target).is(".lg-item ")||a(d.target).is(".lg-img-wrap")&&c)&&(b.$outer.hasClass("lg-dragging")||b.destroy())}))},b.prototype.destroy=function(b){var c=this;b||(c.$el.trigger("onBeforeClose.lg"),a(window).scrollTop(c.prevScrollTop)),b&&(c.s.dynamic||this.$items.off("click.lg click.lgcustom"),a.removeData(c.el,"lightGallery")),this.$el.off(".lg.tm"),a.each(a.fn.lightGallery.modules,function(a){c.modules[a]&&c.modules[a].destroy()}),this.lGalleryOn=!1,clearTimeout(c.hideBartimeout),this.hideBartimeout=!1,a(window).off(".lg"),a("body").removeClass("lg-on lg-from-hash"),c.$outer&&c.$outer.removeClass("lg-visible"),a(".lg-backdrop").removeClass("in"),setTimeout(function(){c.$outer&&c.$outer.remove(),a(".lg-backdrop").remove(),b||c.$el.trigger("onCloseAfter.lg")},c.s.backdropDuration+50)},a.fn.lightGallery=function(c){return this.each(function(){if(a.data(this,"lightGallery"))try{a(this).data("lightGallery").init()}catch(a){console.error("lightGallery has not initiated properly")}else a.data(this,"lightGallery",new b(this,c))})},a.fn.lightGallery.modules={}}()}); + + + +(function($, window, document, undefined) { + + 'use strict'; + + var defaults = { + videoMaxWidth: '855px', + youtubePlayerParams: false, + vimeoPlayerParams: false, + dailymotionPlayerParams: false, + vkPlayerParams: false, + videojs: false, + videojsOptions: {} + }; + + var Video = function(element) { + + this.core = $(element).data('lightGallery'); + + this.$el = $(element); + this.core.s = $.extend({}, defaults, this.core.s); + this.videoLoaded = false; + + this.init(); + + return this; + }; + + Video.prototype.init = function() { + var _this = this; + + // Event triggered when video url found without poster + _this.core.$el.on('hasVideo.lg.tm', function(event, index, src, html) { + _this.core.$slide.eq(index).find('.lg-video').append(_this.loadVideo(src, 'lg-object', true, index, html)); + if (html) { + if (_this.core.s.videojs) { + try { + videojs(_this.core.$slide.eq(index).find('.lg-html5').get(0), _this.core.s.videojsOptions, function() { + if (!_this.videoLoaded) { + this.play(); + } + }); + } catch (e) { + console.error('Make sure you have included videojs'); + } + } else { + _this.core.$slide.eq(index).find('.lg-html5').get(0).play(); + } + } + }); + + // Set max width for video + _this.core.$el.on('onAferAppendSlide.lg.tm', function(event, index) { + _this.core.$slide.eq(index).find('.lg-video-cont').css('max-width', _this.core.s.videoMaxWidth); + _this.videoLoaded = true; + }); + + var loadOnClick = function($el) { + // check slide has poster + if ($el.find('.lg-object').hasClass('lg-has-poster') && $el.find('.lg-object').is(':visible')) { + + // check already video element present + if (!$el.hasClass('lg-has-video')) { + + $el.addClass('lg-video-playing lg-has-video'); + + var _src; + var _html; + var _loadVideo = function(_src, _html) { + + $el.find('.lg-video').append(_this.loadVideo(_src, '', false, _this.core.index, _html)); + + if (_html) { + if (_this.core.s.videojs) { + try { + videojs(_this.core.$slide.eq(_this.core.index).find('.lg-html5').get(0), _this.core.s.videojsOptions, function() { + this.play(); + }); + } catch (e) { + console.error('Make sure you have included videojs'); + } + } else { + _this.core.$slide.eq(_this.core.index).find('.lg-html5').get(0).play(); + } + } + + }; + + if (_this.core.s.dynamic) { + + _src = _this.core.s.dynamicEl[_this.core.index].src; + _html = _this.core.s.dynamicEl[_this.core.index].html; + + _loadVideo(_src, _html); + + } else { + + _src = _this.core.$items.eq(_this.core.index).attr('href') || _this.core.$items.eq(_this.core.index).attr('data-src'); + _html = _this.core.$items.eq(_this.core.index).attr('data-html'); + + _loadVideo(_src, _html); + + } + + var $tempImg = $el.find('.lg-object'); + $el.find('.lg-video').append($tempImg); + + // @todo loading icon for html5 videos also + // for showing the loading indicator while loading video + if (!$el.find('.lg-video-object').hasClass('lg-html5')) { + $el.removeClass('lg-complete'); + $el.find('.lg-video-object').on('load.lg error.lg', function() { + $el.addClass('lg-complete'); + }); + } + + } else { + + var youtubePlayer = $el.find('.lg-youtube').get(0); + var vimeoPlayer = $el.find('.lg-vimeo').get(0); + var dailymotionPlayer = $el.find('.lg-dailymotion').get(0); + var html5Player = $el.find('.lg-html5').get(0); + if (youtubePlayer) { + youtubePlayer.contentWindow.postMessage('{"event":"command","func":"playVideo","args":""}', '*'); + } else if (vimeoPlayer) { + try { + $f(vimeoPlayer).api('play'); + } catch (e) { + console.error('Make sure you have included froogaloop2 js'); + } + } else if (dailymotionPlayer) { + dailymotionPlayer.contentWindow.postMessage('play', '*'); + + } else if (html5Player) { + if (_this.core.s.videojs) { + try { + videojs(html5Player).play(); + } catch (e) { + console.error('Make sure you have included videojs'); + } + } else { + html5Player.play(); + } + } + + $el.addClass('lg-video-playing'); + + } + } + }; + + if (_this.core.doCss() && _this.core.$items.length > 1 && ((_this.core.s.enableSwipe && _this.core.isTouch) || (_this.core.s.enableDrag && !_this.core.isTouch))) { + _this.core.$el.on('onSlideClick.lg.tm', function() { + var $el = _this.core.$slide.eq(_this.core.index); + loadOnClick($el); + }); + } else { + + // For IE 9 and bellow + _this.core.$slide.on('click.lg', function() { + loadOnClick($(this)); + }); + } + + _this.core.$el.on('onBeforeSlide.lg.tm', function(event, prevIndex, index) { + + var $videoSlide = _this.core.$slide.eq(prevIndex); + var youtubePlayer = $videoSlide.find('.lg-youtube').get(0); + var vimeoPlayer = $videoSlide.find('.lg-vimeo').get(0); + var dailymotionPlayer = $videoSlide.find('.lg-dailymotion').get(0); + var vkPlayer = $videoSlide.find('.lg-vk').get(0); + var html5Player = $videoSlide.find('.lg-html5').get(0); + if (youtubePlayer) { + youtubePlayer.contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}', '*'); + } else if (vimeoPlayer) { + try { + $f(vimeoPlayer).api('pause'); + } catch (e) { + console.error('Make sure you have included froogaloop2 js'); + } + } else if (dailymotionPlayer) { + dailymotionPlayer.contentWindow.postMessage('pause', '*'); + + } else if (html5Player) { + if (_this.core.s.videojs) { + try { + videojs(html5Player).pause(); + } catch (e) { + console.error('Make sure you have included videojs'); + } + } else { + html5Player.pause(); + } + } if (vkPlayer) { + $(vkPlayer).attr('src', $(vkPlayer).attr('src').replace('&autoplay', '&noplay')); + } + + var _src; + if (_this.core.s.dynamic) { + _src = _this.core.s.dynamicEl[index].src; + } else { + _src = _this.core.$items.eq(index).attr('href') || _this.core.$items.eq(index).attr('data-src'); + + } + + var _isVideo = _this.core.isVideo(_src, index) || {}; + if (_isVideo.youtube || _isVideo.vimeo || _isVideo.dailymotion || _isVideo.vk) { + _this.core.$outer.addClass('lg-hide-download'); + } + + //$videoSlide.addClass('lg-complete'); + + }); + + _this.core.$el.on('onAfterSlide.lg.tm', function(event, prevIndex) { + _this.core.$slide.eq(prevIndex).removeClass('lg-video-playing'); + }); + }; + + Video.prototype.loadVideo = function(src, addClass, noposter, index, html) { + var video = ''; + var autoplay = 1; + var a = ''; + var isVideo = this.core.isVideo(src, index) || {}; + + // Enable autoplay for first video if poster doesn't exist + if (noposter) { + if (this.videoLoaded) { + autoplay = 0; + } else { + autoplay = 1; + } + } + + if (isVideo.youtube) { + + a = '?wmode=opaque&autoplay=' + autoplay + '&enablejsapi=1'; + if (this.core.s.youtubePlayerParams) { + a = a + '&' + $.param(this.core.s.youtubePlayerParams); + } + + video = ''; + + } else if (isVideo.vimeo) { + + a = '?autoplay=' + autoplay + '&api=1'; + if (this.core.s.vimeoPlayerParams) { + a = a + '&' + $.param(this.core.s.vimeoPlayerParams); + } + + video = ''; + + } else if (isVideo.dailymotion) { + + a = '?wmode=opaque&autoplay=' + autoplay + '&api=postMessage'; + if (this.core.s.dailymotionPlayerParams) { + a = a + '&' + $.param(this.core.s.dailymotionPlayerParams); + } + + video = ''; + + } else if (isVideo.html5) { + var fL = html.substring(0, 1); + if (fL === '.' || fL === '#') { + html = $(html).html(); + } + + video = html; + + } else if (isVideo.vk) { + + a = '&autoplay=' + autoplay; + if (this.core.s.vkPlayerParams) { + a = a + '&' + $.param(this.core.s.vkPlayerParams); + } + + video = ''; + + } + + return video; + }; + + Video.prototype.destroy = function() { + this.videoLoaded = false; + }; + + $.fn.lightGallery.modules.video = Video; + +})(jQuery, window, document); + + + + + +/*! Stellar.js v0.6.2 | Copyright 2014, Mark Dalgleish | http://markdalgleish.com/projects/stellar.js | http://markdalgleish.mit-license.org */ +!function(a,b,c,d){function e(b,c){this.element=b,this.options=a.extend({},g,c),this._defaults=g,this._name=f,this.init()}var f="stellar",g={scrollProperty:"scroll",positionProperty:"position",horizontalScrolling:!0,verticalScrolling:!0,horizontalOffset:0,verticalOffset:0,responsive:!1,parallaxBackgrounds:!0,parallaxElements:!0,hideDistantElements:!0,hideElement:function(a){a.hide()},showElement:function(a){a.show()}},h={scroll:{getLeft:function(a){return a.scrollLeft()},setLeft:function(a,b){a.scrollLeft(b)},getTop:function(a){return a.scrollTop()},setTop:function(a,b){a.scrollTop(b)}},position:{getLeft:function(a){return-1*parseInt(a.css("left"),10)},getTop:function(a){return-1*parseInt(a.css("top"),10)}},margin:{getLeft:function(a){return-1*parseInt(a.css("margin-left"),10)},getTop:function(a){return-1*parseInt(a.css("margin-top"),10)}},transform:{getLeft:function(a){var b=getComputedStyle(a[0])[k];return"none"!==b?-1*parseInt(b.match(/(-?[0-9]+)/g)[4],10):0},getTop:function(a){var b=getComputedStyle(a[0])[k];return"none"!==b?-1*parseInt(b.match(/(-?[0-9]+)/g)[5],10):0}}},i={position:{setLeft:function(a,b){a.css("left",b)},setTop:function(a,b){a.css("top",b)}},transform:{setPosition:function(a,b,c,d,e){a[0].style[k]="translate3d("+(b-c)+"px, "+(d-e)+"px, 0)"}}},j=function(){var b,c=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,d=a("script")[0].style,e="";for(b in d)if(c.test(b)){e=b.match(c)[0];break}return"WebkitOpacity"in d&&(e="Webkit"),"KhtmlOpacity"in d&&(e="Khtml"),function(a){return e+(e.length>0?a.charAt(0).toUpperCase()+a.slice(1):a)}}(),k=j("transform"),l=a("
",{style:"background:#fff"}).css("background-position-x")!==d,m=l?function(a,b,c){a.css({"background-position-x":b,"background-position-y":c})}:function(a,b,c){a.css("background-position",b+" "+c)},n=l?function(a){return[a.css("background-position-x"),a.css("background-position-y")]}:function(a){return a.css("background-position").split(" ")},o=b.requestAnimationFrame||b.webkitRequestAnimationFrame||b.mozRequestAnimationFrame||b.oRequestAnimationFrame||b.msRequestAnimationFrame||function(a){setTimeout(a,1e3/60)};e.prototype={init:function(){this.options.name=f+"_"+Math.floor(1e9*Math.random()),this._defineElements(),this._defineGetters(),this._defineSetters(),this._handleWindowLoadAndResize(),this._detectViewport(),this.refresh({firstLoad:!0}),"scroll"===this.options.scrollProperty?this._handleScrollEvent():this._startAnimationLoop()},_defineElements:function(){this.element===c.body&&(this.element=b),this.$scrollElement=a(this.element),this.$element=this.element===b?a("body"):this.$scrollElement,this.$viewportElement=this.options.viewportElement!==d?a(this.options.viewportElement):this.$scrollElement[0]===b||"scroll"===this.options.scrollProperty?this.$scrollElement:this.$scrollElement.parent()},_defineGetters:function(){var a=this,b=h[a.options.scrollProperty];this._getScrollLeft=function(){return b.getLeft(a.$scrollElement)},this._getScrollTop=function(){return b.getTop(a.$scrollElement)}},_defineSetters:function(){var b=this,c=h[b.options.scrollProperty],d=i[b.options.positionProperty],e=c.setLeft,f=c.setTop;this._setScrollLeft="function"==typeof e?function(a){e(b.$scrollElement,a)}:a.noop,this._setScrollTop="function"==typeof f?function(a){f(b.$scrollElement,a)}:a.noop,this._setPosition=d.setPosition||function(a,c,e,f,g){b.options.horizontalScrolling&&d.setLeft(a,c,e),b.options.verticalScrolling&&d.setTop(a,f,g)}},_handleWindowLoadAndResize:function(){var c=this,d=a(b);c.options.responsive&&d.bind("load."+this.name,function(){c.refresh()}),d.bind("resize."+this.name,function(){c._detectViewport(),c.options.responsive&&c.refresh()})},refresh:function(c){var d=this,e=d._getScrollLeft(),f=d._getScrollTop();c&&c.firstLoad||this._reset(),this._setScrollLeft(0),this._setScrollTop(0),this._setOffsets(),this._findParticles(),this._findBackgrounds(),c&&c.firstLoad&&/WebKit/.test(navigator.userAgent)&&a(b).load(function(){var a=d._getScrollLeft(),b=d._getScrollTop();d._setScrollLeft(a+1),d._setScrollTop(b+1),d._setScrollLeft(a),d._setScrollTop(b)}),this._setScrollLeft(e),this._setScrollTop(f)},_detectViewport:function(){var a=this.$viewportElement.offset(),b=null!==a&&a!==d;this.viewportWidth=this.$viewportElement.width(),this.viewportHeight=this.$viewportElement.height(),this.viewportOffsetTop=b?a.top:0,this.viewportOffsetLeft=b?a.left:0},_findParticles:function(){{var b=this;this._getScrollLeft(),this._getScrollTop()}if(this.particles!==d)for(var c=this.particles.length-1;c>=0;c--)this.particles[c].$element.data("stellar-elementIsActive",d);this.particles=[],this.options.parallaxElements&&this.$element.find("[data-stellar-ratio]").each(function(){var c,e,f,g,h,i,j,k,l,m=a(this),n=0,o=0,p=0,q=0;if(m.data("stellar-elementIsActive")){if(m.data("stellar-elementIsActive")!==this)return}else m.data("stellar-elementIsActive",this);b.options.showElement(m),m.data("stellar-startingLeft")?(m.css("left",m.data("stellar-startingLeft")),m.css("top",m.data("stellar-startingTop"))):(m.data("stellar-startingLeft",m.css("left")),m.data("stellar-startingTop",m.css("top"))),f=m.position().left,g=m.position().top,h="auto"===m.css("margin-left")?0:parseInt(m.css("margin-left"),10),i="auto"===m.css("margin-top")?0:parseInt(m.css("margin-top"),10),k=m.offset().left-h,l=m.offset().top-i,m.parents().each(function(){var b=a(this);return b.data("stellar-offset-parent")===!0?(n=p,o=q,j=b,!1):(p+=b.position().left,void(q+=b.position().top))}),c=m.data("stellar-horizontal-offset")!==d?m.data("stellar-horizontal-offset"):j!==d&&j.data("stellar-horizontal-offset")!==d?j.data("stellar-horizontal-offset"):b.horizontalOffset,e=m.data("stellar-vertical-offset")!==d?m.data("stellar-vertical-offset"):j!==d&&j.data("stellar-vertical-offset")!==d?j.data("stellar-vertical-offset"):b.verticalOffset,b.particles.push({$element:m,$offsetParent:j,isFixed:"fixed"===m.css("position"),horizontalOffset:c,verticalOffset:e,startingPositionLeft:f,startingPositionTop:g,startingOffsetLeft:k,startingOffsetTop:l,parentOffsetLeft:n,parentOffsetTop:o,stellarRatio:m.data("stellar-ratio")!==d?m.data("stellar-ratio"):1,width:m.outerWidth(!0),height:m.outerHeight(!0),isHidden:!1})})},_findBackgrounds:function(){var b,c=this,e=this._getScrollLeft(),f=this._getScrollTop();this.backgrounds=[],this.options.parallaxBackgrounds&&(b=this.$element.find("[data-stellar-background-ratio]"),this.$element.data("stellar-background-ratio")&&(b=b.add(this.$element)),b.each(function(){var b,g,h,i,j,k,l,o=a(this),p=n(o),q=0,r=0,s=0,t=0;if(o.data("stellar-backgroundIsActive")){if(o.data("stellar-backgroundIsActive")!==this)return}else o.data("stellar-backgroundIsActive",this);o.data("stellar-backgroundStartingLeft")?m(o,o.data("stellar-backgroundStartingLeft"),o.data("stellar-backgroundStartingTop")):(o.data("stellar-backgroundStartingLeft",p[0]),o.data("stellar-backgroundStartingTop",p[1])),h="auto"===o.css("margin-left")?0:parseInt(o.css("margin-left"),10),i="auto"===o.css("margin-top")?0:parseInt(o.css("margin-top"),10),j=o.offset().left-h-e,k=o.offset().top-i-f,o.parents().each(function(){var b=a(this);return b.data("stellar-offset-parent")===!0?(q=s,r=t,l=b,!1):(s+=b.position().left,void(t+=b.position().top))}),b=o.data("stellar-horizontal-offset")!==d?o.data("stellar-horizontal-offset"):l!==d&&l.data("stellar-horizontal-offset")!==d?l.data("stellar-horizontal-offset"):c.horizontalOffset,g=o.data("stellar-vertical-offset")!==d?o.data("stellar-vertical-offset"):l!==d&&l.data("stellar-vertical-offset")!==d?l.data("stellar-vertical-offset"):c.verticalOffset,c.backgrounds.push({$element:o,$offsetParent:l,isFixed:"fixed"===o.css("background-attachment"),horizontalOffset:b,verticalOffset:g,startingValueLeft:p[0],startingValueTop:p[1],startingBackgroundPositionLeft:isNaN(parseInt(p[0],10))?0:parseInt(p[0],10),startingBackgroundPositionTop:isNaN(parseInt(p[1],10))?0:parseInt(p[1],10),startingPositionLeft:o.position().left,startingPositionTop:o.position().top,startingOffsetLeft:j,startingOffsetTop:k,parentOffsetLeft:q,parentOffsetTop:r,stellarRatio:o.data("stellar-background-ratio")===d?1:o.data("stellar-background-ratio")})}))},_reset:function(){var a,b,c,d,e;for(e=this.particles.length-1;e>=0;e--)a=this.particles[e],b=a.$element.data("stellar-startingLeft"),c=a.$element.data("stellar-startingTop"),this._setPosition(a.$element,b,b,c,c),this.options.showElement(a.$element),a.$element.data("stellar-startingLeft",null).data("stellar-elementIsActive",null).data("stellar-backgroundIsActive",null);for(e=this.backgrounds.length-1;e>=0;e--)d=this.backgrounds[e],d.$element.data("stellar-backgroundStartingLeft",null).data("stellar-backgroundStartingTop",null),m(d.$element,d.startingValueLeft,d.startingValueTop)},destroy:function(){this._reset(),this.$scrollElement.unbind("resize."+this.name).unbind("scroll."+this.name),this._animationLoop=a.noop,a(b).unbind("load."+this.name).unbind("resize."+this.name)},_setOffsets:function(){var c=this,d=a(b);d.unbind("resize.horizontal-"+this.name).unbind("resize.vertical-"+this.name),"function"==typeof this.options.horizontalOffset?(this.horizontalOffset=this.options.horizontalOffset(),d.bind("resize.horizontal-"+this.name,function(){c.horizontalOffset=c.options.horizontalOffset()})):this.horizontalOffset=this.options.horizontalOffset,"function"==typeof this.options.verticalOffset?(this.verticalOffset=this.options.verticalOffset(),d.bind("resize.vertical-"+this.name,function(){c.verticalOffset=c.options.verticalOffset()})):this.verticalOffset=this.options.verticalOffset},_repositionElements:function(){var a,b,c,d,e,f,g,h,i,j,k=this._getScrollLeft(),l=this._getScrollTop(),n=!0,o=!0;if(this.currentScrollLeft!==k||this.currentScrollTop!==l||this.currentWidth!==this.viewportWidth||this.currentHeight!==this.viewportHeight){for(this.currentScrollLeft=k,this.currentScrollTop=l,this.currentWidth=this.viewportWidth,this.currentHeight=this.viewportHeight,j=this.particles.length-1;j>=0;j--)a=this.particles[j],b=a.isFixed?1:0,this.options.horizontalScrolling?(f=(k+a.horizontalOffset+this.viewportOffsetLeft+a.startingPositionLeft-a.startingOffsetLeft+a.parentOffsetLeft)*-(a.stellarRatio+b-1)+a.startingPositionLeft,h=f-a.startingPositionLeft+a.startingOffsetLeft):(f=a.startingPositionLeft,h=a.startingOffsetLeft),this.options.verticalScrolling?(g=(l+a.verticalOffset+this.viewportOffsetTop+a.startingPositionTop-a.startingOffsetTop+a.parentOffsetTop)*-(a.stellarRatio+b-1)+a.startingPositionTop,i=g-a.startingPositionTop+a.startingOffsetTop):(g=a.startingPositionTop,i=a.startingOffsetTop),this.options.hideDistantElements&&(o=!this.options.horizontalScrolling||h+a.width>(a.isFixed?0:k)&&h<(a.isFixed?0:k)+this.viewportWidth+this.viewportOffsetLeft,n=!this.options.verticalScrolling||i+a.height>(a.isFixed?0:l)&&i<(a.isFixed?0:l)+this.viewportHeight+this.viewportOffsetTop),o&&n?(a.isHidden&&(this.options.showElement(a.$element),a.isHidden=!1),this._setPosition(a.$element,f,a.startingPositionLeft,g,a.startingPositionTop)):a.isHidden||(this.options.hideElement(a.$element),a.isHidden=!0);for(j=this.backgrounds.length-1;j>=0;j--)c=this.backgrounds[j],b=c.isFixed?0:1,d=this.options.horizontalScrolling?(k+c.horizontalOffset-this.viewportOffsetLeft-c.startingOffsetLeft+c.parentOffsetLeft-c.startingBackgroundPositionLeft)*(b-c.stellarRatio)+"px":c.startingValueLeft,e=this.options.verticalScrolling?(l+c.verticalOffset-this.viewportOffsetTop-c.startingOffsetTop+c.parentOffsetTop-c.startingBackgroundPositionTop)*(b-c.stellarRatio)+"px":c.startingValueTop,m(c.$element,d,e)}},_handleScrollEvent:function(){var a=this,b=!1,c=function(){a._repositionElements(),b=!1},d=function(){b||(o(c),b=!0)};this.$scrollElement.bind("scroll."+this.name,d),d()},_startAnimationLoop:function(){var a=this;this._animationLoop=function(){o(a._animationLoop),a._repositionElements()},this._animationLoop()}},a.fn[f]=function(b){var c=arguments;return b===d||"object"==typeof b?this.each(function(){a.data(this,"plugin_"+f)||a.data(this,"plugin_"+f,new e(this,b))}):"string"==typeof b&&"_"!==b[0]&&"init"!==b?this.each(function(){var d=a.data(this,"plugin_"+f);d instanceof e&&"function"==typeof d[b]&&d[b].apply(d,Array.prototype.slice.call(c,1)),"destroy"===b&&a.data(this,"plugin_"+f,null)}):void 0},a[f]=function(){var c=a(b);return c.stellar.apply(c,Array.prototype.slice.call(arguments,0))},a[f].scrollProperty=h,a[f].positionProperty=i,b.Stellar=e}(jQuery,this,document); - /*! - * parallax.js v1.3.1 (http://pixelcog.github.io/parallax.js/) - * @copyright 2015 PixelCog, Inc. - * @license MIT (https://github.com/pixelcog/parallax.js/blob/master/LICENSE) - */ - ;(function ( $, window, document, undefined ) { - // Polyfill for requestAnimationFrame - // via: https://gist.github.com/paulirish/1579671 - - (function() { - var lastTime = 0; - var vendors = ['ms', 'moz', 'webkit', 'o']; - for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) { - window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame']; - window.cancelAnimationFrame = window[vendors[x]+'CancelAnimationFrame'] - || window[vendors[x]+'CancelRequestAnimationFrame']; - } - - if (!window.requestAnimationFrame) - window.requestAnimationFrame = function(callback) { - var currTime = new Date().getTime(); - var timeToCall = Math.max(0, 16 - (currTime - lastTime)); - var id = window.setTimeout(function() { callback(currTime + timeToCall); }, - timeToCall); - lastTime = currTime + timeToCall; - return id; - }; - - if (!window.cancelAnimationFrame) - window.cancelAnimationFrame = function(id) { - clearTimeout(id); - }; - }()); - - - // Parallax Constructor - - function Parallax(element, options) { - var self = this; - - if (typeof options == 'object') { - delete options.refresh; - delete options.render; - $.extend(this, options); - } - - this.$element = $(element); - - - - if (!this.imageSrc && this.$element.is('img')) { - this.imageSrc = this.$element.attr('src'); - } - - var positions = (this.position + '').toLowerCase().match(/\S+/g) || []; - - if (positions.length < 1) { - positions.push('center'); - } - if (positions.length == 1) { - positions.push(positions[0]); - } - - if (positions[0] == 'top' || positions[0] == 'bottom' || positions[1] == 'left' || positions[1] == 'right') { - positions = [positions[1], positions[0]]; - } - - if (this.positionX != undefined) positions[0] = this.positionX.toLowerCase(); - if (this.positionY != undefined) positions[1] = this.positionY.toLowerCase(); - - self.positionX = positions[0]; - self.positionY = positions[1]; - - if (this.positionX != 'left' && this.positionX != 'right') { - if (isNaN(parseInt(this.positionX))) { - this.positionX = 'center'; - } else { - this.positionX = parseInt(this.positionX); - } - } - - if (this.positionY != 'top' && this.positionY != 'bottom') { - if (isNaN(parseInt(this.positionY))) { - this.positionY = 'center'; - } else { - this.positionY = parseInt(this.positionY); - } - } - - this.position = - this.positionX + (isNaN(this.positionX)? '' : 'px') + ' ' + - this.positionY + (isNaN(this.positionY)? '' : 'px'); - - if (navigator.userAgent.match(/(iPod|iPhone|iPad)/)) { - if (this.imageSrc && this.iosFix && !this.$element.is('img')) { - this.$element.css({ - backgroundImage: 'url(' + this.imageSrc + ')', - backgroundSize: 'cover', - backgroundPosition: this.position - }); - } - return this; - } - - if (navigator.userAgent.match(/(Android)/)) { - if (this.imageSrc && this.androidFix && !this.$element.is('img')) { - this.$element.css({ - backgroundImage: 'url(' + this.imageSrc + ')', - backgroundSize: 'cover', - backgroundPosition: this.position - }); - } - return this; - } - - // this.$mirror = $('
').prependTo('body'); - this.$mirror = $('
').prependTo( this.$element ); - - /** - * add by sa shrimp2t - * @type {*|string} - */ - var el_id = this.$element.attr( 'id' ) || ''; - if ( typeof el_id === "undefined" || el_id === '' ){ - el_id = 'parallax-'+ ( new Date().getTime() ); - this.$element.attr( 'id', el_id ); - } - this.$mirror.attr( 'id', 'mirror-' + el_id ); - - - - var slider = this.$element.find('>.parallax-slider'); - var sliderExisted = false; - - if (slider.length == 0) - this.$slider = $('').prependTo(this.$mirror); - else { - this.$slider = slider.prependTo(this.$mirror) - sliderExisted = true; - } - - this.$mirror.addClass('parallax-mirror').css({ - visibility: 'hidden', - zIndex: this.zIndex, - position: 'fixed', - top: 0, - left: 0, - overflow: 'hidden' - }); - - this.$slider.addClass('parallax-slider').one('load', function() { - if (!self.naturalHeight || !self.naturalWidth) { - self.naturalHeight = this.naturalHeight || this.height || 1; - self.naturalWidth = this.naturalWidth || this.width || 1; - } - self.aspectRatio = self.naturalWidth / self.naturalHeight; - - Parallax.isSetup || Parallax.setup(); - Parallax.sliders.push(self); - Parallax.isFresh = false; - Parallax.requestRender(); - }); - - if (!sliderExisted) - this.$slider[0].src = this.imageSrc; - - if (this.naturalHeight && this.naturalWidth || this.$slider[0].complete || slider.length > 0) { - this.$slider.trigger('load'); - } - - }; - - - // Parallax Instance Methods - - $.extend(Parallax.prototype, { - speed: 0.2, - bleed: 0, - zIndex: -100, - iosFix: true, - androidFix: true, - position: 'center', - overScrollFix: false, - - refresh: function() { - this.boxWidth = this.$element.outerWidth(); - this.boxHeight = this.$element.outerHeight() + this.bleed * 2; - this.boxOffsetTop = this.$element.offset().top - this.bleed; - this.boxOffsetLeft = this.$element.offset().left; - this.boxOffsetBottom = this.boxOffsetTop + this.boxHeight; - - var winHeight = Parallax.winHeight; - var docHeight = Parallax.docHeight; - var maxOffset = Math.min(this.boxOffsetTop, docHeight - winHeight); - var minOffset = Math.max(this.boxOffsetTop + this.boxHeight - winHeight, 0); - var imageHeightMin = this.boxHeight + (maxOffset - minOffset) * (1 - this.speed) | 0; - var imageOffsetMin = (this.boxOffsetTop - maxOffset) * (1 - this.speed) | 0; - - if (imageHeightMin * this.aspectRatio >= this.boxWidth) { - this.imageWidth = imageHeightMin * this.aspectRatio | 0; - this.imageHeight = imageHeightMin; - this.offsetBaseTop = imageOffsetMin; - - var margin = this.imageWidth - this.boxWidth; - - if (this.positionX == 'left') { - this.offsetLeft = 0; - } else if (this.positionX == 'right') { - this.offsetLeft = - margin; - } else if (!isNaN(this.positionX)) { - this.offsetLeft = Math.max(this.positionX, - margin); - } else { - this.offsetLeft = - margin / 2 | 0; - } - } else { - this.imageWidth = this.boxWidth; - this.imageHeight = this.boxWidth / this.aspectRatio | 0; - this.offsetLeft = 0; - - var margin = this.imageHeight - imageHeightMin; - - if (this.positionY == 'top') { - this.offsetBaseTop = imageOffsetMin; - } else if (this.positionY == 'bottom') { - this.offsetBaseTop = imageOffsetMin - margin; - } else if (!isNaN(this.positionY)) { - this.offsetBaseTop = imageOffsetMin + Math.max(this.positionY, - margin); - } else { - this.offsetBaseTop = imageOffsetMin - margin / 2 | 0; - } - } - }, - - render: function() { - var scrollTop = Parallax.scrollTop; - var scrollLeft = Parallax.scrollLeft; - var overScroll = this.overScrollFix ? Parallax.overScroll : 0; - var scrollBottom = scrollTop + Parallax.winHeight; - - if (this.boxOffsetBottom > scrollTop && this.boxOffsetTop <= scrollBottom) { - this.visibility = 'visible'; - } else { - this.visibility = 'hidden'; - } - this.mirrorTop = this.boxOffsetTop - scrollTop; - this.mirrorLeft = this.boxOffsetLeft - scrollLeft; - this.offsetTop = this.offsetBaseTop - this.mirrorTop * (1 - this.speed); - - this.$mirror.css({ - transform: 'translate3d(0px, 0px, 0px)', - visibility: this.visibility, - top: this.mirrorTop - overScroll, - left: this.mirrorLeft, - height: this.boxHeight, - width: this.boxWidth - }); - - this.$slider.css({ - transform: 'translate3d(0px, 0px, 0px)', - position: 'absolute', - top: this.offsetTop, - left: this.offsetLeft, - height: this.imageHeight, - width: this.imageWidth, - maxWidth: 'none' - }); - } - }); - - - // Parallax Static Methods - - $.extend(Parallax, { - scrollTop: 0, - scrollLeft: 0, - winHeight: 0, - winWidth: 0, - docHeight: 1 << 30, - docWidth: 1 << 30, - sliders: [], - isReady: false, - isFresh: false, - isBusy: false, - - setup: function() { - if (this.isReady) return; - - var $doc = $(document), $win = $(window); - - var loadDimensions = function() { - Parallax.winHeight = $win.height(); - Parallax.winWidth = $win.width(); - Parallax.docHeight = $doc.height(); - Parallax.docWidth = $doc.width(); - }; - - var loadScrollPosition = function() { - var winScrollTop = $win.scrollTop(); - var scrollTopMax = Parallax.docHeight - Parallax.winHeight; - var scrollLeftMax = Parallax.docWidth - Parallax.winWidth; - Parallax.scrollTop = Math.max(0, Math.min(scrollTopMax, winScrollTop)); - Parallax.scrollLeft = Math.max(0, Math.min(scrollLeftMax, $win.scrollLeft())); - Parallax.overScroll = Math.max(winScrollTop - scrollTopMax, Math.min(winScrollTop, 0)); - }; - - $win.on('resize.px.parallax load.px.parallax', function() { - loadDimensions(); - Parallax.isFresh = false; - Parallax.requestRender(); - }) - .on('scroll.px.parallax load.px.parallax', function() { - loadScrollPosition(); - Parallax.requestRender(); - }); - - loadDimensions(); - loadScrollPosition(); - - this.isReady = true; - }, - - configure: function(options) { - if (typeof options == 'object') { - delete options.refresh; - delete options.render; - $.extend(this.prototype, options); - } - }, - - refresh: function() { - $.each(this.sliders, function(){ this.refresh() }); - this.isFresh = true; - }, - - render: function() { - this.isFresh || this.refresh(); - $.each(this.sliders, function(){ this.render() }); - }, - - requestRender: function() { - var self = this; - - if (!this.isBusy) { - this.isBusy = true; - window.requestAnimationFrame(function() { - self.render(); - self.isBusy = false; - }); - } - }, - destroy: function(el){ - var i, - parallaxElement = $(el).data('px.parallax'); - parallaxElement.$mirror.remove(); - for(i=0; i < this.sliders.length; i+=1){ - if(this.sliders[i] == parallaxElement){ - this.sliders.splice(i, 1); - } - } - $(el).data('px.parallax', false); - if(this.sliders.length === 0){ - $(window).off('scroll.px.parallax resize.px.parallax load.px.parallax'); - this.isReady = false; - Parallax.isSetup = false; - } - } - }); - - - // Parallax Plugin Definition - - function Plugin(option) { - return this.each(function () { - var $this = $(this); - var options = typeof option == 'object' && option; - - if (this == window || this == document || $this.is('body')) { - Parallax.configure(options); - } - else if (!$this.data('px.parallax')) { - options = $.extend({}, $this.data(), options); - $this.data('px.parallax', new Parallax(this, options)); - } - else if (typeof option == 'object') - { - $.extend($this.data('px.parallax'), options); - } - if (typeof option == 'string') { - if(option == 'destroy'){ - Parallax['destroy'](this); - }else{ - Parallax[option](); - } - } - }) - }; - - var old = $.fn.parallax; - - $.fn.parallax = Plugin; - $.fn.parallax.Constructor = Parallax; - - - // Parallax No Conflict - - $.fn.parallax.noConflict = function () { - $.fn.parallax = old; - return this; - }; - - // Parallax Data-API - - $(document).on('ready.px.parallax.data-api', function () { - $('[data-parallax="scroll"]').parallax(); - }); - - }(jQuery, window, document)); diff --git a/assets/js/theme.js b/assets/js/theme.js index 7a56aee..c875e95 100755 --- a/assets/js/theme.js +++ b/assets/js/theme.js @@ -1,4 +1,79 @@ +function preload_images( images, complete_callback ) { + var id = '_img_loading_'+( new Date().getTime() ); + jQuery( 'body').append( '
' ); + jQuery.each( images, function( index, src ){ + var img = jQuery( '' ); + img.attr( 'alt', '' ); + img.attr( 'class', 'image__preload' ); + img.css( 'display', 'none' ); + img.attr( 'src', src ); + jQuery( '#'+id ).append( img ); + } ); + + jQuery( '#'+id ).imagesLoaded( function() { + if ( complete_callback ) { + complete_callback(); + } + setTimeout( function(){ + jQuery( '#'+id ).remove(); + }, 5000 ); + }); + +} + +function _to_number( string ) { + if ( typeof string === 'number' ) { + return string; + } + var n = string.match(/\d+$/); + if ( n ) { + return parseFloat( n[0] ); + } else { + return 0; + } +} + +function _to_bool( v ) { + if ( typeof v === 'boolean' ){ + return v; + } + + if ( typeof v === 'number' ){ + return v === 0 ? false : true; + } + + if ( typeof v === 'string' ) { + if ( v === 'true' || v === '1' ) { + return true; + } else { + return false; + } + } + + return false; +} + +var isMobile = { + Android: function() { + return navigator.userAgent.match(/Android/i); + }, + BlackBerry: function() { + return navigator.userAgent.match(/BlackBerry/i); + }, + iOS: function() { + return navigator.userAgent.match(/iPhone|iPad|iPod/i); + }, + Opera: function() { + return navigator.userAgent.match(/Opera Mini/i); + }, + Windows: function() { + return navigator.userAgent.match(/IEMobile/i); + }, + any: function() { + return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows()); + } +}; /** * skip-link-focus-fix.js @@ -34,149 +109,14 @@ } })(); -/** -* Responsive Videos -*/ -( function() { - jQuery('.site-content').fitVids(); -})(); - -/** - * Section: Hero Full Screen Slideshow - */ -( function() { - - jQuery(window).on('resize', function (){ - var is_transparent = jQuery( 'body').hasClass( 'header-transparent' ); - - var headerH; - var is_top_header = jQuery( '#page > .site-header').length ? true : false; - if( is_top_header && ! is_transparent ) { - headerH = jQuery('.site-header').height(); - } else { - headerH = 0; - } - jQuery('.hero-slideshow-fullscreen').css('height',(jQuery(window).height()-headerH+1)+'px'); - - }); - jQuery(window).trigger( 'resize' ); - -} )(); - - -/** - * Text rotator - */ -( function() { - - jQuery(".js-rotating").Morphext({ - // The [in] animation type. Refer to Animate.css for a list of available animations. - animation: onepress_js_settings.hero_animation, - // An array of phrases to rotate are created based on this separator. Change it if you wish to separate the phrases differently (e.g. So Simple | Very Doge | Much Wow | Such Cool). - separator: "|", - // The delay between the changing of each phrase in milliseconds. - speed: parseInt( onepress_js_settings.hero_speed ), - complete: function () { - // Called after the entrance animation is executed. - } - }); -} )(); - - - -/** - * Parallax Section - */ -( function() { - - jQuery(window).resize(function(){ - onepressParallax(); - }); - - function onepressParallax() { - var isMobile = { - Android: function() { - return navigator.userAgent.match(/Android/i); - }, - BlackBerry: function() { - return navigator.userAgent.match(/BlackBerry/i); - }, - iOS: function() { - return navigator.userAgent.match(/iPhone|iPad|iPod/i); - }, - Opera: function() { - return navigator.userAgent.match(/Opera Mini/i); - }, - Windows: function() { - return navigator.userAgent.match(/IEMobile/i); - }, - any: function() { - return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows()); - } - }; - - var testMobile = isMobile.any(); - if (testMobile == null) { - jQuery( 'body' ).addClass( 'body-desktop') .removeClass( 'body-mobile' ); - } else { - jQuery( 'body' ).addClass( 'body-mobile' ).removeClass( 'body-desktop' ); - } - - jQuery('.section-has-parallax').each(function() { - var $this = jQuery(this); - var bg = $this.find('.parallax_bg'); - - jQuery(bg).css('backgroundImage', 'url(' + $this.data('bg') + ')'); - - if (testMobile == null) { - jQuery(bg).addClass('not-mobile'); - jQuery(bg).removeClass('is-mobile'); - jQuery(bg).parallax('50%', 0.4); - } else { - //jQuery(bg).css('backgroundAttachment', 'inherit'); - jQuery(bg).removeClass('not-mobile'); - jQuery(bg).addClass('is-mobile'); - - } - }); - } -})(); - - -/** - * Reveal Animations When Scrolling - */ -( function() { - if ( onepress_js_settings.onepress_disable_animation != '1' ) { - wow = new WOW( - { - offset: 50, - mobile: false, - live: false - } - ) - wow.init(); - } -})(); - -/** - * Center vertical align for navigation. - */ -( function() { - if ( onepress_js_settings.onepress_vertical_align_menu == '1' ) { - var header_height = jQuery('.site-header').height(); - jQuery('.site-header .onepress-menu').css( 'line-height', header_height + "px" ); - } -})(); /** * Sticky header when scroll. */ -( function( $ ) { +jQuery( document ).ready( function( $ ) { if ( onepress_js_settings.onepress_disable_sticky_header != '1' ) { var is_top_header = $( '#page > .site-header').length ? true : false; - var p_to_top; $('.site-header').eq(0).wrap( ' <# } else if ( field.type == 'textarea' || field.type == 'editor' ) { #> - - <# } else if ( field.type == 'icon' ) { #> -
- - -
- + <# + var icon_class = field.value; + if ( icon_class.indexOf( 'fa-' ) != 0 ) { + icon_class = 'fa-' + field.value; + } else { + icon_class = icon_class.replace( 'fa ', '' ); + } + icon_class = icon_class.replace( 'fa-fa', '' ); + + #> +
+ + +
+ <# } #>
- <# } #> <# } #> @@ -809,3 +743,4 @@ function onepres_customizer_control_scripts(){ add_action( 'customize_controls_enqueue_scripts', 'onepres_customizer_control_scripts', 99 ); add_action( 'customize_controls_enqueue_scripts', array( 'OnePress_Editor_Scripts', 'enqueue' ), 95 ); + diff --git a/languages/en_US.pot b/languages/en_US.pot index ec33f7d..05c4c90 100644 --- a/languages/en_US.pot +++ b/languages/en_US.pot @@ -2,7 +2,7 @@ msgid "" msgstr "" "Project-Id-Version: Tema Coletivo\n" -"POT-Creation-Date: 2017-02-23 14:06-0300\n" +"POT-Creation-Date: 2017-03-25 11:22-0300\n" "PO-Revision-Date: 2016-11-09 16:07-0200\n" "Last-Translator: Diego Rojas \n" "Language-Team: Diego Rojas \n" @@ -95,47 +95,47 @@ msgstr "Barra Lateral" msgid "Page" msgstr "Página" -#: functions.php:290 +#: functions.php:331 #, fuzzy msgid "Install Required Plugins" msgstr "Instale os plugins requeridos" -#: functions.php:291 +#: functions.php:332 #, fuzzy msgid "Install Plugins" msgstr "Instale Plugins" -#: functions.php:292 +#: functions.php:333 #, fuzzy, php-format msgid "Installing Plugin: %s" msgstr "Instalando Plugin: %s" -#: functions.php:293 +#: functions.php:334 #, fuzzy msgid "Something went wrong with the plugin API." msgstr "Alguma coisa aconteceu errado na instalação da API do plugin." -#: functions.php:306 +#: functions.php:347 #, fuzzy msgid "Return to Required Plugins Installer" msgstr "Voltar para o instalador de Plugins obrigatórios" -#: functions.php:307 +#: functions.php:348 #, fuzzy msgid "Plugin activated successfully." msgstr "Plugin ativado corretamente." -#: functions.php:308 +#: functions.php:349 #, fuzzy msgid "The following plugin was activated successfully:" msgstr "Os seguintes plugins foram ativados com sucesso:" -#: functions.php:309 +#: functions.php:350 #, fuzzy, php-format msgid "No action taken. Plugin %1$s was already active." msgstr "Ação desnecessária. Plugin %1$s já está ativo." -#: functions.php:310 +#: functions.php:351 #, fuzzy, php-format msgid "" "Plugin not activated. A higher version of %s is needed for this theme. " @@ -144,12 +144,12 @@ msgstr "" "Plugin não ativado. Uma versão mais atual de %s é necessária para esse tema. " "Por favor atualize o plugin." -#: functions.php:311 +#: functions.php:352 #, fuzzy, php-format msgid "All plugins installed and activated successfully. %1$s" msgstr "Todos os plugins instalados e ativados com sucesso. %1$s" -#: functions.php:312 +#: functions.php:353 #, fuzzy msgid "Please contact the administrator of this site for help." msgstr "Por favor contate o administrador do site para obter ajuda." @@ -189,32 +189,32 @@ msgstr "Selecione um arquivo" msgid "Select image" msgstr "Selecione uma imagem" -#: inc/customizer-controls.php:440 inc/customizer-controls.php:585 +#: inc/customizer-controls.php:402 inc/customizer-controls.php:517 #, fuzzy msgid "Item" msgstr "Item" -#: inc/customizer-controls.php:566 +#: inc/customizer-controls.php:502 #, fuzzy msgid "Add an item" msgstr "Adicionar um item" -#: inc/customizer-controls.php:706 inc/customizer-controls.php:733 +#: inc/customizer-controls.php:633 inc/customizer-controls.php:667 #, fuzzy msgid "Remove" msgstr "Remover" -#: inc/customizer-controls.php:707 +#: inc/customizer-controls.php:634 #, fuzzy msgid "Add" msgstr "Adicionar" -#: inc/customizer-controls.php:707 +#: inc/customizer-controls.php:634 #, fuzzy msgid "Change" msgstr "Mudar" -#: inc/customizer-controls.php:735 +#: inc/customizer-controls.php:669 #, fuzzy msgid "Close" msgstr "Fechar" @@ -927,7 +927,7 @@ msgstr "" #: inc/customizer.php:1338 #, fuzzy msgid "Content source" -msgstr "Formatoconteúdo" +msgstr "Formato do conteúdo" #: inc/customizer.php:1342 #, fuzzy @@ -1067,7 +1067,7 @@ msgstr "Largura Completa" msgid "Display" msgstr "Mostrar" -#: inc/customizer.php:1838 +#: inc/customizer.php:1838 inc/customizer.php:2597 #, fuzzy msgid "Grid" msgstr "Grade" @@ -1130,7 +1130,7 @@ msgstr "Veja Mais" #: inc/customizer.php:1958 #, fuzzy msgid "Read More Text" -msgstr "Texto de leia mais" +msgstr "Texto de Leia Mais" #: inc/customizer.php:1972 #, fuzzy @@ -1292,12 +1292,24 @@ msgstr "Email" msgid "Fax" msgstr "Fax" -#: inc/customizer.php:2685 +#: inc/customizer.php:2577 +msgid "Blog Settings" +msgstr "" + +#: inc/customizer.php:2591 +msgid "Blog style" +msgstr "" + +#: inc/customizer.php:2598 +msgid "List" +msgstr "" + +#: inc/customizer.php:2715 #, fuzzy msgid "Search" msgstr "Pesquise" -#: inc/customizer.php:2689 +#: inc/customizer.php:2719 #, fuzzy msgid "Font Awesome" msgstr "Fonte Awesome" @@ -1510,7 +1522,7 @@ msgid "Next " msgstr "Próximo " #: template-parts/content-list.php:38 template-parts/content-page.php:21 -#: template-parts/content-single.php:18 template-parts/content.php:39 +#: template-parts/content-single.php:18 template-parts/content.php:51 #, fuzzy msgid "Pages:" msgstr "Páginas:" diff --git a/languages/pt_BR.mo b/languages/pt_BR.mo index ef994f31632e73bea4e1a67742e06e5e32dc161b..5753c9bee3b391182359256b185eeee778923fb8 100644 GIT binary patch delta 6145 zcmY+|37pS$9>?+TnEReF#)P@tV`Q468Jgsdai6h8p&C*e$tY6$Q=6kGA!64=*py?W zLG3czA++nrqNT%;NM-3FRLj2J|KDf!VSkUud!FC#_xJn%e&6f&|EnFVg7&`_T`Rs7Jh8! z4_p0&U-#T8JMo=)8Qb!K;OqPccEDij-7y+_Tl?*pO#N<*!$}y9Gq4EfU}M~Y`rNmu z4*!e^7*tPs&ef)%!8S(Dxx&B+=lWnQ_2H-wK8PC8B-8^v^LdP?USaih=2mkT>Vco4 zX7CKA<9Q6@`7WuxKjQj$BlRKJ1ZQI&ZopRfrL`wEU|Faap*lDkLvbQ%AX6|6pF^JE z)}T7P9W}s%7=vfg(}`awXo@1)05Tah(uSxTWLbMBtV_L*wU?qs1{Yf&@xCTfY^Pi6k~fXg&!jg#oMMwEhTZ;E)Kc$+S{m z(a^uXZ6p7N9Z?VJkLuw4$R%zn>b}cS9bJX$_(s%g?0sk__S=bLs44mhH8WRGGZMwS zq@_qS>!a4VF=|Bls2g`eJ#a8;28N=hda|`YiMoC|GA7S0q`>mK&A1j1phhsYiSI%j zPJJ!vfiX>;y9pbh-h$guBb$y|`}wHrR->l)FIL};T7u7zTe-8C9(ezo`I{>bb%XAh zg(FZmeg-x2g{Yn{wf6NGLVc^%-$PC5UJS#-$Ozpr48^Oc^P$bzKNyec9))fcM&Kya zlR-!tz0rl#-wEx|^s?`XmN>jQ^q zkf%^f@RMB_mF>5uqDGpHb+D7Q4?%UP6t!n2Tl*Zmg?a_5qo1Khe%j8TxAs~snSb>( zuBHEgbktNAp+49SHNqaqx33$Dnwdwe{Rxbs{yeH9i&6Jmhgyc*X0(K#G|dJE>_4fsBCiTe@rFeAsG!T#8b z`fyYS)}lJ(y-6XM!sn=w97px+jClbyf~%+whVvACvD}GE(8E|vr5F0~%EnGO95s;T zsJ&H*F?aygf#b-1J@=KJIEN9O_|-q*Lg>C;uNc$^60M$sx-Qk~O;H`s#tnR+5Vb_7 z3;pZPp$2pj<1nbmzi$FY>itiqP|k@A)Qw-nT3CS^*)pqFqHeUo++uFWwzPkQ>PQSP zx2{XUL~MxKv<0X=RATjeFjDXTBntWscnX{07F179m_J}LbzP+I_`0ZH#~V;n+uhpB zFoF6E)aMtWW@44qD>0sWHR`%O=&6TCDd?;6dpi-#_p9o4P&3jT)v;XEQVc;Zb$25B z%q>J#&3%Au2X_IP4A->S@8B?0`;(}d*nsNTj$-DYe|xw+G&IL=P+v%iH~T%zLDk!% zrgRwU2BYl!6jVoNqi(nqb^WWT&9@D8{YRLICs6|mWxZrvTjpQ8JB0>KSqADxIjE5q zqNeO-ycK&QztnCn>aBSLHG>;bGqeNM(X&>+h;^x_^KDcg3sHNjAEx469))@orr>qB z0JS!in1=6I{Rpa~=ggn2{fgD&`7%(4Q&5{Q4b`zM)P0LlGd0laqfj&8c@$D8%)|^_ zhU(e7<`L8lenE{SsXaefn2nmLhjB1Yw)#HYMg0(F1@RA+4tyz5-`&w4`5e9+G@})m zruTmx1?}!#n1f%S-ur~k{)3ZI9n3+kX;;)Y;{fCaZWQW^QT_HZGl->fDt$h)n1CcIc^+kZ>+%w@k3Nci@N)3 z+67e~g!9#nyEFedE}81MO&#{q4lPsHuF++Gkn)Wz-1Q zTYEL?z20Z_GpG(-L9KmUFMsbeL2cqTs6EmT)zLDKg4SXd-iH;ao`?1JZGhT*xu_d< zL5=7RYafrX)Tf#AQRiR5=J+;-;c?V`PGczkuCWe%!it*yPI)k`o)@Bc?+ z71>I3&_Nd;6etG%+{ND{>c7WjffoOD{ME|ZH>a%3_HoaX-GqKRzRLppK$}#@pM2Z_ zjNzW%m)0;Ahm(JiugPq3JJ~^gChQmY2&p-mQph0D+~f(oo*W_99)Gn;cjSd|qe&Fk zcf|FC<@4OD6lxC5hK?J30_*h_$WNp((T4mx8AEE0_bEI?hLL7OduR)Bj8MlY za)rE0){t1*^=h*0ZX3}N>Ct$eLMBNkx#TPI3i$_FLiCNLBiJYK_Z$A+Kq5&n_qYw8 zCaXy;a*PDgei)~ahGZVm(U0hV_q~SRPX4?|bm;xm@g%u5P~t1sTxyEXt^6|Xweo4a zg`|>ylP}0kL`Rm78-j<(r(`jCN%MaP1s&03JK00}kT#^0v?tYMBiTi+l18NFXiH%^ z`NSIb?>ieXl+p`5~xB!rtJ;vzfo4CY(;0=6WZ z$qCYqgp;*oJSic+krjdWkAjZp$fM*P@*tT^bR?1AkxOI-IZnC~9Uqc!NgSOCB|4rZ zO-Kt>IR5P8`eGd`i}~c^z_)=lPBhQqV^$Wis^NkBpfxW?WgTE+flJi!<|c^ICK6f7eyD%{vvA(f6TktF~<_ qosfC&xJ*65^%^;O+{E&lYE@>NlIU7vvYRF|o(Go!7x==b-(Z{~5IzWJPU?!D)}XSw(9>BreY?`#e7E|(5o z>NrXTIadWY6?JYj<@%-6>fATwoeRNlkyGw2hT(lIhJ~Y?3&sdkdl?*xRZ;i7iiL2# zonK`2Res%bYwg5Va}PG>hQp`_{)B}wsDg9hSOnEx3d><7jKCxe#a7rDGcgXQq3+v= zO85XfpvzQg3ecE@nS-IO+kDP>IgLXk3Dt zk-ew^=3*nB?|z_A1M5|CE*ZOF0?t6S@5Utj3`<~0Wo7}(q7tu!Rk1$OmFt8`_&L;o z#$j=sXYDIdGm?#-3i~K1vty_Z-n9#^BFpSS5go7-d8h|mMwZ=ujhf0wSOy~*rbbc&HS%Osg6&WPdCDAY z=f|Sfd?qU4g?4^9s-M@ZGXEO+ZW@&NK~((+md3YHo9rwqft#oswV+yx5~%jd$SKzV zHRWAV2@Xchz(iDkv#<%SMm_ISk3w$>=TTFZ6yw|#Y>f4I4a>(eUDVrF^KZC->M$Sm zpu4C9!>T(+(Z!%TZi7lR1C?M8)ayCK+Q(SCH;sa(XfbLE*P>=%8)_+bo4KepehZbr z8C1ttQ6s;Hn&L9Nb4s8x>bh8DEG`LIMb`~?;z%TM&sD17k01#La3TZspe@)G_oH_I z9n^?oYx--RfVwUnHMKpgJ{UFi6OdcnYslofov1zaK5EZg$9SIaex{&~<7)XMPC{kg z6xH4lgR!^O`=O?CD2Cuz)CebG5nPEnzaCR@8!CaTI1pWJf2Idv1kZOPDd<5{FcfE_ zHdmIluSaFR6E)&I^Apr{*DwR`VhEnLbSHls#< z1huvwp!P&Q>NUJ+K0rMoEViaFd-lfEsBY zmc@(K{yi$8N2uLirmo*%9c)286_w}&)J#sd^9!tf4QgQ7sQwROD4wp%{OiVZG-w20 zB41f|4>dE9_5AiIEJi&Zl}HMz!%WnY^g(qv7|GF%LQVY&48wJHJ{x;c-;LoI;??&% zERD*%7H-27RL7UFCEi561@#j6$Y6h@$<4!L%*7J;9d^O{s01<+{e-$;Vd^iU1~M6y znD>em7NSP55|!Zw)Cc89T!R&Psvd9v8(|){#rvp{G$%W4t`1lnN1_s#jOzDgYoCQh zsW0{0J-3d6Uau{v8+KTI59-1LR(}(fc^>ZJhL2E7H2n$xx>=|ZWnl!aM)kYh+IQi2 z>baJ#;r#sbk^E`L5;j# znx9x}zZvV_p2Be&^o5;v5$|CIEXh|&BacV@S~j(MACH1E9csQ{Cnj2bHY(#R)TUdG zN^B#l<9(=^I%V~I)J)vRC@jRsBL*v>5=%4tpzim^Q_x7}VUErhdhkLdLCf~9 zgM8G7vuwJF25YRzHD(*VO9ysMqQ?*1!i=uinvLs$|st>BuS96GL$=>b}hw zhWk1)|FIN~(vXZ-P&bz96=Ajb3hFXe8I222D@e`kH zE=1kG3Dw^rkAg<@p`EyaO6a~B+SNZ_4r|k1A49Mws-u2b0!O1doQg_p35Mei)b$6k z6&}T6_|V$DuqXYsiNtQ4sDN6VVW=q^hZ@mL{1+}mJ-F}h{NMi(m_&USHpG0h44pke zJpaq4|hGx9u!>ir)8v76BG zfM6@Q!KyrVL{i>PunhvUG#8ne!0|DEFA-XQ9Z6dMZzyOTuM%Sk9p4k$t!0S9WM6Px zr|=9h#~MDtql8{P9s7u_fs()0LEO88`WMzF`dfJe{z2=XL17@Vf>=ZRg_uq7!xz~3 z;L?dh#9KshI&F;ii9(bwppKcu--v6(pNTh!d?K7{I-`yl;s=7g894r_^?#Ajt1&*% z#80j{)C@O&GWES^M7&BoYi)00M=Kw}83Zqe`+%50v>^04mLwVdufBrA3$w}zS{4))xAxhXY3Q?X$=y;0YN5~7jtA7tP z@uA?tSjvm7F3uDB9@JHZ<2~YDpu|_ueBVsQal|&O-!Y%ZABnGt`NTrvOX9ZHzu;&} zp#c#=5~pw;(Si66v5R;}G$gtb!Cdn;_9HeCDMTuvV>2;~C`X(jbQIAUM=Z0p z8~VcJSfxI0A+F>kM5PqUnN;yoSWdsVauLNECNxZmO>UHy++@k*\n" "Language-Team: Diego Rojas \n" "Language: pt_BR\n" @@ -83,41 +83,41 @@ msgstr "Barra Lateral" msgid "Page" msgstr "Página" -#: functions.php:290 +#: functions.php:331 msgid "Install Required Plugins" msgstr "Instale os plugins requeridos" -#: functions.php:291 +#: functions.php:332 msgid "Install Plugins" msgstr "Instale Plugins" -#: functions.php:292 +#: functions.php:333 #, php-format msgid "Installing Plugin: %s" msgstr "Instalando Plugin: %s" -#: functions.php:293 +#: functions.php:334 msgid "Something went wrong with the plugin API." msgstr "Alguma coisa aconteceu errado na instalação da API do plugin." -#: functions.php:306 +#: functions.php:347 msgid "Return to Required Plugins Installer" msgstr "Voltar para o instalador de Plugins obrigatórios" -#: functions.php:307 +#: functions.php:348 msgid "Plugin activated successfully." msgstr "Plugin ativado corretamente." -#: functions.php:308 +#: functions.php:349 msgid "The following plugin was activated successfully:" msgstr "Os seguintes plugins foram ativados com sucesso:" -#: functions.php:309 +#: functions.php:350 #, php-format msgid "No action taken. Plugin %1$s was already active." msgstr "Ação desnecessária. Plugin %1$s já está ativo." -#: functions.php:310 +#: functions.php:351 #, php-format msgid "" "Plugin not activated. A higher version of %s is needed for this theme. " @@ -126,12 +126,12 @@ msgstr "" "Plugin não ativado. Uma versão mais atual de %s é necessária para esse tema. " "Por favor atualize o plugin." -#: functions.php:311 +#: functions.php:352 #, php-format msgid "All plugins installed and activated successfully. %1$s" msgstr "Todos os plugins instalados e ativados com sucesso. %1$s" -#: functions.php:312 +#: functions.php:353 msgid "Please contact the administrator of this site for help." msgstr "Por favor contate o administrador do site para obter ajuda." @@ -163,27 +163,27 @@ msgstr "Selecione um arquivo" msgid "Select image" msgstr "Selecione uma imagem" -#: inc/customizer-controls.php:440 inc/customizer-controls.php:585 +#: inc/customizer-controls.php:402 inc/customizer-controls.php:517 msgid "Item" msgstr "Item" -#: inc/customizer-controls.php:566 +#: inc/customizer-controls.php:502 msgid "Add an item" msgstr "Adicionar um item" -#: inc/customizer-controls.php:706 inc/customizer-controls.php:733 +#: inc/customizer-controls.php:633 inc/customizer-controls.php:667 msgid "Remove" msgstr "Remover" -#: inc/customizer-controls.php:707 +#: inc/customizer-controls.php:634 msgid "Add" msgstr "Adicionar" -#: inc/customizer-controls.php:707 +#: inc/customizer-controls.php:634 msgid "Change" msgstr "Mudar" -#: inc/customizer-controls.php:735 +#: inc/customizer-controls.php:669 msgid "Close" msgstr "Fechar" @@ -864,7 +864,7 @@ msgstr "Largura Completa" msgid "Display" msgstr "Mostrar" -#: inc/customizer.php:1838 +#: inc/customizer.php:1838 inc/customizer.php:2597 msgid "Grid" msgstr "Grade" @@ -1046,11 +1046,23 @@ msgstr "Email" msgid "Fax" msgstr "Fax" -#: inc/customizer.php:2685 +#: inc/customizer.php:2577 +msgid "Blog Settings" +msgstr "Opções do Blog" + +#: inc/customizer.php:2591 +msgid "Blog style" +msgstr "Layout do Blog" + +#: inc/customizer.php:2598 +msgid "List" +msgstr "Lista" + +#: inc/customizer.php:2715 msgid "Search" msgstr "Pesquise" -#: inc/customizer.php:2689 +#: inc/customizer.php:2719 msgid "Font Awesome" msgstr "Fonte Awesome" @@ -1234,7 +1246,7 @@ msgid "Next " msgstr "Próximo " #: template-parts/content-list.php:38 template-parts/content-page.php:21 -#: template-parts/content-single.php:18 template-parts/content.php:39 +#: template-parts/content-single.php:18 template-parts/content.php:51 msgid "Pages:" msgstr "Páginas:" diff --git a/section-parts/section-videolightbox.php b/section-parts/section-videolightbox.php index dce46de..0efa0ea 100755 --- a/section-parts/section-videolightbox.php +++ b/section-parts/section-videolightbox.php @@ -10,34 +10,38 @@ $image = get_theme_mod( 'onepress_videolightbox_image' ); if ( ! onepress_is_selective_refresh() ){ + if ( $image ) { + echo '
'; + echo '
'; + } ?> - -
- -
- class=""> +
+ class=""> + - -
- -
- - - -
- - -

- + +
+ + - - - -
- + + +

+
- + + + + + '; + } }?> .customize-partial-edit-shortcut { content: ""; } -/* Section: Counter +/* Section: Parallax ------------------------------*/ -.counter_item { - text-align: center; - margin-bottom: 35px; - margin-bottom: 2.1875rem; +#parallax-hero { + position: relative; + background: none; + overflow: hidden; } -.counter_item .counter__number { - font-size: 50px; - font-size: 3.125rem; - font-weight: 800; - color: #03c4eb; - line-height: 1; - font-family: serif, sans-serif; - text-transform: uppercase; +#parallax-hero .hero-slideshow-wrapper { + background: none; } -.counter_item .counter_title { - font-size: 18px; - font-size: 1.125rem; +#parallax-hero .hero-slideshow-wrapper::after { + background: none; } -/* Section: Parallax -------------------------------*/ -.section-has-parallax { - overflow: hidden; - position: relative; +#parallax-hero > .parallax-bg { + position: absolute; + top: 0px; + bottom: 0px; + left: 0px; + right: 0px; width: 100%; + height: 150%; + display: block; + -webkit-background-size: cover; + -moz-background-size: cover; + -o-background-size: cover; + background-size: cover; + background-repeat: no-repeat; + background-attachment: fixed; } -.parallax_bg { - background-position: center center; +#parallax-hero > .parallax-bg:before { + content: " "; + position: absolute; + top: 0px; + left: 0px; + right: 0px; + bottom: 0px; + background: rgba(0, 0, 0, 0.3); + display: block; + width: 100%; + height: 100%; + z-index: 2; +} + +#parallax-hero > .parallax-bg:after { + content: " "; + position: absolute; + top: 0px; + left: 0px; + right: 0px; + bottom: 0px; + background-image: inherit; background-repeat: no-repeat; - background-attachment: fixed; + background-position: center center; + -webkit-background-size: cover; + -moz-background-size: cover; + -o-background-size: cover; background-size: cover; + display: block; + width: 100%; height: 100%; +} + +.section-parallax { + background: none; + position: relative; + overflow: hidden; +} + +.section-parallax > section, .section-parallax .onepage-section, .section-parallax .section-inverse { + background: none; +} + +.section-parallax .parallax-bg { + position: absolute; + top: 0px; + bottom: 0px; + left: 0px; + right: 0px; width: 100%; + height: 120%; + display: block; + -webkit-background-size: cover; + -moz-background-size: cover; + -o-background-size: cover; + background-size: cover; + background-repeat: no-repeat; + background-attachment: fixed; +} + +.section-parallax .parallax-bg:before { + content: " "; position: absolute; + top: 0px; + left: 0px; + right: 0px; + bottom: 0px; + background: rgba(0, 0, 0, 0.3); display: block; - top: 0; - left: 0; + width: 100%; + height: 100%; + z-index: 2; } -.parallax_bg.is-mobile { - background-position: 50% 50% !important; +.section-parallax .parallax-bg:after { + content: " "; + position: absolute; + top: 0px; + left: 0px; + right: 0px; + bottom: 0px; + background-image: inherit; + display: block; + width: 100%; + height: 100%; } .parallax_bg_overlay { @@ -2555,6 +2627,11 @@ section > .customize-partial-edit-shortcut { color: #FFFFFF; } +.body-mobile #parallax-hero .parallax-bg, .body-mobile .section-parallax .parallax-bg { + background-attachment: local; +} + + /* Section: Team ------------------------------*/ .section-team .team-member {