Merge branch 'master' into add-invidious

This commit is contained in:
Ajay Ramachandran
2019-12-29 00:34:49 -05:00
committed by GitHub
8 changed files with 86 additions and 21 deletions

View File

@@ -514,12 +514,11 @@ function updatePreviewBar() {
function getChannelID() {
//get channel id
let channelNameContainer = document.getElementById("channel-name");
let channelURLContainer = null;
if (channelNameContainer !== null) {
channelURLContainer = channelNameContainer.querySelector("#container").querySelector("#text-container").querySelector("#text").firstElementChild;
channelURLContainer = document.querySelector("#channel-name > #container > #text-container > #text");
if (channelURLContainer !== null) {
channelURLContainer = channelURLContainer.firstElementChild;
} else if (onInvidious) {
// Unfortunately, the Invidious HTML doesn't have much in the way of element identifiers...
channelContainers = document.querySelector("body > div > div.pure-u-1.pure-u-md-20-24 div.pure-u-1.pure-u-lg-3-5 > div > a");
@@ -677,9 +676,9 @@ function skipToTime(v, index, sponsorTimes, openNotice) {
}
}
//send telemetry that a this sponsor was skipped happened
//send telemetry that a this sponsor was skipped
if (trackViewCount && !sponsorSkipped[index]) {
sendRequestToServer("GET", "/api/viewedVideoSponsorTime?UUID=" + currentUUID);
sendRequestToServer("POST", "/api/viewedVideoSponsorTime?UUID=" + currentUUID);
if (!disableAutoSkip) {
// Count this as a skip
@@ -973,11 +972,13 @@ function vote(type, UUID, skipNotice) {
let sponsorIndex = UUIDs.indexOf(UUID);
// See if the local time saved count and skip count should be reverted
// See if the local time saved count and skip count should be saved
if (type == 0 && sponsorSkipped[sponsorIndex] || type == 1 && !sponsorSkipped[sponsorIndex]) {
let factor = 1;
if (type == 0) {
factor = -1;
sponsorSkipped[sponsorIndex] = false;
}
// Count this as a skip
@@ -991,8 +992,6 @@ function vote(type, UUID, skipNotice) {
chrome.storage.sync.set({"skipCount": result.skipCount + factor * 1 });
});
sponsorSkipped[sponsorIndex] = !sponsorSkipped[sponsorIndex];
}
chrome.runtime.sendMessage({