From b1f5be22e6451d7fefe7b850c20d7f6b52073aa7 Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Sun, 14 Jun 2020 07:24:01 +0200 Subject: Make ESLint happy. Change-Id: I3a8cd7a72467e5f1cdef1d3383f8c5b9f6bb27e7 --- .../resources/bookmarks/MlkBookmarkSubmissionForm.js | 3 ++- .../resources/lazychat/MlkLazychatSubmissionForm.js | 3 ++- src/main/resources/META-INF/resources/posts/postList.js | 16 ++++++++-------- 3 files changed, 12 insertions(+), 10 deletions(-) (limited to 'src/main/resources/META-INF') 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(); -- cgit v1.2.3