Fix export/import not appearing without segments and without chapter enabled

This commit is contained in:
Ajay 2022-09-01 16:32:23 -04:00
parent 69c0fe1caf
commit 9e08d6012c
3 changed files with 7 additions and 9 deletions

View file

@ -44,12 +44,12 @@
</span>
</div>
<div id="issueReporterTimeButtons"></div>
<div id="issueReporterImportExport" class="hidden">
<div id="issueReporterImportExport">
<div id="importExportButtons">
<button id="importSegmentsButton" title="__MSG_importSegments__" class="hidden">
<button id="importSegmentsButton" title="__MSG_importSegments__">
<img src="/icons/import.svg" alt="Refresh icon" id="importSegments" />
</button>
<button id="exportSegmentsButton" title="__MSG_exportSegments__">
<button id="exportSegmentsButton" class="hidden" title="__MSG_exportSegments__">
<img src="/icons/export.svg" alt="Export icon" id="exportSegments" />
</button>
</div>

View file

@ -248,7 +248,8 @@ function messageListener(request: Message, sender: unknown, sendResponse: (respo
for (const segment of importedSegments) {
if (!sponsorTimesSubmitting.concat(sponsorTimes ?? []).some(
(s) => Math.abs(s.segment[0] - segment.segment[0]) < 1
&& Math.abs(s.segment[1] - segment.segment[1]) < 1)) {
&& Math.abs(s.segment[1] - segment.segment[1]) < 1)
&& (segment.category !== "chapter" || utils.getCategorySelection("chapter"))) {
sponsorTimesSubmitting.push(segment);
addedSegments = true;
}

View file

@ -527,12 +527,9 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
}
if (downloadedTimes.length > 0) {
PageElements.issueReporterImportExport.classList.remove("hidden");
if (utils.getCategorySelection("chapter")?.option === CategorySkipOption.ShowOverlay) {
PageElements.importSegmentsButton.classList.remove("hidden");
}
PageElements.exportSegmentsButton.classList.remove("hidden");
} else {
PageElements.issueReporterImportExport.classList.add("hidden");
PageElements.exportSegmentsButton.classList.add("hidden");
}
const isVip = Config.config.isVip;