Collapse-O-Matic - Version 1.7.3

Version Description

  • added effect and duration attributes and data-attributes
  • if duration is a number, string will be converted to integer
  • fully tested with WordPress 4.6
Download this release

Release Info

Developer baden03
Plugin Icon 128x128 Collapse-O-Matic
Version 1.7.3
Comparing to
See all releases

Code changes from version 1.7.2 to 1.7.3

Files changed (3) hide show
  1. collapse-o-matic.php +25 -10
  2. js/collapse.js +24 -5
  3. readme.txt +7 -2
collapse-o-matic.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Collapse-O-Matic
4
  Text Domain: jquery-collapse-o-matic
5
  Plugin URI: http://plugins.twinpictures.de/plugins/collapse-o-matic/
6
  Description: Collapse-O-Matic adds an [expand] shortcode that wraps content into a lovely, jQuery collapsible div.
7
- Version: 1.7.2
8
  Author: twinpictures, baden03
9
  Author URI: http://twinpictures.de/
10
  License: GPL2
@@ -29,7 +29,7 @@ class WP_Collapse_O_Matic {
29
  * Current version
30
  * @var string
31
  */
32
- var $version = '1.7.2';
33
 
34
  /**
35
  * Used as prefix for options entry
@@ -130,7 +130,7 @@ class WP_Collapse_O_Matic {
130
  if($this->options['script_location'] == 'footer' ){
131
  $load_in_footer = true;
132
  }
133
- wp_register_script('collapseomatic-js', plugins_url('js/collapse.js', __FILE__), array('jquery'), '1.6.4', $load_in_footer);
134
  if( empty($this->options['script_check']) ){
135
  wp_enqueue_script('collapseomatic-js');
136
  }
@@ -206,7 +206,9 @@ class WP_Collapse_O_Matic {
206
  'elwraptag' => '',
207
  'elwrapclass' => '',
208
  'filter' => $options['filter_content'],
209
- 'tabindex' => $options['tabindex']
 
 
210
  ), $atts, 'expand'));
211
  if(!empty($cid)){
212
  $args = array(
@@ -365,6 +367,19 @@ class WP_Collapse_O_Matic {
365
  //$anchor = '<input type="hidden" id="find-'.$id.'" name="'.$offset.'"/>';
366
  $anchor = 'data-findme="'.$offset.'"';
367
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
368
  $closeanchor = '';
369
  if($scrollonclose && (is_numeric($scrollonclose) || $scrollonclose == 0)){
370
  $trigclass .= ' scroll-to-trigger';
@@ -384,7 +399,7 @@ class WP_Collapse_O_Matic {
384
  if(!empty($trigtype) && $trigtype == 'image' && !empty($triggerimage)){
385
  $title = wp_get_attachment_image( $triggerimage, 'full' );
386
  }
387
- $link = $closeanchor.'<'.$tag.' class="collapseomatic '.$trigclass.'" id="'.$id.'" '.$relatt.' '.$inexatt.' '.$altatt.' '.$anchor.' '.$groupatt.'>'.$startwrap.$title.$endwrap.'</'.$tag.'>';
388
  }
389
 
390
  //swap image
@@ -698,11 +713,11 @@ class WP_Collapse_O_Matic {
698
  <div class="inside">
699
  <p><?php printf( __('To receive plugin updates you must register your plugin. Enter your Collapse Commander licence key below. Licence keys may be viewed and manged by logging into %syour account%s.', 'colpromat'), '<a href="http://plugins.twinpictures.de/your-account/" target="_blank">', '</a>'); ?></p>
700
  <form method="post" action="options.php">
701
- <?php
702
- settings_fields( $this->license_group );
703
- $options = get_option($this->license_name);
704
- $cc_licence = ( !isset( $options['collapse_commander_license_key'] ) ) ? '' : $options['collapse_commander_license_key'];
705
- ?>
706
  <fieldset>
707
  <table style="width: 100%">
708
  <tbody>
4
  Text Domain: jquery-collapse-o-matic
5
  Plugin URI: http://plugins.twinpictures.de/plugins/collapse-o-matic/
6
  Description: Collapse-O-Matic adds an [expand] shortcode that wraps content into a lovely, jQuery collapsible div.
7
+ Version: 1.7.3
8
  Author: twinpictures, baden03
9
  Author URI: http://twinpictures.de/
10
  License: GPL2
29
  * Current version
30
  * @var string
31
  */
32
+ var $version = '1.7.3';
33
 
34
  /**
35
  * Used as prefix for options entry
130
  if($this->options['script_location'] == 'footer' ){
131
  $load_in_footer = true;
132
  }
133
+ wp_register_script('collapseomatic-js', plugins_url('js/collapse.js', __FILE__), array('jquery'), '1.6.5', $load_in_footer);
134
  if( empty($this->options['script_check']) ){
135
  wp_enqueue_script('collapseomatic-js');
136
  }
206
  'elwraptag' => '',
207
  'elwrapclass' => '',
208
  'filter' => $options['filter_content'],
209
+ 'tabindex' => $options['tabindex'],
210
+ 'animation_effect' => '',
211
+ 'duration' => '',
212
  ), $atts, 'expand'));
213
  if(!empty($cid)){
214
  $args = array(
367
  //$anchor = '<input type="hidden" id="find-'.$id.'" name="'.$offset.'"/>';
368
  $anchor = 'data-findme="'.$offset.'"';
369
  }
370
+
371
+ //effect
372
+ $effatt = '';
373
+ if($animation_effect){
374
+ $effatt = 'data-animation_effect="'.$animation_effect.'"';
375
+ }
376
+
377
+ //duration
378
+ $duratt = '';
379
+ if($duration){
380
+ $duratt = 'data-duration="'.$duration.'"';
381
+ }
382
+
383
  $closeanchor = '';
384
  if($scrollonclose && (is_numeric($scrollonclose) || $scrollonclose == 0)){
385
  $trigclass .= ' scroll-to-trigger';
399
  if(!empty($trigtype) && $trigtype == 'image' && !empty($triggerimage)){
400
  $title = wp_get_attachment_image( $triggerimage, 'full' );
401
  }
402
+ $link = $closeanchor.'<'.$tag.' class="collapseomatic '.$trigclass.'" id="'.$id.'" '.$relatt.' '.$inexatt.' '.$altatt.' '.$anchor.' '.$groupatt.' '.$effatt.' '.$duratt.'>'.$startwrap.$title.$endwrap.'</'.$tag.'>';
403
  }
404
 
405
  //swap image
713
  <div class="inside">
714
  <p><?php printf( __('To receive plugin updates you must register your plugin. Enter your Collapse Commander licence key below. Licence keys may be viewed and manged by logging into %syour account%s.', 'colpromat'), '<a href="http://plugins.twinpictures.de/your-account/" target="_blank">', '</a>'); ?></p>
715
  <form method="post" action="options.php">
716
+ <?php
717
+ settings_fields( $this->license_group );
718
+ $options = get_option($this->license_name);
719
+ $cc_licence = ( !isset( $options['collapse_commander_license_key'] ) ) ? '' : $options['collapse_commander_license_key'];
720
+ ?>
721
  <fieldset>
722
  <table style="width: 100%">
723
  <tbody>
js/collapse.js CHANGED
@@ -1,5 +1,5 @@
1
  /*!
2
- * Collapse-O-Matic JavaSctipt v1.6.4
3
  * http://plugins.twinpictures.de/plugins/collapse-o-matic/
4
  *
5
  * Copyright 2016, Twinpictures
@@ -75,9 +75,28 @@ function toggleState (obj, id, maptastic, trig_id) {
75
  jQuery('[id^=target][id$='+id+']').removeClass('maptastic');
76
  }
77
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
  //slideToggle
79
- if(colomatslideEffect == 'slideToggle'){
80
- jQuery('[id^=target][id$='+id+']').slideToggle(colomatduration, function() {
81
  // Animation complete.
82
  if( jQuery(this).hasClass('colomat-inline') && jQuery(this).is(':visible') ){
83
  jQuery(this).css('display', 'inline');
@@ -97,11 +116,11 @@ function toggleState (obj, id, maptastic, trig_id) {
97
  });
98
  }
99
  //slideFade
100
- else if(colomatslideEffect == 'slideFade'){
101
  jQuery('[id^=target][id$='+id+']').animate({
102
  height: "toggle",
103
  opacity: "toggle"
104
- }, colomatduration, function (){
105
  //Animation complete
106
  if( jQuery(this).hasClass('colomat-inline') && jQuery(this).is(':visible') ){
107
  jQuery(this).css('display', 'inline');
1
  /*!
2
+ * Collapse-O-Matic JavaSctipt v1.6.5
3
  * http://plugins.twinpictures.de/plugins/collapse-o-matic/
4
  *
5
  * Copyright 2016, Twinpictures
75
  jQuery('[id^=target][id$='+id+']').removeClass('maptastic');
76
  }
77
 
78
+ //reset effect and duration to default
79
+ com_effect = colomatslideEffect;
80
+ com_duration = colomatduration;
81
+
82
+ //effect override
83
+ if( obj.attr('data-animation_effect') ){
84
+ com_effect = obj.attr('data-animation_effect');
85
+ }
86
+
87
+ //duration override
88
+ if( obj.attr('data-duration') ){
89
+ com_duration = obj.attr('data-duration');
90
+ }
91
+
92
+ //if durration is a number, make it a number
93
+ if( isFinite(com_duration) ){
94
+ com_duration = parseFloat(com_duration);
95
+ }
96
+
97
  //slideToggle
98
+ if(com_effect == 'slideToggle'){
99
+ jQuery('[id^=target][id$='+id+']').slideToggle(com_duration, function() {
100
  // Animation complete.
101
  if( jQuery(this).hasClass('colomat-inline') && jQuery(this).is(':visible') ){
102
  jQuery(this).css('display', 'inline');
116
  });
117
  }
118
  //slideFade
119
+ else if(com_effect == 'slideFade'){
120
  jQuery('[id^=target][id$='+id+']').animate({
121
  height: "toggle",
122
  opacity: "toggle"
123
+ }, com_duration, function (){
124
  //Animation complete
125
  if( jQuery(this).hasClass('colomat-inline') && jQuery(this).is(':visible') ){
126
  jQuery(this).css('display', 'inline');
readme.txt CHANGED
@@ -4,8 +4,8 @@ Contributors: twinpictures, baden03
4
  Donate link: http://plugins.twinpictures.de/plugins/collapse-o-matic/
5
  Tags: collapse, expand, collapsible, expandable, expandable content, collapsable content, shortcode, hidden, hide, display, accordion, accordion, jQuery, javascript, roll-your-own, twinpictures, read me, read more, more, plugin oven
6
  Requires at least: 4.0
7
- Tested up to: 4.6-rc2
8
- Stable tag: 1.7.2
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -50,6 +50,11 @@ No. Not even close.
50
 
51
  == Changelog ==
52
 
 
 
 
 
 
53
  = 1.7.2 =
54
  * adjusted data-findme to deal with ‘auto’ value
55
  * added the must-be-one class to force one highlander element to stay open
4
  Donate link: http://plugins.twinpictures.de/plugins/collapse-o-matic/
5
  Tags: collapse, expand, collapsible, expandable, expandable content, collapsable content, shortcode, hidden, hide, display, accordion, accordion, jQuery, javascript, roll-your-own, twinpictures, read me, read more, more, plugin oven
6
  Requires at least: 4.0
7
+ Tested up to: 4.7
8
+ Stable tag: 1.7.3
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
50
 
51
  == Changelog ==
52
 
53
+ = 1.7.3 =
54
+ * added effect and duration attributes and data-attributes
55
+ * if duration is a number, string will be converted to integer
56
+ * fully tested with WordPress 4.6
57
+
58
  = 1.7.2 =
59
  * adjusted data-findme to deal with ‘auto’ value
60
  * added the must-be-one class to force one highlander element to stay open