MCPcopy
hub / github.com/MALSync/MALSync / pageInterface

Interface pageInterface

src/pages/pageInterface.ts:4–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2import type { SyncPage } from '../pages-sync/syncPage';
3
4export interface pageInterface {
5 domain: string | string[];
6 languages: string[]; // (ISO language name) https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
7 name: string;
8 type: 'anime' | 'manga';
9 isSyncPage: (url: string) => boolean; // Return true if the current page is the sync page (Chapter/episode page)
10 isOverviewPage?: (url: string) => boolean; // Return true if the current page is the Overview page
11 getImage?: () => Promise<string | undefined> | string | undefined; // Return an image for the entry for local sync
12 sync: {
13 // Definitions for the sync page
14 getTitle: (url: string) => string; // Returns the title of the anime, used for the search on mal
15 getIdentifier: (url: string) => string; // An unique identifier of the anime. Has to be the same on the sync and overview page
16 getOverviewUrl: (url: string) => string; // Return a link to the Overview page.
17 getEpisode: (url: string) => number; // Return the recognized episode or chapter number as integer.
18 getVolume?: (url: string) => number; // (optional) Return the current volume number
19 getImage?: () => string | undefined; // Return an image for the entry for local sync
20 nextEpUrl?: (url: string) => string | undefined; // (optional) return the link to the next episode. Used for links on the userlist
21 uiSelector?: (selector: string) => void; // (optional) Inject a small ui with current status chapter... Only use this if there is no overview page
22 getMalUrl?: (
23 provider: 'MAL' | 'ANILIST' | 'KITSU' | 'SIMKL' | 'SHIKI',
24 ) => Promise<string | false> | string | false; // (optional) Return the MALUrl. Only really needs to be implemented if the page provides that info.
25 readerConfig?: mangaProgressConfig[]; // (optional) Usd to get the current reading progress of a manga chapter
26 };
27 overview?: {
28 getTitle: (url: string) => string;
29 getIdentifier: (url: string) => string;
30 uiSelector: (selector: string) => void;
31 getImage?: () => string | undefined;
32 getMalUrl?: (
33 provider: 'MAL' | 'ANILIST' | 'KITSU' | 'SIMKL' | 'SHIKI',
34 ) => Promise<string | false> | string | false;
35 list?: {
36 // (optional) Used for recognizing the list of episodes/chapters on the overview page. Best is to ask for help on discord for this.
37 offsetHandler: boolean;
38 elementsSelector: () => JQuery<HTMLElement>;
39 elementUrl?: (selector: JQuery<HTMLElement>) => string;
40 elementEp: (selector: JQuery<HTMLElement>) => number;
41 paginationNext?: (updateCheck: boolean) => boolean;
42 handleListHook?: (ep: number, epList: JQuery<HTMLElement>[]) => void;
43 getTotal?: () => number | undefined;
44 };
45 };
46 database?: string | undefined; // ignore, only for first party implementations
47 init: (page: SyncPage) => void; // This is the most important function. It controls when to start the check. Every time page.handlePage() is called it will check the overview/sync page.
48}
49
50export interface pageState {
51 on: 'SYNC' | 'OVERVIEW';

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected