Skip to content

Commit

Permalink
fix: refactor comment and functions name
Browse files Browse the repository at this point in the history
  • Loading branch information
Essomia committed Dec 7, 2024
1 parent 9bc5c9f commit d0b9ed3
Show file tree
Hide file tree
Showing 4 changed files with 133 additions and 131 deletions.
26 changes: 14 additions & 12 deletions src/content.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
/**
* Chrome Extension Content Script
* Will run on the YouTube page.
* Chrome Extension Content Script.
* Will run on all YouTube page.
*/

/**
* Main
*/

chrome.storage.sync.get(
['doHideShorts', 'doHideWatched', 'doFadeByLength', 'videoLengthMax', 'videoLengthMin'],
({ doHideShorts, doHideWatched, doFadeByLength, videoLengthMax, videoLengthMin }) => {
/**
* General Options
* Filters videos
*/

// Hide watched videos (if the option is enabled)
Expand Down Expand Up @@ -36,11 +40,8 @@ chrome.storage.sync.get(
}
};

/**
* Video Length Filter
*/

const filterVideos = () => {
// Fade videos based on their length (if the option is enabled)
const fadeVideosByLength = () => {
if (doFadeByLength) {
// Select all video elements on the YouTube page
const videoElements = document.querySelectorAll('ytd-rich-item-renderer');
Expand Down Expand Up @@ -75,18 +76,19 @@ chrome.storage.sync.get(
};

/**
* Initialize filters
* Run
*/

// Initial run of the filters
hideWatchedVideos();
hideShortsSections();
filterVideos();
fadeVideosByLength();

// Re-apply the filter every 5 seconds to handle dynamic content loading on YouTube
// Re-apply the filter every x seconds to handle dynamic content loading on YouTube
setInterval(() => {
hideWatchedVideos();
hideShortsSections();
filterVideos();
fadeVideosByLength();
}, 3000);
}
);
2 changes: 1 addition & 1 deletion src/contentCategorize.css
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
/* Category Filter Buttons */

.sptcl-channel-filter-container,
.sptcl-category-filter-container {
.sptcl-subscription-filter-container {
display: flex;
flex-direction: row;
justify-content: flex-start;
Expand Down
Loading

0 comments on commit d0b9ed3

Please sign in to comment.