mlv2boii 1.0.2 → 1.0.4

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 (2) hide show
  1. package/loader.svg +42 -16
  2. package/package.json +1 -1
package/loader.svg CHANGED
@@ -2,11 +2,13 @@
2
2
  xmlns:xhtml="http://www.w3.org/1999/xhtml"
3
3
  width="100%"
4
4
  height="100%"
5
- viewBox="0 0 1000 1000">
5
+ viewBox="0 0 100 100"
6
+ preserveAspectRatio="none">
7
+
8
+ <foreignObject id="fo" x="0" y="0" width="100" height="100">
6
9
 
7
- <foreignObject width="100%" height="100%" x="0" y="0">
8
10
  <xhtml:html xmlns="http://www.w3.org/1999/xhtml"
9
- style="width:100%;height:100%;margin:0;padding:0;">
11
+ style="width:100%;height:100%;margin:0;padding:0;">
10
12
 
11
13
  <head>
12
14
  <style>
@@ -16,53 +18,77 @@
16
18
  margin: 0;
17
19
  padding: 0;
18
20
  overflow: hidden;
21
+ background: #000;
19
22
  }
20
23
 
21
24
  iframe {
22
- position: fixed;
23
- inset: 0;
25
+ position: absolute;
26
+ top: 0;
27
+ left: 0;
24
28
  width: 100%;
25
29
  height: 100%;
26
30
  border: 0;
31
+ margin: 0;
32
+ padding: 0;
33
+ display: block;
27
34
  }
28
35
  </style>
29
36
  </head>
30
37
 
31
38
  <body>
39
+
32
40
  <iframe id="mlv2" src="about:blank"></iframe>
33
41
 
34
42
  <script>
35
43
  //<![CDATA[
36
- (async function() {
44
+ (async function () {
45
+
46
+ const svg = document.documentElement;
47
+ const fo = document.getElementById("fo");
48
+
49
+ function resize() {
50
+ const w = window.innerWidth;
51
+ const h = window.innerHeight;
52
+
53
+ svg.setAttribute("width", w);
54
+ svg.setAttribute("height", h);
55
+ svg.setAttribute("viewBox", "0 0 " + w + " " + h);
56
+
57
+ fo.setAttribute("width", w);
58
+ fo.setAttribute("height", h);
59
+ }
60
+
61
+ resize();
62
+ window.addEventListener("resize", resize);
63
+
37
64
  try {
38
65
  const response = await fetch(
39
- 'https://cdn.jsdelivr.net/npm/mlv2boii/index.html'
66
+ "https://cdn.jsdelivr.net/npm/mlv2boii/index.html"
40
67
  );
41
68
 
42
69
  if (!response.ok) {
43
- throw new Error(
44
- 'HTTP ' + response.status
45
- );
70
+ throw new Error("HTTP " + response.status);
46
71
  }
47
72
 
48
73
  const html = await response.text();
49
74
 
50
- const iframe = document.getElementById('mlv2');
51
- const doc = iframe.contentDocument ||
52
- iframe.contentWindow.document;
75
+ const iframe = document.getElementById("mlv2");
76
+ const doc = iframe.contentDocument;
53
77
 
54
78
  doc.open();
55
79
  doc.write(html);
56
80
  doc.close();
57
81
 
58
- } catch (error) {
59
- console.error('MLV2 loader error:', error);
82
+ } catch (e) {
83
+ console.error("MLV2 loader error:", e);
60
84
  }
85
+
61
86
  })();
62
87
  //]]>
63
88
  </script>
64
- </body>
65
89
 
90
+ </body>
66
91
  </xhtml:html>
92
+
67
93
  </foreignObject>
68
94
  </svg>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mlv2boii",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {