Skip to content

Commit

Permalink
remove ESLint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
4yman-0 committed Nov 2, 2024
1 parent 2b80db5 commit b84a0ec
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 17 deletions.
6 changes: 3 additions & 3 deletions js&css/extension/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,10 @@ extension.storage.get = function (key) {
if (key.indexOf('/') === -1) {
return this.data[key];
} else {
var target = this.data,
path = key.split('/').filter(function (value) {
var target = this.data;
/*path = key.split('/').filter(function (value) {

Check failure on line 241 in js&css/extension/core.js

View workflow job for this annotation

GitHub Actions / lint-and-test

Expected indentation of 2 tabs but found 3
return value != '';
});
});*/

for (var i = 0, l = key.length; i < l; i++) {
var part = key[i];
Expand Down
14 changes: 12 additions & 2 deletions js&css/extension/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,16 @@ document.addEventListener('it-message-from-youtube', function () {

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) }
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 {}

Check warning on line 265 in js&css/extension/init.js

View workflow job for this annotation

GitHub Actions / lint-and-test

Trailing spaces not allowed
}, 321);
}
});
8 changes: 4 additions & 4 deletions js&css/extension/www.youtube.com/general/general.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ extension.features.youtubeHomePage = function (anything) {
}
} else if (anything === 'init') {
extension.events.on('init', function (resolve) {
if (/(www|m)\.youtube\.com\/?(\?|\#|$)/.test(location.href)) {
if (/(www|m)\.youtube\.com\/?(\?|#|$)/.test(location.href)) {
chrome.storage.local.get('youtube_home_page', function (items) {
var option = items.youtube_home_page;

Expand Down Expand Up @@ -128,7 +128,7 @@ extension.features.collapseOfSubscriptionSections = function (event) {
window.removeEventListener('click', this.collapseOfSubscriptionSections);

if (
extension.storage.get('collapse_of_subscription_sections') &&
extension.storage.get('collapse_of_subscription_sections') &&
location.href.indexOf('feed/subscriptions') !== -1
) {
window.addEventListener('click', this.collapseOfSubscriptionSections, true);
Expand Down Expand Up @@ -253,7 +253,7 @@ extension.features.popupWindowButtons = function (event) {
ytPlayer = document.querySelector("#movie_player");
if (ytPlayer) {width = ytPlayer.offsetWidth * 0.65; height = ytPlayer.offsetHeight * 0.65}

Check failure on line 254 in js&css/extension/www.youtube.com/general/general.js

View workflow job for this annotation

GitHub Actions / lint-and-test

Closing curly brace does not appear on the same line as the subsequent block
else { width = innerWidth * 0.4; height = innerHeight * 0.4; }
if (!ytPlayer) {
if (!ytPlayer) {
let shorts = /short/.test(this.parentElement.href);
if ( width / height < 1 ) { let vertical = true } else { let vertical = false }

Check failure on line 258 in js&css/extension/www.youtube.com/general/general.js

View workflow job for this annotation

GitHub Actions / lint-and-test

'vertical' is assigned a value but never used

Check failure on line 258 in js&css/extension/www.youtube.com/general/general.js

View workflow job for this annotation

GitHub Actions / lint-and-test

'vertical' is assigned a value but never used
if ( !vertical && shorts ) { width = height * 0.6}
Expand Down Expand Up @@ -422,7 +422,7 @@ extension.features.markWatchedVideos = function (anything) {
--------------------------------------------------------------*/

extension.features.trackWatchedVideos = function () {
if (extension.storage.get('track_watched_videos') && document.documentElement.getAttribute('it-pathname').indexOf('/watch') === 0) {
if (extension.storage.get('track_watched_videos') && document.documentElement.getAttribute('it-pathname').indexOf('/watch') === 0) {
var id = extension.functions.getUrlParameter(location.href, 'v');

if (!extension.storage.watched) {
Expand Down
2 changes: 1 addition & 1 deletion js&css/web-accessible/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ document.addEventListener('it-message-from-extension', function () {

case 'playerPlaybackSpeed':
case 'playerForcedPlaybackSpeed':
if (ImprovedTube.storage.player_forced_playback_speed && isFinite(Number(ImprovedTube.storage.player_playback_speed))) {
if (ImprovedTube.storage.player_forced_playback_speed && isFinite(Number(ImprovedTube.storage.player_playback_speed))) {
ImprovedTube.playbackSpeed (Number(ImprovedTube.storage.player_playback_speed)); //new
ImprovedTube.elements.player.setPlaybackRate(Number(ImprovedTube.storage.player_playback_speed));
// ImprovedTube.elements.player.querySelector('video').playbackRate = Number(ImprovedTube.storage.player_playback_speed.toFixed(2));
Expand Down
6 changes: 3 additions & 3 deletions js&css/web-accessible/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,12 +263,12 @@ ImprovedTube.videoPageUpdate = function () {
if (document.documentElement.dataset.pageType === 'video') {
var video_id = this.getParam(new URL(location.href).search.substr(1), 'v');

if (this.storage.track_watched_videos && video_id) {
if (this.storage.track_watched_videos && video_id) {
ImprovedTube.messages.send({action: 'watched',
type: 'add',
id: video_id,
title: document.title
});
});
}

this.initialVideoUpdateDone = true;
Expand Down Expand Up @@ -405,7 +405,7 @@ ImprovedTube.playerOnPause = function (event) {
};

if (document.documentElement.dataset.pageType === 'video'
&& (ImprovedTube.storage.description === "expanded" || ImprovedTube.storage.transcript || ImprovedTube.storage.chapters )) {
&& (ImprovedTube.storage.description === "expanded" || ImprovedTube.storage.transcript || ImprovedTube.storage.chapters )) {

Check warning on line 408 in js&css/web-accessible/functions.js

View workflow job for this annotation

GitHub Actions / lint-and-test

Multiple spaces found before ')'

Check warning on line 408 in js&css/web-accessible/functions.js

View workflow job for this annotation

GitHub Actions / lint-and-test

Trailing spaces not allowed
ImprovedTube.forbidFocus = function (ms) {

Check warning on line 409 in js&css/web-accessible/functions.js

View workflow job for this annotation

GitHub Actions / lint-and-test

Multiple spaces found before 'function'

Check warning on line 409 in js&css/web-accessible/functions.js

View workflow job for this annotation

GitHub Actions / lint-and-test

Trailing spaces not allowed
const originalFocus = HTMLElement.prototype.focus; // Backing up default method - other methods: Element.prototype.scrollIntoView window.scrollTo window.scrollBy
// Override YouTube's scroll method:
Expand Down
9 changes: 5 additions & 4 deletions js&css/web-accessible/www.youtube.com/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,10 @@ ImprovedTube.playerPlaybackSpeed = function () { if (this.storage.player_forced_
ImprovedTube.speedException = function () {
if (this.storage.player_dont_speed_education && DATA.genre === 'Education')
{player.setPlaybackRate(Number(1)); video.playbackRate = Number(1); return;}
if (this.storage.player_force_speed_on_music )
{ //player.setPlaybackRate(Number(option)); video.playbackRate = Number(option);
return;}
if (this.storage.player_force_speed_on_music ){
//player.setPlaybackRate(Number(option)); video.playbackRate = Number(option);
return;
}
if (DATA.keywords && !keywords) { keywords = DATA.keywords.join(', ') || ''; }
if (keywords === 'video, sharing, camera phone, video phone, free, upload') { keywords = ''; }
var musicIdentifiers = /(official|music|lyrics?)[ -]video|(cover|studio|radio|album|alternate)[- ]version|soundtrack|unplugged|\bmedley\b|\blo-fi\b|\blofi\b|a(lla)? cappella|feat\.|(piano|guitar|jazz|ukulele|violin|reggae)[- ](version|cover)|karaok|backing[- ]track|instrumental|(sing|play)[- ]?along|OK|OK|الكاريوكي|караоке|||bootleg|mashup|Radio edit|Guest (vocals|musician)|(title|opening|closing|bonus|hidden)[ -]track|live acoustic|interlude|featuring|recorded (at|live)/i;
Expand Down Expand Up @@ -936,7 +937,7 @@ ImprovedTube.playerCinemaModeEnable = function () {
overlay = document.getElementById('overlay_cinema');
}

// console.log(overlay && this.storage.player_auto_hide_cinema_mode_when_paused || this.storage.player_auto_cinema_mode && overlay)
// console.log(overlay && this.storage.player_auto_hide_cinema_mode_when_paused || this.storage.player_auto_cinema_mode && overlay)
if (overlay) {
overlay.style.display = 'block'
var player = xpath('//*[@id="movie_player"]/div[1]/video')[0].parentNode.parentNode
Expand Down

0 comments on commit b84a0ec

Please sign in to comment.