mirror of
https://github.com/txtdot/txtdot
synced 2024-10-18 14:40:19 +03:00
fix: google main page
This commit is contained in:
parent
b42036321e
commit
5a067089cc
@ -50,13 +50,6 @@ export default async function google(
|
|||||||
"APjFqb"
|
"APjFqb"
|
||||||
) as HTMLTextAreaElement;
|
) as HTMLTextAreaElement;
|
||||||
|
|
||||||
const searchForm = `
|
|
||||||
<form onsubmit="window.location.href = '/get?url=https://www.google.com/search?q='+ document.getElementById('q').value.split(' ').join('+'); return false">
|
|
||||||
<input type="text" name="q" id="q" value="${search?.value}">
|
|
||||||
<input type="button" value="Search" onclick="window.location.href = '/get?url=https://www.google.com/search?q='+ document.getElementById('q').value.split(' ').join('+');">
|
|
||||||
</form>
|
|
||||||
`;
|
|
||||||
|
|
||||||
const navLinks = [
|
const navLinks = [
|
||||||
...window.document.querySelectorAll(
|
...window.document.querySelectorAll(
|
||||||
"table[class=AaVjTc] > tbody > tr > td > a"
|
"table[class=AaVjTc] > tbody > tr > td > a"
|
||||||
@ -66,21 +59,28 @@ export default async function google(
|
|||||||
return `<td><a href="${link.href}">${link.innerHTML}</a></td>`;
|
return `<td><a href="${link.href}">${link.innerHTML}</a></td>`;
|
||||||
});
|
});
|
||||||
|
|
||||||
const currPage = (
|
const currPage =
|
||||||
window.document.querySelector(".YyVfkd") as HTMLTableCellElement
|
(window.document.querySelector(".YyVfkd") as HTMLTableCellElement)
|
||||||
).cellIndex;
|
?.cellIndex || 0;
|
||||||
|
|
||||||
const pageTd = `<td>${currPage}</td>`;
|
const pageTd = `<td>${currPage}</td>`;
|
||||||
|
|
||||||
if (currPage === 1) navLinks.splice(currPage - 1, 0, pageTd);
|
if (currPage === 1) navLinks.splice(currPage - 1, 0, pageTd);
|
||||||
else navLinks.splice(currPage, 0, pageTd);
|
else if (currPage !== 0) navLinks.splice(currPage, 0, pageTd);
|
||||||
|
|
||||||
const navigation = `<table>
|
const navigation = `<table>
|
||||||
<tbody><tr>${navLinks.join("")}</tr></tbody>
|
<tbody><tr>${navLinks.join("")}</tr></tbody>
|
||||||
</table>`;
|
</table>`;
|
||||||
|
|
||||||
|
const searchForm = `
|
||||||
|
<form onsubmit="window.location.href = '/get?url=https://www.google.com/search?q='+ document.getElementById('q').value.split(' ').join('+'); return false">
|
||||||
|
<input type="text" name="q" id="q" value="${search?.value}">
|
||||||
|
<input type="button" value="Search" onclick="window.location.href = '/get?url=https://www.google.com/search?q='+ document.getElementById('q').value.split(' ').join('+');">
|
||||||
|
</form>
|
||||||
|
`;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
content: `${searchForm}${content.join("")}${navigation}`,
|
content: `${searchForm}${content.join("")}${navigation || ""}`,
|
||||||
textContent: textContent.join("\n"),
|
textContent: textContent.join("\n"),
|
||||||
title: window.document.title,
|
title: window.document.title,
|
||||||
lang: window.document.documentElement.lang,
|
lang: window.document.documentElement.lang,
|
||||||
|
Loading…
Reference in New Issue
Block a user