Skip to content

Commit

Permalink
Beta 4
Browse files Browse the repository at this point in the history
  • Loading branch information
Victor Savinov committed Oct 1, 2019
1 parent b820362 commit 9e9632a
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 3 deletions.
5 changes: 3 additions & 2 deletions 1.5/manifest.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"manifest_version": 2,
"name": "Improve YouTube! (Open-Source for YouTube)",
"version": "1.50.3",
"version_name": "1.50 Beta 3",
"version": "1.50.4",
"version_name": "1.50 Beta 4",

"default_locale": "en",
"description": "Make YouTube wonderful&Keep It clean! YouTube Player Size Playback Quality Auto HD Speed Style Adblock Volume Playlist Channel H.264",
Expand All @@ -28,6 +28,7 @@
"youtube/css/appearance.css",
"youtube/css/player.css",
"youtube/css/channel.css",
"youtube/css/shortcuts.css",
"youtube/css/settings.css",
"youtube/css/themes/legacy.css",
"youtube/css/themes/default.css",
Expand Down
11 changes: 11 additions & 0 deletions 1.5/youtube/css/shortcuts.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#it-status
{
font-size: 5rem;

position: absolute;
top: 2rem;
right: 3rem;

color: #0ff;
text-shadow: 1px 1px 2px #000;
}
34 changes: 33 additions & 1 deletion 1.5/youtube/js/features/shortcuts.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,31 @@ ImprovedTube.shortcuts = function() {
var self = this,
keys = {},
wheel = 0,
hover = false;
hover = false,
status_timer;

function showStatus(player, volume) {
if (!player.querySelector('#it-status')) {
var element = document.createElement('div');

element.id = 'it-status';
element.innerHTML = volume;

document.querySelector('.html5-video-container').appendChild(element);
} else {
player.querySelector('#it-status').innerHTML = volume;
}

if (status_timer) {
clearTimeout(status_timer);
}

status_timer = setTimeout(function() {
if (player.querySelector('#it-status')) {
player.querySelector('#it-status').remove();
}
}, 500);
}

function start(type = 'keys') {
if (document.activeElement && ['EMBED', 'INPUT', 'OBJECT', 'TEXTAREA', 'IFRAME'].indexOf(document.activeElement.tagName) !== -1 || event.target.isContentEditable) {
Expand Down Expand Up @@ -75,27 +99,35 @@ ImprovedTube.shortcuts = function() {

if (player && player.setVolume && player.getVolume) {
player.setVolume(player.getVolume() + 5);

showStatus(player, player.getVolume());
}
},
decrease_volume: function() {
var player = document.querySelector('.html5-video-player');

if (player && player.setVolume && player.getVolume) {
player.setVolume(player.getVolume() - 5);

showStatus(player, player.getVolume());
}
},
increase_playback_speed: function() {
var player = document.querySelector('#movie_player');

if (player && player.setPlaybackRate && player.getPlaybackRate) {
player.setPlaybackRate(player.getPlaybackRate() + .05);

showStatus(player, player.getPlaybackRate());
}
},
decrease_playback_speed: function() {
var player = document.querySelector('#movie_player');

if (player && player.setPlaybackRate && player.getPlaybackRate) {
player.setPlaybackRate(player.getPlaybackRate() - .05);

showStatus(player, player.getPlaybackRate());
}
},
go_to_search_box: function() {
Expand Down

0 comments on commit 9e9632a

Please sign in to comment.