TheFabulousPika / steam-chatlog-to-text

A chrome extension that converts Steam webchat log to text format
2 stars 0 forks source link

Multiple Groups Chats open critical failure #44

Closed TheFabulousPika closed 4 years ago

TheFabulousPika commented 4 years ago

When Multiple Groups Chats are open chatHistory node sometimes does not appear under DropTarget chatHistoryAndMembers, causing the code the look for chatHistory using the wrong index number.

(67):                   <div class="DropTarget chatHistoryAndMembers" style="display: none;">
(73):                           <div class="ChatHistoryContainer">
(78):                             <div class="chatHistoryScroll" tabindex="0">
(79):                               <div class="chatHistory">
(1007):                   <div class="DropTarget chatHistoryAndMembers" style="display: none;">
(1308):                   <div class="DropTarget chatHistoryAndMembers">
(1314):                           <div class="ChatHistoryContainer">
(1319):                             <div class="chatHistoryScroll" tabindex="0">
(1320):                               <div class="chatHistory">

current code L24

var chatHistory = document.getElementsByClassName("chatHistory")[activeTabIndex].childNodes;

new code. look for the active DropTarget chatHistoryAndMembers, find the chatHistory under it


    var activeChatBody = document.getElementsByClassName("DropTarget chatWindow MultiUserChat")[activeTabIndex];
    var chatHistory = activeChatBody.getElementsByClassName("chatHistory")[0].childNodes;