xref: /dokuwiki/lib/scripts/jquery/update.sh (revision 990d87d328ce675daecb17f7e208d175580c1407)
1#!/bin/sh
2#
3# This script loads the latest jQuery and jQuery-UI 1.* versions from jQuery's CDN
4#
5# It also loads the 'smoothness' jQuery-UI theme and all referenced images.
6#
7# @author Andreas Gohr <andi@splitbrain.org>
8# @author Stefan Grönke <stefan@gronke.net>
9# @link   http://code.jquery.com/
10
11# load version infor from external file
12source ./versions
13JQUI_HOST="https://code.jquery.com/ui/$JQUI_VERSION"
14JQUI_GIT="https://raw.githubusercontent.com/jquery/jquery-ui/$JQUI_VERSION/ui"
15
16# load jQuery
17wget -nv https://code.jquery.com/jquery-${JQ_VERSION}.min.js      -O jquery.min.js
18# load jQuery-UI
19wget -nv "$JQUI_HOST/jquery-ui.min.js" -O jquery-ui.min.js
20# load jQuery Migrate
21wget -nv https://code.jquery.com/jquery-migrate-${JQM_VERSION}.min.js      -O jquery-migrate.min.js
22
23# load the smoothness theme
24mkdir -p jquery-ui-theme/images
25wget -nv -qO- "$JQUI_HOST/themes/smoothness/jquery-ui.css" | sed "s/font-family:[^;]*;//" > jquery-ui-theme/smoothness.css
26images=`gawk 'match($0, /url\("?(images\/[^\)"]+)"?\)/, m) { print m[1] }' jquery-ui-theme/smoothness.css`
27for img in $images
28do
29    wget -nv "$JQUI_HOST/themes/smoothness/$img" -O jquery-ui-theme/$img
30done
31
32# load the localization data for jquery ui
33for LNG in ../../../inc/lang/*
34do
35    CODE=`basename $LNG`
36    wget -nv "$JQUI_GIT/i18n/datepicker-$CODE.js" -O $LNG/jquery.ui.datepicker.js
37    if [ ! -s "$LNG/jquery.ui.datepicker.js" ]; then
38        rm -f $LNG/jquery.ui.datepicker.js
39    fi
40done
41
42# some custom language codes
43wget -nv "$JQUI_GIT/i18n/datepicker-de.js" -O ../../../inc/lang/de-informal/jquery.ui.datepicker.js
44wget -nv "$JQUI_GIT/i18n/datepicker-pt-BR.js" -O ../../../inc/lang/pt-br/jquery.ui.datepicker.js
45wget -nv "$JQUI_GIT/i18n/datepicker-zh-CN.js" -O ../../../inc/lang/zh/jquery.ui.datepicker.js
46wget -nv "$JQUI_GIT/i18n/datepicker-zh-TW.js" -O ../../../inc/lang/zh-tw/jquery.ui.datepicker.js
47wget -nv "$JQUI_GIT/i18n/datepicker-cy-GB.js" -O ../../../inc/lang/cy/jquery.ui.datepicker.js
48
49# strip source maps
50sed -i '/sourceMappingURL/d' *.min.js
51