1
/*! fluidvids.js v2.4.1 | (c) 2014 @toddmotto | https://github.com/toddmotto/fluidvids */
2
!function(e,t){"function"==typeof define&&define.amd?define(t):"object"==typeof exports?module.exports=t:e.fluidvids=t()}
3
(this,function(){"use strict";function e(e){return new RegExp("^(https?:)?//(?:"+d.players.join("|")+").*$","i").test(e)}
4
function t(e,t){return parseInt(e,10)/parseInt(t,10)*100+"%"}
5
function i(i){if((e(i.src)||e(i.data))&&!i.getAttribute("data-fluidvids")){var n=document.createElement("div");i.parentNode.insertBefore(n,i),i.className+=(i.className?" ":"")+"fluidvids-item",i.setAttribute("data-fluidvids","loaded"),n.className+="fluidvids",n.style.paddingTop=t(i.height,i.width),n.appendChild(i)}
6
}
7
function n(){var e=document.createElement("div");e.innerHTML="<p>x</p><style>"+o+"</style>",r.appendChild(e.childNodes[1])}
8
var d={selector:["iframe","object"],players:["www.youtube.com","player.vimeo.com"]}
9
,o=[".fluidvids {","width: 100%; max-width: 100%; position: relative;","}
10
",".fluidvids-item {","position: absolute; top: 0px; left: 0px; width: 100%; height: 100%;","}
11
"].join(""),r=document.head||document.getElementsByTagName("head")[0];return d.render=function(){for(var e=document.querySelectorAll(d.selector.join()),t=e.length;t--;)i(e[t])}
12
,d.init=function(e){for(var t in e)d[t]=e[t];d.render(),n()}
13
,d}
14
);