We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 44f1d22 + f09e760 commit 578ef87Copy full SHA for 578ef87
1 file changed
app/assets/javascripts/post_histories.js
@@ -1,9 +1,14 @@
1
-$(() => {
+document.addEventListener('DOMContentLoaded', () => {
2
const openRelevantEditOnly = () => {
3
- $("details.history-event").prop('open', false);
4
- $(location.hash).prop('open', true);
5
- }
+ const [[, historyId]] = location.hash.split(':~:');
6
7
- window.addEventListener("hashchange", openRelevantEditOnly);
+ document.querySelectorAll('details.history-event').forEach((el) => {
+ if (el instanceof HTMLDetailsElement) {
+ el.open = el.id === historyId;
8
+ }
9
+ });
10
+ };
11
+
12
+ window.addEventListener('hashchange', openRelevantEditOnly);
13
openRelevantEditOnly();
14
});
0 commit comments