Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions manifest/firefox-manifest-extra.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,5 @@
},
"browser_action": {
"default_area": "navbar"
},
"permissions": [
"unlimitedStorage"
]
}
}
5 changes: 3 additions & 2 deletions manifest/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "__MSG_fullName__",
"short_name": "SponsorBlock",
"version": "5.14",
"version": "6.0",
"default_locale": "en",
"description": "__MSG_Description__",
"homepage_url": "https://sponsor.ajay.app",
Expand All @@ -16,7 +16,8 @@
},
"permissions": [
"storage",
"scripting"
"scripting",
"unlimitedStorage"
],
"options_ui": {
"page": "options/options.html",
Expand Down
2 changes: 1 addition & 1 deletion maze-utils
Submodule maze-utils updated 1 files
+5 −1 src/video.ts
31 changes: 29 additions & 2 deletions public/popup.css
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,7 @@
* <details> wrapper around each segment
*/
.votingButtons {
font-family: Arial, Helvetica, sans-serif;
border-radius: 8px;
margin: 4px 16px;
}
.votingButtons[open] {
padding-bottom: 5px;
Expand All @@ -208,6 +206,29 @@
background-color: var(--sb-grey-bg-color);
}

/*
* Nested chapters
*/
.innerChapterList {
border-radius: 8px;
}

.innerChapterList > summary {
font-weight: bold;
padding: 4px;
cursor: pointer;
}

.segmentWrapper:has(> .innerChapterList > summary:hover) {
background-color: var(--sb-grey-bg-color);
}

.segmentWrapper{
font-family: Arial, Helvetica, sans-serif;
border-radius: 8px;
margin: 4px 16px;
}

/*
* Individual segments summaries (clickable <summary>)
*/
Expand Down Expand Up @@ -293,6 +314,12 @@
padding: 10px 15px;
transition: background-color 0.2s ease-in-out;
}
.sbControlsMenu-item:first-child {
border-radius: 8px 0px 0px 8px;
}
.sbControlsMenu-item:last-child {
border-radius: 0px 8px 8px 0px;
}
.sbControlsMenu-item:hover, .sbControlsMenu-item:focus {
background-color: #444;
}
Expand Down
22 changes: 8 additions & 14 deletions src/content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,6 @@ let lastCheckVideoTime = -1;
// To determine if a video resolution change is happening
let firstPlay = true;

let channelWhitelisted = false;

let previewBar: PreviewBar = null;
// Skip to highlight button
let skipButtonControlBar: SkipButtonControlBar = null;
Expand Down Expand Up @@ -245,11 +243,6 @@ function messageListener(request: Message, sender: unknown, sendResponse: (respo
isYTTV: (document.location.host === "tv.youtube.com")
});

break;
case "whitelistChange":
channelWhitelisted = request.value;
sponsorsLookup();

break;
case "submitTimes":
openSubmissionMenu();
Expand Down Expand Up @@ -402,12 +395,14 @@ function contentLocalConfigUpdateListener(changes: StorageChangesObject) {
}
}

if (!Config.configSyncListeners.includes(contentConfigUpdateListener)) {
Config.configSyncListeners.push(contentConfigUpdateListener);
}
if (!window.location.href.includes("youtube.com/live_chat")) {
if (!Config.configSyncListeners.includes(contentConfigUpdateListener)) {
Config.configSyncListeners.push(contentConfigUpdateListener);
}

if (!Config.configLocalListeners.includes(contentLocalConfigUpdateListener)) {
Config.configLocalListeners.push(contentLocalConfigUpdateListener);
if (!Config.configLocalListeners.includes(contentLocalConfigUpdateListener)) {
Config.configLocalListeners.push(contentLocalConfigUpdateListener);
}
}

function resetValues() {
Expand All @@ -424,7 +419,6 @@ function resetValues() {
shownSegmentFailedToFetchWarning = false;

videoInfo = null;
channelWhitelisted = false;
lockedCategories = [];

//empty the preview bar
Expand Down Expand Up @@ -704,7 +698,7 @@ async function startSponsorSchedule(includeIntersectingSegments = false, current
logDebug(`Ready to start skipping: ${skipInfo.index} at ${currentTime}`);
if (skipInfo.index === -1) return;

if (Config.config.disableSkipping || channelWhitelisted || (getChannelIDInfo().status === ChannelIDStatus.Fetching && Config.config.forceChannelCheck)){
if (Config.config.disableSkipping || (getChannelIDInfo().status === ChannelIDStatus.Fetching && Config.config.forceChannelCheck)){
return;
}

Expand Down
5 changes: 3 additions & 2 deletions src/js-components/previewBar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,11 @@ class PreviewBar {
// global chapter tooltip or duration tooltip
// YT, Vorapis, unknown, YTTV
const tooltipTextWrapper = document.querySelector(".ytp-tooltip-text-wrapper, .ytp-progress-tooltip-text-container, .yssi-slider .ys-seek-details .time-info-bar") ?? document.querySelector("#progress-bar-container.ytk-player > #hover-time-info");
const defaultTooltipSelector = ".ytp-tooltip-title:not(.sponsorCategoryTooltip), .ytp-tooltip-title:not(.sponsorCategoryTooltip) span, .ytp-progress-tooltip-text:not(.sponsorCategoryTooltip), .current-time:not(.sponsorCategoryTooltip)";
const originalTooltip = findNonEmptyElement([
".ytp-tooltip-title:not(.sponsorCategoryTooltip), .ytp-progress-tooltip-text:not(.sponsorCategoryTooltip), .current-time:not(.sponsorCategoryTooltip)",
defaultTooltipSelector,
".ytp-tooltip-progress-bar-pill-title"
]);
]) ?? document.querySelector(defaultTooltipSelector);
if (!tooltipTextWrapper || !tooltipTextWrapper.parentElement) return;

// Grab the tooltip from the text wrapper as the tooltip doesn't have its classes on init
Expand Down
7 changes: 1 addition & 6 deletions src/messageTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ interface DefaultMessage {
| "getLogs";
}

interface BoolValueMessage {
message: "whitelistChange";
value: boolean;
}

interface IsInfoFoundMessage {
message: "isInfoFound";
updating: boolean;
Expand Down Expand Up @@ -79,7 +74,7 @@ interface SetCurrentTabSkipProfileResponse {
configID: ConfigurationID | null;
}

export type Message = BaseMessage & (DefaultMessage | BoolValueMessage | IsInfoFoundMessage | SkipMessage | SubmitVoteMessage | HideSegmentMessage | CopyToClipboardMessage | ImportSegmentsMessage | KeyDownMessage | LoopChapterMessage | SetCurrentTabSkipProfileResponse);
export type Message = BaseMessage & (DefaultMessage | IsInfoFoundMessage | SkipMessage | SubmitVoteMessage | HideSegmentMessage | CopyToClipboardMessage | ImportSegmentsMessage | KeyDownMessage | LoopChapterMessage | SetCurrentTabSkipProfileResponse);

export interface IsInfoFoundMessageResponse {
found: boolean;
Expand Down
23 changes: 15 additions & 8 deletions src/popup/PopupComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,13 @@ export const PopupComponent = () => {

{/* Toggle Box */}
<div className="sbControlsMenu">
<SkipProfileButton
videoID={videoID}
setShowForceChannelCheckWarning={setShowForceChannelCheckWarning}
/>
{
videoID &&
<SkipProfileButton
videoID={videoID}
setShowForceChannelCheckWarning={setShowForceChannelCheckWarning}
/>
}
<label id="disableExtension" htmlFor="toggleSwitch" className="toggleSwitchContainer sbControlsMenu-item" role="button" tabIndex={0}>
<span className="toggleSwitchContainer-switch">
<input type="checkbox"
Expand Down Expand Up @@ -445,7 +448,8 @@ window.addEventListener("message", async (e): Promise<void> => {

function SkipProfileButton(props: {videoID: string; setShowForceChannelCheckWarning: (v: boolean) => void}): JSX.Element {
const [menuOpen, setMenuOpen] = React.useState(false);
const skipProfileSet = getSkipProfileIDForChannel() !== null;
const channelSkipProfileSet = getSkipProfileIDForChannel() !== null;
const skipProfileSet = getSkipProfileID() !== null;

React.useEffect(() => {
setMenuOpen(false);
Expand All @@ -468,12 +472,15 @@ function SkipProfileButton(props: {videoID: string; setShowForceChannelCheckWarn
<svg viewBox="0 0 24 24" width="23" height="23" className={"SBWhitelistIcon sbControlsMenu-itemIcon " + (menuOpen ? " rotated" : "")}>
<path d="M24 10H14V0h-4v10H0v4h10v10h4V14h10z" />
</svg>
<span id="whitelistChannel" className={(menuOpen || skipProfileSet) ? " hidden" : ""}>
<span id="whitelistChannel" className={!(!menuOpen && !channelSkipProfileSet && !skipProfileSet) ? " hidden" : ""}>
{chrome.i18n.getMessage("addChannelToSkipProfile")}
</span>
<span id="whitelistChannel" className={(menuOpen || !skipProfileSet) ? " hidden" : ""}>
<span id="whitelistChannel" className={!(!menuOpen && channelSkipProfileSet) ? " hidden" : ""}>
{chrome.i18n.getMessage("editChannelsSkipProfile")}
</span>
<span id="whitelistChannel" className={!(!menuOpen && !channelSkipProfileSet && skipProfileSet) ? " hidden" : ""}>
{chrome.i18n.getMessage("editActiveSkipProfile")}
</span>
<span id="unwhitelistChannel" className={!menuOpen ? " hidden" : ""}>
{chrome.i18n.getMessage("closeSkipProfileMenu")}
</span>
Expand Down Expand Up @@ -612,7 +619,7 @@ function SkipProfileRadioButtons(props: SkipProfileRadioButtonsProps): JSX.Eleme
}
}
}
}, [props.configID, props.videoID]);
}, [props.configID, props.videoID, props.selected]);

let alreadySelected = false;
for (const option of skipProfileOptions) {
Expand Down
Loading