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