Fix comment reply for wp-5.2 & update to v3.1.6

This commit is contained in:
Mashiro 2019-02-23 23:32:04 +08:00
parent 36c0e88b20
commit 23570d7004
2 changed files with 12 additions and 2 deletions

View File

@ -7,7 +7,7 @@
* @package Sakura * @package Sakura
*/ */
define( 'SAKURA_VERSION', '3.1.5' ); define( 'SAKURA_VERSION', '3.1.6' );
define( 'BUILD_VERSION', '1' ); define( 'BUILD_VERSION', '1' );
define( 'JSDELIVR_VERSION', '3.6.7' ); define( 'JSDELIVR_VERSION', '3.6.7' );
@ -194,6 +194,7 @@ function sakura_scripts() {
$auto_height = akina_option('focus_height') ? 'fixed' : 'auto'; $auto_height = akina_option('focus_height') ? 'fixed' : 'auto';
$code_lamp = 'close'; $code_lamp = 'close';
if(wp_is_mobile()) $auto_height = 'fixed'; //拦截移动端 if(wp_is_mobile()) $auto_height = 'fixed'; //拦截移动端
version_compare( $GLOBALS['wp_version'], '5.1', '>=' ) ? $reply_link_version = 'new' : $reply_link_version = 'old';
wp_localize_script( 'app', 'Poi' , array( wp_localize_script( 'app', 'Poi' , array(
'pjax' => akina_option('poi_pjax'), 'pjax' => akina_option('poi_pjax'),
'movies' => $movies, 'movies' => $movies,
@ -201,7 +202,8 @@ function sakura_scripts() {
'codelamp' => $code_lamp, 'codelamp' => $code_lamp,
'ajaxurl' => admin_url('admin-ajax.php'), 'ajaxurl' => admin_url('admin-ajax.php'),
'order' => get_option('comment_order'), // ajax comments 'order' => get_option('comment_order'), // ajax comments
'formpostion' => 'bottom' // ajax comments 默认为bottom如果你的表单在顶部则设置为top。 'formpostion' => 'bottom', // ajax comments 默认为bottom如果你的表单在顶部则设置为top。
'reply_link_version' => $reply_link_version
)); ));
} }
add_action( 'wp_enqueue_scripts', 'sakura_scripts' ); add_action( 'wp_enqueue_scripts', 'sakura_scripts' );

View File

@ -158,6 +158,14 @@ try {
code_highlight_style(); code_highlight_style();
} catch (e) {} } catch (e) {}
if (Poi.reply_link_version == 'new'){
$('body').on('click','.comment-reply-link',function(){
addComment.moveForm( "comment-"+$(this).attr('data-commentid'), $(this).attr('data-commentid'), "respond", "1" );
console.log($(this).attr('data-commentid'));
return false;
});
}
function attach_image() { function attach_image() {
$('#upload-img-file').change(function () { $('#upload-img-file').change(function () {
if (this.files.length > 10) { if (this.files.length > 10) {