博客常用的一些js代码
js 代码
// 加了下面的代码,博客会禁止复制(代码还可以复制) <script type="text/javascript">
document.body.onselectstart = document.body.ondrag = function(){return false;}
</script>
// 悬挂的喵
<script type="text/javascript" src="https://files.cnblogs.com/files/liyhbk/GoToTop.js" defer></script> <link rel="stylesheet" type="text/css" href="https://blog-static.cnblogs.com/files/liyhbk/szgotop.css" /> <div class="back-to-top cd-top faa-float animated cd-is-visible" style="top: -999px;"></div>
<!-- 右上角Git链接(页面定制css和页首html都要配置) -->
<a class="git-link-right" href="https://gitee.com/liyhGitee" target="blank"></a>
<!-- 回到页面顶部小飞机(跟上面的代码二选一) -->
<script>
function func(){
var tag = document.getElementById('i1');
var content = tag.innerText;
var f = content.charAt(0);
var l = content.substring(1,content.length);
var new_content = l + f;
tag.innerText = new_content;
}
setInterval('func()',1600);
</script>
<style>
#back-top {
position: fixed;
bottom: 10px;
right: 5px;
z-index: 99;
}
#back-top span {
width: 50px;
height: 64px;
display: block;
background:url(https://files.cnblogs.com/files/liyhbk/GoToTop.bmp) no-repeat center center;
}
#back-top a{outline:none}
</style>
<script type="text/javascript">
$(function() {
// hide #back-top first
$("#back-top").hide();
// fade in #back-top
$(window).scroll(function() {
if ($(this).scrollTop() > 10) {
$('#back-top').fadeIn();
} else {
$('#back-top').fadeOut();
}
});
// scroll body to 0px on click
$('#back-top a').click(function() {
$('body,html').animate({
scrollTop: 0
}, 800);
return false;
});
});
</script>
<p id="back-top" style="display:none"><a href="#top"><span></span></a></p>
<!-- 左上角Git链接(页面定制css和页首html都要配置) -->
<a class="git-link-left" href="https://gitee.com/liyhGitee" target="blank"></a>
<!-- 添加博客顶部信息-->
<p style="text-align: center;font-size:35px;margin-bottom:5px;margin-top:20px;opacity: 0.5">每一年都奔走在自己热爱里</p>
<!-- 添加顶部滚动信息--> <div id="Scroll_info" style="text-align: center;font-size:13px;padding:5px;opacity: 0.5">没有人是一座孤岛,总有谁爱着你</div>
<!-- 线条背景动画 --> <!-- color: 线条颜色,默认:‘0,0,0’;三个数字分别为(R,G,B),注意使用,分割 opacity: 线条透明度0~1,默认0.5 count: 线条总数量,默认99 z-Index: 背景的z-Index属性, css用于控制所在层的位置,默认-1 (1置顶显示)--> <script src="https://blog-static.cnblogs.com/files/liyhbk/js.js" color="255,112,12" opacity="1" count="299" zindex="-1"></script>
<!-- 鼠标点击爱心特效 -->
<script type="text/javascript">
var a_idx = 0;
jQuery(document).ready(function($) {
$("body").click(function(e) {
var a = new Array("❤不做咸鱼!❤","❤拒绝懒惰!❤","❤想做吃货❤","❤向大佬学习❤","❤扶我起来~❤","❤come on❤","❤一直在路上~❤","❤累了~❤","❤再趴一会❤","❤66666❤","❤高兴的飞起*****❤");
var $i = $("<span></span>").text(a[a_idx]);
a_idx = (a_idx + 1) % a.length;
var x = e.pageX,
y = e.pageY;
$i.css({
"z-index": 999999999999999999999999999999999999999999999999999999999999999999999,
"top": y - 20,
"left": x,
"position": "absolute",
"font-weight": "bold",
"color": "rgb("+~~(255*Math.random())+","+~~(255*Math.random())+","+~~(255*Math.random())+")"
});
$("body").append($i);
$i.animate({
"top": y - 180,
"opacity": 0
},
1500,
function() {
$i.remove();
});
});
});
</script>
<!-- 鼠标点击火花特效 -->
<script src="https://blog-static.cnblogs.com/files/liyhbk/mouse-click.js"></script>
<div width="1777" height="841" style="position: fixed; left: 0px; top: 0px; z-index: 2147483647; pointer-events: none;"></div>
<!-- 左下角人物 -->
<script src="https://blog-static.cnblogs.com/files/liyhbk/L2Dwidget.min.js"></script>
<!-- 不同链接显示的是不同的小人,这个可以根据需要来选择 下边的初始化部分,可以修改宽高来修改小人的大小,或者是鼠标移动到小人上的透明度,也可以修改小人在页面出现的位置。 -->
<!--
其他可选的模型:
黑猫:https://unpkg.com/live2d-widget-model-hijiki@1.0.5/assets/hijiki.model.json
萌娘:https://unpkg.com/live2d-widget-model-shizuku@1.0.5/assets/shizuku.model.json
白猫:https://unpkg.com/live2d-widget-model-tororo@1.0.5/assets/tororo.model.json
狗狗:https://unpkg.com/live2d-widget-model-wanko@1.0.5/assets/wanko.model.json
小可爱:https://unpkg.com/live2d-widget-model-z16@1.0.5/assets/z16.model.json
小可爱(男):https://unpkg.com/live2d-widget-model-haruto@1.0.5/assets/haruto.model.json
小可爱(女):https://unpkg.com/live2d-widget-model-koharu@1.0.5/assets/koharu.model.json
小帅哥: https://unpkg.com/live2d-widget-model-chitose@1.0.5/assets/chitose.model.json
-->
<script>
L2Dwidget.init({
"model": { jsonPath : "https://unpkg.com/live2d-widget-model-wanko@1.0.5/assets/wanko.model.json","scale": 1 },
"display": { "position": "left", "width": 85, "height": 180, "hOffset": 0, "vOffset": -20 },
"mobile": { "show": true, "scale": 0.5 },
"react": { "opacityDefault": 0.8, "opacityOnHover": 0.1 }
});
</script>
<!-- 支付宝/微信赞赏/打赏 -->
<script type="text/javascript" src="https://blog-static.cnblogs.com/files/liyhbk/tctip-1.0.3.min.js"></script>
<script>
new tctip({
top: '20%',
button: {
id: 1,
type: 'zanzhu',
},
list: [
// {
// type: 'alipay',
// qrImg: 'https://files.cnblogs.com/files/liyhbk/zhifubao.bmp' //替换成自己的支付宝付款码
// },
{
type: 'wechat',
qrImg: 'https://files.cnblogs.com/files/liyhbk/weixin.bmp' //替换成自己的微信付款码
}
]
}).init()
</script>
<!-- 网易云音乐 -->
<link rel="stylesheet" href="https://blog-static.cnblogs.com/files/liyhbk/APlayer.min.css">
<script src="https://blog-static.cnblogs.com/files/liyhbk/APlayer.min.js"></script>
<div id="aplayer" class="aplayer" data-id="865331941" data-server="netease" data-type="playlist" data-fixed="true" data-listfolded="true" data-order="random" data-theme="#F58EA8"></div>
<script src="https://blog-static.cnblogs.com/files/liyhbk/Meting.min.js"></script>
<!-- 天上飘雪花,css和页脚都要配置 -->
<div class="Snow">
<div id="Snow"></div>
</div>
<script src="https://blog-static.cnblogs.com/files/liyhbk/xue.js"></script>
<!-- 评论区带头像且支持旋转,css和页脚都要配置 -->
<script type="text/javascript" src="https://files.cnblogs.com/files/liyhbk/Comments.js"></script>
<!-- 去除cnblog博客最下面的广告 -->
<style>
#cnblogs_c1,
#cnblogs_c2,
#ad_t2,
#opt_under_post
{
display: none !important;
}
.itnews,
.c_ad_block
{
display: none !important;
}
</style>
<!-- 炫酷的鼠标特效 -->
<script src="https://blog-static.cnblogs.com/files/liyhbk/mouse.min.js"></script>
<script type="text/javascript">
$.shuicheMouse({
// 鼠标类型, 赋值 1 ~ 12 任意一个数字, 分别代表12种类型
type : 12,
// 特效颜色, 如果赋值 false (这里的 false 是 布尔类型), 则会随机一种颜色. string 支持类型(css颜色赋值类型都支持)
// "#ffffff" 类型
// rgb(255,255,255)
// rgba(255,255,255, 0.8)
color:"rgba(187,67,128,1)"
})
</script>
<!-- 底部小鱼 start -->
<style>
.container {
width: 100%;
height: 146px;
position: fixed;
z-index: 1;
opacity: 0.37;
bottom: 0;
left: 0;
}
</style>
<div id="jsi-flying-fish-container" class="container"></div>
<script src='https://blog-static.cnblogs.com/files/liyhbk/fish.js'></script>
<style>
@media only screen and (max-width: 767px){
#sidebar_search_box input[type=text]{width:calc(100% - 24px)}
}
</style>
<!-- 小鱼 end -->
版权声明:
作者:超级管理员
链接:
https://apecloud.ltd/article/detail.html?id=140
来源:猿码云个人技术站
文章版权归作者所有,未经允许请勿转载。
共有0条评论