下拉刷新

下拉刷新,适用于via

目前為 2023-08-07 提交的版本,檢視 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         下拉刷新
// @namespace    https://viayoo.com/
// @version      0.1
// @description 下拉刷新,适用于via
// @homepageURL  https://app.viayoo.com/addons/40
// @author       Sky
// @run-at       document-start
// @match        *
// @grant        none
// @license MIT
// ==/UserScript==
/*
* @name: 下拉刷新
* @Author: Sky
* @version: 1.7
* @description: 位于页面顶端时下拉刷新
* @include: *
* @createTime: 2020-3-6 01:00
* @updateTime: 2020-10-9 21:10
*/
(function(){const
/*等号后的数表示最小触发下拉距离(px)*/
min_dY = 300,
/*----以下勿改----*/
key=encodeURIComponent('下拉刷新:执行判断');if(window[key]){return;}try{window[key]=true;let strtX,strtY=0,rchTp,onePt=false;document.addEventListener('touchstart',function(e){if(onePt){rchTp=false;}else{onePt=true;rchTp=(document.body.scrollTop||document.documentElement.scrollTop)<50;strtX=e.touches[0].screenX;strtY=e.touches[0].screenY;}},{'passive':true});document.addEventListener('touchend',function(e){if(rchTp){const dY=Math.floor(e.changedTouches[0].screenY-strtY);if(dY>min_dY&&Math.abs(e.changedTouches[0].screenX-strtX)<(0.4*dY)){location.reload();}rchTp=false;}onePt=false;},{'passive':true,'capture':true});}catch(err){console.log('下拉刷新:',err);}})();