- 增加根目录静态属性
- 增加浏览页面懒加载
- 增加浏览页面启用选定日期查看图片
- 增加版本检测 ***每月10日06点和25日01点检测Github是否更新***
- 增加上传压缩 ***此压缩有可能使图片变大!特别是小图片 也有一定概率改变图片方向***
- 增加批量压缩目录 ***TinyImag或本机压缩,本机压缩出现的问题***
- 修复title
- 修复二级目录安装
- 修复对PHP5.6的兼容 ***建议使用php7.0及以上!***
This commit is contained in:
icret
2021-05-22 11:27:53 +08:00
parent fa9c9bdfd2
commit 2d7d5bfe66
40 changed files with 7166 additions and 319 deletions

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="margin: auto; background: rgb(241, 242, 243); display: block; shape-rendering: auto; animation-play-state: running; animation-delay: 0s;" width="200px" height="200px" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid">
<path d="M10 50A40 40 0 0 0 90 50A40 42 0 0 1 10 50" fill="#5be1da" stroke="none" style="animation-play-state: running; animation-delay: 0s;">
<animateTransform attributeName="transform" type="rotate" dur="1s" repeatCount="indefinite" keyTimes="0;1" values="0 50 51;360 50 51" style="animation-play-state: running; animation-delay: 0s;"></animateTransform>
</path>
<!-- [ldio] generated by https://loading.io/ --></svg>

After

Width:  |  Height:  |  Size: 771 B

BIN
public/images/top.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 434 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

179
public/static/lazyload.js Normal file
View File

@@ -0,0 +1,179 @@
(function () {
var root = (typeof self == 'object' && self.self == self && self) ||
(typeof global == 'object' && global.global == global && global) ||
this || {};
// 修复 bind 函数
Function.prototype.bind = Function.prototype.bind || function (context) {
if (typeof this !== "function") {
throw new Error("Function.prototype.bind - what is trying to be bound is not callable");
}
var self = this;
var args = Array.prototype.slice.call(arguments, 1);
var fNOP = function () { };
var fBound = function () {
var bindArgs = Array.prototype.slice.call(arguments);
self.apply(this instanceof fNOP ? this : context, args.concat(bindArgs));
}
fNOP.prototype = this.prototype;
fBound.prototype = new fNOP();
return fBound;
}
var util = {
extend: function (target) {
for (var i = 1, len = arguments.length; i < len; i++) {
for (var prop in arguments[i]) {
if (arguments[i].hasOwnProperty(prop)) {
target[prop] = arguments[i][prop]
}
}
}
return target
},
addEvent: function (elem, type, fn) {
if (document.addEventListener) {
elem.addEventListener(type, fn, false);
return fn;
} else if (document.attachEvent) {
var bound = function () {
return fn.apply(elem, arguments)
}
elem.attachEvent('on' + type, bound);
return bound;
}
},
removeEvent: function (elem, type, fn) {
if (document.removeEventListener) {
elem.removeEventListener(type, fn, false)
}
else {
elem.detachEvent("on" + type, fn)
}
}
}
function Lazy(opts) {
this.opts = util.extend({}, this.constructor.defaultOpts, opts)
this.init();
}
Lazy.VERSION = '1.0.0';
Lazy.defaultOpts = {
delay: 250,
useDebounce: false
}
var proto = Lazy.prototype;
proto.init = function () {
this.calulateView();
this.bindScrollEvent();
};
proto.calulateView = function () {
this.view = {
top: 0 - (parseInt(this.opts.top, 10) || 0),
bottom: (root.innerHeight || document.documentElement.clientHeight) + (parseInt(this.opts.bottom, 10) || 0),
left: 0 - (parseInt(this.opts.left, 10) || 0),
right: (root.innerWidth || document.documentElement.clientWidth) + (parseInt(this.opts.right, 10) || 0)
}
};
proto.bindScrollEvent = function () {
var scrollEvent = util.addEvent(root, 'scroll', this.handleLazyLoad.bind(this))
var loadEvent = util.addEvent(root, 'load', this.handleLazyLoad.bind(this))
this.event = {
scrollEvent: scrollEvent,
loadEvent: loadEvent
}
};
var timer = null;
proto.handleLazyLoad = function () {
var self = this;
if (!this.opts.useDebounce && !!timer) {
return;
}
clearTimeout(timer);
timer = setTimeout(function () {
timer = null;
self.render()
}, this.opts.delay);
};
proto.isHidden = function (element) {
return (element.offsetParent === null);
};
proto.checkInView = function (element) {
if (this.isHidden(element)) {
return false;
}
var rect = element.getBoundingClientRect();
return (rect.right >= this.view.left && rect.bottom >= this.view.top && rect.left <= this.view.right && rect.top <= this.view.bottom);
};
proto.render = function () {
var nodes = document.querySelectorAll('[data-image], [data-lazy-background]');
var length = nodes.length;
for (var i = 0; i < length; i++) {
elem = nodes[i];
if (this.checkInView(elem)) {
if (elem.getAttribute('data-lazy-background') !== null) {
elem.style.backgroundImage = 'url(' + elem.getAttribute('data-lazy-background') + ')';
} else if (elem.src !== (src = elem.getAttribute('data-image'))) {
elem.src = src;
}
elem.removeAttribute('data-image');
elem.removeAttribute('data-lazy-background');
if (this.opts.onload && typeof this.opts.onload === 'function') {
this.opts.onload(elem);
}
}
}
if (!length) {
this.unbindScrollEvent();
}
};
proto.unbindScrollEvent = function () {
util.removeEvent(root, 'scroll', this.event.scrollEvent)
util.removeEvent(root, 'load', this.event.loadEvent)
};
if (typeof exports != 'undefined' && !exports.nodeType) {
if (typeof module != 'undefined' && !module.nodeType && module.exports) {
exports = module.exports = Lazy;
}
exports.Lazy = Lazy;
} else {
root.Lazy = Lazy;
}
}());