diff --git a/css/layout.css b/css/layout.css index 94a4dbab..a84236ca 100644 --- a/css/layout.css +++ b/css/layout.css @@ -1178,6 +1178,69 @@ small { line-height: 13px; } +/* BLOG WIDGET ----------*/ + +div.blogRow, div.blogFirstRow { + height: 40px; + padding: 3px 10px; + margin: 0 0; +} + +div.blogLastRow { + height: 20px; + text-align: center; + } + +div.blogFirstRow { + height: 22px; + background: url(../images/table-head.jpg) left top repeat-x #885ca4; + } + +.blogRow:hover { + background: #f6ffd5; + } + +div.blogRow1, div.blogRow3 { + background: #eee8f1; +} + +.blogFeed a { +text-decoration: none; +} + +.blogFeed p { +margin: 0; +font-size: 12px; +} + +p.blogTitle { + font-weight: bold; + text-decoration: underline; + } + +p.blogAuthor { + color: #000000; + text-align: right; + margin-top: -20px; + } + +p.blogAuthor em{ + color: #4e6a20; + text-align: right; + margin-top: -20px; + } + +p.blogDate { + color: #000000; + } + +.blogFeed h2 { + font-size: 1.467em; + margin: 0; + line-height: 23px; + color: #f6f6ed; + } + /* Project page */ diff --git a/en/index.wml b/en/index.wml index 9e8f2096..83d11fa6 100644 --- a/en/index.wml +++ b/en/index.wml @@ -153,35 +153,125 @@
-
-

Announcements

- - - - - - - - - - - - - -
-
Sep
11
-

Tor 0.2.5.7-rc is out

-
-
Sep
7
-

Ahmia search after GSoC development

-
-
Sep
3
-

Tor Browser 3.6.5 and 4.0-alpha-2 are released

-
-
Sep
2
-

Tails 1.1.1 is out

-
-
+ +<: + use strict; + use warnings; + use open ':std', ':encoding(UTF-8)'; + use LWP::Simple; + + # RSS feed url + my $url = 'https://blog.torproject.org/blog/feed'; + # Number of posts to show + my $showPosts = "5"; + # Maximum characters in post title to allow before truncating + my $titleMaxLength = "35"; + # Maximum characters in author name to allow before truncating + my $authorMaxLength = "15"; + + # Retreive url + my $data = get( $url ); + + if ($data) # Url returned data + { + my $check = $data; + $check =~ m{}i; + my $checkVal = $1; + + if ($checkVal) # Is an rss feed + { + my $titleStr = $data; + my $linkStr = $data; + my $dateStr = $data; + my $authorStr = $data; + + print "
+
+

Recent Blog Posts

+
"; + + # Generate posts + for my $i (0..$showPosts) + { + + # Parse title + $titleStr =~ m{(.*?)}g; + my $titleVal = $1; + my $titleLength = length($titleVal); + my $title = $titleVal; + + # Check title length and trim if necessary + my $titleTrim = $title; + if ($titleLength > $titleMaxLength) + { + my $trimLength = $titleMaxLength - 3; + my $titleTxt = substr($title, 0, $trimLength); + $titleTrim = "$titleTxt..."; + } + + # Parse link + $linkStr =~ m{(.*?)}g; + my $link = $1; + + if ($i != 0) + { + # Parse date + $dateStr =~ m{(.*?)}g; + my $date = $1; + + # Trim date + my $dateTrim = substr($date, 0, -15); + + # Parse author + $authorStr =~ m{(.*?)\s*}g; + my $author = $1; + + # Check author length and trim if necessary + my $authorLength = length($author); + my $authorTrim = $author; + if ($authorLength > $authorMaxLength) + { + my $authorTrimLength = $authorMaxLength - 3; + my $authorTxt = substr($author, 0, $authorTrimLength); + $authorTrim = "$authorTxt..."; + } + + # Begin html output + print ""; + + # Required for alternating row colors - switch blogRow# to change order + if (0 == $i % 2) { + print "
"; + } else { + print "
"; + } + + print "

$titleTrim

+

$dateTrim

+

Posted by: $authorTrim

+
+
"; + } + } + + } else { # Not an rss feed + print "
"; + print "

Recent posts are temporarily unavailable

"; + } + + } else { # Url did not return any data + print "
"; + print "

Recent posts are temporarily unavailable

"; + } + + print " +
+

View all blog posts »

+
+
+
"; +:> +

Who Uses Tor?