vscode删除空行
\s*(?=\r?$)\n
修改alert的样式
function customAlert(message) {
const modifiedMessage = message.replace(/http(s)?:\/\/[^/]+/, "");
const alertBox = document.createElement("div");
alertBox.style.position = "fixed";
alertBox.style.top = "50%";
alertBox.style.left = "50%";
alertBox.style.transform = "translate(-50%, -50%)";
alertBox.style.width = "300px";
alertBox.style.padding = "20px";
alertBox.style.backgroundColor = "white";
alertBox.style.border = "1px solid black";
alertBox.style.borderRadius = "5px";
alertBox.textContent = modifiedMessage;
const closeButton = document.createElement("button");
closeButton.textContent = "Close";
closeButton.style.marginTop = "10px";
closeButton.addEventListener("click", function() {
document.body.removeChild(alertBox);
});
alertBox.appendChild(closeButton);
document.body.appendChild(alertBox);
}
window.alert = customAlert;
效果如图