flowplayer-files
Version:
Flowplayer js and css files for v2.5.9 after the reboot of flowplayer
2 lines (1 loc) • 11.8 kB
JavaScript
!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.share=e())}(this,(function(){"use strict";var t=[].slice;function e(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];for(var i in e)t[i]=e[i];return t}function n(t,e,n){for(var r=function(t){return Array.isArray(t)?t.slice(0):t.split(".")}(e);r.length;){if(null==t)return n;var i=r.shift();if("string"!=typeof i)return n;t=t[i]}return null==t?n:t}var r=!!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},i=["touchstart","touchmove"];function o(t){return t.emit=function(n,r,i){i=i||{};var o=function(t){var e=document.createEvent("Event");return e.initEvent(t,!1,!0),e}(n);return r&&e(o,{data:r||{}}),t.dispatchEvent(o),!1===i.return_self?o:t},t.on=function(e,n){return"string"==typeof e&&(e=e.split(" ")),e.forEach((function(e){return function(t){return~i.indexOf(t)}(e)?t.addEventListener(e,n,r):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 r(i){t.off(e,r),n(i)}))},t}var a=Array.isArray,s="undefined"!=typeof window&&o(window),u="undefined"!=typeof document&&o(document),c=["span","a","em","p","i"],l=c.concat(["div","strong","video","img","ol","ul","li","script"]);function f(t,e,n){var r=p(document.createElement(t));if(a(e)&&(n=e,e=!1),a(n)||(n=[n]),r.append(n.filter((function(t){return t}))),"object"!=typeof e)return r;for(var i in e)i in r?r[i]=e[i]:r.setAttribute(i,e[i]);return r}function d(e){var n=e.tagName;e.__flowplayer__=1,e.find=function(t){var n=e.querySelector(t);return n?p(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 r=e.insert=function(t,n){return a(n)?n.map((function(n){return e.insert(t,n)}))[0]:p(n="string"==typeof n?e.insertAdjacentHTML(t,n):e.insertAdjacentElement?e.insertAdjacentElement(t,n):e.appendChild(n))};return e.append=r.bind(e,"beforeend"),e.prepend=r.bind(e,"afterbegin"),e.css=function(t,n){if("object"==typeof t){for(var r in t)e.css(r,t[r]);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:~c.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 r=e.querySelectorAll(n),t.call(r);var r},e.hasClass=function(t){return~e.className.split(" ").indexOf(t)},e}function p(t){return void 0===t||function(t){return t&&t.__flowplayer__}(t)?t:d(o(t))}function h(t,e){if("string"==typeof t&&"<"==t[0])return f(t.slice(1,-1),e);if("string"!=typeof t)return p(t);var n=e instanceof HTMLElement&&e.querySelector(".fp-"+t)||document.querySelector(t);return n?p(n):void 0}function m(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function v(t){var e,n,r=m("svg");return r.setAttribute("viewBox",t.coords),t.name&&r.setAttribute("class",t.name),t.title&&r.setAttribute("title",t.title),t.title&&r.setAttribute("aria-label",t.title),r.setAttribute("tabindex","0"),r.setAttribute("focusable","true"),r.appendChild((e=t.link,(n=m("use")).setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",e),n)),h(r)}h.window=s,h.document=u,h.el=f,l.forEach((function(t){h[t]=function(e,n){return"string"==typeof e&&(e={class:e}),f(t,e,n)}}));var g={TOGGLE_OPEN:"menu:toggle:open",RENDER:"menu:render",PUSH:"menu:push"},b={ON:"fp-on",INVIS:"fp-invis"};function y(t,n,r){var i=r.id||"menu-"+Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5);return r=r||{},t.attr("role","button").attr("aria-haspopup","true").attr("aria-expanded","false").attr("aria-controls",i).attr("aria-label",r.title),r.options=r.options||[],r.id=i,y._interface(t,n,function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return t.slice(1).reduce((function(t,n){return e(t,n)}),t[0]||{})}({},r))}y.title=function(t){return h("<h3>").txt(t)},y.close=function(t){return h.span("fp-close").on("click",t).html("×")},y.option=function(t,e){var n=this,r=h("<li>").attr("tabindex","0").attr("role","menuitem"),i=n._attrs;t.icon&&r.append(v(t.icon)),r.append(h("<span>").txt(t.text)),r.on("click",(function(r){i.multi||n.options().forEach(y.off),n.activate(e),"function"==typeof t.onclick&&t.onclick(r,t,e,n)})),r.idx=e,n.append(r)},y._interface=function(t,e,r){t.addClass("fp-menu-container");var i=h("<ul>").attr("id",r.id).addClass("fp-menu").attr("role","menu");return r.icons&&i.addClass("fp-icons"),i._attrs=r,t.on("click",(function(t){setTimeout((function(){if(!t.defaultPrevented)return i.hasClass(b.ON)?e.emit(g.TOGGLE_OPEN,{menu:i,open:!1}):void e.emit(g.TOGGLE_OPEN,{menu:i,open:!0})}),0)})),i.on("mouseleave",(function(){e.emit(g.TOGGLE_OPEN,{menu:i,open:!1})})),e.on(g.TOGGLE_OPEN,(function(r){if(n(r,"data.menu")!==i)return i.toggleClass(b.ON,!1),t.attr("aria-expanded","false");var o=n(r,"data.open",!1);if(i.toggleClass(b.ON,o),t.attr("aria-expanded",o?"true":"false"),e.hasClass("is-accessibility"))if(o){var a=i.options()[0];a&&a.focus()}else t.focus()})),i.push=function(t){return i._attrs.options=n(i,"_attrs.options",[]),i._attrs.options.push(t),i.render()},i.select=function(t){return i.render(i.options.filter(t))},i.render=function(e){var n=i._attrs;return i.empty(),i.prepend(y.close()),n.title&&i.prepend(y.title(n.title)),n.options=e||n.options,n.options.forEach(y.option,i),t.toggleClass(b.INVIS,0==n.options.length),i._activate(),i},i.close=function(){i.hasClass(b.ON)&&e.emit(g.TOGGLE_OPEN,{menu:i,open:!1})},i._activate=function(){i.options().forEach((function(t){t.toggleClass(b.ON,t.idx===i.idx)}))},i.options=function(){return[].slice.call(i.querySelectorAll("li"))},i.activate=function(t,e){void 0===i.idx||i.idx!==t||e?i.idx=t:delete i.idx,i._activate()},i.deactivate=function(){i.activate(i.idx)},i.render(r.options),t.appendChild(i),i},y.on=function(t){return t.addClass(b.ON),t},y.off=function(t){return t.removeClass(b.ON),t},y.CONTAINER_CLASS="fp-menu",y.Events=g,y.States=b;var w={coords:"-5 25 460 460",link:"#fp-facebook",name:"fp-facebook"},_={coords:"0 0 512 512",link:"#fp-link",name:"fp-link"},x={coords:"0 0 448 512",link:"#fp-share",name:"fp-share"},C={coords:"0 0 512 512",link:"#fp-share",name:"fp-embed"},E={coords:"0 0 512 512",link:"#fp-twitter",name:"fp-twitter"};function O(){try{return(document.querySelector("meta[name='description']")||{content:""}).content}catch(t){return""}}function k(t){if("string"==typeof t.link)return t.link;var e=document.querySelector("link[rel=canonical]");return e?e.href:window.location.toString()}function N(t,e,r){var i=0,o=h.span("fp-share-menu fp-menu-container").attr("tabindex","0");o.append(v(x).attr("tabindex",""));var a={prev_config:0,webshare_listener:0};r.on("mount",(function(){var t=n(e,"ui.header.secondary");t&&t.append(o)}));var s=y(o,e,{title:r._t("share.menu_title"),icons:!0,options:[]});function u(t,e,n){return{text:(i=t,0===i.indexOf("share.")?r._t(i):i),icon:n,onclick:A.bind(null,r,s,e)};var i}r.on("config",(function(e){var i=n(e,"data.share",{});if(!1===i)return function(t){t.removeClass("webshare-enabled")}(o);if(a.prev_config!==i){if(a.prev_config=i,function(){try{return"https:"===window.location.protocol&&"function"==typeof navigator.share}catch(t){return!1}}()&&n(i,"web_share",!0))return function(t){t.addClass("webshare-enabled")}(o),a.webshare_listener||function(t,e,r){r.webshare_listener=!0,e.on("click",(function(r){if(!i&&e.hasClass("webshare-enabled")){r.preventDefault();var i=navigator.share({title:n(t,"share.title",document.title),text:n(t,"share.text",O()),url:k(n(t,"share",{}))});i.catch((function(){}))}}))}(t,o,a);var c=[],l="string"==typeof i.link?i.link:window.location.toString();if(i.iframe){var f="string"==typeof i.iframe?i.iframe:l;c.push(u("share.embed",S.bind(null,f,r),C))}i.link&&c.push(u("share.link",L.bind(null,l),_)),i.facebook&&c.push(u("Facebook",R.bind(null,l),w)),i.twitter&&c.push(u("Twitter",T.bind(null,l),E)),s.render(c)}}));e.on(y.Events.TOGGLE_OPEN,(function(t){if(t.data&&t.data.menu===s){if(r.root.toggleClass("is-share-menu",t.data.open),e.hasClass("is-small"))return(n=!!t.data)&&!r.paused&&(r.pause(),i=1),!n&&i&&(r.play(),i=0),void function(t,e,n,r){var i=r.getBoundingClientRect(),o=function(t,e){var n={top:0,left:0},r=t;for(;r.parentElement&&r.parentElement!==e;)r=r.parentElement,n.top+=r.offsetTop,n.left+=r.offsetLeft;return n}(e,r),a=(s=n,[].reduce.call(s.childNodes,(function(t,e){return t+e.getBoundingClientRect().height}),0));var s;n.css({position:"absolute",right:"auto",bottom:"auto",top:-o.top+"px",left:-o.left+"px",width:i.width+"px",height:a+"px",minHeight:i.height+"px",maxHeight:i.height+"px",margin:0})}(0,o,s,e);var n;!function(t,e,n,r){var i,o=function(t,e){var n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return{left:n.left-r.left,right:n.right-r.left,top:n.top-r.top,bottom:n.bottom-r.top}}(e,r),a=r.getBoundingClientRect(),s=r.hasClass("logo-on-right");i={right:"auto",left:o.right+"px",top:(s?0:o.top)+"px",bottom:"auto",width:"auto",height:"auto",minHeight:"",maxHeight:.75*a.height+"px",margin:"0.5em"},n.css(i)}(0,o,s,e)}})),r.on("state",(function(t){r.hasState("is-touched")||r.hasState("is-hovered")||!r.hasState("is-playing")||s.close()}))}function A(t,e,n){e.deactivate();var r=n();r.success&&r.message&&t.message&&t.root.emit(t.message.events.SHOW_MESSAGE,{message:r.message})}function S(t,e){var n=e.videoHeight/e.videoWidth;return L('<div style="position:relative;width:100%;display:inline-block;"><iframe src="__IFRAME_SRC__" allowfullscreen style="border:none;position:absolute;top:0;left:0;width:100%;height:100%;"></iframe><div style="padding-top: __RATIO__%;"></div></div>'.replace("__IFRAME_SRC__",encodeURI(t)).replace("__RATIO__",100*n))}function L(t){var e=h.el("textarea").css({opacity:0,position:"absolute"});e.value=t;var n=h(document.body);n.append(e),e.select();var r=document.execCommand("copy");return n.removeChild(e),{success:r,message:r?"<trans share.clipboard_success trans>":"<trans share.clipboard_failure trans>"}}function R(t){return G("https://www.facebook.com/sharer.php?u="+encodeURIComponent(t)),{success:!0}}function T(t){return G("https://twitter.com/intent/tweet?url="+encodeURIComponent(t)),{success:!0}}function G(t){var e,n,r=screen.height,i=screen.width;e=Math.round(i/2-275),n=0,r>420&&(n=Math.round(r/2-210)),window.open(t,"sharer","scrollbars=yes,resizable=yes,toolbar=no,location=yes,width=550,height=420,left="+e+",top="+n)}return function(t,e){if("object"==typeof exports&&"undefined"!=typeof module)return e;"flowplayer"in t||(t.flowplayer={extensions:[]});var n=t.flowplayer;"function"==typeof n?n(e):(Array.isArray(n.extensions)||(n.extensions=[]),~n.extensions.indexOf(e)||n.extensions.push(e))}(window,N),N}));