Skip to content

Commit

Permalink
📖 中英文分割开关 & 优化友情链接
Browse files Browse the repository at this point in the history
- 现在允许在后台选择是否开始 Pangu,js 分割中英文
- 友情链接的头像不在通过 div 的背景图展示,而是 img 标签,并适配懒加载
  • Loading branch information
BigCoke233 committed Apr 12, 2020
1 parent 8a03995 commit c4d20db
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 5 deletions.
8 changes: 8 additions & 0 deletions assets/css/main/page.css
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,14 @@
.links-container {
padding: 6px;
}
.links-img {
padding: 0
}
.links-img img {
margin: 0;
width: 100%;
height: 100%
}

/* Saying 说说 */
.saying-meta {
Expand Down
2 changes: 1 addition & 1 deletion assets/css/main/post.css
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@
border-radius: 3px;
max-width: 100%
}
.post-content img:not(.owo-img) {
.post-content img:not(.owo-img,.links-img img) {
margin: 25px auto;
}
.post-content blockquote p {
Expand Down
2 changes: 1 addition & 1 deletion assets/js/miracles.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ function owoLoad() {
//Pangu.js
function panguLoad() {
document.addEventListener('DOMContentLoaded', () => {
pangu.autoSpacingPage();
if(panguLoadAllow==true) pangu.autoSpacingPage();
});
}

Expand Down
1 change: 1 addition & 0 deletions includes/footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
?>
<!-- Varribles and Functions -->
<script>
var panguLoadAllow = <?php if($this->options->pangu==1):?>false<?php else:?>true<?php endif;?>;
var allowNavAero = <?php if($this->options->navAero==1):?>false<?php else:?>true<?php endif;?>;
var siteurl = '<?php $this->options->SiteUrl() ;?>';
var owoJson = '<?php Utils::indexTheme('assets/OwO.json'); ?>';
Expand Down
4 changes: 2 additions & 2 deletions libs/Contents.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ static public function parseLink($text)
$rp = '<div class="col-lg-2 col-6 col-md-3 links-container">
<a href="${2}" title="${4}" target="_blank" class="links-link">
<div class="links-item">
<div class="links-img" style="background:url(\'${3}\');width: 100%;padding-top: 100%;background-repeat: no-repeat;background-size: cover;"></div>
<div class="links-img"><img src=\'${3}\'></div>
<div class="links-title">
<h4>${1}</h4>
</div>
Expand Down Expand Up @@ -119,7 +119,7 @@ static public function parseLink($text)
$linksList .= '<div class="col-lg-2 col-6 col-md-3 links-container">
<a href="' . $link . '" title="' . $des . '" target="_blank" class="links-link">
<div class="links-item">
<div class="links-img" style="background:url(\'' . $avatar . '\');width: 100%;padding-top: 100%;background-repeat: no-repeat;background-size: cover;"></div>
<div class="links-img"><img src=\''.$avatar.'\'></div>
<div class="links-title">
<h4>' . $name . '</h4>
</div>
Expand Down
4 changes: 3 additions & 1 deletion libs/Options.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,10 @@ function themeConfig($form) {
$form->addInput($CDN);
$customCDN = new Typecho_Widget_Helper_Form_Element_Text('customCDN', NULL, '', _t('自定义 CDN'), _t('输入 CDN 的链接,要保证写入的路径下,目录结构和主题的 assets 目录下一致'));
$form->addInput($customCDN);
$ifShowRTA = new Typecho_Widget_Helper_Form_Element_Select('ifShowRTA',array('0'=>'不显示','1'=>'显示'),'0','阅读时长提示 RTA','在文章前加入阅读时长提示,增进用户体验<hr>');
$ifShowRTA = new Typecho_Widget_Helper_Form_Element_Select('ifShowRTA',array('0'=>'不显示','1'=>'显示'),'0','阅读时长提示 RTA','在文章前加入阅读时长提示,增进用户体验');
$form->addInput($ifShowRTA);
$pangu = new Typecho_Widget_Helper_Form_Element_Select('pangu',array('0'=>'启用','1'=>'关闭'),'0','自动分割中英文(pangu.js)','自动分割网页中的中英文,在全角字符和半角字符之间加上空格,也会修复一些标点符号的错误(.=>。),可能会有误判或是有人不喜欢,所以在这里加个按钮<hr>');
$form->addInput($pangu);

//custom style
$grayTheme = new Typecho_Widget_Helper_Form_Element_Select('grayTheme',array('0'=>'关闭','1'=>'开启'),'0','<h2>个性化</h2>哀悼模式','打开后网站变为黑白');
Expand Down

0 comments on commit c4d20db

Please sign in to comment.