mirror of
https://github.com/smogon/pokemon-showdown.git
synced 2026-09-07 16:55:29 -05:00
Room FAQs: Fix source code and repeats display
This commit is contained in:
@@ -138,7 +138,8 @@ export const pages: Chat.PageTable = {
|
||||
for (const repeat of room.settings.repeats) {
|
||||
const minutes = repeat.interval / (repeat.isByMessages ? 1 : 60 * 1000);
|
||||
const repeatText = repeat.faq ? roomFaqs[room.roomid][repeat.id].source : repeat.phrase;
|
||||
const phrase = repeat.isHTML ? repeat.phrase : Chat.formatText(repeatText, true);
|
||||
const phrase = repeat.faq ? visualizeFaq(roomFaqs[room.roomid][repeat.id]) :
|
||||
repeat.isHTML ? repeat.phrase : Chat.formatText(repeatText, true);
|
||||
html += `<tr><td>${repeat.id}</td><td>${phrase}</td><td>${Chat.getReadmoreCodeBlock(repeatText)}</td><td>${repeat.isByMessages ? this.tr`every ${minutes} chat message(s)` : this.tr`every ${minutes} minute(s)`}</td>`;
|
||||
html += `<td><button class="button" name="send" value="/msgroom ${room.roomid},/removerepeat ${repeat.id}">${this.tr`Remove`}</button></td>`;
|
||||
}
|
||||
|
||||
@@ -164,10 +164,11 @@ export const commands: Chat.ChatCommands = {
|
||||
topic = getAlias(room.roomid, topic) || topic;
|
||||
|
||||
if (!this.runBroadcast()) return;
|
||||
this.sendReplyBox(visualizeFaq(roomFaqs[room.roomid][topic]));
|
||||
const rfaq = roomFaqs[room.roomid][topic];
|
||||
this.sendReplyBox(visualizeFaq(rfaq));
|
||||
if (!this.broadcasting && user.can('ban', null, room, 'rfaq')) {
|
||||
const code = Utils.escapeHTML(roomFaqs[room.roomid][topic].source).replace(/\n/g, '<br />');
|
||||
this.sendReplyBox(`<details><summary>Source</summary><code style="white-space: pre-wrap; display: table; tab-size: 3">/addfaq ${topic}, ${code}</code></details>`);
|
||||
const code = Utils.escapeHTML(rfaq.source).replace(/\n/g, '<br />');
|
||||
this.sendReplyBox(`<details><summary>Source</summary><code style="white-space: pre-wrap; display: table; tab-size: 3">/add${rfaq.html ? 'html' : ''}faq ${topic}, ${code}</code></details>`);
|
||||
}
|
||||
},
|
||||
roomfaqhelp: [
|
||||
|
||||
Reference in New Issue
Block a user