Skip to content

Commit

Permalink
update to v1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
chakhsu committed Feb 20, 2017
1 parent 0783c7c commit 1ea8e6a
Show file tree
Hide file tree
Showing 20 changed files with 72 additions and 66 deletions.
Empty file modified 404.php 100755 → 100644
Empty file.
Empty file modified LICENSE.md 100755 → 100644
Empty file.
43 changes: 15 additions & 28 deletions README.md 100755 → 100644
Expand Up @@ -6,15 +6,13 @@ Pinghsu是一款以前端性能优化为出发点而制作的Typecho主题,同

下载地址:

https://github.com/chakhsu/pinghsu

主题预览
主题预览为本站

https://www.linpx.com

图片预览:

![pinghsu-theme-preview.jpg][1]

##主题亮点

Expand All @@ -26,8 +24,7 @@ https://www.linpx.com
- 支持文章个性化标徽设置,10种标徽选择
- 支持文章目录、相关文章与数学公式渲染
- 支持个人社交按钮,但无社交分享
- 主题设置添加XSS检测,评论提交防止触发多次
- 还有更多亮点等你去发现~
- 更多亮点等你去发现···

##主题使用

Expand All @@ -43,40 +40,38 @@ https://www.linpx.com

使用注意事项都在设置里写得比较清楚了,如果遇到不明白的地方,可以评论留言给我

#####logo、icon的设置
####logo、icon的设置

![logo设置.png][2]

#####功能开关
####功能开关

![功能开关.png][3]

#####社交按钮设置
####社交按钮设置

![社交按钮设置.png][4]

#####图片CDN镜像
####图片CDN镜像

肯定支持七牛CDN,理论上也支持有镜像服务的CDN

![图片CDN镜像.png][5]

###页面设置

主题内置了两个自定义页面,分别是文章时间线归档页和文章分类归档页

设置步骤有两步,创建页面,自定义模板选择,自定义字段`archive`,如下图所示

![页面设置.png][6]

###文章缩略图

文章设置缩略图方法有四种,自定义字段`thumb`文章附件第一张图片,文章内图片,默认缩略图
文章设置缩略图方法有四种,自定义字段`thumb`文章附近第一张图片,文章内图片,默认缩略图

优先级顺序 :自定义字段thumb -> 附件第一张图片 -> 文章图片 -> 默认缩略图 -> 无

缩略图尺寸大小,高度至少有250px,宽度大于高度,推荐高度为400px的

###个性化标徽

个性化标徽出现的地方有首页、分类页,标签页,作者页和相关文章
Expand All @@ -85,18 +80,10 @@ https://www.linpx.com

`book``game``note``chat``code``image``web``link``design``lock`

##浏览器兼容情况
###浏览器兼容情况

这个····现代浏览器都兼容····

##License

Open sourced under the MIT license.

###License

[1]: https://ws1.sinaimg.cn/large/7c98397dgy1fcsfm231j9j20rk0ipwhy
[2]: https://ws1.sinaimg.cn/large/7c98397dgy1fcsflqsec3j20m80bbmxe
[3]: https://ws1.sinaimg.cn/large/7c98397dgy1fcsflt4gc6j20m80lxq3t
[4]: https://ws1.sinaimg.cn/large/7c98397dgy1fcsflokwmsj20m80ba74d
[5]: https://ws1.sinaimg.cn/large/7c98397dgy1fcsflpdtuoj20m808dwem
[6]: https://ws1.sinaimg.cn/large/7c98397dgy1fcsflrkphkj20rs0i9dgb
Open sourced under the MIT license.
6 changes: 2 additions & 4 deletions archive.php 100755 → 100644
Expand Up @@ -17,10 +17,8 @@
<?php if ($this->have()): ?>
<?php while($this->next()): ?>
<div class="post-list-item">
<div class="post-list-item-container">
<div class="item-slant reverse-slant"></div>
<div class="item-slant"></div>
<div class="item-label">
<div class="post-list-item-container <?php if ($this->options->colorBgPosts == 'customColor'): ?><?php if (array_key_exists('green',unserialize($this->___fields()))): ?> bg-green<?php elseif (array_key_exists('red',unserialize($this->___fields()))): ?> bg-red<?php elseif (array_key_exists('yellow',unserialize($this->___fields()))): ?> bg-yellow<?php elseif (array_key_exists('blue',unserialize($this->___fields()))): ?> bg-blue<?php elseif (array_key_exists('purple',unserialize($this->___fields()))): ?> bg-purple<?php else : ?> bg-orange<?php endif; ?><?php endif; ?>">
<div class="item-label <?php if ($this->options->colorBgPosts == 'customColor'): ?><?php if (array_key_exists('green',unserialize($this->___fields()))): ?> bg-green<?php elseif (array_key_exists('red',unserialize($this->___fields()))): ?> bg-red<?php elseif (array_key_exists('yellow',unserialize($this->___fields()))): ?> bg-yellow<?php elseif (array_key_exists('blue',unserialize($this->___fields()))): ?> bg-blue<?php elseif (array_key_exists('purple',unserialize($this->___fields()))): ?> bg-purple<?php else : ?> bg-orange<?php endif; ?><?php endif; ?>">
<div class="item-title"><a href="<?php $this->permalink() ?>"><?php $this->title() ?></a></div>
<div class="item-meta clearfix">
<?php if (array_key_exists('book',unserialize($this->___fields()))): ?>
Expand Down
Empty file modified comments.php 100755 → 100644
Empty file.
22 changes: 6 additions & 16 deletions footer.php 100755 → 100644
@@ -1,6 +1,6 @@
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>

<footer class="footer <?php if (array_key_exists('archive',unserialize($this->___fields()))): ?>bg-white<?php elseif($this->is('archive')): ?>bg-white<?php elseif($this->is('single')): ?>bg-white<?php endif; ?>">
<footer class="footer <?php if (array_key_exists('archive',unserialize($this->___fields()))): ?>bg-white<?php elseif($this->is('archive')&&($this->options->colorBgPosts == 'defaultColor')): ?>bg-white<?php elseif($this->is('archive')&&($this->options->colorBgPosts == 'customColor')): ?>bg-grey<?php elseif($this->is('single')): ?>bg-white<?php endif; ?>">
<div class="footer-social">
<div class="footer-container clearfix">
<div class="social-list">
Expand All @@ -24,15 +24,16 @@
<div class="footer-container">
<div class="meta-item meta-copyright">
<div class="meta-copyright-info">
<a href="<?php $this->options->siteUrl(); ?>" class="info-logo">
<a href="<?php $this->options->siteUrl(); ?>" class="info-logo">
<?php if($this->options->footerLogoUrl): ?>
<img src="<?php $this->options->footerLogoUrl();?>" alt="<?php $this->options->title() ?>" />
<?php else : ?>
<?php $this->options->title() ?>
<?php endif; ?>
</a>
<div class="info-text">
<p>Theme is Pinghsu by <a href="https://www.linpx.com/" target="_blank">Chakhsu</a></p>
<p>Better late than never.</p>
<p>Theme is <a href="https://github.com/chakhsu/pinghsu" target="_blank">Pinghsu</a> by <a href="https://www.linpx.com/" target="_blank">Chakhsu</a></p>
<p>Powered by <a href="http://www.typecho.org" target="_blank" rel="nofollow">Typecho</a></p>
<p>&copy; <?php echo date('Y'); ?> <a href="<?php $this->options->siteUrl(); ?>"><?php $this->options->title(); ?></a></p>
</div>
Expand Down Expand Up @@ -164,14 +165,12 @@
}
return el;
},

reply : function (cid, coid) {
var comment = this.dom(cid), parent = comment.parentNode,
response = this.dom('<?php echo $this->respondId(); ?>'),
input = this.dom('comment-parent'),
form = 'form' == response.tagName ? response : response.getElementsByTagName('form')[0],
textarea = response.getElementsByTagName('textarea')[0];

if (null == input) {
input = this.create('input', {
'type' : 'hidden',
Expand All @@ -181,40 +180,31 @@

form.appendChild(input);
}

input.setAttribute('value', coid);

if (null == this.dom('comment-form-place-holder')) {
var holder = this.create('div', {
'id' : 'comment-form-place-holder'
});

response.parentNode.insertBefore(holder, response);
}

comment.appendChild(response);
this.dom('cancel-comment-reply-link').style.display = '';

if (null != textarea && 'text' == textarea.name) {
textarea.focus();
}

return false;
},

cancelReply : function () {
var response = this.dom('<?php echo $this->respondId(); ?>'),
holder = this.dom('comment-form-place-holder'),
input = this.dom('comment-parent');

if (null != input) {
input.parentNode.removeChild(input);
}

if (null == holder) {
return true;
}

this.dom('cancel-comment-reply-link').style.display = 'none';
holder.parentNode.insertBefore(response, holder);
return false;
Expand Down Expand Up @@ -321,10 +311,10 @@ classes: {

if (isInitialLoad === false) {
<?php if($this->options->GoogleAnalytics): ?>
if (typeof ga !== 'undefined') ga('send', 'pageview', location.pathname + location.search);
if (typeof ga !== 'undefined') ga('send', 'pageview', location.pathname + location.search);
<?php endif; ?>
<?php if ($this->options->useMathjax == 'able'): ?>
if (typeof MathJax !== 'undefined'){MathJax.Hub.Queue(["Typeset",MathJax.Hub]);}
if (typeof MathJax !== 'undefined'){MathJax.Hub.Queue(["Typeset",MathJax.Hub]);}
<?php endif; ?>

}
Expand Down
23 changes: 17 additions & 6 deletions functions.php 100755 → 100644
Expand Up @@ -2,15 +2,14 @@
if (!defined('__TYPECHO_ROOT_DIR__')) exit;

function themeConfig($form) {

$logoUrl = new Typecho_Widget_Helper_Form_Element_Text('logoUrl', NULL, NULL, _t('页头logo地址'), _t('一般为http://www.yourblog.com/image.png,支持 https:// 或 //,留空则使用站点名称'));
$form->addInput($logoUrl->addRule('xssCheck', _t('请不要在图片链接中使用特殊字符')));
$footerLogoUrl = new Typecho_Widget_Helper_Form_Element_Text('footerLogoUrl', NULL, NULL, _t('页尾logo地址'), _t('一般为http://www.yourblog.com/image.png,支持 https:// 或 //,留空则使用站点名称'));
$form->addInput($footerLogoUrl->addRule('xssCheck', _t('请不要在图片链接中使用特殊字符')));
$favicon = new Typecho_Widget_Helper_Form_Element_Text('favicon', NULL, NULL, _t('favicon地址'), _t('一般为http://www.yourblog.com/image.png,支持 https:// 或 //,留空则不设置favicon'));
$form->addInput($favicon->addRule('xssCheck', _t('请不要在图片链接中使用特殊字符')));
$iosicon = new Typecho_Widget_Helper_Form_Element_Text('iosicon', NULL, NULL, _t('apple touch icon地址'), _t('一般为http://www.yourblog.com/image.png,支持 https:// 或 //,留空则不设置Apple Touch Icon'));
$form->addInput($iosicon->addRule('xssCheck', _t('请不要在图片链接中使用特殊字符')));
$favicon = new Typecho_Widget_Helper_Form_Element_Text('favicon', NULL, NULL, _t('favicon地址'), _t('一般为http://www.yourblog.com/image.png,支持 https:// 或 //,留空则不设置favicon'));
$form->addInput($favicon->addRule('xssCheck', _t('请不要在图片链接中使用特殊字符')));
$iosicon = new Typecho_Widget_Helper_Form_Element_Text('iosicon', NULL, NULL, _t('apple touch icon地址'), _t('一般为http://www.yourblog.com/image.png,支持 https:// 或 //,留空则不设置Apple Touch Icon'));
$form->addInput($iosicon->addRule('xssCheck', _t('请不要在图片链接中使用特殊字符')));


$pjaxSet = new Typecho_Widget_Helper_Form_Element_Radio('pjaxSet',
Expand All @@ -31,9 +30,16 @@ function themeConfig($form) {
array('able' => _t('启用'),
'disable' => _t('禁止'),
),
'disable', _t('移动端点击延迟消除设置'), _t('默认禁止,想加速老旧的移动端浏览器就开启吧'));
'disable', _t('移动端点击延迟消除设置'), _t('默认禁止,好多安卓原生浏览器有点击延迟,想开启就开启吧'));
$form->addInput($fastClickSet);

$colorBgPosts = new Typecho_Widget_Helper_Form_Element_Radio('colorBgPosts',
array('customColor' => _t('启用'),
'defaultColor' => _t('禁用'),
),
'defaultColor', _t('文章色块设置'), _t('默认禁止,启用则可以通过文章字段控制色块颜色,仅支持blue、purple、green、yellow、red'));
$form->addInput($colorBgPosts);

$relatedPosts = new Typecho_Widget_Helper_Form_Element_Radio('relatedPosts',
array('able' => _t('启用'),
'disable' => _t('禁止'),
Expand Down Expand Up @@ -150,3 +156,8 @@ function getRecentPosts($obj,$pageSize){
echo $output;
}
}

function getRandBgColor($obj){
$colors=array('bg-blue','bg-purple','bg-green','bg-yellow','bg-red');
return $colors[mt_rand(0,4)];
}
2 changes: 1 addition & 1 deletion header.php 100755 → 100644
Expand Up @@ -30,7 +30,7 @@
<script src="//cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body class="<?php if (array_key_exists('archive',unserialize($this->___fields()))): ?>bg-grey<?php elseif($this->is('archive')): ?>bg-grey<?php elseif(!$this->is('single')): ?>bg-grey<?php endif; ?>" gtools_scp_screen_capture_injected="true">
<body class="<?php if (array_key_exists('archive',unserialize($this->___fields()))): ?>bg-grey<?php elseif($this->is('archive')&&($this->options->colorBgPosts == 'defaultColor')): ?>bg-grey<?php elseif($this->is('archive')&&($this->options->colorBgPosts == 'customColor')): ?>bg-white<?php elseif(!$this->is('single')): ?>bg-grey<?php endif; ?>" gtools_scp_screen_capture_injected="true">
<!--[if lt IE 8]>
<div class="browsehappy" role="dialog">
当前网页 <strong>不支持</strong> 你正在使用的浏览器. 为了正常的访问, 请 <a href="http://browsehappy.com/" target="_blank">升级你的浏览器</a>。
Expand Down
Empty file modified images/apple-touch-icon.png 100755 → 100644
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified images/bg-ico.png 100755 → 100644
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified images/favicon.png 100755 → 100644
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified images/logo-hsuping.png 100755 → 100644
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified images/logo.png 100755 → 100644
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 12 additions & 4 deletions index.php 100755 → 100644
Expand Up @@ -4,7 +4,7 @@
*
* @package Pinghsu Theme
* @author Chakhsu Lau
* @version 1.0.0
* @version 1.1.0
* @link https://www.linpx.com/
*/

Expand All @@ -19,14 +19,22 @@
<div class="post-list-item">
<div class="post-list-item-container">
<?php if (array_key_exists('thumb',unserialize($this->___fields()))): ?>
<a href="<?php $this->permalink() ?>" class="item-thumb" style="background-image: url(<?php echo $this->fields->thumb;?>);"></a>
<a href="<?php $this->permalink() ?>" class="item-thumb <?php if ($this->options->colorBgPosts == 'defaultColor'): ?> bg-deepgrey<?php elseif ($this->options->colorBgPosts == 'customColor'): ?><?php if (array_key_exists('green',unserialize($this->___fields()))): ?> bg-green<?php elseif (array_key_exists('red',unserialize($this->___fields()))): ?> bg-red<?php elseif (array_key_exists('yellow',unserialize($this->___fields()))): ?> bg-yellow<?php elseif (array_key_exists('blue',unserialize($this->___fields()))): ?> bg-blue<?php elseif (array_key_exists('purple',unserialize($this->___fields()))): ?> bg-purple<?php else : ?> bg-orange<?php endif; ?><?php endif; ?>" style="background-image:url(<?php echo $this->fields->thumb;?>);">
<dir class="item-desc">
<?php $this->excerpt(75, '...');?>
</dir>
</a>
<?php else : ?>
<?php $thumb = showThumb($this,null,true);?>
<?php if(!empty($thumb)):?>
<a href="<?php $this->permalink() ?>" class="item-thumb" style="background-image: url(<?php echo $thumb;?>);"></a>
<a href="<?php $this->permalink() ?>" class="item-thumb <?php if ($this->options->colorBgPosts == 'defaultColor'): ?> bg-deepgrey<?php elseif ($this->options->colorBgPosts == 'customColor'): ?><?php if (array_key_exists('green',unserialize($this->___fields()))): ?> bg-green<?php elseif (array_key_exists('red',unserialize($this->___fields()))): ?> bg-red<?php elseif (array_key_exists('yellow',unserialize($this->___fields()))): ?> bg-yellow<?php elseif (array_key_exists('blue',unserialize($this->___fields()))): ?> bg-blue<?php elseif (array_key_exists('purple',unserialize($this->___fields()))): ?> bg-purple<?php else : ?> bg-orange<?php endif; ?><?php endif; ?>" style="background-image:url(<?php echo $thumb;?>);">
<dir class="item-desc">
<?php $this->excerpt(75, '...');?>
</dir>
</a>
<?php endif; ?>
<?php endif; ?>
<div class="item-slant reverse-slant bg-white"></div>
<div class="item-slant reverse-slant <<?php if ($this->options->colorBgPosts == 'defaultColor'): ?> bg-deepgrey<?php elseif ($this->options->colorBgPosts == 'customColor'): ?><?php if (array_key_exists('green',unserialize($this->___fields()))): ?> bg-green<?php elseif (array_key_exists('red',unserialize($this->___fields()))): ?> bg-red<?php elseif (array_key_exists('yellow',unserialize($this->___fields()))): ?> bg-yellow<?php elseif (array_key_exists('blue',unserialize($this->___fields()))): ?> bg-blue<?php elseif (array_key_exists('purple',unserialize($this->___fields()))): ?> bg-purple<?php else : ?> bg-orange<?php endif; ?><?php endif; ?>"></div>
<div class="item-slant"></div>
<div class="item-label">
<div class="item-title"><a href="<?php $this->permalink() ?>"><?php $this->title() ?></a></div>
Expand Down
Empty file modified page-category.php 100755 → 100644
Empty file.
Empty file modified page-timeline.php 100755 → 100644
Empty file.
Empty file modified page.php 100755 → 100644
Empty file.
Empty file modified post.php 100755 → 100644
Empty file.
Empty file modified screenshot.jpg 100755 → 100644
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 1ea8e6a

Please sign in to comment.