简洁的目录浏览程序 Files Gallery 去弹窗方法
一款非常不错的图片管理php源码,单文件index.php,未授权每次打开会弹出授权窗口。
搜索 var CodeMirror = {}; ,复制下方代码将其替换掉即可,这段代码作用:
1、解决不能使用中文文件名或中文目录;
2、去掉弹窗。
localStorage.setItem('files:qrx', '<?php echo base64_encode($_SERVER['SERVER_NAME']); ?>');//加入这一行解决不能使用中文文件名或中文目录
var CodeMirror = {};
!function(){const t=window.XMLHttpRequest;window.XMLHttpRequest=function(){const e=new t;return e.open=function(n,o,s,p,l){"GET"===n&&o.startsWith("<?php echo config::$version ?>files.photo.gallery@")&&o.endsWith("/lang/zh.json")&&(arguments[1]=arguments[1].replace(/@[0-9\.]+\/lang/,"@latest/lang")),"POST"===n&&o.includes("auth.photo.gallery")&&(e.send=function(e){t.prototype.send.apply(this,["app=2&host=demo.files.gallery"])}),t.prototype.open.apply(this,arguments)},e}}();//加入这一行去掉弹窗
下面代码已经失效。
<script>
// 将当前页面的主机名(hostname)转换为Base64编码字符串
const encodedHostname = btoa(location.hostname);
// 在浏览器的 localStorage 中设置一个名为 "files:ned" 的项目
// 其值为上面得到的 Base64 编码后的主机名
localStorage.setItem("files:ned", encodedHostname);
</script>

信息科技 2024-12-20 02:07:24 通过 网页 浏览(1564) 打印
共有0条评论!