Skip to content

Commit

Permalink
✨ 优化及更新 #81 #51
Browse files Browse the repository at this point in the history
  • Loading branch information
Licoy committed Dec 25, 2021
1 parent 50d64df commit f9e4f0e
Show file tree
Hide file tree
Showing 14 changed files with 81 additions and 63 deletions.
6 changes: 3 additions & 3 deletions assets/dist/libs.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/dist/puock.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/dist/style.min.css

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions assets/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ gulp.task('lib_style', function () {
return gulp.src(_libs_style)
.pipe(concatCss("libs.min.css"))
.pipe(minifyCSS({
format : 'keep-breaks',
semicolonAfterLastProperty:true,
afterComment:true
format: 'keep-breaks',
semicolonAfterLastProperty: true,
afterComment: true
}))
.pipe(gulp.dest('dist'))
})
Expand Down Expand Up @@ -64,4 +64,6 @@ gulp.task('build', gulp.series(
gulp.task('w', gulp.series('build', function () {
gulp.watch(_core_style, gulp.series('style'))
gulp.watch(_core_script, gulp.series('script'))
}))
gulp.watch(_libs_script, gulp.series('lib_script'))
gulp.watch(_libs_style, gulp.series('lib_style'))
}))
17 changes: 5 additions & 12 deletions assets/js/puock.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class Puock {
is_single: false,
is_pjax: false,
vd_comment: false,
main_lazy_img: false,
},
comment: {
loading: false,
Expand Down Expand Up @@ -190,18 +191,10 @@ class Puock {
this.loadCommentCaptchaImage(null);
this.generatePostQrcode();
$('[data-toggle="tooltip"]').tooltip({placement: 'auto', trigger: 'hover'});
if (document.getElementById("post-main")) {
new Viewer(document.getElementById("post-main"), {
navbar: false,
filter(image) {
if (!$(image).hasClass("dont-view")) {
console.log(image)
return image.complete;
}
return false;
},
});
}
$("#post-main .entry-content").viewer({
navbar: false,
url: this.data.params.main_lazy_img ? 'data-src' : 'src'
});
new ClipboardJS('.copy-post-link', {
text: () => {
const $copyEl = $(".copy-post-link");
Expand Down
13 changes: 12 additions & 1 deletion assets/libs/viewer/viewer.min.js

Large diffs are not rendered by default.

9 changes: 8 additions & 1 deletion assets/style/style.less
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ pre {
}
}

.min-height-container{
.min-height-container {
min-height: 70vh;
}

Expand Down Expand Up @@ -798,13 +798,18 @@ a:hover {
}
}

// 移动端
@media (max-width: 576px) {
#posts {
.post-item-card {
padding-left: 0 !important;
padding-right: 0 !important;
}
}

.t-line-1 {
white-space: normal;
}
}

#magazines {
Expand Down Expand Up @@ -1714,6 +1719,7 @@ a:hover {
justify-content: space-between;
flex-wrap: wrap;
align-items: flex-start;

&:nth-of-type(2)::after {
content: '';
flex: auto;
Expand All @@ -1725,6 +1731,7 @@ a:hover {
color: @colorModeLightFont;
transition: all .2s;
margin-bottom: 8px;

&:hover {
background-color: @colorPrimary;
color: @colorLight;
Expand Down
49 changes: 24 additions & 25 deletions error.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,38 @@
get_header();

$error_info = $_SESSION['error_info'];

unset($_SESSION['error_info']);

if(empty($error_info)){
if (empty($error_info)) {
$error_info = __('无错误信息', PUOCK);
}

?>

<div id="content" class="mt20 container">
<div id="content" class="mt20 container min-height-container">

<?php echo pk_breadcrumbs() ?>
<?php echo pk_breadcrumbs() ?>

<div class="text-center p-block puock-text">
<h3 class="mt20"><?php echo $error_info ?></h3>
<h5 class="mt20"><span id="time-count-down">3</span><?php _e('秒后即将跳转至首页', PUOCK) ?></h5>
<div class="text-center mt20">
<a class="a-link" href="<?php echo home_url() ?>"><i class="czs-home-l"></i>&nbsp;<?php _e('返回首页', PUOCK) ?></a>
</div>
<div class="text-center p-block puock-text">
<h3 class="mt20"><?php echo $error_info ?></h3>
<h5 class="mt20"><span id="time-count-down">3</span><?php _e('秒后即将跳转至首页', PUOCK) ?></h5>
<div class="text-center mt20">
<a class="a-link" href="<?php echo home_url() ?>"><i class="czs-home-l"></i>&nbsp;<?php _e('返回首页', PUOCK) ?>
</a>
</div>
<script>
var timeCountDownS = 3;
var timeCountDownVal = 3;
timeCountDownVal = setInterval(function () {
$("#time-count-down").text(--timeCountDownS);
},1000);
setTimeout(function () {
window.clearInterval(timeCountDownVal);
window.location = '/';
},3000);
</script>
</div>



<?php get_footer() ?>
<script>
var timeCountDownS = 3;
var timeCountDownVal = 3;
timeCountDownVal = setInterval(function () {
$("#time-count-down").text(--timeCountDownS);
}, 1000);
setTimeout(function () {
window.clearInterval(timeCountDownVal);
window.location = '/';
}, 3000);
</script>
</div>


<?php get_footer() ?>
9 changes: 9 additions & 0 deletions functions.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<?php

//添加session支持
function register_session()
{
if (!session_id()) {
session_start();
}
}
register_session();

$puock_colors_name = ['primary', 'danger', 'info', 'success', 'warning', 'dark', 'secondary'];

include('inc/fun/core.php');
Expand Down
1 change: 0 additions & 1 deletion inc/fun/comment-ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ function pk_comment_ajax()
if (empty($token)) {
pk_comment_err('无效验证码');
}

$session_comment_captcha = $_SESSION['comment_captcha'];
if (!$session_comment_captcha || $session_comment_captcha == '' || trim($token) != $session_comment_captcha) {
pk_comment_err('无效验证码');
Expand Down
18 changes: 7 additions & 11 deletions inc/fun/core.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,7 @@ function pk_ajax_resp_error($msg = 'fail', $data = null)
}
add_filter('user_trailingslashit', 'add_init_trailingslashit', 10, 2);

//添加session支持
function register_session()
{
if (!session_id())
session_start();
}

add_action('init', 'register_session');

// 顶部添加自定义菜单
function pk_toolbar_link($bar)
Expand Down Expand Up @@ -395,15 +388,18 @@ function pk_get_oauth_info($type = 'qq', $redirect = '', $gen_state = true)
$qq_oauth_key = pk_get_option('oauth_qq_key');
$redirect = urlencode(admin_url() . 'admin-ajax.php?action=oauth_qq_redirect_ajax&redirect=' . $redirect);
if ($gen_state) {
$_SESSION['qq_oauth_state'] = md5(time() . mt_rand(0, 9) . mt_rand(0, 9) . mt_rand(0, 9));
$qq_oauth_state = md5(time() . mt_rand(0, 9) . mt_rand(0, 9) . mt_rand(0, 9));
$_SESSION['qq_oauth_state'] = $qq_oauth_state;
} else {
$qq_oauth_state = $_SESSION['qq_oauth_state'];
}
$auth_url = "https://graph.qq.com/oauth2.0/authorize?response_type=code&client_id={$qq_oauth_id}&redirect_uri={$redirect}&state=" . $_SESSION['qq_oauth_state'];
$auth_url = "https://graph.qq.com/oauth2.0/authorize?response_type=code&client_id={$qq_oauth_id}&redirect_uri={$redirect}&state=" . $qq_oauth_state;
return array(
'qq_open' => $qq_open,
'qq_oauth_id' => $qq_oauth_id,
'qq_oauth_key' => $qq_oauth_key,
'oauth_redirect' => $redirect,
'oauth_state' => $_SESSION['qq_oauth_state'],
'oauth_state' => $qq_oauth_state,
'oauth_url' => $auth_url,
);
}
Expand Down Expand Up @@ -843,4 +839,4 @@ function pk_get_static_url()
function pk_open_show_comment_avatar()
{
return get_option('show_avatars') == "1";
}
}
2 changes: 1 addition & 1 deletion inc/fun/opt.php
Original file line number Diff line number Diff line change
Expand Up @@ -315,4 +315,4 @@ function pk_comment_captcha()
}

add_action('wp_ajax_nopriv_puock_comment_captcha', 'pk_comment_captcha');
add_action('wp_ajax_puock_comment_captcha', 'pk_comment_captcha');
add_action('wp_ajax_puock_comment_captcha', 'pk_comment_captcha');
3 changes: 2 additions & 1 deletion inc/metas.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
'vd_comment' => pk_is_checked('vd_comment'),
'use_post_menu' => pk_is_checked('use_post_menu'),
'is_single' => is_single(),
'is_pjax' => pk_is_checked('page_ajax_load', false)
'is_pjax' => pk_is_checked('page_ajax_load', false),
'main_lazy_img' => pk_is_checked('basic_img_lazy_z', false)
];
?>
<meta name="puock-params" content='<?php echo json_encode($headMetas) ?>'>
3 changes: 2 additions & 1 deletion style.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ Author: Licoy
Author URI: /~https://github.com/Licoy/wordpress-theme-puock
Description: 支持暗黑与白天模式的自适应多风格主题!
Version: 1.9
*/
Tags: 高颜值, 自适应, 暗黑模式, 多模块, SEO, 无刷新加载
*/

0 comments on commit f9e4f0e

Please sign in to comment.