Skip to content

Commit

Permalink
文章头图加入了圆角风格
Browse files Browse the repository at this point in the history
  • Loading branch information
changbin1997 committed Apr 10, 2022
1 parent 088b901 commit 0252cf6
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 8 deletions.
6 changes: 3 additions & 3 deletions assets/js/options-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ window.onload = function () {
form.insertBefore(titleEl[2], ul[4]); // 导航
form.insertBefore(titleEl[3], ul[5]); // 侧边栏
form.insertBefore(titleEl[4], ul[7]); // 文章相关
form.insertBefore(titleEl[5], ul[9]); // 评论
form.insertBefore(titleEl[6], ul[13]); // 友链
form.insertBefore(titleEl[7], ul[16]); // 开发者
form.insertBefore(titleEl[5], ul[10]); // 评论
form.insertBefore(titleEl[6], ul[14]); // 友链
form.insertBefore(titleEl[7], ul[17]); // 开发者

// 导出配置按钮点击
document.querySelector('#export-btn').addEventListener('click', function() {
Expand Down
2 changes: 1 addition & 1 deletion components/post-list.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<?php $img = postImg($this); ?>
<?php if ($img): ?>
<div class="header-img mb-4">
<a href="<?php $this->permalink(); ?>" aria-hidden="true" aria-label="文章头图" style="background-image: url(<?php echo $img; ?>);" tabindex="-1"></a>
<a <?php if ($this->options->headerImageStyle == 'rounded-corners') echo 'class="rounded"'; ?> href="<?php $this->permalink(); ?>" aria-hidden="true" aria-label="文章头图" style="background-image: url(<?php echo $img; ?>);" tabindex="-1"></a>
</div>
<?php endif; ?>
<?php endif; ?>
Expand Down
7 changes: 7 additions & 0 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@ function themeConfig($form) {
), array('home', 'post'), _t('文章头图设置'));
$form->addInput($headerImage->multiMode());

// 文章头图风格
$headerImageStyle = new Typecho_Widget_Helper_Form_Element_Radio('headerImageStyle', array(
'right-angle' => '直角',
'rounded-corners' => '圆角'
), 'right-angle', _t('文章头图风格'));
$form->addInput($headerImageStyle);

// 评论日期时间格式
$commentDateFormat = new Typecho_Widget_Helper_Form_Element_Radio('commentDateFormat', array(
'format1' => '2020年04月23日 13:09',
Expand Down
2 changes: 1 addition & 1 deletion page-data.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<?php $img = postImg($this); ?>
<?php if ($img): ?>
<div class="header-img mb-3 mt-4">
<a href="<?php $this->permalink(); ?>" aria-hidden="true" aria-label="文章头图" style="background-image: url(<?php echo $img; ?>);" tabindex="-1"></a>
<a <?php if ($this->options->headerImageStyle == 'rounded-corners') echo 'class="rounded"'; ?> href="<?php $this->permalink(); ?>" aria-hidden="true" aria-label="文章头图" style="background-image: url(<?php echo $img; ?>);" tabindex="-1"></a>
</div>
<?php endif; ?>
<?php endif; ?>
Expand Down
2 changes: 1 addition & 1 deletion page-links.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<?php $img = postImg($this); ?>
<?php if ($img): ?>
<div class="header-img mb-3 mt-4">
<a href="<?php $this->permalink(); ?>" aria-hidden="true" aria-label="文章头图" style="background-image: url(<?php echo $img; ?>);" tabindex="-1"></a>
<a <?php if ($this->options->headerImageStyle == 'rounded-corners') echo 'class="rounded"'; ?> href="<?php $this->permalink(); ?>" aria-hidden="true" aria-label="文章头图" style="background-image: url(<?php echo $img; ?>);" tabindex="-1"></a>
</div>
<?php endif; ?>
<?php endif; ?>
Expand Down
2 changes: 1 addition & 1 deletion page.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<?php $img = postImg($this); ?>
<?php if ($img): ?>
<div class="header-img mb-3 mt-4">
<a href="<?php $this->permalink(); ?>" aria-hidden="true" aria-label="文章头图" style="background-image: url(<?php echo $img; ?>);" tabindex="-1"></a>
<a <?php if ($this->options->headerImageStyle == 'rounded-corners') echo 'class="rounded"'; ?> href="<?php $this->permalink(); ?>" aria-hidden="true" aria-label="文章头图" style="background-image: url(<?php echo $img; ?>);" tabindex="-1"></a>
</div>
<?php endif; ?>
<?php endif; ?>
Expand Down
2 changes: 1 addition & 1 deletion post.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<?php $img = postImg($this); ?>
<?php if ($img): ?>
<div class="header-img mb-3 mt-4">
<a href="<?php $this->permalink(); ?>" aria-hidden="true" aria-label="文章头图" style="background-image: url(<?php echo $img; ?>);" tabindex="-1"></a>
<a <?php if ($this->options->headerImageStyle == 'rounded-corners') echo 'class="rounded"'; ?> href="<?php $this->permalink(); ?>" aria-hidden="true" aria-label="文章头图" style="background-image: url(<?php echo $img; ?>);" tabindex="-1"></a>
</div>
<?php endif; ?>
<?php endif; ?>
Expand Down

0 comments on commit 0252cf6

Please sign in to comment.