-- Leo's gemini proxy

-- Connecting to git.thebackupbox.net:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini

repo: janusweb
action: commit
revision:
path_from:
revision_from: ad4ad8d5282b2e3d467edafabb530132d9c5525c:
path_to:
revision_to:

git.thebackupbox.net

janusweb

git://git.thebackupbox.net/janusweb

commit ad4ad8d5282b2e3d467edafabb530132d9c5525c
Author: James Baicoianu <james_github@baicoianu.com>
Date:   Thu May 9 12:05:55 2019 -0700

    Moved script loading into its own function

diff --git a/scripts/room.js b/scripts/room.js

index c6906541f8fc40477f252068b6729839265892cc..

index ..84e90624c5f227b077c9a957cdf69651aee41217 100644

--- a/scripts/room.js
+++ b/scripts/room.js
@@ -740,28 +740,7 @@ elation.require([

         if (assets.scripts) {
           this.pendingScripts = 0;
-          assets.scripts.forEach(elation.bind(this, function(s) {
-            var script = elation.engine.assets.find('script', s.src);
-            this.pendingScripts++;
-
-            if (script._loaded) {
-              // If the script is already part of the document, remove it and readd it so it's reevaluated
-              if (script.parentNode) {
-                script.parentNode.removeChild(script);
-              }
-
-              var oldscript = script;
-              script = document.createElement('script');
-              script.src = oldscript.src;
-              document.head.appendChild(script);
-            }
-            this.roomscripts.push(script);
-            elation.events.add(script, 'asset_load', elation.bind(this, function() {
-              script._loaded = true;
-              document.head.appendChild(script);
-              script.onload = elation.bind(this, this.doScriptOnload);
-            }));
-          }));
+          this.loadScripts(assets.scripts);
         }
       }
       this.applyingEdits = false;
@@ -771,6 +750,30 @@ elation.require([
       //}
       //this.showDebug();
     }
+    this.loadScripts = function(scripts) {
+      scripts.forEach(elation.bind(this, function(s) {
+        var script = elation.engine.assets.find('script', s.src);
+        this.pendingScripts++;
+
+        if (script._loaded) {
+          // If the script is already part of the document, remove it and readd it so it's reevaluated
+          if (script.parentNode) {
+            script.parentNode.removeChild(script);
+          }
+
+          var oldscript = script;
+          script = document.createElement('script');
+          script.src = oldscript.src;
+          document.head.appendChild(script);
+        }
+        this.roomscripts.push(script);
+        elation.events.add(script, 'asset_load', elation.bind(this, function() {
+          script._loaded = true;
+          document.head.appendChild(script);
+          script.onload = elation.bind(this, this.doScriptOnload);
+        }));
+      }));
+    }
     this.getTranslator = function(url) {
       var keys = Object.keys(this.translators);
       for (var i = 0; i < keys.length; i++) {

-----END OF PAGE-----

-- Response ended

-- Page fetched on Sun Jun 2 16:59:34 2024