Skip to content

Commit

Permalink
Ready for first release
Browse files Browse the repository at this point in the history
  • Loading branch information
gmertes committed Oct 18, 2021
1 parent bd7945d commit ebf0911
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 27 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Netflix Intro Skip (NflxIntroSkip)
NflxIntroSkip (Netflix Intro Skip)
-------------
A browser extension that does one thing and one thing only: automatically skip show intros on Netflix.

Expand All @@ -24,14 +24,14 @@ npm run build

How it works
------
The extension works as a content-script that monitors changes in the DOM using `MutationObserver` and looks for the appearance of the Skip Intro button. If it finds it, it evokes `click()` on it. That's it.
The extension works as a content-script that monitors changes in the DOM using `MutationObserver` and looks for the appearance of the Skip Intro button. If it finds it, it evokes `click()` on it.

Typicaly the Skip Intro button will appear in the DOM before it is visible on screen, so the intro may be skipped before you even see the button.
Note that means that it does not matter if the intro is started organically, or if you time skip into it. In both cases the extension will skip it as soon as the Skip Intro button appears. There's no mechanic to only skip the intro once per playback.

Notes
------
- If Netflix doesn't show the Skip Intro button, the extension can't click on it. This will be the case if you play the first episode of a show. For subsequent episodes the button will typically appear and the extension will work normally.
- If Netflix doesn't show the Skip Intro button, the extension can't click on it. This will be the case for shows with short intros, or if you play the first episode of a show. For subsequent episodes the button will typically appear and the extension will work normally.
- The extension works fine alongside other Netflix-enhancing extensions (such as [NflxMultiSubs](https://github.com/gmertes/NflxMultiSubs)).
- It should work for all languages.
- I made this extension because I have no need for all the other functions that other extensions provide, I just wanted something that skips intros. It is therefore highly unlikely that I will add additional functionality to this extension.
- I made this extension because I have no need for all the extra functions that other extensions provide, I just wanted something that skips intros. It is therefore highly unlikely that I will add additional functionality to this extension.
- If it doesn't work, please open an Issue and provide as much details as you can.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "NflxIntroSkip",
"description": "A browser extension to automatically skip Netflix show intros",
"description": "Automatically skip intros in the Netflix web-player",
"author": "Gert Mertes",
"version": "1.0.0",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion src/console.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// wraper console.xxx() to add prefix
// wrap console.xxx() to add prefix
const prefix = 'NflxIntroSkip>';
const console = {
log: (...args) => window.console.log(prefix, ...args),
Expand Down
32 changes: 19 additions & 13 deletions src/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,38 @@ const console = require('./console');

(() => {
window.addEventListener('load', () => {
console.log('Version ' + VERSION)
console.log('Version', VERSION);
bodyObserver.observe(document.body, observerOptions);
});
})();

const observerOptions = {
subtree: true,
childList: true
};

const bodyObserver = new MutationObserver(mutations => {
mutations.forEach(mutation => {
mutation.addedNodes.forEach(node => {
try{
if(node instanceof HTMLElement){
const skipButton = node.querySelector('button[data-uia="player-skip-intro"]');
if(skipButton){
console.log('Skip button seen, clicking...');
skipButton.style.visible = true;
skipButton.querySelector('.ltr-18i00qw').innerHTML = "Skipping...";
setTimeout(skipButton.click(), 1000);
console.log('Skip button seen, clicking..');
// small delay just for visuals
setTimeout(function() {
try{
skipButton.click();
}catch (error) {
console.warn(error);
}}, 800);
try{
skipButton.querySelector('span').innerHTML = "Skipping...";
}catch (error) {
console.warn(error);
}
}
}
}catch (error){
console.warn(error);
}
});
});
});
const observerOptions = {
subtree: true,
childList: true
};

Binary file modified src/icon128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/icon16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/icon48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 5 additions & 7 deletions src/manifest.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
{
"manifest_version": 2,
"name": "NflxIntroSkip (Netflix Intro Skip)",
"action": {},
"manifest_version": 3,
"version": "1.0.0",
"description": "A browser extension to automatically skip Netflix intros",
"description": "Automatically skip intros in the Netflix web-player",
"homepage_url": "https://github.com/gmertes/NflxIntroSkip",
"icons": {
"16": "icon16.png",
"48": "icon48.png",
"128": "icon128.png" },
"host_permissions": [
"https://www.netflix.com/watch/*",
"https://assets.nflxext.com/*"
"permissions": [
"https://www.netflix.com/*"
],
"content_scripts": [
{
Expand Down

0 comments on commit ebf0911

Please sign in to comment.