You are here

function _swfobject_header_js in SWF Tools 5

Same name and namespace in other branches
  1. 6 swfobject/swfobject.module \_swfobject_header_js()
  2. 6.2 swfobject/swfobject.module \_swfobject_header_js()

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="swfobject" divs.

1 call to _swfobject_header_js()
swfobject_swftools_embed in swfobject/swfobject.module
Implementation of swftools_embed hook Returns the markup for the page, plus set necessary javascript.

File

swfobject/swfobject.module, line 67

Code

function _swfobject_header_js() {
  $js = "\n  \$(document).ready(function(){\n    \$('.swfobject').each(function(i){\n      params = Drupal.parseJson(\$(this).attr('swftools'));\n\t    var so = new SWFObject(params['src'], '', params['width'], params['height'], params['version'], params['bgcolor']);\n      for (p in params) {\n        so.addParam(p, params[p]);\n      }\n      so.addVariable('flashvars', '&'+ params['flashvars']);\n      so.write(this.id);\n    });\n  });\n  ";
  return $js;
}