Download & Extend

Views Javascript Random

New Views Options!

Adds a new sort type to views. It's under sort criteria -> Global: Javascript Random.

Why
Lets say this view is used to rotate an ad on your site. If that is cached then the same ad shows until the page cache is cleared.

How
Lets say for the view it will display 3 nodes; with this plugin it will load 25 nodes (number configurable) and then client side it will use Javascript's Math.random() to select what 3 nodes to display. Inside a noscript tag it will use css to unhide the first 3 nodes, but these will not change until the page is created again. This also adds a SQL random to your results so the noscript version is acceptable.

Supported styles
The following styles (Views: Basic settings) have been tested and appear to work correctly.

  • Unformatted
  • Table
  • HTML List

Other styles may work; if they do not & you need it, please create an issue; support for it might be added in.

Unsupported styles
These are views styles that can not easily be done at the moment.

  • Grid (patches welcome!)
  • Jump Menu
  • Panels
  • Bulk Operations
  • GMap
  • XML data document

Downloads

Version Downloads Date Links
6.x-1.x-dev tar.gz (8.61 KB) | zip (10.52 KB) 2011-Mar-19 Notes

Project Information


Maintainers for Views Javascript Random

  • mikeytown2 - 4 commits
    last: 1 year ago, first: 1 year ago

Issues for Views Javascript Random

To avoid duplicates, please search before submitting a new issue.
All issues
Bug reports