Stop mobile-formatting for full browsers; add Al-Jazeera

This commit is contained in:
Neale Pickett 2012-01-06 11:13:54 -06:00
parent 12fbfacc0b
commit d9d0dddacc
1 changed files with 16 additions and 11 deletions

View File

@ -19,10 +19,13 @@ weather () {
} }
section () { section () {
echo "<h2>$1</h2>" echo "<h2><a href=\"$2\">$1</a></h2>"
echo "<ul>" echo "<ul>"
if [ -n "$HTTP_X_WAP_PROFILE" ]; then
pfx="http://news.google.com/gwt/x?u="
fi
curl -s "$3" | \ curl -s "$3" | \
awk -F '>' -v RS='<' -v m=${4:-5} ' awk -F '>' -v RS='<' -v m=${4:-5} -v pfx="$pfx" '
(/^item[> ]/) { (/^item[> ]/) {
a++; a++;
} }
@ -34,11 +37,10 @@ section () {
(a && a<m+1 && /^link/) { (a && a<m+1 && /^link/) {
l=$2; l=$2;
sub(/.*url=/, "", l); sub(/.*url=/, "", l);
print "<li><a href=\"http://news.google.com/gwt/x?u=" l "\">" title "</a></li>"; print "<li><a href=\"" pfx l "\">" title "</a></li>";
}' }'
echo "</ul>" echo "</ul>"
echo "<p class=\"more\"><a href=\"$2\">more...</a></p>"
} }
cat <<EOF cat <<EOF
@ -75,24 +77,27 @@ if [ -z "$HTTP_X_WAP_PROFILE" ]; then
fi fi
cat <<EOF cat <<EOF
<form action="http://m.google.com/"><input name="q" size="12"><input type="submit" value="G"></form> <form action="http://www.google.com/"><input name="q" size="12"><input type="submit" value="G"></form>
EOF EOF
weather weather
section "Top Stories" \
'http://news.google.com/m?pz=1&cf=all&ned=us&hl=en' \
'http://news.google.com/news?pz=1&cf=all&ned=us&hl=en&gwt=on&output=rss'
section "World News" \
'http://news.google.com/m?pz=1&cf=all&ned=us&hl=en&topic=w' \
'http://news.google.com/news?pz=1&cf=all&ned=us&hl=en&topic=w&output=rss'
section "CSM" \ section "CSM" \
'http://www.csmonitor.com/textedition' \ 'http://www.csmonitor.com/textedition' \
'http://rss.csmonitor.com/feeds/csm' 'http://rss.csmonitor.com/feeds/csm'
section NPR \ section NPR \
'http://thin.npr.org/t.php?tid=1001' \ 'http://thin.npr.org/t.php?tid=1001' \
'http://www.npr.org/rss/rss.php?id=1001' 'http://www.npr.org/rss/rss.php?id=1001'
section AJE \
'http://m.aljazeera.net' \
'http://www.aljazeera.com/Services/Rss/?PostingId=2007731105943979989'
section "Ars Technica" \ section "Ars Technica" \
'http://m.arstechnica.com/' \ 'http://m.arstechnica.com/' \
'http://feeds.arstechnica.com/arstechnica/index?format=xml' 'http://feeds.arstechnica.com/arstechnica/index?format=xml'
section "Top Stories" \
'http://news.google.com/m?pz=1&cf=all&ned=us&hl=en' \
'http://news.google.com/news?pz=1&cf=all&ned=us&hl=en&gwt=on&output=rss'
section "World News" \
'http://news.google.com/m?pz=1&cf=all&ned=us&hl=en&topic=w' \
'http://news.google.com/news?pz=1&cf=all&ned=us&hl=en&topic=w&output=rss'
cat <<EOF cat <<EOF
</body> </body>
</html> </html>