Compare commits

..

22 Commits

Author SHA1 Message Date
Ajay Ramachandran
45d20574d9 Merge pull request #356 from ajayyy/react
Fix preview sponsors not skipping
2020-05-17 00:00:08 -04:00
Ajay Ramachandran
252da8c56a Added the ability to stop the notice timer by clicking it 2020-05-16 23:58:02 -04:00
Ajay Ramachandran
99373c3e55 Added category names to notice 2020-05-16 23:48:41 -04:00
Ajay Ramachandran
dce69b3642 Incorrect -> Incorrect/Wrong Timing 2020-05-16 23:42:10 -04:00
Ajay Ramachandran
bb670b93e9 Fix preview sponsors not skipping 2020-05-16 23:39:04 -04:00
Ajay Ramachandran
c011ad105d Merge branch 'rafern' 2020-05-15 21:27:37 -04:00
Ajay Ramachandran
856125f7fd Merge pull request #350 from rafern/master
Don't skip ads, hide controls & sponsor times preview bar when ads are playing
2020-05-15 21:25:30 -04:00
Ajay Ramachandran
178b122ab8 Added back requested changes 2020-05-15 21:20:32 -04:00
Ajay Ramachandran
7b0488d068 Reverse "requested changes" 2020-05-15 21:15:50 -04:00
Ajay Ramachandran
02a9238869 Merge branch 'master' into master 2020-05-15 21:12:31 -04:00
Ajay Ramachandran
2fb97409a1 Changed where cd is used in release workflow 2020-05-15 21:08:52 -04:00
Ajay Ramachandran
3640463112 New Crowdin translations (#353)
* New translations messages.json (Portuguese, Brazilian)

* New translations messages.json (Portuguese, Brazilian)
2020-05-15 21:00:07 -04:00
Ajay Ramachandran
d872ed642d Merge pull request #351 from ajayyy/react
Category Improvements
2020-05-15 20:56:09 -04:00
Ajay Ramachandran
1ab1f33caf Change zip binary in release workflow 2020-05-15 20:51:24 -04:00
Ajay Ramachandran
ba13f5951e Increase version number 2020-05-15 19:40:24 -04:00
Ajay Ramachandran
f66e8ddf92 Merge branch 'master' of https://github.com/ajayyy/SponsorBlock into react 2020-05-15 19:40:12 -04:00
Ajay Ramachandran
cff72b19c7 Enable category vote on main server 2020-05-15 19:39:37 -04:00
rafern
c046df7d18 Requested changes 2020-05-14 10:58:30 +01:00
Ajay Ramachandran
941bd41cdb Added another check to prevent phantom skips 2020-05-13 21:11:00 -04:00
Rafael
dd5ed6ce42 Remove duplicate code 2020-05-13 17:45:08 +01:00
rafern
3a0d5221f6 Don't skip ads, hide controls & bar when ad playing 2020-05-13 17:29:34 +01:00
Ajay Ramachandran
a72f571bd4 Update manifest.json 2020-05-12 22:03:38 -04:00
7 changed files with 445 additions and 66 deletions

View File

@@ -17,7 +17,7 @@ jobs:
- run: npm install
- name: Copy configuration
run: cp config.json.example config.json
# Create Chrome artifacts
- name: Create Chrome artifacts
run: npm run build:chrome
@@ -27,11 +27,7 @@ jobs:
path: dist
- run: mkdir ./builds
- name: Zip Artifacts
run: cd ./dist
- uses: montudor/action-zip@v0.1.0
with:
args: zip -r ../builds/ChromeExtension.zip *
- run: cd ../
run: cd ./dist ; zip -r ../builds/ChromeExtension.zip *
# Create Firefox artifacts
- name: Create Firefox artifacts
@@ -41,11 +37,7 @@ jobs:
name: FirefoxExtension
path: dist
- name: Zip Artifacts
run: cd ./dist
- uses: montudor/action-zip@v0.1.0
with:
args: zip -r ../builds/FirefoxExtension.zip *
- run: cd ../
run: cd ./dist ; zip -r ../builds/FirefoxExtension.zip *
# Create Beta artifacts (Builds with the name changed to beta)
- name: Create Chrome Beta artifacts
@@ -55,11 +47,7 @@ jobs:
name: ChromeExtensionBeta
path: dist
- name: Zip Artifacts
run: cd ./dist
- uses: montudor/action-zip@v0.1.0
with:
args: zip -r ../builds/ChromeExtensionBeta.zip *
- run: cd ../
run: cd ./dist ; zip -r ../builds/ChromeExtensionBeta.zip *
- name: Create Firefox Beta artifacts
run: npm run build:firefox -- --env.stream=beta
@@ -68,11 +56,7 @@ jobs:
name: FirefoxExtensionBeta
path: dist
- name: Zip Artifacts
run: cd ./dist
- uses: montudor/action-zip@v0.1.0
with:
args: zip -r ../builds/FirefoxExtensionBeta.zip *
- run: cd ../
run: cd ./dist ; zip -r ../builds/FirefoxExtensionBeta.zip *
# Create Firefox Signed Beta version
- name: Create Firefox Signed Beta artifacts
@@ -83,9 +67,7 @@ jobs:
- name: Install rename
run: sudo apt-get install rename
- name: Install signed file
run: cd ./web-ext-artifacts
- run: rename 's/.*/FirefoxSignedInstaller.xpi/' *
- run: cd ..
run: cd ./web-ext-artifacts ; rename 's/.*/FirefoxSignedInstaller.xpi/' *
- uses: actions/upload-artifact@v1
with:
name: FirefoxExtensionSigned.xpi

View File

@@ -1,7 +1,7 @@
{
"name": "__MSG_fullName__",
"short_name": "__MSG_Name__",
"version": "1.2.28.1",
"version": "1.2.28.4",
"default_locale": "en",
"description": "__MSG_Description__",
"content_scripts": [{

View File

@@ -35,9 +35,6 @@
"Segments": {
"message": "sponsor segments"
},
"noticeTitle": {
"message": "Sponsor Skipped"
},
"reportButtonTitle": {
"message": "Report"
},
@@ -71,6 +68,9 @@
"paused": {
"message": "Paused"
},
"manualPaused": {
"message": "Timer Stopped"
},
"confirmMSG": {
"message": "To edit or delete individual values, click the info button or open the extension popup by clicking the extension icon in the top right corner."
},
@@ -272,12 +272,12 @@
"errorCode": {
"message": "Error Code: "
},
"noticeTitleNotSkipped": {
"message": "Skip Sponsor?"
},
"skip": {
"message": "Skip"
},
"skipped": {
"message": "Skipped"
},
"disableAutoSkip": {
"message": "Disable Auto Skip"
},
@@ -559,7 +559,7 @@
"message": "Consider Enabling Force Channel Check Before Skipping Sponsors"
},
"downvoteDescription": {
"message": "Incorrect"
"message": "Incorrect/Wrong Timing"
},
"incorrectCategory": {
"message": "Wrong Category"

View File

@@ -1,4 +1,8 @@
{
"Name": {
"message": "SponsorBlock",
"description": "Name of the extension."
},
"fullName": {
"message": "SponsorBlock para YouTube - Pule patrocínios",
"description": "Name of the extension."
@@ -149,22 +153,22 @@
"message": "aqui"
},
"recordTimesDescription": {
"message": "Carregue neste botão abaixo quando o patrocínio começar e quando\n acabar para registar e submetê-lo à base de dados"
"message": "Clique no botão abaixo quando o patrocínio começar e quando terminar para registrar e submetê-lo à base de dados."
},
"popupHint": {
"message": "Dica: Carregue na tecla ; enquanto num vídeo para registar o começo/fim de um patrocínio e \" para submeter"
"message": "Dica: Aperte a tecla ; enquanto reproduzir o vídeo para registar o começo/fim de um patrocínio e \" para enviar. (Essa configuração pode ser mudada em opções.)"
},
"lastTimes": {
"message": "Intervalos de Patrocínios Escolhidos mais Recentemente"
"message": "Últimos Intervalos de Patrocínios Seleciados"
},
"clearTimesButton": {
"message": "Limpar Intervalos"
},
"submitTimesButton": {
"message": "Submeter Intervalos"
"message": "Enviar Intervalos"
},
"publicStats": {
"message": "Isto é usado na página pública de estatísticas que mostra o quanto já contríbuíu. Veje-a"
"message": "Isso é usado na página pública de estatísticas que mostra o quanto você já contríbuíu. Veja-a"
},
"setUsername": {
"message": "Criar nomde de utilizador"
@@ -228,5 +232,339 @@
"sourceCode": {
"message": "Código fonte",
"description": "Used on Firefox Store Page"
},
"noticeUpdate": {
"message": "A notificação foi atualizada!",
"description": "The first line of the message displayed after the notice was upgraded."
},
"noticeUpdate2": {
"message": "Se você ainda não gostar dessa, aperte o botão não mostrar novamente.",
"description": "The second line of the message displayed after the notice was upgraded."
},
"setStartSponsorShortcut": {
"message": "Defina a tecla para que marca o início do patrocínio"
},
"setSubmitKeybind": {
"message": "Defina a tecla para enviar o segmento de patrocínio"
},
"keybindDescription": {
"message": "Selecione uma tecla apertando-a"
},
"keybindDescriptionComplete": {
"message": "A tecla foi definida para: "
},
"0": {
"message": "Tempo limite de conexão excedida. Cheque a sua conexão de internet. Se a sua internet estiver funcionando, o servidor está sobrecarregado ou fora do ar."
},
"disableSkipping": {
"message": "Desativar SponsorBlock"
},
"enableSkipping": {
"message": "Ativar SponsorBlock"
},
"yourWork": {
"message": "Suas submissões",
"description": "Used to describe the section that will show you the statistics from your submissions."
},
"502": {
"message": "O servidor parece estar sobrecarregado. Tente novamente em alguns segundos."
},
"errorCode": {
"message": "Código de erro: "
},
"noticeTitleNotSkipped": {
"message": "Pular patrocinador?"
},
"skip": {
"message": "Pular"
},
"disableAutoSkip": {
"message": "Desativar Salto Automático"
},
"enableAutoSkip": {
"message": "Ativar Salto Automático"
},
"autoSkipDescription": {
"message": "Pular automaticamente irá pular patrocínios por você. Se desabilitado, um aviso irá aparecer perguntando se deseja pular o anúncio."
},
"audioNotification": {
"message": "Notificação de áudio ao pular"
},
"audioNotificationDescription": {
"message": "A notificação de áudio ao pular irá tocar um som sempre que um patrocínio for ignorado. Se desativado (ou o pulo automático estiver desativado), nenhum som será reproduzido."
},
"youHaveSkipped": {
"message": "Você pulou "
},
"youHaveSaved": {
"message": "Você poupou "
},
"minLower": {
"message": "minuto"
},
"minsLower": {
"message": "minutos"
},
"hourLower": {
"message": "hora"
},
"hoursLower": {
"message": "horas"
},
"youHaveSavedTime": {
"message": "Você poupou outros"
},
"youHaveSavedTimeEnd": {
"message": " de suas vidas."
},
"guildlinesSummary": {
"message": "- Certifique-se de que seu segmento contém apenas patrocínio, nada mais.\n- Certifique-se de que pular esse segmento não vai pular conteúdo importante.\n- Se todo o vídeo for patrocinado, por favor não o denuncie. Um sistema completo de relatório de vídeo virá em breve.\n- Por favor, não denuncie avisos de parcialidade do vídeo (se um vídeo de avaliação for patrocinado, não pule quando eles mencionarem que é patrocinado)."
},
"statusReminder": {
"message": "Verifique status.sponsor.ajay.app para o status do servidor."
},
"changeUserID": {
"message": "Importar/Exportar seu ID de usuário"
},
"whatChangeUserID": {
"message": "Isso deve ser mantido em segredo. É como se fosse uma senha e não deve ser compartilhado com ninguém. Se alguém tiver isso, poderá se passar por você."
},
"setUserID": {
"message": "Definir ID de usuário"
},
"userIDChangeWarning": {
"message": "Atenção: A alteração do ID de usuário é permanente. Você tem certeza que deseja fazer isso? Certifique-se de fazer backup de seu ID antigo por precaução."
},
"createdBy": {
"message": "Criado por"
},
"autoSkip": {
"message": "Pular automaticamente"
},
"showSkipNotice": {
"message": "Mostrar aviso após um patrocínio ser ignorado"
},
"keybindCurrentlySet": {
"message": ". Atualmente, está definido para:"
},
"supportInvidious": {
"message": "Apoiar Invidious"
},
"supportInvidiousDescription": {
"message": "Invidious (invidio.us) é um cliente para YouTube de terceiros. Para ativar o apoio, você precisa aceitar as permissões adicionais. Isso não funciona em modo anônimo no Chrome ou em outras variantes do Chromium."
},
"optionsInfo": {
"message": "Ativar apoio ao Invidious, desabilitar pular automaticamente, ocultar botões e mais."
},
"addInvidiousInstance": {
"message": "Adicionar instância do Invidious"
},
"addInvidiousInstanceDescription": {
"message": "Adicionar uma instância personalizada do Invidious. Deve ser formatado com APENAS o domínio. Exemplo: invidious.ajay.app"
},
"add": {
"message": "Adicionar"
},
"addInvidiousInstanceError": {
"message": "Este é um domínio inválido. Ele deve incluir APENAS a parte do domínio. Exemplo: invidious.ajay.app"
},
"resetInvidiousInstance": {
"message": "Redefinir Lista de Instâncias do Invidious"
},
"resetInvidiousInstanceAlert": {
"message": "Você está prestes a redefinir a lista de instâncias do Invidious"
},
"currentInstances": {
"message": "Instâncias Atuais:"
},
"enableAutoUpvote": {
"message": "Upvote automático"
},
"whatAutoUpvote": {
"message": "Com isto habilitado, a extensão dará upvote em todas as submissões que você ver se você não reportar. Não funcionará se o aviso estiver desativado."
},
"minDuration": {
"message": "Duração mínima (segundos):"
},
"minDurationDescription": {
"message": "Segmentos de patrocinadores menores do que o valor definido não serão pulados ou mostrados no reprodutor."
},
"shortCheck": {
"message": "A seguinte submissão é mais curta do que sua opção de duração mínima. Isto significa que já foi enviada e que está sendo ignorada devido a esta opção. Tem certeza que deseja enviar mesmo assim?"
},
"showUploadButton": {
"message": "Mostrar botão de envio"
},
"whatUploadButton": {
"message": "Este botão aparece no reprodutor do YouTube depois de ter selecionado um carimbo de data/hora e está pronto para ser enviado."
},
"customServerAddress": {
"message": "Endereço do servidor do SponsorBlock"
},
"customServerAddressDescription": {
"message": "Endereço que o SponsorBlock usa para fazer chamadas ao servidor.\nA menos que você tenha sua própria instância de servidor, isso não deve ser alterado."
},
"save": {
"message": "Salvar"
},
"reset": {
"message": "Redefinir"
},
"customAddressError": {
"message": "Este endereço não está na forma correta. Certifique-se de que possui http:// ou https:// no início e sem barras no final."
},
"areYouSureReset": {
"message": "Tem certeza que deseja redefinir?"
},
"confirmPrivacy": {
"message": "O este vídeo está marcado como não listado. Clique em cancelar se você não deseja verificar se há patrocínios."
},
"unlistedCheck": {
"message": "Ignorar vídeos não listados/privados"
},
"whatUnlistedCheck": {
"message": "Esta configuração irá diminuir um pouco o desempenho do SponsorBlock. As pesquisas do patrocinador exigem que se envie o ID do vídeo para o servidor. Se você estiver preocupado com o envio de IDs de vídeo não listados pela internet, habilite essa opção."
},
"mobileUpdateInfo": {
"message": "m.youtube.com agora é suportado"
},
"exportOptions": {
"message": "Importar/Exportar Todas as Opções"
},
"whatExportOptions": {
"message": "Essa suas preferências em JSON. Isso inclui seu ID de usuário, então lembre-se de compartilhar com cuidado."
},
"setOptions": {
"message": "Definir Opções"
},
"exportOptionsWarning": {
"message": "Aviso: Alterar as opções é permanente e pode fazer a extensão parar de funcionar. Tem certeza que deseja fazer isso? Certifique-se de fazer um backup de seu antigo por precaução."
},
"incorrectlyFormattedOptions": {
"message": "Este JSON não está formatado corretamente. Suas opções não foram alteradas."
},
"confirmNoticeTitle": {
"message": "Enviar Segmento"
},
"submit": {
"message": "Enviar"
},
"cancel": {
"message": "Cancelar"
},
"delete": {
"message": "Deletar"
},
"preview": {
"message": "Pré-visualizar"
},
"edit": {
"message": "Editar"
},
"copyDebugInformation": {
"message": "Copiar Informações de Depuração Para Área de Transferência"
},
"copyDebugInformationFailed": {
"message": "Erro ao copiar para a área de transferência"
},
"copyDebugInformationOptions": {
"message": "Copia informações para a área de transferência para serem fornecidas a um desenvolvedor quando houver um bug / quando um solicitado pelo desenvolvedor. Informações sensíveis como seu ID de usuário, canais na lista de permissões e endereço personalizado do servidor foram removidos. No entanto, ele contém informações como seu useragent, navegador, sistema operacional e número de versão de extensão. "
},
"copyDebugInformationComplete": {
"message": "A informação de depuração foi copiada para a área de transferência. Sinta-se à vontade para remover qualquer informação que prefira não compartilhar. Salve em um arquivo de texto ou cole-a no relatório de bug."
},
"theKey": {
"message": "A tecla"
},
"keyAlreadyUsedByYouTube": {
"message": "já está sendo usado pelo youtube. Por favor, selecione outra tecla."
},
"keyAlreadyUsed": {
"message": "está vinculado a outra ação. Por favor, selecione outra tecla."
},
"to": {
"message": "até",
"description": "Used between sponsor times. Example: 1:20 to 1:30"
},
"category_sponsor": {
"message": "Patrocinador"
},
"category_intro": {
"message": "Animação de Introdução"
},
"category_outro": {
"message": "Finalização/Créditos"
},
"category_interaction": {
"message": "Lembrete de interação (inscrever-se)"
},
"category_selfpromo": {
"message": "Auto-Promoção e Mercadorias"
},
"category_music_offtopic": {
"message": "Música: Seção sem música"
},
"category_livestream_messages": {
"message": "Livestream: Leituras de Doação/Mensagem"
},
"disable": {
"message": "Desativar"
},
"manualSkip": {
"message": "Pular manualmente"
},
"showOverlay": {
"message": "Mostrar barra de progresso"
},
"enableTestingServer": {
"message": "Habilitar Servidor em teste Beta"
},
"whatEnableTestingServer": {
"message": "Seus envios e votos NÃO SERÃO ENVIADOS para o servidor principal. Use isso apenas para testes."
},
"testingServerWarning": {
"message": "Todas os envios e votos NÃO SERÃO ENVIADOS para o servidor principal enquanto se conecta ao servidor de teste. Certifique-se de desativar isso quando você quiser fazer envios reais."
},
"bracketNow": {
"message": "(agora)"
},
"moreCategories": {
"message": "Mais categorias"
},
"bracketEnd": {
"message": "(Fim)"
},
"hiddenDueToDownvote": {
"message": "oculto: Downvote"
},
"hiddenDueToDuration": {
"message": "oculto: muito curto"
},
"channelDataNotFound": {
"message": "ID do canal ainda não carregado."
},
"adblockerIssue": {
"message": "Parece que algo está bloqueando o SponsorBlock de obter dados de vídeo. Isso é provavelmente o seu bloqueador de anúncios. Por favor, verifique https://github.com/ajayyy/SponsorBlock/wiki/Fix-Ad-Blocker-Blocking-SponsorBlock-Requests"
},
"itCouldBeAdblockerIssue": {
"message": "Se isso continuar acontecendo, pode ser causado pelo seu bloqueador de anúncios. Por favor, verifique https://github.com/ajayyy/SponsorBlock/wiki/Fix-Ad-Blocker-Blocking-SponsorBlock-Requests"
},
"forceChannelCheck": {
"message": "Forçar verificação do canal antes de pular os patrocínios"
},
"whatForceChannelCheck": {
"message": "Por padrão, isso pulará os patrocínios imediatamente mesmo antes de saber qual é o canal. Por padrão, alguns patrocinadores de zero segundo podem ser ignorados nos canais da lista branca. Habilitar esta opção evitará isso, mas irá fazer com que todos os saltos tenham um ligeiro atraso, já que obter o channelID pode levar algum tempo. Este atraso pode não ser perceptível se você tiver internet rápida."
},
"forceChannelCheckPopup": {
"message": "Considere habilitar a verificação de canal forçada antes de pular os patrocinadores"
},
"downvoteDescription": {
"message": "Incorreto"
},
"incorrectCategory": {
"message": "Categoria errada"
},
"nonMusicCategoryOnMusic": {
"message": "Este vídeo é classificado como música. Você tem certeza que deseja enviar segmentos com categorias que não são músicas? A menos que esse vídeo não seja de fato música, você não deve enviar esse segmento. Por favor leia as orientações se estiver em dúvidas."
}
}

View File

@@ -23,6 +23,7 @@ export interface NoticeState {
countdownTime: number,
countdownText: string,
countdownManuallyPaused: boolean,
}
class NoticeComponent extends React.Component<NoticeProps, NoticeState> {
@@ -55,6 +56,7 @@ class NoticeComponent extends React.Component<NoticeProps, NoticeState> {
//the countdown until this notice closes
countdownTime: maxCountdownTime(),
countdownText: null,
countdownManuallyPaused: false
}
}
@@ -71,8 +73,8 @@ class NoticeComponent extends React.Component<NoticeProps, NoticeState> {
<table id={"sponsorSkipNotice" + this.idSuffix}
className={"sponsorSkipObject sponsorSkipNotice" + (this.props.fadeIn ? " sponsorSkipNoticeFadeIn" : "")}
style={noticeStyle}
onMouseEnter={this.pauseCountdown.bind(this)}
onMouseLeave={this.startCountdown.bind(this)}>
onMouseEnter={() => this.timerMouseEnter()}
onMouseLeave={() => this.timerMouseLeave()}>
<tbody>
{/* First row */}
@@ -99,6 +101,7 @@ class NoticeComponent extends React.Component<NoticeProps, NoticeState> {
{/* Time left */}
{this.props.timed ? (
<span id={"sponsorSkipNoticeTimeLeft" + this.idSuffix}
onClick={() => this.toggleManualPause()}
className="sponsorSkipObject sponsorSkipNoticeTimeLeft">
{this.state.countdownText || (this.state.countdownTime + "s")}
@@ -121,6 +124,30 @@ class NoticeComponent extends React.Component<NoticeProps, NoticeState> {
);
}
timerMouseEnter() {
if (this.state.countdownManuallyPaused) return;
this.pauseCountdown();
}
timerMouseLeave() {
if (this.state.countdownManuallyPaused) return;
this.startCountdown();
}
toggleManualPause() {
this.setState({
countdownManuallyPaused: !this.state.countdownManuallyPaused
}, () => {
if (this.state.countdownManuallyPaused) {
this.pauseCountdown();
} else {
this.startCountdown();
}
});
}
//called every second to lower the countdown before hiding the notice
countdown() {
if (!this.props.timed) return;
@@ -159,7 +186,7 @@ class NoticeComponent extends React.Component<NoticeProps, NoticeState> {
//reset countdown and inform the user
this.setState({
countdownTime: this.state.maxCountdownTime(),
countdownText: chrome.i18n.getMessage("paused")
countdownText: this.state.countdownManuallyPaused ? chrome.i18n.getMessage("manualPaused") : chrome.i18n.getMessage("paused")
});
//remove the fade out class if it exists

View File

@@ -62,10 +62,10 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta
this.contentContainer = props.contentContainer;
this.audio = null;
let noticeTitle = chrome.i18n.getMessage("noticeTitle");
let noticeTitle = chrome.i18n.getMessage("category_" + this.getSponsorTime().category) + " " + chrome.i18n.getMessage("skipped");
if (!this.autoSkip) {
noticeTitle = chrome.i18n.getMessage("noticeTitleNotSkipped");
noticeTitle = chrome.i18n.getMessage("skip") + " " + chrome.i18n.getMessage("category_" + this.getSponsorTime().category) + "?";
}
//add notice
@@ -103,6 +103,11 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta
}
}
// Helper method
getSponsorTime() {
return utils.getSponsorTimeFromUUID(this.contentContainer().sponsorTimes, this.UUID);
}
componentDidMount() {
if (Config.config.audioNotificationOnSkip && this.audio) {
this.audio.volume = this.contentContainer().v.volume * 0.1;
@@ -198,13 +203,11 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta
</button>
{/* Category vote */}
{Config.config.testingServer &&
<button className="sponsorSkipObject sponsorSkipNoticeButton"
onClick={() => this.openCategoryChooser()}>
<button className="sponsorSkipObject sponsorSkipNoticeButton"
onClick={() => this.openCategoryChooser()}>
{chrome.i18n.getMessage("incorrectCategory")}
</button>
}
{chrome.i18n.getMessage("incorrectCategory")}
</button>
</td>
</tr>
@@ -217,7 +220,7 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta
{/* Category Selector */}
<select id={"sponsorTimeCategories" + this.idSuffix}
className="sponsorTimeCategories"
defaultValue={utils.getSponsorTimeFromUUID(this.props.contentContainer().sponsorTimes, this.props.UUID).category}
defaultValue={this.getSponsorTime().category}
ref={this.categoryOptionRef}
onChange={this.categorySelectionChange.bind(this)}>
@@ -321,7 +324,7 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta
chrome.runtime.sendMessage({"message": "openConfig"});
// Reset option to original
event.target.value = utils.getSponsorTimeFromUUID(this.props.contentContainer().sponsorTimes, this.props.UUID).category;
event.target.value = this.getSponsorTime().category;
return;
}
}
@@ -342,7 +345,7 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta
getUnskippedModeInfo(buttonText: string) {
let maxCountdownTime = function() {
let sponsorTime = utils.getSponsorTimeFromUUID(this.contentContainer().sponsorTimes, this.UUID);
let sponsorTime = this.getSponsorTime();
let duration = Math.round((sponsorTime.segment[1] - this.contentContainer().v.currentTime) * (1 / this.contentContainer().v.playbackRate));
return Math.max(duration, 4);
@@ -389,7 +392,7 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta
this.adjustDownvotingState(false);
// Change the sponsor locally
let sponsorTime = utils.getSponsorTimeFromUUID(this.contentContainer().sponsorTimes, this.UUID);
let sponsorTime = this.getSponsorTime();
if (sponsorTime) {
if (type === 0) {
sponsorTime.hidden = SponsorHideType.Downvoted;

View File

@@ -41,9 +41,6 @@ var sponsorSkipped: boolean[] = [];
//the video
var video: HTMLVideoElement;
/** The last time this video was seeking to */
var lastVideoTime: number = null;
var onInvidious;
var onMobileYouTube;
@@ -99,6 +96,9 @@ var popupInitialised = false;
var submissionNotice: SubmissionNotice = null;
// If there is an advert playing (or about to be played), this is true
var isAdPlaying = false;
// Contains all of the functions and variables needed by the skip notice
var skipNoticeContentContainer: ContentContainer = () => ({
vote,
@@ -281,6 +281,9 @@ function resetValues() {
} else {
switchingVideos = true;
}
// Reset advert playing flag
isAdPlaying = false;
}
async function videoIDChange(id) {
@@ -446,6 +449,7 @@ function createPreviewBar(): void {
* This happens when the resolution changes or at random time to clear memory.
*/
function durationChangeListener() {
updateAdFlag();
updatePreviewBar();
}
@@ -464,13 +468,22 @@ function cancelSponsorSchedule(): void {
function startSponsorSchedule(includeIntersectingSegments: boolean = false, currentTime?: number): void {
cancelSponsorSchedule();
// Don't skip if advert playing and reset last checked time
if (isAdPlaying) {
// Reset lastCheckVideoTime
lastCheckVideoTime = -1;
lastCheckTime = 0;
return;
}
if (video.paused) return;
if (Config.config.disableSkipping || channelWhitelisted || (channelID === null && Config.config.forceChannelCheck)){
return;
}
if (incorrectVideoIDCheck()) return;
if (incorrectVideoCheck()) return;
if (currentTime === undefined || currentTime === null) currentTime = video.currentTime;
@@ -490,7 +503,7 @@ function startSponsorSchedule(includeIntersectingSegments: boolean = false, curr
let forcedSkipTime: number = null;
let forcedIncludeIntersectingSegments = false;
if (incorrectVideoIDCheck(videoID)) return;
if (incorrectVideoCheck(videoID, currentSkip)) return;
if (video.currentTime >= skipTime[0] && video.currentTime < skipTime[1]) {
skipToTime(video, skipInfo.endIndex, skipInfo.array, skipInfo.openNotice);
@@ -515,13 +528,11 @@ function startSponsorSchedule(includeIntersectingSegments: boolean = false, curr
}
/**
* This makes sure the videoID is still correct
*
* TODO: Remove this bug catching if statement when the bug is found
* This makes sure the videoID is still correct and if the sponsorTime is included
*/
function incorrectVideoIDCheck(videoID?: string): boolean {
function incorrectVideoCheck(videoID?: string, sponsorTime?: SponsorTime): boolean {
let currentVideoID = getYouTubeVideoID(document.URL);
if (currentVideoID !== (videoID || sponsorVideoID)) {
if (currentVideoID !== (videoID || sponsorVideoID) || (sponsorTime && (!sponsorTimes || !sponsorTimes.includes(sponsorTime)) && !sponsorTimesSubmitting.includes(sponsorTime))) {
// Something has really gone wrong
console.error("[SponsorBlock] The videoID recorded when trying to skip is different than what it should be.");
console.error("[SponsorBlock] VideoID recorded: " + sponsorVideoID + ". Actual VideoID: " + currentVideoID);
@@ -556,6 +567,9 @@ function sponsorsLookup(id: string) {
video.addEventListener('play', () => {
switchingVideos = false;
// Check if an ad is playing
updateAdFlag();
// Make sure it doesn't get double called with the playing event
if (lastCheckVideoTime !== video.currentTime && Date.now() - lastCheckTime > 2000) {
lastCheckTime = Date.now();
@@ -563,6 +577,7 @@ function sponsorsLookup(id: string) {
startSponsorSchedule();
}
});
video.addEventListener('playing', () => {
// Make sure it doesn't get double called with the play event
@@ -578,8 +593,6 @@ function sponsorsLookup(id: string) {
lastCheckVideoTime = -1
lastCheckTime = 0;
lastVideoTime = video.currentTime;
if (!video.paused){
startSponsorSchedule();
}
@@ -590,8 +603,6 @@ function sponsorsLookup(id: string) {
lastCheckVideoTime = -1;
lastCheckTime = 0;
lastVideoTime = video.currentTime;
cancelSponsorSchedule();
});
@@ -783,6 +794,11 @@ function updatePreviewBarPositionMobile(parent: Element) {
}
function updatePreviewBar() {
if(isAdPlaying) {
previewBar.set([], [], 0);
return;
}
if (previewBar === null || video === null) return;
let localSponsorTimes = sponsorTimes;
@@ -1577,3 +1593,16 @@ function sendRequestToCustomServer(type, fullAddress, callback) {
//submit this request
xmlhttp.send();
}
/**
* Update the isAdPlaying flag and hide preview bar/controls if ad is playing
*/
function updateAdFlag() {
let wasAdPlaying = isAdPlaying;
isAdPlaying = document.getElementsByClassName('ad-showing').length > 0;
if(wasAdPlaying != isAdPlaying) {
updatePreviewBar();
updateVisibilityOfPlayerControlsButton();
}
}