Skip to content

Commit 1e7e4c5

Browse files
committed
feat: summary section route
1 parent 4f04ef8 commit 1e7e4c5

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

assets/script/index.js

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,4 +162,49 @@ summary.querySelector('form').summary.oninput = function() {
162162

163163
summary.querySelector('form > div > label > small').innerHTML = this.value.length +' / '+ this.maxLength + '<sub>50 - '+ (50 - this.maxLength) +'</sub>';
164164

165+
};
166+
summary.querySelector('form').onsubmit = function(e) { e.preventDefault();
167+
168+
if (e.submitter.classList.contains('finish')) {
169+
170+
significantChange.querySelector('form').significantChange.parentNode.click();
171+
significantChange.querySelector('form').significantChange.checked = false;
172+
173+
currentTarget = significantChange;
174+
significantChange.scrollIntoView({
175+
behavior: 'smooth'
176+
});
177+
178+
} else {
179+
180+
body.querySelector('form').body.parentNode.click();
181+
182+
currentTarget = body;
183+
body.scrollIntoView({
184+
behavior: 'smooth'
185+
});
186+
187+
}
188+
189+
};
190+
summary.querySelector('form').onreset = function() {
191+
192+
if (type.querySelector('form').type.value == 'revert') {
193+
194+
currentTarget = type;
195+
type.scrollIntoView({
196+
behavior: 'smooth'
197+
});
198+
199+
} else {
200+
201+
scope.querySelector('form').scope.parentNode.click();
202+
203+
currentTarget = scope;
204+
scope.scrollIntoView({
205+
behavior: 'smooth'
206+
});
207+
208+
}
209+
165210
};

0 commit comments

Comments
 (0)