《博客园美化》赏心悦目的写博客

一、页面定制 CSS 代码

.postDesc-img {
            position: absolute;
            padding-bottom: 0;
            float: right;
            right: 0;
            bottom: 0;
            z-index: -1;
        }


.cnblogs-post-body h3 {
    text-decoration: none;
    font-size: 10px;
    line-height: 1px;
}

.cnblogs-post-body h2 {
    color: red;
    font-size: 20px;

}

.day {
    padding: 54px 4% 2% 4%;
    border: 1px solid #ddd;
    border-radius: 2px;
    transition: all 0.35s;
    box-shadow: 2px 2px 1px rgba(135, 139, 144, 0.4);
    margin-bottom: 30px;
    margin-top: 0px;
}

.day:hover {
    transform: scale(1.02);
    box-shadow: 12px 12px 18px rgba(50, 50, 50, 0.4);
}
View Code

 

二、页首 HTML 代码

<script type="text/javascript">
/* 鼠标特效 */
var a_idx = 0;
jQuery(document).ready(function($) {
    $("body").click(function(e) {
        var a = new Array("😘","😊","😍","😁","😉","😊","😂","🤣","😎","😜","😢","🤔","注意休息,爱护眼睛");
        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>

<!--右下角内容-->
<html>
  <head>
    <meta charset="UTF-8" />
    <title>Live2d Test Env</title>
    <meta http-equiv="X-UA-Compatible" content="chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1">
  </head>
  <body>
  <script src="https://cdn.jsdelivr.net/npm/live2d-widget@3.0.4/lib/L2Dwidget.min.js"></script>
  <script type="text/javascript">
    L2Dwidget.init({
      "display": {
        "superSample": 2,
        "width": 200,//宽度
        "height": 400,//高度
        "position": "right",//位置,right,left
        "hOffset": 0,
        "vOffset": 0
      }
   });
  </script>
  </body>
</html>

<!--自定义导航栏-->
<script>
        addNag("随笔","https://www.cnblogs.com/weipt0106/",1);
    addNag("壁纸","http://lcoc.top/bizhi/",2);
    addNag("音乐","http://lcoc.top/666/",3);
    addNag("视频","http://lcoc.top/2.2/",4);
    addNag("知网","https://www.cnki.net/",5);
        addNag("写随笔","https://i.cnblogs.com/posts/edit",6);
    function addNag(linkName,linkHref,linkLocation){
        //获得导航DOM对象
        var _navigator = document.getElementsByTagName("ul")[0];
        //创建导航无序列表中的li
        var _link = document.createElement("li");
        var _a = document.createElement("a");
        _a.class="menu";
        _a.href= linkHref;
        var _text = document.createTextNode(linkName);
        _a.appendChild(_text);
        _link.appendChild(_a);
        //添加至指定的位置
        var _lis = _navigator.getElementsByTagName("li");
        if(linkLocation > _lis.length && linkLocation > 0){
            _navigator.appendChild(_link);
        }else{
            _navigator.insertBefore(_link,_lis[linkLocation-1]);
        }
    }
</script>
View Code

 

三、页脚 HTML 代码 

<!-- 小火箭-->
<script src="https://blog-static.cnblogs.com/files/pythonywy/jQuery1.7.js"></script>
<style type="text/css">
 
    /*回到顶部*/
    #rocket-to-top div {
        left: 0;
        margin: 0;
        overflow: hidden;
        padding: 0;
        position: absolute;
        top: 0;
        width: 149px;
    }
 
    #rocket-to-top .level-2 {
        background: url("https://images.cnblogs.com/cnblogs_com/pythonywy/1455951/o_redhuojian2.png") no-repeat scroll -149px 0 transparent;
        display: none;
        height: 250px;
        opacity: 0;
        z-index: 1;
    }
 
    #rocket-to-top .level-3 {
        background: none repeat scroll 0 0 transparent;
        display: block;
        height: 150px;
        z-index: 2;
    }
 
    #rocket-to-top .level-3:hover {
        cursor: url(https://images.cnblogs.com/cnblogs_com/pythonywy/1516412/o_huo3.png), auto;
    }
 
    #rocket-to-top .level-3:active {
        cursor: url(https://images.cnblogs.com/cnblogs_com/pythonywy/1516412/o_huo1.png), auto;
    }
 
    #rocket-to-top .level-3:focus {
        cursor: url(https://images.cnblogs.com/cnblogs_com/pythonywy/1516412/o_huo2.png), auto;
    }
 
    #rocket-to-top {
        background: url("https://images.cnblogs.com/cnblogs_com/pythonywy/1455951/o_redhuojian2.png") no-repeat scroll 0 0 transparent;
        cursor: default;
        display: block;
        height: 250px;
        margin: -125px 0 0;
        overflow: hidden;
        padding: 0;
        position: fixed;
        left: -40px;
        top: 90%;
        width: 149px;
        z-index: 11;
    }
</style>
<div style="display: none;" id="rocket-to-top">
    <div style="opacity:0;display: block;" class="level-2"></div>
    <div class="level-3"></div>
</div>
<script>
    $(function () {
        var e = $("#rocket-to-top"),
            t = $(document).scrollTop(),
            n,
            r,
            i = !0;
        $(window).scroll(function () {
            var t = $(document).scrollTop();
            t == 0 ? e.css("background-position") == "0px 0px" ? e.fadeOut("slow") : i && (i = !1, $(".level-2").css("opacity", 1), e.delay(100).animate({
                    marginTop: "-1000px"
                },
                "normal",
                function () {
                    e.css({
                        "margin-top": "-125px",
                        display: "none"
                    }),
                        i = !0
                })) : e.fadeIn("slow")
        }),
            e.hover(function () {
                    $(".level-2").stop(!0).animate({
                        opacity: 1
                    })
                },
                function () {
                    $(".level-2").stop(!0).animate({
                        opacity: 0
                    })
                }),
            $(".level-3").click(function () {
                function t() {
                    var t = e.css("background-position");
                    if (e.css("display") == "none" || i == 0) {
                        clearInterval(n),
                            e.css("background-position", "0px 0px");
                        e.css("cursor", "url(https://images.cnblogs.com/cnblogs_com/pythonywy/1516412/o_huo1.png), auto");
                        return
                    }
                    switch (t) {
                        case "0px 0px":
                            e.css("background-position", "-298px 0px");
                            break;
                        case "-298px 0px":
                            e.css("background-position", "-447px 0px");
                            break;
                        case "-447px 0px":
                            e.css("background-position", "-596px 0px");
                            break;
                        case "-596px 0px":
                            e.css("background-position", "-745px 0px");
                            break;
                        case "-745px 0px":
                            e.css("background-position", "-298px 0px");
                    }
                }
                if (!i) return;
                n = setInterval(t, 50),
                    $("html,body").animate({scrollTop: 0}, "slow");
            });
    });
</script>

<script>
  !function(){
  
 function n(n,e,t){
  
 return n.getAttribute(e)||t
  
 }
  
 function e(n){
  
 return document.getElementsByTagName(n)
  
 }
  
 function t(){
  
 var t=e("script"),o=t.length,i=t[o-1];
  
 return{
  
 l:o,z:n(i,"zIndex",-1),o:n(i,"opacity",.5),c:n(i,"color","0,0,0"),n:n(i,"count",99)
  
 }
  
 }
  
 function o(){
  
 a=m.width=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,
  
 c=m.height=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight
  
 }
  
 function i(){
  
 r.clearRect(0,0,a,c);
  
 var n,e,t,o,m,l;
  
 s.forEach(function(i,x){
  
 for(i.x+=i.xa,i.y+=i.ya,i.xa*=i.x>a||i.x<0?-1:1,i.ya*=i.y>c||i.y<0?-1:1,r.fillRect(i.x-.5,i.y-.5,1,1),e=x+1;e<u.length;e++)n=u[e],
  
 null!==n.x&&null!==n.y&&(o=i.x-n.x,m=i.y-n.y,
  
 l=o*o+m*m,l<n.max&&(n===y&&l>=n.max/2&&(i.x-=.03*o,i.y-=.03*m),  
 t=(n.max-l)/n.max,r.beginPath(),r.lineWidth=t/2,r.strokeStyle="rgba("+d.c+","+(t+.2)+")",r.moveTo(i.x,i.y),r.lineTo(n.x,n.y),r.stroke()))
  
 }),
 
 x(i)
  
 }
  
 var a,c,u,m=document.createElement("canvas"),
  
 d=t(),l="c_n"+d.l,r=m.getContext("2d"),
x=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||
  
 function(n){
 
 window.setTimeout(n,1e3/45)  
 },
  
 w=Math.random,y={x:null,y:null,max:2e4};m.id=l,m.style.cssText="position:fixed;top:0;left:0;z-index:"+d.z+";opacity:"+d.o,e("body")[0].appendChild(m),o(),window.onresize=o,
  
 window.onmousemove=function(n){
  
 n=n||window.event,y.x=n.clientX,y.y=n.clientY
  
 },
  
 window.onmouseout=function(){
  
 y.x=null,y.y=null
  
 };
  
 for(var s=[],f=0;d.n>f;f++){
  
 var h=w()*a,g=w()*c,v=2*w()-1,p=2*w()-1;s.push({x:h,y:g,xa:v,ya:p,max:6e3})
  
 }
  
 u=s.concat([y]),
  
 setTimeout(function(){i()},100)
  
 }();
  
 </script>
<link  type="text/css" rel="stylesheet" href="https://blog-static.cnblogs.com/files/zouwangblog/comment.css">
<script type="text/javascript">
$(function(){
    $('#blogTitle h1').addClass('bounceInLeft animated');
    $('#blogTitle h2').addClass('bounceInRight animated');
    // 删除反对按钮    $('.buryit').remove();
    initCommentData();
});
function initCommentData() {
    $('.feedbackItem').each(function() {
        var text = $(this).find('.feedbackListSubtitle .layer').text();
        // 将楼层信息放到data里面
        // $(this).find('.blog_comment_body').attr('data-louceng', text.replace(/^#/g, ''));
        if($(this).find('.feedbackListSubtitle .louzhu').length>0) $(this).addClass('myself');
        var avatar = $(this).find('> .feedbackCon > span').html() || 'http://pic.cnitblog.com/face/sample_face.gif';
        $(this).find('> .feedbackCon > .blog_comment_body').append('<img class="user-avatar" src="'+avatar+'"/>')
    });
}

$(document).ajaxComplete(function(event, xhr, settings) {
  // 监听获取评论ajax事件
  if(settings.url.indexOf('/mvc/blog/GetComments.aspx') >= 0) {
    initCommentData();
  }
});
</script>
View Code

 

四、最终效果图

posted @ 2020-07-07 23:44  垚森  阅读(173)  评论(0编辑  收藏  举报