[ Index ]

PHP Cross Reference of Drupal 6 (gatewave)

title

Body

[close]

/sites/all/modules/swftools/onepixelout/ -> onepixelout.js (source)

   1  // Array to hold the player object ids
   2  onepixelout_objects = new Array();
   3  
   4  // Array to hold the playerIDs
   5  onepixelout_players = new Array();
   6  
   7  // Set a flag to show if id's have been collected
   8  onepixelout_initialized = 0;
   9  
  10  // Call back when a player is started - it uses the flashvar playerID of the player that is starting as its parameter
  11  function ap_stopAll(playerID) {
  12    
  13    // If this is the first time we clicked a player then get the object and player ids
  14    if (!onepixelout_initialized) {
  15      onepixelout_getPlayers();
  16      onepixelout_initialized = 1;
  17    }
  18    
  19    // Iterate over the array of players
  20    for(var i = 0; i < onepixelout_players.length; i++) {
  21      
  22      try {
  23    
  24      // If this player id is not the playerID that is starting then close it
  25        if(onepixelout_players[i] != playerID) {
  26          document.getElementById(onepixelout_objects[i]).SetVariable('closePlayer', 1);
  27        }
  28        else {
  29          document.getElementById(onepixelout_objects[i]).SetVariable('closePlayer', 0);
  30        }
  31      } catch( errorObject ) {
  32       // Trap any errors
  33      }
  34    }
  35  }
  36  
  37  
  38  // Get object and playerIDs of onepixelout players
  39  function onepixelout_getPlayers() {
  40  
  41    //Initialize a counter
  42    i = 0;
  43    
  44    // Iterate over all onepixelout players
  45    $('.onepixelout > [id^=swf]').each(function () {
  46      
  47      // Collect the div ids, turn them in to object ids, and store them
  48      onepixelout_objects[i] = $(this).attr('id');
  49      
  50      // Extract the flashvars string
  51      flashvars = $('#' + onepixelout_objects[i] + ' > param').filter('[name=flashvars]').attr('value');
  52  
  53      // Find out where playerID appears in the value
  54      index1 = flashvars.indexOf('playerID');
  55      
  56      // Find out where the first ampersand is in the value
  57      index2 = flashvars.indexOf('&');
  58      
  59      // The playerID variable is this substring so store it
  60      onepixelout_players[i++] = flashvars.substring(index1 + 9, index2);
  61    
  62    });
  63    
  64  }


Generated: Thu Mar 24 11:18:33 2011 Cross-referenced by PHPXref 0.7