Skip to content

Commit

Permalink
feat: add event listeners for rule checkboxes to update predefined ru…
Browse files Browse the repository at this point in the history
…les selection
  • Loading branch information
7Sageer committed Dec 7, 2024
1 parent 9209a20 commit 1fcddd5
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@

## 📝 最近更新

### 2024-11-30
- 添加对 Shadowsocks 旧式 URL 的支持
### 2024-12-07
- 确保在手动选择规则时,预定义规则集的选择框也会自动更新为 "custom"
[查看完整更新日志](/docs/update-log.md)

## 🔧 项目结构
Expand Down
4 changes: 4 additions & 0 deletions docs/update-log.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# 更新日志

## 2024-12-07

- 确保在手动选择规则时,预定义规则集的选择框也会自动更新为 "custom"

## 2024-11-30

- 添加对 Shadowsocks 旧式 URL 的支持
Expand Down
13 changes: 13 additions & 0 deletions src/htmlBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,19 @@ const applyPredefinedRulesFunction = () => `
}
});
}
// Add event listeners to checkboxes
document.addEventListener('DOMContentLoaded', function() {
const checkboxes = document.querySelectorAll('.rule-checkbox');
checkboxes.forEach(checkbox => {
checkbox.addEventListener('change', function() {
const predefinedSelect = document.getElementById('predefinedRules');
if (predefinedSelect.value !== 'custom') {
predefinedSelect.value = 'custom';
}
});
});
});
`;

const tooltipFunction = () => `
Expand Down

0 comments on commit 1fcddd5

Please sign in to comment.