WordPress.org

Ready to get started?Download WordPress

Forums

AdRotate
[resolved] jQuery problem (lightbox component) (5 posts)

  1. ChowKaiDeng
    Member
    Posted 2 years ago #

    I'm not completely sure, but I think that AdRotate is breaking something in my jQuery library calls. This happens after WordPress upgraded to 3.3.1

    This is the problem: among my plugins, I have installed Rich Widget, which is a simple plugin that adds a FCKEditor like box to widgets, so you can edit the content of them in RTF.

    When AdRotate is activated, I can't see no more the lightbox on the RTF editor of Rich Widget, and when deactivated, it shows ok.

    I thought it was something with the jQuery library version called by the updated WordPress, so I de-registered the jquery script and registered a specific version of jquery (older) on my functions file, but nothings happens.

    Is someone around here having a similar problem, maybe with other plugins that use similar lightbox scripts?

    Greetings!

    http://wordpress.org/extend/plugins/adrotate/

  2. Arnan de Gans
    Member
    Posted 2 years ago #

    AdRotate doesnt use or load jquery.

  3. ChowKaiDeng
    Member
    Posted 2 years ago #

    So, what's this?

    File: adrotate-functions.php (line 848)

    function adrotate_filemanager_admin_scripts() {
    	wp_enqueue_script('media-upload');
    	wp_enqueue_script('thickbox');
    	wp_enqueue_script('jquery');
    }

    (line 862)

    function adrotate_filemanager_admin_styles() {
    	wp_enqueue_style('thickbox');
    }

    File: adrotate.php (line 675)

    <script language="JavaScript">
    			jQuery(document).ready(function() {
    				jQuery('#adrotate_image_button').click(function() {
    					formfield = jQuery('#adrotate_image').attr('name');
    					tb_show('', 'media-upload.php?type=image&TB_iframe=true');
    					return false;
    				});
    
    				window.send_to_editor = function(html) {
    					imgurl = jQuery('img',html).attr('src');
    					jQuery('#adrotate_image').val(imgurl);
    					tb_remove();
    				}
    
    			});
    			</script>

    That was just a quick search among obvious files, but I haven't check them all properly.

    As I see, the AdRotate thickbox could be interfering with the Rich Widget thickbox. They both use jQuery.

  4. Arnan de Gans
    Member
    Posted 2 years ago #

    Oh duh.. forgot about those.
    However, those are WP api's/functions used by many plugins.

  5. ChowKaiDeng
    Member
    Posted 2 years ago #

    Yes indeed. After a few minutes I've figured out. The problem was caused by Rich Widget, not AdRotate.
    Rich Widget was doing this ugly thing:

    echo '<link href="' . RB_RICHWIDGET_BASEURL . '/thickbox/thickbox.css" rel="stylesheet" type="text/css" />';
    
    wp_enqueue_script('thickbox_custom', RB_RICHWIDGET_BASEURL . '/thickbox/thickbox.js');

    Instead of just simply this:

    wp_enqueue_script('thickbox');

    I guess that Rich Widget was written in a time when thickbox was not part of the core scripts of WP, or something like that.

    I've changed the thing and everything it's ok. I'm gonna post all this stuff on the Rich Widget forum.

    Greetings

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic