Plugin Directory

Changeset 793323


Ignore:
Timestamp:
10/25/2013 01:16:04 AM (12 years ago)
Author:
bgentry
Message:

Added a checking mechanism that ensures the animation effects only get applied once, even on some WordPress pages that strangely tried to call the javascript twice

Location:
easy-faq-with-expanding-text
Files:
15 added
2 edited

Legend:

Unmodified
Added
Removed
  • easy-faq-with-expanding-text/trunk/faq.php

    r777684 r793323  
    33Plugin Name: Easy FAQ with Expanding Text
    44Description: Easily create a Frequently Asked Questions page with answers that slide down when the questions are clicked. No need for a shortcode, HTML coding, or javascript tweaking.
    5 Version: 3.2
     5Version: 3.2.1
    66Author: bgentry
    77Author URI: http://bryangentry.us
     
    3535            add_action('wp_head', 'faq_css_output');
    3636           
    37             if ( is_single() || is_page() ) {
     37           
    3838           
    3939                add_filter ('the_content', 'faq_function_call' ); //calls the FAQ javascript function for a single post or page
    4040           
    41             }
    42             else {
     41           
     42           
    4343                add_action('get_footer', 'faq_footer'); //if we're on a list of posts, call this function in the footer
    44             }
     44           
    4545    }
    4646}
     
    127127    $faqoptions = get_option('bg_faq_options');
    128128    $foldup = $faqoptions['foldup'];
    129     echo '<script>bgfaq("'.$foldup.'")</script>';
     129    echo '<script>if ( typeof faqStarted == "undefined" ) {
     130    faqStarted = true; 
     131    bgfaq("'.$foldup.'")}</script>';
    130132    }
    131133
     
    142144    }
    143145   
    144     $content .= '<script>bgfaq("'.$foldup.'")</script>';
     146    $content .= '<script>if ( typeof faqStarted == "undefined" ) {';
     147    $content .= 'faqStarted = true;';
     148    $content .= 'bgfaq("'.$foldup.'"); }</script>';
    145149    return $content;
    146150}
     
    242246function faq_get_content_div_class() {
    243247$faqoptions = get_option('bg_faq_options');
    244 echo '<p><strong>Most of these settings</strong>are available on each individual post. However, these default options will be used on a list of posts or on any posts that do not have these settings explicitly set.</p>';
     248
    245249echo '<p><label><strong>One answer open at a time?</strong>';
    246250if($faqoptions['foldup'] == "yes")
  • easy-faq-with-expanding-text/trunk/readme.txt

    r777685 r793323  
    44Tags: faq pages
    55Tested up to: 3.6.1
    6 Stable tag: 3.2
     6Stable tag: 3.2.1
    77License: GPLv2
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    2323
    2424== Changelog ==
     25
     26= 3.2.1 =
     27* Added a checking mechanism that ensures the animation effects only get applied once, even on some WordPress pages that strangely tried to call the javascript twice
    2528
    2629= 3.2 =
Note: See TracChangeset for help on using the changeset viewer.