Collapse-O-Matic - Version 1.5.9

Version Description

  • fixed issue with missing classes in dark style
  • streamlined the collapse/expand function
  • streamlined the collapseall/expandall functions
  • added auto to scrollonclose attribute
  • added new colomat_expandall and colomat_collpaseall functions that can be triggered externally
Download this release

Release Info

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

Code changes from version 1.5.8 to 1.5.9

Files changed (4) hide show
  1. collapse-o-matic.php +23 -6
  2. dark_style.css +6 -2
  3. js/collapse.js +144 -250
  4. readme.txt +16 -2
collapse-o-matic.php CHANGED
@@ -5,7 +5,7 @@ Text Domain: colomat
5
  Domain Path: /languages
6
  Plugin URI: http://plugins.twinpictures.de/plugins/collapse-o-matic/
7
  Description: Collapse-O-Matic adds an [expand] shortcode that wraps content into a lovely, jQuery collapsible div.
8
- Version: 1.5.8
9
  Author: twinpictures, baden03
10
  Author URI: http://twinpictures.de/
11
  License: GPL2
@@ -23,7 +23,7 @@ class WP_Collapse_O_Matic {
23
  * Current version
24
  * @var string
25
  */
26
- var $version = '1.5.8';
27
 
28
  /**
29
  * Used as prefix for options entry
@@ -106,13 +106,13 @@ class WP_Collapse_O_Matic {
106
  if($this->options['script_location'] == 'footer' ){
107
  $load_in_footer = true;
108
  }
109
- wp_register_script('collapseomatic-js', plugins_url('js/collapse.js', __FILE__), array('jquery'), '1.5.7', $load_in_footer);
110
  if( empty($this->options['script_check']) ){
111
  wp_enqueue_script('collapseomatic-js');
112
  }
113
 
114
  //css
115
- wp_register_style( 'collapseomatic-css', plugins_url('/'.$this->options['style'].'_style.css', __FILE__) , array (), '1.5.7' );
116
  wp_enqueue_style( 'collapseomatic-css' );
117
  }
118
 
@@ -291,7 +291,24 @@ class WP_Collapse_O_Matic {
291
  * Admin options page
292
  */
293
  function options_page() {
294
- $like_it_arr = array('made you feel all warm and fuzzy on the inside', 'restored your faith in humanity... even if only for a fleating second', 'rocked your world', 'provided a positive vision of future living', 'inspired you to commit a random act of kindness', 'encouraged more regular flossing of the teeth', 'helped organize your life in the small ways that matter', 'saved your minutes--if not tens of minutes--writing your own solution', 'brightened your day... or darkened if if you are trying to sleep in', 'caused you to dance a little jig of joy and joyness', 'inspired you to tweet a little @twinpictues social love', 'tasted great, while also being less filling');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
295
  $rand_key = array_rand($like_it_arr);
296
  $like_it = $like_it_arr[$rand_key];
297
  ?>
@@ -446,7 +463,7 @@ class WP_Collapse_O_Matic {
446
  <p><?php _e( 'Remove clutter, save space. Display and hide additional content in a SEO friendly way. Wrap any content&mdash;including other shortcodes&mdash;into a lovely jQuery expanding and collapsing element.', 'colomat') ?></p>
447
  <ul>
448
  <li><?php printf( __( '%sDetailed documentation%s, complete with working demonstrations of all shortcode attributes, is available for your instructional enjoyment.', 'colomat'), '<a href="http://plugins.twinpictures.de/plugins/collapse-o-matic/documentation/" target="_blank">', '</a>'); ?></li>
449
- <li><?php printf( __( '%sFree%s Opensource Support', 'colomat'), '<a href="http://wordpress.org/support/plugin/jquery-collapse-o-matic" target="_blank">', '</a>'); ?></li>
450
  <li><?php printf( __('If this plugin %s, please consider %sreviewing it at WordPress.org%s to help others.', 'colomat'), $like_it, '<a href="http://wordpress.org/support/view/plugin-reviews/jquery-collapse-o-matic" target="_blank">', '</a>' ) ?></li>
451
  <li><a href="http://wordpress.org/extend/plugins/jquery-collapse-o-matic/" target="_blank">WordPress.org</a> | <a href="http://plugins.twinpictures.de/plugins/collapse-o-matic/" target="_blank">Twinpictues Plugin Oven</a></li>
452
  </ul>
5
  Domain Path: /languages
6
  Plugin URI: http://plugins.twinpictures.de/plugins/collapse-o-matic/
7
  Description: Collapse-O-Matic adds an [expand] shortcode that wraps content into a lovely, jQuery collapsible div.
8
+ Version: 1.5.9
9
  Author: twinpictures, baden03
10
  Author URI: http://twinpictures.de/
11
  License: GPL2
23
  * Current version
24
  * @var string
25
  */
26
+ var $version = '1.5.9';
27
 
28
  /**
29
  * Used as prefix for options entry
106
  if($this->options['script_location'] == 'footer' ){
107
  $load_in_footer = true;
108
  }
109
+ wp_register_script('collapseomatic-js', plugins_url('js/collapse.js', __FILE__), array('jquery'), '1.5.10', $load_in_footer);
110
  if( empty($this->options['script_check']) ){
111
  wp_enqueue_script('collapseomatic-js');
112
  }
113
 
114
  //css
115
+ wp_register_style( 'collapseomatic-css', plugins_url('/'.$this->options['style'].'_style.css', __FILE__) , array (), '1.6' );
116
  wp_enqueue_style( 'collapseomatic-css' );
117
  }
118
 
291
  * Admin options page
292
  */
293
  function options_page() {
294
+ $like_it_arr = array(
295
+ __('really tied the room together', 'colomat'),
296
+ __('made you feel all warm and fuzzy on the inside', 'colomat'),
297
+ __('restored your faith in humanity... even if only for a fleeting second', 'colomat'),
298
+ __('rocked your world', 'provided a positive vision of future living', 'colomat'),
299
+ __('inspired you to commit a random act of kindness', 'colomat'),
300
+ __('encouraged more regular flossing of the teeth', 'colomat'),
301
+ __('helped organize your life in the small ways that matter', 'colomat'),
302
+ __('saved your minutes--if not tens of minutes--writing your own solution', 'colomat'),
303
+ __('brightened your day... or darkened if if you are trying to sleep in', 'colomat'),
304
+ __('caused you to dance a little jig of joy and joyousness', 'colomat'),
305
+ __('inspired you to tweet a little @twinpictues social love', 'colomat'),
306
+ __('tasted great, while also being less filling', 'colomat'),
307
+ __('caused you to shout: "everybody spread love, give me some mo!"', 'colomat'),
308
+ __('helped you keep the funk alive', 'colomat'),
309
+ __('<a href="http://www.youtube.com/watch?v=dvQ28F5fOdU" target="_blank">soften hands while you do dishes</a>', 'colomat'),
310
+ __('helped that little old lady <a href="http://www.youtube.com/watch?v=Ug75diEyiA0" target="_blank">find the beef</a>', 'colomat')
311
+ );
312
  $rand_key = array_rand($like_it_arr);
313
  $like_it = $like_it_arr[$rand_key];
314
  ?>
463
  <p><?php _e( 'Remove clutter, save space. Display and hide additional content in a SEO friendly way. Wrap any content&mdash;including other shortcodes&mdash;into a lovely jQuery expanding and collapsing element.', 'colomat') ?></p>
464
  <ul>
465
  <li><?php printf( __( '%sDetailed documentation%s, complete with working demonstrations of all shortcode attributes, is available for your instructional enjoyment.', 'colomat'), '<a href="http://plugins.twinpictures.de/plugins/collapse-o-matic/documentation/" target="_blank">', '</a>'); ?></li>
466
+ <li><?php printf( __( '%sFree Opensource Support%s', 'colomat'), '<a href="http://wordpress.org/support/plugin/jquery-collapse-o-matic" target="_blank">', '</a>'); ?></li>
467
  <li><?php printf( __('If this plugin %s, please consider %sreviewing it at WordPress.org%s to help others.', 'colomat'), $like_it, '<a href="http://wordpress.org/support/view/plugin-reviews/jquery-collapse-o-matic" target="_blank">', '</a>' ) ?></li>
468
  <li><a href="http://wordpress.org/extend/plugins/jquery-collapse-o-matic/" target="_blank">WordPress.org</a> | <a href="http://plugins.twinpictures.de/plugins/collapse-o-matic/" target="_blank">Twinpictues Plugin Oven</a></li>
469
  </ul>
dark_style.css CHANGED
@@ -2,7 +2,6 @@
2
  background-image: url(images/arrow-down-dark.png);
3
  background-repeat: no-repeat;
4
  padding: 0 0 10px 16px;
5
- /*border: 1px dotted blue;*/
6
  cursor: pointer;
7
  }
8
  .arrowright {
@@ -25,11 +24,16 @@
25
  padding: 0px;
26
  }
27
  .content_collapse_wrapper {
28
- display: none;
29
  }
30
  .collapseall, .expandall {
31
  cursor: pointer;
32
  }
33
  .collapseall:hover, .expandall:hover {
34
  text-decoration: underline;
 
 
 
 
 
35
  }
2
  background-image: url(images/arrow-down-dark.png);
3
  background-repeat: no-repeat;
4
  padding: 0 0 10px 16px;
 
5
  cursor: pointer;
6
  }
7
  .arrowright {
24
  padding: 0px;
25
  }
26
  .content_collapse_wrapper {
27
+ position: absolute; left: -999em;
28
  }
29
  .collapseall, .expandall {
30
  cursor: pointer;
31
  }
32
  .collapseall:hover, .expandall:hover {
33
  text-decoration: underline;
34
+ }
35
+ .maptastic {
36
+ position: absolute !important;
37
+ left: -10000px !important;
38
+ display:block !important;
39
  }
js/collapse.js CHANGED
@@ -1,8 +1,8 @@
1
  /*!
2
- * Collapse-O-Matic v1.5.7
3
  * http://plugins.twinpictures.de/plugins/collapse-o-matic/
4
  *
5
- * Copyright 2013, Twinpictures
6
  *
7
  * Permission is hereby granted, free of charge, to any person obtaining a copy
8
  * of this software and associated documentation files (the "Software"), to deal
@@ -61,6 +61,54 @@ function swapTitle(origObj, swapObj){
61
  }
62
  }
63
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
  function closeOtherGroups(rel){
65
  jQuery('.collapseomatic[rel!="' + rel +'"]').each(function(index) {
66
  //add close class if open
@@ -82,28 +130,8 @@ function closeOtherGroups(rel){
82
  if(jQuery("#swapexcerpt-"+id).length > 0){
83
  swapTitle("#exerpt-"+id, "#swapexcerpt-"+id);
84
  }
85
-
86
- //slideToggle
87
- if(colomatslideEffect == 'slideToggle'){
88
- jQuery('#target-'+id).slideToggle(colomatduration, function() {
89
- // Animation complete.
90
- if( jQuery(this).hasClass('colomat-inline') && jQuery(this).is(':visible') ){
91
- jQuery(this).css('display', 'inline');
92
- }
93
- });
94
- }
95
- //slideFade
96
- else if(colomatslideEffect == 'slideFade'){
97
- jQuery('#target-'+id).animate({
98
- height: "toggle",
99
- opacity: "toggle"
100
- }, colomatduration, function (){
101
- //Animation complete
102
- if( jQuery(this).hasClass('colomat-inline') && jQuery(this).is(':visible') ){
103
- jQuery(this).css('display', 'inline');
104
- }
105
- });
106
- }
107
 
108
  //check if there are nested children that need to be collapsed
109
  var ancestors = jQuery('.collapseomatic', '#target-'+id);
@@ -144,27 +172,8 @@ function closeOtherMembers(rel, id){
144
  if(!jQuery(this).hasClass('colomat-close') && jQuery(this).hasClass('snap-shut')){
145
  jQuery('#target-'+thisid).hide();
146
  }
147
-
148
- //slideToggle
149
- else if(colomatslideEffect == 'slideToggle'){
150
- jQuery('#target-'+thisid).slideToggle(colomatduration, function() {
151
- // Animation complete.
152
- if( jQuery(this).hasClass('colomat-inline') && jQuery(this).is(':visible') ){
153
- jQuery(this).css('display', 'inline');
154
- }
155
- });
156
- }
157
- //slideFade
158
- else if(colomatslideEffect == 'slideFade'){
159
- jQuery('#target-'+thisid).animate({
160
- height: "toggle",
161
- opacity: "toggle"
162
- }, colomatduration, function(){
163
- // Animation complete.
164
- if( jQuery(this).hasClass('colomat-inline') && jQuery(this).is(':visible') ){
165
- jQuery(this).css('display', 'inline');
166
- }
167
- });
168
  }
169
 
170
  //check if there are nested children that need to be collapsed
@@ -189,6 +198,10 @@ function closeOtherMembers(rel, id){
189
  //deal with any scroll to links from the Title Trigger
190
  if(jQuery('#'+id).hasClass('scroll-to-trigger')){
191
  offset_top = jQuery('#scrollonclose-'+id).attr('name');
 
 
 
 
192
  }
193
 
194
  //toggle master trigger arrow
@@ -216,6 +229,54 @@ function closeOtherMembers(rel, id){
216
  });
217
  }
218
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
219
  jQuery(document).ready(function() {
220
  //console.log(colomatduration, colomatslideEffect);
221
  collapse_init();
@@ -250,6 +311,10 @@ jQuery(document).ready(function() {
250
  //deal with any scroll to links
251
  if(jQuery(this).hasClass('colomat-close') && jQuery(this).hasClass('scroll-to-trigger')){
252
  offset_top = jQuery('#scrollonclose-'+id).attr('name');
 
 
 
 
253
  }
254
 
255
  var id_arr = id.split('-');
@@ -269,6 +334,10 @@ jQuery(document).ready(function() {
269
  //deal with any scroll to links from the Title Trigger
270
  if(jQuery('#'+id).hasClass('scroll-to-trigger')){
271
  offset_top = jQuery('#scrollonclose-'+id).attr('name');
 
 
 
 
272
  }
273
 
274
  //toggle master trigger arrow
@@ -291,6 +360,10 @@ jQuery(document).ready(function() {
291
  //deal with any scroll to links from the Title Trigger
292
  if(jQuery('#'+id).hasClass('scroll-to-trigger')){
293
  offset_top = jQuery('#scrollonclose-'+id).attr('name');
 
 
 
 
294
  }
295
  }
296
  else{
@@ -320,235 +393,56 @@ jQuery(document).ready(function() {
320
  if(!jQuery(this).hasClass('colomat-close') && jQuery(this).hasClass('snap-shut')){
321
  jQuery('#target-'+id).hide();
322
  }
323
-
324
- //slideToggle
325
- else if(colomatslideEffect == 'slideToggle'){
326
- jQuery('#target-'+id).removeClass('maptastic');
327
- jQuery('#target-'+id).slideToggle(colomatduration, function() {
328
- // Animation complete.
329
- if( jQuery(this).hasClass('colomat-inline') && jQuery(this).is(':visible') ){
330
- jQuery(this).css('display', 'inline');
331
- }
332
-
333
- if( jQuery('#'+id).hasClass('find-me') && jQuery('#'+id).hasClass('colomat-close') ){
334
- offset_top = jQuery('#find-'+id).attr('name');
335
- if(!offset_top){
336
- target_offset = jQuery('#'+id).offset();
337
- offset_top = target_offset.top;
338
- }
339
- jQuery('html, body').animate({scrollTop:offset_top}, 500);
340
- }
341
- });
342
- }
343
- //slideFade
344
- else if(colomatslideEffect == 'slideFade'){
345
- jQuery('#target-'+id).removeClass('maptastic');
346
- jQuery('#target-'+id).animate({
347
- height: "toggle",
348
- opacity: "toggle"
349
- }, colomatduration, function() {
350
- // Animation complete.
351
- if( jQuery(this).hasClass('colomat-inline') && jQuery(this).is(':visible') ){
352
- jQuery(this).css('display', 'inline');
353
- }
354
-
355
- //deal with any findme links
356
- if( jQuery('#'+id).hasClass('find-me') && jQuery('#'+id).hasClass('colomat-close') ){
357
- offset_top = jQuery('#find-'+id).attr('name');
358
- if(!offset_top){
359
- target_offset = jQuery('#'+id).offset();
360
- offset_top = target_offset.top;
361
- }
362
- jQuery('html, body').animate({scrollTop:offset_top}, 500);
363
- }
364
- });
365
  }
366
 
367
- //deal with grouped items if needed
368
- if(jQuery(this).attr('rel') !== undefined){
369
- var rel = jQuery(this).attr('rel');
370
  if(rel.indexOf('-highlander') != '-1'){
371
  closeOtherMembers(rel, id);
372
  }
373
  else{
374
  closeOtherGroups(rel);
375
  }
376
- }
377
-
378
  if(offset_top){
379
  jQuery('html, body').animate({scrollTop:offset_top}, 500);
380
  }
381
-
382
- });
383
 
 
384
  jQuery(document).on('click', '.expandall', function(event) {
385
  if(jQuery(this).attr('rel') !== undefined){
386
  var rel = jQuery(this).attr('rel');
387
- jQuery('.collapseomatic[rel="' + rel +'"].collapseomatic:not(.colomat-close)').each(function(index) {
388
- jQuery(this).addClass('colomat-close');
389
- var thisid = jQuery(this).attr('id');
390
- jQuery('#parent-'+thisid).addClass('colomat-parent-highlight');
391
-
392
- if(jQuery("#swap-"+thisid).length > 0){
393
- swapTitle(this, "#swap-"+thisid);
394
- }
395
-
396
- if(jQuery("#swapexcerpt-"+thisid).length > 0){
397
- swapTitle("#excerpt-"+thisid, "#swapexcerpt-"+thisid);
398
- }
399
-
400
- //slideToggle
401
- if(colomatslideEffect == 'slideToggle'){
402
- jQuery('#target-'+thisid).slideToggle(colomatduration, function() {
403
- // Animation complete.
404
- if( jQuery(this).hasClass('colomat-inline') && jQuery(this).is(':visible') ){
405
- jQuery(this).css('display', 'inline');
406
- }
407
- });
408
- }
409
- //slideFade
410
- else if(colomatslideEffect == 'slideFade'){
411
- jQuery('#target-'+thisid).animate({
412
- height: "toggle",
413
- opacity: "toggle"
414
- }, colomatduration, function(){
415
- //Animation complete
416
- if( jQuery(this).hasClass('colomat-inline') && jQuery(this).is(':visible') ){
417
- jQuery(this).css('display', 'inline');
418
- }
419
- });
420
- }
421
- });
422
- }
423
  else{
424
- jQuery('.collapseomatic:not(.colomat-close)').each(function(index) {
425
- jQuery(this).addClass('colomat-close');
426
- var thisid = jQuery(this).attr('id');
427
- jQuery('#parent-'+thisid).addClass('colomat-parent-highlight');
428
-
429
- if(jQuery("#swap-"+thisid).length > 0){
430
- swapTitle(this, "#swap-"+thisid);
431
- }
432
-
433
- if(jQuery("#swapexcerpt-"+thisid).length > 0){
434
- swapTitle("#excerpt-"+thisid, "#swapexcerpt-"+thisid);
435
- }
436
-
437
- //slideToggle
438
- if(colomatslideEffect == 'slideToggle'){
439
- jQuery('#target-'+thisid).slideToggle(colomatduration, function() {
440
- // Animation complete.
441
- if( jQuery(this).hasClass('colomat-inline') && jQuery(this).is(':visible') ){
442
- jQuery(this).css('display', 'inline');
443
- }
444
- });
445
- }
446
- //slideFade
447
- else if(colomatslideEffect == 'slideFade'){
448
- jQuery('#target-'+thisid).animate({
449
- height: "toggle",
450
- opacity: "toggle"
451
- }, colomatduration, function(){
452
- //animation complete
453
- if( jQuery(this).hasClass('colomat-inline') && jQuery(this).is(':visible') ){
454
- jQuery(this).css('display', 'inline');
455
- }
456
- });
457
- }
458
- });
459
  }
460
- });
461
-
 
 
462
  jQuery(document).on('click', '.collapseall', function(event) {
463
  if(jQuery(this).attr('rel') !== undefined){
464
  var rel = jQuery(this).attr('rel');
465
- jQuery('.collapseomatic[rel="' + rel +'"].collapseomatic.colomat-close').each(function(index) {
466
- if(jQuery(this).hasClass('colomat-expand-only') && jQuery(this).hasClass('colomat-close')){
467
- return;
468
- }
469
-
470
- jQuery(this).removeClass('colomat-close');
471
- var thisid = jQuery(this).attr('id');
472
- jQuery('#parent-'+thisid).removeClass('colomat-parent-highlight');
473
-
474
- if(jQuery("#swap-"+thisid).length > 0){
475
- swapTitle(this, "#swap-"+thisid);
476
- }
477
-
478
- if(jQuery("#swapexcerpt-"+thisid).length > 0){
479
- swapTitle("#excerpt-"+thisid, "#swapexcerpt-"+thisid);
480
- }
481
-
482
- //slideToggle
483
- if(colomatslideEffect == 'slideToggle'){
484
- jQuery('#target-'+thisid).slideToggle(colomatduration, function() {
485
- // Animation complete
486
- if( jQuery(this).hasClass('colomat-inline') && jQuery(this).is(':visible') ){
487
- jQuery(this).css('display', 'inline');
488
- }
489
- });
490
- }
491
- //slideFade
492
- else if(colomatslideEffect == 'slideFade'){
493
- jQuery('#target-'+thisid).animate({
494
- height: "toggle",
495
- opacity: "toggle"
496
- }, colomatduration, function(){
497
- // Animation complete
498
- if( jQuery(this).hasClass('colomat-inline') && jQuery(this).is(':visible') ){
499
- jQuery(this).css('display', 'inline');
500
- }
501
- });
502
- }
503
- });
504
  }
505
- else{
506
- jQuery('.collapseomatic.colomat-close').each(function(index) {
507
- if(jQuery(this).hasClass('colomat-expand-only') && jQuery(this).hasClass('colomat-close')){
508
- return;
509
- }
510
- jQuery(this).removeClass('colomat-close');
511
- var thisid = jQuery(this).attr('id');
512
- jQuery('#parent-'+thisid).removeClass('colomat-parent-highlight');
513
-
514
- if(jQuery("#swap-"+thisid).length > 0){
515
- swapTitle(this, "#swap-"+thisid);
516
- }
517
-
518
- if(jQuery("#swapexcerpt-"+thisid).length > 0){
519
- swapTitle("#excerpt-"+thisid, "#swapexcerpt-"+thisid);
520
- }
521
-
522
- //slideToggle
523
- if(colomatslideEffect == 'slideToggle'){
524
- jQuery('#target-'+thisid).slideToggle(colomatduration, function() {
525
- // Animation complete.
526
- if( jQuery(this).hasClass('colomat-inline') && jQuery(this).is(':visible') ){
527
- jQuery(this).css('display', 'inline');
528
- }
529
- });
530
- }
531
- //slideFade
532
- else if(colomatslideEffect == 'slideFade'){
533
- jQuery('#target-'+thisid).animate({
534
- height: "toggle",
535
- opacity: "toggle"
536
- }, colomatduration, function(){
537
- // Animation complete
538
- if( jQuery(this).hasClass('colomat-inline') && jQuery(this).is(':visible') ){
539
- jQuery(this).css('display', 'inline');
540
- }
541
- });
542
- }
543
- });
544
  }
545
- });
 
 
546
 
547
  //handle new page loads with anchor
548
  var myFile = document.location.toString();
549
- if (myFile.match('#')) { // the URL contains an anchor
550
- // click the navigation item corresponding to the anchor
551
- var anchor_arr = myFile.split('#');
552
  if(anchor_arr.length > 1){
553
  junk = anchor_arr.splice(0, 1);
554
  anchor = anchor_arr.join('#');
@@ -564,7 +458,7 @@ jQuery(document).ready(function() {
564
  parent = parent_arr.join('-');
565
  jQuery('#' + parent).click();
566
  })
567
- }
568
 
569
  //handle anchor links within the same page
570
  jQuery(document).on('click', 'a.expandanchor', function(event) {
1
  /*!
2
+ * Collapse-O-Matic JavaSctipt v1.5.10
3
  * http://plugins.twinpictures.de/plugins/collapse-o-matic/
4
  *
5
+ * Copyright 2014, Twinpictures
6
  *
7
  * Permission is hereby granted, free of charge, to any person obtaining a copy
8
  * of this software and associated documentation files (the "Software"), to deal
61
  }
62
  }
63
 
64
+ function toggleState (obj, id, maptastic, trig_id) {
65
+ if (maptastic) {
66
+ jQuery('[id^=target][id$='+id+']').removeClass('maptastic');
67
+ }
68
+
69
+ //slideToggle
70
+ if(colomatslideEffect == 'slideToggle'){
71
+ jQuery('[id^=target][id$='+id+']').slideToggle(colomatduration, function() {
72
+ // Animation complete.
73
+ if( obj.hasClass('colomat-inline') && obj.is(':visible') ){
74
+ obj.css('display', 'inline');
75
+ }
76
+
77
+ //deal with any findme links
78
+ if(trig_id && jQuery('#'+trig_id).is('.find-me.colomat-close')){
79
+ offset_top = jQuery('#find-'+trig_id).attr('name');
80
+ if(!offset_top){
81
+ target_offset = jQuery('#'+trig_id).offset();
82
+ offset_top = target_offset.top;
83
+ }
84
+ jQuery('html, body').animate({scrollTop:offset_top}, 500);
85
+ }
86
+ });
87
+ }
88
+ //slideFade
89
+ else if(colomatslideEffect == 'slideFade'){
90
+ jQuery('[id^=target][id$='+id+']').animate({
91
+ height: "toggle",
92
+ opacity: "toggle"
93
+ }, colomatduration, function (){
94
+ //Animation complete
95
+ if( obj.hasClass('colomat-inline') && obj.is(':visible') ){
96
+ obj.css('display', 'inline');
97
+ }
98
+
99
+ //deal with any findme links
100
+ if(trig_id && jQuery('#'+trig_id).is('.find-me.colomat-close')){
101
+ offset_top = jQuery('#find-'+trig_id).attr('name');
102
+ if(!offset_top){
103
+ target_offset = jQuery('#'+trig_id).offset();
104
+ offset_top = target_offset.top;
105
+ }
106
+ jQuery('html, body').animate({scrollTop:offset_top}, 500);
107
+ }
108
+ });
109
+ }
110
+ }
111
+
112
  function closeOtherGroups(rel){
113
  jQuery('.collapseomatic[rel!="' + rel +'"]').each(function(index) {
114
  //add close class if open
130
  if(jQuery("#swapexcerpt-"+id).length > 0){
131
  swapTitle("#exerpt-"+id, "#swapexcerpt-"+id);
132
  }
133
+
134
+ toggleState (jQuery(this), id, false, false);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
135
 
136
  //check if there are nested children that need to be collapsed
137
  var ancestors = jQuery('.collapseomatic', '#target-'+id);
172
  if(!jQuery(this).hasClass('colomat-close') && jQuery(this).hasClass('snap-shut')){
173
  jQuery('#target-'+thisid).hide();
174
  }
175
+ else{
176
+ toggleState (jQuery(this), thisid, false, false);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
177
  }
178
 
179
  //check if there are nested children that need to be collapsed
198
  //deal with any scroll to links from the Title Trigger
199
  if(jQuery('#'+id).hasClass('scroll-to-trigger')){
200
  offset_top = jQuery('#scrollonclose-'+id).attr('name');
201
+ if (offset_top == 'auto') {
202
+ var target_offset = jQuery('#'+id).offset();
203
+ offset_top = target_offset.top;
204
+ }
205
  }
206
 
207
  //toggle master trigger arrow
229
  });
230
  }
231
 
232
+ function colomat_expandall(loop_items){
233
+ if (!loop_items){
234
+ loop_items = jQuery('.collapseomatic:not(.colomat-close)');
235
+ }
236
+ loop_items.each(function(index) {
237
+ jQuery(this).addClass('colomat-close');
238
+ var thisid = jQuery(this).attr('id');
239
+ jQuery('#parent-'+thisid).addClass('colomat-parent-highlight');
240
+
241
+ if(jQuery("#swap-"+thisid).length > 0){
242
+ swapTitle(this, "#swap-"+thisid);
243
+ }
244
+
245
+ if(jQuery("#swapexcerpt-"+thisid).length > 0){
246
+ swapTitle("#excerpt-"+thisid, "#swapexcerpt-"+thisid);
247
+ }
248
+
249
+ toggleState(jQuery(this), thisid, false, false);
250
+ });
251
+ }
252
+
253
+ function colomat_collapseall(loop_items){
254
+ if (!loop_items){
255
+ loop_items = jQuery('.collapseomatic.colomat-close');
256
+ }
257
+
258
+ loop_items.each(function(index) {
259
+ if(jQuery(this).hasClass('colomat-expand-only') && jQuery(this).hasClass('colomat-close')){
260
+ return;
261
+ }
262
+
263
+ jQuery(this).removeClass('colomat-close');
264
+ var thisid = jQuery(this).attr('id');
265
+ jQuery('#parent-'+thisid).removeClass('colomat-parent-highlight');
266
+
267
+ if(jQuery("#swap-"+thisid).length > 0){
268
+ swapTitle(this, "#swap-"+thisid);
269
+ }
270
+
271
+ if(jQuery("#swapexcerpt-"+thisid).length > 0){
272
+ swapTitle("#excerpt-"+thisid, "#swapexcerpt-"+thisid);
273
+ }
274
+
275
+ toggleState(jQuery(this), thisid, false, false);
276
+
277
+ });
278
+ }
279
+
280
  jQuery(document).ready(function() {
281
  //console.log(colomatduration, colomatslideEffect);
282
  collapse_init();
311
  //deal with any scroll to links
312
  if(jQuery(this).hasClass('colomat-close') && jQuery(this).hasClass('scroll-to-trigger')){
313
  offset_top = jQuery('#scrollonclose-'+id).attr('name');
314
+ if (offset_top == 'auto') {
315
+ var target_offset = jQuery('#'+id).offset();
316
+ offset_top = target_offset.top;
317
+ }
318
  }
319
 
320
  var id_arr = id.split('-');
334
  //deal with any scroll to links from the Title Trigger
335
  if(jQuery('#'+id).hasClass('scroll-to-trigger')){
336
  offset_top = jQuery('#scrollonclose-'+id).attr('name');
337
+ if (offset_top == 'auto') {
338
+ var target_offset = jQuery('#'+id).offset();
339
+ offset_top = target_offset.top;
340
+ }
341
  }
342
 
343
  //toggle master trigger arrow
360
  //deal with any scroll to links from the Title Trigger
361
  if(jQuery('#'+id).hasClass('scroll-to-trigger')){
362
  offset_top = jQuery('#scrollonclose-'+id).attr('name');
363
+ if (offset_top == 'auto') {
364
+ var target_offset = jQuery('#'+id).offset();
365
+ offset_top = target_offset.top;
366
+ }
367
  }
368
  }
369
  else{
393
  if(!jQuery(this).hasClass('colomat-close') && jQuery(this).hasClass('snap-shut')){
394
  jQuery('#target-'+id).hide();
395
  }
396
+ else{
397
+ toggleState (jQuery(this), id, true, id);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
398
  }
399
 
400
+ //deal with grouped items if needed
401
+ if(jQuery(this).attr('rel') !== undefined){
402
+ var rel = jQuery(this).attr('rel');
403
  if(rel.indexOf('-highlander') != '-1'){
404
  closeOtherMembers(rel, id);
405
  }
406
  else{
407
  closeOtherGroups(rel);
408
  }
409
+ }
410
+
411
  if(offset_top){
412
  jQuery('html, body').animate({scrollTop:offset_top}, 500);
413
  }
414
+ });
 
415
 
416
+
417
  jQuery(document).on('click', '.expandall', function(event) {
418
  if(jQuery(this).attr('rel') !== undefined){
419
  var rel = jQuery(this).attr('rel');
420
+ var loop_items = jQuery('.collapseomatic:not(.colomat-close)[rel="' + rel +'"]');
421
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
422
  else{
423
+ var loop_items = jQuery('.collapseomatic:not(.colomat-close)');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
424
  }
425
+
426
+ colomat_expandall(loop_items);
427
+ });
428
+
429
  jQuery(document).on('click', '.collapseall', function(event) {
430
  if(jQuery(this).attr('rel') !== undefined){
431
  var rel = jQuery(this).attr('rel');
432
+ var loop_items = jQuery('.collapseomatic.colomat-close[rel="' + rel +'"]');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
433
  }
434
+ else {
435
+ var loop_items = jQuery('.collapseomatic.colomat-close');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
436
  }
437
+
438
+ colomat_collapseall(loop_items);
439
+ });
440
 
441
  //handle new page loads with anchor
442
  var myFile = document.location.toString();
443
+ if (myFile.match('#')) { // the URL contains an anchor
444
+ // click the navigation item corresponding to the anchor
445
+ var anchor_arr = myFile.split('#');
446
  if(anchor_arr.length > 1){
447
  junk = anchor_arr.splice(0, 1);
448
  anchor = anchor_arr.join('#');
458
  parent = parent_arr.join('-');
459
  jQuery('#' + parent).click();
460
  })
461
+ }
462
 
463
  //handle anchor links within the same page
464
  jQuery(document).on('click', 'a.expandanchor', function(event) {
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: 3.5
7
- Tested up to: 3.9
8
- Stable tag: 1.5.8
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -50,6 +50,13 @@ No. Not even close.
50
 
51
  == Changelog ==
52
 
 
 
 
 
 
 
 
53
  = 1.5.8 =
54
  * load scripts only if shortcode is in use defaults to false - load all the time
55
  * added option to choose where all scripts will load: header or footer
@@ -234,6 +241,13 @@ Fixed auto-expand of urls with id-anchors
234
 
235
  == Upgrade Notice ==
236
 
 
 
 
 
 
 
 
237
  = 1.5.8 =
238
  * scripts always load by default
239
  * can choose if script loads in header or footer
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: 3.5
7
+ Tested up to: 3.9.1
8
+ Stable tag: 1.5.9
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
50
 
51
  == Changelog ==
52
 
53
+ = 1.5.9 =
54
+ * fixed issue with missing classes in dark style
55
+ * streamlined the collapse/expand function
56
+ * streamlined the collapseall/expandall functions
57
+ * added auto to scrollonclose attribute
58
+ * added new colomat_expandall and colomat_collpaseall functions that can be triggered externally
59
+
60
  = 1.5.8 =
61
  * load scripts only if shortcode is in use defaults to false - load all the time
62
  * added option to choose where all scripts will load: header or footer
241
 
242
  == Upgrade Notice ==
243
 
244
+ = 1.5.9 =
245
+ * fixed issue with missing classes in dark style
246
+ * streamlined the collapse/expand function
247
+ * streamlined the collapseall/expandall functions
248
+ * scrollonclose attribute now accepts auto as value
249
+ * added new colomat_expandall and colomat_collpaseall functions that can be triggered externally
250
+
251
  = 1.5.8 =
252
  * scripts always load by default
253
  * can choose if script loads in header or footer