local ref

This commit is contained in:
Lalle 2023-03-22 04:54:47 +01:00
parent 07f62dd96b
commit 3dda6789c2
No known key found for this signature in database
GPG Key ID: A6583D207A8F6B0D

View File

@ -31,7 +31,8 @@ const fetchCatalog = async (boardID: string): Promise<Page[]> => {
// Creates the json index for the catalog. // Creates the json index for the catalog.
const createThreadElement = (thread: Thread, boardID: string,) => { const createThreadElement = (thread: Thread, boardID: string,) => {
const { no, images, com, sub, tim, ext, tn_h, tn_w } = thread; const { no, images, com, sub, tim, ext, tn_h, tn_w } = thread;
const threadURL = `https://boards.4channel.org/${boardID}/thread/${no}`; //const threadURL = `https://boards.4channel.org/${boardID}/thread/${no}`;
const localURL = `/${boardID}/thread/${no}`;
// if ext is .webm or gif, show the thumbnail instead. // if ext is .webm or gif, show the thumbnail instead.
let imgSrc; let imgSrc;
if (ext === '.webm' || ext === '.gif') { if (ext === '.webm' || ext === '.gif') {
@ -42,7 +43,7 @@ const createThreadElement = (thread: Thread, boardID: string,) => {
const ratio = 150 / Math.max(tn_w, tn_h); const ratio = 150 / Math.max(tn_w, tn_h);
return ( return (
<div key={`thread-${no}`} id={`thread-${no}`} className="thread"> <div key={`thread-${no}`} id={`thread-${no}`} className="thread">
<a href={threadURL} target="_blank" rel="noopener noreferrer"> <a href={localURL} className='catalog-link'>
<img id={`thumb-${no}`} src={imgSrc} data-height={tn_h} data-width={tn_w} style={{width: `${tn_w * ratio}px`, height: `${tn_h * ratio}px`}} alt={`Thumbnail for thread ${no}`} /> <img id={`thumb-${no}`} src={imgSrc} data-height={tn_h} data-width={tn_w} style={{width: `${tn_w * ratio}px`, height: `${tn_h * ratio}px`}} alt={`Thumbnail for thread ${no}`} />
</a> </a>
<div id={`meta-${no}`} className="meta" title="(R)eplies / (I)mage Replies"> <div id={`meta-${no}`} className="meta" title="(R)eplies / (I)mage Replies">