Ticket #952 -> En el inicio, escribir comentarios sin cambiar de página

git-svn-id: https://192.168.0.254/svn/Proyectos.ASong2U_Web/trunk@99 cd1a4ea2-8c7f-e448-aada-19d1fee9e1d6
This commit is contained in:
David Arranz 2012-08-09 21:17:11 +00:00
parent da4099022e
commit 135df5fa47
9 changed files with 398 additions and 317 deletions

View File

@ -1,205 +0,0 @@
<?php
// Do not delete these lines
if (!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
die ('Please do not load this page directly. Thanks!');
if(post_password_required()) { ?>
<?php
return;
}
?>
<?php
/*************************** Comment Template ***************************/
global $current_user, $gp_settings;
require(ghostpool_inc . 'options.php');
if($gp_settings['user_comments'] == "One Comment") {
$comment_number = "1";
} else {
$comment_number = "999999999";
}
$args = array('post_id' => $post->ID, 'user_id' => $current_user->ID);
$usercomment = get_comments($args);
function comment_template($comment, $args, $depth) {
$GLOBALS['comment'] = $comment;
global $post, $gp_settings;
require(ghostpool_inc . 'options.php');
?>
<li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">
<div id="comment-<?php comment_ID() ?>" class="comment-box">
<div class="comment-avatar">
<?php echo get_avatar($comment,$size='32'); ?>
</div>
<div class="comment-meta">
<span class="comment-author">
<?php printf(__('%s', 'gp_lang'), comment_author_link()) ?>
</span>
<span class="post-author">(<?php _e('Author', 'gp_lang'); ?>)</span>
<div class="clear"></div>
<div class="comment-date">
<?php comment_time(get_option('date_format')); ?>, <?php comment_time(get_option('time_format')); ?>
</div>
<div class="reply-link">&nbsp;&nbsp;/&nbsp;
<?php comment_reply_link(array_merge($args, array('reply_text' => __('Reply', 'gp_lang').' &rarr;', 'add_below' => 'comment', 'depth' => $depth, 'max_depth' => $args['max_depth']))); ?>
</div>
</div>
<?php if(defined("STARRATING_INSTALLED")) { ?>
<div class="comment-user-score">
<?php wp_gdsr_comment_integrate_standard_result(get_comment_ID(), '', 16); ?>
</div>
<?php } ?>
<div class="clear"></div>
<div class="comment-text">
<?php comment_text(); ?>
<?php if($comment->comment_approved == '0') { ?>
<div class="moderation">
<?php _e('Your comment is awaiting moderation.', 'gp_lang'); ?>
</div>
<?php } ?>
</div>
<?php if(defined('STARRATING_INSTALLED') && $gp_settings['post_type'] == "Review" && $gp_settings['comment_thumbs'] == "Users can rate other comments") {
wp_gdsr_render_comment_thumbs(48, 0, '');
// Calls GDSR Data
//if(defined('STARRATING_INSTALLED')) { $gp_gdsrc = wp_gdsr_rating_comment(); }
?>
<!--<div class="thumb-rating">
<div class="left"><?php //echo $gp_gdsrc->thumb_votes; ?> found this helpful</div>
<div class="right">
<div class="left">Was this review helpful?</div>
<?php //wp_gdsr_render_comment_thumbs(); ?>
</div>
</div><div class="clear"></div>-->
<?php } ?>
</div>
<?php } ?>
<!--Begin Comments-->
<?php if('open' == $post->comment_status OR have_comments()) { ?>
<div id="comments">
<h3 class="comments"><?php comments_number(__('No Comments', 'gp_lang'), __('1 Comment', 'gp_lang'), __('% Comments', 'gp_lang')); ?></h3>
<?php } ?>
<?php if(have_comments()) { // If there are comments ?>
<ol id="commentlist">
<?php wp_list_comments('callback=comment_template'); ?>
</ol>
<?php $total_pages = get_comment_pages_count(); if($total_pages > 1) { ?>
<div class="wp-pagenavi"><?php paginate_comments_links(); ?></div>
<?php } ?>
<?php if('open' == $post->comment_status) { // If comments are open, but there are no comments yet ?>
<?php } else { // If comments are closed ?>
<strong><?php _e('Comments are now closed on this post.', 'gp_lang'); ?></strong>
<?php } ?>
<?php } else { // If there are no comments yet ?>
<?php } ?>
<?php if('open' == $post->comment_status) { ?>
<!--Begin Comment Form-->
<div id="commentform"<?php if(count($usercomment) >= $comment_number) { ?> class="hidden"<?php } ?>>
<!--Begin Respond-->
<div id="respond">
<h3><?php comment_form_title(__('Make a comment', 'gp_lang'), __('Respond to %s', 'gp_lang')); ?> <?php cancel_comment_reply_link(__('Cancel Reply', 'gp_lang')); ?></h3>
<?php if(get_option('comment_registration') && !$user_ID) { ?>
<p><?php _e('You must be logged in to post a comment.', 'gp_lang'); ?></p>
<?php } else { ?>
<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post">
<?php if(defined('STARRATING_INSTALLED') && $gp_settings['post_type'] == "Review" && ($gp_settings['user_voting'] == "Vote with or without posting a comment" OR $gp_settings['user_voting'] == "Vote only when posting a comment")) { ?>
<div class="comment-score">
<div class="comment-score-title"><?php _e('Rate This Item', 'gp_lang'); ?></div>
<div class="comment-score-stars">
<?php wp_gdsr_comment_integrate_standard_rating(); ?>
</div>
</div>
<?php } ?>
<?php if ($user_ID) {} else { ?>
<p><input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="22" tabindex="1" <?php if ($req) echo "aria-required='true'"; ?> /> <label for="author"><?php _e('Name', 'gp_lang'); ?> <span class="required"><?php if ($req) echo "*"; ?></span></label></p>
<p><input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="22" tabindex="2" <?php if ($req) echo "aria-required='true'"; ?> /> <label for="email"><?php _e('Email', 'gp_lang'); ?> <span class="required"><?php if ($req) echo "*"; ?></span></label></p>
<p><input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="22" tabindex="3" /> <label for="url"><?php _e('Website', 'gp_lang'); ?></label></p>
<?php } ?>
<p><textarea name="comment" id="comment" cols="5" rows="7" tabindex="4"></textarea></p>
<input name="submit" type="submit" id="submit" tabindex="5" value="<?php _e('Post', 'gp_lang'); ?> &rarr;" />
<?php comment_id_fields(); ?>
<?php do_action('comment_form', $post->ID); ?>
</form>
<?php } ?>
</div>
<!--End Respond-->
</div>
<!--End Comment Form-->
<?php } ?>
<?php if(count($usercomment) >= $comment_number) { ?>
<div class="clear"></div>
<strong><?php _e('You have already reviewed this item.', 'gp_lang'); ?></strong>
<?php } ?>
<?php if('open' == $post->comment_status OR have_comments()) { ?>
</div>
<?php } ?>
<!--End Comments-->

View File

@ -64,6 +64,12 @@ require(ghostpool_inc . 'options.php');
</div>
<?php if(defined("STARRATING_INSTALLED")) { ?>
<div class="comment-user-score">
<?php wp_gdsr_comment_integrate_standard_result(get_comment_ID(), '', 16); ?>
</div>
<?php } ?>
<div class="clear"></div>
<div class="comment-text">
@ -75,70 +81,126 @@ require(ghostpool_inc . 'options.php');
<?php } ?>
</div>
<?php if(defined('STARRATING_INSTALLED') && $gp_settings['post_type'] == "Review" && $gp_settings['comment_thumbs'] == "Users can rate other comments") {
wp_gdsr_render_comment_thumbs(48, 0, '');
// Calls GDSR Data
//if(defined('STARRATING_INSTALLED')) { $gp_gdsrc = wp_gdsr_rating_comment(); }
?>
<!--<div class="thumb-rating">
<div class="left"><?php //echo $gp_gdsrc->thumb_votes; ?> found this helpful</div>
<div class="right">
<div class="left">Was this review helpful?</div>
<?php //wp_gdsr_render_comment_thumbs(); ?>
</div>
</div><div class="clear"></div>-->
<?php } ?>
</div>
<?php } ?>
<!--Begin Comments-->
<?php if('open' == $post->comment_status OR have_comments()) { ?>
<div id="comments">
<h3 class="comments"><?php comments_number(__('No Comments', 'gp_lang'), __('1 Comment', 'gp_lang'), __('% Comments', 'gp_lang')); ?></h3>
<?php } ?>
<div id="comments">
<?php if('open' == $post->comment_status OR have_comments()) : ?>
<h3 class="comments"><?php comments_number(__('No Comments', 'gp_lang'), __('1 Comment', 'gp_lang'), __('% Comments', 'gp_lang')); ?></h3>
<ol class="commentlist" id="commentlist">
<?php wp_list_comments('callback=comment_template'); ?>
</ol>
<?php if(have_comments()) { // If there are comments ?>
<ol id="commentlist" class="commentlist">
<?php wp_list_comments('callback=comment_template'); ?>
</ol>
<?php $total_pages = get_comment_pages_count(); if($total_pages > 1) { ?>
<div class="wp-pagenavi"><?php paginate_comments_links(); ?></div>
<?php } ?>
<?php else : // this is displayed if there are no comments so far ?>
<?php if('open' == $post->comment_status) { // If comments are open, but there are no comments yet ?>
<?php } else { // If comments are closed ?>
<strong><?php _e('Comments are now closed on this post.', 'gp_lang'); ?></strong>
<?php } ?>
<?php } else { // If there are no comments yet ?>
<ol id="commentlist" class="commentlist">
</ol>
<?php } ?>
<?php if('open' == $post->comment_status) { ?>
<!--Begin Comment Form-->
<div <?php if(count($usercomment) >= $comment_number) { ?> class="hidden"<?php } ?>>
<!--Begin Respond-->
<div id="respond">
<h3><?php comment_form_title(__('Make a comment', 'gp_lang'), __('Respond to %s', 'gp_lang')); ?> <?php cancel_comment_reply_link(__('Cancel Reply', 'gp_lang')); ?></h3>
<?php if ( comments_open() ) : ?>
<!-- If comments are open, but there are no comments. -->
<?php if(get_option('comment_registration') && !$user_ID) { ?>
<p><?php _e('You must be logged in to post a comment.', 'gp_lang'); ?></p>
<?php } else { ?>
<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform" class="commentform">
<?php else : // comments are closed ?>
<!-- If comments are closed. -->
<p class="nocomments"><?php _e('Comments are closed.'); ?></p>
<?php if(defined('STARRATING_INSTALLED') && $gp_settings['post_type'] == "Review" && ($gp_settings['user_voting'] == "Vote with or without posting a comment" OR $gp_settings['user_voting'] == "Vote only when posting a comment")) { ?>
<div class="comment-score">
<div class="comment-score-title"><?php _e('Rate This Item', 'gp_lang'); ?></div>
<div class="comment-score-stars">
<?php wp_gdsr_comment_integrate_standard_rating(); ?>
</div>
</div>
<?php } ?>
<?php if ($user_ID) {} else { ?>
<p><input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="22" tabindex="1" <?php if ($req) echo "aria-required='true'"; ?> /> <label for="author"><?php _e('Name', 'gp_lang'); ?> <span class="required"><?php if ($req) echo "*"; ?></span></label></p>
<p><input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="22" tabindex="2" <?php if ($req) echo "aria-required='true'"; ?> /> <label for="email"><?php _e('Email', 'gp_lang'); ?> <span class="required"><?php if ($req) echo "*"; ?></span></label></p>
<p><input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="22" tabindex="3" /> <label for="url"><?php _e('Website', 'gp_lang'); ?></label></p>
<?php } ?>
<p><textarea name="comment" id="comment" cols="5" rows="7" tabindex="4"></textarea></p>
<input name="submit" type="submit" id="submit" tabindex="5" value="<?php _e('Post', 'gp_lang'); ?> &rarr;" />
<?php comment_id_fields(); ?>
<?php do_action('comment_form', $post->ID); ?>
</form>
<?php } ?>
</div>
<!--End Respond-->
</div>
<!--End Comment Form-->
<?php } ?>
<?php endif; ?>
<?php endif; ?>
</div>
<?php if ( comments_open() ) : ?>
<div id="respond">
<h3><?php comment_form_title( __('Make a comment'), __('Respond to %s' ) ); ?></h3>
<div id="cancel-comment-reply">
<small><?php cancel_comment_reply_link() ?></small>
</div>
<?php if(get_option('comment_registration') && !$user_ID) : ?>
<p><?php _e('You must be logged in to post a comment.', 'gp_lang'); ?></p>
<?php else : ?>
<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
<?php if ( is_user_logged_in() ) : ?>
<p><?php printf(__('Logged in as <a href="%1$s">%2$s</a>.'), get_option('siteurl') . '/wp-admin/profile.php', $user_identity); ?> <a href="<?php echo wp_logout_url(get_permalink()); ?>" title="<?php esc_attr_e('Log out of this account'); ?>"><?php _e('Log out &raquo;'); ?></a></p>
<?php else : ?>
<p><input type="text" name="author" id="author" value="<?php echo esc_attr($comment_author); ?>" size="22" tabindex="1" <?php if ($req) echo "aria-required='true'"; ?> />
<label for="author"><small><?php _e('Name'); ?> <?php if ($req) _e('(required)'); ?></small></label></p>
<p><input type="text" name="email" id="email" value="<?php echo esc_attr($comment_author_email); ?>" size="22" tabindex="2" <?php if ($req) echo "aria-required='true'"; ?> />
<label for="email"><small><?php _e('Mail (will not be published)'); ?> <?php if ($req) _e('(required)'); ?></small></label></p>
<p><input type="text" name="url" id="url" value="<?php echo esc_attr($comment_author_url); ?>" size="22" tabindex="3" />
<label for="url"><small><?php _e('Website'); ?></small></label></p>
<?php endif; ?>
<!--<p><small><?php printf(__('<strong>XHTML:</strong> You can use these tags: <code>%s</code>'), allowed_tags()); ?></small></p>-->
<p><textarea name="comment" id="comment" cols="58" rows="10" tabindex="4"></textarea></p>
<p><input name="submit" type="submit" id="submit" tabindex="5" value="<?php esc_attr_e('Submit Comment'); ?>" />
<?php comment_id_fields(); ?>
</p>
<?php do_action('comment_form', $post->ID); ?>
</form>
<div class="clear"></div>
<?php endif; // If registration required and not logged in ?>
</div>
<?php endif; // if you delete this the sky will fall on your head ?>
<?php if(count($usercomment) >= $comment_number) { ?>
<div class="clear"></div>
<strong><?php _e('You have already reviewed this item.', 'gp_lang'); ?></strong>
<?php } ?>
<?php if('open' == $post->comment_status OR have_comments()) { ?>
</div>
<?php } ?>
<!--End Comments-->

View File

@ -212,7 +212,7 @@ function gp_enqueue_scripts() {
//wp_enqueue_script('jqueryui', 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js', array('jquery'));
if (is_singular())
if (is_singular() OR is_home() OR is_front_page())
wp_enqueue_script('comment-reply');
wp_enqueue_script('swfobject', 'http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js');

View File

@ -11,9 +11,13 @@
<!--[if IE 7]><link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/lib/css/style-ie7.css" media="screen" /><![endif]-->
<!--[if lte IE 8 ]><link rel="stylesheet" type="text/css" href="<?php echo get_template_directory_uri(); ?>/lib/scripts/videoslider/css/ie.css" /><![endif]-->
<?php require(ghostpool_scripts . 'custom.php'); ?>
<?php require(ghostpool_scripts . 'custom.php'); ?>
<?php require(ghostpool_inc . 'page-styling.php'); ?>
<?php if (is_home() OR is_front_page()) : ?>
<?php require(ghostpool_scripts . 'comment-home.php'); ?>
<?php endif; ?>
</head>
<?php if(is_search()) : $gp_settings['skin'] .= ' bp-wrapper'; endif; ?>

View File

@ -14,7 +14,7 @@ if (post_password_required()) {
<?php
/* * ************************* Comment Template ************************** */
global $current_user, $gp_settings;
global $current_user, $gp_settings, $post, $user_identity;
require(ghostpool_inc . 'options.php');
$comment_array = array_reverse(get_approved_comments(get_the_ID()));
@ -64,44 +64,44 @@ $count = 1;
<?php endif; ?>
</div>
<?php } else { ?>
<?php if ( comments_open() ) : ?>
<div id="respond" class="homepage">
<h3><?php comment_form_title( __('Make a comment'), __('Respond to %s' ) ); ?></h3>
<div id="cancel-comment-reply">
<small><?php cancel_comment_reply_link() ?></small>
</div>
<?php if(get_option('comment_registration') && !$user_ID) : ?>
<p><?php _e('You must be logged in to post a comment.', 'gp_lang'); ?></p>
<?php else : ?>
<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform" class="commentform">
<?php if ( is_user_logged_in() ) : ?>
<div id="respond" class="homepage">
<h3><?php comment_form_title( __('Make a comment'), __('Respond to %s' ) ); ?></h3>
<div id="cancel-comment-reply">
<small><?php cancel_comment_reply_link() ?></small>
<p><?php printf(__('Logged in as <a href="%1$s">%2$s</a>.'), get_option('siteurl') . '/wp-admin/profile.php', $user_identity); ?> <a href="<?php echo wp_logout_url(get_permalink()); ?>" title="<?php esc_attr_e('Log out of this account'); ?>"><?php _e('Log out &raquo;'); ?></a></p>
<?php else : ?>
<p><input type="text" name="author" id="author" value="<?php echo esc_attr($comment_author); ?>" size="22" tabindex="1" <?php if ($req) echo "aria-required='true'"; ?> />
<label for="author"><small><?php _e('Name'); ?> <?php if ($req) _e('(required)'); ?></small></label></p>
<p><input type="text" name="email" id="email" value="<?php echo esc_attr($comment_author_email); ?>" size="22" tabindex="2" <?php if ($req) echo "aria-required='true'"; ?> />
<label for="email"><small><?php _e('Mail (will not be published)'); ?> <?php if ($req) _e('(required)'); ?></small></label></p>
<p><input type="text" name="url" id="url" value="<?php echo esc_attr($comment_author_url); ?>" size="22" tabindex="3" />
<label for="url"><small><?php _e('Website'); ?></small></label></p>
<?php endif; ?>
<p><textarea name="comment" id="comment" cols="58" rows="5" tabindex="4"></textarea></p>
<p><input name="submit" type="submit" class="submit" id="submit" tabindex="5" value="<?php esc_attr_e('Submit Comment'); ?>" />
<?php comment_id_fields(); ?>
</p>
<?php do_action('comment_form', $post->ID); ?>
</form>
<div class="clear"></div>
<?php endif; // If registration required and not logged in ?>
</div>
<?php if(get_option('comment_registration') && !$user_ID) : ?>
<p><?php _e('You must be logged in to post a comment.', 'gp_lang'); ?></p>
<?php else : ?>
<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform" class="commentform">
<?php if ( is_user_logged_in() ) : ?>
<p><?php printf(__('Logged in as <a href="%1$s">%2$s</a>.'), get_option('siteurl') . '/wp-admin/profile.php', $user_identity); ?> <a href="<?php echo wp_logout_url(get_permalink()); ?>" title="<?php esc_attr_e('Log out of this account'); ?>"><?php _e('Log out &raquo;'); ?></a></p>
<?php else : ?>
<p><input type="text" name="author" id="author" value="<?php echo esc_attr($comment_author); ?>" size="22" tabindex="1" <?php if ($req) echo "aria-required='true'"; ?> />
<label for="author"><small><?php _e('Name'); ?> <?php if ($req) _e('(required)'); ?></small></label></p>
<p><input type="text" name="email" id="email" value="<?php echo esc_attr($comment_author_email); ?>" size="22" tabindex="2" <?php if ($req) echo "aria-required='true'"; ?> />
<label for="email"><small><?php _e('Mail (will not be published)'); ?> <?php if ($req) _e('(required)'); ?></small></label></p>
<p><input type="text" name="url" id="url" value="<?php echo esc_attr($comment_author_url); ?>" size="22" tabindex="3" />
<label for="url"><small><?php _e('Website'); ?></small></label></p>
<?php endif; ?>
<p><textarea name="comment" id="comment" cols="58" rows="5" tabindex="4"></textarea></p>
<p><input name="submit" type="button" class="submit" id="submit" tabindex="5" value="<?php esc_attr_e('Submit Comment'); ?>" />
<?php comment_id_fields(); ?>
</p>
<?php do_action('comment_form', $post->ID); ?>
</form>
<div class="clear"></div>
<?php endif; // If registration required and not logged in ?>
</div>
<?php endif; ?>
<?php } ?>

View File

@ -0,0 +1,199 @@
<script>
var pager = null;
var cPager = null;
var prev = null;
var next = null;
var moreFront = null;
var moreEnd = null;
var commentlist = null;
var respond = null;
var message = null;
var list = null;
var totalCom = null;
var textarea = null;
var comments_per_page = '3';
var comPerPage = comments_per_page;
var currentPage=0, number, numPerPage, totalPage, reply;
function getTotal(comlist){
list = comlist.children();
totalCom = list.length;
totalPage = Math.ceil(totalCom/comPerPage);
}
function pagination(){
getTotal(commentlist);
numPerPage = parseInt(comments_per_page, 10);
if (totalPage < numPerPage) numPerPage = totalPage;
moreFront.add(moreEnd).empty();
pager.empty().insertAfter(commentlist);
if (comPerPage < totalCom) {
for (var i = 0; i < totalPage; i++) {
jQuery('<span class="page-number"></span>').text(i+1).bind('click',{ newPage:i }, function(event){
currentPage = event.data['newPage'];
number.eq(currentPage).addClass('currentPager').siblings().removeClass('currentPager');
rePagCom();
rePager();
}).appendTo(pager);
}
//select a set of page-numbers for later uses
number = pager.find('span.page-number');
//if there are more page-numbers front
jQuery('<span class="yjl-more"></span>').appendTo(moreFront).text('1').click(function(){number.eq(0).trigger('click');});
moreFront.append(' ... ').prependTo(pager);
prev.prependTo(pager).click(function(){
if ( currentPage > 0 ) number.eq(currentPage).prev().trigger('click');
});
moreEnd.append(' ... ').appendTo(pager);
jQuery('<span class="yjl-more"></span>').appendTo(moreEnd).text(totalPage + '').click(function(){number.eq(totalPage-1).trigger('click');});
next.appendTo(pager).click(function(){
if ( currentPage < totalPage - 1 ) number.eq(currentPage).next().trigger('click');
});
rePager();
rePagCom();
}
}//end of pagination function
/*
*repage all comments
*/
function rePagCom(){
list.hide().slice(currentPage * comPerPage, (currentPage+1) * comPerPage).fadeIn();
}
/*
*show and hide page-numbers
*/
function rePager(){
number.eq(currentPage).addClass('currentPager');
if(currentPage<(numPerPage+1)/2){
number.hide().slice(0,numPerPage).show();
}
else if(currentPage+1>totalPage-(numPerPage+1)/2){
number.hide().slice(totalPage-numPerPage,totalPage+1).show();
}
else{
number.hide().slice(currentPage-(numPerPage-1)/2 ,currentPage+(numPerPage-1)/2+1).show();
}
if(currentPage==0) prev.removeClass('yjl-prev').addClass('gray');
else prev.addClass('yjl-prev').removeClass('gray');
if(currentPage==totalPage-1) next.removeClass('yjl-next').addClass('gray');
else next.addClass('yjl-next').removeClass('gray');
if(currentPage + (numPerPage - 1) / 2 < totalPage - 1 && numPerPage != totalPage)
moreEnd.show();
else
moreEnd.hide();
if(currentPage - (numPerPage - 1) / 2 > 0 && numPerPage != totalPage)
moreFront.show();
else
moreFront.hide();
//cPager.insertAfter(commentlist).empty().append(pager.children().clone(true));
}
function init_comments() {
message = jQuery('.yjl-mes');
if (!message) {
message=jQuery('<span class="yjl-mes"></span>').appendTo("#commentform");
}
respond=jQuery('#respond');
textarea=respond.find('#comment').attr('rows','4');
commentlist=jQuery('.commentlist');
pager = jQuery('<div class="yjl-pager"></div>');
cPager = jQuery('<div class="yjl-pager"></div>');
prev = jQuery('<span class="yjl-prev">'+ 'Prev' + '</span>');
next = jQuery('<span class="yjl-next">'+ 'Next' + '</span>');
moreFront = jQuery('<span></span>');
moreEnd = jQuery('<span></span>');
list = commentlist.children();
totalCom = list.length;
comPerPage = parseInt(comments_per_page, 10);
pagination();
}
function prepare_new_comment_home() {
//track a reply comment
jQuery('.comment-reply-link').live('click',function(){
reply=true;
});
var cancel=jQuery('#cancel-comment-reply-link').click(function(){
reply=false;
});
jQuery.ajax({
beforeSend:function(xhr){
xhr.setRequestHeader("If-Modified-Since","0");
message.empty().append('<img src="" alt="processing...">');
},
type:'post',
url:jQuery('#commentform').attr('action'),
data:jQuery('#commentform').serialize(),
dataType:'html',
error:function(xhr){
if(xhr.status==500){
message.empty().append(xhr.responseText.split('<p>')[1].split('</p>')[0]);
}
else if(xhr.status=='timeout'){
message.empty().append('Error:Server time out,try again!');
}
else{
message.empty().append('Please slow down,you are posting to fast!');
}
},
success:function(data){
message.empty().append('Thank you for your comment!');
newComList=jQuery(data).find('.commentlist');
if ( totalCom > 0 ) {
if (reply) cancel.trigger('click');
else {
getTotal(newComList);
currentPage = totalPage-1;
}
commentlist.prev().replaceWith(newComList.prev());
commentlist.replaceWith(newComList);
} else {
newComList.prev().andSelf().insertBefore(respond);
}
commentlist = newComList;
pagination();
textarea.val('');
}
});
textarea.autoResize({
// On resize:
onResize : function() {
jQuery(this).css({opacity:0.8});
},
// After resize:
animateCallback : function() {
jQuery(this).css({opacity:1});
},
// Quite slow animation:
animateDuration : 300,
// More extra space:
extraSpace : 20
});
}
</script>

View File

@ -103,6 +103,7 @@ function updateInfo() {
var from_to = jQuery('#postdata-from-to-' + id).html();
var artist = jQuery('#postdata-artist-' + id).html();
var song = jQuery('#postdata-song-' + id).html();
var link = jQuery('#postdata-link-' + id).html();
var comments = jQuery('#postdata-comments-' + id).html();
var nUrl = oUrl + 'id/' + the_id;
@ -135,7 +136,21 @@ function updateInfo() {
jQuery('#dedicationComments_container').slideUp(
'fast',
function() { jQuery('#dedicationComments_container').html(comments); }
//function() { jQuery('#dedicationComments_container').html(comments); }
function() {
jQuery('#dedicationComments_container').load(
link + ' #comments', '', function(data) {
init_comments();
jQuery('#dedicationComments_container').on('submit',
'#commentform',
function() {
prepare_new_comment_home();
return false;
}
)
}
);
}
);
jQuery('#dedicationComments_container').slideDown();
}
@ -156,6 +171,7 @@ function shrinkTitle()
textH1.style.fontSize -= 10+"px";
}
jQuery(window).ready(function() {
if (jQuery('#slider-wrapper')) {

View File

@ -1,24 +1,28 @@
<?php require('video-slider.php'); ?>
<?php
global $gp_settings;
<?php /* if($gp_settings['title'] == "Show") { ?><h1><?php the_title(); ?></h1><?php } */ ?>
$is_ajax = (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && (strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'));
if ($is_ajax) :
comments_template('');
endif;
<?php /* require_once('post-meta.php'); */ ?>
if (!$is_ajax) :
require('video-slider.php');
?>
<?php /* require_once('videoplayer.php'); */ ?>
<!--</div>-->
<div id="content">
<?php /* the_content(); */ ?>
<?php wp_link_pages('before=<div class="clear"></div><div class="wp-pagenavi post-navi">&pagelink=<span>%</span>&after=</div>'); ?>
<?php if ($gp_settings['author_info'] == "0") { ?><div class="clear"></div><?php echo do_shortcode('[author]');
} ?>
<?php if ($gp_settings['author_info'] == "0") { ?>
<div class="clear"></div><?php echo do_shortcode('[author]');
} ?>
<?php if ($gp_settings['related_items'] == "0") {
require('related-items.php');
} ?>
<?php comments_template(); ?>
<?php comments_template(); ?>
</div>
</div>
<?php endif; ?>

View File

@ -130,8 +130,9 @@ if (have_posts()) {
<span id="postdata-title-<?php echo $slide_counter; ?>"><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></span>
<span id="postdata-artist-<?php echo $slide_counter; ?>"><?php echo $gp_settings['artist']; ?></span>
<span id="postdata-song-<?php echo $slide_counter; ?>"><?php echo $gp_settings['song']; ?></span>
<span id="postdata-link-<?php echo $slide_counter; ?>"><?php the_permalink(); ?></span>
<span id="postdata-comments-<?php echo $slide_counter; ?>">
<?php require('home-comments.php'); ?>
<?php if (0) /*$_ishome)*/ require('home-comments.php'); ?>
</span>
<span id="postdata-from-to-<?php echo $slide_counter; ?>">
<?php echo $gp_settings['from_flag']; ?><span>FROM: <?php echo $gp_settings['from_user_link']; ?></span>&nbsp;