update.sh 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/usr/bin/env 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. # load version info from external file
  11. source ./versions
  12. JQUI_HOST="https://code.jquery.com/ui/$JQUI_VERSION"
  13. JQUI_GIT="https://raw.githubusercontent.com/jquery/jquery-ui/$JQUI_VERSION/ui"
  14. # load jQuery
  15. wget -nv https://code.jquery.com/jquery-${JQ_VERSION}.min.js -O jquery.min.js
  16. # load jQuery-UI
  17. wget -nv "$JQUI_HOST/jquery-ui.min.js" -O jquery-ui.min.js
  18. # load the smoothness theme
  19. mkdir -p jquery-ui-theme/images
  20. wget -nv -qO- "$JQUI_HOST/themes/smoothness/jquery-ui.css" | sed "s/font-family:[^;]*;//" > jquery-ui-theme/smoothness.css
  21. images=`gawk 'match($0, /url\("?(images\/[^\)"]+)"?\)/, m) { print m[1] }' jquery-ui-theme/smoothness.css`
  22. for img in $images
  23. do
  24. wget -nv "$JQUI_HOST/themes/smoothness/$img" -O jquery-ui-theme/$img
  25. done
  26. # load the localization data for jquery ui
  27. for LNG in ../../../inc/lang/*
  28. do
  29. CODE=`basename $LNG`
  30. wget -nv "$JQUI_GIT/i18n/datepicker-$CODE.js" -O $LNG/jquery.ui.datepicker.js
  31. if [ ! -s "$LNG/jquery.ui.datepicker.js" ]; then
  32. rm -f $LNG/jquery.ui.datepicker.js
  33. fi
  34. done
  35. # some custom language codes
  36. wget -nv "$JQUI_GIT/i18n/datepicker-de.js" -O ../../../inc/lang/de-informal/jquery.ui.datepicker.js
  37. wget -nv "$JQUI_GIT/i18n/datepicker-pt-BR.js" -O ../../../inc/lang/pt-br/jquery.ui.datepicker.js
  38. wget -nv "$JQUI_GIT/i18n/datepicker-zh-CN.js" -O ../../../inc/lang/zh/jquery.ui.datepicker.js
  39. wget -nv "$JQUI_GIT/i18n/datepicker-zh-TW.js" -O ../../../inc/lang/zh-tw/jquery.ui.datepicker.js
  40. wget -nv "$JQUI_GIT/i18n/datepicker-cy-GB.js" -O ../../../inc/lang/cy/jquery.ui.datepicker.js
  41. # strip source maps
  42. sed -i '/sourceMappingURL/d' *.min.js