~qeef/damn-client.js

ref: 3aa8da486770b744cb45dcf8494a53ed97570160 damn-client.js/static/index.html -rw-r--r-- 3.9 KiB
3aa8da48Jiri Vlasak Use creators for area authors 2 months ago
                                                                                
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<!DOCTYPE html>
<!--
Copyright (c) 2021 Jiri Vlasak

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-->
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="stylesheet" href="def.css">
<title>Client for Divide and map. Now.</title>
<script src="damn-api.js"></script>
<script src="i18n.js"></script>
<script src="fn.js"></script>
<script src="html.js"></script>
<script src="light-list.js"></script>
<script src="light-area.js"></script>
<script src="panel-area.js"></script>
<script src="mappy-area.js"></script>
<script src="light-stats.js"></script>
<script src="chat.js"></script>
<script>
    window.addEventListener("resize", chat_size);
    var ws = new WebSocket("wss://chat.damn-project.org");
    ws.onopen = function() {
        try { document.getElementById("messages").innerHTML = "Connected."; }
        catch {}
    };
    ws.onmessage = function(m) {
        try { add_msg(m.data); } catch(e) {}
    };
    ws.onclose = function() {
        try { add_msg("Disconnected."); } catch(e) {}
    };
    var api = new DamnAPI("https://server.damn-project.org");
    //var api = new DamnAPI("http://localhost:8000");
    var panel_e = false;
    var mappy_i = {
        "ed": false,
        "zoom_start": {"x": 0.0, "y": 0.0},
        "last": {"sx": 1.0, "sy": 1.0, "tx": 0.0, "ty": 0.0},
        "changeset_msg": "",
    };
    var stats_g = {"commits": false, "squares": false, "aid": false};
    var stats_a = (function() {
        return function() {
            if (document.getElementById("adv0").innerHTML == "")
                return "adv0";
            else
                return "adv1";
        };
    })();
    var SHOW = "area";
    var LANG = "en";
    try {
        if (api.user() && api.user()["lang"] != "")
            LANG = api.user()["lang"];
    } catch(e) {}
    var EDIT = "id";
    function load()
    {
        const sp = new URLSearchParams(window.location.search);
        if (sp.has("area")) {
            return go_to("area", sp.get("area"));
        } else if (sp.has("panel")) {
            return go_to("panel", sp.get("panel"));
        } else if (sp.has("mappy")) {
            return go_to("mappy", sp.get("mappy"));
        } else if (sp.has("stats")) {
            if (sp.has("of"))
                return go_to("stats", sp.get("stats"), sp.get("of"));
            else
                return go_to("stats", sp.get("stats"));
        } else if (sp.has("chat")) {
            var aid = (sp.get("chat")==="") ? false : sp.get("chat");
            return go_to("chat", aid);
        }
        return go_to("list");
    }
    window.onload = load;
</script>
</head>
<body>
<div id="damn_info"></div>
<div id="damn_main"></div>
<div id="footer">
    <a href="https://www.damn-project.org/" target="_blank">
        www.damn-project.org</a>
    &nbsp;|&nbsp;
    <a href="https://lists.sr.ht/~qeef/damn-project" target="_blank">
        Join discussion</a>
    &nbsp;|&nbsp;
    <a download href="index.html">
        Download client</a>
</div>
</body>
</html>