您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
2023. 5. 14. 오후 4:58:27
当前为
// ==UserScript== // @name arca.live page mover // @namespace Violentmonkey Scripts // @match https://arca.live/* // @grant none // @version 1.0.1.0 // @author 7r // @license MIT // @description 2023. 5. 14. 오후 4:58:27 // ==/UserScript== // 유저스크립트로 변경된 코드 (function () { function getMovedPage(url, direction) { if (!url.match(/(.*\/write)/)) { const queryParams = {}; const [paths, queryString] = url.split('?'); const path = paths.split("/").filter(part => part !== "" && !part.includes(":")); // alert(`path0: ${path[0]}\npath1: ${path[1]}\npath2: ${path[2]}\npath3: ${path[3]}\n`) if(queryString){ queryString.split("&").forEach(pair=>{ const[key,value]=pair.split("="); queryParams[key]=decodeURIComponent(value||"") }); } let openedPosting = path[3] ? (path.splice(3, 1), true) : false; queryParams["p"] = getQueryParams(queryParams["p"], direction, openedPosting); const updatedQueryString = Object.keys(queryParams) .map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(queryParams[key])}`) .join("&"); const updatedUrl = `${path.join("/")}?${updatedQueryString}`; location.href = `https://${updatedUrl}`; } } function getQueryParams(queryParamsPage, direction, openedPosting) { const numPage = parseInt(queryParamsPage); return (queryParamsPage && openedPosting) ? numPage : (direction ? numPage - 1 || 1 : numPage + 1) || (openedPosting || direction ? 1 : 2); } function isInputElement(event) { return ['INPUT', 'TEXTAREA'].includes(event.target.nodeName) || event.target.classList.contains('fr-element'); } document.addEventListener('keydown', function (event) { if ( !isInputElement(event) && // Check if the event doesn't originate from an input element !event.altKey && // Check if the Alt key is not pressed !event.ctrlKey && // Check if the Ctrl key is not pressed !event.shiftKey && // Check if the Shift key is not pressed event.keyCode !== 17 && // Check if the key code is not specifically for the Ctrl key event.keyCode !== 18 && // Check if the key code is not specifically for the Alt key event.keyCode !== 16 // Check if the key code is not specifically for the Shift key ) { const isLeftArrow = event.keyCode === 37; const isRightArrow = event.keyCode === 39; if (isLeftArrow || isRightArrow) { getMovedPage(document.location.href, isLeftArrow); event.preventDefault(); } } }); })();