Socket
Socket
Sign inDemoInstall

opentok-layout-js

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

opentok-layout-js - npm Package Compare versions

Comparing version 0.1.1 to 0.1.3

2

bower.json
{
"name": "opentok-layout-js",
"version": "0.1.1",
"version": "0.1.3",
"homepage": "https://github.com/aullman/opentok-layout-js",

@@ -5,0 +5,0 @@ "authors": [

@@ -63,2 +63,7 @@ /*!

// Really cheap UUID function
var cheapUUID = function() {
return (Math.random() * 100000000).toFixed(0);
};
var getHeight = function (elem) {

@@ -198,4 +203,3 @@ // NOTE: internal OT.$ API

if (!id) {
// NOTE: internal OT.$ API
id = "OT_" + OT.$.uuid();
id = "OT_" + cheapUUID();
container.setAttribute("id", id);

@@ -202,0 +206,0 @@ }

@@ -11,2 +11,2 @@ /*!

**/
("undefined"==typeof module||"undefined"==typeof module.exports)&&(exports=window),function(t){var i=function(i,e,a,o,r,n){var g={left:e+"px",top:a+"px",width:o+"px",height:r+"px"},d=function(){var t=i.querySelector(".OT_root");if(t){var e=t.style.width;t.style.width=o+"px",t.style.width=e||""}};n&&t?(t(i).stop(),t(i).animate(g,n.duration||200,n.easing||"swing",function(){d(),n.complete&&n.complete.call(this)})):OT.$.css(i,g),d()},e=function(t,i){var e=OT.$.css(t,i);return e?parseInt(e,10):0},a=function(t){var i=OT.$.height(t);return i?parseInt(i,10):0},o=function(t){var i=OT.$.width(t);return i?parseInt(i,10):0},r=function(t,a,o,r,n,g,d,l,s){var h,R=t.length,u=function(t,i){for(var e,r,n,g,d,l,s,u=1;R>=u;u++){var f=u,b=Math.ceil(R/f);s=Math.floor(o/b),l=Math.floor(a/f),tRatio=s/l,tRatio>i?(tRatio=i,s=l*tRatio):t>tRatio&&(tRatio=t,l=s/tRatio);var p=l*s*R;(void 0===e||p>e)&&(e=p,g=s,d=l,r=f,n=b)}return{maxArea:e,targetCols:r,targetRows:n,targetHeight:g,targetWidth:d,ratio:h}};if(g){var f=t.length>0&&t[0].querySelector("video");h=f&&f.videoHeight&&f.videoWidth?u(f.videoHeight/f.videoWidth,f.videoHeight/f.videoWidth):u(.75,.75)}else h=u(d,l);for(var b=h.targetRows*h.targetCols-R,p=b*h.targetWidth/2,c=(h.targetRows-1)*h.targetCols,v=(o-h.targetRows*h.targetHeight)/2,m=(a-h.targetCols*h.targetWidth)/2,x=0,y=0,T=0;T<t.length;T++){var M=t[T];T%h.targetCols===0?(x=m,T==c&&(x+=p),y+=0===T?v:h.targetHeight):x+=h.targetWidth,OT.$.css(M,"position","absolute");var O=h.targetWidth-e(M,"paddingLeft")-e(M,"paddingRight")-e(M,"marginLeft")-e(M,"marginRight")-e(M,"borderLeft")-e(M,"borderRight"),w=h.targetHeight-e(M,"paddingTop")-e(M,"paddingBottom")-e(M,"marginTop")-e(M,"marginBottom")-e(M,"borderTop")-e(M,"borderBottom");i(M,x+r,y+n,O,w,s)}},n=function(t){return"none"!==OT.$.css(t,"display")},g=function(t,i){if("none"!==OT.$.css(t,"display")){var g=t.getAttribute("id");g||(g="OT_"+OT.$.uuid(),t.setAttribute("id",g));var d=a(t)-e(t,"borderTop")-e(t,"borderBottom"),l=o(t)-e(t,"borderLeft")-e(t,"borderRight"),s=d/l,h=0,R=0,u=0,f=0,b=Array.prototype.filter.call(t.querySelectorAll("#"+g+">."+i.bigClass),n),p=Array.prototype.filter.call(t.querySelectorAll("#"+g+">*:not(."+i.bigClass+")"),n);if(b.length>0&&p.length>0){var c=b[0].querySelector("video");bigRatio=c&&c.videoHeight&&c.videoWidth?c.videoHeight/c.videoWidth:.75;var v,m;s>bigRatio?(v=l,m=Math.min(Math.floor(d*i.bigPercentage),l*bigRatio),R=m,u=d-R):(m=d,v=Math.min(l*i.bigPercentage,Math.floor(m/bigRatio)),h=v,f=l-h),i.bigFirst?(r(b,v,m,0,0,i.bigFixedRatio,i.bigMinRatio,i.bigMaxRatio,i.animate),r(p,l-h,d-R,h,R,i.fixedRatio,i.minRatio,i.maxRatio,i.animate)):(r(p,l-h,d-R,0,0,i.fixedRatio,i.minRatio,i.maxRatio,i.animate),r(b,v,m,f,u,i.bigFixedRatio,i.bigMinRatio,i.bigMaxRatio,i.animate))}else b.length>0&&0===p.length?r(b,l,d,0,0,i.bigFixedRatio,i.bigMinRatio,i.bigMaxRatio,i.animate):r(p,l-h,d-R,h,R,i.fixedRatio,i.minRatio,i.maxRatio,i.animate)}};exports.initLayoutContainer=function(t,i){return i=OT.$.defaults(i||{},{maxRatio:1.5,minRatio:9/16,fixedRatio:!1,animate:!1,bigClass:"OT_big",bigPercentage:.8,bigFixedRatio:!1,bigMaxRatio:1.5,bigMinRatio:9/16,bigFirst:!0}),t="string"==typeof t?OT.$(t):t,OT.onLoad(function(){g(t,i)}),{layout:g.bind(null,t,i)}},OT.initLayoutContainer=exports.initLayoutContainer}(jQuery);
("undefined"==typeof module||"undefined"==typeof module.exports)&&(exports=window),function(t){var i=function(i,e,o,a,r,n){var g={left:e+"px",top:o+"px",width:a+"px",height:r+"px"},d=function(){var t=i.querySelector(".OT_root");if(t){var e=t.style.width;t.style.width=a+"px",t.style.width=e||""}};n&&t?(t(i).stop(),t(i).animate(g,n.duration||200,n.easing||"swing",function(){d(),n.complete&&n.complete.call(this)})):OT.$.css(i,g),d()},e=function(t,i){var e=OT.$.css(t,i);return e?parseInt(e,10):0},o=function(){return(1e8*Math.random()).toFixed(0)},a=function(t){var i=OT.$.height(t);return i?parseInt(i,10):0},r=function(t){var i=OT.$.width(t);return i?parseInt(i,10):0},n=function(t,o,a,r,n,g,d,l,s){var h,R=t.length,f=function(t,i){for(var e,r,n,g,d,l,s,f=1;R>=f;f++){var u=f,b=Math.ceil(R/u);s=Math.floor(a/b),l=Math.floor(o/u),tRatio=s/l,tRatio>i?(tRatio=i,s=l*tRatio):t>tRatio&&(tRatio=t,l=s/tRatio);var p=l*s*R;(void 0===e||p>e)&&(e=p,g=s,d=l,r=u,n=b)}return{maxArea:e,targetCols:r,targetRows:n,targetHeight:g,targetWidth:d,ratio:h}};if(g){var u=t.length>0&&t[0].querySelector("video");h=u&&u.videoHeight&&u.videoWidth?f(u.videoHeight/u.videoWidth,u.videoHeight/u.videoWidth):f(.75,.75)}else h=f(d,l);for(var b=h.targetRows*h.targetCols-R,p=b*h.targetWidth/2,c=(h.targetRows-1)*h.targetCols,m=(a-h.targetRows*h.targetHeight)/2,v=(o-h.targetCols*h.targetWidth)/2,x=0,y=0,T=0;T<t.length;T++){var M=t[T];T%h.targetCols===0?(x=v,T==c&&(x+=p),y+=0===T?m:h.targetHeight):x+=h.targetWidth,OT.$.css(M,"position","absolute");var O=h.targetWidth-e(M,"paddingLeft")-e(M,"paddingRight")-e(M,"marginLeft")-e(M,"marginRight")-e(M,"borderLeft")-e(M,"borderRight"),w=h.targetHeight-e(M,"paddingTop")-e(M,"paddingBottom")-e(M,"marginTop")-e(M,"marginBottom")-e(M,"borderTop")-e(M,"borderBottom");i(M,x+r,y+n,O,w,s)}},g=function(t){return"none"!==OT.$.css(t,"display")},d=function(t,i){if("none"!==OT.$.css(t,"display")){var d=t.getAttribute("id");d||(d="OT_"+o(),t.setAttribute("id",d));var l=a(t)-e(t,"borderTop")-e(t,"borderBottom"),s=r(t)-e(t,"borderLeft")-e(t,"borderRight"),h=l/s,R=0,f=0,u=0,b=0,p=Array.prototype.filter.call(t.querySelectorAll("#"+d+">."+i.bigClass),g),c=Array.prototype.filter.call(t.querySelectorAll("#"+d+">*:not(."+i.bigClass+")"),g);if(p.length>0&&c.length>0){var m=p[0].querySelector("video");bigRatio=m&&m.videoHeight&&m.videoWidth?m.videoHeight/m.videoWidth:.75;var v,x;h>bigRatio?(v=s,x=Math.min(Math.floor(l*i.bigPercentage),s*bigRatio),f=x,u=l-f):(x=l,v=Math.min(s*i.bigPercentage,Math.floor(x/bigRatio)),R=v,b=s-R),i.bigFirst?(n(p,v,x,0,0,i.bigFixedRatio,i.bigMinRatio,i.bigMaxRatio,i.animate),n(c,s-R,l-f,R,f,i.fixedRatio,i.minRatio,i.maxRatio,i.animate)):(n(c,s-R,l-f,0,0,i.fixedRatio,i.minRatio,i.maxRatio,i.animate),n(p,v,x,b,u,i.bigFixedRatio,i.bigMinRatio,i.bigMaxRatio,i.animate))}else p.length>0&&0===c.length?n(p,s,l,0,0,i.bigFixedRatio,i.bigMinRatio,i.bigMaxRatio,i.animate):n(c,s-R,l-f,R,f,i.fixedRatio,i.minRatio,i.maxRatio,i.animate)}};exports.initLayoutContainer=function(t,i){return i=OT.$.defaults(i||{},{maxRatio:1.5,minRatio:9/16,fixedRatio:!1,animate:!1,bigClass:"OT_big",bigPercentage:.8,bigFixedRatio:!1,bigMaxRatio:1.5,bigMinRatio:9/16,bigFirst:!0}),t="string"==typeof t?OT.$(t):t,OT.onLoad(function(){d(t,i)}),{layout:d.bind(null,t,i)}},OT.initLayoutContainer=exports.initLayoutContainer}(jQuery);
{
"name": "opentok-layout-js",
"version": "0.1.1",
"version": "0.1.3",
"description": "Automatic layout of video elements (publisher and subscriber) minimising white-space for the OpenTok on WebRTC API. This is intended for use with the OpenTok on WebRTC JS API.",

@@ -5,0 +5,0 @@ "main": "opentok-layout.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc