Skip to content

Commit

Permalink
优化样式
Browse files Browse the repository at this point in the history
  • Loading branch information
laozhu committed Jul 25, 2024
1 parent 894e964 commit ed1c54d
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 86 deletions.
5 changes: 3 additions & 2 deletions 404.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>

<?php $this->need('header.php'); ?>
<section>
<section class="position-relative">
<div class="container">
<div class="text-center mt-3 py-5 bg-light shadow rounded">
<div class="text-center mt-3 py-5 bg-white shadow rounded">
<h2 class="text-danger" style="font-size: 8rem; letter-spacing: 1rem">404</h2>
<p class="lead"><?php _e('抱歉,没有找到你要的内容...'); ?></p>
<div>
Expand All @@ -13,4 +13,5 @@
</div>
</div>
</section>
<?php $this->need('sidebar.php'); ?>
<?php $this->need('footer.php'); ?>
7 changes: 4 additions & 3 deletions footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
</p>
</footer><!-- end #footer -->
</div>
</div>

<div id="loader">
<?php
Expand Down Expand Up @@ -69,9 +70,9 @@
elements: "header a,main .nav-tabs a<?php if (!$googleAd['showAd']) : ?>,main .nav-list a<?php endif; ?>",
selectors: ["title",
"meta[charset]",
"#content>header",
"#content>main",
"#content>footer"
"#content>div>header",
"#content>div>main",
"#content>div>footer"
],
cacheBust: false
});
Expand Down
155 changes: 78 additions & 77 deletions header.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,84 +16,85 @@

<body style="min-width: 360px;">
<div id="content">
<?php if ($this->options->particles == 'Show') : ?>
<div id="particles-js" class="position-absolute top-0 start-0 end-0" style="bottom: 0.5rem;"></div>
<?php endif; ?>
<header class="navbar navbar-expand-lg sticky-top bg-black bg-opacity-50 shadow" data-bs-theme="dark">
<div class="container">
<a class="navbar-brand" href="<?php $this->options->siteUrl(); ?>" title="<?php $this->options->title() ?>">
<?php if ($this->options->logoUrl) : ?>
<img height="32" src="<?php $this->options->logoUrl() ?>" alt="<?php $this->options->title() ?>" />
<?php else : ?>
<?php $this->options->title() ?>
<?php endif; ?>
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#topNavBar">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="topNavBar">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<?php \Widget\Contents\Page\Rows::alloc()->to($pages); ?>
<?php while ($pages->next()) : ?>
<li class="nav-item">
<?php if ($this->is('page', $pages->slug)) : ?>
<a class="nav-link active" aria-current="page" href="<?php $pages->permalink(); ?>"><?php $pages->title(); ?></a>
<?php else : ?>
<a class="nav-link" href="<?php $pages->permalink(); ?>"><?php $pages->title(); ?></a>
<?php endif; ?>
</li>
<?php endwhile; ?>
</ul>
</div>
<?php if ($this->options->calendar == 'Show') : ?>
<div id='calendar' class="d-none d-lg-block">
<a id="solarDate" class="text-decoration-none" href="https://www.baidu.com/s?wd=%C8%D5%C0%FA" target="_blank" title="<?php _e('点击查看日历') ?>"></a>
<div class="card bg-black bg-opacity-50 shadow">
<div class="card-body">
<div id="lunarDate" class="fs-3 text-center fw-bold"></div>
<div class="row mt-2">
<div class="col-3 fw-bold"><?php _e('干支') ?></div>
<div id="ganzhi" class="col-9"></div>
</div>
<div class="row">
<div class="col-3 fw-bold"><?php _e('生肖') ?></div>
<div id="animal" class="col-9"></div>
</div>
<div class="row">
<div class="col-3 fw-bold"><?php _e('星座') ?></div>
<div id="astro" class="col-9"></div>
</div>
<div class="row">
<div class="col-3 fw-bold"><?php _e('节日') ?></div>
<div id="festival" class="col-9"></div>
</div>
<div class="row">
<div class="col-3 fw-bold"><?php _e('节气') ?></div>
<div id="term" class="col-9"></div>
<div style="backdrop-filter: blur(10px);padding-bottom: 5rem;min-height:100vh;">
<?php if ($this->options->particles == 'Show') : ?>
<div id="particles-js" class="position-absolute top-0 start-0 end-0" style="bottom: 0.5rem;"></div>
<?php endif; ?>
<header class="navbar navbar-expand-lg sticky-top bg-black bg-opacity-50 shadow" data-bs-theme="dark">
<div class="container">
<a class="navbar-brand" href="<?php $this->options->siteUrl(); ?>" title="<?php $this->options->title() ?>">
<?php if ($this->options->logoUrl) : ?>
<img height="32" src="<?php $this->options->logoUrl() ?>" alt="<?php $this->options->title() ?>" />
<?php else : ?>
<?php $this->options->title() ?>
<?php endif; ?>
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#topNavBar">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="topNavBar">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<?php \Widget\Contents\Page\Rows::alloc()->to($pages); ?>
<?php while ($pages->next()) : ?>
<li class="nav-item">
<?php if ($this->is('page', $pages->slug)) : ?>
<a class="nav-link active" aria-current="page" href="<?php $pages->permalink(); ?>"><?php $pages->title(); ?></a>
<?php else : ?>
<a class="nav-link" href="<?php $pages->permalink(); ?>"><?php $pages->title(); ?></a>
<?php endif; ?>
</li>
<?php endwhile; ?>
</ul>
</div>
<?php if ($this->options->calendar == 'Show') : ?>
<div id='calendar' class="d-none d-lg-block">
<a id="solarDate" class="text-decoration-none" href="https://www.baidu.com/s?wd=%C8%D5%C0%FA" target="_blank" title="<?php _e('点击查看日历') ?>"></a>
<div class="card bg-black bg-opacity-50 shadow">
<div class="card-body">
<div id="lunarDate" class="fs-3 text-center fw-bold"></div>
<div class="row mt-2">
<div class="col-3 fw-bold"><?php _e('干支') ?></div>
<div id="ganzhi" class="col-9"></div>
</div>
<div class="row">
<div class="col-3 fw-bold"><?php _e('生肖') ?></div>
<div id="animal" class="col-9"></div>
</div>
<div class="row">
<div class="col-3 fw-bold"><?php _e('星座') ?></div>
<div id="astro" class="col-9"></div>
</div>
<div class="row">
<div class="col-3 fw-bold"><?php _e('节日') ?></div>
<div id="festival" class="col-9"></div>
</div>
<div class="row">
<div class="col-3 fw-bold"><?php _e('节气') ?></div>
<div id="term" class="col-9"></div>
</div>
</div>
</div>
</div>
</div>
<script src="<?php $this->options->themeUrl('static/js/js-calendar-converter.js'); ?>"></script>
<script>
(function() {
const lunar = calendar.solar2lunar();
document.querySelector('#solarDate').textContent = `${lunar.cYear}年${lunar.cMonth}月${lunar.cDay}日 ${lunar.ncWeek}`;
document.querySelector('#lunarDate').textContent = `${lunar.IMonthCn}${lunar.IDayCn}`;
document.querySelector('#ganzhi').textContent = `${lunar.gzYear}年${lunar.gzMonth}月${lunar.gzDay}日`;
document.querySelector('#animal').textContent = lunar.Animal;
document.querySelector('#astro').textContent = lunar.astro;
if (lunar.festival) {
document.querySelector('#festival').textContent = lunar.festival;
} else if (lunar.lunarFestival) {
document.querySelector('#festival').textContent = lunar.lunarFestival;
}
<script src="<?php $this->options->themeUrl('static/js/js-calendar-converter.js'); ?>"></script>
<script>
(function() {
const lunar = calendar.solar2lunar();
document.querySelector('#solarDate').textContent = `${lunar.cYear}年${lunar.cMonth}月${lunar.cDay}日 ${lunar.ncWeek}`;
document.querySelector('#lunarDate').textContent = `${lunar.IMonthCn}${lunar.IDayCn}`;
document.querySelector('#ganzhi').textContent = `${lunar.gzYear}年${lunar.gzMonth}月${lunar.gzDay}日`;
document.querySelector('#animal').textContent = lunar.Animal;
document.querySelector('#astro').textContent = lunar.astro;
if (lunar.festival) {
document.querySelector('#festival').textContent = lunar.festival;
} else if (lunar.lunarFestival) {
document.querySelector('#festival').textContent = lunar.lunarFestival;
}

if (lunar.isTerm) {
document.querySelector('#term').textContent = lunar.Term;
}
})();
</script>
<?php endif; ?>
</div>
</header>
if (lunar.isTerm) {
document.querySelector('#term').textContent = lunar.Term;
}
})();
</script>
<?php endif; ?>
</div>
</header>
6 changes: 3 additions & 3 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@
<section>
<div class="row justify-content-center mt-3">
<div class="col col-lg-10">
<div class="input-group input-group shadow">
<div class="input-group input-group shadow rounded-pill overflow-hidden">
<select id="search_engine" class="input-group-text text-start" style="outline: none;appearance: none;">
<?php foreach ($this->options->searchEngines as $engine) : ?>
<option value="<?= $engine; ?>" <?php if ($engine === 'self') echo 'selected'; ?>>
<?php echo $allEngines[$engine]['title']; ?>
</option>
<?php endforeach; ?>
</select>
<input id="search_kw" type="search" class="form-control border-start-0" placeholder="<?php _e('输入搜索关键词...') ?>">
<input id="search_kw" type="search" class="form-control form-control-lg border-start-0" placeholder="<?php _e('输入搜索关键词...') ?>">
<button class="btn btn-dark" type="button" onclick="search()"><?php _e('搜索') ?></button>
</div>
</div>
Expand All @@ -85,7 +85,7 @@ function search() {
</script>
<?php endif; ?>
<section>
<ul class="position-relative nav nav-tabs mt-4 bg-opacity-50">
<ul class="position-relative nav nav-tabs mt-5 bg-opacity-50">
<?php if ($this->is('search') or $this->is('tag')) : ?>
<li class="nav-item">
<span class="bg-white bg-opacity-25 d-inline-block rounded-top p-2 border border-bottom-0">
Expand Down
1 change: 0 additions & 1 deletion static/css/common.css
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@

#content {
position: relative;
padding-bottom: 5rem;
min-height: 100vh;
background-color: #f8f9fa;
background-attachment: fixed;
Expand Down

0 comments on commit ed1c54d

Please sign in to comment.