mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2026-01-28 05:10:50 +03:00
Switched skipping to use category settings.
Submission editing is now broken as well as clicking submit. Skipping through multiple submissions just treats it as skipping from one (no multiple vote options).
This commit is contained in:
23
src/utils.ts
23
src/utils.ts
@@ -1,4 +1,5 @@
|
||||
import Config from "./config";
|
||||
import { CategorySelection, SponsorTime } from "./types";
|
||||
|
||||
class Utils {
|
||||
|
||||
@@ -154,6 +155,28 @@ class Utils {
|
||||
});
|
||||
}
|
||||
|
||||
getSponsorIndexFromUUID(sponsorTimes: SponsorTime[], UUID: string): number {
|
||||
for (let i = 0; i < sponsorTimes.length; i++) {
|
||||
if (sponsorTimes[i].UUID === UUID) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
getSponsorTimeFromUUID(sponsorTimes: SponsorTime[], UUID: string): SponsorTime {
|
||||
return sponsorTimes[this.getSponsorIndexFromUUID(sponsorTimes, UUID)];
|
||||
}
|
||||
|
||||
getCategorySelection(category: string): CategorySelection {
|
||||
for (const selection of Config.config.categorySelections) {
|
||||
if (selection.name === category) {
|
||||
return selection;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
localizeHtmlPage() {
|
||||
//Localize by replacing __MSG_***__ meta tags
|
||||
var objects = document.getElementsByClassName("sponsorBlockPageBody")[0].children;
|
||||
|
||||
Reference in New Issue
Block a user