From 79b414d2a1e269e9380e72668239607be9100358 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Wed, 28 Oct 2020 15:16:13 -0400 Subject: [PATCH] FIX: The attribute is `discourse-url` not `data-discourse-url` --- public/javascripts/embed-topics.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/public/javascripts/embed-topics.js b/public/javascripts/embed-topics.js index 3ccbf8d6ea3..4306da31909 100644 --- a/public/javascripts/embed-topics.js +++ b/public/javascripts/embed-topics.js @@ -1,4 +1,4 @@ -(function() { +(function () { function postMessageReceived(e) { if (!e) { return; @@ -13,21 +13,17 @@ } window.addEventListener("message", postMessageReceived, false); - document.addEventListener("DOMContentLoaded", function(event) { + document.addEventListener("DOMContentLoaded", function (event) { var lists = document.querySelectorAll("d-topics-list"); for (var i = 0; i < lists.length; i++) { var list = lists[i]; var url = list.getAttribute("discourse-url"); if (!url || url.length === 0) { - console.error("Error, `data-discourse-url` was not found"); + console.error("Error, `discourse-url` was not found"); continue; } - var frameId = - "de-" + - Math.random() - .toString(36) - .substr(2, 9); + var frameId = "de-" + Math.random().toString(36).substr(2, 9); var params = ["discourse_embed_id=" + frameId]; list.removeAttribute("discourse-url");