tornado - cookie與認證相關
阿新 • • 發佈:2020-08-27
CNBlog美化日記
目錄
Markdown
修改Markdown文字風格
參考:
https://www.cnblogs.com/nowgood/p/3bokejiemain.html#_nav_7
https://www.cnblogs.com/liuxianan/p/custom-cnblogs-highlight-theme.html
.cnblogs-markdown .hljs
。我這裡使用Shades-of-Purple,注意的是如果無法顯示背景顏色,給background最高優先順序即可
示例程式碼:
/** * Shades of Purple Theme — for Highlightjs. * * @author (c) Ahmad Awais <https://twitter.com/mrahmadawais/> * @link GitHub Repo → https://github.com/ahmadawais/Shades-of-Purple-HighlightJS * @version 1.5.0 */ pre { /*控制程式碼不換行*/ white-space: pre; word-wrap: normal; } .cnblogs-markdown .hljs { display: block; overflow-x: auto; /* Custom font is optional */ /* font-family: 'Operator Mono', 'Fira Code', 'Menlo', 'Monaco', 'Courier New', 'monospace'; */ padding: 0.5em; background: #2d2b57 !important; font-weight: normal; } .cnblogs-markdown .hljs-title { color: #fad000; font-weight: normal; } .cnblogs-markdown .hljs-name { color: #a1feff; } .cnblogs-markdown .hljs-tag { color: #ffffff; } .cnblogs-markdown .hljs-attr { color: #f8d000; font-style: italic; } .cnblogs-markdown .hljs-built_in, .cnblogs-markdown .hljs-selector-tag, .cnblogs-markdown .hljs-section { color: #fb9e00; } .cnblogs-markdown .hljs-keyword { color: #fb9e00; } .cnblogs-markdown .hljs, .cnblogs-markdown .hljs-subst { color: #e3dfff; } .cnblogs-markdown .hljs-string, .cnblogs-markdown .hljs-attribute, .cnblogs-markdown .hljs-symbol, .cnblogs-markdown .hljs-bullet, .cnblogs-markdown .hljs-addition, .cnblogs-markdown .hljs-code, .cnblogs-markdown .hljs-regexp, .cnblogs-markdown .hljs-selector-class, .cnblogs-markdown .hljs-selector-attr, .cnblogs-markdown .hljs-selector-pseudo, .cnblogs-markdown .hljs-template-tag, .cnblogs-markdown .hljs-quote, .cnblogs-markdown .hljs-deletion { color: #4cd213; } .cnblogs-markdown .hljs-meta, .cnblogs-markdown .hljs-meta-string { color: #fb9e00; } .cnblogs-markdown .hljs-comment { color: #ac65ff; } .cnblogs-markdown .hljs-keyword, .cnblogs-markdown .hljs-selector-tag, .cnblogs-markdown .hljs-literal, .cnblogs-markdown .hljs-name, .cnblogs-markdown .hljs-strong { font-weight: normal; } .cnblogs-markdown .hljs-literal, .cnblogs-markdown .hljs-number { color: #fa658d; } .cnblogs-markdown .hljs-emphasis { font-style: italic; } .cnblogs-markdown .hljs-strong { font-weight: bold; }
新增複製功能
參考:
https://www.cnblogs.com/byho/p/13180288.html
/*markdown新增按鈕*/ .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; display: none; } .cnblogs-markdown pre:hover > span { display: block; } .cnblogs-markdown pre > .copyed { background: #67c23a; }
新增JS程式碼
<script src="https://blog-static.cnblogs.com/files/kikochz/clipboard.js"></script>
<script src="https://blog-static.cnblogs.com/files/kikochz/cp.js"></script>
Latex渲染
在頁首HTML程式碼中新增
有一個自動換行的細節,如果你的一些列數學公式通過&的方式在某個地方對其(比如在=這裡對齊),自動換行會不起作用。
<script type="text/javascript" async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-MML-AM_CHTML">
<script type="text/x-mathjax-config" src="https://blog-static.cnblogs.com/files/kikochz/latex.js#"></script>
標題特效
/*各個等級標題的顏色樣式*/
#cnblogs_post_body h1 {
background: #2B6695;
border-radius: 6px 6px 6px 6px;
box-shadow: 0 0 0 1px #5F5A4B, 1px 1px 6px 1px rgba(10, 10, 0, 0.5);
color: #FFFFFF;
font-family: "微軟雅黑", "宋體", "黑體", Arial;
font-size: 23px;
font-weight: bold;
height: 25px;
line-height: 25px;
margin: 18px 0 !important;
padding: 8px 0 5px 5px;
text-shadow: 2px 2px 3px #222222;
}
#cnblogs_post_body h2 {
background: #008eb7;
border-radius: 6px 6px 6px 6px;
box-shadow: 0 0 0 1px #5F5A4B, 1px 1px 6px 1px rgba(10, 10, 0, 0.5);
color: #FFFFFF;
font-family: "微軟雅黑", "宋體", "黑體", Arial;
font-size: 20px;
font-weight: bold;
height: 25px;
line-height: 25px;
margin: 18px 0 !important;
padding: 8px 0 5px 5px;
text-shadow: 2px 2px 3px #222222;
}
/*頁面中標題位置*/
#cnblogs_post_body h1 {
color: rgb(235, 235, 235);
}
#cnblogs_post_body h1:hover {
color: rgb(255, 102, 0);
}
#cnblogs_post_body h2 {
color: rgb(235, 235, 235);
}
#cnblogs_post_body h2:hover {
color: rgb(255, 102, 0);
}
背景特效
綵帶
<script src="https://blog-static.cnblogs.com/files/kikochz/ribbon.js"></script>
效果圖:
粒子球
<script src="https://blog-static.cnblogs.com/files/kikochz/canvas.js"></script>
流星
<script src="https://blog-static.cnblogs.com/files/kikochz/vendors.js"></script>
<script src="https://blog-static.cnblogs.com/files/kikochz/borealsky.js"></script>
目錄
參考:
https://www.cnblogs.com/sakuraph/p/5814060.html
<div class="fixedIndexs" style="position: fixed;bottom: 40px;display: none"></div>
<script language="javascript" type="text/javascript" src="https://blog-static.cnblogs.com/files/kikochz/list.js"></script>
新增Fork me on Github
左上角
<a href="https://github.com/dhay3" title="我的站點" target="_Blank" class="github-corner" aria-label="View source on Github"><svg width="80" height="80" viewBox="0 0 250 250" style="fill:#64CEAA; color:#fff; position: absolute; top: 0; border: 0; left: 0; transform: scale(-1, 1);" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></a><style>.github-corner:hover .octo-arm{animation:octocat-wave 560ms ease-in-out}@keyframes octocat-wave{0%,100%{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}@media (max-width:500px){.github-corner:hover .octo-arm{animation:none}.github-corner .octo-arm{animation:octocat-wave 560ms ease-in-out}}</style>
右上角
<a href="https://github.com/dhay3"><img style="position: absolute; top: 76px; right: 0; border: 0" alt="Fork me on GitHub" src="https://cdn.jsdelivr.net/gh/yanglr/Beautify-cnblogs/images/github-pendant-rightCorner.svg?sanitize=true"></a>
修改圖示/未生效
<script type="text/javascript" language="javascript">
var linkObject = document.createElement('link');
linkObject.rel = "shortcut icon";
linkObject.href = "https://blog-static.cnblogs.com/files/kikochz/favicon.ico";
document.getElementsByTagName("head")[0].appendChild(linkObject);
</script>
在公告欄新增滾動文字
<marquee><a href="#"><font color="blue" size="4">You will make it!</marquee>
人體時鐘
<embed wmode="transparent" src="https://files.cnblogs.com/files/enjoy233/honehone_clock_tr.swf" quality="high" bgcolor="#FDF6E3" width="200" height="120" name="honehoneclock" align="middle" allowscriptaccess="always"type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">
隱藏預設項
隱藏推薦按鈕
.diggit {
display: none;
}
隱藏反對按鈕
.buryit {
display: none;
}
.comment_bury {
display: none;
}
隱藏整個框
#div_digg {
display: none;
}
隱藏閱讀排行榜
#sidebar_topviewedposts {
display:none;
}
隱藏推薦排行榜
#sidebar_topdiggedposts{
display:none;
}
隱藏隨筆檔案
.catListPostArchive {
display:none;
}
正文圖片懸停放大
.post img {
cursor: pointer;
transition: all 0.5s;
}
.post img:hover {
transform: scale(1.3);
}
背景圖片
body:after {
background: url(https://img2018.cnblogs.com/blog/1646268/201906/1646268-20190625093618683-318547492.jpg) center/cover no-repeat;
content: '';
background-repeat: no-repeat;
background-position: center;
opacity: 0.4;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: -1;
-webkit-filter: grayscale(40%);
-moz-filter: grayscale(40%);
-ms-filter: grayscale(40%);
-o-filter: grayscale(40%);
filter: grayscale(40%);
filter: gray;
}
側邊導航欄
參考:
https://www.cnblogs.com/0x4D75/p/8965227.html
/* 定製自己導航欄的樣式 */
#shwtop ul {
margin: 0;
padding: 0;
list-style-type: none; /*去除li前的標註*/
background-color: #333;
overflow: hidden; /*隱藏溢位的部分,保持一行*/
}
#shwtop li {
float: left; /*左浮動*/
}
#shwtop li a, .dropbtn {
display: inline-block; /*設定成塊*/
color: white;
text-align: center;
text-decoration: none;
padding: 14px 16px;
}
/*滑鼠移上去,改變背景顏色*/
#shwtop li a:hover, .dropdown:hover .dropbtn {
/* 當然顏色你可以自己改成自己喜歡的,我還是挺喜歡藍色的 */
background-color: blue;
}
#shwtop .dropdown {
/*
display:inline-block將物件呈遞為內聯物件,
但是物件的內容作為塊物件呈遞。
旁邊的內聯物件會被呈遞在同一行內,允許空格。
*/
display: inline-block;
}
#shwtop .dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
}
#shwtop .dropdown-content a {
display: block;
color: black;
padding: 8px 10px;
text-decoration:none;
}
#shwtop .dropdown-content a:hover {
background-color: #a1a1a1;
}
#shwtop .dropdown:hover .dropdown-content{
display: block;
}
導航欄漸變樣式
/* 頭部 */
#header {
position: relative;
height: 280px;
margin: 0;
background: #020031;
background: -moz-linear-gradient(45deg,#020031 0,#6d3353 100%);
background: -webkit-gradient(linear,left bottom,right top,color-stop(0%,#020031),color-stop(100%,#6d3353));
background: -webkit-linear-gradient(45deg,#020031 0,#6d3353 100%);
background: -o-linear-gradient(45deg,#020031 0,#6d3353 100%);
background: -ms-linear-gradient(45deg,#020031 0,#6d3353 100%);
background: linear-gradient(45deg,#020031 0,#6d3353 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#020031', endColorstr='#6d3353', GradientType=1);
-webkit-box-shadow: inset 0 3px 7px rgba(0,0,0,.2),inset 0 -3px 7px rgba(0,0,0,.2);
-moz-box-shadow: inset 0 3px 7px rgba(0,0,0,.2),inset 0 -3px 7px rgba(0,0,0,.2);
box-shadow: inset 0 3px 7px rgba(0,0,0,.2),inset 0 -3px 7px rgba(0,0,0,.2);
}
評論樣式
.blog_comment_body {
background: #B2E866;
float: left;
border-radius: 5px;
position: relative;
overflow: visible;
margin-left: 33px;
max-width: 700px;
}
.feedbackListSubtitle a.layer {
background: #B2E866;
color: #414141 !important;
padding: 2px 4px;
border-radius: 2px;
}