Collapse-O-Matic - Version 1.1

Version Description

  • Optimized Code
  • Shortcode now works in Sidebar
  • Expand Titles now have title tags that match the title, not just some random number
  • Shorcode can include a user-defined ID instead of a generated random number
  • Added auto expand feature if an anchor tag is used in the URL
Download this release

Release Info

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

Version 1.1

collapse-o-matic.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.1
7
+ Author: Twinpictures
8
+ Author URI: http://www.twinpictures.de
9
+ License: GPL2
10
+ */
11
+
12
+ /* Copyright 2010 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.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
+
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
+ 'id' => $ran,
49
+ ), $atts));
50
+
51
+ $link = "<span class=\"collapseomatic\" title=\"".$title."\" id=\"".$id."\">".$title."</span>";
52
+ $eDiv = "<div id=\"target-".$id."\" style=\"display:none;\" class=\"collapseomatic_content\">".do_shortcode($content)."</div>";
53
+ return $link . $eDiv;
54
+ }
55
+
56
+ add_shortcode('expand', 'collapsTronic');
57
+
58
+ //add the filter to the sidebar widgets
59
+ add_filter('widget_text', 'do_shortcode');
60
+ ?>
collapse.js ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function() {
2
+ jQuery('.collapseomatic').click(function() {
3
+ //alert('phones ringin dude');
4
+ jQuery(this).toggleClass('close');
5
+ var id = jQuery(this).attr('id');
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
14
+ var myAnchor = '#' + myFile.split('#')[1];
15
+ jQuery(myAnchor).click();
16
+ }
17
+ });
images/collapse-arrows.png ADDED
Binary file
readme.txt ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.7
7
+ Tested up to: 3.0.2
8
+ Stable tag: 1.1
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="id"]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
+
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. Tweek 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/collapse-o-matic/
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"]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
+ 1. 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
+ 1. 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.
38
+
39
+ == Screenshots ==
40
+
41
+ 1. screenshot-1.png Hmmm.. wonder what happens this text by that arrow is clicked?
42
+ 2. screenshot-2.png Holy Crap! That other text just showed up like magic! Thank you Collapse-O-Matic!
43
+
44
+ == Changelog ==
45
+
46
+ = 1.1 =
47
+ * Optimized Code
48
+ * Shortcode now works in Sidebar
49
+ * Expand Titles now have title tags that match the title, not just some random number
50
+ * Shorcode can include a user-defined ID instead of a generated random number
51
+ * Added auto expand feature if an anchor tag is used in the URL
52
+
53
+ = 1.0 =
54
+ * The plugin came to be.
55
+
56
+ == Upgrade Notice ==
57
+
58
+ = 1.1 =
59
+ Shortcode now works in sidebars. Shorcode must be written as `[expand title="title goes here" id="optional-id-goes-here"]content goes here[/expand]`.
60
+
61
+ = 1.0 =
62
+ Where once there was not, there now is.
screenshot-1.png ADDED
Binary file
screenshot-2.png ADDED
Binary file
style.css ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ span.collapseomatic {
2
+ background-image:url(images/collapse-arrows.png) !important;
3
+ background-repeat:no-repeat;
4
+ padding: 0 0 10px 16px;
5
+ cursor: pointer;
6
+ }
7
+ span.close {
8
+ background-position: 0 -33px !important;
9
+ }
10
+ .collapseomatic_content {
11
+ display: none;
12
+ margin-top: 3px;
13
+ margin-left: 16px;
14
+ }