about summary refs log tree commit diff
path: root/public
diff options
context:
space:
mode:
authorStarfall <us@starfall.systems>2023-01-17 11:41:05 -0600
committerStarfall <us@starfall.systems>2023-01-17 11:41:05 -0600
commit1f9c919b8769f5b0a3424ef343e0049d33d656e3 (patch)
tree1853486629da4b3b76192fe8756e8d4f6d71adcb /public
parent957c21273ff42d5b2b4a5e16b7869bbb09aeb865 (diff)
parent13227e1dafd308dfe1a3effc3379b766274809b3 (diff)
Merge remote-tracking branch 'glitch/main'
Diffstat (limited to 'public')
-rw-r--r--public/embed.js22
-rw-r--r--public/inert.css3
2 files changed, 15 insertions, 10 deletions
diff --git a/public/embed.js b/public/embed.js
index 5607c24d5..defba403e 100644
--- a/public/embed.js
+++ b/public/embed.js
@@ -1,24 +1,28 @@
 // @ts-check
 
-(function() {
+(function () {
   'use strict';
 
   /**
    * @param {() => void} loaded
    */
-  var ready = function(loaded) {
-    if (['interactive', 'complete'].indexOf(document.readyState) !== -1) {
+  var ready = function (loaded) {
+    if (document.readyState === 'complete') {
       loaded();
     } else {
-      document.addEventListener('DOMContentLoaded', loaded);
+      document.addEventListener('readystatechange', function () {
+        if (document.readyState === 'complete') {
+          loaded();
+        }
+      });
     }
   };
 
-  ready(function() {
+  ready(function () {
     /** @type {Map<number, HTMLIFrameElement>} */
     var iframes = new Map();
 
-    window.addEventListener('message', function(e) {
+    window.addEventListener('message', function (e) {
       var data = e.data || {};
 
       if (typeof data !== 'object' || data.type !== 'setHeight' || !iframes.has(data.id)) {
@@ -34,7 +38,7 @@
       iframe.height = data.height;
     });
 
-    [].forEach.call(document.querySelectorAll('iframe.mastodon-embed'), function(iframe) {
+    [].forEach.call(document.querySelectorAll('iframe.mastodon-embed'), function (iframe) {
       // select unique id for each iframe
       var id = 0, failCount = 0, idBuffer = new Uint32Array(1);
       while (id === 0 || iframes.has(id)) {
@@ -49,10 +53,10 @@
 
       iframes.set(id, iframe);
 
-      iframe.scrolling      = 'no';
+      iframe.scrolling = 'no';
       iframe.style.overflow = 'hidden';
 
-      iframe.onload = function() {
+      iframe.onload = function () {
         iframe.contentWindow.postMessage({
           type: 'setHeight',
           id: id,
diff --git a/public/inert.css b/public/inert.css
index 275fad2e6..54e10616d 100644
--- a/public/inert.css
+++ b/public/inert.css
@@ -3,7 +3,8 @@
   cursor: default;
 }
 
-[inert], [inert] * {
+[inert],
+[inert] * {
   user-select: none;
   -webkit-user-select: none;
   -moz-user-select: none;