about summary refs log tree commit diff
path: root/MatrixUtils.Web/wwwroot/index.html
blob: 7425de2f7face90144b682ee6e952de58c9d9269 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<!DOCTYPE html>
<html lang="en">

    <head>
        <meta charset="utf-8"/>
        <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport"/>
        <title>MatrixUtils.Web</title>
        <base href="/"/>
        <link href="css/bootstrap/bootstrap.min.css" rel="stylesheet"/>
        <link href="css/app.css" rel="stylesheet"/>
        <link rel="manifest" href="rmu.webmanifest"/>
        <link rel="apple-touch-icon" sizes="512x512" href="icon-512.png"/>
        <link href="favicon.png" rel="icon" type="image/png"/>
        <link href="MatrixUtils.Web.styles.css" rel="stylesheet"/>
    </head>

    <body>
        <div id="app">
            <svg class="loading-progress">
                <circle cx="50%" cy="50%" r="40%"/>
                <circle cx="50%" cy="50%" r="40%"/>
            </svg>
            <div class="loading-progress-text"></div>
        </div>

        <div id="blazor-error-ui">
            An unhandled error has occurred.
            <a class="reload" href="">Reload</a>
            <a class="dismiss">🗙</a>
        </div>
        <script>
            function BlazorFocusElement(element) {
                if (element == null) return;
                if (element instanceof HTMLElement) {
                    console.log(element);
                    element.focus();
                } else if (element.hasOwnProperty("__internalId")) {
                    console.log("Element is not an HTMLElement", element);
                }
            }

            function getWidth(element) {
                console.log("getWidth", element);
                if (element == null) return 0;
                if (element instanceof HTMLElement) {
                    return element.offsetWidth
                } else if (element.hasOwnProperty("__internalId")) {
                    console.log("Element is not an HTMLElement", element);
                    return 0;
                }
                return 0;
            }

            function getWindowDimensions() {
                return {
                    width: window.innerWidth,
                    height: window.innerHeight
                };
            }

            setImageStream = async (element, imageStream) => {
                if(!(element instanceof HTMLElement)) {
                    console.error("Element is not an HTMLElement", element);
                    return;
                }
                
                const arrayBuffer = await imageStream.arrayBuffer();
                const blob = new Blob([arrayBuffer]);
                const url = URL.createObjectURL(blob);
                const image = document.getElementById(imageElementId);
                image.onload = () => {
                    URL.revokeObjectURL(url);
                }
                image.src = url;
            }
        </script>
        <script src="_framework/blazor.webassembly.js"></script>
<!--        <script>navigator.serviceWorker.register('service-worker.js');</script>-->
        <script src="sw-registrator.js"></script>
    </body>

</html>