Commit 808cc385 authored by Seve's avatar Seve Committed by JC Brand

Refactor to remove jQuery syntax

parent 093fd7a2
...@@ -182,48 +182,48 @@ ...@@ -182,48 +182,48 @@
* Returns: * Returns:
* The DOM element representing the message. * The DOM element representing the message.
*/ */
console.log('These are the attrs and the msg object\n');
console.log(attrs); console.log(attrs);
let msg = this.__super__.renderMessage.apply(this, arguments); let msg = this.__super__.renderMessage.apply(this, arguments);
console.log(msg); console.log(msg);
// const msg_content = $msg[0].querySelector('.chat-msg-content');
//Spoiler logic //Spoiler logic
if ('spoiler' in attrs) { if ('spoiler' in attrs) {
let button = document.createElement("<button>"), console.log('Spoiler in attrs \n');
container = document.createElement("<div>"), let button = document.createElement("button");
content = document.createElement( "<div>" ), let container = document.createElement("div");
hint = document.createElement("<div>"), let content = document.createElement( "div" );
contentHidden = document.createElement("<div>"); let hint = document.createElement("div");
let contentHidden = document.createElement("div");
attrs.spoiler = attrs.spoiler == true ? _('Spoiler') : attrs.spoiler; attrs.spoiler = attrs.spoiler == true ? _('Spoiler') : attrs.spoiler; //Check if attrs.spoiler can be true
hint.text(attrs.spoiler); hint.appendChild(document.createTextNode(attrs.spoiler));
contentHidden.text(text); contentHidden.appendChild(document.createTextNode(msg.message));
contentHidden.addClass("hidden"); contentHidden.classList.add("hidden");
contentHidden.addHyperlinks(); // contentHidden.addHyperlinks();
contentHidden.addEmoticons(_converse.visible_toolbar_buttons.emoticons); // contentHidden.addEmoticons(_converse.visible_toolbar_buttons.emoticons);
container.css("background-color", "Lavender");
container.css("text-align", "center");
container.style.backgroundColor = "Lavender";
container.style.textAlign = "center";
//Spoiler's content //Spoiler's content
content.addClass("spoiler-content"); content.classList.add("spoiler-content");
content.append(hint); content.appendChild(hint);
content.append(contentHidden); content.appendChild(contentHidden);
//Spoiler's button //Spoiler's button
button.addClass("spoiler-button icon-eye"); button.classList.add("spoiler-button");
button.attr("type", "button"); button.classList.add("icon-eye");
button.text(_('Show ')); button.setAttribute("type", "button");
button.css("width", "100%"); button.appendChild(document.createTextNode(_('Show ')));
button.attr("closed", "true"); button.style.width = "100%";
button.setAttribute("closed", "true");
container.append(button);
container.append(content); container.appendChild(button);
container.appendChild(content);
console.log('And this is the container:\n');
console.log(container);
msg.append(container); msg.append(container);
} }
...@@ -231,7 +231,7 @@ ...@@ -231,7 +231,7 @@
} }
}, },
'ChatBox': { 'ChatBox': {
'getMessageAttributes': function () { 'getMessageAttributes': function (message, delay, original_stanza) {
let messageAttributes = this.__super__.getMessageAttributes.apply(this, arguments); let messageAttributes = this.__super__.getMessageAttributes.apply(this, arguments);
console.log(arguments); console.log(arguments);
//Check if message is spoiler //Check if message is spoiler
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment