From bf97c7795bdcd4128788f4004f6f3ed4b98fcd59 Mon Sep 17 00:00:00 2001 From: Tian Gao Date: Tue, 2 Apr 2024 16:06:30 -0700 Subject: [PATCH] Add hover time threshold option --- options/options.html | 14 +++++++++----- options/options.js | 4 ++++ scripts/biliscope.js | 2 +- scripts/load.js | 1 + 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/options/options.html b/options/options.html index cfb3ac2..820a189 100644 --- a/options/options.html +++ b/options/options.html @@ -12,16 +12,20 @@ -
- - -
+
+ + +
+
+ + +
- + diff --git a/options/options.js b/options/options.js index 02118b2..c86a69f 100644 --- a/options/options.js +++ b/options/options.js @@ -172,12 +172,14 @@ function save_options() { const enableUpCard = document.getElementById('enable-up-card').checked; const enableWordCloud = document.getElementById('enable-word-cloud').checked; const enableAiSummary = document.getElementById('enable-ai-summary').checked; + const aiSummaryHoverThreshold = document.getElementById('ai-summary-hover-threshold').value; const minSize = document.getElementById('min-number').value; const enableTagColor = document.getElementById('enable-tag-color').checked; chrome.storage.sync.set({ enableUpCard: enableUpCard, enableWordCloud: enableWordCloud, enableAiSummary: enableAiSummary, + aiSummaryHoverThreshold: aiSummaryHoverThreshold, enableTagColor: enableTagColor, minSize: minSize }, function () { @@ -193,12 +195,14 @@ function restore_options() { enableUpCard: true, enableWordCloud: true, enableAiSummary: true, + aiSummaryHoverThreshold: 800, enableTagColor: false, minSize: 5 }, function (items) { document.getElementById('enable-up-card').checked = items.enableUpCard; document.getElementById('enable-word-cloud').checked = items.enableWordCloud; document.getElementById('enable-ai-summary').checked = items.enableAiSummary; + document.getElementById('ai-summary-hover-threshold').value = items.aiSummaryHoverThreshold, document.getElementById('enable-tag-color').checked = items.enableTagColor; document.getElementById('min-number').value = items.minSize; }); diff --git a/scripts/biliscope.js b/scripts/biliscope.js index 9bce124..6308aac 100644 --- a/scripts/biliscope.js +++ b/scripts/biliscope.js @@ -70,7 +70,7 @@ function showProfileDebounce(event) { debounceTime = 300; break; case "video": - debounceTime = 800; + debounceTime = biliScopeOptions.aiSummaryHoverThreshold; break; } diff --git a/scripts/load.js b/scripts/load.js index 3027993..0f63133 100644 --- a/scripts/load.js +++ b/scripts/load.js @@ -2,6 +2,7 @@ let optionLoad = chrome.storage.sync.get({ enableUpCard: true, enableWordCloud: true, enableAiSummary: true, + aiSummaryHoverThreshold: 800, minSize: 5 });