Skip to content

Commit

Permalink
Add hover time threshold option (#143)
Browse files Browse the repository at this point in the history
  • Loading branch information
gaogaotiantian authored Apr 2, 2024
1 parent 41928a3 commit 2a83896
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
14 changes: 9 additions & 5 deletions options/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,20 @@
<label for="enable-ai-summary">开启up主卡片:</label>
<input type="checkbox" id="enable-up-card">
</div>
<div class="item">
<label for="enable-word-cloud">使用词云:</label>
<input type="checkbox" id="enable-word-cloud">
</div>
<div class="item">
<label for="enable-ai-summary">开启视频AI总结:</label>
<input type="checkbox" id="enable-ai-summary">
</div>
<div class="item">
<label for="enable-ai-summary">视频AI总结悬停触发时长(毫秒):</label>
<input type="number" id="ai-summary-hover-threshold">
</div>
<div class="item">
<label for="enable-word-cloud">使用词云:</label>
<input type="checkbox" id="enable-word-cloud">
</div>
<div class="number-selector item">
<label for="min-number">最小字号:</label>
<label for="min-number">词云最小字号:</label>
<button id="decrement" class="btn btn-change">-</button>
<input type="number" id="min-number" value="5" min="5" max="50">
<button id="increment" class="btn btn-change">+</button>
Expand Down
4 changes: 4 additions & 0 deletions options/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand All @@ -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;
});
Expand Down
2 changes: 1 addition & 1 deletion scripts/biliscope.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function showProfileDebounce(event) {
debounceTime = 300;
break;
case "video":
debounceTime = 800;
debounceTime = biliScopeOptions.aiSummaryHoverThreshold;
break;
}

Expand Down
1 change: 1 addition & 0 deletions scripts/load.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ let optionLoad = chrome.storage.sync.get({
enableUpCard: true,
enableWordCloud: true,
enableAiSummary: true,
aiSummaryHoverThreshold: 800,
minSize: 5
});

Expand Down

0 comments on commit 2a83896

Please sign in to comment.