Collapse-O-Matic - Version 1.4.8

Version Description

  • Click events now use jQuery's on() event handler for content that arrived dynamically via AJAX
  • added notitle attribute if no title should be displayed
  • added startwrap and enwrap attributes for wrapping titles
  • fixed bug when using nested close links and highlander grouping
  • added expandanchor to expand items from anchor links on the same page
  • added colomat-expand-only class to prevent collapse from trigger text
  • added scrollonclose attribute and scroll-to-trigger class to trigger auto-scroll to specific value on close.
Download this release

Release Info

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

Code changes from version 1.4.7 to 1.4.8

Files changed (5) hide show
  1. collapse-o-matic.php +23 -16
  2. collapse.js +93 -25
  3. collapse.min.js +1 -1
  4. readme.txt +21 -3
  5. style.css +7 -2
collapse-o-matic.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: jQuery Collapse-O-Matic
4
  Plugin URI: http://plugins.twinpictures.de/plugins/collapse-o-matic/
5
  Description: Collapse-O-Matic adds an [expand] shortcode that wraps content into a lovely, jQuery collapsible div.
6
- Version: 1.4.7
7
  Author: twinpictures, baden03
8
  Author URI: http://twinpictures.de/
9
  License: GPL2
@@ -28,24 +28,23 @@ License: GPL2
28
 
29
  function collapsTronicInit() {
30
  wp_enqueue_script('jquery');
31
-
32
- $plugin_url = trailingslashit( get_bloginfo('wpurl') ).PLUGINDIR.'/'. dirname( plugin_basename(__FILE__) );
33
  if (!is_admin()){
34
  //collapse script
35
- wp_register_script('collapseomatic-js', $plugin_url.'/collapse.min.js', array ('jquery'), '1.3.5' );
 
36
  wp_enqueue_script('collapseomatic-js');
37
 
38
  //css
39
- wp_register_style( 'collapseomatic-css', $plugin_url.'/style.css', array (), '1.5.1' );
40
  wp_enqueue_style( 'collapseomatic-css' );
41
  }
42
-
43
  add_shortcode('expand', 'collapsTronic');
44
 
45
  for ($i=1; $i<30; $i++) {
46
  add_shortcode('expandsub'.$i, 'collapsTronic');
47
  }
48
-
49
  //add the filter to the sidebar widgets
50
  add_filter('widget_text', 'do_shortcode');
51
  }
@@ -59,6 +58,7 @@ function collapsTronic($atts, $content = null){
59
  'title' => '',
60
  'swaptitle' => '',
61
  'alt' => '',
 
62
  'id' => 'id'.$ran,
63
  'tag' => 'span',
64
  'trigclass' => '',
@@ -71,8 +71,10 @@ function collapsTronic($atts, $content = null){
71
  'excerpttag' => 'div',
72
  'excerptclass' => '',
73
  'findme' => '',
 
 
 
74
  ), $atts));
75
-
76
  if($excerpt){
77
  if($excerptpos == 'above-trigger'){
78
  $nibble = '<'.$excerpttag.' class="'.$excerptclass.'">'.$excerpt.'</'.$excerpttag.'>';
@@ -86,7 +88,7 @@ function collapsTronic($atts, $content = null){
86
  if($alt){
87
  $altatt = 'alt="'.$alt.'" title="'.$alt.'"';
88
  }
89
- else{
90
  $altatt = 'title="'.$title.'"';
91
  }
92
  $relatt = '';
@@ -103,16 +105,23 @@ function collapsTronic($atts, $content = null){
103
  if($findme != 'true' && $findme != 'auto'){
104
  $offset = $findme;
105
  }
106
- $anchor = "<a id='find-".$id."' name='".$offset."'></a>\n";
 
 
 
 
 
107
  }
108
- $link = "<".$tag." class='collapseomatic ".$trigclass."' id='".$id."' ".$relatt." ".$altatt.">".$title."</".$tag.">".$anchor."\n";
109
  if($swaptitle){
110
- $link .= "<".$tag." id='swap-".$id."' style='display:none;'>".$swaptitle."</".$tag.">\n";
111
  }
 
112
  $eDiv = '';
113
  if($content){
114
- $eDiv = "<div id='target-".$id."' class='collapseomatic_content ".$targclass."'>".do_shortcode($content)."</div>\n";
115
  }
 
116
  if($excerpt){
117
  if($excerptpos == 'above-trigger'){
118
  if($trigpos == 'below'){
@@ -147,9 +156,7 @@ function collapsTronic($atts, $content = null){
147
  $retStr = $link.$eDiv;
148
  }
149
  }
 
150
  return $retStr;
151
  }
152
-
153
- //add the filter to the sidebar widgets
154
- add_filter('widget_text', 'do_shortcode');
155
  ?>
3
  Plugin Name: jQuery Collapse-O-Matic
4
  Plugin URI: http://plugins.twinpictures.de/plugins/collapse-o-matic/
5
  Description: Collapse-O-Matic adds an [expand] shortcode that wraps content into a lovely, jQuery collapsible div.
6
+ Version: 1.4.8
7
  Author: twinpictures, baden03
8
  Author URI: http://twinpictures.de/
9
  License: GPL2
28
 
29
  function collapsTronicInit() {
30
  wp_enqueue_script('jquery');
 
 
31
  if (!is_admin()){
32
  //collapse script
33
+ wp_register_script('collapseomatic-js', plugins_url('/collapse.min.js', __FILE__), array('jquery'), '1.4.8');
34
+ //wp_register_script('collapseomatic-js', plugins_url('/collapse.js', __FILE__), array('jquery'), '1.4.8');
35
  wp_enqueue_script('collapseomatic-js');
36
 
37
  //css
38
+ wp_register_style( 'collapseomatic-css', plugins_url('/style.css', __FILE__) , array (), '1.5.2' );
39
  wp_enqueue_style( 'collapseomatic-css' );
40
  }
41
+
42
  add_shortcode('expand', 'collapsTronic');
43
 
44
  for ($i=1; $i<30; $i++) {
45
  add_shortcode('expandsub'.$i, 'collapsTronic');
46
  }
47
+
48
  //add the filter to the sidebar widgets
49
  add_filter('widget_text', 'do_shortcode');
50
  }
58
  'title' => '',
59
  'swaptitle' => '',
60
  'alt' => '',
61
+ 'notitle' => '',
62
  'id' => 'id'.$ran,
63
  'tag' => 'span',
64
  'trigclass' => '',
71
  'excerpttag' => 'div',
72
  'excerptclass' => '',
73
  'findme' => '',
74
+ 'scrollonclose' => '',
75
+ 'startwrap' => '',
76
+ 'endwrap' => ''
77
  ), $atts));
 
78
  if($excerpt){
79
  if($excerptpos == 'above-trigger'){
80
  $nibble = '<'.$excerpttag.' class="'.$excerptclass.'">'.$excerpt.'</'.$excerpttag.'>';
88
  if($alt){
89
  $altatt = 'alt="'.$alt.'" title="'.$alt.'"';
90
  }
91
+ else if( !$notitle ){
92
  $altatt = 'title="'.$title.'"';
93
  }
94
  $relatt = '';
105
  if($findme != 'true' && $findme != 'auto'){
106
  $offset = $findme;
107
  }
108
+ $anchor = '<a id="find-'.$id.'" name="'.$offset.'"> </a>';
109
+ }
110
+ $closeanchor = '';
111
+ if($scrollonclose && (is_numeric($scrollonclose) || $scrollonclose == 0)){
112
+ $trigclass .= ' scroll-to-trigger';
113
+ $closeanchor = '<a id="scrollonclose-'.$id.'" name="'.$scrollonclose.'"> </a>';
114
  }
115
+ $link = $closeanchor.$anchor.'<'.$tag.' class="collapseomatic '.$trigclass.'" id="'.$id.'" '.$relatt.' '.$altatt.'>'.$startwrap.$title.$endwrap.'</'.$tag.'>';
116
  if($swaptitle){
117
+ $link .= "<".$tag." id='swap-".$id."' style='display:none;'>".$startwrap.$swaptitle.$endwrap."</".$tag.">";
118
  }
119
+
120
  $eDiv = '';
121
  if($content){
122
+ $eDiv = '<div id="target-'.$id.'" class="collapseomatic_content '.$targclass.'">'.do_shortcode($content).'</div>';
123
  }
124
+
125
  if($excerpt){
126
  if($excerptpos == 'above-trigger'){
127
  if($trigpos == 'below'){
156
  $retStr = $link.$eDiv;
157
  }
158
  }
159
+ //return '<span class="removeomatic">'.$retStr.'</span>';
160
  return $retStr;
161
  }
 
 
 
162
  ?>
collapse.js CHANGED
@@ -1,5 +1,5 @@
1
  /*!
2
- * jQuery Collapse-O-Matic v1.4.7
3
  * http://plugins.twinpictures.de/plugins/collapse-o-matic/
4
  *
5
  * Copyright 2012, Twinpictures
@@ -26,9 +26,8 @@
26
 
27
  //expand/collapse speed
28
  var duration = 'fast';
 
29
  jQuery(document).ready(function() {
30
- //slide only (slideToggle) or slide and fade (slideFade)
31
- var slideEffect = 'slideFade';
32
 
33
  //force collapse
34
  jQuery('.force_content_collapse').each(function(index) {
@@ -58,13 +57,13 @@ jQuery(document).ready(function() {
58
  jQuery('#find-'+thisid).attr('name', target_top_offset);
59
  }
60
  });
61
-
62
  //Display the collapse wrapper... use to reverse the show-all on no JavaScript degredation.
63
  jQuery('.content_collapse_wrapper').each(function(index) {
64
  jQuery(this).css('display', 'inline');
65
  });
66
 
67
- jQuery('.collapseomatic').hover(function () {
68
  jQuery(this).addClass("colomat-hover");
69
  },
70
  function () {
@@ -73,12 +72,28 @@ jQuery(document).ready(function() {
73
  );
74
 
75
 
76
- jQuery('.collapseomatic').click(function() {
 
 
77
  //alert('phones ringin dude');
 
 
 
78
  var id = jQuery(this).attr('id');
 
 
 
 
 
 
79
  if(id.indexOf('bot-') != '-1'){
80
  id = id.substr(4);
81
  jQuery('#'+id).toggleClass('colomat-close');
 
 
 
 
 
82
  }
83
  else{
84
  jQuery(this).toggleClass('colomat-close');
@@ -99,6 +114,7 @@ jQuery(document).ready(function() {
99
  }
100
  //slideFade
101
  else if(slideEffect == 'slideFade'){
 
102
  jQuery('#target-'+id).animate({
103
  height: "toggle",
104
  opacity: "toggle"
@@ -115,6 +131,10 @@ jQuery(document).ready(function() {
115
  closeOtherGroups(rel);
116
  }
117
  }
 
 
 
 
118
  });
119
 
120
  function swapTitle(obj, id){
@@ -133,7 +153,7 @@ jQuery(document).ready(function() {
133
  function closeOtherGroups(rel){
134
  jQuery('.collapseomatic[rel!="' + rel +'"]').each(function(index) {
135
  //add close class if open
136
- if(jQuery(this).hasClass('colomat-close') && jQuery(this).attr('rel') !== undefined){
137
  jQuery(this).removeClass('colomat-close');
138
  var id = jQuery(this).attr('id');
139
 
@@ -197,28 +217,21 @@ jQuery(document).ready(function() {
197
  //check if there are nested children that need to be collapsed
198
  var ancestors = jQuery('.collapseomatic', '#target-'+id);
199
  ancestors.each(function(index) {
200
- jQuery(this).removeClass('colomat-close');
201
- var thisid = jQuery(this).attr('id');
202
- //check if the title needs to be swapped out
203
- if(jQuery("#swap-"+thisid).length > 0){
204
- swapTitle(this, thisid);
 
 
 
205
  }
206
- jQuery('#target-'+thisid).css('display', 'none');
207
  })
208
  }
209
  });
210
  }
211
 
212
- var myFile = document.location.toString();
213
- if (myFile.match('#')) { // the URL contains an anchor
214
- // click the navigation item corresponding to the anchor
215
- var anchor_arr = myFile.split('#');
216
- if(anchor_arr.length > 1 && anchor_arr[1] != '#'){
217
- jQuery('#' + anchor_arr[1]).click();
218
- }
219
- }
220
-
221
- jQuery('.expandall').click(function() {
222
  if(jQuery(this).attr('rel') !== undefined){
223
  var rel = jQuery(this).attr('rel');
224
  jQuery('.collapseomatic[rel="' + rel +'"].collapseomatic:not(.colomat-close)').each(function(index) {
@@ -270,7 +283,7 @@ jQuery(document).ready(function() {
270
  }
271
  });
272
 
273
- jQuery('.collapseall').click(function() {
274
  if(jQuery(this).attr('rel') !== undefined){
275
  var rel = jQuery(this).attr('rel');
276
  jQuery('.collapseomatic[rel="' + rel +'"].collapseomatic.colomat-close').each(function(index) {
@@ -323,10 +336,65 @@ jQuery(document).ready(function() {
323
  });
324
 
325
  //do we have a find me?
326
- jQuery('.find-me').click(function() {
327
  //get the top offset of the target anchor
328
  var thisid = jQuery(this).attr('id');
329
  var offset_top = jQuery('#find-'+thisid).attr('name');
330
  jQuery('html, body').animate({scrollTop:offset_top}, 500);
 
331
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
332
  });
1
  /*!
2
+ * jQuery Collapse-O-Matic v1.4.8
3
  * http://plugins.twinpictures.de/plugins/collapse-o-matic/
4
  *
5
  * Copyright 2012, Twinpictures
26
 
27
  //expand/collapse speed
28
  var duration = 'fast';
29
+ var slideEffect = 'slideFade';
30
  jQuery(document).ready(function() {
 
 
31
 
32
  //force collapse
33
  jQuery('.force_content_collapse').each(function(index) {
57
  jQuery('#find-'+thisid).attr('name', target_top_offset);
58
  }
59
  });
60
+
61
  //Display the collapse wrapper... use to reverse the show-all on no JavaScript degredation.
62
  jQuery('.content_collapse_wrapper').each(function(index) {
63
  jQuery(this).css('display', 'inline');
64
  });
65
 
66
+ jQuery('.collapseomatic').on("hover", function(event){
67
  jQuery(this).addClass("colomat-hover");
68
  },
69
  function () {
72
  );
73
 
74
 
75
+ jQuery('.collapseomatic').on("click", function(event){
76
+ var offest_top;
77
+
78
  //alert('phones ringin dude');
79
+ if(jQuery(this).hasClass('colomat-expand-only') && jQuery(this).hasClass('colomat-close')){
80
+ return;
81
+ }
82
  var id = jQuery(this).attr('id');
83
+
84
+ //deal with any scroll to links
85
+ if(jQuery(this).hasClass('colomat-close') && jQuery(this).hasClass('scroll-to-trigger')){
86
+ var offset_top = jQuery('#scrollonclose-'+id).attr('name');
87
+ }
88
+
89
  if(id.indexOf('bot-') != '-1'){
90
  id = id.substr(4);
91
  jQuery('#'+id).toggleClass('colomat-close');
92
+
93
+ //deal with any scroll to links
94
+ if(jQuery(this).hasClass('scroll-to-trigger')){
95
+ var offset_top = jQuery('#scrollonclose-'+id).attr('name');
96
+ }
97
  }
98
  else{
99
  jQuery(this).toggleClass('colomat-close');
114
  }
115
  //slideFade
116
  else if(slideEffect == 'slideFade'){
117
+ jQuery('#target-'+id).removeClass('maptastic');
118
  jQuery('#target-'+id).animate({
119
  height: "toggle",
120
  opacity: "toggle"
131
  closeOtherGroups(rel);
132
  }
133
  }
134
+
135
+ if(offset_top){
136
+ jQuery('html, body').animate({scrollTop:offset_top}, 500);
137
+ }
138
  });
139
 
140
  function swapTitle(obj, id){
153
  function closeOtherGroups(rel){
154
  jQuery('.collapseomatic[rel!="' + rel +'"]').each(function(index) {
155
  //add close class if open
156
+ if(jQuery(this).hasClass('colomat-close') && jQuery(this).attr('rel') !== undefined){
157
  jQuery(this).removeClass('colomat-close');
158
  var id = jQuery(this).attr('id');
159
 
217
  //check if there are nested children that need to be collapsed
218
  var ancestors = jQuery('.collapseomatic', '#target-'+id);
219
  ancestors.each(function(index) {
220
+ if(jQuery(this).attr('id').indexOf('bot-') == '-1'){
221
+ jQuery(this).removeClass('colomat-close');
222
+ var thisid = jQuery(this).attr('id');
223
+ //check if the title needs to be swapped out
224
+ if(jQuery("#swap-"+thisid).length > 0){
225
+ swapTitle(this, thisid);
226
+ }
227
+ jQuery('#target-'+thisid).css('display', 'none');
228
  }
 
229
  })
230
  }
231
  });
232
  }
233
 
234
+ jQuery('.expandall').on("click", function(event){
 
 
 
 
 
 
 
 
 
235
  if(jQuery(this).attr('rel') !== undefined){
236
  var rel = jQuery(this).attr('rel');
237
  jQuery('.collapseomatic[rel="' + rel +'"].collapseomatic:not(.colomat-close)').each(function(index) {
283
  }
284
  });
285
 
286
+ jQuery('.collapseall').on("click", function(event){
287
  if(jQuery(this).attr('rel') !== undefined){
288
  var rel = jQuery(this).attr('rel');
289
  jQuery('.collapseomatic[rel="' + rel +'"].collapseomatic.colomat-close').each(function(index) {
336
  });
337
 
338
  //do we have a find me?
339
+ jQuery('.find-me').on("click", function(event){
340
  //get the top offset of the target anchor
341
  var thisid = jQuery(this).attr('id');
342
  var offset_top = jQuery('#find-'+thisid).attr('name');
343
  jQuery('html, body').animate({scrollTop:offset_top}, 500);
344
+ //console.log(offset_top);
345
  });
346
+
347
+ //handle new page loads with anchor
348
+ var myFile = document.location.toString();
349
+ if (myFile.match('#')) { // the URL contains an anchor
350
+ // click the navigation item corresponding to the anchor
351
+ var anchor_arr = myFile.split('#');
352
+ if(anchor_arr.length > 1){
353
+ junk = anchor_arr.splice(0, 1);
354
+ anchor = anchor_arr.join('#');
355
+ }
356
+ else{
357
+ anchor = anchor_arr[0];
358
+ }
359
+ jQuery('#' + anchor).click();
360
+ //expand any nested parents
361
+ jQuery('#' + anchor).parents('.collapseomatic_content').each(function(index) {
362
+ parent_arr = jQuery(this).attr('id').split('-');
363
+ junk = parent_arr.splice(0, 1);
364
+ parent = parent_arr.join('-');
365
+ jQuery('#' + parent).click();
366
+ })
367
+ }
368
+
369
+ //handle anchor links within the same page
370
+ jQuery('a.expandanchor').on("click", function(event){
371
+ event.preventDefault();
372
+ var fullurl = jQuery(this).attr('href');
373
+ if (fullurl.match('#')) { // the URL contains an anchor
374
+ // click the navigation item corresponding to the anchor
375
+ var anchor_arr = fullurl.split('#');
376
+ if(anchor_arr.length > 1){
377
+ junk = anchor_arr.splice(0, 1);
378
+ anchor = anchor_arr.join('#');
379
+ }
380
+ else{
381
+ anchor = anchor_arr[0];
382
+ }
383
+ if(!jQuery('#' + anchor).hasClass('colomat-close')){
384
+ jQuery('#' + anchor).click();
385
+ }
386
+
387
+ //expand any nested parents
388
+ jQuery('#' + anchor).parents('.collapseomatic_content').each(function(index) {
389
+ parent_arr = jQuery(this).attr('id').split('-');
390
+ junk = parent_arr.splice(0, 1);
391
+ parent = parent_arr.join('-');
392
+ if(!jQuery('#' + parent).hasClass('colomat-close')){
393
+ jQuery('#' + parent).click();
394
+ }
395
+
396
+ })
397
+ }
398
+ });
399
+
400
  });
collapse.min.js CHANGED
@@ -1 +1 @@
1
- var duration='fast';jQuery(document).ready(function(){var slideEffect='slideFade';jQuery('.force_content_collapse').each(function(index){jQuery(this).css('display','none')});jQuery('.collapseomatic:not(.colomat-close)').each(function(index){var thisid=jQuery(this).attr('id');jQuery('#target-'+thisid).css('display','none')});jQuery('.collapseomatic.colomat-close').each(function(index){var thisid=jQuery(this).attr('id');if(jQuery("#swap-"+thisid).length>0){swapTitle(this,thisid)}});jQuery('.find-me').each(function(index){var thisid=jQuery(this).attr('id');if(!jQuery('#find-'+thisid).attr('name')){var target_offset=jQuery(this).offset();var target_top_offset=target_offset.top;jQuery('#find-'+thisid).attr('name',target_top_offset)}});jQuery('.content_collapse_wrapper').each(function(index){jQuery(this).css('display','inline')});jQuery('.collapseomatic').hover(function(){jQuery(this).addClass("colomat-hover")},function(){jQuery(this).removeClass("colomat-hover")});jQuery('.collapseomatic').click(function(){var id=jQuery(this).attr('id');if(id.indexOf('bot-')!='-1'){id=id.substr(4);jQuery('#'+id).toggleClass('colomat-close')}else{jQuery(this).toggleClass('colomat-close')}if(jQuery("#swap-"+id).length>0){swapTitle(this,id)}jQuery(this).addClass('colomat-visited');if(slideEffect=='slideToggle'){jQuery('#target-'+id).slideToggle(durration,function(){})}else if(slideEffect=='slideFade'){jQuery('#target-'+id).animate({height:"toggle",opacity:"toggle"},duration)}if(jQuery(this).attr('rel')!==undefined){var rel=jQuery(this).attr('rel');if(rel.indexOf('-highlander')!='-1'){closeOtherMembers(rel,id)}else{closeOtherGroups(rel)}}});function swapTitle(obj,id){var orightml=jQuery(obj).html();var swaphtml=jQuery("#swap-"+id).html();jQuery(obj).html(swaphtml);jQuery("#swap-"+id).html(orightml);if(swaphtml.indexOf("<cufon")!=-1){var trigelem=jQuery(this).get(0).tagName;Cufon.replace(trigelem)}}function closeOtherGroups(rel){jQuery('.collapseomatic[rel!="'+rel+'"]').each(function(index){if(jQuery(this).hasClass('colomat-close')&&jQuery(this).attr('rel')!==undefined){jQuery(this).removeClass('colomat-close');var id=jQuery(this).attr('id');if(jQuery("#swap-"+id).length>0){swapTitle(this,id)}if(slideEffect=='slideToggle'){jQuery('#target-'+id).slideToggle(durration,function(){})}else if(slideEffect=='slideFade'){jQuery('#target-'+id).animate({height:"toggle",opacity:"toggle"},duration)}var ancestors=jQuery('.collapseomatic','#target-'+id);ancestors.each(function(index){jQuery(this).removeClass('colomat-close');var thisid=jQuery(this).attr('id');jQuery('#target-'+thisid).css('display','none')})}})}function closeOtherMembers(rel,id){jQuery('.collapseomatic[rel="'+rel+'"]').each(function(index){if(jQuery(this).attr('id')!=id&&jQuery(this).hasClass('colomat-close')&&jQuery(this).attr('rel')!==undefined){jQuery(this).removeClass('colomat-close');var thisid=jQuery(this).attr('id');if(jQuery("#swap-"+thisid).length>0){swapTitle(this,thisid)}if(slideEffect=='slideToggle'){jQuery('#target-'+thisid).slideToggle(durration,function(){})}else if(slideEffect=='slideFade'){jQuery('#target-'+thisid).animate({height:"toggle",opacity:"toggle"},duration)}var ancestors=jQuery('.collapseomatic','#target-'+id);ancestors.each(function(index){jQuery(this).removeClass('colomat-close');var thisid=jQuery(this).attr('id');if(jQuery("#swap-"+thisid).length>0){swapTitle(this,thisid)}jQuery('#target-'+thisid).css('display','none')})}})}var myFile=document.location.toString();if(myFile.match('#')){var anchor_arr=myFile.split('#');if(anchor_arr.length>1&&anchor_arr[1]!='#'){jQuery('#'+anchor_arr[1]).click()}}jQuery('.expandall').click(function(){if(jQuery(this).attr('rel')!==undefined){var rel=jQuery(this).attr('rel');jQuery('.collapseomatic[rel="'+rel+'"].collapseomatic:not(.colomat-close)').each(function(index){jQuery(this).addClass('colomat-close');var thisid=jQuery(this).attr('id');if(jQuery("#swap-"+thisid).length>0){swapTitle(this,thisid)}if(slideEffect=='slideToggle'){jQuery('#target-'+thisid).slideToggle(durration,function(){})}else if(slideEffect=='slideFade'){jQuery('#target-'+thisid).animate({height:"toggle",opacity:"toggle"},duration)}})}else{jQuery('.collapseomatic:not(.colomat-close)').each(function(index){jQuery(this).addClass('colomat-close');var thisid=jQuery(this).attr('id');if(jQuery("#swap-"+thisid).length>0){swapTitle(this,thisid)}if(slideEffect=='slideToggle'){jQuery('#target-'+thisid).slideToggle(durration,function(){})}else if(slideEffect=='slideFade'){jQuery('#target-'+thisid).animate({height:"toggle",opacity:"toggle"},duration)}})}});jQuery('.collapseall').click(function(){if(jQuery(this).attr('rel')!==undefined){var rel=jQuery(this).attr('rel');jQuery('.collapseomatic[rel="'+rel+'"].collapseomatic.colomat-close').each(function(index){jQuery(this).removeClass('colomat-close');var thisid=jQuery(this).attr('id');if(jQuery("#swap-"+thisid).length>0){swapTitle(this,thisid)}if(slideEffect=='slideToggle'){jQuery('#target-'+thisid).slideToggle(durration,function(){})}else if(slideEffect=='slideFade'){jQuery('#target-'+thisid).animate({height:"toggle",opacity:"toggle"},duration)}})}else{jQuery('.collapseomatic.colomat-close').each(function(index){jQuery(this).removeClass('colomat-close');var thisid=jQuery(this).attr('id');if(jQuery("#swap-"+thisid).length>0){swapTitle(this,thisid)}if(slideEffect=='slideToggle'){jQuery('#target-'+thisid).slideToggle(durration,function(){})}else if(slideEffect=='slideFade'){jQuery('#target-'+thisid).animate({height:"toggle",opacity:"toggle"},duration)}})}});jQuery('.find-me').click(function(){var thisid=jQuery(this).attr('id');var offset_top=jQuery('#find-'+thisid).attr('name');jQuery('html, body').animate({scrollTop:offset_top},500)})});
1
+ var duration='fast';var slideEffect='slideFade';jQuery(document).ready(function(){jQuery('.force_content_collapse').each(function(index){jQuery(this).css('display','none')});jQuery('.collapseomatic:not(.colomat-close)').each(function(index){var thisid=jQuery(this).attr('id');jQuery('#target-'+thisid).css('display','none')});jQuery('.collapseomatic.colomat-close').each(function(index){var thisid=jQuery(this).attr('id');if(jQuery("#swap-"+thisid).length>0){swapTitle(this,thisid)}});jQuery('.find-me').each(function(index){var thisid=jQuery(this).attr('id');if(!jQuery('#find-'+thisid).attr('name')){var target_offset=jQuery(this).offset();var target_top_offset=target_offset.top;jQuery('#find-'+thisid).attr('name',target_top_offset)}});jQuery('.content_collapse_wrapper').each(function(index){jQuery(this).css('display','inline')});jQuery('.collapseomatic').on("hover",function(event){jQuery(this).addClass("colomat-hover")},function(){jQuery(this).removeClass("colomat-hover")});jQuery('.collapseomatic').on("click",function(event){var offest_top;if(jQuery(this).hasClass('colomat-expand-only')&&jQuery(this).hasClass('colomat-close')){return}var id=jQuery(this).attr('id');if(jQuery(this).hasClass('colomat-close')&&jQuery(this).hasClass('scroll-to-trigger')){var offset_top=jQuery('#scrollonclose-'+id).attr('name')}if(id.indexOf('bot-')!='-1'){id=id.substr(4);jQuery('#'+id).toggleClass('colomat-close');if(jQuery(this).hasClass('scroll-to-trigger')){var offset_top=jQuery('#scrollonclose-'+id).attr('name')}}else{jQuery(this).toggleClass('colomat-close')}if(jQuery("#swap-"+id).length>0){swapTitle(this,id)}jQuery(this).addClass('colomat-visited');if(slideEffect=='slideToggle'){jQuery('#target-'+id).slideToggle(durration,function(){})}else if(slideEffect=='slideFade'){jQuery('#target-'+id).removeClass('maptastic');jQuery('#target-'+id).animate({height:"toggle",opacity:"toggle"},duration)}if(jQuery(this).attr('rel')!==undefined){var rel=jQuery(this).attr('rel');if(rel.indexOf('-highlander')!='-1'){closeOtherMembers(rel,id)}else{closeOtherGroups(rel)}}if(offset_top){jQuery('html, body').animate({scrollTop:offset_top},500)}});function swapTitle(obj,id){var orightml=jQuery(obj).html();var swaphtml=jQuery("#swap-"+id).html();jQuery(obj).html(swaphtml);jQuery("#swap-"+id).html(orightml);if(swaphtml.indexOf("<cufon")!=-1){var trigelem=jQuery(this).get(0).tagName;Cufon.replace(trigelem)}}function closeOtherGroups(rel){jQuery('.collapseomatic[rel!="'+rel+'"]').each(function(index){if(jQuery(this).hasClass('colomat-close')&&jQuery(this).attr('rel')!==undefined){jQuery(this).removeClass('colomat-close');var id=jQuery(this).attr('id');if(jQuery("#swap-"+id).length>0){swapTitle(this,id)}if(slideEffect=='slideToggle'){jQuery('#target-'+id).slideToggle(durration,function(){})}else if(slideEffect=='slideFade'){jQuery('#target-'+id).animate({height:"toggle",opacity:"toggle"},duration)}var ancestors=jQuery('.collapseomatic','#target-'+id);ancestors.each(function(index){jQuery(this).removeClass('colomat-close');var thisid=jQuery(this).attr('id');jQuery('#target-'+thisid).css('display','none')})}})}function closeOtherMembers(rel,id){jQuery('.collapseomatic[rel="'+rel+'"]').each(function(index){if(jQuery(this).attr('id')!=id&&jQuery(this).hasClass('colomat-close')&&jQuery(this).attr('rel')!==undefined){jQuery(this).removeClass('colomat-close');var thisid=jQuery(this).attr('id');if(jQuery("#swap-"+thisid).length>0){swapTitle(this,thisid)}if(slideEffect=='slideToggle'){jQuery('#target-'+thisid).slideToggle(durration,function(){})}else if(slideEffect=='slideFade'){jQuery('#target-'+thisid).animate({height:"toggle",opacity:"toggle"},duration)}var ancestors=jQuery('.collapseomatic','#target-'+id);ancestors.each(function(index){if(jQuery(this).attr('id').indexOf('bot-')=='-1'){jQuery(this).removeClass('colomat-close');var thisid=jQuery(this).attr('id');if(jQuery("#swap-"+thisid).length>0){swapTitle(this,thisid)}jQuery('#target-'+thisid).css('display','none')}})}})}jQuery('.expandall').on("click",function(event){if(jQuery(this).attr('rel')!==undefined){var rel=jQuery(this).attr('rel');jQuery('.collapseomatic[rel="'+rel+'"].collapseomatic:not(.colomat-close)').each(function(index){jQuery(this).addClass('colomat-close');var thisid=jQuery(this).attr('id');if(jQuery("#swap-"+thisid).length>0){swapTitle(this,thisid)}if(slideEffect=='slideToggle'){jQuery('#target-'+thisid).slideToggle(durration,function(){})}else if(slideEffect=='slideFade'){jQuery('#target-'+thisid).animate({height:"toggle",opacity:"toggle"},duration)}})}else{jQuery('.collapseomatic:not(.colomat-close)').each(function(index){jQuery(this).addClass('colomat-close');var thisid=jQuery(this).attr('id');if(jQuery("#swap-"+thisid).length>0){swapTitle(this,thisid)}if(slideEffect=='slideToggle'){jQuery('#target-'+thisid).slideToggle(durration,function(){})}else if(slideEffect=='slideFade'){jQuery('#target-'+thisid).animate({height:"toggle",opacity:"toggle"},duration)}})}});jQuery('.collapseall').on("click",function(event){if(jQuery(this).attr('rel')!==undefined){var rel=jQuery(this).attr('rel');jQuery('.collapseomatic[rel="'+rel+'"].collapseomatic.colomat-close').each(function(index){jQuery(this).removeClass('colomat-close');var thisid=jQuery(this).attr('id');if(jQuery("#swap-"+thisid).length>0){swapTitle(this,thisid)}if(slideEffect=='slideToggle'){jQuery('#target-'+thisid).slideToggle(durration,function(){})}else if(slideEffect=='slideFade'){jQuery('#target-'+thisid).animate({height:"toggle",opacity:"toggle"},duration)}})}else{jQuery('.collapseomatic.colomat-close').each(function(index){jQuery(this).removeClass('colomat-close');var thisid=jQuery(this).attr('id');if(jQuery("#swap-"+thisid).length>0){swapTitle(this,thisid)}if(slideEffect=='slideToggle'){jQuery('#target-'+thisid).slideToggle(durration,function(){})}else if(slideEffect=='slideFade'){jQuery('#target-'+thisid).animate({height:"toggle",opacity:"toggle"},duration)}})}});jQuery('.find-me').on("click",function(event){var thisid=jQuery(this).attr('id');var offset_top=jQuery('#find-'+thisid).attr('name');jQuery('html, body').animate({scrollTop:offset_top},500)});var myFile=document.location.toString();if(myFile.match('#')){var anchor_arr=myFile.split('#');if(anchor_arr.length>1){junk=anchor_arr.splice(0,1);anchor=anchor_arr.join('#')}else{anchor=anchor_arr[0]}jQuery('#'+anchor).click();jQuery('#'+anchor).parents('.collapseomatic_content').each(function(index){parent_arr=jQuery(this).attr('id').split('-');junk=parent_arr.splice(0,1);parent=parent_arr.join('-');jQuery('#'+parent).click()})}jQuery('a.expandanchor').on("click",function(event){event.preventDefault();var fullurl=jQuery(this).attr('href');if(fullurl.match('#')){var anchor_arr=fullurl.split('#');if(anchor_arr.length>1){junk=anchor_arr.splice(0,1);anchor=anchor_arr.join('#')}else{anchor=anchor_arr[0]}if(!jQuery('#'+anchor).hasClass('colomat-close')){jQuery('#'+anchor).click()}jQuery('#'+anchor).parents('.collapseomatic_content').each(function(index){parent_arr=jQuery(this).attr('id').split('-');junk=parent_arr.splice(0,1);parent=parent_arr.join('-');if(!jQuery('#'+parent).hasClass('colomat-close')){jQuery('#'+parent).click()}})}})});
readme.txt CHANGED
@@ -5,13 +5,13 @@ 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
6
  Requires at least: 2.8
7
  Tested up to: 3.4.1
8
- Stable tag: 1.4.7
9
 
10
  Remove clutter, save space: display and hide additional content in a SEO friendly way by wrapping content in an [expand] shortcode.
11
 
12
  == Description ==
13
 
14
- Collapse-O-Matic adds an `[expand title="trigger text"]hidden content[/expand]` shortcode that will wrap any content, including other shortcodes, into a lovely jQuery expanding and collapsing div. A <a href='http://plugins.twinpictures.de/plugins/collapse-o-matic/documentation/'>complete listing of shortcode options and attribute demos</a> are available, as well as <a href='http://wordpress.org/support/plugin/jquery-collapse-o-matic'>free community</a> and <a href='http://plugins.twinpictures.de/plugins/collapse-o-matic/support/'>premium support</a>. This plug-in was originally inspired by DrLebowski's Collapsing Objects.
15
 
16
  == Installation ==
17
 
@@ -44,6 +44,15 @@ No. Not even close.
44
 
45
  == Changelog ==
46
 
 
 
 
 
 
 
 
 
 
47
  = 1.4.7 =
48
  Fixed auto-expand of urls with id-anchors
49
 
@@ -157,11 +166,20 @@ Fixed auto-expand of urls with id-anchors
157
 
158
  == Upgrade Notice ==
159
 
 
 
 
 
 
 
 
 
 
160
  = 1.4.7 =
161
  * Fixed auto-expand of urls with id-anchors
162
 
163
  = 1.4.6 =
164
- * Fixed JS bug in 1.4.5 - Sorry people.
165
 
166
  = 1.4.5 =
167
  * Added SlideFade/SlideToggle option and visited trigers now have colomat-visited class
5
  Tags: collapse, expand, collapsible, expandable, expandable content, collapsable content, shortcode, hidden, hide, display, accordion, accordion, jQuery, javascript, roll-your-own, twinpictures
6
  Requires at least: 2.8
7
  Tested up to: 3.4.1
8
+ Stable tag: 1.4.8
9
 
10
  Remove clutter, save space: display and hide additional content in a SEO friendly way by wrapping content in an [expand] shortcode.
11
 
12
  == Description ==
13
 
14
+ Collapse-O-Matic adds an `[expand title="trigger text"]hidden content[/expand]` shortcode that will wrap any content, including other shortcodes, into a lovely jQuery expanding and collapsing div. A <a href='http://plugins.twinpictures.de/plugins/collapse-o-matic/documentation/'>complete listing of shortcode options and attribute demos</a> are available, as well as <a href='http://wordpress.org/support/plugin/jquery-collapse-o-matic'>free community</a> and <a href='http://plugins.twinpictures.de/plugins/collapse-o-matic/support/'>premium support</a>.
15
 
16
  == Installation ==
17
 
44
 
45
  == Changelog ==
46
 
47
+ = 1.4.8 =
48
+ * Click events now use jQuery's on() event handler for content that arrived dynamically via AJAX
49
+ * added notitle attribute if no title should be displayed
50
+ * added startwrap and enwrap attributes for wrapping titles
51
+ * fixed bug when using nested close links and highlander grouping
52
+ * added expandanchor to expand items from anchor links on the same page
53
+ * added colomat-expand-only class to prevent collapse from trigger text
54
+ * added scrollonclose attribute and scroll-to-trigger class to trigger auto-scroll to specific value on close.
55
+
56
  = 1.4.7 =
57
  Fixed auto-expand of urls with id-anchors
58
 
166
 
167
  == Upgrade Notice ==
168
 
169
+ = 1.4.8 =
170
+ * on() event handler for dynamic content
171
+ * added notitle attribute
172
+ * added title wrapping
173
+ * fixed a few obscure bugs
174
+ * added expandanchor class
175
+ * added colomat-expand-only class
176
+ * added scrollonclose attribute and scroll-to-trigger class
177
+
178
  = 1.4.7 =
179
  * Fixed auto-expand of urls with id-anchors
180
 
181
  = 1.4.6 =
182
+ * Fixed JS bug in 1.4.5 - Sorry people
183
 
184
  = 1.4.5 =
185
  * Added SlideFade/SlideToggle option and visited trigers now have colomat-visited class
style.css CHANGED
@@ -24,12 +24,17 @@
24
  margin-left: 16px;
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
  }
24
  margin-left: 16px;
25
  padding: 0px;
26
  }
27
+ .content_collapse_wrapper, collapseomatic_content {
28
+ position: absolute; left: -999em;
29
  }
30
  .collapseall, .expandall {
31
  cursor: pointer;
32
  }
33
  .collapseall:hover, .expandall:hover {
34
  text-decoration: underline;
35
+ }
36
+ .maptastic {
37
+ position: absolute !important;
38
+ left: -10000px !important;
39
+ display:block !important;
40
  }