Files
steam-chat/public/app/dom.js

69 lines
3.7 KiB
JavaScript

export function getAppDomRefs(root = document) {
const pickerPanel = root.getElementById('pickerPanel');
return {
targetIdInput: root.getElementById('targetId'),
historyLimitInput: root.getElementById('historyLimit'),
reloadHistoryButton: root.getElementById('reloadHistory'),
openConversationButton: root.getElementById('openConversation'),
reloadConversationsButton: root.getElementById('reloadConversations'),
conversationListEl: root.getElementById('conversationList'),
friendsListEl: root.getElementById('friendsList'),
groupsListEl: root.getElementById('groupsList'),
reloadFriendsButton: root.getElementById('reloadFriends'),
reloadGroupsButton: root.getElementById('reloadGroups'),
sidebarTabs: root.querySelectorAll('.sidebar-tab'),
sidebarTabPanels: {
conversations: root.getElementById('sidebarTabConversations'),
friends: root.getElementById('sidebarTabFriends'),
groups: root.getElementById('sidebarTabGroups'),
},
chatTitleEl: root.getElementById('chatTitle'),
chatSubtitleEl: root.getElementById('chatSubtitle'),
feedbackStatusEl: root.getElementById('feedbackStatus'),
connectionStatusEl: root.getElementById('connectionStatus'),
connectionStatusLabelEl: root.getElementById('connectionStatusLabel'),
messagesEl: root.getElementById('messages'),
dropOverlay: root.getElementById('dropOverlay'),
sidebarEl: root.querySelector('.sidebar'),
sidebarBackdrop: root.getElementById('sidebarBackdrop'),
mobileSidebarToggleButton: root.getElementById('mobileSidebarToggle'),
closeSidebarButton: root.getElementById('closeSidebar'),
imageLightbox: root.getElementById('imageLightbox'),
imageLightboxViewport: root.getElementById('imageLightboxViewport'),
imageLightboxImage: root.getElementById('imageLightboxImage'),
imageLightboxCaption: root.getElementById('imageLightboxCaption'),
closeImageLightboxButton: root.getElementById('closeImageLightbox'),
imageZoomOutButton: root.getElementById('imageZoomOut'),
imageZoomResetButton: root.getElementById('imageZoomReset'),
imageZoomInButton: root.getElementById('imageZoomIn'),
messageInput: root.getElementById('messageInput'),
emoticonSuggestions: root.getElementById('emoticonSuggestions'),
emoticonPreviewImage: root.getElementById('emoticonPreviewImage'),
emoticonPreviewLabel: root.getElementById('emoticonPreviewLabel'),
sendMessageButton: root.getElementById('sendMessage'),
attachmentButton: root.getElementById('attachmentButton'),
attachmentMenu: root.getElementById('attachmentMenu'),
chooseImageButton: root.getElementById('chooseImageButton'),
chooseUrlButton: root.getElementById('chooseUrlButton'),
imageFileInput: root.getElementById('imageFile'),
urlPanel: root.getElementById('urlPanel'),
imageUrlInput: root.getElementById('imageUrl'),
confirmImageUrlButton: root.getElementById('confirmImageUrl'),
cancelImageUrlButton: root.getElementById('cancelImageUrl'),
attachmentPreview: root.getElementById('attachmentPreview'),
attachmentPreviewImage: root.getElementById('attachmentPreviewImage'),
attachmentPreviewTitle: root.getElementById('attachmentPreviewTitle'),
attachmentPreviewSubtitle: root.getElementById('attachmentPreviewSubtitle'),
clearAttachmentButton: root.getElementById('clearAttachment'),
uploadQueue: root.getElementById('uploadQueue'),
uploadQueueList: root.getElementById('uploadQueueList'),
pickerButton: root.getElementById('pickerButton'),
pickerPanel,
pickerSearch: root.getElementById('pickerSearch'),
pickerGrid: root.getElementById('pickerGrid'),
pickerEmpty: root.getElementById('pickerEmpty'),
pickerTabs: pickerPanel ? pickerPanel.querySelectorAll('.picker-tab') : [],
};
}