Accordion Shortcodes - Version 2.2.1

Version Description

FIXED: A bug where setting both scroll and openfirst would scroll the window without user interaction.

Download this release

Release Info

Developer philbuchanan
Plugin Icon 128x128 Accordion Shortcodes
Version 2.2.1
Comparing to
See all releases

Code changes from version 2.2 to 2.2.1

Files changed (4) hide show
  1. accordion-shortcodes.php +2 -2
  2. accordion.js +15 -19
  3. accordion.min.js +1 -1
  4. readme.txt +7 -1
accordion-shortcodes.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Plugin Name: Accordion Shortcodes
4
  * Description: Shortcodes for creating responsive accordion drop-downs.
5
- * Version: 2.2
6
  * Author: Phil Buchanan
7
  * Author URI: http://philbuchanan.com
8
  */
@@ -17,7 +17,7 @@ class Accordion_Shortcodes {
17
  /**
18
  * Current plugin version number
19
  */
20
- private $plugin_version = '2.2';
21
 
22
 
23
 
2
  /**
3
  * Plugin Name: Accordion Shortcodes
4
  * Description: Shortcodes for creating responsive accordion drop-downs.
5
+ * Version: 2.2.1
6
  * Author: Phil Buchanan
7
  * Author URI: http://philbuchanan.com
8
  */
17
  /**
18
  * Current plugin version number
19
  */
20
+ private $plugin_version = '2.2.1';
21
 
22
 
23
 
accordion.js CHANGED
@@ -55,7 +55,7 @@
55
  }
56
 
57
  // Open clicked item
58
- openItem($(this));
59
  }
60
  // If item is open, and click to close is set, close it
61
  else if (settings.clickToClose) {
@@ -72,29 +72,26 @@
72
  * Also handles accessibility attribute settings.
73
  *
74
  * @param object ele The accordion item title to open
 
75
  */
76
- function openItem(ele) {
77
  // Clear/stop any previous animations before revealing content
78
  ele.next().clearQueue().stop().slideDown(duration, function() {
79
  // Scroll page to the title
80
- if (settings.scroll) {
81
  $('html, body').animate({
82
  scrollTop: $(this).prev().offset().top - settings.scrollOffset
83
  }, duration);
84
  }
85
  });
86
- ele.addClass('open');
87
 
88
- // Mark accordion item as read
89
- ele.addClass('read');
90
-
91
- // Set accessibility attributes
92
- ele.attr({
93
  'aria-selected': 'true',
94
  'aria-expanded': 'true'
95
- });
96
-
97
- ele.next().attr({
98
  'aria-hidden': 'false'
99
  });
100
  }
@@ -115,9 +112,8 @@
115
  ele.attr({
116
  'aria-selected': 'false',
117
  'aria-expanded': 'false'
118
- });
119
-
120
- ele.next().attr({
121
  'aria-hidden': 'true'
122
  });
123
  }
@@ -129,15 +125,15 @@
129
  * Open first, open all or open based on URL hash.
130
  */
131
  if (selectedId.length && selectedId.hasClass('accordion-title')) {
132
- openItem(selectedId);
133
  }
134
  else if (settings.openAll) {
135
  allTitles.each(function() {
136
- openItem($(this));
137
  });
138
  }
139
  else if (settings.openFirst) {
140
- openItem(firstTitle);
141
  }
142
 
143
 
@@ -168,7 +164,7 @@
168
  });
169
  }
170
 
171
- openItem(selectedId);
172
  }
173
  });
174
 
55
  }
56
 
57
  // Open clicked item
58
+ openItem($(this), true);
59
  }
60
  // If item is open, and click to close is set, close it
61
  else if (settings.clickToClose) {
72
  * Also handles accessibility attribute settings.
73
  *
74
  * @param object ele The accordion item title to open
75
+ * @param bool scroll Whether to scroll the page
76
  */
77
+ function openItem(ele, scroll) {
78
  // Clear/stop any previous animations before revealing content
79
  ele.next().clearQueue().stop().slideDown(duration, function() {
80
  // Scroll page to the title
81
+ if (scroll && settings.scroll) {
82
  $('html, body').animate({
83
  scrollTop: $(this).prev().offset().top - settings.scrollOffset
84
  }, duration);
85
  }
86
  });
 
87
 
88
+ // Mark accordion item as open and read and set aria attributes
89
+ ele.addClass('open read')
90
+ .attr({
 
 
91
  'aria-selected': 'true',
92
  'aria-expanded': 'true'
93
+ })
94
+ .next().attr({
 
95
  'aria-hidden': 'false'
96
  });
97
  }
112
  ele.attr({
113
  'aria-selected': 'false',
114
  'aria-expanded': 'false'
115
+ })
116
+ .next().attr({
 
117
  'aria-hidden': 'true'
118
  });
119
  }
125
  * Open first, open all or open based on URL hash.
126
  */
127
  if (selectedId.length && selectedId.hasClass('accordion-title')) {
128
+ openItem(selectedId, true);
129
  }
130
  else if (settings.openAll) {
131
  allTitles.each(function() {
132
+ openItem($(this), false);
133
  });
134
  }
135
  else if (settings.openFirst) {
136
+ openItem(firstTitle, false);
137
  }
138
 
139
 
164
  });
165
  }
166
 
167
+ openItem(selectedId, true);
168
  }
169
  });
170
 
accordion.min.js CHANGED
@@ -1 +1 @@
1
- !function(o){"use strict";var t,e;o.fn.accordionShortcodes=function(t){function e(){return o(this).hasClass("open")?d.clickToClose&&s(o(this)):(d.autoClose&&i.each(function(){s(o(this))}),n(o(this))),!1}function n(t){t.next().clearQueue().stop().slideDown(l,function(){d.scroll&&o("html, body").animate({scrollTop:o(this).prev().offset().top-d.scrollOffset},l)}),t.addClass("open"),t.addClass("read"),t.attr({"aria-selected":"true","aria-expanded":"true"}),t.next().attr({"aria-hidden":"false"})}function s(o){o.next().slideUp(l),o.removeClass("open"),o.attr({"aria-selected":"false","aria-expanded":"false"}),o.next().attr({"aria-hidden":"true"})}var i=this.children(".accordion-title"),a=this.children(".accordion-content").hide(),c=i.first(),r=(a.first(),o(window.location.hash)),l=250,d=o.extend({autoClose:!0,openFirst:!1,openAll:!1,clickToClose:!1,scroll:!1},t);return o(".accordion").removeClass("no-js"),d.scrollOffset=0|Math.floor(parseInt(d.scroll)),r.length&&r.hasClass("accordion-title")?n(r):d.openAll?i.each(function(){n(o(this))}):d.openFirst&&n(c),i.click(e),i.keydown(function(t){var e=t.which;(13===e||32===e)&&o(this).click()}),o(window).on("hashchange",function(){r=o(window.location.hash),r.length&&r.hasClass("accordion-title")&&(d.autoClose&&i.each(function(){s(o(this))}),n(r))}),this};for(var t=0;t<accordionShortcodesSettings.length;t+=1)e=accordionShortcodesSettings[t],o("#"+e.id).accordionShortcodes(e)}(jQuery);
1
+ !function(o){"use strict";var t,e;o.fn.accordionShortcodes=function(t){function e(){return o(this).hasClass("open")?h.clickToClose&&i(o(this)):(h.autoClose&&s.each(function(){i(o(this))}),n(o(this),!0)),!1}function n(t,e){t.next().clearQueue().stop().slideDown(l,function(){e&&h.scroll&&o("html, body").animate({scrollTop:o(this).prev().offset().top-h.scrollOffset},l)}),t.addClass("open read").attr({"aria-selected":"true","aria-expanded":"true"}).next().attr({"aria-hidden":"false"})}function i(o){o.next().slideUp(l),o.removeClass("open"),o.attr({"aria-selected":"false","aria-expanded":"false"}).next().attr({"aria-hidden":"true"})}var s=this.children(".accordion-title"),a=this.children(".accordion-content").hide(),c=s.first(),r=(a.first(),o(window.location.hash)),l=250,h=o.extend({autoClose:!0,openFirst:!1,openAll:!1,clickToClose:!1,scroll:!1},t);return o(".accordion").removeClass("no-js"),h.scrollOffset=0|Math.floor(parseInt(h.scroll)),r.length&&r.hasClass("accordion-title")?n(r,!0):h.openAll?s.each(function(){n(o(this),!1)}):h.openFirst&&n(c,!1),s.click(e),s.keydown(function(t){var e=t.which;(13===e||32===e)&&o(this).click()}),o(window).on("hashchange",function(){r=o(window.location.hash),r.length&&r.hasClass("accordion-title")&&(h.autoClose&&s.each(function(){i(o(this))}),n(r,!0))}),this};for(var t=0;t<accordionShortcodesSettings.length;t+=1)e=accordionShortcodesSettings[t],o("#"+e.id).accordionShortcodes(e)}(jQuery);
readme.txt CHANGED
@@ -5,7 +5,7 @@ Donate Link: http://philbuchanan.com/
5
  Tags: accordion, accordions, shortcodes, responsive accordions, accordions plugin, jquery accordions, accordions short-code, accordions plugin wordpress, accordions plugin jquery
6
  Requires at least: 3.3
7
  Tested up to: 4.2
8
- Stable tag: 2.2
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -190,6 +190,9 @@ For bug reports or feature requests or if you'd like to contribute to the plugin
190
  3. The Accordion Item shortcode insertion dialog box
191
 
192
  == Changelog ==
 
 
 
193
  = 2.2 =
194
  * NEW: Accessible for users requiring tabbed keyboard navigation control (this took way too long)
195
  * NEW: A classname of 'read' is now added to accordion item titles as they are opened. This allows you to style all read accordion items.
@@ -219,6 +222,9 @@ For bug reports or feature requests or if you'd like to contribute to the plugin
219
  * FIXED: A few incredibly small bugs/annoyances
220
 
221
  == Upgrade Notice ==
 
 
 
222
  = 2.2 =
223
  Drastically improved accessibility. New 'read' class added to opened accordion items. Compatibility mode added for themes with the same accordion shortcode names. WordPress 4.2 compatibility.
224
 
5
  Tags: accordion, accordions, shortcodes, responsive accordions, accordions plugin, jquery accordions, accordions short-code, accordions plugin wordpress, accordions plugin jquery
6
  Requires at least: 3.3
7
  Tested up to: 4.2
8
+ Stable tag: 2.2.1
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
190
  3. The Accordion Item shortcode insertion dialog box
191
 
192
  == Changelog ==
193
+ = 2.2.1 =
194
+ FIXED: A bug where setting both scroll and openfirst would scroll the window without user interaction.
195
+
196
  = 2.2 =
197
  * NEW: Accessible for users requiring tabbed keyboard navigation control (this took way too long)
198
  * NEW: A classname of 'read' is now added to accordion item titles as they are opened. This allows you to style all read accordion items.
222
  * FIXED: A few incredibly small bugs/annoyances
223
 
224
  == Upgrade Notice ==
225
+ = 2.2.1 =
226
+ Fixes a bug introduced in v2.2 when using the scroll and openfirst setting together.
227
+
228
  = 2.2 =
229
  Drastically improved accessibility. New 'read' class added to opened accordion items. Compatibility mode added for themes with the same accordion shortcode names. WordPress 4.2 compatibility.
230