mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-10 13:37:04 +03:00
Merge branch 'master' of https://github.com/ajayyy/SponsorBlock into channelTrailer
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "__MSG_fullName__",
|
"name": "__MSG_fullName__",
|
||||||
"short_name": "SponsorBlock",
|
"short_name": "SponsorBlock",
|
||||||
"version": "3.7",
|
"version": "3.7.1",
|
||||||
"default_locale": "en",
|
"default_locale": "en",
|
||||||
"description": "__MSG_Description__",
|
"description": "__MSG_Description__",
|
||||||
"homepage_url": "https://sponsor.ajay.app",
|
"homepage_url": "https://sponsor.ajay.app",
|
||||||
|
|||||||
@@ -26,6 +26,11 @@
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Make sure settings are upfront */
|
||||||
|
.ytp-settings-menu {
|
||||||
|
z-index: 6000 !important;
|
||||||
|
}
|
||||||
|
|
||||||
/* Preview Bar page hacks */
|
/* Preview Bar page hacks */
|
||||||
|
|
||||||
.ytp-tooltip:not(.sponsorCategoryTooltipVisible) .sponsorCategoryTooltip {
|
.ytp-tooltip:not(.sponsorCategoryTooltipVisible) .sponsorCategoryTooltip {
|
||||||
|
|||||||
@@ -16,8 +16,6 @@ export interface NoticeProps {
|
|||||||
timed?: boolean,
|
timed?: boolean,
|
||||||
idSuffix?: string,
|
idSuffix?: string,
|
||||||
|
|
||||||
videoSpeed?: () => number,
|
|
||||||
|
|
||||||
fadeIn?: boolean,
|
fadeIn?: boolean,
|
||||||
startFaded?: boolean,
|
startFaded?: boolean,
|
||||||
firstColumn?: React.ReactElement,
|
firstColumn?: React.ReactElement,
|
||||||
@@ -51,7 +49,6 @@ export interface NoticeState {
|
|||||||
|
|
||||||
class NoticeComponent extends React.Component<NoticeProps, NoticeState> {
|
class NoticeComponent extends React.Component<NoticeProps, NoticeState> {
|
||||||
countdownInterval: NodeJS.Timeout;
|
countdownInterval: NodeJS.Timeout;
|
||||||
intervalVideoSpeed: number;
|
|
||||||
|
|
||||||
idSuffix: string;
|
idSuffix: string;
|
||||||
|
|
||||||
@@ -259,10 +256,6 @@ class NoticeComponent extends React.Component<NoticeProps, NoticeState> {
|
|||||||
|
|
||||||
const countdownTime = Math.min(this.state.countdownTime - 1, this.state.maxCountdownTime());
|
const countdownTime = Math.min(this.state.countdownTime - 1, this.state.maxCountdownTime());
|
||||||
|
|
||||||
if (this.props.videoSpeed && this.intervalVideoSpeed != this.props.videoSpeed()) {
|
|
||||||
this.setupInterval();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (countdownTime <= 0) {
|
if (countdownTime <= 0) {
|
||||||
//remove this from setInterval
|
//remove this from setInterval
|
||||||
clearInterval(this.countdownInterval);
|
clearInterval(this.countdownInterval);
|
||||||
@@ -325,10 +318,7 @@ class NoticeComponent extends React.Component<NoticeProps, NoticeState> {
|
|||||||
setupInterval(): void {
|
setupInterval(): void {
|
||||||
if (this.countdownInterval) clearInterval(this.countdownInterval);
|
if (this.countdownInterval) clearInterval(this.countdownInterval);
|
||||||
|
|
||||||
const intervalDuration = this.props.videoSpeed ? 1000 / this.props.videoSpeed() : 1000;
|
this.countdownInterval = setInterval(this.countdown.bind(this), 1000);
|
||||||
this.countdownInterval = setInterval(this.countdown.bind(this), intervalDuration);
|
|
||||||
|
|
||||||
if (this.props.videoSpeed) this.intervalVideoSpeed = this.props.videoSpeed();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
resetCountdown(): void {
|
resetCountdown(): void {
|
||||||
|
|||||||
@@ -177,7 +177,6 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta
|
|||||||
|| (Config.config.noticeVisibilityMode >= NoticeVisbilityMode.FadedForAutoSkip && this.autoSkip)}
|
|| (Config.config.noticeVisibilityMode >= NoticeVisbilityMode.FadedForAutoSkip && this.autoSkip)}
|
||||||
timed={true}
|
timed={true}
|
||||||
maxCountdownTime={this.state.maxCountdownTime}
|
maxCountdownTime={this.state.maxCountdownTime}
|
||||||
videoSpeed={() => this.contentContainer().v?.playbackRate}
|
|
||||||
style={noticeStyle}
|
style={noticeStyle}
|
||||||
biggerCloseButton={this.contentContainer().onMobileYouTube}
|
biggerCloseButton={this.contentContainer().onMobileYouTube}
|
||||||
ref={this.noticeRef}
|
ref={this.noticeRef}
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ class SubmissionNoticeComponent extends React.Component<SubmissionNoticeProps, S
|
|||||||
idSuffix={this.state.idSuffix}
|
idSuffix={this.state.idSuffix}
|
||||||
ref={this.noticeRef}
|
ref={this.noticeRef}
|
||||||
closeListener={this.cancel.bind(this)}
|
closeListener={this.cancel.bind(this)}
|
||||||
zIndex={50000}>
|
zIndex={5000}>
|
||||||
|
|
||||||
{/* Text Boxes */}
|
{/* Text Boxes */}
|
||||||
{this.getMessageBoxes()}
|
{this.getMessageBoxes()}
|
||||||
|
|||||||
@@ -739,7 +739,7 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
|
|||||||
*/
|
*/
|
||||||
function getFormattedHours(minutes) {
|
function getFormattedHours(minutes) {
|
||||||
minutes = Math.round(minutes * 10) / 10;
|
minutes = Math.round(minutes * 10) / 10;
|
||||||
const days = Math.floor(minutes / 3600);
|
const days = Math.floor(minutes / 1440);
|
||||||
const hours = Math.floor(minutes / 60) % 24;
|
const hours = Math.floor(minutes / 60) % 24;
|
||||||
return (days > 0 ? days + chrome.i18n.getMessage("dayAbbreviation") + " " : "") + (hours > 0 ? hours + chrome.i18n.getMessage("hourAbbreviation") + " " : "") + (minutes % 60).toFixed(1);
|
return (days > 0 ? days + chrome.i18n.getMessage("dayAbbreviation") + " " : "") + (hours > 0 ? hours + chrome.i18n.getMessage("hourAbbreviation") + " " : "") + (minutes % 60).toFixed(1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,10 @@ export default class Utils {
|
|||||||
/** Function that can be used to wait for a condition before returning. */
|
/** Function that can be used to wait for a condition before returning. */
|
||||||
async wait<T>(condition: () => T | false, timeout = 5000, check = 100): Promise<T> {
|
async wait<T>(condition: () => T | false, timeout = 5000, check = 100): Promise<T> {
|
||||||
return await new Promise((resolve, reject) => {
|
return await new Promise((resolve, reject) => {
|
||||||
setTimeout(() => reject("TIMEOUT"), timeout);
|
setTimeout(() => {
|
||||||
|
clearInterval(interval);
|
||||||
|
reject("TIMEOUT");
|
||||||
|
}, timeout);
|
||||||
|
|
||||||
const intervalCheck = () => {
|
const intervalCheck = () => {
|
||||||
const result = condition();
|
const result = condition();
|
||||||
|
|||||||
Reference in New Issue
Block a user