Cosmetic improvements

This commit is contained in:
Sam Ruby 2007-03-10 22:19:47 -05:00
parent 4b1ff4884e
commit 8f0551ae91
6 changed files with 102 additions and 16 deletions

25
filters/detitle.xslt Normal file
View File

@ -0,0 +1,25 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns="http://www.w3.org/1999/xhtml">
<!-- only retain titles that don't duplicate summary or content -->
<xsl:template match="atom:title">
<xsl:if test="string-length(.) &lt; 30 or
( substring(.,1,string-length(.)-3) !=
substring(../atom:content,1,string-length(.)-3) and
substring(.,1,string-length(.)-3) !=
substring(../atom:summary,1,string-length(.)-3) )">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:if>
</xsl:template>
<!-- pass through everything else -->
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>

30
filters/h1title.xslt Normal file
View File

@ -0,0 +1,30 @@
<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">
<!-- Replace title with value of h1, if present -->
<xsl:template match="atom:title">
<xsl:apply-templates select="@*"/>
<xsl:copy>
<xsl:choose>
<xsl:when test="count(//xhtml:h1) = 1">
<xsl:value-of select="normalize-space(//xhtml:h1)"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="node()"/>
</xsl:otherwise>
</xsl:choose>
</xsl:copy>
</xsl:template>
<!-- Remove all h1s -->
<xsl:template match="xhtml:h1"/>
<!-- pass through everything else -->
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>

View File

@ -30,11 +30,15 @@ a:active {
a:focus {
}
a.active {
a.inactive {
color: #558;
}
a.rising {
font-weight: bold;
}
h1 {
body > h1 {
font-size: x-large;
text-transform: uppercase;
letter-spacing: 0.25em;
@ -74,6 +78,11 @@ h1 {
border-bottom: 1px solid #ccc;
}
#sidebar h2 a img {
margin-bottom: 2px;
vertical-align: middle;
}
#sidebar p {
font-size: x-small;
padding-left: 20px;
@ -163,6 +172,10 @@ h1 {
text-decoration: none !important;
}
#sidebar input[name=q] {
margin: 4px 0 0 24px;
}
/* ---------------------------- Footer --------------------------- */
#footer ul {
@ -177,6 +190,10 @@ h1 {
display: inline;
}
#footer ul li ul {
display: none;
}
#footer img {
display: none;
}
@ -419,7 +436,7 @@ math[display=block] {
overflow: auto;
}
.eqno {
.numberedEq span, .eqno {
float: right;
}

View File

@ -40,7 +40,7 @@
<xsl:text>&#10;&#10;</xsl:text>
</div>
<h1>Subscriptions </h1>
<h1>Footnotes</h1>
<xsl:text>&#10;&#10;</xsl:text>
<div id="sidebar">
@ -80,6 +80,7 @@
<xsl:text>&#10;&#10;</xsl:text>
<div id="footer">
<h2>Subscriptions</h2>
<ul>
<xsl:for-each select="planet:source">
<xsl:sort select="planet:name"/>

View File

@ -45,11 +45,14 @@ function navkey(event) {
if (!checkbox || !checkbox.checked) return;
if (!event) event=window.event;
key=event.keyCode;
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 == 'J'.charCodeAt(0)) nextArticle(event);
if (key == 'K'.charCodeAt(0)) prevArticle(event);
}
@ -215,14 +218,12 @@ function moveSidebar() {
var h1 = sidebar.previousSibling;
while (h1.nodeType != 1) h1=h1.previousSibling;
h1.parentNode.removeChild(h1);
if (h1.nodeName.toLowerCase() == 'h1') h1.parentNode.removeChild(h1);
var footer = document.getElementById('footer');
var ul = footer.firstChild;
while (ul.nodeType != 1) ul=ul.nextSibling;
footer.removeChild(ul);
sidebar.insertBefore(ul, sidebar.firstChild);
var h2 = document.createElement('h2');
h2.appendChild(h1.firstChild);
var ul = footer.lastChild;
while (ul.nodeType != 1) ul=ul.previousSibling;
var twisty = document.createElement('a');
twisty.appendChild(document.createTextNode('\u25bc'));
twisty.title = 'hide';
@ -239,10 +240,19 @@ function moveSidebar() {
ul.style.display = display;
createCookie("subscriptions", display, 365);
}
var cookie = readCookie("subscriptions");
if (cookie && cookie == 'none') twisty.onclick();
h2.appendChild(twisty);
sidebar.insertBefore(h2, sidebar.firstChild);
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);

View File

@ -1,4 +1,5 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:access="http://www.bloglines.com/about/specs/fac-1.0"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:indexing="urn:atom-extension:indexing"
xmlns:planet="http://planet.intertwingly.net/"
@ -20,11 +21,13 @@
<!-- Strip site meter -->
<xsl:template match="xhtml:div[comment()[. = ' Site Meter ']]"/>
<!-- add Google/LiveJournal-esque noindex directive -->
<!-- add Google/LiveJournal-esque and Bloglines noindex directive -->
<xsl:template match="atom:feed">
<xsl:copy>
<xsl:attribute name="indexing:index">no</xsl:attribute>
<xsl:apply-templates select="@*|node()"/>
<xsl:apply-templates select="@*"/>
<access:restriction relationship="allow"/>
<xsl:apply-templates select="node()"/>
<xsl:text>&#10;</xsl:text>
</xsl:copy>
</xsl:template>