Skip to content

Commit

Permalink
Limit roomintro size
Browse files Browse the repository at this point in the history
Roomintros are now limited to 200 vertical pixels, with a
scrollbar for any roomintro that doesn't fit.

An exception is given to official rooms under modchat, namely the
Help room. It is expected that other official rooms won't abuse
this exception, but we can deal with that separately if it becomes
an issue.
  • Loading branch information
Zarel committed Apr 17, 2015
1 parent 461303e commit 4a3ae1c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
4 changes: 2 additions & 2 deletions commands.js
Expand Up @@ -353,7 +353,7 @@ var commands = exports.commands = {
if (!target) {
if (!this.canBroadcast()) return;
if (!room.introMessage) return this.sendReply("This room does not have an introduction set.");
this.sendReplyBox(room.introMessage);
this.sendReply('|raw|<div class="infobox infobox-limited">' + room.introMessage + '</div>');
if (!this.broadcasting && user.can('declare', null, room)) {
this.sendReply('Source:');
this.sendReplyBox('<code>' + Tools.escapeHTML(room.introMessage) + '</code>');
Expand All @@ -371,7 +371,7 @@ var commands = exports.commands = {
if (!target.trim()) target = '';
room.introMessage = target;
this.sendReply("(The room introduction has been changed to:)");
this.sendReplyBox(target);
this.sendReply('|raw|<div class="infobox infobox-limited">' + target + '</div>');

this.privateModCommand("(" + user.name + " changed the roomintro.)");

Expand Down
18 changes: 12 additions & 6 deletions rooms.js
Expand Up @@ -1475,15 +1475,21 @@ var ChatRoom = (function () {
this.send(update);
};
ChatRoom.prototype.getIntroMessage = function () {
var html = this.introMessage || '';
if (this.modchat && this.introMessage) {
return '\n|raw|<div class="infobox"><div' + (!this.isOfficial ? ' class="infobox-limited"' : '') + '>' + this.introMessage + '</div>' +
'<br />' +
'<div class="broadcast-red">' +
'Must be rank ' + this.modchat + ' or higher to talk right now.' +
'</div></div>';
}

if (this.modchat) {
if (html) html += '<br /><br />';
html += '<div class="broadcast-red">';
html += 'Must be rank ' + this.modchat + ' or higher to talk right now.';
html += '</div>';
return '\n|raw|<div class="infobox"><div class="broadcast-red">' +
'Must be rank ' + this.modchat + ' or higher to talk right now.' +
'</div></div>';
}

if (html) return '\n|raw|<div class="infobox">' + html + '</div>';
if (this.introMessage) return '\n|raw|<div class="infobox infobox-limited">' + this.introMessage + '</div>';

return '';
};
Expand Down

0 comments on commit 4a3ae1c

Please sign in to comment.