xref: /dokuwiki/lib/scripts/jquery/update.sh (revision 93691af57f65173963a122e19915917814a32b71)
1#!/bin/sh
2#
3# This script loads the latest jQuery and jQuery-UI 1.* versions from Google's and 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   https://code.google.com/apis/libraries/devguide.html#jquery
10# @link   http://code.jquery.com/
11
12# load jQuery
13wget -nv http://code.jquery.com/jquery-latest.min.js      -O jquery.min.js
14wget -nv http://code.jquery.com/jquery-latest.js          -O jquery.js
15
16# load jQuery-UI
17wget -nv https://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js -O jquery-ui.min.js
18wget -nv https://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.js     -O jquery-ui.js
19
20# load the smoothness theme
21mkdir -p jquery-ui-theme/images
22wget -nv -qO- https://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/smoothness/jquery-ui.css | sed "s/font-family:[^;]*;//" > jquery-ui-theme/smoothness.css
23images=`gawk 'match($0, /url\("?(images\/[^\)"]+)"?\)/, m) { print m[1] }' jquery-ui-theme/smoothness.css`
24for img in $images
25do
26    wget -nv https://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/smoothness/$img -O jquery-ui-theme/$img
27done
28
29# load the localization data for jquery ui
30for LNG in ../../../inc/lang/*
31do
32    CODE=`basename $LNG`
33    wget -nv https://ajax.googleapis.com/ajax/libs/jqueryui/1/i18n/jquery.ui.datepicker-$CODE.js -O $LNG/jquery.ui.datepicker.js
34    if [ ! -s "$LNG/jquery.ui.datepicker.js" ]; then
35        rm -f $LNG/jquery.ui.datepicker.js
36    fi
37done
38
39# some custom language codes
40wget -nv https://ajax.googleapis.com/ajax/libs/jqueryui/1/i18n/jquery.ui.datepicker-de.js -O ../../../inc/lang/de-informal/jquery.ui.datepicker.js
41wget -nv https://ajax.googleapis.com/ajax/libs/jqueryui/1/i18n/jquery.ui.datepicker-pt-BR.js -O ../../../inc/lang/pt-br/jquery.ui.datepicker.js
42wget -nv https://ajax.googleapis.com/ajax/libs/jqueryui/1/i18n/jquery.ui.datepicker-zh-CN.js -O ../../../inc/lang/zh/jquery.ui.datepicker.js
43wget -nv https://ajax.googleapis.com/ajax/libs/jqueryui/1/i18n/jquery.ui.datepicker-zh-TW.js -O ../../../inc/lang/zh-tw/jquery.ui.datepicker.js
44
45# strip source maps
46sed -i '/sourceMappingURL/d' *.min.js
47