Skip to content

Commit 8241f10

Browse files
committed
fix: add missing animation in custom rules
1 parent c0d86c7 commit 8241f10

File tree

1 file changed

+26
-7
lines changed

1 file changed

+26
-7
lines changed

src/htmlBuilder.js

+26-7
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,11 @@ const generateStyles = () => `
174174
font-weight: 600;
175175
}
176176
177+
h5 {
178+
color: var(--text-color);
179+
font-weight: 500;
180+
}
181+
177182
.form-label {
178183
font-weight: 500;
179184
color: var(--text-color);
@@ -581,13 +586,28 @@ const generateStyles = () => `
581586
animation: slideIn 0.3s var(--transition-timing) forwards;
582587
}
583588
589+
.custom-rule.removing {
590+
animation: slideOut 0.3s var(--transition-timing) forwards;
591+
}
592+
584593
@keyframes slideIn {
585594
to {
586595
opacity: 1;
587596
transform: translateY(0);
588597
}
589598
}
590599
600+
@keyframes slideOut {
601+
from {
602+
opacity: 1;
603+
transform: translateY(0);
604+
}
605+
to {
606+
opacity: 0;
607+
transform: translateY(-20px);
608+
}
609+
}
610+
591611
/* 暗色模式切换动画 */
592612
body {
593613
transition: background-color 0.3s var(--transition-timing),
@@ -665,7 +685,6 @@ const generateForm = () => `
665685
666686
<div id="advancedOptions">
667687
<div class="form-section">
668-
<div class="form-section-title">Rule Configuration</div>
669688
${generateRuleSetSelection()}
670689
</div>
671690
@@ -680,14 +699,12 @@ const generateForm = () => `
680699
</span>
681700
</div>
682701
<div class="mb-3">
683-
<label for="configType" class="form-label">Config Type:</label>
684702
<select class="form-select" id="configType">
685703
<option value="singbox">SingBox (JSON)</option>
686704
<option value="clash">Clash (YAML)</option>
687705
</select>
688706
</div>
689707
<div class="mb-3">
690-
<label for="configEditor" class="form-label">Custom Base Config:</label>
691708
<textarea class="form-control" id="configEditor" rows="3" placeholder="Paste your custom config here..."></textarea>
692709
</div>
693710
<div class="d-flex gap-2">
@@ -936,7 +953,6 @@ const generateRuleSetSelection = () => `
936953
</div>
937954
938955
<div class="content-container mb-3">
939-
<label for="predefinedRules" class="form-label">Rule Sets:</label>
940956
<select class="form-select" id="predefinedRules" onchange="applyPredefinedRules()">
941957
<option value="custom">Custom</option>
942958
<option value="minimal">Minimal</option>
@@ -955,7 +971,7 @@ const generateRuleSetSelection = () => `
955971
`).join('')}
956972
</div>
957973
<div class="mt-4">
958-
<h4>Custom Rules</h4>
974+
<h5>Custom Rules</h5>
959975
<div class="form-check form-switch mb-3">
960976
<input class="form-check-input" type="checkbox" id="crpinToggle">
961977
<label class="form-check-label" for="crpinToggle">Pin Custom Rules</label>
@@ -1219,8 +1235,11 @@ const customRuleFunctions = `
12191235
function removeCustomRule(button) {
12201236
const ruleDiv = button.closest('.custom-rule');
12211237
if (ruleDiv) {
1222-
ruleDiv.remove();
1223-
customRuleCount--;
1238+
ruleDiv.classList.add('removing');
1239+
ruleDiv.addEventListener('animationend', () => {
1240+
ruleDiv.remove();
1241+
customRuleCount--;
1242+
}, { once: true });
12241243
}
12251244
}
12261245
`;

0 commit comments

Comments
 (0)