【博客园主题美化】《 那些年换过的主题 - 01 》

主题展示

重点

博客园一定要申请JS权限!

这个美化使用的主题是 SimpleMemory 不禁用 主题本身的默认Css!!!

基础主题设置如下:

博客侧边栏公告

代码

<!-- 头像 -->
<div class="av">
<img class="but" itemprop="image" src="https://images.cnblogs.com/cnblogs_com/lingr7/1566573/o_20010106335437898999.jpg" 
 style="cursor:pointer" width= "100%" alt="lingr7" >
</div>
<div class="cont">
我的个人域名(转发至博客园):<a href="lingr7.site" >lingr7.site</a>
<br>
我的领英页面: <a href="https://www.linkedin.com/in/lingr7/" >https://www.linkedin.com/in/lingr7/</a>
<br /> 
<a href="https://www.yuque.com/lingr7/blog" title="语雀"  target="_blank">
     <img id="yuque_icon" src="https://images.cnblogs.com/cnblogs_com/lingr7/1566573/o_200726114019o_191125030713yuque.png" alt="" style="border: 0pt none;" width = 30 height=30></a>
 <a href="https://github.com/lingr7" title="Github"  target="_blank">
 <img id="github_icon" src="https://images.cnblogs.com/cnblogs_com/lingr7/1566573/o_github.png" alt="" style="border: 0pt none;" width = 30 height=30> </a>
 <a href="mailto:lingr7@qq.com" title="邮箱"  target="_blank">
     <img id="mail_icon" src="https://images.cnblogs.com/cnblogs_com/lingr7/1566573/o_gmail.png" alt="" style="border: 0pt none;" width = 30 height=30></a>
 <a href="https://weibo.com/lingr7/" title="微博"  target="_blank">
     <img id="weibo_icon" src="https://images.cnblogs.com/cnblogs_com/lingr7/1566573/o_weibo.png" alt="" style="border: 0pt none;" width = 30 height=30></a>
 <a href="http://wpa.qq.com/msgrd?v=3&uin=1694892905&site=qq&menu=yes" title="QQ对话"  target="_blank">
     <img id="qq_icon" src="https://images.cnblogs.com/cnblogs_com/lingr7/1566573/o_qq.png" alt="" style="border: 0pt none;" width = 30 height=30> </a>
 <a href="https://www.cnblogs.com/lingr7/rss" title="订阅Feed"  target="_blank">
     <img id="feed_icon" src="https://images.cnblogs.com/cnblogs_com/lingr7/1566573/o_rss%20(2).png" alt="" style="border: 0pt none;" width = 30 height=30></a>
</div>
<!-- 头像 -->


<!--随笔发布信息-->
<script>
if ($("#topics")!=null){
$("#cnblogs_post_body").before("<p class='publishinfo'><img src='https://img.shields.io/badge/Post-"+$("#post-date").text().replace(/\-/g,"--").replace(/\ /g,"%20").replace(/\:/g,"%3A")+"-blue'/>"+

"<img src='https://img.shields.io/badge/Read-" + $("#post_view_count").text() + "-red'/>" +

"<img src='https://img.shields.io/badge/Comment-" + $("#post_comment_count").text() + "-green'/><br/>" +
"</p>")
}
</script>

页面定制Css代码

代码

#google_ad_c1, #google_ad_c2 {display:none;}
.syntaxhighlighter a, .syntaxhighlighter div, .syntaxhighlighter code, .syntaxhighlighter table, .syntaxhighlighter table td, .syntaxhighlighter table tr, .syntaxhighlighter             table tbody, .syntaxhighlighter table thead, .syntaxhighlighter table caption, .syntaxhighlighter textarea {
font-size:12px!important;
}
#post_next_prev{
padding-top:10px;
}
/*主体放右侧,侧边栏放左侧*/
#mainContent{
float : right
}
#sideBar{
float : left
}
/*评论输入框的宽度*/
#comment_form_container > div.commentbox_main.comment_textarea{
width :100%
}
#green_channel{
display: none;
}

#author_profile{
display: none;
}
#topics > div > div.postBody > p{
text-indent: 0em;
}
#footer{
margin-top:20px;
}

#site_nav_under {
    display: none;
}
/*去除广告 自定义去除博客园底部的广告和链接推荐 - 赵磊de博客 - 博客园  https://www.cnblogs.com/zzhaolei/p/11063469.html*/
.c_ad_block, .ad_text_commentbox {
    display: none;
    margin: 0;
    padding: 0;
}
#ad_under_google {
    height: 0;
    overflow: hidden;
}
#ad_under_google a {
    display: none;
}
#ad_t2{
display:none;
}
#cnblogs_c1,#under_post_news,#cnblogs_c2,#under_post_kb {display:none;!important}

#sideBar{
font-size:12px;
}
#sideBar h3, #MyIng .ing_title{
margin:16px 0 10px -6px;
font-size:22px;
font-weight:normal;
}
#blog_stats{
line-height:60px;
}
#navList li{
font-size:13pt;
}
#home {
opacity: 0.80;
margin: 0 auto;
width: 85%;
min-width: 950px;
background-color: #fff;
padding: 30px;
margin-top: 30px;
margin-bottom: 50px;
box-shadow: 0 2px 6px rgba(100, 100, 100, 0.3);
}
#blogTitle h1 {
font-size: 30px;
font-weight: bold;
font-family: "Comic Sans MS";
line-height: 1.5em;
margin-top: 20px;
color: #515151;
}
#navList a:hover {
color: #4C9ED9;
text-decoration: none;
}
#navList a {
display: block;
width: 5em;
height: 22px;
float: left;
text-align: center;
padding-top: 18px;
}
#navigator {
font-size: 14px;
height: 60px;
clear: both;
margin-top: 25px;
line-height:30px;
}
.catListTitle {
margin-top: 21px;
margin-bottom: 10.5px;
text-align: left;
border-left: 10px solid rgba(131, 179, 117, 0.8);
padding: 8px 0 8px 10px;
background-color: #f5f5f5;
}
#ad_under_post_holder #google_ad_c1,#google_ad_c2{  
display: none !important;
}
/*可以设置背景图片 免费美图下载Beautiful Free Images & Pictures | Unsplash  https://unsplash.com/*/
/*藤萝紫 http://zhongguose.com/#tengluozi  */

body {
color: #000;
background-color: #8076a3;
background-size: cover;
background-repeat: no-repeat;
font-family: "Helvetica Neue",Helvetica,Verdana,Arial,sans-serif;
font-size: 14px;
min-height: 101%;
line-height:1.7;
}
.postTitle, .entrylistPosttitle, .feedback_area_title{
font-size:18px;
}
#topics .postTitle {
border: 0px;
font-size: 200%;
font-weight: bold;
float: left;
line-height: 1.5;
width: 100%;
padding-left: 5px;
}



.feedbackItem {
font-size:14px;
line-height:24px;
margin:10px 10px;
padding:20px;
background:#F2F2F2;
box-shadow:0 0 5px #aaa;
}
.feedbackListSubtitle {
font-weight:normal;
}
.feedback_area_title {
margin-bottom: 15px;
font-size: 1.8em;
}
.feedbackItem {
border-bottom: 1px solid #CCC;
margin-bottom: 10px;
padding: 5px;
background: rgb(248, 248, 248);
}
.color_shine {background: rgb(226, 242, 255);}
.feedbackItem:hover {-webkit-animation-name: color_shine;-webkit-animation-duration: 2s;-webkit-animation-iteration-count: infinite;}
#comment_form .title {
font-weight: normal;
margin-bottom: 15px;
}





#uprightsideBar{
    font-size:12px;
    font-family:Arial, Helvetica, sans-serif;
    text-align:left;
    position:fixed;
    top:50px;
    right:0px;
    width: auto;
    height: auto; 
}
#sideBarTab{
    float:left;
    width:30px; 
    border:1px solid #e5e5e5;
    border-right:none;
    text-align:center;
    background:#ffffff;
}

#sideBarContents{
    float:left;
    overflow:auto; 
    overflow-x:hidden;!important;
    width:200px;
    min-height:108px;
    max-height:460px;
    border:1px solid #e5e5e5;
    border-right:none; 
    background:#ffffff;
}
#sideBarContents dl{
    margin:0;
    padding:0;
}

#sideBarContents dt{
    margin-top:5px;
    margin-left:5px;
}

#sideBarContents dd, dt {
    cursor: pointer;
}

#sideBarContents dd:hover, dt:hover {
    color:#A7995A;
}
#sideBarContents dd{
    margin-left:20px;
}

/*对点赞按钮美化*/
#div_digg{
  padding: 5px;
  border-radius: 5px;
  position: fixed;
  right: 100px;
  bottom: 80px;
  width:80px;
  z-index:100;
}
.diggit {
    background: url(https://www.cnblogs.com/images/cnblogs_com/tanshaoshenghao/1426602/o_tempZan.png) no-repeat;
    width: 60px;
    height: 60px;
    -webkit-transition: all 0.6s ease-out;
    -moz-transition: all 0.5s ease-out;
    -ms-transition: all 0.5s ease-out;
    -o-transition: all 0.5s ease-out;
    transition: all 0.5s ease-out;
}

.diggit:hover {
    transform: rotate(360deg);
    -moz-transform: rotate(360deg);
    -webkit-transform: rotate(360deg);
    -o-transform: rotate(360deg);
}

#div_digg .diggnum{
  position: absolute;
  bottom: -20px;
  left: 6px;
  background: #D0D0D0;
  padding: 2px 0;
  display: block;
  color: #555;
  font-size: 12px;
  text-align: center;
  width: 60px;
  -moz-border-radius: 4px;
  -webkit-border-radius: 4px;
  font-weight: bold;
}
/* 删除反对按钮,有点邪恶了 */
.buryit{
  display: none;
}

页首HTML代码

代码




<!-- 音乐播放器 -->

<link href="https://cdn.bootcdn.net/ajax/libs/aplayer/1.10.1/APlayer.min.css" rel="stylesheet">
<div id="aplayer" class="aplayer"  data-id="162116100" data-server="netease" data-type="playlist" data-fixed="true" data-listfolded="true" data-order="random" data-theme="#2D8CF0"></div>
<!-- 音乐播放器end data-id="162116100" data-server="netease" 指的是网易云的歌单id,可以按照网易云的歌单播放-->


<link href="http://files.cnblogs.com/files/lingr7/cnblog-scroller.css" type="text/css" rel="stylesheet">
 <script src="http://files.cnblogs.com/files/lingr7/scrollspy.js" type="text/javascript"></script>
 <script src="http://files.cnblogs.com/files/lingr7/stickUp.min.js" type="text/javascript"></script>
<script src="http://files.cnblogs.com/files/lingr7/cnblog-scroller.js" type="text/javascript"></script>

<style>
#back-top {
     position: fixed;
     bottom: 10px;
     right: 5px;
     z-index: 99;
}
#back-top span {
     width: 50px;
     height: 64px;
     display: block;
     background:url(http://images.cnblogs.com/cnblogs_com/seanshao/855033/o_rocket.png) 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() > 500) {
            $('#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>

页脚HTML代码

代码

<script src="https://blog-static.cnblogs.com/files/lingr7/APlayer.min.js"></script>
<script src="https://blog-static.cnblogs.com/files/lingr7/Meting.min.js"></script>
<!-- <script src="https://blog-static.cnblogs.com/files/lingr7/zoom.js"></script> -->



<script type="text/javascript" language="javascript">
  //Setting ico for cnblogs
  var linkObject = document.createElement('link');
  linkObject.rel = "shortcut icon";
  linkObject.href = "https://files-cdn.cnblogs.com/files/lingr7/favicon.ico";
  document.getElementsByTagName("head")[0].appendChild(linkObject);
</script>
<script type="text/javascript">

var BlogDirectory = {
    
    getElementPosition:function (ele) {        
        var topPosition = 0;
        var leftPosition = 0;
        while (ele){              
            topPosition += ele.offsetTop;
            leftPosition += ele.offsetLeft;        
            ele = ele.offsetParent;     
        }  
        return {top:topPosition, left:leftPosition}; 
    },

    
    getScrollBarPosition:function () {
        var scrollBarPosition = document.body.scrollTop || document.documentElement.scrollTop;
        return  scrollBarPosition;
    },
    
    
    moveScrollBar:function(finalpos, interval) {

        //若不支持此方法,则退出
        if(!window.scrollTo) {
            return false;
        }

        //窗体滚动时,禁用鼠标滚轮
        window.onmousewheel = function(){
            return false;
        };
          
        //清除计时
        if (document.body.movement) { 
            clearTimeout(document.body.movement); 
        } 

        var currentpos =BlogDirectory.getScrollBarPosition();//获取滚动条当前位置

        var dist = 0; 
        if (currentpos == finalpos) {//到达预定位置,则解禁鼠标滚轮,并退出
            window.onmousewheel = function(){
                return true;
            }
            return true; 
        } 
        if (currentpos < finalpos) {//未到达,则计算下一步所要移动的距离
            dist = Math.ceil((finalpos - currentpos)/10); 
            currentpos += dist; 
        } 
        if (currentpos > finalpos) { 
            dist = Math.ceil((currentpos - finalpos)/10); 
            currentpos -= dist; 
        }
        
        var scrTop = BlogDirectory.getScrollBarPosition();//获取滚动条当前位置
        window.scrollTo(0, currentpos);//移动窗口
        if(BlogDirectory.getScrollBarPosition() == scrTop)//若已到底部,则解禁鼠标滚轮,并退出
        {
            window.onmousewheel = function(){
                return true;
            }
            return true;
        }
        
        //进行下一步移动
        var repeat = "BlogDirectory.moveScrollBar(" + finalpos + "," + interval + ")"; 
        document.body.movement = setTimeout(repeat, interval); 
    },
    
    htmlDecode:function (text){
        var temp = document.createElement("div");
        temp.innerHTML = text;
        var output = temp.innerText || temp.textContent;
        temp = null;
        return output;
    },

    
    createBlogDirectory:function (id, mt, st, interval){
         //获取博文正文div容器
        var elem = document.getElementById(id);
        if(!elem) return false;
        //获取div中所有元素结点
        var nodes = elem.getElementsByTagName("*");
        //创建博客目录的div容器
        var divSideBar = document.createElement('DIV');
        divSideBar.className = 'uprightsideBar';
        divSideBar.setAttribute('id', 'uprightsideBar');
        var divSideBarTab = document.createElement('DIV');
        divSideBarTab.setAttribute('id', 'sideBarTab');
        divSideBar.appendChild(divSideBarTab);
        var h2 = document.createElement('H2');
        divSideBarTab.appendChild(h2);
        var txt = document.createTextNode('目录导航');
        h2.appendChild(txt);
        var divSideBarContents = document.createElement('DIV');
        divSideBarContents.style.display = 'none';
        divSideBarContents.setAttribute('id', 'sideBarContents');
        divSideBar.appendChild(divSideBarContents);
        //创建自定义列表
        var dlist = document.createElement("dl");
        divSideBarContents.appendChild(dlist);
        var num = 0;//统计找到的mt和st
        mt = mt.toUpperCase();//转化成大写
        st = st.toUpperCase();//转化成大写
        //遍历所有元素结点
        for(var i=0; i<nodes.length; i++)
        {
            if(nodes[i].nodeName == mt|| nodes[i].nodeName == st)    
            {
                //获取标题文本
                var nodetext = nodes[i].innerHTML.replace(/<\/?[^>]+>/g,"");//innerHTML里面的内容可能有HTML标签,所以用正则表达式去除HTML的标签
                nodetext = nodetext.replace(/ /ig, "");//替换掉所有的 
                nodetext = BlogDirectory.htmlDecode(nodetext);
                //插入锚        
                nodes[i].setAttribute("id", "blogTitle" + num);
                var item;
                switch(nodes[i].nodeName)
                {
                    case mt:    //若为主标题 
                        item = document.createElement("dt");
                        break;
                    case st:    //若为子标题
                        item = document.createElement("dd");
                        break;
                }
                
                //创建锚链接
                var itemtext = document.createTextNode(nodetext);
                item.appendChild(itemtext);
                item.setAttribute("name", num);
                item.onclick = function(){        //添加鼠标点击触发函数
                    var pos = BlogDirectory.getElementPosition(document.getElementById("blogTitle" + this.getAttribute("name")));
                    if(!BlogDirectory.moveScrollBar(pos.top, interval)) return false;
                };            
                
                //将自定义表项加入自定义列表中
                dlist.appendChild(item);
                num++;
            }
        }
        
        if(num == 0) return false; 
        
        divSideBarTab.onmouseenter = function(){
            divSideBarContents.style.display = 'block';
        }
        
        divSideBar.onmouseleave = function() {
            divSideBarContents.style.display = 'none';
        }

        document.body.appendChild(divSideBar);
    }
    
};

window.onload=function(){
    
    BlogDirectory.createBlogDirectory("cnblogs_post_body","h2","h3",20);
}
</script>

<script type="text/javascript">
$(function(){
    $('#blogTitle h1').addClass('bounceInLeft animated');
    $('#blogTitle h2').addClass('bounceInRight animated');
    // 删除反对按钮
    $('.buryit').remove();
    initCommentData();
});
</script>

 

文章转载至:https://www.yuque.com/lingr7/blog/lps5nr

posted @ 2024-01-16 12:50  芋白  阅读(43)  评论(0)    收藏  举报