// ==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 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/* // @version 1.0.6 // @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') { const currentURL = window.location.href; // General pattern: match any URL ending in .html, find last number before .html const match = currentURL.match(/(.*?)(\d+)(\.html)$/); if (match) { const prefix = match[1]; // Everything before the last number const numberStr = match[2]; // The number to increment const suffix = match[3]; // Usually ".html" const nextNumber = String(parseInt(numberStr, 10) + 1).padStart(numberStr.length, '0'); const nextURL = `${prefix}${nextNumber}${suffix}`; window.location.href = nextURL; } } }); */