簡單粗暴直接複製吧,想改能夠打開文件本身看看javascript
<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>
也是直接複製進去就行了css
<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("brush: " + lang +";"); //根據語言添加筆刷 SyntaxHighlighter.all(); }) } }, setAtarget: function() { // 博客內的連接在新窗口打開 $("#cnblogs_post_body a").each(function(){ this.target = "_blank"; }) }, setContent: function() { // 根據h二、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>