git-svn-id: https://svn.mozilla.org/projects/planet@142418 4eb1ac78-321c-0410-a911-ec516a8615a5
This commit is contained in:
mhoye@mozilla.com 2015-06-12 19:48:55 +00:00
Родитель 8d276684d3
Коммит 70128dde12
22 изменённых файлов: 1361 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,86 @@
# Planet configuration file
# Every planet needs a [Planet] section
[Planet]
# name: Your planet's name
# link: Link to the main page
# owner_name: Your name
# owner_email: Your e-mail address
name = Participation Planet
link = http://planet.mozilla.org/participation
owner_name = Planet Mozilla Module Team
owner_email = planet@mozilla.org
# cache_directory: Where cached feeds are stored
# log_level: One of DEBUG, INFO, WARNING, ERROR or CRITICAL
cache_directory = cache
log_level = ERROR
feed_timeout = 20
spider_threads = 4
http_cache_directory = http
# The following provide defaults for each template:
# output_theme: "theme" of the output
# output_dir: Directory to place output files
# items_per_page: How many items to put on each page
output_theme = moz_planet
output_dir = /data/static/src/planet.mozilla.org/participation
items_per_page = 75
# If non-zero, all feeds which have not been updated in the indicated
# number of days will be marked as inactive
activity_threshold = 90
# filters to be run
filters = minhead.py stripAd/feedburner.sed stripAd/google_ad_map.sed stripAd/yahoo.sed
[index.html.xslt]
filters:
# mememe.plugin
addsearch.xslt
# Any other section defines a feed to subscribe to. The section title
# (in the []s) is the URI of the feed itself. A section can also be
# have any of the following options:
#
# name: Name of the feed (defaults to the title found in the feed)
# offset: Number of hours (+ or -) the feed's times tend to be out
#
# Additionally any other option placed here will be available in
# the template (prefixed with channel_ for the Items loop). We use
# this trick to make the faces work -- this isn't something Planet
# "natively" knows about. Look at fancy-examples/index.html.tmpl
# for the flip-side of this.
# Options placed in the [DEFAULT] section provide defaults for the feed
# sections. Placing a default here means you only need to override the
# special cases later.
[DEFAULT]
# Hackergotchi default size.
# If we want to put a face alongside a feed, and it's this size, we
# can omit these variables.
facewidth = 65
faceheight = 85
# Ignore any future date (and default to the time the entry was first
# seen) until the feed is updated and the time indicated is past, at which
# point the entry will be updated with the new date.
future_dates = ignore_date
# Any other section defines a feed to subscribe to. The section title
# (in the []s) is the URI of the feed itself. A section can also be
# have any of the following options:
#
# name: Name of the feed (defaults to the title found in the feed)
# offset: Number of hours (+ or -) the feed's times tend to be out
#
# Additionally any other option placed here will be available in
# the template (prefixed with channel_ for the Items loop). We use
# this trick to make the faces work -- this isn't something Planet
# "natively" knows about. Look at fancy-examples/index.html.tmpl
# for the flip-side of this.
[http://georgeroter.org/category/participation/feed/]
name = George Roter
[http://tiptoes.ca/category/participation-team/feed]
name = Emma Irwin

Просмотреть файл

@ -0,0 +1,48 @@
ExpiresActive on
ExpiresDefault "access plus 5 minutes"
<FilesMatch "\.(gif|jpe?g|png)$">
ExpiresDefault "access plus 1 month"
</FilesMatch>
AddType text/plain txt esf
AddType application/xml xml rss ffkar opml soap sn2 tb tbrss wsdl xss
AddType application/atom+xml atom
AddType application/xhtml+xml xhtml
AddType application/xhtml+xml html5
AddType application/rss+xml rss2 rss21 rss11
AddType application/rdf+xml rdf
AddType application/x-netcdf cdf
Header append Vary Accept
Header append Vary User-Agent
RewriteEngine on
# start with the assumption that everything is xhtml
AddType application/xhtml+xml html
RewriteRule ^([^.]*|.*\.html\d?)$ - [T=application/xhtml+xml;charset=utf-8]
# respect requests to not send xhtml
RewriteCond %{HTTP_ACCEPT} application/xhtml\+xml\s*;\s*q=0\.?0*(\s|,|$)
RewriteRule ^([^.]*|.*\.html\d?)$ - [T=text/html;charset=utf-8]
# standards based backwards compatibility - for tools like Lynx
RewriteCond %{HTTP_ACCEPT} text/html
RewriteCond %{HTTP_ACCEPT} !text/html\s*;\s*q=0\.?0*(\s|,|$)
RewriteCond %{HTTP_ACCEPT} !(application|\*)/(xhtml\+xml|\*)
RewriteRule ^([^.]*|.*\.html\d?)$ - [T=text/html;charset=utf-8]
# MSIE accomodation: simple click
RewriteCond %{HTTP_ACCEPT} image/gif
RewriteCond %{HTTP_ACCEPT} !html
RewriteRule ^([^.]*|.*\.html\d?)$ - [T=text/html;charset=utf-8]
# MSIE accomodation: open in new tab/window
RewriteCond %{HTTP_ACCEPT} ^\*/\*$
RewriteCond %{HTTP_USER_AGENT} MSIE
RewriteRule ^([^.]*|.*\.html\d?)$ - [T=text/html;charset=utf-8]
AddDefaultCharset UTF-8
AddCharset utf-8 atom rss ffkar soap tb tbrss wsdl xss html
AddCharset utf-8 txt esf xhtml rss2 rss21 rdf cdf

Просмотреть файл

@ -0,0 +1,33 @@
[Planet]
template_files:
atom.xml.xslt
foafroll.xml.xslt
index.html.xslt
opml.xml.xslt
rss10.xml.tmpl
rss20.xml.tmpl
validate.html.xslt
template_directories:
../../../trunk/themes/common
bill_of_materials:
.htaccess
personalize.js
planet.css
query.js
img/background.jpg
img/bullet_utility.png
img/feed-icon.png
img/feed-icon-10x10.png
img/foaf-icon.png
img/footer.jpg
img/header-bg.jpg
img/header-dino.jpg
img/logo.png
img/mozilla-16.png
img/opml-icon.png
img/sidebar-back.png
img/sidebar-bottom.png
img/tcosm11.gif
img/world.png

Двоичные данные
branches/participation/theme/img/background.jpg Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 108 KiB

Двоичные данные
branches/participation/theme/img/bullet_utility.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 94 B

Двоичные данные
branches/participation/theme/img/feed-icon-10x10.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 469 B

Двоичные данные
branches/participation/theme/img/feed-icon.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 552 B

Двоичные данные
branches/participation/theme/img/foaf-icon.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 4.6 KiB

Двоичные данные
branches/participation/theme/img/footer.jpg Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 111 KiB

Двоичные данные
branches/participation/theme/img/header-bg.jpg Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 619 B

Двоичные данные
branches/participation/theme/img/header-dino.jpg Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 5.9 KiB

Двоичные данные
branches/participation/theme/img/logo.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 4.6 KiB

Двоичные данные
branches/participation/theme/img/mozilla-16.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 580 B

Двоичные данные
branches/participation/theme/img/opml-icon.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 31 KiB

Двоичные данные
branches/participation/theme/img/sidebar-back.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 12 KiB

Двоичные данные
branches/participation/theme/img/sidebar-bottom.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.1 KiB

Двоичные данные
branches/participation/theme/img/tcosm11.gif Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 203 B

Двоичные данные
branches/participation/theme/img/world.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.0 KiB

Просмотреть файл

@ -0,0 +1,362 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:planet="http://planet.intertwingly.net/"
xmlns="http://www.w3.org/1999/xhtml"
exclude-result-prefixes="atom planet xhtml">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:template match="atom:feed">
<xsl:text disable-output-escaping="yes">&lt;!DOCTYPE html&gt;</xsl:text>
<html xmlns="http://www.w3.org/1999/xhtml">
<!-- head -->
<head>
<title><xsl:value-of select='atom:title'/></title>
<meta charset='utf-8'/>
<meta name='generator' content='{atom:generator}'/>
<link href='planet.css' rel='stylesheet' type='text/css'/>
<link href='img/mozilla-16.png' rel='shortcut icon' type='image/png'/>
<xsl:if test='atom:link[@rel="self"]/@type'>
<link rel='alternate' href='{atom:link[@rel="self"]/@href}'
title='{atom:title/text()}' type='{atom:link[@rel="self"]/@type}'/>
</xsl:if>
<script defer="defer" type="text/javascript" src="personalize.js">
<xsl:comment><!--HTML Compatibility--></xsl:comment>
</script>
<script defer="defer" type="text/javascript" src="query.js">
<xsl:comment><!--HTML Compatibility--></xsl:comment>
</script>
</head>
<body>
<div id='utility'>
<p><strong>Looking For</strong></p>
<ul>
<li><a href='http://www.mozilla.org/'>mozilla.org</a></li>
<li><a href='https://wiki.mozilla.org/'>Wiki</a></li>
<li><a href='https://developer.mozilla.org/'>Developer Center</a></li>
<li><a href='http://www.firefox.com/'>Firefox</a></li>
<li><a href='http://www.getthunderbird.com/'>Thunderbird</a></li>
</ul>
</div>
<div id='header'>
<div id='dino'>
<h1>
<a href='/' title='Back to home page'><xsl:value-of select='atom:title'/></a>
</h1>
</div>
</div>
<div class='main-content'>
<xsl:for-each select='atom:entry'>
<!-- date header -->
<xsl:variable name="date" select="substring(atom:updated,1,10)"/>
<xsl:if test="not(preceding-sibling::atom:entry
[substring(atom:updated,1,10) = $date])">
<h2>
<time datetime="{$date}">
<xsl:value-of select="substring-before(atom:updated/@planet:format,', ')"/>
<xsl:text>, </xsl:text>
<xsl:value-of select="substring-before(substring-after(atom:updated/@planet:format,', '), ' ')"/>
</time>
</h2>
</xsl:if>
<div class="news {atom:source/planet:css-id}">
<xsl:if test="@xml:lang">
<xsl:attribute name="xml:lang">
<xsl:value-of select="@xml:lang"/>
</xsl:attribute>
</xsl:if>
<!-- entry title -->
<h3>
<xsl:if test="atom:source/atom:icon">
<img src="{atom:source/atom:icon}" class="icon"/>
</xsl:if>
<a>
<xsl:if test="atom:source/atom:link[@rel='alternate']/@href">
<xsl:attribute name="href">
<xsl:value-of
select="atom:source/atom:link[@rel='alternate']/@href"/>
</xsl:attribute>
</xsl:if>
<xsl:attribute name="title">
<xsl:value-of select="atom:source/atom:title"/>
</xsl:attribute>
<xsl:value-of select="atom:source/planet:name"/>
</a>
<xsl:if test="string-length(atom:title) &gt; 0">
<xsl:text> &#x2014; </xsl:text>
<a href="{atom:link[@rel='alternate']/@href}">
<xsl:if test="atom:title/@xml:lang != @xml:lang">
<xsl:attribute name="xml:lang" select="{atom:title/@xml:lang}"/>
</xsl:if>
<xsl:value-of select="atom:title"/>
</a>
</xsl:if>
</h3>
<!-- entry content -->
<div class='entry'>
<xsl:choose>
<xsl:when test="atom:content">
<xsl:apply-templates select="atom:content"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="atom:summary"/>
</xsl:otherwise>
</xsl:choose>
</div>
<!-- entry footer -->
<div class="permalink">
<xsl:if test="atom:link[@rel='license'] or
atom:source/atom:link[@rel='license'] or
atom:rights or atom:source/atom:rights">
<a>
<xsl:if test="atom:source/atom:link[@rel='license']/@href">
<xsl:attribute name="rel">license</xsl:attribute>
<xsl:attribute name="href">
<xsl:value-of select="atom:source/atom:link[@rel='license']/@href"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="atom:link[@rel='license']/@href">
<xsl:attribute name="rel">license</xsl:attribute>
<xsl:attribute name="href">
<xsl:value-of select="atom:link[@rel='license']/@href"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="atom:source/atom:rights">
<xsl:attribute name="title">
<xsl:value-of select="atom:source/atom:rights"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="atom:rights">
<xsl:attribute name="title">
<xsl:value-of select="atom:rights"/>
</xsl:attribute>
</xsl:if>
<xsl:text>&#169;</xsl:text>
</a>
<xsl:text> </xsl:text>
</xsl:if>
<a href="{atom:link[@rel='alternate']/@href}">
<xsl:choose>
<xsl:when test="atom:author/atom:name">
<xsl:if test="not(atom:link[@rel='license'] or
atom:source/atom:link[@rel='license'] or
atom:rights or atom:source/atom:rights)">
<xsl:text>by </xsl:text>
</xsl:if>
<xsl:value-of select="atom:author/atom:name"/>
<xsl:text> at </xsl:text>
</xsl:when>
<xsl:when test="atom:source/atom:author/atom:name">
<xsl:if test="not(atom:link[@rel='license'] or
atom:source/atom:link[@rel='license'] or
atom:rights or atom:source/atom:rights)">
<xsl:text>by </xsl:text>
</xsl:if>
<xsl:value-of select="atom:source/atom:author/atom:name"/>
<xsl:text> at </xsl:text>
</xsl:when>
</xsl:choose>
<time datetime="{atom:updated}" title="GMT">
<xsl:value-of select="atom:updated/@planet:format"/>
</time>
</a>
</div>
</div>
</xsl:for-each>
</div>
<div class='sidebar'>
<div class='disclaimer'>
<h2><xsl:value-of select='atom:title'/></h2>
<p>Collected here are the most recent blog posts from all over the Mozilla community.
The content here is unfiltered and uncensored, and represents the views of individual community members.
Individual posts are owned by their authors -- see original source for licensing information.</p>
</div>
<div class='feeds'>
<h2>Subscribe to Planet</h2>
<p>Feeds:</p>
<ul>
<li><a href='atom.xml'>Atom</a></li>
<li><a href='rss20.xml'>RSS 2.0</a></li>
<li><a href='rss10.xml'>RSS 1.0</a></li>
</ul>
<p/>
<p>Subscription list:</p>
<ul>
<li class='foaf'><a href='foafroll.xml'>FOAF</a></li>
<li class='opml'><a href='opml.xml'>OPML</a></li>
</ul>
<p>Last update: <time datetime="{atom:updated}" title="GMT">
<xsl:value-of select='atom:updated/@planet:format'/></time></p>
</div>
<div class='main'>
<h2>Other Planets</h2>
<ul class='planets'>
<li><a href='http://planet.mozilla.org/projects/'>Projects</a></li>
<li><a href='http://planet.firefox.com/'>Planet Firefox</a></li>
<li><a href='http://planet.firefox.com/mobile/'>Planet Firefox Mobile</a></li>
<li><a href='http://planet.firefox.com/os/'>Planet FirefoxOS</a></li>
<li><a href='http://planet.mozilla.org/thunderbird/'>Planet Thunderbird</a></li>
<li><a href='http://planet.bugzilla.org/'>Planet Bugzilla</a></li>
<li><a href='http://ux.firefox.com/'>Planet UX</a></li>
<li><a href='https://quality.mozilla.org/'>Planet QMO</a></li>
<li><a href='http://planet.mozilla.org/ateam/'>Planet Automation</a></li>
<li><a href='http://education.mozilla.org/planet/'>Mozilla Education</a></li>
<li><a href='http://planet.mozilla.org/interns/'>Mozilla Interns</a></li>
<li><a href='http://planet.mozilla.org/research/'>Mozilla Research</a></li>
<li><a href='http://mozilla.com.cn/topic/3/'>Mozilla Online (Chinese)</a></li>
</ul>
<div id='sidebar'/>
<h2>Subscriptions</h2>
<ul class='subscriptions'>
<xsl:for-each select="planet:source">
<xsl:sort select="planet:name"/>
<xsl:variable name="id" select="atom:id"/>
<xsl:variable name="posts"
select="/atom:feed/atom:entry[atom:source/atom:id = $id]"/>
<li>
<!-- icon -->
<a title="subscribe">
<xsl:choose>
<xsl:when test="planet:http_location">
<xsl:attribute name="href">
<xsl:value-of select="planet:http_location"/>
</xsl:attribute>
</xsl:when>
<xsl:when test="atom:link[@rel='self']/@href">
<xsl:attribute name="href">
<xsl:value-of select="atom:link[@rel='self']/@href"/>
</xsl:attribute>
</xsl:when>
</xsl:choose>
<img src="img/feed-icon-10x10.png" alt="(feed)"/>
</a>
<xsl:text> </xsl:text>
<!-- name -->
<a>
<xsl:if test="atom:link[@rel='alternate']/@href">
<xsl:attribute name="href">
<xsl:value-of select="atom:link[@rel='alternate']/@href"/>
</xsl:attribute>
</xsl:if>
<xsl:choose>
<xsl:when test="planet:message">
<xsl:attribute name="class">
<xsl:if test="$posts">active message</xsl:if>
<xsl:if test="not($posts)">message</xsl:if>
</xsl:attribute>
<xsl:attribute name="title">
<xsl:value-of select="planet:message"/>
</xsl:attribute>
</xsl:when>
<xsl:when test="atom:title">
<xsl:attribute name="title">
<xsl:value-of select="atom:title"/>
</xsl:attribute>
<xsl:if test="$posts">
<xsl:attribute name="class">active</xsl:attribute>
</xsl:if>
</xsl:when>
</xsl:choose>
<xsl:value-of select="planet:name"/>
</a>
<xsl:if test="$posts[string-length(atom:title) &gt; 0]">
<ul>
<xsl:for-each select="$posts">
<xsl:if test="string-length(atom:title) &gt; 0">
<li>
<a href="{atom:link[@rel='alternate']/@href}">
<xsl:if test="atom:title/@xml:lang != @xml:lang">
<xsl:attribute name="xml:lang"
select="{atom:title/@xml:lang}"/>
</xsl:if>
<xsl:value-of select="atom:title"/>
</a>
</li>
</xsl:if>
</xsl:for-each>
</ul>
</xsl:if>
</li>
</xsl:for-each>
</ul>
<div class='bottom'/>
</div>
</div>
<div id='footer'>
<div id='footer-content'>
<p>Maintained by the <a href='https://bugzilla.mozilla.org/enter_bug.cgi?product=Websites&amp;component=planet.mozilla.org'>Planet Mozilla Module Team</a>. Powered by <a href='http://www.intertwingly.net/code/venus/'>Planet Venus</a>. View our <a href='http://www.mozilla.org/about/policies/privacy-policy.html'>Privacy Policy</a>.</p>
</div>
</div>
</body>
</html>
</xsl:template>
<!-- xhtml content -->
<xsl:template match='atom:content/xhtml:div | atom:summary/xhtml:div'>
<xsl:copy>
<xsl:if test='../@xml:lang and not(../@xml:lang = ../../@xml:lang)'>
<xsl:attribute name='xml:lang'>
<xsl:value-of select='../@xml:lang'/>
</xsl:attribute>
</xsl:if>
<xsl:attribute name='class'>content</xsl:attribute>
<xsl:apply-templates select='@*|node()'/>
</xsl:copy>
</xsl:template>
<!-- plain text content -->
<xsl:template match='atom:content/text() | atom:summary/text()'>
<div class='content' xmlns='http://www.w3.org/1999/xhtml'>
<xsl:if test='../@xml:lang and not(../@xml:lang = ../../@xml:lang)'>
<xsl:attribute name='xml:lang'>
<xsl:value-of select='../@xml:lang'/>
</xsl:attribute>
</xsl:if>
<xsl:copy-of select='.'/>
</div>
</xsl:template>
<!-- Remove stray atom elements -->
<xsl:template match='atom:*'>
<xsl:apply-templates/>
</xsl:template>
<!-- Feedburner detritus -->
<xsl:template match="xhtml:div[@class='feedflare']"/>
<!-- Strip site meter -->
<xsl:template match="xhtml:div[comment()[. = ' Site Meter ']]"/>
<!-- pass through everything else -->
<xsl:template match='@*|node()'>
<xsl:copy>
<xsl:apply-templates select='@*|node()'/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>

Просмотреть файл

@ -0,0 +1,301 @@
var entries = []; // list of news items
var days = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday",
"Friday", "Saturday"];
var months = ["January", "February", "March", "April", "May", "June", "July",
"August", "September", "October", "November", "December"];
// event complete: stop propagation of the event
function stopPropagation(event) {
if (event.preventDefault) {
event.preventDefault();
event.stopPropagation();
} else {
event.returnValue = false;
}
}
// scroll back to the previous article
function prevArticle(event) {
var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
for (var i=entries.length; --i>=0;) {
if (!entries[i].anchor) continue;
if (entries[i].anchor.offsetTop+20 < scrollTop) {
window.location.hash=entries[i].anchor.id;
stopPropagation(event);
break;
}
}
}
// advance to the next article
function nextArticle(event) {
var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
for (var i=1; i<entries.length; i++) {
if (!entries[i].anchor) continue;
if (entries[i].anchor.offsetTop-20 >scrollTop) {
window.location.hash=entries[i].anchor.id;
stopPropagation(event);
break;
}
}
}
// process keypresses
function navkey(event) {
var checkbox = document.getElementById('navkeys');
if (!checkbox || !checkbox.checked) return;
if (!event) event=window.event;
if (event.originalTarget &&
event.originalTarget.nodeName.toLowerCase() == 'input' &&
event.originalTarget.id != 'navkeys') return;
if (!document.documentElement) return;
if (!entries[0].anchor || !entries[0].anchor.offsetTop) return;
key=event.keyCode;
if (key == 'N'.charCodeAt(0)) nextArticle(event);
if (key == 'P'.charCodeAt(0)) prevArticle(event);
}
// create (or reset) a cookie
function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}
// read a cookie
function readCookie(name) {
var nameEQ = name + "=";
if (!document.cookie) return;
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}
// each time the value of the option changes, update the cookie
function selectOption() {
var checkbox = document.getElementById('navkeys');
if (!checkbox) return;
createCookie("navkeys", checkbox.checked?'true':'false', 365);
}
// add navkeys option to sidebar
function addOption(event) {
var sidebar = document.getElementById('sidebar');
if (!sidebar) return;
var h2 = null;
for (var i=entries.length; --i>=0;) {
if (document.getElementById("news-" + i)) break;
if (entries[i].parent.offsetTop > 0) {
var a = entries[i].anchor = document.createElement('a');
a.id = "news-" + i;
entries[i].parent.insertBefore(a, entries[i].parent.firstChild);
if (h2 == null) h2 = document.createElement('h2');
}
}
if (h2 != null && !document.getElementById("navkeys")) {
h2.appendChild(document.createTextNode('Options'));
sidebar.appendChild(h2);
var form = document.createElement('form');
var p = document.createElement('p');
var input = document.createElement('input');
input.type = "checkbox";
input.id = "navkeys";
p.appendChild(input);
var a = document.createElement('a');
a.title = "Navigate entries";
a.appendChild(document.createTextNode('Enable '));
var code = document.createElement('code');
code.appendChild(document.createTextNode('N'));
a.appendChild(code);
a.appendChild(document.createTextNode(' and '));
code = document.createElement('code');
code.appendChild(document.createTextNode('P'));
a.appendChild(code);
a.appendChild(document.createTextNode(' keys'));
p.appendChild(a);
form.appendChild(p);
sidebar.appendChild(form);
var cookie = readCookie("navkeys");
if (cookie && cookie == 'true') input.checked = true;
input.onclick = selectOption;
document.onkeydown = navkey;
}
}
// Parse an HTML5-liberalized version of RFC 3339 datetime values
Date.parseRFC3339 = function (string) {
var date=new Date();
date.setTime(0);
var match = string.match(/(\d{4})-(\d\d)-(\d\d)\s*(?:[\sT]\s*(\d\d):(\d\d)(?::(\d\d))?(\.\d*)?\s*(Z|([-+])(\d\d):(\d\d))?)?/);
if (!match) return;
if (match[2]) match[2]--;
if (match[7]) match[7] = (match[7]+'000').substring(1,4);
var field = [null,'FullYear','Month','Date','Hours','Minutes','Seconds','Milliseconds'];
for (var i=1; i<=7; i++) if (match[i]) date['setUTC'+field[i]](match[i]);
if (match[9]) date.setTime(date.getTime()+
(match[9]=='-'?1:-1)*(match[10]*3600000+match[11]*60000) );
return date.getTime();
}
// convert datetime to local date
var localere = /^(\w+) (\d+) (\w+) \d+ 0?(\d\d?:\d\d):\d\d ([AP]M) (EST|EDT|CST|CDT|MST|MDT|PST|PDT)/;
function localizeDate(element) {
var date = new Date();
date.setTime(Date.parseRFC3339(element.getAttribute('datetime')));
if (!date.getTime()) return;
var local = date.toLocaleString();
if (element.parentNode.nodeName == 'a') local = date.toLocaleTimeString();
var match = local.match(localere);
if (match) { /* Firefox */
element.innerHTML = match[4] + ' ' + match[5].toLowerCase();
element.title = match[6] + " \u2014 " +
match[1] + ', ' + match[3] + ' ' + match[2];
return days[date.getDay()] + ', ' + months[date.getMonth()] + ' ' +
date.getDate() + ', ' + date.getFullYear();
} else {
local = local.replace(/ GMT(-\d\d\d\d) \(.*\)$/, ''); /* Webkit */
element.title = element.innerHTML + ' GMT';
element.innerHTML = local;
return days[date.getDay()] + ', ' + date.getDate() + ' ' +
months[date.getMonth()] + ' ' + date.getFullYear();
}
}
// find entries (and localizeDates)
function findEntries() {
var times = document.getElementsByTagName('time');
for (var i=0; i<times.length; i++) {
if (times[i].title == "GMT") {
var date = localizeDate(times[i]);
var parent = times[i];
while (parent &&
(!parent.className || parent.className.split(' ')[0] != 'news')) {
parent = parent.parentNode;
}
if (parent) {
var info = entries[entries.length] = new Object();
info.parent = parent;
info.date = date;
info.datetime = times[i].getAttribute('datetime').substring(0,10);
}
}
}
}
// insert/remove date headers to indicate change of date in local time zone
function moveDateHeaders() {
var lastdate = ''
for (var i=0; i<entries.length; i++) {
var parent = entries[i].parent;
var date = entries[i].date;
sibling = parent.previousSibling;
while (sibling && sibling.nodeType != 1) {
sibling = sibling.previousSibling;
}
if (sibling && sibling.nodeName.toLowerCase() == 'h2') {
if (lastdate == date) {
sibling.parentNode.removeChild(sibling);
} else {
sibling.childNodes[0].innerHTML = date;
sibling.childNodes[0].setAttribute('datetime',entries[i].datetime);
lastdate = date;
}
} else if (lastdate != date) {
var h2 = document.createElement('h2');
var time = document.createElement('time');
time.setAttribute('datetime',entries[i].datetime);
time.appendChild(document.createTextNode(date));
h2.appendChild(time);
parent.parentNode.insertBefore(h2, parent);
lastdate = date;
}
}
}
function moveSidebar() {
var sidebar = document.getElementById('sidebar');
if (sidebar.currentStyle && sidebar.currentStyle['float'] == 'none') return;
if (window.getComputedStyle && document.defaultView.getComputedStyle(sidebar,null).getPropertyValue('float') == 'none') return;
var h1 = sidebar.previousSibling;
while (h1.nodeType != 1) h1=h1.previousSibling;
if (h1.nodeName.toLowerCase() == 'h1') h1.parentNode.removeChild(h1);
var footer = document.getElementById('footer');
var ul = footer.lastChild;
while (ul.nodeType != 1) ul=ul.previousSibling;
var twisty = document.createElement('a');
twisty.appendChild(document.createTextNode('\u25bc'));
twisty.title = 'hide';
twisty.onclick = function() {
var display = 'block';
if (this.childNodes[0].nodeValue == '\u25ba') {
this.title = 'hide';
this.childNodes[0].nodeValue = '\u25bc';
} else {
this.title = 'show';
this.childNodes[0].nodeValue = '\u25ba';
display = 'none';
}
ul.style.display = display;
createCookie("subscriptions", display, 365);
}
var cookie = readCookie("subscriptions");
if (cookie && cookie == 'none') twisty.onclick();
for (var node=footer.lastChild; node; node=footer.lastChild) {
if (twisty && node.nodeType == 1 && node.nodeName.toLowerCase() == 'h2') {
node.appendChild(twisty);
twisty = null;
}
footer.removeChild(node);
sidebar.insertBefore(node, sidebar.firstChild);
}
var body = document.getElementById('body');
sidebar.parentNode.removeChild(sidebar);
body.parentNode.insertBefore(sidebar, body);
body.style.marginRight = 0;
}
// adjust dates to local time zones, optionally provide navigation keys
function personalize() {
//moveSidebar();
findEntries();
addOption();
moveDateHeaders();
}
// hook event
if (document.getElementById('footer')) {
personalize();
} else {
document.addEventListener("DOMContentLoaded", personalize, false);
}

Просмотреть файл

@ -0,0 +1,248 @@
* {
line-height: 1.4;
padding: 0;
}
ul,
ol {
padding-left: 22px;
}
body {
margin: 0;
padding: 0;
font-family: Helvetica, Arial, Verdana, sans-serif;
background: #ffffff url('img/background.jpg') no-repeat scroll left top;
color: #000;
}
a {
color: #148cb5;
text-decoration: none;
}
a:hover {
color: #148cb5;
text-decoration: underline;
}
#header {
margin: 10px 0 0 96px;
height: 101px;
background: url('img/header-bg.jpg');
}
#header #dino {
background: url('img/header-dino.jpg') no-repeat;
height: 101px;
width: 300px;
}
#header h1 {
padding: 0;
margin: 0;
background: transparent url('img/logo.png') no-repeat 20px 35px;
z-index: 1;
height: 101px;
}
#header h1 a {
display: block;
text-indent: -9999px;
background: transparent url('img/logo.png') no-repeat 20px 35px;
overflow: hidden;
width: 265px;
height: 101px;
}
#utility {
font-family: "Trebuchet MS", sans-serif;
font-size: 62.5%;
margin: 0.8em 0 0.7em 30px;
text-align: right;
text-transform: uppercase;
letter-spacing: 0.1em;
padding: 3px 30px 0 0;
}
#utility * {
display: inline;
}
#utility p {
margin-right: -20px;
}
#utility strong {
color: #000;
font-size: 11px;
}
#utility ul {
margin-left: 10px;
}
#utility li {
background: transparent url('img/bullet_utility.png') no-repeat 4px center;
padding-left: 16px;
font-size: 11px;
}
#utility li:first-child {
background: none;
padding: 0;
} /* @todo: needs ie fixing */
.main-content {
margin-left: 116px;
margin-right: 260px;
}
h2 {
font-family: Georgia, Times, "Times New Roman", serif;
font-weight: normal;
font-size: 1.75em;
color: #b72822;
margin-bottom: 0;
}
h3 {
margin-top: 10px;
border-bottom: 1px solid #ccc;
}
h3 a {
color: black;
}
h4 {
margin: 0 0 0 15px;
border-bottom: 1px solid #ccc;
}
h4 a {
color: black;
}
.entry {
margin-left: 15px;
}
.news .permalink {
text-align: right;
}
.news img {max-width:100% !important;}
#footer {
background-image: url('img/footer.jpg');
background-position: center;
background-repeat: no-repeat;
height: 207px;
}
#footer-content {
margin-left: auto;
margin-right: auto;
padding-top: 100px;
max-width: 1150px;
}
#footer-content p {
text-align: center;
padding: 5px;
background-color: #2a2a2a;
color: #999999;
font-size: 0.9em;
}
.sidebar {
position: absolute;
top: 135px;
right: 0px;
width: 230px;
margin: 0 15px 0 0;
padding: 20px 0 0 0;
font-size: 70%;
}
.sidebar .feeds,
.sidebar .disclaimer {
padding-left: 15px;
}
.sidebar .feeds p {
padding: 0;
margin: 5px 0 0 0;
}
.sidebar .feeds ul {
padding-left: 10px;
}
.sidebar .feeds li {
margin: 0;
padding: 0px;
display: inline;
}
.sidebar .feeds li {
background-image: url('img/feed-icon.png');
background-repeat: no-repeat;
background-position: 0 50%;
padding: 3px 10px 3px 15px;
margin: .4em 0;
}
.sidebar .feeds li.opml {
background-image: url('img/opml-icon.png');
background-repeat: no-repeat;
background-position: 0 50%;
padding: 3px 10px 3px 15px;
margin: .4em 0;
}
.sidebar .feeds li.foaf {
background-image: url('img/foaf-icon.png');
background-repeat: no-repeat;
background-position: 0 50%;
padding: 3px 10px 3px 24px;
margin: .4em 0;
}
.sidebar .main {
background: transparent url('img/sidebar-back.png') no-repeat left top;
/*border-top:5px solid #0095B9;*/
/*min-height:438px; padding:20px;*/
padding: 15px 0 0 15px;
}
.sidebar .main ul.planets {
list-style-image:url('img/world.png');
padding-left: 35px;
}
.sidebar .main ul.planets li {
font-size: 1.3em;
}
.sidebar .main ul.subscriptions li img {
border: 0;
}
.sidebar .main .bottom {
height: 28px;
width: 100%;
background: transparent url('img/sidebar-bottom.png') no-repeat 50% bottom;
padding-bottom: 30px;
}
.sidebar .message {
cursor: help;
border-bottom: 1px dashed red;
}
.sidebar a.message:hover {
cursor: help;
background-color: #ffD0D0;
border: 1px dashed red !important;
text-decoration: none !important;
}

Просмотреть файл

@ -0,0 +1,283 @@
function ns(prefix) {
if (prefix == 'atom') return 'http://www.w3.org/2005/Atom';
if (prefix == 'xhtml') return 'http://www.w3.org/1999/xhtml';
if (prefix == 'planet') return 'http://planet.intertwingly.net/';
return null;
}
function xpath1(node, path) {
return node.ownerDocument.evaluate(path, node, ns,
XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
}
function xpath(node, path) {
return node.ownerDocument.evaluate(path, node, ns,
XPathResult.ORDERED_NODE_ITERATOR_TYPE, null);
}
function copyChildren(source, dest) {
for (var i=0; i<source.childNodes.length; i++) {
dest.appendChild(dest.ownerDocument.importNode(source.childNodes[i], true));
}
}
var query = null;
document.waitmessage = null;
var subs = new Array()
function waitmessage(parent) {
if (document.waitmessage) return;
var span = document.createElement('span');
span.style.backgroundColor='#F00';
span.style.color='#FFF';
span.appendChild(document.createTextNode('Please wait...'));
parent.appendChild(span);
document.getElementById('submit').disabled = true;
document.waitmessage = span;
}
function fetch() {
if (!query || (document.waitmessage &&
window.pageYOffset+window.innerHeight*1.5 < document.waitmessage.offsetTop))
{
var submit = document.getElementById('submit');
if (submit) submit.disabled = false;
return setTimeout(fetch,500);
}
var results = document.getElementById('body');
var xhtml = 'http://www.w3.org/1999/xhtml';
var xhr = new XMLHttpRequest();
waitmessage(results);
xhr.open("POST", "atom", true);
xhr.onreadystatechange = function() {
if (xhr.readyState != 4) {return;}
if (document.waitmessage) {
results.removeChild(document.waitmessage);
document.waitmessage = null;
}
var footer = document.getElementById('sidebar');
footer = xpath1(footer, 'xhtml:ul');
xhr.responseXML.normalize();
var entries = xpath(xhr.responseXML.documentElement, 'atom:entry');
var olddate = '';
for (var entry=entries.iterateNext(); entry; entry=entries.iterateNext()) {
var news = document.createElementNS(xhtml,'div');
news.className = 'news';
var head = document.createElement('h3');
news.appendChild(head);
var source = xpath1(entry, 'atom:source');
var icon = xpath1(source, 'atom:icon');
if (icon) {
var img = document.createElement('img');
img.src = icon.childNodes[0].nodeValue;
img.className = 'icon';
head.appendChild(img);
}
var name = xpath1(source, 'planet:name');
if (!name) title = xpath1(source, 'atom:title');
if (name) {
var a = document.createElement('a');
copyChildren(name,a);
var link = xpath1(source, 'atom:link[@rel="alternate"]');
if (link) a.href=link.getAttribute('href');
head.appendChild(a);
head.appendChild(document.createTextNode(' \u2014 '));
}
var a = document.createElement('a');
var title = xpath1(entry, 'atom:title');
if (title) copyChildren(title,a);
var link = xpath1(entry, 'atom:link[@rel="alternate"]');
if (link) a.href=link.getAttribute('href');
head.appendChild(a);
var content = xpath1(entry, 'atom:content');
if (!content) content = xpath1(entry, 'atom:summary');
if (content) {
if (content.childNodes[0].nodeName == 'div') {
content = content.childNodes[0];
}
var div = document.createElement('div');
div.className = 'content';
copyChildren(content,div);
news.appendChild(div);
}
var permalink = document.createElement('div');
permalink.className = 'permalink';
var a = document.createElement('a');
var link = xpath1(source, 'atom:link[@rel="alternate"]');
if (link) a.href=link.getAttribute('href');
if (name) {
a.appendChild(document.createTextNode('by '));
copyChildren(name,a);
}
var updated = xpath1(entry, 'atom:updated');
if (updated) {
a.appendChild(document.createTextNode(' at '));
var date = document.createElement('time');
date.setAttribute('title','GMT');
date.setAttribute('datetime',updated.childNodes[0].nodeValue);
if (updated.hasAttribute('planet:format')) {
date.appendChild(document.createTextNode(
updated.getAttribute('planet:format')));
}
a.appendChild(date);
}
permalink.appendChild(a);
news.appendChild(permalink);
results.appendChild(news);
if (footer) {
if (name) {
name = name.childNodes[0].nodeValue;
var prev = null;
var node = null;
for (var i=0; i<subs.length; i++) {
if (subs[i][0] == name) {
node = subs[i][1];
} else if (subs[i][0] > name &&
(prev == null || subs[prev][0] > subs[i][0])) {
prev = i;
}
}
if (!node) {
var li = document.createElement('li');
var a = document.createElement('a');
a.title = "subscribe";
var feed = xpath1(source, 'atom:link[@rel="self"]');
if (feed) a.href = feed.getAttribute('href');
var img = document.createElement('img');
img.src="images/feed-icon-10x10.png";
img.title="(feed)";
a.appendChild(img);
li.appendChild(a);
li.appendChild(document.createTextNode(' '));
var a = document.createElement('a');
if (link) a.href=link.getAttribute('href');
a.appendChild(document.createTextNode(name));
li.appendChild(a);
if (prev == null) {
footer.appendChild(li);
} else {
footer.insertBefore(li, subs[prev][1]);
}
li.appendChild(document.createElement('ul'));
subs[subs.length] = new Array(name, node=li);
}
var ul = node.childNodes[node.childNodes.length-1];
var li = document.createElement('li');
var a = document.createElement('a');
if (title) copyChildren(title,a);
var link = xpath1(entry, 'atom:link[@rel="alternate"]');
if (link) a.href=link.getAttribute('href');
li.appendChild(a);
ul.appendChild(li);
}
}
}
var bookmark = xpath1(xhr.responseXML.documentElement, 'planet:bookmark');
query = '';
if (bookmark) {
for (var i=0; i<bookmark.attributes.length; i++) {
var attr = bookmark.attributes[i];
query += '&' + encodeURIComponent(attr.nodeName) + '=' +
encodeURIComponent(attr.nodeValue);
}
}
findEntries();
moveDateHeaders();
var stats = xpath1(xhr.responseXML.documentElement, 'planet:stats');
if (stats) {
if (stats.hasAttribute('scanned')) {
var stat = document.getElementById('stats-scanned');
if (stat) {
stat.innerHTML = Math.floor(stat.innerHTML) +
Math.floor(stats.getAttribute('scanned'));
}
}
if (stats.hasAttribute('found')) {
var stat = document.getElementById('stats-found');
if (stat) {
stat.innerHTML = Math.floor(stat.innerHTML) +
Math.floor(stats.getAttribute('found'));
}
}
if (stats.hasAttribute('date')) {
var stat = document.getElementById('stats-date');
if (stat) {
stat.innerHTML = stats.getAttribute('date');
}
}
}
if (query.length) {
query = query.slice(1,query.length);
waitmessage(results);
} else {
query = null;
}
setTimeout(fetch,200);
}
xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
xhr.send(query);
}
fetch();
function startQuery(textarea) {
query = 'query=' + encodeURIComponent(textarea);
var results = xpath(document.documentElement,
'//xhtml:div[@class="news"] | //div[@class="news"] | //xhtml:h2[@class="date"]');
trash = new Array();
for (var node=results.iterateNext(); node; node=results.iterateNext()) {
trash.push(node);
}
for (var i=0; i<subs.length; i++) {
trash.push(subs[i][1]);
}
subs = new Array();
for (var i=0; i<trash.length; i++) {
trash[i].parentNode.removeChild(trash[i]);
}
document.getElementById('stats-scanned').innerHTML = '0';
document.getElementById('stats-found').innerHTML = '0';
// fetch();
}
if (document.addEventListener) {
autoSearch = function() {
if (document.location.search) {
var args = document.location.search.substring(1).split('&');
for (var i=0; i<args.length; i++) {
var item = args[i].split('=',2);
if (unescape(item[0]) == 'q') {
value = decodeURIComponent(item[1]);
value = value.replace('+',' ').replace(/\s+$/,'');
if (value.length) {
startQuery(document.forms['query'].q.value = value);
break;
}
}
}
}
};
document.addEventListener("DOMContentLoaded", autoSearch, false);
}