您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Stops accidental logout on LowEndTalk by preventing access to the logout URL or similar variations using regex.
// ==UserScript== // @name Prevent Logout on LowEndTalk // @namespace http://tampermonkey.net/ // @version 1.4 // @description Stops accidental logout on LowEndTalk by preventing access to the logout URL or similar variations using regex. // @author Zyra // @match *://lowendtalk.com/* // @grant none // @license MIT // ==/UserScript== (function() { 'use strict'; const logoutRegex = /^https:\/\/lowendtalk\.com\/.*entry\/signout/i; function blockLogoutPage() { if (logoutRegex.test(window.location.href)) { window.location.href = 'https://lowendtalk.com/'; } } blockLogoutPage(); let previousURL = window.location.href; setInterval(() => { if (previousURL !== window.location.href) { previousURL = window.location.href; blockLogoutPage(); } }, 500); document.body.addEventListener('click', function(event) { const target = event.target.closest('a'); if (target && logoutRegex.test(target.href)) { event.preventDefault(); alert("Logout prevented."); } }); window.addEventListener('popstate', blockLogoutPage); window.addEventListener('hashchange', blockLogoutPage); })();