diff options
| -rw-r--r-- | assets/css/main/post.css | 14 | ||||
| -rw-r--r-- | assets/css/main/themes.css | 15 | ||||
| -rw-r--r-- | libs/Contents.php | 10 |
3 files changed, 34 insertions, 5 deletions
diff --git a/assets/css/main/post.css b/assets/css/main/post.css index 294c838..e122706 100644 --- a/assets/css/main/post.css +++ b/assets/css/main/post.css @@ -167,6 +167,20 @@ width: 100%;
border: 2px dashed #f1f1f1
}
+.post-content kbd {
+ display: inline-block;
+ padding: 3px 5px;
+ font: 0.84em sans-serif;
+ line-height: 15px;
+ color: #444d56;
+ vertical-align: middle;
+ background-color: #fafbfc;
+ border: solid 1px #d1d5da;
+ border-bottom-color: #c6cbd1;
+ border-radius: 3px;
+ -webkit-box-shadow: inset 0 -1px 0 #c6cbd1;
+ box-shadow: inset 0 -1px 0 #c6cbd1
+}
.post-content code {
font-size: 0.95em;
background: #f0f0f0;
diff --git a/assets/css/main/themes.css b/assets/css/main/themes.css index f2a7d1f..d8dd60b 100644 --- a/assets/css/main/themes.css +++ b/assets/css/main/themes.css @@ -223,7 +223,8 @@ .body-dark .OwO-item,
.body-dark .index-banner,
.body-dark .login-enter-admin a,
-.body-dark .comment-submit {
+.body-dark .comment-submit,
+.body-dark .post-content kbd {
background-color:#6e6e6e!important
}
.body-dark .index-banner {
@@ -276,7 +277,8 @@ .body-dark .alert,
.body-dark .respond input,
.body-dark .respond textarea,
-.body-dark .login-enter-admin a {
+.body-dark .login-enter-admin a,
+.body-dark .post-content kbd {
color:#fafafa!important
}
.body-dark .options-theme-label {
@@ -298,9 +300,13 @@ .body-dark .post-content th,
.body-dark .post-content tr,
.body-dark .saying-hr,
-.body-dark .post-share {
+.body-dark .post-share,
+.body-dark .post-content kbd {
border-color:#6e6e6e!important
}
+.body-dark .post-content kbd {
+ border-bottom-color: #6e6e6e!important
+}
.body-dark .tip {
border-top-color:#6e6e6e!important;
border-bottom-color:#6e6e6e!important;
@@ -413,7 +419,8 @@ background: transparent
}
.body-sepia .fixed-button,
-.body-sepia .post-pagenav a {
+.body-sepia .post-pagenav a,
+.body-sepia .post-content kbd {
background: rgb(250,246,224)!important
}
.body-sepia .comment-content,
diff --git a/libs/Contents.php b/libs/Contents.php index 06e7246..da552a5 100644 --- a/libs/Contents.php +++ b/libs/Contents.php @@ -14,7 +14,7 @@ class Contents $text = empty($last) ? $data : $last; if ($widget instanceof Widget_Archive) { //ParseOther - $text = Contents::parseEmo(Contents::parseCode(Contents::parseImages(Contents::parseHeadings(Contents::parseTextColor(Contents::parseRuby(Contents::parseTip(Contents::parseLink($text)))))))); + $text = Contents::parseEmo(Contents::parseKbd(Contents::parseCode(Contents::parseImages(Contents::parseHeadings(Contents::parseTextColor(Contents::parseRuby(Contents::parseTip(Contents::parseLink($text))))))))); //LazyLoad $text = preg_replace('/<img (.*?)src(.*?)(\/)?>/','<img $1src="/usr/themes/Miracles/images/loading/'.$load_image.'.gif" data-original$2 />',$text); } @@ -183,6 +183,14 @@ class Contents $text = preg_replace('/<pre><code>/s','<pre><code class="language-html">',$text); return $text; } + + /** + * 解析键盘按键 + */ + static public function parseKbd($text) { + $text = preg_replace('/\~(.*?)\~/s','<kbd>${1}</kbd>',$text); + return $text; + } /** * 解析章节链接 |
