From 00d030a5695b2f75ae3aa198f33665d0e166e021 Mon Sep 17 00:00:00 2001 From: Matt Lima Date: Sun, 2 Mar 2014 15:12:51 -0500 Subject: [PATCH 1/3] Updated jquery.backgroundvideo.js Modified to optionally accept an object as the path argument instead of a string. If you have to reference video files in different locations (for example on a Wordpress site where they were not uploaded at the same time and are in different subdirectories of wp-content/uploads) this can be useful. Object properties should be strings corresponding to the members of the types array. --- jquery.backgroundvideo.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jquery.backgroundvideo.js b/jquery.backgroundvideo.js index 0921f17..d86f8fe 100644 --- a/jquery.backgroundvideo.js +++ b/jquery.backgroundvideo.js @@ -35,7 +35,8 @@ html += 'style="display:none;position:fixed;top:0;left:0;bottom:0;right:0;z-index:-100;width:100%;height:100%;">'; for(var i=0; i < plugin.settings.types.length; i++) { - html += ''; + var vpath = plugin.settings.path[plugin.settings.types[i]] || plugin.settings.path; + html += ''; } html += 'bgvideo'; plugin.el.prepend(html); From 33d0cc26773e3b3b39a5e2e497e36b6dcc09a202 Mon Sep 17 00:00:00 2001 From: Matt Lima Date: Sun, 2 Mar 2014 15:14:59 -0500 Subject: [PATCH 2/3] Update readme.md Added a note about the change to the path argument. --- readme.md | 1 + 1 file changed, 1 insertion(+) diff --git a/readme.md b/readme.md index c4e2d47..4cb793a 100644 --- a/readme.md +++ b/readme.md @@ -25,6 +25,7 @@ And launch the plugin : }); +The path option can be a string or an object with properties corresponding to the types array members, in case you need to reference videos in different locations. ## Examples From a840b5932ea93b4da0c79b56704ffaf12c9dfa7d Mon Sep 17 00:00:00 2001 From: Matt Lima Date: Sun, 2 Mar 2014 15:16:56 -0500 Subject: [PATCH 3/3] Updated jquery.backgroundvideo.min.js updated via http://jscompress.com/ to match jquery.backgroundvideo.js --- jquery.backgroundvideo.min.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jquery.backgroundvideo.min.js b/jquery.backgroundvideo.min.js index 7728552..a09eccc 100644 --- a/jquery.backgroundvideo.min.js +++ b/jquery.backgroundvideo.min.js @@ -5,4 +5,4 @@ * Released under the MIT, BSD, and GPL Licenses. * based on jQuery Plugin Boilerplate 1.3 */ -(function(e){e.backgroundVideo=function(t,n){var r={videoid:"video_background"};var i=this;i.settings={};var s=function(){i.settings=e.extend({},r,n);i.el=t;o()};var o=function(){var t="";t+='";i.el.prepend(t);i.videoEl=document.getElementById(i.settings.videoid);i.$videoEl=e(i.videoEl);i.$videoEl.fadeIn(2e3);u()};var u=function(){var e=a();i.$videoEl.width(e*i.settings.width);i.$videoEl.height(e*i.settings.height);if(typeof i.settings.align!=="undefined"){f()}};var a=function(){var t=e(window).width();var n=e(window).height();var r=t/n;var s=i.settings.width/i.settings.height;var o=n/i.settings.height;if(r>=s){o=t/i.settings.width}return o};var f=function(){var t=(e(window).width()>>1)-(i.$videoEl.width()>>1)|0;var n=(e(window).height()>>1)-(i.$videoEl.height()>>1)|0;if(i.settings.align=="centerXY"){i.$videoEl.css({left:t,top:n});return}if(i.settings.align=="centerX"){i.$videoEl.css("left",t);return}if(i.settings.align=="centerY"){i.$videoEl.css("top",n);return}};s();e(window).resize(function(){u()});i.$videoEl.bind("ended",function(){this.play()})}})(jQuery) +(function(e){e.backgroundVideo=function(t,n){var r={videoid:"video_background"};var i=this;i.settings={};var s=function(){i.settings=e.extend({},r,n);i.el=t;o()};var o=function(){var t="";t+='";i.el.prepend(t);i.videoEl=document.getElementById(i.settings.videoid);i.$videoEl=e(i.videoEl);i.$videoEl.fadeIn(2e3);u()};var u=function(){var e=a();i.$videoEl.width(e*i.settings.width);i.$videoEl.height(e*i.settings.height);if(typeof i.settings.align!=="undefined"){f()}};var a=function(){var t=e(window).width();var n=e(window).height();var r=t/n;var s=i.settings.width/i.settings.height;var o=n/i.settings.height;if(r>=s){o=t/i.settings.width}return o};var f=function(){var t=(e(window).width()>>1)-(i.$videoEl.width()>>1)|0;var n=(e(window).height()>>1)-(i.$videoEl.height()>>1)|0;if(i.settings.align=="centerXY"){i.$videoEl.css({left:t,top:n});return}if(i.settings.align=="centerX"){i.$videoEl.css("left",t);return}if(i.settings.align=="centerY"){i.$videoEl.css("top",n);return}};s();e(window).resize(function(){u()});i.$videoEl.bind("ended",function(){this.play()})}})(jQuery)