background changes done

This commit is contained in:
Crazypersonalph
2023-12-04 14:06:00 +08:00
parent 9d010a7743
commit ef861f48ea
+3 -3
View File
@@ -128,7 +128,7 @@ function GetNews(sendResponse: any) {
}); });
} }
const DefaultValues = { const DefaultValues: any = {
onoff: true, onoff: true,
animatedbk: true, animatedbk: true,
bksliderinput: 50, bksliderinput: 50,
@@ -238,13 +238,13 @@ function UpdateCurrentValues() {
function migrateOldStorage() { function migrateOldStorage() {
const result = browser.storage.local.get() const result = browser.storage.local.get()
function open (items) { function open (items: any) {
let shouldUpdate = false; // Flag to check if there is anything to update let shouldUpdate = false; // Flag to check if there is anything to update
// Check for the old "Name" field and convert it to "name" // Check for the old "Name" field and convert it to "name"
if (items.shortcuts && items.shortcuts.length > 0 && 'Name' in items.shortcuts[0]) { if (items.shortcuts && items.shortcuts.length > 0 && 'Name' in items.shortcuts[0]) {
shouldUpdate = true; shouldUpdate = true;
items.shortcuts = items.shortcuts.map((shortcut) => { items.shortcuts = items.shortcuts.map((shortcut: any) => {
return { return {
name: shortcut.Name, // Convert "Name" to "name" name: shortcut.Name, // Convert "Name" to "name"
enabled: shortcut.enabled // Keep the "enabled" field as is enabled: shortcut.enabled // Keep the "enabled" field as is