Skip to content

Commit

Permalink
Code cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
FMaz008 committed May 17, 2024
1 parent 14e311f commit 8c38566
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
19 changes: 11 additions & 8 deletions scripts/bootloader.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,13 @@ async function init() {

//### Run the boot sequence
Notifications.init(); //Ensure the container for notification was created, in case it was not in preboot.

//The following method is called early as it does a XHR request to the server, which takes a while
//Upon receiving the results, it will loop&wait for initTilesAndDrawToolbars() to have completed.
//This allow the page to be rendered while we wait for the server's response.
fetchProductsData(getAllAsin()); //Obtain the data to fill the toolbars with it.

displayAccountData();
initFetchProductData();
showGDPRPopup();
await initFlushTplCache(); //And display the version changelog popup
initInjectScript();
Expand All @@ -67,7 +72,8 @@ async function init() {
initInsertTopPagination();
await initInsertBookmarkButton();
initFixPreviousButton();
await initDrawToolbars();
await initTilesAndDrawToolbars(); //Create the tiles, and move the locally hidden tiles to the hidden tab

HiddenList.garbageCollection();
}

Expand Down Expand Up @@ -122,10 +128,6 @@ function displayAccountData() {
container.appendChild(div);
}

function initFetchProductData() {
fetchProductsData(getAllAsin()); //Obtain the data to fill the toolbars with it.
}

async function showGDPRPopup() {
if (appSettings.general.GDPRPopup == true || appSettings.general.GDPRPopup == undefined) {
prom = await Tpl.loadFile("view/popup_gdpr.html");
Expand Down Expand Up @@ -382,7 +384,7 @@ function initFixPreviousButton() {
);
//$("ul.a-pagination li:first-child a").prepend(text);
}
async function initDrawToolbars() {
async function initTilesAndDrawToolbars() {
//Browse each items from the Regular grid
//- Create an array of all the products listed on the page
//- Create an empty toolbar for the item tile
Expand Down Expand Up @@ -437,6 +439,7 @@ function generateTile(obj) {

//Move the hidden item to the hidden tab
if (appSettings.hiddenTab.active && tile.isHidden()) {
showRuntime("BOOT: The item is locally hidden, move it to the hidden grid.");
tile.moveToGrid(gridHidden, false); //This is the main sort, do not animate it
}

Expand All @@ -458,7 +461,7 @@ function fetchProductsData(arrUrl) {
let arrJSON = {
api_version: 4,
app_version: appVersion,
action: "getinfoTEST",
action: "getinfo",
country: vineCountry,
uuid: appSettings.general.uuid,
queue: vineQueue,
Expand Down
1 change: 0 additions & 1 deletion scripts/grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ async function createGridInterface() {
if (appSettings.favouriteTab?.active) {
let mapFav = new Map();
mapFav = FavouriteList.getList();
console.log(mapFav);
mapFav.forEach(async (value, key) => {
addFavouriteTile(key, value.title, value.thumbnail);
});
Expand Down

0 comments on commit 8c38566

Please sign in to comment.