From 4e31dbdf81e346bd7bf396fc6f86fbe302b9418c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=9C=E6=81=92?= <2323333339@qq.com> Date: Wed, 20 Jan 2021 14:15:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/css/joe.global.css | 2 +- assets/css/joe.global.scss | 203 +++++++++++++++++++++++++++++++++++++ assets/js/joe.global.js | 59 +++++++++++ core/core.php | 73 +++++++++++++ functions.php | 50 ++++++++- index.php | 2 +- public/aside.php | 37 ++++++- public/header.php | 2 +- 8 files changed, 420 insertions(+), 8 deletions(-) diff --git a/assets/css/joe.global.css b/assets/css/joe.global.css index b3d8eaa..9351756 100644 --- a/assets/css/joe.global.css +++ b/assets/css/joe.global.css @@ -1 +1 @@ -.joe_dropdown{position:relative}.joe_dropdown__link{display:flex;align-items:center}.joe_dropdown__link-icon{transition:-webkit-transform 0.35s;transition:transform 0.35s;transition:transform 0.35s, -webkit-transform 0.35s}.joe_dropdown__menu{position:absolute;left:50%;visibility:hidden;z-index:999;border-top:3px solid var(--theme);-webkit-transform-origin:top;transform-origin:top;background:var(--background);box-shadow:0 0 10px rgba(0,0,0,0.15);border-radius:0 0 4px 4px;padding:10px 0;opacity:0;-webkit-transform:translateX(-50%) perspective(600px) rotateX(-45deg);transform:translateX(-50%) perspective(600px) rotateX(-45deg);transition:opacity 0.35s, visibility 0.35s, -webkit-transform 0.35s;transition:opacity 0.35s, visibility 0.35s, transform 0.35s;transition:opacity 0.35s, visibility 0.35s, transform 0.35s, -webkit-transform 0.35s}.joe_dropdown__menu::before{content:'';position:absolute;top:-10px;left:50%;-webkit-transform:translateX(-50%);transform:translateX(-50%);width:0;height:0;border-left:7px solid transparent;border-right:7px solid transparent;border-bottom:7px solid var(--theme)}.joe_dropdown.active .joe_dropdown__link-icon{-webkit-transform:rotate(-180deg);transform:rotate(-180deg)}.joe_dropdown.active .joe_dropdown__menu{visibility:visible;opacity:1;-webkit-transform:translateX(-50%) perspective(600px) rotateX(0);transform:translateX(-50%) perspective(600px) rotateX(0)}.joe_header{position:-webkit-sticky;position:sticky;top:0;z-index:1000;background:var(--background);box-shadow:0 2px 10px 0 rgba(0,0,0,0.1)}.joe_header__above-logo{position:relative;display:flex;align-items:center;height:60px;padding-right:15px;margin-right:15px}.joe_header__above-logo img{max-width:150px;max-height:50px;-o-object-fit:cover;object-fit:cover}.joe_header__above-logo::after{content:'';position:absolute;top:50%;right:0;width:1px;height:20px;background:var(--classC);-webkit-transform:translateY(-50%);transform:translateY(-50%)}.joe_header__above-nav{display:flex;align-items:center}.joe_header__above-nav .item{position:relative;height:60px;line-height:60px;font-size:15px;padding:0 8px;margin-right:15px;transition:color 0.35s;white-space:nowrap;color:var(--main)}.joe_header__above-nav .item:last-child{margin-right:0}.joe_header__above-nav .item::after{content:'';position:absolute;bottom:0;left:0;right:0;height:3px;transition:opacity 0.5s, -webkit-transform 0.5s;transition:opacity 0.5s, transform 0.5s;transition:opacity 0.5s, transform 0.5s, -webkit-transform 0.5s;border-radius:6px 6px 0 0;opacity:0;-webkit-transform:scaleX(0.25);transform:scaleX(0.25);background:var(--theme)}.joe_header__above-nav .item.active,.joe_header__above-nav .item:hover{color:var(--theme)}.joe_header__above-nav .item.active::after,.joe_header__above-nav .item:hover::after{opacity:1;-webkit-transform:scaleX(1);transform:scaleX(1)}.joe_header__above-nav .joe_dropdown__link a{height:60px;line-height:60px;font-size:15px;padding-left:8px;padding-right:3px;transition:color 0.35s;white-space:nowrap;color:var(--main)}.joe_header__above-nav .joe_dropdown__menu{width:110px;text-align:center}.joe_header__above-nav .joe_dropdown__menu a{display:block;line-height:34px;height:34px;transition:color 0.35s, background 0.35s;color:var(--minor);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;padding:0 15px}.joe_header__above-nav .joe_dropdown__menu a:hover,.joe_header__above-nav .joe_dropdown__menu a.active{color:var(--theme);background:var(--classD)}.joe_header__above-search{position:relative;margin-left:auto;display:flex;align-items:center}.joe_header__above-search .input{background:var(--classC);width:170px;height:34px;border:1px solid transparent;padding:0 18px;color:var(--routine);transition:background 0.35s, border-color 0.35s, padding-right 0.35s;border-radius:17px 0 0 17px}.joe_header__above-search .input:focus{background:var(--background);border-color:var(--theme);padding-right:28px}.joe_header__above-search .input:focus ~ .icon{-webkit-transform:translate3d(0, -50%, 0) rotateY(180deg);transform:translate3d(0, -50%, 0) rotateY(180deg)}.joe_header__above-search .submit{position:relative;z-index:1;height:34px;border:none;background:var(--theme);color:#fff;border-radius:0 17px 17px 0;padding:0 10px}.joe_header__above-search .icon{position:absolute;top:50%;left:142px;width:28px;height:38px;background:url(../img/search.png);background-size:100% 100%;transition:-webkit-transform 0.35s;transition:transform 0.35s;transition:transform 0.35s, -webkit-transform 0.35s;-webkit-transform:translate3d(100%, -50%, 0) rotateY(180deg);transform:translate3d(100%, -50%, 0) rotateY(180deg)}.joe_header__below{border-top:1px solid var(--classC);height:45px}.joe_header__below-class{display:flex}.joe_header__below-class .item{margin-right:15px;color:var(--minor);height:45px;line-height:45px;transition:color 0.35s;white-space:nowrap}.joe_header__below-class .item:hover,.joe_header__below-class .item.active{color:var(--theme)}.joe_header__below-class .joe_dropdown{margin-right:15px}.joe_header__below-class .joe_dropdown__link .item{margin-right:3px}.joe_header__below-class .joe_dropdown__menu{width:110px;text-align:center}.joe_header__below-class .joe_dropdown__menu a{display:block;height:34px;line-height:34px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--minor);transition:color 0.35s, background 0.35s}.joe_header__below-class .joe_dropdown__menu a:hover,.joe_header__below-class .joe_dropdown__menu a.active{color:var(--theme);background:var(--classD)}.joe_aside{padding:15px 0;margin-left:15px}.joe_aside__item{position:relative;width:250px;margin-bottom:15px;border-radius:8px;box-shadow:var(--box-shadow);overflow:hidden}.joe_aside__item:last-child{position:-webkit-sticky;position:sticky;margin-bottom:0}.joe_aside__item.author{background:var(--background);padding:45px 15px 15px}.joe_aside__item.author::before{content:'';position:absolute;top:90px;left:0;width:100%;height:30px;z-index:2;background:linear-gradient(to bottom, rgba(255,255,255,0), var(--background))}.joe_aside__item.author::after{display:none;content:'';position:absolute;top:0;left:0;width:100%;height:273px;background:url("https://cdn.jsdelivr.net/gh/HaoOuBa/Joe@master/assets/img/snow.gif") no-repeat;background-size:cover;z-index:3;pointer-events:none}.joe_aside__item.author:hover::after{display:block}.joe_aside__item.author .image{position:absolute;top:0;left:0;width:100%;height:120px;-o-object-fit:cover;object-fit:cover;z-index:1} +.joe_dropdown{position:relative}.joe_dropdown__link{display:flex;align-items:center}.joe_dropdown__link-icon{transition:-webkit-transform 0.35s;transition:transform 0.35s;transition:transform 0.35s, -webkit-transform 0.35s}.joe_dropdown__menu{position:absolute;left:50%;visibility:hidden;z-index:999;border-top:3px solid var(--theme);-webkit-transform-origin:top;transform-origin:top;background:var(--background);box-shadow:0 0 10px rgba(0,0,0,0.15);border-radius:0 0 4px 4px;padding:10px 0;opacity:0;-webkit-transform:translateX(-50%) perspective(600px) rotateX(-45deg);transform:translateX(-50%) perspective(600px) rotateX(-45deg);transition:opacity 0.35s, visibility 0.35s, -webkit-transform 0.35s;transition:opacity 0.35s, visibility 0.35s, transform 0.35s;transition:opacity 0.35s, visibility 0.35s, transform 0.35s, -webkit-transform 0.35s}.joe_dropdown__menu::before{content:'';position:absolute;top:-10px;left:50%;-webkit-transform:translateX(-50%);transform:translateX(-50%);width:0;height:0;border-left:7px solid transparent;border-right:7px solid transparent;border-bottom:7px solid var(--theme)}.joe_dropdown.active .joe_dropdown__link-icon{-webkit-transform:rotate(-180deg);transform:rotate(-180deg)}.joe_dropdown.active .joe_dropdown__menu{visibility:visible;opacity:1;-webkit-transform:translateX(-50%) perspective(600px) rotateX(0);transform:translateX(-50%) perspective(600px) rotateX(0)}.joe_header{position:-webkit-sticky;position:sticky;top:0;z-index:1000;background:var(--background);box-shadow:0 2px 10px 0 rgba(0,0,0,0.1)}.joe_header__above-logo{position:relative;display:flex;align-items:center;height:60px;padding-right:15px;margin-right:15px}.joe_header__above-logo img{max-width:150px;max-height:50px;-o-object-fit:cover;object-fit:cover}.joe_header__above-logo::after{content:'';position:absolute;top:50%;right:0;width:1px;height:20px;background:var(--classC);-webkit-transform:translateY(-50%);transform:translateY(-50%)}.joe_header__above-nav{display:flex;align-items:center}.joe_header__above-nav .item{position:relative;height:60px;line-height:60px;font-size:15px;padding:0 8px;margin-right:15px;transition:color 0.35s;white-space:nowrap;color:var(--main)}.joe_header__above-nav .item:last-child{margin-right:0}.joe_header__above-nav .item::after{content:'';position:absolute;bottom:0;left:0;right:0;height:3px;transition:opacity 0.5s, -webkit-transform 0.5s;transition:opacity 0.5s, transform 0.5s;transition:opacity 0.5s, transform 0.5s, -webkit-transform 0.5s;border-radius:6px 6px 0 0;opacity:0;-webkit-transform:scaleX(0.25);transform:scaleX(0.25);background:var(--theme)}.joe_header__above-nav .item.active,.joe_header__above-nav .item:hover{color:var(--theme)}.joe_header__above-nav .item.active::after,.joe_header__above-nav .item:hover::after{opacity:1;-webkit-transform:scaleX(1);transform:scaleX(1)}.joe_header__above-nav .joe_dropdown__link a{height:60px;line-height:60px;font-size:15px;padding-left:8px;padding-right:3px;transition:color 0.35s;white-space:nowrap;color:var(--main)}.joe_header__above-nav .joe_dropdown__menu{width:110px;text-align:center}.joe_header__above-nav .joe_dropdown__menu a{display:block;line-height:34px;height:34px;transition:color 0.35s, background 0.35s;color:var(--minor);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;padding:0 15px}.joe_header__above-nav .joe_dropdown__menu a:hover,.joe_header__above-nav .joe_dropdown__menu a.active{color:var(--theme);background:var(--classD)}.joe_header__above-search{position:relative;margin-left:auto;display:flex;align-items:center}.joe_header__above-search .input{background:var(--classC);width:170px;height:34px;border:1px solid transparent;padding:0 18px;color:var(--routine);transition:background 0.35s, border-color 0.35s, padding-right 0.35s;border-radius:17px 0 0 17px}.joe_header__above-search .input:focus{background:var(--background);border-color:var(--theme);padding-right:28px}.joe_header__above-search .input:focus ~ .icon{-webkit-transform:translate3d(0, -50%, 0) rotateY(180deg);transform:translate3d(0, -50%, 0) rotateY(180deg)}.joe_header__above-search .submit{position:relative;z-index:1;height:34px;border:none;background:var(--theme);color:#fff;border-radius:0 17px 17px 0;padding:0 10px}.joe_header__above-search .icon{position:absolute;top:50%;left:142px;width:28px;height:38px;background:url(../img/search.png);background-size:100% 100%;transition:-webkit-transform 0.35s;transition:transform 0.35s;transition:transform 0.35s, -webkit-transform 0.35s;-webkit-transform:translate3d(100%, -50%, 0) rotateY(180deg);transform:translate3d(100%, -50%, 0) rotateY(180deg)}.joe_header__below{border-top:1px solid var(--classC);height:45px}.joe_header__below-class{display:flex}.joe_header__below-class .item{margin-right:15px;color:var(--minor);height:45px;line-height:45px;transition:color 0.35s;white-space:nowrap}.joe_header__below-class .item:hover,.joe_header__below-class .item.active{color:var(--theme)}.joe_header__below-class .joe_dropdown{margin-right:15px}.joe_header__below-class .joe_dropdown__link .item{margin-right:3px}.joe_header__below-class .joe_dropdown__menu{width:110px;text-align:center}.joe_header__below-class .joe_dropdown__menu a{display:block;height:34px;line-height:34px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--minor);transition:color 0.35s, background 0.35s}.joe_header__below-class .joe_dropdown__menu a:hover,.joe_header__below-class .joe_dropdown__menu a.active{color:var(--theme);background:var(--classD)}.joe_aside{padding:15px 0;margin-left:15px}.joe_aside__item{position:relative;width:250px;margin-bottom:15px;border-radius:8px;box-shadow:var(--box-shadow);overflow:hidden}.joe_aside__item:last-child{position:-webkit-sticky;position:sticky;margin-bottom:0}.joe_aside__item-title{display:flex;align-items:center;border-bottom:1px solid var(--classC);font-size:16px;font-weight:500;height:45px;line-height:45px;padding:0 15px;color:var(--main)}.joe_aside__item-title .icon{width:18px;height:18px;margin-right:8px;fill:var(--main)}.joe_aside__item-title .line{width:10px;height:1px;background:#54b5db;margin-left:12px}.joe_aside__item-contain{position:relative;padding:15px}.joe_aside__item.author{background:var(--background);padding:45px 15px 15px}.joe_aside__item.author::before{content:'';position:absolute;top:90px;left:0;width:100%;height:30px;z-index:2;background:linear-gradient(to bottom, rgba(255,255,255,0), var(--background))}.joe_aside__item.author::after{display:none;content:'';position:absolute;top:0;left:0;width:100%;height:273px;background:url("https://cdn.jsdelivr.net/gh/HaoOuBa/Joe@master/assets/img/snow.gif") no-repeat;background-size:cover;z-index:3;pointer-events:none}.joe_aside__item.author:hover::after{display:block}.joe_aside__item.author .image{position:absolute;top:0;left:0;width:100%;height:120px;-o-object-fit:cover;object-fit:cover;z-index:1}.joe_aside__item.author .user{position:relative;z-index:4;display:flex;flex-direction:column;align-items:center;padding-bottom:15px}.joe_aside__item.author .user .avatar{width:75px;height:75px;border-radius:50%;overflow:hidden;margin-bottom:10px;-o-object-fit:cover;object-fit:cover;transition:-webkit-transform 0.75s;transition:transform 0.75s;transition:transform 0.75s, -webkit-transform 0.75s;background:var(--background);padding:5px}.joe_aside__item.author .user .avatar:hover{-webkit-transform:rotate(360deg);transform:rotate(360deg)}.joe_aside__item.author .user .link{color:var(--theme);margin-bottom:10px;font-size:16px;font-weight:500}.joe_aside__item.author .user .link:hover{text-decoration:underline}.joe_aside__item.author .user .motto{color:var(--main);text-align:center}.joe_aside__item.author .count{width:100%;padding-bottom:15px;display:flex;align-items:center;border-bottom:1px solid var(--classC)}.joe_aside__item.author .count .item{min-width:0;flex:1;display:flex;flex-direction:column;align-items:center;color:var(--routine);font-size:12px}.joe_aside__item.author .count .item:first-child{border-right:1px solid var(--classC)}.joe_aside__item.author .count .item .num{max-width:70px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-weight:500;font-size:22px;color:var(--main);margin-bottom:3px;text-shadow:var(--text_shadow)}.joe_aside__item.author .list{padding-top:15px}.joe_aside__item.author .list .item{display:flex;align-items:center;justify-content:space-between;line-height:30px}.joe_aside__item.author .list .item .link{position:relative;color:var(--routine);max-width:85%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.joe_aside__item.author .list .item .link::after{content:'';position:absolute;bottom:0;left:0;width:0;height:1px;background:var(--theme);transition:all 0.35s}.joe_aside__item.author .list .item .link:hover{color:var(--theme)}.joe_aside__item.author .list .item .link:hover::after{width:100%}.joe_aside__item.author .list .item .icon{fill:var(--routine)}.joe_aside__item.timelife{background:var(--background)}.joe_aside__item.timelife .item{margin-bottom:15px}.joe_aside__item.timelife .item:last-child{margin-bottom:0}.joe_aside__item.timelife .item .title{font-size:12px;color:var(--minor);margin-bottom:5px;display:flex;align-items:center}.joe_aside__item.timelife .item .title .text{color:var(--theme);font-weight:500;font-size:14px;margin:0 5px}.joe_aside__item.timelife .item .progress{display:flex;align-items:center}.joe_aside__item.timelife .item .progress-bar{height:10px;border-radius:5px;overflow:hidden;background:var(--classC);width:0;min-width:0;flex:1;margin-right:5px}.joe_aside__item.timelife .item .progress-bar-inner{width:0;height:100%;border-radius:5px;transition:width 0.35s;-webkit-animation:progress 750ms linear infinite;animation:progress 750ms linear infinite}.joe_aside__item.timelife .item .progress-bar-inner-0{background:#bde6ff;background-image:linear-gradient(135deg, #50bfff 25%, transparent 25%, transparent 50%, #50bfff 50%, #50bfff 75%, transparent 75%, transparent 100%);background-size:30px 30px}.joe_aside__item.timelife .item .progress-bar-inner-1{background:#ffd980;background-image:linear-gradient(135deg, #f7ba2a 25%, transparent 25%, transparent 50%, #f7ba2a 50%, #f7ba2a 75%, transparent 75%, transparent 100%);background-size:30px 30px}.joe_aside__item.timelife .item .progress-bar-inner-2{background:#ffa9a9;background-image:linear-gradient(135deg, #ff4949 25%, transparent 25%, transparent 50%, #ff4949 50%, #ff4949 75%, transparent 75%, transparent 100%);background-size:30px 30px}.joe_aside__item.timelife .item .progress-bar-inner-3{background:#67c23a;background-image:linear-gradient(135deg, #4f9e28 25%, transparent 25%, transparent 50%, #4f9e28 50%, #4f9e28 75%, transparent 75%, transparent 100%);background-size:30px 30px}.joe_aside__item.timelife .item .progress-percentage{color:var(--minor)}@-webkit-keyframes progress{0%{background-position:0 0}100%{background-position:30px 0}}@keyframes progress{0%{background-position:0 0}100%{background-position:30px 0}} diff --git a/assets/css/joe.global.scss b/assets/css/joe.global.scss index 11d9f6c..ecd9808 100644 --- a/assets/css/joe.global.scss +++ b/assets/css/joe.global.scss @@ -257,6 +257,33 @@ position: sticky; margin-bottom: 0; } + &-title { + display: flex; + align-items: center; + border-bottom: 1px solid var(--classC); + font-size: 16px; + font-weight: 500; + height: 45px; + line-height: 45px; + padding: 0 15px; + color: var(--main); + .icon { + width: 18px; + height: 18px; + margin-right: 8px; + fill: var(--main); + } + .line { + width: 10px; + height: 1px; + background: #54b5db; + margin-left: 12px; + } + } + &-contain { + position: relative; + padding: 15px; + } &.author { background: var(--background); padding: 45px 15px 15px; @@ -295,6 +322,182 @@ object-fit: cover; z-index: 1; } + .user { + position: relative; + z-index: 4; + display: flex; + flex-direction: column; + align-items: center; + padding-bottom: 15px; + .avatar { + width: 75px; + height: 75px; + border-radius: 50%; + overflow: hidden; + margin-bottom: 10px; + object-fit: cover; + transition: transform 0.75s; + background: var(--background); + padding: 5px; + &:hover { + transform: rotate(360deg); + } + } + .link { + color: var(--theme); + margin-bottom: 10px; + font-size: 16px; + font-weight: 500; + &:hover { + text-decoration: underline; + } + } + .motto { + color: var(--main); + text-align: center; + } + } + .count { + width: 100%; + padding-bottom: 15px; + display: flex; + align-items: center; + border-bottom: 1px solid var(--classC); + .item { + min-width: 0; + flex: 1; + display: flex; + flex-direction: column; + align-items: center; + color: var(--routine); + font-size: 12px; + &:first-child { + border-right: 1px solid var(--classC); + } + .num { + max-width: 70px; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + font-weight: 500; + font-size: 22px; + color: var(--main); + margin-bottom: 3px; + text-shadow: var(--text_shadow); + } + } + } + .list { + padding-top: 15px; + .item { + display: flex; + align-items: center; + justify-content: space-between; + line-height: 30px; + .link { + position: relative; + color: var(--routine); + max-width: 85%; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + &::after { + content: ''; + position: absolute; + bottom: 0; + left: 0; + width: 0; + height: 1px; + background: var(--theme); + transition: all 0.35s; + } + &:hover { + color: var(--theme); + &::after { + width: 100%; + } + } + } + .icon { + fill: var(--routine); + } + } + } + } + &.timelife { + background: var(--background); + .item { + margin-bottom: 15px; + &:last-child { + margin-bottom: 0; + } + .title { + font-size: 12px; + color: var(--minor); + margin-bottom: 5px; + display: flex; + align-items: center; + .text { + color: var(--theme); + font-weight: 500; + font-size: 14px; + margin: 0 5px; + } + } + .progress { + display: flex; + align-items: center; + &-bar { + height: 10px; + border-radius: 5px; + overflow: hidden; + background: var(--classC); + width: 0; + min-width: 0; + flex: 1; + margin-right: 5px; + &-inner { + width: 0; + height: 100%; + border-radius: 5px; + transition: width 0.35s; + animation: progress 750ms linear infinite; + &-0 { + background: #bde6ff; + background-image: linear-gradient(135deg, #50bfff 25%, transparent 25%, transparent 50%, #50bfff 50%, #50bfff 75%, transparent 75%, transparent 100%); + background-size: 30px 30px; + } + &-1 { + background: #ffd980; + background-image: linear-gradient(135deg, #f7ba2a 25%, transparent 25%, transparent 50%, #f7ba2a 50%, #f7ba2a 75%, transparent 75%, transparent 100%); + background-size: 30px 30px; + } + &-2 { + background: #ffa9a9; + background-image: linear-gradient(135deg, #ff4949 25%, transparent 25%, transparent 50%, #ff4949 50%, #ff4949 75%, transparent 75%, transparent 100%); + background-size: 30px 30px; + } + &-3 { + background: #67c23a; + background-image: linear-gradient(135deg, #4f9e28 25%, transparent 25%, transparent 50%, #4f9e28 50%, #4f9e28 75%, transparent 75%, transparent 100%); + background-size: 30px 30px; + } + } + } + &-percentage { + color: var(--minor); + } + } + } } } } + +@keyframes progress { + 0% { + background-position: 0 0; + } + 100% { + background-position: 30px 0; + } +} diff --git a/assets/js/joe.global.js b/assets/js/joe.global.js index 28cc654..9896bc2 100644 --- a/assets/js/joe.global.js +++ b/assets/js/joe.global.js @@ -26,6 +26,65 @@ window.Joe = function () { } }); } + + /* Timelife */ + { + let timelife = [ + { title: '今日已经过去', endTitle: '小时', num: 0, percent: '0%' }, + { title: '这周已经过去', endTitle: '天', num: 0, percent: '0%' }, + { title: '本月已经过去', endTitle: '天', num: 0, percent: '0%' }, + { title: '今年已经过去', endTitle: '个月', num: 0, percent: '0%' } + ]; + { + let nowDate = +new Date(); + let todayStartDate = new Date(new Date().toLocaleDateString()).getTime(); + let todayPassHours = (nowDate - todayStartDate) / 1000 / 60 / 60; + let todayPassHoursPercent = (todayPassHours / 24) * 100; + timelife[0].num = parseInt(todayPassHours); + timelife[0].percent = parseInt(todayPassHoursPercent) + '%'; + } + { + let weeks = { 0: 7, 1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6 }; + let weekDay = weeks[new Date().getDay()]; + let weekDayPassPercent = (weekDay / 7) * 100; + timelife[1].num = parseInt(weekDay); + timelife[1].percent = parseInt(weekDayPassPercent) + '%'; + } + { + let year = new Date().getFullYear(); + let date = new Date().getDate(); + let month = new Date().getMonth() + 1; + let monthAll = new Date(year, month, 0).getDate(); + let monthPassPercent = (date / monthAll) * 100; + timelife[2].num = date; + timelife[2].percent = parseInt(monthPassPercent) + '%'; + } + { + let month = new Date().getMonth() + 1; + let yearPass = (month / 12) * 100; + timelife[3].num = month; + timelife[3].percent = parseInt(yearPass) + '%'; + } + let htmlStr = ''; + timelife.forEach((item, index) => { + htmlStr += ` +
+
+ ${item.title} + ${item.num} + ${item.endTitle} +
+
+
+
+
+
${item.percent}
+
+
+ `; + }); + $('.joe_aside__item-contain').html(htmlStr); + } }; document.addEventListener('DOMContentLoaded', () => Joe()); diff --git a/core/core.php b/core/core.php index 55b4c24..bca76e7 100644 --- a/core/core.php +++ b/core/core.php @@ -1,10 +1,83 @@ 4) { + echo 'https://thirdqq.qlogo.cn/g?b=qq&nk=' . $qqMail . '&s=100'; + } else { + echo $gravatarsUrl . $md5MailLower . '?d=mm'; + } +}; + +function _getAsideAuthorMotto() +{ + $JMottoRandom = explode("\r\n", Helper::options()->JAside_Author_Motto); + echo $JMottoRandom[array_rand($JMottoRandom, 1)]; +} + +function _getAsideAuthorNav() +{ + if (Helper::options()->JAside_Author_Nav !== "off") { + $db = Typecho_Db::get(); + $adapterName = $db->getAdapterName(); + if ($adapterName == 'pgsql' || $adapterName == 'Pdo_Pgsql' || $adapterName == 'Pdo_SQLite' || $adapterName == 'SQLite') { + $order_by = 'RANDOM()'; + } else { + $order_by = 'RAND()'; + } + $result = $db->fetchAll( + $db->select() + ->from('table.contents') + ->where('status = ?', 'publish') + ->where('type = ?', 'post') + ->where('password IS NULL') + ->limit(Helper::options()->JAside_Author_Nav) + ->order($order_by) + ); + foreach ($result as $item) { + $obj = Typecho_Widget::widget('Widget_Abstract_Contents'); + $item = $obj->push($item); + $title = htmlspecialchars($item['title']); + $permalink = $item['permalink']; + echo " +
  • + {$title} + + + +
  • + "; + } + } +} + function themeFields($layout) { $aside = new Typecho_Widget_Helper_Form_Element_Radio( diff --git a/functions.php b/functions.php index 00f99a7..f14d6df 100644 --- a/functions.php +++ b/functions.php @@ -39,7 +39,7 @@ function themeConfig($form) 'JFavicon', NULL, 'https://cdn.jsdelivr.net/gh/HaoOuBa/Joe@master/favicon.ico', - '网站 Favicon 设置(非必填)', + '网站 Favicon 设置', '介绍:用于设置网站 Favicon,一个好的 Favicon 可以给用户一种很专业的观感
    格式:图片 URL地址 或 Base64 地址
    其他:免费转换 Favicon 网站 tool.lu/favicon' @@ -51,7 +51,7 @@ function themeConfig($form) 'JLogo', NULL, 'https://cdn.jsdelivr.net/gh/HaoOuBa/Joe@master/assets/img/logo.png', - '网站 Logo 设置(非必填)', + '网站 Logo 设置', '介绍:用于设置网站 Logo,一个好的 Logo 能为网站带来有效的流量
    格式:图片 URL地址 或 Base64 地址
    其他:免费制作 logo 网站 www.uugai.com' @@ -79,9 +79,10 @@ function themeConfig($form) 'JAside', array( 'author' => '作者栏', + 'timelife' => '计时栏', ), null, - '选择首页需要显示的侧边栏栏目(非必选)', + '选择首页需要显示的侧边栏栏目', '介绍:用于控制首页侧边栏的栏目显示规则
    注意:如果全部未选,则表示不开启侧边栏' ); @@ -92,11 +93,52 @@ function themeConfig($form) 'JAside_Author_Image', NULL, "https://cdn.jsdelivr.net/gh/HaoOuBa/Joe@master/assets/img/aside_author_image.jpg", - '作者栏 —— 背景(非必填)', + '作者栏 —— 背景', '介绍:用于修改作者栏的背景图片
    格式:图片地址
    注意:不填写时,则显示默认背景' ); $JAside_Author_Image->setAttribute('class', 'joe_content joe_aside'); $form->addInput($JAside_Author_Image); + + $JAside_Author_Link = new Typecho_Widget_Helper_Form_Element_Textarea( + 'JAside_Author_Link', + NULL, + "https://ae.js.cn", + '作者栏 —— 跳转链接', + '介绍:用于修改作者栏的跳转链接' + ); + $JAside_Author_Link->setAttribute('class', 'joe_content joe_aside'); + $form->addInput($JAside_Author_Link); + + $JAside_Author_Motto = new Typecho_Widget_Helper_Form_Element_Textarea( + 'JAside_Author_Motto', + NULL, + "有钱终成眷属,没钱亲眼目睹", + '作者栏 —— 座右铭', + '介绍:用于显示在侧边栏作者信息的座右铭。
    + 格式:可以填写多行也可以填写一行,填写多行时,每次随机显示其中的某一条' + ); + $JAside_Author_Motto->setAttribute('class', 'joe_content joe_aside'); + $form->addInput($JAside_Author_Motto); + + $JAside_Author_Nav = new Typecho_Widget_Helper_Form_Element_Select( + 'JAside_Author_Nav', + array( + 'off' => '关闭(默认)', + '3' => '开启,并显示3条最新文章', + '4' => '开启,并显示4条最新文章', + '5' => '开启,并显示5条最新文章', + '6' => '开启,并显示6条最新文章', + '7' => '开启,并显示7条最新文章', + '8' => '开启,并显示8条最新文章', + '9' => '开启,并显示9条最新文章', + '10' => '开启,并显示10条最新文章' + ), + 'off', + '作者栏 —— 随机文章数目', + '介绍:用于控制作者栏的随机文章条数' + ); + $JAside_Author_Nav->setAttribute('class', 'joe_content joe_aside'); + $form->addInput($JAside_Author_Nav->multiMode()); } ?> \ No newline at end of file diff --git a/index.php b/index.php index da9294b..e13d892 100644 --- a/index.php +++ b/index.php @@ -21,7 +21,7 @@ need('public/header.php'); ?>
    - 1 +
    need('public/aside.php'); ?>
    diff --git a/public/aside.php b/public/aside.php index c2f610f..0164265 100644 --- a/public/aside.php +++ b/public/aside.php @@ -2,7 +2,42 @@ diff --git a/public/header.php b/public/header.php index 429617f..528be8f 100644 --- a/public/header.php +++ b/public/header.php @@ -57,7 +57,7 @@