Skip to content

Commit

Permalink
Merge pull request #69 from anime-skip/funimation-setup
Browse files Browse the repository at this point in the history
Funimation Setup & Page Action
  • Loading branch information
aklinker1 authored Aug 26, 2020
2 parents 503255f + 881be64 commit 8b5e61f
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/content-scripts/funimation/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ console.log('INJECTED content-scripts/funimation/index.ts');

global.service = 'funimation';
global.getRootQuery = (): string => {
return 'body>div';
return 'body #funimation-player';
};
global.getVideoQuery = (): string => {
return 'video';
return '#brightcove-player > video';
};

document.body.classList.add('hide-for-anime-skip');
10 changes: 8 additions & 2 deletions src/content-scripts/funimation/style.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
.hide-for-anime-skip * {
display: none !important;
.hide-for-anime-skip {
.vjs-poster,
.vjs-text-track-display,
#funimation-gradient,
.vjs-dock-shelf,
.vjs-dock-text {
display: none !important;
}
}
13 changes: 11 additions & 2 deletions src/manifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@ const services = [
{
folder: 'example',
matches: ['file:///*/example/index.html'],
page_matches: ['file:///*/example/index.html'],
},
{
folder: 'vrv',
matches: ['https://static.vrv.co/*'],
page_matches: ['https://vrv.co/*'],
},
{
folder: 'funimation',
matches: ['https://www.funimation.com/*'],
matches: ['https://www.funimation.com/player/*'],
page_matches: ['https://www.funimation.com/*'],
},
];

Expand All @@ -39,6 +42,12 @@ services.forEach(service => {
css: ['player/index.css', `content-scripts/${service.folder}/index.css`],
all_frames: true,
});

// Add urls to the page_action
manifest.page_action.show_matches.push(...service.page_matches);
});

module.exports = manifest;
module.exports = {
manifest,
services,
};
6 changes: 5 additions & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
"description": "Skip intros, credits, filler and more on supported services",
"manifest_version": 2,
"permissions": ["storage", "tabs"],
"browser_action": {
"page_action": {
"show_matches": [
"https://www.anime-skip.com/get-started*",
"https://anime-skip.com/get-started*"
],
"browser_style": true,
"default_icon": {
"16": "assets/extension-logo/16.png",
Expand Down
17 changes: 12 additions & 5 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const { VueLoaderPlugin } = require('vue-loader');
const { version } = require('./package.json');
const WebpackShellPluginNext = require('webpack-shell-plugin-next');
const path = require('path');
const { services } = require('./src/manifest');

const example = path.resolve(__dirname, 'example', 'index.html');

Expand All @@ -21,11 +22,17 @@ const config = {
'options/index': './options/index.ts',

'player/index': './player/index.ts',
'content-scripts/example/index': './content-scripts/example/index.ts',
'content-scripts/vrv/index': './content-scripts/vrv/index.ts',
'content-scripts/all': './content-scripts/all.ts',
'content-scripts/keyboard-blocker': './content-scripts/keyboard-blocker.ts',
'content-scripts/anime-skip/index': './content-scripts/anime-skip/index.ts',

...services.reduce(
(map, service) => ({
...map,
[`content-scripts/${service.folder}/index`]: `./content-scripts/${service.folder}/index.ts`,
}),
{}
),
},
output: {
path: __dirname + '/dist',
Expand Down Expand Up @@ -117,14 +124,14 @@ const config = {
from: 'manifest.json',
to: 'manifest.json',
transform: _ => {
const content = require('./src/manifest');
const { manifest } = require('./src/manifest');

if (config.mode === 'development') {
content['content_security_policy'] =
manifest['content_security_policy'] =
"script-src 'self' 'unsafe-eval'; object-src 'self'";
}

return JSON.stringify(content, null, 2);
return JSON.stringify(manifest, null, 2);
},
},
]),
Expand Down

0 comments on commit 8b5e61f

Please sign in to comment.