-
Notifications
You must be signed in to change notification settings - Fork 427
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
204 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]>" | ||
|
@@ -22,5 +22,5 @@ | |
"test", | ||
"tests" | ||
], | ||
"buildnum": "7318" | ||
"buildnum": "7340" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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] | ||
|
@@ -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 { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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] | ||
|
@@ -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 : "", | ||
|
||
|
@@ -168,7 +168,7 @@ function iOSversion() { | |
showControls: true, | ||
|
||
/** | ||
showControls (string) | ||
anchor (string) | ||
center,top,bottom,left,right combined in pair | ||
*/ | ||
anchor: "center,center", | ||
|
@@ -237,7 +237,7 @@ function iOSversion() { | |
abundance (bool) | ||
the abudance of the video size | ||
*/ | ||
abundance: 0.2, | ||
abundance: 0.3, | ||
|
||
/** | ||
gaTrack (bool) | ||
|
@@ -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); | ||
|
||
|
@@ -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); | ||
|
@@ -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 -----------------------------------------------------------------------------------------------------------------------*/ | ||
|
||
/** | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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)" | ||
|
@@ -51,5 +51,5 @@ | |
"directories": { | ||
"example": "examples" | ||
}, | ||
"buildnum": "7318" | ||
"buildnum": "7340" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters