Compare commits
125 Commits
Author | SHA1 | Date |
---|---|---|
imgbot[bot] | 9a7a597ac1 | |
migftw | 233d0356c9 | |
migftw | 8bea22e9da | |
Mashiro | 0128ba483b | |
TershiXia | 8842caf739 | |
琥珀 | a0950f1a5c | |
Mashiro | 6e56d0ba42 | |
Spirit | b73c45f022 | |
aierlma | 8a46b8545f | |
Mashiro | 77722ed4d7 | |
Spirit | a831ae70e1 | |
Spirit | 34fdb5d215 | |
Spirit | a063060ad9 | |
Spirit | 69b68c00c0 | |
Spirit | 00e2a2f390 | |
Spirit | fad1d9f30f | |
Spirit | a0d8f8a6cf | |
Spirit | f829ab4b60 | |
Spirit | c9a041eee3 | |
Spirit | 9d5e0a598b | |
Spirit | e15bbeb896 | |
Spirit | 7a96dd7549 | |
Jkkoi | 663768b37a | |
Spirit | 467818c5f6 | |
Mashiro | 7a1ec65a9a | |
Spirit | 85f010d6aa | |
Spirit | 6b919d0157 | |
Spirit | 0ddfcad236 | |
Spirit | 6dff427071 | |
Spirit | 777b91817c | |
Spirit | 9abded81ec | |
Spirit | 689fc6319d | |
Spirit | a90e961e7b | |
Spirit | 499e7eb1cc | |
Spirit | a4bd04fc9f | |
Spirit | 7437bfa456 | |
Spirit | df1c5bac14 | |
Mashiro | 31e08ee6f3 | |
Spirit | 5c415480fa | |
Spirit | a62d42d372 | |
Spirit | 7d5ff98f87 | |
Spirit | 57c541e6db | |
Spirit | 164a977f02 | |
Spirit | 130c8802dd | |
Spirit | 499d2c324e | |
Mashiro | 2e5b6ac6a0 | |
Spirit | 67dffdbfa4 | |
Mashiro | 211bea9ab6 | |
Mashiro | 3f1bf942f0 | |
Mashiro | 3cb08284cf | |
Parasomnia | aa221716b1 | |
Spirit | c0f0990ff0 | |
Spirit | b17576867f | |
Spirit | 3b8cb19294 | |
Mashiro | be6a6e76c3 | |
Mashiro | 376efe91a2 | |
Mashiro | 93eb457c33 | |
Mashiro | ccb0b6f5da | |
Spirit | a6e42f14c2 | |
Spirit | d9a6895d0d | |
Spirit | baaabaa394 | |
Spirit | 978937bb90 | |
Spirit | 680d3b515f | |
Spirit | 742f5680e3 | |
mashiro | b419dcc8ca | |
mashiro | 2100ccd708 | |
Mashiro | 9ddaad79b1 | |
Spirit | 8b77fbd380 | |
Spirit | 5157540319 | |
spirit | 15e7f3b57a | |
Mashiro | ad63468e4e | |
spirit | 0575e6a0e3 | |
spirit | 3e34024bd9 | |
spirit | 6b8e7b0ede | |
spirit | 443894d488 | |
spirit | a99102fdac | |
Mashiro | 5608a0d5fe | |
spirit | d91e1ad885 | |
spirit | 15a6ab525b | |
Mashiro | dedda7185a | |
Mashiro | 77aeb4301c | |
Spirit | c1f315e50c | |
spirit | 14055ede78 | |
spirit | e8e5630907 | |
spirit | 116d039743 | |
spirit | d7e5af113f | |
spirit | f2a96c3f71 | |
spirit | 0d39a81fe4 | |
spirit | 6bab1a43d0 | |
Mashiro | 0a17ab966d | |
mashiro | eda14ef175 | |
mashiro | 63fb8372b0 | |
Mashiro | 3aa254d017 | |
Mashiro | a1d513bcc6 | |
Mashiro | f301cdcde1 | |
Mashiro | a82f353b36 | |
Mashiro | b6f7964560 | |
mashiro | 8f34a4bfd6 | |
mashiro | 8d0bbcd56a | |
spirit | 84d722feb5 | |
spirit | c26c98b653 | |
spirit | d78d8dd12a | |
spirit | 4cc44b9dd0 | |
Mashiro | 4e4d28fcd0 | |
Mashiro | 24f46913ad | |
Mashiro | c205072216 | |
spirit | 19a337ed17 | |
Mashiro | af8c81315b | |
Mashiro | c0b0e81b38 | |
Mashiro | 0f50f2587e | |
Mashiro | 87c5029439 | |
spirit | c8349d33e9 | |
spirit | b770426ce1 | |
spirit | 5197e50c2e | |
spirit | 79ea6a20e3 | |
spirit | 236d263a26 | |
Mashiro | 8ffa252dcd | |
spirit | 90c6ff19d8 | |
spirit | 13c5b996e7 | |
spirit | 19779aa407 | |
spirit | db7bb49397 | |
spirit | ae7f444584 | |
spirit | ceeeeacf05 | |
spirit | 23088bfc2b | |
mashiro | c9a029d775 |
1
404.php
|
@ -12,6 +12,7 @@
|
|||
<head>
|
||||
<meta charset="<?php bloginfo( 'charset' ); ?>">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="shortcut icon" href="<?php echo akina_option('favicon_link', ''); ?>"/>
|
||||
<title itemprop="name"><?php global $page, $paged;wp_title( '-', true, 'right' );
|
||||
bloginfo( 'name' );$site_description = get_bloginfo( 'description', 'display' );
|
||||
if ( $site_description && ( is_home() || is_front_page() ) ) echo " - $site_description";if ( $paged >= 2 || $page >= 2 ) echo ' - ' . sprintf( __( 'page %s'), max( $paged, $page ) );/*第 %s 页*/?>
|
||||
|
|
10
README-en.md
|
@ -1,14 +1,14 @@
|
|||
Sakura🌸: A Wonderful WordPress Theme
|
||||
===
|
||||
|
||||
[中文](README.md) | Engilsh
|
||||
[中文](README.md) | English
|
||||
|
||||
![Sakura](https://view.moezx.cc/images/2018/05/26/sakura.png)
|
||||
![Sakura](screenshot.jpg)
|
||||
|
||||
![PHP version](https://img.shields.io/badge/PHP-7.1+-4F5B93.svg?style=flat-square)
|
||||
![WP version](https://img.shields.io/badge/WordPress-5.0+-0073aa.svg?style=flat-square)
|
||||
![PHP version](https://img.shields.io/badge/PHP-7.1+-4F5B93.svg?style=flat-square&logo=php)
|
||||
![WP version](https://img.shields.io/badge/WordPress-5.3-0073aa.svg?style=flat-square&logo=wordpress)
|
||||
[![GitHub release](https://img.shields.io/github/release/mashirozx/Sakura.svg?style=flat-square)](https://github.com/mashirozx/Sakura/releases/latest)
|
||||
[![Github commits (since latest release)](https://img.shields.io/github/commits-since/mashirozx/Sakura/latest.svg?style=flat-square)](https://github.com/mashirozx/Sakura/commits/)
|
||||
[![Github commits (since latest release)](https://img.shields.io/github/commits-since/mashirozx/Sakura/latest/dev.svg?style=flat-square)](https://github.com/mashirozx/Sakura/commits/dev)
|
||||
[![](https://data.jsdelivr.com/v1/package/gh/moezx/cdn/badge)](https://www.jsdelivr.com/package/gh/moezx/cdn)
|
||||
|
||||
Modified based on theme [Akina (by Fuzzz)](http://www.akina.pw/themeakina) and [Siren (by Louie)](https://github.com/louie-senpai/Siren).
|
||||
|
|
14
README.md
|
@ -1,14 +1,14 @@
|
|||
Sakura🌸: 樱花庄的白猫博客主题
|
||||
===
|
||||
|
||||
中文 | [Engilsh](README-en.md)
|
||||
中文 | [English](README-en.md)
|
||||
|
||||
![Sakura](https://view.moezx.cc/images/2018/05/26/sakura.png)
|
||||
![Sakura](screenshot.jpg)
|
||||
|
||||
![PHP version](https://img.shields.io/badge/PHP-7.1+-4F5B93.svg?style=flat-square)
|
||||
![WP version](https://img.shields.io/badge/WordPress-5.0+-0073aa.svg?style=flat-square)
|
||||
[![GitHub release](https://img.shields.io/github/release/mashirozx/Sakura.svg?style=flat-square)](https://github.com/mashirozx/Sakura/releases/latest)
|
||||
[![Github commits (since latest release)](https://img.shields.io/github/commits-since/mashirozx/Sakura/latest.svg?style=flat-square)](https://github.com/mashirozx/Sakura/commits/)
|
||||
![PHP version](https://img.shields.io/badge/PHP-7.1+-4F5B93.svg?style=flat-square&logo=php)
|
||||
![WP version](https://img.shields.io/badge/WordPress-5.3-0073aa.svg?style=flat-square&logo=wordpress)
|
||||
[![GitHub release](https://img.shields.io/github/v/release/mashirozx/Sakura.svg?style=flat-square&logo=github)](https://github.com/mashirozx/Sakura/releases/latest)
|
||||
[![Github commits (since latest release)](https://img.shields.io/github/commits-since/mashirozx/Sakura/latest/dev.svg?style=flat-square&logo=git&color=important)](https://github.com/mashirozx/Sakura/commits/dev)
|
||||
[![](https://data.jsdelivr.com/v1/package/gh/moezx/cdn/badge)](https://www.jsdelivr.com/package/gh/moezx/cdn)
|
||||
|
||||
在 Louie 基于 Fuzzz 的 [Akina](http://www.akina.pw/themeakina) 主题修改的主题 [Siren](https://github.com/louie-senpai/Siren) 基础上三次修改 =.=
|
||||
|
@ -21,7 +21,7 @@
|
|||
|
||||
主题使用说明见:<https://2heng.xin/theme-sakura/>
|
||||
|
||||
本仓库国内镜像:<https://gitee.com/mashirozx/Sakura>
|
||||
本仓库国内镜像:<https://git.moezx.cc/mirrors/sakura>
|
||||
|
||||
主题交流群:860262481
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ get_header(); ?>
|
|||
|
||||
</main><!-- #main -->
|
||||
<?php if ( akina_option('pagenav_style') == 'ajax') { ?>
|
||||
<div id="pagination" <?php if(akina_option('image_category') && is_category(explode(',',akina_option('image_category')))) echo 'class="pagination-archive"'; ?>><?php next_posts_link(__('Previous')); ?></div>
|
||||
<div id="pagination" <?php if(akina_option('image_category') && is_category(explode(',',akina_option('image_category')))) echo 'class="pagination-archive"'; ?>><?php next_posts_link(' Previous'); ?></div>
|
||||
<div id="add_post"><span id="add_post_time" style="visibility: hidden;" title="<?php echo akina_option('auto_load_post',''); ?>" ></span></div>
|
||||
<?php }else{ ?>
|
||||
<nav class="navigator">
|
||||
|
@ -62,5 +62,4 @@ get_header(); ?>
|
|||
</div><!-- #primary -->
|
||||
|
||||
<?php
|
||||
get_sidebar();
|
||||
get_footer();
|
||||
|
|
|
@ -73,7 +73,7 @@ get_header();
|
|||
|
||||
</main><!-- #main -->
|
||||
<?php if ( akina_option('pagenav_style') == 'ajax') { ?>
|
||||
<div id="pagination"><?php next_posts_link(__('Previous')); ?></div>
|
||||
<div id="pagination"><?php next_posts_link(' Previous'); ?></div>
|
||||
<div id="add_post"><span id="add_post_time" style="visibility: hidden;" title="<?php echo akina_option('auto_load_post',''); ?>" ></span></div>
|
||||
<?php }else{ ?>
|
||||
<nav class="navigator">
|
||||
|
@ -83,5 +83,4 @@ get_header();
|
|||
</div><!-- #primary -->
|
||||
|
||||
<?php
|
||||
get_sidebar();
|
||||
get_footer();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*! Generate by Mashiro. Fri Jan 25 09:41:42 2019*//*!
|
||||
/*! Generate by Mashiro. Mon Dec 23 09:48:25 2019*//*!
|
||||
* baguetteBox.js
|
||||
* @author feimosi
|
||||
* @version 1.11.0
|
||||
|
|
|
@ -8,7 +8,7 @@ function get_gravatar(email, size) {
|
|||
|
||||
var size = size || 80;
|
||||
|
||||
return 'https://gravatar.shino.cc/avatar/' + MD5(email) + '.jpg?s=' + size + '&d=mm';
|
||||
return 'https://' + Poi.gravatar_url + '/' + MD5(email) + '.jpg?s=' + size + '&d=mm';
|
||||
}
|
||||
|
||||
// sync css
|
||||
|
|
|
@ -150,6 +150,7 @@ h1.entry-title {
|
|||
}
|
||||
|
||||
.entry-content tr:nth-child(even){background-color: #f2f2f2}
|
||||
body.dark .entry-content tr:nth-child(even){background-color: unset}
|
||||
|
||||
.entry-content th {
|
||||
color: white;
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
<?php endif; ?>
|
||||
|
||||
<?php
|
||||
|
||||
$robot_comments = '';
|
||||
if(comments_open()){
|
||||
if(akina_option('norobot')) $robot_comments = '<label class="siren-checkbox-label"><input class="siren-checkbox-radio" type="checkbox" name="no-robot"><span class="siren-no-robot-checkbox siren-checkbox-radioInput"></span>'.__('I\'m not a robot', 'sakura').'</label>';
|
||||
$private_ms = akina_option('open_private_message') ? '<label class="siren-checkbox-label"><input class="siren-checkbox-radio" type="checkbox" name="is-private"><span class="siren-is-private-checkbox siren-checkbox-radioInput"></span>'.__('Comment in private', 'sakura').'</label>' : '';
|
||||
|
@ -60,7 +60,7 @@
|
|||
'title_reply_to' => '<div class="graybar"><i class="fa fa-comments-o"></i>' . __('Leave a Reply to', 'sakura') . ' %s' . '</div>',
|
||||
'cancel_reply_link' => __('Cancel Reply', 'sakura'),
|
||||
'label_submit' => __('BiuBiuBiu~', 'sakura'),
|
||||
'comment_field' => '<p><i class="iconfont icon-markdown"></i> Markdown Supported while <i class="fa fa-code" aria-hidden="true"></i> Forbidden</p><div class="comment-textarea"><textarea placeholder="' . __("You are a surprise that I will only meet once in my life", "sakura") . ' ..." name="comment" class="commentbody" id="comment" rows="5" tabindex="4"></textarea><label class="input-label">' . __("You are a surprise that I will only meet once in my life", "sakura") . ' ...</label></div>
|
||||
'comment_field' => '<p style="font-style:italic"><a href="https://segmentfault.com/markdown" target="_blank"><i class="iconfont icon-markdown" style="color:#000"></i></a> Markdown Supported while <i class="fa fa-code" aria-hidden="true"></i> Forbidden</p><div class="comment-textarea"><textarea placeholder="' . __("You are a surprise that I will only meet once in my life", "sakura") . ' ..." name="comment" class="commentbody" id="comment" rows="5" tabindex="4"></textarea><label class="input-label">' . __("You are a surprise that I will only meet once in my life", "sakura") . ' ...</label></div>
|
||||
<div id="upload-img-show"></div>
|
||||
<!--插入表情面版-->
|
||||
<p id="emotion-toggle" class="no-select">
|
||||
|
@ -88,11 +88,11 @@
|
|||
'comment_notes_after' => '',
|
||||
'comment_notes_before' => '',
|
||||
'fields' => apply_filters( 'comment_form_default_fields', array(
|
||||
'avatar' => '<div class="cmt-info-container"><div class="comment-user-avatar"><img src="https://gravatar.shino.cc/avatar/f11f237b3de93c93b24045e71f7f65c6?s=80&d=mm&r=g"><div class="socila-check qq-check"><i class="fa fa-qq" aria-hidden="true"></i></div><div class="socila-check gravatar-check"><i class="fa fa-google" aria-hidden="true"></i></div></div>',
|
||||
'avatar' => '<div class="cmt-info-container"><div class="comment-user-avatar"><img src="' . get_template_directory_uri() . '/images/avatar.jpeg"><div class="socila-check qq-check"><i class="fa fa-qq" aria-hidden="true"></i></div><div class="socila-check gravatar-check"><i class="fa fa-google" aria-hidden="true"></i></div></div>',
|
||||
'author' =>
|
||||
'<div class="popup cmt-popup cmt-author" onclick="cmt_showPopup(this)"><span class="popuptext" id="thePopup" style="margin-left: -115px;width: 230px;">' . __("Auto pull nickname and avatar with a QQ num. entered", "sakura")/*输入QQ号将自动拉取昵称和头像*/ . '</span><input type="text" placeholder="' . __("Nickname or QQ number", "sakura") /*昵称或QQ号*/. ' ' . ( $req ? '(' . __("Name* ", "sakura") . ')' : '') . '" name="author" id="author" value="' . esc_attr($comment_author) . '" size="22" autocomplete="off" tabindex="1" ' . ($req ? "aria-required='true'" : '' ). ' /></div>',
|
||||
'email' =>
|
||||
'<div class="popup cmt-popup" onclick="cmt_showPopup(this)"><span class="popuptext" id="thePopup" style="margin-left: -65px;width: 130px;">' . __("You\' receive notification by email", "sakura")/*你将收到回复通知*/ . '</span><input type="text" placeholder="' . __("email", "sakura") . ' ' . ( $req ? '(' . __("Must* ", "sakura") . ')' : '') . '" name="email" id="email" value="' . esc_attr($comment_author_email) . '" size="22" tabindex="1" autocomplete="off" ' . ($req ? "aria-required='true'" : '' ). ' /></div>',
|
||||
'<div class="popup cmt-popup" onclick="cmt_showPopup(this)"><span class="popuptext" id="thePopup" style="margin-left: -65px;width: 130px;">' . __("You will receive notification by email", "sakura")/*你将收到回复通知*/ . '</span><input type="text" placeholder="' . __("email", "sakura") . ' ' . ( $req ? '(' . __("Must* ", "sakura") . ')' : '') . '" name="email" id="email" value="' . esc_attr($comment_author_email) . '" size="22" tabindex="1" autocomplete="off" ' . ($req ? "aria-required='true'" : '' ). ' /></div>',
|
||||
'url' =>
|
||||
'<div class="popup cmt-popup" onclick="cmt_showPopup(this)"><span class="popuptext" id="thePopup" style="margin-left: -55px;width: 110px;">' . __("Advertisement is forbidden 😀", "sakura")/*禁止小广告😀*/ . '</span><input type="text" placeholder="' . __("Site", "sakura") . '" name="url" id="url" value="' . esc_attr($comment_author_url) . '" size="22" autocomplete="off" tabindex="1" /></div></div>' . $robot_comments . $private_ms . $mail_notify ,
|
||||
'qq' =>
|
||||
|
|
Before Width: | Height: | Size: 55 KiB |
|
@ -1,14 +0,0 @@
|
|||
<?php
|
||||
$img_array = glob("gallery/*.{gif,jpg,png}",GLOB_BRACE);
|
||||
|
||||
$img = array_rand($img_array);
|
||||
|
||||
$imgurl=$img_array[$img];
|
||||
|
||||
if($imgurl) {
|
||||
header("Location: " . $imgurl);
|
||||
exit();
|
||||
} else {
|
||||
exit('error');
|
||||
}
|
||||
?>
|
Before Width: | Height: | Size: 486 KiB |
Before Width: | Height: | Size: 732 KiB |
|
@ -1,14 +0,0 @@
|
|||
<?php
|
||||
$img_array = glob("gallery/*.{gif,jpg,png}",GLOB_BRACE);
|
||||
|
||||
$img = array_rand($img_array);
|
||||
|
||||
$imgurl=$img_array[$img];
|
||||
|
||||
if($imgurl) {
|
||||
header("Location: " . $imgurl);
|
||||
exit();
|
||||
} else {
|
||||
exit('error');
|
||||
}
|
||||
?>
|
10
footer.php
|
@ -65,7 +65,8 @@
|
|||
<?php wp_nav_menu( array( 'depth' => 2, 'theme_location' => 'primary', 'container' => false ) ); ?>
|
||||
</div><!-- m-nav-center end -->
|
||||
<a class="cd-top faa-float animated "></a>
|
||||
<button onclick="topFunction()" id="moblieGoTop" title="Go to top"><i class="fa fa-chevron-up" aria-hidden="true"></i></button>
|
||||
<button id="moblieGoTop" title="Go to top"><i class="fa fa-chevron-up" aria-hidden="true"></i></button>
|
||||
<button id="moblieDarkLight"><i class="fa fa-moon-o" aria-hidden="true"></i></button>
|
||||
<!-- search start -->
|
||||
<form class="js-search search-form search-form--modal" method="get" action="<?php echo home_url(); ?>" role="search">
|
||||
<div class="search-form__inner">
|
||||
|
@ -148,16 +149,15 @@
|
|||
<div class="show-hide-wrap"><button class="show-hide"><svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 32 32"><path d="M22 16l-10.105-10.6-1.895 1.987 8.211 8.613-8.211 8.612 1.895 1.988 8.211-8.613z"></path></svg></button></div>
|
||||
</aside>
|
||||
<?php endif; ?>
|
||||
<?php if (akina_option('playlist_id', '')): ?>
|
||||
<?php if (akina_option('aplayer_server') != 'off'): ?>
|
||||
<div id="aplayer-float" style="z-index: 100;"
|
||||
class="aplayer"
|
||||
data-id="<?php echo akina_option('playlist_id', ''); ?>"
|
||||
data-server="netease"
|
||||
data-id="<?php echo akina_option('aplayer_playlistid', ''); ?>"
|
||||
data-server="<?php echo akina_option('aplayer_server'); ?>"
|
||||
data-type="playlist"
|
||||
data-fixed="true"
|
||||
data-theme="orange">
|
||||
</div>
|
||||
<style>.skin-menu{left:auto;right:10px;}.changeSkin-gear{left:auto;right:5px;}</style>
|
||||
<?php endif; ?>
|
||||
</body>
|
||||
</html>
|
||||
|
|
2052
functions.php
|
@ -62,6 +62,7 @@ if (akina_option('akina_meta') == true) {
|
|||
<meta name="keywords" content="<?php echo $keywords; ?>" />
|
||||
<?php } ?>
|
||||
<link rel="shortcut icon" href="<?php echo akina_option('favicon_link', ''); ?>"/>
|
||||
<meta name="theme-color" content="#31363b">
|
||||
<meta http-equiv="x-dns-prefetch-control" content="on">
|
||||
<?php wp_head(); ?>
|
||||
<script type="text/javascript">
|
||||
|
@ -78,9 +79,7 @@ window.dataLayer=window.dataLayer||[];function gtag(){dataLayer.push(arguments)}
|
|||
<?php endif; ?>
|
||||
</head>
|
||||
<body <?php body_class(); ?>>
|
||||
<?php if(get_template_directory_uri() != get_site_url().'/wp-content/themes/Sakura') echo '<div style="position:fixed;height:100%;width:100%;top:0;left:0;font-size:20px;z-index:999999;background-color: #fff;">Plz rename the theme folder name as <span style="color:red">Sakura</span>!<br>请将主题文件夹名改为 <span style="color:red">Sakura</span>!</div>'; ?>
|
||||
<?php if(!function_exists('curl_exec')) echo '<div style="position:fixed;height:100%;width:100%;top:0;left:0;font-size:20px;z-index:999999;background-color: #fff;">主题需要 PHP 的 curl 支持!请在 `php.ini` 里开启或者联系你的主机商。<br>The theme requires PHP\'s curl support! Please turn on in `php.ini` or contact your hosting provider.</div>'; ?>
|
||||
<div class="scrollbar" id="bar"></div>
|
||||
<div class="scrollbar" id="bar"></div>
|
||||
<section id="main-container">
|
||||
<?php
|
||||
if(!akina_option('head_focus')){
|
||||
|
|
After Width: | Height: | Size: 900 B |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
BIN
images/logo.png
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 70 KiB After Width: | Height: | Size: 56 KiB |
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 65 KiB After Width: | Height: | Size: 40 KiB |
Before Width: | Height: | Size: 56 KiB After Width: | Height: | Size: 34 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 47 KiB After Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 39 KiB |
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 47 KiB |
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 8.1 KiB |
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 47 KiB After Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 8.9 KiB |
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 32 KiB |
BIN
images/temp.jpg
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 30 KiB |
|
@ -17,7 +17,7 @@ class Parsedown
|
|||
{
|
||||
# ~
|
||||
|
||||
const version = '1.7.3';
|
||||
const version = '1.7.4';
|
||||
|
||||
# ~
|
||||
|
||||
|
@ -1489,22 +1489,41 @@ class Parsedown
|
|||
}
|
||||
}
|
||||
|
||||
$permitRawHtml = false;
|
||||
|
||||
if (isset($Element['text']))
|
||||
{
|
||||
$text = $Element['text'];
|
||||
}
|
||||
// very strongly consider an alternative if you're writing an
|
||||
// extension
|
||||
elseif (isset($Element['rawHtml']))
|
||||
{
|
||||
$text = $Element['rawHtml'];
|
||||
$allowRawHtmlInSafeMode = isset($Element['allowRawHtmlInSafeMode']) && $Element['allowRawHtmlInSafeMode'];
|
||||
$permitRawHtml = !$this->safeMode || $allowRawHtmlInSafeMode;
|
||||
}
|
||||
|
||||
if (isset($text))
|
||||
{
|
||||
$markup .= '>';
|
||||
|
||||
if (!isset($Element['nonNestables']))
|
||||
if (!isset($Element['nonNestables']))
|
||||
{
|
||||
$Element['nonNestables'] = array();
|
||||
}
|
||||
|
||||
if (isset($Element['handler']))
|
||||
{
|
||||
$markup .= $this->{$Element['handler']}($Element['text'], $Element['nonNestables']);
|
||||
$markup .= $this->{$Element['handler']}($text, $Element['nonNestables']);
|
||||
}
|
||||
elseif (!$permitRawHtml)
|
||||
{
|
||||
$markup .= self::escape($text, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
$markup .= self::escape($Element['text'], true);
|
||||
$markup .= $text;
|
||||
}
|
||||
|
||||
$markup .= '</'.$Element['name'].'>';
|
||||
|
|
BIN
inc/QQWry.Dat
|
@ -1,216 +1,145 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Classes
|
||||
*/
|
||||
include_once('classes/Aplayer.php');
|
||||
include_once('classes/Bilibili.php');
|
||||
include_once('classes/Cache.php');
|
||||
include_once('classes/Images.php');
|
||||
include_once('classes/QQ.php');
|
||||
|
||||
use Sakura\API\Images;
|
||||
use Sakura\API\QQ;
|
||||
use Sakura\API\Cache;
|
||||
|
||||
/**
|
||||
* Router
|
||||
*/
|
||||
add_action('rest_api_init', function () {
|
||||
register_rest_route('sakura/v1', '/image/upload', array(
|
||||
'methods' => 'POST',
|
||||
'callback' => 'upload_image',
|
||||
));
|
||||
register_rest_route('sakura/v1', '/cache_search/json', array(
|
||||
'methods' => 'GET',
|
||||
'callback' => 'cache_search_json',
|
||||
));
|
||||
register_rest_route('sakura/v1', '/image/upload', array(
|
||||
'methods' => 'POST',
|
||||
'callback' => 'upload_image',
|
||||
));
|
||||
register_rest_route('sakura/v1', '/cache_search/json', array(
|
||||
'methods' => 'GET',
|
||||
'callback' => 'cache_search_json',
|
||||
));
|
||||
register_rest_route('sakura/v1', '/image/cover', array(
|
||||
'methods' => 'GET',
|
||||
'callback' => 'cover_gallery',
|
||||
));
|
||||
register_rest_route('sakura/v1', '/image/feature', array(
|
||||
'methods' => 'GET',
|
||||
'callback' => 'feature_gallery',
|
||||
));
|
||||
register_rest_route('sakura/v1', '/database/update', array(
|
||||
'methods' => 'GET',
|
||||
'callback' => 'update_database',
|
||||
));
|
||||
register_rest_route('sakura/v1', '/qqinfo/json', array(
|
||||
'methods' => 'GET',
|
||||
'callback' => 'get_qq_info',
|
||||
));
|
||||
register_rest_route('sakura/v1', '/qqinfo/avatar', array(
|
||||
'methods' => 'GET',
|
||||
'callback' => 'get_qq_avatar',
|
||||
));
|
||||
register_rest_route('sakura/v1', '/bangumi/bilibili', array(
|
||||
'methods' => 'POST',
|
||||
'callback' => 'bgm_bilibili',
|
||||
));
|
||||
register_rest_route('sakura/v1', '/meting/aplayer', array(
|
||||
'methods' => 'GET',
|
||||
'callback' => 'meting_aplayer',
|
||||
));
|
||||
});
|
||||
|
||||
/**
|
||||
* Image uploader response
|
||||
*/
|
||||
function upload_image(WP_REST_Request $request)
|
||||
{
|
||||
// see: https://developer.wordpress.org/rest-api/requests/
|
||||
function upload_image(WP_REST_Request $request) {
|
||||
// see: https://developer.wordpress.org/rest-api/requests/
|
||||
|
||||
// handle file params $file === $_FILES
|
||||
/**
|
||||
* curl \
|
||||
* -F "filecomment=This is an img file" \
|
||||
* -F "cmt_img_file=@screenshot.jpg" \
|
||||
* https://dev.2heng.xin/wp-json/sakura/v1/image/upload
|
||||
*/
|
||||
// $file = $request->get_file_params();
|
||||
if ( !check_ajax_referer('wp_rest', '_wpnonce', false) ) {
|
||||
$output = array(
|
||||
'status' => 403,
|
||||
'success' => false,
|
||||
'message' => 'Unauthorized client.',
|
||||
'link' => "https://view.moezx.cc/images/2019/11/14/step04.md.png",
|
||||
'proxy' => akina_option('cmt_image_proxy') . "https://view.moezx.cc/images/2019/11/14/step04.md.png",
|
||||
);
|
||||
$result = new WP_REST_Response($output, 403);
|
||||
// handle file params $file === $_FILES
|
||||
/**
|
||||
* curl \
|
||||
* -F "filecomment=This is an img file" \
|
||||
* -F "cmt_img_file=@screenshot.jpg" \
|
||||
* https://dev.2heng.xin/wp-json/sakura/v1/image/upload
|
||||
*/
|
||||
// $file = $request->get_file_params();
|
||||
if (!check_ajax_referer('wp_rest', '_wpnonce', false)) {
|
||||
$output = array('status' => 403,
|
||||
'success' => false,
|
||||
'message' => 'Unauthorized client.',
|
||||
'link' => "https://view.moezx.cc/images/2019/11/14/step04.md.png",
|
||||
'proxy' => akina_option('cmt_image_proxy') . "https://view.moezx.cc/images/2019/11/14/step04.md.png",
|
||||
);
|
||||
$result = new WP_REST_Response($output, 403);
|
||||
$result->set_headers(array('Content-Type' => 'application/json'));
|
||||
return $result;
|
||||
}
|
||||
$images = new \Sakura\API\Images();
|
||||
switch (akina_option("img_upload_api")) {
|
||||
case 'imgur':
|
||||
$image = file_get_contents($_FILES["cmt_img_file"]["tmp_name"]);
|
||||
$API_Request = $images->Imgur_API($image);
|
||||
break;
|
||||
case 'smms':
|
||||
$image = $_FILES;
|
||||
$API_Request = $images->SMMS_API($image);
|
||||
break;
|
||||
case 'chevereto':
|
||||
$image = file_get_contents($_FILES["cmt_img_file"]["tmp_name"]);
|
||||
$API_Request = $images->Chevereto_API($image);
|
||||
break;
|
||||
}
|
||||
|
||||
$result = new WP_REST_Response($API_Request, $API_Request['status']);
|
||||
$result->set_headers(array('Content-Type' => 'application/json'));
|
||||
return $result;
|
||||
}
|
||||
|
||||
switch (akina_option("img_upload_api")) {
|
||||
case 'imgur':
|
||||
$image = file_get_contents($_FILES["cmt_img_file"]["tmp_name"]);
|
||||
$API_Request = Imgur_API($image);
|
||||
break;
|
||||
case 'smms':
|
||||
$image = $_FILES;
|
||||
$API_Request = SMMS_API($image);
|
||||
break;
|
||||
case 'chevereto':
|
||||
$image = file_get_contents($_FILES["cmt_img_file"]["tmp_name"]);
|
||||
$API_Request = Chevereto_API($image);
|
||||
break;
|
||||
}
|
||||
|
||||
$result = new WP_REST_Response($API_Request, $API_Request->status);
|
||||
$result->set_headers(array('Content-Type' => 'application/json'));
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Chevereto upload interface
|
||||
|
||||
/*
|
||||
* 随机封面图 rest api
|
||||
* @rest api接口路径:https://sakura.2heng.xin/wp-json/sakura/v1/image/cover
|
||||
*/
|
||||
function Chevereto_API($image)
|
||||
{
|
||||
$fields = array(
|
||||
'source' => base64_encode($image),
|
||||
'key' => akina_option('chevereto_api_key')
|
||||
);
|
||||
function cover_gallery() {
|
||||
$imgurl = Images::cover_gallery();
|
||||
$data = array('cover image');
|
||||
$response = new WP_REST_Response($data);
|
||||
$response->set_status(302);
|
||||
$response->header('Location', $imgurl);
|
||||
return $response;
|
||||
}
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, akina_option('cheverto_url').'/api/1/upload');
|
||||
curl_setopt($ch, CURLOPT_POST, true);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
|
||||
/*
|
||||
* 随机文章特色图 rest api
|
||||
* @rest api接口路径:https://sakura.2heng.xin/wp-json/sakura/v1/image/feature
|
||||
*/
|
||||
function feature_gallery() {
|
||||
$imgurl = Images::feature_gallery();
|
||||
$data = array('feature image');
|
||||
$response = new WP_REST_Response($data);
|
||||
$response->set_status(302);
|
||||
$response->header('Location', $imgurl);
|
||||
return $response;
|
||||
}
|
||||
|
||||
$reply = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
|
||||
$reply = json_decode($reply);
|
||||
|
||||
if ($reply->status_txt == 'OK' && $reply->status_code == 200) {
|
||||
$status = 200;
|
||||
$success = true;
|
||||
$message = "success";
|
||||
$link = $reply->image->image->url;
|
||||
$proxy = akina_option('cmt_image_proxy') . $link;
|
||||
/*
|
||||
* update database rest api
|
||||
* @rest api接口路径:https://sakura.2heng.xin/wp-json/sakura/v1/database/update
|
||||
*/
|
||||
function update_database() {
|
||||
if (akina_option('cover_cdn_options') == "type_1") {
|
||||
$output = Cache::update_database();
|
||||
$result = new WP_REST_Response($output, 200);
|
||||
return $result;
|
||||
} else {
|
||||
$status = $reply->status_code;
|
||||
$success = false;
|
||||
$message = $reply->error->message;
|
||||
$link = 'https://view.moezx.cc/images/2019/10/28/default_d_h_large.gif';
|
||||
$proxy = akina_option('cmt_image_proxy') . $link;
|
||||
return new WP_REST_Response("Invalid access", 200);
|
||||
}
|
||||
$output = array(
|
||||
'status' => $status,
|
||||
'success' => $success,
|
||||
'message' => $message,
|
||||
'link' => $link,
|
||||
'proxy' => $proxy,
|
||||
);
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Imgur upload interface
|
||||
*/
|
||||
function Imgur_API($image)
|
||||
{
|
||||
$client_id = akina_option('imgur_client_id');
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, akina_option('imgur_upload_image_proxy'));
|
||||
curl_setopt($ch, CURLOPT_POST, true);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: Client-ID ' . $client_id));
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, array('image' => base64_encode($image)));
|
||||
|
||||
$reply = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
|
||||
$reply = json_decode($reply);
|
||||
|
||||
if ($reply->success && $reply->status == 200) {
|
||||
$status = 200;
|
||||
$success = true;
|
||||
$message = "success";
|
||||
$link = $reply->data->link;
|
||||
$proxy = akina_option('cmt_image_proxy') . $link;
|
||||
} else {
|
||||
$status = $reply->status;
|
||||
$success = false;
|
||||
$message = $reply->data->error;
|
||||
$link = 'https://view.moezx.cc/images/2019/10/28/default_d_h_large.gif';
|
||||
$proxy = akina_option('cmt_image_proxy') . $link;
|
||||
}
|
||||
$output = array(
|
||||
'status' => $status,
|
||||
'success' => $success,
|
||||
'message' => $message,
|
||||
'link' => $link,
|
||||
'proxy' => $proxy,
|
||||
);
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* smms upload interface
|
||||
*/
|
||||
function SMMS_API($image)
|
||||
{
|
||||
$client_id = akina_option('smms_client_id');
|
||||
|
||||
$filename = $image['cmt_img_file']['name'];
|
||||
$filedata = $image['cmt_img_file']['tmp_name'];
|
||||
$filesize = $image['cmt_img_file']['size'];
|
||||
|
||||
$url = "https://sm.ms/api/v2/upload";
|
||||
$headers = array();
|
||||
array_push($headers, "Content-Type: multipart/form-data");
|
||||
array_push($headers, "Authorization: Basic " . $client_id);
|
||||
array_push($headers, "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97");
|
||||
|
||||
$finfo = new \finfo(FILEINFO_MIME_TYPE);
|
||||
$mimetype = $finfo->file($filedata);
|
||||
|
||||
$fields = array('smfile' => curl_file_create($filedata, $mimetype, $filename));
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
||||
curl_setopt($ch, CURLOPT_POST, true);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
|
||||
|
||||
$reply = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
|
||||
$reply = json_decode($reply);
|
||||
|
||||
if ($reply->success && $reply->code == 'success') {
|
||||
$status = 200;
|
||||
$success = true;
|
||||
$message = $reply->message;
|
||||
$link = $reply->data->url;
|
||||
$proxy = akina_option('cmt_image_proxy') . $link;
|
||||
} else if (preg_match("/Image upload repeated limit/i", $reply->message, $matches)) {
|
||||
$status = 200; // sm.ms 接口不规范,建议检测到重复的情况下返回标准化的 code,并单独把 url 放进一个字段
|
||||
$success = true;
|
||||
$message = $reply->message;
|
||||
$link = str_replace('Image upload repeated limit, this image exists at: ', '', $reply->message);
|
||||
$proxy = akina_option('cmt_image_proxy') . $link;
|
||||
} else {
|
||||
$status = 400;
|
||||
$success = false;
|
||||
$message = $reply->message;
|
||||
$link = 'https://view.moezx.cc/images/2019/10/28/default_d_h_large.gif';
|
||||
$proxy = akina_option('cmt_image_proxy') . $link;
|
||||
}
|
||||
$output = array(
|
||||
'status' => $status,
|
||||
'success' => $success,
|
||||
'message' => $message,
|
||||
'link' => $link,
|
||||
'proxy' => $proxy,
|
||||
);
|
||||
return $output;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -218,52 +147,121 @@ function SMMS_API($image)
|
|||
* @rest api接口路径:https://sakura.2heng.xin/wp-json/sakura/v1/cache_search/json
|
||||
* @可在cache_search_json()函数末尾通过设置 HTTP header 控制 json 缓存时间
|
||||
*/
|
||||
function cache_search_json()
|
||||
{
|
||||
$vowels = array("[", "{", "]", "}", "<", ">", "\r\n", "\r", "\n", "-", "'", '"', '`', " ", ":", ";", '\\', " ", "toc");
|
||||
$regex = <<<EOS
|
||||
/<\/?[a-zA-Z]+("[^"]*"|'[^']*'|[^'">])*>|begin[\S\s]*\/begin|hermit[\S\s]*\/hermit|img[\S\s]*\/img|{{.*?}}|:.*?:/m
|
||||
EOS;
|
||||
|
||||
$posts = new WP_Query('posts_per_page=-1&post_status=publish&post_type=post');
|
||||
while ($posts->have_posts()): $posts->the_post();
|
||||
$output .= '{"type":"post","link":"' . get_post_permalink() . '","title":' . json_encode(get_the_title()) . ',"comments":"' . get_comments_number('0', '1', '%') . '","text":' . json_encode(str_replace($vowels, " ", preg_replace($regex, ' ', get_the_content()))) . '},';
|
||||
endwhile;
|
||||
wp_reset_postdata();
|
||||
|
||||
$pages = get_pages();
|
||||
foreach ($pages as $page) {
|
||||
$output .= '{"type":"page","link":"' . get_page_link($page) . '","title":' . json_encode($page->post_title) . ',"comments":"' . $page->comment_count . '","text":' . json_encode(str_replace($vowels, " ", preg_replace($regex, ' ', $page->post_content))) . '},';
|
||||
function cache_search_json() {
|
||||
if (!check_ajax_referer('wp_rest', '_wpnonce', false)) {
|
||||
$output = array(
|
||||
'status' => 403,
|
||||
'success' => false,
|
||||
'message' => 'Unauthorized client.'
|
||||
);
|
||||
$result = new WP_REST_Response($output, 403);
|
||||
} else {
|
||||
$output = Cache::search_json();
|
||||
$result = new WP_REST_Response($output, 200);
|
||||
}
|
||||
|
||||
$tags = get_tags();
|
||||
foreach ($tags as $tag) {
|
||||
$output .= '{"type":"tag","link":"' . get_term_link($tag) . '","title":' . json_encode($tag->name) . ',"comments":"","text":""},';
|
||||
}
|
||||
|
||||
$categories = get_categories();
|
||||
foreach ($categories as $category) {
|
||||
$output .= '{"type":"category","link":"' . get_term_link($category) . '","title":' . json_encode($category->name) . ',"comments":"","text":""},';
|
||||
}
|
||||
if (akina_option('live_search_comment')) {
|
||||
$comments = get_comments();
|
||||
foreach ($comments as $comment) {
|
||||
$is_private = get_comment_meta($comment->comment_ID, '_private', true);
|
||||
if ($is_private) {
|
||||
$output .= '{"type":"comment","link":"' . get_comment_link($comment) . '","title":' . json_encode(get_the_title($comment->comment_post_ID)) . ',"comments":"","text":' . json_encode($comment->comment_author . ":" . __("The comment is private", "sakura") /*该评论为私密评论*/) . '},';
|
||||
continue;
|
||||
} else {
|
||||
$output .= '{"type":"comment","link":"' . get_comment_link($comment) . '","title":' . json_encode(get_the_title($comment->comment_post_ID)) . ',"comments":"","text":' . json_encode(str_replace($vowels, " ", preg_replace($regex, " ", $comment->comment_author . ":" . $comment->comment_content))) . '},';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$output = substr($output, 0, strlen($output) - 1);
|
||||
|
||||
$data = '[' . $output . ']';
|
||||
$result = new WP_REST_Response(json_decode($data), 200);
|
||||
$result->set_headers(array('Content-Type' => 'application/json',
|
||||
'Cache-Control' => 'max-age=3600')); // json 缓存控制
|
||||
|
||||
$result->set_headers(
|
||||
array(
|
||||
'Content-Type' => 'application/json',
|
||||
'Cache-Control' => 'max-age=3600', // json 缓存控制
|
||||
)
|
||||
);
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* QQ info
|
||||
* https://sakura.2heng.xin/wp-json/sakura/v1/qqinfo/json
|
||||
*/
|
||||
function get_qq_info(WP_REST_Request $request) {
|
||||
if (!check_ajax_referer('wp_rest', '_wpnonce', false)) {
|
||||
$output = array(
|
||||
'status' => 403,
|
||||
'success' => false,
|
||||
'message' => 'Unauthorized client.'
|
||||
);
|
||||
} elseif ($_GET['qq']) {
|
||||
$qq = $_GET['qq'];
|
||||
$output = QQ::get_qq_info($qq);
|
||||
} else {
|
||||
$output = array(
|
||||
'status' => 400,
|
||||
'success' => false,
|
||||
'message' => 'Bad Request'
|
||||
);
|
||||
}
|
||||
|
||||
$result = new WP_REST_Response($output, $output['status']);
|
||||
$result->set_headers(array('Content-Type' => 'application/json'));
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* QQ头像链接解密
|
||||
* https://sakura.2heng.xin/wp-json/sakura/v1/qqinfo/avatar
|
||||
*/
|
||||
function get_qq_avatar() {
|
||||
$encrypted = $_GET["qq"];
|
||||
$imgurl = QQ::get_qq_avatar($encrypted);
|
||||
if (akina_option('qq_avatar_link') == 'type_2') {
|
||||
$imgdata = file_get_contents($imgurl);
|
||||
$response = new WP_REST_Response();
|
||||
$response->set_headers(array(
|
||||
'Content-Type' => 'image/jpeg',
|
||||
'Cache-Control' => 'max-age=86400'
|
||||
));
|
||||
echo $imgdata;
|
||||
} else {
|
||||
$response = new WP_REST_Response();
|
||||
$response->set_status(301);
|
||||
$response->header('Location', $imgurl);
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
function bgm_bilibili() {
|
||||
if (!check_ajax_referer('wp_rest', '_wpnonce', false)) {
|
||||
$output = array(
|
||||
'status' => 403,
|
||||
'success' => false,
|
||||
'message' => 'Unauthorized client.'
|
||||
);
|
||||
$response = new WP_REST_Response($output, 403);
|
||||
} else {
|
||||
$page = $_GET["page"] ?: 2;
|
||||
$bgm = new \Sakura\API\Bilibili();
|
||||
$html = preg_replace("/\s+|\n+|\r/", ' ', $bgm->get_bgm_items($page));
|
||||
$response = new WP_REST_Response($html, 200);
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
function meting_aplayer() {
|
||||
$type = $_GET['type'];
|
||||
$id = $_GET['id'];
|
||||
$wpnonce = $_GET['_wpnonce'];
|
||||
$meting_pnonce = $_GET['meting_pnonce'];
|
||||
if ((isset($wpnonce) && !check_ajax_referer('wp_rest', $wpnonce, false)) || (isset($nonce) && !wp_verify_nonce($nonce, $type . '#:' . $id))) {
|
||||
$output = array(
|
||||
'status' => 403,
|
||||
'success' => false,
|
||||
'message' => 'Unauthorized client.'
|
||||
);
|
||||
$response = new WP_REST_Response($output, 403);
|
||||
} else {
|
||||
$Meting_API = new \Sakura\API\Aplayer();
|
||||
$data = $Meting_API->get_data($type, $id);
|
||||
if ($type === 'playlist') {
|
||||
$response = new WP_REST_Response($data, 200);
|
||||
$response->set_headers(array('cache-control' => 'max-age=3600'));
|
||||
} elseif ($type === 'lyric') {
|
||||
$response = new WP_REST_Response();
|
||||
$response->set_headers(array('cache-control' => 'max-age=3600'));
|
||||
echo $data;
|
||||
} else {
|
||||
$response = new WP_REST_Response();
|
||||
$response->set_status(301);
|
||||
$response->header('Location', $data);
|
||||
}
|
||||
}
|
||||
return $response;
|
||||
}
|
|
@ -0,0 +1,156 @@
|
|||
<?php
|
||||
|
||||
namespace Sakura\API;
|
||||
|
||||
class Aplayer
|
||||
{
|
||||
public $server;
|
||||
public $playlist_id;
|
||||
private $cookies;
|
||||
public $api_url;
|
||||
|
||||
public function __construct() {
|
||||
$this->server = akina_option('aplayer_server');
|
||||
$this->playlist_id = akina_option('aplayer_playlistid');
|
||||
$this->cookies = akina_option('aplayer_cookie');
|
||||
$this->api_url = rest_url('sakura/v1/meting/aplayer');
|
||||
require('Meting.php');
|
||||
}
|
||||
|
||||
public function get_data($type, $id) {
|
||||
$server = $this->server;
|
||||
$cookies = $this->cookies;
|
||||
$playlist_id = $this->playlist_id;
|
||||
$api = new \Sakura\API\Meting($server);
|
||||
if (!empty($cookies) && $server === "netease") $api->cookie($cookies);
|
||||
switch ($type) {
|
||||
case 'song':
|
||||
$data = $api->format(true)->song($id);
|
||||
$data = json_decode($data, true)["url"];
|
||||
$data = $this->song_url($data);
|
||||
break;
|
||||
// case 'album':
|
||||
// $data = $api->format(true)->album($id);
|
||||
// $data=json_decode($data, true)["url"];
|
||||
// break;
|
||||
case 'playlist':
|
||||
$data = $api->format(true)->playlist($playlist_id);
|
||||
$data = $this->format_playlist($data);
|
||||
break;
|
||||
case 'lyric':
|
||||
$data = $api->format(true)->lyric($id);
|
||||
$data = $this->format_lyric($data);
|
||||
break;
|
||||
case 'pic':
|
||||
$data = $api->format(true)->pic($id);
|
||||
$data = json_decode($data, true)["url"];
|
||||
break;
|
||||
// case 'search':
|
||||
// $data = $api->format(true)->search($id);
|
||||
// $data=json_decode($data, true);
|
||||
// break;
|
||||
default:
|
||||
$data = $api->format(true)->url($id);
|
||||
$data = json_decode($data, true)["url"];
|
||||
$data = $this->song_url($data);
|
||||
break;
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
private function format_playlist($data) {
|
||||
$server = $this->server;
|
||||
$api_url = $this->api_url;
|
||||
$data = json_decode($data);
|
||||
$playlist = array();
|
||||
foreach ((array)$data as $value) {
|
||||
$name = $value->name;
|
||||
$artists = implode(" / ", (array)$value->artist);
|
||||
$mp3_url = "$api_url?server=$server&type=url&id=" . $value->url_id . '&meting_nonce=' . wp_create_nonce('url#:' . $value->url_id);
|
||||
$cover = "$api_url?server=$server&type=pic&id=" . $value->pic_id . '&meting_nonce=' . wp_create_nonce('pic#:' . $value->url_id);
|
||||
$lyric = "$api_url?server=$server&type=lyric&id=" . $value->lyric_id . '&meting_nonce=' . wp_create_nonce('lyric#:' . $value->url_id);
|
||||
$playlist[] = array(
|
||||
"name" => $name,
|
||||
"artist" => $artists,
|
||||
"url" => $mp3_url,
|
||||
"cover" => $cover,
|
||||
"lrc" => $lyric
|
||||
);
|
||||
}
|
||||
return $playlist;
|
||||
}
|
||||
|
||||
private function song_url($url){
|
||||
$server = $this->server;
|
||||
if ($server == 'netease') {
|
||||
$url = str_replace('://m7c.', '://m7.', $url);
|
||||
$url = str_replace('://m8c.', '://m8.', $url);
|
||||
$url = str_replace('http://m8.', 'https://m9.', $url);
|
||||
$url = str_replace('http://m7.', 'https://m9.', $url);
|
||||
$url = str_replace('http://m10.', 'https://m10.', $url);
|
||||
}elseif ($server == 'xiami') {
|
||||
$url = str_replace('http://', 'https://', $url);
|
||||
}elseif ($server == 'baidu') {
|
||||
$url = str_replace('http://zhangmenshiting.qianqian.com', 'https://gss3.baidu.com/y0s1hSulBw92lNKgpU_Z2jR7b2w6buu', $url);
|
||||
}else{
|
||||
$url = $url;
|
||||
}
|
||||
return $url;
|
||||
}
|
||||
|
||||
private function format_lyric($data) {
|
||||
$server = $this->server;
|
||||
$data = json_decode($data, true);
|
||||
$data = $this->lrctran($data['lyric'], $data['tlyric']);
|
||||
if (empty($data)) {
|
||||
$data = "[00:00.000]此歌曲暂无歌词,请您欣赏";
|
||||
}
|
||||
if ($server === 'tencent') {
|
||||
$data = html_entity_decode($data, ENT_QUOTES | ENT_HTML5);
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
private function lrctran($lyric, $tlyric) {
|
||||
$lyric = $this->lrctrim($lyric);
|
||||
$tlyric = $this->lrctrim($tlyric);
|
||||
$len1 = count($lyric);
|
||||
$len2 = count($tlyric);
|
||||
$result = "";
|
||||
for ($i = 0, $j = 0; $i < $len1 && $j < $len2; $i++) {
|
||||
while ($lyric[$i][0] > $tlyric[$j][0] && $j + 1 < $len2) {
|
||||
$j++;
|
||||
}
|
||||
if ($lyric[$i][0] == $tlyric[$j][0]) {
|
||||
$tlyric[$j][2] = str_replace('/', '', $tlyric[$j][2]);
|
||||
if (!empty($tlyric[$j][2])) {
|
||||
$lyric[$i][2] .= " ({$tlyric[$j][2]})";
|
||||
}
|
||||
$j++;
|
||||
}
|
||||
}
|
||||
for ($i = 0; $i < $len1; $i++) {
|
||||
$t = $lyric[$i][0];
|
||||
$result .= sprintf("[%02d:%02d.%03d]%s\n", $t / 60000, $t % 60000 / 1000, $t % 1000, $lyric[$i][2]);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
private function lrctrim($lyrics) {
|
||||
$lyrics = explode("\n", $lyrics);
|
||||
$data = array();
|
||||
foreach ($lyrics as $key => $lyric) {
|
||||
preg_match('/\[(\d{2}):(\d{2}[\.:]?\d*)]/', $lyric, $lrcTimes);
|
||||
$lrcText = preg_replace('/\[(\d{2}):(\d{2}[\.:]?\d*)]/', '', $lyric);
|
||||
if (empty($lrcTimes)) {
|
||||
continue;
|
||||
}
|
||||
$lrcTimes = intval($lrcTimes[1]) * 60000 + intval(floatval($lrcTimes[2]) * 1000);
|
||||
$lrcText = preg_replace('/\s\s+/', ' ', $lrcText);
|
||||
$lrcText = trim($lrcText);
|
||||
$data[] = array($lrcTimes, $key, $lrcText);
|
||||
}
|
||||
sort($data);
|
||||
return $data;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
<?php
|
||||
|
||||
namespace Sakura\API;
|
||||
|
||||
class Bilibili
|
||||
{
|
||||
private $uid;
|
||||
private $cookies;
|
||||
|
||||
public function __construct() {
|
||||
$this->uid = akina_option('bilibili_id');
|
||||
$this->cookies = akina_option('bilibili_cookie');
|
||||
}
|
||||
|
||||
public function get_the_bgm_items($page = 1) {
|
||||
$uid = $this->uid;
|
||||
$cookies = $this->cookies;
|
||||
$url = 'https://api.bilibili.com/x/space/bangumi/follow/list?type=1&pn=' . $page . '&ps=15&follow_status=0&vmid=' . $uid;
|
||||
$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);
|
||||
}
|
||||
|
||||
public function get_bgm_items($page = 1) {
|
||||
$bgm = json_decode($this->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"];
|
||||
$html = "";
|
||||
foreach ((array)$lists as $list) {
|
||||
if (preg_match('/看完/m', $list["progress"], $matches_finish)) {
|
||||
$percent = 100;
|
||||
} else {
|
||||
preg_match('/第(\d+)./m', $list['progress'], $matches_progress);
|
||||
preg_match('/第(\d+)./m', $list["new_ep"]['index_show'], $matches_new);
|
||||
$progress = is_numeric($matches_progress[1]) ? $matches_progress[1] : 0;
|
||||
$total = is_numeric($matches_new[1]) ? $matches_new[1] : $list['total_count'];
|
||||
$percent = $progress / $total * 100;
|
||||
}
|
||||
$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: ' . $percent . '%"></div>
|
||||
<p>' . $list['new_ep']['index_show'] . '</p>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>';
|
||||
}
|
||||
$html .= '</div><br><div id="bangumi-pagination">' . $next . '</div>';
|
||||
return $html;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,103 @@
|
|||
<?php
|
||||
|
||||
namespace Sakura\API;
|
||||
|
||||
class Cache
|
||||
{
|
||||
public static function search_json() {
|
||||
global $more;
|
||||
$vowels = array("[", "{", "]", "}", "<", ">", "\r\n", "\r", "\n", "-", "'", '"', '`', " ", ":", ";", '\\', " ", "toc");
|
||||
$regex = <<<EOS
|
||||
/<\/?[a-zA-Z]+("[^"]*"|'[^']*'|[^'">])*>|begin[\S\s]*\/begin|hermit[\S\s]*\/hermit|img[\S\s]*\/img|{{.*?}}|:.*?:/m
|
||||
EOS;
|
||||
$more = 1;
|
||||
$output = array();
|
||||
|
||||
$posts = new \WP_Query('posts_per_page=-1&post_status=publish&post_type=post');
|
||||
while ($posts->have_posts()): $posts->the_post();
|
||||
$output[] = array(
|
||||
"type" => "post",
|
||||
"link" => get_permalink(),
|
||||
"title" => get_the_title(),
|
||||
"comments" => get_comments_number('0', '1', '%'),
|
||||
"text" => str_replace($vowels, " ", preg_replace($regex, ' ', apply_filters('the_content', get_the_content())))
|
||||
);
|
||||
endwhile;
|
||||
wp_reset_postdata();
|
||||
|
||||
$pages = new \WP_Query('posts_per_page=-1&post_status=publish&post_type=page');
|
||||
while ($pages->have_posts()): $pages->the_post();
|
||||
$output[] = array(
|
||||
"type" => "page",
|
||||
"link" => get_permalink(),
|
||||
"title" => get_the_title(),
|
||||
"comments" => get_comments_number('0', '1', '%'),
|
||||
"text" => str_replace($vowels, " ", preg_replace($regex, ' ', apply_filters('the_content', get_the_content())))
|
||||
);
|
||||
endwhile;
|
||||
wp_reset_postdata();
|
||||
|
||||
$tags = get_tags();
|
||||
foreach ($tags as $tag) {
|
||||
$output[] = array(
|
||||
"type" => "tag",
|
||||
"link" => get_term_link($tag),
|
||||
"title" => $tag->name,
|
||||
"comments" => "",
|
||||
"text" => ""
|
||||
);
|
||||
}
|
||||
|
||||
$categories = get_categories();
|
||||
foreach ($categories as $category) {
|
||||
$output[] = array(
|
||||
"type" => "category",
|
||||
"link" => get_term_link($category),
|
||||
"title" => $category->name,
|
||||
"comments" => "",
|
||||
"text" => ""
|
||||
);
|
||||
}
|
||||
if (akina_option('live_search_comment')) {
|
||||
$comments = get_comments();
|
||||
foreach ($comments as $comment) {
|
||||
$is_private = get_comment_meta($comment->comment_ID, '_private', true);
|
||||
$output[] = array(
|
||||
"type" => "comment",
|
||||
"link" => get_comment_link($comment),
|
||||
"title" => get_the_title($comment->comment_post_ID),
|
||||
"comments" => "",
|
||||
"text" => $is_private ? ($comment->comment_author . ": " . __('The comment is private', 'sakura')) : str_replace($vowels, ' ', preg_replace($regex, ' ', $comment->comment_author . ":" . $comment->comment_content))
|
||||
);
|
||||
}
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
public static function update_database() {
|
||||
global $wpdb;
|
||||
$sakura_table_name = $wpdb->base_prefix . 'sakura';
|
||||
$img_domain = akina_option('cover_cdn') ? akina_option('cover_cdn') : get_template_directory();
|
||||
$manifest = file_get_contents($img_domain . "/manifest/manifest.json");
|
||||
if ($manifest) {
|
||||
$manifest = array(
|
||||
"mate_key" => "manifest_json",
|
||||
"mate_value" => $manifest
|
||||
);
|
||||
$time = array(
|
||||
"mate_key" => "json_time",
|
||||
"mate_value" => date("Y-m-d H:i:s", time())
|
||||
);
|
||||
|
||||
$wpdb->query("DELETE FROM $sakura_table_name WHERE `mate_key` ='manifest_json'");
|
||||
$wpdb->query("DELETE FROM $sakura_table_name WHERE `mate_key` ='json_time'");
|
||||
$wpdb->insert($sakura_table_name, $manifest);
|
||||
$wpdb->insert($sakura_table_name, $time);
|
||||
$output = "manifest.json has been stored into database.";
|
||||
} else {
|
||||
$output = "manifest.json not found, please ensure your url ($img_domain) is corrent.";
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,174 @@
|
|||
<?php
|
||||
|
||||
namespace Sakura\API;
|
||||
|
||||
class Images
|
||||
{
|
||||
private $chevereto_api_key;
|
||||
private $imgur_client_id;
|
||||
private $smms_client_id;
|
||||
|
||||
public function __construct() {
|
||||
$this->chevereto_api_key = akina_option('chevereto_api_key');
|
||||
$this->imgur_client_id = akina_option('imgur_client_id');
|
||||
$this->smms_client_id = akina_option('smms_client_id');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Chevereto upload interface
|
||||
*/
|
||||
public function Chevereto_API($image) {
|
||||
$upload_url = akina_option('cheverto_url') . '/api/1/upload';
|
||||
$args = array(
|
||||
'body' => array(
|
||||
'source' => base64_encode($image),
|
||||
'key' => $this->chevereto_api_key,
|
||||
),
|
||||
);
|
||||
|
||||
$response = wp_remote_post($upload_url, $args);
|
||||
$reply = json_decode($response["body"]);
|
||||
|
||||
if ($reply->status_txt == 'OK' && $reply->status_code == 200) {
|
||||
$status = 200;
|
||||
$success = true;
|
||||
$message = "success";
|
||||
$link = $reply->image->image->url;
|
||||
$proxy = akina_option('cmt_image_proxy') . $link;
|
||||
} else {
|
||||
$status = $reply->status_code;
|
||||
$success = false;
|
||||
$message = $reply->error->message;
|
||||
$link = 'https://view.moezx.cc/images/2019/10/28/default_d_h_large.gif';
|
||||
$proxy = akina_option('cmt_image_proxy') . $link;
|
||||
}
|
||||
$output = array(
|
||||
'status' => $status,
|
||||
'success' => $success,
|
||||
'message' => $message,
|
||||
'link' => $link,
|
||||
'proxy' => $proxy,
|
||||
);
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Imgur upload interface
|
||||
*/
|
||||
public function Imgur_API($image) {
|
||||
$upload_url = akina_option('imgur_upload_image_proxy');
|
||||
$args = array(
|
||||
'headers' => array(
|
||||
'Authorization' => 'Client-ID ' . $this->imgur_client_id,
|
||||
),
|
||||
'body' => array(
|
||||
'image' => base64_encode($image),
|
||||
),
|
||||
);
|
||||
|
||||
$response = wp_remote_post($upload_url, $args);
|
||||
$reply = json_decode($response["body"]);
|
||||
|
||||
if ($reply->success && $reply->status == 200) {
|
||||
$status = 200;
|
||||
$success = true;
|
||||
$message = "success";
|
||||
$link = $reply->data->link;
|
||||
$proxy = akina_option('cmt_image_proxy') . $link;
|
||||
} else {
|
||||
$status = $reply->status;
|
||||
$success = false;
|
||||
$message = $reply->data->error;
|
||||
$link = 'https://view.moezx.cc/images/2019/10/28/default_d_h_large.gif';
|
||||
$proxy = akina_option('cmt_image_proxy') . $link;
|
||||
}
|
||||
$output = array(
|
||||
'status' => $status,
|
||||
'success' => $success,
|
||||
'message' => $message,
|
||||
'link' => $link,
|
||||
'proxy' => $proxy,
|
||||
);
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* smms upload interface
|
||||
*/
|
||||
public function SMMS_API($image) {
|
||||
$client_id = $this->smms_client_id;
|
||||
$upload_url = "https://sm.ms/api/v2/upload";
|
||||
$filename = $image['cmt_img_file']['name'];
|
||||
$filedata = $image['cmt_img_file']['tmp_name'];
|
||||
$Boundary = wp_generate_password();
|
||||
$bits = file_get_contents($filedata);
|
||||
|
||||
$args = array(
|
||||
"headers" => "Content-Type: multipart/form-data; boundary=$Boundary\r\n\r\nAuthorization: Basic $client_id\r\n\r\nUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97",
|
||||
"body" => "--$Boundary\r\nContent-Disposition: form-data; name=\"smfile\"; filename=\"$filename\"\r\n\r\n$bits\r\n\r\n--$Boundary--"
|
||||
);
|
||||
|
||||
$response = wp_remote_post($upload_url, $args);
|
||||
$reply = json_decode($response["body"]);
|
||||
|
||||
if ($reply->success && $reply->code == 'success') {
|
||||
$status = 200;
|
||||
$success = true;
|
||||
$message = $reply->message;
|
||||
$link = $reply->data->url;
|
||||
$proxy = akina_option('cmt_image_proxy') . $link;
|
||||
} else if (preg_match("/Image upload repeated limit/i", $reply->message, $matches)) {
|
||||
$status = 200; // sm.ms 接口不规范,建议检测到重复的情况下返回标准化的 code,并单独把 url 放进一个字段
|
||||
$success = true;
|
||||
$message = $reply->message;
|
||||
$link = str_replace('Image upload repeated limit, this image exists at: ', '', $reply->message);
|
||||
$proxy = akina_option('cmt_image_proxy') . $link;
|
||||
} else {
|
||||
$status = 400;
|
||||
$success = false;
|
||||
$message = $reply->message;
|
||||
$link = 'https://view.moezx.cc/images/2019/10/28/default_d_h_large.gif';
|
||||
$proxy = akina_option('cmt_image_proxy') . $link;
|
||||
}
|
||||
$output = array(
|
||||
'status' => $status,
|
||||
'success' => $success,
|
||||
'message' => $message,
|
||||
'link' => $link,
|
||||
'proxy' => $proxy,
|
||||
);
|
||||
return $output;
|
||||
}
|
||||
|
||||
public static function cover_gallery() {
|
||||
if (akina_option('cover_cdn_options') == "type_2") {
|
||||
$img_array = glob(get_template_directory() . "/manifest/gallary/*.{gif,jpg,png}", GLOB_BRACE);
|
||||
$img = array_rand($img_array);
|
||||
$imgurl = trim($img_array[$img]);
|
||||
$imgurl = str_replace(get_template_directory(), get_template_directory_uri(), $imgurl);
|
||||
} elseif (akina_option('cover_cdn_options') == "type_3") {
|
||||
$imgurl = akina_option('cover_cdn');
|
||||
} else {
|
||||
global $sakura_image_array;
|
||||
$img_array = json_decode($sakura_image_array, true);
|
||||
$img = array_rand($img_array);
|
||||
$img_domain = akina_option('cover_cdn') ? akina_option('cover_cdn') : get_template_directory_uri();
|
||||
if (strpos($_SERVER['HTTP_ACCEPT'], 'image/webp') !== false) {
|
||||
$imgurl = $img_domain . "/manifest/" . $img_array[$img]["webp"][0];
|
||||
} else {
|
||||
$imgurl = $img_domain . "/manifest/" . $img_array[$img]["jpeg"][0];
|
||||
}
|
||||
}
|
||||
return $imgurl;
|
||||
}
|
||||
|
||||
public static function feature_gallery() {
|
||||
if (akina_option('post_cover_options') == "type_2") {
|
||||
$imgurl = akina_option('post_cover');
|
||||
} else {
|
||||
$imgurl = self::cover_gallery();
|
||||
}
|
||||
return $imgurl;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
namespace Sakura\API;
|
||||
|
||||
class QQ
|
||||
{
|
||||
public static function get_qq_info($qq) {
|
||||
$get_info = file_get_contents('http://r.qzone.qq.com/fcg-bin/cgi_get_portrait.fcg?get_nick=1&uins=' . $qq);
|
||||
$get_info = mb_convert_encoding($get_info, "UTF-8", "GBK");
|
||||
$name = json_decode(substr($get_info, 17, -1), true);
|
||||
if ($name) {
|
||||
$output = array(
|
||||
'status' => 200,
|
||||
'success' => true,
|
||||
'message' => 'success',
|
||||
'avatar' => 'https://q.qlogo.cn/headimg_dl?dst_uin=' . $qq . '&spec=100',
|
||||
'name' => $name[$qq][6],
|
||||
);
|
||||
} else {
|
||||
$output = array(
|
||||
'status' => 404,
|
||||
'success' => false,
|
||||
'message' => 'QQ number not exist.'
|
||||
);
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
public static function get_qq_avatar($encrypted) {
|
||||
global $sakura_privkey;
|
||||
if (isset($encrypted)) {
|
||||
$iv = str_repeat($sakura_privkey, 2);
|
||||
$encrypted = base64_decode(urldecode($encrypted));
|
||||
$qq_number = openssl_decrypt($encrypted, 'aes-128-cbc', $sakura_privkey, 0, $iv);
|
||||
preg_match('/^\d{3,}$/', $qq_number, $matches);
|
||||
$imgurl = 'https://q2.qlogo.cn/headimg_dl?dst_uin=' . $matches[0] . '&spec=100';
|
||||
return $imgurl;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -8,7 +8,7 @@ body {
|
|||
|
||||
.nav-tab-wrapper {
|
||||
position: relative;
|
||||
max-width: 860px;
|
||||
max-width: 900px;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@ body {
|
|||
.nav-tab {
|
||||
background: none;
|
||||
border:none;
|
||||
padding: 10px 20px;
|
||||
padding: 10px 15px;
|
||||
font-weight: 300;
|
||||
font-size: 15px;
|
||||
color: darkgoldenrod;
|
||||
|
@ -74,17 +74,23 @@ a#options-group-4-tab:before {
|
|||
|
||||
a#options-group-5-tab:before {
|
||||
font-family: "dashicons";
|
||||
content: "\f110";
|
||||
content: "\f101";
|
||||
float: left;
|
||||
}
|
||||
|
||||
a#options-group-6-tab:before {
|
||||
font-family: "dashicons";
|
||||
content: "\f110";
|
||||
float: left;
|
||||
}
|
||||
|
||||
a#options-group-7-tab:before {
|
||||
font-family: "dashicons";
|
||||
content: "\f325";
|
||||
float: left;
|
||||
}
|
||||
|
||||
a#options-group-7-tab:before {
|
||||
a#options-group-8-tab:before {
|
||||
font-family: "dashicons";
|
||||
content: "\f487";
|
||||
float: left;
|
||||
|
|
Before Width: | Height: | Size: 7.7 KiB After Width: | Height: | Size: 7.6 KiB |
Before Width: | Height: | Size: 7.8 KiB After Width: | Height: | Size: 7.6 KiB |
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 32 KiB |
|
@ -188,9 +188,7 @@ color: #676767 !important}
|
|||
}
|
||||
|
||||
input[type=checkbox]:checked:before {
|
||||
content: "\f147";
|
||||
margin: -2px 0 0 -2px;
|
||||
color: #FF5656;
|
||||
}
|
||||
|
||||
/* loading */
|
||||
|
|
|
@ -25,8 +25,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
|
||||
/* If the user can't edit theme options, no use running this plugin */
|
||||
|
||||
define( 'SAKURA_OPTIONS', __('Sakura Options', 'sakura') );
|
||||
|
||||
add_action( 'init', 'optionsframework_rolescheck' );
|
||||
|
||||
function optionsframework_rolescheck () {
|
||||
|
@ -181,8 +179,8 @@ function optionsframework_setdefaults() {
|
|||
function optionsframework_menu_settings() {
|
||||
|
||||
$menu = array(
|
||||
'page_title' => __( SAKURA_OPTIONS, 'optionsframework'),
|
||||
'menu_title' => __( SAKURA_OPTIONS, 'optionsframework'),
|
||||
'page_title' => __('Sakura Options', 'sakura'),
|
||||
'menu_title' => __('Sakura Options', 'sakura'),
|
||||
'capability' => 'edit_theme_options',
|
||||
'menu_slug' => 'options-framework',
|
||||
'callback' => 'optionsframework_page'
|
||||
|
@ -262,7 +260,6 @@ if ( !function_exists( 'optionsframework_page' ) ) :
|
|||
function optionsframework_page() { ?>
|
||||
|
||||
<div id="optionsframework-wrap" class="wrap">
|
||||
<?php screen_icon( 'themes' ); ?>
|
||||
<h2 class="nav-tab-wrapper">
|
||||
<?php echo optionsframework_tabs(); ?>
|
||||
</h2>
|
||||
|
@ -275,7 +272,7 @@ function optionsframework_page() { ?>
|
|||
<?php settings_fields( 'optionsframework' ); ?>
|
||||
<?php optionsframework_fields(); /* Settings */ ?>
|
||||
<div id="optionsframework-submit">
|
||||
<input type="submit" class="button-primary" name="update" value="<?php esc_attr_e( 'Save', 'sakaura' ); ?>" />
|
||||
<input type="submit" class="button-primary" name="update" value="<?php _e( 'Save', 'sakura' ); ?>" />
|
||||
<input type="submit" class="reset-button button-secondary" name="reset" value="<?php esc_attr_e( 'Restore default', 'sakura' ); ?>" onclick="return confirm( '<?php print esc_js( __( 'All setting will be lost, sure?', 'sakura' ) ); ?>' );" />
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
|
@ -412,7 +409,7 @@ function optionsframework_adminbar() {
|
|||
$wp_admin_bar->add_menu( array(
|
||||
'parent' => 'appearance',
|
||||
'id' => 'of_theme_options',
|
||||
'title' => __( SAKURA_OPTIONS, 'options_framework_theme' ),
|
||||
'title' => __('Sakura Options', 'sakura'),
|
||||
'href' => admin_url( 'themes.php?page=options-framework' )
|
||||
));
|
||||
}
|
||||
|
@ -494,4 +491,4 @@ if ( ! function_exists( 'akina_option' ) ) {
|
|||
|
||||
return $default;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,8 +13,8 @@ mashiro_option.site_name = "<?php echo akina_option('site_name', ''); ?>";
|
|||
mashiro_option.author_name = "<?php echo akina_option('author_name', ''); ?>";
|
||||
mashiro_option.template_url = "<?php echo get_template_directory_uri(); ?>";
|
||||
mashiro_option.site_url = "<?php echo site_url(); ?>";
|
||||
mashiro_option.qq_api_url = "https://api.2heng.xin/qqinfo/";
|
||||
mashiro_option.qq_avatar_api_url = "https://api.2heng.xin/qqinfo/";
|
||||
mashiro_option.qq_api_url = "<?php echo rest_url('sakura/v1/qqinfo/json'); ?>";
|
||||
// mashiro_option.qq_avatar_api_url = "https://api.2heng.xin/qqinfo/";
|
||||
mashiro_option.live_search = <?php if ( akina_option('live_search') ){ echo 'true'; } else { echo 'false'; } ?>;
|
||||
|
||||
<?php if( akina_option('sakura_skin_bg' )){ $bg_arry=explode(",", akina_option('sakura_skin_bg' ));?>
|
||||
|
@ -37,6 +37,8 @@ mashiro_option.skin_bg6 = "https://api.mashiro.top/bing/";
|
|||
mashiro_option.skin_bg7 = "https://cdn.jsdelivr.net/gh/moezx/cdn@3.1.2/other-sites/api-index/images/me.png";
|
||||
<?php } ?>
|
||||
|
||||
mashiro_option.darkmode = <?php if ( akina_option('darkmode') ){ echo 'true'; } else { echo 'false'; } ?>;
|
||||
|
||||
<?php if( is_home() ){ ?>
|
||||
mashiro_option.land_at_home = true;
|
||||
<?php }else {?>
|
||||
|
@ -67,18 +69,14 @@ mashiro_option.jsdelivr_css_src = "<?php echo get_template_directory_uri() ?>/cd
|
|||
<?php } else { ?>
|
||||
mashiro_option.jsdelivr_css_src = "https://cdn.jsdelivr.net/gh/mashirozx/Sakura@<?php echo SAKURA_VERSION; ?>/cdn/css/lib.min.css";
|
||||
<?php } ?>
|
||||
<?php if (akina_option('playlist_id', '')): ?>
|
||||
<?php if (akina_option('aplayer_server') != 'off'): ?>
|
||||
mashiro_option.float_player_on = true;
|
||||
mashiro_option.meting_api_url = "<?php echo rest_url('sakura/v1/meting/aplayer'); ?>";
|
||||
<?php endif; ?>
|
||||
|
||||
<?php
|
||||
if (akina_option('cover_img')) {
|
||||
$imgurl = akina_option('cover_img');
|
||||
} else {
|
||||
$imgurl = get_site_url()."/wp-content/themes/Sakura/cover/index.php";
|
||||
} ?>
|
||||
mashiro_option.cover_api = "<?php echo $imgurl; ?>";
|
||||
mashiro_option.cover_api = "<?php echo rest_url('sakura/v1/image/cover'); ?>";
|
||||
|
||||
mashiro_option.windowheight = /Mobile|Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent) ? 'fixed' : 'auto';
|
||||
/*End of Initial Variables*/
|
||||
</script>
|
||||
<?php }
|
||||
|
|
|
@ -43,11 +43,7 @@ function get_avatar_profile_url(){
|
|||
* 随机图
|
||||
*/
|
||||
function get_random_bg_url(){
|
||||
if ( empty( akina_option('default_feature_image' )) ) {
|
||||
return get_template_directory_uri().'/feature/index.php?'.rand(1,1000);
|
||||
} else {
|
||||
return akina_option('default_feature_image').'?'.rand(1,1000);
|
||||
}
|
||||
return rest_url('sakura/v1/image/feature').'?'.rand(1,1000);
|
||||
}
|
||||
|
||||
|
||||
|
@ -118,7 +114,10 @@ if(akina_option('classify_display')){
|
|||
*/
|
||||
function comment_add_at( $comment_text, $comment = '') {
|
||||
if( $comment->comment_parent > 0) {
|
||||
$comment_text = '<a href="#comment-' . $comment->comment_parent . '" class="comment-at">@'.get_comment_author( $comment->comment_parent ) . '</a> ' . $comment_text;
|
||||
if(substr($comment_text, 0, 3) === "<p>")
|
||||
$comment_text = str_replace(substr($comment_text, 0, 3), '<p><a href="#comment-' . $comment->comment_parent . '" class="comment-at">@'.get_comment_author( $comment->comment_parent ) . '</a> ', $comment_text);
|
||||
else
|
||||
$comment_text = '<a href="#comment-' . $comment->comment_parent . '" class="comment-at">@'.get_comment_author( $comment->comment_parent ) . '</a> ' . $comment_text;
|
||||
}
|
||||
return $comment_text;
|
||||
}
|
||||
|
@ -792,9 +791,6 @@ function siren_get_browsers($ua){
|
|||
}elseif (preg_match('#Edge/([a-zA-Z0-9.]+)#i', $ua, $matches)){
|
||||
$title = 'Edge '. $matches[1];
|
||||
$icon = 'edge';
|
||||
}elseif (preg_match('#Edg/([a-zA-Z0-9.]+)#i', $ua, $matches)){
|
||||
$title = 'Edge Dev (Chromium) '. $matches[1];
|
||||
$icon = 'edge';
|
||||
}elseif (preg_match('#360([a-zA-Z0-9.]+)#i', $ua, $matches)) {
|
||||
$title = '360 Browser '. $matches[1];
|
||||
$icon = '360se';
|
||||
|
|
|
@ -64,7 +64,7 @@ get_header();
|
|||
<?php else : get_template_part( 'tpl/content', 'none' ); endif; ?>
|
||||
</main><!-- #main -->
|
||||
<?php if ( akina_option('pagenav_style') == 'ajax') { ?>
|
||||
<div id="pagination"><?php next_posts_link('Previous'); ?></div>
|
||||
<div id="pagination"><?php next_posts_link(' Previous'); ?></div>
|
||||
<div id="add_post"><span id="add_post_time" style="visibility: hidden;" title="<?php echo akina_option('auto_load_post',''); ?>" ></span></div>
|
||||
<?php }else{ ?>
|
||||
<nav class="navigator">
|
||||
|
|
439
js/sakura-app.js
|
@ -5,6 +5,7 @@
|
|||
* @date 2019.8.3
|
||||
*/
|
||||
mashiro_global.variables = new function () {
|
||||
this.has_hls = false;
|
||||
this.skinSecter = true;
|
||||
}
|
||||
mashiro_global.ini = new function () {
|
||||
|
@ -16,6 +17,7 @@ mashiro_global.ini = new function () {
|
|||
coverVideoIni();
|
||||
checkskinSecter();
|
||||
scrollBar();
|
||||
load_bangumi();
|
||||
}
|
||||
this.pjax = function () { // pjax reload functions (pjax 重载函数)
|
||||
pjaxInit();
|
||||
|
@ -24,6 +26,7 @@ mashiro_global.ini = new function () {
|
|||
copy_code_block();
|
||||
coverVideoIni();
|
||||
checkskinSecter();
|
||||
load_bangumi();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -76,12 +79,21 @@ function post_list_show_animation() {
|
|||
|
||||
function callback(entries) {
|
||||
entries.forEach((article) => {
|
||||
if (article.target.classList.contains("post-list-show")) {
|
||||
io.unobserve(article.target)
|
||||
} else {
|
||||
if (article.isIntersecting) {
|
||||
if (!window.IntersectionObserver) {
|
||||
article.target.style.willChange = 'auto';
|
||||
if( article.target.classList.contains("post-list-show") === false){
|
||||
article.target.classList.add("post-list-show");
|
||||
}
|
||||
} else {
|
||||
if (article.target.classList.contains("post-list-show")) {
|
||||
article.target.style.willChange = 'auto';
|
||||
io.unobserve(article.target)
|
||||
} else {
|
||||
if (article.isIntersecting) {
|
||||
article.target.classList.add("post-list-show");
|
||||
article.target.style.willChange = 'auto';
|
||||
io.unobserve(article.target)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -134,7 +146,7 @@ function code_highlight_style() {
|
|||
}
|
||||
var ele_name = $('pre:eq(' + i + ')')[0].children[0].className;
|
||||
var lang = ele_name.substr(0, ele_name.indexOf(" ")).replace('language-', '');
|
||||
if (lang.toLowerCase() == "hljs") var lang = "text";
|
||||
if (lang.toLowerCase() == "hljs") var lang = $('pre:eq(' + i + ') code').attr("class").replace('hljs', '')?$('pre:eq(' + i + ') code').attr("class").replace('hljs', ''):"text";
|
||||
$('pre:eq(' + i + ')').addClass('highlight-wrap');
|
||||
for (var t in attributes) {
|
||||
$('pre:eq(' + i + ')').attr(t, attributes[t]);
|
||||
|
@ -317,10 +329,49 @@ function checkBgImgCookie() {
|
|||
$("#" + bgurl).click();
|
||||
}
|
||||
}
|
||||
if (document.body.clientWidth > 860) {
|
||||
setTimeout(function () {
|
||||
checkBgImgCookie();
|
||||
}, 100);
|
||||
|
||||
function checkDarkModeCookie() {
|
||||
var dark = getCookie("dark"),
|
||||
today = new Date(),
|
||||
hour = today.getHours();
|
||||
if (mashiro_option.darkmode && ((!dark && (hour > 21 || hour < 7) ) || (dark == '1' && (hour >= 22 || hour <= 6)))) {
|
||||
setTimeout(function () {
|
||||
$("#dark-bg").click();
|
||||
}, 100);
|
||||
$("#moblieDarkLight").html('<i class="fa fa-sun-o" aria-hidden="true"></i>');
|
||||
} else {
|
||||
if (document.body.clientWidth > 860) {
|
||||
setTimeout(function () {
|
||||
checkBgImgCookie();
|
||||
}, 100);
|
||||
} else {
|
||||
$("html").css("background", "unset");
|
||||
$("body").removeClass("dark");
|
||||
$("#moblieDarkLight").html('<i class="fa fa-moon-o" aria-hidden="true"></i>');
|
||||
setCookie("dark", "0", 0.33);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!getCookie("darkcache") && (new Date().getHours() > 21 || new Date().getHours() < 7)) {
|
||||
removeCookie("dark");
|
||||
setCookie("darkcache", "cached", 0.4);
|
||||
}
|
||||
setTimeout(function() {
|
||||
checkDarkModeCookie();
|
||||
}, 100);
|
||||
|
||||
function mobile_dark_light() {
|
||||
if ($("body").hasClass("dark")) {
|
||||
$("html").css("background", "unset");
|
||||
$("body").removeClass("dark");
|
||||
$("#moblieDarkLight").html('<i class="fa fa-moon-o" aria-hidden="true"></i>');
|
||||
setCookie("dark", "0", 0.33);
|
||||
} else {
|
||||
$("html").css("background", "#31363b");
|
||||
$("#moblieDarkLight").html('<i class="fa fa-sun-o" aria-hidden="true"></i>');
|
||||
$("body").addClass("dark");
|
||||
setCookie("dark", "1", 0.33);
|
||||
}
|
||||
}
|
||||
|
||||
function no_right_click() {
|
||||
|
@ -333,13 +384,12 @@ $(document).ready(function () {
|
|||
function checkskin_bg(a) {
|
||||
return a == "none" ? "" : a
|
||||
}
|
||||
|
||||
function changeBG() {
|
||||
var cached = $(".menu-list");
|
||||
cached.find("li").each(function () {
|
||||
var tagid = this.id;
|
||||
cached.on("click", "#" + tagid, function () {
|
||||
if (tagid == "white-bg") {
|
||||
if (tagid == "white-bg" || tagid == "dark-bg") {
|
||||
mashiro_global.variables.skinSecter = true;
|
||||
checkskinSecter();
|
||||
} else {
|
||||
|
@ -347,9 +397,22 @@ $(document).ready(function () {
|
|||
checkskinSecter();
|
||||
}
|
||||
if (tagid == "dark-bg") {
|
||||
$("#night-mode-cover").css("visibility", "visible");
|
||||
} else
|
||||
$("#night-mode-cover").css("visibility", "hidden");
|
||||
addComment.I("content").classList.add('notransition');
|
||||
addComment.I("content").style.backgroundColor = "#fff";
|
||||
addComment.I("content").offsetHeight;
|
||||
addComment.I("content").classList.remove('notransition');
|
||||
$("html").css("background", "#31363b");
|
||||
$("body").addClass("dark");
|
||||
setCookie("dark", "1", 0.33);
|
||||
} else{
|
||||
$("html").css("background", "unset");
|
||||
$("body").removeClass("dark");
|
||||
setCookie("dark", "0", 0.33);
|
||||
setCookie("bgImgSetting", tagid, 30);
|
||||
setTimeout(function () {
|
||||
addComment.I("content").style.backgroundColor = "rgba(255, 255, 255, 0.8)";
|
||||
}, 1000);
|
||||
}
|
||||
switch (tagid) {
|
||||
case "white-bg":
|
||||
$("body").css("background-image", "url(" + checkskin_bg(mashiro_option.skin_bg0) + ")");
|
||||
|
@ -372,11 +435,10 @@ $(document).ready(function () {
|
|||
case "bing-bg":
|
||||
$("body").css("background-image", "url(" + checkskin_bg(mashiro_option.skin_bg6) + ")");
|
||||
break;
|
||||
case "dark-bg":
|
||||
$("body").css("background-image", "url(" + checkskin_bg(mashiro_option.skin_bg7) + ")");
|
||||
break;
|
||||
// case "dark-bg":
|
||||
// $("body").css("background-image", "url(" + checkskin_bg(mashiro_option.skin_bg7) + ")");
|
||||
// break;
|
||||
}
|
||||
setCookie("bgImgSetting", tagid, 30);
|
||||
closeSkinMenu();
|
||||
});
|
||||
});
|
||||
|
@ -416,23 +478,11 @@ $(document).ready(function () {
|
|||
preBG();
|
||||
});
|
||||
});
|
||||
if (document.body.clientWidth <= 860) {
|
||||
window.onscroll = function () {
|
||||
scrollFunction()
|
||||
};
|
||||
|
||||
function scrollFunction() {
|
||||
if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
|
||||
addComment.I("moblieGoTop").style.display = "block";
|
||||
} else {
|
||||
addComment.I("moblieGoTop").style.display = "none";
|
||||
}
|
||||
}
|
||||
|
||||
function topFunction() {
|
||||
document.body.scrollTop = 0;
|
||||
document.documentElement.scrollTop = 0;
|
||||
}
|
||||
function topFunction() {
|
||||
$('body,html').animate({
|
||||
scrollTop: 0
|
||||
})
|
||||
}
|
||||
|
||||
function timeSeriesReload(flag) {
|
||||
|
@ -476,10 +526,20 @@ function timeSeriesReload(flag) {
|
|||
var al_expand_collapse_click = 0;
|
||||
$('#al_expand_collapse').click(function () {
|
||||
if (al_expand_collapse_click == 0) {
|
||||
$al_post_list.show(400);
|
||||
$al_post_list.each(function(index){
|
||||
var $this = $(this),
|
||||
s = setTimeout(function() {
|
||||
$this.show(400);
|
||||
}, 50 * index);
|
||||
});
|
||||
al_expand_collapse_click++;
|
||||
} else if (al_expand_collapse_click == 1) {
|
||||
$al_post_list.hide(400);
|
||||
$al_post_list.each(function(index){
|
||||
var $this = $(this),
|
||||
h = setTimeout(function() {
|
||||
$this.hide(400);
|
||||
}, 50 * index);
|
||||
});
|
||||
al_expand_collapse_click--;
|
||||
}
|
||||
});
|
||||
|
@ -523,22 +583,33 @@ function killCoverVideo() {
|
|||
}
|
||||
}
|
||||
|
||||
function loadHls(){
|
||||
var video = addComment.I('coverVideo');
|
||||
var video_src = $('#coverVideo').attr('data-src');
|
||||
if (Hls.isSupported()) {
|
||||
var hls = new Hls();
|
||||
hls.loadSource(video_src);
|
||||
hls.attachMedia(video);
|
||||
hls.on(Hls.Events.MANIFEST_PARSED, function () {
|
||||
video.play();
|
||||
});
|
||||
} else if (video.canPlayType('application/vnd.apple.mpegurl')) {
|
||||
video.src = video_src;
|
||||
video.addEventListener('loadedmetadata', function () {
|
||||
video.play();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function coverVideoIni() {
|
||||
if ($('video').hasClass('hls')) {
|
||||
var video = addComment.I('coverVideo');
|
||||
var video_src = $('#coverVideo').attr('data-src');
|
||||
if (Hls.isSupported()) {
|
||||
var hls = new Hls();
|
||||
hls.loadSource(video_src);
|
||||
hls.attachMedia(video);
|
||||
hls.on(Hls.Events.MANIFEST_PARSED, function () {
|
||||
video.play();
|
||||
});
|
||||
} else if (video.canPlayType('application/vnd.apple.mpegurl')) {
|
||||
video.src = video_src;
|
||||
video.addEventListener('loadedmetadata', function () {
|
||||
video.play();
|
||||
});
|
||||
if (mashiro_global.variables.has_hls){
|
||||
loadHls();
|
||||
}else{
|
||||
$.getScript("https://cdn.jsdelivr.net/gh/mashirozx/Sakura@3.3.3/cdn/js/src/16.hls.js", function(){
|
||||
loadHls();
|
||||
mashiro_global.variables.has_hls = true;
|
||||
});
|
||||
}
|
||||
//console.info('ini:coverVideoIni()');
|
||||
}
|
||||
|
@ -621,7 +692,7 @@ $(document).on("click", ".sm", function () {
|
|||
if (confirm(msg) == true) {
|
||||
$(this).commentPrivate();
|
||||
} else {
|
||||
aler("已取消");
|
||||
alert("已取消");
|
||||
}
|
||||
});
|
||||
$.fn.commentPrivate = function () {
|
||||
|
@ -751,7 +822,7 @@ if (mashiro_option.float_player_on) {
|
|||
autoplay: !1,
|
||||
mutex: !0,
|
||||
lrcType: 3,
|
||||
listFolded: !1,
|
||||
listFolded: 1,
|
||||
preload: 'auto',
|
||||
theme: '#2980b9',
|
||||
loop: 'all',
|
||||
|
@ -787,30 +858,20 @@ if (mashiro_option.float_player_on) {
|
|||
lrcTag = 2;
|
||||
});
|
||||
var apSwitchTag = 0;
|
||||
var aplayerlist = $(".aplayer-list");
|
||||
aplayerlist.removeClass("aplayer-list-hide").css({
|
||||
maxHeight: '0px'
|
||||
});
|
||||
$(".aplayer.aplayer-fixed .aplayer-body").addClass("ap-hover");
|
||||
$(".aplayer-miniswitcher").click(function () {
|
||||
if (apSwitchTag == 0) {
|
||||
aplayerlist.removeClass("aplayer-list-hide").animate({
|
||||
maxHeight: '250px'
|
||||
});
|
||||
$(".aplayer.aplayer-fixed .aplayer-body").removeClass("ap-hover");
|
||||
$("#secondary").addClass("active");
|
||||
apSwitchTag = 1;
|
||||
} else {
|
||||
aplayerlist.css({
|
||||
maxHeight: '0px'
|
||||
});
|
||||
$(".aplayer.aplayer-fixed .aplayer-body").addClass("ap-hover");
|
||||
$("#secondary").removeClass("active");
|
||||
apSwitchTag = 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
var b = 'https://api.i-meto.com/meting/api?server=:server&type=:type&id=:id&r=:r';
|
||||
var b = mashiro_option.meting_api_url + '?server=:server&type=:type&id=:id&_wpnonce=' + Poi.nonce;
|
||||
'undefined' != typeof meting_api && (b = meting_api);
|
||||
for (var f = 0; f < aplayers.length; f++) try {
|
||||
aplayers[f].destroy()
|
||||
|
@ -823,7 +884,7 @@ if (mashiro_option.float_player_on) {
|
|||
f = d.dataset.id;
|
||||
if (f) {
|
||||
var g = d.dataset.api || b;
|
||||
g = g.replace(':server', d.dataset.server), g = g.replace(':type', d.dataset.type), g = g.replace(':id', d.dataset.id), g = g.replace(':auth', d.dataset.auth), g = g.replace(':r', Math.random());
|
||||
g = g.replace(':server', d.dataset.server), g = g.replace(':type', d.dataset.type), g = g.replace(':id', d.dataset.id);
|
||||
var h = new XMLHttpRequest;
|
||||
h.onreadystatechange = function () {
|
||||
if (4 === h.readyState && (200 <= h.status && 300 > h.status || 304 === h.status)) {
|
||||
|
@ -872,64 +933,56 @@ function getqqinfo() {
|
|||
}
|
||||
var emailAddressFlag = cached.filter('#email').val();
|
||||
cached.filter('#author').on('blur', function () {
|
||||
var qq = cached.filter('#author').val();
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: mashiro_option.qq_api_url + '?type=getqqnickname&qq=' + qq,
|
||||
dataType: 'jsonp',
|
||||
jsonp: 'callback',
|
||||
jsonpCallback: 'portraitCallBack',
|
||||
success: function (data) {
|
||||
cached.filter('#author').val(data[qq][6]);
|
||||
cached.filter('#email').val($.trim(qq) + '@qq.com');
|
||||
if (mashiro_option.qzone_autocomplete) {
|
||||
cached.filter('#url').val('https://user.qzone.qq.com/' + $.trim(qq));
|
||||
}
|
||||
$('div.comment-user-avatar img').attr('src', 'https://q2.qlogo.cn/headimg_dl?dst_uin=' + qq + '&spec=100');
|
||||
is_get_by_qq = true;
|
||||
cached.filter('#qq').val($.trim(qq));
|
||||
if (cached.filter('#qq').val()) {
|
||||
$('.qq-check').css('display', 'block');
|
||||
$('.gravatar-check').css('display', 'none');
|
||||
}
|
||||
setCookie('user_author', data[qq][6], 30);
|
||||
setCookie('user_qq', qq, 30);
|
||||
setCookie('is_user_qq', 'yes', 30);
|
||||
setCookie('user_qq_email', qq + '@qq.com', 30);
|
||||
setCookie('user_email', qq + '@qq.com', 30);
|
||||
emailAddressFlag = cached.filter('#email').val();
|
||||
},
|
||||
error: function () {
|
||||
cached.filter('#qq').val('');
|
||||
$('.qq-check').css('display', 'none');
|
||||
$('.gravatar-check').css('display', 'block');
|
||||
$('div.comment-user-avatar img').attr('src', get_gravatar(cached.filter('#email').val(), 80));
|
||||
setCookie('user_qq', '', 30);
|
||||
setCookie('user_email', cached.filter('#email').val(), 30);
|
||||
setCookie('user_avatar', get_gravatar(cached.filter('#email').val(), 80), 30);
|
||||
}
|
||||
});
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: mashiro_option.qq_avatar_api_url + '?type=getqqavatar&qq=' + qq,
|
||||
dataType: 'jsonp',
|
||||
jsonp: 'callback',
|
||||
jsonpCallback: 'qqavatarCallBack',
|
||||
success: function (data) {
|
||||
$('div.comment-user-avatar img').attr('src', data[qq]);
|
||||
setCookie('user_avatar', data[qq], 30);
|
||||
},
|
||||
error: function () {
|
||||
cached.filter('#qq,#email,#url').val('');
|
||||
if (!cached.filter('#qq').val()) {
|
||||
var qq = cached.filter('#author').val(),
|
||||
$reg = /^[1-9]\d{4,9}$/;
|
||||
if ($reg.test(qq)) {
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: mashiro_option.qq_api_url + '?qq=' + qq + '&_wpnonce=' + Poi.nonce,
|
||||
dataType: 'json',
|
||||
success: function (data) {
|
||||
cached.filter('#author').val(data.name);
|
||||
cached.filter('#email').val($.trim(qq) + '@qq.com');
|
||||
if (mashiro_option.qzone_autocomplete) {
|
||||
cached.filter('#url').val('https://user.qzone.qq.com/' + $.trim(qq));
|
||||
}
|
||||
$('div.comment-user-avatar img').attr('src', 'https://q2.qlogo.cn/headimg_dl?dst_uin=' + qq + '&spec=100');
|
||||
is_get_by_qq = true;
|
||||
cached.filter('#qq').val($.trim(qq));
|
||||
if (cached.filter('#qq').val()) {
|
||||
$('.qq-check').css('display', 'block');
|
||||
$('.gravatar-check').css('display', 'none');
|
||||
}
|
||||
setCookie('user_author', data.name, 30);
|
||||
setCookie('user_qq', qq, 30);
|
||||
setCookie('is_user_qq', 'yes', 30);
|
||||
setCookie('user_qq_email', qq + '@qq.com', 30);
|
||||
setCookie('user_email', qq + '@qq.com', 30);
|
||||
emailAddressFlag = cached.filter('#email').val();
|
||||
/***/
|
||||
$('div.comment-user-avatar img').attr('src', data.avatar);
|
||||
setCookie('user_avatar', data.avatar, 30);
|
||||
},
|
||||
error: function () {
|
||||
cached.filter('#qq').val('');
|
||||
$('.qq-check').css('display', 'none');
|
||||
$('.gravatar-check').css('display', 'block');
|
||||
setCookie('user_qq', '', 30);
|
||||
$('div.comment-user-avatar img').attr('src', get_gravatar(cached.filter('#email').val(), 80));
|
||||
setCookie('user_qq', '', 30);
|
||||
setCookie('user_email', cached.filter('#email').val(), 30);
|
||||
setCookie('user_avatar', get_gravatar(cached.filter('#email').val(), 80), 30);
|
||||
/***/
|
||||
cached.filter('#qq,#email,#url').val('');
|
||||
if (!cached.filter('#qq').val()) {
|
||||
$('.qq-check').css('display', 'none');
|
||||
$('.gravatar-check').css('display', 'block');
|
||||
setCookie('user_qq', '', 30);
|
||||
$('div.comment-user-avatar img').attr('src', get_gravatar(cached.filter('#email').val(), 80));
|
||||
setCookie('user_avatar', get_gravatar(cached.filter('#email').val(), 80), 30);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
if (getCookie('user_avatar') && getCookie('user_email') && getCookie('is_user_qq') == 'no' && !getCookie('user_qq_email')) {
|
||||
$('div.comment-user-avatar img').attr('src', getCookie('user_avatar'));
|
||||
|
@ -987,7 +1040,32 @@ function activate_widget(){
|
|||
$("#secondary").remove();
|
||||
}
|
||||
}
|
||||
activate_widget();
|
||||
setTimeout(function () {
|
||||
activate_widget();
|
||||
}, 100);
|
||||
|
||||
function load_bangumi() {
|
||||
if ($("section").hasClass("bangumi")) {
|
||||
$('body').on('click', '#bangumi-pagination a', function () {
|
||||
$("#bangumi-pagination a").addClass("loading").text("");
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('POST', this.href + "&_wpnonce=" + Poi.nonce, true);
|
||||
xhr.onreadystatechange = function() {
|
||||
if (xhr.readyState == 4 ) {
|
||||
if(xhr.status == 200){
|
||||
var html = JSON.parse(xhr.responseText);
|
||||
$("#bangumi-pagination").remove();
|
||||
$(".row").append(html);
|
||||
}else{
|
||||
$("#bangumi-pagination a").removeClass("loading").html('<i class="fa fa-exclamation-triangle" aria-hidden="true"></i> ERROR ');
|
||||
}
|
||||
}
|
||||
};
|
||||
xhr.send();
|
||||
return false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
mashiro_global.ini.normalize();
|
||||
loadCSS(mashiro_option.jsdelivr_css_src);
|
||||
|
@ -1212,13 +1290,6 @@ var home = location.href,
|
|||
Siren = {
|
||||
MN: function () {
|
||||
$('.iconflat').on('click', function () {
|
||||
if ($("#main-container").hasClass("open")) {
|
||||
$('.iconflat').css('width', '50px').css('height', '50px');
|
||||
$('.openNav').css('height', '50px');
|
||||
} else {
|
||||
$('.iconflat').css('width', '100%').css('height', '100%');
|
||||
$('.openNav').css('height', '100%');
|
||||
}
|
||||
$('body').toggleClass('navOpen');
|
||||
$('#main-container,#mo-nav,.openNav').toggleClass('open');
|
||||
});
|
||||
|
@ -1317,25 +1388,15 @@ var home = location.href,
|
|||
});
|
||||
},
|
||||
AH: function () {
|
||||
if (Poi.windowheight == 'auto') {
|
||||
if (Poi.windowheight == 'auto' && mashiro_option.windowheight == 'auto') {
|
||||
if ($('h1.main-title').length > 0) {
|
||||
var _height = $(window).height() + "px";
|
||||
$('#centerbg').css({
|
||||
'height': _height
|
||||
'height': '100vh'
|
||||
});
|
||||
$('#bgvideo').css({
|
||||
'min-height': _height
|
||||
'min-height': '100vh'
|
||||
});
|
||||
window.resizeFlag = null;
|
||||
$(window).resize(function () {
|
||||
//直接resize性能爆炸,改成延时
|
||||
if (resizeFlag = null) {
|
||||
clearTimeout(resizeFlag);
|
||||
}
|
||||
resizeFlag = setTimeout(function () {
|
||||
Siren.AH();
|
||||
}, 1000);
|
||||
})
|
||||
}
|
||||
} else {
|
||||
$('.headertop').addClass('headertop-bar');
|
||||
|
@ -1389,7 +1450,7 @@ var home = location.href,
|
|||
$('html').css('overflow-y', 'hidden');
|
||||
if (mashiro_option.live_search) {
|
||||
var QueryStorage = [];
|
||||
search_a(Poi.api + "sakura/v1/cache_search/json");
|
||||
search_a(Poi.api + "sakura/v1/cache_search/json?_wpnonce=" + Poi.nonce);
|
||||
|
||||
var otxt = addComment.I("search-input"),
|
||||
list = addComment.I("PostlistBox"),
|
||||
|
@ -1530,17 +1591,19 @@ var home = location.href,
|
|||
});
|
||||
},
|
||||
NH: function () {
|
||||
var h1 = 0;
|
||||
$(window).scroll(function () {
|
||||
var s = $(document).scrollTop(),
|
||||
cached = $('.site-header');
|
||||
if (s == h1) {
|
||||
cached.removeClass('yya');
|
||||
}
|
||||
if (s > h1) {
|
||||
cached.addClass('yya');
|
||||
}
|
||||
if(document.body.clientWidth > 860){
|
||||
var h1 = 0;
|
||||
$(window).scroll(function () {
|
||||
var s = $(document).scrollTop(),
|
||||
cached = $('.site-header');
|
||||
if (s == h1) {
|
||||
cached.removeClass('yya');
|
||||
}
|
||||
if (s > h1) {
|
||||
cached.addClass('yya');
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
XLS: function () {
|
||||
$body = (window.opera) ? (document.compatMode == "CSS1Compat" ? $('html') : $('body')) : $('html,body');
|
||||
|
@ -1587,7 +1650,7 @@ var home = location.href,
|
|||
var tempScrollTop = $(window).scrollTop();
|
||||
$(window).scrollTop(tempScrollTop);
|
||||
$body.animate({
|
||||
scrollTop: tempScrollTop + 300
|
||||
scrollTop: tempScrollTop + 100
|
||||
}, 666)
|
||||
} else {
|
||||
$("#pagination").html("<span>很高兴你翻到这里,但是真的没有了...</span>");
|
||||
|
@ -1715,6 +1778,7 @@ var home = location.href,
|
|||
$body = (window.opera) ? (document.compatMode == "CSS1Compat" ? $('html') : $('body')) : $('html,body');
|
||||
$('body').on('click', '#comments-navi a', function (e) {
|
||||
e.preventDefault();
|
||||
var path = $(this)[0].pathname;
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: $(this).attr('href'),
|
||||
|
@ -1734,6 +1798,11 @@ var home = location.href,
|
|||
$('#loading-comments').after(result.fadeIn(500));
|
||||
$('ul.commentwrap').after(nextlink);
|
||||
lazyload();
|
||||
if (window.gtag) {
|
||||
gtag('config', Poi.google_analytics_id, {
|
||||
'page_path': path
|
||||
});
|
||||
}
|
||||
code_highlight_style();
|
||||
click_to_view_image();
|
||||
}
|
||||
|
@ -1746,36 +1815,52 @@ var home = location.href,
|
|||
document.body.addEventListener('input', POWERMODE)
|
||||
},
|
||||
GT: function () {
|
||||
var offset = 100,
|
||||
offset_opacity = 1200,
|
||||
scroll_top_duration = 700,
|
||||
$back_to_top = $('.cd-top');
|
||||
$(window).scroll(function () {
|
||||
if ($(this).scrollTop() > offset) {
|
||||
$back_to_top.addClass('cd-is-visible');
|
||||
$(".changeSkin-gear").css("bottom", "0");
|
||||
if ($(window).height() > 950) {
|
||||
$(".cd-top.cd-is-visible").css("top", "0");
|
||||
var cwidth = document.body.clientWidth,
|
||||
cheight = window.innerHeight,
|
||||
pc_to_top = document.querySelector(".cd-top"),
|
||||
mb_to_top = document.querySelector("#moblieGoTop"),
|
||||
mb_dark_light = document.querySelector("#moblieDarkLight"),
|
||||
changeskin = document.querySelector(".changeSkin-gear");
|
||||
|
||||
$(window).scroll(function() {
|
||||
if (cwidth <= 860) {
|
||||
if ($(this).scrollTop() > 20) {
|
||||
mb_to_top.style.transform = "scale(1)";
|
||||
mb_dark_light.style.transform = "scale(1)";
|
||||
} else {
|
||||
$(".cd-top.cd-is-visible").css("top", ($(window).height() - 950) + "px");
|
||||
mb_to_top.style.transform = "scale(0)";
|
||||
mb_dark_light.style.transform = "scale(0)";
|
||||
}
|
||||
} else {
|
||||
$(".changeSkin-gear").css("bottom", "-999px");
|
||||
$(".cd-top.cd-is-visible").css("top", "-900px");
|
||||
$back_to_top.removeClass('cd-is-visible cd-fade-out');
|
||||
}
|
||||
if ($(this).scrollTop() > offset_opacity) {
|
||||
$back_to_top.addClass('cd-fade-out');
|
||||
if ($(this).scrollTop() > 100) {
|
||||
pc_to_top.classList.add("cd-is-visible");
|
||||
changeskin.style.bottom = "0";
|
||||
if (cheight > 950) {
|
||||
pc_to_top.style.top = "0";
|
||||
} else {
|
||||
pc_to_top.style.top = cheight - 950 + "px";
|
||||
}
|
||||
} else {
|
||||
changeskin.style.bottom = "-999px";
|
||||
pc_to_top.style.top = "-999px";
|
||||
pc_to_top.classList.remove("cd-fade-out", "cd-is-visible");
|
||||
}
|
||||
if ($(this).scrollTop() > 1200) {
|
||||
pc_to_top.classList.add("cd-fade-out");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//smooth scroll to top
|
||||
$back_to_top.on('click', function (event) {
|
||||
event.preventDefault();
|
||||
$('body,html').animate({
|
||||
scrollTop: 0,
|
||||
}, scroll_top_duration);
|
||||
return false;
|
||||
});
|
||||
pc_to_top.onclick = function() {
|
||||
topFunction();
|
||||
}
|
||||
mb_to_top.onclick = function() {
|
||||
topFunction();
|
||||
}
|
||||
mb_dark_light.onclick = function() {
|
||||
mobile_dark_light();
|
||||
}
|
||||
}
|
||||
}
|
||||
$(function () {
|
||||
|
@ -1821,6 +1906,12 @@ $(function () {
|
|||
$.getScript("//static.duoshuo.com/embed.js");
|
||||
}
|
||||
}
|
||||
}).on('pjax:end', function() {
|
||||
if (window.gtag){
|
||||
gtag('config', Poi.google_analytics_id, {
|
||||
'page_path': window.location.pathname
|
||||
});
|
||||
}
|
||||
}).on('submit', '.search-form,.s-search', function (event) {
|
||||
event.preventDefault();
|
||||
$.pjax.submit(event, '#page', {
|
||||
|
|
1488
languages/en_US.po
1528
languages/sakura.pot
1630
languages/zh_CN.po
|
@ -58,9 +58,6 @@
|
|||
<?php if (akina_option('facebook')){ ?>
|
||||
<li><a href="<?php echo akina_option('facebook', ''); ?>" target="_blank" class="social-wangyiyun" title="Facebook"><img src="https://cdn.jsdelivr.net/gh/moezx/cdn@3.1.9/img/Sakura/images/sns/facebook.png"/></a></li>
|
||||
<?php } ?>
|
||||
<?php if (akina_option('googleplus')){ ?>
|
||||
<li><a href="<?php echo akina_option('googleplus', ''); ?>" target="_blank" class="social-wangyiyun" title="Google+"><img src="https://cdn.jsdelivr.net/gh/moezx/cdn@3.1.9/img/Sakura/images/sns/googleplus.png"/></a></li>
|
||||
<?php } ?>
|
||||
<?php if (akina_option('jianshu')){ ?>
|
||||
<li><a href="<?php echo akina_option('jianshu', ''); ?>" target="_blank" class="social-wangyiyun" title="Jianshu"><img src="https://cdn.jsdelivr.net/gh/moezx/cdn@3.1.9/img/Sakura/images/sns/jianshu.png"/></a></li>
|
||||
<?php } ?>
|
||||
|
@ -120,9 +117,6 @@
|
|||
<?php if (akina_option('facebook')){ ?>
|
||||
<li><a href="<?php echo akina_option('facebook', ''); ?>" target="_blank" class="social-wangyiyun" title="Facebook"><img src="https://cdn.jsdelivr.net/gh/moezx/cdn@3.1.9/img/Sakura/images/sns/facebook.png"/></a></li>
|
||||
<?php } ?>
|
||||
<?php if (akina_option('googleplus')){ ?>
|
||||
<li><a href="<?php echo akina_option('googleplus', ''); ?>" target="_blank" class="social-wangyiyun" title="Google+"><img src="https://cdn.jsdelivr.net/gh/moezx/cdn@3.1.9/img/Sakura/images/sns/googleplus.png"/></a></li>
|
||||
<?php } ?>
|
||||
<?php if (akina_option('jianshu')){ ?>
|
||||
<li><a href="<?php echo akina_option('jianshu', ''); ?>" target="_blank" class="social-wangyiyun" title="Jianshu"><img src="https://cdn.jsdelivr.net/gh/moezx/cdn@3.1.9/img/Sakura/images/sns/jianshu.png"/></a></li>
|
||||
<?php } ?>
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"python.pythonPath": "C:\\Users\\Mashiro\\AppData\\Local\\Programs\\Python\\Python38\\python.exe"
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
封面图生成工具
|
||||
===
|
||||
|
||||
### 依赖
|
||||
Python3
|
||||
PIL (Pillow)
|
||||
|
||||
### 安装依赖
|
||||
安装 Python: <https://docs.python.org/zh-cn/3.7/using/index.html>
|
||||
|
||||
安装 PIL:
|
||||
|
||||
```bash
|
||||
# Linix/Mac Terminal
|
||||
pip install Pillow
|
||||
# 如果也安装了 Python 2,需要指定 pip 版本:
|
||||
pip3 install Pillow
|
||||
|
||||
# Windows Powershell 或者 CMD
|
||||
pip install Pillow
|
||||
# 如果也安装了 Python 2,需要指定 pip 版本:
|
||||
pip3 install Pillow
|
||||
# 如果提示权限不足([WinError 5] Access is denied),请运行:
|
||||
pip install Pillow --user
|
||||
```
|
||||
|
||||
### 运行
|
||||
把图片文件放到 `gallary` 目录,Windows 可直接双击 manifest.py,或者和其他操作系统一样,在 Terminal、Powershell、CMD 中运行:
|
||||
|
||||
```bash
|
||||
# 切换到 manifest.py 所在目录:
|
||||
cd /path/to/manifest/
|
||||
python manifest.py
|
||||
# 如果也安装了 Python 2,需要指定 Python 版本:
|
||||
python3 manifest.py
|
||||
```
|
||||
|
||||
GUI 程序开发中,除了以上运行 manifest.py 的方法以外,也可直接运行 qt.py 启动可视化窗口,需要安装 PyQT5:
|
||||
```bash
|
||||
pip3 install PyQt5
|
||||
python3 qt.py
|
||||
```
|
||||
|
||||
### TODO
|
||||
shell/batch 自动安装依赖、自动删除过期文件、压缩图片、GitHub API push、release
|
|
@ -0,0 +1 @@
|
|||
from .manifest import *
|
Before Width: | Height: | Size: 131 KiB After Width: | Height: | Size: 131 KiB |
Before Width: | Height: | Size: 248 KiB After Width: | Height: | Size: 248 KiB |
After Width: | Height: | Size: 54 KiB |
After Width: | Height: | Size: 119 KiB |
After Width: | Height: | Size: 41 KiB |