zoukankan      html  css  js  c++  java
  • 博客园新样式

    页首Html代码

    简单粗暴直接复制吧,想改可以打开文件自己看看

    <script src="http://cdn.bootcss.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
    
    <link href="https://files.cnblogs.com/files/wudongwei/markdown.css" rel="stylesheet">
    
    
    
    <link href="https://files.cnblogs.com/files/wudongwei/bigmulu.css" rel="stylesheet">
    <script type="text/javascript" src="https://files.cnblogs.com/files/wudongwei/mulu.js"></script>
    

    页脚Html代码

    也是直接复制进去就好了

    <script type="text/javascript">  
        var setMyBlog = {
            setCopyright: function() {
                //设置版权信息,转载出处自动根据页面url生成
                var info_str = '<p>作者:<a target="_blank">@乌冬味</a><br>'+
                    '本文为作者原创,转载请注明出处:<a class="uri"></a></p><hr></hr>', 
                    info = $(info_str),
                    info_a = info.find("a"),
                    url = window.location.href;
                $(info_a[0]).attr("href","https://github.com/xdwkeep");
                $(info_a[1]).attr("href",url).text(url);
                $("#cnblogs_post_body").prepend(info);
            },
            setCodeRow: function(){
                // 代码行号显示
                var pre = $("pre.sourceCode"); //选中需要更改的部分
                if(pre && pre.length){
                    pre.each(function() {
                        var item = $(this);
                        var lang = item.attr("class").split(" ")[1]; //判断高亮的语言
                        item.html(item.html().replace(/<[^>]+>/g,"")); //将<pre>标签中的html标签去掉
                        item.removeClass().addClass(" " + lang +";"); //根据语言添加笔刷
                        SyntaxHighlighter.all();
                    })
                }
            },
            setAtarget: function() {
                // 博客内的链接在新窗口打开
                $("#cnblogs_post_body a").each(function(){
                    this.target = "_blank";
                }) 
            },
            setContent: function() {
                // 根据h2、h3标签自动生成目录
                var captions_ori = $("#cnblogs_post_body h2"),
                    captions = $("#cnblogs_post_body h2,#cnblogs_post_body h3").clone(),
                    content = $("<blockquote><h4>目录</h4></blockquote>");
                $("#cnblogs_post_body").prepend(content.append(captions));
                var index = -1;
                captions.replaceWith(function(){
                    var self = this;
                    if(self.tagName == "H2" || self.tagName == "h2"){
                        // 设置点击目录跳转
                        index += 1;
                        $('<a name="' + '_caption_' + index + '"></a>').insertBefore(captions_ori[index]); 
                        return '<a href="#_caption_' + index + '"><strong>' + self.innerHTML + '</strong></a><br>';
                    } else {
                        return self.innerHTML + "<br>";
                    }
                });
            },
            runAll: function() {
                /* 运行所有方法
                 * setAtarget() 博客园内标签新窗口打开
                 * setContent() 设置目录
                 * setCopyright() 设置版权信息
                 * setCodeRow() 代码行号显示
                 */ 
                //this.setAtarget(); 
                //this.setContent();
                this.setCopyright();
                this.setCodeRow();
            }
        }
        setMyBlog.runAll();
    </script>
    
  • 相关阅读:
    POJ Problem 2631 Roads in the North【树的直径】
    POJ Problem 1985 Cow Marathon 【树的直径】
    Light OJ 1049 Farthest Nodes in a Tree【树的直径】
    HDU Problem 4707 Pet【并查集】
    HDU Problem 1325 Is It A Tree?【并查集】
    HDU Problem 5631 Rikka with Graph【并查集】
    HDU Problem 5326 Work 【并查集】
    文件比较软件修改比较文件时间戳方法
    什么是Oracle 数据泵
    文件对比工具文件上传 FTP如何匹配本地文件
  • 原文地址:https://www.cnblogs.com/wudongwei/p/9153365.html
Copyright © 2011-2022 走看看