Skip to content

Commit

Permalink
tweak for Firefox
Browse files Browse the repository at this point in the history
  • Loading branch information
glaucocustodio committed Oct 31, 2019
1 parent 0222746 commit c2d70ff
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
16 changes: 12 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# <img src="icon48.png" width="30"> YouCaptain <img src="https://img.shields.io/github/v/release/glaucocustodio/youcaptain">

A simple Chrome extension that enables keyboard navigation on YouTube.
A simple browser extension that enables keyboard navigation on YouTube.

![demo.gif](https://raw.githubusercontent.com/glaucocustodio/youcaptain/master/demo.gif)

Expand All @@ -19,13 +19,21 @@ I've set up some shortcuts to ease my life, the bad news is that they aren't con
- `u`: focus on video player if a video is being played, otherwise, focus on first video of the list
- `y`: go to home page (/)

## Compatibility

This extension must work in any browser compatible with the [extension API](https://developer.chrome.com/extensions) or [WebExtensions API](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions). I've tested it on the following browsers:

- Google Chrome
- Firefox Developer Edition
- Brave Browser

## Installation

This extension is not available on Chrome Web Store as I would have to pay a $5 fee to create a developer account. But you can install it by yourself on Google Chrome or any Chromium-based browsers (e.g. Brave, Opera, Vivaldi etc) by following the steps below:
This extension is not available on Chrome Web Store as I would have to pay a $5 fee to create a developer account. You can install it by yourself anyway by following the steps below:

- Grab a copy of the source code either by cloning this repository or by downloading and extracting the zipped source. You can download zip archive by opening the project page on GitHub and clicking on the "Download" button.
- Next, open the "Extensions" page (chrome://extensions/) in the browser and turn on the "Developer mode".
- Click on the "Load unpacked" button and select the source code you just downloaded.
- Next, open the "Extensions" page (`chrome://extensions/` or `about:debugging` on Firefox) in the browser and turn on the "Developer mode".
- Click on the "Load unpacked"/"Load Temporary Add-on" button and select the source code you just downloaded.

Note: extensions installed as unpacked aren't updated automatically. To update the extension you should download it and install as unpacked again.

Expand Down
7 changes: 7 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ var setFocus = function(){
var videoActive = video && video.src != "";
if(videoActive){
SpatialNavigation.focus('ytd-player');

// hack for Firefox
if(document.activeElement.tagName == 'BODY') {
setTimeout(function(){
check();
}, 300);
}
} else {
SpatialNavigation.focus('yc-initial');
}
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "YouCaptain",
"version": "0.0.3",
"version": "0.0.4",
"description": "Enables keyboard navigation on YouTube",
"manifest_version": 2,
"content_scripts": [
Expand Down

0 comments on commit c2d70ff

Please sign in to comment.