Skip to content

Instantly share code, notes, and snippets.

@andysylvester
Last active March 19, 2016 18:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andysylvester/32d5e48822825588904e to your computer and use it in GitHub Desktop.
Save andysylvester/32d5e48822825588904e to your computer and use it in GitHub Desktop.
Demonstration of using the user script functionality in the River5 RSS aggregator by Dave Winer
var now = new Date ();
if (localStorage.feeds === undefined) {
localStorage.feeds = new Object ();
}
if (localStorage.feeds [urlfeed] === undefined) {
localStorage.feeds [urlfeed] = {
ctAdds: 0,
whenFirstAdd: now
};
}
var thisFeed = localStorage.feeds [urlfeed];
thisFeed.ctAdds++;
thisFeed.whenLastAdd = now;
if (thisFeed.stories === undefined) {
thisFeed.stories = new Array ();
}
thisFeed.stories [thisFeed.stories.length] = itemFromRiver; // New line
itemFromRiver.whenLastSayHello = now;
if (itemFromRiver.ctHellos === undefined) {
itemFromRiver.ctHellos = 0;
}
itemFromRiver.ctHellos++;
var testString = "";
var testResult = "";
if (itemFromRiver.link.search("flickr") != -1)
{
testString = '<img src="' + itemFromRiver.enclosure.url + '">';
testResult = testString.concat(itemFromRiver.description);
itemFromRiver.description = testResult;
}
todaysRiverChanged (); //tell River5 to save it
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment