mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2024-11-10 09:07:45 +01:00
Add an Export Segments button to the unsubmitted segments list
This commit is contained in:
parent
26f2143247
commit
5f6307041a
2 changed files with 20 additions and 3 deletions
|
@ -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;
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue