YGestures

for Android Browser without Touch Gestures(particularly Yandex)

目前為 2019-11-21 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         YGestures
// @namespace    http://monodog.net/
// @version      0.4.3
// @license      CC-BY-NC-SA-4.0
// @description  for Android Browser without Touch Gestures(particularly Yandex)
// @description:zh-CN  向手机版yandex浏览器注入前进&后退手势,并可临时禁用某一手势
// @author       Monodog Theiions
// @icon         https://monodog.neocities.org/js/icon/YGestures.png
// @homepage     https://greasyfork.org/zh-CN/scripts/392713-ygestures
// @supportURL   mailto:[email protected]
// @match        http://*/*
// @include      https://*/*
// @exclude      *://*login*
// @run-at       document-body
// @require      https://cdn.jsdelivr.net/npm/[email protected]
// @grant        unsafeWindow
// @contributionURL https://qr.alipay.com/fkx02998fhy75rwy0pjx2eb
// @compatible   Yandex for Android , etc
// @incompatible All Browser without Touch
// ==/UserScript==

(function() {
    'use strict';
    if(window.navigator.userAgent.toLowerCase().indexOf("linux")>10)// code here
    {
        let YGBool=0;
        let array=["上隐藏*下显示*左前进*右后退,按住禁用滑动事件","右滑已经禁用,按住继续更改","水平滑动已经禁用,按住继续更改","上下功能已对调,左右滑动已禁用,按住还原"];
        let body=document.getElementsByTagName("body")[0];
        var floatDIV = document.createElement("div");
        floatDIV.style.cssText=
            "width:100%; height:30px; background:SlateBlue;color:Ivory;line-height:30px;display:none;position: fixed;bottom: 0;font-size:12px";
        floatDIV.innerHTML=array[0];
        body.appendChild(floatDIV);
        new Hammer(body).on("pan", function (e) {
        if(Math.abs(e.deltaY) < 2 * Math.abs(e.deltaX) + 2 ) ;
        else if((e.deltaY<0)!=(YGBool==3)) floatDIV.style.display="none";
        else floatDIV.style.display= "block";})
            .on("swipeleft", function (e) {
        if(Math.abs(e.deltaX) > 2 * Math.abs(e.deltaY) + 2 && YGBool<2 ) window.history.go(1);})
            .on("swiperight", function (e) {
        if(Math.abs(e.deltaX) > 2 * Math.abs(e.deltaY) + 2 && YGBool==0 ) window.history.go(-1);})
        new Hammer(floatDIV).on("pressup", function (e) {
            floatDIV.innerHTML=array[YGBool=(YGBool+1)&3];})
    }
})();