This commit is contained in:
icret
2024-01-19 22:21:12 +08:00
parent a1e80599dd
commit fe237dd712
58 changed files with 1944 additions and 2355 deletions

View File

@@ -1,97 +1,67 @@
/** 图片列表*/
@media screen and (min-width:960px) {
.listNum img {
width: 258px;
height: 258px;
}
}
@media screen and (max-width:960px) {
.listNum img {
width: 358px;
height: 258px;
}
}
/** 返回顶部*/
* {
list-style: none;
border: 0;
}
#rocket-to-top div {
left: 0;
margin: 0;
overflow: hidden;
padding: 0;
position: absolute;
top: 0;
width: 110px;
}
#rocket-to-top .level-2 {
background: url("../images/rocket_button_up.png") no-repeat scroll -149px 0 transparent;
display: none;
height: 250px;
opacity: 0;
z-index: 1;
}
#rocket-to-top .level-3 {
background: none repeat scroll 0 0 transparent;
cursor: pointer;
display: block;
height: 150px;
z-index: 2;
}
#rocket-to-top {
background: url("../images/rocket_button_up.png") no-repeat scroll 0 0 transparent;
cursor: default;
display: block;
height: 250px;
margin: -125px 0 0;
overflow: hidden;
padding: 0;
position: fixed;
right: 0;
top: 80%;
width: 110px;
z-index: 11;
}
.cards {
padding-top: 0px;
padding-bottom: 0px;
margin-right: 0px;
margin-left: 0px;
}
.card {
box-shadow: rgba(0, 0, 0, 0.45) 0px 25px 20px -20px;
border-radius: 5px 5px 5px 5px;
}
img {
cursor: pointer;
transition: all 0.8s;
}
img:hover {
transform: scale(1.5);
position: relative;
z-index: 100;
}
.bottom-bar {
opacity: 0;
width: 100%;
position: absolute;
bottom: 0.1px;
background-color: rgba(0, 0, 0, 0.5);
}
.bottom-bar:hover {
opacity: 1;
}
/* 返回顶部 */
.btn-back-to-top {
padding: 0.5rem 1rem;
position: fixed;
right: 2rem;
bottom: 1rem;
z-index: 2;
-webkit-transition: -webkit-transform 0.2s ease;
transition: transform 0.2s ease;
-webkit-transform: translateY(200%);
transform: translateY(200%);
}
.btn-back-to-top.scrolled {
-webkit-transform: translateY(0);
transform: translateY(0);
}
/** 图片列表*/
@media screen and (min-width:960px) {
.listNum img {
width: 258px;
height: 258px;
}
}
@media screen and (max-width:960px) {
.listNum img {
width: 358px;
height: 258px;
}
}
.cards {
padding-top: 0px;
padding-bottom: 0px;
margin-right: 0px;
margin-left: 0px;
}
.card {
box-shadow: rgba(0, 0, 0, 0.45) 0px 25px 20px -20px;
border-radius: 5px 5px 5px 5px;
}
img {
cursor: pointer;
transition: all 0.8s;
}
img:hover {
transform: scale(1.5);
position: relative;
z-index: 100;
}
.bottom-bar {
opacity: 0;
width: 100%;
position: absolute;
bottom: 0.1px;
background-color: rgba(0, 0, 0, 0.5);
}
.bottom-bar:hover {
opacity: 1;
}

View File

@@ -1,213 +1,56 @@
/**
* 来自于copy_btn.js paste.js合并
* 简单图床-复制链接
* 2023-01-30
* 2023-04-20
* @param {*} copyID 传入的ID
* @param {*} loadClass 传入的class
*/
document.getElementsByClassName('copyBtn1')[0].onclick = function () {
var copyVal = document.getElementById("links");
function uploadCopy(copyID, loadClass) {
var copyVal = document.getElementById(copyID);
copyVal.select();
// 复制内容为空时的提示
if (copyVal.value.length === 0) { new $.zui.Messager("复制内容为空", { type: "danger", icon: "bell" }).show(); return; }
if (navigator.clipboard && window.isSecureContext) {
navigator.clipboard.writeText(copyVal.value).then(function () {
//success info
new $.zui.Messager("复制成功", {
type: "primary", // 定义颜色主题
icon: "ok-sign" // 定义消息图标
}).show();
console.log("复制成功");
//success
new $.zui.Messager("复制成功", { type: "primary", icon: "ok-sign" }).show();
}, function () {
//fail info
alert("复制失败");
//fail
new $.zui.Messager("复制失败, 请手动复制", { type: "danger", icon: "bell" }).show();
});
} else {
if (document.execCommand('copy', false, null)) {
//success info
new $.zui.Messager("复制成功", {
type: "primary", // 定义颜色主题
icon: "ok-sign" // 定义消息图标
}).show();
console.log("复制成功");
//success
new $.zui.Messager("复制成功", { type: "primary", icon: "ok-sign" }).show();
} else {
//fail info
alert("复制失败");
//fail
new $.zui.Messager("复制失败, 请手动复制", { type: "danger", icon: "bell" }).show();
}
}
}
document.getElementsByClassName('copyBtn2')[0].onclick = function () {
var copyVal = document.getElementById("bbscode");
copyVal.select();
if (navigator.clipboard && window.isSecureContext) {
navigator.clipboard.writeText(copyVal.value).then(function () {
//success info
new $.zui.Messager("复制成功", {
type: "primary", // 定义颜色主题
icon: "ok-sign" // 定义消息图标
}).show();
console.log("复制成功");
}, function () {
//fail info
alert("复制失败");
});
} else {
if (document.execCommand('copy', false, null)) {
//success info
new $.zui.Messager("复制成功", {
type: "primary", // 定义颜色主题
icon: "ok-sign" // 定义消息图标
}).show();
console.log("复制成功");
} else {
//fail info
alert("复制失败");
}
}
}
document.getElementsByClassName('copyBtn3')[0].onclick = function () {
var copyVal = document.getElementById("markdown");
copyVal.select();
if (navigator.clipboard && window.isSecureContext) {
navigator.clipboard.writeText(copyVal.value).then(function () {
//success info
new $.zui.Messager("复制成功", {
type: "primary", // 定义颜色主题
icon: "ok-sign" // 定义消息图标
}).show();
console.log("复制成功");
}, function () {
//fail info
alert("复制失败");
});
} else {
if (document.execCommand('copy', false, null)) {
//success info
new $.zui.Messager("复制成功", {
type: "primary", // 定义颜色主题
icon: "ok-sign" // 定义消息图标
}).show();
console.log("复制成功");
} else {
//fail info
alert("复制失败");
}
}
}
document.getElementsByClassName('copyBtn4')[0].onclick = function () {
var copyVal = document.getElementById("html");
copyVal.select();
if (navigator.clipboard && window.isSecureContext) {
navigator.clipboard.writeText(copyVal.value).then(function () {
//success info
new $.zui.Messager("复制成功", {
type: "primary", // 定义颜色主题
icon: "ok-sign" // 定义消息图标
}).show();
console.log("复制成功");
}, function () {
//fail info
alert("复制失败");
});
} else {
if (document.execCommand('copy', false, null)) {
//success info
new $.zui.Messager("复制成功", {
type: "primary", // 定义颜色主题
icon: "ok-sign" // 定义消息图标
}).show();
console.log("复制成功");
} else {
//fail info
alert("复制失败");
}
}
}
document.getElementsByClassName('copyBtn5')[0].onclick = function () {
var copyVal = document.getElementById("thumb");
copyVal.select();
if (navigator.clipboard && window.isSecureContext) {
navigator.clipboard.writeText(copyVal.value).then(function () {
//success info
new $.zui.Messager("复制成功", {
type: "primary", // 定义颜色主题
icon: "ok-sign" // 定义消息图标
}).show();
console.log("复制成功");
}, function () {
//fail info
alert("复制失败");
});
} else {
if (document.execCommand('copy', false, null)) {
//success info
new $.zui.Messager("复制成功", {
type: "primary", // 定义颜色主题
icon: "ok-sign" // 定义消息图标
}).show();
console.log("复制成功");
} else {
//fail info
alert("复制失败");
}
}
}
document.getElementsByClassName('copyBtn6')[0].onclick = function () {
var copyVal = document.getElementById("del");
copyVal.select();
if (navigator.clipboard && window.isSecureContext) {
navigator.clipboard.writeText(copyVal.value).then(function () {
//success info
new $.zui.Messager("复制成功", {
type: "primary", // 定义颜色主题
icon: "ok-sign" // 定义消息图标
}).show();
console.log("复制成功");
}, function () {
//fail info
alert("复制失败");
});
} else {
if (document.execCommand('copy', false, null)) {
//success info
new $.zui.Messager("复制成功", {
type: "primary", // 定义颜色主题
icon: "ok-sign" // 定义消息图标
}).show();
console.log("复制成功");
} else {
//fail info
alert("复制失败");
}
}
}
// 复制按钮状态
$('#btnLinks, #btnBbscode, #btnMarkDown, #btnHtml, #btnThumb, #btnDel').on('click', function () {
var $btn = $(this);
$btn.addClass('btn-success load-indicator loading');
// 复制按钮状态
var $btn = $(loadClass);
$btn.addClass('btn-success');
// $btn.addClass('btn-success load-indicator loading');
$btn.remove('data-toggle data-original-title');
$btn.button('loading');
// 此处使用 setTimeout 来模拟复杂功能逻辑
setTimeout(function () {
$btn.removeClass('btn-success load-indicator loading');
$btn.removeClass('btn-success');
// $btn.removeClass('btn-success load-indicator loading');
$btn.button('reset');
}, 666);
});
}
/** 粘贴上传 2023-01-30 */
(function () {
document.addEventListener('paste', function (e) {
var items = ((e.clipboardData || window.clipboardData).items) || [];
console.log(e)
var file = null;
$("#upShowID").addClass("load-indicator loading"); // 增加正在上传状态 2-1
if (items && items.length) {
for (var i = 0; i < items.length; i++) {
if (items[i].type.indexOf('image') !== -1) {
@@ -217,109 +60,69 @@ $('#btnLinks, #btnBbscode, #btnMarkDown, #btnHtml, #btnThumb, #btnDel').on('clic
}
}
// 未找到图片
if (!file) {
$.zui.messager.show('粘贴内容非图片!', {
icon: 'bell',
time: 3000,
type: 'danger',
placement: 'top'
});
return;
$("#upShowID").removeClass("load-indicator loading"); // 移除正在上传状态 2-2
$.zui.messager.show('粘贴内容非图片!', { icon: 'bell', time: 3000, type: 'danger', placement: 'top' }); return;
}
var formData = new FormData();
formData.append('file', file);
formData.append('sign', Date.now());
formData.append('sign', new Date().getTime() / 1000 | 0);
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function () {
if (xhr.readyState == 1) {
$.zui.messager.show('粘贴上传中...', {
icon: 'bell',
time: 3000,
type: 'primary',
placement: 'top'
});
$(".uploader").addClass("load-indicator loading"); // 增加正在上传状态
}
if (xhr.readyState >= 4) {
$.zui.messager.show('粘贴上传中...', {
icon: 'bell',
time: 3000,
type: 'primary',
placement: 'top'
});
$(".uploader").removeClass("load-indicator loading"); // 移除正在上传状态
if (xhr.readyState === 1) {
$.zui.messager.show('粘贴上传中...', { icon: 'bell', time: 3000, type: 'primary', placement: 'top' });
}
}
xhr.onload = function () {
var result = JSON.parse(this.responseText);
if (result.result === 'success') {
document.getElementById("links").innerHTML += result.url + "\r\n";
document.getElementById("bbscode").innerHTML += "[img]" + result.url + "[/img]\r\n";
document.getElementById("markdown").innerHTML += "![" + result.srcName + "](" + result.url + ")\r\n";
document.getElementById("html").innerHTML += '<img src="' + result.url + '" alt="' + result.srcName + '" />\r\n';
document.getElementById("thumb").innerHTML += result.thumb + "\r\n";
document.getElementById("del").innerHTML += result.del + "\r\n";
$.zui.messager.show(/** result.srcName + */'粘贴上传成功', {
icon: 'bell',
time: 4000,
type: 'success',
placement: 'top'
});
var obj = JSON.parse(this.responseText);
if (obj.code === 200) {
$("#links").append(obj.url + "\r\n");
$("#bbscode").append("[img]" + obj.url + "[/img]\r\n");
$("#markdown").append("![" + obj.srcName + "](" + obj.url + ")\r\n");
$("#html").append('&lt;img src="' + obj.url + '" alt="' + obj.srcName + '" /&gt;\r\n');
$("#thumb").append(obj.thumb + "\r\n");
$("#del").append(obj.del + "\r\n");
// 上传成功提示 原始文件名称obj.srcName + 提示
$.zui.messager.show('粘贴上传成功', { icon: 'bell', time: 4000, type: 'success', placement: 'top' });
// 移除正在上传状态 2-3
$("#upShowID").removeClass("load-indicator loading");
try { // 储存上传记录
console.log('localStorage ok!');
$.zui.store.set(result.srcName, result)
console.log('history localStorage success');
$.zui.store.set(obj.srcName, obj)
} catch (err) {
console.log('localStorage failed:' + err);
// 存储上传记录失败提示
$.zui.messager.show('存储上传记录失败' + err, { icon: 'bell', time: 4000, type: 'danger', placement: 'top' });
console.log('history localStorage failed:' + err);
}
} else {
$.zui.messager.show('上传失败...' + result.message, {
icon: 'bell',
time: 4000,
type: 'danger',
placement: 'top'
});
$("#upShowID").removeClass("load-indicator loading"); // 移除正在上传状态 2-4
$.zui.messager.show(obj.message, { icon: 'bell', time: 4000, type: 'danger', placement: 'top' });
}
};
xhr.onerror = function () {
$.zui.messager.show('因网络问题导致的上传失败...', {
icon: 'bell',
time: 4000,
type: 'primary',
placement: 'top'
});
$("#upShowID").removeClass("load-indicator loading"); // 移除正在上传状态 2-5
$.zui.messager.show('因网络问题导致的上传失败...', { icon: 'bell', time: 4000, type: 'primary', placement: 'top' });
};
xhr.open('POST', 'app/upload.php', true);
xhr.send(formData);
});
})();
// 检测浏览器是否支持cookie
if (navigator.cookieEnabled === false) {
new $.zui.Messager('浏览器不支持cookie, 无法保存登录信息', {
type: 'black',
icon: 'bell',
time: 4500,
placement: 'top'
}).show();
/** 检测浏览器是否支持cookie */
if (navigator.cookieEnabled === false) {
new $.zui.Messager('浏览器不支持cookie, 无法保存登录信息', { type: 'black', icon: 'bell', time: 4500, placement: 'top' }).show();
console.log('浏览器不支持cookie');
}
// 检测浏览器是否支持本地存储
/** 检测浏览器是否支持本地存储 */
if ($.zui.store.enable === false) {
new $.zui.Messager('浏览器不支持本地存储, 无法保存上传历史记录', {
icon: 'bell',
time: 4000,
type: 'primary',
placement: 'top'
}).show();
new $.zui.Messager('浏览器不支持本地存储, 无法保存上传历史记录', { icon: 'bell', time: 4000, type: 'primary', placement: 'top' }).show();
console.log('浏览器不支持本地存储');
}
@@ -339,7 +142,6 @@ if ($.zui.store.enable === false) {
* myURL.protocol; // = 'http'
* myURL.source; // = 'http://abc.com:8080/dir/index.html?id=255&m=hello#top'
*/
function parseURL(url) {
var a = document.createElement('a');
a.href = url;
@@ -368,7 +170,10 @@ function parseURL(url) {
};
}
/** jQuery 读取文件 readTxt('../admin/version.php'); */
/**
* jQuery 读取文件 readTxt('../admin/version.php');
* @param {*} filePath
*/
function readTxt(filePath = '../admin/version.php') {
$.get(filePath, function (data) {
var lines = data.split("\n"); //按行读取
@@ -376,4 +181,16 @@ function readTxt(filePath = '../admin/version.php') {
console.log(v);
});
});
}
}
/**
* JS验证是否为URL 这是提取自npm包 async-validator的源码。
* 参考: https://www.cnblogs.com/lanleiming/p/14250497.html
* @param {*} str
* @returns
* @example isUrl('http://www.baidu.com') // true
*/
function isUrl(str) {
var v = new RegExp('^(?!mailto:)(?:(?:http|https|ftp)://|//)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$', 'i');
return v.test(str);
}

6
public/static/md5/md5.min.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

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,2 @@
/*! TangBin: image.ready.js http://www.planeart.cn/?p=1121 */
!function(n){"use strict";n.zui.imgReady=function(){var n=[],l=null,e=function(){for(var l=0;l<n.length;l++)n[l].end?n.splice(l--,1):n[l]();!n.length&&o()},o=function(){clearInterval(l),l=null};return function(o,r,t,u){var c,i,a,d,f,h=new Image;return h.src=o,h.complete?(r.call(h),void(t&&t.call(h))):(i=h.width,a=h.height,h.onerror=function(){u&&u.call(h),c.end=!0,h=h.onload=h.onerror=null},c=function(){d=h.width,f=h.height,(d!==i||f!==a||d*f>1024)&&(r.call(h),c.end=!0)},c(),h.onload=function(){!c.end&&c(),t&&t.call(h),h=h.onload=h.onerror=null},void(c.end||(n.push(c),null===l&&(l=setInterval(e,40)))))}}()}(jQuery);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long