Skip to content

Commit

Permalink
Fix Specifics
Browse files Browse the repository at this point in the history
修复了多项小细节,包括优化字体粗细、增加高亮语言支持...
  • Loading branch information
Dreamer-Paul committed Nov 17, 2019
1 parent 48125f0 commit 66b3695
Show file tree
Hide file tree
Showing 15 changed files with 547 additions and 556 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@

## 感谢

感谢来自开源社区提供的解决方案,如果没有它们,Single 可能还无法如此完善 ヽ(*≧ω≦)ノ
感谢来自开源社区提供的解决方案,简化了本项目的不少工作!

- [Kico Style](https://github.com/Dreamer-Paul/Kico-Style)
- [Font Awesome](https://github.com/FortAwesome/Font-Awesome)
- [Smooth-Scroll](https://github.com/cferdinandi/smooth-scroll)
- [Prism](https://github.com/PrismJS/prism)
- [Prism](https://github.com/PrismJS/prism)
2 changes: 1 addition & 1 deletion archive.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<p>没有找到结果 (QWQ)</p>
<?php endif; ?>
</section>
<?php $this -> pageNav('&laquo;', '&raquo;'); ?>
<?php $this -> pageNav('&laquo;', '&raquo;', 3, "...", array('wrapTag' => 'section', 'itemTag' => 'span')); ?>
</div>
</main>

Expand Down
16 changes: 8 additions & 8 deletions comments.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
function threadedComments($comments, $options, $single = "Dreamer-Paul") {
$commentClass = '';

if($comments -> authorId == $comments -> ownerId){
$commentClass .= 'comment-by-author';
}
else{
$commentClass .= 'comment-by-user';
}
if($comments -> authorId == $comments -> ownerId){
$commentClass .= 'comment-by-author';
}
else{
$commentClass .= 'comment-by-user';
}

$commentLevelClass = $comments -> levels > 0 ? ' comment-child' : '';

Expand Down Expand Up @@ -59,7 +59,7 @@ function threadedComments($comments, $options, $single = "Dreamer-Paul") {
<?php if($this -> user -> hasLogin()): ?>
<fieldset>
<p>欢迎回来,<a href="<?php $this -> options -> profileUrl() ?>"><?php $this -> user -> screenName(); ?></a>!不是你?<a href="<?php $this -> options -> logoutUrl() ?>">登出</a></p>
<textarea rows="2" name="text" id="textarea" placeholder="快来评论吧 (*≧ω≦)ノ" required><?php $this -> remember('text'); ?></textarea>
<textarea rows="2" name="text" id="textarea" placeholder="快来评论支持吧 (*≧ω≦)ノ" title="如发布虚假信息或广告,将无法通过审核" required><?php $this -> remember('text'); ?></textarea>
<button type="submit" class="btn">写好了~</button>
</fieldset>
<?php else: ?>
Expand All @@ -83,7 +83,7 @@ function threadedComments($comments, $options, $single = "Dreamer-Paul") {

<?php if($comments -> have()): ?>
<div class="comment-list"><?php $comments -> listComments(array('before' => '', 'after' => '', 'replyWord' => '<i class="fa fa-reply"></i>')); ?></div>
<?php $comments -> pageNav('&laquo;', '&raquo;'); ?>
<?php $comments -> pageNav('&laquo;', '&raquo;', 3, "...", array('wrapTag' => 'section', 'itemTag' => 'span')); ?>
<?php endif; ?>

</section>
11 changes: 1 addition & 10 deletions footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,11 @@
</div>
</footer>

<?php if($this -> options -> cdn_set == '0'): ?>
<script src="<?php $this -> options -> themeUrl('static/kico.js'); ?>"></script>
<script src="<?php $this -> options -> themeUrl('static/single.js'); ?>"></script>
<script src="<?php $this -> options -> themeUrl('static/prism.js'); ?>"></script>
<?php else: ?>
<script src="https://cdn.jsdelivr.net/gh/Dreamer-Paul/Single@<?php echo Single::$version; ?>/static/kico.js"></script>
<script src="https://cdn.jsdelivr.net/gh/Dreamer-Paul/Single@<?php echo Single::$version; ?>/static/single.js"></script>
<script src="https://cdn.jsdelivr.net/gh/Dreamer-Paul/Single@<?php echo Single::$version; ?>/static/prism.js"></script>
<?php endif; ?>
<script>var single = new Paul_Single({copyNotice: <?php if($this -> options -> copy_notice == 1): ?>true<?php else: ?>false<?php endif; ?>, toggleNight: <?php if($this -> options -> night_mode == 1): ?>true<?php else: ?>false<?php endif; ?>});</script>
<script>var single = new Paul_Single({copyright: <?php if($this -> options -> copy_notice == 1): ?>true<?php else: ?>false<?php endif; ?>, night: <?php if($this -> options -> night_mode == 1): ?>true<?php else: ?>false<?php endif; ?>});</script>
<?php $this -> options -> custom_script(); ?>
<script src="https://cdn.jsdelivr.net/gh/cferdinandi/smooth-scroll/dist/smooth-scroll.min.js"></script>
<script>var scroll = new SmoothScroll('.to-top, .article-list a, .comment-content a', {offset: 100, easing: "easeOutQuint", updateURL: false, popstate: false});</script>

<?php $this -> footer(); ?>

</body>
Expand Down
18 changes: 5 additions & 13 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function themeConfig($form) {
$custom_css = new Typecho_Widget_Helper_Form_Element_Textarea('custom_css', NULL, NULL, _t('自定义样式表'), _t('在这里填入你的自定义样式表,不填则不输出。'));
$form -> addInput($custom_css);

// 自定义统计代码
// 统计代码
$custom_script = new Typecho_Widget_Helper_Form_Element_Textarea('custom_script', NULL, NULL, _t('统计代码'), _t('在这里填入你的统计代码,不填则不输出。需要 <a>&lt;script&gt;</a> 标签'));
$form -> addInput($custom_script);

Expand All @@ -50,30 +50,22 @@ function themeConfig($form) {
'1', _t('是否在复制内容的时候提示注意事项'), _t('开启则会在访客复制内容时弹窗'));
$form -> addInput($copy_notice);

// 开启公共 CDN
$cdn_set = new Typecho_Widget_Helper_Form_Element_Radio('cdn_set',
array(
'0' => _t('关闭'),
'1' => _t('开启'),
),
'0', _t('是否使用公共 CDN'), _t('使用 JSDelivr 的公共 CDN 服务,确保你的主题版本为最新'));
$form -> addInput($cdn_set);

// 信息栏
$widget_set = new Typecho_Widget_Helper_Form_Element_Radio('widget_set',
array(
'0' => _t('关闭'),
'1' => _t('开启'),
),
'0', _t('是否显示信息栏'), _t('在页尾显示 “最近评论”、“最新文章” 和 “时光机”'));
'0', _t('是否显示信息栏'), _t('在页尾显示 “最新文章”、“最近评论” 和 “时光机”'));
$form -> addInput($widget_set);

// 首页、存档页属性显示
$archive_meta = new Typecho_Widget_Helper_Form_Element_Checkbox('archive_meta',
array(
'show_category' => _t('文章分类'),
'show_tags' => _t('文章标签'),
'show_comments' => _t('评论数')),
'show_comments' => _t('评论数')
),
array('show_category', 'show_comments'), _t('首页、存档页属性显示'));
$form -> addInput($archive_meta -> multiMode());

Expand All @@ -83,7 +75,7 @@ function themeConfig($form) {
'show_category' => _t('文章分类'),
'show_tags' => _t('文章标签'),
'show_comments' => _t('评论数')
),
),
array('show_category', 'show_comments'), _t('文章页属性显示'));
$form -> addInput($post_meta -> multiMode());
}
5 changes: 0 additions & 5 deletions header.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,8 @@
<?php else: ?>
<link rel="icon" href="<?php $this -> options -> themeUrl('img/icon.png'); ?>" sizes="192x192"/>
<?php endif; ?>
<?php if($this -> options -> cdn_set == '0'): ?>
<link href="<?php $this -> options -> themeUrl('static/kico.css'); ?>" rel="stylesheet" type="text/css"/>
<link href="<?php $this -> options -> themeUrl('static/single.css'); ?>" rel="stylesheet" type="text/css"/>
<?php else: ?>
<link href="https://cdn.jsdelivr.net/gh/Dreamer-Paul/Single@<?php echo Single::$version; ?>/static/kico.css" rel="stylesheet" type="text/css"/>
<link href="https://cdn.jsdelivr.net/gh/Dreamer-Paul/Single@<?php echo Single::$version; ?>/static/single.css" rel="stylesheet" type="text/css"/>
<?php endif; ?>
<link href="https://cdn.jsdelivr.net/gh/FortAwesome/Font-Awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"/>
<meta name="viewport" content="width=device-width, maximum-scale=1, initial-scale=1"/>
<?php if($this -> options -> background): ?>
Expand Down
6 changes: 3 additions & 3 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* @package Single Theme
* @author Dreamer-Paul
* @version 2.0
* @version 2.1
* @link https://paugram.com
*/

Expand All @@ -27,7 +27,7 @@
<?php endif; ?>
</section>
<section class="home-posts">
<?php while($this -> next()): ?>
<?php while($this -> next()): ?>
<div class="post-item">
<h2>
<a href="<?php $this -> permalink() ?>"><?php $this->title() ?></a>
Expand All @@ -49,7 +49,7 @@
</div>
<?php endwhile; ?>
</section>
<?php $this -> pageNav('&laquo;', '&raquo;'); ?>
<?php $this -> pageNav('&laquo;', '&raquo;', 3, "...", array('wrapTag' => 'section', 'itemTag' => 'span')); ?>
</div>
</main>

Expand Down
2 changes: 0 additions & 2 deletions page.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
<article class="page-content">
<?php $this -> content(); ?>
</article>

<?php $this -> need('comments.php'); ?>

</div>
</main>

Expand Down
4 changes: 2 additions & 2 deletions post.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<article class="post-content">
<?php if(time() - $this -> modified >= 15552000): ?>
<blockquote>这篇文章上次修改于 <?php echo ceil((time() - $this -> modified) / 86400) ?> 天前,可能其部分内容已经发生变化,如有疑问可询问作者。</blockquote>
<?php endif ?>
<?php endif ?>
<?php $this -> content(); ?>
</article>
<section class="post-near">
Expand All @@ -33,7 +33,7 @@
<li>下一篇: <?php $this -> theNext('%s','看完啦 (つд⊂)'); ?></li>
</ul>
</section>
<?php if($this->options->author_text): ?>
<?php if($this -> options -> author_text): ?>
<section class="post-author">
<figure class="author-avatar">
<?php $this -> author -> gravatar(200); ?>
Expand Down
15 changes: 9 additions & 6 deletions single.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class Single {
static $name = "Single";
static $version = "2.0";
static $version = "2.1";

static $author = "", $authorCache = "";

Expand Down Expand Up @@ -46,7 +46,10 @@ static function update(){
// 夜间模式
static function is_night() {
if(isset($_COOKIE["night"])){
echo $_COOKIE["night"] == "true" ?? ' class="neon"';
echo $_COOKIE["night"] == "true" ? ' class="neon"' : '';
}
else if(Typecho_Widget::widget('Widget_Options') -> night_mode == 2){
echo ' class="neon"';
}
}

Expand All @@ -58,16 +61,16 @@ static function tran_time($ts){
return $ts;
}
else if($dur < 60){
return $dur . ' 秒前';
return $dur . " 秒前";
}
else if($dur < 3600){
return floor($dur / 60) . ' 分钟前';
return floor($dur / 60) . " 分钟前";
}
else if($dur < 86400){
return floor($dur / 3600) . ' 小时前';
return floor($dur / 3600) . " 小时前";
}
else if($dur < 604800){
return floor($dur / 86400) . ' 天前';
return floor($dur / 86400) . " 天前";
}
else if($dur < 2592000){
return floor($dur / 604800) . " 周前";
Expand Down
Loading

0 comments on commit 66b3695

Please sign in to comment.