This commit is contained in:
Harvey committed 2022-06-20 11:44:00 +08:00
1 parent 0c70663345
commit 640360abd7
4 files changed
+71 -12

No files matched your search

+28 -6
View File
@@ -150,13 +150,35 @@ var _styleLessDefault = parcelHelpers.interopDefault(_styleLess);
function artplayerPluginAds(option) {
return (art)=>{
const { constructor: { utils: { append } , } , template: { $player } , } = art;
const $ads = append($player, '<div class="artplayer-plugin-ads"></div>');
append($ads, option.video ? `<video src="${option.video}" controls="false"></video>` : option.html);
function skip() {
//
}
function toggleFullscreen() {
//
}
function toggleMuted() {
//
}
function show() {
art.template.$ads = append($player, '<div class="artplayer-plugin-ads"></div>');
const html = option.video ? `<video class="artplayer-plugin-ads-video" src="${option.video}" controls="false"></video>` : option.html;
const $ads = append(art.template.$ads, html);
art.proxy($ads, "click", ()=>{
if (option.url) window.open(option.url);
art.emit("artplayerPluginAds:click", option);
});
return $ads;
}
art.on("ready", ()=>{
art.once("play", ()=>{
art.pause();
const $ads = show();
const isVideo = $ads instanceof HTMLVideoElement;
});
});
return {
name: "artplayerPluginAds",
skip () {
//
}
skip
};
};
}
@@ -205,7 +227,7 @@ exports.export = function(dest, destName, get) {
};
},{}],"1ZB0H":[function(require,module,exports) {
module.exports = ".artplayer-plugin-ads {\n z-index: 150;\n width: 100%;\n height: 100%;\n color: #fff;\n background-color: #000;\n justify-content: center;\n align-items: center;\n display: flex;\n position: absolute;\n inset: 0;\n overflow: hidden;\n}\n\n";
module.exports = ".artplayer-plugin-ads {\n z-index: 150;\n width: 100%;\n height: 100%;\n color: #fff;\n background-color: #000;\n justify-content: center;\n align-items: center;\n display: flex;\n position: absolute;\n inset: 0;\n overflow: hidden;\n}\n\n.artplayer-plugin-ads .artplayer-plugin-ads-video {\n width: 100%;\n height: 100%;\n}\n\n";
},{}]},["gEVO5"], "gEVO5", "parcelRequirea5da")
@@ -1 +1 @@
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,CAAC,GAAG,kBAAkB,CAAC;;;ACrCtD,OAAO,CAAC,cAAc,GAAG,SAAU,CAAC,EAAE;IACpC,OAAO,CAAC,IAAI,CAAC,CAAC,UAAU,GAAG,CAAC,GAAG;QAAC,OAAO,EAAE,CAAC;KAAC,CAAC;CAC7C,CAAC;AAEF,OAAO,CAAC,iBAAiB,GAAG,SAAU,CAAC,EAAE;IACvC,MAAM,CAAC,cAAc,CAAC,CAAC,EAAE,YAAY,EAAE;QAAC,KAAK,EAAE,IAAI;KAAC,CAAC,CAAC;CACvD,CAAC;AAEF,OAAO,CAAC,SAAS,GAAG,SAAU,MAAM,EAAE,IAAI,EAAE;IAC1C,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,SAAU,GAAG,EAAE;QACzC,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,YAAY,IAAI,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,EACvE,OAAO;QAGT,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,EAAE;YAC/B,UAAU,EAAE,IAAI;YAChB,GAAG,EAAE,WAAY;gBACf,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;aACpB;SACF,CAAC,CAAC;KACJ,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC;CACb,CAAC;AAEF,OAAO,CAAC,MAAM,GAAG,SAAU,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE;IAC9C,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,QAAQ,EAAE;QACpC,UAAU,EAAE,IAAI;QAChB,GAAG,EAAE,GAAG;KACT,CAAC,CAAC;CACJ,CAAC;;;AC9BF,MAAM,CAAC,OAAO,GAAG,kBAAkB,CAAC","sources":["src/index.js","../../node_modules/@parcel/transformer-js/src/esmodule-helpers.js","../../node_modules/@parcel/runtime-js/lib/bundles/runtime-845a50df90dd29ef.js"],"sourcesContent":["import style from 'bundle-text:./style.less';\n\nexport default function artplayerPluginAds(option) {\n return (art) => {\n const {\n constructor: {\n utils: { append },\n },\n template: { $player },\n } = art;\n\n const $ads = append($player, '<div class=\"artplayer-plugin-ads\"></div>');\n append($ads, option.video ? `<video src=\"${option.video}\" controls=\"false\"></video>` : option.html);\n\n return {\n name: 'artplayerPluginAds',\n skip() {\n //\n },\n };\n };\n}\n\nartplayerPluginAds.env = process.env.NODE_ENV;\nartplayerPluginAds.version = process.env.APP_VER;\nartplayerPluginAds.build = process.env.BUILD_DATE;\n\nif (typeof document !== 'undefined') {\n if (!document.getElementById('artplayer-plugin-ads')) {\n const $style = document.createElement('style');\n $style.id = 'artplayer-plugin-ads';\n $style.textContent = style;\n document.head.appendChild($style);\n }\n}\n\nif (typeof window !== 'undefined') {\n window['artplayerPluginAds'] = artplayerPluginAds;\n}\n","exports.interopDefault = function (a) {\n return a && a.__esModule ? a : {default: a};\n};\n\nexports.defineInteropFlag = function (a) {\n Object.defineProperty(a, '__esModule', {value: true});\n};\n\nexports.exportAll = function (source, dest) {\n Object.keys(source).forEach(function (key) {\n if (key === 'default' || key === '__esModule' || dest.hasOwnProperty(key)) {\n return;\n }\n\n Object.defineProperty(dest, key, {\n enumerable: true,\n get: function () {\n return source[key];\n },\n });\n });\n\n return dest;\n};\n\nexports.export = function (dest, destName, get) {\n Object.defineProperty(dest, destName, {\n enumerable: true,\n get: get,\n });\n};\n","module.exports = \"40889a184827c504\";"],"names":[],"version":3,"file":"index.js.map","sourceRoot":"../../../packages/artplayer-plugin-ads/"}
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAAA,oDAA6C;;AAE9B,SAAS,kBAAkB,CAAC,MAAM,EAAE;IAC/C,OAAO,CAAC,GAAG,GAAK;QACZ,MAAM,EACF,WAAW,EAAE,EACT,KAAK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AAO,MAAM,CAAC,GAAG,CAAC,CAAC;aACpB;SACF,CAAC,CAAC;KACJ,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC;CACb,CAAC;AAEF,OAAO,CAAC,MAAM,GAAG,SAAU,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE;IAC9C,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,QAAQ,EAAE;QACpC,UAAU,EAAE,IAAI;QAChB,GAAG,EAAE,GAAG;KACT,CAAC,CAAC;CACJ,CAAC;;;AC9BF,MAAM,CAAC,OAAO,GAAG,kBAAkB,CAAC","sources":["src/index.js","../../node_modules/@parcel/transformer-js/src/esmodule-helpers.js","../../node_modules/@parcel/runtime-js/lib/bundles/runtime-845a50df90dd29ef.js"],"sourcesContent":["import style from 'bundle-text:./style.less';\n\nexport default function artplayerPluginAds(option) {\n return (art) => {\n const {\n constructor: {\n utils: { append },\n },\n template: { $player },\n } = art;\n\n function skip() {\n //\n }\n\n function toggleFullscreen() {\n //\n }\n\n function toggleMuted() {\n //\n }\n\n function show() {\n art.template.$ads = append($player, '<div class=\"artplayer-plugin-ads\"></div>');\n\n const html = option.video\n ? `<video class=\"artplayer-plugin-ads-video\" src=\"${option.video}\" controls=\"false\"></video>`\n : option.html;\n\n const $ads = append(art.template.$ads, html);\n\n art.proxy($ads, 'click', () => {\n if (option.url) window.open(option.url);\n art.emit('artplayerPluginAds:click', option);\n });\n\n return $ads;\n }\n\n art.on('ready', () => {\n art.once('play', () => {\n art.pause();\n const $ads = show();\n const isVideo = $ads instanceof HTMLVideoElement;\n });\n });\n\n return {\n name: 'artplayerPluginAds',\n skip,\n };\n };\n}\n\nartplayerPluginAds.env = process.env.NODE_ENV;\nartplayerPluginAds.version = process.env.APP_VER;\nartplayerPluginAds.build = process.env.BUILD_DATE;\n\nif (typeof document !== 'undefined') {\n if (!document.getElementById('artplayer-plugin-ads')) {\n const $style = document.createElement('style');\n $style.id = 'artplayer-plugin-ads';\n $style.textContent = style;\n document.head.appendChild($style);\n }\n}\n\nif (typeof window !== 'undefined') {\n window['artplayerPluginAds'] = artplayerPluginAds;\n}\n","exports.interopDefault = function (a) {\n return a && a.__esModule ? a : {default: a};\n};\n\nexports.defineInteropFlag = function (a) {\n Object.defineProperty(a, '__esModule', {value: Line truncated
+37 -5
View File
@@ -9,14 +9,46 @@ export default function artplayerPluginAds(option) {
template: { $player },
} = art;
const $ads = append($player, '<div class="artplayer-plugin-ads"></div>');
append($ads, option.video ? `<video src="${option.video}" controls="false"></video>` : option.html);
function skip() {
//
}
function toggleFullscreen() {
//
}
function toggleMuted() {
//
}
function show() {
art.template.$ads = append($player, '<div class="artplayer-plugin-ads"></div>');
const html = option.video
? `<video class="artplayer-plugin-ads-video" src="${option.video}" controls="false"></video>`
: option.html;
const $ads = append(art.template.$ads, html);
art.proxy($ads, 'click', () => {
if (option.url) window.open(option.url);
art.emit('artplayerPluginAds:click', option);
});
return $ads;
}
art.on('ready', () => {
art.once('play', () => {
art.pause();
const $ads = show();
const isVideo = $ads instanceof HTMLVideoElement;
});
});
return {
name: 'artplayerPluginAds',
skip() {
//
},
skip,
};
};
}
@@ -13,4 +13,9 @@
overflow: hidden;
color: #fff;
background-color: #000;
.artplayer-plugin-ads-video {
width: 100%;
height: 100%;
}
}