xref: /dokuwiki/lib/scripts/jquery/update.sh (revision b055d7074c8f9415798be4f2fce8dfdea30d4f68)
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