Version Description
- added catch-all callback for jetpacks infinite-scroll
- fix: XSS Vulnerability
Download this release
Release Info
Developer | baden03 |
Plugin | Collapse-O-Matic |
Version | 1.6.9 |
Comparing to | |
See all releases |
Code changes from version 1.6.8 to 1.6.9
- collapse-o-matic.php +82 -89
- js/collapse.js +76 -70
- readme.txt +8 -212
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.6.
|
9 |
Author: twinpictures, baden03
|
10 |
Author URI: http://twinpictures.de/
|
11 |
License: GPL2
|
@@ -30,14 +30,14 @@ class WP_Collapse_O_Matic {
|
|
30 |
* Current version
|
31 |
* @var string
|
32 |
*/
|
33 |
-
var $version = '1.6.
|
34 |
|
35 |
/**
|
36 |
* Used as prefix for options entry
|
37 |
* @var string
|
38 |
*/
|
39 |
var $domain = 'colomat';
|
40 |
-
|
41 |
/**
|
42 |
* Name of the options
|
43 |
* @var string
|
@@ -64,11 +64,11 @@ class WP_Collapse_O_Matic {
|
|
64 |
'cc_email' => '',
|
65 |
'filter_content' => '',
|
66 |
);
|
67 |
-
|
68 |
var $license_group = 'colomat_licenseing';
|
69 |
-
|
70 |
var $license_name = 'WP_Collapse_O_Matic_license';
|
71 |
-
|
72 |
var $license_options = array(
|
73 |
'collapse_commander_license_key' => '',
|
74 |
'collapse_commander_license_status' => ''
|
@@ -80,13 +80,13 @@ class WP_Collapse_O_Matic {
|
|
80 |
function __construct() {
|
81 |
// set option values
|
82 |
$this->_set_options();
|
83 |
-
|
84 |
// load text domain for translations
|
85 |
load_plugin_textdomain( 'colomat', FALSE, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
|
86 |
-
|
87 |
//load the script and style if viewing the front-end
|
88 |
add_action('wp_enqueue_scripts', array( $this, 'collapsTronicInit' ) );
|
89 |
-
|
90 |
// add actions
|
91 |
add_action( 'admin_menu', array( $this, 'admin_menu' ) );
|
92 |
add_action( 'plugin_action_links_' . plugin_basename(__FILE__), array( $this, 'plugin_actions' ) );
|
@@ -98,13 +98,13 @@ class WP_Collapse_O_Matic {
|
|
98 |
add_action('wp_head', array( $this, 'colomat_js_vars' ) );
|
99 |
}
|
100 |
add_shortcode('expand', array($this, 'shortcode'));
|
101 |
-
|
102 |
//add expandsub shortcodes
|
103 |
for ($i=1; $i<30; $i++) {
|
104 |
add_shortcode('expandsub'.$i, array($this, 'shortcode'));
|
105 |
}
|
106 |
-
|
107 |
-
// Add shortcode support for widgets
|
108 |
add_filter('widget_text', 'do_shortcode');
|
109 |
}
|
110 |
|
@@ -120,21 +120,21 @@ class WP_Collapse_O_Matic {
|
|
120 |
echo "\n</style>\n";
|
121 |
}
|
122 |
}
|
123 |
-
|
124 |
/**
|
125 |
* Callback init
|
126 |
*/
|
127 |
-
function collapsTronicInit() {
|
128 |
//collapse script
|
129 |
$load_in_footer = false;
|
130 |
if($this->options['script_location'] == 'footer' ){
|
131 |
$load_in_footer = true;
|
132 |
}
|
133 |
-
wp_register_script('collapseomatic-js', plugins_url('js/collapse.js', __FILE__), array('jquery'), '1.5.
|
134 |
if( empty($this->options['script_check']) ){
|
135 |
wp_enqueue_script('collapseomatic-js');
|
136 |
}
|
137 |
-
|
138 |
//css
|
139 |
wp_register_style( 'collapseomatic-css', plugins_url('/'.$this->options['style'].'_style.css', __FILE__) , array (), '1.6' );
|
140 |
wp_enqueue_style( 'collapseomatic-css' );
|
@@ -158,7 +158,7 @@ class WP_Collapse_O_Matic {
|
|
158 |
register_setting( $this->domain, $this->options_name );
|
159 |
register_setting( $this->license_group, $this->license_name, array($this, 'edd_sanitize_license') );
|
160 |
}
|
161 |
-
|
162 |
/**
|
163 |
* Callback shortcode
|
164 |
*/
|
@@ -209,7 +209,7 @@ class WP_Collapse_O_Matic {
|
|
209 |
while ( $query_commander->have_posts() ) {
|
210 |
$query_commander->the_post();
|
211 |
$title = get_the_title();
|
212 |
-
|
213 |
//meta values
|
214 |
$meta_values = get_post_meta( $cid );
|
215 |
foreach($meta_values as $key => $value){
|
@@ -223,40 +223,33 @@ class WP_Collapse_O_Matic {
|
|
223 |
if(!empty($highlander) && !empty($rel)){
|
224 |
$rel .= '-highlander';
|
225 |
}
|
226 |
-
|
227 |
//content
|
228 |
-
|
229 |
-
if(empty($filter) || $filter == 'false'){
|
230 |
-
$content = get_the_content();
|
231 |
-
}else{
|
232 |
-
$content = apply_filters( 'the_content', get_the_content() );
|
233 |
-
$content = str_replace( ']]>', ']]>', $content );
|
234 |
-
}
|
235 |
-
}
|
236 |
}
|
237 |
}
|
238 |
wp_reset_postdata();
|
239 |
}
|
|
|
|
|
|
|
|
|
|
|
240 |
else{
|
241 |
-
|
242 |
-
|
243 |
-
}
|
244 |
-
else{
|
245 |
-
$content = apply_filters( 'the_content', $content );
|
246 |
-
$content = str_replace( ']]>', ']]>', $content );
|
247 |
-
}
|
248 |
}
|
249 |
-
|
250 |
$ewo = '';
|
251 |
$ewc = '';
|
252 |
-
|
253 |
//id does not allow spaces
|
254 |
$id = preg_replace('/\s+/', '_', $id);
|
255 |
-
|
256 |
//placeholders
|
257 |
$placeholder_arr = array('%(%', '%)%', '%{%', '%}%');
|
258 |
$swapout_arr = array('<', '>', '[', ']');
|
259 |
-
|
260 |
$title = do_shortcode(str_replace($placeholder_arr, $swapout_arr, $title));
|
261 |
if($swaptitle){
|
262 |
$swaptitle = do_shortcode(str_replace($placeholder_arr, $swapout_arr, $swaptitle));
|
@@ -271,7 +264,7 @@ class WP_Collapse_O_Matic {
|
|
271 |
if(empty($targtag)){
|
272 |
$targtag = 'div';
|
273 |
}
|
274 |
-
|
275 |
if($elwraptag){
|
276 |
$ewclass = '';
|
277 |
if($elwrapclass){
|
@@ -280,7 +273,7 @@ class WP_Collapse_O_Matic {
|
|
280 |
$ewo = '<'.$elwraptag.' '.$ewclass.'>';
|
281 |
$ewc = '</'.$elwraptag.'>';
|
282 |
}
|
283 |
-
|
284 |
$eDiv = '';
|
285 |
if($content){
|
286 |
$inline_class = '';
|
@@ -289,9 +282,9 @@ class WP_Collapse_O_Matic {
|
|
289 |
$inline_class = 'colomat-inline ';
|
290 |
$collapse_class = 'collapseomatic_content_inline ';
|
291 |
}
|
292 |
-
$eDiv = '<'.$targtag.' id="target-'.$id.'" class="'.$collapse_class.$inline_class.$targclass.'">'.$content.'</'.$targtag.'>';
|
293 |
}
|
294 |
-
|
295 |
if($excerpt){
|
296 |
$excerpt = str_replace($placeholder_arr, $swapout_arr, $excerpt);
|
297 |
if(empty($filter) || $filter == 'false'){
|
@@ -301,7 +294,7 @@ class WP_Collapse_O_Matic {
|
|
301 |
$excerpt = apply_filters( 'the_content', $excerpt );
|
302 |
$excerpt = str_replace( ']]>', ']]>', $excerpt );
|
303 |
}
|
304 |
-
|
305 |
if($targpos == 'inline'){
|
306 |
$excerpt .= $eDiv;
|
307 |
$eDiv = '';
|
@@ -361,7 +354,7 @@ class WP_Collapse_O_Matic {
|
|
361 |
if($swaptitle){
|
362 |
$link .= "<".$tag." id='swap-".$id."' alt='".$swapalt."' class='colomat-swap' style='display:none;'>".$startwrap.$swaptitle.$endwrap."</".$tag.">";
|
363 |
}
|
364 |
-
|
365 |
if($excerpt){
|
366 |
if($excerptpos == 'above-trigger'){
|
367 |
if($trigpos == 'below'){
|
@@ -398,7 +391,7 @@ class WP_Collapse_O_Matic {
|
|
398 |
}
|
399 |
return $retStr;
|
400 |
}
|
401 |
-
|
402 |
// Add link to options page from plugin list
|
403 |
function plugin_actions($links) {
|
404 |
$new_links = array();
|
@@ -435,7 +428,7 @@ class WP_Collapse_O_Matic {
|
|
435 |
<div class="icon32" id="icon-options-custom" style="background:url( <?php echo plugins_url( 'images/collapse-o-matic-icon.png', __FILE__ ) ?> ) no-repeat 50% 50%"><br></div>
|
436 |
<h2>Collapse-O-Matic</h2>
|
437 |
</div>
|
438 |
-
|
439 |
<div class="postbox-container metabox-holder meta-box-sortables" style="width: 69%">
|
440 |
<div style="margin:0 5px;">
|
441 |
<div class="postbox">
|
@@ -472,7 +465,7 @@ class WP_Collapse_O_Matic {
|
|
472 |
<br /><span class="description"><?php _e('Select Light for sites with lighter backgrounds. Select Dark for sites with darker backgrounds.', 'colomat'); ?></span></label>
|
473 |
</td>
|
474 |
</tr>
|
475 |
-
|
476 |
<?php if( is_plugin_active( 'collapse-commander/collapse-commander.php' ) ) : ?>
|
477 |
<tr>
|
478 |
<th><?php _e( 'CID Attribute', 'colomat' ) ?>:</th>
|
@@ -481,42 +474,42 @@ class WP_Collapse_O_Matic {
|
|
481 |
</td>
|
482 |
</tr>
|
483 |
<?php endif; ?>
|
484 |
-
|
485 |
<tr>
|
486 |
<th><?php _e( 'Tag Attribute', 'colomat' ) ?>:</th>
|
487 |
<td><label><input type="text" id="<?php echo $this->options_name ?>[tag]" name="<?php echo $this->options_name ?>[tag]" value="<?php echo $options['tag']; ?>" />
|
488 |
<br /><span class="description"><?php printf(__('HTML tag use to wrap the trigger text. See %sTag Attribute%s in the documentation for more info.', 'colomat'), '<a href="http://plugins.twinpictures.de/plugins/collapse-o-matic/documentation/#tag" target="_blank">', '</a>'); ?></span></label>
|
489 |
</td>
|
490 |
</tr>
|
491 |
-
|
492 |
<tr>
|
493 |
<th><?php _e( 'Trigclass Attribute', 'colomat' ) ?>:</th>
|
494 |
<td><label><input type="text" id="<?php echo $this->options_name ?>[trigclass]" name="<?php echo $this->options_name ?>[trigclass]" value="<?php echo $options['trigclass']; ?>" />
|
495 |
<br /><span class="description"><?php printf(__('Default class assigned to the trigger element. See %sTrigclass Attribute%s in the documentation for more info.', 'colomat'), '<a href="http://plugins.twinpictures.de/plugins/collapse-o-matic/documentation/#trigclass" target="_blank">', '</a>'); ?></span></label>
|
496 |
</td>
|
497 |
</tr>
|
498 |
-
|
499 |
<tr>
|
500 |
<th><?php _e( 'Tabindex Attribute', 'colomat' ) ?>:</th>
|
501 |
<td><label><input type="text" id="<?php echo $this->options_name ?>[tabindex]" name="<?php echo $this->options_name ?>[tabindex]" value="<?php echo $options['tabindex']; ?>" />
|
502 |
<br /><span class="description"><?php printf(__('Default tabindex value to be assigned to the trigger element. See %sTabindex Attribute%s in the documentation for more info.', 'colomat'), '<a href="http://plugins.twinpictures.de/plugins/collapse-o-matic/documentation/#tabindex" target="_blank">', '</a>'); ?></span></label>
|
503 |
</td>
|
504 |
</tr>
|
505 |
-
|
506 |
<tr>
|
507 |
<th><?php _e( 'Targtag Attribute', 'colomat' ) ?>:</th>
|
508 |
<td><label><input type="text" id="<?php echo $this->options_name ?>[targtag]" name="<?php echo $this->options_name ?>[targtag]" value="<?php echo $options['targtag']; ?>" />
|
509 |
<br /><span class="description"><?php printf(__('HTML tag use for the target element. See %sTargtag Attribute%s in the documentation for more info.', 'colomat'), '<a href="http://plugins.twinpictures.de/plugins/collapse-o-matic/documentation/#targtag" target="_blank">', '</a>'); ?></span></label>
|
510 |
</td>
|
511 |
</tr>
|
512 |
-
|
513 |
<tr>
|
514 |
<th><?php _e( 'Targclass Attribute', 'colomat' ) ?>:</th>
|
515 |
<td><label><input type="text" id="<?php echo $this->options_name ?>[targclass]" name="<?php echo $this->options_name ?>[targclass]" value="<?php echo $options['targclass']; ?>" />
|
516 |
<br /><span class="description"><?php printf(__('Default class assigned to the target element. See %sTargclass Attribute%s in the documentation for more info.', 'colomat'), '<a href="http://plugins.twinpictures.de/plugins/collapse-o-matic/documentation/#targclass" target="_blank">', '</a>'); ?></span></label>
|
517 |
</td>
|
518 |
</tr>
|
519 |
-
|
520 |
<tr>
|
521 |
<?php
|
522 |
if(empty($options['duration'])){
|
@@ -528,7 +521,7 @@ class WP_Collapse_O_Matic {
|
|
528 |
<br /><span class="description"><?php printf(__('A string or number determining how long the animation will run. See %sDuration%s in the documentation for more info.', 'colomat'), '<a href="http://plugins.twinpictures.de/plugins/collapse-o-matic/documentation/#duration" target="_blank">', '</a>'); ?></span></label>
|
529 |
</td>
|
530 |
</tr>
|
531 |
-
|
532 |
<tr>
|
533 |
<th><?php _e( 'Animation Effect', 'colomat' ) ?>:</th>
|
534 |
<td><label><select id="<?php echo $this->options_name ?>[slideEffect]" name="<?php echo $this->options_name ?>[slideEffect]">
|
@@ -552,28 +545,28 @@ class WP_Collapse_O_Matic {
|
|
552 |
<br /><span class="description"><?php printf(__('Animation effect to use while collapsing and expanding. See %sAnimation Effect%s in the documentation for more info.', 'colomat'), '<a href="http://plugins.twinpictures.de/plugins/collapse-o-matic/documentation/#animation-effect" target="_blank">', '</a>'); ?></span></label>
|
553 |
</td>
|
554 |
</tr>
|
555 |
-
|
556 |
<tr>
|
557 |
<th><?php _e( 'Custom Style', 'colomat' ) ?>:</th>
|
558 |
<td><label><textarea id="<?php echo $this->options_name ?>[custom_css]" name="<?php echo $this->options_name ?>[custom_css]" style="width: 100%; height: 150px;"><?php echo $options['custom_css']; ?></textarea>
|
559 |
<br /><span class="description"><?php _e( 'Custom CSS style for <em>ultimate flexibility</em>', 'colomat' ) ?></span></label>
|
560 |
</td>
|
561 |
</tr>
|
562 |
-
|
563 |
<tr>
|
564 |
<th><?php _e( 'Content Filter', 'colomat' ) ?>:</th>
|
565 |
<td><label><input type="checkbox" id="<?php echo $this->options_name ?>[filter_content]" name="<?php echo $this->options_name ?>[filter_content]" value="1" <?php echo checked( $options['filter_content'], 1 ); ?> /> <?php _e('Apply filter', 'colomat'); ?>
|
566 |
<br /><span class="description"><?php _e('Apply the_content filter to target content.', 'colomat'); ?></span></label>
|
567 |
</td>
|
568 |
</tr>
|
569 |
-
|
570 |
<tr>
|
571 |
<th><?php _e( 'Shortcode Loads Scripts', 'colomat' ) ?>:</th>
|
572 |
<td><label><input type="checkbox" id="<?php echo $this->options_name ?>[script_check]" name="<?php echo $this->options_name ?>[script_check]" value="1" <?php echo checked( $options['script_check'], 1 ); ?> /> <?php _e('Only load scripts with shortcode.', 'colomat'); ?>
|
573 |
<br /><span class="description"><?php _e('Only load Collapse-O-Matic scripts if [expand] shortcode is used.', 'colomat'); ?></span></label>
|
574 |
</td>
|
575 |
</tr>
|
576 |
-
|
577 |
<tr>
|
578 |
<th><?php _e( 'Script Load Location', 'colomat' ) ?>:</th>
|
579 |
<td><label><select id="<?php echo $this->options_name ?>[script_location]" name="<?php echo $this->options_name ?>[script_location]">
|
@@ -611,7 +604,7 @@ class WP_Collapse_O_Matic {
|
|
611 |
</tr>
|
612 |
</table>
|
613 |
</fieldset>
|
614 |
-
|
615 |
<p class="submit">
|
616 |
<input class="button-primary" type="submit" value="<?php _e( 'Save Changes' ) ?>" />
|
617 |
</p>
|
@@ -620,7 +613,7 @@ class WP_Collapse_O_Matic {
|
|
620 |
</div>
|
621 |
</div>
|
622 |
</div>
|
623 |
-
|
624 |
<div class="postbox-container side metabox-holder meta-box-sortables" style="width:29%;">
|
625 |
<div style="margin:0 5px;">
|
626 |
<div class="postbox">
|
@@ -643,9 +636,9 @@ class WP_Collapse_O_Matic {
|
|
643 |
</div>
|
644 |
<div class="clear"></div>
|
645 |
</div>
|
646 |
-
|
647 |
<?php if( is_plugin_active( 'collapse-commander/collapse-commander.php' ) ) : ?>
|
648 |
-
|
649 |
<div class="postbox-container side metabox-holder" style="width:29%;">
|
650 |
<div style="margin:0 5px;">
|
651 |
<div class="postbox">
|
@@ -666,11 +659,11 @@ class WP_Collapse_O_Matic {
|
|
666 |
<td><label for="<?php echo $this->license_name ?>[collapse_commander_license_key]"><input type="text" id="<?php echo $this->license_name ?>[collapse_commander_license_key]" name="<?php echo $this->license_name ?>[collapse_commander_license_key]" value="<?php esc_attr_e( $cc_licence ); ?>" style="width: 100%" />
|
667 |
<br /><span class="description"><?php _e('Enter your license key', 'colpromat'); ?></span></label>
|
668 |
</td>
|
669 |
-
|
670 |
</tr>
|
671 |
-
|
672 |
<?php if( isset($options['collapse_commander_license_key']) ) { ?>
|
673 |
-
<tr valign="top">
|
674 |
<th><?php _e('License Status', 'colpromat'); ?>:</th>
|
675 |
<td>
|
676 |
<?php if( isset($options['collapse_commander_license_status']) && $options['collapse_commander_license_status'] == 'valid' ) { ?>
|
@@ -678,7 +671,7 @@ class WP_Collapse_O_Matic {
|
|
678 |
<input type="submit" class="button-secondary" name="edd_cc_license_deactivate" value="<?php _e('Deactivate License'); ?>"/>
|
679 |
<?php } else {
|
680 |
if( isset($options['collapse_commander_license_status']) ){ ?>
|
681 |
-
<span style="color: red"><?php echo $options['collapse_commander_license_status']; ?></span><br/>
|
682 |
<?php } else { ?>
|
683 |
<span style="color: grey">inactive</span><br/>
|
684 |
<?php } ?>
|
@@ -713,7 +706,7 @@ class WP_Collapse_O_Matic {
|
|
713 |
<?php endif; ?>
|
714 |
<?php
|
715 |
}
|
716 |
-
|
717 |
/**
|
718 |
* Set options from save values or defaults
|
719 |
*/
|
@@ -725,7 +718,7 @@ class WP_Collapse_O_Matic {
|
|
725 |
if ( empty( $saved_options ) ) {
|
726 |
$saved_options = get_option( $this->domain . 'options' );
|
727 |
}
|
728 |
-
|
729 |
// set all options
|
730 |
if ( ! empty( $saved_options ) ) {
|
731 |
foreach ( $this->options AS $key => $option ) {
|
@@ -733,55 +726,55 @@ class WP_Collapse_O_Matic {
|
|
733 |
}
|
734 |
}
|
735 |
}
|
736 |
-
|
737 |
function edd_sanitize_license( $new ) {
|
738 |
//collapse commander
|
739 |
$options = get_option($this->license_name);
|
740 |
$old_cc = ( !isset( $options['collapse_commander_license_key'] ) ) ? '' : $options['collapse_commander_license_key'];
|
741 |
$old_cc_status = ( !isset( $options['collapse_commander_license_status'] ) ) ? '' : $options['collapse_commander_license_status'];
|
742 |
-
|
743 |
if( !empty($old_cc) && $old_cc != $new['collapse_commander_license_key'] ) {
|
744 |
$new['collapse_commander_license_status'] = '';
|
745 |
}
|
746 |
else{
|
747 |
$new['collapse_commander_license_status'] = $old_cc_status;
|
748 |
}
|
749 |
-
|
750 |
if( isset( $_POST['edd_cc_license_activate'] ) ) {
|
751 |
$new['collapse_commander_license_status'] = $this->plugin_oven_activate_license( urlencode( PLUGIN_OVEN_CC ), $new['collapse_commander_license_key'], 'activate_license');
|
752 |
}
|
753 |
-
|
754 |
if( isset( $_POST['edd_cc_license_deactivate'] ) ) {
|
755 |
$new['collapse_commander_license_status'] = $this->plugin_oven_activate_license( urlencode( PLUGIN_OVEN_CC ), $new['collapse_commander_license_key'], 'deactivate_license');
|
756 |
}
|
757 |
return $new;
|
758 |
}
|
759 |
-
|
760 |
-
|
761 |
/************************************
|
762 |
-
* this illustrates how to activate
|
763 |
* a license key
|
764 |
*************************************/
|
765 |
-
|
766 |
-
function plugin_oven_activate_license($plugin_name, $license_key, $edd_action) {
|
767 |
// data to send in our API request
|
768 |
-
$api_params = array(
|
769 |
-
'edd_action' => $edd_action,
|
770 |
-
'license' => $license_key,
|
771 |
'item_name' => $plugin_name,
|
772 |
'url' => home_url()
|
773 |
);
|
774 |
-
|
775 |
// Call the custom API.
|
776 |
-
|
777 |
-
|
778 |
// make sure the response came back okay
|
779 |
if ( is_wp_error( $response ) )
|
780 |
return false;
|
781 |
-
|
782 |
// decode the license data
|
783 |
$license_data = json_decode( wp_remote_retrieve_body( $response ) );
|
784 |
-
|
785 |
// $license_data->license will be either "valid" or "invalid"
|
786 |
return $license_data->license;
|
787 |
}
|
@@ -797,10 +790,10 @@ $WP_Collapse_O_Matic = new WP_Collapse_O_Matic;
|
|
797 |
//clean unwanted p and br tags from shortcodes
|
798 |
//http://www.wpexplorer.com/clean-up-wordpress-shortcode-formatting
|
799 |
if (!function_exists('tp_clean_shortcodes')) {
|
800 |
-
function tp_clean_shortcodes($content){
|
801 |
$array = array (
|
802 |
-
'<p>[' => '[',
|
803 |
-
']</p>' => ']',
|
804 |
']<br />' => ']'
|
805 |
);
|
806 |
$content = strtr($content, $array);
|
@@ -809,4 +802,4 @@ if (!function_exists('tp_clean_shortcodes')) {
|
|
809 |
add_filter('the_content', 'tp_clean_shortcodes');
|
810 |
}
|
811 |
|
812 |
-
?>
|
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.6.9
|
9 |
Author: twinpictures, baden03
|
10 |
Author URI: http://twinpictures.de/
|
11 |
License: GPL2
|
30 |
* Current version
|
31 |
* @var string
|
32 |
*/
|
33 |
+
var $version = '1.6.9';
|
34 |
|
35 |
/**
|
36 |
* Used as prefix for options entry
|
37 |
* @var string
|
38 |
*/
|
39 |
var $domain = 'colomat';
|
40 |
+
|
41 |
/**
|
42 |
* Name of the options
|
43 |
* @var string
|
64 |
'cc_email' => '',
|
65 |
'filter_content' => '',
|
66 |
);
|
67 |
+
|
68 |
var $license_group = 'colomat_licenseing';
|
69 |
+
|
70 |
var $license_name = 'WP_Collapse_O_Matic_license';
|
71 |
+
|
72 |
var $license_options = array(
|
73 |
'collapse_commander_license_key' => '',
|
74 |
'collapse_commander_license_status' => ''
|
80 |
function __construct() {
|
81 |
// set option values
|
82 |
$this->_set_options();
|
83 |
+
|
84 |
// load text domain for translations
|
85 |
load_plugin_textdomain( 'colomat', FALSE, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
|
86 |
+
|
87 |
//load the script and style if viewing the front-end
|
88 |
add_action('wp_enqueue_scripts', array( $this, 'collapsTronicInit' ) );
|
89 |
+
|
90 |
// add actions
|
91 |
add_action( 'admin_menu', array( $this, 'admin_menu' ) );
|
92 |
add_action( 'plugin_action_links_' . plugin_basename(__FILE__), array( $this, 'plugin_actions' ) );
|
98 |
add_action('wp_head', array( $this, 'colomat_js_vars' ) );
|
99 |
}
|
100 |
add_shortcode('expand', array($this, 'shortcode'));
|
101 |
+
|
102 |
//add expandsub shortcodes
|
103 |
for ($i=1; $i<30; $i++) {
|
104 |
add_shortcode('expandsub'.$i, array($this, 'shortcode'));
|
105 |
}
|
106 |
+
|
107 |
+
// Add shortcode support for widgets
|
108 |
add_filter('widget_text', 'do_shortcode');
|
109 |
}
|
110 |
|
120 |
echo "\n</style>\n";
|
121 |
}
|
122 |
}
|
123 |
+
|
124 |
/**
|
125 |
* Callback init
|
126 |
*/
|
127 |
+
function collapsTronicInit() {
|
128 |
//collapse script
|
129 |
$load_in_footer = false;
|
130 |
if($this->options['script_location'] == 'footer' ){
|
131 |
$load_in_footer = true;
|
132 |
}
|
133 |
+
wp_register_script('collapseomatic-js', plugins_url('js/collapse.js', __FILE__), array('jquery'), '1.5.15', $load_in_footer);
|
134 |
if( empty($this->options['script_check']) ){
|
135 |
wp_enqueue_script('collapseomatic-js');
|
136 |
}
|
137 |
+
|
138 |
//css
|
139 |
wp_register_style( 'collapseomatic-css', plugins_url('/'.$this->options['style'].'_style.css', __FILE__) , array (), '1.6' );
|
140 |
wp_enqueue_style( 'collapseomatic-css' );
|
158 |
register_setting( $this->domain, $this->options_name );
|
159 |
register_setting( $this->license_group, $this->license_name, array($this, 'edd_sanitize_license') );
|
160 |
}
|
161 |
+
|
162 |
/**
|
163 |
* Callback shortcode
|
164 |
*/
|
209 |
while ( $query_commander->have_posts() ) {
|
210 |
$query_commander->the_post();
|
211 |
$title = get_the_title();
|
212 |
+
|
213 |
//meta values
|
214 |
$meta_values = get_post_meta( $cid );
|
215 |
foreach($meta_values as $key => $value){
|
223 |
if(!empty($highlander) && !empty($rel)){
|
224 |
$rel .= '-highlander';
|
225 |
}
|
226 |
+
|
227 |
//content
|
228 |
+
$content = get_the_content();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
229 |
}
|
230 |
}
|
231 |
wp_reset_postdata();
|
232 |
}
|
233 |
+
|
234 |
+
//content filtering
|
235 |
+
if(empty($filter) || $filter == 'false'){
|
236 |
+
$content = do_shortcode($content);
|
237 |
+
}
|
238 |
else{
|
239 |
+
$content = apply_filters( 'the_content', $content );
|
240 |
+
$content = str_replace( ']]>', ']]>', $content );
|
|
|
|
|
|
|
|
|
|
|
241 |
}
|
242 |
+
|
243 |
$ewo = '';
|
244 |
$ewc = '';
|
245 |
+
|
246 |
//id does not allow spaces
|
247 |
$id = preg_replace('/\s+/', '_', $id);
|
248 |
+
|
249 |
//placeholders
|
250 |
$placeholder_arr = array('%(%', '%)%', '%{%', '%}%');
|
251 |
$swapout_arr = array('<', '>', '[', ']');
|
252 |
+
|
253 |
$title = do_shortcode(str_replace($placeholder_arr, $swapout_arr, $title));
|
254 |
if($swaptitle){
|
255 |
$swaptitle = do_shortcode(str_replace($placeholder_arr, $swapout_arr, $swaptitle));
|
264 |
if(empty($targtag)){
|
265 |
$targtag = 'div';
|
266 |
}
|
267 |
+
|
268 |
if($elwraptag){
|
269 |
$ewclass = '';
|
270 |
if($elwrapclass){
|
273 |
$ewo = '<'.$elwraptag.' '.$ewclass.'>';
|
274 |
$ewc = '</'.$elwraptag.'>';
|
275 |
}
|
276 |
+
|
277 |
$eDiv = '';
|
278 |
if($content){
|
279 |
$inline_class = '';
|
282 |
$inline_class = 'colomat-inline ';
|
283 |
$collapse_class = 'collapseomatic_content_inline ';
|
284 |
}
|
285 |
+
$eDiv = '<'.$targtag.' id="target-'.$id.'" class="'.$collapse_class.$inline_class.$targclass.'">'.$content.'</'.$targtag.'>';
|
286 |
}
|
287 |
+
|
288 |
if($excerpt){
|
289 |
$excerpt = str_replace($placeholder_arr, $swapout_arr, $excerpt);
|
290 |
if(empty($filter) || $filter == 'false'){
|
294 |
$excerpt = apply_filters( 'the_content', $excerpt );
|
295 |
$excerpt = str_replace( ']]>', ']]>', $excerpt );
|
296 |
}
|
297 |
+
|
298 |
if($targpos == 'inline'){
|
299 |
$excerpt .= $eDiv;
|
300 |
$eDiv = '';
|
354 |
if($swaptitle){
|
355 |
$link .= "<".$tag." id='swap-".$id."' alt='".$swapalt."' class='colomat-swap' style='display:none;'>".$startwrap.$swaptitle.$endwrap."</".$tag.">";
|
356 |
}
|
357 |
+
|
358 |
if($excerpt){
|
359 |
if($excerptpos == 'above-trigger'){
|
360 |
if($trigpos == 'below'){
|
391 |
}
|
392 |
return $retStr;
|
393 |
}
|
394 |
+
|
395 |
// Add link to options page from plugin list
|
396 |
function plugin_actions($links) {
|
397 |
$new_links = array();
|
428 |
<div class="icon32" id="icon-options-custom" style="background:url( <?php echo plugins_url( 'images/collapse-o-matic-icon.png', __FILE__ ) ?> ) no-repeat 50% 50%"><br></div>
|
429 |
<h2>Collapse-O-Matic</h2>
|
430 |
</div>
|
431 |
+
|
432 |
<div class="postbox-container metabox-holder meta-box-sortables" style="width: 69%">
|
433 |
<div style="margin:0 5px;">
|
434 |
<div class="postbox">
|
465 |
<br /><span class="description"><?php _e('Select Light for sites with lighter backgrounds. Select Dark for sites with darker backgrounds.', 'colomat'); ?></span></label>
|
466 |
</td>
|
467 |
</tr>
|
468 |
+
|
469 |
<?php if( is_plugin_active( 'collapse-commander/collapse-commander.php' ) ) : ?>
|
470 |
<tr>
|
471 |
<th><?php _e( 'CID Attribute', 'colomat' ) ?>:</th>
|
474 |
</td>
|
475 |
</tr>
|
476 |
<?php endif; ?>
|
477 |
+
|
478 |
<tr>
|
479 |
<th><?php _e( 'Tag Attribute', 'colomat' ) ?>:</th>
|
480 |
<td><label><input type="text" id="<?php echo $this->options_name ?>[tag]" name="<?php echo $this->options_name ?>[tag]" value="<?php echo $options['tag']; ?>" />
|
481 |
<br /><span class="description"><?php printf(__('HTML tag use to wrap the trigger text. See %sTag Attribute%s in the documentation for more info.', 'colomat'), '<a href="http://plugins.twinpictures.de/plugins/collapse-o-matic/documentation/#tag" target="_blank">', '</a>'); ?></span></label>
|
482 |
</td>
|
483 |
</tr>
|
484 |
+
|
485 |
<tr>
|
486 |
<th><?php _e( 'Trigclass Attribute', 'colomat' ) ?>:</th>
|
487 |
<td><label><input type="text" id="<?php echo $this->options_name ?>[trigclass]" name="<?php echo $this->options_name ?>[trigclass]" value="<?php echo $options['trigclass']; ?>" />
|
488 |
<br /><span class="description"><?php printf(__('Default class assigned to the trigger element. See %sTrigclass Attribute%s in the documentation for more info.', 'colomat'), '<a href="http://plugins.twinpictures.de/plugins/collapse-o-matic/documentation/#trigclass" target="_blank">', '</a>'); ?></span></label>
|
489 |
</td>
|
490 |
</tr>
|
491 |
+
|
492 |
<tr>
|
493 |
<th><?php _e( 'Tabindex Attribute', 'colomat' ) ?>:</th>
|
494 |
<td><label><input type="text" id="<?php echo $this->options_name ?>[tabindex]" name="<?php echo $this->options_name ?>[tabindex]" value="<?php echo $options['tabindex']; ?>" />
|
495 |
<br /><span class="description"><?php printf(__('Default tabindex value to be assigned to the trigger element. See %sTabindex Attribute%s in the documentation for more info.', 'colomat'), '<a href="http://plugins.twinpictures.de/plugins/collapse-o-matic/documentation/#tabindex" target="_blank">', '</a>'); ?></span></label>
|
496 |
</td>
|
497 |
</tr>
|
498 |
+
|
499 |
<tr>
|
500 |
<th><?php _e( 'Targtag Attribute', 'colomat' ) ?>:</th>
|
501 |
<td><label><input type="text" id="<?php echo $this->options_name ?>[targtag]" name="<?php echo $this->options_name ?>[targtag]" value="<?php echo $options['targtag']; ?>" />
|
502 |
<br /><span class="description"><?php printf(__('HTML tag use for the target element. See %sTargtag Attribute%s in the documentation for more info.', 'colomat'), '<a href="http://plugins.twinpictures.de/plugins/collapse-o-matic/documentation/#targtag" target="_blank">', '</a>'); ?></span></label>
|
503 |
</td>
|
504 |
</tr>
|
505 |
+
|
506 |
<tr>
|
507 |
<th><?php _e( 'Targclass Attribute', 'colomat' ) ?>:</th>
|
508 |
<td><label><input type="text" id="<?php echo $this->options_name ?>[targclass]" name="<?php echo $this->options_name ?>[targclass]" value="<?php echo $options['targclass']; ?>" />
|
509 |
<br /><span class="description"><?php printf(__('Default class assigned to the target element. See %sTargclass Attribute%s in the documentation for more info.', 'colomat'), '<a href="http://plugins.twinpictures.de/plugins/collapse-o-matic/documentation/#targclass" target="_blank">', '</a>'); ?></span></label>
|
510 |
</td>
|
511 |
</tr>
|
512 |
+
|
513 |
<tr>
|
514 |
<?php
|
515 |
if(empty($options['duration'])){
|
521 |
<br /><span class="description"><?php printf(__('A string or number determining how long the animation will run. See %sDuration%s in the documentation for more info.', 'colomat'), '<a href="http://plugins.twinpictures.de/plugins/collapse-o-matic/documentation/#duration" target="_blank">', '</a>'); ?></span></label>
|
522 |
</td>
|
523 |
</tr>
|
524 |
+
|
525 |
<tr>
|
526 |
<th><?php _e( 'Animation Effect', 'colomat' ) ?>:</th>
|
527 |
<td><label><select id="<?php echo $this->options_name ?>[slideEffect]" name="<?php echo $this->options_name ?>[slideEffect]">
|
545 |
<br /><span class="description"><?php printf(__('Animation effect to use while collapsing and expanding. See %sAnimation Effect%s in the documentation for more info.', 'colomat'), '<a href="http://plugins.twinpictures.de/plugins/collapse-o-matic/documentation/#animation-effect" target="_blank">', '</a>'); ?></span></label>
|
546 |
</td>
|
547 |
</tr>
|
548 |
+
|
549 |
<tr>
|
550 |
<th><?php _e( 'Custom Style', 'colomat' ) ?>:</th>
|
551 |
<td><label><textarea id="<?php echo $this->options_name ?>[custom_css]" name="<?php echo $this->options_name ?>[custom_css]" style="width: 100%; height: 150px;"><?php echo $options['custom_css']; ?></textarea>
|
552 |
<br /><span class="description"><?php _e( 'Custom CSS style for <em>ultimate flexibility</em>', 'colomat' ) ?></span></label>
|
553 |
</td>
|
554 |
</tr>
|
555 |
+
|
556 |
<tr>
|
557 |
<th><?php _e( 'Content Filter', 'colomat' ) ?>:</th>
|
558 |
<td><label><input type="checkbox" id="<?php echo $this->options_name ?>[filter_content]" name="<?php echo $this->options_name ?>[filter_content]" value="1" <?php echo checked( $options['filter_content'], 1 ); ?> /> <?php _e('Apply filter', 'colomat'); ?>
|
559 |
<br /><span class="description"><?php _e('Apply the_content filter to target content.', 'colomat'); ?></span></label>
|
560 |
</td>
|
561 |
</tr>
|
562 |
+
|
563 |
<tr>
|
564 |
<th><?php _e( 'Shortcode Loads Scripts', 'colomat' ) ?>:</th>
|
565 |
<td><label><input type="checkbox" id="<?php echo $this->options_name ?>[script_check]" name="<?php echo $this->options_name ?>[script_check]" value="1" <?php echo checked( $options['script_check'], 1 ); ?> /> <?php _e('Only load scripts with shortcode.', 'colomat'); ?>
|
566 |
<br /><span class="description"><?php _e('Only load Collapse-O-Matic scripts if [expand] shortcode is used.', 'colomat'); ?></span></label>
|
567 |
</td>
|
568 |
</tr>
|
569 |
+
|
570 |
<tr>
|
571 |
<th><?php _e( 'Script Load Location', 'colomat' ) ?>:</th>
|
572 |
<td><label><select id="<?php echo $this->options_name ?>[script_location]" name="<?php echo $this->options_name ?>[script_location]">
|
604 |
</tr>
|
605 |
</table>
|
606 |
</fieldset>
|
607 |
+
|
608 |
<p class="submit">
|
609 |
<input class="button-primary" type="submit" value="<?php _e( 'Save Changes' ) ?>" />
|
610 |
</p>
|
613 |
</div>
|
614 |
</div>
|
615 |
</div>
|
616 |
+
|
617 |
<div class="postbox-container side metabox-holder meta-box-sortables" style="width:29%;">
|
618 |
<div style="margin:0 5px;">
|
619 |
<div class="postbox">
|
636 |
</div>
|
637 |
<div class="clear"></div>
|
638 |
</div>
|
639 |
+
|
640 |
<?php if( is_plugin_active( 'collapse-commander/collapse-commander.php' ) ) : ?>
|
641 |
+
|
642 |
<div class="postbox-container side metabox-holder" style="width:29%;">
|
643 |
<div style="margin:0 5px;">
|
644 |
<div class="postbox">
|
659 |
<td><label for="<?php echo $this->license_name ?>[collapse_commander_license_key]"><input type="text" id="<?php echo $this->license_name ?>[collapse_commander_license_key]" name="<?php echo $this->license_name ?>[collapse_commander_license_key]" value="<?php esc_attr_e( $cc_licence ); ?>" style="width: 100%" />
|
660 |
<br /><span class="description"><?php _e('Enter your license key', 'colpromat'); ?></span></label>
|
661 |
</td>
|
662 |
+
|
663 |
</tr>
|
664 |
+
|
665 |
<?php if( isset($options['collapse_commander_license_key']) ) { ?>
|
666 |
+
<tr valign="top">
|
667 |
<th><?php _e('License Status', 'colpromat'); ?>:</th>
|
668 |
<td>
|
669 |
<?php if( isset($options['collapse_commander_license_status']) && $options['collapse_commander_license_status'] == 'valid' ) { ?>
|
671 |
<input type="submit" class="button-secondary" name="edd_cc_license_deactivate" value="<?php _e('Deactivate License'); ?>"/>
|
672 |
<?php } else {
|
673 |
if( isset($options['collapse_commander_license_status']) ){ ?>
|
674 |
+
<span style="color: red"><?php echo $options['collapse_commander_license_status']; ?></span><br/>
|
675 |
<?php } else { ?>
|
676 |
<span style="color: grey">inactive</span><br/>
|
677 |
<?php } ?>
|
706 |
<?php endif; ?>
|
707 |
<?php
|
708 |
}
|
709 |
+
|
710 |
/**
|
711 |
* Set options from save values or defaults
|
712 |
*/
|
718 |
if ( empty( $saved_options ) ) {
|
719 |
$saved_options = get_option( $this->domain . 'options' );
|
720 |
}
|
721 |
+
|
722 |
// set all options
|
723 |
if ( ! empty( $saved_options ) ) {
|
724 |
foreach ( $this->options AS $key => $option ) {
|
726 |
}
|
727 |
}
|
728 |
}
|
729 |
+
|
730 |
function edd_sanitize_license( $new ) {
|
731 |
//collapse commander
|
732 |
$options = get_option($this->license_name);
|
733 |
$old_cc = ( !isset( $options['collapse_commander_license_key'] ) ) ? '' : $options['collapse_commander_license_key'];
|
734 |
$old_cc_status = ( !isset( $options['collapse_commander_license_status'] ) ) ? '' : $options['collapse_commander_license_status'];
|
735 |
+
|
736 |
if( !empty($old_cc) && $old_cc != $new['collapse_commander_license_key'] ) {
|
737 |
$new['collapse_commander_license_status'] = '';
|
738 |
}
|
739 |
else{
|
740 |
$new['collapse_commander_license_status'] = $old_cc_status;
|
741 |
}
|
742 |
+
|
743 |
if( isset( $_POST['edd_cc_license_activate'] ) ) {
|
744 |
$new['collapse_commander_license_status'] = $this->plugin_oven_activate_license( urlencode( PLUGIN_OVEN_CC ), $new['collapse_commander_license_key'], 'activate_license');
|
745 |
}
|
746 |
+
|
747 |
if( isset( $_POST['edd_cc_license_deactivate'] ) ) {
|
748 |
$new['collapse_commander_license_status'] = $this->plugin_oven_activate_license( urlencode( PLUGIN_OVEN_CC ), $new['collapse_commander_license_key'], 'deactivate_license');
|
749 |
}
|
750 |
return $new;
|
751 |
}
|
752 |
+
|
753 |
+
|
754 |
/************************************
|
755 |
+
* this illustrates how to activate
|
756 |
* a license key
|
757 |
*************************************/
|
758 |
+
|
759 |
+
function plugin_oven_activate_license($plugin_name, $license_key, $edd_action) {
|
760 |
// data to send in our API request
|
761 |
+
$api_params = array(
|
762 |
+
'edd_action' => $edd_action,
|
763 |
+
'license' => $license_key,
|
764 |
'item_name' => $plugin_name,
|
765 |
'url' => home_url()
|
766 |
);
|
767 |
+
|
768 |
// Call the custom API.
|
769 |
+
$response = wp_remote_get( esc_url_raw( add_query_arg( $api_params, PLUGIN_OVEN_URL ) ), array( 'timeout' => 15, 'sslverify' => false ) );
|
770 |
+
|
771 |
// make sure the response came back okay
|
772 |
if ( is_wp_error( $response ) )
|
773 |
return false;
|
774 |
+
|
775 |
// decode the license data
|
776 |
$license_data = json_decode( wp_remote_retrieve_body( $response ) );
|
777 |
+
|
778 |
// $license_data->license will be either "valid" or "invalid"
|
779 |
return $license_data->license;
|
780 |
}
|
790 |
//clean unwanted p and br tags from shortcodes
|
791 |
//http://www.wpexplorer.com/clean-up-wordpress-shortcode-formatting
|
792 |
if (!function_exists('tp_clean_shortcodes')) {
|
793 |
+
function tp_clean_shortcodes($content){
|
794 |
$array = array (
|
795 |
+
'<p>[' => '[',
|
796 |
+
']</p>' => ']',
|
797 |
']<br />' => ']'
|
798 |
);
|
799 |
$content = strtr($content, $array);
|
802 |
add_filter('the_content', 'tp_clean_shortcodes');
|
803 |
}
|
804 |
|
805 |
+
?>
|
js/collapse.js
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
/*!
|
2 |
-
* Collapse-O-Matic JavaSctipt v1.5.
|
3 |
* http://plugins.twinpictures.de/plugins/collapse-o-matic/
|
4 |
*
|
5 |
-
* Copyright
|
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
|
@@ -11,10 +11,10 @@
|
|
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
|
@@ -28,13 +28,13 @@ function collapse_init() {
|
|
28 |
jQuery('.force_content_collapse').each(function(index) {
|
29 |
jQuery(this).css('display', 'none');
|
30 |
});
|
31 |
-
|
32 |
//inital collapse
|
33 |
jQuery('.collapseomatic:not(.colomat-close)').each(function(index) {
|
34 |
var thisid = jQuery(this).attr('id');
|
35 |
jQuery('#target-'+thisid).css('display', 'none');
|
36 |
});
|
37 |
-
|
38 |
//inital swaptitle for pre-expanded elements
|
39 |
jQuery('.collapseomatic.colomat-close').each(function(index) {
|
40 |
var thisid = jQuery(this).attr('id');
|
@@ -50,10 +50,10 @@ function collapse_init() {
|
|
50 |
function swapTitle(origObj, swapObj){
|
51 |
var orightml = jQuery(origObj).html();
|
52 |
var swaphtml = jQuery(swapObj).html();
|
53 |
-
|
54 |
jQuery(origObj).html(swaphtml);
|
55 |
jQuery(swapObj).html(orightml);
|
56 |
-
|
57 |
//is cufon involved? if so, do that thing
|
58 |
if(swaphtml.indexOf("<cufon") != -1){
|
59 |
var trigelem = jQuery(this).get(0).tagName;
|
@@ -65,7 +65,7 @@ function toggleState (obj, id, maptastic, trig_id) {
|
|
65 |
if (maptastic && jQuery('[id^=target][id$='+id+']').hasClass('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() {
|
@@ -73,7 +73,7 @@ function toggleState (obj, id, maptastic, trig_id) {
|
|
73 |
if( jQuery(this).hasClass('colomat-inline') && jQuery(this).is(':visible') ){
|
74 |
jQuery(this).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');
|
@@ -95,7 +95,7 @@ function toggleState (obj, id, maptastic, trig_id) {
|
|
95 |
if( jQuery(this).hasClass('colomat-inline') && jQuery(this).is(':visible') ){
|
96 |
jQuery(this).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');
|
@@ -114,25 +114,25 @@ function closeOtherGroups(rel){
|
|
114 |
//add close class if open
|
115 |
if(jQuery(this).hasClass('colomat-expand-only') && jQuery(this).hasClass('colomat-close')){
|
116 |
return;
|
117 |
-
}
|
118 |
if(jQuery(this).hasClass('colomat-close') && jQuery(this).attr('rel') !== undefined){
|
119 |
jQuery(this).removeClass('colomat-close');
|
120 |
var id = jQuery(this).attr('id');
|
121 |
//remove parent highlight class
|
122 |
jQuery('#parent-'+id).removeClass('colomat-parent-highlight');
|
123 |
-
|
124 |
//check if the title needs to be swapped out
|
125 |
if(jQuery("#swap-"+id).length > 0){
|
126 |
swapTitle(this, "#swap-"+id);
|
127 |
}
|
128 |
-
|
129 |
//check if the excerpt needs to be swapped out
|
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);
|
138 |
ancestors.each(function(index) {
|
@@ -149,7 +149,7 @@ function closeOtherMembers(rel, id){
|
|
149 |
if(jQuery(this).hasClass('colomat-expand-only') && jQuery(this).hasClass('colomat-close')){
|
150 |
return;
|
151 |
}
|
152 |
-
|
153 |
//add close class if open
|
154 |
if(jQuery(this).attr('id') != id && jQuery(this).hasClass('colomat-close') && jQuery(this).attr('rel') !== undefined){
|
155 |
//collapse the element
|
@@ -157,17 +157,17 @@ function closeOtherMembers(rel, id){
|
|
157 |
var thisid = jQuery(this).attr('id');
|
158 |
//remove parent highlight class
|
159 |
jQuery('#parent-'+thisid).removeClass('colomat-parent-highlight');
|
160 |
-
|
161 |
//check if the title needs to be swapped out
|
162 |
if(jQuery("#swap-"+thisid).length > 0){
|
163 |
swapTitle(this, "#swap-"+thisid);
|
164 |
}
|
165 |
-
|
166 |
//check if the excerpt needs to be swapped out
|
167 |
if(jQuery("#swapexcerpt-"+thisid).length > 0){
|
168 |
swapTitle("#excerpt-"+thisid, "#swapexcerpt-"+thisid);
|
169 |
}
|
170 |
-
|
171 |
//check for snap-shut
|
172 |
if(!jQuery(this).hasClass('colomat-close') && jQuery(this).hasClass('snap-shut')){
|
173 |
jQuery('#target-'+thisid).hide();
|
@@ -175,7 +175,7 @@ function closeOtherMembers(rel, id){
|
|
175 |
else{
|
176 |
toggleState (jQuery(this), thisid, false, false);
|
177 |
}
|
178 |
-
|
179 |
//check if there are nested children that need to be collapsed
|
180 |
var ancestors = jQuery('.collapseomatic', '#target-'+id);
|
181 |
ancestors.each(function(index) {
|
@@ -188,13 +188,13 @@ function closeOtherMembers(rel, id){
|
|
188 |
//console.log('this is an extra trigger');
|
189 |
pre = pre_id.splice(0, 1);
|
190 |
id = pre_id.join('-');
|
191 |
-
|
192 |
//deal with any scroll to links from the Extra Collapse Trigger
|
193 |
if(jQuery(this).hasClass('scroll-to-trigger')){
|
194 |
var target_offset = jQuery('#'+id).offset();
|
195 |
offset_top = target_offset.top;
|
196 |
}
|
197 |
-
|
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');
|
@@ -203,14 +203,14 @@ function closeOtherMembers(rel, id){
|
|
203 |
offset_top = target_offset.top;
|
204 |
}
|
205 |
}
|
206 |
-
|
207 |
//toggle master trigger arrow
|
208 |
jQuery('#'+id).toggleClass('colomat-close');
|
209 |
-
|
210 |
//toggle any other extra trigger arrows
|
211 |
jQuery('[id^=extra][id$='+id+']').toggleClass('colomat-close');
|
212 |
}
|
213 |
-
|
214 |
if(jQuery(this).attr('id').indexOf('bot-') == '-1'){
|
215 |
jQuery(this).removeClass('colomat-close');
|
216 |
var thisid = jQuery(this).attr('id');
|
@@ -237,15 +237,15 @@ function colomat_expandall(loop_items){
|
|
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 |
}
|
@@ -254,39 +254,45 @@ 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();
|
283 |
-
|
|
|
|
|
|
|
|
|
|
|
284 |
//Display the collapse wrapper... use to reverse the show-all on no JavaScript degredation.
|
285 |
jQuery('.content_collapse_wrapper').each(function(index) {
|
286 |
jQuery(this).css('display', 'inline');
|
287 |
});
|
288 |
-
|
289 |
-
//hover
|
290 |
jQuery(document).on({
|
291 |
mouseenter: function(){
|
292 |
//stuff to do on mouseover
|
@@ -297,24 +303,24 @@ jQuery(document).ready(function() {
|
|
297 |
jQuery(this).removeClass('colomat-hover');
|
298 |
}
|
299 |
}, '.collapseomatic'); //pass the element as an argument to .on
|
300 |
-
|
301 |
//tabindex enter
|
302 |
jQuery(document).on('keypress','.collapseomatic', function(event) {
|
303 |
if (event.which == 13) {
|
304 |
event.currentTarget.click();
|
305 |
};
|
306 |
});
|
307 |
-
|
308 |
//the main collapse/expand function
|
309 |
jQuery(document).on('click', '.collapseomatic', function(event) {
|
310 |
var offset_top;
|
311 |
-
|
312 |
//alert('phones ringin dude');
|
313 |
if(jQuery(this).hasClass('colomat-expand-only') && jQuery(this).hasClass('colomat-close')){
|
314 |
return;
|
315 |
}
|
316 |
var id = jQuery(this).attr('id');
|
317 |
-
|
318 |
//deal with any scroll to links
|
319 |
if(jQuery(this).hasClass('colomat-close') && jQuery(this).hasClass('scroll-to-trigger')){
|
320 |
offset_top = jQuery('#scrollonclose-'+id).attr('name');
|
@@ -323,21 +329,21 @@ jQuery(document).ready(function() {
|
|
323 |
offset_top = target_offset.top;
|
324 |
}
|
325 |
}
|
326 |
-
|
327 |
var id_arr = id.split('-');
|
328 |
-
|
329 |
//deal with extra tirggers
|
330 |
if (id_arr[0].indexOf('extra') != '-1') {
|
331 |
//console.log('this is an extra trigger');
|
332 |
pre = id_arr.splice(0, 1);
|
333 |
id = id_arr.join('-');
|
334 |
-
|
335 |
//deal with any scroll to links from the Extra Collapse Trigger
|
336 |
if(jQuery(this).hasClass('scroll-to-trigger')){
|
337 |
var target_offset = jQuery('#'+id).offset();
|
338 |
offset_top = target_offset.top;
|
339 |
}
|
340 |
-
|
341 |
//deal with any scroll to links from the Title Trigger
|
342 |
if(jQuery('#'+id).hasClass('scroll-to-trigger')){
|
343 |
offset_top = jQuery('#scrollonclose-'+id).attr('name');
|
@@ -346,24 +352,24 @@ jQuery(document).ready(function() {
|
|
346 |
offset_top = target_offset.top;
|
347 |
}
|
348 |
}
|
349 |
-
|
350 |
//toggle master trigger arrow
|
351 |
jQuery('#'+id).toggleClass('colomat-close');
|
352 |
-
|
353 |
//toggle any other extra trigger arrows
|
354 |
jQuery('[id^=extra][id$='+id+']').toggleClass('colomat-close');
|
355 |
}
|
356 |
-
|
357 |
else if(id.indexOf('bot-') != '-1'){
|
358 |
id = id.substr(4);
|
359 |
jQuery('#'+id).toggleClass('colomat-close');
|
360 |
-
|
361 |
//deal with any scroll to links from the Internal Collapse Trigger
|
362 |
if(jQuery(this).hasClass('scroll-to-trigger')){
|
363 |
var target_offset = jQuery('#'+id).offset();
|
364 |
offset_top = target_offset.top;
|
365 |
}
|
366 |
-
|
367 |
//deal with any scroll to links from the Title Trigger
|
368 |
if(jQuery('#'+id).hasClass('scroll-to-trigger')){
|
369 |
offset_top = jQuery('#scrollonclose-'+id).attr('name');
|
@@ -378,24 +384,24 @@ jQuery(document).ready(function() {
|
|
378 |
//toggle any extra triggers
|
379 |
jQuery('[id^=extra][id$='+id+']').toggleClass('colomat-close');
|
380 |
}
|
381 |
-
|
382 |
//check if the title needs to be swapped out
|
383 |
if(jQuery("#swap-"+id).length > 0){
|
384 |
swapTitle(jQuery('#'+id), "#swap-"+id);
|
385 |
}
|
386 |
-
|
387 |
//check if the excerpt needs to be swapped out
|
388 |
if(jQuery("#swapexcerpt-"+id).length > 0){
|
389 |
swapTitle("#excerpt-"+id, "#swapexcerpt-"+id);
|
390 |
}
|
391 |
-
|
392 |
//add visited class
|
393 |
jQuery(this).addClass('colomat-visited');
|
394 |
-
|
395 |
//toggle parent highlight class
|
396 |
var parentID = 'parent-'+id;
|
397 |
jQuery('#' + parentID).toggleClass('colomat-parent-highlight');
|
398 |
-
|
399 |
//check for snap-shut
|
400 |
if(!jQuery(this).hasClass('colomat-close') && jQuery(this).hasClass('snap-shut')){
|
401 |
jQuery('#target-'+id).hide();
|
@@ -403,7 +409,7 @@ jQuery(document).ready(function() {
|
|
403 |
else{
|
404 |
toggleState (jQuery(this), id, true, id);
|
405 |
}
|
406 |
-
|
407 |
//deal with grouped items if needed
|
408 |
if(jQuery(this).attr('rel') !== undefined){
|
409 |
var rel = jQuery(this).attr('rel');
|
@@ -412,14 +418,14 @@ jQuery(document).ready(function() {
|
|
412 |
}
|
413 |
else{
|
414 |
closeOtherGroups(rel);
|
415 |
-
}
|
416 |
}
|
417 |
-
|
418 |
if(offset_top){
|
419 |
jQuery('html, body').animate({scrollTop:offset_top}, 500);
|
420 |
}
|
421 |
});
|
422 |
-
|
423 |
|
424 |
jQuery(document).on('click', '.expandall', function(event) {
|
425 |
if(jQuery(this).attr('rel') !== undefined){
|
@@ -432,7 +438,7 @@ jQuery(document).ready(function() {
|
|
432 |
|
433 |
colomat_expandall(loop_items);
|
434 |
});
|
435 |
-
|
436 |
jQuery(document).on('click', '.collapseall', function(event) {
|
437 |
if(jQuery(this).attr('rel') !== undefined){
|
438 |
var rel = jQuery(this).attr('rel');
|
@@ -441,10 +447,10 @@ jQuery(document).ready(function() {
|
|
441 |
else {
|
442 |
var loop_items = jQuery('.collapseomatic.colomat-close');
|
443 |
}
|
444 |
-
|
445 |
colomat_collapseall(loop_items);
|
446 |
});
|
447 |
-
|
448 |
//handle new page loads with anchor
|
449 |
var myFile = document.location.toString();
|
450 |
if (myFile.match('#')) { // the URL contains an anchor
|
@@ -457,7 +463,7 @@ jQuery(document).ready(function() {
|
|
457 |
else{
|
458 |
anchor = anchor_arr[0];
|
459 |
}
|
460 |
-
|
461 |
if( !jQuery('#' + anchor).hasClass('colomat-close') ){
|
462 |
jQuery('#' + anchor).click();
|
463 |
}
|
@@ -471,7 +477,7 @@ jQuery(document).ready(function() {
|
|
471 |
}
|
472 |
})
|
473 |
}
|
474 |
-
|
475 |
//handle anchor links within the same page
|
476 |
jQuery(document).on('click', 'a.expandanchor', function(event) {
|
477 |
event.preventDefault();
|
@@ -489,7 +495,7 @@ jQuery(document).ready(function() {
|
|
489 |
if(!jQuery('#' + anchor).hasClass('colomat-close')){
|
490 |
jQuery('#' + anchor).click();
|
491 |
}
|
492 |
-
|
493 |
//expand any nested parents
|
494 |
jQuery('#' + anchor).parents('.collapseomatic_content, .collapseomatic_content_inline').each(function(index) {
|
495 |
parent_arr = jQuery(this).attr('id').split('-');
|
@@ -498,12 +504,12 @@ jQuery(document).ready(function() {
|
|
498 |
if(!jQuery('#' + parent).hasClass('colomat-close')){
|
499 |
jQuery('#' + parent).click();
|
500 |
}
|
501 |
-
|
502 |
})
|
503 |
}
|
504 |
});
|
505 |
-
|
506 |
jQuery(document).on('click', 'a.colomat-nolink', function(event) {
|
507 |
event.preventDefault();
|
508 |
-
});
|
509 |
-
});
|
1 |
/*!
|
2 |
+
* Collapse-O-Matic JavaSctipt v1.5.15
|
3 |
* http://plugins.twinpictures.de/plugins/collapse-o-matic/
|
4 |
*
|
5 |
+
* Copyright 2015, 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
|
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
|
28 |
jQuery('.force_content_collapse').each(function(index) {
|
29 |
jQuery(this).css('display', 'none');
|
30 |
});
|
31 |
+
|
32 |
//inital collapse
|
33 |
jQuery('.collapseomatic:not(.colomat-close)').each(function(index) {
|
34 |
var thisid = jQuery(this).attr('id');
|
35 |
jQuery('#target-'+thisid).css('display', 'none');
|
36 |
});
|
37 |
+
|
38 |
//inital swaptitle for pre-expanded elements
|
39 |
jQuery('.collapseomatic.colomat-close').each(function(index) {
|
40 |
var thisid = jQuery(this).attr('id');
|
50 |
function swapTitle(origObj, swapObj){
|
51 |
var orightml = jQuery(origObj).html();
|
52 |
var swaphtml = jQuery(swapObj).html();
|
53 |
+
|
54 |
jQuery(origObj).html(swaphtml);
|
55 |
jQuery(swapObj).html(orightml);
|
56 |
+
|
57 |
//is cufon involved? if so, do that thing
|
58 |
if(swaphtml.indexOf("<cufon") != -1){
|
59 |
var trigelem = jQuery(this).get(0).tagName;
|
65 |
if (maptastic && jQuery('[id^=target][id$='+id+']').hasClass('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() {
|
73 |
if( jQuery(this).hasClass('colomat-inline') && jQuery(this).is(':visible') ){
|
74 |
jQuery(this).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');
|
95 |
if( jQuery(this).hasClass('colomat-inline') && jQuery(this).is(':visible') ){
|
96 |
jQuery(this).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');
|
114 |
//add close class if open
|
115 |
if(jQuery(this).hasClass('colomat-expand-only') && jQuery(this).hasClass('colomat-close')){
|
116 |
return;
|
117 |
+
}
|
118 |
if(jQuery(this).hasClass('colomat-close') && jQuery(this).attr('rel') !== undefined){
|
119 |
jQuery(this).removeClass('colomat-close');
|
120 |
var id = jQuery(this).attr('id');
|
121 |
//remove parent highlight class
|
122 |
jQuery('#parent-'+id).removeClass('colomat-parent-highlight');
|
123 |
+
|
124 |
//check if the title needs to be swapped out
|
125 |
if(jQuery("#swap-"+id).length > 0){
|
126 |
swapTitle(this, "#swap-"+id);
|
127 |
}
|
128 |
+
|
129 |
//check if the excerpt needs to be swapped out
|
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);
|
138 |
ancestors.each(function(index) {
|
149 |
if(jQuery(this).hasClass('colomat-expand-only') && jQuery(this).hasClass('colomat-close')){
|
150 |
return;
|
151 |
}
|
152 |
+
|
153 |
//add close class if open
|
154 |
if(jQuery(this).attr('id') != id && jQuery(this).hasClass('colomat-close') && jQuery(this).attr('rel') !== undefined){
|
155 |
//collapse the element
|
157 |
var thisid = jQuery(this).attr('id');
|
158 |
//remove parent highlight class
|
159 |
jQuery('#parent-'+thisid).removeClass('colomat-parent-highlight');
|
160 |
+
|
161 |
//check if the title needs to be swapped out
|
162 |
if(jQuery("#swap-"+thisid).length > 0){
|
163 |
swapTitle(this, "#swap-"+thisid);
|
164 |
}
|
165 |
+
|
166 |
//check if the excerpt needs to be swapped out
|
167 |
if(jQuery("#swapexcerpt-"+thisid).length > 0){
|
168 |
swapTitle("#excerpt-"+thisid, "#swapexcerpt-"+thisid);
|
169 |
}
|
170 |
+
|
171 |
//check for snap-shut
|
172 |
if(!jQuery(this).hasClass('colomat-close') && jQuery(this).hasClass('snap-shut')){
|
173 |
jQuery('#target-'+thisid).hide();
|
175 |
else{
|
176 |
toggleState (jQuery(this), thisid, false, false);
|
177 |
}
|
178 |
+
|
179 |
//check if there are nested children that need to be collapsed
|
180 |
var ancestors = jQuery('.collapseomatic', '#target-'+id);
|
181 |
ancestors.each(function(index) {
|
188 |
//console.log('this is an extra trigger');
|
189 |
pre = pre_id.splice(0, 1);
|
190 |
id = pre_id.join('-');
|
191 |
+
|
192 |
//deal with any scroll to links from the Extra Collapse Trigger
|
193 |
if(jQuery(this).hasClass('scroll-to-trigger')){
|
194 |
var target_offset = jQuery('#'+id).offset();
|
195 |
offset_top = target_offset.top;
|
196 |
}
|
197 |
+
|
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');
|
203 |
offset_top = target_offset.top;
|
204 |
}
|
205 |
}
|
206 |
+
|
207 |
//toggle master trigger arrow
|
208 |
jQuery('#'+id).toggleClass('colomat-close');
|
209 |
+
|
210 |
//toggle any other extra trigger arrows
|
211 |
jQuery('[id^=extra][id$='+id+']').toggleClass('colomat-close');
|
212 |
}
|
213 |
+
|
214 |
if(jQuery(this).attr('id').indexOf('bot-') == '-1'){
|
215 |
jQuery(this).removeClass('colomat-close');
|
216 |
var thisid = jQuery(this).attr('id');
|
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 |
}
|
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 |
+
|
281 |
jQuery(document).ready(function() {
|
282 |
//console.log(colomatduration, colomatslideEffect);
|
283 |
collapse_init();
|
284 |
+
|
285 |
+
//jetpack infinite scroll catch-all
|
286 |
+
jQuery( document.body ).on( 'post-load', function () {
|
287 |
+
collapse_init();
|
288 |
+
} );
|
289 |
+
|
290 |
//Display the collapse wrapper... use to reverse the show-all on no JavaScript degredation.
|
291 |
jQuery('.content_collapse_wrapper').each(function(index) {
|
292 |
jQuery(this).css('display', 'inline');
|
293 |
});
|
294 |
+
|
295 |
+
//hover
|
296 |
jQuery(document).on({
|
297 |
mouseenter: function(){
|
298 |
//stuff to do on mouseover
|
303 |
jQuery(this).removeClass('colomat-hover');
|
304 |
}
|
305 |
}, '.collapseomatic'); //pass the element as an argument to .on
|
306 |
+
|
307 |
//tabindex enter
|
308 |
jQuery(document).on('keypress','.collapseomatic', function(event) {
|
309 |
if (event.which == 13) {
|
310 |
event.currentTarget.click();
|
311 |
};
|
312 |
});
|
313 |
+
|
314 |
//the main collapse/expand function
|
315 |
jQuery(document).on('click', '.collapseomatic', function(event) {
|
316 |
var offset_top;
|
317 |
+
|
318 |
//alert('phones ringin dude');
|
319 |
if(jQuery(this).hasClass('colomat-expand-only') && jQuery(this).hasClass('colomat-close')){
|
320 |
return;
|
321 |
}
|
322 |
var id = jQuery(this).attr('id');
|
323 |
+
|
324 |
//deal with any scroll to links
|
325 |
if(jQuery(this).hasClass('colomat-close') && jQuery(this).hasClass('scroll-to-trigger')){
|
326 |
offset_top = jQuery('#scrollonclose-'+id).attr('name');
|
329 |
offset_top = target_offset.top;
|
330 |
}
|
331 |
}
|
332 |
+
|
333 |
var id_arr = id.split('-');
|
334 |
+
|
335 |
//deal with extra tirggers
|
336 |
if (id_arr[0].indexOf('extra') != '-1') {
|
337 |
//console.log('this is an extra trigger');
|
338 |
pre = id_arr.splice(0, 1);
|
339 |
id = id_arr.join('-');
|
340 |
+
|
341 |
//deal with any scroll to links from the Extra Collapse Trigger
|
342 |
if(jQuery(this).hasClass('scroll-to-trigger')){
|
343 |
var target_offset = jQuery('#'+id).offset();
|
344 |
offset_top = target_offset.top;
|
345 |
}
|
346 |
+
|
347 |
//deal with any scroll to links from the Title Trigger
|
348 |
if(jQuery('#'+id).hasClass('scroll-to-trigger')){
|
349 |
offset_top = jQuery('#scrollonclose-'+id).attr('name');
|
352 |
offset_top = target_offset.top;
|
353 |
}
|
354 |
}
|
355 |
+
|
356 |
//toggle master trigger arrow
|
357 |
jQuery('#'+id).toggleClass('colomat-close');
|
358 |
+
|
359 |
//toggle any other extra trigger arrows
|
360 |
jQuery('[id^=extra][id$='+id+']').toggleClass('colomat-close');
|
361 |
}
|
362 |
+
|
363 |
else if(id.indexOf('bot-') != '-1'){
|
364 |
id = id.substr(4);
|
365 |
jQuery('#'+id).toggleClass('colomat-close');
|
366 |
+
|
367 |
//deal with any scroll to links from the Internal Collapse Trigger
|
368 |
if(jQuery(this).hasClass('scroll-to-trigger')){
|
369 |
var target_offset = jQuery('#'+id).offset();
|
370 |
offset_top = target_offset.top;
|
371 |
}
|
372 |
+
|
373 |
//deal with any scroll to links from the Title Trigger
|
374 |
if(jQuery('#'+id).hasClass('scroll-to-trigger')){
|
375 |
offset_top = jQuery('#scrollonclose-'+id).attr('name');
|
384 |
//toggle any extra triggers
|
385 |
jQuery('[id^=extra][id$='+id+']').toggleClass('colomat-close');
|
386 |
}
|
387 |
+
|
388 |
//check if the title needs to be swapped out
|
389 |
if(jQuery("#swap-"+id).length > 0){
|
390 |
swapTitle(jQuery('#'+id), "#swap-"+id);
|
391 |
}
|
392 |
+
|
393 |
//check if the excerpt needs to be swapped out
|
394 |
if(jQuery("#swapexcerpt-"+id).length > 0){
|
395 |
swapTitle("#excerpt-"+id, "#swapexcerpt-"+id);
|
396 |
}
|
397 |
+
|
398 |
//add visited class
|
399 |
jQuery(this).addClass('colomat-visited');
|
400 |
+
|
401 |
//toggle parent highlight class
|
402 |
var parentID = 'parent-'+id;
|
403 |
jQuery('#' + parentID).toggleClass('colomat-parent-highlight');
|
404 |
+
|
405 |
//check for snap-shut
|
406 |
if(!jQuery(this).hasClass('colomat-close') && jQuery(this).hasClass('snap-shut')){
|
407 |
jQuery('#target-'+id).hide();
|
409 |
else{
|
410 |
toggleState (jQuery(this), id, true, id);
|
411 |
}
|
412 |
+
|
413 |
//deal with grouped items if needed
|
414 |
if(jQuery(this).attr('rel') !== undefined){
|
415 |
var rel = jQuery(this).attr('rel');
|
418 |
}
|
419 |
else{
|
420 |
closeOtherGroups(rel);
|
421 |
+
}
|
422 |
}
|
423 |
+
|
424 |
if(offset_top){
|
425 |
jQuery('html, body').animate({scrollTop:offset_top}, 500);
|
426 |
}
|
427 |
});
|
428 |
+
|
429 |
|
430 |
jQuery(document).on('click', '.expandall', function(event) {
|
431 |
if(jQuery(this).attr('rel') !== undefined){
|
438 |
|
439 |
colomat_expandall(loop_items);
|
440 |
});
|
441 |
+
|
442 |
jQuery(document).on('click', '.collapseall', function(event) {
|
443 |
if(jQuery(this).attr('rel') !== undefined){
|
444 |
var rel = jQuery(this).attr('rel');
|
447 |
else {
|
448 |
var loop_items = jQuery('.collapseomatic.colomat-close');
|
449 |
}
|
450 |
+
|
451 |
colomat_collapseall(loop_items);
|
452 |
});
|
453 |
+
|
454 |
//handle new page loads with anchor
|
455 |
var myFile = document.location.toString();
|
456 |
if (myFile.match('#')) { // the URL contains an anchor
|
463 |
else{
|
464 |
anchor = anchor_arr[0];
|
465 |
}
|
466 |
+
|
467 |
if( !jQuery('#' + anchor).hasClass('colomat-close') ){
|
468 |
jQuery('#' + anchor).click();
|
469 |
}
|
477 |
}
|
478 |
})
|
479 |
}
|
480 |
+
|
481 |
//handle anchor links within the same page
|
482 |
jQuery(document).on('click', 'a.expandanchor', function(event) {
|
483 |
event.preventDefault();
|
495 |
if(!jQuery('#' + anchor).hasClass('colomat-close')){
|
496 |
jQuery('#' + anchor).click();
|
497 |
}
|
498 |
+
|
499 |
//expand any nested parents
|
500 |
jQuery('#' + anchor).parents('.collapseomatic_content, .collapseomatic_content_inline').each(function(index) {
|
501 |
parent_arr = jQuery(this).attr('id').split('-');
|
504 |
if(!jQuery('#' + parent).hasClass('colomat-close')){
|
505 |
jQuery('#' + parent).click();
|
506 |
}
|
507 |
+
|
508 |
})
|
509 |
}
|
510 |
});
|
511 |
+
|
512 |
jQuery(document).on('click', 'a.colomat-nolink', function(event) {
|
513 |
event.preventDefault();
|
514 |
+
});
|
515 |
+
});
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ 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.9
|
7 |
Tested up to: 4.2
|
8 |
-
Stable tag: 1.6.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -50,6 +50,10 @@ No. Not even close.
|
|
50 |
|
51 |
== Changelog ==
|
52 |
|
|
|
|
|
|
|
|
|
53 |
= 1.6.8 =
|
54 |
* fixed filter_content toggle bug.
|
55 |
* even if content is not to be filtered, it will still be passed through do_shortcode function
|
@@ -286,214 +290,6 @@ Fixed auto-expand of urls with id-anchors
|
|
286 |
|
287 |
== Upgrade Notice ==
|
288 |
|
289 |
-
= 1.6.
|
290 |
-
*
|
291 |
-
*
|
292 |
-
|
293 |
-
= 1.6.7 =
|
294 |
-
* added filter_content to the options page, defaults to off
|
295 |
-
|
296 |
-
= 1.6.6 =
|
297 |
-
* added filter attribute to pass the content through the_content filter
|
298 |
-
* changed name of wpex_clean_shortcodes function
|
299 |
-
|
300 |
-
= 1.6.5 =
|
301 |
-
* maptastic class only removed when present
|
302 |
-
* maptastic has a max-width assigned to prevent content from entering display area.
|
303 |
-
* updated collapse-commander integration to work with new licensing system
|
304 |
-
* tested up to: WordPress 4.2-alpha-31047
|
305 |
-
|
306 |
-
= 1.6.4 =
|
307 |
-
* added plugin to GitHub: https://github.com/baden03/collapse-o-matic
|
308 |
-
* added new tabindex attribute to shortcode and options page
|
309 |
-
* registration fields are masked using password input type
|
310 |
-
|
311 |
-
= 1.6.3 =
|
312 |
-
* added shortcode support for the excerpt attribute
|
313 |
-
* added wpex_clean_shortcodes filter to strip unwanted p and br tags from the shortcode
|
314 |
-
* added the ability to set trigclass, targtag and targclass attribute values in the plugin options page
|
315 |
-
|
316 |
-
= 1.6.2 =
|
317 |
-
* added colomat-swap class to the swaptitle element
|
318 |
-
* added optional cid default to the shortcode
|
319 |
-
|
320 |
-
= 1.6.1 =
|
321 |
-
* fixed undeclared cid variable
|
322 |
-
|
323 |
-
= 1.6 =
|
324 |
-
* fixed issue with using id anchor links on elements with expanded=‘true’
|
325 |
-
* added support for Collapse Commander add-on plugin to manage expand elements
|
326 |
-
|
327 |
-
= 1.5.10 =
|
328 |
-
* fixed an HTML5 validation issue with anchors having name attributes
|
329 |
-
* fixed bug with trigpos inline
|
330 |
-
* added span_fix classes to css files
|
331 |
-
* added 4.0 icons to assets
|
332 |
-
|
333 |
-
= 1.5.9 =
|
334 |
-
* fixed issue with missing classes in dark style
|
335 |
-
* streamlined the collapse/expand function
|
336 |
-
* streamlined the collapseall/expandall functions
|
337 |
-
* scrollonclose attribute now accepts auto as value
|
338 |
-
* added new colomat_expandall and colomat_collpaseall functions that can be triggered externally
|
339 |
-
|
340 |
-
= 1.5.8 =
|
341 |
-
* scripts always load by default
|
342 |
-
* can choose if script loads in header or footer
|
343 |
-
|
344 |
-
= 1.5.7 =
|
345 |
-
* option to only load scripts if shortcode is in use
|
346 |
-
* script loads in footer
|
347 |
-
* script and style are now hooked to wp_enqueue_scripts rather than init
|
348 |
-
* added Serbian language files courtesy of Borisa Djuraskovic from webhostinghub.com
|
349 |
-
|
350 |
-
= 1.5.6 =
|
351 |
-
* admin_init error is fixed. oops!
|
352 |
-
|
353 |
-
= 1.5.5 =
|
354 |
-
* updated for 3.8
|
355 |
-
* cleaned up old code
|
356 |
-
|
357 |
-
= 1.5.4 =
|
358 |
-
* updated jQuery .on() method
|
359 |
-
* removed php4 constructor
|
360 |
-
* added DE and RU languages
|
361 |
-
|
362 |
-
= 1.5.3 =
|
363 |
-
* shortcode works in sidebar widgets (again)
|
364 |
-
* fixed hasClass error in Slide Only animation option
|
365 |
-
|
366 |
-
= 1.5.2 =
|
367 |
-
* find-me is now called after all collapse/expand animations finish
|
368 |
-
* removed livequery in favor of jQuery .on() method
|
369 |
-
* updated Requires at least tag to 3.3
|
370 |
-
* added swapexcerpt attribute
|
371 |
-
* fixed typos on the options page
|
372 |
-
* added custom css to options page
|
373 |
-
* added targtag and targpos attributes
|
374 |
-
* added ability to add extra internal triggers
|
375 |
-
|
376 |
-
= 1.5.1 =
|
377 |
-
* find-me auto feature now works with responsive websites
|
378 |
-
|
379 |
-
= 1.5 =
|
380 |
-
* Plugin code completely rewritten
|
381 |
-
* Added Option Page
|
382 |
-
* added scroll-to-trigger class for Internal Collapse Triggers
|
383 |
-
* added livequery and callbacks to handle dynamically added collapse elements
|
384 |
-
* language translation support
|
385 |
-
|
386 |
-
= 1.4.11 =
|
387 |
-
* added colomat-parent-highlight class functionality
|
388 |
-
* findme auto position calculated after images have loaded
|
389 |
-
* Added elwraptag and elwrapclass attributes to wrap entire expand elements in an html element
|
390 |
-
* Added snap-shut class to slam collapses shut
|
391 |
-
|
392 |
-
= 1.4.10 =
|
393 |
-
* Added colomat-nolink class to prevent <a> anchors auto scrolling the page.
|
394 |
-
* bot- links text will no longer swap out if triggers use swap-title
|
395 |
-
|
396 |
-
= 1.4.9 =
|
397 |
-
* on() event handler rolled back to .click() and .hover() for WordPress installs that still use jQuery 1.6.4 - if you can believe that.
|
398 |
-
|
399 |
-
= 1.4.8 =
|
400 |
-
* on() event handler for dynamic content
|
401 |
-
* added notitle attribute
|
402 |
-
* added title wrapping
|
403 |
-
* fixed a few obscure bugs
|
404 |
-
* added expandanchor class
|
405 |
-
* added colomat-expand-only class
|
406 |
-
* added scrollonclose attribute and scroll-to-trigger class
|
407 |
-
|
408 |
-
= 1.4.7 =
|
409 |
-
* Fixed auto-expand of urls with id-anchors
|
410 |
-
|
411 |
-
= 1.4.6 =
|
412 |
-
* Fixed JS bug in 1.4.5 - Sorry people
|
413 |
-
|
414 |
-
= 1.4.5 =
|
415 |
-
* Added SlideFade/SlideToggle option and visited trigers now have colomat-visited class
|
416 |
-
|
417 |
-
= 1.4.4 =
|
418 |
-
* JavaScript has been minified for faster page loads
|
419 |
-
|
420 |
-
= 1.4.3 =
|
421 |
-
* added findme attribute to autoscroll to expanded elements
|
422 |
-
|
423 |
-
= 1.4.2 =
|
424 |
-
* added speed control to collapse/expand effect
|
425 |
-
|
426 |
-
= 1.4.1 =
|
427 |
-
* Swaptitle will be triggered by autoexpand/collapse events such as highlander grouping.
|
428 |
-
|
429 |
-
= 1.4 =
|
430 |
-
* Improved support and FAQs on Plugin Oven support page
|
431 |
-
|
432 |
-
= 1.3.18 =
|
433 |
-
* Added alternate style sheet for sites with dark backgrounds.
|
434 |
-
|
435 |
-
= 1.3.17 =
|
436 |
-
* Improved nesting collapse function for sub-levels and added support for nesting 30 levels deep.
|
437 |
-
|
438 |
-
= 1.3.16.1 =
|
439 |
-
* Added noarrows class for better integration of images as triggers.
|
440 |
-
|
441 |
-
= 1.3.16 =
|
442 |
-
* Bug Fix for the new trigpos attribute, stupid, stupid, stupid
|
443 |
-
|
444 |
-
= 1.3.15 =
|
445 |
-
Added trigpos attribute to position the trigger below the target.
|
446 |
-
|
447 |
-
= 1.3.14 =
|
448 |
-
Fixed Enqueue error and swap title on expand/collpase all. Expanded roll-your-own features.
|
449 |
-
|
450 |
-
= 1.3.13 =
|
451 |
-
Added the ability to place a second trigger link inside the expanding content area.
|
452 |
-
|
453 |
-
= 1.3.12 =
|
454 |
-
Now when Highlander Grouping collapses an element, it will automatically collapse nested elements as well.
|
455 |
-
|
456 |
-
= 1.3.11 =
|
457 |
-
Added excerpt feature that allows a juicy bit of nibble text to be displayed above and below the trigger text—as well as below the target text.
|
458 |
-
|
459 |
-
= 1.3.10 =
|
460 |
-
Rebuilt swaptitle to support images and cufon text. Change CSS names to be more plug-in specific.
|
461 |
-
|
462 |
-
= 1.3.9 =
|
463 |
-
Title triggers that contain <img> or <cufon> tags will not trigger swaptitle. Added rel grouping option to expand/collapse-all triggers.
|
464 |
-
|
465 |
-
= 1.3.8 =
|
466 |
-
Expand elements that have content containing only one space will not insert target elements.
|
467 |
-
|
468 |
-
= 1.3.7 =
|
469 |
-
New expandsub1 - expandsub3 shortcodes for nested expand elements. Collapse/Expand all triggers. Improved arrow icons.
|
470 |
-
|
471 |
-
= 1.3.6 =
|
472 |
-
Plug-in degrades gracefully when JS is disabled. Title can now have expand/collapse states using swaptitle attribute.
|
473 |
-
|
474 |
-
= 1.3.5 =
|
475 |
-
Random ID's are now valid xhtml.
|
476 |
-
|
477 |
-
= 1.3.4 =
|
478 |
-
Changed highlander grouping trigger from -member to -highlander.
|
479 |
-
|
480 |
-
= 1.3.3 =
|
481 |
-
Added highlander grouping... called it -member.
|
482 |
-
|
483 |
-
= 1.3.2 =
|
484 |
-
Expanded attribute and right arrow style added.
|
485 |
-
|
486 |
-
= 1.3.1 =
|
487 |
-
Hover style added.
|
488 |
-
|
489 |
-
= 1.3 =
|
490 |
-
Collapse-O-Matic has been significantly advanced. Elements can now be grouped together.
|
491 |
-
|
492 |
-
= 1.2 =
|
493 |
-
Style has been updated for ultimate flexibility. Shortcode 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]`.
|
494 |
-
|
495 |
-
= 1.1 =
|
496 |
-
Shortcode now works in sidebars. Shortcode must be written as `[expand title="title goes here" id="optional-id-goes-here"]content goes here[/expand]`.
|
497 |
-
|
498 |
-
= 1.0 =
|
499 |
-
Where once there was not, there now is.
|
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.9
|
7 |
Tested up to: 4.2
|
8 |
+
Stable tag: 1.6.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.6.9 =
|
54 |
+
* added catch-all callback for jetpack’s infinite-scroll
|
55 |
+
* fix: XSS Vulnerability
|
56 |
+
|
57 |
= 1.6.8 =
|
58 |
* fixed filter_content toggle bug.
|
59 |
* even if content is not to be filtered, it will still be passed through do_shortcode function
|
290 |
|
291 |
== Upgrade Notice ==
|
292 |
|
293 |
+
= 1.6.9 =
|
294 |
+
* works with jetpack’s infinite-scroll
|
295 |
+
* fix: XSS Vulnerability
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|