diff --git a/src/handlers/google.ts b/src/handlers/google.ts index c3c3d7d..a547c18 100644 --- a/src/handlers/google.ts +++ b/src/handlers/google.ts @@ -44,8 +44,30 @@ export default async function google( `; + const navLinks = [ + ...window.document.querySelectorAll( + "table[class=AaVjTc] > tbody > tr > td > a" + ), + ].map((l) => { + const link = l as HTMLAnchorElement; + return `${link.innerHTML}`; + }); + + const currPage = ( + window.document.querySelector(".YyVfkd") as HTMLTableCellElement + ).cellIndex; + + const pageTd = `${currPage}`; + + if (currPage === 1) navLinks.splice(currPage - 1, 0, pageTd); + else navLinks.splice(currPage, 0, pageTd); + + const navigation = ` + ${navLinks.join("")} +
`; + return { - content: `${searchForm}${content.join("")}`, + content: `${searchForm}${content.join("")}${navigation}`, textContent: textContent.join("\n"), title: window.document.title, lang: window.document.documentElement.lang, diff --git a/static/common.css b/static/common.css index 58f8e49..7c455f4 100644 --- a/static/common.css +++ b/static/common.css @@ -62,3 +62,7 @@ main { background: var(--bg2); color: var(--fg); } + +a { + text-decoration: none; +}