diff --git a/index.php b/index.php index a5d49bc..353efc1 100644 --- a/index.php +++ b/index.php @@ -3,7 +3,7 @@ Plugin Name: PoiLive2D Enhanced Plugin URI: https://github.com/wanghaiwei/PoiLive2d-Enhanced Description: 萌萌哒WordPress看板娘耶! -Version: 2.0.1 +Version: 2.0.2 Author: 墨笙 Author URI: https://rayfalling.com License: GPL2 @@ -53,7 +53,8 @@ function poilive2d_pluginoptions_page() { 'live2d_special_tip' => 'checked', 'live2d_localkoto' => '', 'live2d_catalog' => 'checked', - 'live2d_position' => 'checked' + 'live2d_position' => 'checked', + 'live2d_nav-offset' => 0 ); //写入默认设置 @@ -61,19 +62,22 @@ function poilive2d_pluginoptions_page() { update_option( 'live2d_maincolor', $live2d_setting_default['maincolor'] ); } if ( ! get_option( 'live2d_hitokoto' ) ) { - update_option( 'live2d_hitokoto', $live2d_setting_default['live2d_hitokoto'] ); + update_option( 'live2d_hitokoto', $live2d_setting_default['live2d_hitokoto'] ); } if ( ! get_option( 'live2d_special_tip' ) ) { - update_option( 'live2d_special_tip', $live2d_setting_default['live2d_special_tip'] ); + update_option( 'live2d_special_tip', $live2d_setting_default['live2d_special_tip'] ); } if ( ! get_option( 'live2d_localkoto' ) ) { - update_option( 'live2d_localkoto',$live2d_setting_default['live2d_localkoto'] ); + update_option( 'live2d_localkoto', $live2d_setting_default['live2d_localkoto'] ); } if ( ! get_option( 'live2d_catalog' ) ) { - update_option( 'live2d_catalog', $live2d_setting_default['live2d_catalog'] ); + update_option( 'live2d_catalog', $live2d_setting_default['live2d_catalog'] ); } if ( ! get_option( 'live2d_position' ) ) { - update_option( 'live2d_position', $live2d_setting_default['live2d_position'] ); + update_option( 'live2d_position', $live2d_setting_default['live2d_position'] ); +} +if ( ! get_option( 'live2d_nav-offset' ) ) { + update_option( 'live2d_nav-offset', $live2d_setting_default['live2d_nav-offset'] ); } if ( ! get_option( 'live2d_custommsg' ) ) { $json = "{\"mouseover\":[{\"selector\":\".entry-content a\",\"text\":[\"要看看 「{text}」 么?\"]},{\"selector\":\".post .post-title\",\"text\":[\"主人写的爽文 「{text}」 ,要看看嘛?\"]},{\"selector\":\".feature-content a\",\"text\":[\"超级热门的 「{text}」 ,要看看么?\"]},{\"selector\":\".searchbox\",\"text\":[\"在找什么东西呢,需要帮忙吗?\"]},{\"selector\":\".top-social\",\"text\":[\"这里是主人的社交账号啦!不关注一波嘛?\"]},{\"selector\":\".zilla-likes\",\"text\":[\"听说点这个主人会很开心哦~\"]},{\"selector\":\".cd-top\",\"text\":[\"你想要返回顶部嘛?\"]},{\"selector\":\".site-title\",\"text\":[\"你要返回首页是吗?\"]},{\"selector\":\".comments\",\"text\":[\"看了这么久,是时候评论一下啦!\"]},{\"selector\":\".post-nepre.previous\",\"text\":[\"看看主人的上一篇文章怎么样?\"]},{\"selector\":\".post-nepre.next\",\"text\":[\"看看主人的下一篇文章怎么样?\"]},{\"selector\":\".reward-open\",\"text\":[\"你看主人把我扔在这么慢的服务器上,打赏了解一下?\"]},{\"selector\":\".poiplay.playing\",\"text\":[\"这是播放按钮啦~\"]},{\"selector\":\".poi-open-list\",\"text\":[\"戳一下就可以看到歌词哦!\"]},{\"selector\":\"#open-poi-player\",\"text\":[\"听说点这个按钮可以显示/隐藏播放器?\"]},{\"selector\":\".hide-button\",\"text\":[\"我有话唠属性,觉得我烦可以关掉我哦~\"]},{\"selector\":\"#pagination\",\"text\":[\"想看看更久远的内容?\"]}],\"click\":[{\"selector\":\"#landlord #live2d\",\"text\":[\"不要动手动脚的!快把手拿开~~\",\"真…真的是不知羞耻!\",\"Hentai!\",\"再摸的话我可要报警了!⌇●﹏●⌇\",\"110吗,这里有个变态一直在摸我(ó﹏ò。)\"]}]}"; diff --git a/live2d/js/message.js.php b/live2d/js/message.js.php index a667074..ebf6e6e 100644 --- a/live2d/js/message.js.php +++ b/live2d/js/message.js.php @@ -8,26 +8,20 @@ echo 'const message_Path = "' . LIVE2D_URL . '/live2d/";'; echo 'const home_Path = "' . home_url() . '/";'; -if ( get_option( 'live2d_nohitokoto' ) == "checked" ) { - $noHitoKoto = 'true'; -// echo "let nohitokoto = true;"; -} else { +if ( get_option( 'live2d_hitokoto' ) == "checked" ) { $noHitoKoto = 'false'; -// echo "let nohitokoto = false;"; -} -if ( get_option( 'live2d_nospecialtip' ) == "checked" ) { - $noSpecialTip = 'true'; -// echo "let nospecialtip = true;"; } else { + $noHitoKoto = 'true'; +} +if ( get_option( 'live2d_special_tip' ) == "checked" ) { $noSpecialTip = 'false'; -// echo "let nospecialtip = false;"; +} else { + $noSpecialTip = 'true'; } if ( get_option( 'live2d_localkoto' ) == "checked" ) { $localKoto = 'true'; -// echo "let localkoto = true;"; } else { $localKoto = 'false'; -// echo "let localkoto = false;"; } ?> @@ -207,17 +201,33 @@ function hideMessage(timeout) { } function positionWrap() { - $('.h2wrap, .h3wrap').click(function () { + $('.h2wrap, .h3wrap .h4wrap').click(function () { if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) { let $target = $(this.hash); $target = $target.length && $target || $('[name=' + this.hash.slice(1) + ']'); if ($target.length) { const targetOffset = $target.offset().top; + + + $('html,body').animate({ + scrollTop: targetOffset - 32 - + }, 800); + + $('html,body').animate({ + scrollTop: targetOffset - 32 - $('nav').height() == undefined ? 0 : $('nav').height() + }, 800); + + + + $('html,body').animate({ + scrollTop: targetOffset - + }, 800); + $('html,body').animate({ - scrollTop: targetOffset - }, - 800); - return false; + scrollTop: targetOffset - $('nav').height() == undefined ? 0 : $('nav').height() + }, 800); + + } } }); diff --git a/option.php b/option.php index e0bae44..b5e96e2 100644 --- a/option.php +++ b/option.php @@ -1,8 +1,11 @@

设置已成功保存

'; + if ( live2d_options_update() ) { + echo '

设置已成功保存

'; + } else { + echo '

设置更新失败

'; + } } ?>