~qeef/damn-client.js

ref: 41b677d582f69af971d4ef395f58dd0753c9af1a damn-client.js/gen_static_js_client.sh -rwxr-xr-x 1.7 KiB
41b677d5Jiri Vlasak Add split horizontally/vertically action to mappy 9 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
#!/bin/sh
if [ $# -ne 1 -o x"$1" != x"light" -a x"$1" != x"mappy" -a x"$1" != x"panel" ]
then
    echo 'Need one argument that is _light_, _panel_, or _mappy_.'
    exit 1
fi
serv="https://${DAMN_SERVER:-server.damn-project.org}"
osmsm="https://${DAMN_OSMSM:-osmsm.damn-project.org}"
lang=${DEFAULT_LANG:-en}
edit=${DEFAULT_WEB_EDITOR:-id}
area=$1
if [ "$area" = "light" ]
then
    area="area"
fi
cat static/index.html \
    | sed 's,<link rel="stylesheet" href="def.css">,<style>\n</style>,' \
    | sed '/<style>/ r static/def.css' \
    | sed '/<script src="damn-api.js"><\/script>/d' \
    | sed '/<script src="i18n.js"><\/script>/d' \
    | sed '/<script src="fn.js"><\/script>/d' \
    | sed '/<script src="html.js"><\/script>/d' \
    | sed '/<script src="light-list.js"><\/script>/d' \
    | sed '/<script src="light-area.js"><\/script>/d' \
    | sed '/<script src="panel-area.js"><\/script>/d' \
    | sed '/<script src="mappy-area.js"><\/script>/d' \
    | sed '/<script src="light-stats.js"><\/script>/d' \
    | sed '/<script>/ r static/damn-api.js' \
    | sed '/<script>/ r static/i18n.js' \
    | sed '/<script>/ r static/fn.js' \
    | sed '/<script>/ r static/html.js' \
    | sed '/<script>/ r static/light-list.js' \
    | sed '/<script>/ r static/light-area.js' \
    | sed '/<script>/ r static/panel-area.js' \
    | sed '/<script>/ r static/mappy-area.js' \
    | sed '/<script>/ r static/light-stats.js' \
    | sed "s,https://server.damn-project.org,$serv,g" \
    | sed "s,https://osmsm.damn-project.org,$osmsm,g" \
    | sed "s,var SHOW = \"area\";,var SHOW = \"$area\";," \
    | sed "s,var LANG = \"en\";,var LANG = \"$lang\";," \
    | sed "s,var EDIT = \"id\";,var EDIT = \"$edit\";,"