Here is a way to add a quick and dirty random function for this module.

I say down and dirty because it does not randomize the first load. On refresh the first node of your rotor list will show, then all others will be random.

In the rotor.js file, look for the function:
function animate_rotor_item(rotor_item)

In this function find the line:
var contents = $('.rotor_content');

After this line add:
var randomnumber=Math.floor(Math.random()*15)

*Note the 15 is the one more then the number of I have in my rotor list.

Then change the line below:
actual_item = (actual_item +1) % contents.length;

to include your random number, like this:
actual_item = (actual_item + randomnumber) % contents.length;

The new function looks like this:

function animate_rotor_item(rotor_item) {
  if(typeof rotor_item == "undefined" || typeof rotor_item == "number"){
    rotor_item = $('.rotor_content').get(actual_item);
  }
  $('#rotor > .rotor_content > .rotor_content_detail').hide();
  $('#rotor > .rotor_content > .rotor_tab').removeClass('selected');
  $('.rotor_content_detail', rotor_item).show();
  $('.rotor_tab', rotor_item).addClass('selected');
  var contents = $('.rotor_content');

  var randomnumber=Math.floor(Math.random()*15)       <--- line added here

  var actual = contents.get(actual_item);
  actual_item = (actual_item + randomnumber) % contents.length   <--- line changed here;
}

This will randomize all but your first display. Hope this helps anyone wishing to add a little bit of flexibility.

Comments

mrfelton’s picture

Assigned: Unassigned » mrfelton
Status: Active » Closed (duplicate)

Marked as duplicate of #286671: Random node selection