Skip to content

Commit

Permalink
update 1.6.3
Browse files Browse the repository at this point in the history
  • Loading branch information
wehaox committed Sep 12, 2022
1 parent 06bb33d commit d1dd62f
Show file tree
Hide file tree
Showing 12 changed files with 138 additions and 37 deletions.
10 changes: 9 additions & 1 deletion css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,8 @@ pre code {
margin:4.4px 0.px .4px 1px;
padding:0;
max-height:200px;
padding:8px 8px 8px 42px!important;;
padding:8px 8px 8px 42px!important;
visibility:visible;
}
.expand-bcode{
max-height:100%!important;
Expand Down Expand Up @@ -545,6 +546,13 @@ code[class*="language-"], pre[class*="language-"] {
overflow: auto!important;
}
.OwO .OwO-body .OwO-bar{border:none!important}


.read-fa {
visibility:hidden;
display: inline;
}

/*已移除内容*/
/*#article-container.post-content ul>li:not(.tab):before {*/
/* top: 0.78em;*/
Expand Down
33 changes: 32 additions & 1 deletion edit/extend.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ $("#wmd-button-row #wmd-fullscreen-button").before(`
<li class="wmd-button custom" id="b-wmd-video" title="插入视频">
<svg t="1657445029879" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7626" width="200" height="200"><path d="M374.6 636.5c4.4 0 8.5-1.2 12.1-3.3l171.7-100c8-3.6 13.6-11.9 13.6-21.5 0-8.8-4.8-16.6-11.9-20.7l-167.8-97.8c-4.3-5-10.7-8.1-17.7-8.1-13.1 0-23.6 10.7-23.6 23.8v1.3l-0.3 0.2 0.4 199.8c-0.1 0.8-0.1 1.6-0.1 2.5 0 13.2 10.6 23.8 23.6 23.8z" fill="#707070" p-id="7627"></path><path d="M64.7 586.3a32.2 32.1 0 1 0 64.4 0 32.2 32.1 0 1 0-64.4 0Z" fill="#707070" p-id="7628"></path><path d="M960 398.3c0.1-1.6 0.2-3.2 0.2-4.8 0-35-28.5-63.3-63.6-63.3-11.7 0-22.7 3.2-32.2 8.7l-0.5-0.3-31.5 18.2v-64.7c-0.1-73.1-59.9-133-133.1-133H197.4c-73.1 0-133 59.8-133 133v165.8h0.2c0 17.7 14.4 32.1 32.2 32.1s32.2-14.4 32.2-32.1h0.2V287c0-35.2 28.8-64 64-64h510.2c35.2 0 64 28.8 64 64v448.9c0 35.2-28.8 64-64 64H193.3c-35.2 0-64-28.8-64-64v-21.4c0-17.7-14.4-32.1-32.2-32.1-17.8 0-32.2 14.4-32.2 32.1h-0.4v15.3c0 73.2 59.9 133 133 133h501.9c73.2 0 133-59.8 133-133v-64.1l33.1 19.1 0.1-0.1c9.2 5.1 19.8 8 31 8 35.1 0 63.6-28.4 63.6-63.3 0-1.6-0.1-3.2-0.2-4.8V398.3z m-63.6 205.1c-0.3 7.8-6.9 14.1-15 14.1-2.7 0-5.3-0.7-7.5-2l-41.5-23.7V430.1l40.9-23.2c2.3-1.5 5.1-2.3 8.1-2.3 8.3 0 15 6.6 15 14.6v184.2z" fill="#707070" p-id="7629"></path></svg>
</li>
<li class="wmd-button custom" id="b-wmd-cfont" title="插入自定义文字">
<svg t="1662034634310" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3275" width="200" height="200"><path d="M840.041268 326.208527l-38.23072 5.392824c-11.082406-53.866838-20.333094-80.820724-33.871435-98.779747-18.470677-26.329668-34.516118-34.853809-122.633015-34.853809l-91.596138 0 0 555.051515c0 89.211834 8.994861 99.015108 122.397654 105.001449l0 35.32453-326.270948 0 0-35.32453c109.104907-5.986341 122.070196-14.602579 122.070196-105.001449l0-555.051515-86.039585 0c-88.168062 0-112.215758 8.524141-126.992299 33.656541-12.903891 19.156292-22.185278 50.2955-35.733852 99.977016l-37.565571 0c4.297886-66.453505 11.082406-131.177622 13.538341-194.029088l25.285896 0c17.242709 25.1324 32.019251 19.821441 64.089667 19.821441l457.878358 0c30.821983 0 37.565571 1.115404 54.849212-19.821441l27.117614 0C828.334645 190.855816 833.891198 263.960811 840.041268 326.208527z" p-id="3276" fill="#515151"></path></svg>
</li>
<li class="wmd-spacer wmd-spacer4" id="wmd-spacer4"></li>
<li class="wmd-button custom" id="b-wmd-md-draft" title="保存草稿">
<svg t="1630841483224" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="10796" width="64" height="64"><path d="M363.175 705.746l241.359-241.358c16.594-16.594 16.594-43.747 0-60.34s-43.747-16.594-60.34 0L302.835 645.407c-16.592 16.594-16.592 43.747 0 60.339 16.594 16.593 43.747 16.593 60.34 0z" p-id="10797" fill="#707070"></path><path d="M981.333 922.848H387.434l442.898-442.899 46.99-46.988 90.964-90.965c33.188-33.186 33.188-87.491 0-120.679L787.266 40.298c-33.186-33.188-87.493-33.188-120.679 0l-90.965 90.964-60.34 60.34L43.075 663.808l-30.168 30.17 0.036 0.036C5.21 701.747 0.408 712.415 0.408 724.148v237.354C0.28 962.843 0 964.141 0 965.515c0 11.837 4.903 22.569 12.757 30.319 7.75 7.854 18.481 12.759 30.318 12.759 1.385 0 2.694-0.281 4.047-0.411h934.212c23.467 0 42.667-19.2 42.667-42.667-0.001-23.466-19.201-42.667-42.668-42.667zM85.741 827.154l95.694 95.694H85.741v-95.694z m611.016-696.348c16.592-16.592 43.747-16.592 60.339 0l120.681 120.681c16.594 16.594 16.592 43.747 0 60.339l-60.795 60.795-181.02-181.019 60.795-60.796zM133.585 693.978l442.036-442.036L756.64 432.961 314.604 874.997l-30.17 30.17-30.17-30.17-120.679-120.678-30.17-30.17 30.17-30.171z" p-id="10798" fill="#707070"></path></svg>
Expand Down Expand Up @@ -493,8 +496,36 @@ $(".btn-ok").click(function(){
insertAtCursor('[video title="'+title+' " url="'+url+' " container="b'+artplayer+'" subtitle="'+subtitle+' " poster="'+poster+' "]'+highlight+' [/video]\n');
});
});

//插入自定义文字
$("#b-wmd-cfont").on("click",function() {
$("#ui-datepicker-div").after(`
<div class="wmd-prompt-dialog">
<div><p><b>插入自定义文字</b></p></div>
<form>
<p>文字大小(px):
<input type="text" name="font-size">
文字颜色(颜色值):
<input type="text" name="color">
输入文字:
<textarea type="text" name="Text"></textarea>
</p>
<input type="text" style="display:none;">
<button type="button" class="btn btn-s primary btn-ok">确定</button>
<button type="button" class="btn btn-s btn-cancel">取消</button>
</form>
</div>
`);
$(".btn-ok").click(function(){
let fontSize = $('input[name="font-size"]').val();
let color = $('input[name="color"]').val();
let text = $('textarea[name="Text"]').val();
insertAtCursor('[font size="'+fontSize+'" color="'+color+'"]'+text+'[/font]\n');
});
});

// 需要调用dialog样式的容器
$("#b-wmd-linecode,#b-wmd-code,#b-wmd-reply,#b-wmd-nhtml,#b-wmd-wcheakbox,#b-wmd-inline-tag,#b-wmd-radio,#b-wmd-md-link,#b-wmd-md-img,#b-wmd-mark,#b-wmd-btn,#b-wmd-note,#b-wmd-hide-block,#b-wmd-hide-inline,#b-wmd-hide-toggle,#b-wmd-note-ico,#b-wmd-md-explain,#b-wmd-title,#b-wmd-video").click(function(){
$("#b-wmd-linecode,#b-wmd-code,#b-wmd-reply,#b-wmd-nhtml,#b-wmd-wcheakbox,#b-wmd-inline-tag,#b-wmd-radio,#b-wmd-md-link,#b-wmd-md-img,#b-wmd-mark,#b-wmd-btn,#b-wmd-note,#b-wmd-hide-block,#b-wmd-hide-inline,#b-wmd-hide-toggle,#b-wmd-note-ico,#b-wmd-md-explain,#b-wmd-title,#b-wmd-video,#b-wmd-cfont").click(function(){
var y = document.createElement("div");
let height = document.body.scrollHeight;
z = y.style;
Expand Down
41 changes: 30 additions & 11 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,9 @@ function themeConfig($form) {
$announcement = new Typecho_Widget_Helper_Form_Element_Textarea('announcement', NULL, _t('这里是公告<br>'), _t('公告'), _t('在这里填入公告,它会显示在右侧栏的公告上,采用html写法'));
$form->addInput($announcement);

$AD = new Typecho_Widget_Helper_Form_Element_Textarea('AD', NULL, _t('暂无广告<br>'), _t('广告'), _t('在这里填入广告,会显示在侧栏中公告栏的下方,支持html'));
$AD = new Typecho_Widget_Helper_Form_Element_Textarea('AD', NULL, _t('暂无广告<br>'), _t('广告(由@yzl3014提供)'), _t('在这里填入广告,填入后自动显示在侧栏中公告栏的下方,支持html'));
$form->addInput($AD);



$headerimg = new Typecho_Widget_Helper_Form_Element_Text('headerimg', NULL,_t('https://tva1.sinaimg.cn/large/007X0Rdyly1ghm1qiihrdj31hc0u07jk.jpg'), _t('主页顶图(banner image)'), _t('填入主页头图链接'));
$form->addInput($headerimg);

Expand Down Expand Up @@ -911,6 +910,7 @@ function ParseCode($text)
$text = inline_Tag($text);
$text = Bf_Radio($text);
$text = Bf_Mark($text);
$text = Font($text);
$text = ArtPlayer($text);
$text = PostImage($text);
return $text;
Expand Down Expand Up @@ -1032,6 +1032,14 @@ function Bf_Mark($text)
return $text;
}

function Font($text)
{
$text = preg_replace_callback('/\[font size=\"(.*?)"\ color=\"(.*?)"\](.*?)\[\/font\]/ism', function ($text) {
return '<font style="font-size: '. $text[1] .'px;color:'. $text[2] .'">'. $text[3] .'</font>';
}, $text);
return $text;
}

function ArtPlayer($text)
{
$text = preg_replace_callback('/\[video title=\"(.*?)"\ url=\"(.*?)"\ container=\"(.*?)"\ subtitle=\"(.*?)"\ poster=\"(.*?)"\](.*?)\[\/video\]/ism', function ($text) {
Expand Down Expand Up @@ -1198,9 +1206,11 @@ function getGravatar($email,$name, $comments_a,$s = 96, $d = 'mp', $r = 'g')
$geturl = 'https://ptlogin2.qq.com/getface?&imgtype=1&uin='.$qquser;
$qqurl = file_get_contents($geturl);
$str1 = explode('sdk&k=', $qqurl);
$str2 = explode('&t=', $str1[1]);
$k = $str2[0];
$db->query($db->update('table.comments')->rows(array('qqk' => $k))->where('mail=?',$email));
if(isset($str1[1])){
$str2 = explode('&t=',$str1[1]);
$k = $str2[0];
$db->query($db->update('table.comments')->rows(array('qqk' => $k))->where('mail=?',$email));
}
$url = 'https://q1.qlogo.cn/headimg_dl?dst_uin='.$qquser.'&spec=100';
}else{
$url = 'https://q1.qlogo.cn/g?b=qq&k='.$dbk.'&s=100';
Expand Down Expand Up @@ -1302,7 +1312,13 @@ function getOs($agent)
else if (preg_match('/android 11/i', $agent)) {
$os = '&nbsp;&nbsp;<i class="fab fa-android"></i>&nbsp;&nbsp;Android 11&nbsp;/&nbsp;';
}
else{
else if (preg_match('/android 12/i', $agent)) {
$os = '&nbsp;&nbsp;<i class="fab fa-android"></i>&nbsp;&nbsp;Android 12&nbsp;/&nbsp;';
}
else if (preg_match('/android 13/i', $agent)) {
$os = '&nbsp;&nbsp;<i class="fab fa-android"></i>&nbsp;&nbsp;Android 13&nbsp;/&nbsp;';
}
else{
$os = '&nbsp;&nbsp;<i class="fab fa-android"></i>&nbsp;&nbsp;Android&nbsp;/&nbsp;';
}
}
Expand Down Expand Up @@ -1467,6 +1483,9 @@ function printTag($that) { ?>
function onlinePeople(){
$online_log = "usr/themes/butterfly/online.dat"; //保存人数的文件到根目录,
$timeout = 30;//30秒内没动作者,认为掉线
if(!file_exists($online_log) ){
fopen($online_log, "w");
}
$entries = file($online_log);
$temp = array();
for ($i=0;$i<count($entries);$i++){
Expand Down Expand Up @@ -1614,7 +1633,7 @@ function get_last_update(){
$create = $db->fetchRow($db->select('created')->from('table.contents')->where('table.contents.type=? and status=?',$type,$status)->order('created',Typecho_Db::SORT_DESC)->limit($num));
$update = $db->fetchRow($db->select('modified')->from('table.contents')->where('table.contents.type=? and status=?',$type,$status)->order('modified',Typecho_Db::SORT_DESC)->limit($num));
if($create>=$update){
echo Typecho_I18n::dateWord($create['created'], $now);
echo Typecho_I18n::dateWord(isset($create['created']), $now);
}else{
$lastday = floor(date($now-$update['modified'])/86400);
if($lastday>365){$lastyear = floor(date($now-$update['modified'])/30758400);echo $lastyear . " 年前" ;
Expand All @@ -1641,8 +1660,8 @@ class editor
{
public static function reset()
{
echo "<script src='" . Helper::options()->themeUrl . '/edit/extend.js?v1.6.0' . "'></script>";
echo "<link rel='stylesheet' href='" . Helper::options()->themeUrl . '/edit/edit.css?v1.6.0' . "'>";
echo "<script src='" . Helper::options()->themeUrl . '/edit/extend.js?v1.6.3' . "'></script>";
echo "<link rel='stylesheet' href='" . Helper::options()->themeUrl . '/edit/edit.css?v1.6.3' . "'>";
}

}
Expand Down Expand Up @@ -1724,4 +1743,4 @@ function getCaptcha($recaptcha_response, $secretKey) {
}
}
return $comment;
}
}
4 changes: 2 additions & 2 deletions header_com.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<link rel="preconnect" href="//cdn.staticfile.org" />
<!--<link rel="stylesheet" href="https://gcore.jsdelivr.net/npm/justifiedGallery/dist/css/justifiedGallery.min.css">-->
<link rel="stylesheet" href="<?php $this->options->themeUrl('index.css?v1.5.3'); ?>">
<link rel="stylesheet" href="<?php $this->options->themeUrl('css/style.css?v1.6.1'); ?>">
<link rel="stylesheet" href="<?php $this->options->themeUrl('css/style.css?v1.6.4'); ?>">
<!--魔改美化-->
<?php if (!empty($this->options->beautifyBlock) && in_array('ShowBeautifyChange',$this->options->beautifyBlock)): ?>
<link rel="stylesheet" href="<?php $this->options->themeUrl('css/custom.css?v1.5.9'); ?>">
Expand Down Expand Up @@ -64,7 +64,7 @@
root: "/",
algolia: void 0,
localSearch: {
path: "search.xml",
path: "",
languages: {
hits_empty: "回车查询:${query}"
}
Expand Down
10 changes: 4 additions & 6 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
* <span><script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>主题最新版本:<span id="latest">获取中...</span><script>$(document).ready(function() {$.get("https://typecho.wehao.ml", function(data) { $("#latest").text(data.ver);});});</script></span>
* 这是 Typecho 版本的 butterfly 主题
* 主题为移植至Typecho,你可以替换原butterfly主题的index.css文件
* 当前适配hexo-butterfly 4.2.0
* <a href="https://www.wehaox.com">个人网站</a>
* <a href="https://blog.wehaox.com/archives/typecho-butterfly.html">主题文档</a>
* 当前适配 hexo-butterfly 4.2.0
* <a href="https://www.wehaox.com">个人网站</a> | <a href="https://blog.wehaox.com/archives/typecho-butterfly.html">主题使用文档</a>
* @package Typecho-Butterfly
* @author b站:wehao-
* @version 1.6.0
* @version 1.6.3
* @link https://space.bilibili.com/34174433
*/
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
Expand Down Expand Up @@ -104,7 +103,6 @@
<?php $this->need('sidebar.php'); ?>
</main>
<?php $this->need('footer.php'); ?>

<script>
function ver() {console.log(`
===================================================================
Expand All @@ -116,7 +114,7 @@ function ver() {console.log(`
# # # # # # # # # # # #
##### #### # # ###### # # # ###### #
1.6.0
1.6.3
===================================================================
`);}
</script>
2 changes: 2 additions & 0 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,7 @@ document.addEventListener('DOMContentLoaded', function () {
*/
const rightSideFn = {
switchReadMode: () => { // read-mode
$('.code-toolbar').addClass('read-fa')
const $body = document.body
$body.classList.add('read-mode')
const newEle = document.createElement('button')
Expand All @@ -457,6 +458,7 @@ document.addEventListener('DOMContentLoaded', function () {

function clickFn () {
$body.classList.remove('read-mode')
$('.code-toolbar').removeClass('read-fa')
newEle.remove()
newEle.removeEventListener('click', clickFn)
}
Expand Down
1 change: 0 additions & 1 deletion online.dat
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@

30 changes: 30 additions & 0 deletions page.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,36 @@
echo $content;
?>
</article>
<?php if($this->fields->ShowReward === 'show' || $this->options->ShowGlobalReward === 'show') : ?>
<div class="post-reward">
<div class="reward-button button--animated">
<i class="fas fa-qrcode"></i>打赏</div>
<div class="reward-main">
<ul class="reward-all">
<?php if ($this->options->RewardInfo) : ?>
<?php
if (strpos($this->options->RewardInfo, '||') !== false) {
$list = "";
$txt = $this->options->RewardInfo;
$string_arr = explode("\r\n", $txt);
$long = count($string_arr);
for ($i = 0; $i < $long; $i++) {
$list = $list .
'<li class="reward-item">
<a href="' . explode("||", $string_arr[$i])[1] . '" rel="external nofollow noreferrer" target="_blank">
<img class="post-qr-code-img entered loaded" data-lazy-src="' . explode("||", $string_arr[$i])[1] . '" alt="' . explode("||", $string_arr[$i])[0] . '" src="'.GetLazyLoad().'">
<div class="post-qr-code-desc">' . explode("||", $string_arr[$i])[0] . '</div>
</a>
</li>';
}
echo $list;
}
?>
<?php endif; ?>
</ul>
</div>
</div>
<?php endif; ?>
<?php $this->need('comments.php'); ?>
</div>
<?php $this->need('post_sidebar.php'); ?>
Expand Down
2 changes: 2 additions & 0 deletions page_header.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
'tag' => _t('标签 %s 下的文章'),
'author' => _t('%s 发布的文章')
), '', ''); ?>
<?php if($this->user->hasLogin()):?>
<a style="float: none;" class="post-edit-link" href="<?php $this->options->adminUrl(); ?>write-page.php?cid=<?php echo $this->cid;?>" title="編輯" target="_blank"><i class="fas fa-pencil-alt"></i></a><?php endif;?>
</h1>
</div>
<?php else: ?>
Expand Down
11 changes: 7 additions & 4 deletions post_sidebar.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,12 @@
<div class="card-widget card-announcement"><div class="item-headline">
<i class="fas fa-bullhorn card-announcement-animation"></i><span>公告</span></div>
<div class="announcement_content"><?php $this->options->announcement() ?></div></div>
<div class="card-widget card-announcement"><div class="item-headline">
<i class="fas fa-bullhorn card-announcement-animation"></i><span>广告</span></div>
<div class="announcement_content"><?php $this->options->AD() ?></div></div>
<?php if (!empty($this->options->AD)): ?>
<div class="card-widget card-announcement">
<div class="item-headline"><span>广告</span></div>
<div class="announcement_content"><?php $this->options->AD() ?></div>
</div>
<?php endif; ?>
<div class="sticky_layout">
<div class="card-widget" id="card-toc">
<div class="item-headline">
Expand Down Expand Up @@ -148,4 +151,4 @@
<?php endif; ?>

</div>
</div><!-- end #sidebar -->
</div><!-- end #sidebar -->
20 changes: 13 additions & 7 deletions public/defend.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
exit ('{"status": "200","info":"密码正确,芝麻开门!"}');
}
}
if(isset($_COOKIE["ThemePassword"])!==$this->options->ThemePassword && $this->options->Defend === 'on' || isset($_COOKIE["ThemePassword"])==""&& $this->options->Defend === 'on' ){
if(isset($_COOKIE["ThemePassword"]) && $_COOKIE["ThemePassword"] !==$this->options->ThemePassword && $this->options->Defend === 'on'
|| empty($_COOKIE["ThemePassword"]) && $this->options->Defend === 'on' ){
?>

<html data-theme="light">
Expand All @@ -19,7 +20,7 @@
</head>
<body _c_t_common="1">
<link rel="stylesheet" href="//unpkg.com/element-plus/dist/index.css" />
<script src="https://cdn.jsdelivr.net/npm/vue@3.2.23/dist/vue.global.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue@3.2.23/dist/vue.global.prod.js"></script>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script src="//unpkg.com/element-plus"></script>
<div id="web_bg"></div>
Expand All @@ -38,8 +39,15 @@
<input style="text-align: center" type="password" class="text" placeholder="或在此输入密码访问" v-model="pwd" autocomplete="off">
<input type="submit" class="submit" value="提交" @click="send">
</form>
<?php endif ?>
</div>
</div>
</div>



<script>
const passwordApp = {
const passwordApp = {
data() {
return {
pwd: ''
Expand Down Expand Up @@ -81,10 +89,8 @@
app.use(ElementPlus);
app.mount("#error-wrap");
</script>
<?php endif ?>
</div>
</div>
</div>


<div>
</div>
</div>
Expand Down

0 comments on commit d1dd62f

Please sign in to comment.