Merge pull request #9 from okdargy/main
fix settings being undefined on change load
This commit is contained in:
commit
c0dbbdeb0d
2 changed files with 190 additions and 183 deletions
|
|
@ -1,5 +1,6 @@
|
|||
const SettingsURL = chrome.runtime.getURL('settings.html');
|
||||
const InExtensionSettings = window.location.pathname.split('/')[3] === 'polyplus' && window.location.hash !== '#dev' && window.location.hash !== '#debug';
|
||||
|
||||
if (InExtensionSettings === true) {
|
||||
window.location.href = SettingsURL + window.location.hash;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
var Settings;
|
||||
let Theme = ``;
|
||||
|
||||
(async () => {
|
||||
let Utilities = await import(chrome.runtime.getURL('resources/utils.js'));
|
||||
Utilities = Utilities.default;
|
||||
|
|
@ -9,6 +10,12 @@ let Theme = ``;
|
|||
const RawSettings = result.PolyPlus_Settings;
|
||||
Settings = MergeObjects(RawSettings || Utilities.DefaultSettings, Utilities.DefaultSettings);
|
||||
|
||||
// Apply theme settings after Settings is defined
|
||||
applyThemeSettings();
|
||||
});
|
||||
})();
|
||||
|
||||
function applyThemeSettings() {
|
||||
// If theme exists, create a style element to represent it
|
||||
if (Settings.ThemeCreator && Settings.ThemeCreator.Enabled === true) {
|
||||
switch (Settings.ThemeCreator.BGImageSize) {
|
||||
|
|
@ -110,7 +117,6 @@ let Theme = ``;
|
|||
}
|
||||
`;
|
||||
}
|
||||
});
|
||||
|
||||
const combination = "reload";
|
||||
let currentCombination = "";
|
||||
|
|
@ -200,7 +206,7 @@ let Theme = ``;
|
|||
});
|
||||
}
|
||||
});
|
||||
})();
|
||||
}
|
||||
|
||||
function MergeObjects(obj1, obj2) {
|
||||
var mergedObj = {};
|
||||
|
|
|
|||
Reference in a new issue