Slide Anything – Responsive Content / HTML Slider and Carousel - Version 2.3.37

Version Description

  • Added a new feature 'Mousewheel Navigation' which allows previous/next slide navigation using the mousewheel. Removed the 'Lazy Load Images' feature, as this is now included in the standard WordPress installation.
Download this release

Release Info

Developer simonpedge
Plugin Icon 128x128 Slide Anything – Responsive Content / HTML Slider and Carousel
Version 2.3.37
Comparing to
See all releases

Code changes from version 2.3.36 to 2.3.37

js/jquery.mousewheel.min.js ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ /*!
2
+ * jQuery Mousewheel 3.1.13
3
+ * Copyright OpenJS Foundation and other contributors
4
+ */
5
+ !function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e:e(jQuery)}(function(a){var u,r,e=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],t="onwheel"in window.document||9<=window.document.documentMode?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],f=Array.prototype.slice;if(a.event.fixHooks)for(var n=e.length;n;)a.event.fixHooks[e[--n]]=a.event.mouseHooks;var d=a.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var e=t.length;e;)this.addEventListener(t[--e],i,!1);else this.onmousewheel=i;a.data(this,"mousewheel-line-height",d.getLineHeight(this)),a.data(this,"mousewheel-page-height",d.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var e=t.length;e;)this.removeEventListener(t[--e],i,!1);else this.onmousewheel=null;a.removeData(this,"mousewheel-line-height"),a.removeData(this,"mousewheel-page-height")},getLineHeight:function(e){var t=a(e),e=t["offsetParent"in a.fn?"offsetParent":"parent"]();return e.length||(e=a("body")),parseInt(e.css("fontSize"),10)||parseInt(t.css("fontSize"),10)||16},getPageHeight:function(e){return a(e).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};function i(e){var t,n=e||window.event,i=f.call(arguments,1),o=0,l=0,s=0,h=0;if((e=a.event.fix(n)).type="mousewheel","detail"in n&&(s=-1*n.detail),"wheelDelta"in n&&(s=n.wheelDelta),"wheelDeltaY"in n&&(s=n.wheelDeltaY),"wheelDeltaX"in n&&(l=-1*n.wheelDeltaX),"axis"in n&&n.axis===n.HORIZONTAL_AXIS&&(l=-1*s,s=0),o=0===s?l:s,"deltaY"in n&&(o=s=-1*n.deltaY),"deltaX"in n&&(l=n.deltaX,0===s&&(o=-1*l)),0!==s||0!==l)return 1===n.deltaMode?(o*=t=a.data(this,"mousewheel-line-height"),s*=t,l*=t):2===n.deltaMode&&(o*=t=a.data(this,"mousewheel-page-height"),s*=t,l*=t),h=Math.max(Math.abs(s),Math.abs(l)),(!r||h<r)&&c(n,r=h)&&(r/=40),c(n,h)&&(o/=40,l/=40,s/=40),o=Math[1<=o?"floor":"ceil"](o/r),l=Math[1<=l?"floor":"ceil"](l/r),s=Math[1<=s?"floor":"ceil"](s/r),d.settings.normalizeOffset&&this.getBoundingClientRect&&(h=this.getBoundingClientRect(),e.offsetX=e.clientX-h.left,e.offsetY=e.clientY-h.top),e.deltaX=l,e.deltaY=s,e.deltaFactor=r,e.deltaMode=0,i.unshift(e,o,l,s),u&&window.clearTimeout(u),u=window.setTimeout(w,200),(a.event.dispatch||a.event.handle).apply(this,i)}function w(){r=null}function c(e,t){return d.settings.adjustOldDeltas&&"mousewheel"===e.type&&t%120==0}a.fn.extend({mousewheel:function(e){return e?this.on("mousewheel",e):this.trigger("mousewheel")},unmousewheel:function(e){return this.off("mousewheel",e)}})});
php/slide-anything-admin.php CHANGED
@@ -79,6 +79,7 @@ function cpt_slider_plugin_activation() {
79
  update_post_meta($cpt_id, 'sa_reverse_order', '0');
80
  update_post_meta($cpt_id, 'sa_mouse_drag', '0');
81
  update_post_meta($cpt_id, 'sa_touch_drag', '1');
 
82
  update_post_meta($cpt_id, 'sa_click_advance', '0');
83
  update_post_meta($cpt_id, 'sa_auto_height', '0');
84
  update_post_meta($cpt_id, 'sa_vert_center', '0');
@@ -701,6 +702,19 @@ function cpt_slider_settings_content($post) {
701
  }
702
  echo "<em class='sa_tooltip' href='' title='Allow navigation to previous/next slides on mobile devices by touching screen and dragging left/right'></em>\n";
703
  echo "</div>\n";
 
 
 
 
 
 
 
 
 
 
 
 
 
704
  // CLICK TO ADVANCE
705
  $click_advance = get_post_meta($post->ID, 'sa_click_advance', true);
706
  if ($click_advance == '') {
@@ -2148,6 +2162,8 @@ function cpt_slider_style_content($post) {
2148
  echo "</div>\n";
2149
 
2150
  // Enable Lazy Load Images
 
 
2151
  $tooltip = "Enable &quot;Lazy Load&quot; for images added to your slide content (note: does not apply to slide backgrounds).";
2152
  echo "<div id='sa_window_onload_line'>";
2153
  echo "<span class='sa_tooltip' title='".$tooltip."'></span><span style='min-width:160px;'>Enable 'Lazy Load' Images:</span>";
@@ -2157,6 +2173,10 @@ function cpt_slider_style_content($post) {
2157
  echo "<input type='checkbox' id='sa_lazy_load_images' name='sa_lazy_load_images' value='1'/>";
2158
  }
2159
  echo "</div>\n";
 
 
 
 
2160
 
2161
  // Use UL and LI Containers
2162
  $tooltip = "Use &quot;UL&quot; as the DOM element for &quot;owl-stage&quot; and use &quot;LI&quot; as the DOM elements for &quot;owl-item&quot;.";
@@ -2760,6 +2780,11 @@ function cpt_slider_save_postdata() {
2760
  } else {
2761
  update_post_meta($post->ID, 'sa_touch_drag', '0');
2762
  }
 
 
 
 
 
2763
  if (isset($_POST['sa_click_advance']) && ($_POST['sa_click_advance'] == '1')) {
2764
  update_post_meta($post->ID, 'sa_click_advance', '1');
2765
  } else {
79
  update_post_meta($cpt_id, 'sa_reverse_order', '0');
80
  update_post_meta($cpt_id, 'sa_mouse_drag', '0');
81
  update_post_meta($cpt_id, 'sa_touch_drag', '1');
82
+ update_post_meta($cpt_id, 'sa_mousewheel', '0');
83
  update_post_meta($cpt_id, 'sa_click_advance', '0');
84
  update_post_meta($cpt_id, 'sa_auto_height', '0');
85
  update_post_meta($cpt_id, 'sa_vert_center', '0');
702
  }
703
  echo "<em class='sa_tooltip' href='' title='Allow navigation to previous/next slides on mobile devices by touching screen and dragging left/right'></em>\n";
704
  echo "</div>\n";
705
+ // MOUSEWHEEL NAV
706
+ $mousewheel = get_post_meta($post->ID, 'sa_mousewheel', true);
707
+ if ($mousewheel == '') {
708
+ $mousewheel = '0';
709
+ }
710
+ echo "<div class='sa_setting_checkbox'><span>Mousewheel Nav:</span>";
711
+ if ($mousewheel == '1') {
712
+ echo "<input type='checkbox' id='sa_mousewheel' name='sa_mousewheel' value='1' checked/>";
713
+ } else {
714
+ echo "<input type='checkbox' id='sa_mousewheel' name='sa_mousewheel' value='1'/>";
715
+ }
716
+ echo "<em class='sa_tooltip' href='' title='Allow previous/next slide navigation using the mousewheel (NOTE: does not work well with the Apple Mac touchpad scroll wheel mimic)'></em>\n";
717
+ echo "</div>\n";
718
  // CLICK TO ADVANCE
719
  $click_advance = get_post_meta($post->ID, 'sa_click_advance', true);
720
  if ($click_advance == '') {
2162
  echo "</div>\n";
2163
 
2164
  // Enable Lazy Load Images
2165
+ // ##### REMOVE LAZY LOAD IMAGES FEATURE (WHICH IS NOW INCLUDED IN WP 5.5) #####
2166
+ /*
2167
  $tooltip = "Enable &quot;Lazy Load&quot; for images added to your slide content (note: does not apply to slide backgrounds).";
2168
  echo "<div id='sa_window_onload_line'>";
2169
  echo "<span class='sa_tooltip' title='".$tooltip."'></span><span style='min-width:160px;'>Enable 'Lazy Load' Images:</span>";
2173
  echo "<input type='checkbox' id='sa_lazy_load_images' name='sa_lazy_load_images' value='1'/>";
2174
  }
2175
  echo "</div>\n";
2176
+ */
2177
+ echo "<div style='display:none !important;'>";
2178
+ echo "<input type='checkbox' id='sa_lazy_load_images' name='sa_lazy_load_images' value='0'/>";
2179
+ echo "</div>\n";
2180
 
2181
  // Use UL and LI Containers
2182
  $tooltip = "Use &quot;UL&quot; as the DOM element for &quot;owl-stage&quot; and use &quot;LI&quot; as the DOM elements for &quot;owl-item&quot;.";
2780
  } else {
2781
  update_post_meta($post->ID, 'sa_touch_drag', '0');
2782
  }
2783
+ if (isset($_POST['sa_mousewheel']) && ($_POST['sa_mousewheel'] == '1')) {
2784
+ update_post_meta($post->ID, 'sa_mousewheel', '1');
2785
+ } else {
2786
+ update_post_meta($post->ID, 'sa_mousewheel', '0');
2787
+ }
2788
  if (isset($_POST['sa_click_advance']) && ($_POST['sa_click_advance'] == '1')) {
2789
  update_post_meta($post->ID, 'sa_click_advance', '1');
2790
  } else {
php/slide-anything-frontend.php CHANGED
@@ -17,6 +17,8 @@ function slide_anything_shortcode($atts) {
17
  wp_enqueue_style('owl_theme_css');
18
  wp_register_style('owl_animate_css', SA_PLUGIN_PATH.'owl-carousel/animate.min.css', array(), '2.0', 'all');
19
  wp_enqueue_style('owl_animate_css');
 
 
20
  if ($sa_pro_version) {
21
  // JAVASCRIPT/CSS FOR MAGNIFIC POPUP
22
  wp_register_script('magnific-popup_js', SA_PLUGIN_PATH.'magnific-popup/jquery.magnific-popup.min.js', array('jquery'), '1.1.0', true);
@@ -201,6 +203,16 @@ function slide_anything_shortcode($atts) {
201
  $slide_data['touch_drag'] = 'true';
202
  } else {
203
  $slide_data['touch_drag'] = 'false';
 
 
 
 
 
 
 
 
 
 
204
  }
205
  if (isset($metadata['sa_click_advance'])) {
206
  $slide_data['click_advance'] = $metadata['sa_click_advance'][0];
@@ -745,10 +757,13 @@ function slide_anything_shortcode($atts) {
745
  // strip JavaScript code (<script> tags) from slide content
746
  $slide_content = remove_javascript_from_content($slide_content);
747
  }
 
 
748
  if ($slide_data['lazy_load_images'] == '1') {
749
  // modify images (<img> tag) within slide content to enable owl carousel lazy load
750
  $slide_content = set_slide_images_to_lazy_load($slide_content);
751
  }
 
752
  if ($slide_data['vert_center'] == 'true') {
753
  // vertically center content within each slide
754
  // (we do this by wrapping slide content in a '<div>' wrapper
@@ -1061,6 +1076,21 @@ function slide_anything_shortcode($atts) {
1061
 
1062
 
1063
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1064
  // JAVASCRIPT FOR 'SLIDE GOTO LINKS"
1065
  $output .= " var owl_goto = jQuery('#".esc_attr($slide_data['css_id'])."');\n";
1066
  for ($i = 1; $i <= $slide_data['num_slides']; $i++) {
17
  wp_enqueue_style('owl_theme_css');
18
  wp_register_style('owl_animate_css', SA_PLUGIN_PATH.'owl-carousel/animate.min.css', array(), '2.0', 'all');
19
  wp_enqueue_style('owl_animate_css');
20
+ wp_register_script('mousewheel_js', SA_PLUGIN_PATH.'js/jquery.mousewheel.min.js', array('jquery'), '3.1.13', true);
21
+ wp_enqueue_script('mousewheel_js');
22
  if ($sa_pro_version) {
23
  // JAVASCRIPT/CSS FOR MAGNIFIC POPUP
24
  wp_register_script('magnific-popup_js', SA_PLUGIN_PATH.'magnific-popup/jquery.magnific-popup.min.js', array('jquery'), '1.1.0', true);
203
  $slide_data['touch_drag'] = 'true';
204
  } else {
205
  $slide_data['touch_drag'] = 'false';
206
+ }
207
+ if (isset($metadata['sa_mousewheel'])) {
208
+ $slide_data['mousewheel'] = $metadata['sa_mousewheel'][0];
209
+ if ($slide_data['mousewheel'] == '1') {
210
+ $slide_data['mousewheel'] = 'true';
211
+ } else {
212
+ $slide_data['mousewheel'] = 'false';
213
+ }
214
+ } else {
215
+ $slide_data['mousewheel'] = 'false';
216
  }
217
  if (isset($metadata['sa_click_advance'])) {
218
  $slide_data['click_advance'] = $metadata['sa_click_advance'][0];
757
  // strip JavaScript code (<script> tags) from slide content
758
  $slide_content = remove_javascript_from_content($slide_content);
759
  }
760
+ // ##### REMOVE LAZY LOAD IMAGES FEATURE (WHICH IS NOW INCLUDED IN WP 5.5) #####
761
+ /*
762
  if ($slide_data['lazy_load_images'] == '1') {
763
  // modify images (<img> tag) within slide content to enable owl carousel lazy load
764
  $slide_content = set_slide_images_to_lazy_load($slide_content);
765
  }
766
+ */
767
  if ($slide_data['vert_center'] == 'true') {
768
  // vertically center content within each slide
769
  // (we do this by wrapping slide content in a '<div>' wrapper
1076
 
1077
 
1078
 
1079
+ // JAVASCRIPT FOR 'MOUSEWHEEL NAVIGATION' OPTION ONLY
1080
+ if ($slide_data['mousewheel'] == 'true') {
1081
+ $output .= " var mw_".$id." = jQuery('#".esc_attr($slide_data['css_id'])."');\n";
1082
+ $output .= " mw_".$id.".on('mousewheel', '.owl-stage', function (e) {\n";
1083
+ $output .= " if (e.deltaY>0) {\n";
1084
+ $output .= " mw_".$id.".trigger('next.owl');\n";
1085
+ $output .= " } else {\n";
1086
+ $output .= " mw_".$id.".trigger('prev.owl');\n";
1087
+ $output .= " }\n";
1088
+ $output .= " e.preventDefault();\n";
1089
+ $output .= " });\n";
1090
+ }
1091
+
1092
+
1093
+
1094
  // JAVASCRIPT FOR 'SLIDE GOTO LINKS"
1095
  $output .= " var owl_goto = jQuery('#".esc_attr($slide_data['css_id'])."');\n";
1096
  for ($i = 1; $i <= $slide_data['num_slides']; $i++) {
readme.txt CHANGED
@@ -98,6 +98,9 @@ Adding a SLIDE ANYTHING slider using the WordPress 5.0 'Block Editor' is pretty
98
 
99
  == Changelog ==
100
 
 
 
 
101
  = 2.3.36 =
102
  * Bug Fix: When the 'DOMContentLoaded event' setting was checked, this was not applied to the 'Magnific Popup' (SA PRO only) JavaScript initialize code - only to the Owl Carousel JavaScript initialize code.
103
 
@@ -710,3 +713,6 @@ Adding a SLIDE ANYTHING slider using the WordPress 5.0 'Block Editor' is pretty
710
 
711
  = 2.3.36 =
712
  * Bug Fix: When the 'DOMContentLoaded event' setting was checked, this was not applied to the 'Magnific Popup' (SA PRO only) JavaScript initialize code - only to the Owl Carousel JavaScript initialize code.
 
 
 
98
 
99
  == Changelog ==
100
 
101
+ = 2.3.37 =
102
+ * Added a new feature 'Mousewheel Navigation' which allows previous/next slide navigation using the mousewheel. Removed the 'Lazy Load Images' feature, as this is now included in the standard WordPress installation.
103
+
104
  = 2.3.36 =
105
  * Bug Fix: When the 'DOMContentLoaded event' setting was checked, this was not applied to the 'Magnific Popup' (SA PRO only) JavaScript initialize code - only to the Owl Carousel JavaScript initialize code.
106
 
713
 
714
  = 2.3.36 =
715
  * Bug Fix: When the 'DOMContentLoaded event' setting was checked, this was not applied to the 'Magnific Popup' (SA PRO only) JavaScript initialize code - only to the Owl Carousel JavaScript initialize code.
716
+
717
+ = 2.3.37 =
718
+ * Added a new feature 'Mousewheel Navigation' which allows previous/next slide navigation using the mousewheel. Removed the 'Lazy Load Images' feature, as this is now included in the standard WordPress installation.
slide-anything.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin URI: https://wordpress.org/plugins/slide-anything/
5
  * Description: Slide Anything allows you to create a carousel/slider where the content for each slide can be anything you want - images, text, HTML, and even shortcodes. This plugin uses the Owl Carousel jQuery plugin, and lets you create beautiful, touch enabled, responsive carousels and sliders.
6
  * Author: Simon Edge
7
- * Version: 2.3.36
8
  * License: GPLv2 or later
9
  */
10
 
4
  * Plugin URI: https://wordpress.org/plugins/slide-anything/
5
  * Description: Slide Anything allows you to create a carousel/slider where the content for each slide can be anything you want - images, text, HTML, and even shortcodes. This plugin uses the Owl Carousel jQuery plugin, and lets you create beautiful, touch enabled, responsive carousels and sliders.
6
  * Author: Simon Edge
7
+ * Version: 2.3.37
8
  * License: GPLv2 or later
9
  */
10