gddhy

_(:з」∠)_ 加载中...
  • 主页
  • 归档
  • 工具
  • 关于
所有文章 友链

gddhy

_(:з」∠)_ 加载中...

  • 主页
  • 归档
  • 工具
  • 关于

博客美化&拓展

2021-06-06
字数统计:671字 阅读时长≈3分

博客建好后,有很长一段时间放手什么都没管,后来绑定域名时又多做了些修改,最近看到些有意思的功能/插件一并添加了

美化:自定义鼠标样式
1
2
3
4
5
6
7
8
/** 鼠标样式 开始**/
/** 普通指针样式**/
body {
cursor: url(http://cuijiahua.com/xxx/cursor_1.png), default;
}
/** 链接指针样式**/
a:hover{cursor:url(http://cuijiahua.com/xxx/cursor_2.png), pointer;}
/** 鼠标样式 结束**/

方法来自网站美化:鼠标样式自定义 ,图片可以前往来源获取

添加点击爱心效果

添加 yilia/source/js/clicklove.js 文件

1
!function(e,t,a){function n(){c(".heart{width: 10px;height: 10px;position: fixed;background: #f00;transform: rotate(45deg);-webkit-transform: rotate(45deg);-moz-transform: rotate(45deg);}.heart:after,.heart:before{content: '';width: inherit;height: inherit;background: inherit;border-radius: 50%;-webkit-border-radius: 50%;-moz-border-radius: 50%;position: fixed;}.heart:after{top: -5px;}.heart:before{left: -5px;}"),o(),r()}function r(){for(var e=0;e<d.length;e++)d[e].alpha<=0?(t.body.removeChild(d[e].el),d.splice(e,1)):(d[e].y--,d[e].scale+=.004,d[e].alpha-=.013,d[e].el.style.cssText="left:"+d[e].x+"px;top:"+d[e].y+"px;opacity:"+d[e].alpha+";transform:scale("+d[e].scale+","+d[e].scale+") rotate(45deg);background:"+d[e].color+";z-index:99999");requestAnimationFrame(r)}function o(){var t="function"==typeof e.onclick&&e.onclick;e.onclick=function(e){t&&t(),i(e)}}function i(e){var a=t.createElement("div");a.className="heart",d.push({el:a,x:e.clientX-5,y:e.clientY-5,scale:1,alpha:1,color:s()}),t.body.appendChild(a)}function c(e){var a=t.createElement("style");a.type="text/css";try{a.appendChild(t.createTextNode(e))}catch(t){a.styleSheet.cssText=e}t.getElementsByTagName("head")[0].appendChild(a)}function s(){return"rgb("+~~(255*Math.random())+","+~~(255*Math.random())+","+~~(255*Math.random())+")"}var d=[];e.requestAnimationFrame=function(){return e.requestAnimationFrame||e.webkitRequestAnimationFrame||e.mozRequestAnimationFrame||e.oRequestAnimationFrame||e.msRequestAnimationFrame||function(e){setTimeout(e,1e3/60)}}(),n()}(window,document);

在 yilia/layout/layout.ejs 的 body 内添加

1
2
3
<% if ( theme.clicklove ) { %>
<script type="text/javascript" src="/js/clicklove.js"></script>
<% } %>

在yilia主题的_config.yml中控制样式应用

1
2
# 页面点击小红心
clicklove: true

来源Hexo NexT主题添加点击爱心效果

Hexo 添加 PWA

PWA(Progressive Web App,渐进式网页应用),添加起来稍微麻烦点,我这里就不写了,参考下面两篇博客添加,都写得很详细了

Hexo 添加 PWA 支持 | 过客~励む

hexo博客简单支持PWA - SegmentFault 思否

添加更新通知

个人博客(又不是大佬,不可能有人订阅的
image

觉着这个功能不错,就添加了,参考这篇博客

Hexo 博客订阅文章通知功能 | 过客~励む

注:可能提供商的原因?某些Chrome去广告插件会拦截这个,导致推送失效

赏

谢谢你请我吃糖果

微信
  • Hexo

扫一扫,分享到微信

微信分享二维码
自定义文本选择
在应用详情页拉起应用内Activity
  1. 1. 美化:自定义鼠标样式
  2. 2. 添加点击爱心效果
  3. 3. Hexo 添加 PWA
  4. 4. 添加更新通知
留言已关闭
:gddhy
© gddhy
Hexo Theme Yilia by Litten
  • 所有文章
  • 友链

tag:

  • Android
  • 软件分享
  • game
  • Hexo
  • JavaScript
  • 旧机博物馆
  • MIUI
  • Java
  • git
  • Termux
  • mtk
  • 原神
  • Win
  • Html
  • 安卓学习笔记

    缺失模块

  • Luminous' Home
  • 影子博客
  • 四次元领域
  • 初之音
  • Mr.Pumpkin
  • ZhaoQuinn 's Blog