Skip to content

Commit

Permalink
fnal adjustments to shadow dom subject details, closes #40
Browse files Browse the repository at this point in the history
  • Loading branch information
digas99 committed Nov 21, 2024
1 parent 4d72094 commit e457814
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions popup/scripts/subject.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ chrome.storage.local.get(fetchKeys, async result => {

await details.create(true);

// remove menu button
const menuButton = document.querySelector("#sd-detailsPopupMenu");
if (menuButton)
menuButton.remove();

wrapper.addEventListener("click", e => {
if (e.target.closest(".sd-detailsPopup_cardSideBarInfo")) {
const card = e.target.closest(".sd-detailsPopup_cardRow");
Expand Down
8 changes: 6 additions & 2 deletions scripts/details-popup/subject-display.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,12 @@
if (this.autoplayAudio && this.type === "vocabulary")
playSubjectAudio(this.subject["pronunciation_audios"], null);

if (this.detailsPopup.firstChild)
console.log(this.detailsPopup, this.detailsPopup.firstChild);
if (!this.expanded && this.detailsPopup.firstChild)
this.detailsPopup.firstChild.remove();
else
Array.from(this.detailsPopup.querySelectorAll(".sd-focusPopup_kanji")).forEach(elem => elem.remove());

this.detailsPopup.appendChild(this.charContainer(subject, save));

// srs stage border
Expand Down Expand Up @@ -415,7 +419,7 @@
</div>
</div>
`;
this.detailsPopup.insertAdjacentHTML("afterbegin", sidebar);
this.detailsPopup.insertAdjacentHTML("beforeend", sidebar);
this.sidebar = this.detailsPopup.querySelector(".sd-detailsPopup_sidebar");
});
}
Expand Down

0 comments on commit e457814

Please sign in to comment.