#642 ✓ resolved
Mohammed Buttu

Documentation for using defaults needs to be updated

Reported by Mohammed Buttu | July 3rd, 2011 @ 07:51 PM | in 0.8 (closed)

The documentation for using defaults for plug-ins (http://popcornjs.org/API/defaults-options) has some comments (and a typo) that need to be updated. Also, a couple of lines can be rearranged in order to remain consistent.

In the first jsFiddle, it says:


var p = Popcorn( "#video");

p.defaults( "footnote", {

  // set a default element target id
  target: "my-footnote-default-id", 
  text: "I am the default footnote"
  
});

// In use...
p.footnote({
// all calls will have:
  // target: "foo"
  // text: "I'm a default footnote!"
  // target: "my-footnote-id"
  start: 1,
  end: 6

}).play();

One possible solution is:


var p = Popcorn( "#video");

p.defaults( "footnote", {

  // set a default element target id
  target: "my-footnote-default-id", 
  text: "I'm a default footnote!"
  
});

// In use...
p.footnote({
// all calls will have:
  // target: "my-footnote-default-id"
  // text: "I'm a default footnote!"
  start: 1,
  end: 6

}).play();

The text property was updated so that both jsFiddles on the page are consistent. The comments were also updated and rearranged (in the defaults, the target property was specified first, and then the text--the same is now true for the comments).

Between the two jsFiddles on the page, I'm not entirely sure if they do or if they need to follow our style guide (https://webmademovies.lighthouseapp.com/projects/63272/styleguide). If they do and this is not in conformance with the style guide, then the above suggested solution needs to be tweaked.

For the second jsFiddle on the page, it says:


var p = Popcorn( "#video", {

          // using the "defaults" propery
          // users can setup defaults for plugins
          defaults: {

            // plugin name
            footnote: { 

              // default values to send to plugin options
              target: "my-footnote-default-id",
              text: "I'm a default footnote!"
            }
          }
        });

p.footnote({
  // all calls will have:
  // text: "I'm a default footnote!"
  // target: "my-footnote-default-id"
  start: 1,
  end: 6

}).play();

Same comment as above regarding the style. In the first comment, the word propery should be property

Also, this section:


p.footnote({
  // all calls will have:
  // text: "I'm a default footnote!"
  // target: "my-footnote-default-id"
  start: 1,
  end: 6

}).play();

should be:


p.footnote({
  // all calls will have:
  // target: "my-footnote-default-id"
  // text: "I'm a default footnote!"
  start: 1,
  end: 6

}).play();

just to remain consistent with how the defaults were declared (the target specified first, and then the text property).

Comments and changes to this ticket

  • Rick

    Rick July 3rd, 2011 @ 09:19 PM

    • Assigned user set to “Rick”
    • State changed from “new” to “resolved”

    Updated. Thanks for going through all of those.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Popcorn.js is an HTML5 video framework that lets you bring elements of the web into your videos.

Popcorn.js is a project of Web Made Movies, Mozilla's Open Video Lab.

Shared Ticket Bins

Pages