Merge pull request #6 from ApoorvSaxena/master

added functionality to save default video speed in chrome sync storage
This commit is contained in:
Ilya Grigorik
2014-06-07 22:08:22 -07:00
2 changed files with 12 additions and 5 deletions

View File

@@ -8,9 +8,16 @@ chrome.extension.sendMessage({}, function(response) {
this.video = target; this.video = target;
this.initializeControls(); this.initializeControls();
this.speedIndicator.textContent = this.getSpeed(); chrome.storage.sync.get('speed', function(storage) {
var speed = storage.speed ? storage.speed : '1.00';
target.playbackRate = speed;
this.speedIndicator.textContent = speed;
}.bind(this));
this.video.addEventListener('ratechange', function(event) { this.video.addEventListener('ratechange', function(event) {
this.speedIndicator.textContent = this.getSpeed(); var speed = this.getSpeed();
this.speedIndicator.textContent = speed;
chrome.storage.sync.set({'speed': speed});
}.bind(this)); }.bind(this));
}; };

View File

@@ -1,6 +1,6 @@
{ {
"name": "HTML5 Video Playback Speed Controller", "name": "HTML5 Video Playback Speed Controller",
"version": "0.1.1", "version": "0.1.2",
"manifest_version": 2, "manifest_version": 2,
"description": "Lean in and speed up your video learning with handy shortcuts to accelerate, slow-down, and rewind your video via your keyboard.", "description": "Lean in and speed up your video learning with handy shortcuts to accelerate, slow-down, and rewind your video via your keyboard.",
"homepage_url": "https://github.com/igrigorik/videospeed", "homepage_url": "https://github.com/igrigorik/videospeed",
@@ -9,7 +9,7 @@
"48": "icons/icon48.png", "48": "icons/icon48.png",
"128": "icons/icon128.png" "128": "icons/icon128.png"
}, },
"permissions": [ "activeTab" ], "permissions": [ "activeTab", "storage" ],
"content_scripts": [{ "content_scripts": [{
"all_frames": true, "all_frames": true,
"matches": [ "http://*/*", "https://*/*"], "matches": [ "http://*/*", "https://*/*"],
@@ -17,4 +17,4 @@
"js": [ "inject.js" ] "js": [ "inject.js" ]
} }
] ]
} }