diff --git a/css/binkic.css b/css/binkic.css index a157f18..52531ea 100644 --- a/css/binkic.css +++ b/css/binkic.css @@ -4,7 +4,7 @@ # Kico Style 1.5 # By: Dreamer-Paul -# Last Update: 2017.8.27 +# Last Update: 2017.9.24 一个简洁、有趣的开源响应式框架,仅包含基础样式,需按照一定规则进行二次开发。 @@ -23,18 +23,19 @@ fieldset, legend, figure{ margin: 0; padding: 0; } + body{ color: #353535; - font: 16px /1.5 'Microsoft Yahei', 'PingFang SC', 'Hiragino Sans GB', sans-serif; + font: 16px/1.5 'Microsoft Yahei', 'PingFang SC', 'Hiragino Sans GB', sans-serif; } @media screen and (max-width: 500px){ - body[enable-scale]{ + html[resize] body{ font-size: 14px; } } @media screen and (min-width: 1930px){ - body[enable-scale]{ + html[resize] body{ font-size: 18px; } } @@ -60,31 +61,38 @@ nav, section, main{ background-color: rgba(0,0,0,0.66); } -::-webkit-scrollbar { +/* - 滚动条 */ +::-webkit-scrollbar{ width: 10px; - height: 10px + height: 10px; } -::-webkit-scrollbar-thumb { - min-height: 28px; - background-color: rgba(0,0,0,.2); +::-webkit-scrollbar-thumb{ + border-radius: 5px; + background: rgba(0,0,0,.2); -webkit-background-clip: padding-box; background-clip: padding-box; - border-radius: 5px; -webkit-box-shadow: inset 1px 1px 0 rgba(0,0,0,.1),inset 0 -1px 0 rgba(0,0,0,.07) } -::-webkit-scrollbar-track:hover { - background-color: rgba(0,0,0,.05); +::-webkit-scrollbar-track:hover{ + background: rgba(0,0,0,.05); -webkit-box-shadow: inset 1px 0 0 rgba(0,0,0,.1) } -::-webkit-scrollbar-track:active { +::-webkit-scrollbar-track:active{ background-color: rgba(0,0,0,.05); -webkit-box-shadow: inset 1px 0 0 rgba(0,0,0,.14),inset -1px -1px 0 rgba(0,0,0,.07) } +.bk-scroll-hover::-webkit-scrollbar{ + display: none; +} +.bk-scroll-hover:hover::-webkit-scrollbar{ + display: inherit; +} + /* 1 - 容器 -------------------------------- */ -main, footer{ +body > main, body > footer{ overflow: hidden; } @@ -128,6 +136,19 @@ h1:last-child, h2:last-child, h3:last-child, h4:last-child, h5:last-child, h6:la margin-bottom: 0; } +h1.heading-1{ + font-size: 6em; +} +h2.heading-2{ + font-size: 5.5em; +} +h3.heading-3{ + font-size: 4.5em; +} +h4.heading-4{ + font-size: 3.5em; +} + p{ line-height: 1.8em; margin-bottom: 1em; @@ -150,6 +171,9 @@ em{ background: #3498db; } +audio{ + vertical-align: middle; +} img, svg, video{ height: auto; max-width: 100%; @@ -314,16 +338,20 @@ input[readonly]{ background: rgb(235, 235, 228); } input, textarea, select{ - outline: 0; + outline: none; font: inherit; } -input[type="text"], input[type="email"], input[type="url"], input[type="password"], textarea, select{ +input[type="text"], input[type="email"], input[type="url"], input[type="password"], input[type="number"], input[type="search"], textarea, select{ padding: .5em; color: inherit; border-radius: 4px; border: #ccc 1px solid; } +input[type="number"]:out-of-range{ + background: rgba(255, 0, 0, .3); +} + textarea{ display: block; overflow: auto; @@ -331,6 +359,15 @@ textarea{ resize: vertical; } +progress{ + overflow: auto; + border-radius: 50px; +} +progress::-webkit-progress-bar { + background-color: #eee; +} + + /* - 缤奇表单模组 */ .bk-form label{ display: block; @@ -392,10 +429,11 @@ textarea{ width: 60px; height: 30px; cursor: pointer; + background: #eee; position: relative; border-radius: 50px; - border: 1px solid #ccc; - background: rgba(0,0,0,.05); + border: 1px solid #ddd; + transition: border .3s, background .3s; } .bk-form input[type="checkbox"].switch:before{ margin: 0; @@ -405,13 +443,16 @@ textarea{ height: 28px; display: block; box-shadow: none; + background: #fff; position: absolute; border-radius: 100%; - background: rgba(0,0,0,0.2); - transition: background 0.3s, transform 0.3s; + transition: transform 0.3s; } -.bk-form input[type="checkbox"].switch:checked:before{ +.bk-form input[type="checkbox"].switch:checked{ background: #3498db; + border-color: #3498db; +} +.bk-form input[type="checkbox"].switch:checked:before{ transform: translateX(30px); } @@ -508,6 +549,16 @@ iframe{ border: none; } +/* - 详细信息 */ +details > summary{ + outline: none; + cursor: pointer; + user-select: none; +} +details > summary + *{ + margin-top: .5em; +} + /* - 栅格系统 */ .row{ display: flex; @@ -540,6 +591,7 @@ iframe{ /* -- 网格间距 */ .row [class*="col-"]{ + position: relative; padding-left: 20px; padding-right: 20px; } @@ -553,14 +605,15 @@ iframe{ } /* -- 网格主体 */ -.row [class*="col-s-"], [class*="col-m-"], [class*="col-l-"]{ +.row [class*="col-s-"], +.row [class*="col-m-"], +.row [class*="col-l-"]{ flex: 0 0 100%; max-width: 100%; - position: relative; margin-bottom: 2em; } -.row [class*="col-s-"]:last-child, [class*="col-m-"]:last-child, [class*="col-l-"]:last-child{ - margin-bottom: 0 !important; +.row [class*="col-s-"]:last-child, .row [class*="col-m-"]:last-child, .row [class*="col-l-"]:last-child{ + margin-bottom: 0; } @media screen and (min-width: 600px){ @@ -578,6 +631,42 @@ iframe{ margin-bottom: 0; } } +.offset-left-1{ + left: -8.3333%; +} +.offset-left-2{ + left: -16.6666%; +} +.offset-left-3{ + left: -25%; +} +.offset-left-4{ + left: -33.3333%; +} +.offset-left-5{ + left: -41.6666%; +} +.offset-left-6{ + left: -50%; +} +.offset-left-7{ + left: -58.3333%; +} +.offset-left-8{ + left: -66.6666%; +} +.offset-left-9{ + left: -75%; +} +.offset-left-10{ + left: -83.3333%; +} +.offset-left-11{ + left: -91.6666%; +} +.offset-left-12{ + left: -100%; +} /* --- 固定的 */ .row .col-1{ @@ -888,11 +977,12 @@ iframe{ /* - 弹窗 */ .bk-notice-list{ - top: 3em; + top: 5em; left: 0; right: 0; z-index: 60; position: fixed; + user-select: none; pointer-events: none; } .bk-notice-list .bk-notice { @@ -902,10 +992,10 @@ iframe{ padding: .5em 1em; border-radius: 3em; pointer-events: auto; - animation: fade-in-bottom 0.3s backwards; + animation: fade-large 0.3s backwards; box-shadow: 0 5px 5px -2px rgba(0, 0, 0, 0.2); - max-width: 20em; + max-width: 15em; margin-left: auto; margin-right: auto; margin-bottom: 1em; @@ -916,20 +1006,16 @@ iframe{ /* -- 弹窗颜色 */ .bk-notice.red{ - color: #f55d5b; - background: #ffe8e0; + background: #ea644a; } .bk-notice.yellow{ - color: #eb9c26; - background: #fcf8e3; + background: #f1a325; } .bk-notice.blue{ - color: #3498db; - background: #d9edf7; + background: #3498db; } .bk-notice.green{ - color: #27a17e; - background: #dff0d8; + background: #38b03f; } .bk-notice .close{ @@ -967,12 +1053,13 @@ img[bk-imgs=active]{ cursor: zoom-in; } .bk-imgs{ - position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 66; + position: fixed; + user-select: none; } .bk-imgs:before{ top: 0; @@ -1077,7 +1164,7 @@ img[bk-imgs=active]{ 100%{ opacity: 1 } } .bk-animate.fade-off{ - animation-name: fade-in; + animation-name: fade-off; } @keyframes fade-off { 0% { opacity: 1 } @@ -1172,22 +1259,6 @@ img[bk-imgs=active]{ 100%{ transform: scale(1, 1); } } -.bk-animate.scale-small-left{ - animation-name: scale-small-left; -} -@keyframes scale-small-left { - 0%{ transform: scale(1.5, 1.5) translateX(15%); } - 100%{ transform: scale(1, 1) translateX(0);} -} - -.bk-animate.scale-small-right{ - animation-name: scale-small-right; -} -@keyframes scale-small-right { - 0%{ transform: scale(1.5, 1.5) translateX(15%); } - 100%{ transform: scale(1, 1) translateX(0);} -} - /* ---- diff --git a/css/single.css b/css/single.css index 7885f62..0efd1a4 100644 --- a/css/single.css +++ b/css/single.css @@ -4,7 +4,7 @@ # Single Theme # By: Dreamer-Paul -# Last Update: 2017.8.17 +# Last Update: 2017.11.19 一个简洁大气,含夜间模式的 Typecho 博客模板。 @@ -55,6 +55,10 @@ hr{ border-color: #eee; } +em{ + background: #6f9fc7; +} + .btn{ color: #fff; background: #6f9fc7; @@ -93,7 +97,7 @@ body.neon a:hover{ } /* -- 透明度变黑 */ -body.neon code, body.neon blockquote, body.neon iframe{ +body.neon code, body.neon blockquote, body.neon iframe, body.neon em{ opacity: .6; } @@ -169,6 +173,7 @@ header{ z-index: 11; color: #666; position: fixed; + line-height: 1em; background: #fff; border-bottom: 1px solid #ddd; transition: border 0.3s, background 0.3s; @@ -178,7 +183,7 @@ header{ header .head-title{ left: 0; right: 0; - line-height: 3.5em; + line-height: 3.2em; position: absolute; text-align: center; } @@ -216,7 +221,7 @@ header .head-menu li a:hover{ header .head-menu li.has-child > a:after{ float: right; - content: '\f107'; + content: "\f107"; margin-left: .3em; font-family: "FontAwesome"; } @@ -256,7 +261,7 @@ header .head-menu li.has-child > a:after{ } header .head-menu > li{ - padding: .75em 0; + padding: .6em 0; line-height: 2em; margin-right: 1em; } @@ -277,21 +282,24 @@ header .head-menu .sub-menu a{ /* -- 电脑版 */ @media screen and (min-width: 600px){ - header .head-menu li:hover > ul{ - display: block; + header .head-menu li:hover > .sub-menu{ + opacity: 1; + visibility: visible; } header .head-menu .sub-menu{ margin: 0; - top: 3.5em; + top: 3.25em; + opacity: 0; width: 180px; - display: none; list-style: none; background: #fff; padding: .5em 1em; + visibility: hidden; position: absolute; border: 1px solid #ddd; border-radius: 0 0 5px 5px; + transition: opacity .15s, visibility .15s; } header .toggle-btn{ @@ -303,7 +311,7 @@ header .toggle-btn, header .light-btn, header .search-btn{ z-index: 1; float: left; width: 2em; - margin: .75em; + margin: .6em; cursor: pointer; position: relative; border-radius: 4px; @@ -329,22 +337,23 @@ header .toggle-btn:before, header .light-btn:before, header .search-btn:before{ } header .toggle-btn:before{ - content: '\f0c9'; + content: "\f0c9"; } header .light-btn:before{ - content: '\f0eb'; + content: "\f0eb"; } header .search-btn:before{ - content: '\f002'; + content: "\f002"; } header .search-form{ z-index: 1; opacity: 0; float: right; - padding: .75em 0; + margin: .6em 0; + line-height: 1.5em; position: relative; pointer-events: none; transition: opacity 0.3s; @@ -356,7 +365,7 @@ header .search-form.active{ header .search-form input{ width: 150px; font-size: .9em; - padding: .3em .75em; + padding: .25em .75em; border-radius: 50px; } @media screen and (max-width: 600px){ @@ -436,21 +445,24 @@ main .post-item:last-child{ } /* -- 动画 */ -main .post-item:nth-child(1n){ +main .post-item:nth-child(1){ animation: fade-in-top .3s .2s both; } -main .post-item:nth-child(2n){ +main .post-item:nth-child(2){ animation: fade-in-top .3s .3s both; } -main .post-item:nth-child(3n){ +main .post-item:nth-child(3){ animation: fade-in-top .3s .4s both; } -main .post-item:nth-child(4n){ +main .post-item:nth-child(4){ animation: fade-in-top .3s .5s both; } -main .post-item:nth-child(5n){ +main .post-item:nth-child(5){ animation: fade-in-top .3s .6s both; } +main .post-item:nth-child(6){ + animation: fade-in-top .3s .7s both; +} main .post-item h2{ margin-bottom: .5em; @@ -494,10 +506,10 @@ main .post-meta .category:before{ content: "\f07b"; } main .post-meta .tags:before{ - content: " \f02c"; + content: "\f02c"; } main .post-meta .comments:before{ - content: " \f086"; + content: "\f086"; } /* - 换页 */ @@ -601,8 +613,11 @@ main .post-author{ transition: border 0.3s, filter 0.3s; } -main .post-author img{ +main .post-author figure{ + flex: 0 0 80px; max-width: 80px; +} +main .post-author img{ border-radius: 100%; vertical-align: middle; } @@ -716,33 +731,53 @@ main .comment-list .comment-reply a:hover{ } /* -- 文章目录 */ -.article-list{ +main .article-list{ top: 3.5em; right: 0; bottom: 0; opacity: 0; + width: 15em; padding: 1em; position: fixed; - min-width: 15em; border-radius: 4px; pointer-events: none; border-left: 1px solid #ccc; background: rgba(255, 255, 255, .5); transition: border 0.3s, opacity 0.3s, background 0.3s; } -.article-list a{ +main .article-list a{ display: block; margin-bottom: .5em; } -.article-list a:last-child{ +main .article-list a:last-child{ margin-bottom: 0; } + +main .article-list a.item-3:before, +main .article-list a.item-4:before, +main .article-list a.item-5:before{ + margin-right: .5em; +} + +main .article-list a.item-3:before{ + content: "-"; +} +main .article-list a.item-4:before{ + content: "--"; +} +main .article-list a.item-5:before{ + content: "---"; +} +main .article-list a.item-6:before{ + content: "----"; +} + @media screen and (min-width: 800px){ body.has-trees{ margin-right: 15em; } - .article-list{ + main .article-list{ opacity: 1; pointer-events: inherit; } @@ -812,18 +847,53 @@ main .comment-list .comment-reply a:hover{ .turn-up:before{ width: 1.5em; display: block; - content: '\f062'; + content: "\f062"; text-align: center; font-family: "FontAwesome"; } footer{ - text-align: center; border-top: 1px solid #eee; transition: border 0.3s, background 0.3s; } -footer p{ +footer .widget{ + padding: 2em 0; +} +footer .title-comments:after, +footer .title-recent:after, +footer .title-date:after{ + float: right; + margin-right: .75em; + font-family: "FontAwesome"; +} +footer .title-comments:after{ + content: "\f0e6"; +} +footer .title-recent:after{ + content: "\f040"; +} +footer .title-date:after{ + content: "\f017"; +} + +footer .widget ul{ + margin: 0; + list-style: none; +} +footer .widget ul li{ + margin-bottom: .5em; +} +footer .widget ul li:before{ + content: "\f105"; + margin-right: .75em; + font-family: "FontAwesome"; +} + +footer .sub-footer{ padding: 1em 0; - font-size: .875em; + text-align: center; +} +footer .sub-footer p{ + font-size: .875em; } \ No newline at end of file diff --git a/footer.php b/footer.php index 7ea127c..708eb6f 100644 --- a/footer.php +++ b/footer.php @@ -3,7 +3,38 @@ diff --git a/functions.php b/functions.php index 17a4743..b7081e9 100644 --- a/functions.php +++ b/functions.php @@ -3,7 +3,7 @@ function themeConfig($form) { // 输出主题信息 - $version = "1.3"; + $version = "1.4"; echo(""); echo("
"); echo("

Single 主题 (".$version.")

"); @@ -33,13 +33,21 @@ function themeConfig($form) { '0' => _t('关闭'), '1' => _t('开启') ), '1', _t('显示作者信息'), _t('在文章底部显示作者信息')); - $form->addInput($show_author->multiMode()); // 自定义作者信息 $author_text = new Typecho_Widget_Helper_Form_Element_Text('author_text', NULL, NULL, _t('作者信息'), _t('显示在文章底部的作者信息,可以是版权声明等')); $form->addInput($author_text); + // 信息栏 + $widget_set = new Typecho_Widget_Helper_Form_Element_Radio('widget_set', + array( + '0' => _t('关闭'), + '1' => _t('开启'), + ), + '0', _t('是否显示信息栏'), _t('在页尾显示 “最近评论”、“最新文章” 和 “时光机”')); + $form->addInput($widget_set); + // Pjax $pjax_set = new Typecho_Widget_Helper_Form_Element_Radio('pjax_set', array( @@ -56,7 +64,6 @@ function themeConfig($form) { 'show_tags' => _t('文章标签'), 'show_comments' => _t('评论数')), array('show_category', 'show_comments'), _t('首页、存档页属性显示')); - $form->addInput($archive_meta->multiMode()); // 文章页属性显示 @@ -66,6 +73,5 @@ function themeConfig($form) { 'show_tags' => _t('文章标签'), 'show_comments' => _t('评论数')), array('show_category', 'show_comments'), _t('文章页属性显示')); - $form->addInput($post_meta->multiMode()); } \ No newline at end of file diff --git a/header.php b/header.php index 7a82d83..cc5963f 100644 --- a/header.php +++ b/header.php @@ -25,6 +25,13 @@ options->custom_css): ?> + + header('generator=&template=&pingback=&xmlrpc=&wlw='); ?> diff --git a/index.php b/index.php index bd03566..5f56aa4 100644 --- a/index.php +++ b/index.php @@ -4,7 +4,7 @@ * * @package Single Theme * @author Dreamer-Paul - * @version 1.3 + * @version 1.4 * @link https://hi-paul.space */ diff --git a/js/binkic.js b/js/binkic.js index d4018a3..6271489 100644 --- a/js/binkic.js +++ b/js/binkic.js @@ -15,26 +15,25 @@ var body = document.body; // 弹框 function bk_notice(content, attr) { - var check_list = document.getElementsByClassName("bk-notice-list")[0]; - - - if(check_list == undefined){ - var notice_list = document.createElement("div"); + // 生成框架 + var notice_list = document.createElement("div"); notice_list.classList.add("bk-notice-list"); - } + // 判断是否存在 + var check_list = document.querySelector("body > .bk-notice-list"); + + // 生成子元素 var notice_item = document.createElement("div"); - notice_item.classList.add("bk-notice"); + notice_item.classList.add("bk-notice"); var inner = document.createElement("p"); - inner.classList.add("content"); - inner.innerHTML = content; + inner.classList.add("content"); + inner.innerHTML = content; notice_item.appendChild(inner); if(check_list){ check_list.appendChild(notice_item); - body.appendChild(check_list); } else{ notice_list.appendChild(notice_item); @@ -42,7 +41,7 @@ function bk_notice(content, attr) { } if(attr && attr.overlay == true){ - overlay(attr.dtime); + bk_overlay({time: attr.dtime}); } if(attr && attr.dtime != null){ setTimeout(notice_remove, attr.dtime); @@ -57,24 +56,28 @@ function bk_notice(content, attr) { function notice_remove() { notice_item.classList.add("remove"); setTimeout(function () { - if(check_list){ - check_list.removeChild(notice_item); - } - else{ - notice_list.removeChild(notice_item); - } + check_list ? check_list.removeChild(notice_item) : notice_list.removeChild(notice_item); }, 300); } } // 遮罩 -function overlay(count_down){ +function bk_overlay(attr){ var overlay = document.createElement("div"); overlay.classList.add("overlay"); body.appendChild(overlay); - if(count_down != null){ - setTimeout(overlay_remove, count_down); + if(attr.execute){ + overlay.addEventListener("click", function () { + attr.execute(); + overlay_remove(); + }); + } + if(attr.close){ + attr.close.addEventListener("click", overlay_remove); + } + if(attr.time){ + setTimeout(overlay_remove, attr.time); } function overlay_remove() { @@ -94,8 +97,6 @@ function bk_imgs(selector) { var image = document.createElement("img"); if(selector){ - //var img_list = document.body.getElementsByTagName("img"); - console.log(img_list); img_list.forEach(function (t) { t.setAttribute("bk-imgs", "active"); t.addEventListener("click", function () { diff --git a/js/single.js b/js/single.js index cf0b9b6..e3d95b2 100644 --- a/js/single.js +++ b/js/single.js @@ -2,7 +2,7 @@ # Single Theme # By: Dreamer-Paul -# Last Update: 2017.8.2 +# Last Update: 2017.11.19 一个简洁大气,含夜间模式的 Typecho 博客模板。 @@ -72,27 +72,39 @@ style_select(); title.innerHTML = "文章目录:"; trees.appendChild(title); - headings.forEach(function (t) { - t.id = t.innerText; + + for(var i = 0; i < headings.length; i++){ + headings[i].id = headings[i].innerText; var item = document.createElement("a"); - item.innerText = (t.innerText); - item.href = "#" + t.innerText; - - var i = t.tagName; - switch (i){ - case "H3": item.style = "margin-left: .5em;"; break; - case "H4": item.style = "margin-left: .75em;"; break; - case "H5": item.style = "margin-left: 1em;"; break; - case "H6": item.style = "margin-left: 1.25em;"; break; + item.innerText = headings[i].innerText; + item.href = "#" + headings[i].innerText; + + switch (headings[i].tagName){ + case "H3": item.className = "item-3"; break; + case "H4": item.className = "item-4"; break; + case "H5": item.className = "item-5"; break; + case "H6": item.className = "item-6"; break; } - trees.appendChild(item); - }); + } wrap.appendChild(trees); } } })(); +// 自动添加外链 +(function () { + var content = document.getElementsByClassName("post-content")[0] || document.getElementsByClassName("page-content")[0]; + if(content){ + var links = content.getElementsByTagName("a"); + + if(links[0]){ + for(var i = 0; i < links.length; i++){ + links[i].target = "_blank"; + } + } + } +})(); // 返回页首 function turn_up() {