Collapse-O-Matic - Version 1.3.4

Version Description

Download this release

Release Info

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

Code changes from version 1.3.2 to 1.3.4

collapse-o-matic.php CHANGED
@@ -3,7 +3,7 @@
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.2
7
  Author: Twinpictures
8
  Author URI: http://www.twinpictures.de
9
  License: GPL2
@@ -30,7 +30,7 @@ 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.1' );
34
  wp_enqueue_script('collapseomatic-js');
35
 
36
  //css
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.4
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.2.1' );
34
  wp_enqueue_script('collapseomatic-js');
35
 
36
  //css
collapse.js CHANGED
@@ -1,8 +1,8 @@
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
@@ -44,12 +44,18 @@ jQuery(document).ready(function() {
44
  //deal with grouped items if needed
45
  if(jQuery(this).attr('rel') !== undefined){
46
  var rel = jQuery(this).attr('rel');
47
- closeOthers(rel);
 
 
 
 
 
 
48
  }
49
 
50
  });
51
 
52
- function closeOthers(rel){
53
  jQuery('.collapseomatic[rel!="' + rel +'"]').each(function(index) {
54
  //add close class if open
55
  if(jQuery(this).hasClass('close') && jQuery(this).attr('rel') !== undefined){
@@ -62,6 +68,19 @@ jQuery(document).ready(function() {
62
  });
63
  }
64
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  var myFile = document.location.toString();
66
  if (myFile.match('#')) { // the URL contains an anchor
67
  // click the navigation item corresponding to the anchor
1
  /*!
2
+ * jQuery Collapse-O-Matic v1.2.1
3
  * http://www.twinpictures.de/collapse-o-matic/
4
  *
5
+ * Copyright 2011, 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
44
  //deal with grouped items if needed
45
  if(jQuery(this).attr('rel') !== undefined){
46
  var rel = jQuery(this).attr('rel');
47
+ if(rel.indexOf('-highlander') != '-1'){
48
+ closeOtherMembers(rel, id);
49
+ }
50
+ else{
51
+ closeOtherGroups(rel);
52
+ }
53
+
54
  }
55
 
56
  });
57
 
58
+ function closeOtherGroups(rel){
59
  jQuery('.collapseomatic[rel!="' + rel +'"]').each(function(index) {
60
  //add close class if open
61
  if(jQuery(this).hasClass('close') && jQuery(this).attr('rel') !== undefined){
68
  });
69
  }
70
 
71
+ function closeOtherMembers(rel, id){
72
+ jQuery('.collapseomatic[rel="' + rel +'"]').each(function(index) {
73
+ //add close class if open
74
+ if(jQuery(this).attr('id') != id && jQuery(this).hasClass('close') && jQuery(this).attr('rel') !== undefined){
75
+ jQuery(this).removeClass('close');
76
+ var thisid = jQuery(this).attr('id');
77
+ jQuery('#target-'+thisid).slideToggle('fast', function() {
78
+ // Animation complete.
79
+ });
80
+ }
81
+ });
82
+ }
83
+
84
  var myFile = document.location.toString();
85
  if (myFile.match('#')) { // the URL contains an anchor
86
  // click the navigation item corresponding to the anchor
readme.txt CHANGED
@@ -5,7 +5,7 @@ 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.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
 
@@ -39,11 +39,18 @@ No. Not even close.
39
 
40
  == Screenshots ==
41
 
42
- 1. screenshot-1.png Hmmm.. wonder what happens this text by that arrow is clicked?
43
- 2. screenshot-2.png Holy Crap! That other text just showed up like magic! Thank you Collapse-O-Matic!
44
 
45
  == Changelog ==
46
 
 
 
 
 
 
 
 
47
  = 1.3.1 =
48
  * Added the hover style to pimp the element style when moused over.
49
 
@@ -69,6 +76,9 @@ No. Not even close.
69
 
70
  == Upgrade Notice ==
71
 
 
 
 
72
  = 1.3.1 =
73
  Hover style added.
74
 
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.4
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
 
39
 
40
  == Screenshots ==
41
 
42
+ 1. Hmmm.. wonder what happens this text by that arrow is clicked?
43
+ 2. Holy Crap! That other text just showed up like magic! Thank you Collapse-O-Matic!
44
 
45
  == Changelog ==
46
 
47
+ = 1.3.3 =
48
+ * Added the ability to have only one member of a group expanded by ading '-member' to the rel attribute value.
49
+
50
+ = 1.3.2 =
51
+ * Added Expanded attribute that sets the default positon expanded open.
52
+ * Added style that moves arrows to the right of the text.
53
+
54
  = 1.3.1 =
55
  * Added the hover style to pimp the element style when moused over.
56
 
76
 
77
  == Upgrade Notice ==
78
 
79
+ = 1.3.2 =
80
+ Expanded attribute and right arrow style added.
81
+
82
  = 1.3.1 =
83
  Hover style added.
84
 
trunk/collapse-o-matic.php ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.4
7
+ Author: Twinpictures
8
+ Author URI: http://www.twinpictures.de
9
+ License: GPL2
10
+ */
11
+
12
+ /* Copyright 2011 Twinpictures (www.twinpictures.de)
13
+
14
+ This program is free software; you can redistribute it and/or modify
15
+ it under the terms of the GNU General Public License, version 2, as
16
+ published by the Free Software Foundation.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26
+ */
27
+
28
+ wp_enqueue_script('jquery');
29
+
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.2.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
+
41
+
42
+ function collapsTronic($atts, $content=null){
43
+ //find a random number, incase there is no id assigned
44
+ $ran = rand(1, 10000);
45
+
46
+ extract(shortcode_atts(array(
47
+ 'title' => '',
48
+ 'alt' => '',
49
+ 'id' => $ran,
50
+ 'tag' => 'span',
51
+ 'trigclass' => '',
52
+ 'targclass' => '',
53
+ 'rel' => '',
54
+ 'expanded' => '',
55
+ ), $atts));
56
+
57
+ $altatt = '';
58
+ if($alt){
59
+ $altatt = 'alt="'.$alt.'"';
60
+ }
61
+
62
+ $relatt = '';
63
+ if($rel){
64
+ $relatt = 'rel="'.$rel.'"';
65
+ }
66
+ $hstyle = 'style="display:none;"';
67
+ if($expanded){
68
+ $trigclass .= ' close';
69
+ $hstyle = '';
70
+ }
71
+ $link = '<'.$tag.' class="collapseomatic '.$trigclass.'" title="';
72
+ if($alt){
73
+ $link .= $alt;
74
+ }
75
+ else{
76
+ $link .= $title;
77
+ }
78
+ $link .= '" id="'.$id.'" '.$relatt.' '.$altatt.'>'.$title.'</'.$tag.'>';
79
+ $eDiv = '<div id="target-'.$id.'" '.$hstyle.' class="collapseomatic_content '.$targclass.'">'.do_shortcode($content).'</div>';
80
+ return $link . $eDiv;
81
+ }
82
+
83
+ add_shortcode('expand', 'collapsTronic');
84
+
85
+ //add the filter to the sidebar widgets
86
+ add_filter('widget_text', 'do_shortcode');
87
+ ?>
trunk/collapse.js ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * jQuery Collapse-O-Matic v1.2.1
3
+ * http://www.twinpictures.de/collapse-o-matic/
4
+ *
5
+ * Copyright 2011, 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').hover(function () {
29
+ jQuery(this).addClass("hover");
30
+ },
31
+ function () {
32
+ jQuery(this).removeClass("hover");
33
+ }
34
+ );
35
+
36
+ jQuery('.collapseomatic').click(function() {
37
+ //alert('phones ringin dude');
38
+ jQuery(this).toggleClass('close');
39
+ var id = jQuery(this).attr('id');
40
+ jQuery('#target-'+id).slideToggle('fast', function() {
41
+ // Animation complete.
42
+ });
43
+
44
+ //deal with grouped items if needed
45
+ if(jQuery(this).attr('rel') !== undefined){
46
+ var rel = jQuery(this).attr('rel');
47
+ if(rel.indexOf('-highlander') != '-1'){
48
+ closeOtherMembers(rel, id);
49
+ }
50
+ else{
51
+ closeOtherGroups(rel);
52
+ }
53
+
54
+ }
55
+
56
+ });
57
+
58
+ function closeOtherGroups(rel){
59
+ jQuery('.collapseomatic[rel!="' + rel +'"]').each(function(index) {
60
+ //add close class if open
61
+ if(jQuery(this).hasClass('close') && jQuery(this).attr('rel') !== undefined){
62
+ jQuery(this).removeClass('close');
63
+ var id = jQuery(this).attr('id');
64
+ jQuery('#target-'+id).slideToggle('fast', function() {
65
+ // Animation complete.
66
+ });
67
+ }
68
+ });
69
+ }
70
+
71
+ function closeOtherMembers(rel, id){
72
+ jQuery('.collapseomatic[rel="' + rel +'"]').each(function(index) {
73
+ //add close class if open
74
+ if(jQuery(this).attr('id') != id && jQuery(this).hasClass('close') && jQuery(this).attr('rel') !== undefined){
75
+ jQuery(this).removeClass('close');
76
+ var thisid = jQuery(this).attr('id');
77
+ jQuery('#target-'+thisid).slideToggle('fast', function() {
78
+ // Animation complete.
79
+ });
80
+ }
81
+ });
82
+ }
83
+
84
+ var myFile = document.location.toString();
85
+ if (myFile.match('#')) { // the URL contains an anchor
86
+ // click the navigation item corresponding to the anchor
87
+ var myAnchor = '#' + myFile.split('#')[1];
88
+ jQuery(myAnchor).click();
89
+ }
90
+ });
trunk/images/arrow-down.png ADDED
Binary file
trunk/images/arrow-up.png ADDED
Binary file
trunk/readme.txt ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === jQuery Collapse-O-Matic ===
2
+
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.4
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
+
18
+ 1. Old-school: upload the `collapse-o-matic` folder to the `/wp-content/plugins/` directory via FTP. Hipster: Ironically add collapse-o-matic via the WordPress Plugins menu.
19
+ 1. Activate the Plugin
20
+ 1. Add a the shortcode to your post like so: `[expand title=Displayed Title Goes Here]Hidden content goes here[/expand]`
21
+ 1. Test that the this plugin meets your demanding needs.
22
+ 1. Tweak the CSS to match your flavor.
23
+ 1. Rate the plugin and verify if it works at wordpress.org.
24
+ 1. Leave a comment regarding bugs, feature request, cocktail recipes at http://www.twinpictures.de/jquery-collapse-o-matic-1-3/
25
+
26
+ == Frequently Asked Questions ==
27
+
28
+ = I am a Social Netwookiee, do you have a Facebook page? =
29
+ Yes, yes... <a href='http://www.facebook.com/twinpictures'>Twinpictures is on Facebook</a>.
30
+
31
+ = Does Twinpictures do the Twiter? =
32
+ Ah yes! <a href='twitter.com/switzerbaden'>@SwitzerBaden at Twitter</a> does the tweeting around here.
33
+
34
+ = How does one use the shortcode, exactly? =
35
+ 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.
36
+
37
+ = Is Galato the same as Ice Cream? =
38
+ No. Not even close.
39
+
40
+ == Screenshots ==
41
+
42
+ 1. Hmmm.. wonder what happens this text by that arrow is clicked?
43
+ 2. Holy Crap! That other text just showed up like magic! Thank you Collapse-O-Matic!
44
+
45
+ == Changelog ==
46
+
47
+ = 1.3.4 =
48
+ * Changed '-member' to '-highlander' because it sounds better.
49
+
50
+ = 1.3.3 =
51
+ * Added the ability to have only one member of a group expanded by ading '-member' to the rel attribute value.
52
+
53
+ = 1.3.2 =
54
+ * Added Expanded attribute that sets the default positon expanded open.
55
+ * Added style that moves arrows to the right of the text.
56
+
57
+ = 1.3.1 =
58
+ * Added the hover style to pimp the element style when moused over.
59
+
60
+ = 1.3 =
61
+ * Added the rel attribute to deal with grouping collpase elements.
62
+ * Added the trigclass and targclass attributes.
63
+ * Added the alt attribute to define the title's hover-over text.
64
+
65
+ = 1.2 =
66
+ * Expanded the shortcode to include an optional tag attribute. The system defaults to wrapping the trigger in a span tag.
67
+ * Style will support various element tags... span, div, h1, h2... etc.
68
+ * Style seperates the arrow icons, so there is no background bleed-over on extra-long trigger titles.
69
+
70
+ = 1.1 =
71
+ * Optimized Code
72
+ * Shortcode now works in Sidebar
73
+ * Expand Titles now have title tags that match the title, not just some random number
74
+ * Shorcode can include a user-defined ID instead of a generated random number
75
+ * Added auto expand feature if an anchor tag is used in the URL
76
+
77
+ = 1.0 =
78
+ * The plugin came to be.
79
+
80
+ == Upgrade Notice ==
81
+
82
+ = 1.3.4 =
83
+ Changed highlander grouping trigger from -member to -highlander.
84
+
85
+ = 1.3.3 =
86
+ Added highlander grouping... called it -member.
87
+
88
+ = 1.3.2 =
89
+ Expanded attribute and right arrow style added.
90
+
91
+ = 1.3.1 =
92
+ Hover style added.
93
+
94
+ = 1.3 =
95
+ Collapse-O-Matic has been significantly advanced. Elements can now be grouped together.
96
+
97
+ = 1.2 =
98
+ 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]`.
99
+
100
+ = 1.1 =
101
+ Shortcode now works in sidebars. Shorcode must be written as `[expand title="title goes here" id="optional-id-goes-here"]content goes here[/expand]`.
102
+
103
+ = 1.0 =
104
+ Where once there was not, there now is.
trunk/screenshot-1.png ADDED
Binary file
trunk/screenshot-2.png ADDED
Binary file
trunk/style.css ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .collapseomatic {
2
+ background-image: url(images/arrow-down.png) !important;
3
+ background-repeat: no-repeat;
4
+ padding: 0 0 10px 16px;
5
+ cursor: pointer;
6
+ }
7
+ .arrowright {
8
+ background-position: top right;
9
+ padding: 0 16px 10px 0;
10
+ }
11
+ .hover {
12
+ text-decoration: underline;
13
+ }
14
+ .close {
15
+ background-image: url(images/arrow-up.png) !important;
16
+ }
17
+ .collapseomatic_content {
18
+ margin-top: 3px;
19
+ margin-left: 16px;
20
+ padding-bottom: 1px;
21
+ }