Skip to content
Permalink
Browse files

规范代码结构/增加设置项/优化部分样式

  • Loading branch information...
BigCoke233 committed Jul 20, 2019
1 parent 947afd0 commit 4c7eff848dd38e826787fbd29dd2d8185ba42278
Showing with 159 additions and 88 deletions.
  1. +1 −1 404.php
  2. +3 −2 assets/css/dark.miracles.css
  3. +52 −37 assets/css/miracles.min.css
  4. +83 −0 assets/js/miracles.min.js
  5. +9 −5 functions.php
  6. +9 −39 includes/footer.php
  7. +1 −1 includes/head.php
  8. +1 −1 index.php
  9. +0 −2 saying.php
@@ -8,7 +8,7 @@
<h1 class="error-title">404</h1>
<p style="text-align:center">
<span>糟糕,我家猫咪走丢了!</span><br /><br />
<a href="<?php $this->options->SiteUrl(); ?>" class="error-button no-line">返回首页</a>
<a href="<?php $this->options->SiteUrl(); ?>" class="button error-button no-line">返回首页</a>
</p>
</div>
</div>
@@ -61,7 +61,8 @@
.body-dark .comment-by-author .bubble.comment-content,
.body-dark .bubble.comment-content,
.body-dark .comment-author,
.body-dark .bubble.saying-body {
.body-dark .bubble.saying-body,
.body-dark .tags-item a {
background: #646464
}
/* Need #5a5a5a bg */
@@ -155,7 +156,7 @@
}
.body-dark .nav a:hover,
.body-dark .nav-mobile-title:hover,
.mobile-menu-pagelist a:hover {
.body-dark .mobile-menu-pagelist a:hover {
background: #646464
}
.body-dark .nav-icon-button {
@@ -51,6 +51,49 @@ hr {
background-color: var(--theme-color)
}

/* For Body tag */
.body-dark {
/* For the dark theme
* turn to 'dark.miracles.css'
*/
}
.body-gray {
/* For the gray theme */
filter: grayscale(100%);
-webkit-filter: grayscale(100%);
}
.body-sans-serif {
font-family: 'Noto Sans SC',sans-serif
}
.body-serif {
font-family: 'Noto Serif SC',serif
}

/* 组件 */
/* > 按钮 */
.button {
border: 3px solid #ccc;
border-radius: 30px;
padding: 8px 12px;
transition: all .2s;
}
.button:hover {
border-color: #000;
background: #000;
color: #fff
}
.button-sm {
padding: 3px 5px;
}
.button-md {
border: none;
border-radius: 3px;
}
.button-md:hover {
background: rgb(235,235,235);
color: #fff;
}

/* 导航栏 */
.nav {
background: rgba(255,255,255,0.96);
@@ -62,7 +105,7 @@ hr {
display: table;
top: 0;
z-index: 10;
transition: all .2s
transition: all .2s;
}
.nav-content {
margin: 0;
@@ -127,14 +170,6 @@ hr {
background: rgb(230,230,230);
cursor: pointer
}
/* 字体 Class */
.font-sans-serif {
font-family: 'Noto Sans SC',sans-serif
}

.font-serif {
font-family: 'Noto Serif SC',serif
}
/* 首页大图 */
.index-banner {
margin-top: -21px;
@@ -206,17 +241,8 @@ hr {
margin-top: 15px
}
.post-button {
border: 3px solid #ccc;
border-radius: 30px;
padding: 8px 12px;
transition: all .2s;
float: right
}
.post-button:hover {
border-color: #000;
background: #000;
color: #fff
}
.post-footer {
color: #c8c8c8;
font-size: 14px
@@ -260,10 +286,10 @@ hr {
display: block;
margin: 20px auto;
border-radius: 3px;
box-shadow: 0 2px 10px #ccc;
-moz-box-shadow: 0 2px 10px #ccc;
-webkit-box-shadow: 0 2px 10px #ccc;
max-width: 100%
box-shadow: 0 4px 20px #ccc;
-moz-box-shadow: 0 4px 20px #ccc;
-webkit-box-shadow: 0 4px 20px #ccc;
max-width: 90%
}
.post-content blockquote p {
margin: 0
@@ -634,20 +660,8 @@ hr {
font-size: 100px;
text-shadow: 0 4px 12px #ccc;
}
.error-button {
padding: 5px 10px;
margin: 20px 10px;
transition: all .2s;
border: 4px solid #ddd;
border-radius: 100px;
}
.error-button:hover {
background: #000;
border-color: #000;
color: #fff
}
/* Buttons */
/* > 悬浮按钮 */

/* 悬浮按钮 */
.dark-button,.gotop-button {
background: #fdfdfd;
font-size: 22px;
@@ -766,6 +780,7 @@ hr {
.bubble.comment-content {
background: rgb(238,238,238);
padding: 3px 8px;
padding-right: 12px;
padding-top: -3px;
border-radius: 4px;
min-width: 10px!important;
@@ -788,7 +803,7 @@ hr {
.comment-by-author > .container-fluid > .row > .comment-main > .bubble.comment-content:before {
border-right-color: var(--theme-color)
}
.comment-by-author .bubble.comment-content .comment-reply a {
.comment-by-author > .container-fluid > .row > .comment-main > .bubble.comment-content > .comment-reply a {
color:#fff!important;
}
.comment-reply a {
@@ -0,0 +1,83 @@
/*
* The main JavaScript file for Theme Miracles
* Author: Eltrac
* License: MIT
*/

//toggleDark
function Dark() {
$("body").toggleClass("body-dark");
}
//GoTop
function GoTop() {
$('body,html').animate({scrollTop:0},500);
document.body.scrollTop = 0;
document.documentElement.scrollTop = 0;
}
//LazyLoad
function LazyLoad() {
jQuery(function() {
jQuery("img").lazyload(
{threshold: 200,effect: "fadeIn"}
);
});
}
//Prism
function PrismLoad() {
var pres = document.getElementsByTagName('pre');
for (var i = 0; i < pres.length; i++){
if (pres[i].getElementsByTagName('code').length > 0)pres[i].className = 'line-numbers';
}
}
function PrismReload() {
if (typeof Prism !== 'undefined') {
var pres = document.getElementsByTagName('pre');
for (var i = 0; i < pres.length; i++){
if (pres[i].getElementsByTagName('code').length > 0)
pres[i].className = 'line-numbers';
}
Prism.highlightAll(true,null);
}
}
//Search
function Search() {
$(".search").toggleClass("ready");
$(".search-close").toggleClass("ready");
}
//mobileMenu
function toggleMobileMenu() {
$(".mobile-menu").toggleClass("ready");
$(".mobile-menu-close").toggleClass("ready");
}
//Login
function Login() {
$(".login").toggleClass("ready");
$(".login-close").toggleClass("ready");
}
//owo
function owoLoad() {
var OwO_demo = new OwO({
logo: 'OωO表情',
container: document.getElementsByClassName('OwO')[0],
target: document.getElementsByClassName('OwO-textarea')[0],
api: owoJson,
position: 'down',
width: '300px',
maxHeight: '250px'
});
}
//pjax-loader
if(loadPjax = true) {
$(document).pjax('a[href^="'+siteurl+'"]:not(a[target="_blank"], a[no-pjax])', {
container: '#pjax-container',fragment: '#pjax-container',timeout: 8000
}).on('pjax:send', function () {
GoTop();
beforePjax();
}).on('pjax:complete', function () {
$('form#login-form').addClass('need-refresh');
NProgress.done();
LazyLoad();
PrismReload();
afterPjax();
});
}
@@ -7,6 +7,7 @@
* 注册文章解析 hook
* 具体的解析代码需要在 Contents::parseContent() 方法中实现
* 解析不会改变数据库中的内容,体现在文章前台输出、RSS 输出时
* From AlanDecode(https://imalan.cn)
*/
Typecho_Plugin::factory('Widget_Abstract_Contents')->contentEx = array('Contents','parseContent');
Typecho_Plugin::factory('Widget_Abstract_Contents')->excerptEx = array('Contents','parseContent');
@@ -15,9 +16,6 @@
* 主题启用时执行的方法
*/
function themeInit() {
/**
* 重置某些设置项,采用数据库查询方式完成
*/
$db = Typecho_Db::get();
$query = $db->update('table.options')->rows(array('value'=>'0'))->where('name=?', 'commentsAntiSpam');
@@ -43,7 +41,7 @@ function themeInit() {
*/
function themeConfig($form) {
//nav
$nav_position = new Typecho_Widget_Helper_Form_Element_Select('nav_position',array('0'=>'不固定','1'=>'固定'),'0','导航栏-是否固定','固定后,导航栏不会随滚动条滚动而移动在屏幕上的位置');
$nav_position = new Typecho_Widget_Helper_Form_Element_Select('nav_position',array('0'=>'不固定','1'=>'固定'),'0','导航栏-是否固定','固定后,导航栏不会随滚动条滚动而移动在屏幕上的位置<hr>');
$form->addInput($nav_position);
//index-banner
@@ -53,9 +51,15 @@ function themeConfig($form) {
$form->addInput($bannerHeight);
$bannerTitle = new Typecho_Widget_Helper_Form_Element_Text('bannerTitle', NULL, NULL, _t('首页大图-标题'), _t('这里是首页大图显示的的标题'));
$form->addInput($bannerTitle);
$bannerIntro = new Typecho_Widget_Helper_Form_Element_Text('bannerIntro', NULL, NULL, _t('首页大图-介绍'), _t('这里是首页大图标题下的简介'));
$bannerIntro = new Typecho_Widget_Helper_Form_Element_Text('bannerIntro', NULL, NULL, _t('首页大图-介绍'), _t('这里是首页大图标题下的简介<hr>'));
$form->addInput($bannerIntro);
//pjax
$pjax = new Typecho_Widget_Helper_Form_Element_Select('pjax',array('0'=>'关闭','1'=>'开启'),'1','Pjax-是否开启','Pjax 预加载功能的开关');
$form->addInput($pjax);
$pjax_complete = new Typecho_Widget_Helper_Form_Element_Textarea('pjax_complete', NULL, NULL, _t('Pjax-完成后执行事件'), _t('Pjax 跳转页面后执行的事件,写入 js 代码,一般将 Pjax 重载(回调)函数写在这里。<hr>'));
$form->addInput($pjax_complete);
//custom
$headerEcho = new Typecho_Widget_Helper_Form_Element_Textarea('headerEcho', NULL, NULL, _t('自定义头部信息'), _t('填写 html 代码,将输出在 &lt;head&gt; 标签中'));
$form->addInput($headerEcho);
@@ -21,44 +21,14 @@
<script src="<?php Utils::indexTheme('assets/js/nprogress.js'); ?>"></script>
<script src="<?php Utils::indexTheme('assets/js/OwO.min.js'); ?>"></script>
<script src="<?php Utils::indexTheme('assets/js/prism.js'); ?>"></script>
<script src="<?php Utils::indexTheme('assets/js/main.js'); ?>"></script>
<script>
//pjax-loader
var siteurl = '<?php $this->options->SiteUrl() ;?>';
$(document).pjax('a[href^="'+siteurl+'"]:not(a[target="_blank"], a[no-pjax])', {
container: '#pjax-container',
fragment: '#pjax-container',
timeout: 8000
}).on('pjax:send', function () {
NProgress.start();
GoTop();
}).on('pjax:complete', function () {
NProgress.done();
if (typeof Prism !== 'undefined') {
var pres = document.getElementsByTagName('pre');
for (var i = 0; i < pres.length; i++){
if (pres[i].getElementsByTagName('code').length > 0)
pres[i].className = 'line-numbers';}
Prism.highlightAll(true,null);}
$('form#login-form').addClass('need-refresh');
var OwO_demo = new OwO({logo: 'OωO表情',container: document.getElementsByClassName('OwO')[0],target: document.getElementsByClassName('OwO-textarea')[0],api: '<?php Utils::indexTheme('assets/OwO.json'); ?>',position: 'down',width: '300px',maxHeight: '250px'});
jQuery(function() {jQuery("img").lazyload({threshold: 200,effect: "fadeIn"});});
});
//LazyLoad
jQuery(function() {jQuery("img").lazyload({threshold: 200,effect: "fadeIn"});});
//解决刷新后不显示行号的问题
var pres = document.getElementsByTagName('pre');
for (var i = 0; i < pres.length; i++){if (pres[i].getElementsByTagName('code').length > 0)pres[i].className = 'line-numbers';}
//Search
function Search() {$(".search").toggleClass("ready");$(".search-close").toggleClass("ready");}
//mobileMenu
function toggleMobileMenu() {$(".mobile-menu").toggleClass("ready");$(".mobile-menu-close").toggleClass("ready");}
//Login
function Login() {$(".login").toggleClass("ready");$(".login-close").toggleClass("ready");}
//OwO
var OwO_demo = new OwO({logo: 'OωO表情',container: document.getElementsByClassName('OwO')[0],target: document.getElementsByClassName('OwO-textarea')[0],api: '<?php Utils::indexTheme('assets/OwO.json'); ?>',position: 'down',width: '300px',maxHeight: '250px'});
</script>
<?php if($this->options->jsEcho && $this->options->jsEcho!=''): ?><style><?php $this->options->jsEcho(); ?></style><?php endif; ?>
<?php $this->footer(); ?>
<script>var siteurl = '<?php $this->options->SiteUrl() ;?>';
var owoJson = '<?php Utils::indexTheme('assets/OwO.json'); ?>';
<?php if($this->options->pjax && $this->options->pjax!=0) :?>
var loadPjax = true;
beforePjax = function() {NProgress.start();}
afterPjax = function() {owoLoad();<?php $this->options->pjax_complete(); ?>}
<?php endif; ?></script>
<script src="<?php Utils::indexTheme('assets/js/miracles.min.js'); ?>"></script>
<script>LazyLoad();PrismLoad();owoLoad();<?php $this->options->jsEcho(); ?></script>
</body>
</html>
@@ -65,4 +65,4 @@
<?php $this->options->cssEcho(); ?>
</style>
</head>
<body class="font-sans-serif">
<body class="body-sans-serif">
@@ -40,7 +40,7 @@
?>
</p>
<p class="post-meta"><i class="iconfont icon-block"></i> <?php $this->category(','); ?>&emsp;<i class="iconfont icon-comments"></i> <?php $this->commentsNum('None', 'Only 1', '%d'); ?>&emsp;<i class="iconfont icon-clock"></i> <?php $this->date(); ?></p>
<p class="post-button-box"><a href="<?php $this->permalink(); ?>" class="post-button">Read More</a></p>
<p class="post-button-box"><a href="<?php $this->permalink(); ?>" class="button post-button">Read More</a></p>
</div>
</div></div>
</div>
@@ -55,9 +55,7 @@
<?php //输出说说列表
$this->comments()->to($comments); ?>
<h3 class="comment-title">
<span style="color:#ccc">- </span>
<?php $this->commentsNum(_t('暂无动态'), _t('仅有一条动态'), _t('已有 %d 条动态')); ?>
<span style="color:#ddd"> -</span>
</h3>
<?php if ($comments->have()): ?>
<?php $comments->listComments(); ?>

0 comments on commit 4c7eff8

Please sign in to comment.
You can’t perform that action at this time.