From 6fea990824680a1036ed3f7c729210da09228ac6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=9C=E6=81=92?= <2323333339@qq.com> Date: Mon, 25 Jan 2021 12:30:39 +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/backdrop/backdrop1.js | 2 +- assets/backdrop/backdrop2.js | 142 +++++++++++++++++++++++++++++++++- assets/css/joe.normalize.css | 2 +- assets/css/joe.normalize.scss | 2 +- assets/js/joe.global.js | 9 +++ functions.php | 6 +- public/include.php | 3 +- 7 files changed, 157 insertions(+), 9 deletions(-) diff --git a/assets/backdrop/backdrop1.js b/assets/backdrop/backdrop1.js index 8db6945..8e3a6c3 100644 --- a/assets/backdrop/backdrop1.js +++ b/assets/backdrop/backdrop1.js @@ -1 +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;ct.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;tW||0>F.x?-1:1,F.ya*=F.y>H||0>F.y?-1:1,j.fillRect(F.x-0.5,F.y-0.5,1,1);for(var G=0;GC.max/2&&(F.x-=0.03*x_diff,F.y-=0.03*y_diff),D=(C.max-distance)/C.max,j.beginPath(),j.lineWidth=D/2,j.strokeStyle='rgba('+k.color+','+(D+0.2)+')',j.moveTo(F.x,F.y),j.lineTo(C.x,C.y),j.stroke()));E.splice(E.indexOf(F),1)}),B(g)}var h=document.createElement('canvas'),j=h.getContext('2d'),k=function(){var C=document.getElementsByTagName('script'),D=C.length,E=C[D-1];return{length:D,z:-520,opacity:E.getAttribute('opacity')||0.5,color:E.getAttribute('color')||'0,0,0',count:E.getAttribute('count')||99}}();h.id='c_n'+k.length,h.style.cssText='position:fixed;top:0;left:0;z-index:'+k.z+';opacity:'+k.opacity,document.getElementsByTagName('body')[0].appendChild(h),f(),window.onresize=f;for(var p=Math.random,q=[],C=0;C5?"right":"left",i=1e3,n=200,s=0-n,e=this._width+n,a=0,r=0,l="right"===t?s:e,c=Math.round(o(0,this._height));/^(top|min)$/i.test(this._options.verticalPosition)?c=0+n:/^(middle|center)$/i.test(this._options.verticalPosition)?c=this._height/2:/^(bottom|max)$/i.test(this._options.verticalPosition)&&(c=this._height-n);for(var _=[],p=new h(l,c),d=new h(l,c),u=null,f=Math.round(o(0,360)),b=0;!(i<=0);){if(i--,a=Math.round((1*Math.random()-.2)*this._options.horizontalSpeed),r=Math.round((1*Math.random()-.5)*(.25*this._height)),u=new h,u.copy(d),"right"===t){if(u.add(a,r),d.x>=e)break}else if("left"===t&&(u.subtract(a,r),d.x<=s))break;_.push({point1:new h(p.x,p.y),point2:new h(d.x,d.y),point3:u,color:f,delay:b,dir:t,alpha:0,phase:0}),p.copy(d),d.copy(u),b+=4,f+=this._options.colorCycleSpeed}this._ribbons.push(_)},_drawRibbonSection:function(t){if(t){if(t.phase>=1&&t.alpha<=0)return!0;if(t.delay<=0){if(t.phase+=.02,t.alpha=1*Math.sin(t.phase),t.alpha=t.alpha<=0?0:t.alpha,t.alpha=t.alpha>=1?1:t.alpha,this._options.animateSections){var i=.1*Math.sin(1+t.phase*Math.PI/2);"right"===t.dir?(t.point1.add(i,0),t.point2.add(i,0),t.point3.add(i,0)):(t.point1.subtract(i,0),t.point2.subtract(i,0),t.point3.subtract(i,0)),t.point1.add(0,i),t.point2.add(0,i),t.point3.add(0,i)}}else t.delay-=.5;var n=this._options.colorSaturation,o=this._options.colorBrightness,s="hsla("+t.color+", "+n+", "+o+", "+t.alpha+" )";this._context.save(),0!==this._options.parallaxAmount&&this._context.translate(0,this._scroll*this._options.parallaxAmount),this._context.beginPath(),this._context.moveTo(t.point1.x,t.point1.y),this._context.lineTo(t.point2.x,t.point2.y),this._context.lineTo(t.point3.x,t.point3.y),this._context.fillStyle=s,this._context.fill(),this._options.strokeSize>0&&(this._context.lineWidth=this._options.strokeSize,this._context.strokeStyle=s,this._context.lineCap="round",this._context.stroke()),this._context.restore()}return!1},_onDraw:function(){for(var t=0,i=this._ribbons.length;t=s&&(this._ribbons[n]=null)}this._ribbons.length 5 ? 'right' : 'left', + i = 1e3, + n = 200, + s = 0 - n, + e = this._width + n, + a = 0, + r = 0, + l = 'right' === t ? s : e, + c = Math.round(o(0, this._height)); + /^(top|min)$/i.test(this._options.verticalPosition) ? (c = 0 + n) : /^(middle|center)$/i.test(this._options.verticalPosition) ? (c = this._height / 2) : /^(bottom|max)$/i.test(this._options.verticalPosition) && (c = this._height - n); + for (var _ = [], p = new h(l, c), d = new h(l, c), u = null, f = Math.round(o(0, 360)), b = 0; !(i <= 0); ) { + if ((i--, (a = Math.round((1 * Math.random() - 0.2) * this._options.horizontalSpeed)), (r = Math.round((1 * Math.random() - 0.5) * (0.25 * this._height))), (u = new h()), u.copy(d), 'right' === t)) { + if ((u.add(a, r), d.x >= e)) break; + } else if ('left' === t && (u.subtract(a, r), d.x <= s)) break; + _.push({ point1: new h(p.x, p.y), point2: new h(d.x, d.y), point3: u, color: f, delay: b, dir: t, alpha: 0, phase: 0 }), p.copy(d), d.copy(u), (b += 4), (f += this._options.colorCycleSpeed); + } + this._ribbons.push(_); + }, + _drawRibbonSection: function (t) { + if (t) { + if (t.phase >= 1 && t.alpha <= 0) return !0; + if (t.delay <= 0) { + if (((t.phase += 0.02), (t.alpha = 1 * Math.sin(t.phase)), (t.alpha = t.alpha <= 0 ? 0 : t.alpha), (t.alpha = t.alpha >= 1 ? 1 : t.alpha), this._options.animateSections)) { + var i = 0.1 * Math.sin(1 + (t.phase * Math.PI) / 2); + 'right' === t.dir ? (t.point1.add(i, 0), t.point2.add(i, 0), t.point3.add(i, 0)) : (t.point1.subtract(i, 0), t.point2.subtract(i, 0), t.point3.subtract(i, 0)), t.point1.add(0, i), t.point2.add(0, i), t.point3.add(0, i); + } + } else t.delay -= 0.5; + var n = this._options.colorSaturation, + o = this._options.colorBrightness, + s = 'hsla(' + t.color + ', ' + n + ', ' + o + ', ' + t.alpha + ' )'; + this._context.save(), 0 !== this._options.parallaxAmount && this._context.translate(0, this._scroll * this._options.parallaxAmount), this._context.beginPath(), this._context.moveTo(t.point1.x, t.point1.y), this._context.lineTo(t.point2.x, t.point2.y), this._context.lineTo(t.point3.x, t.point3.y), (this._context.fillStyle = s), this._context.fill(), this._options.strokeSize > 0 && ((this._context.lineWidth = this._options.strokeSize), (this._context.strokeStyle = s), (this._context.lineCap = 'round'), this._context.stroke()), this._context.restore(); + } + return !1; + }, + _onDraw: function () { + for (var t = 0, i = this._ribbons.length; t < i; ++t) this._ribbons[t] || this._ribbons.splice(t, 1); + this._context.clearRect(0, 0, this._width, this._height); + for (var n = 0; n < this._ribbons.length; ++n) { + for (var o = this._ribbons[n], s = o.length, h = 0, e = 0; e < s; ++e) this._drawRibbonSection(o[e]) && h++; + h >= s && (this._ribbons[n] = null); + } + this._ribbons.length < this._options.ribbonCount && this.addRibbon(), requestAnimationFrame(this._onDraw); + }, + _onResize: function (t) { + var i = s(t); + (this._width = i.width), (this._height = i.height), this._canvas && ((this._canvas.width = this._width), (this._canvas.height = this._height), this._context && (this._context.globalAlpha = this._options.colorAlpha)); + }, + _onScroll: function (t) { + var i = s(t); + this._scroll = i.scrolly; + } + }), + e + ); +}), + new Ribbons(); diff --git a/assets/css/joe.normalize.css b/assets/css/joe.normalize.css index 49fed2e..419cf5f 100644 --- a/assets/css/joe.normalize.css +++ b/assets/css/joe.normalize.css @@ -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;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} +*{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:-521;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} diff --git a/assets/css/joe.normalize.scss b/assets/css/joe.normalize.scss index 416a0b7..8fd7d2a 100644 --- a/assets/css/joe.normalize.scss +++ b/assets/css/joe.normalize.scss @@ -31,7 +31,7 @@ body::before { left: 0; right: 0; bottom: 0; - z-index: -520; + z-index: -521; pointer-events: none; } diff --git a/assets/js/joe.global.js b/assets/js/joe.global.js index cba2a8f..b171682 100644 --- a/assets/js/joe.global.js +++ b/assets/js/joe.global.js @@ -27,6 +27,15 @@ document.addEventListener('DOMContentLoaded', () => { }); } + /* 动态背景 */ + { + if (!Joe.IS_MOBILE) { + if (Joe.DYNAMIC_BACKGROUND !== 'off' && Joe.DYNAMIC_BACKGROUND && !Joe.WALLPAPER_BACKGROUND_PC) { + $.getScript(`https://cdn.jsdelivr.net/gh/HaoOuBa/Joe@master/assets/backdrop/${Joe.DYNAMIC_BACKGROUND}`); + } + } + } + /* 激活全局下拉框功能 */ { $('.joe_dropdown').each(function (index, item) { diff --git a/functions.php b/functions.php index 9b03c90..9119517 100644 --- a/functions.php +++ b/functions.php @@ -474,8 +474,8 @@ function themeConfig($form) ), 'off', '是否开启动态背景图(仅限PC)', - '介绍:用于设置PC端动态背景,如果下方填写了PC端静态壁纸,则优先显示下方静态壁纸! - 注意:手机端是不支持此项的' + '介绍:用于设置PC端动态背景
+ 注意:如果您填写了下方PC端静态壁纸,将优先展示下方静态壁纸!如需显示动态壁纸,请将PC端静态壁纸设置成空' ); $JDynamic_Background->setAttribute('class', 'joe_content joe_image'); $form->addInput($JDynamic_Background->multiMode()); @@ -487,7 +487,7 @@ function themeConfig($form) 'PC端网站背景图片(非必填)', '介绍:PC端网站的背景图片,不填写时显示默认的灰色。
格式:图片URL地址 或 随机图片api 例如:http://api.btstu.cn/sjbz/?lx=dongman
- 注意:此项设置会优先显示,如果开启上方动态壁纸,会覆盖上方动态壁纸!' + 注意:如果需要显示上方动态壁纸,请不要填写此项,此项优先级最高!' ); $JWallpaper_Background_PC->setAttribute('class', 'joe_content joe_image'); $form->addInput($JWallpaper_Background_PC); diff --git a/public/include.php b/public/include.php index cdcc6b2..6b56fea 100644 --- a/public/include.php +++ b/public/include.php @@ -14,8 +14,7 @@ LIVE2D: 'options->JLive2d() ?>', // Live2d BASE_API: '/index.php/joe/api', // 请求基准URL DYNAMIC_BACKGROUND: 'options->JDynamic_Background() ?>', // 动态背景 - WALLPAPER_BACKGROUND_PC: 'options->JWallpaper_Background_PC() ?>', // PC端静态背景 - WALLPAPER_BACKGROUND_WAP: 'options->JWallpaper_Background_WAP() ?>', // WAP端静态背景 + WALLPAPER_BACKGROUND_PC: 'options->JWallpaper_Background_PC() ?>', // 是否填写了PC端静态壁纸 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))), // 解密字符串