pull/141/head
icret 2023-02-22 21:48:14 +08:00
parent 7943fec10b
commit ce70b9aa1d
6 changed files with 146 additions and 49 deletions

View File

@ -297,7 +297,7 @@ if (isset($_POST['del_version_file'])) {
unlink(APP_ROOT . $_POST['del_version_file']);
echo "
<script>
new $.zui.Messager('更新版本成功', {
new $.zui.Messager('更新版本成功', {
type: 'success', // 定义颜色主题
icon: 'ok'
}).show();
@ -306,7 +306,7 @@ if (isset($_POST['del_version_file'])) {
} catch (Exception $e) {
echo "
<script>
new $.zui.Messager('更新版本失败', {
new $.zui.Messager('更新版本失败', {
type: 'danger', // 定义颜色主题
icon: 'ok'
}).show();

View File

@ -17,6 +17,9 @@ if ($config['notice_status'] > 0) : ?>
<?php echo $config['notice']; ?>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-mini btn-primary" data-dismiss="modal">了解</button>
</div>
</div>
</div>
<?php endif; ?>
@ -65,7 +68,6 @@ if ($config['notice_status'] > 0) : ?>
// NProgress
NProgress.start();
NProgress.done();
// 导航状态
$('.nav-pills').find('a').each(function() {
// console.log(document.location);
@ -114,9 +116,8 @@ if ($config['notice_status'] > 0) : ?>
$('*').s2t();
});
<?php endif; ?>
<?php /** 暗黑模式 */ if ($config['dark-mode']) : ?>
// cookie 操作封装 https://www.jb51.net/article/94456.htm
// cookie 操作封装 https://www.jb51.net/article/94456.htm
var cookieUtil = {
// 设置cookie
setItem: function(name, value, days) {
@ -152,7 +153,6 @@ if ($config['notice_status'] > 0) : ?>
return cookieArr;
}
};
// 暗黑操作
let styleLabel = document.createElement('style');
document.getElementById('dark').onclick = function() {

View File

@ -95,7 +95,7 @@ if ($config['ad_top']) echo $config['ad_top_info'];
<td><?php echo $logs[$logsName]['size']; ?></td>
</tr>
<tr class="text-primary">
<td>上传用户</td>
<td>上传者IP</td>
<td><?php echo $logs[$logsName]['ip'] . ':' . $logs[$logsName]['port']; ?></td>
</tr>
<tr class="text-primary">

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,7 @@
*2023-02-18 v2.7.5 dev
- 增加定时删除文件
- 修复一处bug
- 修复非安全域名下无法复制[#92](https://github.com/icret/EasyImages2.0/issues/92)
- 修复局域网无法获取新版本时导致的页面混乱[#91](https://github.com/icret/EasyImages2.0/issues/91#issue-1585360193)
- 更换检测新版本方式
- API上传增加返回Token ID

View File

@ -3,11 +3,10 @@
* 简单图床-复制链接
* 2023-01-30
*/
document.getElementsByClassName('copyBtn1')[0].onclick = function () {
var copyVal = document.getElementById("links");
copyVal.select();
try {
if (navigator.clipboard && window.isSecureContext) {
navigator.clipboard.writeText(copyVal.value).then(function () {
//success info
new $.zui.Messager("复制成功", {
@ -19,15 +18,26 @@ document.getElementsByClassName('copyBtn1')[0].onclick = function () {
//fail info
alert("复制失败");
});
} catch (err) {
alert(err);
} 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('copyBtn2')[0].onclick = function () {
var copyVal = document.getElementById("bbscode");
copyVal.select();
try {
if (navigator.clipboard && window.isSecureContext) {
navigator.clipboard.writeText(copyVal.value).then(function () {
//success info
new $.zui.Messager("复制成功", {
@ -39,15 +49,26 @@ document.getElementsByClassName('copyBtn2')[0].onclick = function () {
//fail info
alert("复制失败");
});
} catch (err) {
alert(err);
} 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();
try {
if (navigator.clipboard && window.isSecureContext) {
navigator.clipboard.writeText(copyVal.value).then(function () {
//success info
new $.zui.Messager("复制成功", {
@ -59,15 +80,26 @@ document.getElementsByClassName('copyBtn3')[0].onclick = function () {
//fail info
alert("复制失败");
});
} catch (err) {
alert(err);
} 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();
try {
if (navigator.clipboard && window.isSecureContext) {
navigator.clipboard.writeText(copyVal.value).then(function () {
//success info
new $.zui.Messager("复制成功", {
@ -79,15 +111,26 @@ document.getElementsByClassName('copyBtn4')[0].onclick = function () {
//fail info
alert("复制失败");
});
} catch (err) {
alert(err);
} 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();
try {
if (navigator.clipboard && window.isSecureContext) {
navigator.clipboard.writeText(copyVal.value).then(function () {
//success info
new $.zui.Messager("复制成功", {
@ -99,15 +142,26 @@ document.getElementsByClassName('copyBtn5')[0].onclick = function () {
//fail info
alert("复制失败");
});
} catch (err) {
alert(err);
} 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();
try {
if (navigator.clipboard && window.isSecureContext) {
navigator.clipboard.writeText(copyVal.value).then(function () {
//success info
new $.zui.Messager("复制成功", {
@ -119,8 +173,19 @@ document.getElementsByClassName('copyBtn6')[0].onclick = function () {
//fail info
alert("复制失败");
});
} catch (err) {
alert(err);
} else {
if (document.execCommand('copy', false, null)) {
//success info
new $.zui.Messager("复制成功", {
type: "primary", // 定义颜色主题
icon: "ok-sign" // 定义消息图标
}).show();
console.log("复制成功");
} else {
//fail info
alert("复制失败");
}
}
}
@ -159,7 +224,6 @@ $('#btnLinks, #btnBbscode, #btnMarkDown, #btnHtml, #btnThumb, #btnDel').on('clic
var formData = new FormData();
formData.append('file', file);
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function () {
if (xhr.readyState == 1) {
$.zui.messager.show('粘贴上传中...', {
@ -191,7 +255,6 @@ $('#btnLinks, #btnBbscode, #btnMarkDown, #btnHtml, #btnThumb, #btnDel').on('clic
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,
@ -205,7 +268,6 @@ $('#btnLinks, #btnBbscode, #btnMarkDown, #btnHtml, #btnThumb, #btnDel').on('clic
} catch (err) {
console.log('localStorage failed:' + err);
}
} else {
$.zui.messager.show('上传失败...' + result.message, {
icon: 'bell',
@ -229,8 +291,21 @@ $('#btnLinks, #btnBbscode, #btnMarkDown, #btnHtml, #btnThumb, #btnDel').on('clic
});
})();
/** javascript parseUrlurlurl
/**
* javascript parseUrl函数解析url获取网址url参数
* https://www.cnblogs.com/lazb/p/10144471.html
* 使用示例
* var myURL = parseURL('http://abc.com:8080/dir/index.html?id=255&m=hello#top');
* myURL.file; // = 'index.html'
* myURL.hash; // = 'top'
* myURL.host; // = 'abc.com'
* myURL.query; // = '?id=255&m=hello'
* myURL.params; // = Object = { id: 255, m: hello }
* myURL.path; // = '/dir/index.html'
* myURL.segments; // = Array = ['dir', 'index.html']
* myURL.port; // = '8080'
* myURL.protocol; // = 'http'
* myURL.source; // = 'http://abc.com:8080/dir/index.html?id=255&m=hello#top'
*/
function parseURL(url) {
@ -261,28 +336,49 @@ function parseURL(url) {
};
}
/**
使用实例
var myURL = parseURL('http://abc.com:8080/dir/index.html?id=255&m=hello#top');
myURL.file; // = 'index.html'
myURL.hash; // = 'top'
myURL.host; // = 'abc.com'
myURL.query; // = '?id=255&m=hello'
myURL.params; // = Object = { id: 255, m: hello }
myURL.path; // = '/dir/index.html'
myURL.segments; // = Array = ['dir', 'index.html']
myURL.port; // = '8080'
myURL.protocol; // = 'http'
myURL.source; // = 'http://abc.com:8080/dir/index.html?id=255&m=hello#top'
*/
/** jQuery 读取文件 readTxt('../admin/version.php'); */
function readTxt(filePath) {
function readTxt(filePath = '../admin/version.php') {
$.get(filePath, function (data) {
var lines = data.split("\n"); //按行读取
$.each(lines, function (i, v) {
console.log(v);
});
});
}
}
// cookie 操作封装 https://www.jb51.net/article/94456.htm
var cookieUtil = {
// 设置cookie
setItem: function (name, value, days) {
var date = new Date();
date.setDate(date.getDate() + days);
document.cookie = name + '=' + value + ';expires=' + date + ';path=' + '/';
},
// 获取cookie
getItem: function (name) {
var arr = document.cookie.replace(/\s/g, "").split(';');
for (var i = 0; i < arr.length; i++) {
var tempArr = arr[i].split('=');
if (tempArr[0] == name) {
return decodeURIComponent(tempArr[1]);
}
}
return '';
},
// 删除cookie
removeItem: function (name) {
this.setItem(name, '1', -1);
},
// 检查是否含有某cookie
hasItem: function (name) {
return (new RegExp("(?:^|;\\s*)" + encodeURIComponent(name).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=")).test(document.cookie);
},
// 获取全部的cookie列表
getAllItems: function () {
var cookieArr = document.cookie.replace(/((?:^|\s*;)[^\=]+)(?=;|$)|^\s*|\s*(?:\=[^;]*)?(?:\1|$)/g, "").split(/\s*(?:\=[^;]*)?;\s*/);
for (var nIdx = 0; nIdx < cookieArr.length; nIdx++) {
cookieArr[nIdx] = decodeURIComponent(cookieArr[nIdx]);
}
return cookieArr;
}
};