From bbb8a7354b6e9ff6e9cf825f5d9dd89c5a87e60c Mon Sep 17 00:00:00 2001 From: Ilya Grigorik Date: Wed, 5 Jul 2017 22:26:28 +0200 Subject: [PATCH 01/10] Ignore ratechange events on unitialized videos Closes #233. --- inject.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/inject.js b/inject.js index 7c5dac3..1403bd6 100644 --- a/inject.js +++ b/inject.js @@ -69,10 +69,16 @@ chrome.extension.sendMessage({}, function(response) { }); target.addEventListener('ratechange', function(event) { - var speed = this.getSpeed(); - this.speedIndicator.textContent = speed; - tc.settings.speed = speed; - chrome.storage.sync.set({'speed': speed}); + // Ignore ratechange events on unitialized videos. + // 0 == No information is available about the media resource. + if (event.target.readyState > 0) { + var speed = this.getSpeed(); + this.speedIndicator.textContent = speed; + tc.settings.speed = speed; + chrome.storage.sync.set({'speed': speed}, function() { + console.log('Speed setting saved: ' + speed); + }); + } }.bind(this)); target.playbackRate = tc.settings.speed; From 8e2cf853a53ca613f9b62bc54701bd306813e762 Mon Sep 17 00:00:00 2001 From: Vova Yatsyuk Date: Mon, 7 Aug 2017 17:10:09 +0300 Subject: [PATCH 02/10] Fixed error when using Chrome Autofill. Closes #250 --- inject.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/inject.js b/inject.js index 1403bd6..8dd1323 100644 --- a/inject.js +++ b/inject.js @@ -222,7 +222,8 @@ chrome.extension.sendMessage({}, function(response) { var keyCode = event.keyCode; // Ignore if following modifier is active. - if (event.getModifierState("Alt") + if (!event.getModifierState + || event.getModifierState("Alt") || event.getModifierState("Control") || event.getModifierState("Fn") || event.getModifierState("Meta") From 2818103c7d60aded352511fb3782de1f9d1732d5 Mon Sep 17 00:00:00 2001 From: mariusi7 Date: Tue, 8 Aug 2017 18:07:25 +0300 Subject: [PATCH 03/10] Update inject.js (#252) * Special case hbogo.* inject (same as Amazon) Closes: https://github.com/igrigorik/videospeed/issues/199 --- inject.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/inject.js b/inject.js index 8dd1323..80b0a8e 100644 --- a/inject.js +++ b/inject.js @@ -149,13 +149,14 @@ chrome.extension.sendMessage({}, function(response) { this.video.classList.add('vsc-initialized'); this.video.dataset['vscid'] = this.id; - switch (location.hostname) { - case 'www.amazon.com': + switch (true) { + case (location.hostname == 'www.amazon.com'): + case (/www\.hbogo\./).test(location.hostname): // insert before parent to bypass overlay this.parent.parentElement.insertBefore(fragment, this.parent); break; - case 'www.facebook.com': + case (location.hostname == 'www.facebook.com'): // set stacking context to same as parent's parent. // + default fallthrough this.parent.style.zIndex = 'auto'; From 58e032b14a5d7e091bc163892ba298879692f538 Mon Sep 17 00:00:00 2001 From: Johannes Pfrang Date: Fri, 4 Aug 2017 23:41:14 +0200 Subject: [PATCH 04/10] Use event-driven or direct script initialization Chrome may inject the script immediately after the readystatechange/load events fired, so we need to explicitly check the readyState after script injection. Also unconditionally listen to the window.onload event for further cross-browser robustness (we have init-once logic either way). --- inject.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/inject.js b/inject.js index 80b0a8e..93e1e6b 100644 --- a/inject.js +++ b/inject.js @@ -193,17 +193,22 @@ chrome.extension.sendMessage({}, function(response) { if (blacklisted) return; - var readyStateCheckInterval = setInterval(function() { - if (document && document.readyState === 'complete') { - clearInterval(readyStateCheckInterval); + window.onload = () => initializeNow(document); + if (document) { + if (document.readyState === "complete") { initializeNow(document); + } else { + document.onreadystatechange = () => { + if (document.readyState === "complete") { + initializeNow(document); + } + } } - }, 10); + } } function initializeNow(document) { - // in theory, this should only run once, in practice.. - // that's not guaranteed, hence we enforce own init-once. + // enforce init-once due to redundant callers if (document.body.classList.contains('vsc-initialized')) { return; } From d30fc88f3217a3a85c56d6c4e4c8b707813a567c Mon Sep 17 00:00:00 2001 From: Ilya Grigorik Date: Sun, 27 Aug 2017 10:56:20 -0700 Subject: [PATCH 05/10] update Google Photos fullscreen selector Previous configuration was misfiring on YouTube and shifting controller down. --- inject.css | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/inject.css b/inject.css index 935e7fe..254c408 100644 --- a/inject.css +++ b/inject.css @@ -30,13 +30,13 @@ } /* Google Photos player */ -/* Inline preview doesn't have any additional hooks, relying on Aria label */ +/* Inline preview doesn't have any additional hooks, relying on Aria label */ a[aria-label^="Video"] .vsc-controller { position: relative; top: 35px; } /* Google Photos full-screen view */ -#player:not(.ytd-watch) .html5-video-container .vsc-controller { +#player .house-brand .vsc-controller { position: relative; top: 50px; } @@ -68,7 +68,6 @@ div.video-wrapper + div.target { height: 0; } - /* Fix black overlay on Kickstarter */ div.video-player.has_played.vertically_center:before, div.legacy-video-player.has_played.vertically_center:before { content: none !important; From daec249e3f90656e59b45d5e95b0350414d88132 Mon Sep 17 00:00:00 2001 From: Ilya Grigorik Date: Sun, 27 Aug 2017 11:14:55 -0700 Subject: [PATCH 06/10] revert z-index override for facebook.com Current logic conflicts with imgaus extension - see #241. Also, looks like FB may have changed their stacking? Can't reproduce old problem (#210), testing: - https://www.facebook.com/facebook/videos/10106941168235097/ - https://www.facebook.com/pg/facebook/videos/ - Videos in newsfeed Closes #241 --- inject.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/inject.js b/inject.js index 93e1e6b..dee90c0 100644 --- a/inject.js +++ b/inject.js @@ -156,11 +156,6 @@ chrome.extension.sendMessage({}, function(response) { this.parent.parentElement.insertBefore(fragment, this.parent); break; - case (location.hostname == 'www.facebook.com'): - // set stacking context to same as parent's parent. - // + default fallthrough - this.parent.style.zIndex = 'auto'; - default: // Note: when triggered via a MutationRecord, it's possible that the // target is not the immediate parent. This appends the controller as From 32a3c5392faa7a003d6326bc4fd6cb9a85086b75 Mon Sep 17 00:00:00 2001 From: Ilya Grigorik Date: Sun, 27 Aug 2017 11:31:43 -0700 Subject: [PATCH 07/10] Unify controller close (x) with display shortcut Clicking (x) in controller is equivalent to hiding it via shortcut (v). Closes #232 --- inject.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/inject.js b/inject.js index dee90c0..f9c9799 100644 --- a/inject.js +++ b/inject.js @@ -127,7 +127,7 @@ chrome.extension.sendMessage({}, function(response) { - + `; @@ -341,9 +341,6 @@ chrome.extension.sendMessage({}, function(response) { v.playbackRate = Number(s.toFixed(2)); } else if (action === 'reset') { resetSpeed(v, 1.0); - } else if (action === 'close') { - v.classList.add('vsc-cancelled'); - controller.remove(); } else if (action === 'display') { controller.classList.add('vsc-manual'); controller.classList.toggle('vsc-hidden'); From 66ffd62b7669a849f317970401dc14eae2eba6f4 Mon Sep 17 00:00:00 2001 From: Ilya Grigorik Date: Sun, 27 Aug 2017 11:37:47 -0700 Subject: [PATCH 08/10] update disable flash instructions Closes #249 --- README.md | 4 ++-- options.html | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 0402c9f..fadc177 100644 --- a/README.md +++ b/README.md @@ -30,8 +30,8 @@ _Note: you can customize these shortcut keys in the extension settings page._ **The video controls are not showing up?** This extension is only compatible with HTML5 video. If you don't see the controls showing up, chances are you are viewing a Flash video. If you want to confirm, try right-clicking on the video and inspect the menu: if it mentions flash, then that's the issue. That said, most sites will fallback to HTML5 if they detect that Flash it not available. You can try manually disabling Flash plugin in Chrome: -* In a new tab, navigate to `chrome://plugins` -* Disable "Adobe Flash Player" +* In a new tab, navigate to `chrome://settings/content/flash` +* Disable "Allow sites to run Flash" * Restart your browser and try playing your video again **The speed controls are not showing up for local videos?** To enable playback of local media (e.g. File > Open File), you need to grant additional permissions to the extension. diff --git a/options.html b/options.html index 33bc8a5..2ac11ab 100644 --- a/options.html +++ b/options.html @@ -86,8 +86,8 @@

This extension is only compatible with HTML5 video. If you don't see the controls showing up, chances are you are viewing a Flash video. If you want to confirm, try right-clicking on the video and inspect the menu: if it mentions flash, then that's the issue. That said, most sites will fallback to HTML5 if they detect that Flash it not available. You can try manually disabling Flash plugin in Chrome:

    -
  • In a new tab, navigate to chrome://plugins
  • -
  • Disable "Adobe Flash Player"
  • +
  • In a new tab, navigate to chrome://settings/content/flash
  • +
  • Disable "Allow sites to run Flash"
  • Restart your browser and try playing your video again
From d75552b28049c34d058ba99393e2298bcbba0584 Mon Sep 17 00:00:00 2001 From: Ilya Grigorik Date: Sun, 27 Aug 2017 14:20:34 -0700 Subject: [PATCH 09/10] bump to 0.4.9 --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 9d3127b..48f95a4 100755 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "name": "Video Speed Controller", "short_name": "videospeed", - "version": "0.4.8", + "version": "0.4.9", "manifest_version": 2, "description": "Speed up, slow down, advance and rewind any HTML5 video with quick shortcuts.", "homepage_url": "https://github.com/igrigorik/videospeed", From 2fe5547c64fda66515ddf1bdd68d61b87775224e Mon Sep 17 00:00:00 2001 From: zenwarr Date: Thu, 21 Sep 2017 15:03:08 +0600 Subject: [PATCH 10/10] fix wrong label in settings --- options.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/options.html b/options.html index 2ac11ab..5c73e73 100644 --- a/options.html +++ b/options.html @@ -41,7 +41,7 @@
- +