├── .gitignore
├── assets
├── css
│ └── fields.css
└── js
│ └── fields.js
├── downloadButton
├── css
│ ├── frontend.css
│ └── index.php
├── downloadButton.php
├── includes
│ ├── frontend.php
│ └── index.php
├── index.php
└── js
│ ├── index.php
│ └── settings.js
├── fl-twistermc-modules.php
├── fullImage
├── fullImage.php
└── includes
│ ├── frontend.css.php
│ └── frontend.php
├── pdf-select
├── index.php
├── pdf_select.css
├── pdf_select.js
└── pdf_select.php
├── readme.md
├── slick
├── css
│ ├── frontend.css
│ ├── frontend.responsive.css
│ └── settings.css
├── includes
│ ├── frontend.css.php
│ ├── frontend.js.php
│ ├── frontend.php
│ └── settings-example.php
├── js
│ ├── frontend.js
│ ├── froogaloop2.min.js
│ ├── settings.js
│ └── slick.js
└── slick.php
└── youtube-videos
├── class-youtube-videos.php
├── css
├── frontend.css
└── index.php
├── includes
├── frontend.php
└── index.php
├── index.php
└── js
├── index.php
└── settings.js
/.gitignore:
--------------------------------------------------------------------------------
1 | *.log
2 | wp-config.php
3 | wp-content/advanced-cache.php
4 | wp-content/backup-db/
5 | wp-content/backups/
6 | wp-content/blogs.dir/
7 | wp-content/cache/
8 | wp-content/upgrade/
9 | wp-content/uploads/
10 | wp-content/wp-cache-config.php
11 | wp-content/plugins/hello.php
12 |
13 | /.htaccess
14 | /license.txt
15 | /readme.html
16 | /sitemap.xml
17 | /sitemap.xml.gz
18 | /.idea/*
19 |
20 |
21 | # Created by https://www.gitignore.io/api/macos,phpstorm
22 |
23 | ### macOS ###
24 | *.DS_Store
25 | .AppleDouble
26 | .LSOverride
27 |
28 | # Icon must end with two \r
29 | Icon
30 |
31 | # Thumbnails
32 | ._*
33 |
34 | # Files that might appear in the root of a volume
35 | .DocumentRevisions-V100
36 | .fseventsd
37 | .Spotlight-V100
38 | .TemporaryItems
39 | .Trashes
40 | .VolumeIcon.icns
41 | .com.apple.timemachine.donotpresent
42 |
43 | # Directories potentially created on remote AFP share
44 | .AppleDB
45 | .AppleDesktop
46 | Network Trash Folder
47 | Temporary Items
48 | .apdisk
49 |
50 | ### PhpStorm ###
51 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
52 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
53 |
54 | # User-specific stuff:
55 | .idea/**/workspace.xml
56 | .idea/**/tasks.xml
57 | .idea/dictionaries
58 |
59 | # Sensitive or high-churn files:
60 | .idea/**/dataSources/
61 | .idea/**/dataSources.ids
62 | .idea/**/dataSources.xml
63 | .idea/**/dataSources.local.xml
64 | .idea/**/sqlDataSources.xml
65 | .idea/**/dynamic.xml
66 | .idea/**/uiDesigner.xml
67 |
68 | # Gradle:
69 | .idea/**/gradle.xml
70 | .idea/**/libraries
71 |
72 | # CMake
73 | cmake-build-debug/
74 |
75 | # Mongo Explorer plugin:
76 | .idea/**/mongoSettings.xml
77 |
78 | ## File-based project format:
79 | *.iws
80 |
81 | ## Plugin-specific files:
82 |
83 | # IntelliJ
84 | /out/
85 |
86 | # mpeltonen/sbt-idea plugin
87 | .idea_modules/
88 |
89 | # JIRA plugin
90 | atlassian-ide-plugin.xml
91 |
92 | # Cursive Clojure plugin
93 | .idea/replstate.xml
94 |
95 | # Crashlytics plugin (for Android Studio and IntelliJ)
96 | com_crashlytics_export_strings.xml
97 | crashlytics.properties
98 | crashlytics-build.properties
99 | fabric.properties
100 |
101 | ### PhpStorm Patch ###
102 | # Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
103 |
104 | # *.iml
105 | # modules.xml
106 | # .idea/misc.xml
107 | # *.ipr
108 |
109 | # Sonarlint plugin
110 | .idea/sonarlint
111 |
112 | # End of https://www.gitignore.io/api/macos,phpstorm
113 |
114 |
--------------------------------------------------------------------------------
/assets/css/fields.css:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TwisterMc/twistermc-bb-modules/acd1dc9add8498d66985f16f646eedb0292c9a9c/assets/css/fields.css
--------------------------------------------------------------------------------
/assets/js/fields.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TwisterMc/twistermc-bb-modules/acd1dc9add8498d66985f16f646eedb0292c9a9c/assets/js/fields.js
--------------------------------------------------------------------------------
/downloadButton/css/frontend.css:
--------------------------------------------------------------------------------
1 | .fl-builder-content a.mix-flexbox {
2 | display: inline-flex;
3 | align-items: center;
4 | }
5 |
--------------------------------------------------------------------------------
/downloadButton/css/index.php:
--------------------------------------------------------------------------------
1 | __( 'Download Button', 'fl-builder' ),
23 | 'description' => __( 'Displays a button for downloading files.', 'fl-builder' ),
24 | 'category' => __( 'Advanced Modules', 'fl-builder' ),
25 | 'partial_refresh' => true,
26 | 'dir' => TMC_BB_DIR . 'downloadButton/',
27 | 'url' => TMC_BB_URL . 'downloadButton/',
28 | 'editor_export' => true, // Defaults to true and can be omitted.
29 | 'enabled' => true, // Defaults to true and can be omitted.
30 | )
31 | );
32 | }
33 |
34 | /**
35 | * Register the module and its form settings with Beaver Builder.
36 | *
37 | * What's implied, but not specifically stated, is that BB handles the instantiation of the object.
38 | *
39 | * @see \FLBuilderModel::register_module()
40 | *
41 | * @action init
42 | */
43 | }
44 | FLBuilder::register_module(
45 | 'DownloadButton',
46 | array(
47 | 'general' => array(
48 | 'title' => __( 'General', 'fl-builder' ),
49 | 'sections' => array(
50 | 'general' => array(
51 | 'title' => __( 'Settings', 'fl-builder' ),
52 | 'fields' => array(
53 | 'pdf_url' => array(
54 | 'type' => 'zestsms-pdf',
55 | 'label' => __( 'PDF', 'fl-builder' ),
56 | 'show_remove' => true,
57 | ),
58 | 'pdf_icon' => array(
59 | 'type' => 'icon',
60 | 'label' => __( 'Icon', 'fl-builder' ),
61 | 'show_remove' => true,
62 | ),
63 | 'pdf_title' => array(
64 | 'type' => 'text',
65 | 'label' => __( 'Link Text', 'fl-builder' ),
66 | 'default' => '',
67 | 'placeholder' => __( 'My Great PDF', 'fl-builder' ),
68 | ),
69 | ),
70 | ),
71 | ),
72 | ),
73 | )
74 | );
75 |
76 |
77 |
--------------------------------------------------------------------------------
/downloadButton/includes/frontend.php:
--------------------------------------------------------------------------------
1 | node ).
13 | * @var stdClass $settings The module's settings ( i.e. $module->settings ).
14 | */
15 |
16 | // If this file is called directly, abort.
17 | if ( ! defined( 'ABSPATH' ) ) {
18 | die;
19 | }
20 |
21 | $pdf_title = 'PDF';
22 | if ( $settings->pdf_title ) {
23 | $pdf_title = $settings->pdf_title;
24 | }
25 |
26 | $pdf_url = wp_get_attachment_url( $settings->pdf_url );
27 |
28 | ?>
29 |
30 |
31 | pdf_icon ) { ?>
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/downloadButton/includes/index.php:
--------------------------------------------------------------------------------
1 | 0,
43 | 'byline' => 0,
44 | 'portrait' => 0,
45 | 'badge' => 0,
46 | //'autoplay' => 1,
47 | 'loop' => 1,
48 | 'transparent' => 0,
49 | );
50 | $provider = add_query_arg( $args, $provider );
51 | }
52 | return $provider;
53 | }
54 |
55 | // Forked from Badabing and https://github.com/ZestSMS/BB-PDF-field
56 |
57 | define( 'BBEXTRA_FIELDS_VERSION' , '1.1' );
58 | define( 'BBEXTRA_FIELDS_DIR', plugin_dir_path( __FILE__ ) );
59 | define( 'BBEXTRA_FIELDS_URL', plugins_url( '/', __FILE__ ) );
60 |
61 | function BBEXTRA_extra_fields() {
62 |
63 | if ( class_exists( 'FLBuilder' ) ) {
64 | require_once ( 'pdf-select/pdf_select.php' );
65 | }
66 | }
67 |
68 | add_action( 'init', 'BBEXTRA_extra_fields' );
69 |
70 | // Create a dummy class so we can do a quick test when loading custom modules
71 | // if ( ! class_exists ( bbExtraFields ) ) { return; }
72 | class bbExtraFields { }
73 |
--------------------------------------------------------------------------------
/fullImage/fullImage.php:
--------------------------------------------------------------------------------
1 | __('Full Image', 'fl-builder'),
18 | 'description' => __('Full Width Image', 'fl-builder'),
19 | 'category' => __('Advanced Modules', 'fl-builder'),
20 | 'dir' => TMC_BB_DIR . 'fullImage/',
21 | 'url' => TMC_BB_URL . 'fullImage/',
22 | 'editor_export' => true, // Defaults to true and can be omitted.
23 | 'enabled' => true, // Defaults to true and can be omitted.
24 | ));
25 |
26 | /**
27 | * Use these methods to enqueue css and js already
28 | * registered or to register and enqueue your own.
29 | */
30 | // Already registered
31 | $this->add_css('font-awesome');
32 | }
33 |
34 | /**
35 | * Use this method to work with settings data before
36 | * it is saved. You must return the settings object.
37 | *
38 | * @method update
39 | * @param $settings {object}
40 | */
41 | public function update($settings)
42 | {
43 | $settings->textarea_field .= ' - this text was appended in the update method.';
44 |
45 | return $settings;
46 | }
47 |
48 | /**
49 | * This method will be called by the builder
50 | * right before the module is deleted.
51 | *
52 | * @method delete
53 | */
54 | public function delete()
55 | {
56 |
57 | }
58 |
59 | /**
60 | * Add additional methods to this class for use in the
61 | * other module files such as preview.php, frontend.php
62 | * and frontend.css.php.
63 | *
64 | *
65 | * @method example_method
66 | */
67 | public function example_method()
68 | {
69 |
70 | }
71 | }
72 |
73 | /**
74 | * Register the module and its form settings.
75 | */
76 | FLBuilder::register_module('BBFullImage', array(
77 | 'general' => array( // Tab
78 | 'title' => __('Full Image', 'fl-builder'), // Tab title
79 | 'sections' => array( // Tab Sections
80 | 'general' => array( // Section
81 | 'title' => __('Photo Settings', 'fl-builder'), // Section Title
82 | 'fields' => array( // Section Fields
83 | 'photo_field' => array(
84 | 'type' => 'photo',
85 | 'label' => __('Photo', 'fl-builder'),
86 | ),
87 | 'forceImageSize' => array(
88 | 'type' => 'select',
89 | 'label' => __('Force Image to Full Width', 'fl-builder'),
90 | 'default' => 'true',
91 | 'options' => array(
92 | 'true' => __('Yes', 'fl-builder'),
93 | 'false' => __('No', 'fl-builder')
94 | ),
95 | 'toggle' => array(
96 | 'false' => array(
97 | 'fields' => array( 'imageAlign' ),
98 | ),
99 | )
100 | ),
101 | 'imageAlign' => array(
102 | 'type' => 'select',
103 | 'label' => __('Image Align', 'fl-builder'),
104 | 'default' => 'left',
105 | 'options' => array(
106 | 'left' => __('Left', 'fl-builder'),
107 | 'center' => __('Center', 'fl-builder'),
108 | 'right' => __('Right', 'fl-builder')
109 | )
110 | ),
111 | 'showCaption' => array(
112 | 'type' => 'select',
113 | 'label' => __('Show Caption', 'fl-builder'),
114 | 'default' => 'false',
115 | 'options' => array(
116 | 'true' => __('Yes', 'fl-builder'),
117 | 'false' => __('No', 'fl-builder')
118 | ),
119 | 'toggle' => array(
120 | 'true' => array(
121 | 'sections' => array( 'captionStyle' ),
122 | ),
123 | )
124 | ),
125 | )
126 | ),
127 | 'captionStyle' => array( // Section
128 | 'title' => __('Caption Style', 'fl-builder'), // Section Title
129 | 'fields' => array( // Section Fields
130 | 'captionSize' => array(
131 | 'type' => 'text',
132 | 'size' => 3,
133 | 'label' => __('Caption Text Size', 'fl-builder'),
134 | 'default' => 14,
135 | 'description' => 'px'
136 | ),
137 | 'captionAlign' => array(
138 | 'type' => 'select',
139 | 'label' => __('Text Align', 'fl-builder'),
140 | 'default' => 'center',
141 | 'options' => array(
142 | 'left' => __('Left', 'fl-builder'),
143 | 'center' => __('Center', 'fl-builder'),
144 | 'right' => __('Right', 'fl-builder')
145 | )
146 | ),
147 | 'captionColor' => array(
148 | 'type' => 'color',
149 | 'label' => __('Caption Text Color', 'fl-builder'),
150 | 'default' => 'ffffff'
151 | ),
152 | 'captionBackgroundColor' => array(
153 | 'type' => 'color',
154 | 'label' => __('Caption Background Color', 'fl-builder'),
155 | 'default' => '333333',
156 | 'show_reset' => true
157 | ),
158 | 'captionPadding' => array(
159 | 'type' => 'text',
160 | 'size' => 3,
161 | 'label' => __('Caption Padding', 'fl-builder'),
162 | 'default' => 5,
163 | 'description' => 'px'
164 | ),
165 | )
166 | )
167 | )
168 | ),
169 | 'link' => array( // Tab
170 | 'title' => __('Link', 'fl-builder'), // Tab title
171 | 'sections' => array( // Tab Sections
172 | 'general-link' => array( // Section
173 | 'title' => __('Link', 'fl-builder'), // Section Title
174 | 'fields' => array( // Section Fields
175 | 'linkImage' => array(
176 | 'type' => 'select',
177 | 'label' => __('Link Image', 'fl-builder'),
178 | 'default' => 'false',
179 | 'options' => array(
180 | 'true' => __('Yes', 'fl-builder'),
181 | 'false' => __('No', 'fl-builder')
182 | ),
183 | 'toggle' => array(
184 | 'true' => array(
185 | 'sections' => array( 'linkdetails' ),
186 | ),
187 | )
188 | ),
189 | )
190 | ),
191 | 'linkdetails' => array( // Section
192 | 'title' => __('Link Details'), // Section Title
193 | 'fields' => array( // Section Fields
194 | 'linkurl' => array(
195 | 'type' => 'link',
196 | 'label' => __('Link', 'fl-builder'),
197 | ),
198 | 'linktarget' => array(
199 | 'type' => 'select',
200 | 'label' => __('Target', 'fl-builder'),
201 | 'default' => '_self',
202 | 'options' => array(
203 | '_self' => __('Same Window', 'fl-builder'),
204 | '_blank' => __('New Window', 'fl-builder'),
205 | )
206 | ),
207 | )
208 | )
209 | )
210 | ),
211 | ));
--------------------------------------------------------------------------------
/fullImage/includes/frontend.css.php:
--------------------------------------------------------------------------------
1 | /**
2 | * This file should contain frontend styles that
3 | * will be applied to individual module instances.
4 | *
5 | * You have access to three variables in this file:
6 | *
7 | * $module An instance of your module class.
8 | * $id The module's ID.
9 | * $settings The module's settings.
10 | *
11 | * Example:
12 | */
13 |
14 | forceImageSize == 'true') { ?>
15 | .fl-node- .tm_bb_fullImage img {
16 | width: 100%;
17 | height: auto;
18 | }
19 |
20 | .fl-node- .tm_bb_fullImage {
21 | text-align: imageAlign; ?>;
22 | }
23 |
24 |
25 | showCaption == 'true') {
26 | if ($settings->captionBackgroundColor == '') {
27 | $backgroundColor = 'transparent';
28 | } else {
29 | $backgroundColor = '#' . $settings->captionBackgroundColor;
30 | }
31 |
32 | if ($settings->captionPadding == '') {
33 | $captionPadding = '0';
34 | } else {
35 | $captionPadding = $settings->captionPadding;
36 | }
37 |
38 | ?>
39 | .fl-node- .tm_bb_fullImage_caption {
40 | padding: px;
41 | background: ;
42 | text-align: captionAlign; ?>;
43 | color: #captionColor; ?>;
44 | font-size: captionSize; ?>px;
45 | }
46 |
--------------------------------------------------------------------------------
/fullImage/includes/frontend.php:
--------------------------------------------------------------------------------
1 | photo_field);
14 | $image_caption = $image->post_excerpt;
15 |
16 | ?>
17 |
18 |
23 |
24 | showCaption == 'true') { ?>
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/pdf-select/index.php:
--------------------------------------------------------------------------------
1 |
11 |
12 |
13 |
14 |
15 |
16 |

17 |
18 |
filename; ?>
19 |
20 |
21 |

22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | example_method(); ?>
15 |
16 | .tmc_isVisibilyHidden {
17 | width: 1px;
18 | height: 1px;
19 | margin: -1px;
20 | padding: 0;
21 | border: 0;
22 | position: absolute;
23 | clip: rect(0 0 0 0);
24 | overflow: hidden;
25 | }
26 |
27 | /* ---------------------------------------------------------------------
28 | Slick
29 | ------------------------------------------------------------------------ */
30 |
31 | .slickModule_bb {
32 | position: relative;
33 | }
34 |
35 | .slickModule_bb button,
36 | .slickModule_bb button:hover,
37 | .slickModule_bb button:active,
38 | .slick-active button,
39 | .slick-active button:focus,
40 | .slick-active button:active {
41 | border: none;
42 | }
43 |
44 | .fl-node- .slick-arrow,
45 | .fl-node- .slickModule_bb_Pause {
46 | arrowBackgroundColor != '') { ?>background: #arrowBackgroundColor; ?>; background: transparent;
47 | color: #arrowColor; ?>;
48 | }
49 |
50 | .fl-node- .slick-arrow:before,
51 | .fl-node- .slickModule_bb_Pause:before {
52 | font-size: arrowSize; ?>px;
53 | }
54 |
55 | .fl-node- .slick-arrow:hover,
56 | .fl-node- .slickModule_bb_Pause:hover {
57 | arrowHoverBackgroundColor != '') { ?>background: #arrowHoverBackgroundColor; ?>; background: transparent;
58 | color: #arrowHoverColor; ?>;
59 | }
60 |
61 | /* ---------------------------------------------------------------------
62 | Dots
63 | ------------------------------------------------------------------------ */
64 | .slickModule_bb .slick-dots {
65 | text-align: center;
66 | }
67 |
68 | .slickModule_bb .slick-dots li {
69 | display: inline-block;
70 | padding: 5px 5px;
71 | }
72 |
73 | .fl-node- .slick-dots button {
74 | dotBackgroundColor != '') { ?>background: #dotBackgroundColor; ?>; background: transparent;
75 | color: #dotColor; ?>;
76 | font-size: dotSize; ?>px;
77 |
78 | }
79 |
80 | .fl-node- .slick-dots button:hover {
81 | dotHoverBackgroundColor != '') { ?>background: #dotHoverBackgroundColor; ?>; background: transparent;
82 | color: #dotHoverColor; ?>;
83 | }
84 |
85 | .fl-node- .slick-active button {
86 | dotActiveBackgroundColor != '') { ?>background: #dotActiveBackgroundColor; ?>; background: transparent;
87 | color: #dotActiveColor; ?>;
88 | }
89 |
90 | /* ---------------------------------------------------------------------
91 | Play/Pause
92 | ------------------------------------------------------------------------ */
93 |
94 | .slickModule_bb_Pause,
95 | .slickModule_bb_Pause:active,
96 | .slickModule_bb_Pause:focus {
97 | position: absolute;
98 | top: 10px;
99 | right: 10px;
100 | z-index: 10;
101 | }
102 |
103 | /* ---------------------------------------------------------------------
104 | Arrows
105 | ------------------------------------------------------------------------ */
106 |
107 | .slickModule_bb .slick-arrow,
108 | .slickModule_bb .slick-arrow:active,
109 | .slickModule_bb .slick-arrow:focus {
110 | position: absolute;
111 | top: 40%;
112 | z-index: 10;
113 | }
114 |
115 | .slickModule_bb .slick-arrow.slick-prev {
116 | left: 10px;
117 | }
118 |
119 | .slickModule_bb .slick-arrow.slick-next {
120 | right: 10px;
121 | }
122 |
123 | forceImageSize == 'false') { ?>
124 | .fl-node- .slick-slide img {
125 | object-fit: contain;
126 | }
127 |
128 |
129 | forceImageSize == 'true' ) { ?>
130 | /* ---------------------------------------------------------------------
131 | Force Image Size
132 | ------------------------------------------------------------------------ */
133 | .fl-node- .slick-slide img {
134 | width: 100%;
135 | height: auto;
136 | }
137 |
138 |
139 | showCaptions == 'true') { ?>
140 | /* ---------------------------------------------------------------------
141 | Photo Captions
142 | ------------------------------------------------------------------------ */
143 | .fl-node- .slickPhotoCaption {
144 | background-color: #000;
145 | padding: 10px;
146 | text-align: center;
147 | color: #fff;
148 | }
149 |
150 |
151 | adaptiveHeight == 'false') { ?>
152 | /* ---------------------------------------------------------------------
153 | Fixed Height Size
154 | ------------------------------------------------------------------------ */
155 | .fl-node- .slick-slide {
156 | height: fixedHeightSize; ?>px;
157 | }
158 |
159 | .fl-node- .slick-slide img {
160 | max-height: 100%;
161 | }
162 |
163 |
164 | /* ---------------------------------------------------------------------
165 | Embeds
166 | ------------------------------------------------------------------------ */
167 | .videoWrapper {
168 | position: relative;
169 | padding-bottom: 56.25%;
170 | height: 0;
171 | overflow: hidden;
172 | max-width: 100%;
173 | }
174 | .videoWrapper iframe {
175 | position: absolute;
176 | top: 0;
177 | left: 0;
178 | width: 100%;
179 | height: 100%;
180 | }
181 |
--------------------------------------------------------------------------------
/slick/includes/frontend.js.php:
--------------------------------------------------------------------------------
1 | /**
2 | * This file should contain frontend JavaScript that
3 | * will be applied to individual module instances.
4 | *
5 | * You have access to three variables in this file:
6 | *
7 | * $module An instance of your module class.
8 | * $id The module's ID.
9 | * $settings The module's settings.
10 | *
11 | * Example:
12 | */
13 |
14 | (function($){
15 |
16 | var $slickSlider_bb = $(".fl-node- .slickWrapper_bb");
17 | var $slickSlider_bb_pauseButton = $(".fl-node- .js-slickModule_bb_Pause");
18 | var $slickSlider_bb_autoplay = autoPlay; ?>;
19 | var $slickSlider_bb_autoplaySpeed = autoPlaySpeed; ?>;
20 | var $slickSlider_bb_adaptiveHeight = adaptiveHeight; ?>;
21 | var $slickSlider_bb_arrows = arrows; ?>;
22 | var $slickSlider_bb_dots = dots; ?>;
23 | var $slickSlider_bb_pauseOnHover = pauseOnHover; ?>;
24 | var $slickSlider_bb_pauseOnDotsHover = pauseOnDotsHover; ?>;
25 | var $slickSlider_bb_variableWidth = variableWidth; ?>;
26 | var $slickSlider_bb_centerMode = centerMode; ?>;
27 | var $slickSlider_bb_fade = fade; ?>;
28 | var $slickSlider_bb_infinite = infinite; ?>;
29 | var $slickSlider_bb_slidesToShow = slidesToShow; ?>;
30 | var $slickSlider_bb_slidesToScroll = slidesToScroll; ?>;
31 | var $slickSlider_bb_oneSlide = oneSlide; ?>;
32 | var $slickSlider_bb_verticalCarousel = verticalCarousel; ?>;
33 |
34 | photoVideo === 'video' && $settings->autoplay_videos === 'true' && !FLBuilderModel::is_builder_active()) { ?>
35 | $slickSlider_bb.on('init', function(event, slick){
36 | var srcVideo = $("iframe", slick.$slides[0])[0].src;
37 | isYouTubeVideo = srcVideo.includes('youtube');
38 | isVimeoVideo = srcVideo.includes('vimeo');
39 |
40 | function callback(isYouTubeVideo,isVimeoVideo){
41 | // YouTube
42 | if (isYouTubeVideo == true) {
43 | $("iframe", slick.$slides[0])[0].contentWindow.postMessage('{"event":"command","func":"' + 'playVideo' + '","args":""}', '*');
44 | }
45 |
46 | // Vimeo
47 | if (isVimeoVideo == true) {
48 | var iframe = $("iframe", slick.$slides[0])[0];
49 | var player = $f(iframe);
50 | player.api('play');
51 | }
52 |
53 | }
54 | /* Attempt to auto play the first slide video. */
55 | setTimeout(function() {
56 | callback(isYouTubeVideo,isVimeoVideo);
57 | }, 5000);
58 | });
59 |
60 |
61 | /* we have to setup the slider based on the number of slides we're showing and scrolling */
62 | if ($slickSlider_bb_oneSlide == true) {
63 | $slickSlider_bb.slick({
64 | autoplay: $slickSlider_bb_autoplay,
65 | autoplaySpeed: $slickSlider_bb_autoplaySpeed,
66 | arrows: $slickSlider_bb_arrows,
67 | dots: $slickSlider_bb_dots,
68 | pauseOnHover: $slickSlider_bb_pauseOnHover,
69 | pauseOnDotsHover: $slickSlider_bb_pauseOnDotsHover,
70 | vertical: $slickSlider_bb_verticalCarousel,
71 | infinite: $slickSlider_bb_infinite,
72 | adaptiveHeight: $slickSlider_bb_adaptiveHeight
73 | });
74 | } else {
75 | $slickSlider_bb.slick({
76 | autoplay: $slickSlider_bb_autoplay,
77 | autoplaySpeed: $slickSlider_bb_autoplaySpeed,
78 | arrows: $slickSlider_bb_arrows,
79 | dots: $slickSlider_bb_dots,
80 | pauseOnHover: $slickSlider_bb_pauseOnHover,
81 | pauseOnDotsHover: $slickSlider_bb_pauseOnDotsHover,
82 | vertical: $slickSlider_bb_verticalCarousel,
83 | infinite: $slickSlider_bb_infinite,
84 | slidesToShow: $slickSlider_bb_slidesToShow,
85 | slidesToScroll: $slickSlider_bb_slidesToScroll,
86 | variableWidth: $slickSlider_bb_variableWidth,
87 | centerMode: $slickSlider_bb_centerMode
88 | });
89 | }
90 |
91 | $ss_nextArrow = '';
92 | $ss_prevArrow = '';
93 | $ss_downArrow = '';
94 | $ss_upArrow = '';
95 |
96 |
97 | /* only use fade setting when using a horizontal carousel */
98 | if ($slickSlider_bb_verticalCarousel == false) {
99 | $slickSlider_bb.slick("slickSetOption", "fade", $slickSlider_bb_fade, false);
100 | $slickSlider_bb.slick("slickSetOption", "nextArrow", $ss_nextArrow, true);
101 | $slickSlider_bb.slick("slickSetOption", "prevArrow", $ss_prevArrow, true);
102 | } else {
103 | $slickSlider_bb.slick("slickSetOption", "nextArrow", $ss_downArrow, true);
104 | $slickSlider_bb.slick("slickSetOption", "prevArrow", $ss_upArrow, true);
105 | }
106 |
107 | if ($slickSlider_bb_autoplay === false) {
108 | $slickSlider_bb_pauseButton.addClass('paused');
109 | $slickSlider_bb_pauseButton.addClass('fa-play-circle');
110 | $slickSlider_bb_pauseButton.removeClass('fa-pause-circle');
111 | }
112 |
113 | $slickSlider_bb_pauseButton.on( "click", function() {
114 | if ($slickSlider_bb_pauseButton.hasClass('paused')) {
115 | $slickSlider_bb_pauseButton.removeClass('paused');
116 | $slickSlider_bb_pauseButton.removeClass('fa-play-circle');
117 | $slickSlider_bb_pauseButton.addClass('fa-pause-circle');
118 | $slickSlider_bb.slick('slickPlay');
119 | } else {
120 | $slickSlider_bb_pauseButton.addClass('paused');
121 | $slickSlider_bb_pauseButton.addClass('fa-play-circle');
122 | $slickSlider_bb_pauseButton.removeClass('fa-pause-circle');
123 | $slickSlider_bb.slick('slickPause');
124 | }
125 |
126 | });
127 |
128 | photoVideo === 'video') { ?>
129 | /* ---------------------------------------------------------------------
130 | Pause videos when changing slides
131 | Author: Thomas McMahon
132 | ------------------------------------------------------------------------ */
133 | $slickSlider_bb.on('beforeChange', function(event, slick, currentSlide, nextSlide){
134 | $('iframe').each(function(){
135 | var srcVideo = $(this)[0].src;
136 | isYouTubeVideo = srcVideo.includes('youtube');
137 | isVimeoVideo = srcVideo.includes('vimeo');
138 |
139 | // YouTube
140 | if (isYouTubeVideo == true) {
141 | $(this)[0].contentWindow.postMessage('{"event":"command","func":"' + 'pauseVideo' + '","args":""}', '*');
142 | }
143 |
144 | // Vimeo
145 | if (isVimeoVideo == true) {
146 | var iframe = $(this)[0];
147 | var player = $f(iframe);
148 | player.api('pause');
149 | }
150 | });
151 | });
152 |
153 | /* ---------------------------------------------------------------------
154 | Auto play current slide video
155 | Author: Thomas McMahon
156 | ------------------------------------------------------------------------ */
157 | autoplay_videos === 'true') { ?>
158 | $slickSlider_bb.on('afterChange', function(event, slick, currentSlide, nextSlide){
159 | var srcVideo = $("iframe", slick.$slides[currentSlide])[0].src;
160 | isYouTubeVideo = srcVideo.includes('youtube');
161 | isVimeoVideo = srcVideo.includes('vimeo');
162 |
163 | // YouTube
164 | if (isYouTubeVideo == true) {
165 | $("iframe", slick.$slides[currentSlide])[0].contentWindow.postMessage('{"event":"command","func":"' + 'playVideo' + '","args":""}', '*');
166 | }
167 |
168 | // Vimeo
169 | if (isVimeoVideo == true) {
170 | var iframe = $("iframe", slick.$slides[currentSlide])[0];
171 | var player = $f(iframe);
172 | player.api('play');
173 | }
174 |
175 | });
176 |
177 |
178 |
179 |
180 | })(jQuery);
181 |
--------------------------------------------------------------------------------
/slick/includes/frontend.php:
--------------------------------------------------------------------------------
1 |
14 |
15 |
16 |
17 | photoVideo === 'photo' ) {
20 | $arr = $settings->multiple_photos_field;
21 | if ( is_array( $arr ) ) {
22 | foreach ( $arr as &$value ) {
23 | echo '
';
24 | echo wp_get_attachment_image( $value, 'large', '', array( 'class' => 'img-responsive' ) );
25 |
26 | if ( $settings->showCaptions === 'true' ) {
27 | $imageInfo = get_post( $value );
28 | echo '' . $imageInfo->post_excerpt . '
';
29 | }
30 |
31 | echo '';
32 | }
33 | }
34 | } else {
35 | $arr = $settings->multiple_video_field;
36 | foreach ( $arr as &$value ) {
37 | echo '
';
38 | echo '';
39 | $embed_code = wp_oembed_get( $value );
40 | echo $embed_code;
41 | echo '
';
42 | echo '';
43 | }
44 | }
45 | ?>
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/slick/includes/settings-example.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
15 |
16 |
--------------------------------------------------------------------------------
/slick/js/frontend.js:
--------------------------------------------------------------------------------
1 | /**
2 | * This file should contain frontend logic for
3 | * all module instances.
4 | */
--------------------------------------------------------------------------------
/slick/js/froogaloop2.min.js:
--------------------------------------------------------------------------------
1 | var Froogaloop=function(){function e(a){return new e.fn.init(a)}function g(a,c,b){if(!b.contentWindow.postMessage)return!1;a=JSON.stringify({method:a,value:c});b.contentWindow.postMessage(a,h)}function l(a){var c,b;try{c=JSON.parse(a.data),b=c.event||c.method}catch(e){}"ready"!=b||k||(k=!0);if(!/^https?:\/\/player.vimeo.com/.test(a.origin))return!1;"*"===h&&(h=a.origin);a=c.value;var m=c.data,f=""===f?null:c.player_id;c=f?d[f][b]:d[b];b=[];if(!c)return!1;void 0!==a&&b.push(a);m&&b.push(m);f&&b.push(f);
2 | return 0 'form'.
59 | // */
60 | // FLBuilder._registerModuleHelper('example_settings_form', {
61 | //
62 | // rules: {
63 | // example: {
64 | // required: true
65 | // }
66 | // },
67 | //
68 | // init: function()
69 | // {
70 | //
71 | // },
72 | //
73 | // submit: function()
74 | // {
75 | // var result = confirm('Do you really want to save this form?');
76 | //
77 | // return result;
78 | // }
79 | // });
80 | //
81 | // })(jQuery);
--------------------------------------------------------------------------------
/slick/js/slick.js:
--------------------------------------------------------------------------------
1 | /*
2 | _ _ _ _
3 | ___| (_) ___| | __ (_)___
4 | / __| | |/ __| |/ / | / __|
5 | \__ \ | | (__| < _ | \__ \
6 | |___/_|_|\___|_|\_(_)/ |___/
7 | |__/
8 |
9 | Version: 1.6.0
10 | Author: Ken Wheeler
11 | Website: http://kenwheeler.github.io
12 | Docs: http://kenwheeler.github.io/slick
13 | Repo: http://github.com/kenwheeler/slick
14 | Issues: http://github.com/kenwheeler/slick/issues
15 |
16 | */
17 | /* global window, document, define, jQuery, setInterval, clearInterval */
18 | (function(factory) {
19 | 'use strict';
20 | if (typeof define === 'function' && define.amd) {
21 | define(['jquery'], factory);
22 | } else if (typeof exports !== 'undefined') {
23 | module.exports = factory(require('jquery'));
24 | } else {
25 | factory(jQuery);
26 | }
27 |
28 | }(function($) {
29 | 'use strict';
30 | var Slick = window.Slick || {};
31 |
32 | Slick = (function() {
33 |
34 | var instanceUid = 0;
35 |
36 | function Slick(element, settings) {
37 |
38 | var _ = this, dataSettings;
39 |
40 | _.defaults = {
41 | accessibility: true,
42 | adaptiveHeight: false,
43 | appendArrows: $(element),
44 | appendDots: $(element),
45 | arrows: true,
46 | asNavFor: null,
47 | prevArrow: '',
48 | nextArrow: '',
49 | autoplay: false,
50 | autoplaySpeed: 3000,
51 | centerMode: false,
52 | centerPadding: '50px',
53 | cssEase: 'ease',
54 | customPaging: function(slider, i) {
55 | return $('').text(i + 1);
56 | },
57 | dots: false,
58 | dotsClass: 'slick-dots',
59 | draggable: true,
60 | easing: 'linear',
61 | edgeFriction: 0.35,
62 | fade: false,
63 | focusOnSelect: false,
64 | infinite: true,
65 | initialSlide: 0,
66 | lazyLoad: 'ondemand',
67 | mobileFirst: false,
68 | pauseOnHover: true,
69 | pauseOnFocus: true,
70 | pauseOnDotsHover: false,
71 | respondTo: 'window',
72 | responsive: null,
73 | rows: 1,
74 | rtl: false,
75 | slide: '',
76 | slidesPerRow: 1,
77 | slidesToShow: 1,
78 | slidesToScroll: 1,
79 | speed: 500,
80 | swipe: true,
81 | swipeToSlide: false,
82 | touchMove: true,
83 | touchThreshold: 5,
84 | useCSS: true,
85 | useTransform: true,
86 | variableWidth: false,
87 | vertical: false,
88 | verticalSwiping: false,
89 | waitForAnimate: true,
90 | zIndex: 1000
91 | };
92 |
93 | _.initials = {
94 | animating: false,
95 | dragging: false,
96 | autoPlayTimer: null,
97 | currentDirection: 0,
98 | currentLeft: null,
99 | currentSlide: 0,
100 | direction: 1,
101 | $dots: null,
102 | listWidth: null,
103 | listHeight: null,
104 | loadIndex: 0,
105 | $nextArrow: null,
106 | $prevArrow: null,
107 | slideCount: null,
108 | slideWidth: null,
109 | $slideTrack: null,
110 | $slides: null,
111 | sliding: false,
112 | slideOffset: 0,
113 | swipeLeft: null,
114 | $list: null,
115 | touchObject: {},
116 | transformsEnabled: false,
117 | unslicked: false
118 | };
119 |
120 | $.extend(_, _.initials);
121 |
122 | _.activeBreakpoint = null;
123 | _.animType = null;
124 | _.animProp = null;
125 | _.breakpoints = [];
126 | _.breakpointSettings = [];
127 | _.cssTransitions = false;
128 | _.focussed = false;
129 | _.interrupted = false;
130 | _.hidden = 'hidden';
131 | _.paused = true;
132 | _.positionProp = null;
133 | _.respondTo = null;
134 | _.rowCount = 1;
135 | _.shouldClick = true;
136 | _.$slider = $(element);
137 | _.$slidesCache = null;
138 | _.transformType = null;
139 | _.transitionType = null;
140 | _.visibilityChange = 'visibilitychange';
141 | _.windowWidth = 0;
142 | _.windowTimer = null;
143 |
144 | dataSettings = $(element).data('slick') || {};
145 |
146 | _.options = $.extend({}, _.defaults, settings, dataSettings);
147 |
148 | _.currentSlide = _.options.initialSlide;
149 |
150 | _.originalSettings = _.options;
151 |
152 | if (typeof document.mozHidden !== 'undefined') {
153 | _.hidden = 'mozHidden';
154 | _.visibilityChange = 'mozvisibilitychange';
155 | } else if (typeof document.webkitHidden !== 'undefined') {
156 | _.hidden = 'webkitHidden';
157 | _.visibilityChange = 'webkitvisibilitychange';
158 | }
159 |
160 | _.autoPlay = $.proxy(_.autoPlay, _);
161 | _.autoPlayClear = $.proxy(_.autoPlayClear, _);
162 | _.autoPlayIterator = $.proxy(_.autoPlayIterator, _);
163 | _.changeSlide = $.proxy(_.changeSlide, _);
164 | _.clickHandler = $.proxy(_.clickHandler, _);
165 | _.selectHandler = $.proxy(_.selectHandler, _);
166 | _.setPosition = $.proxy(_.setPosition, _);
167 | _.swipeHandler = $.proxy(_.swipeHandler, _);
168 | _.dragHandler = $.proxy(_.dragHandler, _);
169 | _.keyHandler = $.proxy(_.keyHandler, _);
170 |
171 | _.instanceUid = instanceUid++;
172 |
173 | // A simple way to check for HTML strings
174 | // Strict HTML recognition (must start with <)
175 | // Extracted from jQuery v1.11 source
176 | _.htmlExpr = /^(?:\s*(<[\w\W]+>)[^>]*)$/;
177 |
178 |
179 | _.registerBreakpoints();
180 | _.init(true);
181 |
182 | }
183 |
184 | return Slick;
185 |
186 | }());
187 |
188 | Slick.prototype.activateADA = function() {
189 | var _ = this;
190 |
191 | _.$slideTrack.find('.slick-active').attr({
192 | 'aria-hidden': 'false'
193 | }).find('a, input, button, select').attr({
194 | 'tabindex': '0'
195 | });
196 |
197 | };
198 |
199 | Slick.prototype.addSlide = Slick.prototype.slickAdd = function(markup, index, addBefore) {
200 |
201 | var _ = this;
202 |
203 | if (typeof(index) === 'boolean') {
204 | addBefore = index;
205 | index = null;
206 | } else if (index < 0 || (index >= _.slideCount)) {
207 | return false;
208 | }
209 |
210 | _.unload();
211 |
212 | if (typeof(index) === 'number') {
213 | if (index === 0 && _.$slides.length === 0) {
214 | $(markup).appendTo(_.$slideTrack);
215 | } else if (addBefore) {
216 | $(markup).insertBefore(_.$slides.eq(index));
217 | } else {
218 | $(markup).insertAfter(_.$slides.eq(index));
219 | }
220 | } else {
221 | if (addBefore === true) {
222 | $(markup).prependTo(_.$slideTrack);
223 | } else {
224 | $(markup).appendTo(_.$slideTrack);
225 | }
226 | }
227 |
228 | _.$slides = _.$slideTrack.children(this.options.slide);
229 |
230 | _.$slideTrack.children(this.options.slide).detach();
231 |
232 | _.$slideTrack.append(_.$slides);
233 |
234 | _.$slides.each(function(index, element) {
235 | $(element).attr('data-slick-index', index);
236 | });
237 |
238 | _.$slidesCache = _.$slides;
239 |
240 | _.reinit();
241 |
242 | };
243 |
244 | Slick.prototype.animateHeight = function() {
245 | var _ = this;
246 | if (_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) {
247 | var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true);
248 | _.$list.animate({
249 | height: targetHeight
250 | }, _.options.speed);
251 | }
252 | };
253 |
254 | Slick.prototype.animateSlide = function(targetLeft, callback) {
255 |
256 | var animProps = {},
257 | _ = this;
258 |
259 | _.animateHeight();
260 |
261 | if (_.options.rtl === true && _.options.vertical === false) {
262 | targetLeft = -targetLeft;
263 | }
264 | if (_.transformsEnabled === false) {
265 | if (_.options.vertical === false) {
266 | _.$slideTrack.animate({
267 | left: targetLeft
268 | }, _.options.speed, _.options.easing, callback);
269 | } else {
270 | _.$slideTrack.animate({
271 | top: targetLeft
272 | }, _.options.speed, _.options.easing, callback);
273 | }
274 |
275 | } else {
276 |
277 | if (_.cssTransitions === false) {
278 | if (_.options.rtl === true) {
279 | _.currentLeft = -(_.currentLeft);
280 | }
281 | $({
282 | animStart: _.currentLeft
283 | }).animate({
284 | animStart: targetLeft
285 | }, {
286 | duration: _.options.speed,
287 | easing: _.options.easing,
288 | step: function(now) {
289 | now = Math.ceil(now);
290 | if (_.options.vertical === false) {
291 | animProps[_.animType] = 'translate(' +
292 | now + 'px, 0px)';
293 | _.$slideTrack.css(animProps);
294 | } else {
295 | animProps[_.animType] = 'translate(0px,' +
296 | now + 'px)';
297 | _.$slideTrack.css(animProps);
298 | }
299 | },
300 | complete: function() {
301 | if (callback) {
302 | callback.call();
303 | }
304 | }
305 | });
306 |
307 | } else {
308 |
309 | _.applyTransition();
310 | targetLeft = Math.ceil(targetLeft);
311 |
312 | if (_.options.vertical === false) {
313 | animProps[_.animType] = 'translate3d(' + targetLeft + 'px, 0px, 0px)';
314 | } else {
315 | animProps[_.animType] = 'translate3d(0px,' + targetLeft + 'px, 0px)';
316 | }
317 | _.$slideTrack.css(animProps);
318 |
319 | if (callback) {
320 | setTimeout(function() {
321 |
322 | _.disableTransition();
323 |
324 | callback.call();
325 | }, _.options.speed);
326 | }
327 |
328 | }
329 |
330 | }
331 |
332 | };
333 |
334 | Slick.prototype.getNavTarget = function() {
335 |
336 | var _ = this,
337 | asNavFor = _.options.asNavFor;
338 |
339 | if ( asNavFor && asNavFor !== null ) {
340 | asNavFor = $(asNavFor).not(_.$slider);
341 | }
342 |
343 | return asNavFor;
344 |
345 | };
346 |
347 | Slick.prototype.asNavFor = function(index) {
348 |
349 | var _ = this,
350 | asNavFor = _.getNavTarget();
351 |
352 | if ( asNavFor !== null && typeof asNavFor === 'object' ) {
353 | asNavFor.each(function() {
354 | var target = $(this).slick('getSlick');
355 | if(!target.unslicked) {
356 | target.slideHandler(index, true);
357 | }
358 | });
359 | }
360 |
361 | };
362 |
363 | Slick.prototype.applyTransition = function(slide) {
364 |
365 | var _ = this,
366 | transition = {};
367 |
368 | if (_.options.fade === false) {
369 | transition[_.transitionType] = _.transformType + ' ' + _.options.speed + 'ms ' + _.options.cssEase;
370 | } else {
371 | transition[_.transitionType] = 'opacity ' + _.options.speed + 'ms ' + _.options.cssEase;
372 | }
373 |
374 | if (_.options.fade === false) {
375 | _.$slideTrack.css(transition);
376 | } else {
377 | _.$slides.eq(slide).css(transition);
378 | }
379 |
380 | };
381 |
382 | Slick.prototype.autoPlay = function() {
383 |
384 | var _ = this;
385 |
386 | _.autoPlayClear();
387 |
388 | if ( _.slideCount > _.options.slidesToShow ) {
389 | _.autoPlayTimer = setInterval( _.autoPlayIterator, _.options.autoplaySpeed );
390 | }
391 |
392 | };
393 |
394 | Slick.prototype.autoPlayClear = function() {
395 |
396 | var _ = this;
397 |
398 | if (_.autoPlayTimer) {
399 | clearInterval(_.autoPlayTimer);
400 | }
401 |
402 | };
403 |
404 | Slick.prototype.autoPlayIterator = function() {
405 |
406 | var _ = this,
407 | slideTo = _.currentSlide + _.options.slidesToScroll;
408 |
409 | if ( !_.paused && !_.interrupted && !_.focussed ) {
410 |
411 | if ( _.options.infinite === false ) {
412 |
413 | if ( _.direction === 1 && ( _.currentSlide + 1 ) === ( _.slideCount - 1 )) {
414 | _.direction = 0;
415 | }
416 |
417 | else if ( _.direction === 0 ) {
418 |
419 | slideTo = _.currentSlide - _.options.slidesToScroll;
420 |
421 | if ( _.currentSlide - 1 === 0 ) {
422 | _.direction = 1;
423 | }
424 |
425 | }
426 |
427 | }
428 |
429 | _.slideHandler( slideTo );
430 |
431 | }
432 |
433 | };
434 |
435 | Slick.prototype.buildArrows = function() {
436 |
437 | var _ = this;
438 |
439 | if (_.options.arrows === true ) {
440 |
441 | _.$prevArrow = $(_.options.prevArrow).addClass('slick-arrow');
442 | _.$nextArrow = $(_.options.nextArrow).addClass('slick-arrow');
443 |
444 | if( _.slideCount > _.options.slidesToShow ) {
445 |
446 | _.$prevArrow.removeClass('slick-hidden').removeAttr('aria-hidden tabindex');
447 | _.$nextArrow.removeClass('slick-hidden').removeAttr('aria-hidden tabindex');
448 |
449 | if (_.htmlExpr.test(_.options.prevArrow)) {
450 | _.$prevArrow.prependTo(_.options.appendArrows);
451 | }
452 |
453 | if (_.htmlExpr.test(_.options.nextArrow)) {
454 | _.$nextArrow.appendTo(_.options.appendArrows);
455 | }
456 |
457 | if (_.options.infinite !== true) {
458 | _.$prevArrow
459 | .addClass('slick-disabled')
460 | .attr('aria-disabled', 'true');
461 | }
462 |
463 | } else {
464 |
465 | _.$prevArrow.add( _.$nextArrow )
466 |
467 | .addClass('slick-hidden')
468 | .attr({
469 | 'aria-disabled': 'true',
470 | 'tabindex': '-1'
471 | });
472 |
473 | }
474 |
475 | }
476 |
477 | };
478 |
479 | Slick.prototype.buildDots = function() {
480 |
481 | var _ = this,
482 | i, dot;
483 |
484 | if (_.options.dots === true && _.slideCount > _.options.slidesToShow) {
485 |
486 | _.$slider.addClass('slick-dotted');
487 |
488 | dot = $('').addClass(_.options.dotsClass);
489 |
490 | for (i = 0; i <= _.getDotCount(); i += 1) {
491 | dot.append($('').append(_.options.customPaging.call(this, _, i)));
492 | }
493 |
494 | _.$dots = dot.appendTo(_.options.appendDots);
495 |
496 | _.$dots.find('li').first().addClass('slick-active').attr('aria-hidden', 'false');
497 |
498 | }
499 |
500 | };
501 |
502 | Slick.prototype.buildOut = function() {
503 |
504 | var _ = this;
505 |
506 | _.$slides =
507 | _.$slider
508 | .children( _.options.slide + ':not(.slick-cloned)')
509 | .addClass('slick-slide');
510 |
511 | _.slideCount = _.$slides.length;
512 |
513 | _.$slides.each(function(index, element) {
514 | $(element)
515 | .attr('data-slick-index', index)
516 | .data('originalStyling', $(element).attr('style') || '');
517 | });
518 |
519 | _.$slider.addClass('slick-slider');
520 |
521 | _.$slideTrack = (_.slideCount === 0) ?
522 | $('').appendTo(_.$slider) :
523 | _.$slides.wrapAll('').parent();
524 |
525 | _.$list = _.$slideTrack.wrap(
526 | '').parent();
527 | _.$slideTrack.css('opacity', 0);
528 |
529 | if (_.options.centerMode === true || _.options.swipeToSlide === true) {
530 | _.options.slidesToScroll = 1;
531 | }
532 |
533 | $('img[data-lazy]', _.$slider).not('[src]').addClass('slick-loading');
534 |
535 | _.setupInfinite();
536 |
537 | _.buildArrows();
538 |
539 | _.buildDots();
540 |
541 | _.updateDots();
542 |
543 |
544 | _.setSlideClasses(typeof _.currentSlide === 'number' ? _.currentSlide : 0);
545 |
546 | if (_.options.draggable === true) {
547 | _.$list.addClass('draggable');
548 | }
549 |
550 | };
551 |
552 | Slick.prototype.buildRows = function() {
553 |
554 | var _ = this, a, b, c, newSlides, numOfSlides, originalSlides,slidesPerSection;
555 |
556 | newSlides = document.createDocumentFragment();
557 | originalSlides = _.$slider.children();
558 |
559 | if(_.options.rows > 1) {
560 |
561 | slidesPerSection = _.options.slidesPerRow * _.options.rows;
562 | numOfSlides = Math.ceil(
563 | originalSlides.length / slidesPerSection
564 | );
565 |
566 | for(a = 0; a < numOfSlides; a++){
567 | var slide = document.createElement('div');
568 | for(b = 0; b < _.options.rows; b++) {
569 | var row = document.createElement('div');
570 | for(c = 0; c < _.options.slidesPerRow; c++) {
571 | var target = (a * slidesPerSection + ((b * _.options.slidesPerRow) + c));
572 | if (originalSlides.get(target)) {
573 | row.appendChild(originalSlides.get(target));
574 | }
575 | }
576 | slide.appendChild(row);
577 | }
578 | newSlides.appendChild(slide);
579 | }
580 |
581 | _.$slider.empty().append(newSlides);
582 | _.$slider.children().children().children()
583 | .css({
584 | 'width':(100 / _.options.slidesPerRow) + '%',
585 | 'display': 'inline-block'
586 | });
587 |
588 | }
589 |
590 | };
591 |
592 | Slick.prototype.checkResponsive = function(initial, forceUpdate) {
593 |
594 | var _ = this,
595 | breakpoint, targetBreakpoint, respondToWidth, triggerBreakpoint = false;
596 | var sliderWidth = _.$slider.width();
597 | var windowWidth = window.innerWidth || $(window).width();
598 |
599 | if (_.respondTo === 'window') {
600 | respondToWidth = windowWidth;
601 | } else if (_.respondTo === 'slider') {
602 | respondToWidth = sliderWidth;
603 | } else if (_.respondTo === 'min') {
604 | respondToWidth = Math.min(windowWidth, sliderWidth);
605 | }
606 |
607 | if ( _.options.responsive &&
608 | _.options.responsive.length &&
609 | _.options.responsive !== null) {
610 |
611 | targetBreakpoint = null;
612 |
613 | for (breakpoint in _.breakpoints) {
614 | if (_.breakpoints.hasOwnProperty(breakpoint)) {
615 | if (_.originalSettings.mobileFirst === false) {
616 | if (respondToWidth < _.breakpoints[breakpoint]) {
617 | targetBreakpoint = _.breakpoints[breakpoint];
618 | }
619 | } else {
620 | if (respondToWidth > _.breakpoints[breakpoint]) {
621 | targetBreakpoint = _.breakpoints[breakpoint];
622 | }
623 | }
624 | }
625 | }
626 |
627 | if (targetBreakpoint !== null) {
628 | if (_.activeBreakpoint !== null) {
629 | if (targetBreakpoint !== _.activeBreakpoint || forceUpdate) {
630 | _.activeBreakpoint =
631 | targetBreakpoint;
632 | if (_.breakpointSettings[targetBreakpoint] === 'unslick') {
633 | _.unslick(targetBreakpoint);
634 | } else {
635 | _.options = $.extend({}, _.originalSettings,
636 | _.breakpointSettings[
637 | targetBreakpoint]);
638 | if (initial === true) {
639 | _.currentSlide = _.options.initialSlide;
640 | }
641 | _.refresh(initial);
642 | }
643 | triggerBreakpoint = targetBreakpoint;
644 | }
645 | } else {
646 | _.activeBreakpoint = targetBreakpoint;
647 | if (_.breakpointSettings[targetBreakpoint] === 'unslick') {
648 | _.unslick(targetBreakpoint);
649 | } else {
650 | _.options = $.extend({}, _.originalSettings,
651 | _.breakpointSettings[
652 | targetBreakpoint]);
653 | if (initial === true) {
654 | _.currentSlide = _.options.initialSlide;
655 | }
656 | _.refresh(initial);
657 | }
658 | triggerBreakpoint = targetBreakpoint;
659 | }
660 | } else {
661 | if (_.activeBreakpoint !== null) {
662 | _.activeBreakpoint = null;
663 | _.options = _.originalSettings;
664 | if (initial === true) {
665 | _.currentSlide = _.options.initialSlide;
666 | }
667 | _.refresh(initial);
668 | triggerBreakpoint = targetBreakpoint;
669 | }
670 | }
671 |
672 | // only trigger breakpoints during an actual break. not on initialize.
673 | if( !initial && triggerBreakpoint !== false ) {
674 | _.$slider.trigger('breakpoint', [_, triggerBreakpoint]);
675 | }
676 | }
677 |
678 | };
679 |
680 | Slick.prototype.changeSlide = function(event, dontAnimate) {
681 |
682 | var _ = this,
683 | $target = $(event.currentTarget),
684 | indexOffset, slideOffset, unevenOffset;
685 |
686 | // If target is a link, prevent default action.
687 | if($target.is('a')) {
688 | event.preventDefault();
689 | }
690 |
691 | // If target is not the element (ie: a child), find the .
692 | if(!$target.is('li')) {
693 | $target = $target.closest('li');
694 | }
695 |
696 | unevenOffset = (_.slideCount % _.options.slidesToScroll !== 0);
697 | indexOffset = unevenOffset ? 0 : (_.slideCount - _.currentSlide) % _.options.slidesToScroll;
698 |
699 | switch (event.data.message) {
700 |
701 | case 'previous':
702 | slideOffset = indexOffset === 0 ? _.options.slidesToScroll : _.options.slidesToShow - indexOffset;
703 | if (_.slideCount > _.options.slidesToShow) {
704 | _.slideHandler(_.currentSlide - slideOffset, false, dontAnimate);
705 | }
706 | break;
707 |
708 | case 'next':
709 | slideOffset = indexOffset === 0 ? _.options.slidesToScroll : indexOffset;
710 | if (_.slideCount > _.options.slidesToShow) {
711 | _.slideHandler(_.currentSlide + slideOffset, false, dontAnimate);
712 | }
713 | break;
714 |
715 | case 'index':
716 | var index = event.data.index === 0 ? 0 :
717 | event.data.index || $target.index() * _.options.slidesToScroll;
718 |
719 | _.slideHandler(_.checkNavigable(index), false, dontAnimate);
720 | $target.children().trigger('focus');
721 | break;
722 |
723 | default:
724 | return;
725 | }
726 |
727 | };
728 |
729 | Slick.prototype.checkNavigable = function(index) {
730 |
731 | var _ = this,
732 | navigables, prevNavigable;
733 |
734 | navigables = _.getNavigableIndexes();
735 | prevNavigable = 0;
736 | if (index > navigables[navigables.length - 1]) {
737 | index = navigables[navigables.length - 1];
738 | } else {
739 | for (var n in navigables) {
740 | if (index < navigables[n]) {
741 | index = prevNavigable;
742 | break;
743 | }
744 | prevNavigable = navigables[n];
745 | }
746 | }
747 |
748 | return index;
749 | };
750 |
751 | Slick.prototype.cleanUpEvents = function() {
752 |
753 | var _ = this;
754 |
755 | if (_.options.dots && _.$dots !== null) {
756 |
757 | $('li', _.$dots)
758 | .off('click.slick', _.changeSlide)
759 | .off('mouseenter.slick', $.proxy(_.interrupt, _, true))
760 | .off('mouseleave.slick', $.proxy(_.interrupt, _, false));
761 |
762 | }
763 |
764 | _.$slider.off('focus.slick blur.slick');
765 |
766 | if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) {
767 | _.$prevArrow && _.$prevArrow.off('click.slick', _.changeSlide);
768 | _.$nextArrow && _.$nextArrow.off('click.slick', _.changeSlide);
769 | }
770 |
771 | _.$list.off('touchstart.slick mousedown.slick', _.swipeHandler);
772 | _.$list.off('touchmove.slick mousemove.slick', _.swipeHandler);
773 | _.$list.off('touchend.slick mouseup.slick', _.swipeHandler);
774 | _.$list.off('touchcancel.slick mouseleave.slick', _.swipeHandler);
775 |
776 | _.$list.off('click.slick', _.clickHandler);
777 |
778 | $(document).off(_.visibilityChange, _.visibility);
779 |
780 | _.cleanUpSlideEvents();
781 |
782 | if (_.options.accessibility === true) {
783 | _.$list.off('keydown.slick', _.keyHandler);
784 | }
785 |
786 | if (_.options.focusOnSelect === true) {
787 | $(_.$slideTrack).children().off('click.slick', _.selectHandler);
788 | }
789 |
790 | $(window).off('orientationchange.slick.slick-' + _.instanceUid, _.orientationChange);
791 |
792 | $(window).off('resize.slick.slick-' + _.instanceUid, _.resize);
793 |
794 | $('[draggable!=true]', _.$slideTrack).off('dragstart', _.preventDefault);
795 |
796 | $(window).off('load.slick.slick-' + _.instanceUid, _.setPosition);
797 | $(document).off('ready.slick.slick-' + _.instanceUid, _.setPosition);
798 |
799 | };
800 |
801 | Slick.prototype.cleanUpSlideEvents = function() {
802 |
803 | var _ = this;
804 |
805 | _.$list.off('mouseenter.slick', $.proxy(_.interrupt, _, true));
806 | _.$list.off('mouseleave.slick', $.proxy(_.interrupt, _, false));
807 |
808 | };
809 |
810 | Slick.prototype.cleanUpRows = function() {
811 |
812 | var _ = this, originalSlides;
813 |
814 | if(_.options.rows > 1) {
815 | originalSlides = _.$slides.children().children();
816 | originalSlides.removeAttr('style');
817 | _.$slider.empty().append(originalSlides);
818 | }
819 |
820 | };
821 |
822 | Slick.prototype.clickHandler = function(event) {
823 |
824 | var _ = this;
825 |
826 | if (_.shouldClick === false) {
827 | event.stopImmediatePropagation();
828 | event.stopPropagation();
829 | event.preventDefault();
830 | }
831 |
832 | };
833 |
834 | Slick.prototype.destroy = function(refresh) {
835 |
836 | var _ = this;
837 |
838 | _.autoPlayClear();
839 |
840 | _.touchObject = {};
841 |
842 | _.cleanUpEvents();
843 |
844 | $('.slick-cloned', _.$slider).detach();
845 |
846 | if (_.$dots) {
847 | _.$dots.remove();
848 | }
849 |
850 |
851 | if ( _.$prevArrow && _.$prevArrow.length ) {
852 |
853 | _.$prevArrow
854 | .removeClass('slick-disabled slick-arrow slick-hidden')
855 | .removeAttr('aria-hidden aria-disabled tabindex')
856 | .css('display','');
857 |
858 | if ( _.htmlExpr.test( _.options.prevArrow )) {
859 | _.$prevArrow.remove();
860 | }
861 | }
862 |
863 | if ( _.$nextArrow && _.$nextArrow.length ) {
864 |
865 | _.$nextArrow
866 | .removeClass('slick-disabled slick-arrow slick-hidden')
867 | .removeAttr('aria-hidden aria-disabled tabindex')
868 | .css('display','');
869 |
870 | if ( _.htmlExpr.test( _.options.nextArrow )) {
871 | _.$nextArrow.remove();
872 | }
873 |
874 | }
875 |
876 |
877 | if (_.$slides) {
878 |
879 | _.$slides
880 | .removeClass('slick-slide slick-active slick-center slick-visible slick-current')
881 | .removeAttr('aria-hidden')
882 | .removeAttr('data-slick-index')
883 | .each(function(){
884 | $(this).attr('style', $(this).data('originalStyling'));
885 | });
886 |
887 | _.$slideTrack.children(this.options.slide).detach();
888 |
889 | _.$slideTrack.detach();
890 |
891 | _.$list.detach();
892 |
893 | _.$slider.append(_.$slides);
894 | }
895 |
896 | _.cleanUpRows();
897 |
898 | _.$slider.removeClass('slick-slider');
899 | _.$slider.removeClass('slick-initialized');
900 | _.$slider.removeClass('slick-dotted');
901 |
902 | _.unslicked = true;
903 |
904 | if(!refresh) {
905 | _.$slider.trigger('destroy', [_]);
906 | }
907 |
908 | };
909 |
910 | Slick.prototype.disableTransition = function(slide) {
911 |
912 | var _ = this,
913 | transition = {};
914 |
915 | transition[_.transitionType] = '';
916 |
917 | if (_.options.fade === false) {
918 | _.$slideTrack.css(transition);
919 | } else {
920 | _.$slides.eq(slide).css(transition);
921 | }
922 |
923 | };
924 |
925 | Slick.prototype.fadeSlide = function(slideIndex, callback) {
926 |
927 | var _ = this;
928 |
929 | if (_.cssTransitions === false) {
930 |
931 | _.$slides.eq(slideIndex).css({
932 | zIndex: _.options.zIndex
933 | });
934 |
935 | _.$slides.eq(slideIndex).animate({
936 | opacity: 1
937 | }, _.options.speed, _.options.easing, callback);
938 |
939 | } else {
940 |
941 | _.applyTransition(slideIndex);
942 |
943 | _.$slides.eq(slideIndex).css({
944 | opacity: 1,
945 | zIndex: _.options.zIndex
946 | });
947 |
948 | if (callback) {
949 | setTimeout(function() {
950 |
951 | _.disableTransition(slideIndex);
952 |
953 | callback.call();
954 | }, _.options.speed);
955 | }
956 |
957 | }
958 |
959 | };
960 |
961 | Slick.prototype.fadeSlideOut = function(slideIndex) {
962 |
963 | var _ = this;
964 |
965 | if (_.cssTransitions === false) {
966 |
967 | _.$slides.eq(slideIndex).animate({
968 | opacity: 0,
969 | zIndex: _.options.zIndex - 2
970 | }, _.options.speed, _.options.easing);
971 |
972 | } else {
973 |
974 | _.applyTransition(slideIndex);
975 |
976 | _.$slides.eq(slideIndex).css({
977 | opacity: 0,
978 | zIndex: _.options.zIndex - 2
979 | });
980 |
981 | }
982 |
983 | };
984 |
985 | Slick.prototype.filterSlides = Slick.prototype.slickFilter = function(filter) {
986 |
987 | var _ = this;
988 |
989 | if (filter !== null) {
990 |
991 | _.$slidesCache = _.$slides;
992 |
993 | _.unload();
994 |
995 | _.$slideTrack.children(this.options.slide).detach();
996 |
997 | _.$slidesCache.filter(filter).appendTo(_.$slideTrack);
998 |
999 | _.reinit();
1000 |
1001 | }
1002 |
1003 | };
1004 |
1005 | Slick.prototype.focusHandler = function() {
1006 |
1007 | var _ = this;
1008 |
1009 | _.$slider
1010 | .off('focus.slick blur.slick')
1011 | .on('focus.slick blur.slick',
1012 | '*:not(.slick-arrow)', function(event) {
1013 |
1014 | event.stopImmediatePropagation();
1015 | var $sf = $(this);
1016 |
1017 | setTimeout(function() {
1018 |
1019 | if( _.options.pauseOnFocus ) {
1020 | _.focussed = $sf.is(':focus');
1021 | _.autoPlay();
1022 | }
1023 |
1024 | }, 0);
1025 |
1026 | });
1027 | };
1028 |
1029 | Slick.prototype.getCurrent = Slick.prototype.slickCurrentSlide = function() {
1030 |
1031 | var _ = this;
1032 | return _.currentSlide;
1033 |
1034 | };
1035 |
1036 | Slick.prototype.getDotCount = function() {
1037 |
1038 | var _ = this;
1039 |
1040 | var breakPoint = 0;
1041 | var counter = 0;
1042 | var pagerQty = 0;
1043 |
1044 | if (_.options.infinite === true) {
1045 | while (breakPoint < _.slideCount) {
1046 | ++pagerQty;
1047 | breakPoint = counter + _.options.slidesToScroll;
1048 | counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow;
1049 | }
1050 | } else if (_.options.centerMode === true) {
1051 | pagerQty = _.slideCount;
1052 | } else if(!_.options.asNavFor) {
1053 | pagerQty = 1 + Math.ceil((_.slideCount - _.options.slidesToShow) / _.options.slidesToScroll);
1054 | }else {
1055 | while (breakPoint < _.slideCount) {
1056 | ++pagerQty;
1057 | breakPoint = counter + _.options.slidesToScroll;
1058 | counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow;
1059 | }
1060 | }
1061 |
1062 | return pagerQty - 1;
1063 |
1064 | };
1065 |
1066 | Slick.prototype.getLeft = function(slideIndex) {
1067 |
1068 | var _ = this,
1069 | targetLeft,
1070 | verticalHeight,
1071 | verticalOffset = 0,
1072 | targetSlide;
1073 |
1074 | _.slideOffset = 0;
1075 | verticalHeight = _.$slides.first().outerHeight(true);
1076 |
1077 | if (_.options.infinite === true) {
1078 | if (_.slideCount > _.options.slidesToShow) {
1079 | _.slideOffset = (_.slideWidth * _.options.slidesToShow) * -1;
1080 | verticalOffset = (verticalHeight * _.options.slidesToShow) * -1;
1081 | }
1082 | if (_.slideCount % _.options.slidesToScroll !== 0) {
1083 | if (slideIndex + _.options.slidesToScroll > _.slideCount && _.slideCount > _.options.slidesToShow) {
1084 | if (slideIndex > _.slideCount) {
1085 | _.slideOffset = ((_.options.slidesToShow - (slideIndex - _.slideCount)) * _.slideWidth) * -1;
1086 | verticalOffset = ((_.options.slidesToShow - (slideIndex - _.slideCount)) * verticalHeight) * -1;
1087 | } else {
1088 | _.slideOffset = ((_.slideCount % _.options.slidesToScroll) * _.slideWidth) * -1;
1089 | verticalOffset = ((_.slideCount % _.options.slidesToScroll) * verticalHeight) * -1;
1090 | }
1091 | }
1092 | }
1093 | } else {
1094 | if (slideIndex + _.options.slidesToShow > _.slideCount) {
1095 | _.slideOffset = ((slideIndex + _.options.slidesToShow) - _.slideCount) * _.slideWidth;
1096 | verticalOffset = ((slideIndex + _.options.slidesToShow) - _.slideCount) * verticalHeight;
1097 | }
1098 | }
1099 |
1100 | if (_.slideCount <= _.options.slidesToShow) {
1101 | _.slideOffset = 0;
1102 | verticalOffset = 0;
1103 | }
1104 |
1105 | if (_.options.centerMode === true && _.options.infinite === true) {
1106 | _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2) - _.slideWidth;
1107 | } else if (_.options.centerMode === true) {
1108 | _.slideOffset = 0;
1109 | _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2);
1110 | }
1111 |
1112 | if (_.options.vertical === false) {
1113 | targetLeft = ((slideIndex * _.slideWidth) * -1) + _.slideOffset;
1114 | } else {
1115 | targetLeft = ((slideIndex * verticalHeight) * -1) + verticalOffset;
1116 | }
1117 |
1118 | if (_.options.variableWidth === true) {
1119 |
1120 | if (_.slideCount <= _.options.slidesToShow || _.options.infinite === false) {
1121 | targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex);
1122 | } else {
1123 | targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex + _.options.slidesToShow);
1124 | }
1125 |
1126 | if (_.options.rtl === true) {
1127 | if (targetSlide[0]) {
1128 | targetLeft = (_.$slideTrack.width() - targetSlide[0].offsetLeft - targetSlide.width()) * -1;
1129 | } else {
1130 | targetLeft = 0;
1131 | }
1132 | } else {
1133 | targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0;
1134 | }
1135 |
1136 | if (_.options.centerMode === true) {
1137 | if (_.slideCount <= _.options.slidesToShow || _.options.infinite === false) {
1138 | targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex);
1139 | } else {
1140 | targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex + _.options.slidesToShow + 1);
1141 | }
1142 |
1143 | if (_.options.rtl === true) {
1144 | if (targetSlide[0]) {
1145 | targetLeft = (_.$slideTrack.width() - targetSlide[0].offsetLeft - targetSlide.width()) * -1;
1146 | } else {
1147 | targetLeft = 0;
1148 | }
1149 | } else {
1150 | targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0;
1151 | }
1152 |
1153 | targetLeft += (_.$list.width() - targetSlide.outerWidth()) / 2;
1154 | }
1155 | }
1156 |
1157 | return targetLeft;
1158 |
1159 | };
1160 |
1161 | Slick.prototype.getOption = Slick.prototype.slickGetOption = function(option) {
1162 |
1163 | var _ = this;
1164 |
1165 | return _.options[option];
1166 |
1167 | };
1168 |
1169 | Slick.prototype.getNavigableIndexes = function() {
1170 |
1171 | var _ = this,
1172 | breakPoint = 0,
1173 | counter = 0,
1174 | indexes = [],
1175 | max;
1176 |
1177 | if (_.options.infinite === false) {
1178 | max = _.slideCount;
1179 | } else {
1180 | breakPoint = _.options.slidesToScroll * -1;
1181 | counter = _.options.slidesToScroll * -1;
1182 | max = _.slideCount * 2;
1183 | }
1184 |
1185 | while (breakPoint < max) {
1186 | indexes.push(breakPoint);
1187 | breakPoint = counter + _.options.slidesToScroll;
1188 | counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow;
1189 | }
1190 |
1191 | return indexes;
1192 |
1193 | };
1194 |
1195 | Slick.prototype.getSlick = function() {
1196 |
1197 | return this;
1198 |
1199 | };
1200 |
1201 | Slick.prototype.getSlideCount = function() {
1202 |
1203 | var _ = this,
1204 | slidesTraversed, swipedSlide, centerOffset;
1205 |
1206 | centerOffset = _.options.centerMode === true ? _.slideWidth * Math.floor(_.options.slidesToShow / 2) : 0;
1207 |
1208 | if (_.options.swipeToSlide === true) {
1209 | _.$slideTrack.find('.slick-slide').each(function(index, slide) {
1210 | if (slide.offsetLeft - centerOffset + ($(slide).outerWidth() / 2) > (_.swipeLeft * -1)) {
1211 | swipedSlide = slide;
1212 | return false;
1213 | }
1214 | });
1215 |
1216 | slidesTraversed = Math.abs($(swipedSlide).attr('data-slick-index') - _.currentSlide) || 1;
1217 |
1218 | return slidesTraversed;
1219 |
1220 | } else {
1221 | return _.options.slidesToScroll;
1222 | }
1223 |
1224 | };
1225 |
1226 | Slick.prototype.goTo = Slick.prototype.slickGoTo = function(slide, dontAnimate) {
1227 |
1228 | var _ = this;
1229 |
1230 | _.changeSlide({
1231 | data: {
1232 | message: 'index',
1233 | index: parseInt(slide)
1234 | }
1235 | }, dontAnimate);
1236 |
1237 | };
1238 |
1239 | Slick.prototype.init = function(creation) {
1240 |
1241 | var _ = this;
1242 |
1243 | if (!$(_.$slider).hasClass('slick-initialized')) {
1244 |
1245 | $(_.$slider).addClass('slick-initialized');
1246 |
1247 | _.buildRows();
1248 | _.buildOut();
1249 | _.setProps();
1250 | _.startLoad();
1251 | _.loadSlider();
1252 | _.initializeEvents();
1253 | _.updateArrows();
1254 | _.updateDots();
1255 | _.checkResponsive(true);
1256 | _.focusHandler();
1257 |
1258 | }
1259 |
1260 | if (creation) {
1261 | _.$slider.trigger('init', [_]);
1262 | }
1263 |
1264 | if (_.options.accessibility === true) {
1265 | _.initADA();
1266 | }
1267 |
1268 | if ( _.options.autoplay ) {
1269 |
1270 | _.paused = false;
1271 | _.autoPlay();
1272 |
1273 | }
1274 |
1275 | };
1276 |
1277 | Slick.prototype.initADA = function() {
1278 | var _ = this;
1279 | _.$slides.add(_.$slideTrack.find('.slick-cloned')).attr({
1280 | 'aria-hidden': 'true',
1281 | 'tabindex': '-1'
1282 | }).find('a, input, button, select').attr({
1283 | 'tabindex': '-1'
1284 | });
1285 |
1286 | _.$slideTrack.attr('role', 'listbox');
1287 |
1288 | _.$slides.not(_.$slideTrack.find('.slick-cloned')).each(function(i) {
1289 | $(this).attr({
1290 | 'role': 'option',
1291 | 'aria-describedby': 'slick-slide' + _.instanceUid + i + ''
1292 | });
1293 | });
1294 |
1295 | if (_.$dots !== null) {
1296 | _.$dots.attr('role', 'tablist').find('li').each(function(i) {
1297 | $(this).attr({
1298 | 'role': 'presentation',
1299 | 'aria-selected': 'false',
1300 | 'aria-controls': 'navigation' + _.instanceUid + i + '',
1301 | 'id': 'slick-slide' + _.instanceUid + i + ''
1302 | });
1303 | })
1304 | .first().attr('aria-selected', 'true').end()
1305 | .find('button').attr('role', 'button').end()
1306 | .closest('div').attr('role', 'toolbar');
1307 | }
1308 | _.activateADA();
1309 |
1310 | };
1311 |
1312 | Slick.prototype.initArrowEvents = function() {
1313 |
1314 | var _ = this;
1315 |
1316 | if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) {
1317 | _.$prevArrow
1318 | .off('click.slick')
1319 | .on('click.slick', {
1320 | message: 'previous'
1321 | }, _.changeSlide);
1322 | _.$nextArrow
1323 | .off('click.slick')
1324 | .on('click.slick', {
1325 | message: 'next'
1326 | }, _.changeSlide);
1327 | }
1328 |
1329 | };
1330 |
1331 | Slick.prototype.initDotEvents = function() {
1332 |
1333 | var _ = this;
1334 |
1335 | if (_.options.dots === true && _.slideCount > _.options.slidesToShow) {
1336 | $('li', _.$dots).on('click.slick', {
1337 | message: 'index'
1338 | }, _.changeSlide);
1339 | }
1340 |
1341 | if ( _.options.dots === true && _.options.pauseOnDotsHover === true ) {
1342 |
1343 | $('li', _.$dots)
1344 | .on('mouseenter.slick', $.proxy(_.interrupt, _, true))
1345 | .on('mouseleave.slick', $.proxy(_.interrupt, _, false));
1346 |
1347 | }
1348 |
1349 | };
1350 |
1351 | Slick.prototype.initSlideEvents = function() {
1352 |
1353 | var _ = this;
1354 |
1355 | if ( _.options.pauseOnHover ) {
1356 |
1357 | _.$list.on('mouseenter.slick', $.proxy(_.interrupt, _, true));
1358 | _.$list.on('mouseleave.slick', $.proxy(_.interrupt, _, false));
1359 |
1360 | }
1361 |
1362 | };
1363 |
1364 | Slick.prototype.initializeEvents = function() {
1365 |
1366 | var _ = this;
1367 |
1368 | _.initArrowEvents();
1369 |
1370 | _.initDotEvents();
1371 | _.initSlideEvents();
1372 |
1373 | _.$list.on('touchstart.slick mousedown.slick', {
1374 | action: 'start'
1375 | }, _.swipeHandler);
1376 | _.$list.on('touchmove.slick mousemove.slick', {
1377 | action: 'move'
1378 | }, _.swipeHandler);
1379 | _.$list.on('touchend.slick mouseup.slick', {
1380 | action: 'end'
1381 | }, _.swipeHandler);
1382 | _.$list.on('touchcancel.slick mouseleave.slick', {
1383 | action: 'end'
1384 | }, _.swipeHandler);
1385 |
1386 | _.$list.on('click.slick', _.clickHandler);
1387 |
1388 | $(document).on(_.visibilityChange, $.proxy(_.visibility, _));
1389 |
1390 | if (_.options.accessibility === true) {
1391 | _.$list.on('keydown.slick', _.keyHandler);
1392 | }
1393 |
1394 | if (_.options.focusOnSelect === true) {
1395 | $(_.$slideTrack).children().on('click.slick', _.selectHandler);
1396 | }
1397 |
1398 | $(window).on('orientationchange.slick.slick-' + _.instanceUid, $.proxy(_.orientationChange, _));
1399 |
1400 | $(window).on('resize.slick.slick-' + _.instanceUid, $.proxy(_.resize, _));
1401 |
1402 | $('[draggable!=true]', _.$slideTrack).on('dragstart', _.preventDefault);
1403 |
1404 | $(window).on('load.slick.slick-' + _.instanceUid, _.setPosition);
1405 | $(document).on('ready.slick.slick-' + _.instanceUid, _.setPosition);
1406 |
1407 | };
1408 |
1409 | Slick.prototype.initUI = function() {
1410 |
1411 | var _ = this;
1412 |
1413 | if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) {
1414 |
1415 | _.$prevArrow.show();
1416 | _.$nextArrow.show();
1417 |
1418 | }
1419 |
1420 | if (_.options.dots === true && _.slideCount > _.options.slidesToShow) {
1421 |
1422 | _.$dots.show();
1423 |
1424 | }
1425 |
1426 | };
1427 |
1428 | Slick.prototype.keyHandler = function(event) {
1429 |
1430 | var _ = this;
1431 | //Dont slide if the cursor is inside the form fields and arrow keys are pressed
1432 | if(!event.target.tagName.match('TEXTAREA|INPUT|SELECT')) {
1433 | if (event.keyCode === 37 && _.options.accessibility === true) {
1434 | _.changeSlide({
1435 | data: {
1436 | message: _.options.rtl === true ? 'next' : 'previous'
1437 | }
1438 | });
1439 | } else if (event.keyCode === 39 && _.options.accessibility === true) {
1440 | _.changeSlide({
1441 | data: {
1442 | message: _.options.rtl === true ? 'previous' : 'next'
1443 | }
1444 | });
1445 | }
1446 | }
1447 |
1448 | };
1449 |
1450 | Slick.prototype.lazyLoad = function() {
1451 |
1452 | var _ = this,
1453 | loadRange, cloneRange, rangeStart, rangeEnd;
1454 |
1455 | function loadImages(imagesScope) {
1456 |
1457 | $('img[data-lazy]', imagesScope).each(function() {
1458 |
1459 | var image = $(this),
1460 | imageSource = $(this).attr('data-lazy'),
1461 | imageToLoad = document.createElement('img');
1462 |
1463 | imageToLoad.onload = function() {
1464 |
1465 | image
1466 | .animate({ opacity: 0 }, 100, function() {
1467 | image
1468 | .attr('src', imageSource)
1469 | .animate({ opacity: 1 }, 200, function() {
1470 | image
1471 | .removeAttr('data-lazy')
1472 | .removeClass('slick-loading');
1473 | });
1474 | _.$slider.trigger('lazyLoaded', [_, image, imageSource]);
1475 | });
1476 |
1477 | };
1478 |
1479 | imageToLoad.onerror = function() {
1480 |
1481 | image
1482 | .removeAttr( 'data-lazy' )
1483 | .removeClass( 'slick-loading' )
1484 | .addClass( 'slick-lazyload-error' );
1485 |
1486 | _.$slider.trigger('lazyLoadError', [ _, image, imageSource ]);
1487 |
1488 | };
1489 |
1490 | imageToLoad.src = imageSource;
1491 |
1492 | });
1493 |
1494 | }
1495 |
1496 | if (_.options.centerMode === true) {
1497 | if (_.options.infinite === true) {
1498 | rangeStart = _.currentSlide + (_.options.slidesToShow / 2 + 1);
1499 | rangeEnd = rangeStart + _.options.slidesToShow + 2;
1500 | } else {
1501 | rangeStart = Math.max(0, _.currentSlide - (_.options.slidesToShow / 2 + 1));
1502 | rangeEnd = 2 + (_.options.slidesToShow / 2 + 1) + _.currentSlide;
1503 | }
1504 | } else {
1505 | rangeStart = _.options.infinite ? _.options.slidesToShow + _.currentSlide : _.currentSlide;
1506 | rangeEnd = Math.ceil(rangeStart + _.options.slidesToShow);
1507 | if (_.options.fade === true) {
1508 | if (rangeStart > 0) rangeStart--;
1509 | if (rangeEnd <= _.slideCount) rangeEnd++;
1510 | }
1511 | }
1512 |
1513 | loadRange = _.$slider.find('.slick-slide').slice(rangeStart, rangeEnd);
1514 | loadImages(loadRange);
1515 |
1516 | if (_.slideCount <= _.options.slidesToShow) {
1517 | cloneRange = _.$slider.find('.slick-slide');
1518 | loadImages(cloneRange);
1519 | } else
1520 | if (_.currentSlide >= _.slideCount - _.options.slidesToShow) {
1521 | cloneRange = _.$slider.find('.slick-cloned').slice(0, _.options.slidesToShow);
1522 | loadImages(cloneRange);
1523 | } else if (_.currentSlide === 0) {
1524 | cloneRange = _.$slider.find('.slick-cloned').slice(_.options.slidesToShow * -1);
1525 | loadImages(cloneRange);
1526 | }
1527 |
1528 | };
1529 |
1530 | Slick.prototype.loadSlider = function() {
1531 |
1532 | var _ = this;
1533 |
1534 | _.setPosition();
1535 |
1536 | _.$slideTrack.css({
1537 | opacity: 1
1538 | });
1539 |
1540 | _.$slider.removeClass('slick-loading');
1541 |
1542 | _.initUI();
1543 |
1544 | if (_.options.lazyLoad === 'progressive') {
1545 | _.progressiveLazyLoad();
1546 | }
1547 |
1548 | };
1549 |
1550 | Slick.prototype.next = Slick.prototype.slickNext = function() {
1551 |
1552 | var _ = this;
1553 |
1554 | _.changeSlide({
1555 | data: {
1556 | message: 'next'
1557 | }
1558 | });
1559 |
1560 | };
1561 |
1562 | Slick.prototype.orientationChange = function() {
1563 |
1564 | var _ = this;
1565 |
1566 | _.checkResponsive();
1567 | _.setPosition();
1568 |
1569 | };
1570 |
1571 | Slick.prototype.pause = Slick.prototype.slickPause = function() {
1572 |
1573 | var _ = this;
1574 |
1575 | _.autoPlayClear();
1576 | _.paused = true;
1577 |
1578 | };
1579 |
1580 | Slick.prototype.play = Slick.prototype.slickPlay = function() {
1581 |
1582 | var _ = this;
1583 |
1584 | _.autoPlay();
1585 | _.options.autoplay = true;
1586 | _.paused = false;
1587 | _.focussed = false;
1588 | _.interrupted = false;
1589 |
1590 | };
1591 |
1592 | Slick.prototype.postSlide = function(index) {
1593 |
1594 | var _ = this;
1595 |
1596 | if( !_.unslicked ) {
1597 |
1598 | _.$slider.trigger('afterChange', [_, index]);
1599 |
1600 | _.animating = false;
1601 |
1602 | _.setPosition();
1603 |
1604 | _.swipeLeft = null;
1605 |
1606 | if ( _.options.autoplay ) {
1607 | _.autoPlay();
1608 | }
1609 |
1610 | if (_.options.accessibility === true) {
1611 | _.initADA();
1612 | }
1613 |
1614 | }
1615 |
1616 | };
1617 |
1618 | Slick.prototype.prev = Slick.prototype.slickPrev = function() {
1619 |
1620 | var _ = this;
1621 |
1622 | _.changeSlide({
1623 | data: {
1624 | message: 'previous'
1625 | }
1626 | });
1627 |
1628 | };
1629 |
1630 | Slick.prototype.preventDefault = function(event) {
1631 |
1632 | event.preventDefault();
1633 |
1634 | };
1635 |
1636 | Slick.prototype.progressiveLazyLoad = function( tryCount ) {
1637 |
1638 | tryCount = tryCount || 1;
1639 |
1640 | var _ = this,
1641 | $imgsToLoad = $( 'img[data-lazy]', _.$slider ),
1642 | image,
1643 | imageSource,
1644 | imageToLoad;
1645 |
1646 | if ( $imgsToLoad.length ) {
1647 |
1648 | image = $imgsToLoad.first();
1649 | imageSource = image.attr('data-lazy');
1650 | imageToLoad = document.createElement('img');
1651 |
1652 | imageToLoad.onload = function() {
1653 |
1654 | image
1655 | .attr( 'src', imageSource )
1656 | .removeAttr('data-lazy')
1657 | .removeClass('slick-loading');
1658 |
1659 | if ( _.options.adaptiveHeight === true ) {
1660 | _.setPosition();
1661 | }
1662 |
1663 | _.$slider.trigger('lazyLoaded', [ _, image, imageSource ]);
1664 | _.progressiveLazyLoad();
1665 |
1666 | };
1667 |
1668 | imageToLoad.onerror = function() {
1669 |
1670 | if ( tryCount < 3 ) {
1671 |
1672 | /**
1673 | * try to load the image 3 times,
1674 | * leave a slight delay so we don't get
1675 | * servers blocking the request.
1676 | */
1677 | setTimeout( function() {
1678 | _.progressiveLazyLoad( tryCount + 1 );
1679 | }, 500 );
1680 |
1681 | } else {
1682 |
1683 | image
1684 | .removeAttr( 'data-lazy' )
1685 | .removeClass( 'slick-loading' )
1686 | .addClass( 'slick-lazyload-error' );
1687 |
1688 | _.$slider.trigger('lazyLoadError', [ _, image, imageSource ]);
1689 |
1690 | _.progressiveLazyLoad();
1691 |
1692 | }
1693 |
1694 | };
1695 |
1696 | imageToLoad.src = imageSource;
1697 |
1698 | } else {
1699 |
1700 | _.$slider.trigger('allImagesLoaded', [ _ ]);
1701 |
1702 | }
1703 |
1704 | };
1705 |
1706 | Slick.prototype.refresh = function( initializing ) {
1707 |
1708 | var _ = this, currentSlide, lastVisibleIndex;
1709 |
1710 | lastVisibleIndex = _.slideCount - _.options.slidesToShow;
1711 |
1712 | // in non-infinite sliders, we don't want to go past the
1713 | // last visible index.
1714 | if( !_.options.infinite && ( _.currentSlide > lastVisibleIndex )) {
1715 | _.currentSlide = lastVisibleIndex;
1716 | }
1717 |
1718 | // if less slides than to show, go to start.
1719 | if ( _.slideCount <= _.options.slidesToShow ) {
1720 | _.currentSlide = 0;
1721 |
1722 | }
1723 |
1724 | currentSlide = _.currentSlide;
1725 |
1726 | _.destroy(true);
1727 |
1728 | $.extend(_, _.initials, { currentSlide: currentSlide });
1729 |
1730 | _.init();
1731 |
1732 | if( !initializing ) {
1733 |
1734 | _.changeSlide({
1735 | data: {
1736 | message: 'index',
1737 | index: currentSlide
1738 | }
1739 | }, false);
1740 |
1741 | }
1742 |
1743 | };
1744 |
1745 | Slick.prototype.registerBreakpoints = function() {
1746 |
1747 | var _ = this, breakpoint, currentBreakpoint, l,
1748 | responsiveSettings = _.options.responsive || null;
1749 |
1750 | if ( $.type(responsiveSettings) === 'array' && responsiveSettings.length ) {
1751 |
1752 | _.respondTo = _.options.respondTo || 'window';
1753 |
1754 | for ( breakpoint in responsiveSettings ) {
1755 |
1756 | l = _.breakpoints.length-1;
1757 | currentBreakpoint = responsiveSettings[breakpoint].breakpoint;
1758 |
1759 | if (responsiveSettings.hasOwnProperty(breakpoint)) {
1760 |
1761 | // loop through the breakpoints and cut out any existing
1762 | // ones with the same breakpoint number, we don't want dupes.
1763 | while( l >= 0 ) {
1764 | if( _.breakpoints[l] && _.breakpoints[l] === currentBreakpoint ) {
1765 | _.breakpoints.splice(l,1);
1766 | }
1767 | l--;
1768 | }
1769 |
1770 | _.breakpoints.push(currentBreakpoint);
1771 | _.breakpointSettings[currentBreakpoint] = responsiveSettings[breakpoint].settings;
1772 |
1773 | }
1774 |
1775 | }
1776 |
1777 | _.breakpoints.sort(function(a, b) {
1778 | return ( _.options.mobileFirst ) ? a-b : b-a;
1779 | });
1780 |
1781 | }
1782 |
1783 | };
1784 |
1785 | Slick.prototype.reinit = function() {
1786 |
1787 | var _ = this;
1788 |
1789 | _.$slides =
1790 | _.$slideTrack
1791 | .children(_.options.slide)
1792 | .addClass('slick-slide');
1793 |
1794 | _.slideCount = _.$slides.length;
1795 |
1796 | if (_.currentSlide >= _.slideCount && _.currentSlide !== 0) {
1797 | _.currentSlide = _.currentSlide - _.options.slidesToScroll;
1798 | }
1799 |
1800 | if (_.slideCount <= _.options.slidesToShow) {
1801 | _.currentSlide = 0;
1802 | }
1803 |
1804 | _.registerBreakpoints();
1805 |
1806 | _.setProps();
1807 | _.setupInfinite();
1808 | _.buildArrows();
1809 | _.updateArrows();
1810 | _.initArrowEvents();
1811 | _.buildDots();
1812 | _.updateDots();
1813 | _.initDotEvents();
1814 | _.cleanUpSlideEvents();
1815 | _.initSlideEvents();
1816 |
1817 | _.checkResponsive(false, true);
1818 |
1819 | if (_.options.focusOnSelect === true) {
1820 | $(_.$slideTrack).children().on('click.slick', _.selectHandler);
1821 | }
1822 |
1823 | _.setSlideClasses(typeof _.currentSlide === 'number' ? _.currentSlide : 0);
1824 |
1825 | _.setPosition();
1826 | _.focusHandler();
1827 |
1828 | _.paused = !_.options.autoplay;
1829 | _.autoPlay();
1830 |
1831 | _.$slider.trigger('reInit', [_]);
1832 |
1833 | };
1834 |
1835 | Slick.prototype.resize = function() {
1836 |
1837 | var _ = this;
1838 |
1839 | if ($(window).width() !== _.windowWidth) {
1840 | clearTimeout(_.windowDelay);
1841 | _.windowDelay = window.setTimeout(function() {
1842 | _.windowWidth = $(window).width();
1843 | _.checkResponsive();
1844 | if( !_.unslicked ) { _.setPosition(); }
1845 | }, 50);
1846 | }
1847 | };
1848 |
1849 | Slick.prototype.removeSlide = Slick.prototype.slickRemove = function(index, removeBefore, removeAll) {
1850 |
1851 | var _ = this;
1852 |
1853 | if (typeof(index) === 'boolean') {
1854 | removeBefore = index;
1855 | index = removeBefore === true ? 0 : _.slideCount - 1;
1856 | } else {
1857 | index = removeBefore === true ? --index : index;
1858 | }
1859 |
1860 | if (_.slideCount < 1 || index < 0 || index > _.slideCount - 1) {
1861 | return false;
1862 | }
1863 |
1864 | _.unload();
1865 |
1866 | if (removeAll === true) {
1867 | _.$slideTrack.children().remove();
1868 | } else {
1869 | _.$slideTrack.children(this.options.slide).eq(index).remove();
1870 | }
1871 |
1872 | _.$slides = _.$slideTrack.children(this.options.slide);
1873 |
1874 | _.$slideTrack.children(this.options.slide).detach();
1875 |
1876 | _.$slideTrack.append(_.$slides);
1877 |
1878 | _.$slidesCache = _.$slides;
1879 |
1880 | _.reinit();
1881 |
1882 | };
1883 |
1884 | Slick.prototype.setCSS = function(position) {
1885 |
1886 | var _ = this,
1887 | positionProps = {},
1888 | x, y;
1889 |
1890 | if (_.options.rtl === true) {
1891 | position = -position;
1892 | }
1893 | x = _.positionProp == 'left' ? Math.ceil(position) + 'px' : '0px';
1894 | y = _.positionProp == 'top' ? Math.ceil(position) + 'px' : '0px';
1895 |
1896 | positionProps[_.positionProp] = position;
1897 |
1898 | if (_.transformsEnabled === false) {
1899 | _.$slideTrack.css(positionProps);
1900 | } else {
1901 | positionProps = {};
1902 | if (_.cssTransitions === false) {
1903 | positionProps[_.animType] = 'translate(' + x + ', ' + y + ')';
1904 | _.$slideTrack.css(positionProps);
1905 | } else {
1906 | positionProps[_.animType] = 'translate3d(' + x + ', ' + y + ', 0px)';
1907 | _.$slideTrack.css(positionProps);
1908 | }
1909 | }
1910 |
1911 | };
1912 |
1913 | Slick.prototype.setDimensions = function() {
1914 |
1915 | var _ = this;
1916 |
1917 | if (_.options.vertical === false) {
1918 | if (_.options.centerMode === true) {
1919 | _.$list.css({
1920 | padding: ('0px ' + _.options.centerPadding)
1921 | });
1922 | }
1923 | } else {
1924 | _.$list.height(_.$slides.first().outerHeight(true) * _.options.slidesToShow);
1925 | if (_.options.centerMode === true) {
1926 | _.$list.css({
1927 | padding: (_.options.centerPadding + ' 0px')
1928 | });
1929 | }
1930 | }
1931 |
1932 | _.listWidth = _.$list.width();
1933 | _.listHeight = _.$list.height();
1934 |
1935 |
1936 | if (_.options.vertical === false && _.options.variableWidth === false) {
1937 | _.slideWidth = Math.ceil(_.listWidth / _.options.slidesToShow);
1938 | _.$slideTrack.width(Math.ceil((_.slideWidth * _.$slideTrack.children('.slick-slide').length)));
1939 |
1940 | } else if (_.options.variableWidth === true) {
1941 | _.$slideTrack.width(5000 * _.slideCount);
1942 | } else {
1943 | _.slideWidth = Math.ceil(_.listWidth);
1944 | _.$slideTrack.height(Math.ceil((_.$slides.first().outerHeight(true) * _.$slideTrack.children('.slick-slide').length)));
1945 | }
1946 |
1947 | var offset = _.$slides.first().outerWidth(true) - _.$slides.first().width();
1948 | if (_.options.variableWidth === false) _.$slideTrack.children('.slick-slide').width(_.slideWidth - offset);
1949 |
1950 | };
1951 |
1952 | Slick.prototype.setFade = function() {
1953 |
1954 | var _ = this,
1955 | targetLeft;
1956 |
1957 | _.$slides.each(function(index, element) {
1958 | targetLeft = (_.slideWidth * index) * -1;
1959 | if (_.options.rtl === true) {
1960 | $(element).css({
1961 | position: 'relative',
1962 | right: targetLeft,
1963 | top: 0,
1964 | zIndex: _.options.zIndex - 2,
1965 | opacity: 0
1966 | });
1967 | } else {
1968 | $(element).css({
1969 | position: 'relative',
1970 | left: targetLeft,
1971 | top: 0,
1972 | zIndex: _.options.zIndex - 2,
1973 | opacity: 0
1974 | });
1975 | }
1976 | });
1977 |
1978 | _.$slides.eq(_.currentSlide).css({
1979 | zIndex: _.options.zIndex - 1,
1980 | opacity: 1
1981 | });
1982 |
1983 | };
1984 |
1985 | Slick.prototype.setHeight = function() {
1986 |
1987 | var _ = this;
1988 |
1989 | if (_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) {
1990 | var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true);
1991 | _.$list.css('height', targetHeight);
1992 | }
1993 |
1994 | };
1995 |
1996 | Slick.prototype.setOption =
1997 | Slick.prototype.slickSetOption = function() {
1998 |
1999 | /**
2000 | * accepts arguments in format of:
2001 | *
2002 | * - for changing a single option's value:
2003 | * .slick("setOption", option, value, refresh )
2004 | *
2005 | * - for changing a set of responsive options:
2006 | * .slick("setOption", 'responsive', [{}, ...], refresh )
2007 | *
2008 | * - for updating multiple values at once (not responsive)
2009 | * .slick("setOption", { 'option': value, ... }, refresh )
2010 | */
2011 |
2012 | var _ = this, l, item, option, value, refresh = false, type;
2013 |
2014 | if( $.type( arguments[0] ) === 'object' ) {
2015 |
2016 | option = arguments[0];
2017 | refresh = arguments[1];
2018 | type = 'multiple';
2019 |
2020 | } else if ( $.type( arguments[0] ) === 'string' ) {
2021 |
2022 | option = arguments[0];
2023 | value = arguments[1];
2024 | refresh = arguments[2];
2025 |
2026 | if ( arguments[0] === 'responsive' && $.type( arguments[1] ) === 'array' ) {
2027 |
2028 | type = 'responsive';
2029 |
2030 | } else if ( typeof arguments[1] !== 'undefined' ) {
2031 |
2032 | type = 'single';
2033 |
2034 | }
2035 |
2036 | }
2037 |
2038 | if ( type === 'single' ) {
2039 |
2040 | _.options[option] = value;
2041 |
2042 |
2043 | } else if ( type === 'multiple' ) {
2044 |
2045 | $.each( option , function( opt, val ) {
2046 |
2047 | _.options[opt] = val;
2048 |
2049 | });
2050 |
2051 |
2052 | } else if ( type === 'responsive' ) {
2053 |
2054 | for ( item in value ) {
2055 |
2056 | if( $.type( _.options.responsive ) !== 'array' ) {
2057 |
2058 | _.options.responsive = [ value[item] ];
2059 |
2060 | } else {
2061 |
2062 | l = _.options.responsive.length-1;
2063 |
2064 | // loop through the responsive object and splice out duplicates.
2065 | while( l >= 0 ) {
2066 |
2067 | if( _.options.responsive[l].breakpoint === value[item].breakpoint ) {
2068 |
2069 | _.options.responsive.splice(l,1);
2070 |
2071 | }
2072 |
2073 | l--;
2074 |
2075 | }
2076 |
2077 | _.options.responsive.push( value[item] );
2078 |
2079 | }
2080 |
2081 | }
2082 |
2083 | }
2084 |
2085 | if ( refresh ) {
2086 |
2087 | _.unload();
2088 | _.reinit();
2089 |
2090 | }
2091 |
2092 | };
2093 |
2094 | Slick.prototype.setPosition = function() {
2095 |
2096 | var _ = this;
2097 |
2098 | _.setDimensions();
2099 |
2100 | _.setHeight();
2101 |
2102 | if (_.options.fade === false) {
2103 | _.setCSS(_.getLeft(_.currentSlide));
2104 | } else {
2105 | _.setFade();
2106 | }
2107 |
2108 | _.$slider.trigger('setPosition', [_]);
2109 |
2110 | };
2111 |
2112 | Slick.prototype.setProps = function() {
2113 |
2114 | var _ = this,
2115 | bodyStyle = document.body.style;
2116 |
2117 | _.positionProp = _.options.vertical === true ? 'top' : 'left';
2118 |
2119 | if (_.positionProp === 'top') {
2120 | _.$slider.addClass('slick-vertical');
2121 | } else {
2122 | _.$slider.removeClass('slick-vertical');
2123 | }
2124 |
2125 | if (bodyStyle.WebkitTransition !== undefined ||
2126 | bodyStyle.MozTransition !== undefined ||
2127 | bodyStyle.msTransition !== undefined) {
2128 | if (_.options.useCSS === true) {
2129 | _.cssTransitions = true;
2130 | }
2131 | }
2132 |
2133 | if ( _.options.fade ) {
2134 | if ( typeof _.options.zIndex === 'number' ) {
2135 | if( _.options.zIndex < 3 ) {
2136 | _.options.zIndex = 3;
2137 | }
2138 | } else {
2139 | _.options.zIndex = _.defaults.zIndex;
2140 | }
2141 | }
2142 |
2143 | if (bodyStyle.OTransform !== undefined) {
2144 | _.animType = 'OTransform';
2145 | _.transformType = '-o-transform';
2146 | _.transitionType = 'OTransition';
2147 | if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false;
2148 | }
2149 | if (bodyStyle.MozTransform !== undefined) {
2150 | _.animType = 'MozTransform';
2151 | _.transformType = '-moz-transform';
2152 | _.transitionType = 'MozTransition';
2153 | if (bodyStyle.perspectiveProperty === undefined && bodyStyle.MozPerspective === undefined) _.animType = false;
2154 | }
2155 | if (bodyStyle.webkitTransform !== undefined) {
2156 | _.animType = 'webkitTransform';
2157 | _.transformType = '-webkit-transform';
2158 | _.transitionType = 'webkitTransition';
2159 | if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false;
2160 | }
2161 | if (bodyStyle.msTransform !== undefined) {
2162 | _.animType = 'msTransform';
2163 | _.transformType = '-ms-transform';
2164 | _.transitionType = 'msTransition';
2165 | if (bodyStyle.msTransform === undefined) _.animType = false;
2166 | }
2167 | if (bodyStyle.transform !== undefined && _.animType !== false) {
2168 | _.animType = 'transform';
2169 | _.transformType = 'transform';
2170 | _.transitionType = 'transition';
2171 | }
2172 | _.transformsEnabled = _.options.useTransform && (_.animType !== null && _.animType !== false);
2173 | };
2174 |
2175 |
2176 | Slick.prototype.setSlideClasses = function(index) {
2177 |
2178 | var _ = this,
2179 | centerOffset, allSlides, indexOffset, remainder;
2180 |
2181 | allSlides = _.$slider
2182 | .find('.slick-slide')
2183 | .removeClass('slick-active slick-center slick-current')
2184 | .attr('aria-hidden', 'true');
2185 |
2186 | _.$slides
2187 | .eq(index)
2188 | .addClass('slick-current');
2189 |
2190 | if (_.options.centerMode === true) {
2191 |
2192 | centerOffset = Math.floor(_.options.slidesToShow / 2);
2193 |
2194 | if (_.options.infinite === true) {
2195 |
2196 | if (index >= centerOffset && index <= (_.slideCount - 1) - centerOffset) {
2197 |
2198 | _.$slides
2199 | .slice(index - centerOffset, index + centerOffset + 1)
2200 | .addClass('slick-active')
2201 | .attr('aria-hidden', 'false');
2202 |
2203 | } else {
2204 |
2205 | indexOffset = _.options.slidesToShow + index;
2206 | allSlides
2207 | .slice(indexOffset - centerOffset + 1, indexOffset + centerOffset + 2)
2208 | .addClass('slick-active')
2209 | .attr('aria-hidden', 'false');
2210 |
2211 | }
2212 |
2213 | if (index === 0) {
2214 |
2215 | allSlides
2216 | .eq(allSlides.length - 1 - _.options.slidesToShow)
2217 | .addClass('slick-center');
2218 |
2219 | } else if (index === _.slideCount - 1) {
2220 |
2221 | allSlides
2222 | .eq(_.options.slidesToShow)
2223 | .addClass('slick-center');
2224 |
2225 | }
2226 |
2227 | }
2228 |
2229 | _.$slides
2230 | .eq(index)
2231 | .addClass('slick-center');
2232 |
2233 | } else {
2234 |
2235 | if (index >= 0 && index <= (_.slideCount - _.options.slidesToShow)) {
2236 |
2237 | _.$slides
2238 | .slice(index, index + _.options.slidesToShow)
2239 | .addClass('slick-active')
2240 | .attr('aria-hidden', 'false');
2241 |
2242 | } else if (allSlides.length <= _.options.slidesToShow) {
2243 |
2244 | allSlides
2245 | .addClass('slick-active')
2246 | .attr('aria-hidden', 'false');
2247 |
2248 | } else {
2249 |
2250 | remainder = _.slideCount % _.options.slidesToShow;
2251 | indexOffset = _.options.infinite === true ? _.options.slidesToShow + index : index;
2252 |
2253 | if (_.options.slidesToShow == _.options.slidesToScroll && (_.slideCount - index) < _.options.slidesToShow) {
2254 |
2255 | allSlides
2256 | .slice(indexOffset - (_.options.slidesToShow - remainder), indexOffset + remainder)
2257 | .addClass('slick-active')
2258 | .attr('aria-hidden', 'false');
2259 |
2260 | } else {
2261 |
2262 | allSlides
2263 | .slice(indexOffset, indexOffset + _.options.slidesToShow)
2264 | .addClass('slick-active')
2265 | .attr('aria-hidden', 'false');
2266 |
2267 | }
2268 |
2269 | }
2270 |
2271 | }
2272 |
2273 | if (_.options.lazyLoad === 'ondemand') {
2274 | _.lazyLoad();
2275 | }
2276 |
2277 | };
2278 |
2279 | Slick.prototype.setupInfinite = function() {
2280 |
2281 | var _ = this,
2282 | i, slideIndex, infiniteCount;
2283 |
2284 | if (_.options.fade === true) {
2285 | _.options.centerMode = false;
2286 | }
2287 |
2288 | if (_.options.infinite === true && _.options.fade === false) {
2289 |
2290 | slideIndex = null;
2291 |
2292 | if (_.slideCount > _.options.slidesToShow) {
2293 |
2294 | if (_.options.centerMode === true) {
2295 | infiniteCount = _.options.slidesToShow + 1;
2296 | } else {
2297 | infiniteCount = _.options.slidesToShow;
2298 | }
2299 |
2300 | for (i = _.slideCount; i > (_.slideCount -
2301 | infiniteCount); i -= 1) {
2302 | slideIndex = i - 1;
2303 | $(_.$slides[slideIndex]).clone(true).attr('id', '')
2304 | .attr('data-slick-index', slideIndex - _.slideCount)
2305 | .prependTo(_.$slideTrack).addClass('slick-cloned');
2306 | }
2307 | for (i = 0; i < infiniteCount + _.slideCount; i += 1) { slideIndex = i; $(_.$slides[slideIndex]).clone(true).attr('id', '') .attr('data-slick-index', slideIndex + _.slideCount) .appendTo(_.$slideTrack).addClass('slick-cloned'); } _.$slideTrack.find('.slick-cloned').find('[id]').each(function () { $(this).attr('id', ''); });
2308 |
2309 | }
2310 |
2311 | }
2312 |
2313 | };
2314 |
2315 | Slick.prototype.interrupt = function( toggle ) {
2316 |
2317 | var _ = this;
2318 |
2319 | if( !toggle ) {
2320 | _.autoPlay();
2321 | }
2322 | _.interrupted = toggle;
2323 |
2324 | };
2325 |
2326 | Slick.prototype.selectHandler = function(event) {
2327 |
2328 | var _ = this;
2329 |
2330 | var targetElement =
2331 | $(event.target).is('.slick-slide') ?
2332 | $(event.target) :
2333 | $(event.target).parents('.slick-slide');
2334 |
2335 | var index = parseInt(targetElement.attr('data-slick-index'));
2336 |
2337 | if (!index) index = 0;
2338 |
2339 | if (_.slideCount <= _.options.slidesToShow) {
2340 |
2341 | _.setSlideClasses(index);
2342 | _.asNavFor(index);
2343 | return;
2344 |
2345 | }
2346 |
2347 | _.slideHandler(index);
2348 |
2349 | };
2350 |
2351 | Slick.prototype.slideHandler = function(index, sync, dontAnimate) {
2352 |
2353 | var targetSlide, animSlide, oldSlide, slideLeft, targetLeft = null,
2354 | _ = this, navTarget;
2355 |
2356 | sync = sync || false;
2357 |
2358 | if (_.animating === true && _.options.waitForAnimate === true) {
2359 | return;
2360 | }
2361 |
2362 | if (_.options.fade === true && _.currentSlide === index) {
2363 | return;
2364 | }
2365 |
2366 | if (_.slideCount <= _.options.slidesToShow) {
2367 | return;
2368 | }
2369 |
2370 | if (sync === false) {
2371 | _.asNavFor(index);
2372 | }
2373 |
2374 | targetSlide = index;
2375 | targetLeft = _.getLeft(targetSlide);
2376 | slideLeft = _.getLeft(_.currentSlide);
2377 |
2378 | _.currentLeft = _.swipeLeft === null ? slideLeft : _.swipeLeft;
2379 |
2380 | if (_.options.infinite === false && _.options.centerMode === false && (index < 0 || index > _.getDotCount() * _.options.slidesToScroll)) {
2381 | if (_.options.fade === false) {
2382 | targetSlide = _.currentSlide;
2383 | if (dontAnimate !== true) {
2384 | _.animateSlide(slideLeft, function() {
2385 | _.postSlide(targetSlide);
2386 | });
2387 | } else {
2388 | _.postSlide(targetSlide);
2389 | }
2390 | }
2391 | return;
2392 | } else if (_.options.infinite === false && _.options.centerMode === true && (index < 0 || index > (_.slideCount - _.options.slidesToScroll))) {
2393 | if (_.options.fade === false) {
2394 | targetSlide = _.currentSlide;
2395 | if (dontAnimate !== true) {
2396 | _.animateSlide(slideLeft, function() {
2397 | _.postSlide(targetSlide);
2398 | });
2399 | } else {
2400 | _.postSlide(targetSlide);
2401 | }
2402 | }
2403 | return;
2404 | }
2405 |
2406 | if ( _.options.autoplay ) {
2407 | clearInterval(_.autoPlayTimer);
2408 | }
2409 |
2410 | if (targetSlide < 0) {
2411 | if (_.slideCount % _.options.slidesToScroll !== 0) {
2412 | animSlide = _.slideCount - (_.slideCount % _.options.slidesToScroll);
2413 | } else {
2414 | animSlide = _.slideCount + targetSlide;
2415 | }
2416 | } else if (targetSlide >= _.slideCount) {
2417 | if (_.slideCount % _.options.slidesToScroll !== 0) {
2418 | animSlide = 0;
2419 | } else {
2420 | animSlide = targetSlide - _.slideCount;
2421 | }
2422 | } else {
2423 | animSlide = targetSlide;
2424 | }
2425 |
2426 | _.animating = true;
2427 |
2428 | _.$slider.trigger('beforeChange', [_, _.currentSlide, animSlide]);
2429 |
2430 | oldSlide = _.currentSlide;
2431 | _.currentSlide = animSlide;
2432 |
2433 | _.setSlideClasses(_.currentSlide);
2434 |
2435 | if ( _.options.asNavFor ) {
2436 |
2437 | navTarget = _.getNavTarget();
2438 | navTarget = navTarget.slick('getSlick');
2439 |
2440 | if ( navTarget.slideCount <= navTarget.options.slidesToShow ) {
2441 | navTarget.setSlideClasses(_.currentSlide);
2442 | }
2443 |
2444 | }
2445 |
2446 | _.updateDots();
2447 | _.updateArrows();
2448 |
2449 | if (_.options.fade === true) {
2450 | if (dontAnimate !== true) {
2451 |
2452 | _.fadeSlideOut(oldSlide);
2453 |
2454 | _.fadeSlide(animSlide, function() {
2455 | _.postSlide(animSlide);
2456 | });
2457 |
2458 | } else {
2459 | _.postSlide(animSlide);
2460 | }
2461 | _.animateHeight();
2462 | return;
2463 | }
2464 |
2465 | if (dontAnimate !== true) {
2466 | _.animateSlide(targetLeft, function() {
2467 | _.postSlide(animSlide);
2468 | });
2469 | } else {
2470 | _.postSlide(animSlide);
2471 | }
2472 |
2473 | };
2474 |
2475 | Slick.prototype.startLoad = function() {
2476 |
2477 | var _ = this;
2478 |
2479 | if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) {
2480 |
2481 | _.$prevArrow.hide();
2482 | _.$nextArrow.hide();
2483 |
2484 | }
2485 |
2486 | if (_.options.dots === true && _.slideCount > _.options.slidesToShow) {
2487 |
2488 | _.$dots.hide();
2489 |
2490 | }
2491 |
2492 | _.$slider.addClass('slick-loading');
2493 |
2494 | };
2495 |
2496 | Slick.prototype.swipeDirection = function() {
2497 |
2498 | var xDist, yDist, r, swipeAngle, _ = this;
2499 |
2500 | xDist = _.touchObject.startX - _.touchObject.curX;
2501 | yDist = _.touchObject.startY - _.touchObject.curY;
2502 | r = Math.atan2(yDist, xDist);
2503 |
2504 | swipeAngle = Math.round(r * 180 / Math.PI);
2505 | if (swipeAngle < 0) {
2506 | swipeAngle = 360 - Math.abs(swipeAngle);
2507 | }
2508 |
2509 | if ((swipeAngle <= 45) && (swipeAngle >= 0)) {
2510 | return (_.options.rtl === false ? 'left' : 'right');
2511 | }
2512 | if ((swipeAngle <= 360) && (swipeAngle >= 315)) {
2513 | return (_.options.rtl === false ? 'left' : 'right');
2514 | }
2515 | if ((swipeAngle >= 135) && (swipeAngle <= 225)) {
2516 | return (_.options.rtl === false ? 'right' : 'left');
2517 | }
2518 | if (_.options.verticalSwiping === true) {
2519 | if ((swipeAngle >= 35) && (swipeAngle <= 135)) {
2520 | return 'down';
2521 | } else {
2522 | return 'up';
2523 | }
2524 | }
2525 |
2526 | return 'vertical';
2527 |
2528 | };
2529 |
2530 | Slick.prototype.swipeEnd = function(event) {
2531 |
2532 | var _ = this,
2533 | slideCount,
2534 | direction;
2535 |
2536 | _.dragging = false;
2537 | _.interrupted = false;
2538 | _.shouldClick = ( _.touchObject.swipeLength > 10 ) ? false : true;
2539 |
2540 | if ( _.touchObject.curX === undefined ) {
2541 | return false;
2542 | }
2543 |
2544 | if ( _.touchObject.edgeHit === true ) {
2545 | _.$slider.trigger('edge', [_, _.swipeDirection() ]);
2546 | }
2547 |
2548 | if ( _.touchObject.swipeLength >= _.touchObject.minSwipe ) {
2549 |
2550 | direction = _.swipeDirection();
2551 |
2552 | switch ( direction ) {
2553 |
2554 | case 'left':
2555 | case 'down':
2556 |
2557 | slideCount =
2558 | _.options.swipeToSlide ?
2559 | _.checkNavigable( _.currentSlide + _.getSlideCount() ) :
2560 | _.currentSlide + _.getSlideCount();
2561 |
2562 | _.currentDirection = 0;
2563 |
2564 | break;
2565 |
2566 | case 'right':
2567 | case 'up':
2568 |
2569 | slideCount =
2570 | _.options.swipeToSlide ?
2571 | _.checkNavigable( _.currentSlide - _.getSlideCount() ) :
2572 | _.currentSlide - _.getSlideCount();
2573 |
2574 | _.currentDirection = 1;
2575 |
2576 | break;
2577 |
2578 | default:
2579 |
2580 |
2581 | }
2582 |
2583 | if( direction != 'vertical' ) {
2584 |
2585 | _.slideHandler( slideCount );
2586 | _.touchObject = {};
2587 | _.$slider.trigger('swipe', [_, direction ]);
2588 |
2589 | }
2590 |
2591 | } else {
2592 |
2593 | if ( _.touchObject.startX !== _.touchObject.curX ) {
2594 |
2595 | _.slideHandler( _.currentSlide );
2596 | _.touchObject = {};
2597 |
2598 | }
2599 |
2600 | }
2601 |
2602 | };
2603 |
2604 | Slick.prototype.swipeHandler = function(event) {
2605 |
2606 | var _ = this;
2607 |
2608 | if ((_.options.swipe === false) || ('ontouchend' in document && _.options.swipe === false)) {
2609 | return;
2610 | } else if (_.options.draggable === false && event.type.indexOf('mouse') !== -1) {
2611 | return;
2612 | }
2613 |
2614 | _.touchObject.fingerCount = event.originalEvent && event.originalEvent.touches !== undefined ?
2615 | event.originalEvent.touches.length : 1;
2616 |
2617 | _.touchObject.minSwipe = _.listWidth / _.options
2618 | .touchThreshold;
2619 |
2620 | if (_.options.verticalSwiping === true) {
2621 | _.touchObject.minSwipe = _.listHeight / _.options
2622 | .touchThreshold;
2623 | }
2624 |
2625 | switch (event.data.action) {
2626 |
2627 | case 'start':
2628 | _.swipeStart(event);
2629 | break;
2630 |
2631 | case 'move':
2632 | _.swipeMove(event);
2633 | break;
2634 |
2635 | case 'end':
2636 | _.swipeEnd(event);
2637 | break;
2638 |
2639 | }
2640 |
2641 | };
2642 |
2643 | Slick.prototype.swipeMove = function(event) {
2644 |
2645 | var _ = this,
2646 | edgeWasHit = false,
2647 | curLeft, swipeDirection, swipeLength, positionOffset, touches;
2648 |
2649 | touches = event.originalEvent !== undefined ? event.originalEvent.touches : null;
2650 |
2651 | if (!_.dragging || touches && touches.length !== 1) {
2652 | return false;
2653 | }
2654 |
2655 | curLeft = _.getLeft(_.currentSlide);
2656 |
2657 | _.touchObject.curX = touches !== undefined ? touches[0].pageX : event.clientX;
2658 | _.touchObject.curY = touches !== undefined ? touches[0].pageY : event.clientY;
2659 |
2660 | _.touchObject.swipeLength = Math.round(Math.sqrt(
2661 | Math.pow(_.touchObject.curX - _.touchObject.startX, 2)));
2662 |
2663 | if (_.options.verticalSwiping === true) {
2664 | _.touchObject.swipeLength = Math.round(Math.sqrt(
2665 | Math.pow(_.touchObject.curY - _.touchObject.startY, 2)));
2666 | }
2667 |
2668 | swipeDirection = _.swipeDirection();
2669 |
2670 | if (swipeDirection === 'vertical') {
2671 | return;
2672 | }
2673 |
2674 | if (event.originalEvent !== undefined && _.touchObject.swipeLength > 4) {
2675 | event.preventDefault();
2676 | }
2677 |
2678 | positionOffset = (_.options.rtl === false ? 1 : -1) * (_.touchObject.curX > _.touchObject.startX ? 1 : -1);
2679 | if (_.options.verticalSwiping === true) {
2680 | positionOffset = _.touchObject.curY > _.touchObject.startY ? 1 : -1;
2681 | }
2682 |
2683 |
2684 | swipeLength = _.touchObject.swipeLength;
2685 |
2686 | _.touchObject.edgeHit = false;
2687 |
2688 | if (_.options.infinite === false) {
2689 | if ((_.currentSlide === 0 && swipeDirection === 'right') || (_.currentSlide >= _.getDotCount() && swipeDirection === 'left')) {
2690 | swipeLength = _.touchObject.swipeLength * _.options.edgeFriction;
2691 | _.touchObject.edgeHit = true;
2692 | }
2693 | }
2694 |
2695 | if (_.options.vertical === false) {
2696 | _.swipeLeft = curLeft + swipeLength * positionOffset;
2697 | } else {
2698 | _.swipeLeft = curLeft + (swipeLength * (_.$list.height() / _.listWidth)) * positionOffset;
2699 | }
2700 | if (_.options.verticalSwiping === true) {
2701 | _.swipeLeft = curLeft + swipeLength * positionOffset;
2702 | }
2703 |
2704 | if (_.options.fade === true || _.options.touchMove === false) {
2705 | return false;
2706 | }
2707 |
2708 | if (_.animating === true) {
2709 | _.swipeLeft = null;
2710 | return false;
2711 | }
2712 |
2713 | _.setCSS(_.swipeLeft);
2714 |
2715 | };
2716 |
2717 | Slick.prototype.swipeStart = function(event) {
2718 |
2719 | var _ = this,
2720 | touches;
2721 |
2722 | _.interrupted = true;
2723 |
2724 | if (_.touchObject.fingerCount !== 1 || _.slideCount <= _.options.slidesToShow) {
2725 | _.touchObject = {};
2726 | return false;
2727 | }
2728 |
2729 | if (event.originalEvent !== undefined && event.originalEvent.touches !== undefined) {
2730 | touches = event.originalEvent.touches[0];
2731 | }
2732 |
2733 | _.touchObject.startX = _.touchObject.curX = touches !== undefined ? touches.pageX : event.clientX;
2734 | _.touchObject.startY = _.touchObject.curY = touches !== undefined ? touches.pageY : event.clientY;
2735 |
2736 | _.dragging = true;
2737 |
2738 | };
2739 |
2740 | Slick.prototype.unfilterSlides = Slick.prototype.slickUnfilter = function() {
2741 |
2742 | var _ = this;
2743 |
2744 | if (_.$slidesCache !== null) {
2745 |
2746 | _.unload();
2747 |
2748 | _.$slideTrack.children(this.options.slide).detach();
2749 |
2750 | _.$slidesCache.appendTo(_.$slideTrack);
2751 |
2752 | _.reinit();
2753 |
2754 | }
2755 |
2756 | };
2757 |
2758 | Slick.prototype.unload = function() {
2759 |
2760 | var _ = this;
2761 |
2762 | $('.slick-cloned', _.$slider).remove();
2763 |
2764 | if (_.$dots) {
2765 | _.$dots.remove();
2766 | }
2767 |
2768 | if (_.$prevArrow && _.htmlExpr.test(_.options.prevArrow)) {
2769 | _.$prevArrow.remove();
2770 | }
2771 |
2772 | if (_.$nextArrow && _.htmlExpr.test(_.options.nextArrow)) {
2773 | _.$nextArrow.remove();
2774 | }
2775 |
2776 | _.$slides
2777 | .removeClass('slick-slide slick-active slick-visible slick-current')
2778 | .attr('aria-hidden', 'true')
2779 | .css('width', '');
2780 |
2781 | };
2782 |
2783 | Slick.prototype.unslick = function(fromBreakpoint) {
2784 |
2785 | var _ = this;
2786 | _.$slider.trigger('unslick', [_, fromBreakpoint]);
2787 | _.destroy();
2788 |
2789 | };
2790 |
2791 | Slick.prototype.updateArrows = function() {
2792 |
2793 | var _ = this,
2794 | centerOffset;
2795 |
2796 | centerOffset = Math.floor(_.options.slidesToShow / 2);
2797 |
2798 | if ( _.options.arrows === true &&
2799 | _.slideCount > _.options.slidesToShow &&
2800 | !_.options.infinite ) {
2801 |
2802 | _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false');
2803 | _.$nextArrow.removeClass('slick-disabled').attr('aria-disabled', 'false');
2804 |
2805 | if (_.currentSlide === 0) {
2806 |
2807 | _.$prevArrow.addClass('slick-disabled').attr('aria-disabled', 'true');
2808 | _.$nextArrow.removeClass('slick-disabled').attr('aria-disabled', 'false');
2809 |
2810 | } else if (_.currentSlide >= _.slideCount - _.options.slidesToShow && _.options.centerMode === false) {
2811 |
2812 | _.$nextArrow.addClass('slick-disabled').attr('aria-disabled', 'true');
2813 | _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false');
2814 |
2815 | } else if (_.currentSlide >= _.slideCount - 1 && _.options.centerMode === true) {
2816 |
2817 | _.$nextArrow.addClass('slick-disabled').attr('aria-disabled', 'true');
2818 | _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false');
2819 |
2820 | }
2821 |
2822 | }
2823 |
2824 | };
2825 |
2826 | Slick.prototype.updateDots = function() {
2827 |
2828 | var _ = this;
2829 |
2830 | if (_.$dots !== null) {
2831 |
2832 | _.$dots
2833 | .find('li')
2834 | .removeClass('slick-active')
2835 | .attr('aria-hidden', 'true');
2836 |
2837 | _.$dots
2838 | .find('li')
2839 | .eq(Math.floor(_.currentSlide / _.options.slidesToScroll))
2840 | .addClass('slick-active')
2841 | .attr('aria-hidden', 'false');
2842 |
2843 | }
2844 |
2845 | };
2846 |
2847 | Slick.prototype.visibility = function() {
2848 |
2849 | var _ = this;
2850 |
2851 | if ( _.options.autoplay ) {
2852 |
2853 | if ( document[_.hidden] ) {
2854 |
2855 | _.interrupted = true;
2856 |
2857 | } else {
2858 |
2859 | _.interrupted = false;
2860 |
2861 | }
2862 |
2863 | }
2864 |
2865 | };
2866 |
2867 | $.fn.slick = function() {
2868 | var _ = this,
2869 | opt = arguments[0],
2870 | args = Array.prototype.slice.call(arguments, 1),
2871 | l = _.length,
2872 | i,
2873 | ret;
2874 | for (i = 0; i < l; i++) {
2875 | if (typeof opt == 'object' || typeof opt == 'undefined')
2876 | _[i].slick = new Slick(_[i], opt);
2877 | else
2878 | ret = _[i].slick[opt].apply(_[i].slick, args);
2879 | if (typeof ret != 'undefined') return ret;
2880 | }
2881 | return _;
2882 | };
2883 |
2884 | }));
2885 |
--------------------------------------------------------------------------------
/slick/slick.php:
--------------------------------------------------------------------------------
1 | __( 'Slick', 'fl-builder' ),
17 | 'description' => __( 'Slick Slider for BeaverBuilder', 'fl-builder' ),
18 | 'category' => __( 'Advanced Modules', 'fl-builder' ),
19 | 'dir' => TMC_BB_DIR . 'slick/',
20 | 'url' => TMC_BB_URL . 'slick/',
21 | 'editor_export' => true, // Defaults to true and can be omitted.
22 | 'enabled' => true, // Defaults to true and can be omitted.
23 | ) );
24 |
25 | /**
26 | * Use these methods to enqueue css and js already
27 | * registered or to register and enqueue your own.
28 | */
29 | // Already registered
30 | $this->add_css( 'font-awesome' );
31 | $this->add_js( 'jquery-bxslider' );
32 |
33 | // Register and enqueue your own
34 | $this->add_css( 'slick-slider-css-cdn', '//cdn.jsdelivr.net/jquery.slick/1.6.0/slick.css', array(), '' );
35 | $this->add_js( 'slick-slider-js-cdn', TMC_BB_URL . '/slick/js/slick.js', array( 'jquery' ), '', false );
36 |
37 | }
38 |
39 | /**
40 | * This method will be called by the builder
41 | * right before the module is deleted.
42 | *
43 | * @method delete
44 | */
45 | public function delete() {
46 |
47 | }
48 |
49 | /**
50 | * Add additional methods to this class for use in the
51 | * other module files such as preview.php, frontend.php
52 | * and frontend.css.php.
53 | *
54 | *
55 | * @method example_method
56 | */
57 | public function example_method() {
58 | }
59 |
60 | /* ---------------------------------------------------------------------
61 | Enqueue Vimeo Helper Script
62 | TODO: This should only be included if we have Vimeo modules
63 | ------------------------------------------------------------------------ */
64 | public function enqueue_scripts() {
65 | if ( $this->settings && 'video' === $this->settings->photoVideo ) {
66 | wp_enqueue_script( 'vimeo-helper', '//f.vimeocdn.com/js/froogaloop2.min.js', array(), '3', true );
67 | }
68 | }
69 | }
70 |
71 | /**
72 | * Register the module and its form settings.
73 | * TODO: Break out Photo vs Video settings
74 | */
75 | FLBuilder::register_module('BBSlickSlider', array(
76 | 'general' => array( // Tab
77 | 'title' => __( 'Media', 'fl-builder' ), // Tab title
78 | 'sections' => array( // Tab Sections
79 | 'general' => array( // Section
80 | 'title' => __( 'Media Settings', 'fl-builder' ), // Section Title
81 | 'fields' => array( // Section Fields
82 | 'photoVideo' => array(
83 | 'type' => 'select',
84 | 'label' => __( 'Type of Media', 'fl-builder' ),
85 | 'default' => 'photo',
86 | 'options' => array(
87 | 'photo' => __( 'Photo', 'fl-builder' ),
88 | 'video' => __( 'Video - YouTube/Vimeo *Beta*', 'fl-builder' )
89 | ),
90 | 'toggle' => array(
91 | 'photo' => array(
92 | 'tabs' => array( 'imageSettings' ),
93 | 'fields' => array( 'fade' ),
94 | ),
95 | 'video' => array(
96 | 'tabs' => array( 'videoSettings' ),
97 | ),
98 | ),
99 | ),
100 | ),
101 | ),
102 | ),
103 | ),
104 | 'imageSettings' => array( // Tab
105 | 'title' => __( 'Images', 'fl-builder' ), // Tab title
106 | 'sections' => array( // Tab Sections
107 | 'general' => array( // Section
108 | 'title' => __( 'Image Settings', 'fl-builder' ), // Section Title
109 | 'fields' => array( // Section Fields
110 | 'multiple_photos_field' => array(
111 | 'type' => 'multiple-photos',
112 | 'label' => __( 'Photos', 'fl-builder' ),
113 | ),
114 | 'showCaptions' => array(
115 | 'type' => 'select',
116 | 'label' => __( 'Show Captions', 'fl-builder' ),
117 | 'default' => 'false',
118 | 'options' => array(
119 | 'true' => __( 'Yes', 'fl-builder' ),
120 | 'false' => __( 'No', 'fl-builder' )
121 | )
122 | ),
123 | 'oneSlide' => array(
124 | 'type' => 'select',
125 | 'label' => __( 'Show # Slides', 'fl-builder' ),
126 | 'default' => 'true',
127 | 'options' => array(
128 | 'true' => __( 'One', 'fl-builder' ),
129 | 'false' => __( 'Multiple', 'fl-builder' )
130 | ),
131 | 'toggle' => array(
132 | 'false' => array(
133 | 'sections' => array( 'multiplePhotoSettings' ),
134 | ),
135 | 'true' => array(
136 | 'fields' => array( 'adaptiveHeight','forceImageSize' ),
137 | ),
138 | )
139 | ),
140 | 'forceImageSize' => array(
141 | 'type' => 'select',
142 | 'label' => __( 'Force Images to Full Width', 'fl-builder' ),
143 | 'default' => 'false',
144 | 'options' => array(
145 | 'true' => __( 'Yes', 'fl-builder' ),
146 | 'false' => __( 'No', 'fl-builder' )
147 | ),
148 | ),
149 | ),
150 | ),
151 | 'multiplePhotoSettings' => array( // Section
152 | 'title' => 'Multiple Photo Settings', // Section Title
153 | 'fields' => array( // Section Fields
154 | 'centerMode' => array(
155 | 'type' => 'select',
156 | 'label' => __( 'Center Mode', 'fl-builder' ),
157 | 'default' => 'false',
158 | 'options' => array(
159 | 'true' => __( 'Yes', 'fl-builder' ),
160 | 'false' => __( 'No', 'fl-builder' )
161 | ),
162 | 'toggle' => array(
163 | 'false' => array(
164 | 'fields' => array( 'slidesToScroll' ),
165 | ),
166 | )
167 | ),
168 | 'variableWidth' => array(
169 | 'type' => 'select',
170 | 'label' => __( 'Variable Width', 'fl-builder' ),
171 | 'default' => 'false',
172 | 'options' => array(
173 | 'true' => __( 'Yes', 'fl-builder' ),
174 | 'false' => __( 'No', 'fl-builder' )
175 | )
176 | ),
177 | 'slidesToShow' => array(
178 | 'type' => 'text',
179 | 'label' => __( 'Slides to Show', 'fl-builder' ),
180 | 'default' => '1',
181 | ),
182 | 'slidesToScroll' => array(
183 | 'type' => 'text',
184 | 'label' => __( 'Slides to Scroll', 'fl-builder' ),
185 | 'default' => '1'
186 | ),
187 | ),
188 | ),
189 | ),
190 | ),
191 | 'videoSettings' => array( // Tab
192 | 'title' => __( 'Videos', 'fl-builder' ), // Tab title
193 | 'sections' => array( // Tab Sections
194 | 'general' => array( // Section
195 | 'title' => __( 'Video Controls', 'fl-builder' ), // Section Title
196 | 'fields' => array( // Section Fields
197 | 'multiple_video_field' => array(
198 | 'type' => 'text',
199 | 'label' => __( 'Video URL', 'fl-builder' ),
200 | 'multiple' => true,
201 | ),
202 | 'autoplay_videos' => array(
203 | 'type' => 'select',
204 | 'label' => __( 'Auto play videos?', 'fl-builder' ),
205 | 'default' => 'false',
206 | 'options' => array(
207 | 'true' => __( 'Yes', 'fl-builder' ),
208 | 'false' => __( 'No', 'fl-builder' )
209 | ),
210 | ),
211 | ),
212 | ),
213 | ),
214 | ),
215 | 'toggle' => array( // Tab
216 | 'title' => __( 'Controls', 'fl-builder' ), // Tab title
217 | 'sections' => array( // Tab Sections
218 | 'general' => array( // Section
219 | 'title' => __( 'Slideshow Controls', 'fl-builder' ), // Section Title
220 | 'fields' => array( // Section Fields
221 | 'autoPlay' => array(
222 | 'type' => 'select',
223 | 'label' => __( 'Auto Play', 'fl-builder' ),
224 | 'default' => 'false',
225 | 'options' => array(
226 | 'true' => __( 'Yes', 'fl-builder' ),
227 | 'false' => __( 'No', 'fl-builder' )
228 | ),
229 | 'toggle' => array(
230 | 'true' => array(
231 | 'fields' => array( 'autoPlaySpeed' ),
232 | ),
233 | )
234 | ),
235 | 'autoPlaySpeed' => array(
236 | 'type' => 'text',
237 | 'label' => __( 'Auto Play Speed', 'fl-builder' ),
238 | 'default' => '3000',
239 | 'description' => 'milliseconds'
240 | ),
241 | 'arrows' => array(
242 | 'type' => 'select',
243 | 'label' => __( 'Show Arrows', 'fl-builder' ),
244 | 'default' => 'true',
245 | 'options' => array(
246 | 'true' => __( 'Yes', 'fl-builder' ),
247 | 'false' => __( 'No', 'fl-builder' )
248 | )
249 | ),
250 | 'pauseOnHover' => array(
251 | 'type' => 'select',
252 | 'label' => __( 'Pause on Hover', 'fl-builder' ),
253 | 'default' => 'true',
254 | 'options' => array(
255 | 'true' => __( 'Yes', 'fl-builder' ),
256 | 'false' => __( 'No', 'fl-builder' )
257 | )
258 | ),
259 | 'dots' => array(
260 | 'type' => 'select',
261 | 'label' => __( 'Show Dots', 'fl-builder' ),
262 | 'default' => 'true',
263 | 'options' => array(
264 | 'true' => __( 'Yes', 'fl-builder' ),
265 | 'false' => __( 'No', 'fl-builder' )
266 | ),
267 | 'toggle' => array(
268 | 'true' => array(
269 | 'fields' => array( 'pauseOnDotsHover' ),
270 | ),
271 | )
272 | ),
273 | 'pauseOnDotsHover' => array(
274 | 'type' => 'select',
275 | 'label' => __( 'Pause on Dots Hover', 'fl-builder' ),
276 | 'default' => 'true',
277 | 'options' => array(
278 | 'true' => __( 'Yes', 'fl-builder' ),
279 | 'false' => __( 'No', 'fl-builder' )
280 | )
281 | ),
282 | )
283 | ),
284 | )
285 | ),
286 | 'design' => array( // Tab
287 | 'title' => __( 'Design', 'fl-builder' ), // Tab title
288 | 'sections' => array( // Tab Sections
289 | 'general' => array( // Section
290 | 'title' => __( 'Tweak the Design', 'fl-builder' ), // Section Title
291 | 'fields' => array( // Section Fields
292 | 'arrowSize' => array(
293 | 'type' => 'text',
294 | 'label' => __( 'Arrow Size', 'fl-builder' ),
295 | 'default' => '20',
296 | 'description' => 'pixels',
297 | ),
298 | 'arrowColor' => array(
299 | 'type' => 'color',
300 | 'label' => __( 'Arrow Color', 'fl-builder' ),
301 | 'default' => 'ffffff'
302 | ),
303 | 'arrowBackgroundColor' => array(
304 | 'type' => 'color',
305 | 'label' => __( 'Arrow Background Color', 'fl-builder' ),
306 | 'default' => '333333',
307 | 'show_reset' => true
308 | ),
309 | 'arrowHoverColor' => array(
310 | 'type' => 'color',
311 | 'label' => __( 'Arrow Hover Color', 'fl-builder' ),
312 | 'default' => 'ffffff',
313 | ),
314 | 'arrowHoverBackgroundColor' => array(
315 | 'type' => 'color',
316 | 'label' => __( 'Arrow Hover Background Color', 'fl-builder' ),
317 | 'default' => '689BCA',
318 | 'show_reset' => true
319 | ),
320 | 'dotSize' => array(
321 | 'type' => 'text',
322 | 'label' => __( 'Dot Size', 'fl-builder' ),
323 | 'default' => '14',
324 | 'description' => 'pixels',
325 | ),
326 | 'dotColor' => array(
327 | 'type' => 'color',
328 | 'label' => __( 'Dot Color', 'fl-builder' ),
329 | 'default' => '000000',
330 | ),
331 | 'dotBackgroundColor' => array(
332 | 'type' => 'color',
333 | 'label' => __( 'Dot Background Color', 'fl-builder' ),
334 | 'show_reset' => true,
335 | 'default' => '000000',
336 | ),
337 | 'dotActiveColor' => array(
338 | 'type' => 'color',
339 | 'label' => __( 'Dot Active Color', 'fl-builder' ),
340 | 'default' => 'ffffff',
341 | ),
342 | 'dotActiveBackgroundColor' => array(
343 | 'type' => 'color',
344 | 'label' => __( 'Dot Active Background Color', 'fl-builder' ),
345 | 'default' => '333333',
346 | 'show_reset' => true
347 | ),
348 | 'dotHoverColor' => array(
349 | 'type' => 'color',
350 | 'label' => __( 'Dot Hover Color', 'fl-builder' ),
351 | 'default' => 'ffffff',
352 | ),
353 | 'dotHoverBackgroundColor' => array(
354 | 'type' => 'color',
355 | 'label' => __( 'Dot Hover Background Color', 'fl-builder' ),
356 | 'default' => '689BCA',
357 | 'show_reset' => true
358 | )
359 | )
360 | ),
361 | )
362 | ),
363 | 'multiple' => array( // Tab
364 | 'title' => __( 'Settings', 'fl-builder' ), // Tab title
365 | 'sections' => array( // Tab Sections
366 | 'general' => array( // Section
367 | 'title' => __( 'Overall Settings', 'fl-builder' ), // Section Title
368 | 'fields' => array( // Section Fields
369 | 'adaptiveHeight' => array(
370 | 'type' => 'select',
371 | 'label' => __( 'Adaptive Height', 'fl-builder' ),
372 | 'default' => 'false',
373 | 'options' => array(
374 | 'true' => __( 'Yes', 'fl-builder' ),
375 | 'false' => __( 'No', 'fl-builder' )
376 | ),
377 | 'toggle' => array(
378 | 'false' => array(
379 | 'fields' => array( 'fixedHeightSize' ),
380 | ),
381 | )
382 | ),
383 | 'fixedHeightSize' => array(
384 | 'type' => 'text',
385 | 'label' => __( 'Fixed Height Size', 'fl-builder' ),
386 | 'default' => '500',
387 | 'description' => 'pixels',
388 | ),
389 | 'fade' => array(
390 | 'type' => 'select',
391 | 'label' => __( 'Fade', 'fl-builder' ),
392 | 'help' => __( 'For images only.', 'fl-builder' ),
393 | 'default' => 'false',
394 | 'options' => array(
395 | 'true' => __( 'Yes', 'fl-builder' ),
396 | 'false' => __( 'No', 'fl-builder' )
397 | )
398 | ),
399 | 'infinite' => array(
400 | 'type' => 'select',
401 | 'label' => __( 'Infinite Loop', 'fl-builder' ),
402 | 'default' => 'true',
403 | 'options' => array(
404 | 'true' => __( 'Yes', 'fl-builder' ),
405 | 'false' => __( 'No', 'fl-builder' )
406 | )
407 | ),
408 | 'verticalCarousel' => array(
409 | 'type' => 'select',
410 | 'label' => __( 'Scroll', 'fl-builder' ),
411 | 'default' => 'false',
412 | 'options' => array(
413 | 'true' => __( 'Vertical', 'fl-builder' ),
414 | 'false' => __( 'Horizontal', 'fl-builder' )
415 | ),
416 | 'toggle' => array(
417 | 'false' => array(
418 | 'fields' => array( 'fade' ),
419 | ),
420 | )
421 | ),
422 | )
423 | ),
424 | )
425 | ),
426 | ));
427 |
--------------------------------------------------------------------------------
/youtube-videos/class-youtube-videos.php:
--------------------------------------------------------------------------------
1 | __( 'YouTube Video', 'fl-builder' ),
23 | 'description' => __( 'Displays YouTube Videos.', 'fl-builder' ),
24 | 'category' => __( 'Advanced', 'fl-builder' ),
25 | 'partial_refresh' => true,
26 | 'dir' => TMC_BB_DIR . 'youtube-videos/',
27 | 'url' => TMC_BB_URL . 'youtube-videos/',
28 | )
29 | );
30 | }
31 | }
32 |
33 | /**
34 | * Register the module and its form settings with Beaver Builder.
35 | *
36 | * What's implied, but not specifically stated, is that BB handles the instantiation of the object.
37 | *
38 | * @see \FLBuilderModel::register_module()
39 | *
40 | * @action init
41 | */
42 | FLBuilder::register_module(
43 | 'YouTubeVideos',
44 | array(
45 | 'general' => array(
46 | 'title' => __( 'General', 'fl-builder' ),
47 | 'sections' => array(
48 | 'general' => array(
49 | 'title' => __( 'General', 'fl-builder' ),
50 | 'fields' => array(
51 | 'youtube_url' => array(
52 | 'type' => 'text',
53 | 'label' => __( 'YouTube URL', 'fl-builder' ),
54 | 'default' => '',
55 | 'placeholder' => 'https://www.youtube.com/watch?v=ScMzIvxBSi4',
56 | 'help' => __( 'The URL to the YouTube video that should display.', 'fl-builder' ),
57 | ),
58 | ),
59 | ),
60 | ),
61 | ),
62 | )
63 | );
64 |
65 |
66 |
--------------------------------------------------------------------------------
/youtube-videos/css/frontend.css:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TwisterMc/twistermc-bb-modules/acd1dc9add8498d66985f16f646eedb0292c9a9c/youtube-videos/css/frontend.css
--------------------------------------------------------------------------------
/youtube-videos/css/index.php:
--------------------------------------------------------------------------------
1 | node ).
13 | * @var stdClass $settings The module's settings ( i.e. $module->settings ).
14 | */
15 |
16 | // If this file is called directly, abort.
17 | if ( ! defined( 'ABSPATH' ) ) {
18 | die;
19 | }
20 |
21 | $embed_code = wp_oembed_get( esc_url( $settings->youtube_url ) );
22 |
23 | echo $embed_code;
24 |
--------------------------------------------------------------------------------
/youtube-videos/includes/index.php:
--------------------------------------------------------------------------------
1 |