Skip to content

Commit

Permalink
Release v3.2.8 stable
Browse files Browse the repository at this point in the history
  • Loading branch information
pupunzi committed Oct 21, 2018
1 parent cda15c9 commit 07ada49
Show file tree
Hide file tree
Showing 7 changed files with 204 additions and 27 deletions.
4 changes: 2 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jquery.mb.ytplayer",
"version": "3.2.7",
"version": "3.2.8",
"homepage": "http://pupunzi.open-lab.com/mb-jquery-components/jquery-mb-ytplayer",
"authors": [
"pupunzi <[email protected]>"
Expand All @@ -22,5 +22,5 @@
"test",
"tests"
],
"buildnum": "7318"
"buildnum": "7340"
}
8 changes: 4 additions & 4 deletions dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
file: index.tmpl
last modified: 16/03/18 19.59
Version: 3.2.7
Build: 7318
Version: 3.2.8
Build: 7340
Open Lab s.r.l., Florence - Italy
email: [email protected]
Expand All @@ -26,9 +26,9 @@
<meta charset="UTF-8">
<title>youtube Chromeless Player - mb.YTPlayer</title>
<link href='//fonts.googleapis.com/css?family=Lekton|Lobster' rel='stylesheet' type='text/css'>
<link href="css/jquery.mb.YTPlayer.min.css?_bn=7318" media="all" rel="stylesheet" type="text/css">
<link href="css/jquery.mb.YTPlayer.min.css?_bn=7340" media="all" rel="stylesheet" type="text/css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="jquery.mb.YTPlayer.js?_bn=7318"></script>
<script src="jquery.mb.YTPlayer.js?_bn=7340"></script>
<script src="../examples/assets/apikey.js"></script>
<style>
*:focus {
Expand Down
111 changes: 98 additions & 13 deletions dist/jquery.mb.YTPlayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
file: jquery.mb.YTPlayer.src.js
last modified: 16/03/18 20.01
Version: 3.2.7
Build: 7318
Version: 3.2.8
Build: 7340
Open Lab s.r.l., Florence - Italy
email: [email protected]
Expand Down Expand Up @@ -60,8 +60,8 @@ function iOSversion() {

jQuery.mbYTPlayer = {
name : "jquery.mb.YTPlayer",
version: "3.2.7",
build : "7318",
version: "3.2.8",
build : "7340",
author : "Matteo Bicocchi (pupunzi)",
apiKey : "",

Expand Down Expand Up @@ -168,7 +168,7 @@ function iOSversion() {
showControls: true,

/**
showControls (string)
anchor (string)
center,top,bottom,left,right combined in pair
*/
anchor: "center,center",
Expand Down Expand Up @@ -237,7 +237,7 @@ function iOSversion() {
abundance (bool)
the abudance of the video size
*/
abundance: 0.2,
abundance: 0.3,

/**
gaTrack (bool)
Expand Down Expand Up @@ -405,12 +405,6 @@ function iOSversion() {
if (jQuery.mbBrowser.msie && jQuery.mbBrowser.version < 9)
YTPlayer.opt.opacity = 1;

/**
Manage Fade Time
*/
if (jQuery.mbBrowser.os.name == "mac" && jQuery.mbBrowser.safari )
YTPlayer.opt.fadeOnStartTime = YTPlayer.opt.fadeOnStartTime;

YTPlayer.opt.containment = YTPlayer.opt.containment === "self" ? $YTPlayer : jQuery(YTPlayer.opt.containment);
YTPlayer.isRetina = (window.retina || window.devicePixelRatio > 1);

Expand Down Expand Up @@ -2360,6 +2354,7 @@ function iOSversion() {
ga('send', 'event', 'YTPlayer', 'play', (YTPlayer.hasData ? YTPlayer.videoData.title : YTPlayer.videoID.toString()));

if (YTPlayer.opt.autoPlay) {

var YTPStart = jQuery.Event("YTPStart");
YTPStart.time = YTPlayer.currentTime;
jQuery(YTPlayer).trigger(YTPStart);
Expand Down Expand Up @@ -2563,7 +2558,97 @@ function iOSversion() {
maxWidth : "initial"
});
};




jQuery.fn.optimizeDisplay = function (anchor) {
var YTPlayer = this.get(0);
var vid = {};
var el = YTPlayer.wrapper;
var iframe = jQuery(YTPlayer.playerEl);

YTPlayer.opt.anchor = anchor || YTPlayer.opt.anchor;
YTPlayer.opt.anchor = typeof YTPlayer.opt.anchor != "undefined " ? YTPlayer.opt.anchor : "center,center";
var YTPAlign = YTPlayer.opt.anchor.split(",");

if (YTPlayer.opt.optimizeDisplay) {
var abundance = el.height() * YTPlayer.opt.abundance;
var win = {};
win.width = el.outerWidth();
win.height = el.outerHeight() + abundance;

// TODO why do we need to check for ratio == auto in every method, shouldn't this be handled in buildPlayer()?
// The buildPlayer is called once while the ratio could be set each time the changeVideo is called

YTPlayer.opt.ratio = YTPlayer.opt.ratio === "auto" ? 16 / 9 : YTPlayer.opt.ratio;
YTPlayer.opt.ratio = eval(YTPlayer.opt.ratio);

vid.width = win.width + abundance;
vid.height = Math.ceil(vid.width / YTPlayer.opt.ratio);
vid.marginTop = Math.ceil(-((vid.height - win.height) / 2));
vid.marginLeft = -(abundance/2);
var lowest = vid.height < win.height;

if (lowest) {
vid.height = win.height + abundance;
vid.width = Math.ceil(vid.height * YTPlayer.opt.ratio);
vid.marginTop = -(abundance/2);
vid.marginLeft = Math.ceil(-((vid.width - win.width) / 2));
}

for (var a in YTPAlign) {
if (YTPAlign.hasOwnProperty(a)) {
var al = YTPAlign[a].replace(/ /g, "");
switch (al) {
case "top":
vid.marginTop = lowest ? -((vid.height - win.height) / 2) : -(abundance/2);
break;
case "bottom":
vid.marginTop = lowest ? -(vid.height - (win.height)) - (abundance/2) : -(vid.height - (win.height));
break;
case "left":
vid.marginLeft = -(abundance/2);
break;
case "right":
vid.marginLeft = lowest ? -(vid.width - win.width) : -(abundance/2);
break;
default:
if (vid.width > win.width)
vid.marginLeft = -((vid.width - win.width) / 2);
break;
}
}
}

} else {
vid.width = "100%";
vid.height = "100%";
vid.marginTop = 0;
vid.marginLeft = 0;
}

/*
console.debug("YTPAlign", YTPAlign)
console.debug("lowest", lowest)
console.debug("abundance", abundance)
console.debug("vid.width", vid.width)
console.debug("vid.height", vid.height)
console.debug("vid.marginTop", vid.marginTop)
console.debug("vid.marginLeft", vid.marginLeft)
*/

iframe.css({
width : vid.width,
height : vid.height,
marginTop : vid.marginTop,
marginLeft: vid.marginLeft,
maxWidth : "initial"
});
};




/* UTILITIES -----------------------------------------------------------------------------------------------------------------------*/

/**
Expand Down
6 changes: 3 additions & 3 deletions dist/jquery.mb.YTPlayer.min.js

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion examples/demo_ext_methods.html
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,10 @@ <h2 style="color:white">Available controls methods</h2>
<img border="0" alt="PayPal" src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG_global.gif" class="alignright">
</a>

<!--r1xohS2u69E-->
<!--7SnmCUwOsts-->
<a id="bgndVideo" class="player" data-property="{videoURL:'r1xohS2u69E',containment:'body', showControls:true, autoPlay:true, loop:true, vol:50, mute:true, startAt:40, stopAt:150, opacity:1, addRaster:true, quality:'hd720'}">My video</a>
<!--IJNR2EpS0jw-->
<a id="bgndVideo" class="player" data-property="{videoURL:'r1xohS2u69E',containment:'body', showControls:true, autoPlay:true, loop:true, vol:50, mute:true, startAt:40, stopAt:150, opacity:1, addRaster:true, quality:'hd720', abundance:.3}">My video</a>
<!--BsekcY04xvQ-->

</div>
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"player",
"custom"
],
"version": "3.2.7",
"version": "3.2.8",
"author": "Pupunzi <[email protected]> (Matteo Bicocchi)",
"maintainers": [
"Pupunzi <[email protected]> (Matteo Bicocchi)"
Expand Down Expand Up @@ -51,5 +51,5 @@
"directories": {
"example": "examples"
},
"buildnum": "7318"
"buildnum": "7340"
}
94 changes: 92 additions & 2 deletions src/jquery.mb.YTPlayer.src.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ function iOSversion() {
abundance (bool)
the abudance of the video size
*/
abundance: 0.2,
abundance: 0.3,

/**
gaTrack (bool)
Expand Down Expand Up @@ -2561,7 +2561,97 @@ function iOSversion() {
maxWidth : "initial"
});
};




jQuery.fn.optimizeDisplay = function (anchor) {
var YTPlayer = this.get(0);
var vid = {};
var el = YTPlayer.wrapper;
var iframe = jQuery(YTPlayer.playerEl);

YTPlayer.opt.anchor = anchor || YTPlayer.opt.anchor;
YTPlayer.opt.anchor = typeof YTPlayer.opt.anchor != "undefined " ? YTPlayer.opt.anchor : "center,center";
var YTPAlign = YTPlayer.opt.anchor.split(",");

if (YTPlayer.opt.optimizeDisplay) {
var abundance = el.height() * YTPlayer.opt.abundance;
var win = {};
win.width = el.outerWidth();
win.height = el.outerHeight() + abundance;

// TODO why do we need to check for ratio == auto in every method, shouldn't this be handled in buildPlayer()?
// The buildPlayer is called once while the ratio could be set each time the changeVideo is called

YTPlayer.opt.ratio = YTPlayer.opt.ratio === "auto" ? 16 / 9 : YTPlayer.opt.ratio;
YTPlayer.opt.ratio = eval(YTPlayer.opt.ratio);

vid.width = win.width + abundance;
vid.height = Math.ceil(vid.width / YTPlayer.opt.ratio);
vid.marginTop = Math.ceil(-((vid.height - win.height) / 2));
vid.marginLeft = -(abundance/2);
var lowest = vid.height < win.height;

if (lowest) {
vid.height = win.height + abundance;
vid.width = Math.ceil(vid.height * YTPlayer.opt.ratio);
vid.marginTop = -(abundance/2);
vid.marginLeft = Math.ceil(-((vid.width - win.width) / 2));
}

for (var a in YTPAlign) {
if (YTPAlign.hasOwnProperty(a)) {
var al = YTPAlign[a].replace(/ /g, "");
switch (al) {
case "top":
vid.marginTop = lowest ? -((vid.height - win.height) / 2) : -(abundance/2);
break;
case "bottom":
vid.marginTop = lowest ? -(vid.height - (win.height)) - (abundance/2) : -(vid.height - (win.height));
break;
case "left":
vid.marginLeft = -(abundance/2);
break;
case "right":
vid.marginLeft = lowest ? -(vid.width - win.width) : -(abundance/2);
break;
default:
if (vid.width > win.width)
vid.marginLeft = -((vid.width - win.width) / 2);
break;
}
}
}

} else {
vid.width = "100%";
vid.height = "100%";
vid.marginTop = 0;
vid.marginLeft = 0;
}

/*
console.debug("YTPAlign", YTPAlign)
console.debug("lowest", lowest)
console.debug("abundance", abundance)
console.debug("vid.width", vid.width)
console.debug("vid.height", vid.height)
console.debug("vid.marginTop", vid.marginTop)
console.debug("vid.marginLeft", vid.marginLeft)
*/

iframe.css({
width : vid.width,
height : vid.height,
marginTop : vid.marginTop,
marginLeft: vid.marginLeft,
maxWidth : "initial"
});
};




/* UTILITIES -----------------------------------------------------------------------------------------------------------------------*/

/**
Expand Down

0 comments on commit 07ada49

Please sign in to comment.