Picviewer CE+

Powerful picture viewing tool online, which can popup/scale/rotate/batch save pictures automatically

< Feedback on Picviewer CE+

Review: Good - script works

§
Posted: 2024-11-13

在与HTML5视频播放工具同时启用时,即网页中有视频窗口时,无法双击图片窗口关闭。

此冲突存在很长时间了,两个脚本我都非常喜欢且经常使用,如果不是您这里的问题,请回复一下,我再去隔壁提交feedback,感谢。

hoothinAuthor
§
Posted: 2024-11-14

它删除了所有双击事件,不光是 Picviewer CE+ 的

EventTarget.prototype.addEventListener = function(...args) {
                        const block = (args[0] == 'dblclick' && !args[1].toString().includes('actList.get(1037)')) || (args[0] == 'ratechange' && 'baidu' == u && !args[1].toString().includes('localStorage.mvPlayRate'));
                        if (!block)
                            return rawAel.apply(this, args);
}
§
Posted: 2024-11-14

它删除了所有双击事件,不光是 Picviewer CE+ 的

EventTarget.prototype.addEventListener = function(...args) {
                        const block = (args[0] == 'dblclick' && !args[1].toString().includes('actList.get(1037)')) || (args[0] == 'ratechange' && 'baidu' == u && !args[1].toString().includes('localStorage.mvPlayRate'));
                        if (!block)
                            return rawAel.apply(this, args);
}

感谢回复,这涉及到HTML5视频播放工具的核心功能了吧
我问了一下AI,将


const rawAel = EventTarget.prototype.addEventListener;
EventTarget.prototype.addEventListener = function(...args) {
    const block = (args[0] == 'dblclick' && !args[1].toString().includes('actList.get(1037)'))
        || (args[0] == 'ratechange' && 'baidu' == u && !args[1].toString().includes('localStorage.mvPlayRate'));
    if (!block) return rawAel.apply(this, args);
};

替换成了


// 保存原始的 addEventListener 方法
const rawAel = EventTarget.prototype.addEventListener;

EventTarget.prototype.addEventListener = function (...args) {
    // 检查是否是视频元素
    const isVideoElement = this instanceof HTMLMediaElement;
    // 只有当事件是双击事件,且在视频元素上时才进行判断
    const block = isVideoElement && (args[0] === 'dblclick' && !args[1].toString().includes('actList.get(1037)'))
            || (args[0] === 'ratechange' && typeof u === 'string' && u === 'baidu' && !args[1].toString().includes('localStorage.mvPlayRate'));

    // 如果不需要拦截,则调用原始的 addEventListener 方法
    if (!block) {
        return rawAel.apply(this, args);
    }
};

解决了无法双击关闭的问题。

Post reply

Sign in to post a reply.