YGestures

for Android Browser without Touch Gestures(particularly Yandex)

当前为 2019-11-21 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name YGestures
  3. // @namespace http://monodog.net/
  4. // @version 0.4.2
  5. // @license CC-BY-NC-SA-4.0
  6. // @description for Android Browser without Touch Gestures(particularly Yandex)
  7. // @description:zh-CN 向手机版yandex浏览器注入前进&后退手势,并可临时禁用某一手势
  8. // @author Monodog Theiions
  9. // @icon https://monodog.neocities.org/js/icon/YGestures.png
  10. // @homepage https://monodog.neocities.org/YGestures
  11. // @supportURL mailto:wung.thy@gmail.com
  12. // @match http://*/*
  13. // @include https://*/*
  14. // @exclude *://*login*
  15. // @run-at document-body
  16. // @require https://cdn.jsdelivr.net/npm/hammerjs@2.0.8
  17. // @grant unsafeWindow
  18. // @contributionURL https://qr.alipay.com/fkx02998fhy75rwy0pjx2eb
  19. // @compatible Yandex for Android , etc
  20. // @incompatible All Browser without Touch
  21. // ==/UserScript==
  22.  
  23. (function() {
  24. 'use strict';
  25. if(window.navigator.userAgent.toLowerCase().indexOf("linux")>10)// code here
  26. {
  27. let YGBool=0;
  28. let array=["上隐藏*下显示*左前进*右后退,按住禁用滑动事件","右滑已经禁用,按住继续更改","水平滑动已经禁用,按住继续更改","上下功能已对调,左右滑动已禁用,按住还原"];
  29. let body=document.getElementsByTagName("body")[0];
  30. var floatDIV = document.createElement("div");
  31. floatDIV.style.cssText=
  32. "width:100%; height:30px; background:SlateBlue;color:Ivory;line-height:30px;display:none;position: fixed;bottom: 0;font-size:12px";
  33. floatDIV.innerHTML=array[0];
  34. body.appendChild(floatDIV);
  35. new Hammer(body).on("pan", function (e) {
  36. if(Math.abs(e.deltaY) < 2 * Math.abs(e.deltaX) + 2 ) ;
  37. else if((e.deltaY<0)!=(YGBool==3)) floatDIV.style.display="none";
  38. else floatDIV.style.display= "block";})
  39. .on("swipeleft", function (e) {
  40. if(Math.abs(e.deltaX) > 2 * Math.abs(e.deltaY) + 2 && YGBool<2 ) window.history.go(1);})
  41. .on("swiperight", function (e) {
  42. if(Math.abs(e.deltaX) > 2 * Math.abs(e.deltaY) + 2 && YGBool==0 ) window.history.go(-1);})
  43. new Hammer(floatDIV).on("pressup", function (e) {
  44. floatDIV.innerHTML=array[YGBool=(YGBool+1)&3];})
  45. }
  46. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址