mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-08 10:56:15 -08:00
artplayer-plugin-ads@1.0.3
This commit is contained in:
1 parent
d81f9d4f65
commit
1d4b2d58ac
9 files changed
+16
-8
No files matched your search
@@ -16,6 +16,7 @@ var art = new Artplayer({
|
||||
url: 'http://artplayer.org',
|
||||
|
||||
// 必须观看的时长,期间不能被跳过,单位为秒
|
||||
// 当该值大于或等于totalDuration时,不能提前关闭广告
|
||||
playDuration: 5,
|
||||
|
||||
// 广告总时长,单位为秒
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*!
|
||||
* artplayer-plugin-ads.js v1.0.2
|
||||
* artplayer-plugin-ads.js v1.0.3
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2022 Harvey Zack
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,n,l,t,i){var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},r="function"==typeof a.parcelRequirea5da&&a.parcelRequirea5da,o=r.cache||{},d="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function s(n,l){if(!o[n]){if(!e[n]){var t="function"==typeof a.parcelRequirea5da&&a.parcelRequirea5da;if(!l&&t)return t(n,!0);if(r)return r(n,!0);if(d&&"string"==typeof n)return d(n);var i=new Error("Cannot find module '"+n+"'");throw i.code="MODULE_NOT_FOUND",i}u.resolve=function(l){var t=e[n][1][l];return null!=t?t:l},u.cache={};var p=o[n]=new s.Module(n);e[n][0].call(p.exports,u,p,p.exports,this)}return o[n].exports;function u(e){var n=u.resolve(e);return!1===n?{}:s(n)}}s.isParcelRequire=!0,s.Module=function(e){this.id=e,this.bundle=s,this.exports={}},s.modules=e,s.cache=o,s.parent=r,s.register=function(n,l){e[n]=[function(e,n){n.exports=l},{}]},Object.defineProperty(s,"root",{get:function(){return a.parcelRequirea5da}}),a.parcelRequirea5da=s;for(var p=0;p<n.length;p++)s(n[p]);var u=s(l);"object"==typeof exports&&"undefined"!=typeof module?module.exports=u:"function"==typeof define&&define.amd&&define((function(){return u}))}({E13ST:[function(e,n,l){var t=e("@parcel/transformer-js/src/esmodule-helpers.js");t.defineInteropFlag(l);var i=e("bundle-text:./style.less"),a=t.interopDefault(i);function r(e){return n=>{const{template:{$player:l},icons:{volume:t,volumeClose:i,fullscreenOn:a,fullscreenOff:r,loading:o},constructor:{validator:d,utils:{query:s,append:p,setStyle:u}}}=n;e=d({html:"",video:"",url:"",playDuration:5,totalDuration:10,i18n:{close:"关闭广告",countdown:"%s秒",detail:"查看详情",canBeClosed:"%s秒后可关闭广告"},...e},{html:"?string",video:"?string",url:"?string",playDuration:"number",totalDuration:"number",i18n:{close:"string",countdown:"string",detail:"string",canBeClosed:"string"}});let c=null,y=null,f=null,g=null,m=null,v=null,x=0,h=null,b=!1,w=!1;function j(e,n){return n.replace("%s",e)}function k(){b=!0,n.play(),e.video&&c.pause(),u(n.template.$ads,"display","none"),n.emit("artplayerPluginAds:skip",e)}function D(){b||(h=setTimeout((()=>{x+=1;const l=e.playDuration-x;l>=1?f.innerHTML=j(l,e.i18n.canBeClosed):(f.innerHTML=e.i18n.close,n.proxy(f,"click",k)),g.innerHTML=j(e.totalDuration-x,e.i18n.countdown),x>=e.totalDuration?k():D()}),1e3))}function O(){b||clearTimeout(h)}function $(){w||(w=!0,function(){n.template.$ads=p(l,'<div class="artplayer-plugin-ads"></div>'),c=p(n.template.$ads,e.video?`<video class="artplayer-plugin-ads-video" src="${e.video}" loop playsInline></video>`:`<div class="artplayer-plugin-ads-html">${e.html}</div>`),v=p(n.template.$ads,'<div class="artplayer-plugin-ads-loading"></div>'),p(v,o),y=p(n.template.$ads,`<div class="artplayer-plugin-ads-timer"><div class="artplayer-plugin-ads-close">${j(e.playDuration,e.i18n.canBeClosed)}</div><div class="artplayer-plugin-ads-countdown">${j(e.totalDuration,e.i18n.countdown)}</div></div>`),f=s(".artplayer-plugin-ads-close",y),g=s(".artplayer-plugin-ads-countdown",y),m=p(n.template.$ads,`<div class="artplayer-plugin-ads-control"><div class="artplayer-plugin-ads-detail">${e.i18n.detail}</div><div class="artplayer-plugin-ads-muted"></div><div class="artplayer-plugin-ads-fullscreen"></div></div>`);const d=s(".artplayer-plugin-ads-detail",m),x=s(".artplayer-plugin-ads-muted",m),h=s(".artplayer-plugin-ads-fullscreen",m);if(e.url?n.proxy(d,"click",(()=>{window.open(e.url),n.emit("artplayerPluginAds:click",e)})):u(d,"display","none"),e.video){const e=p(x,t),l=p(x,i);u(l,"display","none"),n.proxy(x,"click",(()=>{c.muted=!c.muted,c.muted?(u(e,"display","none"),u(l,"display","inline-flex")):(u(e,"display","inline-flex"),u(l,"display","none"))}))}else u(x,"display","none");const b=p(h,a),w=p(h,r);u(w,"display","none"),n.proxy(h,"click",(()=>{n.fullscreen=!n.fullscreen,n.fullscreen?(u(b,"display","inline-flex"),u(w,"display","none")):(u(b,"display","none"),u(w,"display","inline-flex"))})),n.proxy(c,"click",(()=>{e.url&&window.open(e.url),n.emit("artplayerPluginAds:click",e)}))}(),n.pause(),e.video?(n.proxy(c,"error",k),n.proxy(c,"loadedmetadata",(()=>{D(),c.play(),u(y,"display","flex"),u(m,"display","flex"),u(v,"display","none")}))):(D(),u(y,"display","flex"),u(m,"display","flex"),u(v,"display","none")),n.proxy(document,"visibilitychange",(()=>{document.hidden?O():D()})))}return n.on("ready",(()=>{n.once("play",$),n.once("video:playing",$)})),{name:"artplayerPluginAds",skip:k,pause:O,play:D}}}if(l.default=r,r.env="production",r.version="1.0.2",r.build="1655794470564","undefined"!=typeof document&&!document.getElementById("artplayer-plugin-ads")){const e=document.createElement("style");e.id="artplayer-plugin-ads",e.textContent=a.default,document.head.appendChild(e)}"undefined"!=typeof window&&(window.artplayerPluginAds=r)},{"bundle-text:./style.less":"5j5O2","@parcel/transformer-js/src/esmodule-heLine truncated
|
||||
!function(e,n,l,t,i){var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},r="function"==typeof a.parcelRequirea5da&&a.parcelRequirea5da,o=r.cache||{},d="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(n,l){if(!o[n]){if(!e[n]){var t="function"==typeof a.parcelRequirea5da&&a.parcelRequirea5da;if(!l&&t)return t(n,!0);if(r)return r(n,!0);if(d&&"string"==typeof n)return d(n);var i=new Error("Cannot find module '"+n+"'");throw i.code="MODULE_NOT_FOUND",i}u.resolve=function(l){var t=e[n][1][l];return null!=t?t:l},u.cache={};var s=o[n]=new p.Module(n);e[n][0].call(s.exports,u,s,s.exports,this)}return o[n].exports;function u(e){var n=u.resolve(e);return!1===n?{}:p(n)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.exports={}},p.modules=e,p.cache=o,p.parent=r,p.register=function(n,l){e[n]=[function(e,n){n.exports=l},{}]},Object.defineProperty(p,"root",{get:function(){return a.parcelRequirea5da}}),a.parcelRequirea5da=p;for(var s=0;s<n.length;s++)p(n[s]);var u=p(l);"object"==typeof exports&&"undefined"!=typeof module?module.exports=u:"function"==typeof define&&define.amd&&define((function(){return u}))}({E13ST:[function(e,n,l){var t=e("@parcel/transformer-js/src/esmodule-helpers.js");t.defineInteropFlag(l);var i=e("bundle-text:./style.less"),a=t.interopDefault(i);function r(e){return n=>{const{template:{$player:l},icons:{volume:t,volumeClose:i,fullscreenOn:a,fullscreenOff:r,loading:o},constructor:{validator:d,utils:{query:p,append:s,setStyle:u}}}=n;e=d({html:"",video:"",url:"",playDuration:5,totalDuration:10,i18n:{close:"关闭广告",countdown:"%s秒",detail:"查看详情",canBeClosed:"%s秒后可关闭广告"},...e},{html:"?string",video:"?string",url:"?string",playDuration:"number",totalDuration:"number",i18n:{close:"string",countdown:"string",detail:"string",canBeClosed:"string"}});let c=null,y=null,f=null,g=null,m=null,v=null,x=0,h=null,b=!1,w=!1;function D(e,n){return n.replace("%s",e)}function j(){b=!0,n.play(),e.video&&c.pause(),u(n.template.$ads,"display","none"),n.emit("artplayerPluginAds:skip",e)}function k(){b||(h=setTimeout((()=>{x+=1;const l=e.playDuration-x;l>=1?f.innerHTML=D(l,e.i18n.canBeClosed):(f.innerHTML=e.i18n.close,n.proxy(f,"click",j)),g.innerHTML=D(e.totalDuration-x,e.i18n.countdown),x>=e.totalDuration?j():k()}),1e3))}function O(){b||clearTimeout(h)}function $(){w||(w=!0,function(){n.template.$ads=s(l,'<div class="artplayer-plugin-ads"></div>'),c=s(n.template.$ads,e.video?`<video class="artplayer-plugin-ads-video" src="${e.video}" loop playsInline></video>`:`<div class="artplayer-plugin-ads-html">${e.html}</div>`),v=s(n.template.$ads,'<div class="artplayer-plugin-ads-loading"></div>'),s(v,o),y=s(n.template.$ads,`<div class="artplayer-plugin-ads-timer"><div class="artplayer-plugin-ads-close">${D(e.playDuration,e.i18n.canBeClosed)}</div><div class="artplayer-plugin-ads-countdown">${D(e.totalDuration,e.i18n.countdown)}</div></div>`),f=p(".artplayer-plugin-ads-close",y),g=p(".artplayer-plugin-ads-countdown",y),e.playDuration>=e.totalDuration&&u(f,"display","none"),m=s(n.template.$ads,`<div class="artplayer-plugin-ads-control"><div class="artplayer-plugin-ads-detail">${e.i18n.detail}</div><div class="artplayer-plugin-ads-muted"></div><div class="artplayer-plugin-ads-fullscreen"></div></div>`);const d=p(".artplayer-plugin-ads-detail",m),x=p(".artplayer-plugin-ads-muted",m),h=p(".artplayer-plugin-ads-fullscreen",m);if(e.url?n.proxy(d,"click",(()=>{window.open(e.url),n.emit("artplayerPluginAds:click",e)})):u(d,"display","none"),e.video){const e=s(x,t),l=s(x,i);u(l,"display","none"),n.proxy(x,"click",(()=>{c.muted=!c.muted,c.muted?(u(e,"display","none"),u(l,"display","inline-flex")):(u(e,"display","inline-flex"),u(l,"display","none"))}))}else u(x,"display","none");const b=s(h,a),w=s(h,r);u(w,"display","none"),n.proxy(h,"click",(()=>{n.fullscreen=!n.fullscreen,n.fullscreen?(u(b,"display","inline-flex"),u(w,"display","none")):(u(b,"display","none"),u(w,"display","inline-flex"))})),n.proxy(c,"click",(()=>{e.url&&window.open(e.url),n.emit("artplayerPluginAds:click",e)}))}(),n.pause(),e.video?(n.proxy(c,"error",j),n.proxy(c,"loadedmetadata",(()=>{k(),c.play(),u(y,"display","flex"),u(m,"display","flex"),u(v,"display","none")}))):(k(),u(y,"display","flex"),u(m,"display","flex"),u(v,"display","none")),n.proxy(document,"visibilitychange",(()=>{document.hidden?O():k()})))}return n.on("ready",(()=>{n.once("play",$),n.once("video:playing",$)})),{name:"artplayerPluginAds",skip:j,pause:O,play:k}}}if(l.default=r,r.env="production",r.version="1.0.3",r.build="1655861857629","undefined"!=typeof document&&!document.getElementById("artplayer-plugin-ads")){const e=document.createElement("style");e.id="artplayer-plugin-ads",e.textContent=a.default,document.head.appendChild(e)}"undefined"!=typeof window&&(window.artplayerPluginAds=r)},{"bundle-text:./stylLine truncated
|
||||
@@ -226,6 +226,7 @@ function artplayerPluginAds(option) {
|
||||
</div>`);
|
||||
$close = query(".artplayer-plugin-ads-close", $timer);
|
||||
$countdown = query(".artplayer-plugin-ads-countdown", $timer);
|
||||
if (option.playDuration >= option.totalDuration) setStyle($close, "display", "none");
|
||||
$control = append(art.template.$ads, `<div class="artplayer-plugin-ads-control">
|
||||
<div class="artplayer-plugin-ads-detail">${option.i18n.detail}</div>
|
||||
<div class="artplayer-plugin-ads-muted"></div>
|
||||
@@ -311,8 +312,8 @@ function artplayerPluginAds(option) {
|
||||
}
|
||||
exports.default = artplayerPluginAds;
|
||||
artplayerPluginAds.env = "development";
|
||||
artplayerPluginAds.version = "1.0.0";
|
||||
artplayerPluginAds.build = "1655790320716";
|
||||
artplayerPluginAds.version = "1.0.3";
|
||||
artplayerPluginAds.build = "1655860694742";
|
||||
if (typeof document !== "undefined") {
|
||||
if (!document.getElementById("artplayer-plugin-ads")) {
|
||||
const $style = document.createElement("style");
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"mappings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M,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;YAGxC,MAAM,aAAa,GAAG,MAAM,CAAC,WAAW,EAAE,YAAY,CAAC,AAAC;YACxD,MAAM,cAAc,GAAG,MAAM,CAAC,WAAW,EAAE,aAAa,CAAC,AAAC;YAC1D,QAAQ,CAAC,cAAc,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;YAE5C,GAAG,CAAC,KAAK,CAAC,WAAW,EAAE,OAAO,EAAE,IAAM;gBAClC,GAAG,CAAC,UAAU,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC;gBACjC,IAAI,GAAG,CAAC,UAAU,EAAE;oBAChB,QAAQ,CAAC,aAAa,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC;oBAClD,QAAQ,CAAC,cAAc,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;iBAC/C,MAAM;oBACH,QAAQ,CAAC,aAAa,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;oBAC3C,QAAQ,CAAC,cAAc,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC;iBACtD;aACJ,CAAC,CAAC;YAEH,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,IAAM;gBAC3B,IAAI,MAAM,CAAC,GAAG,EAAE,Line truncated
|
||||
@@ -61,6 +61,7 @@ var art = new Artplayer({
|
||||
url: 'http://artplayer.org',
|
||||
|
||||
// The length of time that must be watched, the period cannot be skipped, the unit is seconds
|
||||
// When the value is greater than or equal to totalDuration, the ad cannot be closed early
|
||||
playDuration: 5,
|
||||
|
||||
// The total duration of the ad, in seconds
|
||||
|
||||
@@ -61,6 +61,7 @@ var art = new Artplayer({
|
||||
url: 'http://artplayer.org',
|
||||
|
||||
// 必须观看的时长,期间不能被跳过,单位为秒
|
||||
// 当该值大于或等于totalDuration时,不能提前关闭广告
|
||||
playDuration: 5,
|
||||
|
||||
// 广告总时长,单位为秒
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*!
|
||||
* artplayer-plugin-ads.js v1.0.2
|
||||
* artplayer-plugin-ads.js v1.0.3
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2022 Harvey Zack
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,n,l,t,i){var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},r="function"==typeof a.parcelRequirea5da&&a.parcelRequirea5da,o=r.cache||{},d="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function s(n,l){if(!o[n]){if(!e[n]){var t="function"==typeof a.parcelRequirea5da&&a.parcelRequirea5da;if(!l&&t)return t(n,!0);if(r)return r(n,!0);if(d&&"string"==typeof n)return d(n);var i=new Error("Cannot find module '"+n+"'");throw i.code="MODULE_NOT_FOUND",i}u.resolve=function(l){var t=e[n][1][l];return null!=t?t:l},u.cache={};var p=o[n]=new s.Module(n);e[n][0].call(p.exports,u,p,p.exports,this)}return o[n].exports;function u(e){var n=u.resolve(e);return!1===n?{}:s(n)}}s.isParcelRequire=!0,s.Module=function(e){this.id=e,this.bundle=s,this.exports={}},s.modules=e,s.cache=o,s.parent=r,s.register=function(n,l){e[n]=[function(e,n){n.exports=l},{}]},Object.defineProperty(s,"root",{get:function(){return a.parcelRequirea5da}}),a.parcelRequirea5da=s;for(var p=0;p<n.length;p++)s(n[p]);var u=s(l);"object"==typeof exports&&"undefined"!=typeof module?module.exports=u:"function"==typeof define&&define.amd&&define((function(){return u}))}({E13ST:[function(e,n,l){var t=e("@parcel/transformer-js/src/esmodule-helpers.js");t.defineInteropFlag(l);var i=e("bundle-text:./style.less"),a=t.interopDefault(i);function r(e){return n=>{const{template:{$player:l},icons:{volume:t,volumeClose:i,fullscreenOn:a,fullscreenOff:r,loading:o},constructor:{validator:d,utils:{query:s,append:p,setStyle:u}}}=n;e=d({html:"",video:"",url:"",playDuration:5,totalDuration:10,i18n:{close:"关闭广告",countdown:"%s秒",detail:"查看详情",canBeClosed:"%s秒后可关闭广告"},...e},{html:"?string",video:"?string",url:"?string",playDuration:"number",totalDuration:"number",i18n:{close:"string",countdown:"string",detail:"string",canBeClosed:"string"}});let c=null,y=null,f=null,g=null,m=null,v=null,x=0,h=null,b=!1,w=!1;function j(e,n){return n.replace("%s",e)}function k(){b=!0,n.play(),e.video&&c.pause(),u(n.template.$ads,"display","none"),n.emit("artplayerPluginAds:skip",e)}function D(){b||(h=setTimeout((()=>{x+=1;const l=e.playDuration-x;l>=1?f.innerHTML=j(l,e.i18n.canBeClosed):(f.innerHTML=e.i18n.close,n.proxy(f,"click",k)),g.innerHTML=j(e.totalDuration-x,e.i18n.countdown),x>=e.totalDuration?k():D()}),1e3))}function O(){b||clearTimeout(h)}function $(){w||(w=!0,function(){n.template.$ads=p(l,'<div class="artplayer-plugin-ads"></div>'),c=p(n.template.$ads,e.video?`<video class="artplayer-plugin-ads-video" src="${e.video}" loop playsInline></video>`:`<div class="artplayer-plugin-ads-html">${e.html}</div>`),v=p(n.template.$ads,'<div class="artplayer-plugin-ads-loading"></div>'),p(v,o),y=p(n.template.$ads,`<div class="artplayer-plugin-ads-timer"><div class="artplayer-plugin-ads-close">${j(e.playDuration,e.i18n.canBeClosed)}</div><div class="artplayer-plugin-ads-countdown">${j(e.totalDuration,e.i18n.countdown)}</div></div>`),f=s(".artplayer-plugin-ads-close",y),g=s(".artplayer-plugin-ads-countdown",y),m=p(n.template.$ads,`<div class="artplayer-plugin-ads-control"><div class="artplayer-plugin-ads-detail">${e.i18n.detail}</div><div class="artplayer-plugin-ads-muted"></div><div class="artplayer-plugin-ads-fullscreen"></div></div>`);const d=s(".artplayer-plugin-ads-detail",m),x=s(".artplayer-plugin-ads-muted",m),h=s(".artplayer-plugin-ads-fullscreen",m);if(e.url?n.proxy(d,"click",(()=>{window.open(e.url),n.emit("artplayerPluginAds:click",e)})):u(d,"display","none"),e.video){const e=p(x,t),l=p(x,i);u(l,"display","none"),n.proxy(x,"click",(()=>{c.muted=!c.muted,c.muted?(u(e,"display","none"),u(l,"display","inline-flex")):(u(e,"display","inline-flex"),u(l,"display","none"))}))}else u(x,"display","none");const b=p(h,a),w=p(h,r);u(w,"display","none"),n.proxy(h,"click",(()=>{n.fullscreen=!n.fullscreen,n.fullscreen?(u(b,"display","inline-flex"),u(w,"display","none")):(u(b,"display","none"),u(w,"display","inline-flex"))})),n.proxy(c,"click",(()=>{e.url&&window.open(e.url),n.emit("artplayerPluginAds:click",e)}))}(),n.pause(),e.video?(n.proxy(c,"error",k),n.proxy(c,"loadedmetadata",(()=>{D(),c.play(),u(y,"display","flex"),u(m,"display","flex"),u(v,"display","none")}))):(D(),u(y,"display","flex"),u(m,"display","flex"),u(v,"display","none")),n.proxy(document,"visibilitychange",(()=>{document.hidden?O():D()})))}return n.on("ready",(()=>{n.once("play",$),n.once("video:playing",$)})),{name:"artplayerPluginAds",skip:k,pause:O,play:D}}}if(l.default=r,r.env="production",r.version="1.0.2",r.build="1655794470564","undefined"!=typeof document&&!document.getElementById("artplayer-plugin-ads")){const e=document.createElement("style");e.id="artplayer-plugin-ads",e.textContent=a.default,document.head.appendChild(e)}"undefined"!=typeof window&&(window.artplayerPluginAds=r)},{"bundle-text:./style.less":"5j5O2","@parcel/transformer-js/src/esmodule-heLine truncated
|
||||
!function(e,n,l,t,i){var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},r="function"==typeof a.parcelRequirea5da&&a.parcelRequirea5da,o=r.cache||{},d="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(n,l){if(!o[n]){if(!e[n]){var t="function"==typeof a.parcelRequirea5da&&a.parcelRequirea5da;if(!l&&t)return t(n,!0);if(r)return r(n,!0);if(d&&"string"==typeof n)return d(n);var i=new Error("Cannot find module '"+n+"'");throw i.code="MODULE_NOT_FOUND",i}u.resolve=function(l){var t=e[n][1][l];return null!=t?t:l},u.cache={};var s=o[n]=new p.Module(n);e[n][0].call(s.exports,u,s,s.exports,this)}return o[n].exports;function u(e){var n=u.resolve(e);return!1===n?{}:p(n)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.exports={}},p.modules=e,p.cache=o,p.parent=r,p.register=function(n,l){e[n]=[function(e,n){n.exports=l},{}]},Object.defineProperty(p,"root",{get:function(){return a.parcelRequirea5da}}),a.parcelRequirea5da=p;for(var s=0;s<n.length;s++)p(n[s]);var u=p(l);"object"==typeof exports&&"undefined"!=typeof module?module.exports=u:"function"==typeof define&&define.amd&&define((function(){return u}))}({E13ST:[function(e,n,l){var t=e("@parcel/transformer-js/src/esmodule-helpers.js");t.defineInteropFlag(l);var i=e("bundle-text:./style.less"),a=t.interopDefault(i);function r(e){return n=>{const{template:{$player:l},icons:{volume:t,volumeClose:i,fullscreenOn:a,fullscreenOff:r,loading:o},constructor:{validator:d,utils:{query:p,append:s,setStyle:u}}}=n;e=d({html:"",video:"",url:"",playDuration:5,totalDuration:10,i18n:{close:"关闭广告",countdown:"%s秒",detail:"查看详情",canBeClosed:"%s秒后可关闭广告"},...e},{html:"?string",video:"?string",url:"?string",playDuration:"number",totalDuration:"number",i18n:{close:"string",countdown:"string",detail:"string",canBeClosed:"string"}});let c=null,y=null,f=null,g=null,m=null,v=null,x=0,h=null,b=!1,w=!1;function D(e,n){return n.replace("%s",e)}function j(){b=!0,n.play(),e.video&&c.pause(),u(n.template.$ads,"display","none"),n.emit("artplayerPluginAds:skip",e)}function k(){b||(h=setTimeout((()=>{x+=1;const l=e.playDuration-x;l>=1?f.innerHTML=D(l,e.i18n.canBeClosed):(f.innerHTML=e.i18n.close,n.proxy(f,"click",j)),g.innerHTML=D(e.totalDuration-x,e.i18n.countdown),x>=e.totalDuration?j():k()}),1e3))}function O(){b||clearTimeout(h)}function $(){w||(w=!0,function(){n.template.$ads=s(l,'<div class="artplayer-plugin-ads"></div>'),c=s(n.template.$ads,e.video?`<video class="artplayer-plugin-ads-video" src="${e.video}" loop playsInline></video>`:`<div class="artplayer-plugin-ads-html">${e.html}</div>`),v=s(n.template.$ads,'<div class="artplayer-plugin-ads-loading"></div>'),s(v,o),y=s(n.template.$ads,`<div class="artplayer-plugin-ads-timer"><div class="artplayer-plugin-ads-close">${D(e.playDuration,e.i18n.canBeClosed)}</div><div class="artplayer-plugin-ads-countdown">${D(e.totalDuration,e.i18n.countdown)}</div></div>`),f=p(".artplayer-plugin-ads-close",y),g=p(".artplayer-plugin-ads-countdown",y),e.playDuration>=e.totalDuration&&u(f,"display","none"),m=s(n.template.$ads,`<div class="artplayer-plugin-ads-control"><div class="artplayer-plugin-ads-detail">${e.i18n.detail}</div><div class="artplayer-plugin-ads-muted"></div><div class="artplayer-plugin-ads-fullscreen"></div></div>`);const d=p(".artplayer-plugin-ads-detail",m),x=p(".artplayer-plugin-ads-muted",m),h=p(".artplayer-plugin-ads-fullscreen",m);if(e.url?n.proxy(d,"click",(()=>{window.open(e.url),n.emit("artplayerPluginAds:click",e)})):u(d,"display","none"),e.video){const e=s(x,t),l=s(x,i);u(l,"display","none"),n.proxy(x,"click",(()=>{c.muted=!c.muted,c.muted?(u(e,"display","none"),u(l,"display","inline-flex")):(u(e,"display","inline-flex"),u(l,"display","none"))}))}else u(x,"display","none");const b=s(h,a),w=s(h,r);u(w,"display","none"),n.proxy(h,"click",(()=>{n.fullscreen=!n.fullscreen,n.fullscreen?(u(b,"display","inline-flex"),u(w,"display","none")):(u(b,"display","none"),u(w,"display","inline-flex"))})),n.proxy(c,"click",(()=>{e.url&&window.open(e.url),n.emit("artplayerPluginAds:click",e)}))}(),n.pause(),e.video?(n.proxy(c,"error",j),n.proxy(c,"loadedmetadata",(()=>{k(),c.play(),u(y,"display","flex"),u(m,"display","flex"),u(v,"display","none")}))):(k(),u(y,"display","flex"),u(m,"display","flex"),u(v,"display","none")),n.proxy(document,"visibilitychange",(()=>{document.hidden?O():k()})))}return n.on("ready",(()=>{n.once("play",$),n.once("video:playing",$)})),{name:"artplayerPluginAds",skip:j,pause:O,play:k}}}if(l.default=r,r.env="production",r.version="1.0.3",r.build="1655861857629","undefined"!=typeof document&&!document.getElementById("artplayer-plugin-ads")){const e=document.createElement("style");e.id="artplayer-plugin-ads",e.textContent=a.default,document.head.appendChild(e)}"undefined"!=typeof window&&(window.artplayerPluginAds=r)},{"bundle-text:./stylLine truncated
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"license": "MIT",
|
||||
"version": "1.0.2",
|
||||
"version": "1.0.3",
|
||||
"name": "artplayer-plugin-ads",
|
||||
"types": "types/artplayer-plugin-ads.d.ts",
|
||||
"description": "Ads plugin for ArtPlayer",
|
||||
|
||||
@@ -124,6 +124,10 @@ export default function artplayerPluginAds(option) {
|
||||
$close = query('.artplayer-plugin-ads-close', $timer);
|
||||
$countdown = query('.artplayer-plugin-ads-countdown', $timer);
|
||||
|
||||
if (option.playDuration >= option.totalDuration) {
|
||||
setStyle($close, 'display', 'none');
|
||||
}
|
||||
|
||||
$control = append(
|
||||
art.template.$ads,
|
||||
`<div class="artplayer-plugin-ads-control">
|
||||
|
||||
Reference in new issue
Block a user