diff options
Diffstat (limited to 'unclutter')
-rw-r--r-- | unclutter/duckduckgo.xsl | 24 | ||||
-rw-r--r-- | unclutter/github.xsl | 77 | ||||
-rw-r--r-- | unclutter/hacker-news.xsl | 33 | ||||
-rw-r--r-- | unclutter/lobsters.xsl | 20 | ||||
-rw-r--r-- | unclutter/mediawiki.xsl | 26 |
5 files changed, 180 insertions, 0 deletions
diff --git a/unclutter/duckduckgo.xsl b/unclutter/duckduckgo.xsl new file mode 100644 index 0000000..2bf6e2b --- /dev/null +++ b/unclutter/duckduckgo.xsl @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> + <xsl:output method="html" indent="yes"/> + <xsl:template match="/"> + <html> + <body> + DuckDuckGo + <xsl:for-each select="//tr[not(@class) or @class!='result-sponsored']"> + <xsl:for-each select="td/a[@class='result-link']"> + <br /> + <br /> + <a href="{@href}"> + <xsl:value-of select="." /> + </a> + </xsl:for-each> + <xsl:for-each select="td[@class='result-snippet']"> + <br /> + <xsl:value-of select="." /> + </xsl:for-each> + </xsl:for-each> + </body> + </html> + </xsl:template> +</xsl:stylesheet> diff --git a/unclutter/github.xsl b/unclutter/github.xsl new file mode 100644 index 0000000..c4e42d4 --- /dev/null +++ b/unclutter/github.xsl @@ -0,0 +1,77 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> + <xsl:output method="html" indent="yes"/> + + <xsl:template match="/"> + <html> + <body> + <xsl:apply-templates select="//div[@role='main']" /> + </body> + </html> + </xsl:template> + + <xsl:template match="nav[@role='navigation'] | ul[@class='numbers-summary'] | div[@class='repository-lang-stats']"> + <p> + <xsl:for-each select=".//a"> + <xsl:if test="position()>1"> + | + </xsl:if> + <a href="{@href}"> + <xsl:value-of select="." /> + </a> + </xsl:for-each> + </p> + </xsl:template> + + <!-- files --> + <xsl:template match="div[@class='file-wrap']"> + <div> + <xsl:for-each select=".//tr[position()>1]"> + <xsl:copy-of select="td[@class='content']//a" /> + (<xsl:copy-of select=".//time-ago" />) + <br/> + </xsl:for-each> + </div> + </xsl:template> + + <!-- code --> + <xsl:template match="table[@class='highlight tab-size js-file-line-container']"> + <pre> + <xsl:for-each select=".//td[@class='blob-code blob-code-inner js-file-line']"> + <xsl:value-of select="." /> + <xsl:text>
</xsl:text> + </xsl:for-each> + </pre> + </xsl:template> + + <!-- watch, star, fork --> + <xsl:template match="ul[@class='pagehead-actions']" /> + <!-- signup --> + <xsl:template match="div[@class='signup-prompt-bg rounded-1']" /> + <!-- languages, duplication --> + <xsl:template match="div[@class='repository-lang-stats-graph js-toggle-lang-stats']" /> + <!-- misc clutter --> + <xsl:template match="div[@class='js-socket-channel js-updatable-content']" /> + <xsl:template match="div[@class='mt-3 mb-2 text-center']" /> + <xsl:template match="div[@class='subnav']" /> + <!-- issue filters and such --> + <xsl:template match="div[@id='js-issues-toolbar']" /> + <!-- registration thing --> + <xsl:template match="div[@class='px-4']" /> + <!-- another "sign up for free" thing --> + <xsl:template match="div[@class='flash flash-warn mt-3']" /> + <!-- protips --> + <xsl:template match="div[@class='protip']" /> + <!-- branch selection, new PR, etc --> + <xsl:template match="div[@class='file-navigation in-mid-page']" /> + + + <!-- Catch-all: copy and apply templates --> + <xsl:template match="node()" priority="0"> + <xsl:copy> + <xsl:copy-of select="@*" /> + <xsl:apply-templates /> + </xsl:copy> + </xsl:template> + +</xsl:stylesheet> diff --git a/unclutter/hacker-news.xsl b/unclutter/hacker-news.xsl new file mode 100644 index 0000000..0f8c352 --- /dev/null +++ b/unclutter/hacker-news.xsl @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> + <xsl:output method="html" indent="yes"/> + <xsl:template match="/"> + <html> + <body> + Hacker News + <xsl:for-each select="//td[@class='title' or @class='subtext']"> + <xsl:choose> + <xsl:when test="@class = 'title'"> + <xsl:variable name="uri" select="a/@href"/> + <xsl:if test="$uri!=''"> + <br /> + <br /> + <a href="{$uri}" > + <xsl:value-of select="a" /> + </a> + </xsl:if> + </xsl:when> + <xsl:when test="@class = 'subtext'"> + <br/> + <xsl:value-of select="span[@class='age']" /> + | + <a href="{a[last()]/@href}"> + <xsl:value-of select="a[last()]" /> + </a> + </xsl:when> + </xsl:choose> + </xsl:for-each> + </body> + </html> + </xsl:template> +</xsl:stylesheet> diff --git a/unclutter/lobsters.xsl b/unclutter/lobsters.xsl new file mode 100644 index 0000000..92b58a7 --- /dev/null +++ b/unclutter/lobsters.xsl @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> + <xsl:output method="html" indent="yes"/> + <xsl:template match="/"> + <html> + <body> + Lobsters + <xsl:for-each select="//div[@class='details']"> + <p> + <xsl:copy-of select="span[@class='link']/a" /> + <br/> + <xsl:value-of select="div[@class='byline']/span[position()=1]" /> + | + <xsl:copy-of select="div[@class='byline']/span[@class='comments_label']/a" /> + </p> + </xsl:for-each> + </body> + </html> + </xsl:template> +</xsl:stylesheet> diff --git a/unclutter/mediawiki.xsl b/unclutter/mediawiki.xsl new file mode 100644 index 0000000..1b88b4a --- /dev/null +++ b/unclutter/mediawiki.xsl @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> + <xsl:output method="html" indent="yes"/> + + <xsl:template match="/"> + <html> + <body> + <xsl:apply-templates select="//div[@id='content']" /> + </body> + </html> + </xsl:template> + + <!-- Cut these out --> + <xsl:template match="span[@class='mw-editsection']" /> + <xsl:template match="ul[@id='page-actions']" /> + <xsl:template match="div[@class='mw-ui-icon mw-ui-icon-element indicator']" /> + <xsl:template match="a[@class='mw-ui-icon mw-ui-icon-element mw-ui-icon-edit-enabled edit-page']" /> + + <!-- Catch-all: copy and apply templates --> + <xsl:template match="node()" priority="0"> + <xsl:copy> + <xsl:copy-of select="@*" /> + <xsl:apply-templates /> + </xsl:copy> + </xsl:template> +</xsl:stylesheet> |