()
| 21 | let page; |
| 22 | |
| 23 | async function main() { |
| 24 | if (utils.isDomainMatching(window.location.href, 'myanimelist.net')) { |
| 25 | injectDb(); |
| 26 | const mal = new MyAnimeListClass(window.location.href); |
| 27 | mal.init(); |
| 28 | if (window.location.href.indexOf('episode') > -1) { |
| 29 | await runPage(); |
| 30 | } |
| 31 | } else if (utils.isDomainMatching(window.location.href, 'anilist.co')) { |
| 32 | /* eslint-disable-next-line @typescript-eslint/no-unused-vars */ |
| 33 | const anilist = new AnilistClass(window.location.href); |
| 34 | } else if (utils.isDomainMatching(window.location.href, 'kitsu.app')) { |
| 35 | /* eslint-disable-next-line @typescript-eslint/no-unused-vars */ |
| 36 | const kitsu = new KitsuClass(window.location.href); |
| 37 | } else if (utils.isDomainMatching(window.location.href, 'mangabaka.org')) { |
| 38 | /* eslint-disable-next-line @typescript-eslint/no-unused-vars */ |
| 39 | const mangabaka = new MangaBakaClass(); |
| 40 | } else if (utils.isDomainMatching(window.location.href, 'simkl.com')) { |
| 41 | /* eslint-disable-next-line @typescript-eslint/no-unused-vars */ |
| 42 | const simkl = new SimklClass(window.location.href); |
| 43 | } else if ( |
| 44 | window.location.hostname === 'malsync.moe' && |
| 45 | window.location.pathname.startsWith('/mal/oauth') |
| 46 | ) { |
| 47 | oauth(); |
| 48 | } else if ( |
| 49 | window.location.hostname === 'malsync.moe' && |
| 50 | window.location.pathname.startsWith('/anilist/oauth') |
| 51 | ) { |
| 52 | anilistOauth(); |
| 53 | } else if ( |
| 54 | window.location.hostname === 'malsync.moe' && |
| 55 | window.location.pathname.startsWith('/mangabaka/oauth') |
| 56 | ) { |
| 57 | mangabakaOauth(); |
| 58 | } else if ( |
| 59 | window.location.hostname === 'malsync.moe' && |
| 60 | window.location.pathname.startsWith('/shikimori/oauth') |
| 61 | ) { |
| 62 | shikiOauth(); |
| 63 | } else if ( |
| 64 | window.location.hostname === 'malsync.moe' && |
| 65 | window.location.pathname.startsWith('/pwa') |
| 66 | ) { |
| 67 | injectDb(); |
| 68 | pwa(); |
| 69 | } else { |
| 70 | await runPage(); |
| 71 | } |
| 72 | firebaseNotification(); |
| 73 | |
| 74 | shortcutListener(shortcut => { |
| 75 | con.log('[content] Shortcut', shortcut); |
| 76 | switch (shortcut.shortcut) { |
| 77 | case 'correctionShort': |
| 78 | page.openCorrectionUi(); |
| 79 | break; |
| 80 | case 'syncShort': |
no test coverage detected