'lutman_replace', 'module' => 'lutman', 'shared_file' => 'lutman/jquery.flash.js', 'title' => t('jQuery Plugin - Luke Lutman'), ); return $methods; } /** * Implementation of swftools_embed hook * Returns the markup for the page, plus set necessary javascript. */ function lutman_swftools_embed($action = 'add_js', $methods = FALSE, $vars = FALSE, $html_alt = '') { static $lutman_has_run; // Output javascript to the header if (!$lutman_has_run) { // Add jquery.flash.js drupal_add_js(swftools_get_player_path() .'/lutman/jquery.flash.js'); drupal_add_js(_lutman_header_js(), 'inline', 'header'); $lutman_has_run = TRUE; if ($action == 'add_js') { // Exit early having put the javascript in the header. return; } } // Use time() to prevent caching issues. $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 'data' attribute of all swftools-embed divs. * */ function _lutman_header_js() { $js = " $(document).ready(function(){ $('.lutman').flash(null, {version:7}, function(htmlOptions) { htmlOptions = Drupal.parseJson($(this).attr('swftools')); $(this).parent().prepend($.fn.flash.transform(htmlOptions)); $(this).remove(); }); }); "; return $js; }