diff options
Diffstat (limited to 'src/main/resources/META-INF')
3 files changed, 12 insertions, 10 deletions
diff --git a/src/main/resources/META-INF/resources/bookmarks/MlkBookmarkSubmissionForm.js b/src/main/resources/META-INF/resources/bookmarks/MlkBookmarkSubmissionForm.js index 3b93305..7c71518 100644 --- a/src/main/resources/META-INF/resources/bookmarks/MlkBookmarkSubmissionForm.js +++ b/src/main/resources/META-INF/resources/bookmarks/MlkBookmarkSubmissionForm.js @@ -74,9 +74,10 @@ export class MlkBookmarkSubmissionForm extends HTMLElement { get editedId() /*:number | null*/ { let attr = this.getAttribute("edited-id"); - if (attr === undefined || attr === null) { + if (attr === null) { return null; } + return parseInt(attr, 10); } diff --git a/src/main/resources/META-INF/resources/lazychat/MlkLazychatSubmissionForm.js b/src/main/resources/META-INF/resources/lazychat/MlkLazychatSubmissionForm.js index 4c4aca8..7bd6d4d 100644 --- a/src/main/resources/META-INF/resources/lazychat/MlkLazychatSubmissionForm.js +++ b/src/main/resources/META-INF/resources/lazychat/MlkLazychatSubmissionForm.js @@ -58,9 +58,10 @@ export class MlkLazychatSubmissionForm extends HTMLElement { get editedId() /*:number | null*/ { let attr = this.getAttribute("edited-id"); - if (attr === undefined || attr === null) { + if (attr === null) { return null; } + return parseInt(attr, 10); } diff --git a/src/main/resources/META-INF/resources/posts/postList.js b/src/main/resources/META-INF/resources/posts/postList.js index 8ffb7ca..1b6f9f5 100644 --- a/src/main/resources/META-INF/resources/posts/postList.js +++ b/src/main/resources/META-INF/resources/posts/postList.js @@ -2,21 +2,21 @@ document.addEventListener('DOMContentLoaded', () => { let bookmarkSubmissionPane = document.getElementById('bookmark-submission-pane'); if (bookmarkSubmissionPane) { let bookmarkSubmissionForm = document.getElementById('bookmark-submission-form'); - bookmarkSubmissionPane.addEventListener('opened',() => bookmarkSubmissionForm.focus()); + 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()); + lazychatSubmissionPane.addEventListener('opened', () => lazychatSubmissionForm.focus()); } let lazychatMessages = document.getElementsByClassName('lazychat-message'); for (let message of lazychatMessages) { - let editorPane = message.getElementsByClassName('lazychat-editor-pane')[0]; + let [editorPane] = message.getElementsByClassName('lazychat-editor-pane'); if (editorPane) { - let form = message.getElementsByTagName('mlk-lazychat-submission-form')[0]; - let editButton = message.getElementsByClassName('lazychat-edit-button')[0]; + let [form] = message.getElementsByTagName('mlk-lazychat-submission-form'); + let [editButton] = message.getElementsByClassName('lazychat-edit-button'); editButton.addEventListener('click', () => { editorPane.toggle(); form.focus(); @@ -26,10 +26,10 @@ document.addEventListener('DOMContentLoaded', () => { let bookmarks = document.getElementsByClassName('bookmark'); for (let bookmark of bookmarks) { - let editorPane = bookmark.getElementsByClassName('editor-pane')[0]; + let [editorPane] = bookmark.getElementsByClassName('editor-pane'); if (editorPane) { - let form = bookmark.getElementsByTagName('mlk-bookmark-submission-form')[0]; - let editButton = bookmark.getElementsByClassName('bookmark-edit-button')[0]; + let [form] = bookmark.getElementsByTagName('mlk-bookmark-submission-form'); + let [editButton] = bookmark.getElementsByClassName('bookmark-edit-button'); editButton.addEventListener('click', () => { editorPane.toggle(); form.focus(); |