feat: add bibibili bangumi support

Now you can display your bibibili bangumi status, note: the api is
unofficial, so may be abandoned in the future.
issue #209
pull/212/head
Spirit 2020-04-01 17:14:01 +08:00
parent 7437bfa456
commit 4210f97716
11 changed files with 599 additions and 212 deletions

View File

@ -32,6 +32,10 @@ add_action('rest_api_init', function () {
'methods' => 'GET',
'callback' => 'get_qq_avatar',
));
register_rest_route('sakura/v1', '/bangumi/bilibili', array(
'methods' => 'POST',
'callback' => 'bgm_bilibili',
));
});
/**
@ -422,3 +426,55 @@ function get_qq_avatar(){
}
}
}
function get_the_bgm_items($page = 1){
$cookies = akina_option('bilibili_cookie');
$url = 'https://api.bilibili.com/x/space/bangumi/follow/list?type=1&pn=' . $page . '&ps=15&follow_status=0&vmid=' . akina_option('bilibili_id');
$args = array(
'headers' => array(
'Cookie' => $cookies,
'Host' => 'api.bilibili.com',
'User-Agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97'
)
);
$response = wp_remote_get($url, $args);
$bgmdata = json_decode($response["body"])->data;
return json_encode($bgmdata);
}
function get_bgm_items($page = 1){
$bgm = json_decode(get_the_bgm_items($page),true);
$totalpage = $bgm["total"] / 15;
if($totalpage - $page < 0){
$next = '<span>共追番' . $bgm["total"] .'部,继续加油吧!٩(ˊᗜˋ*)و</span>';
}else{
$next = '<a class="bangumi-next" href="' . rest_url('sakura/v1/bangumi/bilibili') . '?page=' . ++$page . '"><i class="fa fa-bolt" aria-hidden="true"></i> NEXT </a>';
}
$lists = $bgm["list"];
foreach ((array)$lists as $list) {
preg_match('/看到第(\d+)话/m',$list['progress'], $matches);
$progress = is_numeric($matches[1]) ? $matches[1] : 0;
$html .= '<div class="column">
<a class="bangumi-item" href="https://bangumi.bilibili.com/anime/' . $list['season_id'] . '/" target="_blank" rel="nofollow">
<img class="bangumi-image" src="' . str_replace('http://', 'https://', $list['cover']) . '"/>
<div class="bangumi-info">
<h3 class="bangumi-title" title="' . $list['title'] . '">' . $list['title'] . '</h2>
<div class="bangumi-summary"> '. $list['evaluate'] .' </div>
<div class="bangumi-status">
<div class="bangumi-status-bar" style="width: '. $progress / $list['total_count'] * 100 .'%"></div>
<p>' . $list['new_ep']['index_show'] . '</p>
</div>
</div>
</a>
</div>';
}
$html .= '</div><br><div id="bangumi-pagination">' . $next .'</div>';
return $html;
}
function bgm_bilibili(){
$page = $_GET["page"] ?: 2;
$html = preg_replace("/\s+|\n+|\r/", ' ', get_bgm_items($page));
echo $html;
}

View File

@ -17,6 +17,7 @@ mashiro_global.ini = new function () {
coverVideoIni();
checkskinSecter();
scrollBar();
load_bangumi();
}
this.pjax = function () { // pjax reload functions (pjax 重载函数)
pjaxInit();
@ -25,6 +26,7 @@ mashiro_global.ini = new function () {
copy_code_block();
coverVideoIni();
checkskinSecter();
load_bangumi();
}
}
@ -1011,6 +1013,22 @@ setTimeout(function () {
activate_widget();
}, 100);
function load_bangumi() {
$('body').on('click', '#bangumi-pagination a', function () {
$("#bangumi-pagination a").addClass("loading").text("");
var xhr = new XMLHttpRequest();
xhr.open('POST', this.href, true);
xhr.onreadystatechange = function() {
if (xhr.readyState == 4 && xhr.status == 200) {
$("#bangumi-pagination").remove();
$(".row").append(xhr.responseText);
}
};
xhr.send();
return false;
});
}
mashiro_global.ini.normalize();
loadCSS(mashiro_option.jsdelivr_css_src);
loadCSS(mashiro_option.entry_content_theme_src);
@ -1796,6 +1814,9 @@ var home = location.href,
pc_to_top.onclick = function() {
topFunction();
}
mb_to_top.onclick = function() {
topFunction();
}
}
}
$(function () {

Binary file not shown.

View File

@ -1,8 +1,8 @@
msgid ""
msgstr ""
"Project-Id-Version: Sakura\n"
"POT-Creation-Date: 2020-03-29 00:39+0800\n"
"PO-Revision-Date: 2020-03-29 00:39+0800\n"
"POT-Creation-Date: 2020-04-01 17:10+0800\n"
"PO-Revision-Date: 2020-04-01 17:10+0800\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: en_US\n"
@ -222,7 +222,7 @@ msgstr ""
msgid "page %s "
msgstr ""
#: inc/api.php:304 inc/theme_plus.php:727
#: inc/api.php:308 inc/theme_plus.php:727
msgid "The comment is private"
msgstr ""
@ -923,7 +923,7 @@ msgstr ""
msgid "Whether to turn on the top-feature"
msgstr ""
#: options.php:446 options.php:1085
#: options.php:446 options.php:1097
msgid "Default on"
msgstr ""
@ -1429,118 +1429,139 @@ msgid ""
"(mobile device is invalid)"
msgstr ""
#: options.php:974
msgid "The categories of articles that don't not show on homepage"
#: options.php:973
msgid "Bilibili UID"
msgstr ""
#: options.php:975 options.php:982
msgid "Fill in category ID, multiple IDs are divided by a comma \",\""
#: options.php:974
msgid ""
"Fill in your UID, eg.https://space.bilibili.com/13972644/, only fill in with "
"the number part."
msgstr ""
#: options.php:980
msgid "Bilibili Cookie"
msgstr ""
#: options.php:981
msgid "Images category"
msgid ""
"Fill in your Cookies, go to your bilibili homepage, you can get cookies in "
"brownser network pannel with pressing F12. If left this blank, you'll not "
"get the progress."
msgstr ""
#: options.php:988
msgid "Statistics Interface"
#: options.php:986
msgid "The categories of articles that don't not show on homepage"
msgstr ""
#: options.php:987 options.php:994
msgid "Fill in category ID, multiple IDs are divided by a comma \",\""
msgstr ""
#: options.php:993
msgid "Images category"
msgstr ""
#: options.php:1000
msgid "Statistics Interface"
msgstr ""
#: options.php:1005
msgid ""
"WP-Statistics plugin (Professional statistics, can exclude invalid access)"
msgstr ""
#: options.php:994
#: options.php:1006
msgid "Theme built-in (simple statistics, calculate each page access request)"
msgstr ""
#: options.php:998
#: options.php:1010
msgid "Statistical data display format"
msgstr ""
#: options.php:1003
#: options.php:1015
msgid "23333 Views (default)"
msgstr ""
#: options.php:1004
#: options.php:1016
msgid "23,333 Views (britain)"
msgstr ""
#: options.php:1005
#: options.php:1017
msgid "23 333 Views (french)"
msgstr ""
#: options.php:1006
#: options.php:1018
msgid "23k Views (chinese)"
msgstr ""
#: options.php:1010
#: options.php:1022
msgid "Comment image upload API"
msgstr ""
#: options.php:1015
#: options.php:1027
msgid "Imgur (https://imgur.com)"
msgstr ""
#: options.php:1016
#: options.php:1028
msgid "SM.MS (https://sm.ms)"
msgstr ""
#: options.php:1017
#: options.php:1029
msgid "Chevereto (https://chevereto.com)"
msgstr ""
#: options.php:1021
#: options.php:1033
msgid "Imgur Client ID"
msgstr ""
#: options.php:1022
#: options.php:1034
msgid ""
"Register your application <a href=\"https://api.imgur.com/oauth2/addclient"
"\">here</a>, note we only need the Client ID here."
msgstr ""
#: options.php:1028
#: options.php:1040
msgid "SM.MS Secret Token"
msgstr ""
#: options.php:1029
#: options.php:1041
msgid ""
"Register your application <a href=\"https://sm.ms/home/apitoken\">here</a>."
msgstr ""
#: options.php:1035
#: options.php:1047
msgid "Chevereto API v1 key"
msgstr ""
#: options.php:1036
#: options.php:1048
msgid "Get your API key here: "
msgstr ""
#: options.php:1042
#: options.php:1054
msgid "Chevereto URL"
msgstr ""
#: options.php:1043
#: options.php:1055
msgid ""
"Your Chevereto homepage url, no slash in the end, eg. https://your.cherverto."
"com"
msgstr ""
#: options.php:1049
#: options.php:1061
msgid "Comment images proxy"
msgstr ""
#: options.php:1050
#: options.php:1062
msgid ""
"A front-ed proxy for the uploaded images. Leave it blank if you do not need."
msgstr ""
#: options.php:1056
#: options.php:1068
msgid "Imgur upload proxy"
msgstr ""
#: options.php:1057
#: options.php:1069
msgid ""
"A back-ed proxy to upload images. You may set a self hosted proxy with "
"Nginx, following my <a href=\"https://2heng.xin/2018/06/06/javascript-upload-"
@ -1550,151 +1571,151 @@ msgid ""
"a>】"
msgstr ""
#: options.php:1063
#: options.php:1075
msgid "Enable live search"
msgstr ""
#: options.php:1064
#: options.php:1076
msgid ""
"Real-time search in the foreground, call the Rest API to update the cache "
"every hour, you can manually set the cache time in functions.php"
msgstr ""
#: options.php:1070
#: options.php:1082
msgid "Include comments in live search"
msgstr ""
#: options.php:1071
#: options.php:1083
msgid ""
"Search for comments in real-time search (not recommended if there are too "
"many comments on the site)"
msgstr ""
#: options.php:1077
#: options.php:1089
msgid "Enable baguetteBox"
msgstr ""
#: options.php:1078
#: options.php:1090
msgid ""
"Default off<a href=\"https://github.com/mashirozx/Sakura/wiki/Fancybox"
"\">please read wiki</a>"
msgstr ""
#: options.php:1084
#: options.php:1096
msgid "Enable lazyload in posts"
msgstr ""
#: options.php:1091
#: options.php:1103
msgid "lazyload spinner"
msgstr ""
#: options.php:1092
#: options.php:1104
msgid "The placeholder to display when the image loads, fill in the image url"
msgstr ""
#: options.php:1098
#: options.php:1110
msgid "Whether to enable the clipboard copyright"
msgstr ""
#: options.php:1099
#: options.php:1111
msgid ""
"Automatically add a copyright to the clipboard when copying more than 30 "
"bytes, which is enabled by default."
msgstr ""
#: options.php:1105
#: options.php:1117
msgid "Email address prefix"
msgstr ""
#: options.php:1106
#: options.php:1118
msgid ""
"For sending system mail, the sender address displayed in the user's mailbox, "
"do not use Chinese, the default system email address is bibi@your_domain_name"
msgstr ""
#: options.php:1112
#: options.php:1124
msgid "Comments reply notification"
msgstr ""
#: options.php:1113
#: options.php:1125
msgid ""
"WordPress will use email to notify users when their comments receive a reply "
"by default. Tick this item allows users to set their own comments reply "
"notification"
msgstr ""
#: options.php:1119
#: options.php:1131
msgid "Administrator comment notification"
msgstr ""
#: options.php:1120
#: options.php:1132
msgid ""
"Whether to use email notification when the administrator's comments receive "
"a reply"
msgstr ""
#: options.php:1126
#: options.php:1138
msgid "Enable private comment"
msgstr ""
#: options.php:1127
#: options.php:1139
msgid "Allow users to set their own comments to be invisible to others"
msgstr ""
#: options.php:1133
#: options.php:1145
msgid "Human verification"
msgstr ""
#: options.php:1134
#: options.php:1146
msgid "Enable human verification"
msgstr ""
#: options.php:1140
#: options.php:1152
msgid "QQ avatar link encryption"
msgstr ""
#: options.php:1141
#: options.php:1153
msgid "Do not display the user's qq avatar links directly."
msgstr ""
#: options.php:1146
#: options.php:1158
msgid "Off (default)"
msgstr ""
#: options.php:1147
#: options.php:1159
msgid "use redirect (general security)"
msgstr ""
#: options.php:1148
#: options.php:1160
msgid "fetch data at backend (high security)"
msgstr ""
#: options.php:1149
#: options.php:1161
msgid "fetch data at backend (high securityslow)"
msgstr ""
#: options.php:1153
#: options.php:1165
msgid "Comment UA infomation"
msgstr ""
#: options.php:1154
#: options.php:1166
msgid ""
"Check to enable, display the user's browser, operating system information"
msgstr ""
#: options.php:1160
#: options.php:1172
msgid "Enable disqus"
msgstr ""
#: options.php:1161
#: options.php:1173
msgid "Enable disqus for comment"
msgstr ""
#: options.php:1167
#: options.php:1179
msgid "Time Zone adjustment"
msgstr ""
#: options.php:1168
#: options.php:1180
msgid ""
"If the comment has a time difference problem adjust here, fill in an "
"integer, the calculation method: actual_time = display_error_time - "
@ -1753,6 +1774,10 @@ msgstr ""
msgid "Attribution-NonCommercial-ShareAlike 4.0 International"
msgstr ""
#: user/page-bangumi.php:27
msgid "Please fill in the Bilibili UID in Sakura Options."
msgstr ""
#: user/page-login.php:18
msgid "Remember Me"
msgstr ""
@ -1817,7 +1842,11 @@ msgstr ""
msgid "Sign up"
msgstr ""
#: user/page-register.php:92
#: user/page-register.php:90
msgid "Success! Redirecting......"
msgstr ""
#: user/page-register.php:95
msgid "Registration is not open yet."
msgstr ""

View File

@ -3,7 +3,7 @@ msgid ""
msgstr ""
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
"Project-Id-Version: Sakura\n"
"POT-Creation-Date: 2020-03-29 00:38+0800\n"
"POT-Creation-Date: 2020-04-01 17:10+0800\n"
"PO-Revision-Date: 2019-11-01 14:27+0800\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -220,7 +220,7 @@ msgstr ""
msgid "page %s "
msgstr ""
#: inc/api.php:304 inc/theme_plus.php:727
#: inc/api.php:308 inc/theme_plus.php:727
msgid "The comment is private"
msgstr ""
@ -911,7 +911,7 @@ msgstr ""
msgid "Whether to turn on the top-feature"
msgstr ""
#: options.php:446 options.php:1085
#: options.php:446 options.php:1097
msgid "Default on"
msgstr ""
@ -1406,113 +1406,132 @@ msgid ""
"invalid)"
msgstr ""
#: options.php:974
msgid "The categories of articles that don't not show on homepage"
#: options.php:973
msgid "Bilibili UID"
msgstr ""
#: options.php:975 options.php:982
msgid "Fill in category ID, multiple IDs are divided by a comma \",\""
#: options.php:974
msgid ""
"Fill in your UID, eg.https://space.bilibili.com/13972644/, only fill in with the number part."
msgstr ""
#: options.php:980
msgid "Bilibili Cookie"
msgstr ""
#: options.php:981
msgid "Images category"
msgid ""
"Fill in your Cookies, go to your bilibili homepage, you can get cookies in brownser network "
"pannel with pressing F12. If left this blank, you'll not get the progress."
msgstr ""
#: options.php:988
msgid "Statistics Interface"
#: options.php:986
msgid "The categories of articles that don't not show on homepage"
msgstr ""
#: options.php:987 options.php:994
msgid "Fill in category ID, multiple IDs are divided by a comma \",\""
msgstr ""
#: options.php:993
msgid "WP-Statistics plugin (Professional statistics, can exclude invalid access)"
msgid "Images category"
msgstr ""
#: options.php:994
msgid "Theme built-in (simple statistics, calculate each page access request)"
msgstr ""
#: options.php:998
msgid "Statistical data display format"
msgstr ""
#: options.php:1003
msgid "23333 Views (default)"
msgstr ""
#: options.php:1004
msgid "23,333 Views (britain)"
#: options.php:1000
msgid "Statistics Interface"
msgstr ""
#: options.php:1005
msgid "23 333 Views (french)"
msgid "WP-Statistics plugin (Professional statistics, can exclude invalid access)"
msgstr ""
#: options.php:1006
msgid "23k Views (chinese)"
msgid "Theme built-in (simple statistics, calculate each page access request)"
msgstr ""
#: options.php:1010
msgid "Comment image upload API"
msgid "Statistical data display format"
msgstr ""
#: options.php:1015
msgid "Imgur (https://imgur.com)"
msgid "23333 Views (default)"
msgstr ""
#: options.php:1016
msgid "SM.MS (https://sm.ms)"
msgid "23,333 Views (britain)"
msgstr ""
#: options.php:1017
msgid "Chevereto (https://chevereto.com)"
msgid "23 333 Views (french)"
msgstr ""
#: options.php:1021
msgid "Imgur Client ID"
#: options.php:1018
msgid "23k Views (chinese)"
msgstr ""
#: options.php:1022
msgid "Comment image upload API"
msgstr ""
#: options.php:1027
msgid "Imgur (https://imgur.com)"
msgstr ""
#: options.php:1028
msgid "SM.MS (https://sm.ms)"
msgstr ""
#: options.php:1029
msgid "Chevereto (https://chevereto.com)"
msgstr ""
#: options.php:1033
msgid "Imgur Client ID"
msgstr ""
#: options.php:1034
msgid ""
"Register your application <a href=\"https://api.imgur.com/oauth2/addclient\">here</a>, note we "
"only need the Client ID here."
msgstr ""
#: options.php:1028
#: options.php:1040
msgid "SM.MS Secret Token"
msgstr ""
#: options.php:1029
#: options.php:1041
msgid "Register your application <a href=\"https://sm.ms/home/apitoken\">here</a>."
msgstr ""
#: options.php:1035
#: options.php:1047
msgid "Chevereto API v1 key"
msgstr ""
#: options.php:1036
#: options.php:1048
msgid "Get your API key here: "
msgstr ""
#: options.php:1042
#: options.php:1054
msgid "Chevereto URL"
msgstr ""
#: options.php:1043
#: options.php:1055
msgid "Your Chevereto homepage url, no slash in the end, eg. https://your.cherverto.com"
msgstr ""
#: options.php:1049
#: options.php:1061
msgid "Comment images proxy"
msgstr ""
#: options.php:1050
#: options.php:1062
msgid "A front-ed proxy for the uploaded images. Leave it blank if you do not need."
msgstr ""
#: options.php:1056
#: options.php:1068
msgid "Imgur upload proxy"
msgstr ""
#: options.php:1057
#: options.php:1069
msgid ""
"A back-ed proxy to upload images. You may set a self hosted proxy with Nginx, following my <a "
"href=\"https://2heng.xin/2018/06/06/javascript-upload-images-with-imgur-api/\">turtal</a>. "
@ -1521,146 +1540,146 @@ msgid ""
"</a>】"
msgstr ""
#: options.php:1063
#: options.php:1075
msgid "Enable live search"
msgstr ""
#: options.php:1064
#: options.php:1076
msgid ""
"Real-time search in the foreground, call the Rest API to update the cache every hour, you can "
"manually set the cache time in functions.php"
msgstr ""
#: options.php:1070
#: options.php:1082
msgid "Include comments in live search"
msgstr ""
#: options.php:1071
#: options.php:1083
msgid ""
"Search for comments in real-time search (not recommended if there are too many comments on the "
"site)"
msgstr ""
#: options.php:1077
#: options.php:1089
msgid "Enable baguetteBox"
msgstr ""
#: options.php:1078
#: options.php:1090
msgid ""
"Default off<a href=\"https://github.com/mashirozx/Sakura/wiki/Fancybox\">please read wiki</a>"
msgstr ""
#: options.php:1084
#: options.php:1096
msgid "Enable lazyload in posts"
msgstr ""
#: options.php:1091
#: options.php:1103
msgid "lazyload spinner"
msgstr ""
#: options.php:1092
#: options.php:1104
msgid "The placeholder to display when the image loads, fill in the image url"
msgstr ""
#: options.php:1098
#: options.php:1110
msgid "Whether to enable the clipboard copyright"
msgstr ""
#: options.php:1099
#: options.php:1111
msgid ""
"Automatically add a copyright to the clipboard when copying more than 30 bytes, which is "
"enabled by default."
msgstr ""
#: options.php:1105
#: options.php:1117
msgid "Email address prefix"
msgstr ""
#: options.php:1106
#: options.php:1118
msgid ""
"For sending system mail, the sender address displayed in the user's mailbox, do not use "
"Chinese, the default system email address is bibi@your_domain_name"
msgstr ""
#: options.php:1112
#: options.php:1124
msgid "Comments reply notification"
msgstr ""
#: options.php:1113
#: options.php:1125
msgid ""
"WordPress will use email to notify users when their comments receive a reply by default. Tick "
"this item allows users to set their own comments reply notification"
msgstr ""
#: options.php:1119
#: options.php:1131
msgid "Administrator comment notification"
msgstr ""
#: options.php:1120
#: options.php:1132
msgid "Whether to use email notification when the administrator's comments receive a reply"
msgstr ""
#: options.php:1126
#: options.php:1138
msgid "Enable private comment"
msgstr ""
#: options.php:1127
#: options.php:1139
msgid "Allow users to set their own comments to be invisible to others"
msgstr ""
#: options.php:1133
#: options.php:1145
msgid "Human verification"
msgstr ""
#: options.php:1134
#: options.php:1146
msgid "Enable human verification"
msgstr ""
#: options.php:1140
#: options.php:1152
msgid "QQ avatar link encryption"
msgstr ""
#: options.php:1141
#: options.php:1153
msgid "Do not display the user's qq avatar links directly."
msgstr ""
#: options.php:1146
#: options.php:1158
msgid "Off (default)"
msgstr ""
#: options.php:1147
#: options.php:1159
msgid "use redirect (general security)"
msgstr ""
#: options.php:1148
#: options.php:1160
msgid "fetch data at backend (high security)"
msgstr ""
#: options.php:1149
#: options.php:1161
msgid "fetch data at backend (high securityslow)"
msgstr ""
#: options.php:1153
#: options.php:1165
msgid "Comment UA infomation"
msgstr ""
#: options.php:1154
#: options.php:1166
msgid "Check to enable, display the user's browser, operating system information"
msgstr ""
#: options.php:1160
#: options.php:1172
msgid "Enable disqus"
msgstr ""
#: options.php:1161
#: options.php:1173
msgid "Enable disqus for comment"
msgstr ""
#: options.php:1167
#: options.php:1179
msgid "Time Zone adjustment"
msgstr ""
#: options.php:1168
#: options.php:1180
msgid ""
"If the comment has a time difference problem adjust here, fill in an integer, the calculation "
"method: actual_time = display_error_time - the_integer_you_entered (unit: hour)"
@ -1714,6 +1733,10 @@ msgstr ""
msgid "Attribution-NonCommercial-ShareAlike 4.0 International"
msgstr ""
#: user/page-bangumi.php:27
msgid "Please fill in the Bilibili UID in Sakura Options."
msgstr ""
#: user/page-login.php:18
msgid "Remember Me"
msgstr ""
@ -1777,6 +1800,10 @@ msgstr ""
msgid "Sign up"
msgstr ""
#: user/page-register.php:92
#: user/page-register.php:90
msgid "Success! Redirecting......"
msgstr ""
#: user/page-register.php:95
msgid "Registration is not open yet."
msgstr ""

Binary file not shown.

View File

@ -1,8 +1,8 @@
msgid ""
msgstr ""
"Project-Id-Version: Sakura\n"
"POT-Creation-Date: 2020-03-29 00:38+0800\n"
"PO-Revision-Date: 2020-03-29 00:38+0800\n"
"POT-Creation-Date: 2020-04-01 17:11+0800\n"
"PO-Revision-Date: 2020-04-01 17:13+0800\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: zh_CN\n"
@ -227,7 +227,7 @@ msgstr ""
msgid "page %s "
msgstr "第 %s 页 "
#: inc/api.php:304 inc/theme_plus.php:727
#: inc/api.php:308 inc/theme_plus.php:727
msgid "The comment is private"
msgstr "该评论为私密评论"
@ -938,7 +938,7 @@ msgstr "点点"
msgid "Whether to turn on the top-feature"
msgstr "是否开启聚焦"
#: options.php:446 options.php:1085
#: options.php:446 options.php:1097
msgid "Default on"
msgstr "默认开启"
@ -1465,72 +1465,96 @@ msgstr ""
"公告内容文字超出142个字节将会被滚动显示移动端无效一个汉字 = 3字节一"
"个字母 = 1字节自己计算吧"
#: options.php:973
msgid "Bilibili UID"
msgstr ""
#: options.php:974
msgid ""
"Fill in your UID, eg.https://space.bilibili.com/13972644/, only fill in with "
"the number part."
msgstr ""
"填写你的UID,例如https://space.bilibili.com/13972644/,只需填写数字部分。"
#: options.php:980
msgid "Bilibili Cookie"
msgstr ""
#: options.php:981
msgid ""
"Fill in your Cookies, go to your bilibili homepage, you can get cookies in "
"brownser network pannel with pressing F12. If left this blank, you'll not "
"get the progress."
msgstr ""
"填写你的帐号Cookies。F12打开浏览器网络面板前往你的B站主页获取Cookies。如果"
"留空,将不会显示追番进度。"
#: options.php:986
msgid "The categories of articles that don't not show on homepage"
msgstr "首页不显示的分类文章"
#: options.php:975 options.php:982
#: options.php:987 options.php:994
msgid "Fill in category ID, multiple IDs are divided by a comma \",\""
msgstr "填写分类ID多个用英文“ , ”分开"
#: options.php:981
#: options.php:993
msgid "Images category"
msgstr "图片展示分类"
#: options.php:988
#: options.php:1000
msgid "Statistics Interface"
msgstr "统计接口"
#: options.php:993
#: options.php:1005
msgid ""
"WP-Statistics plugin (Professional statistics, can exclude invalid access)"
msgstr "WP-Statistics 插件(专业性统计,可排除无效访问)"
#: options.php:994
#: options.php:1006
msgid "Theme built-in (simple statistics, calculate each page access request)"
msgstr "主题内建(简单的统计,计算每一次页面访问请求)"
#: options.php:998
#: options.php:1010
msgid "Statistical data display format"
msgstr "统计数据显示格式"
#: options.php:1003
#: options.php:1015
msgid "23333 Views (default)"
msgstr "23333 次访问(默认)"
#: options.php:1004
#: options.php:1016
msgid "23,333 Views (britain)"
msgstr "23,333 次访问(英式)"
#: options.php:1005
#: options.php:1017
msgid "23 333 Views (french)"
msgstr "23 333 次访问(法式)"
#: options.php:1006
#: options.php:1018
msgid "23k Views (chinese)"
msgstr "23k 次访问(中式)"
#: options.php:1010
#: options.php:1022
msgid "Comment image upload API"
msgstr "评论上传图片接口"
#: options.php:1015
#: options.php:1027
msgid "Imgur (https://imgur.com)"
msgstr ""
#: options.php:1016
#: options.php:1028
msgid "SM.MS (https://sm.ms)"
msgstr ""
#: options.php:1017
#: options.php:1029
msgid "Chevereto (https://chevereto.com)"
msgstr ""
#: options.php:1021
#: options.php:1033
msgid "Imgur Client ID"
msgstr ""
#: options.php:1022
#: options.php:1034
msgid ""
"Register your application <a href=\"https://api.imgur.com/oauth2/addclient"
"\">here</a>, note we only need the Client ID here."
@ -1538,48 +1562,48 @@ msgstr ""
"在<a href=\"https://api.imgur.com/oauth2/addclient\">这里</a>注册你的 "
"application , 注意此处只需要填写 Client ID."
#: options.php:1028
#: options.php:1040
msgid "SM.MS Secret Token"
msgstr ""
#: options.php:1029
#: options.php:1041
msgid ""
"Register your application <a href=\"https://sm.ms/home/apitoken\">here</a>."
msgstr "在<a href=\"https://sm.ms/home/apitoken\">这里</a>获取 key."
#: options.php:1035
#: options.php:1047
msgid "Chevereto API v1 key"
msgstr ""
#: options.php:1036
#: options.php:1048
msgid "Get your API key here: "
msgstr "在这里获取你的 API key "
#: options.php:1042
#: options.php:1054
msgid "Chevereto URL"
msgstr ""
#: options.php:1043
#: options.php:1055
msgid ""
"Your Chevereto homepage url, no slash in the end, eg. https://your.cherverto."
"com"
msgstr ""
"你的 Chevereto 首页 url, 注意结尾没有 /, 例如https://your.cherverto.com"
#: options.php:1049
#: options.php:1061
msgid "Comment images proxy"
msgstr "评论图片代理"
#: options.php:1050
#: options.php:1062
msgid ""
"A front-ed proxy for the uploaded images. Leave it blank if you do not need."
msgstr "前端显示的图片的代理。"
#: options.php:1056
#: options.php:1068
msgid "Imgur upload proxy"
msgstr "Imgur 上传代理"
#: options.php:1057
#: options.php:1069
msgid ""
"A back-ed proxy to upload images. You may set a self hosted proxy with "
"Nginx, following my <a href=\"https://2heng.xin/2018/06/06/javascript-upload-"
@ -1594,11 +1618,11 @@ msgstr ""
"端显示都需要代理!如果服务器在国外不需要上传代理,此处填写默认值即可:【<a "
"href=\"https://api.imgur.com/3/image/\">https://api.imgur.com/3/image/</a>】"
#: options.php:1063
#: options.php:1075
msgid "Enable live search"
msgstr "启用实时搜索"
#: options.php:1064
#: options.php:1076
msgid ""
"Real-time search in the foreground, call the Rest API to update the cache "
"every hour, you can manually set the cache time in functions.php"
@ -1606,21 +1630,21 @@ msgstr ""
"前台实现实时搜索,调用 Rest API 每小时更新一次缓存,可在 functions.php 里手动"
"设置缓存时间"
#: options.php:1070
#: options.php:1082
msgid "Include comments in live search"
msgstr "实时搜索包含评论"
#: options.php:1071
#: options.php:1083
msgid ""
"Search for comments in real-time search (not recommended if there are too "
"many comments on the site)"
msgstr "在实时搜索中搜索评论(如果网站评论数量太多不建议开启)"
#: options.php:1077
#: options.php:1089
msgid "Enable baguetteBox"
msgstr "启用 baguetteBox"
#: options.php:1078
#: options.php:1090
msgid ""
"Default off<a href=\"https://github.com/mashirozx/Sakura/wiki/Fancybox"
"\">please read wiki</a>"
@ -1628,33 +1652,33 @@ msgstr ""
"默认禁用,<a href=\"https://github.com/mashirozx/Sakura/wiki/Fancybox\">请阅"
"读说明</a>"
#: options.php:1084
#: options.php:1096
msgid "Enable lazyload in posts"
msgstr "文章内图片启用 lazyload"
#: options.php:1091
#: options.php:1103
msgid "lazyload spinner"
msgstr "lazyload 占位图"
#: options.php:1092
#: options.php:1104
msgid "The placeholder to display when the image loads, fill in the image url"
msgstr "图片加载时要显示的占位图,填写图片 url"
#: options.php:1098
#: options.php:1110
msgid "Whether to enable the clipboard copyright"
msgstr "是否开启剪贴板版权标识"
#: options.php:1099
#: options.php:1111
msgid ""
"Automatically add a copyright to the clipboard when copying more than 30 "
"bytes, which is enabled by default."
msgstr "复制超过30个字节时自动向剪贴板添加版权标识默认开启。"
#: options.php:1105
#: options.php:1117
msgid "Email address prefix"
msgstr "发件地址前缀"
#: options.php:1106
#: options.php:1118
msgid ""
"For sending system mail, the sender address displayed in the user's mailbox, "
"do not use Chinese, the default system email address is bibi@your_domain_name"
@ -1662,11 +1686,11 @@ msgstr ""
"用于发送系统邮件,在用户的邮箱中显示的发件人地址,不要使用中文,默认系统邮件"
"地址为 bibi@你的域名"
#: options.php:1112
#: options.php:1124
msgid "Comments reply notification"
msgstr "邮件回复通知"
#: options.php:1113
#: options.php:1125
msgid ""
"WordPress will use email to notify users when their comments receive a reply "
"by default. Tick this item allows users to set their own comments reply "
@ -1675,78 +1699,78 @@ msgstr ""
"WordPress默认会使用邮件通知用户评论收到回复开启此项允许用户设置自己的评论收"
"到回复时是否使用邮件通知"
#: options.php:1119
#: options.php:1131
msgid "Administrator comment notification"
msgstr "邮件回复通知管理员"
#: options.php:1120
#: options.php:1132
msgid ""
"Whether to use email notification when the administrator's comments receive "
"a reply"
msgstr "当管理员评论收到回复时是否使用邮件通知"
#: options.php:1126
#: options.php:1138
msgid "Enable private comment"
msgstr "允许私密评论"
#: options.php:1127
#: options.php:1139
msgid "Allow users to set their own comments to be invisible to others"
msgstr "允许用户设置自己的评论对其他人不可见"
#: options.php:1133
#: options.php:1145
msgid "Human verification"
msgstr "机器人验证"
#: options.php:1134
#: options.php:1146
msgid "Enable human verification"
msgstr "开启机器人验证"
#: options.php:1140
#: options.php:1152
msgid "QQ avatar link encryption"
msgstr "QQ头像链接加密"
#: options.php:1141
#: options.php:1153
msgid "Do not display the user's qq avatar links directly."
msgstr "不直接暴露用户QQ头像链接"
#: options.php:1146
#: options.php:1158
msgid "Off (default)"
msgstr "关闭(默认)"
#: options.php:1147
#: options.php:1159
msgid "use redirect (general security)"
msgstr "使用重定向(安全性低)"
#: options.php:1148
#: options.php:1160
msgid "fetch data at backend (high security)"
msgstr "后端获取头像数据(安全性高)"
#: options.php:1149
#: options.php:1161
msgid "fetch data at backend (high securityslow)"
msgstr "后端解析QQ头像接口安全性高"
#: options.php:1153
#: options.php:1165
msgid "Comment UA infomation"
msgstr "评论UA信息"
#: options.php:1154
#: options.php:1166
msgid ""
"Check to enable, display the user's browser, operating system information"
msgstr "勾选开启,显示用户的浏览器,操作系统信息"
#: options.php:1160
#: options.php:1172
msgid "Enable disqus"
msgstr "开启多说插件支持"
#: options.php:1161
#: options.php:1173
msgid "Enable disqus for comment"
msgstr "多说已经凉了~~"
#: options.php:1167
#: options.php:1179
msgid "Time Zone adjustment"
msgstr "时区调整"
#: options.php:1168
#: options.php:1180
msgid ""
"If the comment has a time difference problem adjust here, fill in an "
"integer, the calculation method: actual_time = display_error_time - "
@ -1806,6 +1830,10 @@ msgstr ""
msgid "Attribution-NonCommercial-ShareAlike 4.0 International"
msgstr "知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议"
#: user/page-bangumi.php:27
msgid "Please fill in the Bilibili UID in Sakura Options."
msgstr "请在后台设置填写 Bilibili UID 后继续。"
#: user/page-login.php:18
msgid "Remember Me"
msgstr "记住我"
@ -1870,7 +1898,11 @@ msgstr "拖动滑块验证"
msgid "Sign up"
msgstr "注 册"
#: user/page-register.php:92
#: user/page-register.php:90
msgid "Success! Redirecting......"
msgstr "注册成功!正在跳转......"
#: user/page-register.php:95
msgid "Registration is not open yet."
msgstr "暂未开放注册。"

View File

@ -969,7 +969,19 @@ function optionsframework_options()
'id' => 'notice_title',
'std' => '',
'type' => 'text');
$options[] = array(
'name' => __('Bilibili UID', 'sakura'), /*bilibiliUID*/
'desc' => __('Fill in your UID, eg.https://space.bilibili.com/13972644/, only fill in with the number part.', 'sakura'),
'id' => 'bilibili_id',
'std' => '13972644',
'type' => 'text');
$options[] = array(
'name' => __('Bilibili Cookie', 'sakura'), /*Bilibili Cookie*/
'desc' => __('Fill in your Cookies, go to your bilibili homepage, you can get cookies in brownser network pannel with pressing F12. If left this blank, you\'ll not get the progress.', 'sakura'),
'id' => 'bilibili_cookie',
'std' => 'LIVE_BUVID=',
'type' => 'textarea');
$options[] = array(
'name' => __('The categories of articles that don\'t not show on homepage', 'sakura'), /*首页不显示的分类文章*/
'desc' => __('Fill in category ID, multiple IDs are divided by a comma ","', 'sakura'), /*填写分类ID多个用英文“ , ”分开*/

176
style.css
View File

@ -3867,6 +3867,10 @@ li.feature-2 {
z-index: -1
}
@supports (-webkit-touch-callout: none) {
#centerbg: { background-attachment: scroll !important; }
}
@media (max-width:860px) {
#centerbg {
height: 300px;
@ -5010,7 +5014,7 @@ i.iconfont.down {
color: #ADADAD
}
#pagination span {
#pagination span,#bangumi-pagination span {
color: #989898;
font-size: 15px
}
@ -5020,7 +5024,7 @@ i.iconfont.down {
color: orange
}
#pagination .loading {
#pagination .loading,#bangumi-pagination .loading {
background: url(https://cdn.jsdelivr.net/gh/moezx/cdn@3.1.9/img/Sakura/images/wordpress-rotating-ball-o.svg);
background-position: center;
background-repeat: no-repeat;
@ -8625,3 +8629,171 @@ h1[id*=toc-head]::before,h2[id*=toc-head]::before,h3[id*=toc-head]::before,h4[id
width: 100%;
height: 100%;
}
.bangumi .row {
display: flex;
margin: 0 -10px -20px;
flex-wrap: wrap;
}
.bangumi .column {
max-width: 50%;
flex: 0 0 50%;
margin-bottom: 30px;
padding: 0 15px;
max-width: 100%;
flex: 0 0 100%;
transition: .5s;
}
.bangumi-item {
height: 0;
color: #fff;
display: block;
overflow: hidden;
text-align: center;
position: relative;
padding-bottom: 130%;
box-shadow: 0 0 10px rgba(0, 0, 0, .1), 0 5px 20px rgba(0, 0, 0, .2);
}
.bangumi-item:hover {
color: #fff;
}
.bangumi-item img {
width: 100%;
user-select: none;
object-fit: cover;
transition: filter 2s;
}
.bangumi-item .bangumi-info {
height: 30%;
top: 0;
left: 0;
right: 0;
padding: 10px;
position: absolute;
background: rgba(0, 0, 0, .5);
transition: transform 1s;
transform: translateY(250%);
}
.bangumi-title {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
margin-top: 0;
}
.bangumi-summary {
height: 65%;
white-space: normal;
display: none;
font-weight: bold;
}
.bangumi-status-bar {
top: 0;
bottom: 0;
max-width: 100%;
position: absolute;
background: #dc143c;
}
.bangumi-status, .bangumi-status p {
position: relative;
}
.bangumi-status {
background: rgba(0, 0, 0, .6);
}
@media screen and (min-width: 400px) {
.bangumi .column {
max-width: 50%;
flex: 0 0 50%;
}
.bangumi-item .bangumi-info{
height: 50%;
transform: translateY(140%);
}
.bangumi-title {
height: 20%;
}
}
@media screen and (min-width: 600px) {
.bangumi .column {
max-width: 33.3333%;
flex: 0 0 33.3333%;
}
.bangumi-item .bangumi-info{
height: 50%;
transform: translateY(140%);
}
}
@media screen and (min-width: 900px) {
.bangumi .column {
max-width: 25%;
flex: 0 0 25%;
}
.bangumi-item .bangumi-info{
height: 100%;
transform: translateY(85%);
}
.bangumi-item:hover .bangumi-info {
transform: translateY(0);
}
.bangumi-item:hover img{
filter: blur(3px);
}
.bangumi-title {
height: 15%;
}
.bangumi-summary{
display: block;
}
.bangumi-status {
height: 10%;
}
}
@media screen and (min-width: 1200px) {
.bangumi-item .bangumi-info{
height: 75%;
transform: translateY(115%);
}
.bangumi-item:hover .bangumi-info {
transform: translateY(35%);
}
.bangumi-title {
height: 10%;
}
}
#bangumi-pagination {
width: 100%;
margin-top: 80px;
padding: 20px 0;
font-size: 36px;
text-align: center;
}
.bangumi-next{
color: #e67474;
position: relative;
padding: 13px 35px;
overflow: hidden;
}
.bangumi-next:before {
content: ' ';
background-color: pink;
bottom: 0;
left: 0;
width: 100%;
height: 0;
position: absolute;
transition: all 5s;
z-index: -1;
}
.bangumi-next.loading:before{
display: none !important;
}
.bangumi-next:hover:before {
height: 100%;
}
.bangumi-next i {
color: orange;
}

View File

@ -0,0 +1,35 @@
<?php
/**
Template Name: Bangumi
*/
get_header();
?>
<meta name="referrer" content="same-origin">
<style>
#content,.comments,.site-footer{max-width:1200px;}
.comments{display: none}
</style>
</head>
<?php while(have_posts()) : the_post(); ?>
<?php if(akina_option('patternimg') || !get_post_thumbnail_id(get_the_ID())) { ?>
<span class="linkss-title"><?php the_title();?></span>
<?php } ?>
<article <?php post_class("post-item"); ?>>
<?php the_content(); ?>
<section class="bangumi">
<?php if (akina_option('bilibili_id') ):?>
<div class="row">
<?php echo get_bgm_items(); ?>
<?php else: ?>
<div class="row">
<p> <?php _e("Please fill in the Bilibili UID in Sakura Options.","sakura"); ?></p>
</div>
<?php endif; ?>
</section>
</article>
<?php endwhile; ?>
<?php
get_footer();

View File

@ -86,7 +86,10 @@ if( !empty($_POST['register_reg']) ) {
<?php }else{
$loadurl = akina_option('exlogin_url') ? akina_option('exlogin_url') : get_bloginfo('url');
?>
<script>//window.location.href='<?php echo $loadurl; ?>';</script>
<div class="ex-register-title">
<h3><?php _e("Success! Redirecting......","sakura")/*注册成功!正在跳转...*/?></h3>
</div>
<script>window.location.href='<?php echo $loadurl; ?>';</script>
<?php } ?>
<?php else : ?>
<div class="register-close"><p><?php _e("Registration is not open yet.","sakura")/*暂未开放注册。*/?></p></div>