Handle cases where hint is not supplied.

This commit is contained in:
Seve 2018-01-28 22:22:23 +01:00 committed by JC Brand
parent 934e5ad421
commit 41bbf653b9

View File

@ -222,7 +222,8 @@
console.log(msg); console.log(msg);
//Spoiler logic //Spoiler logic
if ('spoiler' in attrs) { //The value of the "spoiler" attribute, corresponds to the spoiler's hint.
if ("spoiler" in attrs) {
console.log('Spoiler in attrs \n'); console.log('Spoiler in attrs \n');
let button = document.createElement("button"); let button = document.createElement("button");
let container = document.createElement("div"); let container = document.createElement("div");
@ -231,7 +232,6 @@
let contentHidden = document.createElement("div"); let contentHidden = document.createElement("div");
let messageContent = msg.querySelector(".chat-msg-content"); let messageContent = msg.querySelector(".chat-msg-content");
attrs.spoiler = attrs.spoiler == true ? _('Spoiler') : attrs.spoiler; //Check if attrs.spoiler can be true
hint.appendChild(document.createTextNode(attrs.spoiler)); hint.appendChild(document.createTextNode(attrs.spoiler));
for (var i = 0; i < messageContent.childNodes.length; i++){ for (var i = 0; i < messageContent.childNodes.length; i++){