mirror of
https://github.com/SoPat712/videospeed.git
synced 2025-08-21 18:08:46 -04:00
updated functionality to save video speed via existing control panel video
This commit is contained in:
21
inject.js
21
inject.js
@@ -8,18 +8,17 @@ chrome.extension.sendMessage({}, function(response) {
|
||||
this.video = target;
|
||||
this.initializeControls();
|
||||
|
||||
this.speedIndicator.textContent = this.getSpeed();
|
||||
this.video.addEventListener('ratechange', function(event) {
|
||||
this.speedIndicator.textContent = this.getSpeed();
|
||||
}.bind(this));
|
||||
chrome.storage.sync.get('speed', function(storage) {
|
||||
target.playbackRate = storage.speed;
|
||||
});
|
||||
chrome.storage.onChanged.addListener(function(storage) {
|
||||
if(storage.speed) {
|
||||
target.playbackRate = storage.speed.newValue;
|
||||
}
|
||||
});
|
||||
var speed = storage.speed ? storage.speed : '1.00';
|
||||
target.playbackRate = speed;
|
||||
this.speedIndicator.textContent = speed;
|
||||
}.bind(this));
|
||||
|
||||
this.video.addEventListener('ratechange', function(event) {
|
||||
var speed = this.getSpeed();
|
||||
this.speedIndicator.textContent = speed;
|
||||
chrome.storage.sync.set({'speed': speed});
|
||||
}.bind(this));
|
||||
};
|
||||
|
||||
tc.videoController.prototype.getSpeed = function() {
|
||||
|
Reference in New Issue
Block a user