Skip to content

Commit

Permalink
Fix bugs in project-notes-tabs (ScratchAddons#6736)
Browse files Browse the repository at this point in the history
* Fix bugs in project-notes-tabs

* Fix first bug reported by DNin01
  • Loading branch information
WorldLanguages authored Oct 10, 2023
1 parent b5598f0 commit dbaf7c1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions addons/project-notes-tabs/userscript.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,29 @@ export default async function ({ addon, console }) {
markAsSeen: true,
reduxCondition: (state) => state.scratchGui.mode.isPlayerOnly,
});
projectNotes.insertBefore(tabs, projectNotes.querySelector(".description-block"));
projectNotes.insertBefore(wrapper, projectNotes.querySelector(".description-block"));
}
}

let projectNotes;
let tabs;
const wrapper = document.createElement("div");
wrapper.classList = "sa-project-tabs-wrapper";
let wrapper;

while (true) {
projectNotes = await addon.tab.waitForElement(".project-notes", {
markAsSeen: true,
reduxCondition: (state) => state.scratchGui.mode.isPlayerOnly,
});

if (!document.body.classList.contains("sa-project-tabs-on")) continue; // We're disabled

const labels = document.querySelectorAll(".project-textlabel");
const descriptions = document.querySelectorAll(".description-block");
const tabButtons = [];
const sectionCount = descriptions.length;

wrapper = document.createElement("div");
wrapper.classList = "sa-project-tabs-wrapper";
projectNotes.insertBefore(wrapper, projectNotes.querySelector(".description-block"));
tabs = document.createElement("div");
wrapper.appendChild(tabs);
Expand Down

0 comments on commit dbaf7c1

Please sign in to comment.