您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
三击页面任意位置即可关闭页面
当前为
// ==UserScript== // @name 三击关闭页面 // @namespace http://tampermonkey.net/ // @version 1.0.4 // @description 三击页面任意位置即可关闭页面 // @author 捈荼 // @license Apache License 2.0 // @match *://*/* // @require https://greasyfork.org/scripts/453846-string-format/code/string%20format.js // @run-at document-start // @grant unsafeWindow // @grant window.close // @grant GM_log // ==/UserScript== function nclickEvent(n, interval, dom, fn) { "use strict"; n = parseInt(n) < 1 ? 1 : parseInt(n); let count = 0, lastTime = 0; let handler = (event) => { let currentTime = new Date().getTime(); count = (currentTime - lastTime) < interval ? count + 1 : 0; GM_log('click event: last since {} ms;\nconsecutive {} times.\n'.format(currentTime - lastTime, count + 1)); lastTime = new Date().getTime(); if (count >= n - 1) { fn(event, n); count = 0; } }; dom.addEventListener('click', handler); } (function () { "use strict"; nclickEvent(3, 250, document, (_event, n) => { GM_log(n + 'click'); window.opener = null; window.open('', '_self'); setTimeout(() => window.close(), 1); }); })();