PageSourceSearch

https://boards.core77.com/javascripts/embed-topics.js

js core77.com collected 2026-09-24 08:28:24 UTC 1,340 bytes, 43 lines download raw bytes

1(function () {
2  function postMessageReceived(e) {
3    if (!e) {
4      return;
5    }
6
7    if (e.data && e.data.type === "discourse-resize" && e.data.embedId) {
8      var elem = document.getElementById(e.data.embedId);
9      if (elem) {
10        elem.height = e.data.height + "px";
11      }
12    }
13  }
14  window.addEventListener("message", postMessageReceived, false);
15
16  document.addEventListener("DOMContentLoaded", function (event) {
17    var lists = document.querySelectorAll("d-topics-list");
18
19    for (var i = 0; i < lists.length; i++) {
20      var list = lists[i];
21      var url = list.getAttribute("discourse-url");
22      if (!url || url.length === 0) {
23        console.error("Error, `discourse-url` was not found");
24        continue;
25      }
26      var frameId = "de-" + Math.random().toString(36).substr(2, 9);
27      var params = ["discourse_embed_id=" + frameId];
28      list.removeAttribute("discourse-url");
29
30      for (var j = 0; j < list.attributes.length; j++) {
31        var attr = list.attributes[j];
32        params.push(attr.name.replace("-", "_") + "=" + attr.value);
33      }
34
35      var iframe = document.createElement("iframe");
36      iframe.src = url + "/embed/topics?" + params.join("&");
37      iframe.id = frameId;
38      iframe.frameBorder = 0;
39      iframe.scrolling = "no";
40      list.appendChild(iframe);
41    }
42  });
43})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.