xref: /dokuwiki/lib/scripts/jquery/update.sh (revision f4b12de73d07db2a5a0549309329486d7a9e0fdf)
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# Adjust version for jQuery-UI here - there's no good latest link
12JQUI_VERSION='1.11.4'
13JQUI_HOST="https://code.jquery.com/ui/$JQUI_VERSION"
14JQUI_GIT="https://raw.githubusercontent.com/jquery/jquery-ui/$JQUI_VERSION/ui"
15
16# Adjust version for jQueryhere - latest updates slowly
17JQ_VERSION='1.11.3'
18
19
20# load jQuery
21wget -nv http://code.jquery.com/jquery-${JQ_VERSION}.min.js      -O jquery.min.js
22wget -nv http://code.jquery.com/jquery-${JQ_VERSION}.js          -O jquery.js
23
24# load jQuery-UI
25wget -nv "$JQUI_HOST/jquery-ui.min.js" -O jquery-ui.min.js
26wget -nv "$JQUI_HOST/jquery-ui.js"     -O jquery-ui.js
27
28# load the smoothness theme
29mkdir -p jquery-ui-theme/images
30wget -nv -qO- "$JQUI_HOST/themes/smoothness/jquery-ui.css" | sed "s/font-family:[^;]*;//" > jquery-ui-theme/smoothness.css
31images=`gawk 'match($0, /url\("?(images\/[^\)"]+)"?\)/, m) { print m[1] }' jquery-ui-theme/smoothness.css`
32for img in $images
33do
34    wget -nv "$JQUI_HOST/themes/smoothness/$img" -O jquery-ui-theme/$img
35done
36
37# load the localization data for jquery ui
38for LNG in ../../../inc/lang/*
39do
40    CODE=`basename $LNG`
41    wget -nv "$JQUI_GIT/i18n/datepicker-$CODE.js" -O $LNG/jquery.ui.datepicker.js
42    if [ ! -s "$LNG/jquery.ui.datepicker.js" ]; then
43        rm -f $LNG/jquery.ui.datepicker.js
44    fi
45done
46
47# some custom language codes
48wget -nv "$JQUI_GIT/i18n/datepicker-de.js" -O ../../../inc/lang/de-informal/jquery.ui.datepicker.js
49wget -nv "$JQUI_GIT/i18n/datepicker-pt-BR.js" -O ../../../inc/lang/pt-br/jquery.ui.datepicker.js
50wget -nv "$JQUI_GIT/i18n/datepicker-zh-CN.js" -O ../../../inc/lang/zh/jquery.ui.datepicker.js
51wget -nv "$JQUI_GIT/i18n/datepicker-zh-TW.js" -O ../../../inc/lang/zh-tw/jquery.ui.datepicker.js
52
53# strip source maps
54sed -i '/sourceMappingURL/d' *.min.js
55