Skip to content

Commit cb0d902

Browse files
committed
Update pagetual.user.js
1 parent 3ef1642 commit cb0d902

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

Pagetual/pagetual.user.js

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9328,7 +9328,7 @@
93289328
importBtn.style.fontSize = "20px";
93299329
importBtn.addEventListener("click", e => {
93309330
let parentNode = importBtn.parentNode;
9331-
if (!parentNode) return;
9331+
if (!parentNode || !e.isTrusted) return;
93329332
parentNode.removeChild(importBtn);
93339333
try {
93349334
let rules = parentNode.innerText.trim();
@@ -9522,11 +9522,11 @@
95229522
padding: 0!important;
95239523
}
95249524
#saveBtn {
9525-
width: 60vw;
9525+
width: var(--config-width, 60vw);
95269526
position: fixed;
95279527
z-index: 999;
95289528
bottom: 0;
9529-
left: 20vw;
9529+
left: var(--config-left, 20vw);
95309530
font-size: xx-large;
95319531
opacity: 0.6;
95329532
cursor: pointer;
@@ -10021,6 +10021,7 @@
1002110021
}
1002210022

1002310023
updateP.onclick = e => {
10024+
if (!e.isTrusted) return;
1002410025
updateFail = false;
1002510026
//ruleParser.rules = [];
1002610027
showTips(i18n("beginUpdate"), "", 30000);
@@ -10105,8 +10106,29 @@
1010510106
saveBtn.innerHTML = i18n("save");
1010610107
saveBtn.id = "saveBtn";
1010710108
configCon.appendChild(saveBtn);
10109+
saveBtn.style.display = "none";
10110+
const syncSaveBtnLayout = () => {
10111+
if (!configCon || !saveBtn) return;
10112+
const rect = configCon.getBoundingClientRect();
10113+
if (rect.width > 0) {
10114+
document.documentElement.style.setProperty("--config-left", `${rect.left}px`);
10115+
document.documentElement.style.setProperty("--config-width", `${rect.width}px`);
10116+
saveBtn.style.display = "";
10117+
} else {
10118+
saveBtn.style.display = "none";
10119+
}
10120+
};
10121+
syncSaveBtnLayout();
10122+
window.addEventListener("resize", syncSaveBtnLayout);
10123+
if (window.ResizeObserver) {
10124+
const saveBtnResizeObserver = new ResizeObserver(() => {
10125+
syncSaveBtnLayout();
10126+
});
10127+
saveBtnResizeObserver.observe(configCon);
10128+
}
1010810129
saveBtn.onclick = e => {
1010910130
try {
10131+
if (!e.isTrusted) return;
1011010132
let customRules;
1011110133
if (editor) {
1011210134
if (editorChanged) {

0 commit comments

Comments
 (0)