Scroll in chat

It would be great if there was a feature to scroll in chat, or press Page up to scroll.

The PageUp/PageDown buttons are actually already programmed to do exactly that, but looking into it closer it seems there’s a bug which stops them from working. I’ll post the working code in a bit if you want to change the chat resource yourself.

2 Likes

UPDATE:
This fix has now been implemented in the fx-server-data. I recommend that you download the newest version from github here, instead of trying the patch listed below.

Fix (Not recommended, update your resources using the link above instead!)

Alright here’s my solution.

  1. Go to resources/[system]/chat/html/App.js
  2. To be safe, make a backup/copy of this file and store it somewhere else.
  3. In the App.js file go to line 103 (keyDown(e)…)
  4. Change the keyDown function (line 103 - 114) from this:
    keyDown(e) {
      if (e.which === 38 || e.which === 40) {
        e.preventDefault();
        this.moveOldMessageIndex(e.which === 38);
      } else if (e.which == 33) {
        const buf = $(this.$refs.messages);
        buf.scrollTop(buf.scrollTop() - 50);
      } else if (e.which == 34) {
        const buf = $(this.$refs.messages);
        buf.scrollTop(buf.scrollTop() + 50);
      }
    },
  1. To this:
    keyDown(e) {
      if (e.which === 38 || e.which === 40) {
        e.preventDefault();
        this.moveOldMessageIndex(e.which === 38);
      } else if (e.which === 33) {
        var buf = document.getElementsByClassName('chat-messages')[0];
        buf.scrollTop = buf.scrollTop - 100;
      } else if (e.which === 34) {
        var buf = document.getElementsByClassName('chat-messages')[0];
        buf.scrollTop = buf.scrollTop + 100;
      }
    },
  1. Save the file.
  2. Delete your server cache! (Otherwise it will not work properly!!)
  3. Start your server.

Now if you have the chat open, press PageUp or PageDown and the chat will scroll up/down.

1 Like