Giter Site home page Giter Site logo

zoer / swfobject-rails Goto Github PK

View Code? Open in Web Editor NEW

This project forked from janrenz/swfobject-rails

0.0 2.0 0.0 134 KB

Integration of swfobject with the Rails 3.x asset pipeline

Home Page: https://github.com/gucki/swfobject-rails

License: Other

Ruby 98.41% JavaScript 0.19% CSS 1.40%

swfobject-rails's Introduction

Rails 3.1 Integration for SWFObject

This gem integrates SWFObject with the Rails 3.1 asset pipeline.

Installation

Just add it to your Gemfile:

gem "swfobject-rails"

Quick Start

Add to your application.js:

//= require swfobject

Place your SWFs you want to incude somewhere in the rails 3.1 assets directories (ex. app/assets/swfs/...).

swfobject-rails includes a helper for generating static embed code, #swf_tag:

<%= swf_tag "video", :id => "my_video", :params => { :loop => true }, :flashvars => { :debug => true } do %>
  <p>You should download the latest Flash player!</p>
<% end %>

This would generate the following HTML:

<object id="my_video" name="my_video" width="100%" height="100%" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">
  <param name="movie" value="/assets/video.swf" />
  <param name="wmode" value="transparent" />
  <param name="loop" value="true" />
  <param name="allowfullscreen" value="true" />
  <param name="allowscriptaccess" value="always" />
  <param name="flashvars" value="debug=true" />
  <!--[if !IE]>-->
    <object data="/assets/video.swf" width="100%" height="100%">
      <param name="wmode" value="transparent" />
      <param name="loop" value="true" />
      <param name="allowfullscreen" value="true" />
      <param name="allowscriptaccess" value="always" />
      <param name="flashvars" value="debug=true" />
      <!--<![endif]-->
        <p>You should download the latest Flash player!</p>
      <!--[if !IE]>-->
    </object>
  <!--<![endif]-->
</object>
<script type="text/javascript">
  swfobject.registerObject("my_video", "9.0.0", "/assets/expressInstall.swf");
</script>

Updating

When new versions swfobject are released, simply update the gem to the latest version.

swfobject-rails's People

Contributors

janrenz avatar gucki avatar petebrowne avatar zoer avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.