diff --git a/background.js b/background.js index 7b5aa5e61..e818c4dbd 100644 --- a/background.js +++ b/background.js @@ -95,13 +95,15 @@ chrome.runtime.onInstalled.addListener(function (installed) { }); } else if (installed.reason == 'install') { if (navigator.userAgent.indexOf("Firefox") != -1) { - chrome.storage.local.set({below_player_pip: false})} + chrome.storage.local.set({below_player_pip: false}) + } if (navigator.userAgent.indexOf('Safari') !== -1 && (!/Windows|Chrom/.test(navigator.userAgent) || /Macintosh|iPhone/.test(navigator.userAgent))) { chrome.storage.local.set({below_player_pip: false}) // still needed? (are screenshots broken in Safari?): - chrome.storage.local.set({below_player_screenshot: false})} + chrome.storage.local.set({below_player_screenshot: false}) + } // console.log('Thanks for installing!'); } }); @@ -312,9 +314,8 @@ chrome.runtime.onMessage.addListener(function (message, sender, sendResponse) { } catch (error) { console.error(error); } - } else { - console.error('Permission is not granted.'); - }}) + } else { console.error('Permission is not granted.'); } + }) break } }); diff --git a/js&css/extension/init.js b/js&css/extension/init.js index 8020cd839..99d8ed77c 100644 --- a/js&css/extension/init.js +++ b/js&css/extension/init.js @@ -241,8 +241,8 @@ document.addEventListener('it-message-from-youtube', function () { } }); -document.addEventListener('it-play', function (event) { - var videos = document.querySelectorAll('video'); - try {chrome.runtime.sendMessage({action: 'play'})} - catch (error) {console.log(error); setTimeout(function () { try { chrome.runtime.sendMessage({action: 'play'}, function (response) { console.log(response) } ); } catch { } }, 321) } - }); +document.addEventListener('it-play', function () { + // var videos = document.querySelectorAll('video'); + try {chrome.runtime.sendMessage({action: 'play'}) + } catch (error) {console.log(error); setTimeout(function () { try { chrome.runtime.sendMessage({action: 'play'}, function (response) { console.log(response) } ); } catch { } }, 321) } +}); \ No newline at end of file diff --git a/js&css/web-accessible/www.youtube.com/shortcuts.js b/js&css/web-accessible/www.youtube.com/shortcuts.js index 4c3653396..454e374eb 100644 --- a/js&css/web-accessible/www.youtube.com/shortcuts.js +++ b/js&css/web-accessible/www.youtube.com/shortcuts.js @@ -355,20 +355,20 @@ ImprovedTube.shortcutScreenshot = ImprovedTube.screenshot; ------------------------------------------------------------------------------*/ ImprovedTube.shortcutIncreasePlaybackSpeed = function () { const value = Number(this.storage.shortcuts_playback_speed_step) || .05, // original: - var video = this.elements.video; + const video = this.elements.video; if (video) {if ( video.playbackRate){ if ( video.playbackRate < 1 && video.playbackRate > 1-ImprovedTube.storage.shortcut_playback_speed_step ) { video.playbackRate = 1 } // aligning at 1.0 instead of passing by 1.0 - else { video.playbackRate = Math.min(Math.max(Number((video.playbackRate + Number(ImprovedTube.storage.shortcut_playback_speed_step || .05)).toFixed(2)), .1),24); - } + else { video.playbackRate = Math.min(Math.max(Number((video.playbackRate + Number(ImprovedTube.storage.shortcut_playback_speed_step || .05)).toFixed(2)), .1),16); + } // Firefox doesnt limit speed to 16x. We can allow more in Firefox if people ask ImprovedTube.showStatus(video.playbackRate); } else { // alternative: - var player = this.elements.player; + const player = this.elements.player; if (player) { if ( player.getPlaybackRate() < 1 && player.getPlaybackRate() > 1-ImprovedTube.storage.shortcut_playback_speed_step ) { player.setPlaybackRate(1) } // aligning at 1.0 instead of passing by 1.0 - else { player.setPlaybackRate(Math.min(Math.max(Number((player.getPlaybackRate() + Number(ImprovedTube.storage.shortcut_playback_speed_step || .05)).toFixed(2)), .1),24)) + else { player.setPlaybackRate(Math.min(Math.max(Number((player.getPlaybackRate() + Number(ImprovedTube.storage.shortcut_playback_speed_step || .05)).toFixed(2)), .1),16)) } ImprovedTube.showStatus(player.getPlaybackRate()); }}}}; @@ -377,7 +377,7 @@ ImprovedTube.shortcutIncreasePlaybackSpeed = function () { const value = Number( ------------------------------------------------------------------------------*/ ImprovedTube.shortcutDecreasePlaybackSpeed = function () { const value = Number(ImprovedTube.storage.shortcut_playback_speed_step) || .05; // original: - var video = this.elements.video; + const video = this.elements.video; if (video) { if (video.playbackRate){ if ( video.playbackRate < 0.1+ImprovedTube.storage.shortcut_playback_speed_step ) { @@ -388,7 +388,7 @@ ImprovedTube.shortcutDecreasePlaybackSpeed = function () { const value = Number( } else { // alternative: - var player = this.elements.player; + const player = this.elements.player; if (player) { if ( player.getPlaybackRate() < 0.1+ImprovedTube.storage.shortcut_playback_speed_step ) { player.setPlaybackRate(player.getPlaybackRate()*0.7) } // slow down near minimum