xref: /dokuwiki/lib/scripts/jquery/update.sh (revision 1420e73d5e21de82e3e1a7a88bdaac5cd6827c92)
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# @link   https://code.google.com/apis/libraries/devguide.html#jquery
9
10# load jQuery
11wget -nv https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js      -O jquery.min.js
12wget -nv https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js          -O jquery.js
13
14# load jQuery-UI
15wget -nv https://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js -O jquery-ui.min.js
16wget -nv https://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.js     -O jquery-ui.js
17
18# load the smoothness theme
19mkdir -p jquery-ui-theme/images
20wget -nv https://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/smoothness/jquery-ui.css -O jquery-ui-theme/smoothness.css
21images=`gawk 'match($0, /url\((images\/[^\)]+)\)/, m) { print m[1] }' jquery-ui-theme/smoothness.css`
22for img in $images
23do
24    wget -nv https://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/smoothness/$img -O jquery-ui-theme/$img
25done
26
27# remove font family declarations from smoothness CSS
28sed -i "s/font-family:[^;]*; \?//" jquery-ui-theme/smoothness.css
29