gAjax RSS Pausing Scroller (hosted)
Dec 3rd, 16': Updated
gfeedfetcher.js engine to version 2.1, which uses
YUI YQL
in place of Google Feeds API due to retirement of later. Also adds
limitlength()
method
Feb 8th, 17': Updated
gfeedfetcher.js engine to version 2.2 (by
jscheuer1), which adds Atom Feeds support, plus improvements to the
limitlength()
function
Description: gAjax RSS Pausing scroller is a flexible RSS scroller that's extremely easy to set up to boot. Using the gAjax RSS Displayer script engine, there's nothing to install or host on your server. Furthermore, you can display results from multiple feeds intermixed, sort them in a variety of ways, specify how many entries to show at once, what portion of each entry to show etc. There is simply no more versatile script RSS scroller out there!
Here's a summary of the features of this script:
- Uses the gAjax RSS Displayer engine and YUI YQL to host/cache the desired RSS feeds, so you don't have to install or host anything on your own server.
- Specify multiple RSS feeds to display, with the results intermixed.
-
Sort the results either by "
date
", "title
", or a custom "label
" assigned to each feed (ie: "Digg" then "Slashdot"). - Set the number of total RSS entries to show. If multiple feeds are specified, that number is spread out evenly amongst the feeds.
- Set the number of RSS entries to show at once (default is 1).
-
Specify which portions of each RSS entry to
show, such as its "
label
", "date
", "description
" and more. - Supports multiple gAjax RSS scroller instances on the same page.
Demo:
Example 1: (Single RSS feed, 10 entries, " Example 2: (Two RSS feeds, 20 entries, " |
Example 3: (Two RSS feeds, 8 entries, " |
Step 1: Insert the following code into the HEAD section of your page:
Step 2: Download the below .js file and image, which are also referenced by the code above, and upload to your site:
- gfeedfetcher.js (inherited from gAjax Feed Displayer. No need to edit).
- gajaxscroller.js (configure path to "loading" gif at the top)
-
(right click and choose "Save As").
Step 3: Finally, to display the desired RSS feeds, just add the below sample HTML to your page, which illustrates 3 different examples using various feeds (Slashdot, Digg, CSS Drive, CNN etc):
Documentation
Below describes all the available methods at your disposal when
calling gfeedpausescroller()
class. Note that all except one of its
methods are inherited from the script
gAjax RSS Displayer, so if
you're familiar with that script, you'll feel right at home!
Constructor | Description |
---|---|
new gfeedpausescroller("id", "cssclass,
pause, Required |
Main gfeedpausescroller() constructor function to
create a new instance of gAjax RSS Scroller.Parameters:
Example:
|
Method |
Description |
instance.addFeed("label", "feedurl") Required Improved in v2.2 |
Adds a feed to be retrieved and shown (based on its full
URL). Call this function more than once to add multiple feeds. Parameters:
Example:
|
instance.displayoptions(space_delimited_keywords) |
By default, only the title of each RSS entry is shown.
Specify additional fields such as each entry's date and description by calling displayoptions() and passing in
specific keywords, each separated by a space, for example, "datetime
label description ".Parameter:
Example:
|
instance.setentrycontainer(TagName) |
Changes the element used to contain each RSS entry. By
default, it is a DIV element (<li> ), so that
the RSS entries are individually wrapped in a DIV tag. You can, for example, pass
in "li " or "p " so the entries are
each wrapped around a DIV or P, respectively.Parameter:
Examples:
|
instance.limitlength(chars, "fieldtype",
[ForceStrip]) defaults to undefined Improved in v2.2 |
Lets you strip any HTML inside a field and limit the number of
remaining characters shown inside a
particular field, most commonly, the "description" field. Parameter:
This method can be called more than once to apply the character restriction to both the "title" and "description" fields if needed. Examples:
|
instance.addregexp(RegExpLiteral, "replacement_text",
"targetfield") defaults to null Improved in v2.2 |
Lets you perform a search and replace inside a specific field such as the "description" field.
The first parameter is a
regular expression to isolate the text you wish to replace, and the
2nd, the new text to replace it with. An optional 3rd parameter lets you
limit the operation to a specific field within each RSS entry, with the
valid keywords being:
Lets say the description field of your RSS entries contain the "
The first parameter is a standard
JavaScript regular expression that basically detects the presence of
either " You can call See "Search and replace text within your RSS entries" on the supplementary page for additional info. |
instance.filterfeed(int, ["sortby"]) Required |
Sets the number of entries to retrieve and display. An
optional second parameter lets you sort the results by "date ",
"label ", or "title ".Parameter:
Examples:
|
instance.entries_per_page(int) Note: Non inherited method |
Sets the number of entries to show at once (per page).
Default is 1. Parameter:
Examples:
|
instance.onfeedload() |
Call back function that runs when the RSS Scroller has
fully loaded (all of its feeds that is). Use it to execute custom code
just before the RSS Displayer is shown on the page. Examples:
|
instance.init() Required |
Call this function at the very end to initialize the gAjax RSS Pausing Scroller using the above settings. |
Styling the RSS Pausing Scroller
Every aspect of each RSS Pausing Scroller can be styled using CSS. Structurally the scroller looks like this:
Outer Most DIV
Inner DIV containing the RSS feed
The outermost purple DIV can be styled through the "id
"
and/or "classname
" attributes you assigned when calling
gfeedpausescroller()
. The inner DIV (orange) is the DIV that contains the
visible RSS entries. Finally, there are the yellow containers, defined using the
setentrycontainer()
method (defaults to "div
") and is
wrapped around each RSS entry individually. So for example, by calling
setentrycontainer("p")
each yellow container is now a paragraph, and can
be accessed via the CSS:
#scrollerid div p{
background-color: yellow;
}
Of if you've called setentrycontainer("li")
instead, the yellow boxes can be style using:
#scrollerid div ul{
background-color: yellow;
}
#scrollerid div ul li{
margin-bottom: 5px;
}
Now, within each yellow box, you can style the various
components of the RSS entry via the CSS classes ".titlefield
", ".labelfield
",
".datefield
".