diff --git a/src/content-scripts/adn.ts b/src/content-scripts/adn.ts new file mode 100644 index 0000000..6b3fe2a --- /dev/null +++ b/src/content-scripts/adn.ts @@ -0,0 +1,39 @@ +/* eslint-disable no-param-reassign */ +import create from '@/content-scripts/web-integration'; + +function init(): void { + // In case we are on an anime page. + if (document.querySelector('body .adn-maincontent meta[itemprop="name"]')) { + create({ + selector: 'body .adn-maincontent meta[itemprop="name"]', + getValue: (node: HTMLElement) => node.getAttribute('content'), + getTitle: (node: HTMLElement) => node.getAttribute('content'), + appendInPage(node: HTMLElement): void { + node.style.marginBottom = '10px'; + node.style.textAlign = 'left'; + + const target = document.querySelector('body .adn-maincontent .header h1'); + if (target) target.prepend(node); + + const targetMobile = document.querySelector('body .adn-maincontent .mobile-h1'); + if (targetMobile) targetMobile.prepend(node.cloneNode(true)); + }, + }); + } + + // In case we are on an anime episode page. + if (document.querySelector('body .adn-maincontent .adn-player-header h1 > a')) { + create({ + selector: 'body .adn-maincontent .adn-player-header h1 > a', + appendInPage(node: HTMLElement): void { + node.style.marginBottom = '10px'; + node.style.textAlign = 'left'; + + const target = document.querySelector('body .adn-maincontent .adn-player-header h1'); + if (target) target.prepend(node); + }, + }); + } +} + +init(); diff --git a/src/manifest_chrome.json b/src/manifest_chrome.json index 17b26d3..0a1982b 100644 --- a/src/manifest_chrome.json +++ b/src/manifest_chrome.json @@ -45,6 +45,10 @@ { "matches": ["*://www.hidive.com/*"], "js": ["js/content/hidive.js"] + }, + { + "matches": ["*://animedigitalnetwork.fr/*"], + "js": ["js/content/adn.js"] } ] } diff --git a/src/manifest_firefox.json b/src/manifest_firefox.json index d850300..15f6488 100644 --- a/src/manifest_firefox.json +++ b/src/manifest_firefox.json @@ -49,6 +49,10 @@ { "matches": ["*://www.hidive.com/*"], "js": ["js/content/hidive.js"] + }, + { + "matches": ["*://animedigitalnetwork.fr/*"], + "js": ["js/content/adn.js"] } ], "chrome_settings_overrides": { diff --git a/vue.config.js b/vue.config.js index 7dbf337..cba362b 100644 --- a/vue.config.js +++ b/vue.config.js @@ -15,6 +15,7 @@ const scripts = { wakanim: './src/content-scripts/wakanim.ts', animelab: './src/content-scripts/animelab.ts', hidive: './src/content-scripts/hidive.ts', + adn: './src/content-scripts/adn.ts', }, };