UNPKG

flowplayer-files

Version:

Flowplayer js and css files for v2.5.9 after the reboot of flowplayer

2 lines (1 loc) 7.55 kB
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):((t=t||self).flowplayer=t.flowplayer||{},t.flowplayer["float_on-scroll"]=e())}(this,(function(){"use strict";var t=[].slice;function e(t,e,n){for(var o=function(t){return Array.isArray(t)?t.slice(0):t.split(".")}(e);o.length;){if(null==t)return n;var r=o.shift();if("string"!=typeof r)return n;t=t[r]}return null==t?n:t}var n="function"==typeof requestAnimationFrame?requestAnimationFrame:setTimeout;var o=!!function(){var t=!1;try{var e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("testPassive",null,e),window.removeEventListener("testPassive",null,e)}catch(t){}return t}()&&{passive:!0},r=["touchstart","touchmove"];function i(t){return t.emit=function(e,n,o){o=o||{};var r=function(t){var e=document.createEvent("Event");return e.initEvent(t,!1,!0),e}(e);return n&&function(t,e){for(var n=[],o=2;o<arguments.length;o++)n[o-2]=arguments[o];for(var r in e)t[r]=e[r]}(r,{data:n||{}}),t.dispatchEvent(r),!1===o.return_self?r:t},t.on=function(e,n){return"string"==typeof e&&(e=e.split(" ")),e.forEach((function(e){return function(t){return~r.indexOf(t)}(e)?t.addEventListener(e,n,o):t.addEventListener(e,n)})),t},t.off=function(e,n){return t.removeEventListener(e,n),t},t.one=t.once=function(e,n){return t.on(e,(function o(r){t.off(e,o),n(r)}))},t}var a=Array.isArray,u="undefined"!=typeof window&&i(window),l="undefined"!=typeof document&&i(document),f=["span","a","em","p","i"],s=f.concat(["div","strong","video","img","ol","ul","li","script"]);function c(t,e,n){var o=d(document.createElement(t));if(a(e)&&(n=e,e=!1),a(n)||(n=[n]),o.append(n.filter((function(t){return t}))),"object"!=typeof e)return o;for(var r in e)r in o?o[r]=e[r]:o.setAttribute(r,e[r]);return o}function p(e){var n=e.tagName;e.__flowplayer__=1,e.find=function(t){var n=e.querySelector(t);return n?d(n):n},e.html=function(t){return e.innerHTML=t,e},e.empty=function(){return e.innerHTML="",e},e.offset=function(){var t={top:0,left:0},n=e;do{t.left+=n.offsetLeft||0,t.top+=n.offsetTop||0}while(n=n.offsetParent);return t},e.innerWidth=function(){var t=getComputedStyle(e);return e.clientWidth-parseFloat(t.paddingLeft)-parseFloat(t.paddingRight)};var o=e.insert=function(t,n){return a(n)?n.map((function(n){return e.insert(t,n)}))[0]:d(n="string"==typeof n?e.insertAdjacentHTML(t,n):e.insertAdjacentElement?e.insertAdjacentElement(t,n):e.appendChild(n))};return e.append=o.bind(e,"beforeend"),e.prepend=o.bind(e,"afterbegin"),e.css=function(t,n){if("object"==typeof t){for(var o in t)e.css(o,t[o]);return e}return void 0===n?getComputedStyle(e)[t]:(1*n&&(n+="px"),e.style[t]=n,e)},e.show=function(){return e.css({display:~f.indexOf(n)?"inline":"block"})},e.hide=function(){return e.css({display:"none"})},e.remove=function(){var t=e.parentNode;t&&t.removeChild(e)},e.attr=function(t,n){return null==n?e.getAttribute(t):(e.setAttribute(t,n),e)},e.txt=function(t){return e.textContent=t,e},e.fp=function(t){return e.addClass("fp-"+t)},e.addClass=function(t){return t.split(" ").forEach((function(t){e.hasClass(t)||(e.className+=(e.className?" ":"")+t)})),e},e.removeClass=function(t){t=t.split(" ");var n=e.className.split(" ");return e.className=n.filter((function(e){return!~t.indexOf(e)})).join(" "),e},e.toggleClass=function(t,n){return void 0===n&&(n=!e.hasClass(t)),n?e.addClass(t):e.removeClass(t)},e.findAll=function(n){return o=e.querySelectorAll(n),t.call(o);var o},e.hasClass=function(t){return~e.className.split(" ").indexOf(t)},e}function d(t){return void 0===t||function(t){return t&&t.__flowplayer__}(t)?t:p(i(t))}function v(t,e){if("string"==typeof t&&"<"==t[0])return c(t.slice(1,-1),e);if("string"!=typeof t)return d(t);var n=e instanceof HTMLElement&&e.querySelector(".fp-"+t)||document.querySelector(t);return n?d(n):void 0}v.window=u,v.document=l,v.el=c,s.forEach((function(t){v[t]=function(e,n){return"string"==typeof e&&(e={class:e}),c(t,e,n)}}));var m="float:pop:in",y=Object.freeze({__proto__:null,POP_IN:m,POP_OUT:"float:pop:out"});var g=Object.freeze({__proto__:null,NO_STANDARD_CONTROLS:1<<20}),w={coords:"-22 -22 122 122",link:"#fp-mute",translation_key:"core.mute",name:"fp-mute"},_={coords:"-22 -22 122 122",link:"#fp-unmute",translation_key:"core.mute",name:"fp-unmute"},h={coords:"19 0 80 80",link:"#fp-close",translation_key:"core.close",name:"fp-close"};function A(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function b(t){var e,n,o=A("svg");return o.setAttribute("viewBox",t.coords),t.name&&o.setAttribute("class",t.name),t.title&&o.setAttribute("title",t.title),t.title&&o.setAttribute("aria-label",t.title),o.setAttribute("tabindex","0"),o.setAttribute("focusable","true"),o.appendChild((e=t.link,(n=A("use")).setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",e),n)),v(o)}var C={PLACEHOLDER:void 0,FLOATING_CONTAINER:void 0},E="flowplayer-floating-container",N="flowplayer-floating-placeholder",x="fp-on",O="no-standard-controls";function L(){return function(t){const e=t.getBoundingClientRect(),n=window.innerHeight,o=e.y;return o>n||o+e.height<0?0:e.y<0?(e.height+o)/e.height:n-e.y>e.height?1:Math.abs((n-e.y)/e.height)}(k())>.8}function T(){return C.FLOATING_CONTAINER=C.FLOATING_CONTAINER||v.div().attr("id",E)}function k(){return C.PLACEHOLDER=C.PLACEHOLDER||v.div().attr("id",N)}function P(t,e){var n=e.parentNode;n&&n.replaceChild(t,e)}function S(t,n,o){if(0!=o.reaper&&!o.floating){var r=T(),i=k(),a=v.p().txt(o._t("float_on_scroll.popped_out","video playing in floating mode"));i.empty().appendChild(a);var u=n.aspect_ratio.cloneNode(!1);u&&i.append(u),P(i,n),r.append(n),r.addClass(x),r.toggleClass(O,function(t){return 1<<20&e(t,"opts.ui",0)}(o)),t.pop_out_container.appendChild(r),o.emit("resize"),o.emit("float:pop:out")}}function j(t,e,n){if(0!=n.reaper&&n.floating){var o=T();P(e,k()),o.removeClass(x),o.parentElement.removeChild(o),n.emit("resize"),n.emit(m)}}function R(t,o,r){if(!(t.multiplay||"float_on_scroll"in t&&0==t.float_on_scroll)){(function(){try{return window.self!==window.top}catch(t){return!0}})()&&console.warn("iframe detected - floating player not supported in iframe");var i={pop_out_container:e(t,"float_on_scroll.container",document.body),was_user_toggled:!1},a=e(o,"ui.header");a&&function(t,e,n,o){var r=v.div("fp-exit-float");r.append(b(h).attr("role","button")),r.on("click",(function(){e.was_user_toggled=!0,o.togglePlay(!1),j(0,n,o)})),t.append(r);var i=v.div("fp-mute-float"),a=b(w).attr("role","button"),u=b(_).attr("role","button");i.append([a,u]),i.on("click",(function(){o.toggleMute(!o.muted)})),t.append(i)}(a,i,o,r);var u,l,f,s,c,p,d,y=(u=function(){L()&&j(0,o,r)},s=l||60,c=Math.ceil(1e3/s),p=Date.now(),d=null,function(){var t=Date.now()-p;null===d&&(d=(f||n)((function(){d=null,u.apply(this,arguments),p=Date.now()}),Math.max(0,c-t)))});r.on("viewleave",(function(){r.paused||i.was_user_toggled||S(i,o,r)})),r.on("viewenter",(function(){i.was_user_toggled=!1})),r.on("float:pop:out",(function(){window.on("scroll",y),r.floating=!0,r.setState("is-popped-out",!0)})),r.on(m,(function(){window.off("scroll",y),r.floating=!1,r.setState("is-popped-out",!1)}))}}return R.events=y,R.flags=g,function(t,e){if("object"==typeof exports&&"undefined"!=typeof module)return e;"flowplayer"in t||(t.flowplayer={extensions:[]});var n=t.flowplayer;return"function"==typeof n?(n(e),e):(Array.isArray(n.extensions)||(n.extensions=[]),~n.extensions.indexOf(e)||n.extensions.push(e),e)}(window,R)}));