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