-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
get_js_deps.sh
executable file
·82 lines (68 loc) · 2.87 KB
/
get_js_deps.sh
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
#!/bin/sh
set -e
###
# download JS dependencies and place them in our templates/assets folder
# then launch our ogv.js script to fix dynamic loading links
###
if ! command -v curl > /dev/null; then
echo "you need curl."
exit 1
fi
if ! command -v unzip > /dev/null; then
echo "you need unzip."
exit 1
fi
# Absolute path this script is in.
SCRIPT_PATH="$( cd "$(dirname "$0")" ; pwd -P )"
ASSETS_PATH="${SCRIPT_PATH}/openedx2zim/templates/assets"
echo "About to download JS assets to ${ASSETS_PATH}"
echo "getting open sans font"
curl -L -o opensans.zip https://gwfh.mranftl.com/api/fonts/open-sans?download=zip\&subsets=vietnamese,latin-ext,latin,greek-ext,greek,cyrillic-ext,cyrillic\&variants=regular\&formats=woff,woff2
rm -rf $ASSETS_PATH/fonts/opensans
mkdir -p $ASSETS_PATH/fonts/opensans
unzip -o -d $ASSETS_PATH/fonts/opensans opensans.zip
mv $ASSETS_PATH/fonts/opensans/*.woff $ASSETS_PATH/fonts/opensans/opensans.woff
mv $ASSETS_PATH/fonts/opensans/*.woff2 $ASSETS_PATH/fonts/opensans/opensans.woff2
rm -f opensans.zip
echo "getting fontawesome"
curl -L -O https://use.fontawesome.com/releases/v5.13.1/fontawesome-free-5.13.1-web.zip
rm -rf $ASSETS_PATH/fontawesome
unzip -o -d $ASSETS_PATH fontawesome-free-5.13.1-web.zip
mv $ASSETS_PATH/fontawesome-free-5.13.1-web $ASSETS_PATH/fontawesome
rm -rf $ASSETS_PATH/fontawesome/js $ASSETS_PATH/fontawesome/less $ASSETS_PATH/fontawesome/metadata $ASSETS_PATH/fontawesome/scss $ASSETS_PATH/fontawesome/sprites $ASSETS_PATH/fontawesome/svgs $ASSETS_PATH/fontawesome/LICENSE.txt
rm -f fontawesome-free-5.13.1-web.zip
echo "getting video.js"
curl -L -O https://github.com/videojs/video.js/releases/download/v7.8.1/video-js-7.8.1.zip
rm -rf $ASSETS_PATH/videojs
mkdir -p $ASSETS_PATH/videojs
unzip -o -d $ASSETS_PATH/videojs video-js-7.8.1.zip
rm -rf $ASSETS_PATH/videojs/alt $ASSETS_PATH/videojs/examples
rm -f video-js-7.8.1.zip
echo "getting mathjax"
curl -L -O https://github.com/mathjax/MathJax/archive/3.0.5.zip
rm -rf $ASSETS_PATH/mathjax
unzip -o -d $ASSETS_PATH 3.0.5.zip
mv $ASSETS_PATH/MathJax-3.0.5/es5 $ASSETS_PATH/mathjax
rm -rf $ASSETS_PATH/MathJax-3.0.5
rm -f 3.0.5.zip
echo "getting jquery.min.js"
curl -L -o $ASSETS_PATH/jquery.min.js https://code.jquery.com/jquery-3.5.1.min.js
echo "getting ogv.js"
curl -L -O https://github.com/brion/ogv.js/releases/download/1.6.1/ogvjs-1.6.1.zip
rm -rf $ASSETS_PATH/ogvjs
unzip -o ogvjs-1.6.1.zip
mv ogvjs-1.6.1 $ASSETS_PATH/ogvjs
rm -f ogvjs-1.6.1.zip
echo "getting videojs-ogvjs.js"
curl -L -O https://github.com/hartman/videojs-ogvjs/archive/v1.3.1.zip
rm -f $ASSETS_PATH/videojs-ogvjs.js
unzip -o v1.3.1.zip
mv videojs-ogvjs-1.3.1/dist/videojs-ogvjs.js $ASSETS_PATH/videojs-ogvjs.js
rm -rf videojs-ogvjs-1.3.1
rm -f v1.3.1.zip
if command -v fix_ogvjs_dist > /dev/null; then
echo "fixing JS files"
fix_ogvjs_dist $ASSETS_PATH "assets"
else
echo "NOT fixing JS files (zimscraperlib not installed)"
fi