fix(sdk): jsx content join
and fix searx search title
This commit is contained in:
parent
d4aa5b47a6
commit
91cbc415bf
@ -11,13 +11,7 @@ export function PageFooter({
|
|||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{page !== 1 ? (
|
{page !== 1 ? <a href={previous}>Previous </a> : <></>}| {page} |
|
||||||
<>
|
|
||||||
<a href={previous}>Previous </a> |
|
|
||||||
</>
|
|
||||||
) : (
|
|
||||||
<></>
|
|
||||||
)}
|
|
||||||
<a href={next}> Next</a>
|
<a href={next}> Next</a>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
@ -49,7 +49,7 @@ async function search(
|
|||||||
|
|
||||||
const content = (
|
const content = (
|
||||||
<>
|
<>
|
||||||
{articles_parsed.map((a) => a.html).join('')}
|
{articles_parsed.map((a) => a.html)}
|
||||||
<PageFooter page={page} previous={previous} next={next} />
|
<PageFooter page={page} previous={previous} next={next} />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
@ -59,7 +59,7 @@ async function search(
|
|||||||
return {
|
return {
|
||||||
content: content,
|
content: content,
|
||||||
textContent,
|
textContent,
|
||||||
title: `${search} - Searx - Page ${page}`,
|
title: `"${(document.getElementById('q') as HTMLInputElement).value}" - Searx - Page ${page}`,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,28 +35,25 @@ function postParser(el: Element | null): string {
|
|||||||
const body = el.querySelector('.js-post-body')?.innerHTML || '';
|
const body = el.querySelector('.js-post-body')?.innerHTML || '';
|
||||||
const voteCount = el.querySelector('.js-vote-count')?.textContent || '';
|
const voteCount = el.querySelector('.js-vote-count')?.textContent || '';
|
||||||
|
|
||||||
const footer = [...el.querySelectorAll('.post-signature')]
|
const footer = [...el.querySelectorAll('.post-signature')].map((el) => {
|
||||||
.map((el) => {
|
const userName = el.querySelector('.user-details a')?.textContent || '';
|
||||||
const userName = el.querySelector('.user-details a')?.textContent || '';
|
const userUrl =
|
||||||
const userUrl =
|
(el.querySelector('.user-details a') as HTMLAnchorElement)?.href || '';
|
||||||
(el.querySelector('.user-details a') as HTMLAnchorElement)?.href || '';
|
const userTitle = el.querySelector('.user-action-time')?.textContent || '';
|
||||||
const userTitle =
|
|
||||||
el.querySelector('.user-action-time')?.textContent || '';
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<h4>
|
<h4>
|
||||||
{userTitle}
|
{userTitle}
|
||||||
{userUrl ? (
|
{userUrl ? (
|
||||||
<>
|
<>
|
||||||
by <a href={userUrl}>{userName}</a>
|
by <a href={userUrl}>{userName}</a>
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<></>
|
<></>
|
||||||
)}
|
)}
|
||||||
</h4>
|
</h4>
|
||||||
);
|
);
|
||||||
})
|
});
|
||||||
.join('');
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
/* Visit https://aka.ms/tsconfig to read more about this file */
|
/* Visit https://aka.ms/tsconfig to read more about this file */
|
||||||
|
|
||||||
/* Projects */
|
/* Projects */
|
||||||
// "incremental": true /* Save .tsbuildinfo files to allow for incremental compilation of projects. */,
|
"incremental": true /* Save .tsbuildinfo files to allow for incremental compilation of projects. */,
|
||||||
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
// "composite": true /* Enable constraints that allow a TypeScript project to be used with project references. */,
|
||||||
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
|
"tsBuildInfoFile": "./.tsbuildinfo" /* Specify the path to .tsbuildinfo incremental compilation file. */,
|
||||||
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
|
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
|
||||||
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
||||||
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
||||||
|
@ -1,19 +1,19 @@
|
|||||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
|
/* eslint-disable @typescript-eslint/no-namespace */
|
||||||
export namespace JSX {
|
export namespace JSX {
|
||||||
export type Element = string;
|
export type Element = string;
|
||||||
export interface IntrinsicElements {
|
export interface IntrinsicElements {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
||||||
[elemName: string]: any;
|
[elemName: string]: any;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createElement(
|
export function createElement(
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
||||||
name: any,
|
name: any,
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
||||||
props: { [id: string]: any },
|
props: { [id: string]: any },
|
||||||
...content: string[]
|
...inner: any[]
|
||||||
) {
|
) {
|
||||||
|
const content = inner.flat().join('');
|
||||||
|
|
||||||
if (typeof name === 'string') {
|
if (typeof name === 'string') {
|
||||||
props = props || {};
|
props = props || {};
|
||||||
const propsstr = Object.keys(props)
|
const propsstr = Object.keys(props)
|
||||||
@ -24,12 +24,12 @@ export function createElement(
|
|||||||
})
|
})
|
||||||
.join(' ');
|
.join(' ');
|
||||||
|
|
||||||
return content.length === 0
|
return inner.length === 0
|
||||||
? `<${name} ${propsstr}/>`
|
? `<${name} ${propsstr}/>`
|
||||||
: `<${name} ${propsstr}>${content.join('')}</${name}>`;
|
: `<${name} ${propsstr}>${content}</${name}>`;
|
||||||
} else if (typeof name === 'function') {
|
} else if (typeof name === 'function') {
|
||||||
return name(props, ...content);
|
return name(props, content);
|
||||||
} else {
|
} else {
|
||||||
return content.join('');
|
return content;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
/* Visit https://aka.ms/tsconfig to read more about this file */
|
/* Visit https://aka.ms/tsconfig to read more about this file */
|
||||||
|
|
||||||
/* Projects */
|
/* Projects */
|
||||||
// "incremental": true /* Save .tsbuildinfo files to allow for incremental compilation of projects. */,
|
"incremental": true /* Save .tsbuildinfo files to allow for incremental compilation of projects. */,
|
||||||
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
// "composite": true /* Enable constraints that allow a TypeScript project to be used with project references. */,
|
||||||
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
|
"tsBuildInfoFile": "./.tsbuildinfo" /* Specify the path to .tsbuildinfo incremental compilation file. */,
|
||||||
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
|
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
|
||||||
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
||||||
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
/* Visit https://aka.ms/tsconfig to read more about this file */
|
/* Visit https://aka.ms/tsconfig to read more about this file */
|
||||||
|
|
||||||
/* Projects */
|
/* Projects */
|
||||||
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
|
"incremental": true /* Save .tsbuildinfo files to allow for incremental compilation of projects. */,
|
||||||
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
// "composite": true /* Enable constraints that allow a TypeScript project to be used with project references. */,
|
||||||
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
|
"tsBuildInfoFile": "./.tsbuildinfo" /* Specify the path to .tsbuildinfo incremental compilation file. */,
|
||||||
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
|
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
|
||||||
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
||||||
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user