Skip to content

Commit

Permalink
v1.2.0. Fixed the "black bars" - check the readme for the rest of the…
Browse files Browse the repository at this point in the history
… changelog.
  • Loading branch information
mike-zarandona committed Jul 30, 2014
1 parent 89c4c45 commit 946e995
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 25 deletions.
33 changes: 21 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,22 +65,31 @@ Call the plugin on the placeholder element:


## Options
Name | Description
---- | -----------
**videoID** | The video ID of the YouTube video. This option will be ignored if the `data-videoid` attribute is present. (E.g.: *aBcDeFg12345*)
**previewSize** | Preview image size pulled from YouTube. This option will be ignored if the `customPreviewImage` attribute is present. Available sizes from smallest to largest: `thumb-default`, `thumb-1`, `thumb-2`, `thumb-3`, `default`, `medium`, `high`, `hd` *(default)*
**customPreviewImage** | Custom defined preview image URL. This option overrides `options.previewSize`.
**showInfo** | Display video information (top bar).
**showControls** | Display YouTube player controls.
**loop** | Play video as a loop.
**colorScheme** | Display YouTube player user interface.
**showRelated** | Display YouTube related videos on video end.
**useFitVids** | Call FitVids.js on `.pretty-embed` instances once the video(s) is/are loaded.
Name | Description
---- | -----------
**videoID** | The video ID of the YouTube video. This option will be ignored if the `data-videoid` attribute is present. (E.g.: *aBcDeFg12345*)
**previewSize** | Preview image size pulled from YouTube. This option will be ignored if the `customPreviewImage` attribute is present. Available sizes from smallest to largest: `thumb-default`, `thumb-1`, `thumb-2`, `thumb-3`, `default`, `medium`, `high`, `hd` *(default)*
**customPreviewImage** | Custom defined preview image URL. This option overrides `options.previewSize`.
**showInfo** | Display video information (top bar).
**showControls** | Display YouTube player controls.
**loop** | Play video as a loop.
**closedCaptions** | Displays closed captions (if available).
**localization** | Changes the localization. Accepts an [ISO 639-1 two-letter language code](http://www.loc.gov/standards/iso639-2/php/code_list.php).
**colorScheme** | Display YouTube player user interface.
**showRelated** | Display YouTube related videos on video end.
**useFitVids** | Call FitVids.js on `.pretty-embed` instances once the video(s) is/are loaded.



## Changelog

### v1.2.0
- Fixed those annoying "black bars" that would show up on the sides of the video once playing
- Fixed an issue which would cause HTML5 `data-pe-` attributes to break
- Removed the background-color from `.pretty-embed`, because be more flexible, ya know?
- New option: `closedCaptions` to turn on closed captions (if available)
- New option: `localization` which accepts an [ISO 639-1 two-letter language code](http://www.loc.gov/standards/iso639-2/php/code_list.php)

### v1.1.0
- Better multiple instance handling
- Fixed duplicate appended styles on multiple instances
Expand All @@ -96,7 +105,7 @@ Name | Description


## Thanks
Thanks to the contributors and suggestions from around the web ([@k-risc](https://github.com/k-risc))
Thanks to the contributors and suggestions from around the web

Thanks to alexanderdickson for [waitForImages](https://github.com/alexanderdickson/waitForImages), which this plugin leverages for dynamic image previews.

Expand Down
51 changes: 40 additions & 11 deletions jquery.prettyembed.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
**********************************************************
* prettyEmbed.js | https://github.com/mike-zarandona/prettyembed.js
*
* Version: v1.1.0
* Version: v1.2.0
* Author: Mike Zarandona
* Release: June 30 2014
* Release: July 30 2014
*
* Reqs: jQuery | http://jquery.com
* waitForImages | https://github.com/alexanderdickson/waitForImages
Expand All @@ -19,6 +19,7 @@
* showInfo: true,
* showControls: true,
* loop: false,
* closedCaptions: false,
* colorScheme: 'dark',
* showRelated: false,
*
Expand All @@ -40,7 +41,7 @@
if ( $('#pretty-embed-style').length === 0 ) {
var styles = $('<style />', {
id: 'pretty-embed-style',
html: '.pretty-embed{position:relative;background-color:#000;cursor:pointer;display:block}.pretty-embed img{width:100%;height:auto}.pretty-embed iframe{border:0 solid transparent}.pretty-embed:after{display:block;content:"";position:absolute;top:50%;margin-top:-19px;left:50%;margin-left:-27px;width:54px;height:38px;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGwAAABMCAYAAACIylL7AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAadEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41Lj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lLltTmtfCi/Ac8DXydf7KHCHr4VMWAFpsAD4PfN75z7gvpiid8841KRJ/wIcsey9MCgPGwAAAABJRU5ErkJggg==);-webkit-background-size:cover;background-size:cover}.pretty-embed.play:after{display:none}.pretty-embed:hover:after{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGwAAABMCAYAAACIylL7AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAadEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjExR/NCNwAABwhJREFUeF7t3GlsVFUYBuCDIi4xGreA1O6dmXbaYQ2oCAriGjUuRDSiETVRISGCu2BcAH8gagKKpnWJ5UcBFVQIGhMDFGwVGcqU0m2WtkPpIqNSbEHaQj/fM5yh9HLAAlP6TTlv8iSdc+899/a8PenMnxHRSp3LIQ2ASyAO0mEUjIe7YTJMhWnwAsyBebAQFkM2fAl58A18Dz/Az7ABNsFm2AIeKIZypRIC/8MLkfO3g5zDDXLOXyAf5L1+hNWwEpZBLuTAh/AezIfX4UWYDk/AQ3APTIDR4IR4uBTOh35qmc5sdmU5BsC4XS7HLPgE1sAWqIK/4QB0ABlhci3kmuyBaiiCHyAHXsZaToSL1PJGL5jUBZ9BE5ARVfsgD64DteKnmNos++W1WY4v4CCQ0aM6YBXEqeU/uaCskRAETGacQSGYqGroXnZm2m+Cf4CMXtEKk1QdJw5OdECTutDoPQdgjKpFn2Cm/RwoBDJY8MEFqp5jE3TaJ1suMHrfLFVP19Q47f3ADWSwUgvnqZo6g8FRR51k8HKfqqkz1U77B0AGS8tVTYdTnWGT/EAGS3thgKpLiKoMWyqQwdqNqq5wYY9bDhr8zFF1CRHIsC0BMlj7VtWFwtJt64EM1ryqLiH86bYAkMFaC/SXZfVXL3QnGbxcJXyOtCuAjJgwRBbmtAwafN0qvI608UDc+ZwO8g8fqj12FnlUFvagZZAl/8hh1PZHI9W99Sb5XJnac84CM0WlPW0aEHe+EcOID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8rCLoeOowYNvlzit2sSz4UWIIO9K8NfrIIf/JYDBj9yU/UPF/brNYnrgAzWKsNlyfwal/ghkMHaKlWXEIVxiY8BGay9puoKF5ZsOWjwM1bVFS5MFMQleoEMlpqg6zdrFwxOXAhksJSnaurML4MTRgAZLN2tauoMBqXNR51k8FADhz9/WbNpcMIDm65OIIORwQkzVD3HBif0g/wuFxi9qRw6v69el41XJ6TCX0BGr9oPo1QtJw5OvA7+VhcaZ96/cJeqo3vJH5TghDIg44xqgHGqhpMLLrwwf1D8W7AXMJnRgw5BHtZ8oFr+U8+GQfGXwQzYCG1ARtQ0wRcwDNSKRzGY9GIYB89sGBi/AFbAFqiFZjgIZITJtWiBRiiHAlgJi0FugBvgxO8CezLrB8afAxfBVZACQ+B6uAXugckwFZ6F5+AVeAPegYWwGD6Bz2EpLIeVsBrWws+wHjbCb/A7eKAYypXAcUSOl4C8ZitshgKQ88m5f4Q1sArkvXPhU/gI3gf5nPJ5X4IZ8BQ8AvfBbTAG5O8sf3e5BnItzlXLE4UI8R86m8y4ltOs9gAAAABJRU5ErkJggg==)}'
html: '.pretty-embed{position:relative;cursor:pointer;display:block}.pretty-embed img{width:100%;height:auto}.pretty-embed iframe{border:0 solid transparent}.pretty-embed:after{display:block;content:"";position:absolute;top:50%;margin-top:-19px;left:50%;margin-left:-27px;width:54px;height:38px;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGwAAABMCAYAAACIylL7AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAadEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjExR/NCNwAABmxJREFUeF7t3W9MVlUcB3BNs3Kt1h/XC9eL6kWCAg6E8h/YMLKFm4v+GNZCfYHQnDoNVzjLYbZG8SLCVqSrHGgWtnDWbK1CK/sHi5oF8n+9IMcqiIqA6PT9Xs6Nx+tPAkSec+9zfu7zgnvuOffhfr3Avc997pk0XjUrahZNg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8/d7jDu3M0GFlq9vb2qoqLC5KsjNjC3+CNw5QMrxW0bxAZWU1OjslZnids0UOQGxvOv7HXZKirKV++hRV5gjY2NasPGDX59lzpyAuNfgHlb85y7r6TxfcIJLNAXf3mOtf2J7aaeCI+Wc/E3kG+vdHR0qF1P7zL9UtNotTKwQL2ByYu7RUVFQb3p1HkDMxC3CHR3d6uS3SUqMSlR7B8Qzi0CfCag1GiUcwXW09Oj9uzdo+YvmC/2C5hjDMyXt7nxMlJZWZlKTkkW1w8o5zY3PhFUajSKG1h/f79zvS91aaq4XsCVM7DHPQuNlDAvwbnfcNmdy8T2CFHCwHzxYQjLUcDAfPFxI8vhfNzIFx/osxyrGBj/SY2WeZyPzPJBzPbR5f4Qw8CmgH3sgz9c6z5YxT7JzXyDD1bRgfniAnCEq3fCYuELzisirWSZ45COywnsIU+jZZ7HdFxOYDd4Gi3zLNJxOYERp2uSVrTCjxM/nPlkbSzwxVX7CFWuYxoqLIz3rGSZI13HNFRYSJytTupghU8rDJ5/eQsNd4esaJlhvY7n7EIjp/PgXJBSR2vicb7OoefVS4UV+Az7n3UHK3z+hEQdy/CFFTkfIychlQayLrweuEvHMbJCBz5a9ns9gDVx2mGxjmF0hY6XwZPAuT+kwa3xMwCcbfa6wb1/HoVBroL1cAz6QNqgNTa8isGZfOeC3uPjWBj0cuDk29nwDLwBnHybE5N1g51CeAj3Bd/H+gn4F9+nwBnYOTM8D4CFMPxfgReysHHOoTkdZsCNEAvzYSlw6nd3evt1sAG2wnZ4Ctwp7jkD+x54HfgsR36DnGr+CHDqeU47wiP9c/gS+Pm20GnuvVPau9z274B9qoEXCrgTOZ47rT0/a8D5lLltTmtfCi/Ac8DXydf7KHCHr4VMWAFpsAD4PfN75z7gvpiid8841KRJ/wIcsey9MCgPGwAAAABJRU5ErkJggg==);-webkit-background-size:cover;background-size:cover}.pretty-embed.play:after{display:none}.pretty-embed:hover:after{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGwAAABMC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IIORwQkzVD3HBif0g/wuFxi9qRw6v69el41XJ6TCX0BGr9oPo1QtJw5OvA7+VhcaZ96/cJeqo3vJH5TghDIg44xqgHGqhpMLLrwwf1D8W7AXMJnRgw5BHtZ8oFr+U8+GQfGXwQzYCG1ARtQ0wRcwDNSKRzGY9GIYB89sGBi/AFbAFqiFZjgIZITJtWiBRiiHAlgJi0FugBvgxO8CezLrB8afAxfBVZACQ+B6uAXugckwFZ6F5+AVeAPegYWwGD6Bz2EpLIeVsBrWws+wHjbCb/A7eKAYypXAcUSOl4C8ZitshgKQ88m5f4Q1sArkvXPhU/gI3gf5nPJ5X4IZ8BQ8AvfBbTAG5O8sf3e5BnItzlXLE4UI8R86m8y4ltOs9gAAAABJRU5ErkJggg==)}'
}).appendTo('head');
}

Expand All @@ -56,7 +57,7 @@

// if no selector, only fire on .pretty-embed
if ( $(this).length === 0 ) { elem = $('.pretty-embed'); }
else { elem = $(this).add('.pretty-embed'); }
else { elem = $(this); }

// Main setup loop
elem.each(function() {
Expand All @@ -71,6 +72,8 @@
thisShowInfo,
thisShowControls,
thisLoop,
thisClosedCaptions,
thisLocalization,
thisColorScheme,
thisShowRelated;

Expand Down Expand Up @@ -104,6 +107,16 @@
else if ( options.loop !== undefined ) { thisLoop = options.loop; }
else { thisLoop = undefined; }

// closed captions
if ( $(this).attr('data-pe-closed-captions') !== undefined ) { thisClosedCaptions = $(this).attr('data-pe-closed-captions'); }
else if ( options.closedCaptions !== undefined ) { thisClosedCaptions = options.closedCaptions; }
else { thisClosedCaptions = undefined; }

// localization
if ( $(this).attr('data-pe-localization') !== undefined ) { thisLocalization = $(this).attr('data-pe-localization'); }
else if ( options.localization !== undefined ) { thisLocalization = options.localization; }
else { thisLocalization = undefined; }

// color scheme
if ( $(this).attr('data-pe-color-scheme') !== undefined ) { thisColorScheme = $(this).attr('data-pe-color-scheme'); }
else if ( options.colorScheme !== undefined ) { thisColorScheme = options.colorScheme; }
Expand All @@ -128,6 +141,8 @@
.attr('data-pe-show-info', thisShowInfo)
.attr('data-pe-show-controls', thisShowControls)
.attr('data-pe-loop', thisLoop)
.attr('data-pe-closed-captions', thisClosedCaptions)
.attr('data-pe-localization', thisLocalization)
.attr('data-pe-color-scheme', thisColorScheme)
.attr('data-pe-show-related', thisShowRelated);

Expand All @@ -136,7 +151,7 @@
}

// Write the options.customPreviewImage OR choose a size
if ( thisCustomPreviewImage !== undefined ) {
if ( thisCustomPreviewImage !== undefined && thisCustomPreviewImage !== '' ) {
$(this).html('<img src="' + thisCustomPreviewImage + '" width="100%" alt="YouTube Video Preview" />');
}
else {
Expand Down Expand Up @@ -203,8 +218,8 @@
* obj = the current object referenced passed from $(this)
*/
function clickEventRunner(obj) {
var wrapperWidth = obj.outerWidth(true),
wrapperHeight = obj.outerHeight(true),
var wrapperWidth = obj.find('img').outerWidth(true),
wrapperHeight = obj.find('img').outerHeight(true),
playerOptions = '',
thisVideoID = '';

Expand All @@ -219,19 +234,32 @@

// Assemble the player options string
// showInfo
if ( (obj.attr('data-pe-show-info') === false) || (options.showInfo === false) ) { playerOptions += '&showinfo=0'; }
if ( (obj.attr('data-pe-show-info') === 'false') || (options.showInfo === false) ) { playerOptions += '&showinfo=0'; }

// showControls
if ( (obj.attr('data-pe-show-controls') === false) || (options.showControls === false) ) { playerOptions += '&controls=0'; }
if ( (obj.attr('data-pe-show-controls') === 'false') || (options.showControls === false) ) { playerOptions += '&controls=0'; }

// loop
if ( (obj.attr('data-pe-loop') === true) || (options.loop === true) ) { playerOptions += '&loop=1'; }
if ( (obj.attr('data-pe-loop') === 'true') || (options.loop === true) ) { playerOptions += '&loop=1'; }

// closed captions
if ( (obj.attr('data-pe-closed-captions') === 'true') || (options.closedCaptions === true) ) { playerOptions += '&cc_load_policy=1'; }

// localization
if ( (obj.attr('data-pe-localization') !== undefined) || (options.localization !== undefined) ) {
if ( obj.attr('data-pe-localization') !== undefined ) {
playerOptions += '&hl=' + obj.attr('data-pe-localization');
}
else if ( options.localization !== undefined ) {
playerOptions += '&hl=' + options.localization;
}
}

// colorScheme
if ( (obj.attr('data-pe-color-scheme') == 'light') || (options.colorScheme == 'light') ) { playerOptions += '&theme=light'; }

// showRelated
if ( (obj.attr('data-pe-show-related') === false) || (options.showRelated === false) ) { playerOptions += '&rel=0'; } else { playerOptions += '&rel=1'; }
if ( (obj.attr('data-pe-show-related') === 'false') || (options.showRelated === false) ) { playerOptions += '&rel=0'; } else { playerOptions += '&rel=1'; }

// Write the YouTube video iFrame into the element at the exact dimensions it is now
obj.html('<iframe width="' + wrapperWidth + '" height="' + wrapperHeight + '" style="border:none;" src="//www.youtube.com/embed/' + thisVideoID + '?autoplay=1' + playerOptions + '"></iframe>')
Expand Down Expand Up @@ -271,6 +299,7 @@
showInfo: true,
showControls: true,
loop: false,
closedCaptions: false,

colorScheme: 'dark',
showRelated: false,
Expand Down
Loading

0 comments on commit 946e995

Please sign in to comment.