aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormini-bomba <[email protected]>2022-08-24 14:25:35 +0200
committerAjay <[email protected]>2022-09-01 23:03:25 -0400
commit5f6307041a0b00424c13a56628ed21f65a1ba583 (patch)
tree1aac2210c38099cacf8c2ed6a7205400a2ab234e
parent26f214324799135c8178019c1083d3d91071c671 (diff)
downloadSponsorBlock-5f6307041a0b00424c13a56628ed21f65a1ba583.tar.gz
SponsorBlock-5f6307041a0b00424c13a56628ed21f65a1ba583.zip
Add an Export Segments button to the unsubmitted segments list
-rw-r--r--src/components/UnsubmittedVideoListItem.tsx21
-rw-r--r--src/components/UnsubmittedVideosComponent.tsx2
2 files changed, 20 insertions, 3 deletions
diff --git a/src/components/UnsubmittedVideoListItem.tsx b/src/components/UnsubmittedVideoListItem.tsx
index ab00fa83..fec08dc9 100644
--- a/src/components/UnsubmittedVideoListItem.tsx
+++ b/src/components/UnsubmittedVideoListItem.tsx
@@ -1,6 +1,7 @@
import * as React from "react";
import Config from "../config";
+import { exportTimes } from "../utils/exporter";
export interface UnsubmittedVideosListItemProps {
videoID: string;
@@ -40,6 +41,12 @@ class UnsubmittedVideoListItem extends React.Component<UnsubmittedVideosListItem
</td>
<td id={this.props.videoID + "UnsubmittedVideoActions"}>
+ <div id={this.props.videoID + "ExportSegmentsAction"}
+ className="option-button inline low-profile"
+ onClick={this.exportSegments.bind(this)}>
+ {chrome.i18n.getMessage("exportSegments")}
+ </div>
+ {" "}
<div id={this.props.videoID + "ClearSegmentsAction"}
className="option-button inline low-profile"
onClick={this.clearSegments.bind(this)}>
@@ -55,10 +62,20 @@ class UnsubmittedVideoListItem extends React.Component<UnsubmittedVideosListItem
clearSegments(): void {
if (confirm(chrome.i18n.getMessage("clearThis"))) {
- delete Config.config.unsubmittedSegments[this.props.videoID]
- Config.forceSyncUpdate("unsubmittedSegments")
+ delete Config.config.unsubmittedSegments[this.props.videoID];
+ Config.forceSyncUpdate("unsubmittedSegments");
}
}
+
+ exportSegments(): void {
+ navigator.clipboard.writeText(exportTimes(Config.config.unsubmittedSegments[this.props.videoID]))
+ .then(() => {
+ alert(chrome.i18n.getMessage("CopiedExclamation"));
+ })
+ .catch(() => {
+ alert(chrome.i18n.getMessage("copyDebugInformationFailed"));
+ });
+ }
}
export default UnsubmittedVideoListItem;
diff --git a/src/components/UnsubmittedVideosComponent.tsx b/src/components/UnsubmittedVideosComponent.tsx
index 04542adc..ee1f70f2 100644
--- a/src/components/UnsubmittedVideosComponent.tsx
+++ b/src/components/UnsubmittedVideosComponent.tsx
@@ -38,7 +38,7 @@ class UnsubmittedVideosComponent extends React.Component<UnsubmittedVideosProps,
{videoCount > 0 && <div className="option-button inline" onClick={() => this.setState({tableVisible: !this.state.tableVisible})}>
{chrome.i18n.getMessage(this.state.tableVisible ? "hideUnsubmittedSegments" : "showUnsubmittedSegments")}
</div>}
-
+ {" "}
<div className="option-button inline" onClick={this.clearAllSegments}>
{chrome.i18n.getMessage("clearUnsubmittedSegments")}
</div>