博客设置

 

 

博文中标变为目录

<script language="javascript" type="text/javascript">
//生成目录索引列表
function GenerateContentList()
{
    var jquery_h3_list = $('#cnblogs_post_body h3');//如果你的章节标题不是h3,只需要将这里的h3换掉即可
    if(jquery_h3_list.length>0)
    {
        var content = '<a name="_labelTop"></a>';
        content    += '<div id="navCategory">';
        content    += '<p style="font-size:18px"><b>阅读目录</b></p>';
        content    += '<ul>';
        for(var i =0;i<jquery_h3_list.length;i++)
        {
            var go_to_top = '<div style="text-align: right"><a href="#_labelTop">回到顶部</a><a name="_label' + i + '"></a></div>';
            $(jquery_h3_list[i]).before(go_to_top);
            var li_content = '<li><a href="#_label' + i + '">' + $(jquery_h3_list[i]).text() + '</a></li>';
            content += li_content;
        }
        content    += '</ul>';
        content    += '</div>';
        if($('#cnblogs_post_body').length != 0 )
        {
            $($('#cnblogs_post_body')[0]).prepend(content);
        }
    }    
}
GenerateContentList();
</script>
生成目录索引列表

 

自定义博客

页面定制CSS代码

/*添加按钮,copy*/
.cnblogs-markdown pre {
  position: relative;
}
.cnblogs-markdown pre > span {
  position: absolute;
  top: 0;
  right: 0;
  border-radius: 2px;
  padding: 0 10px;
  font-size: 12px;
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  cursor: pointer;
}
.cnblogs-markdown pre > .copyed {
  background: #67c23a;
}




/*markdown > */
#cnblogs_post_body blockquote {
border: none;
border-left: 10px solid #E6E6E6;                /*左边大小和颜色*/
margin-left: 20px;
padding-left: 10px;               /* 左边文字距离*/
padding-right: 163px;  
}



#top {
    background-color: #bdc3c7;
        height:50px;
    vertical-align: middle;
    color: #ccc;
    padding-left: 10px;
}


#sub {
    background-color: #ddd;
    color: #ccc;
}



/*去掉推送*/
#ad_t2{/*广告*/
  display: none;/*设置框架不显示*/
  overflow: hidden;/*框架超出部分隐藏*//*下同*/
}
#cnblogs_c1{/*空白块1*/
  display: none;
  overflow: hidden;
}
#cnblogs_c2{/*空白块2*/
  display: none;
  overflow: hidden;
}
#under_post_news{/*相关博文*/
  display: none;
  overflow: hidden;
}
#under_post_kb{/*最新新闻*/
  display: none;
  overflow: hidden;
}

/*删除div*/
#green_channel{/*好文要顶*/
  display: none;/*设置框架不显示*/
  overflow: hidden;/*框架超出部分隐藏*//*下同*/
}
#author_profile{/*作者信息*/
  display: none;/*设置框架不显示*/
  overflow: hidden;/*框架超出部分隐藏*//*下同*/
}



#MySignature {
    display: none;
    background-color: #cacfd2;
    border-radius: 10px;
    box-shadow: 1px 1px 1px #6B6B6B;
    padding: 10px;
    line-height: 1.5;
    text-shadow: 1px 1px 1px #FFF;
    font-size: 16px;
    font-family: 'Microsoft Yahei';
}




/* 定制公告栏文字信息 */
.gonggao{
    text-align: center;
    font-size:17px;
    color:blue;
}
.wenzi{
    text-align: center;
    font-size:15px;
}


/* 定制博客背景图片,url里面是你的图片位置信息 */
body { 
     /*background-color: #efefef;*/
     background-image:url(https://tuchuang001.com/images/2017/06/16/ie-die1.jpg);
    background-repeat: no-repeat; 
     background-attachment: fixed; 
     background-position: center 0; 
     background-size: cover; 
    padding-top:0px;
 opacity:0.9;
  }



/* 定制推荐和反对按键 */
#div_digg{
  position:fixed;
  bottom:-10px;
  width:120px;
  right:20px;
  box-shadow: 0 0 6px #0000FF;
  border:2px solid #FF0000;
  padding:4px;
  background-color:#fff;
  border-radius:4px 4px 4px 4px !important;
}

.icon_favorite {
    background: transparent url('http://images.cnblogs.com/cnblogs_com/shwee/1218109/o_kj.gif') no-repeat 0 0;
    padding-left: 15px;
}

#blog_post_info_block a {
    text-decoration: none;
    color: #5B9DCA;
    padding: 3px;
}


/*评论栏*/
.commentform .comment_textarea {
    width: 100%!important;
    height: 200px!important;
    border: 1px solid #eef2f8;
    border-radius: 6px;
    padding: 5px;
    font-family: inherit;
    font-size: 15px;
    resize: none;
    box-sizing: border-box;
    background-color: transparent;
    color: #314659;
}
div.commentform textarea.comment_textarea {
    line-height: 1.6;
}
.commentform .comment_textarea:hover {
    border-color: #2D8CF0;
}
页面定制CSS代码

 

博客侧边栏公告

<script type="text/javascript">
        $(document).ready(function () {
            var pres = $("pre");
            for (var i = 0; i < pres.length; i++) {
                $(pres[i]).attr('id', 'pre' + i);
                //这里注释掉
                //$(pres[i]).children('code').hide();
                //这里原来是view code,改为hide code
                $(pres[i]).prepend('<button id="btn'+ i +'" onclick="view_code(\'pre'+ i +'\');">hide code</button>');
            }
        });
        function view_code (id) {
            var btn_text =  document.getElementById(id).children[0].innerText;
            var style;
            var status;
            if(btn_text == 'view code') {
                style = '""';
                status = 'hide code';
            } else {
                style = 'display: none;';
                status = 'view code';
            }
            document.getElementById(id).children[0].innerText = status;
            document.getElementById(id).children[1].style = style;
        }
</script>
博客侧边栏公告

 

posted @ 2020-10-28 01:43  doitjust  阅读(103)  评论(0编辑  收藏  举报