Skip to content

Commit

Permalink
Add compatibility for v12
Browse files Browse the repository at this point in the history
  • Loading branch information
DFreds committed Jun 13, 2024
1 parent f8d7384 commit 823d1f7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions module.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
"flags": {},
"version": "1.0.0",
"compatibility": {
"minimum": 11,
"verified": "11.304",
"maximum": 11
"minimum": 12,
"verified": "12.327",
"maximum": 12
},
"scripts": [],
"esmodules": ["./scripts/main.js"],
Expand Down
14 changes: 7 additions & 7 deletions scripts/chat-pins-log.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default class ChatPinsLog extends Application {
left: 1300,
minimizable: true,
resizable: true,
scrollY: ['#chat-pins-log'],
scrollY: ['#chat-log'],
});
}

Expand Down Expand Up @@ -51,7 +51,7 @@ export default class ChatPinsLog extends Application {
async _render(force, options) {
if (this.rendered) return; // Never re-render the Chat Log itself, only it's contents
await super._render(force, options);
this._scrollBottom();
return this._scrollBottom();
}

/** @inheritdoc */
Expand All @@ -63,7 +63,7 @@ export default class ChatPinsLog extends Application {

async _renderBatch(html, size) {
const messages = this.collection;
const log = html.find('#chat-pins-log');
const log = html.find('#chat-log');

// Get the index of the last rendered message
let lastIdx = messages.findIndex((m) => m.id === this._lastId);
Expand Down Expand Up @@ -139,7 +139,7 @@ export default class ChatPinsLog extends Application {

// Render the message to the log
const html = await message.getHTML();
const log = this.element.find('#chat-pins-log');
const log = this.element.find('#chat-log');

// Append the message after some other one
const existing = before
Expand All @@ -155,7 +155,7 @@ export default class ChatPinsLog extends Application {

_scrollBottom() {
const el = this.element;
const log = el.length ? el[0].querySelector('#chat-pins-log') : null;
const log = el.length ? el[0].querySelector('#chat-log') : null;
if (log) log.scrollTop = log.scrollHeight;
}

Expand Down Expand Up @@ -187,7 +187,7 @@ export default class ChatPinsLog extends Application {
}

_updateTimestamps() {
const messages = this.element.find('#chat-pins-log .message');
const messages = this.element.find('#chat-log .message');
for (let li of messages) {
const message = game.messages.get(li.dataset['messageId']);
if (!message?.timestamp) return;
Expand All @@ -199,7 +199,7 @@ export default class ChatPinsLog extends Application {
/** @inheritdoc */
activateListeners(html) {
// Load new messages on scroll
html.find('#chat-pins-log').scroll(this._onScrollLog.bind(this));
html.find('#chat-log').scroll(this._onScrollLog.bind(this));

// Single Message Delete
html.on('click', 'a.message-delete', this._onDeleteMessage.bind(this));
Expand Down
2 changes: 1 addition & 1 deletion templates/chat-pins-app.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<section class="directory flexcol" id="chat-pins">
<ol id="chat-pins-log">
<ol id="chat-log">
</ol>
</section>

0 comments on commit 823d1f7

Please sign in to comment.