'ufo_replace',
'module' => 'ufo',
'shared_file' => 'ufo/ufo.js',
'title' => t('UFO - Bobby Van der Sluis'),
);
return $methods;
}
/**
* Implementation of swftools_embed hook
* Returns the markup for the page, plus set necessary javascript.
*/
function ufo_swftools_embed($action = 'add_js', $methods = FALSE, $vars = FALSE, $html_alt = '') {
static $ufo_has_run;
static $ufo_id = 0;
// Output javascript to the header
if (!$ufo_has_run) {
// Add ufo.js
drupal_add_js(swftools_get_player_path() .'/ufo/ufo.js');
drupal_add_js(_ufo_header_js(), 'inline', 'header');
$ufo_has_run = TRUE;
if ($action == 'add_js') {
// Exit early having put the javascript in the header.
return;
}
}
static $unique_id = 0;
$unique_id++;
$html = '
params, 'swftools') .' '.">\n".
$html_alt .
'
';
return $html;
}
/**
* The jQuery code that will try to replace all elements after the page loads.
* This parses the JSON out of the 'swftools' attribute of all class="ufo" divs. *
*/
function _ufo_header_js() {
// var FO = { movie:"test8.swf", width:"300", height:"120", majorversion:"8", build:"0", xi:"true" };
// UFO.create(FO, "ufoDemo");
$js = "
$(document).ready(function(){
$('.ufo').each(function(i){
params = Drupal.parseJson($(this).attr('swftools'));
var FO = { movie: params['src'], width: params['width'], height: params['height'],
majorversion: params['version'], build: '0', xi: 'false',
quality: params['quality'], wmode: params['wmode'], align: params['align'],
salign: params['salign'], play: params['play'], loop: params['loop'],
menu: params['menu'], base: params['base'], flashvars: params['flashvars'],
allowfullscreen: 'true'
};
alert(FO.flashvars);
UFO.create(FO, this.id);
});
});
";
return $js;
}