'aNi-N-gin', 'description' => 'Embed aNi-N-gin in your sidebar' );
/* Widget control settings. */
$control_ops = array( 'width' => 300, 'height' => 350, 'id_base' => 'aningin-widget' );
/* Create the widget. */
$this->WP_Widget( 'aningin-widget', 'aNi-N-gin Widget', $widget_ops, $control_ops );
}
function widget( $args, $instance ) {
extract( $args );
/* User-selected settings. */
$title = apply_filters('widget_title', $instance['title'] );
$home = get_bloginfo('home');
/* Before widget (defined by themes). */
echo $before_widget;
/* Title of widget (before and after defined by themes). */
if ( $title )
echo $before_title . $title . $after_title;
echo <<
jQuery(document).ready(function() {
ARused=0;
jQuery("#ARbutton").click(function(){
if (ARused = 1) {
jQuery('#ARresult').slideUp("slow", function(){
jQuery('#ARstatus').text('Loading...');
});
}
if (jQuery("#ARnick").val() != "") {
jQuery('#ARstatus').text('Loading...');
jQuery("#ARresult").load("$home/wp-content/plugins/ani-n-gin-anime-recommendation-system/ani-n-gin-widget-hook.php", {
nick: jQuery("#ARnick").val(),
}, function(){
jQuery('#ARstatus').text('Done.');
jQuery('#ARresult').slideDown("slow");
ARused = 1
});}});});
Insert MyAnimeList nick to get suggestions on which anime to watch:
Online and ready.
RESULT;
/* After widget (defined by themes). */
echo $after_widget;
}
function update( $new_instance, $old_instance ) {
$instance = $old_instance;
/* Strip tags (if needed) and update the widget settings. */
$instance['title'] = strip_tags( $new_instance['title'] );
return $instance;
}
function form( $instance ) {
/* Set up some default widget settings. */
$defaults = array( 'title' => 'aNi-N-gin');
$instance = wp_parse_args( (array) $instance, $defaults ); ?>