From 3ac22bf6ce5f0c7be414b257480b8da886faa9c4 Mon Sep 17 00:00:00 2001 From: RayLee <146833774+tymnxye@users.noreply.github.com> Date: Wed, 10 Jul 2024 10:54:27 +0800 Subject: [PATCH] Add files via upload --- css/about.css | 75 + css/article.css | 541 ++++ css/base.css | 541 ++++ css/baseArticle.css | 246 ++ css/detail.css | 1027 ++++++++ css/detail.css.bak | 1028 ++++++++ css/friendsLink.css | 189 ++ css/index.css | 427 ++++ css/label.css | 38 + css/prettify.css | 152 ++ css/publish.css | 335 +++ css/test.css | 3041 ++++++++++++++++++++++ html/about.html | 79 + html/article.html | 67 + html/detail.html | 136 + html/friendLink.html | 79 + html/index.html | 115 + html/label.html | 47 + html/publish.html | 90 + js/article.js | 419 ++++ js/base.js | 135 + js/detail.js | 671 +++++ js/editor.js | 4731 +++++++++++++++++++++++++++++++++++ js/friendLink.js | 92 + js/index.js | 100 + js/label.js | 112 + js/publish.js | 139 + js/tagCloud/tagCloud.js | 181 ++ js/template.js | 87 + js/template/art-template.js | 3 + js/test.js | 1988 +++++++++++++++ 31 files changed, 16911 insertions(+) create mode 100644 css/about.css create mode 100644 css/article.css create mode 100644 css/base.css create mode 100644 css/baseArticle.css create mode 100644 css/detail.css create mode 100644 css/detail.css.bak create mode 100644 css/friendsLink.css create mode 100644 css/index.css create mode 100644 css/label.css create mode 100644 css/prettify.css create mode 100644 css/publish.css create mode 100644 css/test.css create mode 100644 html/about.html create mode 100644 html/article.html create mode 100644 html/detail.html create mode 100644 html/friendLink.html create mode 100644 html/index.html create mode 100644 html/label.html create mode 100644 html/publish.html create mode 100644 js/article.js create mode 100644 js/base.js create mode 100644 js/detail.js create mode 100644 js/editor.js create mode 100644 js/friendLink.js create mode 100644 js/index.js create mode 100644 js/label.js create mode 100644 js/publish.js create mode 100644 js/tagCloud/tagCloud.js create mode 100644 js/template.js create mode 100644 js/template/art-template.js create mode 100644 js/test.js diff --git a/css/about.css b/css/about.css new file mode 100644 index 0000000..99fea2c --- /dev/null +++ b/css/about.css @@ -0,0 +1,75 @@ +.about_left{ + float: left; + width: 68%; +} + +.about_right{ + float: right; + width: 28%; +} + +.about_left h3{ + margin-bottom: 20px; + padding-left: 20px; + margin-top: 20px; + border-left: 3px solid #EE2C2C; + font-size: 18px; + line-height: 22px; +} + +.about_left p{ + line-height: 36px; + margin-left: 20px; + color: #232328; + font-size: 12px; +} + +.about_left>div{ + background-color: rgba(255,255,255,0.9); + border-radius: 10px; + padding: 20px; + margin-bottom: 30px; +} + +.about_left i{ + margin-right: 10px; +} + +.about_left a{ + color: #EE2C2C; + margin:0 5px; +} + +.about_left a:hover{ + text-decoration: underline; +} + +.zzw{ + cursor: none; +} + +/*关于我页面手机适配*/ +@media screen and (max-width: 500px){ + + .about_left{ + float: none; + width: 100%; + } + + .about_right{ + float: none; + width: 100%; + } + + .about_left>div{ + border-radius: 5px; + } + + .about_me{ + border-radius: 5px; + } + + .weChat{ + border-radius: 5px; + } +} diff --git a/css/article.css b/css/article.css new file mode 100644 index 0000000..d9d24f4 --- /dev/null +++ b/css/article.css @@ -0,0 +1,541 @@ +.blog_content{ + width: 68%; + float: left; +} + +.blog_classify{ + width: 28%; + float: right; +} + +.blog_classify>ul>li{ + margin: 0 0 40px 0; +} + +.blog_content ul li{ + display: block; + position: relative; + background: rgba(255,255,255,.9); + margin: 0 0 30px 0; + padding: 20px; + box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04); + cursor: pointer; + border-radius: 10px; + overflow: hidden; +} + +.blog_content ul li:hover .line{ + height: 25px; +} + +.blog_image{ + position: relative; + float: left; + width: 220px; + height: 130px; + overflow: hidden; + margin: 0 20px 0 0; +} + +.blog_image:before{ + content: "Loading"; + position: absolute; + left: 0; + width: 100%; + height: 100%; + line-height: 130px; + text-align: center; + font-size: 25px; + background-color: rgba(0,0,0,0.01); + color: #b7b6b6; + z-index: -1; +} + +.blog_image>img{ + width: 100%; + height: 100%; + -webkit-transition: all .5s; + -moz-transition: all .5s; + -ms-transition: all .5s; + -o-transition: all .5s; + transition: all .5s; +} + +.blog_image>img:hover{ + -webkit-transform: scale(1.05); + -moz-transform: scale(1.05); + -ms-transform: scale(1.05); + -o-transform: scale(1.05); + transform: scale(1.05); +} + +.blog_content ul li:before:hover{ + -webkit-transform: scale(1.1); + -moz-transform: scale(1.1); + -ms-transform: scale(1.1); + -o-transform: scale(1.1); + transform: scale(1.1); +} + + +.blog_content ul li h3{ + font-family: inherit; + font-style: inherit; + color: #444; + font-size: 14px; + line-height: 20px; + padding: 0 0 7px 0; +} + +.blog_content ul li h3>span{ + color: #2D93CA; +} + +.article_content{ + font-size: 13px; + color: #777; + height: 78px; + overflow: hidden; + line-height: 26px; + display: -webkit-box; + -ms-text-overflow: ellipsis; + text-overflow: ellipsis; + -webkit-box-orient:vertical; + -webkit-line-clamp:3; +} + +.article_content img{ + height: 50px; + width: 50px; +} + +.blog_content ul li>span{ + position: relative; + top: 22px; + color: rgba(0,0,0,.5); +} + +.read_more{ + position: absolute; + right: -1px; + bottom: 10px; + display: block; + background: #3690cf; + color: #fff; + line-height: 30px; + padding: 0 12px; + border-right: none; + border-radius: 2px 0 0 2px; + cursor: pointer; +} + +.article{ + display: block; + overflow: hidden; + position: relative; +} + +.article_classify{ + display: block; + padding: 5px 6px; + background-color: rgba(0,0,0,.6); + position: absolute; + color: #FFFFFF; + top: 30px; + left: 30px; + text-align: center; + font-size: 12px; +} + +.article_classify:hover{ + background-color: #EE2C2C; +} + +.blog_content ul li span i{ + margin: 0 5px 0 2px; +} + +.blog_date{ + float: right; + margin-right: 80px; +} + +.blog_comment{ + margin-left: 15px; +} + +.line{ + position: absolute; + background: #EE2C2C; + top: 20px; + left: -1px; + width: 5px; + height: 0; + box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1); + -webkit-transition: height .5s; + -moz-transition: height .5s; + -ms-transition: height .5s; + -o-transition: height .5s; + transition: height .5s; +} + +.blog_heart{ + margin-left: 15px; +} + +.top{ + width: 80px; + height: 20px; + background-color: red; + line-height: 20px; + position: absolute; + text-align: center; + font-size: 13px; + transform: rotate(45deg); + right: -20px; + top: 9px; + color: #fff; + cursor: default; +} + +.article_info{ + position: relative; + top: 10px; + color: #666; + font-size: 13px; +} + +.classify{ + display: block; + background-color: rgba(255,255,255,.9);; +} + +.classify li{ + display: block; + position: relative; + background-color: rgba(255,255,255,.9);; + height: 40px; + line-height: 40px; + border-bottom: 1px solid #eeeeee; + counter-increment:nums; + cursor: pointer; +} + +.classify li:hover{ + background-color: #f8f9f7; +} + +#allClassify{ + cursor: pointer; +} + +#allClassify:hover{ + color: #2ea7e0; +} + +.classify_title{ + display: block; + color: #EE2C2C; + font-size: 16px; + line-height: 40px; + padding-bottom: 5px; + background-color: rgba(255,255,255,.9); + border-bottom: 1px solid #EE2C2C; + text-align: center; +} + +.classify li:last-child{ + border-bottom: none; +} + +.classify li a{ + margin: 0 60px; + color: #787977; + font-size: 14px; +} + +.blog_classify>ul>li>ul>li>a:before{ + content: counter(nums,decimal); + width: 20px; + height: 20px; + line-height: 20px; + text-align: center; + position: absolute; + left: 25px; + top: 9px; + border-radius: 100%; + background-color: #edefee; + text-shadow: 0 1px 0 rgba(255,255,255,.5); +} + +.blog_classify>ul>li>ul>li:first-child>a:before{ + margin-top: 10px; + background-color: #e24d46; + color: #ffffff; + text-shadow: none; +} + +.blog_classify>ul>li>ul>li:nth-child(2)>a:before{ + background-color: #2ea7e0; + color: #ffffff; + text-shadow: none; +} + +.blog_classify>ul>li>ul>li:nth-child(3)>a:before{ + background-color: #6bc30d; + color: #ffffff; + text-shadow: none; +} + +.blog_classify>ul>li>ul>li:first-child{ + padding-top: 10px; +} + +.blog_classify>ul>li>ul>li:last-child{ + padding-bottom: 10px; +} + +.hot_article{ + background-color: rgba(255,255,255,.9);; +} + +.hot_article li{ + display: block; + line-height: 38px; + position: relative; + counter-increment: nums; + padding-left: 30px; + overflow: hidden; + word-wrap: normal!important; + white-space: nowrap; + text-overflow: ellipsis; +} + +.hot_article li a{ + color: #787977; + font-size: 13px; + margin: 0 30px; +} + +.hot_article li a:hover{ + color: #EE2C2C; + text-decoration: underline; +} + +.hot_tag{ + position: relative; + overflow: hidden; + height: 330px; + background-color: rgba(255,255,255,.9);; +} + +#tag_cloud_widget span{ + display: block; + position: absolute; + font-size: 14px; + color: #fff; + text-align: center; + text-overflow: ellipsis; + white-space: nowrap; + top: 0; + left: 0; + padding: 3px 5px; + box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08); + line-height: 15px; + background: #999; + cursor: pointer; +} + +#tag_cloud_widget{ + position: relative; + width: 100%; + height: 240px; + overflow: hidden; + margin: 10px auto 10px; +} + +#tag_cloud_widget span:nth-child(n) { + white-space: nowrap; + _white-space: normal; + *white-space: normal; + overflow: hidden; + text-overflow: ellipsis; +} + +#tag_cloud_widget span:nth-child(2n) { + background: #d1a601; +} + +#tag_cloud_widget span:nth-child(3n) { + background: #286c4a; +} + +#tag_cloud_widget span:nth-child(5n) { + background: #518ab2; +} + +#tag_cloud_widget span:nth-child(4n) { + background: #c91d13; +} + +.left1{ + display: none; +} + +.left2{ + display: none; +} + +.top1{ + display: none; +} + +@media screen and (max-width: 500px){ + /*article页面适配手机*/ + .blog_content{ + width: 100%; + } + + .blog_image{ + width: 100%; + height: 100%; + min-height: 150px; + margin: 37px 20px 0 0; + } + + .blog_content ul li h3{ + position: absolute; + width: 100%; + } + + .article{ + overflow: initial; + } + + .read_more{ + display: none; + } + + .article_classify{ + top: 47px; + } + + .article_content{ + width: 100%; + } + + .blog_date{ + margin-right: 0; + } + + .blog_comment{ + margin-left: 8px; + } + + .blog_heart{ + margin-left: 8px; + } + + .article_info{ + font-size: 12px; + } + + .mobile_close{ + display: none; + } + + .hot_mobile_open{ + width: 70%; + position: fixed; + top: 10%; + right: 0; + background-color: rgba(255,255,255,.4); + z-index: 200; + overflow-y: scroll; + } + + .top_mobile_open{ + width: 70%; + position: fixed; + bottom: 20%; + right: 0; + background-color: rgba(255,255,255,.4); + z-index: 200; + overflow-y: scroll; + } + + .label_mobile_open{ + width: 80%; + position: fixed; + top: calc(51% - 135px); + right: 0; + background-color: rgba(255,255,255,.4); + z-index: 200; + overflow-y: scroll; + } + + .classify_mobile_open{ + width: 90%; + position: fixed; + top: 70px; + left: 5%; + z-index: 200; + } + + .left1{ + display: block; + position: fixed; + right: 0; + top: 20%; + width: 15px; + background: rgba(238, 44, 44,.8); + color: #fff; + font-size: 16px; + padding: 30px 0; + z-index: 9999; + text-align: center; + } + + .left2{ + display: block; + position: fixed; + right: 0; + bottom: 20%; + width: 15px; + background-color: rgba(165, 51, 225, .8); + color: #fff; + font-size: 16px; + padding: 30px 0; + z-index: 9999; + text-align: center; + } + + .top1{ + display: block; + position: fixed; + width: 40px; + height: 40px; + text-align: center; + left: 25px; + top: 12px; + color: rgba(255,255,255,.8); + background-color: rgba(0,0,0,.1); + border-radius: 50%; + z-index: 500; + } + + .top1:hover{ + background-color: #EE2C2C; + } + + .top1 i{ + line-height: 40px; + font-size: 18px; + } + + #tag_cloud_widget{ + right: 13%; + overflow: initial; + } +} + diff --git a/css/base.css b/css/base.css new file mode 100644 index 0000000..1a606be --- /dev/null +++ b/css/base.css @@ -0,0 +1,541 @@ +* { + padding: 0; + margin: 0; +} + +ul li { + list-style: none; +} + +a, img { + text-decoration: none; + border: none; +} + +label { + display: inline-block; +} + +::selection { + background: #EE2C2C; + color: white; +} + +input::-webkit-input-placeholder { + color: #c9c9c9; + font-size: 12px; +} + +input::placeholder { + color: #c9c9c9; + font-size: 12px; +} + +body{ + background-image: url(http://wx3.sinaimg.cn/large/007aGNoFly1fvzkpbekttj30ev0b1acd.jpg); + background-attachment: fixed; + background-size: cover; + background-repeat: no-repeat; +} + +nav { + width: 100%; + height: 60px; + position: fixed; + top: 0; + background-color: rgba(0, 0, 0, .3); + z-index: 501; +} + +select { + width: 138px; + height: 32px; + font-size: 14px; + line-height: 32px; + border: 1px solid #ddd; + border-radius: 4px; + background-color: #f4f4f4; + box-sizing: border-box; + padding-left: 16px; + margin-left: 10px; + outline: none; +} + +iframe{ + display: none; +} + +.nav { + width: 1000px; + margin: 0 auto; + height: 60px; + line-height: 60px; + text-align: center; +} + +.nav-logo{ + float: left; +} + +.nav-logo h1 { + margin-left: 10px; + font-size: 18px; + color: #ffffff; + float: left; +} + +.nav-logo img { + float: left; + width: 30px; + height: 30px; + margin: 15px 0; +} + +.nav-content { + float: right; +} + +.nav-content ul li { + float: left; + margin-right: 30px; +} + +.nav-content a { + font-size: 12px; + letter-spacing: 1px; + color: #FFFFFF; +} + +.nav-content a:hover { + color: #EE2C2C; +} + +#header{ + overflow: hidden; +} + +menu { + display: block; + width: 40px; + height: 40px; + background-color: rgba(0, 0, 0, .1); + border-radius: 50%; + z-index: 502; + position: fixed; + right: 55px; + top: 12px; + cursor: pointer; +} + +menu span { + display: block; + height: 2px; + width: 26px; + background-color: #ffffff; + line-height: 10px; + margin: 5px auto; +} + +.menu_close span:first-child { + margin-top: 12px; + +} + +.menu_open span:first-child { + margin-top: 18px; + transform: rotate(45deg); + -o-transform: rotate(45deg); + -moz-transform: rotate(45deg); + -ms-transform: rotate(45deg); + -webkit-transform: rotate(45deg); + -webkit-transition: all .5s; + -moz-transition: all .5s; + -ms-transition: all .5s; + -o-transition: all .5s; + transition: all .5s; +} + +.menu_open span:nth-last-of-type(2) { + margin-top: -6px; + -webkit-transform: rotate(-45deg); + -moz-transform: rotate(-45deg); + -ms-transform: rotate(-45deg); + -o-transform: rotate(-45deg); + transform: rotate(-45deg); + -webkit-transition: all .5s; + -moz-transition: all .5s; + -ms-transition: all .5s; + -o-transition: all .5s; + transition: all .5s; +} + +.menu_close span:last-child, .menu_close span:last-child, .menu_close span:nth-last-of-type(2) { + -webkit-transform: rotate(0); + -moz-transform: rotate(0); + -ms-transform: rotate(0); + -o-transform: rotate(0); + transform: rotate(0); + -webkit-transition: all .5s; + -moz-transition: all .5s; + -ms-transition: all .5s; + -o-transition: all .5s; + transition: all .5s; +} + +.menu_open span:last-child { + display: none; +} + +menu:hover { + background-color: #EE2C2C; +} + +.fix_bar { + position: fixed; + right: 15px; + bottom: 15px; + z-index: 999; +} + +.fix_bar li { + width: 50px; + height: 50px; + line-height: 50px; + margin-bottom: 2px; + text-align: center; + cursor: pointer; + font-size: 20px; + background-color: rgba(0, 0, 0, .5); + color: #fff; + border-radius: 2px; + opacity: .95; +} + +.searchBox { + padding: 14px; + background-color: grey; + border-radius: 15px 15px 0 0; +} + +.searchBox input { + display: block; + width: 100%; + height: 40px; + border-radius: 40px; + border: none; + text-align: center; + outline: none; +} + +.searchBox i { + float: right; + position: relative; + right: 16px; + bottom: 28px; + color: rgba(0, 0, 0, .5); + cursor: pointer; +} + +.box_bounceInDown_fixed { + position: fixed; + top: auto; + bottom: 200px; + width: 280px; + margin-top: 0; + -webkit-animation-duration: 1s; + animation-duration: 1s; + -webkit-animation-fill-mode: both; + animation-fill-mode: both; + -webkit-animation-name: bounceInDown; + animation-name: bounceInDown; +} + +.box_bounceInUp_fixed { + position: fixed; + top: auto; + bottom: 200px; + width: 230px; + margin-top: 0; + -webkit-animation-duration: 1s; + animation-duration: 1s; + -webkit-animation-fill-mode: both; + animation-fill-mode: both; + -webkit-animation-name: bounceInUp; + animation-name: bounceInUp; +} + +.about_me { + background-color: rgba(255, 255, 255, 0.9); + padding: 29px 29px 10px 29px; + margin-bottom: 30px; + border-radius: 10px; +} + +.about_me h2, .weChat h2 { + font-size: 22px; + text-align: center; + color: #EE2C2C; +} + +.about_me p { + line-height: 30px; + color: #232328; + font-size: 12px; +} + +.about_me > div > p:first-child { + margin-top: 20px; +} + +.about_me img { + display: block; + margin: auto; + border-radius: 50px; + margin-top: 20px; +} + +.weChat { + background-color: #FFFFFF; + padding-top: 29px; + margin-top: 30px; + opacity: 0.9; + border-radius: 10px; + text-align: center; +} + +.w1000 { + width: 1000px; + margin: 0 auto; + margin-top: 80px; + overflow: hidden; +} + +.w700{ + max-width: 700px; + margin: 70px auto 0 auto; + padding: 30px; + border-radius:4px; + background-color: rgba(255,255,255,.95); +} + +.link img { + float: left; + width: 40px; + height: 40px; + border-radius: 100%; +} + +.link h3 { + text-align: left; + padding: 5px 0 0 5px; + font-size: 16px; + font-weight: normal; + color: #000000; + height: 20px; + line-height: 20px; + display: -webkit-box; + -ms-text-overflow: ellipsis; + text-overflow: ellipsis; + -webkit-box-orient: vertical; + -webkit-line-clamp: 1; + overflow: hidden; +} + +.link p { + height: 56px; + overflow: hidden; + margin-top: 22px; + font-size: 12px; + line-height: 28px; + color: #232328; + display: -webkit-box; + -ms-text-overflow: ellipsis; + text-overflow: ellipsis; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; +} + +#overLay { + width: 100%; + height: 100%; + background-color: rgba(0, 0, 0, 0.5); + position: fixed; + top: 0; + left: 0; + z-index: 198; +} + +#footer { + text-align: center; + padding: 20px; +} + +#footer a { + display: inline-block; + width: 30px; + height: 30px; + background-color: rgba(0, 0, 0, .3); + text-align: center; + line-height: 30px; + text-shadow: 1px 1px 1px rgba(0, 0, 0, .5); + font-size: 14px; + margin-left: 15px; + margin-right: 0; + border-radius: 100%; + text-decoration: none; + color: rgba(255, 255, 255, .7); + -webkit-transition: all .3s; + transition: all .3s; +} + +#footer a:hover { + font-size: 16px; +} + +#footer a:first-child:hover { + background-color: #b952c5; +} + +#footer a:nth-child(2):hover { + background-color: #EE2C2C; +} + +#footer a:nth-child(3):hover { + background-color: #668f20; +} + +#footer a:nth-child(4):hover { + background-color: #06a2c9; +} + +.swal-modal{ + opacity: 0; + pointer-events: none; + background-color: rgba(33, 34, 32, .6); + text-align: center; + border-radius: 5px; + position: static; + margin: 20px auto; + display: inline-block; + vertical-align: middle; + -webkit-transform: scale(1); + transform: scale(1); + -webkit-transform-origin: 50% 50%; + transform-origin: 50% 50%; + z-index: 10001; + transition: opacity .2s,-webkit-transform .3s; + transition: transform .3s,opacity .2s; + transition: transform .3s,opacity .2s,-webkit-transform .3s; +} + +.swal-text:last-child { + margin-bottom: 15px; +} + +.swal-text:first-child { + margin-top: 15px; +} + +.swal-text { + font-size: 14px; + position: relative; + float: none; + line-height: normal; + vertical-align: top; + text-align: left; + display: inline-block; + margin: 0; + padding: 0 10px; + font-weight: 400; + color: rgba(255,255,255,.95); + max-width: calc(100% - 20px); + overflow-wrap: break-word; + box-sizing: border-box; +} + +.w-e-toolbar .w-e-active i{ + color: #EE2C2C !important; +} + +.toolbar { + background-color: #eeeeee; + border: 1px solid #c9c9c9; + font-size: 12px; +} +.text { + border: 1px solid #ccc; + height: 180px; + border-top: none; +} + +input:not([type~="checkbox"]):not([type~="radio"]), textarea, button, .btn { + -webkit-transition:all .2s; + -moz-transition:all .2s; + -ms-transition:all .2s; + -o-transition:all .2s; + transition:all .2s; + border-radius: 3px; + -webkit-appearance: none; +} + +input[type="text"]:focus { + background-color: #fff!important; +} + +.w-e-item img { + width: 78px; + height: 78px; + display: inline-block; + margin: 3px; + padding: 6px; + border-radius: 5px; + background: #EEEEEE; +} + +.w-e-panel-container .w-e-panel-tab-title { + list-style: none; + display: -webkit-box; + display: -ms-flexbox; + display: flex; + font-size: 16px; + margin: 2px 10px 0 10px; + border-bottom: 1px solid #f1f1f1; + box-sizing: border-box; +} + +.w-e-panel-container{ + width: 500px!important; +} + +.w-e-text:focus{ + background-color: rgba(255,255,255,.9); +} + +@media screen and (max-width: 500px){ + + .w1000{ + width: 90%; + } + + menu{ + right: 25px; + } + + nav{ + height: auto; + } + + .nav { + width: 90%; + height: auto; + } + + .nav-content{ + float: none; + text-align: left; + padding-top: 60px; + padding-left: 8px; + } + + +} diff --git a/css/baseArticle.css b/css/baseArticle.css new file mode 100644 index 0000000..e4dc051 --- /dev/null +++ b/css/baseArticle.css @@ -0,0 +1,246 @@ +.article { + width: 1000px; + margin: 0 auto; + overflow: hidden; +} + +.news img { + float: left; + -webkit-transition: all 0.5s; + -moz-transition: all 0.5s; + -ms-transition: all 0.5s; + -o-transition: all 0.5s; + transition: all 0.5s; +} + +.news:hover { + cursor: pointer; +} + +.news img:hover { + -webkit-transform: scale(1.1); + -moz-transform: scale(1.1); + -ms-transform: scale(1.1); + -o-transform: scale(1.1); + transform: scale(1.1); +} + +.news ul li { + float: left; + width: 33.33%; + overflow: hidden; +} + +.news ul li:first-child { + margin-bottom: 30px; +} + +.news ul li:nth-child(2) { + margin-bottom: 30px; +} + +.news ul li:nth-child(3) { + margin-bottom: 30px; +} + +.single_new { + border: 1px solid #e6ebf5; + background-color: rgba(255, 255, 255, 0.73); + box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .05); + border-radius: 4px; + overflow: hidden; + max-width: 270px; + margin: 0 auto; + transform-style: preserve-3d; + transform: rotate(0deg); + -webkit-transform: rotate(0deg); +} + +.single_new:hover .articleImg { + -webkit-transform: scale(1.1); + -moz-transform: scale(1.1); + transform: scale(1.1); + -webkit-filter: blur(3px); + -moz-filter: blur(3px); + filter: blur(3px); +} + +.single_new:hover .archive_content { + -webkit-animation: fade-in .5s; + animation: fade-in .5s; + opacity: 1; +} + +.new { + position: relative; + display: inherit; + overflow: hidden; +} + +.new:before { + content: "Loading..."; + position: absolute; + width: 100%; + left: 0; + text-align: center; + -webkit-transform: translateY(-34%); + -moz-transform: translateY(-34%); + -ms-transform: translateY(-34%); + -o-transform: translateY(-34%); + transform: translateY(-34%); + line-height: 500px; + font-size: 25px; + color: #b7b6b6; + z-index: -1; +} + +.new:after { + content: ""; + background: rgba(0, 0, 0, 0.01); + position: absolute; + top: 0; + bottom: 0; + left: 0; + right: 0; +} + +.articleImg { + display: inherit; + min-height: 160px; + -webkit-transition: -webkit-transform .5s ease, filter .5s ease; + -moz-transition: -moz-transform .5s ease, filter .5s ease; + -o-transition: -o-transform .5s ease, filter .5s ease; + transition: transform .5s ease, filter .5s ease; + background-position: 50% 50%; + background-size: cover; + background-repeat: no-repeat; +} + +.archive_content { + padding: 160px 20px; + position: absolute; + top: 50%; + left: 0; + right: 0; + -webkit-transform: translateY(-50%); + -moz-transform: translateY(-50%); + -ms-transform: translateY(-50%); + -o-transform: translateY(-50%); + transform: translateY(-50%); + background-color: rgba(0, 0, 0, .5); + text-align: left; + color: #fff; + opacity: 0; + font-size: 12px; + line-height: 26px; +} + +.archive_content > span { + display: block; + position: relative; + overflow: hidden; + height: 78px; +} + +.article_other { + padding: 10px 10px 0 10px; + min-height: 75px; + position: relative; +} + +.article_info { + font-size: 12px; + text-decoration: none; + color: #666; + position: absolute; + bottom: 5px; + cursor: default; +} + +.article_info > i:first-child { + margin-right: 3px; +} + +.article_info > i:nth-child(n+2) { + margin-left: 5px; + margin-right: 3px; +} + +.article_title{ + font-size: 18px; + color: #222; + font-weight: 400; + -webkit-font-smoothing: antialiased; + line-height: 1.8; +} + +.article_title > a { + text-decoration: none; + font-size: 14px; + line-height: 22px; + font-weight: normal; + color: #000; + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; + word-break: break-all; +} + +.article > div > div:after { + content: ""; + display: block; + position: absolute; + bottom: -12px; + left: 25px; + width: 0; + height: 1.5px; + background-color: #2D93CA; + -webkit-transition: width .6s; + -moz-transition: width .6s; + -ms-transition: width .6s; + -o-transition: width .6s; + transition: width .6s; +} + +.article > div > div:hover:after { + width: 360px; +} + +@media screen and (max-width: 500px){ + .article{ + width: 90%; + } + + .single_new{ + max-width: 500px; + } + + .news ul li{ + width: 100%; + margin-bottom: 30px; + } +} + +@-webkit-keyframes fade-in { + 0% { + -webkit-transform: translateY(-45%); + opacity: 0 + } + 100% { + -webkit-transform: translateY(-50%); + opacity: 1 + } +} + +@keyframes fade-in { + 0% { + transform: translateY(-45%); + opacity: 0 + } + 100% { + transform: translateY(-50%); + opacity: 1 + } +} diff --git a/css/detail.css b/css/detail.css new file mode 100644 index 0000000..341534b --- /dev/null +++ b/css/detail.css @@ -0,0 +1,1027 @@ + +fieldset { + border: 1px solid #eee; + border-radius: 3px; + padding: 10px 15px; +} + +fieldset > legend { + background-color: #eb5055; + color: #fff; + border-radius: 2px; + padding: 2px 5px; + font-size: 12px; +} + +.article_label { + font-size: 14px; + word-wrap: break-word; + word-break: break-word; + margin: 0; + padding: 15px 0 15px; +} + +.article_label a { + font-size: 13px; + font-weight: 600; + display: inline-block; + margin: 4px 8px 0 0; + padding: 0 15px; + -webkit-transition-duration: .4s; + transition-duration: .4s; + letter-spacing: 0; +} + +.article_label a:nth-child(n) { + color: #fff; + border: 1px solid #b952c5; + border-radius: 15px; + background: #b952c5; +} + +.article_label a:nth-child(2n) { + color: #fff; + border: 1px solid #ff9800; + border-radius: 15px; + background: #ff9800; +} + +.article_label a:nth-child(3n) { + color: #fff; + border: 1px solid #46c47c; + border-radius: 15px; + background: #46c47c; +} + +.article_label a:nth-child(4n) { + color: #fff; + border: 1px solid #6fa3ef; + border-radius: 15px; + background: #6fa3ef; +} + +.article_label a:nth-child(5n) { + color: #fff; + border: 1px solid #EE2C2C; + border-radius: 15px; + background: #EE2C2C; +} + +.article_label a:hover{ + color: #5f5f5f; + border: 1px solid #f7f7f7; + outline-style: none; + background: #f7f7f7; +} + +.detail_info { + font-size: 13px; + color: #a5a5a5; + text-decoration: none; + text-shadow: 0 0 2px #fff; + padding-bottom: 20px; + border-bottom: 1px dashed #c5c5c5; +} + +.detail_info span { + margin-right: 15px; + display: inline-block; +} + +.detail_info span i { + margin: 0 5px 0 5px; +} + +.detail_content { + margin-top: 30px; +} + +.detail_content > div { + margin-top: 30px; +} + +.detail_comment { + margin-top: 70px; +} + +.reply_comment { + margin-top: 10px; +} + +.detail_comment > h3 { + border-left: 4px solid #eb5055; + padding-left: 10px; + font-size: 16px; + display: inline-block; + line-height: 30px; + margin-bottom: 5px; +} + +.detail_comment > form > ul, #reply_form > ul { + margin-top: 20px; + overflow: hidden; +} + +.detail_comment > form > ul > li:first-child, #reply_form > ul > li:first-child { + position: relative; + bottom: 3px; + width: 14%; + text-align: center; +} + +.detail_comment > form > ul > li:last-child, #reply_form > ul > li:last-child { + margin-left: 30px; +} + +.detail_comment > form > ul > li, #reply_form > ul > li { + float: left; + overflow: hidden; + box-sizing: border-box; + padding-right: 30px; + padding-bottom: 10px; +} + +input[type=text] { + width: 100%; + height: 20px; + background: #F7F7F9; + border: 1px solid #D3D3D7; + border-radius: 5px; + font-size: 14px; + color: black; + padding: 6px 8px; + outline: none; +} + +label { + font-size: 12px; + line-height: 20px; + padding-bottom: 5px; + display: block; +} + +.detail_editor { + padding: 10px 0; +} + +.headImg { + background-color: rgba(0, 0, 0, .4); + text-align: center; + width: 250px; + height: 256px; + position: fixed; + top: calc(50% - 130px); + left: calc(50% - 128px); + z-index: 5; +} + +.headImg ul { + overflow: hidden; + padding: 10px; +} + +.headImg ul li { + overflow: hidden; + display: block; + width: 24%; + padding-top: 5px; + float: left; +} + +.headImg ul li img { + border-radius: 50px; + cursor: pointer; + -webkit-transition: all .3s; + -moz-transition: all .3s; + -ms-transition: all .3s; + -o-transition: all .3s; + transition: all .3s; +} + +.headImg ul li img:hover { + transform: scale(1.3); +} + +.close { + position: absolute; + top: 5px; + right: 5px; + cursor: pointer; +} + +.close i { + font-size: 14px; + color: #EE2C2C; + margin-right: 5px; +} + +#commentHeadImage, #replyHeadImage { + z-index: 2; + border-radius: 50px; + cursor: pointer; + -webkit-transition: all .3s; + -moz-transition: all .3s; + -ms-transition: all .3s; + -o-transition: all .3s; + transition: all .3s; +} + +#commentHeadImage:hover, #replyHeadImage:hover { + transform: scale(1.3); +} + +.email_reply, .email_comment { + position: relative; + float: left; + height: 24px; + margin-bottom: 3px; + vertical-align: middle; + cursor: pointer; +} + +.email_comment span, .email_reply span { + position: relative; + font-size: 14px; + margin-left: 10px; + bottom: 6px; + cursor: pointer; +} + +.email_comment:before, .email_reply:before { + display: inline-block; + position: relative; + content: ''; + width: 45px; + height: 24px; + background-color: #D8D8D8; + border-radius: 100px; + transition: background-color .5s; +} + +.email_comment:after, .email_reply:after { + position: absolute; + left: 4px; + top: 4px; + content: ''; + width: 16px; + height: 16px; + border-radius: 50%; + background-color: #fff; + transition: transform 0.3s ease-in; +} + +#email_reply:checked + .email_reply:before { + background-color: #EE2C2C; +} + +#email_reply:checked + .email_reply:after { + transform: translateX(130%); +} + +#email_comment:checked + .email_comment:before { + background-color: #EE2C2C; +} + +#email_comment:checked + .email_comment:after { + transform: translateX(130%); +} + +#email_reply, #email_comment { + display: none; +} + +.commit_comment, .reply_commit { + border-radius: 5px; + color: #FFFFFF; + font-size: 12px; + padding: 2px 20px; + line-height: 25px; + width: auto; + float: right; + background-color: #EE2C2C; + cursor: pointer; +} + +.submit_info { + overflow: hidden; + text-align: center; + vertical-align: middle; +} + +.commentHeadImg { + position: absolute; +} + +.commentHeadImg img { + width: 48px; + height: 48px; + border-radius: 50%; + border: 0; + vertical-align: middle; + user-select: none; +} + +.replyHeadImg { + position: absolute; +} + +.replyHeadImg img { + width: 35px; + height: 35px; + border-radius: 50%; + border: 0; + vertical-align: middle; + user-select: none; +} + +.comment { + margin-left: 75px; +} + +.comment_reply { + margin-left: 50px; +} + +.comment > h3, .comment_reply > h3 { + line-height: 18px; + padding-bottom: 4px; + display: block; + word-wrap: break-word; + text-decoration: none; + font-size: 12px; + font-weight: 700; + color: #6d757a; + cursor: pointer; +} + +.comment > span, .comment_reply > span { + line-height: 25px; + padding: 2px 0; + font-size: 14px; + text-shadow: none; + overflow: hidden; + word-wrap: break-word; + word-break: break-word; +} + +.comment > span img, .comment_reply > span img { + width: 78px; + height: 78px; +} + +.comment > p, .comment_reply > p { + margin-top: 4px; + margin-bottom: 8px; + font-size: 13px; + color: #99a2aa; +} + +.article_comment { + margin-top: 20px; +} + +.reply { + margin-left: 10px; + cursor: pointer; +} + +.reply:hover { + color: #EE2C2C; +} + +.article_reply { + margin-top: 20px; + margin-left: 75px; +} + +.reply_sign { + font-size: 12px; + color: #EE2C2C; +} + +#commentBox > li { + padding-top: 20px; +} + +#commentBox > li:after { + margin-left: 75px; + content: ""; + display: block; + height: 1px; + background-color: #e5e9ef; + margin-top: 20px; +} + +.prise { + user-select: none; + border-top: 1px solid #eee; + border-bottom: 1px solid #eee; + padding: 15px 5px; + margin: 10px 0; + text-align: center; + -webkit-transition: .4s; + -moz-transition: .4s; + -o-transition: .4s; + -ms-transition: .4s; + opacity: .3; +} + +.prise:hover { + opacity: 1; +} + +.prise > div { + display: inline-block; + margin-right: 15px; + padding-left: 35px; + position: relative; + cursor: pointer; +} + +.likeHeart, .likeHeart:before, .likeHeart:after { + background: url(../images/like_heart.png); + background-position: left; + background-repeat: no-repeat; + height: 80px; + width: 80px; + cursor: pointer; + position: absolute; + left: -25px; + top: -30px; + background-size: 2900%; +} + +.like:hover { + background: 0; +} + +.like:hover .likeHeart { + background-position: right; +} + +.like:hover .likeHeart:before { + content: ''; + background-position: right; + position: absolute; + -webkit-animation: i-like 2.13584698s infinite; + animation: i-like 2.13584698s infinite; + z-index: 0; +} + +.like:hover .likeHeart:after { + content: ''; + background-position: right; + position: absolute; + -webkit-animation: i-like 3.141592653s infinite; + animation: i-like 3.141592653s infinite; +} + +.prise i { + font-size: 28px; + position: absolute; + width: 30px; + left: 0; + top: -5px; + color: #aab8c2; +} + +.priseImg { + position: fixed; + display: none; + background-color: #FFFFFF; + padding-top: 10px; + top: calc(50% - 100px); + left: calc(50% - 200px); + -webkit-animation: dance 5s infinite ease-in-out; + animation: dance 5s infinite ease-in-out; +} + +.weChatPay { + float: left; +} + +.aliPay { + float: right; +} + +.pay:hover .priseImg { + display: block; +} + +.pay img { + padding: 10px; +} + +.mobile{ + display: none; +} + +@media screen and (max-width: 500px) { + .w700 { + padding: 20px 10px 0 10px; + } + + .detail_comment > form > ul > li:first-child, #reply_form > ul > li:first-child { + width: 20%; + } + + .detail_comment > form > ul > li, #reply_form > ul > li { + padding-bottom: 0; + width: 40%; + } + + .detail_comment > form > ul > li:last-child, #reply_form > ul > li:last-child { + margin-left: 0; + } + + .article_reply{ + margin-left: 12px; + } + + #commentBox > li:after{ + margin-left: 2px; + } + + .comment .reply_comment{ + margin-left: -75px; + } + + .comment_reply .reply_comment{ + margin-left: -62px; + } + + .w-e-panel-container{ + width: 320px!important; + } + + .priseImg img{ + width: 100px; + height: 100px; + } + + .priseImg{ + top: calc(50% - 50px); + left: calc(50% - 120px); + } + + .mobile{ + display: block; + } + +} + +@-webkit-keyframes i-like { + 0% { + -webkit-transform: translateY(29px); + transform: translateY(29px); + margin-left: 25px + } + 20% { + margin-left: 35px + } + 40% { + margin-left: -6px + } + 60% { + margin-left: 4px + } + 80% { + margin-left: -2px + } + 100% { + opacity: 0; + -webkit-transform: translateY(-50px) rotate(180deg) scale(.5); + transform: translateY(-50px) rotate(180deg) scale(.5) + } +} + +@keyframes i-like { + 0% { + -webkit-transform: translateY(29px); + transform: translateY(29px); + margin-left: 25px + } + 20% { + margin-left: 35px + } + 40% { + margin-left: -6px + } + 60% { + margin-left: 4px + } + 80% { + margin-left: -2px + } + 100% { + opacity: 0; + -webkit-transform: translateY(-50px) rotate(180deg) scale(.5); + transform: translateY(-50px) rotate(180deg) scale(.5) + } +} + +@-webkit-keyframes dance { + 2% { + -webkit-transform: translateY(1.5px) rotate(1.5deg); + transform: translateY(1.5px) rotate(1.5deg) + } + 4% { + -webkit-transform: translateY(-1.5px) rotate(-.5deg); + transform: translateY(-1.5px) rotate(-.5deg) + } + 6% { + -webkit-transform: translateY(1.5px) rotate(-1.5deg); + transform: translateY(1.5px) rotate(-1.5deg) + } + 8% { + -webkit-transform: translateY(-1.5px) rotate(-1.5deg); + transform: translateY(-1.5px) rotate(-1.5deg) + } + 10% { + -webkit-transform: translateY(2.5px) rotate(1.5deg); + transform: translateY(2.5px) rotate(1.5deg) + } + 12% { + -webkit-transform: translateY(-.5px) rotate(1.5deg); + transform: translateY(-.5px) rotate(1.5deg) + } + 14% { + -webkit-transform: translateY(-1.5px) rotate(1.5deg); + transform: translateY(-1.5px) rotate(1.5deg) + } + 16% { + -webkit-transform: translateY(-.5px) rotate(-1.5deg); + transform: translateY(-.5px) rotate(-1.5deg) + } + 18% { + -webkit-transform: translateY(.5px) rotate(-1.5deg); + transform: translateY(.5px) rotate(-1.5deg) + } + 20% { + -webkit-transform: translateY(-1.5px) rotate(2.5deg); + transform: translateY(-1.5px) rotate(2.5deg) + } + 22% { + -webkit-transform: translateY(.5px) rotate(-1.5deg); + transform: translateY(.5px) rotate(-1.5deg) + } + 24% { + -webkit-transform: translateY(1.5px) rotate(1.5deg); + transform: translateY(1.5px) rotate(1.5deg) + } + 26% { + -webkit-transform: translateY(.5px) rotate(.5deg); + transform: translateY(.5px) rotate(.5deg) + } + 28% { + -webkit-transform: translateY(.5px) rotate(1.5deg); + transform: translateY(.5px) rotate(1.5deg) + } + 30% { + -webkit-transform: translateY(-.5px) rotate(2.5deg); + transform: translateY(-.5px) rotate(2.5deg) + } + 32% { + -webkit-transform: translateY(1.5px) rotate(-.5deg); + transform: translateY(1.5px) rotate(-.5deg) + } + 34% { + -webkit-transform: translateY(1.5px) rotate(-.5deg); + transform: translateY(1.5px) rotate(-.5deg) + } + 36% { + -webkit-transform: translateY(-1.5px) rotate(2.5deg); + transform: translateY(-1.5px) rotate(2.5deg) + } + 38% { + -webkit-transform: translateY(1.5px) rotate(-1.5deg); + transform: translateY(1.5px) rotate(-1.5deg) + } + 40% { + -webkit-transform: translateY(-.5px) rotate(2.5deg); + transform: translateY(-.5px) rotate(2.5deg) + } + 42% { + -webkit-transform: translateY(2.5px) rotate(-1.5deg); + transform: translateY(2.5px) rotate(-1.5deg) + } + 44% { + -webkit-transform: translateY(1.5px) rotate(.5deg); + transform: translateY(1.5px) rotate(.5deg) + } + 46% { + -webkit-transform: translateY(-1.5px) rotate(2.5deg); + transform: translateY(-1.5px) rotate(2.5deg) + } + 48% { + -webkit-transform: translateY(-.5px) rotate(.5deg); + transform: translateY(-.5px) rotate(.5deg) + } + 50% { + -webkit-transform: translateY(.5px) rotate(.5deg); + transform: translateY(.5px) rotate(.5deg) + } + 52% { + -webkit-transform: translateY(2.5px) rotate(2.5deg); + transform: translateY(2.5px) rotate(2.5deg) + } + 54% { + -webkit-transform: translateY(-1.5px) rotate(1.5deg); + transform: translateY(-1.5px) rotate(1.5deg) + } + 56% { + -webkit-transform: translateY(2.5px) rotate(2.5deg); + transform: translateY(2.5px) rotate(2.5deg) + } + 58% { + -webkit-transform: translateY(.5px) rotate(2.5deg); + transform: translateY(.5px) rotate(2.5deg) + } + 60% { + -webkit-transform: translateY(2.5px) rotate(2.5deg); + transform: translateY(2.5px) rotate(2.5deg) + } + 62% { + -webkit-transform: translateY(-.5px) rotate(2.5deg); + transform: translateY(-.5px) rotate(2.5deg) + } + 64% { + -webkit-transform: translateY(-.5px) rotate(1.5deg); + transform: translateY(-.5px) rotate(1.5deg) + } + 66% { + -webkit-transform: translateY(1.5px) rotate(-.5deg); + transform: translateY(1.5px) rotate(-.5deg) + } + 68% { + -webkit-transform: translateY(-1.5px) rotate(-.5deg); + transform: translateY(-1.5px) rotate(-.5deg) + } + 70% { + -webkit-transform: translateY(1.5px) rotate(.5deg); + transform: translateY(1.5px) rotate(.5deg) + } + 72% { + -webkit-transform: translateY(2.5px) rotate(1.5deg); + transform: translateY(2.5px) rotate(1.5deg) + } + 74% { + -webkit-transform: translateY(-.5px) rotate(.5deg); + transform: translateY(-.5px) rotate(.5deg) + } + 76% { + -webkit-transform: translateY(-.5px) rotate(2.5deg); + transform: translateY(-.5px) rotate(2.5deg) + } + 78% { + -webkit-transform: translateY(-.5px) rotate(1.5deg); + transform: translateY(-.5px) rotate(1.5deg) + } + 80% { + -webkit-transform: translateY(1.5px) rotate(1.5deg); + transform: translateY(1.5px) rotate(1.5deg) + } + 82% { + -webkit-transform: translateY(-.5px) rotate(.5deg); + transform: translateY(-.5px) rotate(.5deg) + } + 84% { + -webkit-transform: translateY(1.5px) rotate(2.5deg); + transform: translateY(1.5px) rotate(2.5deg) + } + 86% { + -webkit-transform: translateY(-1.5px) rotate(-1.5deg); + transform: translateY(-1.5px) rotate(-1.5deg) + } + 88% { + -webkit-transform: translateY(-.5px) rotate(2.5deg); + transform: translateY(-.5px) rotate(2.5deg) + } + 90% { + -webkit-transform: translateY(2.5px) rotate(-.5deg); + transform: translateY(2.5px) rotate(-.5deg) + } + 92% { + -webkit-transform: translateY(.5px) rotate(-.5deg); + transform: translateY(.5px) rotate(-.5deg) + } + 94% { + -webkit-transform: translateY(2.5px) rotate(.5deg); + transform: translateY(2.5px) rotate(.5deg) + } + 96% { + -webkit-transform: translateY(-.5px) rotate(1.5deg); + transform: translateY(-.5px) rotate(1.5deg) + } + 98% { + -webkit-transform: translateY(-1.5px) rotate(-.5deg); + transform: translateY(-1.5px) rotate(-.5deg) + } + 0%, to { + -webkit-transform: translate(0) rotate(0deg); + transform: translate(0) rotate(0deg) + } +} + +@keyframes dance { + 2% { + -webkit-transform: translateY(1.5px) rotate(1.5deg); + transform: translateY(1.5px) rotate(1.5deg) + } + 4% { + -webkit-transform: translateY(-1.5px) rotate(-.5deg); + transform: translateY(-1.5px) rotate(-.5deg) + } + 6% { + -webkit-transform: translateY(1.5px) rotate(-1.5deg); + transform: translateY(1.5px) rotate(-1.5deg) + } + 8% { + -webkit-transform: translateY(-1.5px) rotate(-1.5deg); + transform: translateY(-1.5px) rotate(-1.5deg) + } + 10% { + -webkit-transform: translateY(2.5px) rotate(1.5deg); + transform: translateY(2.5px) rotate(1.5deg) + } + 12% { + -webkit-transform: translateY(-.5px) rotate(1.5deg); + transform: translateY(-.5px) rotate(1.5deg) + } + 14% { + -webkit-transform: translateY(-1.5px) rotate(1.5deg); + transform: translateY(-1.5px) rotate(1.5deg) + } + 16% { + -webkit-transform: translateY(-.5px) rotate(-1.5deg); + transform: translateY(-.5px) rotate(-1.5deg) + } + 18% { + -webkit-transform: translateY(.5px) rotate(-1.5deg); + transform: translateY(.5px) rotate(-1.5deg) + } + 20% { + -webkit-transform: translateY(-1.5px) rotate(2.5deg); + transform: translateY(-1.5px) rotate(2.5deg) + } + 22% { + -webkit-transform: translateY(.5px) rotate(-1.5deg); + transform: translateY(.5px) rotate(-1.5deg) + } + 24% { + -webkit-transform: translateY(1.5px) rotate(1.5deg); + transform: translateY(1.5px) rotate(1.5deg) + } + 26% { + -webkit-transform: translateY(.5px) rotate(.5deg); + transform: translateY(.5px) rotate(.5deg) + } + 28% { + -webkit-transform: translateY(.5px) rotate(1.5deg); + transform: translateY(.5px) rotate(1.5deg) + } + 30% { + -webkit-transform: translateY(-.5px) rotate(2.5deg); + transform: translateY(-.5px) rotate(2.5deg) + } + 32% { + -webkit-transform: translateY(1.5px) rotate(-.5deg); + transform: translateY(1.5px) rotate(-.5deg) + } + 34% { + -webkit-transform: translateY(1.5px) rotate(-.5deg); + transform: translateY(1.5px) rotate(-.5deg) + } + 36% { + -webkit-transform: translateY(-1.5px) rotate(2.5deg); + transform: translateY(-1.5px) rotate(2.5deg) + } + 38% { + -webkit-transform: translateY(1.5px) rotate(-1.5deg); + transform: translateY(1.5px) rotate(-1.5deg) + } + 40% { + -webkit-transform: translateY(-.5px) rotate(2.5deg); + transform: translateY(-.5px) rotate(2.5deg) + } + 42% { + -webkit-transform: translateY(2.5px) rotate(-1.5deg); + transform: translateY(2.5px) rotate(-1.5deg) + } + 44% { + -webkit-transform: translateY(1.5px) rotate(.5deg); + transform: translateY(1.5px) rotate(.5deg) + } + 46% { + -webkit-transform: translateY(-1.5px) rotate(2.5deg); + transform: translateY(-1.5px) rotate(2.5deg) + } + 48% { + -webkit-transform: translateY(-.5px) rotate(.5deg); + transform: translateY(-.5px) rotate(.5deg) + } + 50% { + -webkit-transform: translateY(.5px) rotate(.5deg); + transform: translateY(.5px) rotate(.5deg) + } + 52% { + -webkit-transform: translateY(2.5px) rotate(2.5deg); + transform: translateY(2.5px) rotate(2.5deg) + } + 54% { + -webkit-transform: translateY(-1.5px) rotate(1.5deg); + transform: translateY(-1.5px) rotate(1.5deg) + } + 56% { + -webkit-transform: translateY(2.5px) rotate(2.5deg); + transform: translateY(2.5px) rotate(2.5deg) + } + 58% { + -webkit-transform: translateY(.5px) rotate(2.5deg); + transform: translateY(.5px) rotate(2.5deg) + } + 60% { + -webkit-transform: translateY(2.5px) rotate(2.5deg); + transform: translateY(2.5px) rotate(2.5deg) + } + 62% { + -webkit-transform: translateY(-.5px) rotate(2.5deg); + transform: translateY(-.5px) rotate(2.5deg) + } + 64% { + -webkit-transform: translateY(-.5px) rotate(1.5deg); + transform: translateY(-.5px) rotate(1.5deg) + } + 66% { + -webkit-transform: translateY(1.5px) rotate(-.5deg); + transform: translateY(1.5px) rotate(-.5deg) + } + 68% { + -webkit-transform: translateY(-1.5px) rotate(-.5deg); + transform: translateY(-1.5px) rotate(-.5deg) + } + 70% { + -webkit-transform: translateY(1.5px) rotate(.5deg); + transform: translateY(1.5px) rotate(.5deg) + } + 72% { + -webkit-transform: translateY(2.5px) rotate(1.5deg); + transform: translateY(2.5px) rotate(1.5deg) + } + 74% { + -webkit-transform: translateY(-.5px) rotate(.5deg); + transform: translateY(-.5px) rotate(.5deg) + } + 76% { + -webkit-transform: translateY(-.5px) rotate(2.5deg); + transform: translateY(-.5px) rotate(2.5deg) + } + 78% { + -webkit-transform: translateY(-.5px) rotate(1.5deg); + transform: translateY(-.5px) rotate(1.5deg) + } + 80% { + -webkit-transform: translateY(1.5px) rotate(1.5deg); + transform: translateY(1.5px) rotate(1.5deg) + } + 82% { + -webkit-transform: translateY(-.5px) rotate(.5deg); + transform: translateY(-.5px) rotate(.5deg) + } + 84% { + -webkit-transform: translateY(1.5px) rotate(2.5deg); + transform: translateY(1.5px) rotate(2.5deg) + } + 86% { + -webkit-transform: translateY(-1.5px) rotate(-1.5deg); + transform: translateY(-1.5px) rotate(-1.5deg) + } + 88% { + -webkit-transform: translateY(-.5px) rotate(2.5deg); + transform: translateY(-.5px) rotate(2.5deg) + } + 90% { + -webkit-transform: translateY(2.5px) rotate(-.5deg); + transform: translateY(2.5px) rotate(-.5deg) + } + 92% { + -webkit-transform: translateY(.5px) rotate(-.5deg); + transform: translateY(.5px) rotate(-.5deg) + } + 94% { + -webkit-transform: translateY(2.5px) rotate(.5deg); + transform: translateY(2.5px) rotate(.5deg) + } + 96% { + -webkit-transform: translateY(-.5px) rotate(1.5deg); + transform: translateY(-.5px) rotate(1.5deg) + } + 98% { + -webkit-transform: translateY(-1.5px) rotate(-.5deg); + transform: translateY(-1.5px) rotate(-.5deg) + } + 0%, to { + -webkit-transform: translate(0) rotate(0deg); + transform: translate(0) rotate(0deg) + } +} diff --git a/css/detail.css.bak b/css/detail.css.bak new file mode 100644 index 0000000..d97d9f4 --- /dev/null +++ b/css/detail.css.bak @@ -0,0 +1,1028 @@ + +fieldset { + border: 1px solid #eee; + border-radius: 3px; + padding: 10px 15px; +} + +fieldset > legend { + background-color: #eb5055; + color: #fff; + border-radius: 2px; + padding: 2px 5px; + font-size: 12px; +} + +.article_label { + font-size: 14px; + word-wrap: break-word; + word-break: break-word; + margin: 0; + padding: 15px 0 15px; +} + +.article_label a { + font-size: 13px; + font-weight: 600; + display: inline-block; + margin: 4px 8px 0 0; + padding: 0 15px; + -webkit-transition-duration: .4s; + transition-duration: .4s; + letter-spacing: 0; +} + +.article_label a:nth-child(n) { + color: #fff; + border: 1px solid #b952c5; + border-radius: 15px; + background: #b952c5; +} + +.article_label a:nth-child(2n) { + color: #fff; + border: 1px solid #ff9800; + border-radius: 15px; + background: #ff9800; +} + +.article_label a:nth-child(3n) { + color: #fff; + border: 1px solid #46c47c; + border-radius: 15px; + background: #46c47c; +} + +.article_label a:nth-child(4n) { + color: #fff; + border: 1px solid #6fa3ef; + border-radius: 15px; + background: #6fa3ef; +} + +.article_label a:nth-child(5n) { + color: #fff; + border: 1px solid #EE2C2C; + border-radius: 15px; + background: #EE2C2C; +} + +.article_label a:hover{ + color: #5f5f5f; + border: 1px solid #f7f7f7; + outline-style: none; + background: #f7f7f7; +} + +.detail_info { + font-size: 13px; + color: #a5a5a5; + text-decoration: none; + text-shadow: 0 0 2px #fff; + padding-bottom: 20px; + border-bottom: 1px dashed #c5c5c5; +} + +.detail_info span { + margin-right: 15px; + display: inline-block; +} + +.detail_info span i { + margin: 0 5px 0 5px; +} + +.detail_content { + margin-top: 30px; +} + +.detail_content > div { + margin-top: 30px; +} + +.detail_comment { + margin-top: 70px; +} + +.reply_comment { + margin-top: 10px; +} + +.detail_comment > h3 { + border-left: 4px solid #eb5055; + padding-left: 10px; + font-size: 16px; + display: inline-block; + line-height: 30px; + margin-bottom: 5px; +} + +.detail_comment > form > ul, #reply_form > ul { + margin-top: 20px; + overflow: hidden; +} + +.detail_comment > form > ul > li:first-child, #reply_form > ul > li:first-child { + position: relative; + bottom: 3px; + width: 14%; + text-align: center; +} + +.detail_comment > form > ul > li:last-child, #reply_form > ul > li:last-child { + margin-left: 30px; +} + +.detail_comment > form > ul > li, #reply_form > ul > li { + float: left; + overflow: hidden; + box-sizing: border-box; + padding-right: 30px; + padding-bottom: 10px; +} + +input[type=text] { + width: 100%; + height: 20px; + background: #F7F7F9; + border: 1px solid #D3D3D7; + border-radius: 5px; + font-size: 14px; + color: black; + padding: 6px 8px; + outline: none; +} + +label { + font-size: 12px; + line-height: 20px; + padding-bottom: 5px; + display: block; +} + +.detail_editor { + padding: 10px 0; +} + +.headImg { + background-color: rgba(0, 0, 0, .4); + text-align: center; + width: 250px; + height: 256px; + position: fixed; + top: calc(50% - 130px); + left: calc(50% - 128px); + z-index: 5; +} + +.headImg ul { + overflow: hidden; + padding: 10px; +} + +.headImg ul li { + overflow: hidden; + display: block; + width: 24%; + padding-top: 5px; + float: left; +} + +.headImg ul li img { + border-radius: 50px; + cursor: pointer; + -webkit-transition: all .3s; + -moz-transition: all .3s; + -ms-transition: all .3s; + -o-transition: all .3s; + transition: all .3s; +} + +.headImg ul li img:hover { + transform: scale(1.3); +} + +.close { + position: absolute; + top: 5px; + right: 5px; + cursor: pointer; +} + +.close i { + font-size: 14px; + color: #EE2C2C; + margin-right: 5px; +} + +#commentHeadImage, #replyHeadImage { + z-index: 2; + border-radius: 50px; + cursor: pointer; + -webkit-transition: all .3s; + -moz-transition: all .3s; + -ms-transition: all .3s; + -o-transition: all .3s; + transition: all .3s; +} + +#commentHeadImage:hover, #replyHeadImage:hover { + transform: scale(1.3); +} + +.email_reply, .email_comment { + position: relative; + float: left; + height: 24px; + margin-bottom: 3px; + vertical-align: middle; + cursor: pointer; +} + +.email_comment span, .email_reply span { + position: relative; + font-size: 14px; + margin-left: 10px; + bottom: 6px; + cursor: pointer; +} + +.email_comment:before, .email_reply:before { + display: inline-block; + position: relative; + content: ''; + width: 45px; + height: 24px; + background-color: #D8D8D8; + border-radius: 100px; + transition: background-color .5s; +} + +.email_comment:after, .email_reply:after { + position: absolute; + left: 4px; + top: 4px; + content: ''; + width: 16px; + height: 16px; + border-radius: 50%; + background-color: #fff; + transition: transform 0.3s ease-in; +} + +#email_reply:checked + .email_reply:before { + background-color: #EE2C2C; +} + +#email_reply:checked + .email_reply:after { + transform: translateX(130%); +} + +#email_comment:checked + .email_comment:before { + background-color: #EE2C2C; +} + +#email_comment:checked + .email_comment:after { + transform: translateX(130%); +} + +#email_reply, #email_comment { + display: none; +} + +.commit_comment, .reply_commit { + border-radius: 5px; + color: #FFFFFF; + font-size: 12px; + padding: 2px 20px; + line-height: 25px; + width: auto; + float: right; + background-color: #EE2C2C; + cursor: pointer; +} + +.submit_info { + overflow: hidden; + text-align: center; + vertical-align: middle; +} + +.commentHeadImg { + position: absolute; +} + +.commentHeadImg img { + width: 48px; + height: 48px; + border-radius: 50%; + border: 0; + vertical-align: middle; + user-select: none; +} + +.replyHeadImg { + position: absolute; +} + +.replyHeadImg img { + width: 35px; + height: 35px; + border-radius: 50%; + border: 0; + vertical-align: middle; + user-select: none; +} + +.comment { + margin-left: 75px; +} + +.comment_reply { + margin-left: 50px; +} + +.comment > h3, .comment_reply > h3 { + line-height: 18px; + padding-bottom: 4px; + display: block; + word-wrap: break-word; + text-decoration: none; + font-size: 12px; + font-weight: 700; + color: #6d757a; + cursor: pointer; +} + +.comment > span, .comment_reply > span { + line-height: 25px; + padding: 2px 0; + font-size: 14px; + text-shadow: none; + overflow: hidden; + word-wrap: break-word; + word-break: break-word; +} + +.comment > span img, .comment_reply > span img { + width: 78px; + height: 78px; +} + +.comment > p, .comment_reply > p { + margin-top: 4px; + margin-bottom: 8px; + font-size: 13px; + color: #99a2aa; +} + +.article_comment { + margin-top: 20px; +} + +.reply { + margin-left: 10px; + cursor: pointer; +} + +.reply:hover { + color: #EE2C2C; +} + +.article_reply { + margin-top: 20px; + margin-left: 75px; +} + +.reply_sign { + font-size: 12px; + color: #EE2C2C; +} + +#commentBox > li { + padding-top: 20px; +} + +#commentBox > li:after { + margin-left: 75px; + content: ""; + display: block; + height: 1px; + background-color: #e5e9ef; + margin-top: 20px; +} + +.prise { + user-select: none; + border-top: 1px solid #eee; + border-bottom: 1px solid #eee; + padding: 15px 5px; + margin: 10px 0; + text-align: center; + -webkit-transition: .4s; + -moz-transition: .4s; + -o-transition: .4s; + -ms-transition: .4s; + opacity: .3; +} + +.prise:hover { + opacity: 1; +} + +.prise > div { + display: inline-block; + margin-right: 15px; + padding-left: 35px; + position: relative; + cursor: pointer; +} + +.likeHeart, .likeHeart:before, .likeHeart:after { + background: url(../images/like_heart.png); + background-position: left; + background-repeat: no-repeat; + height: 80px; + width: 80px; + cursor: pointer; + position: absolute; + left: -25px; + top: -30px; + background-size: 2900%; +} + +.like:hover { + background: 0; +} + +.like:hover .likeHeart { + background-position: right; +} + +.like:hover .likeHeart:before { + content: ''; + background-position: right; + position: absolute; + -webkit-animation: i-like 2.13584698s infinite; + animation: i-like 2.13584698s infinite; + z-index: 0; +} + +.like:hover .likeHeart:after { + content: ''; + background-position: right; + position: absolute; + -webkit-animation: i-like 3.141592653s infinite; + animation: i-like 3.141592653s infinite; +} + +.prise i { + font-size: 28px; + position: absolute; + width: 30px; + left: 0; + top: -5px; + color: #aab8c2; +} + +.priseImg { + position: fixed; + display: none; + background-color: #FFFFFF; + padding-top: 10px; + top: calc(50% - 100px); + left: calc(50% - 200px); + -webkit-animation: dance 5s infinite ease-in-out; + animation: dance 5s infinite ease-in-out; +} + +.weChatPay { + float: left; +} + +.aliPay { + float: right; +} + +.pay:hover .priseImg { + display: block; +} + +.pay img { + padding: 10px; +} + +.mobile{ + display: none; +} + +@media screen and (max-width: 500px) { + .w700 { + width: 90%; + padding: 20px 10px 0 10px; + } + + .detail_comment > form > ul > li:first-child, #reply_form > ul > li:first-child { + width: 20%; + } + + .detail_comment > form > ul > li, #reply_form > ul > li { + padding-bottom: 0; + width: 40%; + } + + .detail_comment > form > ul > li:last-child, #reply_form > ul > li:last-child { + margin-left: 0; + } + + .article_reply{ + margin-left: 12px; + } + + #commentBox > li:after{ + margin-left: 2px; + } + + .comment .reply_comment{ + margin-left: -75px; + } + + .comment_reply .reply_comment{ + margin-left: -62px; + } + + .w-e-panel-container{ + width: 320px!important; + } + + .priseImg img{ + width: 100px; + height: 100px; + } + + .priseImg{ + top: calc(50% - 50px); + left: calc(50% - 120px); + } + + .mobile{ + display: block; + } + +} + +@-webkit-keyframes i-like { + 0% { + -webkit-transform: translateY(29px); + transform: translateY(29px); + margin-left: 25px + } + 20% { + margin-left: 35px + } + 40% { + margin-left: -6px + } + 60% { + margin-left: 4px + } + 80% { + margin-left: -2px + } + 100% { + opacity: 0; + -webkit-transform: translateY(-50px) rotate(180deg) scale(.5); + transform: translateY(-50px) rotate(180deg) scale(.5) + } +} + +@keyframes i-like { + 0% { + -webkit-transform: translateY(29px); + transform: translateY(29px); + margin-left: 25px + } + 20% { + margin-left: 35px + } + 40% { + margin-left: -6px + } + 60% { + margin-left: 4px + } + 80% { + margin-left: -2px + } + 100% { + opacity: 0; + -webkit-transform: translateY(-50px) rotate(180deg) scale(.5); + transform: translateY(-50px) rotate(180deg) scale(.5) + } +} + +@-webkit-keyframes dance { + 2% { + -webkit-transform: translateY(1.5px) rotate(1.5deg); + transform: translateY(1.5px) rotate(1.5deg) + } + 4% { + -webkit-transform: translateY(-1.5px) rotate(-.5deg); + transform: translateY(-1.5px) rotate(-.5deg) + } + 6% { + -webkit-transform: translateY(1.5px) rotate(-1.5deg); + transform: translateY(1.5px) rotate(-1.5deg) + } + 8% { + -webkit-transform: translateY(-1.5px) rotate(-1.5deg); + transform: translateY(-1.5px) rotate(-1.5deg) + } + 10% { + -webkit-transform: translateY(2.5px) rotate(1.5deg); + transform: translateY(2.5px) rotate(1.5deg) + } + 12% { + -webkit-transform: translateY(-.5px) rotate(1.5deg); + transform: translateY(-.5px) rotate(1.5deg) + } + 14% { + -webkit-transform: translateY(-1.5px) rotate(1.5deg); + transform: translateY(-1.5px) rotate(1.5deg) + } + 16% { + -webkit-transform: translateY(-.5px) rotate(-1.5deg); + transform: translateY(-.5px) rotate(-1.5deg) + } + 18% { + -webkit-transform: translateY(.5px) rotate(-1.5deg); + transform: translateY(.5px) rotate(-1.5deg) + } + 20% { + -webkit-transform: translateY(-1.5px) rotate(2.5deg); + transform: translateY(-1.5px) rotate(2.5deg) + } + 22% { + -webkit-transform: translateY(.5px) rotate(-1.5deg); + transform: translateY(.5px) rotate(-1.5deg) + } + 24% { + -webkit-transform: translateY(1.5px) rotate(1.5deg); + transform: translateY(1.5px) rotate(1.5deg) + } + 26% { + -webkit-transform: translateY(.5px) rotate(.5deg); + transform: translateY(.5px) rotate(.5deg) + } + 28% { + -webkit-transform: translateY(.5px) rotate(1.5deg); + transform: translateY(.5px) rotate(1.5deg) + } + 30% { + -webkit-transform: translateY(-.5px) rotate(2.5deg); + transform: translateY(-.5px) rotate(2.5deg) + } + 32% { + -webkit-transform: translateY(1.5px) rotate(-.5deg); + transform: translateY(1.5px) rotate(-.5deg) + } + 34% { + -webkit-transform: translateY(1.5px) rotate(-.5deg); + transform: translateY(1.5px) rotate(-.5deg) + } + 36% { + -webkit-transform: translateY(-1.5px) rotate(2.5deg); + transform: translateY(-1.5px) rotate(2.5deg) + } + 38% { + -webkit-transform: translateY(1.5px) rotate(-1.5deg); + transform: translateY(1.5px) rotate(-1.5deg) + } + 40% { + -webkit-transform: translateY(-.5px) rotate(2.5deg); + transform: translateY(-.5px) rotate(2.5deg) + } + 42% { + -webkit-transform: translateY(2.5px) rotate(-1.5deg); + transform: translateY(2.5px) rotate(-1.5deg) + } + 44% { + -webkit-transform: translateY(1.5px) rotate(.5deg); + transform: translateY(1.5px) rotate(.5deg) + } + 46% { + -webkit-transform: translateY(-1.5px) rotate(2.5deg); + transform: translateY(-1.5px) rotate(2.5deg) + } + 48% { + -webkit-transform: translateY(-.5px) rotate(.5deg); + transform: translateY(-.5px) rotate(.5deg) + } + 50% { + -webkit-transform: translateY(.5px) rotate(.5deg); + transform: translateY(.5px) rotate(.5deg) + } + 52% { + -webkit-transform: translateY(2.5px) rotate(2.5deg); + transform: translateY(2.5px) rotate(2.5deg) + } + 54% { + -webkit-transform: translateY(-1.5px) rotate(1.5deg); + transform: translateY(-1.5px) rotate(1.5deg) + } + 56% { + -webkit-transform: translateY(2.5px) rotate(2.5deg); + transform: translateY(2.5px) rotate(2.5deg) + } + 58% { + -webkit-transform: translateY(.5px) rotate(2.5deg); + transform: translateY(.5px) rotate(2.5deg) + } + 60% { + -webkit-transform: translateY(2.5px) rotate(2.5deg); + transform: translateY(2.5px) rotate(2.5deg) + } + 62% { + -webkit-transform: translateY(-.5px) rotate(2.5deg); + transform: translateY(-.5px) rotate(2.5deg) + } + 64% { + -webkit-transform: translateY(-.5px) rotate(1.5deg); + transform: translateY(-.5px) rotate(1.5deg) + } + 66% { + -webkit-transform: translateY(1.5px) rotate(-.5deg); + transform: translateY(1.5px) rotate(-.5deg) + } + 68% { + -webkit-transform: translateY(-1.5px) rotate(-.5deg); + transform: translateY(-1.5px) rotate(-.5deg) + } + 70% { + -webkit-transform: translateY(1.5px) rotate(.5deg); + transform: translateY(1.5px) rotate(.5deg) + } + 72% { + -webkit-transform: translateY(2.5px) rotate(1.5deg); + transform: translateY(2.5px) rotate(1.5deg) + } + 74% { + -webkit-transform: translateY(-.5px) rotate(.5deg); + transform: translateY(-.5px) rotate(.5deg) + } + 76% { + -webkit-transform: translateY(-.5px) rotate(2.5deg); + transform: translateY(-.5px) rotate(2.5deg) + } + 78% { + -webkit-transform: translateY(-.5px) rotate(1.5deg); + transform: translateY(-.5px) rotate(1.5deg) + } + 80% { + -webkit-transform: translateY(1.5px) rotate(1.5deg); + transform: translateY(1.5px) rotate(1.5deg) + } + 82% { + -webkit-transform: translateY(-.5px) rotate(.5deg); + transform: translateY(-.5px) rotate(.5deg) + } + 84% { + -webkit-transform: translateY(1.5px) rotate(2.5deg); + transform: translateY(1.5px) rotate(2.5deg) + } + 86% { + -webkit-transform: translateY(-1.5px) rotate(-1.5deg); + transform: translateY(-1.5px) rotate(-1.5deg) + } + 88% { + -webkit-transform: translateY(-.5px) rotate(2.5deg); + transform: translateY(-.5px) rotate(2.5deg) + } + 90% { + -webkit-transform: translateY(2.5px) rotate(-.5deg); + transform: translateY(2.5px) rotate(-.5deg) + } + 92% { + -webkit-transform: translateY(.5px) rotate(-.5deg); + transform: translateY(.5px) rotate(-.5deg) + } + 94% { + -webkit-transform: translateY(2.5px) rotate(.5deg); + transform: translateY(2.5px) rotate(.5deg) + } + 96% { + -webkit-transform: translateY(-.5px) rotate(1.5deg); + transform: translateY(-.5px) rotate(1.5deg) + } + 98% { + -webkit-transform: translateY(-1.5px) rotate(-.5deg); + transform: translateY(-1.5px) rotate(-.5deg) + } + 0%, to { + -webkit-transform: translate(0) rotate(0deg); + transform: translate(0) rotate(0deg) + } +} + +@keyframes dance { + 2% { + -webkit-transform: translateY(1.5px) rotate(1.5deg); + transform: translateY(1.5px) rotate(1.5deg) + } + 4% { + -webkit-transform: translateY(-1.5px) rotate(-.5deg); + transform: translateY(-1.5px) rotate(-.5deg) + } + 6% { + -webkit-transform: translateY(1.5px) rotate(-1.5deg); + transform: translateY(1.5px) rotate(-1.5deg) + } + 8% { + -webkit-transform: translateY(-1.5px) rotate(-1.5deg); + transform: translateY(-1.5px) rotate(-1.5deg) + } + 10% { + -webkit-transform: translateY(2.5px) rotate(1.5deg); + transform: translateY(2.5px) rotate(1.5deg) + } + 12% { + -webkit-transform: translateY(-.5px) rotate(1.5deg); + transform: translateY(-.5px) rotate(1.5deg) + } + 14% { + -webkit-transform: translateY(-1.5px) rotate(1.5deg); + transform: translateY(-1.5px) rotate(1.5deg) + } + 16% { + -webkit-transform: translateY(-.5px) rotate(-1.5deg); + transform: translateY(-.5px) rotate(-1.5deg) + } + 18% { + -webkit-transform: translateY(.5px) rotate(-1.5deg); + transform: translateY(.5px) rotate(-1.5deg) + } + 20% { + -webkit-transform: translateY(-1.5px) rotate(2.5deg); + transform: translateY(-1.5px) rotate(2.5deg) + } + 22% { + -webkit-transform: translateY(.5px) rotate(-1.5deg); + transform: translateY(.5px) rotate(-1.5deg) + } + 24% { + -webkit-transform: translateY(1.5px) rotate(1.5deg); + transform: translateY(1.5px) rotate(1.5deg) + } + 26% { + -webkit-transform: translateY(.5px) rotate(.5deg); + transform: translateY(.5px) rotate(.5deg) + } + 28% { + -webkit-transform: translateY(.5px) rotate(1.5deg); + transform: translateY(.5px) rotate(1.5deg) + } + 30% { + -webkit-transform: translateY(-.5px) rotate(2.5deg); + transform: translateY(-.5px) rotate(2.5deg) + } + 32% { + -webkit-transform: translateY(1.5px) rotate(-.5deg); + transform: translateY(1.5px) rotate(-.5deg) + } + 34% { + -webkit-transform: translateY(1.5px) rotate(-.5deg); + transform: translateY(1.5px) rotate(-.5deg) + } + 36% { + -webkit-transform: translateY(-1.5px) rotate(2.5deg); + transform: translateY(-1.5px) rotate(2.5deg) + } + 38% { + -webkit-transform: translateY(1.5px) rotate(-1.5deg); + transform: translateY(1.5px) rotate(-1.5deg) + } + 40% { + -webkit-transform: translateY(-.5px) rotate(2.5deg); + transform: translateY(-.5px) rotate(2.5deg) + } + 42% { + -webkit-transform: translateY(2.5px) rotate(-1.5deg); + transform: translateY(2.5px) rotate(-1.5deg) + } + 44% { + -webkit-transform: translateY(1.5px) rotate(.5deg); + transform: translateY(1.5px) rotate(.5deg) + } + 46% { + -webkit-transform: translateY(-1.5px) rotate(2.5deg); + transform: translateY(-1.5px) rotate(2.5deg) + } + 48% { + -webkit-transform: translateY(-.5px) rotate(.5deg); + transform: translateY(-.5px) rotate(.5deg) + } + 50% { + -webkit-transform: translateY(.5px) rotate(.5deg); + transform: translateY(.5px) rotate(.5deg) + } + 52% { + -webkit-transform: translateY(2.5px) rotate(2.5deg); + transform: translateY(2.5px) rotate(2.5deg) + } + 54% { + -webkit-transform: translateY(-1.5px) rotate(1.5deg); + transform: translateY(-1.5px) rotate(1.5deg) + } + 56% { + -webkit-transform: translateY(2.5px) rotate(2.5deg); + transform: translateY(2.5px) rotate(2.5deg) + } + 58% { + -webkit-transform: translateY(.5px) rotate(2.5deg); + transform: translateY(.5px) rotate(2.5deg) + } + 60% { + -webkit-transform: translateY(2.5px) rotate(2.5deg); + transform: translateY(2.5px) rotate(2.5deg) + } + 62% { + -webkit-transform: translateY(-.5px) rotate(2.5deg); + transform: translateY(-.5px) rotate(2.5deg) + } + 64% { + -webkit-transform: translateY(-.5px) rotate(1.5deg); + transform: translateY(-.5px) rotate(1.5deg) + } + 66% { + -webkit-transform: translateY(1.5px) rotate(-.5deg); + transform: translateY(1.5px) rotate(-.5deg) + } + 68% { + -webkit-transform: translateY(-1.5px) rotate(-.5deg); + transform: translateY(-1.5px) rotate(-.5deg) + } + 70% { + -webkit-transform: translateY(1.5px) rotate(.5deg); + transform: translateY(1.5px) rotate(.5deg) + } + 72% { + -webkit-transform: translateY(2.5px) rotate(1.5deg); + transform: translateY(2.5px) rotate(1.5deg) + } + 74% { + -webkit-transform: translateY(-.5px) rotate(.5deg); + transform: translateY(-.5px) rotate(.5deg) + } + 76% { + -webkit-transform: translateY(-.5px) rotate(2.5deg); + transform: translateY(-.5px) rotate(2.5deg) + } + 78% { + -webkit-transform: translateY(-.5px) rotate(1.5deg); + transform: translateY(-.5px) rotate(1.5deg) + } + 80% { + -webkit-transform: translateY(1.5px) rotate(1.5deg); + transform: translateY(1.5px) rotate(1.5deg) + } + 82% { + -webkit-transform: translateY(-.5px) rotate(.5deg); + transform: translateY(-.5px) rotate(.5deg) + } + 84% { + -webkit-transform: translateY(1.5px) rotate(2.5deg); + transform: translateY(1.5px) rotate(2.5deg) + } + 86% { + -webkit-transform: translateY(-1.5px) rotate(-1.5deg); + transform: translateY(-1.5px) rotate(-1.5deg) + } + 88% { + -webkit-transform: translateY(-.5px) rotate(2.5deg); + transform: translateY(-.5px) rotate(2.5deg) + } + 90% { + -webkit-transform: translateY(2.5px) rotate(-.5deg); + transform: translateY(2.5px) rotate(-.5deg) + } + 92% { + -webkit-transform: translateY(.5px) rotate(-.5deg); + transform: translateY(.5px) rotate(-.5deg) + } + 94% { + -webkit-transform: translateY(2.5px) rotate(.5deg); + transform: translateY(2.5px) rotate(.5deg) + } + 96% { + -webkit-transform: translateY(-.5px) rotate(1.5deg); + transform: translateY(-.5px) rotate(1.5deg) + } + 98% { + -webkit-transform: translateY(-1.5px) rotate(-.5deg); + transform: translateY(-1.5px) rotate(-.5deg) + } + 0%, to { + -webkit-transform: translate(0) rotate(0deg); + transform: translate(0) rotate(0deg) + } +} diff --git a/css/friendsLink.css b/css/friendsLink.css new file mode 100644 index 0000000..68edcf8 --- /dev/null +++ b/css/friendsLink.css @@ -0,0 +1,189 @@ + + +.link_left { + float: left; + width: 68%; + overflow: hidden; +} + +.link_right { + float: right; + width: 28%; + overflow: hidden; +} + +.link_left > div > h3 { + margin-bottom: 20px; + padding-left: 20px; + margin-top: 20px; + border-left: 3px solid #EE2C2C; + font-size: 18px; + line-height: 22px; +} + +.link_desc p { + line-height: 28px; + margin-left: 20px; + color: #232328; + font-size: 12px; +} + +.link_left > div { + position: relative; + background-color: rgba(255, 255, 255, 0.9); + padding: 20px; + margin-bottom: 30px; + border-radius: 10px; + overflow: hidden; +} + +.link_desc a { + color: #EE2C2C; +} + +.link_desc a:hover { + text-decoration: underline; +} + +.link_desc p:last-child { + color: #EE2C2C; +} + +.link_desc i:nth-child(n+2) { + margin-left: 6px; +} + +.link { + float: left; + padding: 15px 10px 10px 20px; +} + +.link a { + display: block; + padding: 12px; +} + +.link_left ul { + overflow: hidden; +} + +.link_left ul li { + float: left; + width: 33.3%; + overflow: hidden; +} + +.link_add { + position: absolute; + top: 40px; + right: 40px; + line-height: 22px; + font-size: 13px; + color: #EE2C2C; + cursor: pointer; +} + +.link_add:hover { + text-decoration: underline; +} + +.link_add i { + margin-right: 5px; +} + +.add_link_box { + background-color: rgba(255, 255, 255, 0.9); + position: fixed; + z-index: 1000; + min-height: 290px; + min-width: 300px; + font-size: 12px; + padding: 30px 30px 0 30px; + text-align: right; + top: calc(50% - 150px); + left: calc(50% - 180px); +} + +.add_link_box span { + display: table; + background: #EE2C2C; + border: none; + border-radius: 100px; + font-size: 16px; + color: #FFFFFF; + padding: 7px 28px; + margin: 0 auto; + margin-top: 10px; + cursor: pointer; + +} + +input[type="text"] { + width: 240px; + height: 20px; + background: #F7F7F9; + border: 1px solid #D3D3D7; + border-radius: 5px; + font-size: 14px; + color: black; + padding: 6px 8px; + outline: none; +} + +.add_link_box i { + font-size: 14px; + color: #EE2C2C; + margin-right: 5px; +} + +.add_link_box p { + line-height: 56px; +} + +.close { + position: absolute; + top: 10px; + right: 10px; + cursor: pointer; +} + +/*适配友情连接的手机页面*/ +@media screen and (max-width: 500px) { + + .link_left { + width: 100%; + } + + .link_right { + display: none; + } + + .link_left ul li { + width: 50%; + } + + .link { + padding: 5px 0 10px 10px; + } + + .link a { + padding: 0; + } + + .add_link_box { + background-color: rgba(255, 255, 255, 1); + position: fixed; + z-index: 1000; + min-height: 290px; + width: 90%; + font-size: 12px; + padding: 30px 30px 0 0; + text-align: right; + top: calc(50% - 145px); + left: calc(5% - 15px); + } + + .link_left > div { + border-radius: 5px; + } +} diff --git a/css/index.css b/css/index.css new file mode 100644 index 0000000..6789045 --- /dev/null +++ b/css/index.css @@ -0,0 +1,427 @@ +body { + background-color: #F7F7F9; + background-size: 0; +} + +page { + display: table; + table-layout: fixed; + padding: 40px 0; + width: 100%; + background-size: cover; + overflow: hidden; + position: relative; +} + +.page1 { + background-image: url(http://wx2.sinaimg.cn/large/007aGNoFly1fvysv5m71bj30ev09rdgu.jpg); + height: 100vh; + background-color: transparent; + background-position: center; + background-repeat: no-repeat; + background-attachment: fixed; + padding: 0; +} + +.page1:after, .page3:after { + content: ""; + position: absolute; + top: 0; + left: 0; + z-index: 0; + width: 100%; + height: 100%; + background-color: rgba(0, 0, 0, .5); +} + +.table_cell { + display: table-cell; + vertical-align: middle; + width: 100%; + height: 100%; + position: relative; + z-index: 1; +} + +.mText { + text-align: center; + color: #ffffff; +} + +.mText h2 { + font-size: 26px; + letter-spacing: 8px; +} + +.mText p { + letter-spacing: 8px; + margin: 20px 0; + font-size: 16px; +} + +#next { + width: 40px; + height: 40px; + border-radius: 50%; + position: absolute; + bottom: 60px; + left: 50%; + margin-left: -24px; + z-index: 0; + -webkit-transition: all .5s ease-out; + transition: all .5s ease-out; + cursor: pointer; +} + +#next:hover { + background-color: #EE2C2C; +} + +#next:after { + display: inline-block; + font-family: FontAwesome; + content: "\f107"; + color: #ffffff; + font-size: 2rem; + width: 40px; + height: 40px; + text-align: center; + line-height: 40px; +} + +.page2 { + width: 100%; + position: relative; + margin: 0 auto; + font-family: "Microsoft YaHei Mono"; +} + +.article_box { + width: 100%; + height: 100%; + position: relative; +} + +.title { + text-align: center; +} + +.title h1 { + font-size: 20px; + padding-bottom: 50px; + position: relative; +} + +.title h1:after { + position: absolute; + width: 50px; + height: 2px; + content: ""; + left: 50%; + margin-left: -25px; + bottom: 35px; + background-color: #EE2C2C; +} + +.page3 { + padding: 100px 0; + background-image: url(http://wx4.sinaimg.cn/large/007aGNoFly1fvysv60e57j30dc08cdg0.jpg); + background-position: center; + background-attachment: fixed; + background-repeat: no-repeat; + background-color: rgba(0, 0, 0, .5); +} + +.about_box { + width: 100%; + position: relative; + color: #ffffff; + font-family: "Microsoft YaHei Mono"; +} + +.about { + width: 1000px; + margin: auto; + text-align: center; +} + +.about ul li { + display: inline-block; + width: 200px; + height: 46px; + margin: 10px; + border: 1px solid #b4b4b4; + position: relative; + text-align: center; + overflow: hidden; +} + +.about ul li:after { + content: ""; + display: block; + position: absolute; + left: 0; + top: 0; + width: 0; + height: 46px; + background-color: #EE2C2C; + opacity: 0.5; + -webkit-transition: width 0.6s; + -moz-transition: width 0.6s; + -ms-transition: width 0.6s; + -o-transition: width 0.6s; + transition: width 0.6s; +} + +.about ul li:hover:after { + width: 200px; +} + +.about ul li a { + display: block; + line-height: 26px; + padding: 10px; + color: #ffffff; + text-decoration: none; + font-size: 14px; + position: relative; + z-index: 1; +} + +.about ul li a i { + margin-right: 5px; + font-size: 14px; + width: 20px; +} + +.links { + width: 1000px; + margin: 0 auto; + overflow: hidden; +} + +.links ul li { + float: left; + width: 25%; +} + +.link { + float: left; + padding: 0 30px 20px; +} + +.link a { + display: block; + padding: 20px; + min-width: 170px; + border-radius: 10px; +} + +.page5 { + background-color: #232328; + padding: 60px 0; +} + +.footer_box { + width: 1000px; + position: relative; + margin: 0 auto; + padding-left: 60px; +} + +.footer > li { + display: block; + float: left; + line-height: 40px; + width: 33.33%; +} + +.footer > li > h2 { + color: #FFFFFF; + font-size: 22px; + margin-bottom: 10px; + letter-spacing: 5px; +} + +.footer > li > p { + color: #eee; +} + +.footer > li > a { + display: block; + line-height: 38px; + width: 68px; + text-align: center; + padding: 0 18px; + font-size: 14px; + border: none; + color: #ffffff; + border-radius: 2px; + background-color: rgba(238, 44, 44, .9); + margin-top: 15px; +} + +.footer > li > button:hover { + background-color: rgba(238, 44, 44, 1); +} + +.footer > li > h3 { + color: #ffffff; + font-size: 18px; + margin-bottom: 10px; + font-weight: 100; +} + +.all_link > li { + float: left; + width: 50%; + line-height: 38px; + font-size: 14px; +} + +.all_link > li > a { + color: #eeeeee; + letter-spacing: 1px; +} + +.all_link > li > a:hover{ + color: #EE2C2C; +} + +.all_link > li > a > i { + margin-right: 5px; +} + +#contact > li { + color: #eeeeee; + line-height: 38px; + font-size: 14px; +} + +#contact > li > i { + margin-right: 10px; + width: 20px; + font-size: 16px; + color: #eeeeee; +} + +#loading { + background-color: #374140; + height: 100%; + width: 100%; + position: fixed; + z-index: 1; + margin-top: 0; + top: 0; +} + +#loading-center { + width: 100%; + height: 100%; + position: relative; +} + +#loading-center-absolute { + position: absolute; + left: calc(50% - 75px); + top: calc(50% - 75px); + height: 150px; + width: 150px; +} + +.object { + width: 20px; + height: 20px; + background-color: #fff; + float: left; + margin-right: 15px; + margin-left: 15px; + margin-top: 65px; + -moz-border-radius: 50% 50% 50% 50%; + -webkit-border-radius: 50% 50% 50% 50%; + border-radius: 50% 50% 50% 50%; +} + +#object_one { + -webkit-animation: object 1.5s infinite; + animation: object 1.5s infinite; +} + +#object_two { + -webkit-animation: object 1.5s infinite; + animation: object 1.5s infinite; + -webkit-animation-delay: .25s; + animation-delay: .25s; +} + +#object_three { + -webkit-animation: object 1.5s infinite; + animation: object 1.5s infinite; + -webkit-animation-delay: .5s; + animation-delay: .5s; +} + +@-webkit-keyframes object { + 75% { + -webkit-transform: scale(0); + -moz-transform: scale(0); + -ms-transform: scale(0); + -o-transform: scale(0); + transform: scale(0); + } +} + +@keyframes object{ + 75% { + -webkit-transform: scale(0); + -moz-transform: scale(0); + -ms-transform: scale(0); + -o-transform: scale(0); + transform: scale(0); + } +} + +@media screen and (max-width: 500px){ + .page1 { + background-position: 58%; + } + + .about{ + width: 90%; + } + + .links{ + width: 90%; + } + + .links ul li{ + width: 50%; + } + + .link{ + padding: 0; + } + + .link a{ + min-width: 120px; + width: 120px; + } + + .article_info > i:nth-child(n+2){ + margin-left: 20px; + } + + .footer_box{ + width: 90%; + padding: 0 15px; + } + + .footer > li{ + width: 100%; + margin-bottom: 30px; + } + + .footer > li:last-child{ + margin-bottom: 0; + } +} diff --git a/css/label.css b/css/label.css new file mode 100644 index 0000000..bd9c651 --- /dev/null +++ b/css/label.css @@ -0,0 +1,38 @@ +.single_new { + border: none; + background-color: #FFFFFF; +} + +.news ul li{ + margin-bottom: 30px; +} + +.label_title { + width: 100%; + margin-top: 80px; + color: #FFFFFF; + text-align: center; +} + +.label_title h1 { + font-weight: 100; + font-size: 24px; + margin-bottom: 15px; + letter-spacing: .1em; + color: #fff; + text-shadow: 0 4px 8px rgba(7,17,27,.4); +} + +.label_title p { + font-size: 15px; + font-weight: 100; + color: rgba(255,255,255,.8); +} + +.label_title a{ + color: #EE2C2C; +} + +.w1000{ + margin-top: 50px; +} \ No newline at end of file diff --git a/css/prettify.css b/css/prettify.css new file mode 100644 index 0000000..0f751c2 --- /dev/null +++ b/css/prettify.css @@ -0,0 +1,152 @@ +/* ======================== +//#google-prettify-monokai-theme +//#Version: 0.3 +//#Author: RaphaelDDL +//#Github: https://github.com/RaphaelDDL/google-prettify-monokai-theme/ +//For use with Google Code Prettify, HTML Syntax only +//======================== */ +li.L0, li.L1, li.L2, li.L3,li.L4, +li.L5, li.L6, li.L7, li.L8,li.L9{ + list-style-type: decimal !important; + font-family: consolas, menlo, courier, monospace; + font-size: 14px; + min-height: 20px; + line-height: 20px; + word-wrap: break-word; +} +li.L0 span, li.L1 span, li.L2 span, li.L3 span,li.L4 span, +li.L5 span, li.L6 span, li.L7 span, li.L8 span,li.L9 span{ + font-family: consolas, menlo, courier, monospace; + font-size: 14px; + line-height: 1.75; +} +pre .str, code .str { color: #e6db5a; } /* string */ +pre .kwd, code .kwd { color: #66d9ef; } /* keyword */ +pre .com, code .com { color: #75715e; font-style: italic; } /* comment */ +pre .typ, code .typ { color: #66d9ef; } /* type */ +pre .lit, code .lit { color: #ae81ff; } /* literal */ +pre .pun, code .pun { color: #fff; } /* punctuation */ +pre .pln, code .pln { color: #fff; } /* plaintext */ +pre .tag, code .tag { color: #f92672; } /* html/xml tag */ +pre .atn, code .atn { color: #a6e22a; } /* html/xml attribute name */ +pre .atv, code .atv { color: #e6db74; } /* html/xml attribute value */ +pre .dec, code .dec { color: #ae81ff; } /* decimal */ + +pre.prettyprint, code.prettyprint { + background-color: #272822; + -moz-border-radius: 8px; + -webkit-border-radius: 8px; + -o-border-radius: 8px; + -ms-border-radius: 8px; + -khtml-border-radius: 8px; + border-radius: 8px; + font-family: consolas, menlo, courier, monospace; +} + +pre.prettyprint { + max-width: 100%; + margin: 1em auto; + padding: 1em; + white-space: pre-wrap; +} + +pre.prettyprinted { + box-shadow:inset 0 0 1px 2px #3c3d39, 0 0 15px rgba(0,0,0,0.5); + border:1px solid #0b0c0a; +} + + +/* ------------------------ +//Section: class 'linenums' for line numbering +//------------------------ */ +ol.linenums { + margin-top: 0; + margin-bottom: 0; + margin-left: 40px; + color: #75715e; +} /* IE indents via margin-left */ + + +/* ============================================= +//Section: Print Styles (partially from Sunburn Theme) +//================================================ */ +@media print { + pre.prettyprinted, pre.prettyprint, code.prettyprint { + background-color:#fff; + color:#000; + -moz-border-radius:0; + -webkit-border-radius:0; + -o-border-radius:0; + -ms-border-radius:0; + -khtml-border-radius:0; + border-radius:0; + } + + pre .str, code .str { color: #060; } + pre .kwd, code .kwd { color: #006; font-weight: bold; } + pre .com, code .com { color: #600; font-style: italic; } + pre .typ, code .typ { color: #404; font-weight: bold; } + pre .lit, code .lit { color: #044; } + pre .pun, code .pun { color: #440; } + pre .pln, code .pln { color: #000; } + pre .tag, code .tag { color: #006; font-weight: bold; } + pre .atn, code .atn { color: #404; } + pre .atv, code .atv { color: #060; } +} + +.code-pretty-container { + position: relative; + padding-top: 9px; + margin-bottom: 20px; +} + +.code-pretty-toolbar { + position: absolute; + top: -2px; + left: 0; + color: #ddd; +} + +.code-pretty-toolbar .title{ + display: inline-block; + vertical-align: top; + padding: 4px 14px 2px; + margin-right: 12px; + line-height: 1.75; + background-color: #1E1F1A; + border: 1px solid #0b0c0a; + border-radius: 8px 8px 0 0; + border-bottom: none; + box-shadow: inset 2px 3px 1px 0px #3c3d39, 0 -1px 12px rgba(0,0,0,0.5); + font-size: 12px; +} + +.code-pretty-toolbar .tool { + margin: -2px 3px 0 0; + height: 24px; + width: 24px; + font-size: 16px; + color: #777777; +} + +.code-pretty-toolbar span, .code-pretty-toolbar a { + display: inline-block; + vertical-align: top; +} + +.code-pretty-text { + position: absolute; + top: 36px; + left: 2px; + padding: 4px; + color: #FFF; + font-family: consolas, menlo, courier, monospace; + font-size: 14px; + word-break: break-all; + line-height: 20px; + border: none; + overflow: hidden; + background-color: rgb(39, 40, 34); + resize: none; + outline: none; +} \ No newline at end of file diff --git a/css/publish.css b/css/publish.css new file mode 100644 index 0000000..2686c20 --- /dev/null +++ b/css/publish.css @@ -0,0 +1,335 @@ +.publishBlog { + padding-bottom: 10px; + overflow: hidden; + background: rgba(255, 255, 255, .9); + border-radius: 10px; +} + +.publishBlog > form > ul > li:nth-child(n+2) > div > i { + margin-right: 10px; + font-size: 16px; + color: #EE2C2C; + line-height: 36px; +} + +.publishBlog > form > ul > li { + padding-left: 40px; + overflow: hidden; +} + +.publishBlog > form > ul > li:nth-child(n+2) { + padding-top: 2px; + padding-bottom: 30px; +} + +.publishBlog > form > ul > li > div { + position: relative; +} + +.publishBlog > form > ul > li > div:first-child { + width: 60%; +} + +.publishBlog > form > ul > li > div:nth-child(2) { + width: 40%; +} + +.uploadImg { + float: left; + background-position: 55% 50%; + background-repeat: no-repeat; + background-size: 35% 60%; +} + +.uploadImg label { + position: absolute; + background-color: #EE2C2C; + display: block; + width: 100px; + height: 30px; + left: 80px; + top: 88px; + text-align: center; + line-height: 30px; + color: #FFFFFF; + border-radius: 5px; +} + +.uploadImg label i{ + margin-right: 8px; +} + +.uploadImg > i { + margin-right: 10px; + font-size: 16px; + color: #EE2C2C; + line-height: 200px; +} + +.uploadImg img { + position: relative; + top: 50px; + left: 5px; +} + +.uploadImg > span { + margin-left: 12%; +} + +#uploadImg { + position: absolute; + left: 55px; + line-height: 200px; + top: 0; + opacity: 0; +} + +.classify { + float: right; +} + +.classify i { + margin-right: 10px; + font-size: 16px; + color: #EE2C2C; + line-height: 200px; +} + +.title { + float: left; +} + +.top { + float: right; +} + +.top span { + font-size: 14px; + color: #787977; + margin-left: 8px; + display: none; +} + +#top { + display: none; +} + +#top:checked + .top_label:before { + background-color: #EE2C2C; +} + +.top_label { + position: relative; + height: 24px; + margin-bottom: 3px; + margin-left: 10px; + vertical-align: middle; + cursor: pointer; +} + +.top_label:before { + display: inline-block; + position: relative; + content: ''; + width: 45px; + height: 24px; + background-color: #D8D8D8; + border-radius: 100px; + transition: background-color 0.3s +} + +.top_label:after { + position: absolute; + left: 4px; + top: 4px; + content: ''; + width: 16px; + height: 16px; + border-radius: 50%; + background-color: #fff; + transition: transform 0.3s ease-in; +} + +#top:checked + .top_label:after { + transform: translateX(130%); +} + +#top:checked ~ span { + display: inline; +} + +.label { + float: left; +} + +.private { + float: right; +} + +.private span { + font-size: 14px; + color: #787977; + margin-left: 8px; + display: none; +} + +#private { + display: none; +} + +#private:checked + .private_label:before { + background-color: #EE2C2C; +} + +.private_label { + position: relative; + height: 24px; + margin-bottom: 3px; + margin-left: 10px; + vertical-align: middle; + cursor: pointer; +} + +.private_label:before { + display: inline-block; + position: relative; + content: ''; + width: 45px; + height: 24px; + background-color: #D8D8D8; + border-radius: 100px; + transition: background-color 0.3s +} + +.private_label:after { + position: absolute; + left: 4px; + top: 4px; + content: ''; + width: 16px; + height: 16px; + border-radius: 50%; + background-color: #fff; + transition: transform 0.3s ease-in; +} + +#private:checked + .private_label:after { + transform: translateX(130%); +} + +#private:checked ~ span { + display: inline; +} + +.publish_editor { + padding: 10px 40px; +} + +.admire { + float: left; +} + +.type { + float: right; +} + +.type span { + font-size: 14px; + color: #787977; + margin-left: 8px; + display: none; +} + +#type { + display: none; +} + +#type:checked + .type_label:before { + background-color: #EE2C2C; +} + +.type_label { + position: relative; + height: 24px; + margin-bottom: 3px; + margin-left: 10px; + vertical-align: middle; + cursor: pointer; +} + +.type_label:before { + display: inline-block; + position: relative; + content: ''; + width: 45px; + height: 24px; + background-color: #D8D8D8; + border-radius: 100px; + transition: background-color 0.3s +} + +.type_label:after { + position: absolute; + left: 4px; + top: 4px; + content: ''; + width: 16px; + height: 16px; + border-radius: 50%; + background-color: #fff; + transition: transform 0.3s ease-in; +} + +#type:checked + .type_label:after { + transform: translateX(130%); +} + +#type:checked ~ span { + display: inline; +} + +.commit_message { + display: table; + background: #EE2C2C; + border: none; + border-radius: 100px; + font-size: 16px; + color: #FFFFFF; + padding: 7px 28px; + margin: 0 auto; + cursor: pointer; +} + +input[type="text"] { + width: 240px; + height: 20px; + background: #F7F7F9; + border: 1px solid #D3D3D7; + border-radius: 5px; + font-size: 14px; + color: black; + padding: 6px 8px; + margin-left: 10px; + outline: none; +} + +.top_text { + border: 1px solid #ccc; + height: 180px; + border-top: none; +} + +.publish_text { + border: 1px solid #ccc; + min-height: 600px; + border-top: none; +} + +.publish_text > .w-e-text { + min-height: 600px; +} + +.article_top { + margin-left: 40px; + margin-top: 5px; +} diff --git a/css/test.css b/css/test.css new file mode 100644 index 0000000..7a4bdf3 --- /dev/null +++ b/css/test.css @@ -0,0 +1,3041 @@ +@charset "utf-8"; +/* +Theme Name: mkBlog +Theme URI: https://mkblog.cn/theme-mkblog/ +Author: 孟坤博客 +Author URI: https://mkblog.cn +Description: 一款简洁但不简单的 WordPress 主题 +Version: 1.6 +*/ + +/* style */ +* { + margin: 0; + padding: 0; + font-family: Microsoft Yahei, "微软雅黑", "Helvetica Neue", Helvetica, Hiragino Sans GB, WenQuanYi Micro Hei, sans-serif; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box +} + +::-webkit-scrollbar { + width: 8px; + height: 8px +} + +::-webkit-scrollbar-track { + background-color: transparent; + -webkit-border-radius: 2em; + -moz-border-radius: 2em; + border-radius: 2em +} + +::-webkit-scrollbar-thumb { + background-color: #F90; + background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .4) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .4) 50%, rgba(255, 255, 255, .4) 75%, transparent 75%, transparent); + -webkit-border-radius: 2em; + -moz-border-radius: 2em; + border-radius: 2em +} + +::-moz-selection { + color: #fff; + background-color: #eb5055 +} + +::selection { + color: #fff; + background-color: #eb5055 +} + +a:focus, button:focus, input:focus, select:focus, textarea:focus, .fancybox-close-small:focus { + outline: 0 +} + +a { + text-decoration: none; + color: #313131 +} + +img { + border: 0; + -ms-interpolation-mode: bicubic; + image-rendering: optimizeQuality +} + +img[src=""] { + opacity: 0 +} + +table { + border-collapse: collapse; + border-spacing: 0 +} + +.text-center { + text-align: center +} + +.clear-fix { + zoom: 1 +} + +.clear-fix:before, .clear-fix:after { + display: table; + line-height: 0; + content: "" +} + +.clear-fix:after { + clear: both +} + +.hidden { + display: none !important +} + +.no-shadow { + -webkit-box-shadow: none !important; + -moz-box-shadow: none !important; + box-shadow: none !important +} + +.anim-trans { + -webkit-transition: .3s ease all; + -moz-transition: .3s ease all; + -o-transition: .3s ease all; + transition: .3s ease all +} + +body, html { + position: relative; + margin: 0; + padding: 0; + font-size: 14px; + height: 100% +} + +.fancybox-close-small:focus:after { + outline: 0 +} + +fieldset { + border: 1px solid #eee; + border-radius: 3px; + padding: 10px 15px +} + +fieldset > legend { + background-color: #eb5055; + color: #fff; + border-radius: 2px; + padding: 2px 5px; + font-size: 12px +} + +.entry-content fieldset > :nth-child(2) { + margin-top: 0 +} + +.entry-content fieldset > :last-child { + margin-bottom: 0 +} + +table th, table td { + border: 1px solid #f2f2f2; + padding: 8px +} + +.links { + color: #313131; + border-bottom: 1px solid #ccc; + text-decoration: none; + margin: 0 5px; + -webkit-transition: .2s; + -moz-transition: .2s; + -o-transition: .2s; + -ms-transition: .2s; + cursor: pointer +} + +.links:hover { + color: #eb5055; + border-bottom: 1px solid #eb5055 +} + +input:not([type~="checkbox"]):not([type~="radio"]), textarea, button, .btn { + -webkit-transition: .2s; + -moz-transition: .2s; + -ms-transition: .2s; + -o-transition: .2s; + transition: .2s; + font-size: 1em; + border-radius: 3px; + -webkit-appearance: none +} + +input:not([type~="checkbox"]):not([type~="radio"]):disabled, textarea:disabled, button:disabled, .btn:disabled { + background-color: #a9a9a9; + cursor: not-allowed +} + +input, textarea { + width: 100%; + padding: 5px; + box-sizing: border-box; + border: 1px solid #e5e9ef; + background-color: #f4f5f7; + resize: vertical +} + +input:focus, textarea:focus { + background-color: #fff +} + +button, .btn { + border: 0; + background: #eb5055; + color: #fff; + cursor: pointer; + opacity: 1; + user-select: none +} + +button:hover, button:focus, .btn:hover, .btn:focus { + opacity: .9 +} + +button:active, .btn:active { + opacity: 1 +} + +.btn { + padding: 6px 12px; + margin-right: 4px; + margin-bottom: 4px; + display: inline-block; + line-height: 1.5 +} + +.mk-checkbox { + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + display: inline-block; + cursor: pointer +} + +.mk-checkbox input[type="checkbox"] { + position: absolute; + opacity: 0; + width: auto !important +} + +.mk-checkbox input[type="checkbox"] + div { + vertical-align: middle; + width: 40px; + height: 20px; + border: 1px solid rgba(0, 0, 0, .4); + border-radius: 999px; + background-color: rgba(0, 0, 0, 0.1); + -webkit-transition-duration: .4s; + -moz-transition-duration: .4s; + -o-transition-duration: .4s; + -webkit-transition-property: transform, background-color, box-shadow; + -moz-transition-property: transform, background-color; + -o-transition-property: transform, background-color; + box-shadow: inset 0 0 0 0 rgba(0, 0, 0, 0.4); + display: inline-block; + margin-right: 3px +} + +.mk-checkbox input[type="checkbox"] + div > div { + float: left; + width: 18px; + height: 18px; + border-radius: inherit; + background: #fff; + -webkit-transition-timing-function: cubic-bezier(.54, 1.85, .5, 1); + -moz-transition-timing-function: cubic-bezier(.54, 1.85, .5, 1); + -o-transition-timing-function: cubic-bezier(.54, 1.85, .5, 1); + -webkit-transition-duration: .4s; + -moz-transition-duration: .4s; + -o-transition-duration: .4s; + -webkit-transition-property: transform, background-color, box-shadow; + -moz-transition-property: transform, background-color; + -o-transition-property: transform, background-color; + box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(0, 0, 0, 0.4); + pointer-events: none +} + +.mk-checkbox input[type="checkbox"]:checked + div > div { + -webkit-transform: translate3d(20px, 0, 0); + -moz-transform: translate3d(20px, 0, 0); + -ms-transform: translate3d(20px, 0, 0); + -o-transform: translate3d(20px, 0, 0); + transform: translate3d(20px, 0, 0); + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(8, 80, 172, 1) +} + +.mk-checkbox input[type="checkbox"]:checked + div { + background-color: #f85200; + border: 1px solid #eb5055; + box-shadow: inset 0 0 0 10px #eb5055 +} + +.mk-checkbox input[type="checkbox"]:checked + div > div { + box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3), 0 0 0 1px #eb5055 +} + +body { + overflow-x: hidden; + padding-top: 60px +} + +.no-ie { + position: fixed; + bottom: 0; + height: 50px; + line-height: 50px; + width: 100%; + text-align: center; + z-index: 9999999999; + background-color: #923838; + color: #fff; + font-size: 16px +} + +.no-ie a { + color: #fff; + border-bottom: 2px solid #c5baba +} + +.no-ie a:hover { + color: #eee; + border-bottom: 3px solid #c5baba +} + +#top-navi { + height: 60px; + box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.43); + position: fixed; + width: 100%; + top: 0; + z-index: 999; + background-color: #fff; + background-color: rgba(255, 255, 255, 0.95) +} + +.admin-bar #top-navi { + top: 32px +} + +#top-navi.headroom--unpinned { + top: -65px +} + +.top-navi-content { + height: 100%; + max-width: 1000px; + margin: 0 auto +} + +.top-navi-logo { + display: block; + height: 100%; + width: auto; + float: left; + padding: 8px +} + +.top-navi-logo > img { + display: inline-block; + height: 100% +} + +.top-navi-logo > h1 { + font-size: 22px; + font-weight: 900; + line-height: 42px; + letter-spacing: .03em; + text-shadow: 2px 2px 1px #eee; + color: #505050 +} + +.top-navi-search-btn { + width: 40px; + height: 100%; + float: right; + cursor: pointer; + text-align: center +} + +#top-navi .main-menu { + display: inline-block; + float: right; + height: 100% +} + +#top-navi .main-menu::-webkit-scrollbar { + height: 6px; + width: 6px +} + +#top-navi .main-menu::-webkit-scrollbar-track-piece { + background-color: #f5f5f5 +} + +#top-navi .main-menu::-webkit-scrollbar-thumb { + height: 6px; + width: 6px; + border-radius: 0; + background: #cbcbcb +} + +#top-navi .main-menu::-webkit-scrollbar-thumb:hover { + background: #909090 +} + +#top-navi .main-menu ul { + list-style: none; + position: relative; + display: inline-table; + z-index: 999 +} + +#top-navi .main-menu ul:after { + content: ""; + clear: both; + display: block +} + +#top-navi .main-menu ul li { + float: left +} + +#top-navi .main-menu > ul > li > a, .top-navi-search-btn { + line-height: 60px; + font-size: 14px +} + +#top-navi .main-menu ul li a { + display: block; + padding: 0 20px; + height: 100%; + color: #000; + text-decoration: none +} + +#top-navi .main-menu ul li a, .top-navi-search-btn { + -webkit-transition: .3s ease all; + -moz-transition: .3s ease all; + -o-transition: .3s ease all; + transition: .3s ease all +} + +#top-navi .main-menu ul li:hover > a, .top-navi-search-btn:hover { + color: #eb5055 +} + +#top-navi .main-menu ul li:hover > ul { + visibility: visible; + filter: alpha(Opacity=98); + -moz-opacity: .98; + opacity: .98; + margin-top: 0 +} + +#top-navi .main-menu ul ul { + background: #fff; + padding: 0; + position: absolute; + top: 100%; + box-shadow: 0 0 10px 0 #cacaca; + -webkit-transition: all .3s ease-in-out; + -moz-transition: all .3s ease-in-out; + -o-transition: all .3s ease-in-out; + transition: all .3s ease-in-out; + visibility: hidden; + opacity: 0; + margin-top: -15px +} + +#top-navi .main-menu ul ul li { + float: none; + position: relative +} + +#top-navi .main-menu ul ul li a { + padding: 15px 25px; + width: 160px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap +} + +#top-navi .main-menu ul ul li a:hover { + padding-left: 32px +} + +#top-navi .main-menu ul ul ul li a:hover { + padding-left: 22px +} + +#top-navi .main-menu ul ul ul { + position: absolute; + left: 100%; + top: 5px +} + +#top-navi .main-menu ul ul ul li a { + padding: 12px 15px; + width: 160px +} + +#menu-btn { + display: none +} + +@media screen and (max-width: 750px) { + body { + padding-top: 50px; + webkit-transition: .5s linear all; + -moz-transition: .5s linear all; + -o-transition: .5s linear all; + transition: .5s linear all + } + + #top-navi { + height: 50px; + box-shadow: 5px 0 5px 0 rgba(0, 0, 0, 0.33) + } + + .top-navi-search-btn { + top: 5px; + right: 5px; + display: block; + width: 40px; + height: 40px; + line-height: 40px; + font-size: 26px; + color: #848484; + position: absolute + } + + .top-navi-content { + text-align: center + } + + .top-navi-logo { + float: none; + margin: 0 auto; + display: inline-block + } + + .top-navi-logo > h1 { + line-height: 32px; + text-shadow: none + } + + .main-menu { + position: fixed; + top: 0; + bottom: 0; + right: 100%; + width: 65%; + z-index: 999; + overflow-y: auto; + background: #fff; + background: rgba(255, 255, 255, 0.68) + } + + .main-menu-on .main-menu { + box-shadow: 0 0 15px 0 #9c9c9c + } + + #top-navi .main-menu:before { + content: "Navigation"; + font-size: 26px; + line-height: 55px; + color: #e2e2e2 + } + + #top-navi .main-menu li a { + padding: 0 20px !important; + line-height: 45px !important; + display: block !important; + width: 100% !important; + text-align: left + } + + #top-navi .main-menu ul { + width: 100%; + padding: 0 + } + + #top-navi .main-menu ul li { + display: block; + width: 100%; + position: static + } + + #top-navi .main-menu .current-menu-item > a, #top-navi .main-menu .current-menu-item > a:hover { + background-color: #eb5055 !important; + color: #fff !important + } + + #top-navi .main-menu a, #top-navi .main-menu ul li:hover a { + background-color: transparent; + color: #000 + } + + #top-navi .main-menu ul li a:hover { + background-color: #eee; + color: #eb5055 + } + + #top-navi .main-menu ul ul, #top-navi .main-menu ul ul ul { + visibility: visible; + filter: alpha(Opacity=100); + -moz-opacity: 1; + opacity: 1; + background-color: transparent; + position: static; + box-shadow: none; + margin: 0; + -webkit-transition: none; + -moz-transition: none; + -o-transition: none; + transition: none + } + + #menu-btn { + display: block; + position: absolute; + width: 40px; + height: 40px; + left: 8px; + top: 7px; + border-radius: 15px; + cursor: pointer; + z-index: 999999 + } + + #menu-btn .menu-btn-bar:nth-of-type(1) { + margin-top: 7px + } + + #menu-btn .menu-btn-bar:nth-of-type(3) { + margin-bottom: 0 + } + + #menu-btn .menu-btn-bar { + position: relative; + display: block; + width: 30px; + height: 3px; + margin: 6px auto; + background-color: #848484; + border-radius: 10px; + -webkit-transition: .3s; + -moz-transition: .3s; + -o-transition: .3s; + transition: .3s + } + + .main-menu-on #menu-btn .menu-btn-bar:nth-of-type(1) { + -webkit-transform: translateY(9px) rotate(-45deg); + -ms-transform: translateY(9px) rotate(-45deg); + transform: translateY(9px) rotate(-45deg) + } + + .main-menu-on #menu-btn .menu-btn-bar:nth-of-type(2) { + opacity: 0 + } + + .main-menu-on #menu-btn .menu-btn-bar:nth-of-type(3) { + -webkit-transform: translateY(-9px) rotate(45deg); + -ms-transform: translateY(-9px) rotate(45deg); + transform: translateY(-9px) rotate(45deg) + } + + .main-menu-on { + -webkit-transform: translateX(65%); + -moz-transform: translateX(65%); + -ms-transform: translateX(65%); + -o-transform: translateX(65%); + transform: translateX(65%); + position: fixed; + top: 0; + left: 0; + right: 0; + bottom: 0; + overflow: hidden + } + + .main-menu-on:after { + content: ""; + cursor: pointer; + position: absolute; + width: 100%; + height: 100%; + z-index: 998; + left: 0; + top: 0; + background-color: rgba(0, 0, 0, 0.02) + } +} + +#top-navi { + webkit-transition: .5s ease all; + -moz-transition: .5s ease all; + -o-transition: .5s ease all; + transition: .5s ease all +} + +.banner-bg-header { + background: url(https://ws1.sinaimg.cn/large/a15b4afegy1fmeb638hhjj228009gdgq.jpg) no-repeat; + -webkit-background-size: cover; + -moz-background-size: cover; + -ms-background-size: cover; + background-size: cover; + padding: 90px 0 30px; + text-align: center; + margin-top: -60px +} + +.banner-bg-header .banner-title { + font-weight: 100; + font-size: 30px; + margin-bottom: 10px; + letter-spacing: .1em; + color: #fff; + text-shadow: 0 4px 8px rgba(7, 17, 27, .4) +} + +.banner-bg-header .banner-sub-title { + font-weight: 100; + font-size: 15px; + color: #eee; + color: rgba(255, 255, 255, 0.54) +} + +@media screen and (max-width: 660px) { + .banner-bg-header .banner-title { + font-size: 26px + } + + .banner-bg-header .banner-sub-title { + font-size: 14px + } +} + +.index-header-title { + text-align: center; + color: #c3c3c3; + font-size: 16px +} + +#post-lists { + max-width: 900px; + margin: 20px auto 0 +} + +#post-lists > article { + width: 33.33%; + float: left +} + +.post-item-card { + margin: 20px +} + +.post-item-card .post-item-card-body { + border: 1px solid #e6ebf5; + background-color: #fff; + background-color: rgba(255, 255, 255, 0.73); + box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .05); + border-radius: 4px; + overflow: hidden; + max-width: 270px; + margin: 0 auto; + transform-style: preserve-3d; + transform: rotate(0deg); + -webkit-transform: rotate(0deg) +} + +.post-item-card .item-thumb { + position: relative; + display: inherit; + overflow: hidden +} + +.post-item-card .thumbnail { + display: inherit; + min-height: 160px; + -webkit-transition: -webkit-transform .5s ease, filter .5s ease; + -moz-transition: -moz-transform .5s ease, filter .5s ease; + -o-transition: -o-transform .5s ease, filter .5s ease; + transition: transform .5s ease, filter .5s ease; + background-position: 50% 50%; + background-size: cover +} + +.post-item-card:hover .item-thumb .thumbnail { + -webkit-transform: scale(1.1); + -moz-transform: scale(1.1); + transform: scale(1.1); + -webkit-filter: blur(3px); + -moz-filter: blur(3px); + filter: blur(3px) +} + +.post-item-card .item-thumb:before { + content: "Loading..."; + position: absolute; + width: 100%; + left: 0; + background-color: #eee; + background-color: rgba(238, 238, 238, 0.67); + text-align: center; + -webkit-transform: translateY(-34%); + -moz-transform: translateY(-34%); + -ms-transform: translateY(-34%); + -o-transform: translateY(-34%); + transform: translateY(-34%); + line-height: 500px; + font-size: 25px; + color: #b7b6b6; + z-index: -1 +} + +.post-item-card .item-thumb:after { + content: ""; + background: rgba(0, 0, 0, 0.01); + position: absolute; + top: 0; + bottom: 0; + left: 0; + right: 0 +} + +.post-item-card .archive-content { + padding: 160px 20px; + position: absolute; + top: 50%; + left: 0; + right: 0; + -webkit-transform: translateY(-50%); + -moz-transform: translateY(-50%); + -ms-transform: translateY(-50%); + -o-transform: translateY(-50%); + transform: translateY(-50%); + text-align: center; + color: #fff; + font-size: 14px; + line-height: 26px; + opacity: 0; + background-color: rgba(0, 0, 0, .5) +} + +.post-item-card:hover .archive-content { + -webkit-animation: fade-in .5s; + animation: fade-in .5s; + opacity: 1 +} + +@keyframes fade-in { + 0% { + transform: translateY(-45%); + opacity: 0 + } + 100% { + transform: translateY(-50%); + opacity: 1 + } +} + +@-webkit-keyframes fade-in { + 0% { + -webkit-transform: translateY(-45%); + opacity: 0 + } + 100% { + -webkit-transform: translateY(-50%); + opacity: 1 + } +} + +.post-item-card .entry-header { + margin: 10px; + min-height: 90px; + position: relative +} + +.post-item-card .entry-title > a { + text-decoration: none; + font-size: 16px; + line-height: 26px; + font-weight: normal; + color: #000; + text-overflow: -o-ellipsis-lastline; + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; + word-break: break-all +} + +.article-ontop { + color: #eb5055; + font-weight: bold +} + +.post-item-card .entry-meta { + position: absolute; + bottom: 0; + cursor: default +} + +.post-item-card .entry-meta, .entry-meta > a { + font-size: 12px; + text-decoration: none; + color: #666 +} + +.post-item-card .entry-meta > .fa { + margin-right: 3px; + margin-left: 10px +} + +.post-item-card .entry-meta > .fa:first-child { + margin-left: 0 +} + +@media screen and (max-width: 900px) { + #post-lists { + width: 650px; + margin: 0 auto + } + + #post-lists > article { + width: 50% + } +} + +@media screen and (max-width: 660px) { + #post-lists { + width: auto + } + + #post-lists > article { + width: 100% + } + + .post-item-card .post-item-card-body { + max-width: 500px + } + + .post-item-card .thumbnail { + height: 220px + } + + .post-item-card .entry-title > a { + font-size: 20px; + line-height: 32px + } + + .post-item-card .entry-meta, .entry-meta > a { + font-size: 14px + } +} + +@media screen and (max-width: 500px) { + .post-item-card .thumbnail { + height: auto + } + + .post-item-card .entry-header { + margin: 13px; + min-height: 95px + } +} + +.single .post, .single .attachment, .page .page, .comments-area, .width-short, #SOHUCS, #SOHUCS #SOHU_MAIN { + max-width: 700px; + padding: 10px 25px 15px; + margin: 10px auto 0; + background-color: #fff; + background-color: rgba(255, 255, 255, 0.68); + border-radius: 3px +} + +.entry-title { + font-size: 21px; + color: #222; + font-weight: 400; + -webkit-font-smoothing: antialiased; + line-height: 1.8 +} + +.header-info { + font-size: 13px; + margin-top: 10px; + padding-bottom: 15px; + border-bottom: 1px dashed #c5c5c5; + margin-bottom: 20px +} + +.header-info, .header-info a { + color: #a5a5a5; + text-decoration: none; + text-shadow: 0 0 2px #fff +} + +.header-info > span { + margin-right: 10px; + display: inline-block +} + +.article-report { + display: inline-block; + background-color: #f44336; + color: #fff; + text-align: center; + border-radius: 5px; + width: 20px; + height: 20px; + line-height: 20px; + font-size: 12px; + margin-right: 2px; + cursor: pointer; + text-shadow: none +} + +.wp-smiley { + height: 26px !important; + width: auto !important; + max-height: none !important; + vertical-align: bottom; + -webkit-box-shadow: none !important; + -moz-box-shadow: none !important; + box-shadow: none !important; + border: none !important; + border-radius: 0 !important +} + +.entry-content { + font-size: 1em +} + +.entry-content p { + word-wrap: break-word; + word-break: break-word; + margin: 20px 0; + vertical-align: baseline; + line-height: 1.8 +} + +.entry-content ul, .entry-content ol { + padding-left: 20px +} + +.entry-content ul > li, .entry-content ol > li { + margin: .6em 0; + line-height: 1.8em +} + +.entry-content h1 { + font-weight: bold; + font-size: 1.5em; + margin: 35px 0 0 +} + +.entry-content h2 { + font-weight: 500; + position: relative; + margin: 30px 0 20px; + font-size: 1.3em; + color: #444 +} + +.entry-content h2:before { + font-weight: 600; + position: absolute; + top: 0; + left: -15px; + content: '#'; + color: #eb5055 +} + +.entry-content h3 { + font-size: 1.1em; + font-weight: 700; + margin: 1em 0 .8em +} + +.entry-content blockquote { + padding: 5px 10px 5px 20px; + border-left: 4px solid #ddd; + margin: .6em 0; + vertical-align: baseline +} + +.entry-content blockquote > :first-child { + margin-top: 0 +} + +.entry-content blockquote > :last-child { + margin-bottom: 0 +} + +.entry-content code { + color: #fff; + background-color: #9b9b9b; + border-radius: 3px; + padding: 0 3px; + font-size: 100%; + font-weight: normal; + margin: 0 2px +} + +.entry-content .wp-caption { + max-width: 100% +} + +.entry-content .aligncenter, .entry-content .alignnone, .entry-content img.alignnone { + display: block; + margin: 0 auto; + text-align: center +} + +.entry-content .wp-caption .wp-caption-text { + text-align: center; + margin: 10px auto 30px; + border-bottom: 1px #c3c3c3 dashed; + display: inline-block; + padding: 0 6px 1px; + color: #949292; + font-size: .9em +} + +.entry-content img { + max-width: 100%; + height: auto; + border-radius: 2px; + -webkit-box-shadow: 0 0 2.6875rem rgba(0, 0, 0, 0.15); + -moz-box-shadow: 0 0 2.6875rem rgba(0, 0, 0, 0.15); + box-shadow: 0 0 2.6875rem rgba(0, 0, 0, 0.15) +} + +.entry-content a:not([class]):not([data-fancybox]) { + color: #313131; + border-bottom: 1px solid #ccc; + text-decoration: none; + margin: 0 5px +} + +.entry-content a:not([class]):not([data-fancybox]):hover, .comment-content-text a:not([class]):not([data-fancybox]):hover { + color: #eb5055; + border-bottom: 1px solid #eb5055 +} + +.entry-content .gallery { + clear: both; + font-size: 18px +} + +.entry-content .gallery .gallery-item { + margin: 0 !important; + overflow: hidden; + position: relative; + float: left +} + +.entry-content .gallery-caption { + pointer-events: none; + padding: 1000px 20px; + position: absolute; + top: 50%; + left: 0; + right: 0; + -webkit-transform: translateY(-50%); + -moz-transform: translateY(-50%); + -ms-transform: translateY(-50%); + -o-transform: translateY(-50%); + transform: translateY(-50%); + webkit-transition: .5s ease all; + -moz-transition: .5s ease all; + -o-transition: .5s ease all; + transition: .5s ease all; + text-align: center; + color: #fff; + opacity: 0; + background-color: rgba(0, 0, 0, .70); + cursor: pointer +} + +.entry-content .gallery .gallery-item:hover .gallery-caption { + opacity: 1 +} + +.entry-content .gallery-columns-1 .gallery-item { + width: 100% !important +} + +.entry-content .gallery-columns-2 .gallery-item { + width: 50% !important +} + +.entry-content .gallery-columns-3 .gallery-item { + width: 33.3333333% !important +} + +.entry-content .gallery-columns-4 .gallery-item { + width: 25% !important +} + +.entry-content .gallery-columns-5 .gallery-item { + width: 20% !important +} + +.entry-content .gallery-columns-6 .gallery-item { + width: 16.6666667% !important +} + +.entry-content .gallery-columns-7 .gallery-item { + width: 14.2857142857% !important; + font-size: .9em +} + +.entry-content .gallery-columns-8 .gallery-item { + width: 12.5% !important; + font-size: .8em +} + +.entry-content .gallery-columns-9 .gallery-item { + width: 11.11111112% !important; + font-size: .7em +} + +.entry-content .gallery .gallery-item dt:before { + content: ""; + display: block; + padding-top: 100% +} + +.entry-content .gallery .gallery-item dt { + position: relative; + box-shadow: 0 0 0 1px rgba(0, 0, 0, .1) inset; + background: #eee; + cursor: pointer; + overflow: hidden +} + +.entry-content .gallery .gallery-item a { + display: block; + width: 100%; + height: 100%; + position: absolute; + top: 0; + border: 0; + margin: 0 +} + +.entry-content .gallery .gallery-item img { + position: absolute; + top: 0; + left: 0; + height: 100%; + width: 100%; + object-fit: cover; + border: 0 !important; + box-shadow: none +} + +.mk-side-form input { + float: left; + padding: 2px 10px; + width: 77%; + height: 37px; + border: 1px solid #ebebeb; + border-right-color: transparent; + border-radius: 2px 0 0 2px; + line-height: 37px +} + +.mk-side-form button { + position: relative; + overflow: visible; + width: 23%; + height: 37px; + border-radius: 0 2px 2px 0; + text-transform: uppercase +} + +.entry-content .content-extras { + margin: 5px 0 20px +} + +.entry-content .content-extras p { + margin: 5px 0 +} + +.single-copyright { + display: inline-block +} + +.single-tags { + display: inline-block; + float: right +} + +.single-tags > .fa { + color: #b3b3b3 +} + +p.mk-article-collapse, p.mk-article-collapse .fa { + -webkit-transition: all .2s; + -moz-transition: all .2s; + -o-transition: all .2s; + transition: all .2s +} + +p.mk-article-collapse { + cursor: pointer; + background-color: #f5f5f5; + background-color: rgba(245, 245, 245, 0.6); + padding: 5px; + border-radius: 3px; + text-align: center; + font-size: 13px; + margin: 20px auto 10px; + color: #807e7e; + word-break: keep-all; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none +} + +p.mk-article-collapse:hover { + background-color: #eee +} + +.mk-collapse-open .fa { + -webkit-transform: rotate(180deg); + -moz-transform: rotate(180deg); + -ms-transform: rotate(180deg); + -o-transform: rotate(180deg); + transform: rotate(180deg) +} + +.code-pretty-container { + position: relative; + margin-bottom: 1em +} + +.code-pretty-container .code-type { + position: absolute; + top: 0; + right: 0; + padding: 5px 10px; + background: #eb5055; + color: #fff; + cursor: pointer; + border-radius: 0 3px 0 5px; + font-size: .8em; + user-select: none +} + +.code-pretty-container .prettyprint { + margin-bottom: .5em; + border-radius: 3px +} + +.code-pretty-container textarea { + position: absolute; + top: 0 +} + +.code-pretty-container .code-pretty-toolbar .btn.fa { + font-size: .8em +} + +.code-pretty-container .code-pretty-toolbar .msg { + line-height: 1.8; + font-size: .8em; + padding: 6px 12px; + padding-left: 20px; + color: #827171; + display: none +} + +.code-pretty-container .code-pretty-toolbar .back-to-pretty { + display: none +} + +.social-main { + user-select: none; + border-top: 1px solid #eee; + border-bottom: 1px solid #eee; + padding: 15px 5px; + margin: 10px 0; + text-align: center; + -webkit-transition: .4s; + -moz-transition: .4s; + -o-transition: .4s; + -ms-transition: .4s; + opacity: .3 +} + +.social-main:hover { + opacity: 1 +} + +.social-main > div { + display: inline-block; + margin-right: 15px; + padding-left: 35px; + position: relative; + cursor: pointer +} + +.social-main > div:last-child { + margin-right: 0 +} + +.social-main > div .fa { + font-size: 28px; + position: absolute; + width: 30px; + left: 0; + top: -5px +} + +.social-main .like:hover { + background: 0 +} + +.social-main .likeHeart { + z-index: 2 +} + +.social-main .likeHeart, .social-main .likeHeart:after, .social-main .likeHeart:before { + background: url(images/like_heart.png); + background-position: left; + background-repeat: no-repeat; + height: 80px; + width: 80px; + cursor: pointer; + position: absolute; + left: -25px; + top: -30px; + background-size: 2900% +} + +.social-main .like:hover .likeHeart, .social-main .like:focus .likeHeart { + background-position: right +} + +.social-main .like:hover .likeHeart:before, .social-main .like:hover .likeHeart:after { + content: ''; + background-position: right; + position: absolute; + -webkit-animation: ilike 2.13584698s infinite; + animation: ilike 2.13584698s infinite; + z-index: 0 +} + +.social-main .like:hover .likeHeart:after { + content: ''; + background-position: right; + position: absolute; + -webkit-animation: ilike 3.141592653s infinite; + animation: ilike 3.141592653s infinite +} + +@-webkit-keyframes ilike { + 0% { + -webkit-transform: translateY(29px); + transform: translateY(29px); + margin-left: 25px + } + 20% { + margin-left: 35px + } + 40% { + margin-left: -6px + } + 60% { + margin-left: 4px + } + 80% { + margin-left: -2px + } + 100% { + opacity: 0; + -webkit-transform: translateY(-50px) rotate(180deg) scale(.5); + transform: translateY(-50px) rotate(180deg) scale(.5) + } +} + +@keyframes ilike { + 0% { + -webkit-transform: translateY(29px); + transform: translateY(29px); + margin-left: 25px + } + 20% { + margin-left: 35px + } + 40% { + margin-left: -6px + } + 60% { + margin-left: 4px + } + 80% { + margin-left: -2px + } + 100% { + opacity: 0; + -webkit-transform: translateY(-50px) rotate(180deg) scale(.5); + transform: translateY(-50px) rotate(180deg) scale(.5) + } +} + +.social-main .done { + display: inline-block; + -webkit-animation-name: heartBlast; + animation-name: heartBlast; + -webkit-animation-duration: .8s; + animation-duration: .8s; + -webkit-animation-iteration-count: 1; + animation-iteration-count: 1; + -webkit-animation-timing-function: steps(28); + animation-timing-function: steps(28); + background-position: right +} + +@-webkit-keyframes heartBlast { + 0% { + background-position: left + } + 100% { + background-position: right + } +} + +@keyframes heartBlast { + 0% { + background-position: left + } + 100% { + background-position: right + } +} + +.social-main .reward .fa { + color: #aab8c2 +} + +.social-main .reward .reward-qrcode { + background-color: #fff; + box-shadow: 0 0 6px rgba(14, 22, 30, .3); + left: -40px; + top: -15px; + position: absolute; + width: 130px; + height: 0; + max-width: 130px; + z-index: 10; + padding: 5px; + opacity: 0; + pointer-events: none; + -webkit-transition: .4s; + -moz-transition: .4s; + -o-transition: .4s; + -ms-transition: .4s +} + +.social-main .reward:hover .reward-qrcode { + display: block; + opacity: 1; + height: 130px; + top: -145px +} + +#article-share, #article-menu { + position: fixed; + left: 50%; + top: 50%; + transform: translate(0, -50%) +} + +#article-share { + margin-left: -430px; + color: #8590a6; + opacity: 0; + text-align: center; + display: none +} + +#article-share.headroom--pinned { + opacity: 1; + visibility: visible +} + +#article-share.headroom--unpinned { + opacity: 0; + visibility: hidden; + display: none +} + +#article-share .share-item { + cursor: pointer; + width: 48px; + height: 50px; + font-size: 12px; + margin: 18px 0 +} + +#article-share .share-item[data-site="weixin"] { + color: #7dd239 +} + +#article-share .share-item[data-site="weibo"] { + color: #f96e76 +} + +#article-share .share-item[data-site="qq"] { + color: #1e93ec +} + +#article-share .share-item:hover { + color: #8590a6 +} + +#article-share .fa { + font-size: 23px; + display: block; + margin-bottom: 6px +} + +.fancybox-stage .share-qrcode { + max-width: 240px +} + +@media screen and (max-width: 900px) { + #article-share, #article-menu { + display: none + } +} + +#article-menu::-webkit-scrollbar { + height: 6px; + width: 6px +} + +#article-menu::-webkit-scrollbar-track-piece { + background-color: #f5f5f5 +} + +#article-menu::-webkit-scrollbar-thumb { + height: 6px; + width: 6px; + border-radius: 0; + background: #cbcbcb +} + +#article-menu::-webkit-scrollbar-thumb:hover { + background: #909090 +} + +#article-menu { + margin-left: 350px; + overflow: hidden; + overflow-y: hidden; + width: 200px; + max-height: 300px +} + +#article-menu:hover { + overflow-y: auto +} + +#article-menu ul { + margin: 10px; + border-left: 3px #eee solid; + padding-left: 10px; + position: relative; + display: none +} + +#article-menu ul > li { + list-style: none; + padding: 5px 0; + position: relative +} + +#article-menu ul > li > a { + display: block; + word-break: keep-all; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + color: #8590a6 +} + +#article-menu ul > li > a:hover { + color: gray +} + +#article-menu ul > li.active > a { + color: #f44336 +} + +#article-menu ul > li.active:before { + content: ""; + width: 12px; + height: 12px; + border-radius: 100%; + position: absolute; + left: -18px; + background: #9e9e9e; + top: 50%; + transform: translate(0, -50%) +} + +#article-menu ul > li.menu-level-two { + padding-left: 8px; + font-size: .8em +} + +#respond { + margin: 20px 0 +} + +.comment-reply-title { + margin-bottom: 15px +} + +.comment-reply-title span { + border-left: 4px solid #eb5055; + padding-left: 5px; + font-size: 16px; + display: inline-block; + line-height: 30px +} + +#cancel-comment-reply-link { + float: right; + color: #e26f6f; + line-height: 30px +} + +.comment-author-welcome { + margin: 10px 0 +} + +.comment-author-welcome .avatar { + border-radius: 50%; + vertical-align: middle; + margin-right: 10px; + width: 30px; + height: 30px; + user-select: none +} + +.comment-author-welcome .links { + user-select: none; + display: inline-block +} + +#comment-author-info > div { + width: 33.33%; + box-sizing: border-box; + padding-right: 10px; + float: left; + padding-bottom: 10px +} + +#comment-author-info > div:last-child { + padding-right: 0 +} + +#comment-author-info > div > label { + font-size: 12px; + line-height: 20px; + padding-bottom: 3px; + display: block +} + +.comment-form-comment { + margin-bottom: 5px +} + +#comment-tips { + display: none; + margin: 5px 0 +} + +#comment-tips .comment-error { + color: #eb5055 +} + +#comment-tips .comment-success { + color: #4caf50 +} + +.comment-form-tools { + margin-bottom: 10px; + border-bottom: 1px dashed #e5e9ef; + padding-bottom: 2px; + display: none; + user-select: none +} + +.comment-form-tools span { + display: inline-block; + margin-right: 5px; + padding-left: 1px; + cursor: pointer; + height: 25px; + line-height: 25px; + text-align: center; + font-size: 14px; + border-radius: 3px; + color: #848484 +} + +.comment-extra-input { + width: 100%; + max-width: 450px +} + +.comment-extra-input h5 { + font-size: 23px; + font-weight: 100; + text-align: center; + margin: 0 auto 15px; + letter-spacing: .1em +} + +.comment-extra-input form input { + margin-bottom: 8px; + padding: 8px 6px +} + +.comment-extra-input form button { + width: 100%; + height: 33px; + margin-top: 6px +} + +.comment-pic-input .or { + margin: 2px auto 10px; + font-size: 20px; + color: #777575 +} + +.comment-pic-upload { + position: relative +} + +.comment-pic-upload #comment-pic-upload { + position: absolute; + z-index: 1; + cursor: pointer; + opacity: 0 +} + +.comment-pic-upload .comment-pic-upload-btn, .comment-pic-upload #comment-pic-upload { + width: 100%; + background: #dcdada; + margin: 0 auto 20px; + display: block; + height: 80px; + color: #4a4a4a; + border: 3px dashed #888; + -webkit-transition: .2s; + -moz-transition: .2s; + -ms-transition: .2s; + -o-transition: .2s; + transition: .2s +} + +.comment-pic-upload:hover .comment-pic-upload-btn, .comment-pic-upload:hover #comment-pic-upload { + background: #f5f3f3 +} + +.comment-pic-upload.ondrag .comment-pic-upload-btn, .comment-pic-upload.ondrag #comment-pic-upload { + border-color: #000 +} + +.comment-mail-notify { + display: inline-block; + line-height: 29px +} + +.comment-form-vf-code { + display: inline-block +} + +.comment-form-vf-code img { + cursor: pointer; + margin-left: 10px; + margin-top: 3px +} + +.comment-form-vf-code input { + display: inline-block; + width: 60px; + float: left +} + +.comment-form-submit #submit, .comment-form-submit #submit:focus, .comment-form-submit #submit:hover { + border-radius: 2px; + font-size: 12px; + padding: 2px 20px; + line-height: 25px; + width: auto; + float: right +} + +.comment-list, .comment-list ol, .comment-list ul { + list-style: none +} + +.comment-list > li { + padding-top: 20px +} + +.comment-body { + position: relative; + min-height: 55px +} + +.comment-avatar-area { + position: absolute +} + +.comment-avatar-area > .avatar { + width: 48px; + height: 48px; + border-radius: 50%; + border: 0; + vertical-align: middle; + user-select: none +} + +.comment-list > li:after { + content: ""; + display: block; + height: 1px; + background-color: #e5e9ef; + margin-top: 20px +} + +.comment-content-user { + line-height: 18px; + padding-bottom: 4px; + display: block; + word-wrap: break-word +} + +.comment-content-user .comment-auth, .comment-content-user .comment-auth a { + text-decoration: none; + font-size: 12px; + font-weight: 700; + word-wrap: break-word; + color: #6d757a; + cursor: pointer +} + +.comment-content-user .level { + margin-left: 5px; + font-size: 12px; + color: #fff; + background-color: #666; + padding: 0 4px; + border-radius: 2px; + font-size: 12px; + cursor: pointer; + -webkit-transition: .3s; + -moz-transition: .3s; + -o-transition: .3s; + -ms-transition: .3s; + filter: alpha(opacity=50); + -moz-opacity: .5; + -khtml-opacity: .5; + opacity: .5; + line-height: 150%; + display: inline-block; + vertical-align: middle +} + +.comment-content-area:hover .comment-content-user .level { + filter: alpha(opacity=100); + -moz-opacity: 1; + -khtml-opacity: 1; + opacity: 1 +} + +.comment-content-user .level-1 { + background: #348be8 +} + +.comment-content-user .level-2 { + background: #0bf +} + +.comment-content-user .level-3 { + background: #fd8edb +} + +.comment-content-user .level-4 { + background: #673ab7 +} + +.comment-content-user .level-5 { + background: #ffb31e +} + +.comment-content-user .level-6 { + background: #6ec400 +} + +.comment-content-user .level-7 { + background: #fc912d +} + +.comment-content-user .level-8 { + background: #fd5d3c +} + +.comment-content-user .level-9 { + background: #fd5d3c +} + +.comment-content-user .level-admin { + background: #fd5d3c +} + +.comment-content-text { + line-height: 25px; + padding: 2px 0; + font-size: 14px; + text-shadow: none; + overflow: hidden; + word-wrap: break-word; + word-break: break-word +} + +.comment-awaiting-moderation { + color: #eb5055 +} + +.comment-content-info { + margin-top: 4px; + margin-bottom: 8px; + font-size: 13px +} + +.comment-content-info, .comment-content-info a { + color: #99a2aa; + text-decoration: none +} + +.comment-content-info span { + margin-right: 6px +} + +.comment-content-area, .comment.depth-1 > .children, .comment-list > li:after, .comment-list > .comment.depth-1 > #respond { + margin-left: 75px +} + +.comment.depth-1 > .children .comment-body { + margin-top: 20px +} + +.comment.depth-1 > .children .comment-avatar-area > .avatar { + width: 35px; + height: 35px +} + +.comment.depth-1 > .children .comment-content-area { + margin-left: 50px +} + +.comment-at { + color: #eb5055 !important; + border: none !important; + margin-right: 5px +} + +@media screen and (max-width: 750px) { + .comment-content-area, .comment.depth-1 > .children, .comment-list > li:after, .comment-list > .comment.depth-1 > #respond { + margin-left: 65px + } +} + +@media screen and (max-width: 500px) { + .comment.depth-1 > .children, .comment-list > li:after, .comment-list > .comment.depth-1 > #respond { + margin-left: 0 + } + + .comment.depth-1 > .children { + border-left: 3px dotted #f3f3f3; + padding-left: 12px + } + + .comment-at { + display: inline-block + } +} + +.page-navi, .comment-navi, .article-navi { + margin: 0; + padding: 0 10px; + list-style: none; + text-align: center; + margin: 20px 0; + text-shadow: 1px 1px 10px #fff +} + +.page-navi li { + display: inline-block; + color: #5f5f5f; + line-height: 20px +} + +.article-navi a { + border: none !important; + margin: 0 !important +} + +.page-navi li a, .comment-navi .page-numbers, .article-navi span, .article-navi > a > span { + display: inline-block; + font-size: 14px; + padding: 4px 15px 4px; + color: #5f5f5f; + text-decoration: none +} + +.page-navi li.current a, .comment-navi .page-numbers.current, .article-navi span { + color: #eb5055 +} + +@media screen and (max-width: 750px) { + .single .post, .page .page, .comments-area, .width-short { + max-width: none; + width: 100%; + padding-left: 10px; + padding-right: 10px + } + + .entry-content h2 { + margin-left: 15px + } +} + +#site-footer { + font-size: 13px; + margin-top: 10px; + text-align: center; + padding: 12px +} + +#site-footer, #site-footer a { + color: #9a9a9a; + vertical-align: baseline; + text-decoration: none +} + +#site-footer .fa { + margin-left: 5px; + font-size: 20px +} + +@media screen and (max-width: 650px) { + #site-footer span { + display: none + } + + #scroll-to-top.show { + right: 30px + } +} + +#scroll-to-top { + width: 40px; + height: 40px; + line-height: 37px; + text-align: center; + font-size: 18px; + color: #9c9c9c; + position: fixed; + right: 50px; + bottom: 50px; + cursor: pointer; + background-color: #fff; + border-radius: 100%; + box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.43); + opacity: 0; + -webkit-transition: .5s ease all; + -moz-transition: .5s ease all; + -o-transition: .5s ease all; + transition: .5s ease all +} + +#scroll-to-top.show { + opacity: .5 +} + +#scroll-to-top.show:hover { + opacity: 1 +} + +#scroll-to-top.show.headroom--pinned { + bottom: 50px +} + +#scroll-to-top.show.headroom--unpinned { + bottom: -60px; + opacity: 0 +} + +#post-lists, .single .post, .page .page, .comments-area, .width-short { + -webkit-animation: fadeIn .6s linear; + animation: fadeIn .6s linear +} + +@-webkit-keyframes fadeIn { + from { + opacity: 0; + -webkit-transform: translateY(-15px) + } + to { + opacity: 1; + -webkit-transform: translateY(0) + } +} + +@keyframes fadeIn { + from { + opacity: 0; + transform: translateY(-15px) + } + to { + opacity: 1; + transform: translateY(0) + } +} + +.post-item-card .post-item-card-body, .single .post, .single .attachment, .page .page, .comments-area, .width-short, #SOHUCS, #SOHUCS #SOHU_MAIN { + background-color: #fff; + background-color: rgba(255, 255, 255, 0.88) +} + +.entry-content ul.wp-block-gallery { + padding-left: 0 +} + +.wp-block-button .wp-block-button__link { + font-size: 1em; + padding: 5px 15px +} + +.wp-block-latest-comments__comment-excerpt p { + margin: 0 +} + +.blocks-gallery-item img { + -webkit-box-shadow: none; + -moz-box-shadow: none; + box-shadow: none +} + +.prettyprint { + margin-bottom: 1em; + overflow: auto; + overflow-y: hidden +} + +.prettyprint ol.linenums, .prettyprint ol { + padding: 10px 0 10px 20px; + margin-left: 15px +} + +.prettyprint ol > li { + margin: 0; + padding: 0 !important +} + +.prettyprint .pre-title { + padding: 8px 0 0 8px +} + +.prettyprint { + background: #151718; + font-family: Menlo, Bitstream Vera Sans Mono, DejaVu Sans Mono, Monaco, Consolas, monospace; + border: 0 !important +} + +.pln { + color: #e6e9ed +} + +ol.linenums { + margin-top: 0; + margin-bottom: 0; + color: #484646 +} + +li.L0, li.L1, li.L2, li.L3, li.L4, li.L5, li.L6, li.L7, li.L8, li.L9 { + padding-left: 1em; + list-style-type: decimal +} + +@media screen { + .str { + color: #ffce54 + } + + .kwd { + color: #4fc1e9 + } + + .com { + color: #676767 + } + + .typ { + color: #4fc1e9 + } + + .lit { + color: #ac92ec + } + + .pun { + color: #e6e9ed + } + + .opn { + color: #e6e9ed + } + + .clo { + color: #e6e9ed + } + + .tag { + color: #ed5565 + } + + .atn { + color: #a0d468 + } + + .atv { + color: #ffce54 + } + + .dec { + color: #ac92ec + } + + .var { + color: #e6e9ed + } + + .fun { + color: #e6e9ed + } +} + +/* highlight */ +.dp-highlighter { + background: #fff; + border: 1px solid #e8e9e7; + word-break: break-all; + white-space: normal; + overflow: auto; + padding: 2px 5px; + font-size: 13px +} + +.dp-highlighter .bar { + padding: 0 +} + +.dp-highlighter .collapsed .bar, .dp-highlighter .nogutter .bar { + padding-left: 0 +} + +.dp-highlighter ol { + margin: 0 0 1px -10px; + padding: 2px; + color: #666 +} + +.dp-highlighter.nogutter ol { + list-style-type: none +} + +.dp-highlighter ol li, .dp-highlighter .columns div { + border-left: 1px solid #e8e9e7; + padding-left: 10px; + line-height: 2em; + list-style-position: outside; + white-space: nowrap; + margin: 0 0 0 35px +} + +.dp-highlighter.nogutter ol li, .dp-highlighter.nogutter .columns div { + border: 0; + margin: 0 +} + +.dp-highlighter .columns { + color: gray; + width: 100% +} + +.dp-highlighter .columns div { + padding-bottom: 5px +} + +.dp-highlighter ol li span { + color: Black +} + +.dp-highlighter .collapsed ol { + margin: 0 +} + +.dp-highlighter .collapsed ol li { + display: none +} + +.dp-highlighter .printing { + border: 0 +} + +.dp-highlighter .printing .tools { + display: none !important +} + +.dp-highlighter .printing li { + display: list-item !important +} + +.dp-highlighter .tools { + padding: 3px 8px 3px 15px; + border-bottom: 1px solid #2b91af; + color: silver +} + +.dp-highlighter .collapsed .tools { + border-bottom: 0 +} + +.dp-highlighter .tools a { + font-size: 9pt; + color: gray; + text-decoration: none; + margin-right: 10px +} + +.dp-highlighter .tools a:hover { + color: red; + text-decoration: underline +} + +.dp-about { + background-color: #fff; + margin: 0; + padding: 0 +} + +.dp-about table { + width: 100%; + height: 100% +} + +.dp-about td { + padding: 10px; + vertical-align: top +} + +.dp-about .copy { + border-bottom: 1px solid #aca899; + height: 95% +} + +.dp-about .title { + color: red; + font-weight: bold +} + +.dp-about .para { + margin: 0 0 4px 0 +} + +.dp-about .footer { + background-color: #eceadb; + border-top: 1px solid #fff; + text-align: right +} + +.dp-about .close { + background-color: #eceadb; + width: 60px; + height: 22px +} + +.dp-c .comment { + color: green +} + +.dp-c .string { + color: blue +} + +.dp-c .preprocessor { + color: gray +} + +.dp-c .keyword { + color: blue +} + +.dp-c .vars { + color: #d00 +} + +.dp-vb .comment { + color: green +} + +.dp-vb .string { + color: blue +} + +.dp-vb .preprocessor { + color: gray +} + +.dp-vb .keyword { + color: blue +} + +.dp-sql .comment { + color: green +} + +.dp-sql .string { + color: red +} + +.dp-sql .keyword { + color: #7f0055 +} + +.dp-sql .func { + color: #ff1493 +} + +.dp-sql .op { + color: blue +} + +.dp-xml .cdata { + color: #ff1493 +} + +.dp-xml .comments { + color: green +} + +.dp-xml .tag { + font-weight: bold; + color: blue +} + +.dp-xml .tag-name { + color: #7f0055; + font-weight: bold +} + +.dp-xml .attribute { + color: red +} + +.dp-xml .attribute-value { + color: blue +} + +.dp-delphi .comment { + color: #008200; + font-style: italic +} + +.dp-delphi .string { + color: blue +} + +.dp-delphi .number { + color: blue +} + +.dp-delphi .directive { + color: #008284 +} + +.dp-delphi .keyword { + font-weight: bold; + color: navy +} + +.dp-delphi .vars { + color: #000 +} + +.dp-py .comment { + color: green +} + +.dp-py .string { + color: red +} + +.dp-py .docstring { + color: green +} + +.dp-py .keyword { + color: blue; + font-weight: bold +} + +.dp-py .builtins { + color: #ff1493 +} + +.dp-py .magicmethods { + color: #808080 +} + +.dp-py .exceptions { + color: brown +} + +.dp-py .types { + color: brown; + font-style: italic +} + +.dp-py .commonlibs { + color: #8a2be2; + font-style: italic +} + +.dp-rb .comment { + color: #c00 +} + +.dp-rb .string { + color: #f0c +} + +.dp-rb .symbol { + color: #02b902 +} + +.dp-rb .keyword { + color: #069 +} + +.dp-rb .variable { + color: #6cf +} + +.dp-css .comment { + color: green +} + +.dp-css .string { + color: red +} + +.dp-css .keyword { + color: blue +} + +.dp-css .colors { + color: darkred +} + +.dp-css .vars { + color: #d00 +} + +.dp-j .comment { + color: #3f7f5f +} + +.dp-j .string { + color: #2a00ff +} + +.dp-j .keyword { + color: #7f0055; + font-weight: bold +} + +.dp-j .annotation { + color: #646464 +} + +.dp-j .number { + color: #c00000 +} + +.dp-cpp .comment { + color: #e00 +} + +.dp-cpp .string { + color: red +} + +.dp-cpp .preprocessor { + color: #cd00cd; + font-weight: bold +} + +.dp-cpp .keyword { + color: #5697d9; + font-weight: bold +} + +.dp-cpp .datatypes { + color: #2e8b57; + font-weight: bold +} + +.dp-perl .comment { + color: green +} + +.dp-perl .string { + color: red +} + +.dp-perl .keyword { + color: #7f0055 +} + +.dp-perl .func { + color: #ff1493 +} + +.dp-perl .declarations { + color: blue +} + +.dp-css .vars { + color: #d00 +} + +.dp-g .comment { + color: #3f7f5f +} + +.dp-g .string { + color: #2a00ff +} + +.dp-g .keyword { + color: #7f0055; + font-weight: bold +} + +.dp-g .type { + color: #007f00; + font-weight: bold +} + +.dp-g .modifier { + color: #640064; + font-weight: bold +} + +.dp-g .constant { + color: #f00; + font-weight: bold +} + +.dp-g .method { + color: #ff6000; + font-weight: bold +} + +.dp-g .number { + color: #c00000 +} + +.dp-html .cdata { + color: #ff1493 +} + +.dp-html .comments { + color: #236e25 +} + +.dp-html .tag { + color: #bcacba +} + +.dp-html .tag-name { + color: #881280 +} + +.dp-html .attribute { + color: #ab652d +} + +.dp-html .attribute-value { + color: #1a1aa6 +} + +.comment-list .dp-highlighter { + background: #fff; + margin-top: 5px; + border: 1px solid #e8e9e7 +} + +.comment-list .dp-highlighter li { + margin: 0; + padding: 0 5px; + border: 0 +} + +.comment-list .dp-highlighter ol { + margin: 0 +} + +/* emoji */ +.emoji_btn { + position: absolute; + display: inline-block; + cursor: pointer; + width: 25px; + height: 25px +} + +.emoji_container * { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box +} + +.emoji_container { + display: none; + max-width: 544px; + position: absolute; + background-color: #fff; + border: 1px solid #bfbfbf; + box-shadow: 0 1px 3px rgba(0, 0, 0, 0.176) +} + +.emoji_container ul { + list-style: none; + padding-left: 0; + margin: 0 +} + +.emoji_content { + height: 277px; + overflow-y: auto; + padding: 5px +} + +.emoji_content ul { + padding-top: 1px; + padding-left: 1px +} + +.emoji_content ul li { + width: 54px; + height: 54px; + float: left; + border: 1px solid #e3e3e3; + margin-top: -1px; + margin-left: -1px; + margin-right: 0; + margin-bottom: 0 +} + +.emoji_content ul li a { + display: block; + line-height: 54px; + text-align: center; + cursor: pointer +} + +.emoji_content ul li a img { + vertical-align: middle; + max-width: 52px; + max-height: 52px +} + +.emoji_content .mCSB_scrollTools { + width: 10px +} + +.emoji_content .mCSB_outside + .mCS-minimal-dark.mCSB_scrollTools_vertical, .emoji_content .mCSB_outside + .mCS-minimal.mCSB_scrollTools_vertical { + margin: 5px 0 +} + +.emoji_tab { + background-color: #f7f7f7; + border-top: 1px solid #e3e3e3; + color: #666; + height: 32px; + position: relative +} + +.emoji_tab_prev { + border-top: 4px solid transparent; + border-bottom: 4px solid transparent; + border-right: 4px dashed; + cursor: pointer; + left: 8px; + top: 12px; + position: absolute; + display: inline-block; + height: 0; + vertical-align: middle; + width: 0 +} + +.emoji_tab_next { + border-top: 4px solid transparent; + border-bottom: 4px solid transparent; + border-left: 4px dashed; + cursor: pointer; + right: 7px; + top: 12px; + position: absolute; + display: inline-block; + height: 0; + vertical-align: middle; + width: 0 +} + +.emoji_tab_list { + left: 22px; + overflow: hidden; + position: absolute; + top: 0; + width: 500px +} + +.emoji_tab_list ul { + width: 1500px; + transition: all .8s ease 0s +} + +.emoji_tab_list ul li { + border-top: 0 none; + cursor: pointer; + float: left; + height: 22px; + line-height: 22px; + margin: 5px 4px 0 0; + font-size: 12px; + border-radius: 3px; + text-align: center; + width: 68px; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis +} + +.emoji_tab_list ul li:hover { + background: #e5e5e5 +} + +.emoji_tab_list ul li.selected { + color: #fff; + background: steelblue +} + +.emoji_preview { + position: absolute; + top: 0; + border: 1px solid #c8c8c8; + border-radius: 50%; + width: 65px; + height: 65px; + background: #fff; + text-align: center; + line-height: 65px; + box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.176); + z-index: 2; + display: none +} + +.emoji_preview img { + vertical-align: middle; + max-width: 42px; + max-height: 42px +} + +.emoji_tab_next, .emoji_tab_prev { + display: none +} + +.emoji_tab_list { + left: 8px +} + +.emoji_tab_list ul li { + width: auto; + padding: 0 15px; + -khtml-user-select: none; + -moz-user-select: none; + user-select: none; + -webkit-transition: .2s; + -moz-transition: .2s; + -o-transition: .2s; + -ms-transition: .2s; + transition: .2s +} + +.emoji_content ul li { + display: inline-block; + float: none +} + +.emoji_content ul li a img { + max-height: 35px +} + +.emoji_container { + margin-right: 10px; + max-width: 520px +} + +.emoji_preview { + pointer-events: none +} diff --git a/html/about.html b/html/about.html new file mode 100644 index 0000000..122d0c9 --- /dev/null +++ b/html/about.html @@ -0,0 +1,79 @@ + + + + + AZJ~关于我 + + + + + + + + + +
+
+

About Me

+

因为一个人,爱上一座城。

+

毕业之后,因为一个故事来到了帝都。

+

博铭:三十功名尘与土,八千里路云和月

+

Contact

+

可通过如下方式联系到我

+

QQ:876784235

+

Email:zengzhiwei_hfut@163.com

+

Github:zengzhiwei12138 +

+

Gitee:zzwazj

+
+

About Site

+

本站建于2018年9月,主要记录技术分享,交流,生活心得,吐槽等...

+

本站所用技术

+

前端:art-template html5&css3 es6 wow tagCould esc

+

后端:springmvc spring mybatis dubbo esc

+

数据库:mariadb

+

About Rights

+

本站由azj博客创作,采用知识共享署名4.0国际许可协议进行许可 +

+

本站文章除注明转载/出处外,均为本站原创或翻译,转载前请务必署名

+

只要您在使用时注明出处,就可以对本站所有原创内容进行转载、节选、二次创作,但是您不得对其用于商业目的

+
+
+

——About Me——

+

网名:AZJ

+

职业:Java后端攻城狮

+

籍贯:河南-信阳

+

邮箱:876784235@qq.com

+
+

——WeChat——

个人微信
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/html/article.html b/html/article.html new file mode 100644 index 0000000..73dbf41 --- /dev/null +++ b/html/article.html @@ -0,0 +1,67 @@ + + + + + + + AZJ~文章列表 + + + + + + + +
+
+
+ +
+
+ +
<<
+ +
+ + + + + + + + + + + \ No newline at end of file diff --git a/html/detail.html b/html/detail.html new file mode 100644 index 0000000..7996a1e --- /dev/null +++ b/html/detail.html @@ -0,0 +1,136 @@ + + + + + AZJ~文章详情 + + + + + + + + + + + +
+
+

发表评论

+
+
    +
  • +
  • +
  • +
  • +
+
+
+
+
+

+
确认提交 +
+
+
+
+ +
+
+ +
+ +
+
+ 分享 +
+ 微信 +
+
+ 微博 +
+
+ QQ +
+
+ +
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/html/friendLink.html b/html/friendLink.html new file mode 100644 index 0000000..04a2e80 --- /dev/null +++ b/html/friendLink.html @@ -0,0 +1,79 @@ + + + + + AZJ ~ 友情链接 + + + + + + + + + +
+ + +
+ + +
+ + + + + + + + + + + \ No newline at end of file diff --git a/html/index.html b/html/index.html new file mode 100644 index 0000000..abc4373 --- /dev/null +++ b/html/index.html @@ -0,0 +1,115 @@ + + + + + AZJ@二人世界 + + + + + + + + + + + + +
+

azj

+

三十功名尘与土,八千里路云和月

+ +
+
+ +
+
+
+

Hot Article

+
+
+
+
+
+
+
+ +
+
+
+ +
+
+
+
+ +
+
+

Close Friends

+ +
+
+
+ +
+ +
+
+
Copyright©2018-2019 AZJ@二人世界All Rights Reserved京ICP备18053311号
+
+
+
+
+
+
+
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/html/label.html b/html/label.html new file mode 100644 index 0000000..9065202 --- /dev/null +++ b/html/label.html @@ -0,0 +1,47 @@ + + + + + + + AZJ~标签页面 + + + + + + + + +

标签

+

』标签相关的内容

+
+
+ +
+
+ +
+ + + + + + + + + \ No newline at end of file diff --git a/html/publish.html b/html/publish.html new file mode 100644 index 0000000..341c672 --- /dev/null +++ b/html/publish.html @@ -0,0 +1,90 @@ + + + + + 发布博客 + + + + + + + +
+
+
+
    +
  • +
    图片:
    +
    分类:
    +
  • +
  • +
    标题:
    +
    置顶:已设置为置顶
    +
  • +
  • +
    标签:
    +
    私密:已设置为私密文章
    +
  • +
  • +
    赞赏:
    +
    原创:已设置为原创 +
    +
  • +
  • +
    开篇:
    +
  • +
+
开篇描述:
+
+
+
+
+
文章内容:
+
+
+
+
+ 确认提交
+
+
+ +
+ + + + + + + + + + + \ No newline at end of file diff --git a/js/article.js b/js/article.js new file mode 100644 index 0000000..74ee1c2 --- /dev/null +++ b/js/article.js @@ -0,0 +1,419 @@ +const article = ``; + + +const classify = ` {{each classifyList classify index}} +
  • + {{classify.classifyName}} +
  • + {{/each}}`; + +const hot_article = ` {{each hotArticleList hotArticle index}} +
  • + {{hotArticle.title}} +
  • + {{/each}}`; + +const label = `{{each labelList label index}} + {{label.labelName}} + {{/each}}`; + +const line = "

    我也是有底线的!

    "; + +let pageNum = 1; +let articleRender = template.compile(article); +let exist = false; + +//定义分类,标签,搜索 +let is_classify_id = 0; +let is_search_keywords = ""; +let is_label_id = ""; + +$(function () { + getPageArticle(pageNum); + let classifyRender = template.compile(classify); + $.ajax({ + url: '/classify/getClassify.action', + type: 'POST', + success: function (res) { + let classifyData = { + classifyList: res.data + }; + let classifyHtml = classifyRender(classifyData); + $('#classify').html(classifyHtml); + //分类的点击事件 + $('#classify>li').each(function () { + $(this).click(function () { + let classifyId = $(this).attr('name'); + + getArticleByClassify(classifyId); + }); + }); + } + }); + + let hotArticleRender = template.compile(hot_article); + $.ajax({ + url: '/article/hotArticle.action', + type: 'POST', + success: function (res) { + let hotArticleData = { + hotArticleList: res.data + }; + let hotArticleHtml = hotArticleRender(hotArticleData); + $('#hot_article').html(hotArticleHtml); + } + }); + + $.ajax({ + url: '/article/topArticle.action', + type: 'POST', + success: function (res) { + let topArticleData = { + hotArticleList: res.data + }; + let topArticleHtml = hotArticleRender(topArticleData); + $('#top_article').html(topArticleHtml); + } + }); + + let labelRender = template.compile(label); + $.ajax({ + url: '/label/getLabel.action', + type: 'POST', + success: function (res) { + let labelData = { + labelList: res.data + }; + let labelHtml = labelRender(labelData); + $('#tag_cloud_widget').html(labelHtml); + tagCloud(); + $('#tag_cloud_widget>span').each(function () { + $(this).click(function () { + // 清楚分类和搜索的标记 + is_classify_id = 0; + is_search_keywords = ""; + pageNum = 1; + exist = false; + // 获取labelId + let labelId = $(this).attr('name'); + is_label_id = labelId; + getPageArticle(pageNum); + $('body,html').animate({scrollTop: 0}, 300); + }); + }); + } + }); + + if (document.body.offsetWidth <= 500) { + $('.left1').click(function () { + let hot_article = $("li[name='hot_article']"); + let article_label = $("li[name='article_label']"); + let classify = $('#classifyBox'); + if ($('.left1').text() == '<') { + $('#overLay').removeAttr('hidden'); + $('.left1').text('>'); + if (article_label.hasClass('label_mobile_open')) { + article_label.removeAttr('style'); + article_label.removeClass('fadeInUp'); + article_label.addClass('fadeOutDown'); + $('.left2').text('<'); + } + if (classify.hasClass('classify_mobile_open')) { + classify.removeAttr('style'); + classify.removeClass('bounceInDown'); + classify.addClass('bounceOutDown'); + } + if (hot_article.hasClass('hot_mobile_open')) { + hot_article.removeAttr('style'); + hot_article.addClass('fadeInRight'); + hot_article.removeClass('fadeOutRight'); + } else { + hot_article.addClass('hot_mobile_open'); + hot_article.removeClass('mobile_close'); + } + } else { + hot_article.removeAttr('style'); + hot_article.removeClass('fadeInRight'); + hot_article.addClass('fadeOutRight'); + $('#overLay').attr('hidden', 'hidden'); + $('.left1').text('<'); + } + + $('#overLay').click(function () { + hot_article.removeAttr('style'); + hot_article.removeClass('fadeInRight'); + hot_article.addClass('fadeOutRight'); + $('#overLay').attr('hidden', 'hidden'); + $('.left1').text('<'); + }); + }); + + $('.left2').click(function () { + let hot_article = $("li[name='hot_article']"); + let article_label = $("li[name='article_label']"); + let classify = $('#classifyBox'); + if (hot_article.hasClass('hot_mobile_open')) { + hot_article.removeAttr('style'); + hot_article.removeClass('fadeInRight'); + hot_article.addClass('fadeOutRight'); + $('.left1').text('<'); + } + if (classify.hasClass('classify_mobile_open')) { + classify.removeAttr('style'); + classify.removeClass('bounceInDown'); + classify.addClass('bounceOutDown'); + } + if ($('.left2').text() == '<') { + $('#overLay').removeAttr('hidden'); + $('.left2').text('>'); + if (article_label.hasClass('label_mobile_open')) { + article_label.removeAttr('style'); + article_label.addClass('fadeInUp'); + article_label.removeClass('fadeOutDown'); + } else { + article_label.addClass('label_mobile_open'); + article_label.removeClass('mobile_close'); + } + } else { + article_label.removeAttr('style'); + article_label.removeClass('fadeInUp'); + article_label.addClass('fadeOutDown'); + $('#overLay').attr('hidden', 'hidden'); + $('.left2').text('<'); + } + + $('#overLay').click(function () { + article_label.removeAttr('style'); + article_label.removeClass('fadeInUp'); + article_label.addClass('fadeOutDown'); + $('#overLay').attr('hidden', 'hidden'); + $('.left2').text('<'); + }); + }); + + $('.top1').click(function () { + let hot_article = $("li[name='hot_article']"); + let article_label = $("li[name='article_label']"); + let classify = $('#classifyBox'); + if (hot_article.hasClass('hot_mobile_open')) { + hot_article.removeAttr('style'); + hot_article.removeClass('fadeInRight'); + hot_article.addClass('fadeOutRight'); + $('.left1').text('<'); + } + if (article_label.hasClass('label_mobile_open')) { + article_label.removeAttr('style'); + article_label.removeClass('fadeInUp'); + article_label.addClass('fadeOutDown'); + $('.left2').text('<'); + } + $('#overLay').removeAttr('hidden'); + if (classify.hasClass('classify_mobile_open')) { + if (classify.hasClass('bounceInDown')) { + classify.removeAttr('style'); + classify.removeClass('bounceInDown'); + classify.addClass('bounceOutDown'); + $('#overLay').attr('hidden', 'hidden'); + } else { + classify.removeAttr('style'); + classify.addClass('bounceInDown'); + classify.removeClass('bounceOutDown'); + } + } else { + classify.removeAttr('style'); + classify.removeClass('flipInY'); + classify.addClass('bounceInDown'); + classify.addClass('classify_mobile_open'); + classify.removeClass('mobile_close'); + } + $('#overLay').click(function () { + classify.removeAttr('style'); + classify.removeClass('bounceInDown'); + classify.addClass('bounceOutDown'); + $('#overLay').attr('hidden', 'hidden'); + }); + }); + } + + $('#allClassify').click(function () { + is_search_keywords = ""; + is_classify_id = 0; + is_label_id = ""; + exist = false; + pageNum = 1; + getPageArticle(pageNum); + $('body,html').animate({scrollTop: 0}, 300); + }); + + $(".searchBox>input[type='text']").click(function () { + $(document).keyup(function (event) { + if (event.keyCode == 13) { + searchArticle(); + } + }); + }); + + $('.searchBox>i').click(function () { + searchArticle(); + }); + +}); + +function searchArticle() { + is_label_id = ""; + is_classify_id = 0; + pageNum = 1; + exist = false; + is_search_keywords = $(".searchBox>input[type='text']").val(); + if (is_search_keywords == "") { + swal("请输入查询关键字!", { + button: false, + timer: 2000 + }); + } + getPageArticle(pageNum); + $('body,html').animate({scrollTop: 0}, 300); +} + +function getArticleByClassify(classifyId) { + // 清空标签和搜索的分页条件 + is_search_keywords = ""; + is_label_id = ""; + exist = false; + pageNum = 1; + is_classify_id = classifyId; + getPageArticle(pageNum); + $('body,html').animate({scrollTop: 0}, 300); +} + +//获取滚动条当前的位置 +function getScrollTop() { + let scrollTop = 0; + if (document.documentElement && document.documentElement.scrollTop) { + scrollTop = document.documentElement.scrollTop; + } else if (document.body) { + scrollTop = document.body.scrollTop; + } + return scrollTop; +} + +//获取当前可视范围的高度 +function getClientHeight() { + let clientHeight = 0; + if (document.body.clientHeight && document.documentElement.clientHeight) { + clientHeight = Math.min(document.body.clientHeight, document.documentElement.clientHeight); + } else { + clientHeight = Math.max(document.body.clientHeight, document.documentElement.clientHeight); + } + return clientHeight; +} + +//获取文档完整的高度 +function getScrollHeight() { + return Math.max(document.body.scrollHeight, document.documentElement.scrollHeight); +} + +//滚动事件触发 +window.onscroll = function () { + if (getScrollTop() + getClientHeight() > getScrollHeight() - 110) { + pageNum++; + getPageArticle(pageNum); + } +}; + +function getPageArticle(pageNum) { + if (!exist) { + $.ajax({ + url: '/article/getPageArticle.action', + data: { + pageNum: pageNum, + labelId: is_label_id, + classifyId: is_classify_id, + keywords: is_search_keywords + }, + type: 'POST', + success: function (res) { + if (document.body.offsetWidth <= 500){ + let hot_article = $("li[name='hot_article']"); + let article_label = $("li[name='article_label']"); + let classify = $('#classifyBox'); + if (article_label.hasClass('label_mobile_open')) { + article_label.removeAttr('style'); + article_label.removeClass('fadeInUp'); + article_label.addClass('fadeOutDown'); + $('.left2').text('<'); + } + if (classify.hasClass('classify_mobile_open')) { + classify.removeAttr('style'); + classify.removeClass('bounceInDown'); + classify.addClass('bounceOutDown'); + } + if (hot_article.hasClass('hot_mobile_open')) { + hot_article.removeAttr('style'); + hot_article.removeClass('fadeInRight'); + hot_article.addClass('fadeOutRight'); + $('.left1').text('<'); + } + $('#overLay').attr('hidden', 'hidden'); + } + if (res.data.length > 0) { + var articleData = { + articleList: res.data + }; + let articleHtml = articleRender(articleData); + if (pageNum == 1) { + $('#blog_content').html(articleHtml); + } else { + $('#blog_content').append(articleHtml); + } + $('.article_classify').each(function () { + $(this).click(function () { + let classifyId = $(this).attr('name'); + getArticleByClassify(classifyId); + }); + }); + if (res.data.length < 20){ + $('#blog_content').append(line); + exist = true; + } + } else { + if (pageNum == 1) { + $('#blog_content').html(line); + exist = true; + } else if (!exist) { + $('#blog_content').append(line); + exist = true; + } + } + } + }); + } +} diff --git a/js/base.js b/js/base.js new file mode 100644 index 0000000..55208b3 --- /dev/null +++ b/js/base.js @@ -0,0 +1,135 @@ +// 富文本编辑器表情管理 +const emoji = []; +const toot = []; +const cute = []; +const mogutou = []; + +getImg(emoji,"emoji",96); +getImg(toot,"toot",16); +getImg(cute,'cute',8); +getImg(mogutou,'mogutou',15); + +function getImg(arr,name,max) { + if (max < 10){ + for(let i = 1; i< max; i++){ + arr.push({alt:"0"+i,src:"https://www.zzwazj.online/images/emoticon/"+name+"/0"+i+".gif"}); + } + }else { + for(let i = 1; i < 10; i++){ + arr.push({alt:"0"+i,src:"https://www.zzwazj.online/images/emoticon/"+name+"/0"+i+".gif"}); + } + for (let j = 10; j <= max; j++){ + arr.push({alt:j,src:"https://www.zzwazj.online/images/emoticon/"+name+"/"+j+".gif"}); + } + } +} + +$(function () { + console.log("如果你喜欢本站模板,欢迎发邮件给876784235@qq.com,免费分享本站静态模板哦~"); + console.log("欢迎加群进行学习交流哦~"); + // 刷新回到顶部 防止wow.js的动画失效 + $('body,html').animate({scrollTop: 0},700); + // 初始化wow + new WOW().init(); + + // 鼠标点击事件 + var i = 0; + $('html').click(function (element) { + let arr = ["富强","民主","文明","和谐","自由","平等","公正","法治","爱国","敬业","诚信","友善"]; + let dom = $("").text(arr[i]); + i = (i+1) % arr.length; + let x = element.pageX; + let y = element.pageY; + dom.css({ + "z-index": 99999, + "top": y - 20, + "left": x, + "position": "absolute", + "font-weight": "bold", + "color": "#ff6651" + }); + $('body').append(dom); + dom.animate({ + "top": y-180, + "opacity":0 + },1500,function () { + dom.remove(); + }); + }); + // toTop事件 + $('#toTop').click(function () { + $('html,body').animate({scrollTop:0},500); + }); + + // 上一次滚轮的位置 + var last_position = 0; + // 监听滚轮事件 + $(window).scroll(function () { + let offset = 500; + let pageY = $(window).scrollTop(); + pageY > offset ? $('#toTop').removeAttr('hidden') : $('#toTop').attr('hidden','hidden'); + if (document.body.offsetWidth > 500){ + if (pageY > 1000){ + $("#classifyBox").removeAttr('style'); + $("#classifyBox").addClass('box_bounceInDown_fixed'); + }else { + $("#classifyBox").removeClass('box_bounceInDown_fixed'); + } + if (pageY>700){ + $('.about_me').removeAttr('style'); + $('.about_me').addClass('box_bounceInDown_fixed'); + }else { + $('.about_me').removeClass('box_bounceInDown_fixed'); + } + if (pageY>600){ + $('#message_search').removeAttr('hidden','hidden'); + $("#message_search").removeAttr('style'); + $("#message_search").addClass('box_bounceInUp_fixed'); + }else{ + $('#message_search').attr('hidden','hidden'); + $("#message_search").removeClass('box_bounceInUp_fixed'); + } + } + // 获取当前位置 + let position = window.scrollY; + if(position - last_position > 0) { + let menuId = $('#menu'); + let nav = $('#nav'); + if (menuId.hasClass("menu_open")) { + nav.removeClass('bounceInRight'); + nav.removeAttr('style'); + nav.addClass('bounceOutRight'); + menuId.removeClass('menu_open'); + menuId.addClass('menu_close'); + } + } + last_position = position; + }); +}); + + + +function getEditorConfig(editor) { + editor.customConfig.emotions = [ + { + title: '默认', + type: 'image', + content: emoji + }, + { + title: '蒙嘟嘟', + type: 'image', + content: toot + }, + { + title: '乖巧宝宝', + type: 'image', + content: cute + }, + { + title: '骚气蘑菇头', + type: 'image', + content: mogutou + } + ]; +} \ No newline at end of file diff --git a/js/detail.js b/js/detail.js new file mode 100644 index 0000000..a5c4267 --- /dev/null +++ b/js/detail.js @@ -0,0 +1,671 @@ +let detail = `

    {{article.title}}

    +

    + {{each labelList label index}} + ${{label.labelName}} + {{/each}} +

    +
    + {{article.author}} + {{article.updateTime}} + {{article.viewNum}} + {{article.commentNum}} +
    +
    +
    + {{article.topDesc}} + {{@article.topContent}} +
    +
    {{@article.content}}
    +
    + +
    +
    +
    +

    微信打赏

    + 微信打赏 +
    +
    +

    支付宝打赏

    + 支付宝打赏 +
    +

    手机版可截图扫描相册二维码打赏

    +
    + 打赏 +
    +
    +
    `; +let reply = `
    +
    + + + + + + + +
      +
    • + + +
    • +
    • + + +
    • +
    • + + +
    • +
    +
    +
    +
    +
    +

    +
    + + + 确认回复 +
    +
    +
    `; +let comment = `{{each commentList comment index}} +
  • +
    + +
    +
    +

    {{comment.commentName}}

    + {{@comment.commentContent}} +

    {{comment.commentTime}}回复

    +
    +
    + {{each replyList reply index}} + {{if comment.id==reply.commentId}} +
    +
    + +
    +
    +

    {{reply.replyName}}

    + @{{reply.commentName}} {{@reply.replyComment}} +

    {{reply.replyTime}}回复

    +
    +
    +
    + {{/if}} + {{/each}} +
  • + {{/each}}`; +let replyContent = `
    +
    + +
    +
    +

    {{reply.replyName}}

    + @{{reply.commentName}}{{@reply.replyComment}} +

    {{reply.replyTime}}回复

    +
    +
    +
    `; +let commentContent = `
  • {{comment.commentName}}

    {{@comment.commentContent}}

    {{comment.commentTime}}回复

  • `; +let pageNum = 1; +let replyOrComment; +let E = window.wangEditor; +let replyRender = template.compile(reply); +let replyHtml = replyRender(); +let reply_editor = new E("#reply_toolbar", '#reply_text'); +reply_editor.customConfig.menus = ['bold', 'fontSize', 'foreColor', 'backColor', 'link', 'quote', 'emoticon', 'code', 'undo', 'redo']; +getEditorConfig(reply_editor); +let href = window.location.href; +let articleId = href.substring(href.lastIndexOf("?") + 4); +let exist = false; +let detailRender = template.compile(detail); +let commentRender = template.compile(comment); + +var pageFun = { + highLight: function () { + var _this = this; + _this.codePrettify(); + }, + codePrettify: function () { + var _this = this; + $('pre code').each(function () { + var lang = $(this).attr('class'); + if (!$(this).parent().hasClass('prettyprinted')) { + $(this).parent().attr('class', 'prettyprint linenums lang-' + lang).html(this.innerHTML) + .wrap('
    ') + .parent().append(_this.codePrettifyToolbar(lang)); + prettyPrint(); + _this.codePrettifyToolbarAction(); + } + }); + }, + codePrettifyToolbar: function (lang) { + var _lang; + switch (lang.toLowerCase()) { + case 'js': + case 'javascript': + _lang = 'JavaScript'; + break; + case 'java': + _lang = lang.charAt(0).toUpperCase().concat(lang.toLowerCase().slice(1)); + break; + case 'html': + case 'css': + case 'xml': + _lang = lang.toUpperCase(); + break; + default: + _lang = lang; + } + + var toolbar = '
    ' + + '' + _lang + '' + + '' + + '' + + '' + + '' + + '
    '; + + return toolbar; + }, + //代码高亮工具栏功能 + codePrettifyToolbarAction: function () { + /* 复制代码 */ + _this = this; + var clipboard = new ClipboardJS('.clipboard', { + text: function (e) { + let container = $(e).parent().parent(); + return _this.getPrettifyCode(container); + } + }); + clipboard.on('success', function (e) { + let container = $(e.trigger).parent().parent(); + let msg = container.find('.msg'); + msg.text('已复制').stop().slideDown(); + setTimeout(function () { + msg.fadeOut(); + },2000); + }); + + clipboard.on('error', function (e) { + let container = $(e.trigger).parent().parent(); + let msg = container.find('.msg'); + msg.text('暂不支持当前浏览器,请手动复制 (ctrl + c)').stop().slideDown(); + setTimeout(function () { + msg.fadeOut(); + },3000); + container.find('.view-source').trigger('click'); + }); + + /* 其他事件 */ + $('.code-pretty-toolbar a').on('click', function () { + /* 查看纯文本代码 */ + let container = $(this).parent().parent(); + // 获取源代码 + var pre = container.find('pre'); + + if ($(this).hasClass('view-source')) { + // 获取代码文本 + code = _this.getPrettifyCode(container); + + // 填充 textarea + if (!container.find('textarea').length) { + container.append(''); + } else { + container.find('textarea').val(code); + } + // 去除滚动条 + pre.css('white-space','inherit'); + pre.css('overflow-x','hidden'); + if (pre.hasClass('lang-bash')) { // bash 固定不变 + var w = pre.width() - 15; + var h = pre.height() + 10; + var marginLeft = 32; + } else { + var liCount = pre.find('li').length; + var offset = liCount / 1000; + var w = pre.width() - 30 - 5 * offset; + var h = pre.height() + 10; + var marginLeft = 53 + 5 * offset; + } + // 显示 textarea + container.find('textarea').css({height: h, width: w, 'margin-left': marginLeft}) + .show().select(); + + container.find('.view-source').hide(); + container.find('.back-to-pretty').css('display', 'inline-block'); + + } else if ($(this).hasClass('back-to-pretty')) { + container.find('.back-to-pretty').hide(); + container.find('.view-source').css('display', 'inline-block'); + // 添加滚动条 + pre.css('white-space','pre'); + pre.css('overflow-x','scroll'); + container.find('textarea').hide(); + } + }); + }, + //获取代码文本 + getPrettifyCode: function (container) { + code = []; + container.find('li').each(function () { + code.push($(this).text()); + }); + code = code.join('\r'); + code = code.replace(/\u00a0/g, " "); + return code; + }, + + // show comment message + showCommentMsg: function (status, msg, isHide , isComment) { + switch (status) { + case 'wait': + msg = ' ' + msg; + break; + case 'success': + msg = ' ' + msg + ''; + break; + case 'error': + msg = ' ' + msg + ''; + break; + } + isComment ? $('#commentMsg').html(msg).stop().slideDown() : $('#replyMsg').html(msg).stop().slideDown(); + isHide && setTimeout(function () { + isComment ? $('#commentMsg').stop().fadeOut() : $('#replyMsg').stop().fadeOut(); + },3000); + }, + + createHtml : function (text , flag) { + return flag ? "" : ""; + } +}; + +$(function () { + let commentContentRender = template.compile(commentContent); + getPageComment(pageNum, articleId); + $("#comment_form input[name='articleId']").val(articleId); + let detail_editor = new E('#detail_toolbar', '#detail_text'); + detail_editor.customConfig.menus = ['bold', 'foreColor', 'backColor', 'link', 'emoticon', 'code',]; + getEditorConfig(detail_editor); + detail_editor.create(); + $('.close').click(function () { + $('.headImg').attr('hidden', 'hidden'); + }); + $('#commentHeadImage').click(function () { + $('.headImg').removeAttr('hidden'); + replyOrComment = 'comment'; + }); + $('.headImg ul li img').click(function () { + $('.headImg').attr('hidden', 'hidden'); + let src = $(this).attr('src'); + if (replyOrComment == 'comment') { + $('#commentHeadImage').attr('src', src); + } else { + $('#replyHeadImage').attr('src', src); + } + }); + $('#commentName').focus(function () { + pageFun.showCommentMsg('success','新功能:在昵称框输入qq号可快速获取昵称,邮箱和头像!',true , true); + }); + $('#commentName').blur(function () { + let qq = $('#commentName').val(); + if (/^[1-9]\d{4,12}$/.test(qq)) { + $.ajax({ + url: 'https://users.qzone.qq.com/fcg-bin/cgi_get_portrait.fcg?uins=' + qq, + dataType: "jsonp", + jsonpCallback: "portraitCallBack", + scriptCharset: "gbk", + beforeSend: function () { + $('#commentName').val(''); + $('#commentName').attr('placeholder', '获取中...') + }, + success: function (res) { + if (res[qq] && res[qq][6]) { + $('#commentName').val(res[qq][6]); + $('#commentEmail').val(qq + '@qq.com'); + $('#commentName').removeAttr('placeholder'); + $('#commentHeadImage').attr('src','https://q1.qlogo.cn/g?b=qq&nk='+qq+'&s=100'); + }else { + pageFun.showCommentMsg('error', 'QQ信息获取失败!', true , true); + $('#commentName').val(qq); + } + } + }); + } + }); + + $('.commit_comment').click(function () { + let commentHeadImage = $('#commentHeadImage').attr('src'); + let comment = $('#detail_text>div'); + let commentHtml = comment.html(); + if (validateForm($('#commentName').val(), $('#commentEmail').val(), commentHtml,true)) { + $("input[name='commentHeadImage']").val(commentHeadImage); + $("textarea[name='commentContent']").val(commentHtml); + // 获取本文章的浏览量 + let commentNum = $('.detail_info>span:last-child').text(); + // 填充本文章的浏览量,避免再次查询数据库 + $("#comment_form input[name='commentNum']").val(commentNum); + $.ajax({ + url: '/article/addComment.action', + data: $('#comment_form').serialize(), + type: 'POST', + beforeSend : function(res){ + pageFun.showCommentMsg('wait','让评论飞一会儿~',false , true); + }, + success: function (res) { + let contentData = { + comment: res.data + }; + let commentContentHtml = commentContentRender(contentData); + $('#commentBox').prepend(commentContentHtml); + // 清空评论框内容 + $('#commentHeadImage').attr('src', 'https://wx1.sinaimg.cn/square/007aGNoFly1fvys0zjwv7j301o01o0si.jpg'); + $('#commentName').val(""); + $('#commentEmail').val(""); + comment.html(""); + $('#email_comment').prop('checked', false); + pageFun.showCommentMsg('success','评论发布成功!',true , true); + // 更新文章评论数量 + $('.detail_info>span:last-child').text(res.data.commentNum); + replyClick(); + if (commentContentHtml.indexOf("
    ") != -1) {
    +                        pageFun.highLight();
    +                    }
    +                    $('html,body').animate({
    +                        scrollTop: $('#commentBox').offset().top
    +                    }, 200);
    +                },
    +                error : function () {
    +                    pageFun.showCommentMsg('error','评论发布失败,请联系站长!',true , true);
    +                }
    +            })
    +        }
    +    })
    +});
    +
    +function replyClick() {
    +    $('.reply').each(function () {
    +        $(this).unbind('click');
    +        $(this).click(function () {
    +            let text = $(this).text();
    +            let commentId = "";
    +            let replyId = "";
    +            // 判断是否是评论还是回复
    +            if ($(this).parent().parent().hasClass('comment')) {
    +                // 是要回复评论
    +                commentId = $(this).attr('name');
    +            } else {
    +                commentId = $(this).parent().parent().parent().parent().attr('name');
    +                replyId = $(this).attr('name');
    +            }
    +            let commentName = $(this).parent().prev().prev().text();
    +            if (text == '回复') {
    +                $(this).text('取消回复');
    +                let num = $('.reply_comment').length;
    +                if (num > 0) {
    +                    $('.reply_comment').parent().prev().find('.reply').text('回复');
    +                    $('.reply_comment').parent().html("");
    +                }
    +                $(this).parent().next().html(replyHtml);
    +                reply_editor.create();
    +                $('#replyName').focus(function () {
    +                    pageFun.showCommentMsg('success','新功能:在昵称框输入qq号可快速获取昵称,邮箱和头像!',true , false);
    +                });
    +                $('#replyName').blur(function () {
    +                    let qq = $('#replyName').val();
    +                    if (/^[1-9]\d{4,12}$/.test(qq)) {
    +                        $.ajax({
    +                            url: 'https://users.qzone.qq.com/fcg-bin/cgi_get_portrait.fcg?uins=' + qq,
    +                            dataType: "jsonp",
    +                            jsonpCallback: "portraitCallBack",
    +                            scriptCharset: "gbk",
    +                            beforeSend: function () {
    +                                $('#replyName').val('');
    +                                $('#replyName').attr('placeholder', '获取中...')
    +                            },
    +                            success: function (res) {
    +                                if (res[qq] && res[qq][6]) {
    +                                    $('#replyName').val(res[qq][6]);
    +                                    $('#replyEmail').val(qq + '@qq.com');
    +                                    $('#replyName').removeAttr('placeholder');
    +                                    $('#replyHeadImage').attr('src','https://q1.qlogo.cn/g?b=qq&nk='+qq+'&s=100');
    +                                }else {
    +                                    pageFun.showCommentMsg('error', 'QQ信息获取失败!', true , false);
    +                                    $('#replyName').val(qq);
    +                                }
    +                            }
    +                        });
    +                    }
    +                });
    +                $('#replyHeadImage').click(function () {
    +                    $('.headImg').removeAttr('hidden');
    +                    replyOrComment = 'reply'
    +                });
    +                $('.reply_commit').click(function () {
    +                    let replyHeadImage = $('#replyHeadImage').attr('src');
    +                    let reply = $('#reply_text>div');
    +                    let replyHtml = reply.html();
    +                    // 验证表单内容 主要验证邮箱和评论不能为空
    +                    if (validateForm($('#replyName').val(), $('#replyEmail').val(), replyHtml , false)) {
    +                        $("input[name='replyId']").val(replyId);
    +                        $("#reply_form input[name='commentName']").val(commentName);
    +                        $("input[name='replyHeadImage']").val(replyHeadImage);
    +                        $("textarea[name='replyComment']").val(replyHtml);
    +                        $("input[name='commentId']").val(commentId);
    +                        $("#reply_form input[name='articleId']").val(articleId);
    +                        // 获取本文章的浏览量
    +                        let commentNum = $('.detail_info>span:last-child').text();
    +                        $("#reply_form input[name='commentNum']").val(commentNum);
    +                        $.ajax({
    +                            url: '/article/addReply.action',
    +                            data: $('#reply_form').serialize(),
    +                            type: 'POST',
    +                            beforeSend : function(res){
    +                                pageFun.showCommentMsg('wait','让回复飞一会儿~',false , false);
    +                            },
    +                            success: function (res) {
    +                                if (res.status == 200) {
    +                                    let replyContentRender = template.compile(replyContent);
    +                                    let replyContentData = {
    +                                        reply: res.data,
    +                                    };
    +                                    let replyContentHtml = replyContentRender(replyContentData);
    +                                    // 情况reply form的数据
    +                                    $('#replyHeadImage').attr('src','https://wx1.sinaimg.cn/square/007aGNoFly1fvys0zjwv7j301o01o0si.jpg');
    +                                    $('#replyName').val("");
    +                                    $('#replyEmail').val("");
    +                                    $('#email_reply').prop('checked', false);
    +                                    reply.html("");
    +                                    pageFun.showCommentMsg('success','回复发布成功!',true , false);
    +                                    // 隐藏回复框
    +                                    $('.reply_comment').parent().prev().find('.reply').text('回复');
    +                                    $('.reply_comment').parent().html("");
    +                                    // 更新文章评论量
    +                                    $('.detail_info>span:last-child').text(res.data.commentNum);
    +                                    let dom = $("li[name=" + commentId + "]");
    +                                    $('html,body').animate({
    +                                        scrollTop: dom.innerHeight() + dom.offset().top - 200
    +                                    }, 200);
    +                                    dom.append(replyContentHtml);
    +                                    if (replyContentHtml.indexOf("
    ") != -1) {
    +                                        pageFun.highLight();
    +                                    }
    +                                    replyClick();
    +                                }
    +                            },
    +                            error : function () {
    +                                pageFun.showCommentMsg('success','回复发布失败,请联系站长!',true , false);
    +                            }
    +                        })
    +                    }
    +                    ;
    +                })
    +            } else {
    +                $(this).text('回复');
    +                $(this).parent().next().html("");
    +            }
    +        })
    +    })
    +}
    +
    +function getScrollTop() {
    +    let scrollTop = 0;
    +    if (document.documentElement && document.documentElement.scrollTop) {
    +        scrollTop = document.documentElement.scrollTop
    +    } else if (document.body) {
    +        scrollTop = document.body.scrollTop
    +    }
    +    return scrollTop;
    +}
    +
    +function getClientHeight() {
    +    let clientHeight = 0;
    +    if (document.body.clientHeight && document.documentElement.clientHeight) {
    +        clientHeight = Math.min(document.body.clientHeight, document.documentElement.clientHeight)
    +    } else {
    +        clientHeight = Math.max(document.body.clientHeight, document.documentElement.clientHeight)
    +    }
    +    return clientHeight;
    +}
    +
    +function getScrollHeight() {
    +    return Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
    +}
    +
    +window.onscroll = function () {
    +    if (getScrollTop() + getClientHeight() > getScrollHeight() - 110) {
    +        pageNum++;
    +        getPageComment(pageNum, articleId);
    +    }
    +};
    +
    +function getPageComment(pageNum, articleId) {
    +    if (!exist) {
    +        $.ajax({
    +            url: '/article/detail.action',
    +            type: 'POST',
    +            data: {
    +                pageNum: pageNum,
    +                articleId: articleId
    +            },
    +            success: function (res) {
    +                if (pageNum == 1) {
    +                    let detailData = {
    +                        article: res.data.article,
    +                        labelList: res.data.labelList
    +                    };
    +                    let detailHtml = detailRender(detailData);
    +                    $('#detail').html(detailHtml);
    +                    var menu = "";
    +                    // 右边导航栏
    +                    $('.detail_content h2 , .detail_content h3').each(function (index) {
    +                        // 获取标题文本
    +                        let text = $(this).text();
    +                        text = text.replace('$','');
    +                        $(this).attr('id',"title"+index);
    +                        menu += $(this).prop('tagName') == 'H2' ? "" : "";
    +                    });
    +                    $('#article_menu>ul').html(menu);
    +                    $('.menu_one,.menu_two').click(function () {
    +                        let title_name = $(this).attr('name');
    +                        $('html,body').animate({scrollTop: $('#'+title_name).offset().top - 200}, 800);
    +                    });
    +                    //var last_position = 0;
    +                    $(window).scroll(function () {
    +                        let dTop = $(document).scrollTop();
    +                        /*if (last_position > dTop){
    +                            $('.article_share').stop().fadeIn();
    +                        } else {
    +                            $('.article_share').stop().fadeOut();
    +                        }*/
    +                        if ($(document).scrollTop() < $('.detail_content').offset().top || $(document).scrollTop() > $('.prise').offset().top){
    +                            $('#article_menu').stop().fadeOut();
    +                            //$('.article_share').stop().fadeOut();
    +                        } else {
    +                            $('#article_menu').fadeIn();
    +                        }
    +                        //last_position = dTop;
    +                        $('.detail_content h2 , .detail_content h3').each(function (index) {
    +                            let top = $(this).offset().top;
    +                            if (dTop >= top - 201){
    +                                // 获取标题id
    +                                let id = $(this).attr('id');
    +                                id && $('.active').attr('name') != id &&
    +                                ($('.active').removeClass('active'),$('li[name='+id+']').addClass('active'));
    +                            }
    +                        });
    +
    +                    });
    +                    $('title').text(res.data.article.title);
    +                    // fancybox open the picture
    +                    $(".detail_content img:not([src$='.gif'])").each(function () {
    +                        let url = $(this).attr('src');
    +                        $(this).wrap(``);
    +                    });
    +                    $('.like').click(function () {
    +                        let priseNum = $('.like > span:last-child').text();
    +                        $.ajax({
    +                            type: 'POST',
    +                            url: '/article/prise.action',
    +                            data: {
    +                                articleId: articleId,
    +                                ip: returnCitySN["cip"]
    +                            },
    +                            success: function (res) {
    +                                if (res.status == 520) {
    +                                    swal(res.msg, {
    +                                        button: false,
    +                                        timer: 2000
    +                                    })
    +                                } else if (res.status == 200) {
    +                                    $('.like > span:last-child').text(parseInt(priseNum) + 1)
    +                                }
    +                            }
    +                        })
    +                    })
    +                }
    +                if (res.data.articleComments.length > 0) {
    +                    let commentData = {
    +                        commentList: res.data.articleComments,
    +                        replyList: res.data.articleReplies
    +                    };
    +                    let commentHtml = commentRender(commentData);
    +                    $('#commentBox').append(commentHtml);
    +                    replyClick();
    +                    if (res.data.articleComments.length < 20) {
    +                        exist = true
    +                    }
    +                } else {
    +                    exist = true
    +                }
    +                if ($('pre code').length > 0) {
    +                    pageFun.highLight();
    +                }
    +            }
    +        })
    +    }
    +}
    +
    +// 验证表单
    +function validateForm(name, email, content,isComment) {
    +    if (name == "") {
    +        pageFun.showCommentMsg('error','请输入昵称!',true , isComment);
    +        return false;
    +    }
    +    let emailPattern = /^[A-Za-z0-9\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/;
    +    if (!emailPattern.test(email)) {
    +        pageFun.showCommentMsg('error','邮箱格式不正确!',true , isComment);
    +        return false;
    +    }
    +    let contentPattern = /[\u4e00-\u9fa5]/;
    +    if (!contentPattern.test(content)) {
    +        pageFun.showCommentMsg('error','评论回复内容至少包含一个汉字!',true , isComment);
    +        return false;
    +    }
    +    return true;
    +}
    \ No newline at end of file
    diff --git a/js/editor.js b/js/editor.js
    new file mode 100644
    index 0000000..ad86121
    --- /dev/null
    +++ b/js/editor.js
    @@ -0,0 +1,4731 @@
    +(function (global, factory) {
    +    typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
    +        typeof define === 'function' && define.amd ? define(factory) :
    +            (global.wangEditor = factory());
    +}(this, (function () {
    +    'use strict';
    +
    +    /*
    +    poly-fill
    +*/
    +
    +    var polyfill = function () {
    +
    +        // Object.assign
    +        if (typeof Object.assign != 'function') {
    +            Object.assign = function (target, varArgs) {
    +                // .length of function is 2
    +                if (target == null) {
    +                    // TypeError if undefined or null
    +                    throw new TypeError('Cannot convert undefined or null to object');
    +                }
    +
    +                var to = Object(target);
    +
    +                for (var index = 1; index < arguments.length; index++) {
    +                    var nextSource = arguments[index];
    +
    +                    if (nextSource != null) {
    +                        // Skip over if undefined or null
    +                        for (var nextKey in nextSource) {
    +                            // Avoid bugs when hasOwnProperty is shadowed
    +                            if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
    +                                to[nextKey] = nextSource[nextKey];
    +                            }
    +                        }
    +                    }
    +                }
    +                return to;
    +            };
    +        }
    +
    +        // IE 中兼容 Element.prototype.matches
    +        if (!Element.prototype.matches) {
    +            Element.prototype.matches = Element.prototype.matchesSelector || Element.prototype.mozMatchesSelector || Element.prototype.msMatchesSelector || Element.prototype.oMatchesSelector || Element.prototype.webkitMatchesSelector || function (s) {
    +                var matches = (this.document || this.ownerDocument).querySelectorAll(s),
    +                    i = matches.length;
    +                while (--i >= 0 && matches.item(i) !== this) {
    +                }
    +                return i > -1;
    +            };
    +        }
    +    };
    +
    +    /*
    +    DOM 操作 API
    +*/
    +
    +// 根据 html 代码片段创建 dom 对象
    +    function createElemByHTML(html) {
    +        var div = void 0;
    +        div = document.createElement('div');
    +        div.innerHTML = html;
    +        return div.children;
    +    }
    +
    +// 是否是 DOM List
    +    function isDOMList(selector) {
    +        if (!selector) {
    +            return false;
    +        }
    +        if (selector instanceof HTMLCollection || selector instanceof NodeList) {
    +            return true;
    +        }
    +        return false;
    +    }
    +
    +// 封装 document.querySelectorAll
    +    function querySelectorAll(selector) {
    +        var result = document.querySelectorAll(selector);
    +        if (isDOMList(result)) {
    +            return result;
    +        } else {
    +            return [result];
    +        }
    +    }
    +
    +// 记录所有的事件绑定
    +    var eventList = [];
    +
    +// 创建构造函数
    +    function DomElement(selector) {
    +        if (!selector) {
    +            return;
    +        }
    +
    +        // selector 本来就是 DomElement 对象,直接返回
    +        if (selector instanceof DomElement) {
    +            return selector;
    +        }
    +
    +        this.selector = selector;
    +        var nodeType = selector.nodeType;
    +
    +        // 根据 selector 得出的结果(如 DOM,DOM List)
    +        var selectorResult = [];
    +        if (nodeType === 9) {
    +            // document 节点
    +            selectorResult = [selector];
    +        } else if (nodeType === 1) {
    +            // 单个 DOM 节点
    +            selectorResult = [selector];
    +        } else if (isDOMList(selector) || selector instanceof Array) {
    +            // DOM List 或者数组
    +            selectorResult = selector;
    +        } else if (typeof selector === 'string') {
    +            // 字符串
    +            selector = selector.replace('/\n/mg', '').trim();
    +            if (selector.indexOf('<') === 0) {
    +                // 如 
    + selectorResult = createElemByHTML(selector); + } else { + // 如 #id .class + selectorResult = querySelectorAll(selector); + } + } + + var length = selectorResult.length; + if (!length) { + // 空数组 + return this; + } + + // 加入 DOM 节点 + var i = void 0; + for (i = 0; i < length; i++) { + this[i] = selectorResult[i]; + } + this.length = length; + } + +// 修改原型 + DomElement.prototype = { + constructor: DomElement, + + // 类数组,forEach + forEach: function forEach(fn) { + var i = void 0; + for (i = 0; i < this.length; i++) { + var elem = this[i]; + var result = fn.call(elem, elem, i); + if (result === false) { + break; + } + } + return this; + }, + + // clone + clone: function clone(deep) { + var cloneList = []; + this.forEach(function (elem) { + cloneList.push(elem.cloneNode(!!deep)); + }); + return $(cloneList); + }, + + // 获取第几个元素 + get: function get(index) { + var length = this.length; + if (index >= length) { + index = index % length; + } + return $(this[index]); + }, + + // 第一个 + first: function first() { + return this.get(0); + }, + + // 最后一个 + last: function last() { + var length = this.length; + return this.get(length - 1); + }, + + // 绑定事件 + on: function on(type, selector, fn) { + // selector 不为空,证明绑定事件要加代理 + if (!fn) { + fn = selector; + selector = null; + } + + // type 是否有多个 + var types = []; + types = type.split(/\s+/); + + return this.forEach(function (elem) { + types.forEach(function (type) { + if (!type) { + return; + } + + // 记录下,方便后面解绑 + eventList.push({ + elem: elem, + type: type, + fn: fn + }); + + if (!selector) { + // 无代理 + elem.addEventListener(type, fn); + return; + } + + // 有代理 + elem.addEventListener(type, function (e) { + var target = e.target; + if (target.matches(selector)) { + fn.call(target, e); + } + }); + }); + }); + }, + + // 取消事件绑定 + off: function off(type, fn) { + return this.forEach(function (elem) { + elem.removeEventListener(type, fn); + }); + }, + + // 获取/设置 属性 + attr: function attr(key, val) { + if (val == null) { + // 获取值 + return this[0].getAttribute(key); + } else { + // 设置值 + return this.forEach(function (elem) { + elem.setAttribute(key, val); + }); + } + }, + + // 添加 class + addClass: function addClass(className) { + if (!className) { + return this; + } + return this.forEach(function (elem) { + var arr = void 0; + if (elem.className) { + // 解析当前 className 转换为数组 + arr = elem.className.split(/\s/); + arr = arr.filter(function (item) { + return !!item.trim(); + }); + // 添加 class + if (arr.indexOf(className) < 0) { + arr.push(className); + } + // 修改 elem.class + elem.className = arr.join(' '); + } else { + elem.className = className; + } + }); + }, + + // 删除 class + removeClass: function removeClass(className) { + if (!className) { + return this; + } + return this.forEach(function (elem) { + var arr = void 0; + if (elem.className) { + // 解析当前 className 转换为数组 + arr = elem.className.split(/\s/); + arr = arr.filter(function (item) { + item = item.trim(); + // 删除 class + if (!item || item === className) { + return false; + } + return true; + }); + // 修改 elem.class + elem.className = arr.join(' '); + } + }); + }, + + // 修改 css + css: function css(key, val) { + var currentStyle = key + ':' + val + ';'; + return this.forEach(function (elem) { + var style = (elem.getAttribute('style') || '').trim(); + var styleArr = void 0, + resultArr = []; + if (style) { + // 将 style 按照 ; 拆分为数组 + styleArr = style.split(';'); + styleArr.forEach(function (item) { + // 对每项样式,按照 : 拆分为 key 和 value + var arr = item.split(':').map(function (i) { + return i.trim(); + }); + if (arr.length === 2) { + resultArr.push(arr[0] + ':' + arr[1]); + } + }); + // 替换或者新增 + resultArr = resultArr.map(function (item) { + if (item.indexOf(key) === 0) { + return currentStyle; + } else { + return item; + } + }); + if (resultArr.indexOf(currentStyle) < 0) { + resultArr.push(currentStyle); + } + // 结果 + elem.setAttribute('style', resultArr.join('; ')); + } else { + // style 无值 + elem.setAttribute('style', currentStyle); + } + }); + }, + + // 显示 + show: function show() { + return this.css('display', 'block'); + }, + + // 隐藏 + hide: function hide() { + return this.css('display', 'none'); + }, + + // 获取子节点 + children: function children() { + var elem = this[0]; + if (!elem) { + return null; + } + + return $(elem.children); + }, + + // 获取子节点(包括文本节点) + childNodes: function childNodes() { + var elem = this[0]; + if (!elem) { + return null; + } + + return $(elem.childNodes); + }, + + // 增加子节点 + append: function append($children) { + return this.forEach(function (elem) { + $children.forEach(function (child) { + elem.appendChild(child); + }); + }); + }, + + // 移除当前节点 + remove: function remove() { + return this.forEach(function (elem) { + if (elem.remove) { + elem.remove(); + } else { + var parent = elem.parentElement; + parent && parent.removeChild(elem); + } + }); + }, + + // 是否包含某个子节点 + isContain: function isContain($child) { + var elem = this[0]; + var child = $child[0]; + return elem.contains(child); + }, + + // 尺寸数据 + getSizeData: function getSizeData() { + var elem = this[0]; + return elem.getBoundingClientRect(); // 可得到 bottom height left right top width 的数据 + }, + + // 封装 nodeName + getNodeName: function getNodeName() { + var elem = this[0]; + return elem.nodeName; + }, + + // 从当前元素查找 + find: function find(selector) { + var elem = this[0]; + return $(elem.querySelectorAll(selector)); + }, + + // 获取当前元素的 text + text: function text(val) { + if (!val) { + // 获取 text + var elem = this[0]; + return elem.innerHTML.replace(/<.*?>/g, function () { + return ''; + }); + } else { + // 设置 text + return this.forEach(function (elem) { + elem.innerHTML = val; + }); + } + }, + + // 获取 html + html: function html(value) { + var elem = this[0]; + if (value == null) { + return elem.innerHTML; + } else { + elem.innerHTML = value; + return this; + } + }, + + // 获取 value + val: function val() { + var elem = this[0]; + return elem.value.trim(); + }, + + // focus + focus: function focus() { + return this.forEach(function (elem) { + elem.focus(); + }); + }, + + // parent + parent: function parent() { + var elem = this[0]; + return $(elem.parentElement); + }, + + // parentUntil 找到符合 selector 的父节点 + parentUntil: function parentUntil(selector, _currentElem) { + var results = document.querySelectorAll(selector); + var length = results.length; + if (!length) { + // 传入的 selector 无效 + return null; + } + + var elem = _currentElem || this[0]; + if (elem.nodeName === 'BODY') { + return null; + } + + var parent = elem.parentElement; + var i = void 0; + for (i = 0; i < length; i++) { + if (parent === results[i]) { + // 找到,并返回 + return $(parent); + } + } + + // 继续查找 + return this.parentUntil(selector, parent); + }, + + // 判断两个 elem 是否相等 + equal: function equal($elem) { + if ($elem.nodeType === 1) { + return this[0] === $elem; + } else { + return this[0] === $elem[0]; + } + }, + + // 将该元素插入到某个元素前面 + insertBefore: function insertBefore(selector) { + var $referenceNode = $(selector); + var referenceNode = $referenceNode[0]; + if (!referenceNode) { + return this; + } + return this.forEach(function (elem) { + var parent = referenceNode.parentNode; + parent.insertBefore(elem, referenceNode); + }); + }, + + // 将该元素插入到某个元素后面 + insertAfter: function insertAfter(selector) { + var $referenceNode = $(selector); + var referenceNode = $referenceNode[0]; + if (!referenceNode) { + return this; + } + return this.forEach(function (elem) { + var parent = referenceNode.parentNode; + if (parent.lastChild === referenceNode) { + // 最后一个元素 + parent.appendChild(elem); + } else { + // 不是最后一个元素 + parent.insertBefore(elem, referenceNode.nextSibling); + } + }); + } + }; + +// new 一个对象 + function $(selector) { + return new DomElement(selector); + } + +// 解绑所有事件,用于销毁编辑器 + $.offAll = function () { + eventList.forEach(function (item) { + var elem = item.elem; + var type = item.type; + var fn = item.fn; + // 解绑 + elem.removeEventListener(type, fn); + }); + }; + + /* + 配置信息 +*/ + + var config = { + + // 默认菜单配置 + menus: ['head', 'bold', 'fontSize', 'fontName', 'italic', 'underline', 'strikeThrough', 'foreColor', 'backColor', 'link', 'list', 'justify', 'quote', 'emoticon', 'image', 'table', 'video', 'code', 'undo', 'redo'], + + fontNames: ['宋体', '微软雅黑', 'Arial', 'Tahoma', 'Verdana'], + + colors: ['#000000', '#eeece0', '#1c487f', '#4d80bf', '#c24f4a', '#8baa4a', '#7b5ba1', '#46acc8', '#f9963b', '#ffffff'], + + // // 语言配置 + // lang: { + // '设置标题': 'title', + // '正文': 'p', + // '链接文字': 'link text', + // '链接': 'link', + // '插入': 'insert', + // '创建': 'init' + // }, + + // 表情 + emotions: [{ + // tab 的标题 + title: '默认', + // type -> 'emoji' / 'image' + type: 'image', + // content -> 数组 + content: [{ + alt: '[坏笑]', + src: 'https://img.t.sinajs.cn/t4/appstyle/expression/ext/normal/50/pcmoren_huaixiao_org.png' + }, { + alt: '[舔屏]', + src: 'https://img.t.sinajs.cn/t4/appstyle/expression/ext/normal/40/pcmoren_tian_org.png' + }, { + alt: '[污]', + src: 'https://img.t.sinajs.cn/t4/appstyle/expression/ext/normal/3c/pcmoren_wu_org.png' + }] + }, { + // tab 的标题 + title: '新浪', + // type -> 'emoji' / 'image' + type: 'image', + // content -> 数组 + content: [{ + src: 'https://img.t.sinajs.cn/t35/style/images/common/face/ext/normal/7a/shenshou_thumb.gif', + alt: '[草泥马]' + }, { + src: 'https://img.t.sinajs.cn/t35/style/images/common/face/ext/normal/60/horse2_thumb.gif', + alt: '[神马]' + }, { + src: 'https://img.t.sinajs.cn/t35/style/images/common/face/ext/normal/bc/fuyun_thumb.gif', + alt: '[浮云]' + }] + }, { + // tab 的标题 + title: 'emoji', + // type -> 'emoji' / 'image' + type: 'emoji', + // content -> 数组 + content: '😀 😃 😄 😁 😆 😅 😂 😊 😇 🙂 🙃 😉 😓 😪 😴 🙄 🤔 😬 🤐'.split(/\s/) + }], + + // 编辑区域的 z-index + zIndex: 10000, + + // 是否开启 debug 模式(debug 模式下错误会 throw error 形式抛出) + debug: false, + + // 插入链接时候的格式校验 + linkCheck: function linkCheck(text, link) { + // text 是插入的文字 + // link 是插入的链接 + return true; // 返回 true 即表示成功 + // return '校验失败' // 返回字符串即表示失败的提示信息 + }, + + // 插入网络图片的校验 + linkImgCheck: function linkImgCheck(src) { + // src 即图片的地址 + return true; // 返回 true 即表示成功 + // return '校验失败' // 返回字符串即表示失败的提示信息 + }, + + // 粘贴过滤样式,默认开启 + pasteFilterStyle: true, + + // 粘贴内容时,忽略图片。默认关闭 + pasteIgnoreImg: false, + + // 对粘贴的文字进行自定义处理,返回处理后的结果。编辑器会将处理后的结果粘贴到编辑区域中。 + // IE 暂时不支持 + pasteTextHandle: function pasteTextHandle(content) { + // content 即粘贴过来的内容(html 或 纯文本),可进行自定义处理然后返回 + return content; + }, + + // onchange 事件 + // onchange: function (html) { + // // html 即变化之后的内容 + // console.log(html) + // }, + + // 是否显示添加网络图片的 tab + showLinkImg: true, + + // 插入网络图片的回调 + linkImgCallback: function linkImgCallback(url) { + // console.log(url) // url 即插入图片的地址 + }, + + // 默认上传图片 max size: 5M + uploadImgMaxSize: 5 * 1024 * 1024, + + // 配置一次最多上传几个图片 + // uploadImgMaxLength: 5, + + // 上传图片,是否显示 base64 格式 + uploadImgShowBase64: false, + + // 上传图片,server 地址(如果有值,则 base64 格式的配置则失效) + // uploadImgServer: '/upload', + + // 自定义配置 filename + uploadFileName: '', + + // 上传图片的自定义参数 + uploadImgParams: { + // token: 'abcdef12345' + }, + + // 上传图片的自定义header + uploadImgHeaders: { + // 'Accept': 'text/x-json' + }, + + // 配置 XHR withCredentials + withCredentials: false, + + // 自定义上传图片超时时间 ms + uploadImgTimeout: 10000, + + // 上传图片 hook + uploadImgHooks: { + // customInsert: function (insertLinkImg, result, editor) { + // console.log('customInsert') + // // 图片上传并返回结果,自定义插入图片的事件,而不是编辑器自动插入图片 + // const data = result.data1 || [] + // data.forEach(link => { + // insertLinkImg(link) + // }) + // }, + before: function before(xhr, editor, files) { + // 图片上传之前触发 + + // 如果返回的结果是 {prevent: true, msg: 'xxxx'} 则表示用户放弃上传 + // return { + // prevent: true, + // msg: '放弃上传' + // } + }, + success: function success(xhr, editor, result) { + // 图片上传并返回结果,图片插入成功之后触发 + }, + fail: function fail(xhr, editor, result) { + // 图片上传并返回结果,但图片插入错误时触发 + }, + error: function error(xhr, editor) { + // 图片上传出错时触发 + }, + timeout: function timeout(xhr, editor) { + // 图片上传超时时触发 + } + }, + + // 是否上传七牛云,默认为 false + qiniu: false + + }; + + /* + 工具 +*/ + +// 和 UA 相关的属性 + var UA = { + _ua: navigator.userAgent, + + // 是否 webkit + isWebkit: function isWebkit() { + var reg = /webkit/i; + return reg.test(this._ua); + }, + + // 是否 IE + isIE: function isIE() { + return 'ActiveXObject' in window; + } + }; + +// 遍历对象 + function objForEach(obj, fn) { + var key = void 0, + result = void 0; + for (key in obj) { + if (obj.hasOwnProperty(key)) { + result = fn.call(obj, key, obj[key]); + if (result === false) { + break; + } + } + } + } + +// 遍历类数组 + function arrForEach(fakeArr, fn) { + var i = void 0, + item = void 0, + result = void 0; + var length = fakeArr.length || 0; + for (i = 0; i < length; i++) { + item = fakeArr[i]; + result = fn.call(fakeArr, item, i); + if (result === false) { + break; + } + } + } + +// 获取随机数 + function getRandom(prefix) { + return prefix + Math.random().toString().slice(2); + } + +// 替换 html 特殊字符 + function replaceHtmlSymbol(html) { + if (html == null) { + return ''; + } + return html.replace(//gm, '>').replace(/"/gm, '"'); + } + +// 返回百分比的格式 + + +// 判断是不是 function + function isFunction(fn) { + return typeof fn === 'function'; + } + + /* + bold-menu +*/ + +// 构造函数 + function Bold(editor) { + this.editor = editor; + this.$elem = $('
    \n \n
    '); + this.type = 'click'; + + // 当前是否 active 状态 + this._active = false; + } + +// 原型 + Bold.prototype = { + constructor: Bold, + + // 点击事件 + onClick: function onClick(e) { + // 点击菜单将触发这里 + + var editor = this.editor; + var isSeleEmpty = editor.selection.isSelectionEmpty(); + + if (isSeleEmpty) { + // 选区是空的,插入并选中一个“空白” + editor.selection.createEmptyRange(); + } + + // 执行 bold 命令 + editor.cmd.do('bold'); + + if (isSeleEmpty) { + // 需要将选取折叠起来 + editor.selection.collapseRange(); + editor.selection.restoreSelection(); + } + }, + + // 试图改变 active 状态 + tryChangeActive: function tryChangeActive(e) { + var editor = this.editor; + var $elem = this.$elem; + if (editor.cmd.queryCommandState('bold')) { + this._active = true; + $elem.addClass('w-e-active'); + } else { + this._active = false; + $elem.removeClass('w-e-active'); + } + } + }; + + /* + 替换多语言 + */ + + var replaceLang = function (editor, str) { + var langArgs = editor.config.langArgs || []; + var result = str; + + langArgs.forEach(function (item) { + var reg = item.reg; + var val = item.val; + + if (reg.test(result)) { + result = result.replace(reg, function () { + return val; + }); + } + }); + + return result; + }; + + /* + droplist +*/ + var _emptyFn = function _emptyFn() { + }; + +// 构造函数 + function DropList(menu, opt) { + var _this = this; + + // droplist 所依附的菜单 + var editor = menu.editor; + this.menu = menu; + this.opt = opt; + // 容器 + var $container = $('
    '); + + // 标题 + var $title = opt.$title; + var titleHtml = void 0; + if ($title) { + // 替换多语言 + titleHtml = $title.html(); + titleHtml = replaceLang(editor, titleHtml); + $title.html(titleHtml); + + $title.addClass('w-e-dp-title'); + $container.append($title); + } + + var list = opt.list || []; + var type = opt.type || 'list'; // 'list' 列表形式(如“标题”菜单) / 'inline-block' 块状形式(如“颜色”菜单) + var onClick = opt.onClick || _emptyFn; + + // 加入 DOM 并绑定事件 + var $list = $('
      '); + $container.append($list); + list.forEach(function (item) { + var $elem = item.$elem; + + // 替换多语言 + var elemHtml = $elem.html(); + elemHtml = replaceLang(editor, elemHtml); + $elem.html(elemHtml); + + var value = item.value; + var $li = $('
    • '); + if ($elem) { + $li.append($elem); + $list.append($li); + $li.on('click', function (e) { + onClick(value); + + // 隐藏 + _this.hideTimeoutId = setTimeout(function () { + _this.hide(); + }, 0); + }); + } + }); + + // 绑定隐藏事件 + $container.on('mouseleave', function (e) { + _this.hideTimeoutId = setTimeout(function () { + _this.hide(); + }, 0); + }); + + // 记录属性 + this.$container = $container; + + // 基本属性 + this._rendered = false; + this._show = false; + } + +// 原型 + DropList.prototype = { + constructor: DropList, + + // 显示(插入DOM) + show: function show() { + if (this.hideTimeoutId) { + // 清除之前的定时隐藏 + clearTimeout(this.hideTimeoutId); + } + + var menu = this.menu; + var $menuELem = menu.$elem; + var $container = this.$container; + if (this._show) { + return; + } + if (this._rendered) { + // 显示 + $container.show(); + } else { + // 加入 DOM 之前先定位位置 + var menuHeight = $menuELem.getSizeData().height || 0; + var width = this.opt.width || 100; // 默认为 100 + $container.css('margin-top', menuHeight + 'px').css('width', width + 'px'); + + // 加入到 DOM + $menuELem.append($container); + this._rendered = true; + } + + // 修改属性 + this._show = true; + }, + + // 隐藏(移除DOM) + hide: function hide() { + if (this.showTimeoutId) { + // 清除之前的定时显示 + clearTimeout(this.showTimeoutId); + } + + var $container = this.$container; + if (!this._show) { + return; + } + // 隐藏并需改属性 + $container.hide(); + this._show = false; + } + }; + + /* + menu - header +*/ + +// 构造函数 + function Head(editor) { + var _this = this; + + this.editor = editor; + this.$elem = $('
      '); + this.type = 'droplist'; + + // 当前是否 active 状态 + this._active = false; + + // 初始化 droplist + this.droplist = new DropList(this, { + width: 100, + $title: $('

      设置标题

      '), + type: 'list', // droplist 以列表形式展示 + list: [{$elem: $('

      H1

      '), value: '

      '}, { + $elem: $('

      H2

      '), + value: '

      ' + }, {$elem: $('

      H3

      '), value: '

      '}, { + $elem: $('

      H4

      '), + value: '

      ' + }, {$elem: $('

      H5
      '), value: '
      '}, {$elem: $('

      正文

      '), value: '

      '}], + onClick: function onClick(value) { + // 注意 this 是指向当前的 Head 对象 + _this._command(value); + } + }); + } + +// 原型 + Head.prototype = { + constructor: Head, + + // 执行命令 + _command: function _command(value) { + var editor = this.editor; + + var $selectionElem = editor.selection.getSelectionContainerElem(); + if (editor.$textElem.equal($selectionElem)) { + // 不能选中多行来设置标题,否则会出现问题 + // 例如选中的是

      xxx

      yyy

      来设置标题,设置之后会成为

      xxx
      yyy

      不符合预期 + return; + } + + editor.cmd.do('formatBlock', value); + }, + + // 试图改变 active 状态 + tryChangeActive: function tryChangeActive(e) { + var editor = this.editor; + var $elem = this.$elem; + var reg = /^h/i; + var cmdValue = editor.cmd.queryCommandValue('formatBlock'); + if (reg.test(cmdValue)) { + this._active = true; + $elem.addClass('w-e-active'); + } else { + this._active = false; + $elem.removeClass('w-e-active'); + } + } + }; + + /* + menu - fontSize +*/ + +// 构造函数 + function FontSize(editor) { + var _this = this; + + this.editor = editor; + this.$elem = $('
      '); + this.type = 'droplist'; + + // 当前是否 active 状态 + this._active = false; + + // 初始化 droplist + this.droplist = new DropList(this, { + width: 160, + $title: $('

      字号

      '), + type: 'list', // droplist 以列表形式展示 + list: [{ + $elem: $('x-small'), + value: '1' + }, {$elem: $('small'), value: '2'}, { + $elem: $('normal'), + value: '3' + }, { + $elem: $('large'), + value: '4' + }, { + $elem: $('x-large'), + value: '5' + }, {$elem: $('xx-large'), value: '6'}], + onClick: function onClick(value) { + // 注意 this 是指向当前的 FontSize 对象 + _this._command(value); + } + }); + } + +// 原型 + FontSize.prototype = { + constructor: FontSize, + + // 执行命令 + _command: function _command(value) { + var editor = this.editor; + editor.cmd.do('fontSize', value); + } + }; + + /* + menu - fontName +*/ + +// 构造函数 + function FontName(editor) { + var _this = this; + + this.editor = editor; + this.$elem = $('
      '); + this.type = 'droplist'; + + // 当前是否 active 状态 + this._active = false; + + // 获取配置的字体 + var config = editor.config; + var fontNames = config.fontNames || []; + + // 初始化 droplist + this.droplist = new DropList(this, { + width: 100, + $title: $('

      字体

      '), + type: 'list', // droplist 以列表形式展示 + list: fontNames.map(function (fontName) { + return { + $elem: $('' + fontName + ''), + value: fontName + }; + }), + onClick: function onClick(value) { + // 注意 this 是指向当前的 FontName 对象 + _this._command(value); + } + }); + } + +// 原型 + FontName.prototype = { + constructor: FontName, + + _command: function _command(value) { + var editor = this.editor; + editor.cmd.do('fontName', value); + } + }; + + /* + panel +*/ + + var emptyFn = function emptyFn() { + }; + +// 记录已经显示 panel 的菜单 + var _isCreatedPanelMenus = []; + +// 构造函数 + function Panel(menu, opt) { + this.menu = menu; + this.opt = opt; + } + +// 原型 + Panel.prototype = { + constructor: Panel, + + // 显示(插入DOM) + show: function show() { + var _this = this; + + var menu = this.menu; + if (_isCreatedPanelMenus.indexOf(menu) >= 0) { + // 该菜单已经创建了 panel 不能再创建 + return; + } + + var editor = menu.editor; + var $body = $('body'); + var $textContainerElem = editor.$textContainerElem; + var opt = this.opt; + + // panel 的容器 + var $container = $('
      '); + var width = opt.width || 300; // 默认 300px + $container.css('width', width + 'px').css('margin-left', (0 - width) / 2 + 'px'); + + // 添加关闭按钮 + var $closeBtn = $(''); + $container.append($closeBtn); + $closeBtn.on('click', function () { + _this.hide(); + }); + + // 准备 tabs 容器 + var $tabTitleContainer = $('
        '); + var $tabContentContainer = $('
        '); + $container.append($tabTitleContainer).append($tabContentContainer); + + // 设置高度 + var height = opt.height; + if (height) { + $tabContentContainer.css('height', height + 'px').css('overflow-y', 'auto'); + } + + // tabs + var tabs = opt.tabs || []; + var tabTitleArr = []; + var tabContentArr = []; + tabs.forEach(function (tab, tabIndex) { + if (!tab) { + return; + } + var title = tab.title || ''; + var tpl = tab.tpl || ''; + + // 替换多语言 + title = replaceLang(editor, title); + tpl = replaceLang(editor, tpl); + + // 添加到 DOM + var $title = $('
      • ' + title + '
      • '); + $tabTitleContainer.append($title); + var $content = $(tpl); + $tabContentContainer.append($content); + + // 记录到内存 + $title._index = tabIndex; + tabTitleArr.push($title); + tabContentArr.push($content); + + // 设置 active 项 + if (tabIndex === 0) { + $title._active = true; + $title.addClass('w-e-active'); + } else { + $content.hide(); + } + + // 绑定 tab 的事件 + $title.on('click', function (e) { + if ($title._active) { + return; + } + // 隐藏所有的 tab + tabTitleArr.forEach(function ($title) { + $title._active = false; + $title.removeClass('w-e-active'); + }); + tabContentArr.forEach(function ($content) { + $content.hide(); + }); + + // 显示当前的 tab + $title._active = true; + $title.addClass('w-e-active'); + $content.show(); + }); + }); + + // 绑定关闭事件 + $container.on('click', function (e) { + // 点击时阻止冒泡 + e.stopPropagation(); + }); + $body.on('click', function (e) { + _this.hide(); + }); + + // 添加到 DOM + $textContainerElem.append($container); + + // 绑定 opt 的事件,只有添加到 DOM 之后才能绑定成功 + tabs.forEach(function (tab, index) { + if (!tab) { + return; + } + var events = tab.events || []; + events.forEach(function (event) { + var selector = event.selector; + var type = event.type; + var fn = event.fn || emptyFn; + var $content = tabContentArr[index]; + $content.find(selector).on(type, function (e) { + e.stopPropagation(); + var needToHide = fn(e); + // 执行完事件之后,是否要关闭 panel + if (needToHide) { + _this.hide(); + } + }); + }); + }); + + // focus 第一个 elem + var $inputs = $container.find('input[type=text],textarea'); + if ($inputs.length) { + $inputs.get(0).focus(); + } + + // 添加到属性 + this.$container = $container; + + // 隐藏其他 panel + this._hideOtherPanels(); + // 记录该 menu 已经创建了 panel + _isCreatedPanelMenus.push(menu); + }, + + // 隐藏(移除DOM) + hide: function hide() { + var menu = this.menu; + var $container = this.$container; + if ($container) { + $container.remove(); + } + + // 将该 menu 记录中移除 + _isCreatedPanelMenus = _isCreatedPanelMenus.filter(function (item) { + if (item === menu) { + return false; + } else { + return true; + } + }); + }, + + // 一个 panel 展示时,隐藏其他 panel + _hideOtherPanels: function _hideOtherPanels() { + if (!_isCreatedPanelMenus.length) { + return; + } + _isCreatedPanelMenus.forEach(function (menu) { + var panel = menu.panel || {}; + if (panel.hide) { + panel.hide(); + } + }); + } + }; + + /* + menu - link +*/ + +// 构造函数 + function Link(editor) { + this.editor = editor; + this.$elem = $('
        '); + this.type = 'panel'; + + // 当前是否 active 状态 + this._active = false; + } + +// 原型 + Link.prototype = { + constructor: Link, + + // 点击事件 + onClick: function onClick(e) { + var editor = this.editor; + var $linkelem = void 0; + + if (this._active) { + // 当前选区在链接里面 + $linkelem = editor.selection.getSelectionContainerElem(); + if (!$linkelem) { + return; + } + // 将该元素都包含在选取之内,以便后面整体替换 + editor.selection.createRangeByElem($linkelem); + editor.selection.restoreSelection(); + // 显示 panel + this._createPanel($linkelem.text(), $linkelem.attr('href')); + } else { + // 当前选区不在链接里面 + if (editor.selection.isSelectionEmpty()) { + // 选区是空的,未选中内容 + this._createPanel('', ''); + } else { + // 选中内容了 + this._createPanel(editor.selection.getSelectionText(), ''); + } + } + }, + + // 创建 panel + _createPanel: function _createPanel(text, link) { + var _this = this; + + // panel 中需要用到的id + var inputLinkId = getRandom('input-link'); + var inputTextId = getRandom('input-text'); + var btnOkId = getRandom('btn-ok'); + var btnDelId = getRandom('btn-del'); + + // 是否显示“删除链接” + var delBtnDisplay = this._active ? 'inline-block' : 'none'; + + // 初始化并显示 panel + var panel = new Panel(this, { + width: 300, + // panel 中可包含多个 tab + tabs: [{ + // tab 的标题 + title: '链接', + // 模板 + tpl: '
        \n \n \n
        \n \n \n
        \n
        ', + // 事件绑定 + events: [ + // 插入链接 + { + selector: '#' + btnOkId, + type: 'click', + fn: function fn() { + // 执行插入链接 + var $link = $('#' + inputLinkId); + var $text = $('#' + inputTextId); + var link = $link.val(); + var text = $text.val(); + _this._insertLink(text, link); + + // 返回 true,表示该事件执行完之后,panel 要关闭。否则 panel 不会关闭 + return true; + } + }, + // 删除链接 + { + selector: '#' + btnDelId, + type: 'click', + fn: function fn() { + // 执行删除链接 + _this._delLink(); + + // 返回 true,表示该事件执行完之后,panel 要关闭。否则 panel 不会关闭 + return true; + } + }] + } // tab end + ] // tabs end + }); + + // 显示 panel + panel.show(); + + // 记录属性 + this.panel = panel; + }, + + // 删除当前链接 + _delLink: function _delLink() { + if (!this._active) { + return; + } + var editor = this.editor; + var $selectionELem = editor.selection.getSelectionContainerElem(); + if (!$selectionELem) { + return; + } + var selectionText = editor.selection.getSelectionText(); + editor.cmd.do('insertHTML', '' + selectionText + ''); + }, + + // 插入链接 + _insertLink: function _insertLink(text, link) { + var editor = this.editor; + var config = editor.config; + var linkCheck = config.linkCheck; + var checkResult = true; // 默认为 true + if (linkCheck && typeof linkCheck === 'function') { + checkResult = linkCheck(text, link); + } + if (checkResult === true) { + editor.cmd.do('insertHTML', '' + text + ''); + } else { + alert(checkResult); + } + }, + + // 试图改变 active 状态 + tryChangeActive: function tryChangeActive(e) { + var editor = this.editor; + var $elem = this.$elem; + var $selectionELem = editor.selection.getSelectionContainerElem(); + if (!$selectionELem) { + return; + } + if ($selectionELem.getNodeName() === 'A') { + this._active = true; + $elem.addClass('w-e-active'); + } else { + this._active = false; + $elem.removeClass('w-e-active'); + } + } + }; + + /* + italic-menu +*/ + +// 构造函数 + function Italic(editor) { + this.editor = editor; + this.$elem = $('
        \n \n
        '); + this.type = 'click'; + + // 当前是否 active 状态 + this._active = false; + } + +// 原型 + Italic.prototype = { + constructor: Italic, + + // 点击事件 + onClick: function onClick(e) { + // 点击菜单将触发这里 + + var editor = this.editor; + var isSeleEmpty = editor.selection.isSelectionEmpty(); + + if (isSeleEmpty) { + // 选区是空的,插入并选中一个“空白” + editor.selection.createEmptyRange(); + } + + // 执行 italic 命令 + editor.cmd.do('italic'); + + if (isSeleEmpty) { + // 需要将选取折叠起来 + editor.selection.collapseRange(); + editor.selection.restoreSelection(); + } + }, + + // 试图改变 active 状态 + tryChangeActive: function tryChangeActive(e) { + var editor = this.editor; + var $elem = this.$elem; + if (editor.cmd.queryCommandState('italic')) { + this._active = true; + $elem.addClass('w-e-active'); + } else { + this._active = false; + $elem.removeClass('w-e-active'); + } + } + }; + + /* + redo-menu +*/ + +// 构造函数 + function Redo(editor) { + this.editor = editor; + this.$elem = $('
        \n \n
        '); + this.type = 'click'; + + // 当前是否 active 状态 + this._active = false; + } + +// 原型 + Redo.prototype = { + constructor: Redo, + + // 点击事件 + onClick: function onClick(e) { + // 点击菜单将触发这里 + + var editor = this.editor; + + // 执行 redo 命令 + editor.cmd.do('redo'); + } + }; + + /* + strikeThrough-menu +*/ + +// 构造函数 + function StrikeThrough(editor) { + this.editor = editor; + this.$elem = $('
        \n \n
        '); + this.type = 'click'; + + // 当前是否 active 状态 + this._active = false; + } + +// 原型 + StrikeThrough.prototype = { + constructor: StrikeThrough, + + // 点击事件 + onClick: function onClick(e) { + // 点击菜单将触发这里 + + var editor = this.editor; + var isSeleEmpty = editor.selection.isSelectionEmpty(); + + if (isSeleEmpty) { + // 选区是空的,插入并选中一个“空白” + editor.selection.createEmptyRange(); + } + + // 执行 strikeThrough 命令 + editor.cmd.do('strikeThrough'); + + if (isSeleEmpty) { + // 需要将选取折叠起来 + editor.selection.collapseRange(); + editor.selection.restoreSelection(); + } + }, + + // 试图改变 active 状态 + tryChangeActive: function tryChangeActive(e) { + var editor = this.editor; + var $elem = this.$elem; + if (editor.cmd.queryCommandState('strikeThrough')) { + this._active = true; + $elem.addClass('w-e-active'); + } else { + this._active = false; + $elem.removeClass('w-e-active'); + } + } + }; + + /* + underline-menu +*/ + +// 构造函数 + function Underline(editor) { + this.editor = editor; + this.$elem = $('
        \n \n
        '); + this.type = 'click'; + + // 当前是否 active 状态 + this._active = false; + } + +// 原型 + Underline.prototype = { + constructor: Underline, + + // 点击事件 + onClick: function onClick(e) { + // 点击菜单将触发这里 + + var editor = this.editor; + var isSeleEmpty = editor.selection.isSelectionEmpty(); + + if (isSeleEmpty) { + // 选区是空的,插入并选中一个“空白” + editor.selection.createEmptyRange(); + } + + // 执行 underline 命令 + editor.cmd.do('underline'); + + if (isSeleEmpty) { + // 需要将选取折叠起来 + editor.selection.collapseRange(); + editor.selection.restoreSelection(); + } + }, + + // 试图改变 active 状态 + tryChangeActive: function tryChangeActive(e) { + var editor = this.editor; + var $elem = this.$elem; + if (editor.cmd.queryCommandState('underline')) { + this._active = true; + $elem.addClass('w-e-active'); + } else { + this._active = false; + $elem.removeClass('w-e-active'); + } + } + }; + + /* + undo-menu +*/ + +// 构造函数 + function Undo(editor) { + this.editor = editor; + this.$elem = $('
        \n \n
        '); + this.type = 'click'; + + // 当前是否 active 状态 + this._active = false; + } + +// 原型 + Undo.prototype = { + constructor: Undo, + + // 点击事件 + onClick: function onClick(e) { + // 点击菜单将触发这里 + + var editor = this.editor; + + // 执行 undo 命令 + editor.cmd.do('undo'); + } + }; + + /* + menu - list +*/ + +// 构造函数 + function List(editor) { + var _this = this; + + this.editor = editor; + this.$elem = $('
        '); + this.type = 'droplist'; + + // 当前是否 active 状态 + this._active = false; + + // 初始化 droplist + this.droplist = new DropList(this, { + width: 120, + $title: $('

        设置列表

        '), + type: 'list', // droplist 以列表形式展示 + list: [{ + $elem: $(' 有序列表'), + value: 'insertOrderedList' + }, {$elem: $(' 无序列表'), value: 'insertUnorderedList'}], + onClick: function onClick(value) { + // 注意 this 是指向当前的 List 对象 + _this._command(value); + } + }); + } + +// 原型 + List.prototype = { + constructor: List, + + // 执行命令 + _command: function _command(value) { + var editor = this.editor; + var $textElem = editor.$textElem; + editor.selection.restoreSelection(); + if (editor.cmd.queryCommandState(value)) { + return; + } + editor.cmd.do(value); + + // 验证列表是否被包裹在

        之内 + var $selectionElem = editor.selection.getSelectionContainerElem(); + if ($selectionElem.getNodeName() === 'LI') { + $selectionElem = $selectionElem.parent(); + } + if (/^ol|ul$/i.test($selectionElem.getNodeName()) === false) { + return; + } + if ($selectionElem.equal($textElem)) { + // 证明是顶级标签,没有被

        包裹 + return; + } + var $parent = $selectionElem.parent(); + if ($parent.equal($textElem)) { + // $parent 是顶级标签,不能删除 + return; + } + + $selectionElem.insertAfter($parent); + $parent.remove(); + }, + + // 试图改变 active 状态 + tryChangeActive: function tryChangeActive(e) { + var editor = this.editor; + var $elem = this.$elem; + if (editor.cmd.queryCommandState('insertUnOrderedList') || editor.cmd.queryCommandState('insertOrderedList')) { + this._active = true; + $elem.addClass('w-e-active'); + } else { + this._active = false; + $elem.removeClass('w-e-active'); + } + } + }; + + /* + menu - justify +*/ + +// 构造函数 + function Justify(editor) { + var _this = this; + + this.editor = editor; + this.$elem = $('

        '); + this.type = 'droplist'; + + // 当前是否 active 状态 + this._active = false; + + // 初始化 droplist + this.droplist = new DropList(this, { + width: 100, + $title: $('

        对齐方式

        '), + type: 'list', // droplist 以列表形式展示 + list: [{ + $elem: $(' 靠左'), + value: 'justifyLeft' + }, { + $elem: $(' 居中'), + value: 'justifyCenter' + }, {$elem: $(' 靠右'), value: 'justifyRight'}], + onClick: function onClick(value) { + // 注意 this 是指向当前的 List 对象 + _this._command(value); + } + }); + } + +// 原型 + Justify.prototype = { + constructor: Justify, + + // 执行命令 + _command: function _command(value) { + var editor = this.editor; + editor.cmd.do(value); + } + }; + + /* + menu - Forecolor +*/ + +// 构造函数 + function ForeColor(editor) { + var _this = this; + + this.editor = editor; + this.$elem = $('
        '); + this.type = 'droplist'; + + // 获取配置的颜色 + var config = editor.config; + var colors = config.colors || []; + + // 当前是否 active 状态 + this._active = false; + + // 初始化 droplist + this.droplist = new DropList(this, { + width: 120, + $title: $('

        文字颜色

        '), + type: 'inline-block', // droplist 内容以 block 形式展示 + list: colors.map(function (color) { + return {$elem: $(''), value: color}; + }), + onClick: function onClick(value) { + // 注意 this 是指向当前的 ForeColor 对象 + _this._command(value); + } + }); + } + +// 原型 + ForeColor.prototype = { + constructor: ForeColor, + + // 执行命令 + _command: function _command(value) { + var editor = this.editor; + editor.cmd.do('foreColor', value); + } + }; + + /* + menu - BackColor +*/ + +// 构造函数 + function BackColor(editor) { + var _this = this; + + this.editor = editor; + this.$elem = $('
        '); + this.type = 'droplist'; + + // 获取配置的颜色 + var config = editor.config; + var colors = config.colors || []; + + // 当前是否 active 状态 + this._active = false; + + // 初始化 droplist + this.droplist = new DropList(this, { + width: 120, + $title: $('

        背景色

        '), + type: 'inline-block', // droplist 内容以 block 形式展示 + list: colors.map(function (color) { + return {$elem: $(''), value: color}; + }), + onClick: function onClick(value) { + // 注意 this 是指向当前的 BackColor 对象 + _this._command(value); + } + }); + } + +// 原型 + BackColor.prototype = { + constructor: BackColor, + + // 执行命令 + _command: function _command(value) { + var editor = this.editor; + editor.cmd.do('backColor', value); + } + }; + + /* + menu - quote +*/ + +// 构造函数 + function Quote(editor) { + this.editor = editor; + this.$elem = $('
        \n \n
        '); + this.type = 'click'; + + // 当前是否 active 状态 + this._active = false; + } + +// 原型 + Quote.prototype = { + constructor: Quote, + + onClick: function onClick(e) { + var editor = this.editor; + var $selectionElem = editor.selection.getSelectionContainerElem(); + var nodeName = $selectionElem.getNodeName(); + + if (!UA.isIE()) { + if (nodeName === 'BLOCKQUOTE') { + // 撤销 quote + editor.cmd.do('formatBlock', '

        '); + } else { + // 转换为 quote + editor.cmd.do('formatBlock', '

        '); + } + return; + } + + // IE 中不支持 formatBlock
        ,要用其他方式兼容 + var content = void 0, + $targetELem = void 0; + if (nodeName === 'P') { + // 将 P 转换为 quote + content = $selectionElem.text(); + $targetELem = $('
        ' + content + '
        '); + $targetELem.insertAfter($selectionElem); + $selectionElem.remove(); + return; + } + if (nodeName === 'BLOCKQUOTE') { + // 撤销 quote + content = $selectionElem.text(); + $targetELem = $('

        ' + content + '

        '); + $targetELem.insertAfter($selectionElem); + $selectionElem.remove(); + } + }, + + tryChangeActive: function tryChangeActive(e) { + var editor = this.editor; + var $elem = this.$elem; + var reg = /^BLOCKQUOTE$/i; + var cmdValue = editor.cmd.queryCommandValue('formatBlock'); + if (reg.test(cmdValue)) { + this._active = true; + $elem.addClass('w-e-active'); + } else { + this._active = false; + $elem.removeClass('w-e-active'); + } + } + }; + + /* + menu - code +*/ + +// 构造函数 + function Code(editor) { + this.editor = editor; + this.$elem = $('
        \n \n
        '); + this.type = 'panel'; + + // 当前是否 active 状态 + this._active = false; + } + +// 原型 + Code.prototype = { + constructor: Code, + + onClick: function onClick(e) { + var editor = this.editor; + var $startElem = editor.selection.getSelectionStartElem(); + var $endElem = editor.selection.getSelectionEndElem(); + var isSeleEmpty = editor.selection.isSelectionEmpty(); + var selectionText = editor.selection.getSelectionText(); + var $code = void 0; + + if (!$startElem.equal($endElem)) { + // 跨元素选择,不做处理 + editor.selection.restoreSelection(); + return; + } + if (!isSeleEmpty) { + // 选取不是空,用 包裹即可 + $code = $('' + selectionText + ''); + editor.cmd.do('insertElem', $code); + editor.selection.createRangeByElem($code, false); + editor.selection.restoreSelection(); + return; + } + + // 选取是空,且没有夸元素选择,则插入
        
        +            if (this._active) {
        +                // 选中状态,将编辑内容
        +                this._createPanel($startElem.html());
        +            } else {
        +                // 未选中状态,将创建内容
        +                this._createPanel();
        +            }
        +        },
        +
        +        _createPanel: function _createPanel(value) {
        +            var _this = this;
        +
        +            // value - 要编辑的内容
        +            value = value || '';
        +            var type = !value ? 'new' : 'edit';
        +            var langId = getRandom('langId');
        +            var textId = getRandom('texxt');
        +            var btnId = getRandom('btn');
        +
        +            var panel = new Panel(this, {
        +                width: 500,
        +                // 一个 Panel 包含多个 tab
        +                tabs: [{
        +                    // 标题
        +                    title: '插入代码',
        +                    // 模板
        +                    tpl: '
        \n \n
        \n \n
        \n
        ', + // 事件绑定 + events: [ + // 插入代码 + { + selector: '#' + btnId, + type: 'click', + fn: function fn() { + var $lang = $('#' + langId); + var $text = $('#' + textId); + var lang = $lang.val(); + var text = $text.val() || $text.html(); + text = replaceHtmlSymbol(text); + if (type === 'new') { + // 新插入 + _this._insertCode(text,lang); + } else { + // 编辑更新 + _this._updateCode(text); + } + + // 返回 true,表示该事件执行完之后,panel 要关闭。否则 panel 不会关闭 + return true; + } + }] + } // first tab end + ] // tabs end + }); // new Panel end + + // 显示 panel + panel.show(); + + // 记录属性 + this.panel = panel; + }, + + // 插入代码 + _insertCode: function _insertCode(value,lang) { + var editor = this.editor; + editor.cmd.do('insertHTML', '
        ' + value + '


        '); + }, + + // 更新代码 + _updateCode: function _updateCode(value) { + var editor = this.editor; + var $selectionELem = editor.selection.getSelectionContainerElem(); + if (!$selectionELem) { + return; + } + $selectionELem.html(value); + editor.selection.restoreSelection(); + }, + + // 试图改变 active 状态 + tryChangeActive: function tryChangeActive(e) { + var editor = this.editor; + var $elem = this.$elem; + var $selectionELem = editor.selection.getSelectionContainerElem(); + if (!$selectionELem) { + return; + } + var $parentElem = $selectionELem.parent(); + if ($selectionELem.getNodeName() === 'CODE' && $parentElem.getNodeName() === 'PRE') { + this._active = true; + $elem.addClass('w-e-active'); + } else { + this._active = false; + $elem.removeClass('w-e-active'); + } + } + }; + + /* + menu - emoticon +*/ + +// 构造函数 + function Emoticon(editor) { + this.editor = editor; + this.$elem = $('
        \n \n
        '); + this.type = 'panel'; + + // 当前是否 active 状态 + this._active = false; + } + +// 原型 + Emoticon.prototype = { + constructor: Emoticon, + + onClick: function onClick() { + this._createPanel(); + }, + + _createPanel: function _createPanel() { + var _this = this; + + var editor = this.editor; + var config = editor.config; + // 获取表情配置 + var emotions = config.emotions || []; + + // 创建表情 dropPanel 的配置 + var tabConfig = []; + emotions.forEach(function (emotData) { + var emotType = emotData.type; + var content = emotData.content || []; + + // 这一组表情最终拼接出来的 html + var faceHtml = ''; + + // emoji 表情 + if (emotType === 'emoji') { + content.forEach(function (item) { + if (item) { + faceHtml += '' + item + ''; + } + }); + } + // 图片表情 + if (emotType === 'image') { + content.forEach(function (item) { + var src = item.src; + var alt = item.alt; + if (src) { + // 加一个 data-w-e 属性,点击图片的时候不再提示编辑图片 + faceHtml += '' + alt + ''; + } + }); + } + + tabConfig.push({ + title: emotData.title, + tpl: '
        ' + faceHtml + '
        ', + events: [{ + selector: 'span.w-e-item', + type: 'click', + fn: function fn(e) { + var target = e.target; + var $target = $(target); + var nodeName = $target.getNodeName(); + + var insertHtml = void 0; + if (nodeName === 'IMG') { + // 插入图片 + insertHtml = $target.parent().html(); + } else { + // 插入 emoji + insertHtml = '' + $target.html() + ''; + } + + _this._insert(insertHtml); + // 返回 true,表示该事件执行完之后,panel 要关闭。否则 panel 不会关闭 + return true; + } + }] + }); + }); + + var panel = new Panel(this, { + width: 300, + height: 200, + // 一个 Panel 包含多个 tab + tabs: tabConfig + }); + + // 显示 panel + panel.show(); + + // 记录属性 + this.panel = panel; + }, + + // 插入表情 + _insert: function _insert(emotHtml) { + var editor = this.editor; + editor.cmd.do('insertHTML', emotHtml); + } + }; + + /* + menu - table +*/ + +// 构造函数 + function Table(editor) { + this.editor = editor; + this.$elem = $('
        '); + this.type = 'panel'; + + // 当前是否 active 状态 + this._active = false; + } + +// 原型 + Table.prototype = { + constructor: Table, + + onClick: function onClick() { + if (this._active) { + // 编辑现有表格 + this._createEditPanel(); + } else { + // 插入新表格 + this._createInsertPanel(); + } + }, + + // 创建插入新表格的 panel + _createInsertPanel: function _createInsertPanel() { + var _this = this; + + // 用到的 id + var btnInsertId = getRandom('btn'); + var textRowNum = getRandom('row'); + var textColNum = getRandom('col'); + + var panel = new Panel(this, { + width: 250, + // panel 包含多个 tab + tabs: [{ + // 标题 + title: '插入表格', + // 模板 + tpl: '
        \n

        \n \u521B\u5EFA\n \n \u884C\n \n \u5217\u7684\u8868\u683C\n

        \n
        \n \n
        \n
        ', + // 事件绑定 + events: [{ + // 点击按钮,插入表格 + selector: '#' + btnInsertId, + type: 'click', + fn: function fn() { + var rowNum = parseInt($('#' + textRowNum).val()); + var colNum = parseInt($('#' + textColNum).val()); + + if (rowNum && colNum && rowNum > 0 && colNum > 0) { + // form 数据有效 + _this._insert(rowNum, colNum); + } + + // 返回 true,表示该事件执行完之后,panel 要关闭。否则 panel 不会关闭 + return true; + } + }] + } // first tab end + ] // tabs end + }); // panel end + + // 展示 panel + panel.show(); + + // 记录属性 + this.panel = panel; + }, + + // 插入表格 + _insert: function _insert(rowNum, colNum) { + // 拼接 table 模板 + var r = void 0, + c = void 0; + var html = ''; + for (r = 0; r < rowNum; r++) { + html += ''; + if (r === 0) { + for (c = 0; c < colNum; c++) { + html += ''; + } + } else { + for (c = 0; c < colNum; c++) { + html += ''; + } + } + html += ''; + } + html += '
          


        '; + + // 执行命令 + var editor = this.editor; + editor.cmd.do('insertHTML', html); + + // 防止 firefox 下出现 resize 的控制点 + editor.cmd.do('enableObjectResizing', false); + editor.cmd.do('enableInlineTableEditing', false); + }, + + // 创建编辑表格的 panel + _createEditPanel: function _createEditPanel() { + var _this2 = this; + + // 可用的 id + var addRowBtnId = getRandom('add-row'); + var addColBtnId = getRandom('add-col'); + var delRowBtnId = getRandom('del-row'); + var delColBtnId = getRandom('del-col'); + var delTableBtnId = getRandom('del-table'); + + // 创建 panel 对象 + var panel = new Panel(this, { + width: 320, + // panel 包含多个 tab + tabs: [{ + // 标题 + title: '编辑表格', + // 模板 + tpl: '
        \n
        \n \n \n \n \n
        \n
        \n \n \n
        ', + // 事件绑定 + events: [{ + // 增加行 + selector: '#' + addRowBtnId, + type: 'click', + fn: function fn() { + _this2._addRow(); + // 返回 true,表示该事件执行完之后,panel 要关闭。否则 panel 不会关闭 + return true; + } + }, { + // 增加列 + selector: '#' + addColBtnId, + type: 'click', + fn: function fn() { + _this2._addCol(); + // 返回 true,表示该事件执行完之后,panel 要关闭。否则 panel 不会关闭 + return true; + } + }, { + // 删除行 + selector: '#' + delRowBtnId, + type: 'click', + fn: function fn() { + _this2._delRow(); + // 返回 true,表示该事件执行完之后,panel 要关闭。否则 panel 不会关闭 + return true; + } + }, { + // 删除列 + selector: '#' + delColBtnId, + type: 'click', + fn: function fn() { + _this2._delCol(); + // 返回 true,表示该事件执行完之后,panel 要关闭。否则 panel 不会关闭 + return true; + } + }, { + // 删除表格 + selector: '#' + delTableBtnId, + type: 'click', + fn: function fn() { + _this2._delTable(); + // 返回 true,表示该事件执行完之后,panel 要关闭。否则 panel 不会关闭 + return true; + } + }] + }] + }); + // 显示 panel + panel.show(); + }, + + // 获取选中的单元格的位置信息 + _getLocationData: function _getLocationData() { + var result = {}; + var editor = this.editor; + var $selectionELem = editor.selection.getSelectionContainerElem(); + if (!$selectionELem) { + return; + } + var nodeName = $selectionELem.getNodeName(); + if (nodeName !== 'TD' && nodeName !== 'TH') { + return; + } + + // 获取 td index + var $tr = $selectionELem.parent(); + var $tds = $tr.children(); + var tdLength = $tds.length; + $tds.forEach(function (td, index) { + if (td === $selectionELem[0]) { + // 记录并跳出循环 + result.td = { + index: index, + elem: td, + length: tdLength + }; + return false; + } + }); + + // 获取 tr index + var $tbody = $tr.parent(); + var $trs = $tbody.children(); + var trLength = $trs.length; + $trs.forEach(function (tr, index) { + if (tr === $tr[0]) { + // 记录并跳出循环 + result.tr = { + index: index, + elem: tr, + length: trLength + }; + return false; + } + }); + + // 返回结果 + return result; + }, + + // 增加行 + _addRow: function _addRow() { + // 获取当前单元格的位置信息 + var locationData = this._getLocationData(); + if (!locationData) { + return; + } + var trData = locationData.tr; + var $currentTr = $(trData.elem); + var tdData = locationData.td; + var tdLength = tdData.length; + + // 拼接即将插入的字符串 + var newTr = document.createElement('tr'); + var tpl = '', + i = void 0; + for (i = 0; i < tdLength; i++) { + tpl += ' '; + } + newTr.innerHTML = tpl; + // 插入 + $(newTr).insertAfter($currentTr); + }, + + // 增加列 + _addCol: function _addCol() { + // 获取当前单元格的位置信息 + var locationData = this._getLocationData(); + if (!locationData) { + return; + } + var trData = locationData.tr; + var tdData = locationData.td; + var tdIndex = tdData.index; + var $currentTr = $(trData.elem); + var $trParent = $currentTr.parent(); + var $trs = $trParent.children(); + + // 遍历所有行 + $trs.forEach(function (tr) { + var $tr = $(tr); + var $tds = $tr.children(); + var $currentTd = $tds.get(tdIndex); + var name = $currentTd.getNodeName().toLowerCase(); + + // new 一个 td,并插入 + var newTd = document.createElement(name); + $(newTd).insertAfter($currentTd); + }); + }, + + // 删除行 + _delRow: function _delRow() { + // 获取当前单元格的位置信息 + var locationData = this._getLocationData(); + if (!locationData) { + return; + } + var trData = locationData.tr; + var $currentTr = $(trData.elem); + $currentTr.remove(); + }, + + // 删除列 + _delCol: function _delCol() { + // 获取当前单元格的位置信息 + var locationData = this._getLocationData(); + if (!locationData) { + return; + } + var trData = locationData.tr; + var tdData = locationData.td; + var tdIndex = tdData.index; + var $currentTr = $(trData.elem); + var $trParent = $currentTr.parent(); + var $trs = $trParent.children(); + + // 遍历所有行 + $trs.forEach(function (tr) { + var $tr = $(tr); + var $tds = $tr.children(); + var $currentTd = $tds.get(tdIndex); + // 删除 + $currentTd.remove(); + }); + }, + + // 删除表格 + _delTable: function _delTable() { + var editor = this.editor; + var $selectionELem = editor.selection.getSelectionContainerElem(); + if (!$selectionELem) { + return; + } + var $table = $selectionELem.parentUntil('table'); + if (!$table) { + return; + } + $table.remove(); + }, + + // 试图改变 active 状态 + tryChangeActive: function tryChangeActive(e) { + var editor = this.editor; + var $elem = this.$elem; + var $selectionELem = editor.selection.getSelectionContainerElem(); + if (!$selectionELem) { + return; + } + var nodeName = $selectionELem.getNodeName(); + if (nodeName === 'TD' || nodeName === 'TH') { + this._active = true; + $elem.addClass('w-e-active'); + } else { + this._active = false; + $elem.removeClass('w-e-active'); + } + } + }; + + /* + menu - video +*/ + +// 构造函数 + function Video(editor) { + this.editor = editor; + this.$elem = $('
        '); + this.type = 'panel'; + + // 当前是否 active 状态 + this._active = false; + } + +// 原型 + Video.prototype = { + constructor: Video, + + onClick: function onClick() { + this._createPanel(); + }, + + _createPanel: function _createPanel() { + var _this = this; + + // 创建 id + var textValId = getRandom('text-val'); + var btnId = getRandom('btn'); + + // 创建 panel + var panel = new Panel(this, { + width: 350, + // 一个 panel 多个 tab + tabs: [{ + // 标题 + title: '插入视频', + // 模板 + tpl: '
        \n \n
        \n \n
        \n
        ', + // 事件绑定 + events: [{ + selector: '#' + btnId, + type: 'click', + fn: function fn() { + var $text = $('#' + textValId); + var val = $text.val().trim(); + + // 测试用视频地址 + // + + if (val) { + // 插入视频 + _this._insert(val); + } + + // 返回 true,表示该事件执行完之后,panel 要关闭。否则 panel 不会关闭 + return true; + } + }] + } // first tab end + ] // tabs end + }); // panel end + + // 显示 panel + panel.show(); + + // 记录属性 + this.panel = panel; + }, + + // 插入视频 + _insert: function _insert(val) { + var editor = this.editor; + editor.cmd.do('insertHTML', val + '


        '); + } + }; + + /* + menu - img +*/ + +// 构造函数 + function Image(editor) { + this.editor = editor; + var imgMenuId = getRandom('w-e-img'); + this.$elem = $('
        '); + editor.imgMenuId = imgMenuId; + this.type = 'panel'; + + // 当前是否 active 状态 + this._active = false; + } + +// 原型 + Image.prototype = { + constructor: Image, + + onClick: function onClick() { + var editor = this.editor; + var config = editor.config; + if (config.qiniu) { + return; + } + if (this._active) { + this._createEditPanel(); + } else { + this._createInsertPanel(); + } + }, + + _createEditPanel: function _createEditPanel() { + var editor = this.editor; + + // id + var width30 = getRandom('width-30'); + var width50 = getRandom('width-50'); + var width100 = getRandom('width-100'); + var delBtn = getRandom('del-btn'); + + // tab 配置 + var tabsConfig = [{ + title: '编辑图片', + tpl: '
        \n
        \n \u6700\u5927\u5BBD\u5EA6\uFF1A\n \n \n \n
        \n
        \n \n \n
        ', + events: [{ + selector: '#' + width30, + type: 'click', + fn: function fn() { + var $img = editor._selectedImg; + if ($img) { + $img.css('max-width', '30%'); + } + // 返回 true,表示该事件执行完之后,panel 要关闭。否则 panel 不会关闭 + return true; + } + }, { + selector: '#' + width50, + type: 'click', + fn: function fn() { + var $img = editor._selectedImg; + if ($img) { + $img.css('max-width', '50%'); + } + // 返回 true,表示该事件执行完之后,panel 要关闭。否则 panel 不会关闭 + return true; + } + }, { + selector: '#' + width100, + type: 'click', + fn: function fn() { + var $img = editor._selectedImg; + if ($img) { + $img.css('max-width', '100%'); + } + // 返回 true,表示该事件执行完之后,panel 要关闭。否则 panel 不会关闭 + return true; + } + }, { + selector: '#' + delBtn, + type: 'click', + fn: function fn() { + var $img = editor._selectedImg; + if ($img) { + $img.remove(); + } + // 返回 true,表示该事件执行完之后,panel 要关闭。否则 panel 不会关闭 + return true; + } + }] + }]; + + // 创建 panel 并显示 + var panel = new Panel(this, { + width: 300, + tabs: tabsConfig + }); + panel.show(); + + // 记录属性 + this.panel = panel; + }, + + _createInsertPanel: function _createInsertPanel() { + var editor = this.editor; + var uploadImg = editor.uploadImg; + var config = editor.config; + + // id + var upTriggerId = getRandom('up-trigger'); + var upFileId = getRandom('up-file'); + var linkUrlId = getRandom('link-url'); + var linkBtnId = getRandom('link-btn'); + + // tabs 的配置 + var tabsConfig = [{ + title: '上传图片', + tpl: '
        \n
        \n \n
        \n
        \n \n
        \n
        ', + events: [{ + // 触发选择图片 + selector: '#' + upTriggerId, + type: 'click', + fn: function fn() { + var $file = $('#' + upFileId); + var fileElem = $file[0]; + if (fileElem) { + fileElem.click(); + } else { + // 返回 true 可关闭 panel + return true; + } + } + }, { + // 选择图片完毕 + selector: '#' + upFileId, + type: 'change', + fn: function fn() { + var $file = $('#' + upFileId); + var fileElem = $file[0]; + if (!fileElem) { + // 返回 true 可关闭 panel + return true; + } + + // 获取选中的 file 对象列表 + var fileList = fileElem.files; + if (fileList.length) { + uploadImg.uploadImg(fileList); + } + + // 返回 true 可关闭 panel + return true; + } + }] + }, // first tab end + { + title: '网络图片', + tpl: '
        \n \n
        \n \n
        \n
        ', + events: [{ + selector: '#' + linkBtnId, + type: 'click', + fn: function fn() { + var $linkUrl = $('#' + linkUrlId); + var url = $linkUrl.val().trim(); + + if (url) { + uploadImg.insertLinkImg(url); + } + + // 返回 true 表示函数执行结束之后关闭 panel + return true; + } + }] + } // second tab end + ]; // tabs end + + // 判断 tabs 的显示 + var tabsConfigResult = []; + if ((config.uploadImgShowBase64 || config.uploadImgServer || config.customUploadImg) && window.FileReader) { + // 显示“上传图片” + tabsConfigResult.push(tabsConfig[0]); + } + if (config.showLinkImg) { + // 显示“网络图片” + tabsConfigResult.push(tabsConfig[1]); + } + + // 创建 panel 并显示 + var panel = new Panel(this, { + width: 300, + tabs: tabsConfigResult + }); + panel.show(); + + // 记录属性 + this.panel = panel; + }, + + // 试图改变 active 状态 + tryChangeActive: function tryChangeActive(e) { + var editor = this.editor; + var $elem = this.$elem; + if (editor._selectedImg) { + this._active = true; + $elem.addClass('w-e-active'); + } else { + this._active = false; + $elem.removeClass('w-e-active'); + } + } + }; + + /* + 所有菜单的汇总 +*/ + +// 存储菜单的构造函数 + var MenuConstructors = {}; + + MenuConstructors.bold = Bold; + + MenuConstructors.head = Head; + + MenuConstructors.fontSize = FontSize; + + MenuConstructors.fontName = FontName; + + MenuConstructors.link = Link; + + MenuConstructors.italic = Italic; + + MenuConstructors.redo = Redo; + + MenuConstructors.strikeThrough = StrikeThrough; + + MenuConstructors.underline = Underline; + + MenuConstructors.undo = Undo; + + MenuConstructors.list = List; + + MenuConstructors.justify = Justify; + + MenuConstructors.foreColor = ForeColor; + + MenuConstructors.backColor = BackColor; + + MenuConstructors.quote = Quote; + + MenuConstructors.code = Code; + + MenuConstructors.emoticon = Emoticon; + + MenuConstructors.table = Table; + + MenuConstructors.video = Video; + + MenuConstructors.image = Image; + + /* + 菜单集合 +*/ + +// 构造函数 + function Menus(editor) { + this.editor = editor; + this.menus = {}; + } + +// 修改原型 + Menus.prototype = { + constructor: Menus, + + // 初始化菜单 + init: function init() { + var _this = this; + + var editor = this.editor; + var config = editor.config || {}; + var configMenus = config.menus || []; // 获取配置中的菜单 + + // 根据配置信息,创建菜单 + configMenus.forEach(function (menuKey) { + var MenuConstructor = MenuConstructors[menuKey]; + if (MenuConstructor && typeof MenuConstructor === 'function') { + // 创建单个菜单 + _this.menus[menuKey] = new MenuConstructor(editor); + } + }); + + // 添加到菜单栏 + this._addToToolbar(); + + // 绑定事件 + this._bindEvent(); + }, + + // 添加到菜单栏 + _addToToolbar: function _addToToolbar() { + var editor = this.editor; + var $toolbarElem = editor.$toolbarElem; + var menus = this.menus; + var config = editor.config; + // config.zIndex 是配置的编辑区域的 z-index,菜单的 z-index 得在其基础上 +1 + var zIndex = config.zIndex + 1; + objForEach(menus, function (key, menu) { + var $elem = menu.$elem; + if ($elem) { + // 设置 z-index + $elem.css('z-index', zIndex); + $toolbarElem.append($elem); + } + }); + }, + + // 绑定菜单 click mouseenter 事件 + _bindEvent: function _bindEvent() { + var menus = this.menus; + var editor = this.editor; + objForEach(menus, function (key, menu) { + var type = menu.type; + if (!type) { + return; + } + var $elem = menu.$elem; + var droplist = menu.droplist; + var panel = menu.panel; + + // 点击类型,例如 bold + if (type === 'click' && menu.onClick) { + $elem.on('click', function (e) { + if (editor.selection.getRange() == null) { + return; + } + menu.onClick(e); + }); + } + + // 下拉框,例如 head + if (type === 'droplist' && droplist) { + $elem.on('mouseenter', function (e) { + if (editor.selection.getRange() == null) { + return; + } + // 显示 + droplist.showTimeoutId = setTimeout(function () { + droplist.show(); + }, 200); + }).on('mouseleave', function (e) { + // 隐藏 + droplist.hideTimeoutId = setTimeout(function () { + droplist.hide(); + }, 0); + }); + } + + // 弹框类型,例如 link + if (type === 'panel' && menu.onClick) { + $elem.on('click', function (e) { + e.stopPropagation(); + if (editor.selection.getRange() == null) { + return; + } + // 在自定义事件中显示 panel + menu.onClick(e); + }); + } + }); + }, + + // 尝试修改菜单状态 + changeActive: function changeActive() { + var menus = this.menus; + objForEach(menus, function (key, menu) { + if (menu.tryChangeActive) { + setTimeout(function () { + menu.tryChangeActive(); + }, 100); + } + }); + } + }; + + /* + 粘贴信息的处理 +*/ + +// 获取粘贴的纯文本 + function getPasteText(e) { + var clipboardData = e.clipboardData || e.originalEvent && e.originalEvent.clipboardData; + var pasteText = void 0; + if (clipboardData == null) { + pasteText = window.clipboardData && window.clipboardData.getData('text'); + } else { + pasteText = clipboardData.getData('text/plain'); + } + + return replaceHtmlSymbol(pasteText); + } + +// 获取粘贴的html + function getPasteHtml(e, filterStyle, ignoreImg) { + var clipboardData = e.clipboardData || e.originalEvent && e.originalEvent.clipboardData; + var pasteText = void 0, + pasteHtml = void 0; + if (clipboardData == null) { + pasteText = window.clipboardData && window.clipboardData.getData('text'); + } else { + pasteText = clipboardData.getData('text/plain'); + pasteHtml = clipboardData.getData('text/html'); + } + if (!pasteHtml && pasteText) { + pasteHtml = '

        ' + replaceHtmlSymbol(pasteText) + '

        '; + } + if (!pasteHtml) { + return; + } + + // 过滤word中状态过来的无用字符 + var docSplitHtml = pasteHtml.split(''); + if (docSplitHtml.length === 2) { + pasteHtml = docSplitHtml[0]; + } + + // 过滤无用标签 + pasteHtml = pasteHtml.replace(/<(meta|script|link).+?>/igm, ''); + // 去掉注释 + pasteHtml = pasteHtml.replace(//mg, ''); + // 过滤 data-xxx 属性 + pasteHtml = pasteHtml.replace(/\s?data-.+?=('|").+?('|")/igm, ''); + + if (ignoreImg) { + // 忽略图片 + pasteHtml = pasteHtml.replace(//igm, ''); + } + + if (filterStyle) { + // 过滤样式 + pasteHtml = pasteHtml.replace(/\s?(class|style)=('|").+?('|")/igm, ''); + } else { + // 保留样式 + pasteHtml = pasteHtml.replace(/\s?class=('|").+?('|")/igm, ''); + } + + return pasteHtml; + } + +// 获取粘贴的图片文件 + function getPasteImgs(e) { + var result = []; + var txt = getPasteText(e); + if (txt) { + // 有文字,就忽略图片 + return result; + } + + var clipboardData = e.clipboardData || e.originalEvent && e.originalEvent.clipboardData || {}; + var items = clipboardData.items; + if (!items) { + return result; + } + + objForEach(items, function (key, value) { + var type = value.type; + if (/image/i.test(type)) { + result.push(value.getAsFile()); + } + }); + + return result; + } + + /* + 编辑区域 +*/ + +// 获取一个 elem.childNodes 的 JSON 数据 + function getChildrenJSON($elem) { + var result = []; + var $children = $elem.childNodes() || []; // 注意 childNodes() 可以获取文本节点 + $children.forEach(function (curElem) { + var elemResult = void 0; + var nodeType = curElem.nodeType; + + // 文本节点 + if (nodeType === 3) { + elemResult = curElem.textContent; + } + + // 普通 DOM 节点 + if (nodeType === 1) { + elemResult = {}; + + // tag + elemResult.tag = curElem.nodeName.toLowerCase(); + // attr + var attrData = []; + var attrList = curElem.attributes || {}; + var attrListLength = attrList.length || 0; + for (var i = 0; i < attrListLength; i++) { + var attr = attrList[i]; + attrData.push({ + name: attr.name, + value: attr.value + }); + } + elemResult.attrs = attrData; + // children(递归) + elemResult.children = getChildrenJSON($(curElem)); + } + + result.push(elemResult); + }); + return result; + } + +// 构造函数 + function Text(editor) { + this.editor = editor; + } + +// 修改原型 + Text.prototype = { + constructor: Text, + + // 初始化 + init: function init() { + // 绑定事件 + this._bindEvent(); + }, + + // 清空内容 + clear: function clear() { + this.html('


        '); + }, + + // 获取 设置 html + html: function html(val) { + var editor = this.editor; + var $textElem = editor.$textElem; + var html = void 0; + if (val == null) { + html = $textElem.html(); + // 未选中任何内容的时候点击“加粗”或者“斜体”等按钮,就得需要一个空的占位符 ​ ,这里替换掉 + html = html.replace(/\u200b/gm, ''); + return html; + } else { + $textElem.html(val); + + // 初始化选取,将光标定位到内容尾部 + editor.initSelection(); + } + }, + + // 获取 JSON + getJSON: function getJSON() { + var editor = this.editor; + var $textElem = editor.$textElem; + return getChildrenJSON($textElem); + }, + + // 获取 设置 text + text: function text(val) { + var editor = this.editor; + var $textElem = editor.$textElem; + var text = void 0; + if (val == null) { + text = $textElem.text(); + // 未选中任何内容的时候点击“加粗”或者“斜体”等按钮,就得需要一个空的占位符 ​ ,这里替换掉 + text = text.replace(/\u200b/gm, ''); + return text; + } else { + $textElem.text('

        ' + val + '

        '); + + // 初始化选取,将光标定位到内容尾部 + editor.initSelection(); + } + }, + + // 追加内容 + append: function append(html) { + var editor = this.editor; + var $textElem = editor.$textElem; + $textElem.append($(html)); + + // 初始化选取,将光标定位到内容尾部 + editor.initSelection(); + }, + + // 绑定事件 + _bindEvent: function _bindEvent() { + // 实时保存选取 + this._saveRangeRealTime(); + + // 按回车建时的特殊处理 + this._enterKeyHandle(); + + // 清空时保留


        + this._clearHandle(); + + // 粘贴事件(粘贴文字,粘贴图片) + this._pasteHandle(); + + // tab 特殊处理 + this._tabHandle(); + + // img 点击 + this._imgHandle(); + + // 拖拽事件 + this._dragHandle(); + }, + + // 实时保存选取 + _saveRangeRealTime: function _saveRangeRealTime() { + var editor = this.editor; + var $textElem = editor.$textElem; + + // 保存当前的选区 + function saveRange(e) { + // 随时保存选区 + editor.selection.saveRange(); + // 更新按钮 ative 状态 + editor.menus.changeActive(); + } + + // 按键后保存 + $textElem.on('keyup', saveRange); + $textElem.on('mousedown', function (e) { + // mousedown 状态下,鼠标滑动到编辑区域外面,也需要保存选区 + $textElem.on('mouseleave', saveRange); + }); + $textElem.on('mouseup', function (e) { + saveRange(); + // 在编辑器区域之内完成点击,取消鼠标滑动到编辑区外面的事件 + $textElem.off('mouseleave', saveRange); + }); + }, + + // 按回车键时的特殊处理 + _enterKeyHandle: function _enterKeyHandle() { + var editor = this.editor; + var $textElem = editor.$textElem; + + function insertEmptyP($selectionElem) { + var $p = $('


        '); + $p.insertBefore($selectionElem); + editor.selection.createRangeByElem($p, true); + editor.selection.restoreSelection(); + $selectionElem.remove(); + } + + // 将回车之后生成的非

        的顶级标签,改为

        + function pHandle(e) { + var $selectionElem = editor.selection.getSelectionContainerElem(); + var $parentElem = $selectionElem.parent(); + + if ($parentElem.html() === '
        ') { + // 回车之前光标所在一个

        .....

        ,忽然回车生成一个空的


        + // 而且继续回车跳不出去,因此只能特殊处理 + insertEmptyP($selectionElem); + return; + } + + if (!$parentElem.equal($textElem)) { + // 不是顶级标签 + return; + } + + var nodeName = $selectionElem.getNodeName(); + if (nodeName === 'P') { + // 当前的标签是 P ,不用做处理 + return; + } + + if ($selectionElem.text()) { + // 有内容,不做处理 + return; + } + + // 插入

        ,并将选取定位到

        ,删除当前标签 + insertEmptyP($selectionElem); + } + + $textElem.on('keyup', function (e) { + if (e.keyCode !== 13) { + // 不是回车键 + return; + } + // 将回车之后生成的非

        的顶级标签,改为

        + pHandle(e); + }); + + //

        回车时 特殊处理 + function codeHandle(e) { + var $selectionElem = editor.selection.getSelectionContainerElem(); + if (!$selectionElem) { + return; + } + var $parentElem = $selectionElem.parent(); + var selectionNodeName = $selectionElem.getNodeName(); + var parentNodeName = $parentElem.getNodeName(); + + if (selectionNodeName !== 'CODE' || parentNodeName !== 'PRE') { + // 不符合要求 忽略 + return; + } + + if (!editor.cmd.queryCommandSupported('insertHTML')) { + // 必须原生支持 insertHTML 命令 + return; + } + + // 处理:光标定位到代码末尾,联系点击两次回车,即跳出代码块 + if (editor._willBreakCode === true) { + // 此时可以跳出代码块 + // 插入

        ,并将选取定位到

        + var $p = $('


        '); + $p.insertAfter($parentElem); + editor.selection.createRangeByElem($p, true); + editor.selection.restoreSelection(); + + // 修改状态 + editor._willBreakCode = false; + + e.preventDefault(); + return; + } + + var _startOffset = editor.selection.getRange().startOffset; + + // 处理:回车时,不能插入
        而是插入 \n ,因为是在 pre 标签里面 + editor.cmd.do('insertHTML', '\n'); + editor.selection.saveRange(); + if (editor.selection.getRange().startOffset === _startOffset) { + // 没起作用,再来一遍 + editor.cmd.do('insertHTML', '\n'); + } + + var codeLength = $selectionElem.html().length; + if (editor.selection.getRange().startOffset + 1 === codeLength) { + // 说明光标在代码最后的位置,执行了回车操作 + // 记录下来,以便下次回车时候跳出 code + editor._willBreakCode = true; + } + + // 阻止默认行为 + e.preventDefault(); + } + + $textElem.on('keydown', function (e) { + if (e.keyCode !== 13) { + // 不是回车键 + // 取消即将跳转代码块的记录 + editor._willBreakCode = false; + return; + } + //
        回车时 特殊处理 + codeHandle(e); + }); + }, + + // 清空时保留


        + _clearHandle: function _clearHandle() { + var editor = this.editor; + var $textElem = editor.$textElem; + + $textElem.on('keydown', function (e) { + if (e.keyCode !== 8) { + return; + } + var txtHtml = $textElem.html().toLowerCase().trim(); + if (txtHtml === '


        ') { + // 最后剩下一个空行,就不再删除了 + e.preventDefault(); + return; + } + }); + + $textElem.on('keyup', function (e) { + if (e.keyCode !== 8) { + return; + } + var $p = void 0; + var txtHtml = $textElem.html().toLowerCase().trim(); + + // firefox 时用 txtHtml === '
        ' 判断,其他用 !txtHtml 判断 + if (!txtHtml || txtHtml === '
        ') { + // 内容空了 + $p = $('


        '); + $textElem.html(''); // 一定要先清空,否则在 firefox 下有问题 + $textElem.append($p); + editor.selection.createRangeByElem($p, false, true); + editor.selection.restoreSelection(); + } + }); + }, + + // 粘贴事件(粘贴文字 粘贴图片) + _pasteHandle: function _pasteHandle() { + var editor = this.editor; + var config = editor.config; + var pasteFilterStyle = config.pasteFilterStyle; + var pasteTextHandle = config.pasteTextHandle; + var ignoreImg = config.pasteIgnoreImg; + var $textElem = editor.$textElem; + + // 粘贴图片、文本的事件,每次只能执行一个 + // 判断该次粘贴事件是否可以执行 + var pasteTime = 0; + + function canDo() { + var now = Date.now(); + var flag = false; + if (now - pasteTime >= 500) { + // 间隔大于 500 ms ,可以执行 + flag = true; + } + pasteTime = now; + return flag; + } + + function resetTime() { + pasteTime = 0; + } + + // 粘贴文字 + $textElem.on('paste', function (e) { + if (UA.isIE()) { + return; + } else { + // 阻止默认行为,使用 execCommand 的粘贴命令 + e.preventDefault(); + } + + // 粘贴图片和文本,只能同时使用一个 + if (!canDo()) { + return; + } + + // 获取粘贴的文字 + var pasteHtml = getPasteHtml(e, pasteFilterStyle, ignoreImg); + var pasteText = getPasteText(e); + pasteText = pasteText.replace(/\n/gm, '
        '); + + var $selectionElem = editor.selection.getSelectionContainerElem(); + if (!$selectionElem) { + return; + } + var nodeName = $selectionElem.getNodeName(); + + // code 中只能粘贴纯文本 + if (nodeName === 'CODE' || nodeName === 'PRE') { + if (pasteTextHandle && isFunction(pasteTextHandle)) { + // 用户自定义过滤处理粘贴内容 + pasteText = '' + (pasteTextHandle(pasteText) || ''); + } + editor.cmd.do('insertHTML', '

        ' + pasteText + '

        '); + return; + } + + // 先放开注释,有问题再追查 ———— + // // 表格中忽略,可能会出现异常问题 + // if (nodeName === 'TD' || nodeName === 'TH') { + // return + // } + + if (!pasteHtml) { + // 没有内容,可继续执行下面的图片粘贴 + resetTime(); + return; + } + try { + // firefox 中,获取的 pasteHtml 可能是没有
          包裹的
        • + // 因此执行 insertHTML 会报错 + if (pasteTextHandle && isFunction(pasteTextHandle)) { + // 用户自定义过滤处理粘贴内容 + pasteHtml = '' + (pasteTextHandle(pasteHtml) || ''); + } + editor.cmd.do('insertHTML', pasteHtml); + } catch (ex) { + // 此时使用 pasteText 来兼容一下 + if (pasteTextHandle && isFunction(pasteTextHandle)) { + // 用户自定义过滤处理粘贴内容 + pasteText = '' + (pasteTextHandle(pasteText) || ''); + } + editor.cmd.do('insertHTML', '

          ' + pasteText + '

          '); + } + }); + + // 粘贴图片 + $textElem.on('paste', function (e) { + if (UA.isIE()) { + return; + } else { + e.preventDefault(); + } + + // 粘贴图片和文本,只能同时使用一个 + if (!canDo()) { + return; + } + + // 获取粘贴的图片 + var pasteFiles = getPasteImgs(e); + if (!pasteFiles || !pasteFiles.length) { + return; + } + + // 获取当前的元素 + var $selectionElem = editor.selection.getSelectionContainerElem(); + if (!$selectionElem) { + return; + } + var nodeName = $selectionElem.getNodeName(); + + // code 中粘贴忽略 + if (nodeName === 'CODE' || nodeName === 'PRE') { + return; + } + + // 上传图片 + var uploadImg = editor.uploadImg; + uploadImg.uploadImg(pasteFiles); + }); + }, + + // tab 特殊处理 + _tabHandle: function _tabHandle() { + var editor = this.editor; + var $textElem = editor.$textElem; + + $textElem.on('keydown', function (e) { + if (e.keyCode !== 9) { + return; + } + if (!editor.cmd.queryCommandSupported('insertHTML')) { + // 必须原生支持 insertHTML 命令 + return; + } + var $selectionElem = editor.selection.getSelectionContainerElem(); + if (!$selectionElem) { + return; + } + var $parentElem = $selectionElem.parent(); + var selectionNodeName = $selectionElem.getNodeName(); + var parentNodeName = $parentElem.getNodeName(); + + if (selectionNodeName === 'CODE' && parentNodeName === 'PRE') { + //
           里面
          +                    editor.cmd.do('insertHTML', '    ');
          +                } else {
          +                    // 普通文字
          +                    editor.cmd.do('insertHTML', '    ');
          +                }
          +
          +                e.preventDefault();
          +            });
          +        },
          +
          +        // img 点击
          +        _imgHandle: function _imgHandle() {
          +            var editor = this.editor;
          +            var $textElem = editor.$textElem;
          +
          +            // 为图片增加 selected 样式
          +            $textElem.on('click', 'img', function (e) {
          +                var img = this;
          +                var $img = $(img);
          +
          +                if ($img.attr('data-w-e') === '1') {
          +                    // 是表情图片,忽略
          +                    return;
          +                }
          +
          +                // 记录当前点击过的图片
          +                editor._selectedImg = $img;
          +
          +                // 修改选区并 restore ,防止用户此时点击退格键,会删除其他内容
          +                editor.selection.createRangeByElem($img);
          +                editor.selection.restoreSelection();
          +            });
          +
          +            // 去掉图片的 selected 样式
          +            $textElem.on('click  keyup', function (e) {
          +                if (e.target.matches('img')) {
          +                    // 点击的是图片,忽略
          +                    return;
          +                }
          +                // 删除记录
          +                editor._selectedImg = null;
          +            });
          +        },
          +
          +        // 拖拽事件
          +        _dragHandle: function _dragHandle() {
          +            var editor = this.editor;
          +
          +            // 禁用 document 拖拽事件
          +            var $document = $(document);
          +            $document.on('dragleave drop dragenter dragover', function (e) {
          +                e.preventDefault();
          +            });
          +
          +            // 添加编辑区域拖拽事件
          +            var $textElem = editor.$textElem;
          +            $textElem.on('drop', function (e) {
          +                e.preventDefault();
          +                var files = e.dataTransfer && e.dataTransfer.files;
          +                if (!files || !files.length) {
          +                    return;
          +                }
          +
          +                // 上传图片
          +                var uploadImg = editor.uploadImg;
          +                uploadImg.uploadImg(files);
          +            });
          +        }
          +    };
          +
          +    /*
          +    命令,封装 document.execCommand
          +*/
          +
          +// 构造函数
          +    function Command(editor) {
          +        this.editor = editor;
          +    }
          +
          +// 修改原型
          +    Command.prototype = {
          +        constructor: Command,
          +
          +        // 执行命令
          +        do: function _do(name, value) {
          +            var editor = this.editor;
          +
          +            // 使用 styleWithCSS
          +            if (!editor._useStyleWithCSS) {
          +                document.execCommand('styleWithCSS', null, true);
          +                editor._useStyleWithCSS = true;
          +            }
          +
          +            // 如果无选区,忽略
          +            if (!editor.selection.getRange()) {
          +                return;
          +            }
          +
          +            // 恢复选取
          +            editor.selection.restoreSelection();
          +
          +            // 执行
          +            var _name = '_' + name;
          +            if (this[_name]) {
          +                // 有自定义事件
          +                this[_name](value);
          +            } else {
          +                // 默认 command
          +                this._execCommand(name, value);
          +            }
          +
          +            // 修改菜单状态
          +            editor.menus.changeActive();
          +
          +            // 最后,恢复选取保证光标在原来的位置闪烁
          +            editor.selection.saveRange();
          +            editor.selection.restoreSelection();
          +
          +            // 触发 onchange
          +            editor.change && editor.change();
          +        },
          +
          +        // 自定义 insertHTML 事件
          +        _insertHTML: function _insertHTML(html) {
          +            var editor = this.editor;
          +            var range = editor.selection.getRange();
          +
          +            if (this.queryCommandSupported('insertHTML')) {
          +                // W3C
          +                this._execCommand('insertHTML', html);
          +            } else if (range.insertNode) {
          +                // IE
          +                range.deleteContents();
          +                range.insertNode($(html)[0]);
          +            } else if (range.pasteHTML) {
          +                // IE <= 10
          +                range.pasteHTML(html);
          +            }
          +        },
          +
          +        // 插入 elem
          +        _insertElem: function _insertElem($elem) {
          +            var editor = this.editor;
          +            var range = editor.selection.getRange();
          +
          +            if (range.insertNode) {
          +                range.deleteContents();
          +                range.insertNode($elem[0]);
          +            }
          +        },
          +
          +        // 封装 execCommand
          +        _execCommand: function _execCommand(name, value) {
          +            document.execCommand(name, false, value);
          +        },
          +
          +        // 封装 document.queryCommandValue
          +        queryCommandValue: function queryCommandValue(name) {
          +            return document.queryCommandValue(name);
          +        },
          +
          +        // 封装 document.queryCommandState
          +        queryCommandState: function queryCommandState(name) {
          +            return document.queryCommandState(name);
          +        },
          +
          +        // 封装 document.queryCommandSupported
          +        queryCommandSupported: function queryCommandSupported(name) {
          +            return document.queryCommandSupported(name);
          +        }
          +    };
          +
          +    /*
          +    selection range API
          +*/
          +
          +// 构造函数
          +    function API(editor) {
          +        this.editor = editor;
          +        this._currentRange = null;
          +    }
          +
          +// 修改原型
          +    API.prototype = {
          +        constructor: API,
          +
          +        // 获取 range 对象
          +        getRange: function getRange() {
          +            return this._currentRange;
          +        },
          +
          +        // 保存选区
          +        saveRange: function saveRange(_range) {
          +            if (_range) {
          +                // 保存已有选区
          +                this._currentRange = _range;
          +                return;
          +            }
          +
          +            // 获取当前的选区
          +            var selection = window.getSelection();
          +            if (selection.rangeCount === 0) {
          +                return;
          +            }
          +            var range = selection.getRangeAt(0);
          +
          +            // 判断选区内容是否在编辑内容之内
          +            var $containerElem = this.getSelectionContainerElem(range);
          +            if (!$containerElem) {
          +                return;
          +            }
          +
          +            // 判断选区内容是否在不可编辑区域之内
          +            if ($containerElem.attr('contenteditable') === 'false' || $containerElem.parentUntil('[contenteditable=false]')) {
          +                return;
          +            }
          +
          +            var editor = this.editor;
          +            var $textElem = editor.$textElem;
          +            if ($textElem.isContain($containerElem)) {
          +                // 是编辑内容之内的
          +                this._currentRange = range;
          +            }
          +        },
          +
          +        // 折叠选区
          +        collapseRange: function collapseRange(toStart) {
          +            if (toStart == null) {
          +                // 默认为 false
          +                toStart = false;
          +            }
          +            var range = this._currentRange;
          +            if (range) {
          +                range.collapse(toStart);
          +            }
          +        },
          +
          +        // 选中区域的文字
          +        getSelectionText: function getSelectionText() {
          +            var range = this._currentRange;
          +            if (range) {
          +                return this._currentRange.toString();
          +            } else {
          +                return '';
          +            }
          +        },
          +
          +        // 选区的 $Elem
          +        getSelectionContainerElem: function getSelectionContainerElem(range) {
          +            range = range || this._currentRange;
          +            var elem = void 0;
          +            if (range) {
          +                elem = range.commonAncestorContainer;
          +                return $(elem.nodeType === 1 ? elem : elem.parentNode);
          +            }
          +        },
          +        getSelectionStartElem: function getSelectionStartElem(range) {
          +            range = range || this._currentRange;
          +            var elem = void 0;
          +            if (range) {
          +                elem = range.startContainer;
          +                return $(elem.nodeType === 1 ? elem : elem.parentNode);
          +            }
          +        },
          +        getSelectionEndElem: function getSelectionEndElem(range) {
          +            range = range || this._currentRange;
          +            var elem = void 0;
          +            if (range) {
          +                elem = range.endContainer;
          +                return $(elem.nodeType === 1 ? elem : elem.parentNode);
          +            }
          +        },
          +
          +        // 选区是否为空
          +        isSelectionEmpty: function isSelectionEmpty() {
          +            var range = this._currentRange;
          +            if (range && range.startContainer) {
          +                if (range.startContainer === range.endContainer) {
          +                    if (range.startOffset === range.endOffset) {
          +                        return true;
          +                    }
          +                }
          +            }
          +            return false;
          +        },
          +
          +        // 恢复选区
          +        restoreSelection: function restoreSelection() {
          +            var selection = window.getSelection();
          +            selection.removeAllRanges();
          +            selection.addRange(this._currentRange);
          +        },
          +
          +        // 创建一个空白(即 ​ 字符)选区
          +        createEmptyRange: function createEmptyRange() {
          +            var editor = this.editor;
          +            var range = this.getRange();
          +            var $elem = void 0;
          +
          +            if (!range) {
          +                // 当前无 range
          +                return;
          +            }
          +            if (!this.isSelectionEmpty()) {
          +                // 当前选区必须没有内容才可以
          +                return;
          +            }
          +
          +            try {
          +                // 目前只支持 webkit 内核
          +                if (UA.isWebkit()) {
          +                    // 插入 ​
          +                    editor.cmd.do('insertHTML', '​');
          +                    // 修改 offset 位置
          +                    range.setEnd(range.endContainer, range.endOffset + 1);
          +                    // 存储
          +                    this.saveRange(range);
          +                } else {
          +                    $elem = $('');
          +                    editor.cmd.do('insertElem', $elem);
          +                    this.createRangeByElem($elem, true);
          +                }
          +            } catch (ex) {
          +                // 部分情况下会报错,兼容一下
          +            }
          +        },
          +
          +        // 根据 $Elem 设置选区
          +        createRangeByElem: function createRangeByElem($elem, toStart, isContent) {
          +            // $elem - 经过封装的 elem
          +            // toStart - true 开始位置,false 结束位置
          +            // isContent - 是否选中Elem的内容
          +            if (!$elem.length) {
          +                return;
          +            }
          +
          +            var elem = $elem[0];
          +            var range = document.createRange();
          +
          +            if (isContent) {
          +                range.selectNodeContents(elem);
          +            } else {
          +                range.selectNode(elem);
          +            }
          +
          +            if (typeof toStart === 'boolean') {
          +                range.collapse(toStart);
          +            }
          +
          +            // 存储 range
          +            this.saveRange(range);
          +        }
          +    };
          +
          +    /*
          +    上传进度条
          +*/
          +
          +    function Progress(editor) {
          +        this.editor = editor;
          +        this._time = 0;
          +        this._isShow = false;
          +        this._isRender = false;
          +        this._timeoutId = 0;
          +        this.$textContainer = editor.$textContainerElem;
          +        this.$bar = $('
          '); + } + + Progress.prototype = { + constructor: Progress, + + show: function show(progress) { + var _this = this; + + // 状态处理 + if (this._isShow) { + return; + } + this._isShow = true; + + // 渲染 + var $bar = this.$bar; + if (!this._isRender) { + var $textContainer = this.$textContainer; + $textContainer.append($bar); + } else { + this._isRender = true; + } + + // 改变进度(节流,100ms 渲染一次) + if (Date.now() - this._time > 100) { + if (progress <= 1) { + $bar.css('width', progress * 100 + '%'); + this._time = Date.now(); + } + } + + // 隐藏 + var timeoutId = this._timeoutId; + if (timeoutId) { + clearTimeout(timeoutId); + } + timeoutId = setTimeout(function () { + _this._hide(); + }, 500); + }, + + _hide: function _hide() { + var $bar = this.$bar; + $bar.remove(); + + // 修改状态 + this._time = 0; + this._isShow = false; + this._isRender = false; + } + }; + + var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { + return typeof obj; + } : function (obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }; + + /* + 上传图片 +*/ + +// 构造函数 + function UploadImg(editor) { + this.editor = editor; + } + +// 原型 + UploadImg.prototype = { + constructor: UploadImg, + + // 根据 debug 弹出不同的信息 + _alert: function _alert(alertInfo, debugInfo) { + var editor = this.editor; + var debug = editor.config.debug; + var customAlert = editor.config.customAlert; + + if (debug) { + throw new Error('wangEditor: ' + (debugInfo || alertInfo)); + } else { + if (customAlert && typeof customAlert === 'function') { + customAlert(alertInfo); + } else { + alert(alertInfo); + } + } + }, + + // 根据链接插入图片 + insertLinkImg: function insertLinkImg(link) { + var _this2 = this; + + if (!link) { + return; + } + var editor = this.editor; + var config = editor.config; + + // 校验格式 + var linkImgCheck = config.linkImgCheck; + var checkResult = void 0; + if (linkImgCheck && typeof linkImgCheck === 'function') { + checkResult = linkImgCheck(link); + if (typeof checkResult === 'string') { + // 校验失败,提示信息 + alert(checkResult); + return; + } + } + + editor.cmd.do('insertHTML', ''); + + // 验证图片 url 是否有效,无效的话给出提示 + var img = document.createElement('img'); + img.onload = function () { + var callback = config.linkImgCallback; + if (callback && typeof callback === 'function') { + callback(link); + } + + img = null; + }; + img.onerror = function () { + img = null; + // 无法成功下载图片 + _this2._alert('插入图片错误', 'wangEditor: \u63D2\u5165\u56FE\u7247\u51FA\u9519\uFF0C\u56FE\u7247\u94FE\u63A5\u662F "' + link + '"\uFF0C\u4E0B\u8F7D\u8BE5\u94FE\u63A5\u5931\u8D25'); + return; + }; + img.onabort = function () { + img = null; + }; + img.src = link; + }, + + // 上传图片 + uploadImg: function uploadImg(files) { + var _this3 = this; + + if (!files || !files.length) { + return; + } + + // ------------------------------ 获取配置信息 ------------------------------ + var editor = this.editor; + var config = editor.config; + var uploadImgServer = config.uploadImgServer; + var uploadImgShowBase64 = config.uploadImgShowBase64; + + var maxSize = config.uploadImgMaxSize; + var maxSizeM = maxSize / 1024 / 1024; + var maxLength = config.uploadImgMaxLength || 10000; + var uploadFileName = config.uploadFileName || ''; + var uploadImgParams = config.uploadImgParams || {}; + var uploadImgParamsWithUrl = config.uploadImgParamsWithUrl; + var uploadImgHeaders = config.uploadImgHeaders || {}; + var hooks = config.uploadImgHooks || {}; + var timeout = config.uploadImgTimeout || 3000; + var withCredentials = config.withCredentials; + if (withCredentials == null) { + withCredentials = false; + } + var customUploadImg = config.customUploadImg; + + if (!customUploadImg) { + // 没有 customUploadImg 的情况下,需要如下两个配置才能继续进行图片上传 + if (!uploadImgServer && !uploadImgShowBase64) { + return; + } + } + + // ------------------------------ 验证文件信息 ------------------------------ + var resultFiles = []; + var errInfo = []; + arrForEach(files, function (file) { + var name = file.name; + var size = file.size; + + // chrome 低版本 name === undefined + if (!name || !size) { + return; + } + + if (/\.(jpg|jpeg|png|bmp|gif)$/i.test(name) === false) { + // 后缀名不合法,不是图片 + errInfo.push('\u3010' + name + '\u3011\u4E0D\u662F\u56FE\u7247'); + return; + } + if (maxSize < size) { + // 上传图片过大 + errInfo.push('\u3010' + name + '\u3011\u5927\u4E8E ' + maxSizeM + 'M'); + return; + } + + // 验证通过的加入结果列表 + resultFiles.push(file); + }); + // 抛出验证信息 + if (errInfo.length) { + this._alert('图片验证未通过: \n' + errInfo.join('\n')); + return; + } + if (resultFiles.length > maxLength) { + this._alert('一次最多上传' + maxLength + '张图片'); + return; + } + + // ------------------------------ 自定义上传 ------------------------------ + if (customUploadImg && typeof customUploadImg === 'function') { + customUploadImg(resultFiles, this.insertLinkImg.bind(this)); + + // 阻止以下代码执行 + return; + } + + // 添加图片数据 + var formdata = new FormData(); + arrForEach(resultFiles, function (file) { + var name = uploadFileName || file.name; + formdata.append(name, file); + }); + + // ------------------------------ 上传图片 ------------------------------ + if (uploadImgServer && typeof uploadImgServer === 'string') { + // 添加参数 + var uploadImgServerArr = uploadImgServer.split('#'); + uploadImgServer = uploadImgServerArr[0]; + var uploadImgServerHash = uploadImgServerArr[1] || ''; + objForEach(uploadImgParams, function (key, val) { + val = encodeURIComponent(val); + + // 第一,将参数拼接到 url 中 + if (uploadImgParamsWithUrl) { + if (uploadImgServer.indexOf('?') > 0) { + uploadImgServer += '&'; + } else { + uploadImgServer += '?'; + } + uploadImgServer = uploadImgServer + key + '=' + val; + } + + // 第二,将参数添加到 formdata 中 + formdata.append(key, val); + }); + if (uploadImgServerHash) { + uploadImgServer += '#' + uploadImgServerHash; + } + + // 定义 xhr + var xhr = new XMLHttpRequest(); + xhr.open('POST', uploadImgServer); + + // 设置超时 + xhr.timeout = timeout; + xhr.ontimeout = function () { + // hook - timeout + if (hooks.timeout && typeof hooks.timeout === 'function') { + hooks.timeout(xhr, editor); + } + + _this3._alert('上传图片超时'); + }; + + // 监控 progress + if (xhr.upload) { + xhr.upload.onprogress = function (e) { + var percent = void 0; + // 进度条 + var progressBar = new Progress(editor); + if (e.lengthComputable) { + percent = e.loaded / e.total; + progressBar.show(percent); + } + }; + } + + // 返回数据 + xhr.onreadystatechange = function () { + var result = void 0; + if (xhr.readyState === 4) { + if (xhr.status < 200 || xhr.status >= 300) { + // hook - error + if (hooks.error && typeof hooks.error === 'function') { + hooks.error(xhr, editor); + } + + // xhr 返回状态错误 + _this3._alert('上传图片发生错误', '\u4E0A\u4F20\u56FE\u7247\u53D1\u751F\u9519\u8BEF\uFF0C\u670D\u52A1\u5668\u8FD4\u56DE\u72B6\u6001\u662F ' + xhr.status); + return; + } + + result = xhr.responseText; + if ((typeof result === 'undefined' ? 'undefined' : _typeof(result)) !== 'object') { + try { + result = JSON.parse(result); + } catch (ex) { + // hook - fail + if (hooks.fail && typeof hooks.fail === 'function') { + hooks.fail(xhr, editor, result); + } + + _this3._alert('上传图片失败', '上传图片返回结果错误,返回结果是: ' + result); + return; + } + } + if (!hooks.customInsert && result.errno != '0') { + // hook - fail + if (hooks.fail && typeof hooks.fail === 'function') { + hooks.fail(xhr, editor, result); + } + + // 数据错误 + _this3._alert('上传图片失败', '上传图片返回结果错误,返回结果 errno=' + result.errno); + } else { + if (hooks.customInsert && typeof hooks.customInsert === 'function') { + // 使用者自定义插入方法 + hooks.customInsert(_this3.insertLinkImg.bind(_this3), result, editor); + } else { + // 将图片插入编辑器 + var data = result.data || []; + data.forEach(function (link) { + _this3.insertLinkImg(link); + }); + } + + // hook - success + if (hooks.success && typeof hooks.success === 'function') { + hooks.success(xhr, editor, result); + } + } + } + }; + + // hook - before + if (hooks.before && typeof hooks.before === 'function') { + var beforeResult = hooks.before(xhr, editor, resultFiles); + if (beforeResult && (typeof beforeResult === 'undefined' ? 'undefined' : _typeof(beforeResult)) === 'object') { + if (beforeResult.prevent) { + // 如果返回的结果是 {prevent: true, msg: 'xxxx'} 则表示用户放弃上传 + this._alert(beforeResult.msg); + return; + } + } + } + + // 自定义 headers + objForEach(uploadImgHeaders, function (key, val) { + xhr.setRequestHeader(key, val); + }); + + // 跨域传 cookie + xhr.withCredentials = withCredentials; + + // 发送请求 + xhr.send(formdata); + + // 注意,要 return 。不去操作接下来的 base64 显示方式 + return; + } + + // ------------------------------ 显示 base64 格式 ------------------------------ + if (uploadImgShowBase64) { + arrForEach(files, function (file) { + var _this = _this3; + var reader = new FileReader(); + reader.readAsDataURL(file); + reader.onload = function () { + _this.insertLinkImg(this.result); + }; + }); + } + } + }; + + /* + 编辑器构造函数 +*/ + +// id,累加 + var editorId = 1; + +// 构造函数 + function Editor(toolbarSelector, textSelector) { + if (toolbarSelector == null) { + // 没有传入任何参数,报错 + throw new Error('错误:初始化编辑器时候未传入任何参数,请查阅文档'); + } + // id,用以区分单个页面不同的编辑器对象 + this.id = 'wangEditor-' + editorId++; + + this.toolbarSelector = toolbarSelector; + this.textSelector = textSelector; + + // 自定义配置 + this.customConfig = {}; + } + +// 修改原型 + Editor.prototype = { + constructor: Editor, + + // 初始化配置 + _initConfig: function _initConfig() { + // _config 是默认配置,this.customConfig 是用户自定义配置,将它们 merge 之后再赋值 + var target = {}; + this.config = Object.assign(target, config, this.customConfig); + + // 将语言配置,生成正则表达式 + var langConfig = this.config.lang || {}; + var langArgs = []; + objForEach(langConfig, function (key, val) { + // key 即需要生成正则表达式的规则,如“插入链接” + // val 即需要被替换成的语言,如“insert link” + langArgs.push({ + reg: new RegExp(key, 'img'), + val: val + + }); + }); + this.config.langArgs = langArgs; + }, + + // 初始化 DOM + _initDom: function _initDom() { + var _this = this; + + var toolbarSelector = this.toolbarSelector; + var $toolbarSelector = $(toolbarSelector); + var textSelector = this.textSelector; + + var config$$1 = this.config; + var zIndex = config$$1.zIndex; + + // 定义变量 + var $toolbarElem = void 0, + $textContainerElem = void 0, + $textElem = void 0, + $children = void 0; + + if (textSelector == null) { + // 只传入一个参数,即是容器的选择器或元素,toolbar 和 text 的元素自行创建 + $toolbarElem = $('
          '); + $textContainerElem = $('
          '); + + // 将编辑器区域原有的内容,暂存起来 + $children = $toolbarSelector.children(); + + // 添加到 DOM 结构中 + $toolbarSelector.append($toolbarElem).append($textContainerElem); + + // 自行创建的,需要配置默认的样式 + $toolbarElem.css('background-color', '#f1f1f1').css('border', '1px solid #ccc'); + $textContainerElem.css('border', '1px solid #ccc').css('border-top', 'none').css('height', '300px'); + } else { + // toolbar 和 text 的选择器都有值,记录属性 + $toolbarElem = $toolbarSelector; + $textContainerElem = $(textSelector); + // 将编辑器区域原有的内容,暂存起来 + $children = $textContainerElem.children(); + } + + // 编辑区域 + $textElem = $('
          '); + $textElem.attr('contenteditable', 'true').css('width', '100%').css('height', '100%'); + + // 初始化编辑区域内容 + if ($children && $children.length) { + $textElem.append($children); + } else { + $textElem.append($('


          ')); + } + + // 编辑区域加入DOM + $textContainerElem.append($textElem); + + // 设置通用的 class + $toolbarElem.addClass('w-e-toolbar'); + $textContainerElem.addClass('w-e-text-container'); + $textContainerElem.css('z-index', zIndex); + $textElem.addClass('w-e-text'); + + // 添加 ID + var toolbarElemId = getRandom('toolbar-elem'); + $toolbarElem.attr('id', toolbarElemId); + var textElemId = getRandom('text-elem'); + $textElem.attr('id', textElemId); + + // 记录属性 + this.$toolbarElem = $toolbarElem; + this.$textContainerElem = $textContainerElem; + this.$textElem = $textElem; + this.toolbarElemId = toolbarElemId; + this.textElemId = textElemId; + + // 记录输入法的开始和结束 + var compositionEnd = true; + $textContainerElem.on('compositionstart', function () { + // 输入法开始输入 + compositionEnd = false; + }); + $textContainerElem.on('compositionend', function () { + // 输入法结束输入 + compositionEnd = true; + }); + + // 绑定 onchange + $textContainerElem.on('click keyup', function () { + // 输入法结束才出发 onchange + compositionEnd && _this.change && _this.change(); + }); + $toolbarElem.on('click', function () { + this.change && this.change(); + }); + + //绑定 onfocus 与 onblur 事件 + if (config$$1.onfocus || config$$1.onblur) { + // 当前编辑器是否是焦点状态 + this.isFocus = false; + + $(document).on('click', function (e) { + //判断当前点击元素是否在编辑器内 + var isChild = $textElem.isContain($(e.target)); + + //判断当前点击元素是否为工具栏 + var isToolbar = $toolbarElem.isContain($(e.target)); + var isMenu = $toolbarElem[0] == e.target ? true : false; + + if (!isChild) { + //若为选择工具栏中的功能,则不视为成blur操作 + if (isToolbar && !isMenu) { + return; + } + + if (_this.isFocus) { + _this.onblur && _this.onblur(); + } + _this.isFocus = false; + } else { + if (!_this.isFocus) { + _this.onfocus && _this.onfocus(); + } + _this.isFocus = true; + } + }); + } + }, + + // 封装 command + _initCommand: function _initCommand() { + this.cmd = new Command(this); + }, + + // 封装 selection range API + _initSelectionAPI: function _initSelectionAPI() { + this.selection = new API(this); + }, + + // 添加图片上传 + _initUploadImg: function _initUploadImg() { + this.uploadImg = new UploadImg(this); + }, + + // 初始化菜单 + _initMenus: function _initMenus() { + this.menus = new Menus(this); + this.menus.init(); + }, + + // 添加 text 区域 + _initText: function _initText() { + this.txt = new Text(this); + this.txt.init(); + }, + + // 初始化选区,将光标定位到内容尾部 + initSelection: function initSelection(newLine) { + var $textElem = this.$textElem; + var $children = $textElem.children(); + if (!$children.length) { + // 如果编辑器区域无内容,添加一个空行,重新设置选区 + $textElem.append($('


          ')); + this.initSelection(); + return; + } + + var $last = $children.last(); + + if (newLine) { + // 新增一个空行 + var html = $last.html().toLowerCase(); + var nodeName = $last.getNodeName(); + if (html !== '
          ' && html !== '' || nodeName !== 'P') { + // 最后一个元素不是


          ,添加一个空行,重新设置选区 + $textElem.append($('


          ')); + this.initSelection(); + return; + } + } + + this.selection.createRangeByElem($last, false, true); + this.selection.restoreSelection(); + }, + + // 绑定事件 + _bindEvent: function _bindEvent() { + // -------- 绑定 onchange 事件 -------- + var onChangeTimeoutId = 0; + var beforeChangeHtml = this.txt.html(); + var config$$1 = this.config; + + // onchange 触发延迟时间 + var onchangeTimeout = config$$1.onchangeTimeout; + onchangeTimeout = parseInt(onchangeTimeout, 10); + if (!onchangeTimeout || onchangeTimeout <= 0) { + onchangeTimeout = 200; + } + + var onchange = config$$1.onchange; + if (onchange && typeof onchange === 'function') { + // 触发 change 的有三个场景: + // 1. $textContainerElem.on('click keyup') + // 2. $toolbarElem.on('click') + // 3. editor.cmd.do() + this.change = function () { + // 判断是否有变化 + var currentHtml = this.txt.html(); + + if (currentHtml.length === beforeChangeHtml.length) { + // 需要比较每一个字符 + if (currentHtml === beforeChangeHtml) { + return; + } + } + + // 执行,使用节流 + if (onChangeTimeoutId) { + clearTimeout(onChangeTimeoutId); + } + onChangeTimeoutId = setTimeout(function () { + // 触发配置的 onchange 函数 + onchange(currentHtml); + beforeChangeHtml = currentHtml; + }, onchangeTimeout); + }; + } + + // -------- 绑定 onblur 事件 -------- + var onblur = config$$1.onblur; + if (onblur && typeof onblur === 'function') { + this.onblur = function () { + var currentHtml = this.txt.html(); + onblur(currentHtml); + }; + } + + // -------- 绑定 onfocus 事件 -------- + var onfocus = config$$1.onfocus; + if (onfocus && typeof onfocus === 'function') { + this.onfocus = function () { + onfocus(); + }; + } + }, + + // 创建编辑器 + create: function create() { + // 初始化配置信息 + this._initConfig(); + + // 初始化 DOM + this._initDom(); + + // 封装 command API + this._initCommand(); + + // 封装 selection range API + this._initSelectionAPI(); + + // 添加 text + this._initText(); + + // 初始化菜单 + this._initMenus(); + + // 添加 图片上传 + this._initUploadImg(); + + // 初始化选区,将光标定位到内容尾部 + this.initSelection(true); + + // 绑定事件 + this._bindEvent(); + }, + + // 解绑所有事件(暂时不对外开放) + _offAllEvent: function _offAllEvent() { + $.offAll(); + } + }; + +// 检验是否浏览器环境 + try { + document; + } catch (ex) { + throw new Error('请在浏览器环境下运行'); + } + +// polyfill + polyfill(); + +// 这里的 `inlinecss` 将被替换成 css 代码的内容,详情可去 ./gulpfile.js 中搜索 `inlinecss` 关键字 + var inlinecss = '.w-e-toolbar,.w-e-text-container,.w-e-menu-panel { padding: 0; margin: 0; box-sizing: border-box;}.w-e-toolbar *,.w-e-text-container *,.w-e-menu-panel * { padding: 0; margin: 0; box-sizing: border-box;}.w-e-clear-fix:after { content: ""; display: table; clear: both;}.w-e-toolbar .w-e-droplist { position: absolute; left: 0; top: 0; background-color: #fff; border: 1px solid #f1f1f1; border-right-color: #ccc; border-bottom-color: #ccc;}.w-e-toolbar .w-e-droplist .w-e-dp-title { text-align: center; color: #999; line-height: 2; border-bottom: 1px solid #f1f1f1; font-size: 13px;}.w-e-toolbar .w-e-droplist ul.w-e-list { list-style: none; line-height: 1;}.w-e-toolbar .w-e-droplist ul.w-e-list li.w-e-item { color: #333; padding: 5px 0;}.w-e-toolbar .w-e-droplist ul.w-e-list li.w-e-item:hover { background-color: #f1f1f1;}.w-e-toolbar .w-e-droplist ul.w-e-block { list-style: none; text-align: left; padding: 5px;}.w-e-toolbar .w-e-droplist ul.w-e-block li.w-e-item { display: inline-block; *display: inline; *zoom: 1; padding: 3px 5px;}.w-e-toolbar .w-e-droplist ul.w-e-block li.w-e-item:hover { background-color: #f1f1f1;}@font-face { font-family: \'w-e-icon\'; src: url(data:application/x-font-woff;charset=utf-8;base64,d09GRgABAAAAABhQAAsAAAAAGAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABPUy8yAAABCAAAAGAAAABgDxIPBGNtYXAAAAFoAAABBAAAAQQrSf4BZ2FzcAAAAmwAAAAIAAAACAAAABBnbHlmAAACdAAAEvAAABLwfpUWUWhlYWQAABVkAAAANgAAADYQp00kaGhlYQAAFZwAAAAkAAAAJAfEA+FobXR4AAAVwAAAAIQAAACEeAcD7GxvY2EAABZEAAAARAAAAERBSEX+bWF4cAAAFogAAAAgAAAAIAAsALZuYW1lAAAWqAAAAYYAAAGGmUoJ+3Bvc3QAABgwAAAAIAAAACAAAwAAAAMD3gGQAAUAAAKZAswAAACPApkCzAAAAesAMwEJAAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAQAAA8fwDwP/AAEADwABAAAAAAQAAAAAAAAAAAAAAIAAAAAAAAwAAAAMAAAAcAAEAAwAAABwAAwABAAAAHAAEAOgAAAA2ACAABAAWAAEAIOkG6Q3pEulH6Wbpd+m56bvpxunL6d/qDepc6l/qZepo6nHqefAN8BTxIPHc8fz//f//AAAAAAAg6QbpDekS6UfpZel36bnpu+nG6cvp3+oN6lzqX+pi6mjqcep38A3wFPEg8dzx/P/9//8AAf/jFv4W+Bb0FsAWoxaTFlIWURZHFkMWMBYDFbUVsxWxFa8VpxWiEA8QCQ7+DkMOJAADAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAB//8ADwABAAAAAAAAAAAAAgAANzkBAAAAAAEAAAAAAAAAAAACAAA3OQEAAAAAAQAAAAAAAAAAAAIAADc5AQAAAAACAAD/wAQAA8AABAATAAABNwEnAQMuAScTNwEjAQMlATUBBwGAgAHAQP5Anxc7MmOAAYDA/oDAAoABgP6ATgFAQAHAQP5A/p0yOxcBEU4BgP6A/YDAAYDA/oCAAAQAAAAABAADgAAQACEALQA0AAABOAExETgBMSE4ATEROAExITUhIgYVERQWMyEyNjURNCYjBxQGIyImNTQ2MzIWEyE1EwEzNwPA/IADgPyAGiYmGgOAGiYmGoA4KCg4OCgoOED9AOABAEDgA0D9AAMAQCYa/QAaJiYaAwAaJuAoODgoKDg4/biAAYD+wMAAAAIAAABABAADQAA4ADwAAAEmJy4BJyYjIgcOAQcGBwYHDgEHBhUUFx4BFxYXFhceARcWMzI3PgE3Njc2Nz4BNzY1NCcuAScmJwERDQED1TY4OXY8PT8/PTx2OTg2CwcICwMDAwMLCAcLNjg5djw9Pz89PHY5ODYLBwgLAwMDAwsIBwv9qwFA/sADIAgGBggCAgICCAYGCCkqKlktLi8vLi1ZKiopCAYGCAICAgIIBgYIKSoqWS0uLy8uLVkqKin94AGAwMAAAAAAAgDA/8ADQAPAABsAJwAAASIHDgEHBhUUFx4BFxYxMDc+ATc2NTQnLgEnJgMiJjU0NjMyFhUUBgIAQjs6VxkZMjJ4MjIyMngyMhkZVzo7QlBwcFBQcHADwBkZVzo7Qnh9fcxBQUFBzH19eEI7OlcZGf4AcFBQcHBQUHAAAAEAAAAABAADgAArAAABIgcOAQcGBycRISc+ATMyFx4BFxYVFAcOAQcGBxc2Nz4BNzY1NCcuAScmIwIANTIyXCkpI5YBgJA1i1BQRUZpHh4JCSIYGB5VKCAgLQwMKCiLXl1qA4AKCycbHCOW/oCQNDweHmlGRVArKClJICEaYCMrK2I2NjlqXV6LKCgAAQAAAAAEAAOAACoAABMUFx4BFxYXNyYnLgEnJjU0Nz4BNzYzMhYXByERByYnLgEnJiMiBw4BBwYADAwtICAoVR4YGCIJCR4eaUZFUFCLNZABgJYjKSlcMjI1al1eiygoAYA5NjZiKysjYBohIEkpKCtQRUZpHh48NJABgJYjHBsnCwooKIteXQAAAAACAAAAQAQBAwAAJgBNAAATMhceARcWFRQHDgEHBiMiJy4BJyY1JzQ3PgE3NjMVIgYHDgEHPgEhMhceARcWFRQHDgEHBiMiJy4BJyY1JzQ3PgE3NjMVIgYHDgEHPgHhLikpPRESEhE9KSkuLikpPRESASMjelJRXUB1LQkQBwgSAkkuKSk9ERISET0pKS4uKSk9ERIBIyN6UlFdQHUtCRAHCBICABIRPSkpLi4pKT0REhIRPSkpLiBdUVJ6IyOAMC4IEwoCARIRPSkpLi4pKT0REhIRPSkpLiBdUVJ6IyOAMC4IEwoCAQAABgBA/8AEAAPAAAMABwALABEAHQApAAAlIRUhESEVIREhFSEnESM1IzUTFTMVIzU3NSM1MxUVESM1MzUjNTM1IzUBgAKA/YACgP2AAoD9gMBAQECAwICAwMCAgICAgIACAIACAIDA/wDAQP3yMkCSPDJAku7+wEBAQEBAAAYAAP/ABAADwAADAAcACwAXACMALwAAASEVIREhFSERIRUhATQ2MzIWFRQGIyImETQ2MzIWFRQGIyImETQ2MzIWFRQGIyImAYACgP2AAoD9gAKA/YD+gEs1NUtLNTVLSzU1S0s1NUtLNTVLSzU1SwOAgP8AgP8AgANANUtLNTVLS/61NUtLNTVLS/61NUtLNTVLSwADAAAAAAQAA6AAAwANABQAADchFSElFSE1EyEVITUhJQkBIxEjEQAEAPwABAD8AIABAAEAAQD9YAEgASDggEBAwEBAAQCAgMABIP7g/wABAAAAAAACAB7/zAPiA7QAMwBkAAABIiYnJicmNDc2PwE+ATMyFhcWFxYUBwYPAQYiJyY0PwE2NCcuASMiBg8BBhQXFhQHDgEjAyImJyYnJjQ3Nj8BNjIXFhQPAQYUFx4BMzI2PwE2NCcmNDc2MhcWFxYUBwYPAQ4BIwG4ChMIIxISEhIjwCNZMTFZIyMSEhISI1gPLA8PD1gpKRQzHBwzFMApKQ8PCBMKuDFZIyMSEhISI1gPLA8PD1gpKRQzHBwzFMApKQ8PDysQIxISEhIjwCNZMQFECAckLS1eLS0kwCIlJSIkLS1eLS0kVxAQDysPWCl0KRQVFRTAKXQpDysQBwj+iCUiJC0tXi0tJFcQEA8rD1gpdCkUFRUUwCl0KQ8rEA8PJC0tXi0tJMAiJQAAAAAFAAD/wAQAA8AAGwA3AFMAXwBrAAAFMjc+ATc2NTQnLgEnJiMiBw4BBwYVFBceARcWEzIXHgEXFhUUBw4BBwYjIicuAScmNTQ3PgE3NhMyNz4BNzY3BgcOAQcGIyInLgEnJicWFx4BFxYnNDYzMhYVFAYjIiYlNDYzMhYVFAYjIiYCAGpdXosoKCgoi15dampdXosoKCgoi15dalZMTHEgISEgcUxMVlZMTHEgISEgcUxMVisrKlEmJiMFHBtWODc/Pzc4VhscBSMmJlEqK9UlGxslJRsbJQGAJRsbJSUbGyVAKCiLXl1qal1eiygoKCiLXl1qal1eiygoA6AhIHFMTFZWTExxICEhIHFMTFZWTExxICH+CQYGFRAQFEM6OlYYGRkYVjo6QxQQEBUGBvcoODgoKDg4KCg4OCgoODgAAAMAAP/ABAADwAAbADcAQwAAASIHDgEHBhUUFx4BFxYzMjc+ATc2NTQnLgEnJgMiJy4BJyY1NDc+ATc2MzIXHgEXFhUUBw4BBwYTBycHFwcXNxc3JzcCAGpdXosoKCgoi15dampdXosoKCgoi15dalZMTHEgISEgcUxMVlZMTHEgISEgcUxMSqCgYKCgYKCgYKCgA8AoKIteXWpqXV6LKCgoKIteXWpqXV6LKCj8YCEgcUxMVlZMTHEgISEgcUxMVlZMTHEgIQKgoKBgoKBgoKBgoKAAAQBl/8ADmwPAACkAAAEiJiMiBw4BBwYVFBYzLgE1NDY3MAcGAgcGBxUhEzM3IzceATMyNjcOAQMgRGhGcVNUbRobSUgGDWVKEBBLPDxZAT1sxizXNC1VJi5QGB09A7AQHh1hPj9BTTsLJjeZbwN9fv7Fj5AjGQIAgPYJDzdrCQcAAAAAAgAAAAAEAAOAAAkAFwAAJTMHJzMRIzcXIyURJyMRMxUhNTMRIwcRA4CAoKCAgKCggP8AQMCA/oCAwEDAwMACAMDAwP8AgP1AQEACwIABAAADAMAAAANAA4AAFgAfACgAAAE+ATU0Jy4BJyYjIREhMjc+ATc2NTQmATMyFhUUBisBEyMRMzIWFRQGAsQcIBQURi4vNf7AAYA1Ly5GFBRE/oRlKjw8KWafn58sPj4B2yJULzUvLkYUFPyAFBRGLi81RnQBRks1NUv+gAEASzU1SwAAAAACAMAAAANAA4AAHwAjAAABMxEUBw4BBwYjIicuAScmNREzERQWFx4BMzI2Nz4BNQEhFSECwIAZGVc6O0JCOzpXGRmAGxgcSSgoSRwYG/4AAoD9gAOA/mA8NDVOFhcXFk41NDwBoP5gHjgXGBsbGBc4Hv6ggAAAAAABAIAAAAOAA4AACwAAARUjATMVITUzASM1A4CA/sCA/kCAAUCAA4BA/QBAQAMAQAABAAAAAAQAA4AAPQAAARUjHgEVFAYHDgEjIiYnLgE1MxQWMzI2NTQmIyE1IS4BJy4BNTQ2Nz4BMzIWFx4BFSM0JiMiBhUUFjMyFhcEAOsVFjUwLHE+PnEsMDWAck5OcnJO/gABLAIEATA1NTAscT4+cSwwNYByTk5yck47bisBwEAdQSI1YiQhJCQhJGI1NExMNDRMQAEDASRiNTViJCEkJCEkYjU0TEw0NEwhHwAAAAcAAP/ABAADwAADAAcACwAPABMAGwAjAAATMxUjNzMVIyUzFSM3MxUjJTMVIwMTIRMzEyETAQMhAyMDIQMAgIDAwMABAICAwMDAAQCAgBAQ/QAQIBACgBD9QBADABAgEP2AEAHAQEBAQEBAQEBAAkD+QAHA/oABgPwAAYD+gAFA/sAAAAoAAAAABAADgAADAAcACwAPABMAFwAbAB8AIwAnAAATESERATUhFR0BITUBFSE1IxUhNREhFSElIRUhETUhFQEhFSEhNSEVAAQA/YABAP8AAQD/AED/AAEA/wACgAEA/wABAPyAAQD/AAKAAQADgPyAA4D9wMDAQMDAAgDAwMDA/wDAwMABAMDA/sDAwMAAAAUAAAAABAADgAADAAcACwAPABMAABMhFSEVIRUhESEVIREhFSERIRUhAAQA/AACgP2AAoD9gAQA/AAEAPwAA4CAQID/AIABQID/AIAAAAAABQAAAAAEAAOAAAMABwALAA8AEwAAEyEVIRchFSERIRUhAyEVIREhFSEABAD8AMACgP2AAoD9gMAEAPwABAD8AAOAgECA/wCAAUCA/wCAAAAFAAAAAAQAA4AAAwAHAAsADwATAAATIRUhBSEVIREhFSEBIRUhESEVIQAEAPwAAYACgP2AAoD9gP6ABAD8AAQA/AADgIBAgP8AgAFAgP8AgAAAAAABAD8APwLmAuYALAAAJRQPAQYjIi8BBwYjIi8BJjU0PwEnJjU0PwE2MzIfATc2MzIfARYVFA8BFxYVAuYQThAXFxCoqBAXFhBOEBCoqBAQThAWFxCoqBAXFxBOEBCoqBDDFhBOEBCoqBAQThAWFxCoqBAXFxBOEBCoqBAQThAXFxCoqBAXAAAABgAAAAADJQNuABQAKAA8AE0AVQCCAAABERQHBisBIicmNRE0NzY7ATIXFhUzERQHBisBIicmNRE0NzY7ATIXFhcRFAcGKwEiJyY1ETQ3NjsBMhcWExEhERQXFhcWMyEyNzY3NjUBIScmJyMGBwUVFAcGKwERFAcGIyEiJyY1ESMiJyY9ATQ3NjsBNzY3NjsBMhcWHwEzMhcWFQElBgUIJAgFBgYFCCQIBQaSBQUIJQgFBQUFCCUIBQWSBQUIJQgFBQUFCCUIBQVJ/gAEBAUEAgHbAgQEBAT+gAEAGwQGtQYEAfcGBQg3Ghsm/iUmGxs3CAUFBQUIsSgIFxYXtxcWFgkosAgFBgIS/rcIBQUFBQgBSQgFBgYFCP63CAUFBQUIAUkIBQYGBQj+twgFBQUFCAFJCAUGBgX+WwId/eMNCwoFBQUFCgsNAmZDBQICBVUkCAYF/eMwIiMhIi8CIAUGCCQIBQVgFQ8PDw8VYAUFCAACAAcASQO3Aq8AGgAuAAAJAQYjIi8BJjU0PwEnJjU0PwE2MzIXARYVFAcBFRQHBiMhIicmPQE0NzYzITIXFgFO/vYGBwgFHQYG4eEGBh0FCAcGAQoGBgJpBQUI/dsIBQUFBQgCJQgFBQGF/vYGBhwGCAcG4OEGBwcGHQUF/vUFCAcG/vslCAUFBQUIJQgFBQUFAAAAAQAjAAAD3QNuALMAACUiJyYjIgcGIyInJjU0NzY3Njc2NzY9ATQnJiMhIgcGHQEUFxYXFjMWFxYVFAcGIyInJiMiBwYjIicmNTQ3Njc2NzY3Nj0BETQ1NDU0JzQnJicmJyYnJicmIyInJjU0NzYzMhcWMzI3NjMyFxYVFAcGIwYHBgcGHQEUFxYzITI3Nj0BNCcmJyYnJjU0NzYzMhcWMzI3NjMyFxYVFAcGByIHBgcGFREUFxYXFhcyFxYVFAcGIwPBGTMyGhkyMxkNCAcJCg0MERAKEgEHFf5+FgcBFQkSEw4ODAsHBw4bNTUaGDExGA0HBwkJCwwQDwkSAQIBAgMEBAUIEhENDQoLBwcOGjU1GhgwMRgOBwcJCgwNEBAIFAEHDwGQDgcBFAoXFw8OBwcOGTMyGRkxMRkOBwcKCg0NEBEIFBQJEREODQoLBwcOAAICAgIMCw8RCQkBAQMDBQxE4AwFAwMFDNRRDQYBAgEICBIPDA0CAgICDAwOEQgJAQIDAwUNRSEB0AINDQgIDg4KCgsLBwcDBgEBCAgSDwwNAgICAg0MDxEICAECAQYMULYMBwEBBwy2UAwGAQEGBxYPDA0CAgICDQwPEQgIAQECBg1P/eZEDAYCAgEJCBEPDA0AAAIAAP+3A/8DtwATADkAAAEyFxYVFAcCBwYjIicmNTQ3ATYzARYXFh8BFgcGIyInJicmJyY1FhcWFxYXFjMyNzY3Njc2NzY3NjcDmygeHhq+TDdFSDQ0NQFtISn9+BcmJy8BAkxMe0c2NiEhEBEEExQQEBIRCRcIDxITFRUdHR4eKQO3GxooJDP+mUY0NTRJSTABSx/9sSsfHw0oek1MGhsuLzo6RAMPDgsLCgoWJRsaEREKCwQEAgABAAAAAAAA9evv618PPPUACwQAAAAAANbEBFgAAAAA1sQEWAAA/7cEAQPAAAAACAACAAAAAAAAAAEAAAPA/8AAAAQAAAD//wQBAAEAAAAAAAAAAAAAAAAAAAAhBAAAAAAAAAAAAAAAAgAAAAQAAAAEAAAABAAAAAQAAMAEAAAABAAAAAQAAAAEAABABAAAAAQAAAAEAAAeBAAAAAQAAAAEAABlBAAAAAQAAMAEAADABAAAgAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAMlAD8DJQAAA74ABwQAACMD/wAAAAAAAAAKABQAHgBMAJQA+AE2AXwBwgI2AnQCvgLoA34EHgSIBMoE8gU0BXAFiAXgBiIGagaSBroG5AcoB+AIKgkcCXgAAQAAACEAtAAKAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAA4ArgABAAAAAAABAAcAAAABAAAAAAACAAcAYAABAAAAAAADAAcANgABAAAAAAAEAAcAdQABAAAAAAAFAAsAFQABAAAAAAAGAAcASwABAAAAAAAKABoAigADAAEECQABAA4ABwADAAEECQACAA4AZwADAAEECQADAA4APQADAAEECQAEAA4AfAADAAEECQAFABYAIAADAAEECQAGAA4AUgADAAEECQAKADQApGljb21vb24AaQBjAG8AbQBvAG8AblZlcnNpb24gMS4wAFYAZQByAHMAaQBvAG4AIAAxAC4AMGljb21vb24AaQBjAG8AbQBvAG8Abmljb21vb24AaQBjAG8AbQBvAG8AblJlZ3VsYXIAUgBlAGcAdQBsAGEAcmljb21vb24AaQBjAG8AbQBvAG8AbkZvbnQgZ2VuZXJhdGVkIGJ5IEljb01vb24uAEYAbwBuAHQAIABnAGUAbgBlAHIAYQB0AGUAZAAgAGIAeQAgAEkAYwBvAE0AbwBvAG4ALgAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=) format(\'truetype\'); font-weight: normal; font-style: normal;}[class^="w-e-icon-"],[class*=" w-e-icon-"] { /* use !important to prevent issues with browser extensions that change fonts */ font-family: \'w-e-icon\' !important; speak: none; font-style: normal; font-weight: normal; font-variant: normal; text-transform: none; line-height: 1; /* Better Font Rendering =========== */ -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;}.w-e-icon-close:before { content: "\\f00d";}.w-e-icon-upload2:before { content: "\\e9c6";}.w-e-icon-trash-o:before { content: "\\f014";}.w-e-icon-header:before { content: "\\f1dc";}.w-e-icon-pencil2:before { content: "\\e906";}.w-e-icon-paint-brush:before { content: "\\f1fc";}.w-e-icon-image:before { content: "\\e90d";}.w-e-icon-play:before { content: "\\e912";}.w-e-icon-location:before { content: "\\e947";}.w-e-icon-undo:before { content: "\\e965";}.w-e-icon-redo:before { content: "\\e966";}.w-e-icon-quotes-left:before { content: "\\e977";}.w-e-icon-list-numbered:before { content: "\\e9b9";}.w-e-icon-list2:before { content: "\\e9bb";}.w-e-icon-link:before { content: "\\e9cb";}.w-e-icon-happy:before { content: "\\e9df";}.w-e-icon-bold:before { content: "\\ea62";}.w-e-icon-underline:before { content: "\\ea63";}.w-e-icon-italic:before { content: "\\ea64";}.w-e-icon-strikethrough:before { content: "\\ea65";}.w-e-icon-table2:before { content: "\\ea71";}.w-e-icon-paragraph-left:before { content: "\\ea77";}.w-e-icon-paragraph-center:before { content: "\\ea78";}.w-e-icon-paragraph-right:before { content: "\\ea79";}.w-e-icon-terminal:before { content: "\\f120";}.w-e-icon-page-break:before { content: "\\ea68";}.w-e-icon-cancel-circle:before { content: "\\ea0d";}.w-e-icon-font:before { content: "\\ea5c";}.w-e-icon-text-heigh:before { content: "\\ea5f";}.w-e-toolbar { display: -webkit-box; display: -ms-flexbox; display: flex; padding: 0 5px; /* flex-wrap: wrap; */ /* 单个菜单 */}.w-e-toolbar .w-e-menu { position: relative; text-align: center; padding: 5px 10px; cursor: pointer;}.w-e-toolbar .w-e-menu i { color: #999;}.w-e-toolbar .w-e-menu:hover i { color: #333;}.w-e-toolbar .w-e-active i { color: #1e88e5;}.w-e-toolbar .w-e-active:hover i { color: #1e88e5;}.w-e-text-container .w-e-panel-container { position: absolute; top: 0; left: 50%; border: 1px solid #ccc; border-top: 0; box-shadow: 1px 1px 2px #ccc; color: #333; background-color: #fff; /* 为 emotion panel 定制的样式 */ /* 上传图片的 panel 定制样式 */}.w-e-text-container .w-e-panel-container .w-e-panel-close { position: absolute; right: 0; top: 0; padding: 5px; margin: 2px 5px 0 0; cursor: pointer; color: #999;}.w-e-text-container .w-e-panel-container .w-e-panel-close:hover { color: #333;}.w-e-text-container .w-e-panel-container .w-e-panel-tab-title { list-style: none; display: -webkit-box; display: -ms-flexbox; display: flex; font-size: 14px; margin: 2px 10px 0 10px; border-bottom: 1px solid #f1f1f1;}.w-e-text-container .w-e-panel-container .w-e-panel-tab-title .w-e-item { padding: 3px 5px; color: #999; cursor: pointer; margin: 0 3px; position: relative; top: 1px;}.w-e-text-container .w-e-panel-container .w-e-panel-tab-title .w-e-active { color: #333; border-bottom: 1px solid #333; cursor: default; font-weight: 700;}.w-e-text-container .w-e-panel-container .w-e-panel-tab-content { padding: 10px 15px 10px 15px; font-size: 16px; /* 输入框的样式 */ /* 按钮的样式 */}.w-e-text-container .w-e-panel-container .w-e-panel-tab-content input:focus,.w-e-text-container .w-e-panel-container .w-e-panel-tab-content textarea:focus,.w-e-text-container .w-e-panel-container .w-e-panel-tab-content button:focus { outline: none;}.w-e-text-container .w-e-panel-container .w-e-panel-tab-content textarea { width: 100%; border: 1px solid #ccc; padding: 5px;}.w-e-text-container .w-e-panel-container .w-e-panel-tab-content textarea:focus { border-color: #1e88e5;}.w-e-text-container .w-e-panel-container .w-e-panel-tab-content input[type=text] { border: none; border-bottom: 1px solid #ccc; font-size: 14px; height: 20px; color: #333; text-align: left;}.w-e-text-container .w-e-panel-container .w-e-panel-tab-content input[type=text].small { width: 30px; text-align: center;}.w-e-text-container .w-e-panel-container .w-e-panel-tab-content input[type=text].block { display: block; width: 100%; margin: 10px 0;}.w-e-text-container .w-e-panel-container .w-e-panel-tab-content input[type=text]:focus { border-bottom: 2px solid #1e88e5;}.w-e-text-container .w-e-panel-container .w-e-panel-tab-content .w-e-button-container button { font-size: 14px; color: #1e88e5; border: none; padding: 5px 10px; background-color: #fff; cursor: pointer; border-radius: 3px;}.w-e-text-container .w-e-panel-container .w-e-panel-tab-content .w-e-button-container button.left { float: left; margin-right: 10px;}.w-e-text-container .w-e-panel-container .w-e-panel-tab-content .w-e-button-container button.right { float: right; margin-left: 10px;}.w-e-text-container .w-e-panel-container .w-e-panel-tab-content .w-e-button-container button.gray { color: #999;}.w-e-text-container .w-e-panel-container .w-e-panel-tab-content .w-e-button-container button.red { color: #c24f4a;}.w-e-text-container .w-e-panel-container .w-e-panel-tab-content .w-e-button-container button:hover { background-color: #f1f1f1;}.w-e-text-container .w-e-panel-container .w-e-panel-tab-content .w-e-button-container:after { content: ""; display: table; clear: both;}.w-e-text-container .w-e-panel-container .w-e-emoticon-container .w-e-item { cursor: pointer; font-size: 18px; padding: 0 3px; display: inline-block; *display: inline; *zoom: 1;}.w-e-text-container .w-e-panel-container .w-e-up-img-container { text-align: center;}.w-e-text-container .w-e-panel-container .w-e-up-img-container .w-e-up-btn { display: inline-block; *display: inline; *zoom: 1; color: #999; cursor: pointer; font-size: 60px; line-height: 1;}.w-e-text-container .w-e-panel-container .w-e-up-img-container .w-e-up-btn:hover { color: #333;}.w-e-text-container { position: relative;}.w-e-text-container .w-e-progress { position: absolute; background-color: #1e88e5; bottom: 0; left: 0; height: 1px;}.w-e-text { padding: 0 10px; overflow-y: scroll;}.w-e-text p,.w-e-text h1,.w-e-text h2,.w-e-text h3,.w-e-text h4,.w-e-text h5,.w-e-text table,.w-e-text pre { margin: 10px 0; line-height: 1.5;}.w-e-text ul,.w-e-text ol { margin: 10px 0 10px 20px;}.w-e-text blockquote { display: block; border-left: 8px solid #d0e5f2; padding: 5px 10px; margin: 10px 0; line-height: 1.4; font-size: 100%; background-color: #f1f1f1;}.w-e-text code { display: inline-block; *display: inline; *zoom: 1; background-color: #f1f1f1; border-radius: 3px; padding: 3px 5px; margin: 0 3px;}.w-e-text pre code { display: block;}.w-e-text table { border-top: 1px solid #ccc; border-left: 1px solid #ccc;}.w-e-text table td,.w-e-text table th { border-bottom: 1px solid #ccc; border-right: 1px solid #ccc; padding: 3px 5px;}.w-e-text table th { border-bottom: 2px solid #ccc; text-align: center;}.w-e-text:focus { outline: none;}.w-e-text img { cursor: pointer;}.w-e-text img:hover { box-shadow: 0 0 5px #333;}'; + +// 将 css 代码添加到