forked from georgejhunt/youtube
-
Notifications
You must be signed in to change notification settings - Fork 0
/
get_js_deps.sh
executable file
·66 lines (54 loc) · 2.13 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
#!/bin/sh
###
# 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}/youtube2zim/templates/assets"
echo "About to download JS assets to ${ASSETS_PATH}"
echo "getting video.js"
curl -L -O https://github.com/videojs/video.js/releases/download/v7.20.3/video-js-7.20.3.zip
rm -rf $ASSETS_PATH/videojs
mkdir -p $ASSETS_PATH/videojs
unzip -o -d $ASSETS_PATH/videojs video-js-7.20.3.zip
rm -rf $ASSETS_PATH/videojs/alt $ASSETS_PATH/videojs/examples
rm -f video-js-7.20.3.zip
echo "getting ogv.js"
curl -L -O https://github.com/brion/ogv.js/releases/download/1.8.9/ogvjs-1.8.9.zip
rm -rf $ASSETS_PATH/ogvjs
unzip -o ogvjs-1.8.9.zip
mv ogvjs-1.8.9 $ASSETS_PATH/ogvjs
rm -f ogvjs-1.8.9.zip
echo "getting chosen.jquery.js"
curl -L -O https://github.com/harvesthq/chosen/releases/download/v1.8.7/chosen_v1.8.7.zip
rm -rf $ASSETS_PATH/chosen
mkdir -p $ASSETS_PATH/chosen
unzip -o -d $ASSETS_PATH/chosen chosen_v1.8.7.zip
rm -rf $ASSETS_PATH/chosen/docsupport $ASSETS_PATH/chosen/chosen.proto.* $ASSETS_PATH/chosen/*.html $ASSETS_PATH/chosen/*.md
rm -f chosen_v1.8.7.zip
echo "getting videojs-ogvjs.js"
curl -L -o $ASSETS_PATH/videojs-ogvjs.js https://dev.kiwix.org/videojs-ogvjs/videojs-ogvjs.min.js
echo "getting jquery.js"
curl -L -o $ASSETS_PATH/jquery.min.js https://code.jquery.com/jquery-1.12.4.min.js
echo "getting webp-hero"
curl -L -O https://unpkg.com/[email protected]/dist-cjs/polyfills.js
rm -f $ASSETS_PATH/polyfills.js
mv polyfills.js $ASSETS_PATH/polyfills.js
curl -L -O https://unpkg.com/[email protected]/dist-cjs/webp-hero.bundle.js
rm -f $ASSETS_PATH/webp-hero.bundle.js
mv webp-hero.bundle.js $ASSETS_PATH/webp-hero.bundle.js
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