diff --git a/public/_locales/en/messages.json b/public/_locales/en/messages.json index 3328e515..28da58da 100644 --- a/public/_locales/en/messages.json +++ b/public/_locales/en/messages.json @@ -558,5 +558,11 @@ }, "forceChannelCheckPopup": { "message": "Consider Enabling Force Channel Check Before Skipping Sponsors" + }, + "downvoteDescription": { + "message": "Incorrect" + }, + "incorrectCategory": { + "message": "Wrong Category" } } diff --git a/src/background.ts b/src/background.ts index b204b64c..74382357 100644 --- a/src/background.ts +++ b/src/background.ts @@ -47,7 +47,7 @@ chrome.runtime.onMessage.addListener(function (request, sender, callback) { //this allows the callback to be called later return true; case "submitVote": - submitVote(request.type, request.UUID, callback); + submitVote(request.type, request.UUID, request.category, callback); //this allows the callback to be called later return true; @@ -147,7 +147,7 @@ function addSponsorTime(time, videoID, callback) { }); } -function submitVote(type, UUID, callback) { +function submitVote(type, UUID, category, callback) { let userID = Config.config.userID; if (userID == undefined || userID === "undefined") { @@ -156,8 +156,10 @@ function submitVote(type, UUID, callback) { Config.config.userID = userID; } + let typeSection = (type !== undefined) ? "&type=" + type : "&category=" + category; + //publish this vote - utils.sendRequestToServer("POST", "/api/voteOnSponsorTime?UUID=" + UUID + "&userID=" + userID + "&type=" + type, function(xmlhttp, error) { + utils.sendRequestToServer("POST", "/api/voteOnSponsorTime?UUID=" + UUID + "&userID=" + userID + typeSection, function(xmlhttp, error) { if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { callback({ successType: 1 diff --git a/src/components/SkipNoticeComponent.tsx b/src/components/SkipNoticeComponent.tsx index 8d53efbb..7f75e7de 100644 --- a/src/components/SkipNoticeComponent.tsx +++ b/src/components/SkipNoticeComponent.tsx @@ -1,4 +1,5 @@ import * as React from "react"; +import * as CompileConfig from "../../config.json"; import Config from "../config" import { ContentContainer, SponsorHideType } from "../types"; @@ -19,16 +20,19 @@ export interface SkipNoticeProps { } export interface SkipNoticeState { - noticeTitle: string, + noticeTitle: string; - messages: string[], + messages: string[]; - countdownTime: number, + countdownTime: number; maxCountdownTime: () => number; - countdownText: string, + countdownText: string; - unskipText: string, - unskipCallback: () => void + unskipText: string; + unskipCallback: () => void; + + downvoting: boolean; + choosingCategory: boolean; } class SkipNoticeComponent extends React.Component { @@ -43,10 +47,15 @@ class SkipNoticeComponent extends React.Component; + categoryOptionRef: React.RefObject; + + // Used to update on config change + configListener: () => void; constructor(props: SkipNoticeProps) { super(props); this.noticeRef = React.createRef(); + this.categoryOptionRef = React.createRef(); this.UUID = props.UUID; this.autoSkip = props.autoSkip; @@ -83,7 +92,10 @@ class SkipNoticeComponent extends React.Component + closeListener={() => this.closeListener()}> {(Config.config.audioNotificationOnSkip) &&