Version Description
- added check for a callback function: colomat_callback on any expand element state change
- added Initial Pause option to pause initial collapse of expand elements on page load
- tabindex allows for a value of 0
- if cid is provided and no cid exists, shortcode will return blank
- added collapse-commander display id and title options for shortcodes
- merged is_valid_jquery_selector function from csummer on github
- added touchstart to click bindings
- fully tested with WordPress 4.9.0
Download this release
Release Info
Developer | baden03 |
Plugin | Collapse-O-Matic |
Version | 1.7.7 |
Comparing to | |
See all releases |
Code changes from version 1.7.6 to 1.7.7
- collapse-o-matic.php +43 -6
- js/collapse.js +30 -10
- readme.txt +20 -5
collapse-o-matic.php
CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Collapse-O-Matic
|
|
4 |
Text Domain: jquery-collapse-o-matic
|
5 |
Plugin URI: https://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.
|
8 |
Author: twinpictures, baden03
|
9 |
Author URI: https://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.
|
33 |
|
34 |
/**
|
35 |
* Used as prefix for options entry
|
@@ -63,6 +63,9 @@ class WP_Collapse_O_Matic {
|
|
63 |
'cc_download_key' => '',
|
64 |
'cc_email' => '',
|
65 |
'filter_content' => '',
|
|
|
|
|
|
|
66 |
);
|
67 |
|
68 |
var $license_group = 'colomat_licenseing';
|
@@ -113,6 +116,7 @@ class WP_Collapse_O_Matic {
|
|
113 |
echo "<script type='text/javascript'>\n";
|
114 |
echo "var colomatduration = '".$this->options['duration']."';\n";
|
115 |
echo "var colomatslideEffect = '".$this->options['slideEffect']."';\n";
|
|
|
116 |
echo "</script>";
|
117 |
if( !empty( $this->options['custom_css'] ) ){
|
118 |
echo "\n<style>\n";
|
@@ -130,7 +134,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.
|
134 |
if( empty($this->options['script_check']) ){
|
135 |
wp_enqueue_script('collapseomatic-js');
|
136 |
}
|
@@ -241,6 +245,8 @@ class WP_Collapse_O_Matic {
|
|
241 |
//content
|
242 |
$content = get_the_content();
|
243 |
}
|
|
|
|
|
244 |
}
|
245 |
wp_reset_postdata();
|
246 |
}
|
@@ -379,6 +385,7 @@ class WP_Collapse_O_Matic {
|
|
379 |
$groupatt = 'data-togglegroup="'.$togglegroup.'"';
|
380 |
}
|
381 |
$inexatt = '';
|
|
|
382 |
if(!empty($tabindex) || $tabindex == 0 ){
|
383 |
$inexatt = 'tabindex="'.$tabindex.'"';
|
384 |
}
|
@@ -600,6 +607,13 @@ class WP_Collapse_O_Matic {
|
|
600 |
</td>
|
601 |
</tr>
|
602 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
603 |
<tr>
|
604 |
<?php
|
605 |
if(empty($options['duration'])){
|
@@ -650,6 +664,25 @@ class WP_Collapse_O_Matic {
|
|
650 |
</td>
|
651 |
</tr>
|
652 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
653 |
<tr>
|
654 |
<th><?php _e( 'Shortcode Loads Scripts', 'jquery-collapse-o-matic' ) ?>:</th>
|
655 |
<td><label><input type="checkbox" id="<?php echo $this->options_name ?>[script_check]" name="<?php echo $this->options_name ?>[script_check]" value="1" <?php echo checked( $options['script_check'], 1 ); ?> /> <?php _e('Only load scripts with shortcode.', 'jquery-collapse-o-matic'); ?>
|
@@ -813,11 +846,15 @@ class WP_Collapse_O_Matic {
|
|
813 |
if ( empty( $saved_options ) ) {
|
814 |
$saved_options = get_option( $this->domain . 'options' );
|
815 |
}
|
816 |
-
|
817 |
// set all options
|
818 |
-
if ( !
|
819 |
foreach ( $this->options AS $key => $option ) {
|
820 |
-
|
|
|
|
|
|
|
|
|
|
|
821 |
}
|
822 |
}
|
823 |
}
|
4 |
Text Domain: jquery-collapse-o-matic
|
5 |
Plugin URI: https://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.7
|
8 |
Author: twinpictures, baden03
|
9 |
Author URI: https://twinpictures.de/
|
10 |
License: GPL2
|
29 |
* Current version
|
30 |
* @var string
|
31 |
*/
|
32 |
+
var $version = '1.7.7';
|
33 |
|
34 |
/**
|
35 |
* Used as prefix for options entry
|
63 |
'cc_download_key' => '',
|
64 |
'cc_email' => '',
|
65 |
'filter_content' => '',
|
66 |
+
'pauseinit' => '',
|
67 |
+
'cc_display_id' => '',
|
68 |
+
'cc_display_title' => '',
|
69 |
);
|
70 |
|
71 |
var $license_group = 'colomat_licenseing';
|
116 |
echo "<script type='text/javascript'>\n";
|
117 |
echo "var colomatduration = '".$this->options['duration']."';\n";
|
118 |
echo "var colomatslideEffect = '".$this->options['slideEffect']."';\n";
|
119 |
+
echo "var colomatpauseInit = '".$this->options['pauseinit']."';\n";
|
120 |
echo "</script>";
|
121 |
if( !empty( $this->options['custom_css'] ) ){
|
122 |
echo "\n<style>\n";
|
134 |
if($this->options['script_location'] == 'footer' ){
|
135 |
$load_in_footer = true;
|
136 |
}
|
137 |
+
wp_register_script('collapseomatic-js', plugins_url('js/collapse.js', __FILE__), array('jquery'), '1.6.9', $load_in_footer);
|
138 |
if( empty($this->options['script_check']) ){
|
139 |
wp_enqueue_script('collapseomatic-js');
|
140 |
}
|
245 |
//content
|
246 |
$content = get_the_content();
|
247 |
}
|
248 |
+
}else{
|
249 |
+
return null;
|
250 |
}
|
251 |
wp_reset_postdata();
|
252 |
}
|
385 |
$groupatt = 'data-togglegroup="'.$togglegroup.'"';
|
386 |
}
|
387 |
$inexatt = '';
|
388 |
+
//var_dump($tabindex);
|
389 |
if(!empty($tabindex) || $tabindex == 0 ){
|
390 |
$inexatt = 'tabindex="'.$tabindex.'"';
|
391 |
}
|
607 |
</td>
|
608 |
</tr>
|
609 |
|
610 |
+
<tr>
|
611 |
+
<th><?php _e( 'Initial Pause', 'jquery-collapse-o-matic' ) ?>:</th>
|
612 |
+
<td><label><input type="number" id="<?php echo $this->options_name ?>[pauseinit]" name="<?php echo $this->options_name ?>[pauseinit]" value="<?php echo $options['pauseinit']; ?>" />
|
613 |
+
<br /><span class="description"><?php _e('Amount of time in milliseconds to pause before the initial collapse is triggered on page load.', 'jquery-collapse-o-matic'); ?></span></label>
|
614 |
+
</td>
|
615 |
+
</tr>
|
616 |
+
|
617 |
<tr>
|
618 |
<?php
|
619 |
if(empty($options['duration'])){
|
664 |
</td>
|
665 |
</tr>
|
666 |
|
667 |
+
<?php
|
668 |
+
//if collapse-commander is installed, display options for displaying id and text in shortocdes
|
669 |
+
if( is_plugin_active( 'collapse-commander/collapse-commander.php' ) ) :
|
670 |
+
?>
|
671 |
+
<tr>
|
672 |
+
<th><?php _e( 'Display ID', 'colpromat' ) ?>:</th>
|
673 |
+
<td><label><input type="checkbox" id="<?php echo $this->options_name ?>[cc_display_id]" name="<?php echo $this->options_name ?>[cc_display_id]" value="1" <?php echo checked( $options['cc_display_id'], 1 ); ?> /> <?php _e('Display ID', 'colpromat'); ?>
|
674 |
+
<br /><span class="description"><?php _e('Display custom ID attribute in shortcodes if set for easier shortcode managment.', 'colpromat'); ?></span></label>
|
675 |
+
</td>
|
676 |
+
</tr>
|
677 |
+
|
678 |
+
<tr>
|
679 |
+
<th><?php _e( 'Display Title', 'colpromat' ) ?>:</th>
|
680 |
+
<td><label><input type="checkbox" id="<?php echo $this->options_name ?>[cc_display_title]" name="<?php echo $this->options_name ?>[cc_display_title]" value="1" <?php echo checked( $options['cc_display_title'], 1 ); ?> /> <?php _e('Display Title', 'colpromat'); ?>
|
681 |
+
<br /><span class="description"><?php _e('Display custom eT attribute in shortcodes that shows expand title for easier shortcode managment.', 'colpromat'); ?></span></label>
|
682 |
+
</td>
|
683 |
+
</tr>
|
684 |
+
<?php endif; ?>
|
685 |
+
|
686 |
<tr>
|
687 |
<th><?php _e( 'Shortcode Loads Scripts', 'jquery-collapse-o-matic' ) ?>:</th>
|
688 |
<td><label><input type="checkbox" id="<?php echo $this->options_name ?>[script_check]" name="<?php echo $this->options_name ?>[script_check]" value="1" <?php echo checked( $options['script_check'], 1 ); ?> /> <?php _e('Only load scripts with shortcode.', 'jquery-collapse-o-matic'); ?>
|
846 |
if ( empty( $saved_options ) ) {
|
847 |
$saved_options = get_option( $this->domain . 'options' );
|
848 |
}
|
|
|
849 |
// set all options
|
850 |
+
if ( !empty( $saved_options ) ) {
|
851 |
foreach ( $this->options AS $key => $option ) {
|
852 |
+
if($key == 'tabindex'){
|
853 |
+
$this->options[ $key ] = $saved_options[ $key ];
|
854 |
+
}
|
855 |
+
else{
|
856 |
+
$this->options[ $key ] = ( empty( $saved_options[ $key ] ) ) ? '' : $saved_options[ $key ];
|
857 |
+
}
|
858 |
}
|
859 |
}
|
860 |
}
|
js/collapse.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
/*!
|
2 |
-
* Collapse-O-Matic JavaSctipt v1.6.
|
3 |
* http://plugins.twinpictures.de/plugins/collapse-o-matic/
|
4 |
*
|
5 |
* Copyright 2017, Twinpictures
|
@@ -150,6 +150,11 @@ function toggleState (obj, id, maptastic, trig_id) {
|
|
150 |
google.maps.event.trigger(map, 'resize');
|
151 |
});
|
152 |
}
|
|
|
|
|
|
|
|
|
|
|
153 |
}
|
154 |
|
155 |
function closeOtherGroups(rel){
|
@@ -322,8 +327,23 @@ function colomat_collapseall(loop_items){
|
|
322 |
|
323 |
|
324 |
jQuery(document).ready(function() {
|
325 |
-
//console.log(colomatduration, colomatslideEffect);
|
326 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
327 |
|
328 |
//jetpack infinite scroll catch-all
|
329 |
jQuery( document.body ).on( 'post-load', function () {
|
@@ -363,7 +383,7 @@ jQuery(document).ready(function() {
|
|
363 |
});
|
364 |
|
365 |
//the main collapse/expand function
|
366 |
-
jQuery(document).on('click', '.collapseomatic', function(event) {
|
367 |
var offset_top;
|
368 |
|
369 |
//alert('phones ringin dude');
|
@@ -484,7 +504,7 @@ jQuery(document).ready(function() {
|
|
484 |
});
|
485 |
|
486 |
|
487 |
-
jQuery(document).on('click', '.expandall', function(event) {
|
488 |
if(jQuery(this).attr('rel') !== undefined){
|
489 |
var rel = jQuery(this).attr('rel');
|
490 |
var loop_items = jQuery('.collapseomatic:not(.colomat-close)[rel="' + rel +'"]');
|
@@ -500,7 +520,7 @@ jQuery(document).ready(function() {
|
|
500 |
colomat_expandall(loop_items);
|
501 |
});
|
502 |
|
503 |
-
jQuery(document).on('click', '.collapseall', function(event) {
|
504 |
if(jQuery(this).attr('rel') !== undefined){
|
505 |
var rel = jQuery(this).attr('rel');
|
506 |
var loop_items = jQuery('.collapseomatic.colomat-close[rel="' + rel +'"]');
|
@@ -531,7 +551,7 @@ jQuery(document).ready(function() {
|
|
531 |
}
|
532 |
|
533 |
//if the element exists
|
534 |
-
if( jQuery('#' + anchor).length ){
|
535 |
|
536 |
//if the element isn't already expanded, expand it
|
537 |
if(!jQuery('#' + anchor).hasClass('colomat-close')){
|
@@ -555,7 +575,7 @@ jQuery(document).ready(function() {
|
|
555 |
}
|
556 |
|
557 |
//handle anchor links within the same page
|
558 |
-
jQuery(document).on('click', 'a.expandanchor', function(event) {
|
559 |
//event.preventDefault();
|
560 |
var fullurl = jQuery(this).attr('href');
|
561 |
// the URL contains an anchor but not a hash-bang
|
@@ -571,7 +591,7 @@ jQuery(document).ready(function() {
|
|
571 |
anchor = anchor_arr[0];
|
572 |
}
|
573 |
|
574 |
-
if( jQuery('#' + anchor).length ){
|
575 |
//expand any nested parents
|
576 |
jQuery('#' + anchor).parents('.collapseomatic_content').each(function(index) {
|
577 |
parent_arr = jQuery(this).attr('id').split('-');
|
@@ -589,7 +609,7 @@ jQuery(document).ready(function() {
|
|
589 |
}
|
590 |
});
|
591 |
|
592 |
-
jQuery(document).on('click', 'a.colomat-nolink', function(event) {
|
593 |
event.preventDefault();
|
594 |
});
|
595 |
});
|
1 |
/*!
|
2 |
+
* Collapse-O-Matic JavaSctipt v1.6.9
|
3 |
* http://plugins.twinpictures.de/plugins/collapse-o-matic/
|
4 |
*
|
5 |
* Copyright 2017, Twinpictures
|
150 |
google.maps.event.trigger(map, 'resize');
|
151 |
});
|
152 |
}
|
153 |
+
|
154 |
+
//callback
|
155 |
+
if ( typeof colomat_callback != 'undefined' ) {
|
156 |
+
colomat_callback();
|
157 |
+
}
|
158 |
}
|
159 |
|
160 |
function closeOtherGroups(rel){
|
327 |
|
328 |
|
329 |
jQuery(document).ready(function() {
|
330 |
+
//console.log(colomatduration, colomatslideEffect, colomatpauseInit);
|
331 |
+
if(colomatpauseInit){
|
332 |
+
init_pause = setTimeout(collapse_init, colomatpauseInit);
|
333 |
+
}
|
334 |
+
else{
|
335 |
+
collapse_init();
|
336 |
+
}
|
337 |
+
|
338 |
+
function is_valid_jquery_selector(sel) {
|
339 |
+
try {
|
340 |
+
jQuery(sel);
|
341 |
+
return true;
|
342 |
+
}
|
343 |
+
catch(ex) {
|
344 |
+
return false;
|
345 |
+
}
|
346 |
+
}
|
347 |
|
348 |
//jetpack infinite scroll catch-all
|
349 |
jQuery( document.body ).on( 'post-load', function () {
|
383 |
});
|
384 |
|
385 |
//the main collapse/expand function
|
386 |
+
jQuery(document).on('click touchstart', '.collapseomatic', function(event) {
|
387 |
var offset_top;
|
388 |
|
389 |
//alert('phones ringin dude');
|
504 |
});
|
505 |
|
506 |
|
507 |
+
jQuery(document).on('click touchstart', '.expandall', function(event) {
|
508 |
if(jQuery(this).attr('rel') !== undefined){
|
509 |
var rel = jQuery(this).attr('rel');
|
510 |
var loop_items = jQuery('.collapseomatic:not(.colomat-close)[rel="' + rel +'"]');
|
520 |
colomat_expandall(loop_items);
|
521 |
});
|
522 |
|
523 |
+
jQuery(document).on('click touchstart', '.collapseall', function(event) {
|
524 |
if(jQuery(this).attr('rel') !== undefined){
|
525 |
var rel = jQuery(this).attr('rel');
|
526 |
var loop_items = jQuery('.collapseomatic.colomat-close[rel="' + rel +'"]');
|
551 |
}
|
552 |
|
553 |
//if the element exists
|
554 |
+
if( is_valid_jquery_selector('#' + anchor) && jQuery('#' + anchor).length ){
|
555 |
|
556 |
//if the element isn't already expanded, expand it
|
557 |
if(!jQuery('#' + anchor).hasClass('colomat-close')){
|
575 |
}
|
576 |
|
577 |
//handle anchor links within the same page
|
578 |
+
jQuery(document).on('click touchstart', 'a.expandanchor', function(event) {
|
579 |
//event.preventDefault();
|
580 |
var fullurl = jQuery(this).attr('href');
|
581 |
// the URL contains an anchor but not a hash-bang
|
591 |
anchor = anchor_arr[0];
|
592 |
}
|
593 |
|
594 |
+
if( is_valid_jquery_selector('#' + anchor) && jQuery('#' + anchor).length ){
|
595 |
//expand any nested parents
|
596 |
jQuery('#' + anchor).parents('.collapseomatic_content').each(function(index) {
|
597 |
parent_arr = jQuery(this).attr('id').split('-');
|
609 |
}
|
610 |
});
|
611 |
|
612 |
+
jQuery(document).on('click touchstart', 'a.colomat-nolink', function(event) {
|
613 |
event.preventDefault();
|
614 |
});
|
615 |
});
|
readme.txt
CHANGED
@@ -3,9 +3,9 @@
|
|
3 |
Contributors: twinpictures, baden03
|
4 |
Donate link: https://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.
|
7 |
-
Tested up to: 4.
|
8 |
-
Stable tag: 1.7.
|
9 |
License: GPLv2 or later
|
10 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -50,6 +50,16 @@ No. Not even close.
|
|
50 |
|
51 |
== Changelog ==
|
52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
= 1.7.6 =
|
54 |
* integrated collapse-commander expand templates
|
55 |
* fully tested with WordPress 4.8.1
|
@@ -342,5 +352,10 @@ Fixed auto-expand of urls with id-anchors
|
|
342 |
* The plug-in came to be.
|
343 |
|
344 |
== Upgrade Notice ==
|
345 |
-
*
|
346 |
-
*
|
|
|
|
|
|
|
|
|
|
3 |
Contributors: twinpictures, baden03
|
4 |
Donate link: https://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.5
|
7 |
+
Tested up to: 4.9.0
|
8 |
+
Stable tag: 1.7.7
|
9 |
License: GPLv2 or later
|
10 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
50 |
|
51 |
== Changelog ==
|
52 |
|
53 |
+
= 1.7.7 =
|
54 |
+
* added check for a callback function: colomat_callback on any expand element state change
|
55 |
+
* added Initial Pause option to pause initial collapse of expand elements on page load
|
56 |
+
* tabindex allows for a value of 0
|
57 |
+
* if cid is provided and no cid exists, shortcode will return blank
|
58 |
+
* added collapse-commander display id and title options for shortcodes
|
59 |
+
* merged is_valid_jquery_selector function from csummer on github
|
60 |
+
* added touchstart to click bindings
|
61 |
+
* fully tested with WordPress 4.9.0
|
62 |
+
|
63 |
= 1.7.6 =
|
64 |
* integrated collapse-commander expand templates
|
65 |
* fully tested with WordPress 4.8.1
|
352 |
* The plug-in came to be.
|
353 |
|
354 |
== Upgrade Notice ==
|
355 |
+
* added check for a callback function: colomat_callback on any expand element state change
|
356 |
+
* added Initial Pause option to pause initial collapse of expand elements on page load
|
357 |
+
* tabindex allows for a value of 0
|
358 |
+
* if cid is provided and no cid exists, shortcode will return blank
|
359 |
+
* added collapse-commander display id and title options for shortcodes
|
360 |
+
* merged is_valid_jquery_selector function from csummer on github
|
361 |
+
* fully tested with WordPress 4.9.0
|