-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
be9cfe5
commit cf42d8e
Showing
5 changed files
with
57 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import WebIntegration from '@/utils/WebIntegration'; | ||
import * as Enum from '@/utils/Enum'; | ||
|
||
/** | ||
* Display overlay for anime page. | ||
*/ | ||
function animePage(): void { | ||
const titleNode = document.querySelector('#main > .content-series2'); | ||
|
||
const title = titleNode ? titleNode.getAttribute('data-title') : null; | ||
|
||
if (title) WebIntegration.displayButton(title, Enum.SearchType.ANIME); | ||
} | ||
|
||
/** | ||
* Display overlay for anime episode page. | ||
*/ | ||
function animeEpisodePage(): void { | ||
const titleNode = document.querySelector('#video-details h1 > a') as HTMLElement; | ||
|
||
const title = titleNode ? titleNode.innerText : null; | ||
|
||
if (title) WebIntegration.displayButton(title, Enum.SearchType.ANIME); | ||
} | ||
|
||
async function init() { | ||
try { | ||
if (!(await WebIntegration.isEnabled())) return; | ||
|
||
// In case we are on an anime page. | ||
if (document.querySelector('#main > .content-series2')) { | ||
animePage(); | ||
} | ||
|
||
// In case we are on an anime episode page. | ||
if (document.getElementById('video-details')) { | ||
animeEpisodePage(); | ||
} | ||
} | ||
catch (e) { | ||
console.error(e); | ||
} | ||
} | ||
|
||
init(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters