|
12 | 12 | // @description:ja 画像を強力に閲覧できるツール。ポップアップ表示、拡大・縮小、回転、一括保存などの機能を自動で実行できます |
13 | 13 | // @description:pt-BR Poderosa ferramenta de visualização de imagens on-line, que pode pop-up/dimensionar/girar/salvar em lote imagens automaticamente |
14 | 14 | // @description:ru Мощный онлайн-инструмент для просмотра изображений, который может автоматически отображать/масштабировать/вращать/пакетно сохранять изображения |
15 | | -// @version 2025.10.10.1 |
| 15 | +// @version 2025.10.16.1 |
16 | 16 | // @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAAV1BMVEUAAAD////29vbKysoqKioiIiKysrKhoaGTk5N9fX3z8/Pv7+/r6+vk5OTb29vOzs6Ojo5UVFQzMzMZGRkREREMDAy4uLisrKylpaV4eHhkZGRPT08/Pz/IfxjQAAAAgklEQVQoz53RRw7DIBBAUb5pxr2m3/+ckfDImwyJlL9DDzQgDIUMRu1vWOxTBdeM+onApENF0qHjpkOk2VTwLVEF40Kbfj1wK8AVu2pQA1aBBYDHJ1wy9Cf4cXD5chzNAvsAnc8TjoLAhIzsBao9w1rlVTIvkOYMd9nm6xPi168t9AYkbANdajpjcwAAAABJRU5ErkJggg== |
17 | 17 | // @namespace https://github.com/hoothin/UserScripts |
18 | 18 | // @homepage https://github.com/hoothin/UserScripts/tree/master/Picviewer%20CE%2B |
@@ -12543,14 +12543,8 @@ ImgOps | https://imgops.com/#b#`; |
12543 | 12543 | }); |
12544 | 12544 | break; |
12545 | 12545 | } catch (e) { |
12546 | | - try { |
12547 | | - escapeHTMLPolicy = unsafeWindow.trustedTypes.policies.get(name); |
12548 | | - if (escapeHTMLPolicy) { |
12549 | | - break; |
12550 | | - } |
12551 | | - } catch (e2) { |
12552 | | - console.warn(`create '${name}' failed`); |
12553 | | - } |
| 12546 | + console.warn(`create '${name}' failed`); |
| 12547 | + return; |
12554 | 12548 | } |
12555 | 12549 | } |
12556 | 12550 | } |
@@ -22227,12 +22221,10 @@ ImgOps | https://imgops.com/#b#`; |
22227 | 22221 |
|
22228 | 22222 | let size = rectSize, containsScroll = imgWindow.classList.contains("pv-pic-window-scroll"); |
22229 | 22223 | if (rectSize.w > wSize.w) { |
22230 | | - if (rectSize.w / rectSize.h > wSize.w / wSize.h) { |
22231 | | - size = { |
22232 | | - w: wSize.w, |
22233 | | - h: wSize.w / (rectSize.w / rectSize.h), |
22234 | | - }; |
22235 | | - } |
| 22224 | + size = { |
| 22225 | + w: wSize.w, |
| 22226 | + h: wSize.w / (rectSize.w / rectSize.h), |
| 22227 | + }; |
22236 | 22228 |
|
22237 | 22229 | let cs = this.getRotatedImgCliSize(size); |
22238 | 22230 | let ns = this.imgNaturalSize; |
@@ -24250,7 +24242,7 @@ ImgOps | https://imgops.com/#b#`; |
24250 | 24242 | window.addEventListener('scroll',this._scrollHandler,true); |
24251 | 24243 | }, |
24252 | 24244 | hide:function(){ |
24253 | | - lastEvent = null; |
| 24245 | + target = null; |
24254 | 24246 | clearTimeout(this.showTimer); |
24255 | 24247 | this.floatBar.style.opacity=0.01; |
24256 | 24248 | this.shown=false; |
@@ -25674,16 +25666,18 @@ ImgOps | https://imgops.com/#b#`; |
25674 | 25666 | } |
25675 | 25667 | } |
25676 | 25668 | } |
25677 | | - if (!found && target.children && target.children[0] && target.children[0].nodeName.toUpperCase() == 'IMG') { |
25678 | | - let img = target.children[0]; |
25679 | | - while (img.nextElementSibling && img.nextElementSibling.nodeName.toUpperCase() == 'IMG') { |
25680 | | - img = img.nextElementSibling; |
25681 | | - } |
25682 | | - let rect = img.getBoundingClientRect(); |
| 25669 | + if (!found && target.children && target.children.length) { |
| 25670 | + let img = target.querySelector("img"); |
| 25671 | + if (img) { |
| 25672 | + while (img.nextElementSibling && img.nextElementSibling.nodeName.toUpperCase() == 'IMG') { |
| 25673 | + img = img.nextElementSibling; |
| 25674 | + } |
| 25675 | + let rect = img.getBoundingClientRect(); |
25683 | 25676 |
|
25684 | | - if (clientY >= rect.top && clientY <= rect.bottom && clientX >= rect.left && clientX <= rect.right) { |
25685 | | - target = img; |
25686 | | - found = true; |
| 25677 | + if (clientY >= rect.top && clientY <= rect.bottom && clientX >= rect.left && clientX <= rect.right) { |
| 25678 | + target = img; |
| 25679 | + found = true; |
| 25680 | + } |
25687 | 25681 | } |
25688 | 25682 | } |
25689 | 25683 | if (!found && document.elementsFromPoint) { |
@@ -25926,7 +25920,7 @@ ImgOps | https://imgops.com/#b#`; |
25926 | 25920 | } |
25927 | 25921 | } |
25928 | 25922 |
|
25929 | | - var checkFloatBarTimer, initMouse = false, lastEvent, composedTarget, checking = false; |
| 25923 | + var checkFloatBarTimer, initMouse = false, composedTarget, checking = false, target, type, clientX, clientY, altKey; |
25930 | 25924 | function globalMouseoverHandler(e) { |
25931 | 25925 | if (galleryMode) return;//库模式全屏中...... |
25932 | 25926 | if (e.target == ImgWindowC.overlayer) return; |
@@ -25963,26 +25957,33 @@ ImgOps | https://imgops.com/#b#`; |
25963 | 25957 | } |
25964 | 25958 | if (!initMouse) return; |
25965 | 25959 | if (e.type == "keydown") { |
25966 | | - if (!lastEvent) return; |
25967 | | - e = lastEvent; |
| 25960 | + if (!target) return; |
25968 | 25961 | } else { |
25969 | | - lastEvent = e; |
25970 | | - if (checking) { |
25971 | | - setTimeout(() => { |
25972 | | - checking = false; |
25973 | | - }, 50); |
25974 | | - } else { |
25975 | | - checking = true; |
| 25962 | + target = e.target; |
| 25963 | + type = e.type; |
| 25964 | + clientX = e.clientX; |
| 25965 | + clientY = e.clientY; |
| 25966 | + altKey = e.altKey; |
| 25967 | + if (e.type !== "mousemove") { |
25976 | 25968 | let path = e && e.composedPath && e.composedPath(); |
25977 | 25969 | composedTarget = path && path[0]; |
25978 | 25970 | } |
25979 | 25971 | } |
25980 | 25972 | clearTimeout(checkFloatBarTimer); |
25981 | 25973 | checkFloatBarTimer = setTimeout(function() { |
25982 | | - if (!e || !e.target || !e.target.parentNode) return; |
| 25974 | + if (!target || !target.parentNode) return; |
25983 | 25975 | if (gallery && gallery.shown) return; |
25984 | | - checkFloatBar(e.target, e.type, canPreview, e.clientX, e.clientY, e.altKey, composedTarget); |
| 25976 | + checkFloatBar(target, type, canPreview, clientX, clientY, altKey, composedTarget); |
25985 | 25977 | }, 50); |
| 25978 | + if (e.target.shadowRoot) { |
| 25979 | + if (!e.target.shadowRoot.initListener) { |
| 25980 | + e.target.shadowRoot.initListener = true; |
| 25981 | + e.target.shadowRoot.addEventListener('mouseenter', (e) => { |
| 25982 | + globalMouseoverHandler(e); |
| 25983 | + }, true); |
| 25984 | + e.target.shadowRoot.addEventListener('mousemove', globalMouseoverHandler, true); |
| 25985 | + } |
| 25986 | + } |
25986 | 25987 | } |
25987 | 25988 |
|
25988 | 25989 | var selectionClientRect, selectionStr, selectionChanging = false; |
|
0 commit comments