NetNewsWire style hack - Show web page instead of feed

Posted
9:59 PM 7 February 2008

This stylesheet for NetNewsWire loads the linked web page instead of displaying the feed itself. It is a simple hack born from a question posed to the NetNewsWire email group yesterday. So Jan, here’s your answer:

ollicle-wittrodt1.zip

Linked web page displayed in NetNewsWire HTML pane

Installation

Double-clicking the contained Ollicle Wittrodt.nnwstyle package will prompt NetNewsWire to install the style in your Library.

Select Ollicle Wittrodt from your styles menu to use it.

Note: If you haven’t already, you need to enable JavaScript for news items in NetNewsWire’s preferences for this style to do anything remotely special:

  • NetNewsWire Preferences
    • Browsing
      • News Items
        • Enable JavaScript

How it works

One line of JavaScript! Despite calling it a stylesheet it does not include a single line of CSS, just a very trim template file:

<div id="newsItemTitle">[[newsitem_title]]</div>
<script type="text/javascript">
    location.replace(document.getElementById('newsItemTitle').firstChild.getAttribute('href'));
</script>

Coming soon

For those of you who prefer their feed reading to be clean, consistent and snappy, I have been working on a slowly evolving and revamped version of Ollicle Reflex. It has some subtle niceties I am very much looking forward to sharing, so keep that browning ollicle.com feed in your list for a little longer yet.

Further thoughts

Comments

  1. Louije
    Commented
    9:59 PM 15 February 2008

    Pretty nice. Now, the next step would be setting per-feed style preferences in NNW. This way, one could fix the feeds that only display the beginning of the article. Thanks Oliver!

  2. autumnmist
    Commented
    9:59 PM 15 February 2008

    You inspired me to finally get around to making a style with this functionality. I copied your method of replacing the location of the page (thanks!) and added the ability to do this per-feed…. it’s not that pretty but it works.

    I have it so that the particular article loads (instead of the general feed webpage).

    This code will work in Vienna but I imagine you can easily adapt it to NetNewswire:

    var sitetitle = "$FeedTitle$";
    var loadThisPage = new Array();
        loadThisPage[0] = "Consumerist";
    // add in element to array for each additional feed you want to be loaded
    
    for (i=0; i
    
  3. Commented
    9:59 PM 14 March 2008

    I threw together a quick stylesheet that loads the link directly only for specified feeds (with the default style). You can download it here.

    If you want to adapt this to your own themes, the template.html looks like this:

    <!-- FILE: template.html -->
    <!-- this works with stylesheet.css from the Default style -->
    
    <div class="newsItemContainer" id="newsItemContainer">
        <div class="newsItemTitle" id="newsItemTitle">[[newsitem_title]]</div>
        <div class="newsItemDescription" id="newsItemDescription">[[newsitem_description]]
                <p class="newsItemExtraLinks" id="newsItemExtraLinks">[[newsitem_extralinks]]</p></div>
        <div class="newsItemDateLine" id="newsItemDateLine">[[newsitem_dateline]]</div>
    </div>
    
    
    <script type="text/javascript">
    
    ///////////////////////////////////////////////////////////
    // add in the feeds you want to be loaded directly here,
    // make sure there's no comma after the last one
    ///////////////////////////////////////////////////////////
    var feedsToLoadDirectly = new Array(
      "del.icio.us/popular",
      "Uncrate",
      "The Chicago Reader",
      "Freakonomics"
    );
    
    //allow for missing favicons by using lastChild insetad of bynumber
    var thistitle = document.getElementById('newsItemDateLine').firstChild.lastChild.innerHTML;
    var thislink = document.getElementById('newsItemTitle').firstChild.getAttribute('href');
    
    for (i=0; i < feedsToLoadDirectly.length; i++) {
        if (thistitle == feedsToLoadDirectly[i]) {
            location.replace(thislink);
        }
    }
    
    </script>
    

Oliver Boermans is a design geek in Adelaide, South Australia: ollicle.com is a place for Ollie to rant, reflect and share. Feed

Previous entry
23 October 2007
Bigger link: easier clicking with jQuery
Next entry
8 March 2008
Ollicle Reflex refined for smarter feed reading