From e05ee031523544f3e8e80e850ce1e81eb8b72fab Mon Sep 17 00:00:00 2001 From: Mashiro Date: Sat, 16 Feb 2019 11:02:15 +0800 Subject: [PATCH] update to v3.1.4 --- cdn/theme/github.css | 2 +- comments.php | 8 +--- functions.php | 79 ++++++++++++++++++++++++++++++------ inc/css/dashboard-fix.css | 79 ++++++++++++++++++++++++++++++++++++ inc/css/dashboard-light.css | 80 ------------------------------------- style.css | 16 ++++++-- 6 files changed, 160 insertions(+), 104 deletions(-) create mode 100644 inc/css/dashboard-fix.css diff --git a/cdn/theme/github.css b/cdn/theme/github.css index 1edfbaf..3610a06 100644 --- a/cdn/theme/github.css +++ b/cdn/theme/github.css @@ -7,7 +7,7 @@ -webkit-text-size-adjust: 100%; line-height: 1.5; color: #24292e; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; + /*font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";*/ font-size: 16px; line-height: 1.5; word-wrap: break-word; diff --git a/comments.php b/comments.php index 631f008..cd78188 100644 --- a/comments.php +++ b/comments.php @@ -79,10 +79,6 @@
' . push_bili_smilies() . '
@@ -91,13 +87,13 @@ 'comment_notes_after' => '', 'comment_notes_before' => '', 'fields' => apply_filters( 'comment_form_default_fields', array( - 'avatar' => '
', + 'avatar' => '
', 'author' => '', 'email' => '', 'url' => - '' . $robot_comments . $private_ms , + '
' . $robot_comments . $private_ms , 'qq' => '' ) diff --git a/functions.php b/functions.php index 9293370..dc38880 100644 --- a/functions.php +++ b/functions.php @@ -7,7 +7,8 @@ * @package Sakura */ -define( 'SAKURA_VERSION', '3.1.3' ); +define( 'SAKURA_VERSION', '3.1.4' ); +define( 'BUILD_VERSION', '1' ); define( 'JSDELIVR_VERSION', '3.6.7' ); //ini_set('display_errors', true); @@ -1276,15 +1277,48 @@ function remove_dashboard () { add_action('admin_menu', 'remove_dashboard'); /** - * Filter the except length to 20 words. 限制摘要长度(似乎无效) + * Filter the except length to 20 words. 限制摘要长度 * * @param int $length Excerpt length. * @return int (Maybe) modified excerpt length. */ -function wpdocs_custom_excerpt_length( $length ) { - return 50; + +function GBsubstr($string, $start, $length) { + if (strlen($string) > $length) { + $str = null; + $len = 0; + $i = $start; + while ( $len < $length) { + if (ord(substr($string, $i, 1)) > 0xc0) { + $str .=substr($string, $i, 3); + $i+= 3; + }elseif (ord(substr($string, $i, 1)) > 0xa0) { + $str .= substr($string, $i, 2); + $i+= 2; + }else { + $str.=substr($string, $i, 1); + $i++; + } + $len ++; + } + return $str; + }else { + return $string; + } } -add_filter( 'excerpt_length', 'wpdocs_custom_excerpt_length', 999 ); + +function excerpt_length($exp) { + if (!function_exists(mb_substr)) { + $exp = GBsubstr($exp, 0, 80); + } else { + /* + * To use mb_substr() function, you should uncomment "extension=php_mbstring.dll" in php.ini + */ + $exp = mb_substr($exp, 0, 80); + } + return $exp; +} +add_filter( 'the_excerpt', 'excerpt_length' ); /* @@ -1302,6 +1336,7 @@ add_filter('site_url', 'wpadmin_filter', 10, 3); function admin_style() { wp_enqueue_style('admin-styles-fix-icon', get_site_url() . '/wp-includes/css/dashicons.css'); + wp_enqueue_style('cus-styles-light', get_site_url() . '/wp-content/themes/Sakura/inc/css/dashboard-fix.css'); if ( get_user_option( 'admin_color' ) == "light" ) { wp_enqueue_style('cus-styles-light', get_site_url() . '/wp-content/themes/Sakura/inc/css/dashboard-light.css'); } @@ -1309,11 +1344,22 @@ function admin_style() { add_action('admin_enqueue_scripts', 'admin_style'); function custom_register_admin_scripts() { - wp_enqueue_script( 'lazyload', 'https://cdn.jsdelivr.net/npm/lazyload@2.0.0-beta.2/lazyload.min.js' ); + wp_enqueue_script( 'lazyload', 'https://cdn.jsdelivr.net/npm/lazyload@2.0.0-beta.2/lazyload.min.js' ); } add_action( 'admin_enqueue_scripts', 'custom_register_admin_scripts' ); - +function custom_admin_js() { + echo ''; +} +add_action('admin_footer', 'custom_admin_js'); /* * 后台通知 @@ -1357,16 +1403,23 @@ function recommend_light() { if ( get_user_locale( get_current_user_id() ) == "ja-JP") { $msg = '管理画面の配色「ライト」を使用することをお勧めします。'; } - ?> -
-

-
-

'.$msg.'

'; + } } if ( get_user_option( 'admin_color' ) != "light" ) { - add_action( 'admin_notices', 'recommend_light' ); + add_action( 'admin_notices', 'recommend_light' ); } +function scheme_tip_dismissed() { + $user_id = get_current_user_id(); + if ( isset( $_GET['scheme-tip-dismissed'.BUILD_VERSION] ) ) + add_user_meta( $user_id, 'scheme-tip-dismissed'.BUILD_VERSION, 'true', true ); +} +add_action( 'admin_init', 'scheme_tip_dismissed' ); + // 阻止垃圾注册 add_action( 'register_post', 'codecheese_register_post', 10, 3 ); diff --git a/inc/css/dashboard-fix.css b/inc/css/dashboard-fix.css new file mode 100644 index 0000000..0face44 --- /dev/null +++ b/inc/css/dashboard-fix.css @@ -0,0 +1,79 @@ +/* emotion;*/ +/*bilibili*/ +.emotion-box { + padding-left: 16px; + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -ms-flex-direction: row; + flex-direction: row; + -ms-flex-wrap: wrap; + flex-wrap: wrap; + display: none; +} +.emotion-inline { + padding-left: 0px !important; + padding-right: 0px !important; +} +.emotion-item { + margin: 6px; + display: inline-block; + width: 32px; + height: 32px; + overflow: hidden; + border-radius: 4px; + margin-bottom: -8px; +} +.emotion-secter { + margin: 12px 12px 0 0; +} +@media (max-width: 860px) { + .emotion-box { + padding-left: 0; + } + .emotion-item { + transform: scale(0.6); + margin-bottom: -10px; + } + .emotion-secter { + margin: 0; + } +} + +.emotion-item .img { + -webkit-animation: im-emotion-step 1.08s steps(27) infinite; + animation: im-emotion-step 1.08s steps(27) infinite; + animation-duration: 1.08s; + animation-timing-function: steps(27); +} + +.emotion-item .img { + width: 32px; + height: 864px; + max-width: 32px; + background: top/32px no-repeat; + background-image: none; +} + +@-webkit-keyframes im-emotion-step { + 0% { + -webkit-transform:translateY(0); + transform:translateY(0) + } + to { + -webkit-transform:translateY(-100%); + transform:translateY(-100%) + } +} +@keyframes im-emotion-step { + 0% { + -webkit-transform:translateY(0); + transform:translateY(0) + } + to { + -webkit-transform:translateY(-100%); + transform:translateY(-100%) + } +} \ No newline at end of file diff --git a/inc/css/dashboard-light.css b/inc/css/dashboard-light.css index 005a9aa..a78e8da 100644 --- a/inc/css/dashboard-light.css +++ b/inc/css/dashboard-light.css @@ -72,84 +72,4 @@ tr { .wp-submenu .wp-submenu-wrap { background: #ffffff !important; -} - -// emotion; -/*bilibili*/ -.emotion-box { - padding-left: 16px; - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -webkit-box-orient: horizontal; - -webkit-box-direction: normal; - -ms-flex-direction: row; - flex-direction: row; - -ms-flex-wrap: wrap; - flex-wrap: wrap; - display: none; -} -.emotion-inline { - padding-left: 0px !important; - padding-right: 0px !important; -} -.emotion-item { - margin: 6px; - display: inline-block; - width: 32px; - height: 32px; - overflow: hidden; - border-radius: 4px; - margin-bottom: -8px; -} -.emotion-secter { - margin: 12px 12px 0 0; -} -@media (max-width: 860px) { - .emotion-box { - padding-left: 0; - } - .emotion-item { - transform: scale(0.6); - margin-bottom: -10px; - } - .emotion-secter { - margin: 0; - } -} - -.emotion-item .img { - -webkit-animation: im-emotion-step 1.08s steps(27) infinite; - animation: im-emotion-step 1.08s steps(27) infinite; - animation-duration: 1.08s; - animation-timing-function: steps(27); -} - -.emotion-item .img { - width: 32px; - height: 864px; - max-width: 32px; - background: top/32px no-repeat; - background-image: none; -} - -@-webkit-keyframes im-emotion-step { - 0% { - -webkit-transform:translateY(0); - transform:translateY(0) - } - to { - -webkit-transform:translateY(-100%); - transform:translateY(-100%) - } -} -@keyframes im-emotion-step { - 0% { - -webkit-transform:translateY(0); - transform:translateY(0) - } - to { - -webkit-transform:translateY(-100%); - transform:translateY(-100%) - } } \ No newline at end of file diff --git a/style.css b/style.css index e964e2e..9b77c9f 100644 --- a/style.css +++ b/style.css @@ -7505,7 +7505,6 @@ a.toc-link { .comment-user-avatar { position: absolute; display: inline-block; - float: left; width: 64px; height: 64px; margin-top: 10px; @@ -7547,7 +7546,7 @@ a.toc-link { padding-top: 10px; width: 45px; height: 55px; - right: 36px + right: 11% } .comment-user-avatar .socila-check { width: 1.5em; @@ -7563,7 +7562,16 @@ a.toc-link { display: inline-block; cursor: pointer } - +@media (min-width: 625px){ + .cmt-info-container { + width: 100%; + display: -webkit-flex; + display: flex; + flex-flow: row nowrap; + justify-content: space-between; + align-items: stretch + } +} .cmt-popup { margin: 0 0 40px 1%; --widthA: 97%; @@ -8228,7 +8236,7 @@ td.hljs-ln-numbers { } .control-btn-serif { - font-family: 'Noto Serif CJK SC', 'Noto Serif CJK', serif + font-family: 'Noto Serif SC', 'Source Han Serif SC', 'Source Han Serif', source-han-serif-sc, 'PT Serif', 'SongTi SC', 'MicroSoft Yahei', Georgia, serif } .control-btn-sans-serif {