-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 51a16be
Showing
482 changed files
with
18,327 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
*.js linguist-language=PHP | ||
*.css linguist-language=PHP | ||
*.html linguist-language=PHP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<?php | ||
/** | ||
* Archives | ||
* | ||
* @package custom | ||
* | ||
* @author 熊猫小A | ||
* @version 2019-01-17 0.1 | ||
* | ||
*/ | ||
if (!defined('__TYPECHO_ROOT_DIR__')) exit; | ||
?> | ||
|
||
<?php | ||
if(!Utils::isPjax()){ | ||
$this->need('includes/head.php'); | ||
$this->need('includes/header.php'); | ||
} | ||
?> | ||
|
||
<main id="pjax-container"> | ||
<title hidden> | ||
<?php Contents::title($this); ?> | ||
</title> | ||
<?php $lazyID = rand(1,10000); ?> | ||
<div class="lazy-wrap loading"><div id="banner" class="lazy" data-lazy-id=<?php echo $lazyID; ?>></div></div> | ||
<?php Utils::registerLazyImg($this->fields->banner != '' ? $this->fields->banner : $this->options->defaultBanner.'?&v='.rand(), $lazyID); ?> | ||
<div class="wrapper container"> | ||
<section id="post"> | ||
<div class="section-title"><?php if($this->is('post')) echo 'POST'; else echo 'PAGE'; ?></div> | ||
<article class="post yue"> | ||
<h1 class="post-title"><?php $this->title(); ?></h1> | ||
<p class="post-meta"> | ||
<?php $this->author(); ?> • | ||
<?php echo date('Y-m-d', $this->created); ?> • | ||
<a href="#comments"><?php $this->commentsNum(); ?> Comments</a> | ||
<?php | ||
if(Utils::isPluginAvailable('TePostViews')) | ||
{ | ||
echo ' • '; | ||
$this->viewsNum(); | ||
echo ' Views'; | ||
} | ||
?> | ||
</p> | ||
<div id="archives"> | ||
<?php $this->widget('Widget_Contents_Post_Recent', 'pageSize=10000')->to($archives);?> | ||
<ol> | ||
<?php while($archives->next()): ?> | ||
<li> | ||
<div class="meta"> | ||
<span class="date"><?php echo date('M d\<\s\p\a\n\> l\<\/\s\p\a\n\>',$archives->created); ?></span> | ||
<span class="year"><?php echo date('Y',$archives->created); ?></span> | ||
</div> | ||
<div class="content"> | ||
<span class="title"><a href="<?php $archives->permalink(); ?>"><?php $archives->title(); ?></a></span> | ||
</div> | ||
</li> | ||
<?php endwhile; ?> | ||
</ol> | ||
</div> | ||
</article> | ||
</section> | ||
|
||
<!--评论区,可选--> | ||
<?php if ($this->allow('comment')) $this->need('includes/comments.php'); ?> | ||
</div> | ||
</main> | ||
|
||
<?php | ||
if(!Utils::isPjax()){ | ||
$this->need('includes/footer.php'); | ||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2018 AlanDecode | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Typecho Theme VOID | ||
|
||
> 🐒 猴子打字机原理的产物 | ||
作为计算机术语时,VOID 的意思是「无类型」。 | ||
|
||
## 概览 | ||
|
||
 | ||
|
||
## 特性 | ||
|
||
> 演示站点:[熊猫小A的博客](https://blog.imalan.cn)。 | ||
* PJAX | ||
* 响应式设计 | ||
* 卡片式 | ||
* 简洁易用 | ||
* 代码高亮 | ||
* MathJax 公式 | ||
* 表情解析 | ||
* 图片排版 | ||
* 目录解析 | ||
* ... | ||
|
||
总之用起来还算舒服。 | ||
|
||
## 开始使用 | ||
|
||
1. 下载压缩包:[点击下载](https://github.com/AlanDecode/Typecho-Theme-VOID/archive/master.zip) | ||
2. 解压 | ||
3. **把解压后的文件夹重命名为 VOID** | ||
4. 检查文件夹名是否为 VOID,不是的话改成 VOID | ||
5. 检查文件夹名是否为 VOID,不是的话改成 VOID | ||
6. 检查文件夹名是否为 VOID,不是的话改成 VOID | ||
7. 上传文件夹至站点 /usr/themes 目录下 | ||
8. 后台启用主题 | ||
|
||
可选:将主题 `assets` 文件夹下的 `VOIDCacheRule.js` 复制一份到站点根目录,以启用 Service Worker 缓存。 | ||
|
||
## 更新 | ||
|
||
重复「开始使用」章节的 1-6 步,然后删除服务器上原来的主题文件夹,最后进行「开始使用」章节的第 7 步。期间不要禁用主题。 | ||
|
||
## 鸣谢 | ||
|
||
### 开源项目 | ||
|
||
[JQuery](https://github.com/jquery/jquery) | [highlight.js](https://highlightjs.org/) | [MathJax](https://www.mathjax.org/) | [fancyBox](http://fancyapps.com/fancybox/3/) | [scrollTo](http://demos.flesler.com/jquery/scrollTo/) | [OwO](https://github.com/DIYgod/OwO) | [pjax](https://github.com/defunkt/jquery-pjax) | [yue.css](https://github.com/lepture/yue.css) | ||
|
||
### 其他 | ||
|
||
[RAW](https://github.com/AlanDecode/Typecho-Theme-RAW) | [Mirages](https://get233.com/archives/mirages-intro.html) | [handsome](https://www.ihewro.com/archives/489/) | ||
|
||
## License | ||
|
||
MIT © [AlanDecode](https://github.com/AlanDecode) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,195 @@ | ||
// RAW | ||
// Author: 熊猫小A | ||
// Link: https://www.imalan.cn | ||
|
||
console.log(` %c Theme VOID %c https://blog.imalan.cn/ `, `color: #fadfa3; background: #23b7e5; padding:5px;`, `background: #1c2b36; padding:5px;`); | ||
|
||
VOID = { | ||
// 初始化单页应用 | ||
init : function(){ | ||
NProgress.configure({ showSpinner: false }); | ||
VOID.parsedPhotos(); | ||
VOID.parseUrl(); | ||
hljs.initHighlightingOnLoad(); | ||
VOID.hitokoto(); | ||
var cookies = $.macaroon('_syan_like') || ""; | ||
$.each($(".post-like"),function(i,item){ | ||
var id = $(item).attr('data-pid'); | ||
if (-1 !== cookies.indexOf("," + id + ",")) $(item).addClass("done"); | ||
}) | ||
$(".post-like").click(function(){ | ||
$(this).addClass("done"); | ||
}) | ||
}, | ||
|
||
// 解析照片集 | ||
parsedPhotos : function(){ | ||
var nPhotos=$("article .photos img").length; | ||
var parsedPhotos=0; | ||
$.each($("article .photos"),function(i,item){ | ||
var MinHeight=10000000000000; | ||
$.each($(item).find("img"),function(ii,iitem){ | ||
var theImage = new Image(); | ||
theImage.onload=function(){ | ||
$(iitem).parent().attr("data-height",String(theImage.height)); | ||
$(iitem).parent().attr("data-width",String(theImage.width)); | ||
MinHeight=MinHeight<theImage.height?MinHeight:theImage.height; | ||
$(item).attr("data-min-h",String(MinHeight)); | ||
parsedPhotos++; | ||
if(parsedPhotos>=nPhotos){ | ||
$.each($("article .photos a"),function(i,item){ | ||
$(item).css("flex",String(parseFloat($(item).parent().attr("data-min-h"))/parseFloat($(item).attr("data-height")))); | ||
}) | ||
} | ||
} | ||
theImage.src = $(iitem).attr( "src"); | ||
}) | ||
}) | ||
}, | ||
|
||
// 解析URL | ||
parseUrl : function(){ | ||
var domain=document.domain; | ||
$(`a:not(a[href^="#"]):not('.post-like')`).each(function(i,item){ | ||
if((!$(item).attr("target") || (!$(item).attr("target")=="" && !$(item).attr("target")=="_self" ))){ | ||
if(item.host!=domain){ | ||
$(item).attr("target","_blank"); | ||
} | ||
} | ||
}) | ||
|
||
if(VOIDConfig.PJAX){ | ||
$.each($('a:not(a[target="_blank"], a[no-pjax])'),function(i,item){ | ||
if(item.host==domain){ | ||
$(item).addClass("pjax"); | ||
} | ||
}) | ||
$(document).pjax('a.pjax', { | ||
container: '#pjax-container', | ||
fragment: '#pjax-container', | ||
timeout: 8000, | ||
}); | ||
} | ||
}, | ||
|
||
// 一言 | ||
hitokoto : function(){ | ||
$.ajax({ | ||
url: " https://v1.hitokoto.cn/?c=a&encode=json", | ||
async:true, | ||
success:function(data){ | ||
$("#hitokoto").html(data.hitokoto + ` - 「` + data.from + `」`); | ||
} | ||
}); | ||
}, | ||
|
||
// PJAX 开始前 | ||
beforePjax : function(){ | ||
NProgress.start(); | ||
$(".toggle").removeClass("pushed"); | ||
if($("body").hasClass("modal-open")) VOID.closeModal(); | ||
$("#nav-mobile").fadeOut(200); | ||
}, | ||
|
||
// PJAX 结束后 | ||
afterPjax(){ | ||
NProgress.done(); | ||
VOID.parsedPhotos(); | ||
VOID.parseUrl(); | ||
VOID.reload(); | ||
}, | ||
|
||
// 重载与事件绑定 | ||
reload : function(){ | ||
// 重载代码高亮 | ||
$("pre code").each(function(i, block) {hljs.highlightBlock(block);}); | ||
// 重载 MathJax | ||
if (typeof MathJax !== 'undefined'){ | ||
MathJax.Hub.Queue(["Typeset",MathJax.Hub]); | ||
} | ||
// 重载百度统计 | ||
if (typeof _hmt !== 'undefined'){ | ||
_hmt.push(['_trackPageview', location.pathname + location.search]); | ||
} | ||
// 重新绑定文章点赞事件 | ||
$(".post-like").click(function(){ | ||
$(this).addClass("done"); | ||
}) | ||
$(".post-like").on("click", function(){ | ||
var th = $(this); | ||
var id = th.attr('data-pid'); | ||
var cookies = $.macaroon('_syan_like') || ""; | ||
if (!id || !/^\d{1,10}$/.test(id)) return; | ||
if (-1 !== cookies.indexOf("," + id + ",")) return alert("您已经赞过了!"); | ||
cookies ? cookies.length >= 160 ? (cookies = cookies.substring(0, cookies.length - 1), cookies = cookies.substr | ||
(1).split(","), cookies.splice(0, 1), cookies.push(id), cookies = cookies.join(","), $.macaroon("_syan_like", "," + cookies + | ||
",")) : $.macaroon("_syan_like", cookies + id + ",") : $.macaroon("_syan_like", "," + id + ","); | ||
$.post(likePath,{ | ||
cid:id | ||
},function(data){ | ||
th.addClass('actived'); | ||
var zan = th.find('.like-num').text(); | ||
th.find('.like-num').text(parseInt(zan) + 1); | ||
},'json'); | ||
}); | ||
// 已点赞按钮高亮 | ||
var cookies = $.macaroon('_syan_like') || ""; | ||
$.each($(".post-like"),function(i,item){ | ||
var id = $(item).attr('data-pid'); | ||
if (-1 !== cookies.indexOf("," + id + ",")) $(item).addClass("done"); | ||
}) | ||
}, | ||
|
||
scrollTop : 0, | ||
|
||
// 开启模态框 | ||
openModal : function(){ | ||
VOID.scrollTop = document.scrollingElement.scrollTop; | ||
document.body.classList.add("modal-open"); | ||
document.body.style.top = -VOID.scrollTop + 'px'; | ||
}, | ||
|
||
// 关闭模态框 | ||
closeModal : function () { | ||
document.body.classList.remove("modal-open"); | ||
document.scrollingElement.scrollTop = VOID.scrollTop; | ||
} | ||
} | ||
|
||
$(document).ready(function(){ | ||
VOID.init(); | ||
}) | ||
|
||
if(VOIDConfig.PJAX){ | ||
$(document).on('pjax:send',function(){ | ||
VOID.beforePjax(); | ||
}) | ||
|
||
$(document).on('pjax:complete',function(){ | ||
VOID.afterPjax(); | ||
}) | ||
} | ||
|
||
setInterval(function(){ | ||
var times = new Date().getTime() - Date.parse(VOIDConfig.buildTime); | ||
times = Math.floor(times/1000); // convert total milliseconds into total seconds | ||
var days = Math.floor( times/(60*60*24) ); //separate days | ||
times %= 60*60*24; //subtract entire days | ||
var hours = Math.floor( times/(60*60) ); //separate hours | ||
times %= 60*60; //subtract entire hours | ||
var minutes = Math.floor( times/60 ); //separate minutes | ||
times %= 60; //subtract entire minutes | ||
var seconds = Math.floor( times/1 ); // remainder is seconds | ||
$("#uptime").html(days + " 天 " + hours + " 小时 " + minutes + " 分 " + seconds + " 秒 "); | ||
}, 1000); | ||
|
||
$(document).scroll(function(){ | ||
if(window.innerWidth <= 768) return; | ||
if($(".TOC").length<1) return; | ||
if($(document).scrollTop() > 400){ | ||
$(".TOC").addClass("fixed"); | ||
} | ||
else{ | ||
$(".TOC").removeClass("fixed"); | ||
} | ||
}) |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.