1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
#!/bin/sh
# remove code violating user privacy
if [ $# -ne 1 ] ; then
echo "Usage: $0 <file>"
exit 1
fi
if [ ! -e $1 ] ; then
echo "File $1 not found"
exit 1
fi
sed -i -e '/<\!-- Start of StatCounter Code -->/,/<\!-- End Google Analytics -->/d' \
-e '/<script type="text\/javascript">/{;N;s/\n//;}' \
-e "/flattr_btn='compact'/{;N;s/\n//;}" \
-e '/<script type="text\/javascript">.*flattr_url/,/lattr_btn.*<\/script>/d' \
-e '/<script src="http:\/\/api.flattr.com\/button\/load.js.*javascript"><\/script>/d' \
-e '/<a href="http:\/\/sourceforge.net\/donate\/index.php?group_id=[0-9]\+"><img src="http:\/\/images.sourceforge.net\/images\/project-support.jpg".* alt="Support This Project".*a>/d' \
-e '/<link rel="shortcut icon" type="image\/x-icon" href="http:\/\/cimg.sourceforge.net\/favicon.ico"><\/link>/d' \
-e 's/<img src="http:\/\/sourceforge.net\/sflogo.php[^>]\+><\/img>/SourceForge/' \
-e 's?href="http://cimg.eu/favicon.ico">?href="favicon.ico">?' \
-e 's?img src="http://cimg.eu/img/CImgLogo2.jpg"?img src="img/CImgLogo2.jpg"?' \
-e 's?<img src="http://images.sourceforge.net/images/project-support.jpg" width=.* height=.* border=.* alt="Support This Project" />?Support This Project?' \
$1
# use local logo
INSERT=""
if echo $1 | grep -q 'reference/[^/]\+$' ; then
INSERT="../"
fi
sed -i "s?http://cimg.sourceforge.net/img/CImgLogo2.jpg?${INSERT}CImgLogo2.jpg?" $1
|