summaryrefslogtreecommitdiff
path: root/src/main/resources/META-INF/resources/posts/postList.js
blob: 7bab4f970a2d684b3d3bc804856d12ff969028e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
document.addEventListener('DOMContentLoaded', () => {
  let bookmarkSubmissionPane = document.getElementById('bookmark-submission-pane');
  if (bookmarkSubmissionPane) {
    let bookmarkSubmissionForm = document.getElementById('bookmark-submission-form');
    bookmarkSubmissionPane.addEventListener('opened',() => bookmarkSubmissionForm.focus());
  }

  let lazychatSubmissionPane = document.getElementById('lazychat-submission-pane');
  if (lazychatSubmissionPane) {
    let lazychatSubmissionForm = document.getElementById('lazychat-submission-form');
    lazychatSubmissionPane.addEventListener('opened',() => lazychatSubmissionForm.focus());
  }

  let lazychatMessages = document.getElementsByClassName('lazychat-message');
  for (let message of lazychatMessages) {
    let editorPane = message.getElementsByClassName('lazychat-editor-pane')[0];
    if (editorPane) {
      let form = message.getElementsByTagName('mlk-lazychat-submission-form')[0];
      let editButton = message.getElementsByClassName('lazychat-edit-button')[0];
      editButton.addEventListener('click', () => {
        editorPane.toggle();
        form.focus();
      });
    }
  }
});