Skip to content

Commit

Permalink
Prevent buttons submitting forms, return players
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Potts committed Feb 17, 2015
1 parent fc2bb9f commit 9827e6a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
7 changes: 6 additions & 1 deletion assets/js/plyr.js
Original file line number Diff line number Diff line change
Expand Up @@ -955,7 +955,7 @@
}

// Get the players
var elements = document.querySelectorAll(config.selectors.container);
var elements = document.querySelectorAll(config.selectors.container), players = [];

// Create a player instance for each element
for (var i = elements.length - 1; i >= 0; i--) {
Expand All @@ -964,6 +964,11 @@

// Setup a player instance and add to the element
element.plyr = new Plyr(element);

// Add to return array
players.push(element.plyr);
}

return players;
}
}(this.plyr = this.plyr || {}));
12 changes: 6 additions & 6 deletions assets/templates/controls.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@
<span>0</span>% played
</progress>
<span class="player-controls-playback">
<button data-player="restart">
<button type="button" data-player="restart">
<svg><use xlink:href="#icon-refresh"></use></svg>
<span class="sr-only">Restart</span>
</button>
<button data-player="rewind">
<button type="button" data-player="rewind">
<svg><use xlink:href="#icon-rewind"></use></svg>
<span class="sr-only">Rewind <span class="player-seek-time">10</span> seconds</span>
</button>
<button aria-label="{aria-label}" data-player="play">
<button type="button" aria-label="{aria-label}" data-player="play">
<svg><use xlink:href="#icon-play"></use></svg>
<span class="sr-only">Play</span>
</button>
<button data-player="pause">
<button type="button" data-player="pause">
<svg><use xlink:href="#icon-pause"></use></svg>
<span class="sr-only">Pause</span>
</button>
<button data-player="fast-forward">
<button type="button" data-player="fast-forward">
<svg><use xlink:href="#icon-fast-forward"></use></svg>
<span class="sr-only">Fast forward <span class="player-seek-time">10</span> seconds</span>
</button>
Expand All @@ -45,7 +45,7 @@
<span class="sr-only">Captions</span>
</label>

<button data-player="fullscreen">
<button type="button" data-player="fullscreen">
<svg class="icon-exit-fullscreen"><use xlink:href="#icon-collapse"></use></svg>
<svg><use xlink:href="#icon-expand"></use></svg>
<span class="sr-only">Toggle fullscreen</span>
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ <h1>Plyr</h1>
<source src="//cdn.sampotts.me/plyr/movie.webm" type="video/webm">

<!-- Text track file -->
<track kind="captions" label="English captions" src="//cdn.sampotts.me/plyr/movie_captions_en.vtt" srclang="en" default>
<track kind="captions" label="English captions" src="//cdn.sampotts.me/plyr/movie_captions.vtt" srclang="en" default>

<!-- Fallback for browsers that don't support the <video> element -->
<div>
Expand Down

0 comments on commit 9827e6a

Please sign in to comment.