diff --git a/README.md b/README.md index be79512..855c029 100644 --- a/README.md +++ b/README.md @@ -29,10 +29,12 @@ _Haku,是 Tina 小姐最爱的喵喵,它在这里守卫着 Tina 小姐_ 原主题:[https://github.com/WingLim/hugo-tania](https://github.com/WingLim/hugo-tania) ## 最近版本更新日志 -- 调整了 自定义页脚部分的位置 -- 更改为原版 Jquery Pjax 进行加载 -- 使用原版 Jquery Pjax 进行加载后,支持了MathJax的加载 -- 使用原版 Jquery Pjax 进行加载后,支持了对夜间模式的正常加载 +- ✨ 新增对鼠标美化的UA检测,手机端将不再显示 +- ✨ 新增代码块复制功能 +- ✨ 新增图片Lazyload,需开启Jquery,开启图片灯箱即可开启Lazyload +- 精简底部版权信息 +- ⚠️ TinaTheme 于 `2.1.2-Build30608-Dev-No.4` 版本更新了静态资源库,请自建静态资源的用户更新后及时比对[文档](https://tina.docs.fmcf.cc/optimization/public_cdn/)更新,以免资源失效 + ## 功能与特性 diff --git a/assets/js/codecopy.js b/assets/js/codecopy.js new file mode 100644 index 0000000..b1abe8d --- /dev/null +++ b/assets/js/codecopy.js @@ -0,0 +1,2 @@ +/*! CodeCopyJs for v2.1.2 | Created by Magneto for TinaTheme| Size about 1.1KB */ +var codeblocks=document.getElementsByTagName("pre");for(var i=0;i0)selection.removeAllRanges();selection.addRange(range);document.execCommand('copy');codeblocks[i].childNodes[1].innerHTML="Copy Success";setTimeout(function(){codeblocks[i].childNodes[1].innerHTML="Copy"},3000);if(selection.rangeCount>0)selection.removeAllRanges();0}codeblocks[i].childNodes[1].addEventListener('click',copyArticle,false)}(i)} \ No newline at end of file diff --git a/assets/js/cursor.js b/assets/js/cursor.js index cd59585..498bb89 100644 --- a/assets/js/cursor.js +++ b/assets/js/cursor.js @@ -1,2 +1,2 @@ -/*! CursorJS for v2.0.0 | Created by Magneto for TinaTheme */ +/*! CursorJS for v2.0.0 | Created by Magneto for TinaTheme| Size about 2.1KB */ var CURSOR;Math.lerp=(a,b,n)=>(1-n)*a+n*b;const getStyle=(el,attr)=>{try{return window.getComputedStyle?window.getComputedStyle(el)[attr]:el.currentStyle[attr]}catch(e){}return""};class Cursor{constructor(){this.pos={curr:null,prev:null};this.pt=[];this.create();this.init();this.render()}move(left,top){this.cursor.style["left"]=`${left}px`;this.cursor.style["top"]=`${top}px`}create(){if(!this.cursor){this.cursor=document.createElement("div");this.cursor.id="cursor";this.cursor.classList.add("hidden");document.body.append(this.cursor)}var el=document.getElementsByTagName('*');for(let i=0;i")4 4,auto!important}`}refresh(){this.scr.remove();this.cursor.classList.remove("hover");this.cursor.classList.remove("active");this.pos={curr:null,prev:null};this.pt=[];this.create();this.init();this.render()}init(){document.onmouseover=e=>this.pt.includes(e.target.outerHTML)&&this.cursor.classList.add("hover");document.onmouseout=e=>this.pt.includes(e.target.outerHTML)&&this.cursor.classList.remove("hover");document.onmousemove=e=>{(this.pos.curr==null)&&this.move(e.clientX-8,e.clientY-8);this.pos.curr={x:e.clientX-8,y:e.clientY-8};this.cursor.classList.remove("hidden")};document.onmouseenter=e=>this.cursor.classList.remove("hidden");document.onmouseleave=e=>this.cursor.classList.add("hidden");document.onmousedown=e=>this.cursor.classList.add("active");document.onmouseup=e=>this.cursor.classList.remove("active")}render(){if(this.pos.prev){this.pos.prev.x=Math.lerp(this.pos.prev.x,this.pos.curr.x,0.15);this.pos.prev.y=Math.lerp(this.pos.prev.y,this.pos.curr.y,0.15);this.move(this.pos.prev.x,this.pos.prev.y)}else{this.pos.prev=this.pos.curr}requestAnimationFrame(()=>this.render())}}(()=>{CURSOR=new Cursor()})(); \ No newline at end of file diff --git a/assets/js/features.js b/assets/js/features.js index 7f75712..fb1947c 100644 --- a/assets/js/features.js +++ b/assets/js/features.js @@ -1,2 +1,2 @@ -/*! TinaJS for v2.0.0 | Created by Magneto for TinaTheme| Size about 1.3KB */ -(()=>{S=function(){let l=document.documentElement,c="user-color-scheme",s="data-user-color-scheme",i=document.getElementById("dark-mode-button"),d=(n,a)=>{try{localStorage.setItem(n,a)}catch(g){}},h=n=>{try{localStorage.removeItem(n)}catch(a){}},e=n=>{try{return localStorage.getItem(n)}catch(a){return null}},t=()=>window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",o=()=>{l.removeAttribute(s),h(c)},r={dark:!0,light:!0},m=n=>{let a=n||e(c);a===t()?o():r[a]?l.setAttribute(s,a):o()},u={dark:"light",light:"dark"},f=()=>{let n=e(c);if(r[n])n=u[n];else if(n===null)n=u[t()];else return;return d(c,n),n};m(),i.addEventListener("click",()=>{m(f())})}()})();console.log('%cTheme: %cTinaTheme%cBy Magneto','color: rgba(255,255,255,.6); background: #ffbd31; font-size: 15px;border-radius:5px 0 0 5px;padding:10px 0 10px 20px;','color: rgba(255,255,255,1); background: #ffbd31; font-size: 15px;border-radius:0;padding:10px 15px 10px 0px;','color: #fff; background: #ffd479; font-size: 15px;border-radius:0 5px 5px 0;padding:10px 20px 10px 15px;');console.log('%chttps://github.com/ouyangyanhuo/TinaTheme','font-size: 12px;border-radius:5px;padding:3px 10px 3px 10px;border:1px solid #5e72e4;'); \ No newline at end of file +/*! TinaJS for v2.1.2 | Created by Magneto for TinaTheme| Size about 1.3KB */ +(()=>{S=function(){let l=document.documentElement,c="user-color-scheme",s="data-user-color-scheme",i=document.getElementById("dark-mode-button"),d=(n,a)=>{try{localStorage.setItem(n,a)}catch(g){}},h=n=>{try{localStorage.removeItem(n)}catch(a){}},e=n=>{try{return localStorage.getItem(n)}catch(a){return null}},t=()=>window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",o=()=>{l.removeAttribute(s),h(c)},r={dark:!0,light:!0},m=n=>{let a=n||e(c);a===t()?o():r[a]?l.setAttribute(s,a):o()},u={dark:"light",light:"dark"},f=()=>{let n=e(c);if(r[n])n=u[n];else if(n===null)n=u[t()];else return;return d(c,n),n};m(),i.addEventListener("click",()=>{m(f())})}()})();console.log('%cTheme: %cTinaTheme%cBy Magneto','color: rgba(255,255,255,.6); background: #ffbd31; font-size: 15px;border-radius:5px 0 0 5px;padding:10px 0 10px 20px;','color: rgba(255,255,255,1); background: #ffbd31; font-size: 15px;border-radius:0;padding:10px 15px 10px 0px;','color: #fff; background: #ffd479; font-size: 15px;border-radius:0 5px 5px 0;padding:10px 20px 10px 15px;');console.log('%chttps://github.com/ouyangyanhuo/TinaTheme','font-size: 12px;border-radius:5px;padding:3px 10px 3px 10px;border:1px solid #5e72e4;');$(function() {$("img.lazy").lazyload({effect: "fadeIn"});}); \ No newline at end of file diff --git a/core/functions.php b/core/functions.php index a203baa..dac45bf 100755 --- a/core/functions.php +++ b/core/functions.php @@ -306,6 +306,12 @@ function staticUrl($file = ''){ 'cf' => 'cdnjs.cloudflare.com/ajax/libs/jquery.pjax/2.0.1/jquery.pjax.min.js', 'jd' => 'cdn.jsdelivr.net/npm/jquery-pjax@2.0.1/jquery.pjax.min.js', 'custom' => isset($lists[11]) ? $lists[11] : '' + ], + 'jquery.lazyload.min.js' => [ + 'bc' => 'cdn.bootcdn.net/ajax/libs/jquery_lazyload/1.9.7/jquery.lazyload.min.js', + 'cf' => 'cdnjs.cloudflare.com/ajax/libs/jquery_lazyload/1.9.7/jquery.lazyload.min.js', + 'jd' => 'cdn.jsdelivr.net/npm/jquery-lazyload@1.9.7/jquery.lazyload.min.js', + 'custom' => isset($lists[12]) ? $lists[12] : '' ] ]; if (isset($cjCDNlinks[$file])) { diff --git a/footer.php b/footer.php index 7f7caba..f58f296 100755 --- a/footer.php +++ b/footer.php @@ -4,7 +4,7 @@ options->FooterHTML() ?> @@ -23,17 +23,27 @@ options->MathRender == 'Close'): ?> + options->WebPjax): ?> - + options->cursor): ?> - +options->themeUrl('/assets/js/cursor.js'); + echo '" data-enable-footnotes="true">'; +} +?> footer(); ?> diff --git a/functions.php b/functions.php index 1b05426..416966a 100755 --- a/functions.php +++ b/functions.php @@ -25,7 +25,7 @@ function themeConfig($form) { ), 0, _t('鼠标美化'), - _t('开启后电脑端网页会对鼠标进行美化,默认关闭)') + _t('开启后电脑端网页会对鼠标进行美化,手机端不会美化,默认关闭。') ); $form->addInput($cursor); @@ -98,7 +98,7 @@ function themeConfig($form) { null, null, _t('公共静态资源自建地址'), - _t('只在上面的选项选择自建时需要。') + _t('只在上面的选项选择自建时需要,[查看建规则]') ); $form->addInput($cjCDNlink); @@ -115,7 +115,7 @@ function themeConfig($form) { ), 1, _t('JqueryControl'), - _t('默认开启,如果要使用PJAX、Fancybox必须开启 Jquery 控件!') + _t('默认开启,如果要使用PJAX、Fancybox、Lazyload必须开启 Jquery 控件!') ); $form->addInput($JqueryControl); @@ -126,7 +126,7 @@ function themeConfig($form) { 0 => _t('关闭') ), 1, - _t('图片灯箱'), + _t('图片灯箱及Lazyload'), _t('默认开启,启用后可以优化图片浏览的体验') ); $form->addInput($fancybox); diff --git a/header.php b/header.php index a2679af..73ed477 100755 --- a/header.php +++ b/header.php @@ -38,6 +38,7 @@ options->fancybox): ?> + diff --git a/index.php b/index.php index 2441054..0f5f315 100755 --- a/index.php +++ b/index.php @@ -2,11 +2,11 @@ /** * 移植自WingLimhugo-tania主题,在其基础上进行了深度修改的 TinaTheme 或许是你在Typecho上最好的选择 *
版本检测中... 
- * + * * * @package Tina Theme * @author Magneto - * @version 2.1.1 + * @version 2.1.2 * @link https://www.fmcf.cc */ diff --git a/page-links.php b/page-links.php index 1954e42..55aa54d 100755 --- a/page-links.php +++ b/page-links.php @@ -25,7 +25,7 @@ options->fancybox): ?> ]*>/i'; - $replacement = '$2'; + $replacement = '$2'; $content = preg_replace($pattern, $replacement, $this->content); echo getContentTest($this->content); ?> diff --git a/page.php b/page.php index 344ce32..663f551 100755 --- a/page.php +++ b/page.php @@ -30,7 +30,7 @@ options->fancybox): ?> ]*>/i'; - $replacement = '$2'; + $replacement = '$2'; $content = preg_replace($pattern, $replacement, $this->content); echo getContentTest($this->content); ?> diff --git a/post.php b/post.php index 2066a82..6970fb7 100755 --- a/post.php +++ b/post.php @@ -1,4 +1,14 @@ +/* + * @Author: Magneto github.com:ouyangyanhuo + * @Date: 2023-06-08 10:43:31 + * @LastEditors: ouyangyanhuo ouyangyanhuo@vip.qq.com + * @LastEditTime: 2023-06-23 18:11:52 + * @FilePath: \AdminMDf:\Github Projects\TinaTheme\post.php + * @Description: + * EMail:magneto@88.com + * Copyright (c) 2023 by Magneto, All Rights Reserved. + */ need('header.php'); ?>
@@ -33,7 +43,7 @@ options->fancybox): ?> ]*>/i'; - $replacement = '$2'; + $replacement = '$2'; $content = preg_replace($pattern, $replacement, $this->content); echo getContentTest($content) ?>