test/emission_fichiers/fc_bloc_direct.js
author hamidouk
Mon, 07 Nov 2011 17:23:48 +0100
branchpopcorn-port
changeset 202 2e0205ee7ca9
parent 0 c357d5b60635
permissions -rw-r--r--
patch to respond to update the player widget when the user clicks directly on the html5/flash player window.

Drupal.behaviors.fcBlocDirect = function(context) {
  // Set up interval
  if (context == document && typeof(Drupal.settings.rf_bloc_suppress) == 'undefined') { // Only one is enough
    var fcBlocDirectUpdateInterval = setInterval('fcBlocDirectUpdate()', Drupal.settings.fc_bloc_direct.interval);
    if (Drupal.settings.fc_bloc_direct.refresh_on_load === 1) {
      fcBlocDirectUpdate();
    };
  };
};

// Interval callback
function fcBlocDirectUpdate() {
  var url = Drupal.settings.basePath + 'fc_bloc_direct/refresh';
  $.ajax({
    method: 'get',
    url : url,
    dataType : 'json',
    error: function(xhr) {
      // Do nothing in production mode
      // Drupal.CTools.AJAX.handleErrors(xhr, url);
    },
    success: Drupal.CTools.AJAX.respond
  });
};