From 921f489fceb140010a8dc900ef5e0e3b6045d6fd Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Tue, 18 Oct 2016 23:07:28 +0200 Subject: [PATCH] General code cleanup, slight refactoring, forcing specific aspect ratio is now an experimental feature, updated README.MD to reflect changes. --- README.md | 31 +++- js/uw.js | 495 +++++++++++++++++++++++++------------------------- manifest.json | 2 +- 3 files changed, 274 insertions(+), 254 deletions(-) diff --git a/README.md b/README.md index f1031b1..77714ed 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,19 @@ This extension also allows you to zoom in or out of video (similar to how SMPlay ## Installing -[Just install it from Mozilla's addon page](https://addons.mozilla.org/en/firefox/addon/ultrawidify/). I'm only showing the source here. +### Temporary install + +1. Clone this repo +2. Open up Firefox +3. Go to `about:debugging` +4. Add temporary addon +5. Browse to wherever you saved it and select manifest.json + +### Permanent + +[Experimental version](https://addons.mozilla.org/sl/developers/addon/ultrawidify-git) — If 30 minutes old is stable enough for you, this is it. This version is pretty much code from this repo. It's also unlisted so I don't have to go through AMO for every minor change. + +[Regular version](https://addons.mozilla.org/en/firefox/addon/ultrawidify/) — more stable and with AMO's approval. No experimental features either. **NOTE: AMO still hasn't approved this version. You won't be able to install it until they do.** ## How do I use it? @@ -26,6 +38,19 @@ Here's the list of keybinds: * `u` : unzoom * `r` : reset to default +As of version 0.9.6, there's also experimental feature that will try to force an aspect ratio for the video. You specify the aspect ratio of the video you're watching. Extension then looks at the actual aspect ratio of the video. If aspect ratios are different, extension assumes that video contains black borders and zooms in on the video, so the black bars are removed. For example: if the video you're watching is 4:3, but you specify it's actually 16:9, then the extension will zoom on 16:9 section inside that video. (Visual example is going to land soon, because I'm bad at explaining this). + +Here's the list of keybinds: + +* `s` : force 16:9¹ (1920/1080) +* `a` : force 16:10 +* `d` : force 21:9¹ (2560/1080) +* `x` : force 4:3 + +¹These ratios are calculated using the number in the brackets, as 1920/1080 does not strictly equal to 16/9 (same goes for 21:9). + +**Please note that these keybindings could change at any time, and some definitely will** (apparently some of them conflict with youtube player)**.** I'll try to get them sorted out by the end of october. + ## What works More or less everything. Works regardless of whether the video is in fullscreen or not. Works regardless if the youtube video you're watching is embedded on some other page. @@ -34,9 +59,11 @@ More or less everything. Works regardless of whether the video is in fullscreen On a very rare occasion, `w` button won't work. So far this behaviour was seen in [two](https://www.youtube.com/watch?v=eRsGyueVLvQ) [videos](https://www.youtube.com/watch?v=RYsPEl-xOv0) out of countless I've tried. In cases like this, use `z` to zoom instead. +Keybind `a` just doesn't work at all, so no 16:10. + ## Plans for the future * Adding custom keybinds * Adding a proper settings page * Adding buttons for actions in youtube's player -* Adding an option to force specific aspect ratio +* ~~Adding an option to force specific aspect ratio~~ (now it's "experimental") diff --git a/js/uw.js b/js/uw.js index 69849e8..c0cd7f9 100644 --- a/js/uw.js +++ b/js/uw.js @@ -4,7 +4,10 @@ var inFullScreen = false; var cssmod = ""; var zoomStep = 0.05; -var originalcss; +var whatdo_persistence = true; +var last_whatdo = "reset"; + +var debugmsg = false; $(document).ready(function() { // console.log("uw::document.ready | document is ready"); @@ -29,6 +32,18 @@ $(document).ready(function() { break; case 'u': changeCSS("unzoom"); + break; + case 'd': + changeCSS(0); + break; + case 's': + changeCSS(1); + break; + case 'a': + changeCSS(2); + break; + case 'x': + changeCSS(3); } }); // console.log("uw::document.ready | loaded shortcuts"); @@ -74,19 +89,48 @@ function onFullscreenOff(){ } function changeCSS(what_do){ - - // Če nismo na Youtube, bodo youtube videi v