Greasy Fork is available in English.

手机浏览器触摸手势

为手机浏览器添加触摸手势,即装即用,无需配置😎。拥有超多通用手势满足你的需求,还设计有对📝文字、🖼️图片、🎥视频交互的特殊手势💪。还想要更多😱?支持添加属于你的个性化手势,更有隐藏功能等待你的发现😏!推荐使用:狐猴 | Quetta | Yandex 浏览器。

< Feedback on 手机浏览器触摸手势

Review: قالتىس - قوليازما ئىشلەيدۇ

§
يوللانغان ۋاقتى: 2026-02-11

下面是我全屏手势的想法,可以避免全屏手势失效,也最大程度防止干扰页面:

const video = gestureData.getNearVideo(gestureData.touchEle) || gestureData.videoPlayer;
let tipBox;

if (video) {
let videoContainer;

// 如果不是已处理的视频容器,则创建浮动播放器
if (!video.matches('.JQMA_video-container > video')) {
// 关闭可能存在的旧播放器
document.querySelector('#JQMA_video-close')?.click();

// 创建新的视频容器
videoContainer = document.createElement('div');
videoContainer.classList.add('JQMA_video-container');
videoContainer.style.cssText = `
overflow: hidden !important;
position: fixed;
display: block;
top: 0;
left: 0;
z-index: 2147483647;
width: 350px;
min-width: 350px;
height: 300px;
min-height: 300px;
`;

// 创建关闭按钮
const closeButton = document.createElement('div');
closeButton.id = 'JQMA_video-close';
const originalParent = video.parentElement;

closeButton.style.cssText = `
position: fixed;
display: block;
top: 120px;
right: 0;
z-index: 2147483647;
width: 40px;
min-width: 40px;
height: 40px;
min-height: 40px;
background: gray;
`;

// 关闭按钮点击事件:恢复原始状态
closeButton.addEventListener('click', () => {
originalParent.prepend(video);
videoContainer.remove();
closeButton.remove();
});

// 设置视频样式
video.style.cssText = `
position: relative;
display: block;
top: 0;
left: 0;
width: 100%;
min-width: 100%;
height: 100%;
min-height: 100%;
object-fit: contain;
`;

// 添加到页面
document.body.prepend(videoContainer);
document.body.prepend(closeButton);
videoContainer.prepend(video);
} else {
// 如果已经是浮动播放器,获取其容器
videoContainer = video.parentElement;
}

// 添加提示框到视频容器
tipBox = gestureData.tipBoxThree;
if (videoContainer !== tipBox.parentElement) {
videoContainer.appendChild(tipBox);
}

// 锁定屏幕方向
const lockScreenOrientation = () => {
setTimeout(() => {
const orientation = video.videoHeight < video.videoWidth ? 'landscape' : 'portrait';
screen.orientation.lock(orientation);
}, video.videoHeight ? 0 : 500); // 等待视频加载
};

// 播放视频并进入全屏
video.play();
video.muted = false;
video.volume = 1;

setTimeout(() => {
videoContainer.requestFullscreen();
lockScreenOrientation();
}, 300);

} else {
// 没有找到视频
tipBox = gestureData.tipBoxTwo;
}

// 显示操作结果
tipBox.textContent = `全屏 ${video ? '成功' : '失败'}`;
tipBox.style.visibility = 'visible';

// 隐藏提示
setTimeout(() => {
tipBox.style.visibility = 'hidden';
}, 300);

§
يوللانغان ۋاقتى: 2026-02-11

上面的锁定方向和脚本自带的方向锁定冲突,不建议直接使用,仅供参考,提供思路。

جاۋاب قايتۇرۇش

جاۋاب قايتۇرۇش ئۈچۈن كىرىش.