diff --git a/css/style.css b/css/style.css index 5976203..d0518b1 100644 --- a/css/style.css +++ b/css/style.css @@ -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; @@ -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;*/ diff --git a/edit/extend.js b/edit/extend.js index 7329ce2..f9ce1f3 100644 --- a/edit/extend.js +++ b/edit/extend.js @@ -126,6 +126,9 @@ $("#wmd-button-row #wmd-fullscreen-button").before(`
  • +
  • + +
  • @@ -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(` +
    +

    插入自定义文字

    +
    +

    文字大小(px): + + 文字颜色(颜色值): + + 输入文字: + +

    + + + +
    +
    +`); +$(".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; diff --git a/functions.php b/functions.php index b23c44e..3ba9b90 100644 --- a/functions.php +++ b/functions.php @@ -130,10 +130,9 @@ function themeConfig($form) { $announcement = new Typecho_Widget_Helper_Form_Element_Textarea('announcement', NULL, _t('这里是公告
    '), _t('公告'), _t('在这里填入公告,它会显示在右侧栏的公告上,采用html写法')); $form->addInput($announcement); - $AD = new Typecho_Widget_Helper_Form_Element_Textarea('AD', NULL, _t('暂无广告
    '), _t('广告'), _t('在这里填入广告,会显示在侧栏中公告栏的下方,支持html')); + $AD = new Typecho_Widget_Helper_Form_Element_Textarea('AD', NULL, _t('暂无广告
    '), _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); @@ -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; @@ -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 ''. $text[3] .''; + }, $text); + return $text; +} + function ArtPlayer($text) { $text = preg_replace_callback('/\[video title=\"(.*?)"\ url=\"(.*?)"\ container=\"(.*?)"\ subtitle=\"(.*?)"\ poster=\"(.*?)"\](.*?)\[\/video\]/ism', function ($text) { @@ -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'; @@ -1302,7 +1312,13 @@ function getOs($agent) else if (preg_match('/android 11/i', $agent)) { $os = '    Android 11 / '; } - else{ + else if (preg_match('/android 12/i', $agent)) { + $os = '    Android 12 / '; + } + else if (preg_match('/android 13/i', $agent)) { + $os = '    Android 13 / '; + } + else{ $os = '    Android / '; } } @@ -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;$ifetchRow($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 . " 年前" ; @@ -1641,8 +1660,8 @@ class editor { public static function reset() { - echo ""; - echo ""; + echo ""; + echo ""; } } @@ -1724,4 +1743,4 @@ function getCaptcha($recaptcha_response, $secretKey) { } } return $comment; -} +} \ No newline at end of file diff --git a/header_com.php b/header_com.php index deecb98..38d42ed 100644 --- a/header_com.php +++ b/header_com.php @@ -22,7 +22,7 @@ - + options->beautifyBlock) && in_array('ShowBeautifyChange',$this->options->beautifyBlock)): ?> @@ -64,7 +64,7 @@ root: "/", algolia: void 0, localSearch: { - path: "search.xml", + path: "", languages: { hits_empty: "回车查询:${query}" } diff --git a/index.php b/index.php index 3921a94..9925234 100644 --- a/index.php +++ b/index.php @@ -3,12 +3,11 @@ * 主题最新版本:获取中... * 这是 Typecho 版本的 butterfly 主题 * 主题为移植至Typecho,你可以替换原butterfly主题的index.css文件 - * 当前适配hexo-butterfly 4.2.0 - * 个人网站 - * 主题文档 + * 当前适配 hexo-butterfly 4.2.0 + * 个人网站 | 主题使用文档 * @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; @@ -104,7 +103,6 @@ need('sidebar.php'); ?> need('footer.php'); ?> - \ No newline at end of file diff --git a/js/main.js b/js/main.js index f6c8bec..5c1a34d 100644 --- a/js/main.js +++ b/js/main.js @@ -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') @@ -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) } diff --git a/online.dat b/online.dat index 8b13789..e69de29 100644 --- a/online.dat +++ b/online.dat @@ -1 +0,0 @@ - diff --git a/page.php b/page.php index 116956e..9e830b3 100644 --- a/page.php +++ b/page.php @@ -18,6 +18,36 @@ echo $content; ?> + fields->ShowReward === 'show' || $this->options->ShowGlobalReward === 'show') : ?> +
    +
    + 打赏
    +
    +
      +options->RewardInfo) : ?> + 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 . + '
    • + + ' . explode( +
      ' . explode("||", $string_arr[$i])[0] . '
      +
      +
    • '; + } + echo $list; + } + ?> + +
    +
    +
    + need('comments.php'); ?> need('post_sidebar.php'); ?> diff --git a/page_header.php b/page_header.php index 3593858..fdf2467 100644 --- a/page_header.php +++ b/page_header.php @@ -12,6 +12,8 @@ 'tag' => _t('标签 %s 下的文章'), 'author' => _t('%s 发布的文章') ), '', ''); ?> + user->hasLogin()):?> + diff --git a/post_sidebar.php b/post_sidebar.php index 2e16e26..9ce325f 100644 --- a/post_sidebar.php +++ b/post_sidebar.php @@ -49,9 +49,12 @@
    公告
    options->announcement() ?>
    -
    - 广告
    -
    options->AD() ?>
    +options->AD)): ?> +
    +
    广告
    +
    options->AD() ?>
    +
    +
    @@ -148,4 +151,4 @@
    -
    +
    \ No newline at end of file diff --git a/public/defend.php b/public/defend.php index 1eb0762..61c4b15 100644 --- a/public/defend.php +++ b/public/defend.php @@ -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' ){ ?> @@ -19,7 +20,7 @@ - +
    @@ -38,8 +39,15 @@ + + + + + + + - - - - + +
    diff --git a/sidebar.php b/sidebar.php index 56dae07..9cf9dc4 100644 --- a/sidebar.php +++ b/sidebar.php @@ -51,9 +51,12 @@ 公告
    options->announcement() ?>
    -
    - 广告
    -
    options->AD() ?>
    + options->AD)): ?> +
    +
    广告
    +
    options->AD() ?>
    +
    +
    options->sidebarBlock) && in_array('ShowRecentPosts', $this->options->sidebarBlock)): ?>
    @@ -211,4 +214,4 @@
    - + \ No newline at end of file