"),
+ contentHidden = document.createElement("
");
+
+ attrs.spoiler = attrs.spoiler == true ? _('Spoiler') : attrs.spoiler;
+ hint.text(attrs.spoiler);
+
+ contentHidden.text(text);
+ contentHidden.addClass("hidden");
+ contentHidden.addHyperlinks();
+ contentHidden.addEmoticons(_converse.visible_toolbar_buttons.emoticons);
+
+
+ container.css("background-color", "Lavender");
+ container.css("text-align", "center");
+
+
+ //Spoiler's content
+ content.addClass("spoiler-content");
+ content.append(hint);
+ content.append(contentHidden);
+
+ //Spoiler's button
+ button.addClass("spoiler-button icon-eye");
+ button.attr("type", "button");
+ button.text(_('Show '));
+ button.css("width", "100%");
+ button.attr("closed", "true");
+
+ container.append(button);
+ container.append(content);
+
+
+ msg_content.append(container);
+
+ } else {
+ return this.__super__.renderMessage.apply(this, arguments);
+ }
+
+ return $msg;
+ }
+ },
+ 'ChatBox': {
+ 'getMessageAttributes': function () {
+ let messageAttributes = this.__super__.getMessageAttributes.apply(this, arguments);
+ console.log(arguments);
+ //Check if message is spoiler
+ let spoiler = null, i = 0, found = false;
+
+ while (i < message.childNodes.length && !found) {
+ if (message.childNodes[i].nodeName == "spoiler") {
+ spoiler = message.childNodes[i];
+ found = true;
+ }
+
+ i++;
+ }
+ if (spoiler) {
+ messageAttributes['spoiler'] = spoiler.textContent.length > 0 ? spoiler.textContent : _('Spoiler');
+ }
+
+ return messageAttributes;
}
}