mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-06 19:47:04 +03:00
Compare commits
63 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1782376e3d | ||
|
|
ef1b96bbf1 | ||
|
|
7deea5d648 | ||
|
|
c6460b006f | ||
|
|
4352667b1c | ||
|
|
a84502dc92 | ||
|
|
d7c67fb481 | ||
|
|
adc9748d4d | ||
|
|
f310c53f88 | ||
|
|
f2c2fd0d29 | ||
|
|
1b0cd0f485 | ||
|
|
48f6f2f66c | ||
|
|
85b70f8ad7 | ||
|
|
3e32f28d2e | ||
|
|
9bd1b03504 | ||
|
|
cdccc43b31 | ||
|
|
21ce614bd9 | ||
|
|
7f56ec238f | ||
|
|
e1625437d4 | ||
|
|
5b9afebd4e | ||
|
|
93afc06717 | ||
|
|
cfbf1f8995 | ||
|
|
516e5077a9 | ||
|
|
0c2ceb134b | ||
|
|
02bcb0b213 | ||
|
|
35c6ed81b5 | ||
|
|
a229aee2cc | ||
|
|
f91c6d5f9d | ||
|
|
0e93fb6f57 | ||
|
|
1f491d2031 | ||
|
|
32dd7d43d7 | ||
|
|
284efe9902 | ||
|
|
4e795c8fb1 | ||
|
|
c83eb589ea | ||
|
|
7cd6b324b9 | ||
|
|
5891fccacb | ||
|
|
59233f3307 | ||
|
|
796466a72a | ||
|
|
3f35642010 | ||
|
|
5bbfcf742d | ||
|
|
aaf79fda0d | ||
|
|
8604788d27 | ||
|
|
519a822751 | ||
|
|
fef31c399b | ||
|
|
5802e05228 | ||
|
|
da21081a12 | ||
|
|
6d739de57c | ||
|
|
edcd328743 | ||
|
|
5c9e6cac0e | ||
|
|
7ab5e2cf52 | ||
|
|
42dcdb40cf | ||
|
|
896357a943 | ||
|
|
2d96c24b13 | ||
|
|
1753f58120 | ||
|
|
7244ca8f5e | ||
|
|
ec0c989066 | ||
|
|
c801b1fecd | ||
|
|
57b50106d1 | ||
|
|
871ba63f67 | ||
|
|
23fbbebc9e | ||
|
|
6bcdb3e272 | ||
|
|
2d12f957bc | ||
|
|
c1efe02614 |
@@ -14,6 +14,15 @@
|
||||
<a href="https://sponsor.ajay.app/stats">Stats</a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://addons.mozilla.org/addon/sponsorblock/?src=external-github"><img src="https://img.shields.io/amo/users/sponsorblock?label=Firefox%20Users" alt="Badge"></img></a>
|
||||
<a href="https://chrome.google.com/webstore/detail/mnjggcdmjocbbbhaepdhchncahnbgone"><img src="https://img.shields.io/chrome-web-store/users/mnjggcdmjocbbbhaepdhchncahnbgone?label=Chome%20Users" alt="Badge"></img></a>
|
||||
<a href="https://sponsor.ajay.app/stats"><img src="https://img.shields.io/badge/dynamic/json?label=Sponsors%20Submitted&query=totalSubmissions&suffix=%20sponsors&url=http%3A%2F%2Fsponsor.ajay.app%2Fapi%2FgetTotalStats&color=darkred" alt="Badge"></img></a>
|
||||
<a href="https://sponsor.ajay.app/stats"><img src="https://img.shields.io/badge/dynamic/json?label=Contributing%20Users&query=userCount&url=http%3A%2F%2Fsponsor.ajay.app%2Fapi%2FgetTotalStats&color=darkblue" alt="Badge"></img></a>
|
||||
<a href="https://sponsor.ajay.app/stats"><img src="https://img.shields.io/badge/dynamic/json?label=Time%20Saved%20From%20Skips&query=daysSaved&url=http%3A%2F%2Fsponsor.ajay.app%2Fapi%2FgetDaysSavedFormatted&color=darkgreen&suffix=%20days" alt="Badge"></img></a>
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
SponsorBlock is an extension that will skip over sponsored segments of YouTube videos. SponsorBlock is a crowdsourced browser extension that lets anyone submit the start and end times of sponsored segments of YouTube videos. Once one person submits this information, everyone else with this extension will skip right over the sponsored segment.
|
||||
|
||||
|
||||
@@ -31,10 +31,10 @@
|
||||
"message": "Channel Whitelisted!"
|
||||
},
|
||||
"Sponsor": {
|
||||
"message": "Sponsor"
|
||||
"message": "sponsor"
|
||||
},
|
||||
"Sponsors": {
|
||||
"message": "Sponsors"
|
||||
"message": "sponsors"
|
||||
},
|
||||
"Segment": {
|
||||
"message": "sponsor segment"
|
||||
@@ -135,5 +135,113 @@
|
||||
},
|
||||
"submitCheck": {
|
||||
"message": "Are you sure you want to submit this?"
|
||||
},
|
||||
"whitelistChannel": {
|
||||
"message": "Whitelist Channel"
|
||||
},
|
||||
"removeFromWhitelist": {
|
||||
"message": "Remove Channel From Whitelist"
|
||||
},
|
||||
"whitelistDescription": {
|
||||
"message": "Whitelist the channels who do sponsorships ethically to encourage good behavior, or maybe if they are just entertaining and funny. Or don't, that's your call."
|
||||
},
|
||||
"voteOnTime": {
|
||||
"message": "Vote On A Sponsor Time"
|
||||
},
|
||||
"recordTimes": {
|
||||
"message": "Record the times of a sponsorship"
|
||||
},
|
||||
"soFarUHSubmited": {
|
||||
"message": "So far, you've submitted"
|
||||
},
|
||||
"savedPeopleFrom": {
|
||||
"message": "You have saved people from "
|
||||
},
|
||||
"viewLeaderboard": {
|
||||
"message": "View the leaderboard"
|
||||
},
|
||||
"here": {
|
||||
"message": "here"
|
||||
},
|
||||
"recordTimesDescription": {
|
||||
"message": "Click the button below when the sponsorship starts and ends to record and\nsubmit it to the database."
|
||||
},
|
||||
"popupHint": {
|
||||
"message": "Hint: Press the semicolon key while focused on a video report the start/end of a sponsor and quote to submit."
|
||||
},
|
||||
"lastTimes": {
|
||||
"message": "Latest Sponsor Message Times Chosen"
|
||||
},
|
||||
"clearTimesButton": {
|
||||
"message": "Clear Times"
|
||||
},
|
||||
"submitTimesButton": {
|
||||
"message": "Submit Times"
|
||||
},
|
||||
"publicStats": {
|
||||
"message": "This is used on the public stats page to show off how much you've contributed. See it"
|
||||
},
|
||||
"setUsername": {
|
||||
"message": "Set Username"
|
||||
},
|
||||
"discordAdvert": {
|
||||
"message": "Come join the official discord server to give suggestions and feedback!"
|
||||
},
|
||||
"hideThis": {
|
||||
"message": "Hide this"
|
||||
},
|
||||
"Options": {
|
||||
"message": "Options"
|
||||
},
|
||||
"showButtons": {
|
||||
"message": "Hide Buttons On YouTube Player"
|
||||
},
|
||||
"hideButtons": {
|
||||
"message": "Show Buttons On YouTube Player"
|
||||
},
|
||||
"hideButtonsDescription": {
|
||||
"message": "This hides the buttons that appear on the YouTube player to submit sponsors. I can see this being annoying for some\n people. Instead of using the button there, this popup can be used to submit sponsors. To hide the notice that appears, \n use the button that appears on the notice saying \"Don't show this again\". You can always enable these settings again later."
|
||||
},
|
||||
"showInfoButton": {
|
||||
"message": "Show Info Button On YouTube Player"
|
||||
},
|
||||
"hideInfoButton": {
|
||||
"message": "Hide Info Button On YouTube Player"
|
||||
},
|
||||
"whatInfoButton": {
|
||||
"message": "This is the button that opens up a popup in the YouTube page."
|
||||
},
|
||||
"hideDeleteButton": {
|
||||
"message": "Hide Delete Button On YouTube Player"
|
||||
},
|
||||
"showDeleteButton": {
|
||||
"message": "Show Delete Button On YouTube Player"
|
||||
},
|
||||
"whatDeleteButton": {
|
||||
"message": "This is the button that allows you to clear all sponsors on the YouTube player."
|
||||
},
|
||||
"disableViewTracking": {
|
||||
"message": "Disable Sponsor View Tracking"
|
||||
},
|
||||
"enableViewTracking": {
|
||||
"message": "Enable Sponsor View Tracking"
|
||||
},
|
||||
"whatViewTracking": {
|
||||
"message": "This feature tracks which sponsors you have skipped to let users know how much their submission has helped others and\nused as a metric along with upvotes to ensure that spam doesn't get into the database. The extension sends a message\nto the server each time you skip a sponsor. Hopefully most people don't change this setting so that the view numbers are accurate. :)"
|
||||
},
|
||||
"showNotice": {
|
||||
"message": "Show Notice Again"
|
||||
},
|
||||
"longDescription": {
|
||||
"message": "SponsorBlock is an extension that will skip over sponsored segments of YouTube videos. SponsorBlock is a crowdsourced browser extension that let's anyone submit the start and end time's of sponsored segments of YouTube videos. Once one person submits this information, everyone else with this extension will skip right over the sponsored segment.",
|
||||
"description": "Full description of the extension on the store pages."
|
||||
},
|
||||
"website": {
|
||||
"message": "Website",
|
||||
"description": "Used on Firefox Store Page"
|
||||
},
|
||||
"sourceCode": {
|
||||
"message": "Source Code",
|
||||
"description": "Used on Firefox Store Page"
|
||||
}
|
||||
}
|
||||
|
||||
247
_locales/it/messages.json
Normal file
247
_locales/it/messages.json
Normal file
@@ -0,0 +1,247 @@
|
||||
{
|
||||
"Name": {
|
||||
"message": "SponsorBlock",
|
||||
"description": "Name of the extension."
|
||||
},
|
||||
"fullName": {
|
||||
"message": "SponsorBlock per YouTube - Salta gli sponsor",
|
||||
"description": "Name of the extension."
|
||||
},
|
||||
|
||||
"Description": {
|
||||
"message": "Salta i contenuti sponsorizzati nei video di YouTube. Segnala gli annunci incorporati nei video che guardi per far risparmiare tempo agli altri.",
|
||||
"description": "Description of the extension."
|
||||
},
|
||||
"helpPage": {
|
||||
"message": "index_en.html"
|
||||
},
|
||||
"400": {
|
||||
"message": "Richiesta non valida"
|
||||
},
|
||||
"429": {
|
||||
"message": "Stai inviando troppi spezzoni per questo video, sei sicuro che ce ne siano così tanti?"
|
||||
},
|
||||
"409": {
|
||||
"message": "Questo spezzone è già stato inviato"
|
||||
},
|
||||
"502": {
|
||||
"message": "Sembra che il server non funzioni. Contatta lo sviluppatore."
|
||||
},
|
||||
"channelWhitelisted": {
|
||||
"message": "Canale aggiunto alla whitelist!"
|
||||
},
|
||||
"Sponsor": {
|
||||
"message": "sponsorizzazione"
|
||||
},
|
||||
"Sponsors": {
|
||||
"message": "sponsorizzazioni"
|
||||
},
|
||||
"Segment": {
|
||||
"message": "spezzone sponsorizzato"
|
||||
},
|
||||
"Segments": {
|
||||
"message": "spezzoni sponsorizzati"
|
||||
},
|
||||
"noticeTitle": {
|
||||
"message": "Sponsorizzazione Saltata"
|
||||
},
|
||||
"reportButtonTitle": {
|
||||
"message": "Segnala"
|
||||
},
|
||||
"reportButtonInfo": {
|
||||
"message": "Segnala questo spezzone come non corretto."
|
||||
},
|
||||
"Dismiss": {
|
||||
"message": "Chiudi"
|
||||
},
|
||||
"Loading": {
|
||||
"message": "Caricamento..."
|
||||
},
|
||||
"Mins": {
|
||||
"message": "Minuti"
|
||||
},
|
||||
"Secs": {
|
||||
"message": "Secondi"
|
||||
},
|
||||
"Hide": {
|
||||
"message": "Non mostrare più"
|
||||
},
|
||||
"hitGoBack": {
|
||||
"message": "Premi non saltare per tornare da dove sei venuto."
|
||||
},
|
||||
"unskip": {
|
||||
"message": "Non saltare"
|
||||
},
|
||||
"reskip": {
|
||||
"message": "Salta ancora"
|
||||
},
|
||||
"paused": {
|
||||
"message": "In pausa"
|
||||
},
|
||||
"confirmMSG": {
|
||||
"message": "\n\nPer modificare o eliminare valori specifici, premi il pulsante delle informazioni o apri il popup cliccando l'icona dell'estensione nell'angolo in alto a destra."
|
||||
},
|
||||
"clearThis": {
|
||||
"message": "Sei sicuro di volerlo cancellare?\n\n"
|
||||
},
|
||||
"Unknown": {
|
||||
"message": "Si è verificato un errore durante l'invio dello spezzone sponsorizzato, per favore riprova più tardi."
|
||||
},
|
||||
|
||||
"sponsorFound": {
|
||||
"message": "I contenuti sponsorizzati di questo video sono nel database!"
|
||||
},
|
||||
"sponsor404": {
|
||||
"message": "Nessuna sponsorizzazione trovata"
|
||||
},
|
||||
"sponsorStart": {
|
||||
"message": "La sponsorizzazione inizia adesso"
|
||||
},
|
||||
"sponsorEnd": {
|
||||
"message": "La sponsorizzazione finisce adesso"
|
||||
},
|
||||
"noVideoID": {
|
||||
"message": "Probabilmente questa non è una scheda di YouTube, oppure hai cliccato troppo presto. \nSe sei sicuro di essere in una scheda di YouTube,\n riapri questo popup."
|
||||
},
|
||||
"success": {
|
||||
"message": "Successo!"
|
||||
},
|
||||
"voted": {
|
||||
"message": "Votato!"
|
||||
},
|
||||
"voteFail": {
|
||||
"message": "Hai già votato."
|
||||
},
|
||||
"serverDown": {
|
||||
"message": "Sembra che il server non funzioni. Contatta subito lo sviluppatore."
|
||||
},
|
||||
"connectionError": {
|
||||
"message": "Si è verificato un errore durante la connessione. Codice errore: "
|
||||
},
|
||||
"wantToSubmit": {
|
||||
"message": "Vuoi inviare gli spezzoni sponsorizzati per il video con id"
|
||||
},
|
||||
"leftTimes": {
|
||||
"message": "Sembra che tu non abbia inviato alcuni spezzoni sponsorizzati. Ritorna alla pagina precedente per inviarli (non sono stati eliminati)."
|
||||
},
|
||||
"clearTimes": {
|
||||
"message": "Cancella gli Spezzoni Sponsorizzati"
|
||||
},
|
||||
"openPopup": {
|
||||
"message": "Apri il Popup di SponsorBlock"
|
||||
},
|
||||
"SubmitTimes": {
|
||||
"message": "Invia gli Spezzoni Sponsorizzati"
|
||||
},
|
||||
"submitCheck": {
|
||||
"message": "Sei sicuro di volerlo inviare?"
|
||||
},
|
||||
"whitelistChannel": {
|
||||
"message": "Aggiungi Canale alla Whitelist"
|
||||
},
|
||||
"removeFromWhitelist": {
|
||||
"message": "Rimuovi Canale dalla Whitelist"
|
||||
},
|
||||
"whitelistDescription": {
|
||||
"message": "Aggiungi alla whitelist i canali che sponsorizzano eticamente per incoraggiare ad un comportamento corretto, oppure se sono semplicemente intrattenenti e divertenti. Oppure non farlo, decidi tu."
|
||||
},
|
||||
"voteOnTime": {
|
||||
"message": "Vota uno Spezzone Sponsorizzato"
|
||||
},
|
||||
"recordTimes": {
|
||||
"message": "Registra uno Spezzone Sponsorizzato"
|
||||
},
|
||||
"soFarUHSubmited": {
|
||||
"message": "Fino ad ora hai inviato"
|
||||
},
|
||||
"savedPeopleFrom": {
|
||||
"message": "Hai salvato le persone da "
|
||||
},
|
||||
"viewLeaderboard": {
|
||||
"message": "Guarda la classifica"
|
||||
},
|
||||
"here": {
|
||||
"message": "qui"
|
||||
},
|
||||
"recordTimesDescription": {
|
||||
"message": "Premi il pulsante qui sotto quando inizia e finisce la sponsorizzazione per registrarla e\ninviarla al database."
|
||||
},
|
||||
"popupHint": {
|
||||
"message": "Suggerimento: Premi il tasto punto e virgola mentre il video è attivo per segnalare l'inizio/fine di una sponsorizzazione e virgolette per inviare."
|
||||
},
|
||||
"lastTimes": {
|
||||
"message": "Ultimi minutaggi sponsorizzati scelti"
|
||||
},
|
||||
"clearTimesButton": {
|
||||
"message": "Cancella Minutaggi"
|
||||
},
|
||||
"submitTimesButton": {
|
||||
"message": "Invia Minutaggi"
|
||||
},
|
||||
"publicStats": {
|
||||
"message": "Viene utilizzato nelle pagine delle statistiche pubbliche che mostrano quanto hai contribuito. Vedi"
|
||||
},
|
||||
"setUsername": {
|
||||
"message": "Imposta Username"
|
||||
},
|
||||
"discordAdvert": {
|
||||
"message": "Entra nel server Discord ufficiale per darci suggerimenti e feedback!"
|
||||
},
|
||||
"hideThis": {
|
||||
"message": "Nascondi"
|
||||
},
|
||||
"Options": {
|
||||
"message": "Opzioni"
|
||||
},
|
||||
"showButtons": {
|
||||
"message": "Nascondi i Pulsanti nel Lettore di YouTube"
|
||||
},
|
||||
"hideButtons": {
|
||||
"message": "Mostra i Pulsanti nel Lettore di YouTube"
|
||||
},
|
||||
"hideButtonsDescription": {
|
||||
"message": "Nasconde i pulsanti che appaiono nel lettore di YouTube per inviare spezzoni sponsorizzati. Capisco che può essere fastidioso per alcune\n persone. Invece di utilizzare quei pulsanti, è possibile utilizzare questo popup per inviare gli spezzoni sponsorizzati. Per nascondere l'avviso che appare, \nusa il bottone \"Non mostrare più\" nell'avviso. Potrai sempre abilitare nuovamente queste impostazioni in futuro."
|
||||
},
|
||||
"showInfoButton": {
|
||||
"message": "Mostra il Pulsante Informazioni nel Lettore di YouTube"
|
||||
},
|
||||
"hideInfoButton": {
|
||||
"message": "Nascondi il Pulsante Informazioni nel Lettore di YouTube"
|
||||
},
|
||||
"whatInfoButton": {
|
||||
"message": "Questo è il pulsante che apre un popup nella pagina YouTube."
|
||||
},
|
||||
"hideDeleteButton": {
|
||||
"message": "Nascondi il Pulsante Elimina nel Lettore di YouTube"
|
||||
},
|
||||
"showDeleteButton": {
|
||||
"message": "Mostra il Pulsante Elimina nel Lettore di YouTube"
|
||||
},
|
||||
"whatDeleteButton": {
|
||||
"message": "Questo è il pulsante che ti permette di cancellare tutti gli spezzoni sponsorizzati nel lettore di YouTube."
|
||||
},
|
||||
"disableViewTracking": {
|
||||
"message": "Disattiva il Monitoraggio delle Sponsorizzazioni"
|
||||
},
|
||||
"enableViewTracking": {
|
||||
"message": "Disattiva il Monitoraggio delle Sponsorizzazioni"
|
||||
},
|
||||
"whatViewTracking": {
|
||||
"message": "Questa funzione tiene traccia di quali sponsorizzazioni hai saltato per far sapere agli utenti quanto è stato d'aiuto agli altri il loro contributo e\nviene utilizzato come metrica assieme ai voti positivi per filtrare lo spam dal database. L'estensione invia un messaggio\nal server ogni volta che salti una sponsorizzazione. Si spera che la maggior parte delle persone non modifichi questa impostazione così i numeri sono accurati. :)"
|
||||
},
|
||||
"showNotice": {
|
||||
"message": "Mostra di Nuovo l'Avviso"
|
||||
},
|
||||
"longDescription": {
|
||||
"message": "SponsorBlock è un'estensione che salta gli spezzoni con contenuti sponsorizzati nei video di YouTube. SponsorBlock è un'estensione crowdsourced per i browser che permette a chiunque di inviare i minutaggi degli spezzoni sponsorizzati nei video di YouTube. Quando una persona avrà inviato questa informazione, tutti gli utenti che utilizzano questa estensione potranno saltare lo spezzone sponsorizzato.",
|
||||
"description": "Full description of the extension on the store pages."
|
||||
},
|
||||
"website": {
|
||||
"message": "Sito Web",
|
||||
"description": "Used on Firefox Store Page"
|
||||
},
|
||||
"sourceCode": {
|
||||
"message": "Codice Sorgente",
|
||||
"description": "Used on Firefox Store Page"
|
||||
}
|
||||
}
|
||||
212
content.js
212
content.js
@@ -24,6 +24,9 @@ var durationListenerSetUp = false;
|
||||
//the channel this video is about
|
||||
var channelURL;
|
||||
|
||||
//the title of the last video loaded. Used to make sure the channel URL has been updated yet.
|
||||
var title;
|
||||
|
||||
//is this channel whitelised from getting sponsors skipped
|
||||
var channelWhitelisted = false;
|
||||
|
||||
@@ -90,20 +93,20 @@ chrome.runtime.onMessage.addListener(messageListener);
|
||||
|
||||
function messageListener(request, sender, sendResponse) {
|
||||
//messages from popup script
|
||||
|
||||
if (request.message == "update") {
|
||||
switch(request.message){
|
||||
case "update":
|
||||
videoIDChange(getYouTubeVideoID(document.URL));
|
||||
}
|
||||
|
||||
if (request.message == "sponsorStart") {
|
||||
break;
|
||||
case "sponsorStart":
|
||||
sponsorMessageStarted(sendResponse);
|
||||
}
|
||||
|
||||
if (request.message == "sponsorDataChanged") {
|
||||
break;
|
||||
case "sponsorDataChanged":
|
||||
updateSponsorTimesSubmitting();
|
||||
}
|
||||
|
||||
if (request.message == "isInfoFound") {
|
||||
break;
|
||||
case "isInfoFound":
|
||||
//send the sponsor times along with if it's found
|
||||
sendResponse({
|
||||
found: sponsorDataFound,
|
||||
@@ -118,87 +121,92 @@ function messageListener(request, sender, sendResponse) {
|
||||
}
|
||||
|
||||
popupInitialised = true;
|
||||
}
|
||||
|
||||
if (request.message == "getVideoID") {
|
||||
break;
|
||||
case "getVideoID":
|
||||
sendResponse({
|
||||
videoID: sponsorVideoID
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
if (request.message == "getVideoDuration") {
|
||||
break;
|
||||
case "getVideoDuration":
|
||||
sendResponse({
|
||||
duration: v.duration
|
||||
});
|
||||
}
|
||||
|
||||
if (request.message == "skipToTime") {
|
||||
break;
|
||||
case "skipToTime":
|
||||
v.currentTime = request.time;
|
||||
}
|
||||
|
||||
if (request.message == "getCurrentTime") {
|
||||
return
|
||||
case "getCurrentTime":
|
||||
sendResponse({
|
||||
currentTime: v.currentTime
|
||||
});
|
||||
}
|
||||
|
||||
if (request.message == "getChannelURL") {
|
||||
break;
|
||||
case "getChannelURL":
|
||||
sendResponse({
|
||||
channelURL: channelURL
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
if (request.message == "isChannelWhitelisted") {
|
||||
break;
|
||||
case "isChannelWhitelisted":
|
||||
sendResponse({
|
||||
value: channelWhitelisted
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
if (request.message == "whitelistChange") {
|
||||
break;
|
||||
case "whitelistChange":
|
||||
channelWhitelisted = request.value;
|
||||
sponsorsLookup(sponsorVideoID);
|
||||
}
|
||||
|
||||
if (request.message == "showNoticeAgain") {
|
||||
break;
|
||||
case "dontShowNotice":
|
||||
dontShowNotice = false;
|
||||
}
|
||||
|
||||
if (request.message == "changeStartSponsorButton") {
|
||||
break;
|
||||
case "changeStartSponsorButton":
|
||||
changeStartSponsorButton(request.showStartSponsor, request.uploadButtonVisible);
|
||||
}
|
||||
|
||||
if (request.message == "changeVideoPlayerControlsVisibility") {
|
||||
break;
|
||||
case "showNoticeAgain":
|
||||
dontShowNotice = false;
|
||||
|
||||
break;
|
||||
case "changeVideoPlayerControlsVisibility":
|
||||
hideVideoPlayerControls = request.value;
|
||||
|
||||
updateVisibilityOfPlayerControlsButton();
|
||||
} else if (request.message == "changeInfoButtonPlayerControlsVisibility") {
|
||||
|
||||
break;
|
||||
case "changeInfoButtonPlayerControlsVisibility":
|
||||
hideInfoButtonPlayerControls = request.value;
|
||||
|
||||
updateVisibilityOfPlayerControlsButton();
|
||||
} else if (request.message == "changeDeleteButtonPlayerControlsVisibility") {
|
||||
|
||||
break;
|
||||
case "changeDeleteButtonPlayerControlsVisibility":
|
||||
hideDeleteButtonPlayerControls = request.value;
|
||||
|
||||
updateVisibilityOfPlayerControlsButton();
|
||||
}
|
||||
|
||||
if (request.message == "trackViewCount") {
|
||||
break;
|
||||
case "trackViewCount":
|
||||
trackViewCount = request.value;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//check for hotkey pressed
|
||||
document.onkeydown = function(e){
|
||||
e = e || window.event;
|
||||
var key = e.which || e.keyCode;
|
||||
var key = e.key;
|
||||
|
||||
let video = document.getElementById("movie_player");
|
||||
|
||||
//is the video in focus, otherwise they could be typing a comment
|
||||
if (document.activeElement === video) {
|
||||
if(key == 186){
|
||||
if(key == ';'){
|
||||
//semicolon
|
||||
startSponsorClicked();
|
||||
} else if (key == 222) {
|
||||
} else if (key == "'") {
|
||||
//single quote
|
||||
submitSponsorTimes();
|
||||
}
|
||||
@@ -235,11 +243,16 @@ function videoIDChange(id) {
|
||||
//id is not valid
|
||||
if (!id) return;
|
||||
|
||||
let channelIDPromise = wait(getChannelID);
|
||||
channelIDPromise.then(() => channelIDPromise.isFulfilled = true).catch(() => channelIDPromise.isRejected = true);
|
||||
|
||||
//setup the preview bar
|
||||
if (previewBar == null) {
|
||||
//create it
|
||||
wait(getControls).then(result => {
|
||||
let progressBar = document.getElementsByClassName("ytp-progress-bar-container")[0] || document.getElementsByClassName("no-model cue-range-markers")[0];
|
||||
previewBar = new PreviewBar(progressBar);
|
||||
});
|
||||
}
|
||||
|
||||
//warn them if they had unsubmitted times
|
||||
@@ -268,10 +281,10 @@ function videoIDChange(id) {
|
||||
//close popup
|
||||
closeInfoMenu();
|
||||
|
||||
sponsorsLookup(id);
|
||||
sponsorsLookup(id, channelIDPromise);
|
||||
|
||||
//make sure everything is properly added
|
||||
updateVisibilityOfPlayerControlsButton(true);
|
||||
updateVisibilityOfPlayerControlsButton();
|
||||
|
||||
//reset sponsor times submitting
|
||||
sponsorTimesSubmitting = [];
|
||||
@@ -327,7 +340,7 @@ function videoIDChange(id) {
|
||||
|
||||
}
|
||||
|
||||
function sponsorsLookup(id) {
|
||||
function sponsorsLookup(id, channelIDPromise) {
|
||||
v = document.querySelector('video') // Youtube video player
|
||||
//there is no video here
|
||||
if (v == null) {
|
||||
@@ -343,7 +356,6 @@ function sponsorsLookup(id) {
|
||||
}
|
||||
|
||||
//check database for sponsor times
|
||||
|
||||
//made true once a setTimeout has been created to try again after a server error
|
||||
let recheckStarted = false;
|
||||
sendRequestToServer('GET', "/api/getVideoSponsorTimes?videoID=" + id, function(xmlhttp) {
|
||||
@@ -361,7 +373,17 @@ function sponsorsLookup(id) {
|
||||
updatePreviewBar();
|
||||
}
|
||||
|
||||
getChannelID();
|
||||
if (channelIDPromise != null) {
|
||||
if (channelIDPromise.isFulfilled) {
|
||||
whitelistCheck();
|
||||
} else if (channelIDPromise.isRejected) {
|
||||
//try again
|
||||
wait(getChannelID).then(whitelistCheck).catch();
|
||||
} else {
|
||||
//add it as a then statement
|
||||
channelIDPromise.then(whitelistCheck);
|
||||
}
|
||||
}
|
||||
|
||||
sponsorLookupRetries = 0;
|
||||
} else if (xmlhttp.readyState == 4 && xmlhttp.status == 404) {
|
||||
@@ -369,7 +391,7 @@ function sponsorsLookup(id) {
|
||||
|
||||
//check if this video was uploaded recently
|
||||
//use the invidious api to get the time published
|
||||
sendRequestToCustomServer('GET', "https://invidio.us/api/v1/videos/" + id, function(xmlhttp, error) {
|
||||
sendRequestToCustomServer('GET', "https://invidio.us/api/v1/videos/" + id + '?fields=published', function(xmlhttp, error) {
|
||||
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
|
||||
let unixTimePublished = JSON.parse(xmlhttp.responseText).published;
|
||||
|
||||
@@ -412,7 +434,7 @@ function updatePreviewBar() {
|
||||
types.push("previewSponsor");
|
||||
}
|
||||
|
||||
previewBar.set(allSponsorTimes, types, v.duration);
|
||||
wait(() => previewBar !== null).then((result) => previewBar.set(allSponsorTimes, types, v.duration));
|
||||
|
||||
//update last video id
|
||||
lastPreviewBarUpdate = sponsorVideoID;
|
||||
@@ -420,12 +442,13 @@ function updatePreviewBar() {
|
||||
|
||||
function getChannelID() {
|
||||
//get channel id
|
||||
let channelContainers = document.querySelectorAll("#owner-name");
|
||||
let channelContainers = document.querySelectorAll(".ytd-channel-name#text");
|
||||
let channelURLContainer = null;
|
||||
|
||||
for (let i = 0; i < channelContainers.length; i++) {
|
||||
if (channelContainers[i].firstElementChild != null) {
|
||||
channelURLContainer = channelContainers[i].firstElementChild;
|
||||
let child = channelContainers[i].firstElementChild;
|
||||
if (child != null && child.getAttribute("href") != "") {
|
||||
channelURLContainer = child;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -439,12 +462,34 @@ function getChannelID() {
|
||||
|
||||
if (channelURLContainer == null) {
|
||||
//try later
|
||||
setTimeout(getChannelID, 100);
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
//first get the title to make sure a title change has occurred (otherwise the next video might still be loading)
|
||||
let titleInfoContainer = document.getElementById("info-contents");
|
||||
let currentTitle = "";
|
||||
if (titleInfoContainer != null) {
|
||||
currentTitle = titleInfoContainer.firstElementChild.firstElementChild.querySelector(".title").firstElementChild.innerText;
|
||||
} else {
|
||||
//old YouTube theme
|
||||
currentTitle = document.getElementById("eow-title").innerText;
|
||||
}
|
||||
|
||||
if (title == currentTitle) {
|
||||
//video hasn't changed yet, wait
|
||||
//try later
|
||||
return false;
|
||||
}
|
||||
title = currentTitle;
|
||||
|
||||
channelURL = channelURLContainer.getAttribute("href");
|
||||
|
||||
//reset variables
|
||||
channelWhitelisted = false;
|
||||
}
|
||||
|
||||
//checks if this channel is whitelisted, should be done only after the channelID has been loaded
|
||||
function whitelistCheck() {
|
||||
//see if this is a whitelisted channel
|
||||
chrome.storage.sync.get(["whitelistedChannels"], function(result) {
|
||||
let whitelistedChannels = result.whitelistedChannels;
|
||||
@@ -455,6 +500,23 @@ function getChannelID() {
|
||||
UUIDs = [];
|
||||
|
||||
channelWhitelisted = true;
|
||||
|
||||
//make sure the whitelistedChannels array isn't broken and full of null entries
|
||||
//TODO: remove this at some point in the future as the bug that caused this should be patched
|
||||
if (whitelistedChannels.some((el) => el === null)) {
|
||||
//remove the entries that are null
|
||||
let cleanWhitelistedChannelsArray = [];
|
||||
for (let i = 0; i < whitelistedChannels.length; i++) {
|
||||
let channelURL = whitelistedChannels[i];
|
||||
if (channelURL !== null) {
|
||||
//add it
|
||||
cleanWhitelistedChannelsArray.push(channelURL);
|
||||
}
|
||||
}
|
||||
|
||||
//save this value
|
||||
chrome.storage.sync.set({"whitelistedChannels": cleanWhitelistedChannelsArray});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -596,8 +658,9 @@ function getControls() {
|
||||
};
|
||||
|
||||
//adds all the player controls buttons
|
||||
function createButtons() {
|
||||
wait(getControls).then(result => {
|
||||
async function createButtons() {
|
||||
let result = await wait(getControls).catch();
|
||||
|
||||
//set global controls variable
|
||||
controls = result;
|
||||
|
||||
@@ -606,19 +669,19 @@ function createButtons() {
|
||||
createButton("info", "openPopup", openInfoMenu, "PlayerInfoIconSponsorBlocker256px.png")
|
||||
createButton("delete", "clearTimes", clearSponsorTimes, "PlayerDeleteIconSponsorBlocker256px.png");
|
||||
createButton("submit", "SubmitTimes", submitSponsorTimes, "PlayerUploadIconSponsorBlocker256px.png");
|
||||
});
|
||||
}
|
||||
//adds or removes the player controls button to what it should be
|
||||
function updateVisibilityOfPlayerControlsButton() {
|
||||
async function updateVisibilityOfPlayerControlsButton() {
|
||||
//not on a proper video yet
|
||||
if (!sponsorVideoID) return;
|
||||
|
||||
createButtons();
|
||||
await createButtons();
|
||||
|
||||
if (hideVideoPlayerControls) {
|
||||
removePlayerControlsButton();
|
||||
}
|
||||
if (hideInfoButtonPlayerControls) {
|
||||
//don't show the info button on embeds
|
||||
if (hideInfoButtonPlayerControls || document.URL.includes("/embed/")) {
|
||||
document.getElementById("infoButton").style.display = "none";
|
||||
}
|
||||
if (hideDeleteButtonPlayerControls) {
|
||||
@@ -666,11 +729,14 @@ function isSubmitButtonLoaded() {
|
||||
return document.getElementById("submitButton") !== null;
|
||||
}
|
||||
|
||||
function changeStartSponsorButton(showStartSponsor, uploadButtonVisible) {
|
||||
async function changeStartSponsorButton(showStartSponsor, uploadButtonVisible) {
|
||||
if(!sponsorVideoID) return false;
|
||||
wait(isSubmitButtonLoaded).then(result => {
|
||||
|
||||
//make sure submit button is loaded
|
||||
await wait(isSubmitButtonLoaded);
|
||||
|
||||
//if it isn't visible, there is no data
|
||||
let shouldHide = (uploadButtonVisible && !hideDeleteButtonPlayerControls) ? "unset":"none"
|
||||
let shouldHide = (uploadButtonVisible && !hideDeleteButtonPlayerControls) ? "unset" : "none"
|
||||
document.getElementById("deleteButton").style.display = shouldHide;
|
||||
|
||||
if (showStartSponsor) {
|
||||
@@ -692,7 +758,6 @@ function changeStartSponsorButton(showStartSponsor, uploadButtonVisible) {
|
||||
//disable submit button
|
||||
document.getElementById("submitButton").style.display = "none";
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function toggleStartSponsorButton() {
|
||||
@@ -726,12 +791,19 @@ function openInfoMenu() {
|
||||
//add the close button
|
||||
popup.prepend(closeButton);
|
||||
|
||||
let parentNode = document.getElementById("secondary");
|
||||
let parentNodes = document.querySelectorAll("#secondary");
|
||||
let parentNode = null;
|
||||
for (let i = 0; i < parentNodes.length; i++) {
|
||||
if (parentNodes[i].firstElementChild !== null) {
|
||||
parentNode = parentNodes[i];
|
||||
}
|
||||
}
|
||||
if (parentNode == null) {
|
||||
//old youtube theme
|
||||
parentNode = document.getElementById("watch7-sidebar-contents");
|
||||
}
|
||||
|
||||
|
||||
//make the logo source not 404
|
||||
//query selector must be used since getElementByID doesn't work on a node and this isn't added to the document yet
|
||||
let logo = popup.querySelector("#sponsorBlockPopupLogo");
|
||||
@@ -754,9 +826,11 @@ function closeInfoMenu() {
|
||||
if (popup != null) {
|
||||
popup.remove();
|
||||
|
||||
//show info button
|
||||
//show info button if it's not an embed
|
||||
if (!document.URL.includes("/embed/")) {
|
||||
document.getElementById("infoButton").style.display = "unset";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function clearSponsorTimes() {
|
||||
@@ -896,7 +970,7 @@ function submitSponsorTimes() {
|
||||
//called after all the checks have been made that it's okay to do so
|
||||
function sendSubmitMessage(){
|
||||
//add loading animation
|
||||
document.getElementById("submitButtonImage").src = chrome.extension.getURL("icons/PlayerUploadIconSponsorBlocker256px.png");
|
||||
document.getElementById("submitImage").src = chrome.extension.getURL("icons/PlayerUploadIconSponsorBlocker256px.png");
|
||||
document.getElementById("submitButton").style.animation = "rotate 1s 0s infinite";
|
||||
|
||||
let currentVideoID = sponsorVideoID;
|
||||
@@ -931,7 +1005,7 @@ function sendSubmitMessage(){
|
||||
} else {
|
||||
//show that the upload failed
|
||||
document.getElementById("submitButton").style.animation = "unset";
|
||||
document.getElementById("submitButtonImage").src = chrome.extension.getURL("icons/PlayerUploadFailedIconSponsorBlocker256px.png");
|
||||
document.getElementById("submitImage").src = chrome.extension.getURL("icons/PlayerUploadFailedIconSponsorBlocker256px.png");
|
||||
|
||||
if([400,429,409,502].includes(response.statusCode)) {
|
||||
alert(chrome.i18n.getMessage(response.statusCode));
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "__MSG_fullName__",
|
||||
"short_name": "__MSG_Name__",
|
||||
"version": "1.1.4",
|
||||
"version": "1.1.9",
|
||||
"default_locale": "en",
|
||||
"description": "__MSG_Description__",
|
||||
"content_scripts": [
|
||||
|
||||
88
popup.html
88
popup.html
@@ -1,6 +1,6 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>SponsorBlock Popup</title>
|
||||
<title>__MSG_openPopup__</title>
|
||||
<link id="sponorBlockPopupFont" rel="stylesheet" type="text/css" href="/libs/Source+Sans+Pro.css"/>
|
||||
<link id="sponorBlockStyleSheet" rel="stylesheet" type="text/css" href="popup.css"/>
|
||||
</head>
|
||||
@@ -10,10 +10,10 @@
|
||||
<div id="app" class="popupBody">
|
||||
<img src="icons/LogoSponsorBlocker256px.png" height="64px" id="sponsorBlockPopupLogo"/>
|
||||
|
||||
<h1 class="popupElement">SponsorBlock</h1>
|
||||
<h1 class="popupElement">__MSG_Name__</h1>
|
||||
|
||||
<!-- Loading text -->
|
||||
<p id="loadingIndicator" class="popupElement">Loading...</p>
|
||||
<p id="loadingIndicator" class="popupElement">__MSG_Loading__</p>
|
||||
|
||||
<!-- Hidden until loading complete -->
|
||||
<div id="mainControls" class="main popupElement" style="display: none">
|
||||
@@ -29,21 +29,21 @@
|
||||
<br/>
|
||||
|
||||
<div>
|
||||
<button id="whitelistChannel" class="whitelistButton popupElement">Whitelist Channel</button>
|
||||
<button id="unwhitelistChannel" class="whitelistButton popupElement" style="display: none">Remove Channel From Whitelist</button>
|
||||
<button id="whitelistChannel" class="whitelistButton popupElement">__MSG_whitelistChannel__</button>
|
||||
<button id="unwhitelistChannel" class="whitelistButton popupElement" style="display: none">__MSG_removeFromWhitelist__</button>
|
||||
</div>
|
||||
<sub class="popupElement">
|
||||
Whitelist the channels who do sponsorships ethically to encourage good behavior, or maybe if they are just entertaining and funny. Or don't, that's your call.
|
||||
__MSG_whitelistDescription__
|
||||
</sub>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
<button id="reportAnIssue" class="dangerButton popupElement">Vote On A Sponsor Time</button>
|
||||
<button id="reportAnIssue" class="dangerButton popupElement">__MSG_voteOnTime__</button>
|
||||
|
||||
<div id="issueReporterContainer" class="popupElement" style="display: none">
|
||||
|
||||
<h3 style="margin-top: 0px" class="popupElement">Vote On A Sponsor Time</h3>
|
||||
<h3 style="margin-top: 0px" class="popupElement">__MSG_voteOnTime__</h3>
|
||||
|
||||
<div id="issueReporterTimeButtons" class="popupElement">
|
||||
|
||||
@@ -51,47 +51,47 @@
|
||||
|
||||
</div>
|
||||
|
||||
<h2 class="recordingSubtitle popupElement">Record the times of a sponsorship</h2>
|
||||
<h2 class="recordingSubtitle popupElement">__MSG_recordTimes__</h2>
|
||||
|
||||
<p class="popupElement">
|
||||
<span id=sponsorTimesContributionsContainer class="popupElement" style="display: none">
|
||||
So far, you've submitted
|
||||
__MSG_soFarUHSubmited__
|
||||
<span id="sponsorTimesContributionsDisplay" class="popupElement">
|
||||
0
|
||||
</span>
|
||||
<span id="sponsorTimesContributionsDisplayEndWord" class="popupElement">
|
||||
sponsors.
|
||||
__MSG_Sponsors__.
|
||||
</span>
|
||||
</span>
|
||||
|
||||
<span id=sponsorTimesViewsContainer class="popupElement" style="display: none">
|
||||
You have saved people from
|
||||
__MSG_savedPeopleFrom__
|
||||
<span id="sponsorTimesViewsDisplay" class="popupElement">
|
||||
0
|
||||
</span>
|
||||
<span id="sponsorTimesViewsDisplayEndWord" class="popupElement">
|
||||
sponsor segments.
|
||||
__MSG_Segments__.
|
||||
__MSG_savedPeopleFrom__
|
||||
</span>
|
||||
</span>
|
||||
|
||||
<div class="popupElement">
|
||||
View the leaderboard <a class="popupElement discreteLink" href="https://sponsor.ajay.app/stats" target="_blank">here</a>.
|
||||
__MSG_viewLeaderboard__ <a class="popupElement discreteLink" href="https://sponsor.ajay.app/stats" target="_blank">__MSG_here__</a>.
|
||||
</div>
|
||||
</p>
|
||||
|
||||
<p class="popupElement">
|
||||
Click the button below when the sponsorship starts and ends to record and
|
||||
submit it to the database.
|
||||
__MSG_recordTimesDescription__
|
||||
</p>
|
||||
|
||||
<div>
|
||||
<button id="sponsorStart" class="greenButton popupElement">Sponsorship Starts Now</button>
|
||||
<button id="sponsorStart" class="greenButton popupElement">__MSG_sponsorStart__</button>
|
||||
</div>
|
||||
|
||||
<sub class="popupElement">Hint: Press the semicolon key while focused on a video report the start/end of a sponsor and quote to submit.</sub>
|
||||
<sub class="popupElement">__MSG_popupHint__</sub>
|
||||
|
||||
<div id="submissionSection" class="popupElement" style="display: none">
|
||||
<h3 class="popupElement">Latest Sponsor Message Times Chosen</h3>
|
||||
<h3 class="popupElement">__MSG_lastTimes__</h3>
|
||||
<b>
|
||||
<div id="sponsorMessageTimes" class="popupElement">
|
||||
|
||||
@@ -100,13 +100,13 @@
|
||||
|
||||
<br/>
|
||||
|
||||
<button id="clearTimes" class="smallButton popupElement">Clear Times</button>
|
||||
<button id="clearTimes" class="smallButton popupElement">__MSG_clearTimesButton__</button>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
<div id="submitTimesContainer" class="popupElement" style="display: none">
|
||||
<button id="submitTimes" class="smallButton popupElement">Submit Times</button>
|
||||
<button id="submitTimes" class="smallButton popupElement">__MSG_submitTimesButton__</button>
|
||||
|
||||
<div id="submitTimesInfoMessageContainer" class="popupElement" style="display: none">
|
||||
<h3 id="submitTimesInfoMessage" class="popupElement">
|
||||
@@ -122,17 +122,17 @@
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
<button id="setUsernameButton" class="warningButton popupElement">Set Username</button>
|
||||
<button id="setUsernameButton" class="warningButton popupElement">__MSG_setUsername__</button>
|
||||
<br/>
|
||||
<sub class="popupElement">
|
||||
This is used on the public stats page to show off how much you've contributed. See it <a class="popupElement discreteLink" href="https://sponsor.ajay.app/stats" target="_blank">here</a>.
|
||||
__MSG_publicStats__ <a class="popupElement discreteLink" href="https://sponsor.ajay.app/stats" target="_blank">__MSG_here__</a>.
|
||||
</sub>
|
||||
</div>
|
||||
|
||||
<div id="setUsername" class="popupElement" style="display: none">
|
||||
<br/>
|
||||
|
||||
<h3>Set Username</h3>
|
||||
<h3>__MSG_setUsername__</h3>
|
||||
|
||||
<div id="setUsernameStatusContainer" style="display: none">
|
||||
<h2 id="setUsernameStatus"></h2>
|
||||
@@ -154,72 +154,66 @@
|
||||
|
||||
<br/>
|
||||
|
||||
Come join the official discord server to give suggestions and feedback!
|
||||
__MSG_discordAdvert__
|
||||
|
||||
<br/>
|
||||
|
||||
<span id="hideDiscordButton" class="smallLink popupElement">Hide this</span>
|
||||
<span id="hideDiscordButton" class="smallLink popupElement">__MSG_hideThis__</span>
|
||||
</div>
|
||||
|
||||
<div id="optionsButtonContainer" class="popupElement">
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
<button id="optionsButton" class="dangerButton popupElement">Options</button>
|
||||
<button id="optionsButton" class="dangerButton popupElement">__MSG_Options__</button>
|
||||
</div>
|
||||
|
||||
<div id="options" class="popupElement" style="display: none">
|
||||
<br/>
|
||||
|
||||
<h3>Options</h3>
|
||||
<h3>__MSG_Options__</h3>
|
||||
|
||||
<button id="hideVideoPlayerControls" class="warningButton popupElement">Hide Buttons On YouTube Player</button>
|
||||
<button id="showVideoPlayerControls" style="display: none" class="warningButton popupElement">Show Buttons On YouTube Player</button>
|
||||
<button id="hideVideoPlayerControls" class="warningButton popupElement">__MSG_hideButtons__</button>
|
||||
<button id="showVideoPlayerControls" style="display: none" class="warningButton popupElement">__MSG_showButtons__</button>
|
||||
<br/>
|
||||
<sub class="popupElement">
|
||||
This hides the buttons that appear on the YouTube player to submit sponsors. I can see this being annoying for some
|
||||
people. Instead of using the button there, this popup can be used to submit sponsors. To hide the notice that appears,
|
||||
use the button that appears on the notice saying "Don't show this again". You can always enable these settings again
|
||||
later.
|
||||
__MSG_hideButtonsDescription__
|
||||
</sub>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
<button id="hideInfoButtonPlayerControls" class="warningButton popupElement">Hide Info Button On YouTube Player</button>
|
||||
<button id="showInfoButtonPlayerControls" style="display: none" class="warningButton popupElement">Show Info Button On YouTube Player</button>
|
||||
<button id="hideInfoButtonPlayerControls" class="warningButton popupElement">__MSG_hideInfoButton__</button>
|
||||
<button id="showInfoButtonPlayerControls" style="display: none" class="warningButton popupElement">__MSG_showInfoButton__</button>
|
||||
<br/>
|
||||
<sub class="popupElement">
|
||||
This is the button that opens up a popup in the YouTube page.
|
||||
__MSG_whatInfoButton__
|
||||
</sub>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
<button id="hideDeleteButtonPlayerControls" class="warningButton popupElement">Hide Delete Button On YouTube Player</button>
|
||||
<button id="showDeleteButtonPlayerControls" style="display: none" class="warningButton popupElement">Show Delete Button On YouTube Player</button>
|
||||
<button id="hideDeleteButtonPlayerControls" class="warningButton popupElement">__MSG_hideDeleteButton__</button>
|
||||
<button id="showDeleteButtonPlayerControls" style="display: none" class="warningButton popupElement">__MSG_showDeleteButton__</button>
|
||||
<br/>
|
||||
<sub class="popupElement">
|
||||
This is the button that allows you to clear all sponsors on the YouTube player.
|
||||
__MSG_whatDeleteButton__
|
||||
</sub>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
<button id="disableSponsorViewTracking" class="warningButton popupElement">Disable Sponsor View Tracking</button>
|
||||
<button id="enableSponsorViewTracking" style="display: none" class="warningButton popupElement">Enable Sponsor View Tracking</button>
|
||||
<button id="disableSponsorViewTracking" class="warningButton popupElement">__MSG_disableViewTracking__</button>
|
||||
<button id="enableSponsorViewTracking" style="display: none" class="warningButton popupElement">__MSG_enableViewTracking__</button>
|
||||
<br/>
|
||||
<sub class="popupElement">
|
||||
This feature tracks which sponsors you have skipped to let users know how much their submission has helped others and
|
||||
used as a metric along with upvotes to ensure that spam doesn't get into the database. The extension sends a message
|
||||
to the server each time you skip a sponsor. Hopefully most people don't change this setting so that the view numbers
|
||||
are accurate. :)
|
||||
__MSG_whatViewTracking__
|
||||
</sub>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
<button id="showNoticeAgain" style="display: none" class="dangerButton popupElement">Show Notice Again</button>
|
||||
<button id="showNoticeAgain" style="display: none" class="dangerButton popupElement">__MSG_showNotice__</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
1
popup.js
1
popup.js
@@ -1,6 +1,7 @@
|
||||
|
||||
//make this a function to allow this to run on the content page
|
||||
function runThePopup() {
|
||||
localizeHtmlPage();
|
||||
|
||||
//is it in the popup or content script
|
||||
var inPopup = true;
|
||||
|
||||
33
utils.js
33
utils.js
@@ -1,14 +1,20 @@
|
||||
// Function that can be used to wait for a condition before returning
|
||||
async function wait(condition, timeout = 5000, check = 100) {
|
||||
return await new Promise((resolve, reject) => {
|
||||
setTimeout(() => {reject("TIMEOUT")}, timeout);
|
||||
const interval = setInterval(() => {
|
||||
setTimeout(() => reject("TIMEOUT"), timeout);
|
||||
|
||||
let intervalCheck = () => {
|
||||
let result = condition();
|
||||
if (result !== false) {
|
||||
resolve(result);
|
||||
clearInterval(interval);
|
||||
};
|
||||
}, check);
|
||||
};
|
||||
|
||||
let interval = setInterval(intervalCheck, check);
|
||||
|
||||
//run the check once first, this speeds it up a lot
|
||||
intervalCheck();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -37,5 +43,26 @@ function getYouTubeVideoID(url) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function localizeHtmlPage() {
|
||||
//Localize by replacing __MSG_***__ meta tags
|
||||
var objects = document.getElementsByClassName("popupBody")[0].children;
|
||||
for (var j = 0; j < objects.length; j++) {
|
||||
var obj = objects[j];
|
||||
|
||||
var valStrH = obj.innerHTML.toString();
|
||||
var valNewH = valStrH.replace(/__MSG_(\w+)__/g, function(match, v1)
|
||||
{
|
||||
return v1 ? chrome.i18n.getMessage(v1) : "";
|
||||
});
|
||||
|
||||
if(valNewH != valStrH)
|
||||
{
|
||||
obj.innerHTML = valNewH;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user