#!/usr/bin/env zsh
# 
# xyz.malte70.de/js/mirror.zsh
# 
# Download JavaScript libraries from cdnjs.
# 

cd $(dirname $0)

##########################################
# Library versions
# 
jquery="3.6.1"
dialog_polyfill="0.5.6"
classie="1.0.1"



##########################################
# 
# https://cdnjs.com/libraries/jquery
# 
echo ":: jquery"
mkdir -p "jquery"
pushd "jquery"
for f in jquery{,.slim}{{,.min}.js,.min.js.map}
do
	echo "  → $f"
	rm -f $f
	wget -q "https://cdnjs.cloudflare.com/ajax/libs/jquery/$jquery/$f"
done
popd



##########################################
# 
# https://cdnjs.com/libraries/dialog-polyfill
# 
echo ":: dialog-polyfill"
mkdir -p "dialog-polyfill"
pushd "dialog-polyfill"
for f in dialog-polyfill{,.min}.{js,css}
do
	echo "  → $f"
	rm -f $f
	wget -q "https://cdnjs.cloudflare.com/ajax/libs/dialog-polyfill/$dialog_polyfill/$f"
done
popd



##########################################
# 
# https://cdnjs.com/libraries/classie
# 
echo ":: classie"
mkdir -p "classie"
pushd "classie"
for f in classie{,.min}.js
do
	echo "  → $f"
	rm -f $f
	wget -q "https://cdnjs.cloudflare.com/ajax/libs/classie/$classie/$f"
done
popd



