vfsjs-test 1.0.12 → 1.0.13
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.
- package/index.html +1 -10
- package/main.js +39 -2
- package/package.json +1 -1
package/index.html
CHANGED
|
@@ -7,16 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
<script src="vfsjs.js"></script>
|
|
9
9
|
<script src="main.js"></script>
|
|
10
|
-
|
|
11
|
-
<link rel="stylesheet" href="live_theme.css?vfs=true">
|
|
12
10
|
</head>
|
|
13
|
-
<body
|
|
14
|
-
|
|
15
|
-
<h2>Infrared Advanced VFS Core</h2>
|
|
16
|
-
<div id="status" style="background: #020617; border: 1px solid #334155; padding: 15px; height: 180px; color: #f1f5f9; line-height: 1.6; overflow-y: auto;">
|
|
17
|
-
> Initializing isolated modular framework...
|
|
18
|
-
</div>
|
|
19
|
-
|
|
20
|
-
<script src="index.js?vfs=true"></script>
|
|
11
|
+
<body>
|
|
21
12
|
</body>
|
|
22
13
|
</html>
|
package/main.js
CHANGED
|
@@ -18,8 +18,45 @@ async function startDeveloperWorkspace() {
|
|
|
18
18
|
|
|
19
19
|
// 2. Add traditional JavaScript code
|
|
20
20
|
vfs.add('index.js', `
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
console.log("VFS Engine: Spin test activated inside the seamless frame!");
|
|
22
|
+
|
|
23
|
+
// 1. Inject a global CSS animation rule directly into the frame's head
|
|
24
|
+
const styleNode = document.createElement('style');
|
|
25
|
+
styleNode.innerHTML = \`
|
|
26
|
+
@keyframes customSpinMatrix {
|
|
27
|
+
0% { transform: rotate(0deg); }
|
|
28
|
+
100% { transform: rotate(360deg); }
|
|
29
|
+
}
|
|
30
|
+
.vfs-spinning-target {
|
|
31
|
+
display: inline-block !important;
|
|
32
|
+
animation: customSpinMatrix 4s linear infinite !important;
|
|
33
|
+
}
|
|
34
|
+
\`;
|
|
35
|
+
document.head.appendChild(styleNode);
|
|
36
|
+
|
|
37
|
+
// 2. Locate all text elements and wrap their text in spinning tags
|
|
38
|
+
function applySpinToText() {
|
|
39
|
+
// Target headers, paragraphs, lists, and span layers
|
|
40
|
+
const textElements = document.querySelectorAll('h1, h2, h3, p, span, li, div');
|
|
41
|
+
|
|
42
|
+
textElements.forEach(element => {
|
|
43
|
+
// Ignore containers that have children to avoid breaking structure layouts
|
|
44
|
+
if (element.children.length === 0 && element.innerText.trim() !== '') {
|
|
45
|
+
const words = element.innerText.split(' ');
|
|
46
|
+
element.innerHTML = words.map(word =>
|
|
47
|
+
\`<span class="vfs-spinning-target">\${word}</span>\`
|
|
48
|
+
).join(' ');
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Run the spin cycle as soon as the virtual document structure loads
|
|
54
|
+
if (document.readyState === 'loading') {
|
|
55
|
+
document.addEventListener('DOMContentLoaded', applySpinToText);
|
|
56
|
+
} else {
|
|
57
|
+
applySpinToText();
|
|
58
|
+
}
|
|
59
|
+
`, 'text/javascript');
|
|
23
60
|
|
|
24
61
|
// 3. Add the main index entry file using native, normal markup tags!
|
|
25
62
|
vfs.add('workspace.html', `
|