Created
September 30, 2013 19:28
-
-
Save rosshanney/6768839 to your computer and use it in GitHub Desktop.
Remove tooltip stuff from GCE JavaScript.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin name: GCE - Remove tooltip JS | |
*/ | |
function gce_remove_tooltip_js() { | |
if ( defined( 'GCE_GENERAL_OPTIONS_NAME' ) ) { | |
$options = get_option( GCE_GENERAL_OPTIONS_NAME ); | |
wp_deregister_script( 'gce_scripts' ); | |
wp_enqueue_script( 'gce_scripts', plugins_url( '/gce-script.js', __FILE__ ), array( 'jquery' ), null, (bool) $options['javascript'] ); | |
wp_localize_script( 'gce_scripts', 'GoogleCalendarEvents', array( | |
'ajaxurl' => admin_url( 'admin-ajax.php', is_ssl() ? 'https' : 'http' ), | |
'loading' => $options['loading'] | |
) ); | |
} | |
} | |
add_action( 'wp_enqueue_scripts', 'gce_remove_tooltip_js', 99 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function gce_ajaxify(target, feed_ids, max_events, title_text, type){ | |
//Add click event to change month links | |
jQuery('#' + target + ' .gce-change-month').click(function(){ | |
//Extract month and year | |
var month_year = jQuery(this).attr('name').split('-', 2); | |
//Add loading text to table caption | |
jQuery('#' + target + ' caption').html(GoogleCalendarEvents.loading); | |
//Send AJAX request | |
jQuery.get(GoogleCalendarEvents.ajaxurl,{ | |
action:'gce_ajax', | |
gce_type:type, | |
gce_feed_ids:feed_ids, | |
gce_title_text:title_text, | |
gce_widget_id:target, | |
gce_max_events:max_events, | |
gce_month:month_year[0], | |
gce_year:month_year[1] | |
}, function(data){ | |
//Replace existing data with returned AJAX data | |
if(type == 'widget'){ | |
jQuery('#' + target).html(data); | |
}else{ | |
jQuery('#' + target).replaceWith(data); | |
} | |
}); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment