This commit is contained in:
杜恒 2021-01-25 11:29:51 +08:00
parent 7d49bfe1cb
commit fd21fc6a49
15 changed files with 1888 additions and 1698 deletions

View File

@ -0,0 +1 @@
!function(){function t(){let t=document.getElementsByTagName("script"),e=t.length,n=t[e-1];return{length:e,z:-1000,opacity:n.getAttribute("opacity")||.5,color:n.getAttribute("color")||"0,0,0",count:n.getAttribute("count")||99}}function e(){W=i.width=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,H=i.height=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight}function n(){o.clearRect(0,0,W,H);var t,e,i=[y].concat(d);d.forEach(function(n){n.x+=n.xa,n.y+=n.ya,n.xa=n.xa*(n.x>W||n.x<0?-1:1),n.ya=n.ya*(n.y>H||n.y<0?-1:1),o.fillRect(n.x-.5,n.y-.5,1,1);for(let c=0;c<i.length;c++)t=i[c],n!==t&&null!==t.x&&null!==t.y&&(x_diff=n.x-t.x,y_diff=n.y-t.y,distance=x_diff*x_diff+y_diff*y_diff,distance<t.max&&(t===y&&distance>t.max/2&&(n.x=n.x-.03*x_diff,n.y=n.y-.03*y_diff),e=(t.max-distance)/t.max,o.beginPath(),o.lineWidth=e/2,o.strokeStyle="rgba("+a.color+","+(e+.2)+")",o.moveTo(n.x,n.y),o.lineTo(t.x,t.y),o.stroke()));i.splice(i.indexOf(n),1)}),r(n)}var i=document.createElement("canvas"),o=i.getContext("2d"),a=t();i.id="c_n"+a.length,i.style.cssText="position:fixed;top:0;left:0;z-index:"+a.z+";opacity:"+a.opacity,document.getElementsByTagName("body")[0].appendChild(i),e(),window.onresize=e;var c=Math.random,d=[];for(let t=0;t<a.count;t++){var l=c()*W,u=c()*H,m=2*c()-1,x=2*c()-1;d.push({x:l,y:u,xa:m,ya:x,max:6e3})}var y={x:null,y:null,max:2e4};window.onmousemove=function(t){t=t||window.event,y.x=t.clientX,y.y=t.clientY},window.onmouseout=function(){y.x=null,y.y=null};var r=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){window.setTimeout(t,1e3/45)};setTimeout(function(){n()},100)}();

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
function animate(a=0){const t=a>=finish+arcStagger*colors.length;let e=window.innerWidth*DPR,n=window.innerHeight*DPR;const o=.5*n/colors.length,i=e/2,r=n+o*rainbowHeight+(n-colors.length*o)/3,l=e/2+colors.length*o*2,s=n;let c=document.getElementById("rainbow").getContext("2d");c.clearRect(0,0,e,n),c.globalAlpha=1,c.lineWidth=o;for(let e=colors.length-1;e>-1;e--){const[n,d]=colors[e],h=r+e*(o/2-1),m=l-e*o/2,f=s-e*o/2,g=tau*(a-e*arcStagger)+start,u=clamp(start,tau*finish+start,g);if(c.beginPath(),c.shadowColor=n,c.strokeStyle=n,c.ellipse(i,h,m,f,0,start,u,!1),c.lineCap="round",c.stroke(),c.closePath(),t)sparkles.push(makeSparkle({cx:i,cy:h,radiusX:m,radiusY:f,endAngle:Math.random()*Math.PI+Math.PI,lineWidth:o,color:boolRandom()?"#fff":d}));else for(let a=0;a<sparklesInPerStripe;a++)sparkles.push(makeSparkle({cx:i,cy:h,radiusX:m,radiusY:f,endAngle:u,lineWidth:o,color:n}))}const d=[];for(let a=0,t=sparkles.length;a<t;a++){const{x:t,y:e,opacity:n,color:o,rad:i}=sparkles[a];c.beginPath(),c.globalAlpha=n,c.fillStyle=o,c.arc(t-i,e-i,i,0,Math.PI/2),c.arc(t-i,e+i,i,3*Math.PI/2,2*Math.PI),c.arc(t+i,e+i,i,Math.PI,3*Math.PI/2),c.arc(t+i,e-i,i,Math.PI/2,Math.PI),c.fill(),n>.2&&i>.2&&d.push({x:t,y:e,opacity:n-.03,rad:i-.2,color:o})}sparkles=d,t?requestAnimationFrame(function(){animate(finish+colors.length*arcStagger)}):requestAnimationFrame(function(){animate(a+inc)})}let canvasDom=document.createElement("canvas");canvasDom.setAttribute("id","rainbow"),canvasDom.setAttribute("style","background-color: #ffffffe0;z-index: -1000;position:fixed;top:0;left:0;right:0;bottom:0;"),document.body.appendChild(canvasDom);const DPR=window.devicePixelRatio,colors=[["#EC008C","#f957b6"],["#EF4136","#ff7972"],["yellow","#fff"],["lime","#7aff7a"],["#27AAE1","#5ec8f2"],["#662D91","#a158d8"]],tau=2*Math.PI,start=Math.PI,finish=.5,inc=.007,rainbowHeight=.5,arcStagger=.05,sparklesInPerStripe=3;let sparkles=[];const clamp=(a,t,e)=>Math.min(Math.max(a,e),t),boolRandom=()=>!Math.round(Math.random()),sizeCanvas=()=>{radius=clamp(15,50,window.innerWidth/60/DPR);const a=document.getElementById("rainbow");a.width=window.innerWidth*DPR,a.height=window.innerHeight*DPR},addRandom=function(a){return(boolRandom()?-1:1)*Math.random()*a},makeSparkle=({cx:a,cy:t,radiusX:e,radiusY:n,endAngle:o,lineWidth:i,color:r})=>({x:a+e*Math.cos(o)+addRandom(i),y:t+n*Math.sin(o)+addRandom(i),opacity:1,color:r,rad:Math.max(radius*Math.random()*DPR,15)});sizeCanvas(),requestAnimationFrame(function(){animate()}),window.addEventListener("resize",sizeCanvas);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
!function(){function e(e,t,n){return Number(e.getAttribute(t))||n}function t(){for(r.clearRect(0,0,h,s),a=[{x:0,y:.7*s+f},{x:0,y:.7*s-f}];a[1].x<h+f;)n(a[0],a[1])}function n(e,t){r.beginPath(),r.moveTo(e.x,e.y),r.lineTo(t.x,t.y);var n=t.x+(2*p()-.25)*f,o=i(t.y);r.lineTo(n,o),r.closePath(),m-=x/-50,r.fillStyle="#"+(127*y(m)+128<<16|127*y(m+x/3)+128<<8|127*y(m+x/3*2)+128).toString(16),r.fill(),a[0]=a[1],a[1]={x:n,y:o}}function i(e){return l=e+(2*p()-1.1)*f,l>s||l<0?i(e):l}var o=document.getElementsByTagName("script"),c=o[o.length-1];config={z:e(c,"zIndex",-1000),a:e(c,"alpha",.6),s:e(c,"size",90)};var a,l,d=document.createElement("canvas"),r=d.getContext("2d"),g=window.devicePixelRatio||1,h=window.innerWidth,s=window.innerHeight,f=config.s,u=Math,m=0,x=2*u.PI,y=u.cos,p=u.random;d.width=h*g,d.height=s*g,r.scale(g,g),r.globalAlpha=config.a,d.style.cssText="opacity: "+config.a+";position:fixed;top:0;left:0;z-index: "+config.z+";width:100%;height:100%;pointer-events:none;",document.getElementsByTagName("body")[0].appendChild(d),document.onclick=t,document.ontouchstart=t,t()}();

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -1 +1 @@
*{margin:0;padding:0;box-sizing:border-box;outline:none;-webkit-tap-highlight-color:transparent}::-webkit-scrollbar{width:8px}::-webkit-scrollbar-thumb{border-radius:4px;background:var(--seat)}::-webkit-scrollbar-track{background:transparent}body{font-size:14px;background:#f5f5f5;font-family:'Helvetica Neue', Helvetica, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', '微软雅黑', Arial, sans-serif}input[type='text']{-webkit-appearance:none;border-radius:0;font-size:13px;font-weight:500}textarea{resize:none;-webkit-appearance:none}li{list-style:none}a{text-decoration:none}h1,h2,h3,h4,h5,h6{font-weight:500}img{border:0;vertical-align:middle}img[src=''],img:not([src]){border:0;opacity:0}svg,canvas{vertical-align:middle}button{cursor:pointer;-webkit-appearance:none;font-size:13px}table{border-collapse:collapse;border-spacing:0}.joe_main{min-width:0;flex:1;padding:15px 0}.joe_container{display:flex;width:100%;margin:0 auto;padding:0 15px}@media (min-width: 576px){.joe_container{max-width:540px}}@media (min-width: 768px){.joe_container{max-width:720px}}@media (min-width: 992px){.joe_container{max-width:960px}}@media (min-width: 1200px){.joe_container{max-width:1140px}}@media (min-width: 1400px){.joe_container{max-width:1320px}}html{--background: #fff;--theme: #f24e4e;--main: #303133;--routine: #606266;--minor: #909399;--seat: #c0c4cc;--classA: #dcdfe6;--classB: #e4e7ed;--classC: #ebeef5;--classD: #f2f6fc;--text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);--box-shadow: 0px 0px 20px -5px rgba(158, 158, 158, 0.22)}html[dark='true']{--background: #303133;--box-shadow: none}
*{margin:0;padding:0;box-sizing:border-box;outline:none;-webkit-tap-highlight-color:transparent}::-webkit-scrollbar{width:8px}::-webkit-scrollbar-thumb{border-radius:4px;background:var(--seat)}::-webkit-scrollbar-track{background:transparent}body{font-size:14px;font-family:'Helvetica Neue', Helvetica, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', '微软雅黑', Arial, sans-serif}body::before{content:'';position:fixed;top:0;left:0;right:0;bottom:0;z-index:-520;pointer-events:none}input[type='text']{-webkit-appearance:none;border-radius:0;font-size:13px;font-weight:500}textarea{resize:none;-webkit-appearance:none}li{list-style:none}a{text-decoration:none}h1,h2,h3,h4,h5,h6{font-weight:500}img{border:0;vertical-align:middle}img[src=''],img:not([src]){border:0;opacity:0}svg,canvas{vertical-align:middle}button{cursor:pointer;-webkit-appearance:none;font-size:13px}table{border-collapse:collapse;border-spacing:0}.joe_main{min-width:0;flex:1;padding:15px 0}.joe_container{display:flex;width:100%;margin:0 auto;padding:0 15px}@media (min-width: 576px){.joe_container{max-width:540px}}@media (min-width: 768px){.joe_container{max-width:720px}}@media (min-width: 992px){.joe_container{max-width:960px}}@media (min-width: 1200px){.joe_container{max-width:1140px}}@media (min-width: 1400px){.joe_container{max-width:1320px}}html{--background: #fff;--theme: #f24e4e;--main: #303133;--routine: #606266;--minor: #909399;--seat: #c0c4cc;--classA: #dcdfe6;--classB: #e4e7ed;--classC: #ebeef5;--classD: #f2f6fc;--text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);--box-shadow: 0px 0px 20px -5px rgba(158, 158, 158, 0.22)}html[data-night='night']{--background: #303133;--box-shadow: none}

View File

@ -1,48 +1,58 @@
* {
margin: 0;
padding: 0;
box-sizing: border-box;
outline: none;
-webkit-tap-highlight-color: transparent;
margin: 0;
padding: 0;
box-sizing: border-box;
outline: none;
-webkit-tap-highlight-color: transparent;
}
::-webkit-scrollbar {
width: 8px;
width: 8px;
}
::-webkit-scrollbar-thumb {
border-radius: 4px;
background: var(--seat);
border-radius: 4px;
background: var(--seat);
}
::-webkit-scrollbar-track {
background: transparent;
background: transparent;
}
body {
font-size: 14px;
background: #f5f5f5;
font-family: 'Helvetica Neue', Helvetica, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', '微软雅黑', Arial, sans-serif;
font-size: 14px;
font-family: 'Helvetica Neue', Helvetica, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', '微软雅黑', Arial, sans-serif;
}
body::before {
content: '';
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: -520;
pointer-events: none;
}
input[type='text'] {
-webkit-appearance: none;
border-radius: 0;
font-size: 13px;
font-weight: 500;
-webkit-appearance: none;
border-radius: 0;
font-size: 13px;
font-weight: 500;
}
textarea {
resize: none;
-webkit-appearance: none;
resize: none;
-webkit-appearance: none;
}
li {
list-style: none;
list-style: none;
}
a {
text-decoration: none;
text-decoration: none;
}
h1,
@ -51,96 +61,91 @@ h3,
h4,
h5,
h6 {
font-weight: 500;
font-weight: 500;
}
img {
border: 0;
vertical-align: middle;
border: 0;
vertical-align: middle;
}
img[src=''],
img:not([src]) {
border: 0;
opacity: 0;
border: 0;
opacity: 0;
}
svg,
canvas {
vertical-align: middle;
vertical-align: middle;
}
button {
cursor: pointer;
-webkit-appearance: none;
font-size: 13px;
cursor: pointer;
-webkit-appearance: none;
font-size: 13px;
}
table {
border-collapse: collapse;
border-spacing: 0;
border-collapse: collapse;
border-spacing: 0;
}
.joe_main {
min-width: 0;
flex: 1;
padding: 15px 0;
min-width: 0;
flex: 1;
padding: 15px 0;
}
.joe_container {
display: flex;
width: 100%;
margin: 0 auto;
padding: 0 15px;
display: flex;
width: 100%;
margin: 0 auto;
padding: 0 15px;
}
@media (min-width: 576px) {
.joe_container {
max-width: 540px;
}
.joe_container {
max-width: 540px;
}
}
@media (min-width: 768px) {
.joe_container {
max-width: 720px;
}
.joe_container {
max-width: 720px;
}
}
@media (min-width: 992px) {
.joe_container {
max-width: 960px;
}
.joe_container {
max-width: 960px;
}
}
@media (min-width: 1200px) {
.joe_container {
max-width: 1140px;
}
.joe_container {
max-width: 1140px;
}
}
@media (min-width: 1400px) {
.joe_container {
max-width: 1320px;
}
.joe_container {
max-width: 1320px;
}
}
html {
--background: #fff;
--theme: #f24e4e;
--main: #303133;
--routine: #606266;
--minor: #909399;
--seat: #c0c4cc;
--classA: #dcdfe6;
--classB: #e4e7ed;
--classC: #ebeef5;
--classD: #f2f6fc;
--text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
--box-shadow: 0px 0px 20px -5px rgba(158, 158, 158, 0.22);
--background: #fff;
--theme: #f24e4e;
--main: #303133;
--routine: #606266;
--minor: #909399;
--seat: #c0c4cc;
--classA: #dcdfe6;
--classB: #e4e7ed;
--classC: #ebeef5;
--classD: #f2f6fc;
--text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
--box-shadow: 0px 0px 20px -5px rgba(158, 158, 158, 0.22);
}
html[dark='true'] {
--background: #303133;
--box-shadow: none;
html[data-night='night'] {
--background: #303133;
--box-shadow: none;
}

View File

@ -1,86 +1,105 @@
window.Joe = {
BASE_API: '/index.php/joe/api',
IS_MOBILE: /windows phone|iphone|android/gi.test(window.navigator.userAgent),
encryption: str => window.btoa(unescape(encodeURIComponent(str))),
decrypt: str => decodeURIComponent(escape(window.atob(str)))
}
console.time('Global.js执行时长')
console.time('Global.js执行时长');
document.addEventListener('DOMContentLoaded', () => {
/* 激活全局下拉框功能 */
{
$('.joe_dropdown').each(function (index, item) {
const menu = $(this).find('.joe_dropdown__menu')
const trigger = $(item).attr('trigger') || 'click'
const placement = $(item).attr('placement') || $(this).height() || 0
menu.css('top', placement)
if (trigger === 'hover') {
$(this).hover(
() => $(this).addClass('active'),
() => $(this).removeClass('active')
)
} else {
$(this).on('click', function (e) {
$(this).toggleClass('active')
$(document).one('click', () => $(this).removeClass('active'))
e.stopPropagation()
})
menu.on('click', e => e.stopPropagation())
}
})
}
/* 昼夜模式 */
{
if (localStorage.getItem('data-night')) {
$('html').attr('data-night', 'night');
$('.joe_action_item.mode .icon-1').addClass('active');
$('.joe_action_item.mode .icon-2').removeClass('active');
} else {
$('html').removeAttr('data-night');
$('.joe_action_item.mode .icon-1').removeClass('active');
$('.joe_action_item.mode .icon-2').addClass('active');
}
$('.joe_action_item.mode').on('click', () => {
if (localStorage.getItem('data-night')) {
$('.joe_action_item.mode .icon-1').removeClass('active');
$('.joe_action_item.mode .icon-2').addClass('active');
$('html').removeAttr('data-night');
localStorage.removeItem('data-night');
} else {
$('.joe_action_item.mode .icon-1').addClass('active');
$('.joe_action_item.mode .icon-2').removeClass('active');
$('html').attr('data-night', 'night');
localStorage.setItem('data-night', 'night');
}
});
}
/* 激活全局返回顶部功能 */
{
const handleScroll = () => ((document.documentElement.scrollTop || document.body.scrollTop) > 300 ? $('.joe_action_item.scroll').addClass('active') : $('.joe_action_item.scroll').removeClass('active'))
handleScroll()
$(window).on('scroll', () => handleScroll())
$('.joe_action_item.scroll').on('click', () => window.scrollTo({ top: 0, behavior: 'smooth' }))
}
/* 激活全局下拉框功能 */
{
$('.joe_dropdown').each(function (index, item) {
const menu = $(this).find('.joe_dropdown__menu');
const trigger = $(item).attr('trigger') || 'click';
const placement = $(item).attr('placement') || $(this).height() || 0;
menu.css('top', placement);
if (trigger === 'hover') {
$(this).hover(
() => $(this).addClass('active'),
() => $(this).removeClass('active')
);
} else {
$(this).on('click', function (e) {
$(this).toggleClass('active');
$(document).one('click', () => $(this).removeClass('active'));
e.stopPropagation();
});
menu.on('click', e => e.stopPropagation());
}
});
}
/* 激活侧边栏人生倒计时功能 */
{
if ($('.joe_aside__item.timelife').length !== 0) {
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 += `
/* 激活全局返回顶部功能 */
{
const handleScroll = () => ((document.documentElement.scrollTop || document.body.scrollTop) > 300 ? $('.joe_action_item.scroll').addClass('active') : $('.joe_action_item.scroll').removeClass('active'));
handleScroll();
$(window).on('scroll', () => handleScroll());
$('.joe_action_item.scroll').on('click', () => window.scrollTo({ top: 0, behavior: 'smooth' }));
}
/* 激活侧边栏人生倒计时功能 */
{
if ($('.joe_aside__item.timelife').length !== 0) {
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 += `
<div class="item">
<div class="title">
${item.title}
@ -93,56 +112,69 @@ document.addEventListener('DOMContentLoaded', () => {
</div>
<div class="progress-percentage">${item.percent}</div>
</div>
</div>`
})
$('.joe_aside__item.timelife .joe_aside__item-contain').html(htmlStr)
}
}
</div>`;
});
$('.joe_aside__item.timelife .joe_aside__item-contain').html(htmlStr);
}
}
/* 激活侧边栏天气功能 */
{
if ($('.joe_aside__item.weather').length !== 0) {
const key = $('.joe_aside__item.weather').attr('data-key')
const style = $('.joe_aside__item.weather').attr('data-style')
const aqiColor = { 1: 'FFFFFF', 2: '4A4A4A', 3: 'FFFFFF' }
window.WIDGET = { CONFIG: { layout: 2, width: '220', height: '270', background: style, dataColor: aqiColor[style], language: 'zh', key: key } }
}
}
/* 激活侧边栏天气功能 */
{
if ($('.joe_aside__item.weather').length !== 0) {
const key = $('.joe_aside__item.weather').attr('data-key');
const style = $('.joe_aside__item.weather').attr('data-style');
const aqiColor = { 1: 'FFFFFF', 2: '4A4A4A', 3: 'FFFFFF' };
window.WIDGET = { CONFIG: { layout: 2, width: '220', height: '270', background: style, dataColor: aqiColor[style], language: 'zh', key: key } };
}
}
/* 激活侧边栏排行榜功能 */
{
if ($('.joe_aside__item.ranking').length !== 0) {
$.ajax({
url: Joe.BASE_API,
type: 'POST',
data: { routeType: 'aside_ranking' },
success(res) {
$('.joe_aside__item.ranking .joe_aside__item-title .text').html(res.title)
let htmlStr = ''
if (res.code === 1) {
res.data.forEach((item, index) => {
htmlStr += `
/* 激活侧边栏排行榜功能 */
{
if ($('.joe_aside__item.ranking').length !== 0) {
$.ajax({
url: Joe.BASE_API,
type: 'POST',
data: { routeType: 'aside_ranking' },
success(res) {
$('.joe_aside__item.ranking .joe_aside__item-title .text').html(res.title);
let htmlStr = '';
if (res.code === 1) {
res.data.forEach((item, index) => {
htmlStr += `
<li class="item">
<span class="sort">${index + 1}</span>
<a class="link" href="${item.url}" title="${item.title}" target="_blank" rel="noopener noreferrer nofollow">${item.title}</a>
</li>
`
})
} else {
htmlStr += `<li class="error">数据抓取异常!</li>`
}
$('.joe_aside__item.ranking .joe_aside__item-contain').html(htmlStr)
}
})
}
}
`;
});
} else {
htmlStr += `<li class="error">数据抓取异常!</li>`;
}
$('.joe_aside__item.ranking .joe_aside__item-contain').html(htmlStr);
}
});
}
}
/* 设置侧边栏最后一个元素的高度 */
{
$('.joe_aside__item:last-child').css('top', $('.joe_header').height() + 15)
}
/* 懒加载 */
new LazyLoad('.lazyload')
/* 设置侧边栏最后一个元素的高度 */
{
$('.joe_aside__item:last-child').css('top', $('.joe_header').height() + 15);
}
console.timeEnd('Global.js执行时长')
})
/* 激活Live2d人物 */
{
if (Joe.LIVE2D !== 'off' && Joe.LIVE2D) {
$.getScript('https://cdn.jsdelivr.net/npm/live2d-widget@3.1.4/lib/L2Dwidget.min.js', () => {
L2Dwidget.init({
model: { jsonPath: Joe.LIVE2D, scale: 1 },
mobile: { show: false },
display: { position: 'right', width: 160, height: 200, hOffset: 70, vOffset: 0 }
});
});
}
}
/* 懒加载 */
new LazyLoad('.lazyload');
console.timeEnd('Global.js执行时长');
});

View File

@ -1,11 +1,15 @@
<?php
/* 页面加载计时 */
_startCountTime();
/* 主题开发API */
require_once('route.php');
/* 主题初始化 */
function themeInit($self)
{
/* 主题开放API 路由规则 */
$path_info = $self->request->getPathinfo();
if ($path_info === "/joe/api") {
@ -35,6 +39,26 @@ function _getVersion()
return "1.0.0";
};
function _isMobile()
{
if (isset($_SERVER['HTTP_X_WAP_PROFILE']))
return true;
if (isset($_SERVER['HTTP_VIA'])) {
return stristr($_SERVER['HTTP_VIA'], "wap") ? true : false;
}
if (isset($_SERVER['HTTP_USER_AGENT'])) {
$clientkeywords = array('nokia', 'sony', 'ericsson', 'mot', 'samsung', 'htc', 'sgh', 'lg', 'sharp', 'sie-', 'philips', 'panasonic', 'alcatel', 'lenovo', 'iphone', 'ipod', 'blackberry', 'meizu', 'android', 'netfront', 'symbian', 'ucweb', 'windowsce', 'palm', 'operamini', 'operamobi', 'openwave', 'nexusone', 'cldc', 'midp', 'wap', 'mobile');
if (preg_match("/(" . implode('|', $clientkeywords) . ")/i", strtolower($_SERVER['HTTP_USER_AGENT'])))
return true;
}
if (isset($_SERVER['HTTP_ACCEPT'])) {
if ((strpos($_SERVER['HTTP_ACCEPT'], 'vnd.wap.wml') !== false) && (strpos($_SERVER['HTTP_ACCEPT'], 'text/html') === false || (strpos($_SERVER['HTTP_ACCEPT'], 'vnd.wap.wml') < strpos($_SERVER['HTTP_ACCEPT'], 'text/html')))) {
return true;
}
}
return false;
}
/* 获取加密的文章标题 */
function _getEncryptionTitle($item, $type = true)
{
@ -66,10 +90,7 @@ function _parseContent($post)
echo $content;
}
/* 页面计时 */
timerStart();
function timerStart()
function _startCountTime()
{
global $timeStart;
$mTime = explode(' ', microtime());
@ -77,13 +98,13 @@ function timerStart()
return true;
}
function timerStop($precision = 3)
function _endCountTime($precision = 3)
{
global $timeStart, $timeEnd;
$mTime = explode(' ', microtime());
$timeEnd = $mTime[1] + $mTime[0];
$timeTotal = number_format($timeEnd - $timeStart, $precision);
echo '<span class="joe_time_count"><svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="15" height="15"><path d="M872 64c13.2544 0 24 10.7456 24 24 0 13.2544-10.7456 24-24 24h-104v177.456c0 67.0672-36.4912 128.8224-95.2368 161.1744l-111.0816 61.1744 111.328 61.536C731.6176 605.7328 768 667.4112 768 734.376V912h104c13.2544 0 24 10.7456 24 24 0 13.2544-10.7456 24-24 24H152c-13.2544 0-24-10.7456-24-24 0-13.2544 10.7456-24 24-24h104V734.544c0-67.0672 36.4912-128.8224 95.2368-161.1744l111.08-61.176-111.328-61.5328C292.3824 418.2656 256 356.5872 256 289.6224V112H152c-13.2544 0-24-10.7456-24-24 0-13.2544 10.7456-24 24-24h720zM512.4 539.4112l-138.0064 76.0032A136 136 0 0 0 304 734.544V912h416V734.3776a136 136 0 0 0-70.2096-119.0272l-137.3904-75.9392zM720 112H304v177.6224a136 136 0 0 0 70.2096 119.0272l137.3904 75.9392 138.0064-76.0032A136 136 0 0 0 720 289.456V112z" fill="#979797" p-id="2750"></path></svg>' . ($timeTotal < 1 ? $timeTotal * 1000 . 'ms' : $timeTotal . 's') . '</span>';
echo $timeTotal < 1 ? $timeTotal * 1000 . 'ms' : $timeTotal . 's';
}
function _getAvatarByMail($mail)

View File

@ -187,6 +187,46 @@ function themeConfig($form)
$JFooter_Right->setAttribute('class', 'joe_content joe_global');
$form->addInput($JFooter_Right);
/* Live2d */
$JLive2d = new Typecho_Widget_Helper_Form_Element_Select(
'JLive2d',
array(
'off' => '关闭(默认)',
'https://cdn.jsdelivr.net/npm/live2d-widget-model-shizuku@1.0.5/assets/shizuku.model.json' => 'shizuku',
'https://cdn.jsdelivr.net/npm/live2d-widget-model-izumi@1.0.5/assets/izumi.model.json' => 'izumi',
'https://cdn.jsdelivr.net/npm/live2d-widget-model-haru@1.0.5/01/assets/haru01.model.json' => 'haru01',
'https://cdn.jsdelivr.net/npm/live2d-widget-model-haru@1.0.5/02/assets/haru02.model.json' => 'haru02',
'https://cdn.jsdelivr.net/npm/live2d-widget-model-wanko@1.0.5/assets/wanko.model.json' => 'wanko',
'https://cdn.jsdelivr.net/npm/live2d-widget-model-hijiki@1.0.5/assets/hijiki.model.json' => 'hijiki',
'https://cdn.jsdelivr.net/npm/live2d-widget-model-koharu@1.0.5/assets/koharu.model.json' => 'koharu',
'https://cdn.jsdelivr.net/npm/live2d-widget-model-z16@1.0.5/assets/z16.model.json' => 'z16',
'https://cdn.jsdelivr.net/npm/live2d-widget-model-haruto@1.0.5/assets/haruto.model.json' => 'haruto',
'https://cdn.jsdelivr.net/npm/live2d-widget-model-tororo@1.0.5/assets/tororo.model.json' => 'tororo',
'https://cdn.jsdelivr.net/npm/live2d-widget-model-chitose@1.0.5/assets/chitose.model.json' => 'chitose',
'https://cdn.jsdelivr.net/npm/live2d-widget-model-miku@1.0.5/assets/miku.model.json' => 'miku',
'https://cdn.jsdelivr.net/npm/live2d-widget-model-epsilon2_1@1.0.5/assets/Epsilon2.1.model.json' => 'Epsilon2.1',
'https://cdn.jsdelivr.net/npm/live2d-widget-model-unitychan@1.0.5/assets/unitychan.model.json' => 'unitychan',
'https://cdn.jsdelivr.net/npm/live2d-widget-model-nico@1.0.5/assets/nico.model.json' => 'nico',
'https://cdn.jsdelivr.net/npm/live2d-widget-model-rem@1.0.1/assets/rem.model.json' => 'rem',
'https://cdn.jsdelivr.net/npm/live2d-widget-model-nito@1.0.5/assets/nito.model.json' => 'nito',
'https://cdn.jsdelivr.net/npm/live2d-widget-model-nipsilon@1.0.5/assets/nipsilon.model.json' => 'nipsilon',
'https://cdn.jsdelivr.net/npm/live2d-widget-model-ni-j@1.0.5/assets/ni-j.model.json' => 'ni-j',
'https://cdn.jsdelivr.net/npm/live2d-widget-model-nietzsche@1.0.5/assets/nietzche.model.json' => 'nietzche',
'https://cdn.jsdelivr.net/npm/live2d-widget-model-platelet@1.1.0/assets/platelet.model.json' => 'platelet',
'https://cdn.jsdelivr.net/npm/live2d-widget-model-isuzu@1.0.4/assets/model.json' => 'isuzu',
'https://cdn.jsdelivr.net/npm/live2d-widget-model-jth@1.0.0/assets/model/katou_01/katou_01.model.json' => 'katou_01',
'https://cdn.jsdelivr.net/npm/live2d-widget-model-mikoto@1.0.0/assets/mikoto.model.json' => 'mikoto',
'https://cdn.jsdelivr.net/npm/live2d-widget-model-mashiro-seifuku@1.0.1/assets/seifuku.model.json' => 'seifuku',
'https://cdn.jsdelivr.net/npm/live2d-widget-model-ichigo@1.0.1/assets/ichigo.model.json' => 'ichigo',
'https://cdn.jsdelivr.net/npm/live2d-widget-model-hk_fos@1.0.0/assets/hk416.model.json' => 'hk416'
),
'off',
'选择一款喜爱的Live2D动态人物模型',
'介绍:开启后会在右下角显示一个小人'
);
$JLive2d->setAttribute('class', 'joe_content joe_global');
$form->addInput($JLive2d->multiMode());
$JAside = new Typecho_Widget_Helper_Form_Element_Checkbox(
'JAside',
array(
@ -421,6 +461,48 @@ function themeConfig($form)
$JLazyload->setAttribute('class', 'joe_content joe_image');
$form->addInput($JLazyload);
$JDynamic_Background = new Typecho_Widget_Helper_Form_Element_Select(
'JDynamic_Background',
array(
'off' => '关闭(默认)',
'backdrop1.js' => '效果1',
'backdrop2.js' => '效果2',
'backdrop3.js' => '效果3',
'backdrop4.js' => '效果4',
'backdrop5.js' => '效果5',
'backdrop6.js' => '效果6'
),
'off',
'是否开启动态背景图仅限PC',
'介绍用于设置PC端动态背景如果下方填写了PC端静态壁纸则优先显示下方静态壁纸
注意:手机端是不支持此项的'
);
$JDynamic_Background->setAttribute('class', 'joe_content joe_image');
$form->addInput($JDynamic_Background->multiMode());
$JWallpaper_Background_PC = new Typecho_Widget_Helper_Form_Element_Textarea(
'JWallpaper_Background_PC',
NULL,
NULL,
'PC端网站背景图片非必填',
'介绍PC端网站的背景图片不填写时显示默认的灰色。<br />
格式图片URL地址 随机图片api 例如http://api.btstu.cn/sjbz/?lx=dongman <br />
注意:此项设置会优先显示,如果开启上方动态壁纸,会覆盖上方动态壁纸!'
);
$JWallpaper_Background_PC->setAttribute('class', 'joe_content joe_image');
$form->addInput($JWallpaper_Background_PC);
$JWallpaper_Background_WAP = new Typecho_Widget_Helper_Form_Element_Textarea(
'JWallpaper_Background_WAP',
NULL,
NULL,
'WAP端网站背景图片非必填',
'介绍WAP端网站的背景图片不填写时显示默认的灰色。<br />
格式图片URL地址 随机图片api 例如http://api.btstu.cn/sjbz/?lx=m_dongman'
);
$JWallpaper_Background_WAP->setAttribute('class', 'joe_content joe_image');
$form->addInput($JWallpaper_Background_WAP);
$JIndex_Carousel = new Typecho_Widget_Helper_Form_Element_Textarea(
'JIndex_Carousel',
NULL,

View File

@ -2,7 +2,6 @@
<div class="joe_container">
<div class="left">
<?php $this->options->JFooter_Left() ?>
<?php timerStop(); ?>
</div>
<div class="right">
<?php $this->options->JFooter_Right() ?>
@ -16,4 +15,18 @@
<path d="M725.902222 498.915556c18.204444-251.448889-93.297778-410.737778-205.368889-475.591112l-6.257777-3.982222-6.257778 3.413334c-111.502222 64.853333-224.711111 224.142222-204.8 475.591111-55.751111 53.475556-80.213333 116.622222-80.213334 204.8v15.36l179.2-35.271111c11.377778 40.391111 58.595556 69.973333 113.208889 69.973333 54.613333 0 101.262222-29.582222 112.64-68.835556l180.337778 36.408889V705.422222c-0.568889-89.884444-25.031111-153.6-82.488889-206.506666zM571.733333 392.533333c-33.564444 31.288889-87.04 28.444444-118.328889-5.12s-28.444444-87.04 5.12-117.76c33.564444-31.288889 87.04-28.444444 118.328889 5.12s28.444444 86.471111-5.12 117.76zM515.413333 761.173333c-35.84 0-64.284444 29.013333-64.284444 64.284445 0 35.84 54.044444 182.613333 64.284444 182.613333s64.284444-146.773333 64.284445-182.613333c0-35.271111-29.013333-64.284444-64.284445-64.284445z"></path>
</svg>
</div>
</div>
<div class="joe_action_item mode">
<svg class="icon-1" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="25" height="25">
<path d="M587.264 104.96c33.28 57.856 52.224 124.928 52.224 196.608 0 218.112-176.128 394.752-393.728 394.752-29.696 0-58.368-3.584-86.528-9.728 64.512 145.92 209.92 247.808 379.392 247.808 229.376 0 414.72-186.368 414.72-416.256 1.024-212.992-159.744-389.12-366.08-413.184z"></path>
<path d="M340.48 567.808l-23.552-70.144-70.144-23.552L316.928 450.56l23.552-70.144L364.032 450.56l70.144 23.552-70.144 23.552-23.552 70.144zM168.96 361.472l-30.208-91.136-91.648-30.208L138.24 209.92l30.72-91.648 30.208 91.136 91.136 30.208-91.136 30.208L168.96 361.472z"></path>
</svg>
<svg class="icon-2" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="25" height="25">
<path d="M512 512m-277.76 0a277.76 277.76 0 1 0 555.52 0 277.76 277.76 0 1 0-555.52 0Z"></path>
<path d="M512 187.733333a42.666667 42.666667 0 0 1-42.666667-42.666666V42.666667a42.666667 42.666667 0 0 1 85.333334 0v102.826666a42.666667 42.666667 0 0 1-42.666667 42.24zM253.013333 295.253333a42.666667 42.666667 0 0 1-29.866666-12.373333L150.186667 209.493333a42.666667 42.666667 0 0 1 59.306666-59.306666l73.386667 72.96a42.666667 42.666667 0 0 1 0 59.733333 42.666667 42.666667 0 0 1-29.866667 12.373333zM145.493333 554.666667H42.666667a42.666667 42.666667 0 0 1 0-85.333334h102.826666a42.666667 42.666667 0 0 1 0 85.333334zM179.626667 886.613333a42.666667 42.666667 0 0 1-29.44-72.106666l72.96-73.386667a42.666667 42.666667 0 0 1 59.733333 59.733333l-73.386667 73.386667a42.666667 42.666667 0 0 1-29.866666 12.373333zM512 1024a42.666667 42.666667 0 0 1-42.666667-42.666667v-102.826666a42.666667 42.666667 0 0 1 85.333334 0V981.333333a42.666667 42.666667 0 0 1-42.666667 42.666667zM844.373333 886.613333a42.666667 42.666667 0 0 1-29.866666-12.373333l-73.386667-73.386667a42.666667 42.666667 0 0 1 0-59.733333 42.666667 42.666667 0 0 1 59.733333 0l72.96 73.386667a42.666667 42.666667 0 0 1-29.44 72.106666zM981.333333 554.666667h-102.826666a42.666667 42.666667 0 1 1 0-85.333334H981.333333a42.666667 42.666667 0 0 1 0 85.333334zM770.986667 295.253333a42.666667 42.666667 0 0 1-29.866667-12.373333 42.666667 42.666667 0 0 1 0-59.733333l73.386667-72.96a42.666667 42.666667 0 1 1 59.306666 59.306666l-72.96 73.386667a42.666667 42.666667 0 0 1-29.866666 12.373333z"></path>
</svg>
</div>
</div>
<script>
console.log("PHP输出页面时长: <?php _endCountTime(); ?>")
</script>

View File

@ -9,6 +9,32 @@
<link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/joe.normalize.css'); ?>">
<link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/joe.global.css'); ?>">
<link rel="stylesheet" href="https://apip.weatherdt.com/standard/static/css/weather-standard.css">
<script>
window.Joe = {
LIVE2D: '<?php $this->options->JLive2d() ?>', // Live2d
BASE_API: '/index.php/joe/api', // 请求基准URL
DYNAMIC_BACKGROUND: '<?php $this->options->JDynamic_Background() ?>', // 动态背景
WALLPAPER_BACKGROUND_PC: '<?php $this->options->JWallpaper_Background_PC() ?>', // PC端静态背景
WALLPAPER_BACKGROUND_WAP: '<?php $this->options->JWallpaper_Background_WAP() ?>', // WAP端静态背景
IS_MOBILE: /windows phone|iphone|android/gi.test(window.navigator.userAgent), // 是否是手机端
encryption: str => window.btoa(unescape(encodeURIComponent(str))), // 加密字符串
decrypt: str => decodeURIComponent(escape(window.atob(str))), // 解密字符串
}
</script>
<style>
body::before {
background: <?php
if (_isMobile()) {
echo $this->options->JWallpaper_Background_WAP ? "url(" . $this->options->JWallpaper_Background_WAP . ")" : "#f5f5f5";
} else {
echo $this->options->JWallpaper_Background_PC ? "url(" . $this->options->JWallpaper_Background_PC . ")" : "#f5f5f5";
}
?>;
background-position: center 0;
background-repeat: no-repeat;
background-size: cover;
}
</style>
<script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/HaoOuBa/Joe@master/assets/js/joe.scroll.js"></script>
<script src="https://cdn.jsdelivr.net/gh/HaoOuBa/Joe@master/assets/js/joe.lazyload.js"></script>