Files
ArtPlayer/docs/compiled/artplayer-plugin-ads.legacy.js
T
2023-08-26 13:32:51 +08:00

24 lines
9.2 KiB
JavaScript

/*!
* artplayer-plugin-ads.js v2.0.0
* Github: https://github.com/zhw2590582/ArtPlayer
* (c) 2017-2023 Harvey Zack
* Released under the MIT License.
*/
!// modules are defined as an array
// [ module function, map of requires ]
//
// map of requires is short require name -> numeric require
//
// anything defined in a previous bundle is accessed via the
// orig method which is the require for previous bundles
function(e,n,t,r,l){/* eslint-disable no-undef */var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},a="function"==typeof i[r]&&i[r],o=a.cache||{},s="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function d(n,t){if(!o[n]){if(!e[n]){// if we cannot find the module within our internal map or
// cache jump to the current global require ie. the last bundle
// that was added to the page.
var l="function"==typeof i[r]&&i[r];if(!t&&l)return l(n,!0);// If there are other bundles on this page the require from the
// previous one is saved to 'previousRequire'. Repeat this as
// many times as there are bundles until the module is found or
// we exhaust the require chain.
if(a)return a(n,!0);// Try the node require function if it exists.
if(s&&"string"==typeof n)return s(n);var p=Error("Cannot find module '"+n+"'");throw p.code="MODULE_NOT_FOUND",p}c.resolve=function(t){var r=e[n][1][t];return null!=r?r:t},c.cache={};var u=o[n]=new d.Module(n);e[n][0].call(u.exports,c,u,u.exports,this)}return o[n].exports;function c(e){var n=c.resolve(e);return!1===n?{}:d(n)}}d.isParcelRequire=!0,d.Module=function(e){this.id=e,this.bundle=d,this.exports={}},d.modules=e,d.cache=o,d.parent=a,d.register=function(n,t){e[n]=[function(e,n){n.exports=t},{}]},Object.defineProperty(d,"root",{get:function(){return i[r]}}),i[r]=d;for(var p=0;p<n.length;p++)d(n[p]);if(t){// Expose entry point to Node, AMD or browser globals
// Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
var u=d(t);"object"==typeof exports&&"undefined"!=typeof module?module.exports=u:"function"==typeof define&&define.amd?define(function(){return u}):l&&(this[l]=u)}}({"69VIU":[function(e,n,t){var r=e("@parcel/transformer-js/src/esmodule-helpers.js");r.defineInteropFlag(t),r.export(t,"default",function(){return o});var l=e("@swc/helpers/_/_object_spread"),i=e("bundle-text:./style.less"),a=r.interopDefault(i);function o(e){return function(n){r=(t=n.constructor).version,(0,t.utils.errorHandle)((i=r.split(".").map(Number))[0]+i[1]/100>=5,"Artplayer.js@".concat(r," is not compatible the artplayerPluginAds@").concat(o.version,". Please update it to version Artplayer.js@5.x.x"));var t,r,i,a=n.template.$player,s=n.icons,d=s.volume,p=s.volumeClose,u=s.fullscreenOn,c=s.fullscreenOff,f=s.loading,y=n.constructor,g=y.validator,m=y.utils,v=m.query,h=m.append,x=m.setStyle;e=g((0,l._)({html:"",video:"",url:"",playDuration:5,totalDuration:10,muted:!1,i18n:{close:"关闭广告",countdown:"%s秒",detail:"查看详情",canBeClosed:"%s秒后可关闭广告"}},e),{html:"?string",video:"?string",url:"?string",playDuration:"number",totalDuration:"number",muted:"?boolean",i18n:{close:"string",countdown:"string",detail:"string",canBeClosed:"string"}});var b=null,w=null,j=null,_=null,D=null,O=null,P=0,k=null,A=!1,I=!1,M=!1;function C(e,n){return n.replace("%s",e)}function L(){A=!0,n.play(),e.video&&b.pause(),x(n.template.$ads,"display","none"),n.emit("artplayerPluginAds:skip",e)}function T(){A||(k=setTimeout(function(){P+=1;var n=e.playDuration-P;n>=1?j.innerHTML=C(n,e.i18n.canBeClosed):(j.innerHTML=e.i18n.close,M||(M=!0)),_.innerHTML=C(e.totalDuration-P,e.i18n.countdown),P>=e.totalDuration?L():T()},1e3))}function F(){A||clearTimeout(k)}function U(){I||(I=!0,function(){n.template.$ads=h(a,'<div class="artplayer-plugin-ads"></div>'),b=h(n.template.$ads,e.video?'<video class="artplayer-plugin-ads-video" src="'.concat(e.video,'" loop playsInline></video>'):'<div class="artplayer-plugin-ads-html">'.concat(e.html,"</div>")),O=h(n.template.$ads,'<div class="artplayer-plugin-ads-loading"></div>'),h(O,f),j=v(".artplayer-plugin-ads-close",w=h(n.template.$ads,'<div class="artplayer-plugin-ads-timer"><div class="artplayer-plugin-ads-close">'.concat(e.playDuration<=0?e.i18n.close:C(e.playDuration,e.i18n.canBeClosed),'</div><div class="artplayer-plugin-ads-countdown">').concat(C(e.totalDuration,e.i18n.countdown),"</div></div>"))),_=v(".artplayer-plugin-ads-countdown",w),e.playDuration>=e.totalDuration&&x(j,"display","none"),n.proxy(j,"click",function(){M&&L()});var t=v(".artplayer-plugin-ads-detail",D=h(n.template.$ads,'<div class="artplayer-plugin-ads-control"><div class="artplayer-plugin-ads-detail">'.concat(e.i18n.detail,'</div><div class="artplayer-plugin-ads-muted"></div><div class="artplayer-plugin-ads-fullscreen"></div></div>'))),r=v(".artplayer-plugin-ads-muted",D),l=v(".artplayer-plugin-ads-fullscreen",D);if(e.url?n.proxy(t,"click",function(){window.open(e.url),n.emit("artplayerPluginAds:click",e)}):x(t,"display","none"),e.video){var i=h(r,d),o=h(r,p);x(o,"display","none"),e.muted&&(b.muted=!0,x(i,"display","none"),x(o,"display","inline-flex")),n.proxy(r,"click",function(){b.muted=!b.muted,b.muted?(x(i,"display","none"),x(o,"display","inline-flex")):(x(i,"display","inline-flex"),x(o,"display","none"))})}else x(r,"display","none");var s=h(l,u),y=h(l,c);x(y,"display","none"),n.proxy(l,"click",function(){n.fullscreen=!n.fullscreen,n.fullscreen?(x(s,"display","inline-flex"),x(y,"display","none")):(x(s,"display","none"),x(y,"display","inline-flex"))}),n.proxy(b,"click",function(){e.url&&window.open(e.url),n.emit("artplayerPluginAds:click",e)})}(),n.pause(),e.video?(n.proxy(b,"error",L),n.proxy(b,"loadedmetadata",function(){T(),b.play(),x(w,"display","flex"),x(D,"display","flex"),x(O,"display","none")})):(T(),x(w,"display","flex"),x(D,"display","flex"),x(O,"display","none")),n.proxy(document,"visibilitychange",function(){document.hidden?F():T()}))}return n.on("ready",function(){n.once("play",U),n.once("video:playing",U)}),{name:"artplayerPluginAds",skip:L,pause:F,play:T}}}if(o.env="production",o.version="2.0.0",o.build="2023-08-26 13:29:29","undefined"!=typeof document&&!document.getElementById("artplayer-plugin-ads")){var s=document.createElement("style");s.id="artplayer-plugin-ads",s.textContent=a.default,document.head.appendChild(s)}"undefined"!=typeof window&&(window.artplayerPluginAds=o)},{"@swc/helpers/_/_object_spread":"9agdF","bundle-text:./style.less":"1LZhU","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],"9agdF":[function(e,n,t){var r=e("@parcel/transformer-js/src/esmodule-helpers.js");r.defineInteropFlag(t),r.export(t,"_object_spread",function(){return i}),r.export(t,"_",function(){return i});var l=e("./_define_property.js");function i(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.forEach(function(n){(0,l._define_property)(e,n,t[n])})}return e}},{"./_define_property.js":"3NGsL","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],"3NGsL":[function(e,n,t){var r=e("@parcel/transformer-js/src/esmodule-helpers.js");function l(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}r.defineInteropFlag(t),r.export(t,"_define_property",function(){return l}),r.export(t,"_",function(){return l})},{"@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],iWrD0:[function(e,n,t){t.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},t.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},t.exportAll=function(e,n){return Object.keys(e).forEach(function(t){"default"===t||"__esModule"===t||n.hasOwnProperty(t)||Object.defineProperty(n,t,{enumerable:!0,get:function(){return e[t]}})}),n},t.export=function(e,n,t){Object.defineProperty(e,n,{enumerable:!0,get:t})}},{}],"1LZhU":[function(e,n,t){n.exports=".artplayer-plugin-ads{z-index:150;width:100%;height:100%;color:#fff;background-color:#000;font-size:13px;line-height:1;position:absolute;top:0;bottom:0;left:0;right:0;overflow:hidden}.artplayer-plugin-ads .artplayer-plugin-ads-html{width:100%;height:100%;justify-content:center;align-items:center;display:flex}.artplayer-plugin-ads .artplayer-plugin-ads-video{width:100%;height:100%}.artplayer-plugin-ads .artplayer-plugin-ads-timer{display:none;position:absolute;top:10px;right:10px}.artplayer-plugin-ads .artplayer-plugin-ads-timer>div{cursor:pointer;background-color:rgba(0,0,0,.5);border-radius:15px;align-items:center;margin-left:5px;padding:5px 10px;display:flex}.artplayer-plugin-ads .artplayer-plugin-ads-control{display:none;position:absolute;bottom:10px;right:10px}.artplayer-plugin-ads .artplayer-plugin-ads-control>div{cursor:pointer;background-color:rgba(0,0,0,.5);border-radius:15px;align-items:center;margin-left:5px;padding:5px 10px;display:flex}.artplayer-plugin-ads .artplayer-plugin-ads-control .art-icon svg{width:20px;height:20px}.artplayer-plugin-ads .artplayer-plugin-ads-loading{width:100%;height:100%;justify-content:center;align-items:center;display:flex;position:absolute;top:0;bottom:0;left:0;right:0}"},{}]},["69VIU"],"69VIU","parcelRequire4dc0");