WordPress.org

Support

Support » Plugins and Hacks » JS & CSS Script Optimizer » Plugin affecting photo galleries/sliders

Plugin affecting photo galleries/sliders

Viewing 2 replies - 1 through 2 (of 2 total)
  • Same here. I have a custom slider, but the problem is caused by this:

    Uncaught ReferenceError: thickboxL10n is not defined

    It appears that packing thickbox.js produces undesirable results. Moreover, if I try to exclude it from the scripts via the exclude-js field, then the order in which the scripts are processed is wrong, so I get jQuery undefined errors.

    So is there a way to define a script order that takes into account all scripts (even excluded ones)?

    It would be nice if we could also determine which scripts go to the bottom of the page, and which ones stay in the head.

    I did more research. It seems that by combining scripts, localization is lost for thickbox.js. In WP 3.5.1, see /wp-includes/script-loader.php, line 182:

    did_action( 'init' ) && $scripts->localize( 'thickbox', 'thickboxL10n', array(
    			'next' => __('Next >'),
    			'prev' => __('< Prev'),
    			'image' => __('Image'),
    			'of' => __('of'),
    			'close' => __('Close'),
    			'noiframes' => __('This feature requires inline frames. You have iframes disabled or your browser does not support them.'),
    			'loadingAnimation' => includes_url('js/thickbox/loadingAnimation.gif'),
    			'closeImage' => includes_url('js/thickbox/tb-close.png')
    	) );

    When the plugin is enabled with combining on, this localization is not triggered (hence the thickboxL10n undefined errors).

    I fixed my issue by adding this to my theme’s functions.php:

    function mytheme_thickbox_compression_fix() {
        echo '<script type="text/javascript">';
        echo "var thickboxL10n = ".json_encode(array(
            'next' => __('Next >'),
            'prev' => __('< Prev'),
            'image' => __('Image'),
            'of' => __('of'),
            'close' => __('Close'),
            'noiframes' => __('This feature requires inline frames. You have iframes disabled or your browser does not support them.'),
            'loadingAnimation' => includes_url('js/thickbox/loadingAnimation.gif'),
            'closeImage' => includes_url('js/thickbox/tb-close.png')));
        echo '</script>';
    }
    add_filter('wp_footer','mytheme_thickbox_compression_fix',20000001);

    It’s a hack that works for now, at least until this issue can be addressed by the developer.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Plugin affecting photo galleries/sliders’ is closed to new replies.
Skip to toolbar