-for i in `ls -S $IMGPATH`; do
- if [ $first -ne 1 ]; then
- echo -n ", "
- if [ $ct -eq 8 ]; then
- echo
- echo -n "$spa"
- ct=0
- fi
- else
- echo -n "$spa"
- fi
- sz="`stat -c '%s' $IMGPATH/$i`"
- sum=$((sum + sz))
- cur="`echo "100.0 * $sum / $tot" | bc -l | sed 's/\(\.[0-9]\)[0-9]*/\1/g'`"
- echo -n "\"$cur\""
- ct=$((ct + 1))
- first=0
-done
-
-echo ");"
-) >> $OUTFILE
+ for dpath in "" briskin5/ ; do
+ OUTFILE="web/${dpath}"preload_img${fsuf}.js
+ echo "creating $OUTFILE ..."
+ rm -f $OUTFILE
+ IMGPATH="${IMGPATHBASE}${dpath}img"
+ (
+ echo "var g_preload_img_arr = new Array( "
+ first=1
+ spa=" "
+ ltri="$(echo "$IMGPATH" | wc -c)"
+ for i in $(imglist "$dpath" "$lang"); do
+ if [ $first -ne 1 ]; then
+ echo -n ","
+ if [ $((ct % 2)) -eq 0 ]; then
+ echo
+ echo -n "$spa"
+ fi
+ else
+ echo -n "$spa"
+ fi
+ outna="img/$(echo "$i" | cut -c $((ltri + 1))-)"
+ if [ $((ct % 2)) -eq 0 ]; then
+ echo -n "\"$outna\""
+ else
+ echo -n " \"$outna\""
+ fi
+ ct=$((ct + 1))
+ first=0
+ done
+ echo "CT: $ct" >&2
+ echo ");"
+ ) >> $OUTFILE
+
+ (
+ echo "var g_preload_imgsz_arr = new Array( "
+ first=1
+ sum=0
+ spa=" "
+ tot=0
+ ltri="$(echo "$IMGPATH" | wc -c)"
+ for i in $(imglist "$dpath" "$lang"); do
+ outna="$(echo "$i" | cut -c $((ltri + 1))-)"
+ sz="$(stat -c '%s' $IMGPATH/$outna)"
+ tot=$((tot + sz))
+ done
+
+ for i in $(imglist "$dpath" "$lang"); do
+ outna="$(echo "$i" | cut -c $((ltri + 1))-)"
+ if [ $first -ne 1 ]; then
+ echo -n ","
+ if [ $((ct % 8)) -eq 0 ]; then
+ echo
+ echo -n "$spa"
+ fi
+ else
+ echo -n "$spa"
+ fi
+ sz="$(stat -c '%s' $IMGPATH/$outna)"
+ sum=$((sum + sz))
+ cur="$(echo "100.0 * $sum / $tot" | bc -l | sed 's/\(\.[0-9]\)[0-9]*/\1/g')"
+ if [ $((ct % 8)) -eq 0 ]; then
+ echo -n "\"$cur\""
+ else
+ echo -n " \"$cur\""
+ fi
+ ct=$((ct + 1))
+ first=0
+ done
+
+ echo "CT2: $ct" >&2