Skip to content

Commit f7ca127

Browse files
committed
Update Picviewer CE+.user.js
1 parent 2a76a33 commit f7ca127

File tree

1 file changed

+26
-5
lines changed

1 file changed

+26
-5
lines changed

Picviewer CE+/Picviewer CE+.user.js

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23591,9 +23591,30 @@ ImgOps | https://imgops.com/#b#`;
2359123591
return true;
2359223592
}
2359323593
var targetPosi = getContentClientRect(this.data.img);
23594-
var pa = this.data.img.offsetParent || this.data.img.parentNode;
23594+
var pa = this.data.img.parentNode, limited = false;
2359523595
if (pa && pa.scrollHeight > 30 && pa.scrollWidth > 30) {
2359623596
var paPosi=pa.getBoundingClientRect();
23597+
if (paPosi.width > 30 && paPosi.height > 30) {
23598+
const style = unsafeWindow.getComputedStyle(this.data.img);
23599+
const matrix = new DOMMatrixReadOnly(style.transform);
23600+
let translateX = matrix.m41, translateY = matrix.m42, scaleX = matrix.m11, scaleY = matrix.m22;
23601+
if (translateY || this.data.img.offsetTop != 0 || (scaleY && scaleY !== 1)) {
23602+
if (paPosi.height < targetPosi.height - 3) {
23603+
limited = true;
23604+
targetPosi.top = paPosi.top;
23605+
}
23606+
}
23607+
if (translateX || this.data.img.offsetLeft != 0 || (scaleX && scaleX !== 1)) {
23608+
if (paPosi.width < targetPosi.width - 3) {
23609+
limited = true;
23610+
targetPosi.left = paPosi.left;
23611+
}
23612+
}
23613+
}
23614+
}
23615+
if (!limited) {
23616+
pa = this.data.img.offsetParent;
23617+
paPosi=pa.getBoundingClientRect();
2359723618
if (paPosi.width > 30 && paPosi.height > 30) {
2359823619
const style = unsafeWindow.getComputedStyle(this.data.img);
2359923620
const matrix = new DOMMatrixReadOnly(style.transform);
@@ -24967,7 +24988,10 @@ ImgOps | https://imgops.com/#b#`;
2496724988
if (broEle == target) broEle = null;
2496824989
}
2496924990
}
24970-
if (prefs.floatBar.listenBg && hasBg(target)) {
24991+
if (target.children.length == 1 && !(target.textContent && target.textContent.trim()) && target.children[0].nodeName == "IMG") {
24992+
target = target.children[0];
24993+
found = true;
24994+
} else if (prefs.floatBar.listenBg && hasBg(target)) {
2497124995
let src = targetBg, nsrc = src, noActual = true, type = "scale";
2497224996
result = {
2497324997
src: nsrc,
@@ -24993,9 +25017,6 @@ ImgOps | https://imgops.com/#b#`;
2499325017
};
2499425018
found = true;
2499525019
}
24996-
} else if (target.children.length == 1 && !(target.textContent && target.textContent.trim()) && target.children[0].nodeName == "IMG") {
24997-
target = target.children[0];
24998-
found = true;
2499925020
} else if (prefs.floatBar.listenBg && broEle && hasBg(broEle)) {
2500025021
let src = targetBg, nsrc = src, noActual = true, type = "scale";
2500125022
result = {

0 commit comments

Comments
 (0)