分享一款子比主题独立下载页面美化!
直接下载文件覆盖掉download.php即可(文件路径:/wp-content/themes/zibll/pages/download.php),更新前记得备份!记得备份!记得备份!不然就没后悔药吃了!
JS代码
<!--下载页面密码复制-->
if(document.querySelectorAll(".but-download .badg")!=undefined){
const reg = /[a-zA-z0-9]/ig;
const copy = document.querySelectorAll(".but-download .badg");
for (let i = 0; i < copy.length; i++) {
copy[i].index = i;
copy[i].setAttribute("data-toggle", "tooltip");
copy[i].setAttribute("data-original-title", "点击复制");
copy[i].addEventListener("click", copyOperation);
};
function copyOperation() {
var oInput = document.createElement("input");
let text = this.innerText;
text = text.match(reg).join("");
oInput.value = text;
document.body.appendChild(oInput);
oInput.select();
document.execCommand("Copy");
oInput.className = "oInput";
oInput.style.display = "none";
this.setAttribute("data-original-title", "已复制");
};
};
这里再套个点击复制密码功能吧!
下载地址
https://wwin.lanzoue.com/s/zibi-download
提取密码:32jv
解压密码