// ==UserScript== // @name Press Enter key to go to next episode URL // @description Press Enter key to go to next episode URL // @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/* // @version 1.0.1 // ==/UserScript== // document.addEventListener('keydown', function(event) { // if (event.key === 'Enter') { // let currentUrl = new URL(window.location.href); // let params = new URLSearchParams(currentUrl.search); // let index = params.get('index'); // // Check if there's an index parameter and handle it // if (index !== null) { // let numIndex = parseInt(index, 10); // if (!isNaN(numIndex)) { // numIndex++; // params.set('index', numIndex.toString()); // currentUrl.search = params.toString(); // window.location.href = currentUrl.href; // return; // } // } // // Check if the URL path ends with a number and file extension // let pathMatch = currentUrl.pathname.match(/\/(\d+)\.(\w+)$/); // if (pathMatch) { // let pageNumber = pathMatch[1]; // let fileExtension = pathMatch[2]; // let nextPageNumber = parseInt(pageNumber, 10) + 1; // let nextPageNumberPadded = String(nextPageNumber).padStart(pageNumber.length, '0'); // currentUrl.pathname = currentUrl.pathname.replace(`/${pageNumber}.${fileExtension}`, `/${nextPageNumberPadded}.${fileExtension}`); // window.location.href = currentUrl.href; // return; // } // } // }); /*document.addEventListener('keydown', function(event) { if (event.key === 'Enter') { const currentURL = window.location.href; // Pattern 1: /001.html let match = currentURL.match(/\/(\d+)\.(\w+)$/); if (match) { const pageNumber = match[1]; const extension = match[2]; const nextPageNumber = String(parseInt(pageNumber, 10) + 1).padStart(pageNumber.length, '0'); const nextURL = currentURL.replace(`/${pageNumber}.${extension}`, `/${nextPageNumber}.${extension}`); window.location.href = nextURL; return; } // Pattern 2: /6467-1.html match = currentURL.match(/\/(\d+)-(\d+)\.(\w+)$/); if (match) { const seriesID = match[1]; const currentPage = match[2]; const extension = match[3]; const nextPage = String(parseInt(currentPage, 10) + 1).padStart(currentPage.length, '0'); const nextURL = currentURL.replace(`/${seriesID}-${currentPage}.${extension}`, `/${seriesID}-${nextPage}.${extension}`); window.location.href = nextURL; return; } // ✅ Pattern 3: /9314-2-6.html match = currentURL.match(/\/(\d+)-(\d+)-(\d+)\.(\w+)$/); if (match) { const id1 = match[1]; const id2 = match[2]; const page = match[3]; const extension = match[4]; const nextPage = String(parseInt(page, 10) + 1).padStart(page.length, '0'); const currentPart = `/${id1}-${id2}-${page}.${extension}`; const nextPart = `/${id1}-${id2}-${nextPage}.${extension}`; const nextURL = currentURL.replace(currentPart, nextPart); window.location.href = nextURL; return; } // Add more patterns here if needed } }); */ 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; } } });