mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2024-11-10 01:01:55 +01:00
Changed to upvote/downvote from report
This commit is contained in:
parent
05acb1669e
commit
ef17cae9a1
6 changed files with 142 additions and 17 deletions
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "__MSG_fullName__",
|
"name": "__MSG_fullName__",
|
||||||
"short_name": "__MSG_Name__",
|
"short_name": "__MSG_Name__",
|
||||||
"version": "1.2.28.4",
|
"version": "1.2.29",
|
||||||
"default_locale": "en",
|
"default_locale": "en",
|
||||||
"description": "__MSG_Description__",
|
"description": "__MSG_Description__",
|
||||||
"content_scripts": [{
|
"content_scripts": [{
|
||||||
|
@ -30,6 +30,8 @@
|
||||||
"icons/PlayerUploadFailedIconSponsorBlocker256px.png",
|
"icons/PlayerUploadFailedIconSponsorBlocker256px.png",
|
||||||
"icons/upvote.png",
|
"icons/upvote.png",
|
||||||
"icons/downvote.png",
|
"icons/downvote.png",
|
||||||
|
"icons/thumbs_down.svg",
|
||||||
|
"icons/thumbs_up.svg",
|
||||||
"icons/report.png",
|
"icons/report.png",
|
||||||
"icons/close.png",
|
"icons/close.png",
|
||||||
"icons/beep.ogg",
|
"icons/beep.ogg",
|
||||||
|
|
|
@ -35,11 +35,14 @@
|
||||||
"Segments": {
|
"Segments": {
|
||||||
"message": "sponsor segments"
|
"message": "sponsor segments"
|
||||||
},
|
},
|
||||||
|
"upvoteButtonInfo": {
|
||||||
|
"message": "Upvote this submission"
|
||||||
|
},
|
||||||
"reportButtonTitle": {
|
"reportButtonTitle": {
|
||||||
"message": "Report"
|
"message": "Report"
|
||||||
},
|
},
|
||||||
"reportButtonInfo": {
|
"reportButtonInfo": {
|
||||||
"message": "Report this sponsor submission as incorrect."
|
"message": "Report this submission as incorrect."
|
||||||
},
|
},
|
||||||
"Dismiss": {
|
"Dismiss": {
|
||||||
"message": "Dismiss"
|
"message": "Dismiss"
|
||||||
|
|
58
public/icons/thumbs_down.svg
Normal file
58
public/icons/thumbs_down.svg
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
height="24"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
width="24"
|
||||||
|
version="1.1"
|
||||||
|
id="svg6"
|
||||||
|
sodipodi:docname="thumbs_down.svg"
|
||||||
|
inkscape:version="0.92.4 (5da689c313, 2019-01-14)">
|
||||||
|
<metadata
|
||||||
|
id="metadata12">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<defs
|
||||||
|
id="defs10" />
|
||||||
|
<sodipodi:namedview
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1"
|
||||||
|
objecttolerance="10"
|
||||||
|
gridtolerance="10"
|
||||||
|
guidetolerance="10"
|
||||||
|
inkscape:pageopacity="0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:window-width="730"
|
||||||
|
inkscape:window-height="480"
|
||||||
|
id="namedview8"
|
||||||
|
showgrid="false"
|
||||||
|
inkscape:zoom="9.8333333"
|
||||||
|
inkscape:cx="12"
|
||||||
|
inkscape:cy="12"
|
||||||
|
inkscape:window-x="0"
|
||||||
|
inkscape:window-y="0"
|
||||||
|
inkscape:window-maximized="0"
|
||||||
|
inkscape:current-layer="svg6" />
|
||||||
|
<path
|
||||||
|
d="M0 0h24v24H0z"
|
||||||
|
fill="none"
|
||||||
|
id="path2" />
|
||||||
|
<path
|
||||||
|
d="M15 3H6c-.83 0-1.54.5-1.84 1.22l-3.02 7.05c-.09.23-.14.47-.14.73v2c0 1.1.9 2 2 2h6.31l-.95 4.57-.03.32c0 .41.17.79.44 1.06L9.83 23l6.59-6.59c.36-.36.58-.86.58-1.41V5c0-1.1-.9-2-2-2zm4 0v12h4V3h-4z"
|
||||||
|
id="path4"
|
||||||
|
style="fill:#ffffff" />
|
||||||
|
</svg>
|
After Width: | Height: | Size: 1.7 KiB |
59
public/icons/thumbs_up.svg
Normal file
59
public/icons/thumbs_up.svg
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
fill="black"
|
||||||
|
width="18px"
|
||||||
|
height="18px"
|
||||||
|
version="1.1"
|
||||||
|
id="svg6"
|
||||||
|
sodipodi:docname="thumbs_up.svg"
|
||||||
|
inkscape:version="0.92.4 (5da689c313, 2019-01-14)">
|
||||||
|
<metadata
|
||||||
|
id="metadata12">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<defs
|
||||||
|
id="defs10" />
|
||||||
|
<sodipodi:namedview
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1"
|
||||||
|
objecttolerance="10"
|
||||||
|
gridtolerance="10"
|
||||||
|
guidetolerance="10"
|
||||||
|
inkscape:pageopacity="0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:window-width="730"
|
||||||
|
inkscape:window-height="480"
|
||||||
|
id="namedview8"
|
||||||
|
showgrid="false"
|
||||||
|
inkscape:zoom="13.111111"
|
||||||
|
inkscape:cx="9"
|
||||||
|
inkscape:cy="9"
|
||||||
|
inkscape:window-x="0"
|
||||||
|
inkscape:window-y="0"
|
||||||
|
inkscape:window-maximized="0"
|
||||||
|
inkscape:current-layer="svg6" />
|
||||||
|
<path
|
||||||
|
d="M0 0h24v24H0V0z"
|
||||||
|
fill="none"
|
||||||
|
id="path2" />
|
||||||
|
<path
|
||||||
|
d="M1 21h4V9H1v12zm22-11c0-1.1-.9-2-2-2h-6.31l.95-4.57.03-.32c0-.41-.17-.79-.44-1.06L14.17 1 7.59 7.59C7.22 7.95 7 8.45 7 9v10c0 1.1.9 2 2 2h9c.83 0 1.54-.5 1.84-1.22l3.02-7.05c.09-.23.14-.47.14-.73v-2z"
|
||||||
|
id="path4"
|
||||||
|
style="fill:#ffffff" />
|
||||||
|
</svg>
|
After Width: | Height: | Size: 1.7 KiB |
|
@ -164,19 +164,19 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta
|
||||||
<td id={"sponsorTimesVoteButtonsContainer" + this.idSuffix}
|
<td id={"sponsorTimesVoteButtonsContainer" + this.idSuffix}
|
||||||
className="sponsorTimesVoteButtonsContainer">
|
className="sponsorTimesVoteButtonsContainer">
|
||||||
|
|
||||||
{/* Report Text */}
|
{/* Upvote Button */}
|
||||||
<span id={"sponsorTimesReportText" + this.idSuffix}
|
<img id={"sponsorTimesDownvoteButtonsContainer" + this.idSuffix}
|
||||||
className="sponsorTimesInfoMessage sponsorTimesVoteButtonMessage"
|
className="sponsorSkipObject voteButton"
|
||||||
title={chrome.i18n.getMessage("reportButtonInfo")}
|
src={chrome.extension.getURL("icons/thumbs_up.svg")}
|
||||||
style={{marginRight: "5px"}}>
|
title={chrome.i18n.getMessage("upvoteButtonInfo")}
|
||||||
|
onClick={() => this.prepAction(SkipNoticeAction.Upvote)}>
|
||||||
{chrome.i18n.getMessage("reportButtonTitle")}
|
|
||||||
</span>
|
</img>
|
||||||
|
|
||||||
{/* Report Button */}
|
{/* Report Button */}
|
||||||
<img id={"sponsorTimesDownvoteButtonsContainer" + this.idSuffix}
|
<img id={"sponsorTimesDownvoteButtonsContainer" + this.idSuffix}
|
||||||
className="sponsorSkipObject voteButton"
|
className="sponsorSkipObject voteButton"
|
||||||
src={chrome.extension.getURL("icons/report.png")}
|
src={chrome.extension.getURL("icons/thumbs_down.svg")}
|
||||||
title={chrome.i18n.getMessage("reportButtonInfo")}
|
title={chrome.i18n.getMessage("reportButtonInfo")}
|
||||||
onClick={() => this.adjustDownvotingState(true)}>
|
onClick={() => this.adjustDownvotingState(true)}>
|
||||||
|
|
||||||
|
@ -328,6 +328,9 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta
|
||||||
switch (action ?? this.state.actionState) {
|
switch (action ?? this.state.actionState) {
|
||||||
case SkipNoticeAction.None:
|
case SkipNoticeAction.None:
|
||||||
break;
|
break;
|
||||||
|
case SkipNoticeAction.Upvote:
|
||||||
|
this.contentContainer().vote(1, this.segments[index].UUID, undefined, this);
|
||||||
|
break;
|
||||||
case SkipNoticeAction.Downvote:
|
case SkipNoticeAction.Downvote:
|
||||||
this.contentContainer().vote(0, this.segments[index].UUID, undefined, this);
|
this.contentContainer().vote(0, this.segments[index].UUID, undefined, this);
|
||||||
break;
|
break;
|
||||||
|
@ -468,11 +471,13 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
afterDownvote(segment: SponsorTime, type: number, category: string) {
|
afterVote(segment: SponsorTime, type: number, category: string) {
|
||||||
this.addVoteButtonInfo(chrome.i18n.getMessage("voted"));
|
this.addVoteButtonInfo(chrome.i18n.getMessage("voted"));
|
||||||
this.setNoticeInfoMessage(chrome.i18n.getMessage("hitGoBack"));
|
|
||||||
|
|
||||||
this.adjustDownvotingState(false);
|
if (type === 0) {
|
||||||
|
this.setNoticeInfoMessage(chrome.i18n.getMessage("hitGoBack"));
|
||||||
|
this.adjustDownvotingState(false);
|
||||||
|
}
|
||||||
|
|
||||||
// Change the sponsor locally
|
// Change the sponsor locally
|
||||||
if (segment) {
|
if (segment) {
|
||||||
|
|
|
@ -1376,9 +1376,7 @@ function vote(type: number, UUID: string, category?: string, skipNotice?: SkipNo
|
||||||
if (skipNotice != null) {
|
if (skipNotice != null) {
|
||||||
if (response.successType == 1 || (response.successType == -1 && response.statusCode == 429)) {
|
if (response.successType == 1 || (response.successType == -1 && response.statusCode == 429)) {
|
||||||
//success (treat rate limits as a success)
|
//success (treat rate limits as a success)
|
||||||
if (type === 0 || category) {
|
skipNotice.afterVote.bind(skipNotice)(utils.getSponsorTimeFromUUID(sponsorTimes, UUID), type, category);
|
||||||
skipNotice.afterDownvote.bind(skipNotice)(utils.getSponsorTimeFromUUID(sponsorTimes, UUID), type, category);
|
|
||||||
}
|
|
||||||
} else if (response.successType == 0) {
|
} else if (response.successType == 0) {
|
||||||
//failure: duplicate vote
|
//failure: duplicate vote
|
||||||
skipNotice.setNoticeInfoMessage.bind(skipNotice)(chrome.i18n.getMessage("voteFail"))
|
skipNotice.setNoticeInfoMessage.bind(skipNotice)(chrome.i18n.getMessage("voteFail"))
|
||||||
|
|
Loading…
Reference in a new issue