From 434be97f8a63631e90de7b69a4909bb279368eea Mon Sep 17 00:00:00 2001 From: Guangcong Luo Date: Sun, 28 Jun 2015 00:49:14 -0400 Subject: [PATCH] Support |popup| options Specifically, |wide| makes a wide popup, suitable for modlog results. And |modal| makes a modal popup, currently only used for locks and bans, to make sure they're not accidentally dismissed. --- js/client.js | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/js/client.js b/js/client.js index 8a73f2aca..297a941b0 100644 --- a/js/client.js +++ b/js/client.js @@ -989,7 +989,22 @@ break; case 'popup': - this.addPopupMessage(data.substr(7).replace(/\|\|/g, '\n')); + var maxWidth = undefined; + var type = 'semimodal'; + data = data.substr(7); + if (data.substr(0, 6) === '|wide|') { + data = data.substr(6); + maxWidth = 960; + } + if (data.substr(0, 7) === '|modal|') { + data = data.substr(7); + type = 'modal'; + } + app.addPopup(Popup, { + type: type, + message: data.replace(/\|\|/g, '\n'), + maxWidth: maxWidth + }); if (this.rooms['']) this.rooms[''].resetPending(); break; @@ -2038,8 +2053,8 @@ } }, initialize: function(data) { - this.type = 'semimodal'; - this.$el.html('

'+Tools.parseMessage(data.message)+'

').css('max-width', 480); + if (!this.type) this.type = 'semimodal'; + this.$el.html('

'+(data.htmlMessage||Tools.parseMessage(data.message))+'

').css('max-width', data.maxWidth || 480); }, dispatchClickButton: function(e) {