// ==UserScript== // @name Press Enter / Shift+Enter to navigate episodes // @description Press Enter to go to next episode, Shift+Enter to go to previous episode // @match https://yhdm6a.com/* // @match http://ysjdm6.com/* // @match http://agedm6.com/* // @match http://yuejuwu.me/* // @match http*://agedm1.com/* // @match http*://agedm2.com/* // @match http://ysjdm2.com/* // @match http://acgdmw.com/* // @match *://www.yhdm03.com/* // @match *://yhdm007.com/* // @match *://www.bumimi20.com/* // @match https://www.olevod.com/* // @match http://100.65.173.16:5244/* // @match http://192.168.10.102:5244/* // @match http://yhdm.in/* // @match http://www.iyinghua.com/* // @match https://www.mxdm.xyz/* // @match https://yhdm.one/* // @match https://yhdm6.top/* // @match https://www.868dm.com/* // @match https://www.agedm.io/* // @match https://www.skr2.cc/* // @version 1.1.1 // @run-at document-start // ==/UserScript== /* document.addEventListener('keydown', function(event) { if (event.key !== 'Enter') return; const currentURL = window.location.href; const direction = event.shiftKey ? -1 : 1; // --------------------------------------------------------- // Pattern 1: /001.html // e.g. .../005.html → .../006.html // --------------------------------------------------------- let match = currentURL.match(/\/(\d+)\.(\w+)$/); if (match) { const num = match[1]; const ext = match[2]; const nextNum = String(parseInt(num, 10) + direction).padStart(num.length, "0"); const nextURL = currentURL.replace(`/${num}.${ext}`, `/${nextNum}.${ext}`); window.location.href = nextURL; return; } // --------------------------------------------------------- // Pattern 2: /6467-1.html // e.g. .../6467-1.html → .../6467-2.html // --------------------------------------------------------- match = currentURL.match(/\/(\d+)-(\d+)\.(\w+)$/); if (match) { const id = match[1]; const num = match[2]; const ext = match[3]; const nextNum = String(parseInt(num, 10) + direction).padStart(num.length, "0"); const nextURL = currentURL.replace(`/${id}-${num}.${ext}`, `/${id}-${nextNum}.${ext}`); window.location.href = nextURL; return; } // --------------------------------------------------------- // Pattern 3: /9314-2-6.html // e.g. .../9314-2-6.html → .../9314-2-7.html // --------------------------------------------------------- match = currentURL.match(/\/(\d+)-(\d+)-(\d+)\.(\w+)$/); if (match) { const id1 = match[1]; const id2 = match[2]; const num = match[3]; const ext = match[4]; const nextNum = String(parseInt(num, 10) + direction).padStart(num.length, "0"); const currentPart = `/${id1}-${id2}-${num}.${ext}`; const nextPart = `/${id1}-${id2}-${nextNum}.${ext}`; const nextURL = currentURL.replace(currentPart, nextPart); window.location.href = nextURL; return; } // --------------------------------------------------------- // Pattern 4: /number or /number/ // Generic fallback // e.g. .../18 → .../19 // .../18/ → .../19/ // --------------------------------------------------------- match = currentURL.match(/\/(\d+)(\/?)$/); if (match) { const num = match[1]; const trailing = match[2] || ""; const nextNum = String(parseInt(num, 10) + direction); const nextURL = currentURL.replace(`/${num}${trailing}`, `/${nextNum}${trailing}`); window.location.href = nextURL; return; } }); */ document.addEventListener('keydown', function(event) { if (event.key !== 'Enter') return; const currentURL = window.location.href; const direction = event.shiftKey ? -1 : 1; // --------------------------------------------------------- // Universal pattern: // Find the last number in the URL and increase/decrease it. // // Works for: // /005.html // /6467-1.html // /9314-2-6.html // /209418-2-13/ // /18 // /18/ // /play/xxx/yyy/008/ // --------------------------------------------------------- const match = currentURL.match(/^(.*?)(\d+)((?:\.\w+)?\/?)$/); if (!match) return; const prefix = match[1]; const num = match[2]; const suffix = match[3]; const nextNum = String(parseInt(num, 10) + direction) .padStart(num.length, "0"); const nextURL = prefix + nextNum + suffix; window.location.href = nextURL; });