PageSourceSearch

https://pupwife.com/scripts/desktop/citrusShellScripts.js

js pupwife.com collected 2026-09-30 15:04:09 UTC 1,702 bytes, 57 lines download raw bytes

1/**
2 * CitrusOS shell script loader — injects scripts from citrusShellManifest.js in order.
3 *
4 * Uses document.write during initial parse so dependents run before DOMContentLoaded,
5 * matching legacy synchronous <script src> behavior on index.html.
6 */
7(function (global) {
8    'use strict';
9
10    var manifest = global.CITRUS_SHELL_MANIFEST;
11    if (!manifest) {
12        console.error('[citrusShellScripts] Missing CITRUS_SHELL_MANIFEST — load citrusShellManifest.js first.');
13        return;
14    }
15
16    function pushGroup(list, key) {
17        var group = manifest[key];
18        if (!Array.isArray(group)) return;
19        for (var i = 0; i < group.length; i++) {
20            list.push(group[i]);
21        }
22    }
23
24    function flattenManifest() {
25        if (Array.isArray(manifest.scripts)) {
26            return manifest.scripts.slice();
27        }
28        var scripts = [];
29        pushGroup(scripts, 'hub');
30        pushGroup(scripts, 'core');
31        pushGroup(scripts, 'widgets');
32        pushGroup(scripts, 'boot');
33        return scripts;
34    }
35
36    function escapeAttr(value) {
37        return String(value)
38            .replace(/&/g, '&amp;')
39            .replace(/"/g, '&quot;')
40            .replace(/</g, '&lt;');
41    }
42
43    var scripts = flattenManifest();
44    if (!scripts.length) {
45        console.warn('[citrusShellScripts] Manifest has no scripts.');
46        return;
47    }
48
49    var html = '';
50    for (var s = 0; s < scripts.length; s++) {
51        var src = scripts[s];
52        if (!src || typeof src !== 'string') continue;
53        html += '<script src="' + escapeAttr(src) + '"><\/script>';
54    }
55
56    global.document.write(html);
57})(typeof window !== 'undefined' ? window : this);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.