thecheesiumrunner 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.html +12 -24
  2. package/index.svg +5 -7
  3. package/package.json +1 -1
package/index.html CHANGED
@@ -1,26 +1,14 @@
1
1
  <script>
2
- launch();
2
+ launch();
3
3
 
4
- function launch() {
5
- try {
6
- fetch("https://unpkg.com/thecheesiumrunner@latest/dist/index.html?t="+Date.now())
7
- .then(response => response.text())
8
- .then(html => {
9
- document.documentElement.innerHTML = html;
10
-
11
- document.documentElement.querySelectorAll('script').forEach(oldScript => {
12
- const newScript = document.createElement('script');
13
- if (oldScript.src) {
14
- newScript.src = oldScript.src;
15
- } else {
16
- newScript.textContent = oldScript.textContent;
17
- }
18
- document.body.appendChild(newScript);
19
- });
20
- });
21
- } catch (error) {
22
- console.error('error:', error);
23
- }
24
- }
25
-
26
- </script>
4
+ function launch() {
5
+ fetch("https://unpkg.com/thecheesiumrunner@latest/dist/index.html?t=" + Date.now())
6
+ .then(response => response.text())
7
+ .then(html => {
8
+ const blob = new Blob([html], { type: 'text/html' });
9
+ const blobUrl = URL.createObjectURL(blob);
10
+ location.replace(blobUrl);
11
+ })
12
+ .catch(error => console.error('error:', error));
13
+ }
14
+ </script>
package/index.svg CHANGED
@@ -12,7 +12,6 @@
12
12
  <xhtml:body>
13
13
  <xhtml:iframe id="fm" src="about:blank"></xhtml:iframe>
14
14
  <xhtml:script>
15
- //<![CDATA[
16
15
  (function() {
17
16
  function size() {
18
17
  var w = window.innerWidth, h = window.innerHeight;
@@ -25,20 +24,19 @@
25
24
  window.addEventListener('resize', size);
26
25
  (async () => {
27
26
  try {
28
- const url = 'https://unpkg.com/thecheesiumrunner@latest/index.html?t=' + Date.now();
27
+ const url = 'https://unpkg.com/thecheesiumrunner@latest/dist/index.html?t=' + Date.now();
29
28
  const res = await fetch(url);
30
29
  const text = await res.text();
31
30
  const frame = document.getElementById('fm');
32
- const fdoc = frame.contentDocument || frame.contentWindow.document;
33
- fdoc.open();
34
- fdoc.write(text);
35
- fdoc.close();
31
+ const blob = new Blob([text], { type: 'text/html' });
32
+ const blobUrl = URL.createObjectURL(blob);
33
+ frame.src = blobUrl;
34
+ frame.onload = () => URL.revokeObjectURL(blobUrl);
36
35
  } catch(e) {
37
36
  console.error('Loader error:', e);
38
37
  }
39
38
  })();
40
39
  })();
41
- //]]>
42
40
  </xhtml:script>
43
41
  </xhtml:body>
44
42
  </xhtml:html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thecheesiumrunner",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "",
5
5
  "license": "ISC",
6
6
  "author": "",