mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-10 13:37:04 +03:00
refactor(lint): apply automatic eslint fixes
This commit is contained in:
@@ -132,7 +132,7 @@ class SBMap<T, U> extends Map {
|
||||
}
|
||||
}
|
||||
|
||||
var Config: SBObject = {
|
||||
const Config: SBObject = {
|
||||
/**
|
||||
* Callback function when an option is updated
|
||||
*/
|
||||
@@ -286,7 +286,7 @@ function configProxy(): any {
|
||||
}
|
||||
});
|
||||
|
||||
var handler: ProxyHandler<any> = {
|
||||
const handler: ProxyHandler<any> = {
|
||||
set(obj, prop, value) {
|
||||
Config.localConfig[prop] = value;
|
||||
|
||||
@@ -298,7 +298,7 @@ function configProxy(): any {
|
||||
},
|
||||
|
||||
get(obj, prop): any {
|
||||
let data = Config.localConfig[prop];
|
||||
const data = Config.localConfig[prop];
|
||||
|
||||
return obj[prop] || data;
|
||||
},
|
||||
@@ -351,7 +351,7 @@ function migrateOldFormats(config: SBConfig) {
|
||||
if (config.whitelistedChannels.length > 0 &&
|
||||
(config.whitelistedChannels[0] == null || config.whitelistedChannels[0].includes("/"))) {
|
||||
const channelURLFixer = async() => {
|
||||
let newChannelList: string[] = [];
|
||||
const newChannelList: string[] = [];
|
||||
for (const item of config.whitelistedChannels) {
|
||||
if (item != null) {
|
||||
if (item.includes("/channel/")) {
|
||||
@@ -360,7 +360,7 @@ function migrateOldFormats(config: SBConfig) {
|
||||
|
||||
|
||||
// Replace channel URL with channelID
|
||||
let response = await utils.asyncRequestToCustomServer("GET", "https://sponsor.ajay.app/invidious/api/v1/channels/" + item.split("/")[2] + "?fields=authorId");
|
||||
const response = await utils.asyncRequestToCustomServer("GET", "https://sponsor.ajay.app/invidious/api/v1/channels/" + item.split("/")[2] + "?fields=authorId");
|
||||
|
||||
if (response.ok) {
|
||||
newChannelList.push((JSON.parse(response.responseText)).authorId);
|
||||
@@ -408,9 +408,9 @@ function migrateOldFormats(config: SBConfig) {
|
||||
|
||||
// Otherwise junk data
|
||||
if (Array.isArray(jsonData)) {
|
||||
let oldMap = new Map(jsonData);
|
||||
const oldMap = new Map(jsonData);
|
||||
oldMap.forEach((sponsorTimes: number[][], key) => {
|
||||
let segmentTimes: SponsorTime[] = [];
|
||||
const segmentTimes: SponsorTime[] = [];
|
||||
for (const segment of sponsorTimes) {
|
||||
segmentTimes.push({
|
||||
segment: segment,
|
||||
@@ -442,7 +442,7 @@ async function setupConfig() {
|
||||
// Reset config
|
||||
function resetConfig() {
|
||||
Config.config = Config.defaults;
|
||||
};
|
||||
}
|
||||
|
||||
function convertJSON(): void {
|
||||
Object.keys(Config.localConfig).forEach(key => {
|
||||
@@ -463,7 +463,7 @@ function addDefaults() {
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Sync config
|
||||
setupConfig();
|
||||
|
||||
Reference in New Issue
Block a user