Collapse-O-Matic - Version 1.3

Version Description

  • Added the rel attribute to deal with grouping collpase elements.
  • Added the trigclass and targclass attributes.
  • Added the alt attribute to define the title's hover-over text.
Download this release

Release Info

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

Code changes from version 1.2 to 1.3

Files changed (3) hide show
  1. collapse-o-matic.php +28 -8
  2. collapse.js +47 -1
  3. readme.txt +14 -11
collapse-o-matic.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /*
3
  Plugin Name: jQuery Collapse-O-Matic
4
- Plugin URI: http://www.twinpictures.de/collapse/
5
- Description: Collapseable Objects using jQuery.
6
- Version: 1.2
7
  Author: Twinpictures
8
  Author URI: http://www.twinpictures.de
9
  License: GPL2
@@ -30,11 +30,11 @@ wp_enqueue_script('jquery');
30
  $plugin_url = trailingslashit( get_bloginfo('wpurl') ).PLUGINDIR.'/'. dirname( plugin_basename(__FILE__) );
31
  if (!is_admin()){
32
  //collapse script
33
- wp_register_script('collapseomatic-js', $plugin_url.'/collapse.js', array ('jquery'), '1.0' );
34
  wp_enqueue_script('collapseomatic-js');
35
 
36
  //css
37
- wp_register_style( 'collapseomatic-css', $plugin_url.'/style.css', array (), '1.0' );
38
  wp_enqueue_style( 'collapseomatic-css' );
39
  }
40
 
@@ -45,12 +45,32 @@ function collapsTronic($atts, $content=null){
45
 
46
  extract(shortcode_atts(array(
47
  'title' => '',
 
48
  'id' => $ran,
49
  'tag' => 'span',
 
 
 
50
  ), $atts));
51
-
52
- $link = "<".$tag." class=\"collapseomatic\" title=\"".$title."\" id=\"".$id."\">".$title."</".$tag.">";
53
- $eDiv = "<div id=\"target-".$id."\" style=\"display:none;\" class=\"collapseomatic_content\">".do_shortcode($content)."</div>";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  return $link . $eDiv;
55
  }
56
 
1
  <?php
2
  /*
3
  Plugin Name: jQuery Collapse-O-Matic
4
+ Plugin URI: http://www.twinpictures.de/jquery-collapse-o-matic-1-3/
5
+ Description: Collapse-O-Matic adds an `[expand]` shortcode that wraps content into a lovely, jQuery collapsible div.
6
+ Version: 1.3
7
  Author: Twinpictures
8
  Author URI: http://www.twinpictures.de
9
  License: GPL2
30
  $plugin_url = trailingslashit( get_bloginfo('wpurl') ).PLUGINDIR.'/'. dirname( plugin_basename(__FILE__) );
31
  if (!is_admin()){
32
  //collapse script
33
+ wp_register_script('collapseomatic-js', $plugin_url.'/collapse.js', array ('jquery'), '1.1' );
34
  wp_enqueue_script('collapseomatic-js');
35
 
36
  //css
37
+ wp_register_style( 'collapseomatic-css', $plugin_url.'/style.css', array (), '1.1' );
38
  wp_enqueue_style( 'collapseomatic-css' );
39
  }
40
 
45
 
46
  extract(shortcode_atts(array(
47
  'title' => '',
48
+ 'alt' => '',
49
  'id' => $ran,
50
  'tag' => 'span',
51
+ 'trigclass' => '',
52
+ 'targclass' => '',
53
+ 'rel' => ''
54
  ), $atts));
55
+
56
+ $altatt = '';
57
+ if($alt){
58
+ $altatt = 'alt="'.$alt.'"';
59
+ }
60
+
61
+ $relatt = '';
62
+ if($rel){
63
+ $relatt = 'rel="'.$rel.'"';
64
+ }
65
+ $link = '<'.$tag.' class="collapseomatic '.$trigclass.'" title="';
66
+ if($alt){
67
+ $link .= $alt;
68
+ }
69
+ else{
70
+ $link .= $title;
71
+ }
72
+ $link .= '" id="'.$id.'" '.$relatt.' '.$altatt.'>'.$title.'</'.$tag.'>';
73
+ $eDiv = '<div id="target-'.$id.'" style="display:none;" class="collapseomatic_content '.$targclass.'">'.do_shortcode($content).'</div>';
74
  return $link . $eDiv;
75
  }
76
 
collapse.js CHANGED
@@ -1,3 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  jQuery(document).ready(function() {
2
  jQuery('.collapseomatic').click(function() {
3
  //alert('phones ringin dude');
@@ -6,8 +32,28 @@ jQuery(document).ready(function() {
6
  jQuery('#target-'+id).slideToggle('fast', function() {
7
  // Animation complete.
8
  });
9
- });
10
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  var myFile = document.location.toString();
12
  if (myFile.match('#')) { // the URL contains an anchor
13
  // click the navigation item corresponding to the anchor
1
+ /*!
2
+ * jQuery Collapse-O-Matic v1.1
3
+ * http://www.twinpictures.de/collapse-o-matic/
4
+ *
5
+ * Copyright 2010, 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
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, blend, trade,
11
+ * bake, hack, scramble, difiburlate, digest and/or sell copies of the Software,
12
+ * and to permit persons to whom the Software is furnished to do so, subject to
13
+ * the following conditions:
14
+ *
15
+ * The above copyright notice and this permission notice shall be included in
16
+ * all copies or substantial portions of the Software.
17
+ *
18
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
+ * THE SOFTWARE.
25
+ */
26
+
27
  jQuery(document).ready(function() {
28
  jQuery('.collapseomatic').click(function() {
29
  //alert('phones ringin dude');
32
  jQuery('#target-'+id).slideToggle('fast', function() {
33
  // Animation complete.
34
  });
 
35
 
36
+ //deal with grouped items if needed
37
+ if(jQuery(this).attr('rel') !== undefined){
38
+ var rel = jQuery(this).attr('rel');
39
+ closeOthers(rel);
40
+ }
41
+
42
+ });
43
+
44
+ function closeOthers(rel){
45
+ jQuery('.collapseomatic[rel!="' + rel +'"]').each(function(index) {
46
+ //add close class if open
47
+ if(jQuery(this).hasClass('close') && jQuery(this).attr('rel') !== undefined){
48
+ jQuery(this).removeClass('close');
49
+ var id = jQuery(this).attr('id');
50
+ jQuery('#target-'+id).slideToggle('fast', function() {
51
+ // Animation complete.
52
+ });
53
+ }
54
+ });
55
+ }
56
+
57
  var myFile = document.location.toString();
58
  if (myFile.match('#')) { // the URL contains an anchor
59
  // click the navigation item corresponding to the anchor
readme.txt CHANGED
@@ -3,15 +3,15 @@
3
  Contributors: Twinpictures, DrLebowski
4
  Donate link: http://www.twinpictures.de/collapse-o-matic/
5
  Tags: collapse, expand, collapsible, expandable, content, shortcode, hidden, jQuery, javascript, twinpictures
6
- Requires at least: 2.7
7
- Tested up to: 3.0.2
8
- Stable tag: 1.2
9
 
10
  Collapse-O-Matic adds an `[expand]` shortcode that wraps any object or content--including other shortcodes--into a lovely jQuery collapsible div.
11
 
12
  == Description ==
13
 
14
- Collapse-O-Matic adds an `[expand title="title" id="optional-id" tag="optional-span"]content[/expand]` shortcode that will wrap any content, including other shortcodes, into a lovely jQuery collapsible div. This plugin is a more advanced version of--and inspired by--DrLebowski's Collapsing Objects.
15
 
16
  == Installation ==
17
 
@@ -25,13 +25,8 @@ Collapse-O-Matic adds an `[expand title="title" id="optional-id" tag="optional-s
25
 
26
  == Frequently Asked Questions ==
27
 
28
- = How dose one use the shortcode, exactly? =
29
- [expand title="title goes here" id="optional-id-goes-here" tag="optional-html-tag-goes-here"]this is where content, including other shortcodes, goes.[/expand]
30
-
31
- = Can one of the expands auto-expand based on an anchor tag in the url? =
32
- Yes, just do this:
33
- * Give the expand a specific id in the short code: [expand title="title goes here" id="monkey"]this is where content, including other shortcodes, goes.[/expand]
34
- * Use the id as and anchor in the URL: http://www.twinpictures.de/your-page/#monkey
35
 
36
  = Is Galato the same as Ice Cream? =
37
  No. Not even close.
@@ -43,6 +38,11 @@ No. Not even close.
43
 
44
  == Changelog ==
45
 
 
 
 
 
 
46
  = 1.2 =
47
  * Expanded the shortcode to include an optional tag attribute. The system defaults to wrapping the trigger in a span tag.
48
  * Style will support various element tags... span, div, h1, h2... etc.
@@ -60,6 +60,9 @@ No. Not even close.
60
 
61
  == Upgrade Notice ==
62
 
 
 
 
63
  = 1.2 =
64
  Style has been updated for ultimate flexibility. Shorcode can now be written as `[expand title="title goes here" id="optional-id-goes-here" tag="optional-html-tag-goes-here"]content goes here[/expand]`.
65
 
3
  Contributors: Twinpictures, DrLebowski
4
  Donate link: http://www.twinpictures.de/collapse-o-matic/
5
  Tags: collapse, expand, collapsible, expandable, content, shortcode, hidden, jQuery, javascript, twinpictures
6
+ Requires at least: 2.8
7
+ Tested up to: 3.1
8
+ Stable tag: 1.3
9
 
10
  Collapse-O-Matic adds an `[expand]` shortcode that wraps any object or content--including other shortcodes--into a lovely jQuery collapsible div.
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 collapsible div. A <a href='http://www.twinpictures.de/jquery-collapse-o-matic-1-3/'>complete listing of shortcode options</a> and attribute demos are available. This plugin was inspired by DrLebowski's Collapsing Objects.
15
 
16
  == Installation ==
17
 
25
 
26
  == Frequently Asked Questions ==
27
 
28
+ = How does one use the shortcode, exactly? =
29
+ A <a href='http://www.twinpictures.de/jquery-collapse-o-matic-1-3/'>complete listing of shortcode options</a> has been provided to answer this exact question.
 
 
 
 
 
30
 
31
  = Is Galato the same as Ice Cream? =
32
  No. Not even close.
38
 
39
  == Changelog ==
40
 
41
+ = 1.3 =
42
+ * Added the rel attribute to deal with grouping collpase elements.
43
+ * Added the trigclass and targclass attributes.
44
+ * Added the alt attribute to define the title's hover-over text.
45
+
46
  = 1.2 =
47
  * Expanded the shortcode to include an optional tag attribute. The system defaults to wrapping the trigger in a span tag.
48
  * Style will support various element tags... span, div, h1, h2... etc.
60
 
61
  == Upgrade Notice ==
62
 
63
+ = 1.3 =
64
+ Collapse-O-Matic has been significantly advanced. Elements can now be grouped together.
65
+
66
  = 1.2 =
67
  Style has been updated for ultimate flexibility. Shorcode can now be written as `[expand title="title goes here" id="optional-id-goes-here" tag="optional-html-tag-goes-here"]content goes here[/expand]`.
68