Skip to content

Commit

Permalink
Hide card contents when disable to avoid showing it in the next video (
Browse files Browse the repository at this point in the history
  • Loading branch information
F-park authored Oct 24, 2024
1 parent f073113 commit ec424f7
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions scripts/videoui.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,18 @@ VideoProfileCard.prototype.disable = function() {
this.enabled = false;
this.valid = false;
this.data = {};
if (this.el) {
this.el.style.display = "none";
}
this.el.style.display = "none";
this.hideCardContent();
return true;
}

VideoProfileCard.prototype.hideCardContent = function() {
const ids = ["biliscope-ai-summary-popup", "biliscope-hot-comment-wrapper"];
for (const id of ids) {
document.getElementById(id)?.classList.add("d-none");
}
}

VideoProfileCard.prototype.setLeaveEvent = function() {
let validTargets = [this.el, this.target];

Expand Down Expand Up @@ -267,6 +273,8 @@ VideoProfileCard.prototype.updateTarget = function(target) {
}

VideoProfileCard.prototype.drawConclusion = function() {
document.getElementById("biliscope-ai-summary-popup").classList.add("d-none");

let summary = this.data.conclusion?.model_result?.summary;
let outline = this.data.conclusion?.model_result?.outline;
const summaryDiv = document.getElementById("biliscope-ai-summary-abstracts");
Expand Down Expand Up @@ -304,6 +312,10 @@ VideoProfileCard.prototype.drawConclusion = function() {
} else {
outlineDiv.classList.add("d-none");
}

if (summary || outline?.length > 0) {
document.getElementById("biliscope-ai-summary-popup").classList.remove("d-none");
}
}

VideoProfileCard.prototype.drawHotComment = function() {
Expand Down Expand Up @@ -389,7 +401,7 @@ VideoProfileCard.prototype.updateData = function(data) {
this.data.replies = data.payload?.replies;
}

if (this.enabled && this.el) {
if (this.enabled) {
if (this.valid != null) {
this.el.style.display = "flex";
if (this.valid) {
Expand Down

0 comments on commit ec424f7

Please sign in to comment.