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