From a7d77f4f70a0800d70df91ea403da4c72ec621a0 Mon Sep 17 00:00:00 2001 From: Harvey Zack Date: Sat, 16 Aug 2025 16:45:09 +0800 Subject: [PATCH] chore: remove Document Picture-in-Picture plugin files from the repository --- docs/uncompiled/artplayer-plugin-pip/index.js | 348 ------------------ .../artplayer-plugin-pip/index.js.map | 1 - 2 files changed, 349 deletions(-) delete mode 100644 docs/uncompiled/artplayer-plugin-pip/index.js delete mode 100644 docs/uncompiled/artplayer-plugin-pip/index.js.map diff --git a/docs/uncompiled/artplayer-plugin-pip/index.js b/docs/uncompiled/artplayer-plugin-pip/index.js deleted file mode 100644 index 4ea69d9ba..000000000 --- a/docs/uncompiled/artplayer-plugin-pip/index.js +++ /dev/null @@ -1,348 +0,0 @@ -// 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 ( - modules, - entry, - mainEntry, - parcelRequireName, - externals, - distDir, - publicUrl, - devServer -) { - /* eslint-disable no-undef */ - var globalObject = - typeof globalThis !== 'undefined' - ? globalThis - : typeof self !== 'undefined' - ? self - : typeof window !== 'undefined' - ? window - : typeof global !== 'undefined' - ? global - : {}; - /* eslint-enable no-undef */ - - // Save the require from previous bundle to this closure if any - var previousRequire = - typeof globalObject[parcelRequireName] === 'function' && - globalObject[parcelRequireName]; - - var importMap = previousRequire.i || {}; - var cache = previousRequire.cache || {}; - // Do not use `require` to prevent Webpack from trying to bundle this call - var nodeRequire = - typeof module !== 'undefined' && - typeof module.require === 'function' && - module.require.bind(module); - - function newRequire(name, jumped) { - if (!cache[name]) { - if (!modules[name]) { - if (externals[name]) { - return externals[name]; - } - // 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 currentRequire = - typeof globalObject[parcelRequireName] === 'function' && - globalObject[parcelRequireName]; - if (!jumped && currentRequire) { - return currentRequire(name, true); - } - - // 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 (previousRequire) { - return previousRequire(name, true); - } - - // Try the node require function if it exists. - if (nodeRequire && typeof name === 'string') { - return nodeRequire(name); - } - - var err = new Error("Cannot find module '" + name + "'"); - err.code = 'MODULE_NOT_FOUND'; - throw err; - } - - localRequire.resolve = resolve; - localRequire.cache = {}; - - var module = (cache[name] = new newRequire.Module(name)); - - modules[name][0].call( - module.exports, - localRequire, - module, - module.exports, - globalObject - ); - } - - return cache[name].exports; - - function localRequire(x) { - var res = localRequire.resolve(x); - return res === false ? {} : newRequire(res); - } - - function resolve(x) { - var id = modules[name][1][x]; - return id != null ? id : x; - } - } - - function Module(moduleName) { - this.id = moduleName; - this.bundle = newRequire; - this.require = nodeRequire; - this.exports = {}; - } - - newRequire.isParcelRequire = true; - newRequire.Module = Module; - newRequire.modules = modules; - newRequire.cache = cache; - newRequire.parent = previousRequire; - newRequire.distDir = distDir; - newRequire.publicUrl = publicUrl; - newRequire.devServer = devServer; - newRequire.i = importMap; - newRequire.register = function (id, exports) { - modules[id] = [ - function (require, module) { - module.exports = exports; - }, - {}, - ]; - }; - - // Only insert newRequire.load when it is actually used. - // The code in this file is linted against ES5, so dynamic import is not allowed. - // INSERT_LOAD_HERE - - Object.defineProperty(newRequire, 'root', { - get: function () { - return globalObject[parcelRequireName]; - }, - }); - - globalObject[parcelRequireName] = newRequire; - - for (var i = 0; i < entry.length; i++) { - newRequire(entry[i]); - } - - if (mainEntry) { - // Expose entry point to Node, AMD or browser globals - // Based on https://github.com/ForbesLindesay/umd/blob/master/template.js - var mainExports = newRequire(mainEntry); - - // CommonJS - if (typeof exports === 'object' && typeof module !== 'undefined') { - module.exports = mainExports; - - // RequireJS - } else if (typeof define === 'function' && define.amd) { - define(function () { - return mainExports; - }); - } - } -})({"55Mmu":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>artplayerPluginDocumentPip); -function artplayerPluginDocumentPip(userOptions = {}) { - const options = { - width: 480, - height: 270, - fallbackToVideoPiP: true, - placeholder: `Playing in Document Picture-in-Picture`, - ...userOptions - }; - return (art)=>{ - const dpipOK = 'documentPictureInPicture' in window && typeof window.documentPictureInPicture?.requestWindow === 'function'; - const { proxy, icons, i18n, template: { $container }, constructor: { utils: { append, tooltip } } } = art; - const state = { - win: null, - originalParent: null, - originalNext: null, - currentDoc: null, - placeholder: null - }; - function copyStylesTo(targetDoc) { - const base = targetDoc.createElement('style'); - base.textContent = ` - html, body { margin:0; padding:0; width:100%; height:100%; background:#000; overflow:hidden; } - #__art_dpip_root { position:absolute; inset:0; display:flex; } - #__art_dpip_root > * { width:100% !important; height:100% !important; } - `; - targetDoc.head.appendChild(base); - if (!targetDoc.querySelector('meta[name="viewport"]')) { - const meta = targetDoc.createElement('meta'); - meta.name = 'viewport'; - meta.content = 'width=device-width,initial-scale=1'; - targetDoc.head.appendChild(meta); - } - try { - document.querySelectorAll('link[rel="stylesheet"]').forEach((link)=>{ - const clone = targetDoc.createElement('link'); - clone.rel = 'stylesheet'; - clone.href = link.href; - if (link.media) clone.media = link.media; - if (link.crossOrigin) clone.crossOrigin = link.crossOrigin; - if (link.referrerPolicy) clone.referrerPolicy = link.referrerPolicy; - targetDoc.head.appendChild(clone); - }); - } catch {} - try { - document.querySelectorAll('style').forEach((style)=>{ - const clone = targetDoc.createElement('style'); - clone.textContent = style.textContent; - targetDoc.head.appendChild(clone); - }); - } catch {} - } - async function open() { - if (!dpipOK && options.fallbackToVideoPiP) { - art.pip = true; - console.warn('[artplayer-plugin-document-pip] Document Picture-in-Picture is not supported, falling back to Video Picture-in-Picture'); - return; - } - if (state.win) return; - try { - const pipWin = await window.documentPictureInPicture.requestWindow({ - width: options.width, - height: options.height - }); - state.win = pipWin; - state.currentDoc = pipWin.document; - state.placeholder = document.createElement('div'); - state.placeholder.className = 'artplayer-pip-placeholder'; - state.placeholder.style.cssText = `display:flex;justify-content:center;align-items:center;width:100%;height:100%;`; - state.placeholder.textContent = options.placeholder; - state.originalParent = $container.parentNode; - state.originalNext = $container.nextSibling; - state.originalParent.insertBefore(state.placeholder, state.originalNext); - const root = pipWin.document.createElement('div'); - root.id = '__art_dpip_root'; - pipWin.document.body.appendChild(root); - copyStylesTo(pipWin.document); - const adopted = pipWin.document.adoptNode($container); - root.appendChild(adopted); - state.currentDoc = pipWin.document; - const onResize = ()=>art.resize?.(); - const onClose = ()=>close(); - pipWin.addEventListener('resize', onResize); - pipWin.addEventListener('pagehide', onClose); - pipWin.addEventListener('unload', onClose); - state.cleanup = ()=>{ - pipWin.removeEventListener('resize', onResize); - pipWin.removeEventListener('pagehide', onClose); - pipWin.removeEventListener('unload', onClose); - }; - art.emit('document-pip', true); - } catch (err) { - art.notice.show = 'Document Picture-in-Picture open failed'; - console.warn('[artplayer-plugin-document-pip] open failed:', err); - } - } - function restoreToOriginalDocument() { - if (!state.placeholder) return; - const backDoc = state.placeholder.ownerDocument || document; - const adoptedBack = backDoc.adoptNode($container); - state.originalParent.insertBefore(adoptedBack, state.placeholder); - state.placeholder.remove(); - state.placeholder = null; - state.currentDoc = backDoc; - } - function close() { - if (!dpipOK && options.fallbackToVideoPiP) { - art.pip = false; - return; - } - if (!state.win) return; - try { - state.cleanup?.(); - restoreToOriginalDocument(); - state.win.close(); - state.win = null; - art.emit('document-pip', false); - } catch (err) { - art.notice.show = 'Document Picture-in-Picture close failed'; - console.warn('[artplayer-plugin-document-pip] close failed:', err); - } - } - function toggle() { - if (state.win) close(); - else open(); - } - art.controls.add({ - name: 'document-pip', - position: 'right', - index: 40, - tooltip: art.i18n.get('PIP Mode'), - mounted: ($control)=>{ - append($control, icons.pip); - proxy($control, 'click', toggle); - art.on('document-pip', (value)=>{ - tooltip($control, i18n.get(value ? 'Exit PIP Mode' : 'PIP Mode')); - }); - } - }); - art.on('destroy', close); - return { - name: 'artplayerPluginDocumentPip', - open, - close, - toggle - }; - }; -} -if (typeof window !== 'undefined') window.artplayerPluginDocumentPip = artplayerPluginDocumentPip; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"8oCsH"}],"8oCsH":[function(require,module,exports,__globalThis) { -exports.interopDefault = function(a) { - return a && a.__esModule ? a : { - default: a - }; -}; -exports.defineInteropFlag = function(a) { - Object.defineProperty(a, '__esModule', { - value: true - }); -}; -exports.exportAll = function(source, dest) { - Object.keys(source).forEach(function(key) { - if (key === 'default' || key === '__esModule' || Object.prototype.hasOwnProperty.call(dest, key)) return; - Object.defineProperty(dest, key, { - enumerable: true, - get: function() { - return source[key]; - } - }); - }); - return dest; -}; -exports.export = function(dest, destName, get) { - Object.defineProperty(dest, destName, { - enumerable: true, - get: get - }); -}; - -},{}]},["55Mmu"], "55Mmu", "parcelRequire4dc0", {}) - -//# sourceMappingURL=index.js.map diff --git a/docs/uncompiled/artplayer-plugin-pip/index.js.map b/docs/uncompiled/artplayer-plugin-pip/index.js.map deleted file mode 100644 index c36821c37..000000000 --- a/docs/uncompiled/artplayer-plugin-pip/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6CAAwB;AAAT,SAAS,mBAAmB,cAAc,CAAC,CAAC;IACzD,MAAM,UAAU;QACd,OAAO;QACP,QAAQ;QACR,oBAAoB;QACpB,aAAa,CAAC,sCAAsC,CAAC;QACrD,GAAG,WAAW;IAChB;IAEA,OAAO,CAAC;QACN,MAAM,SAAS,8BAA8B,UACxC,OAAO,OAAO,wBAAwB,EAAE,kBAAkB;QAE/D,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE,aAAa,EAAE,O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C;AAC5C;AAEA,QAAQ,iBAAiB,GAAG,SAAU,CAAC;IACrC,OAAO,cAAc,CAAC,GAAG,cAAc;QAAC,OAAO;IAAI;AACrD;AAEA,QAAQ,SAAS,GAAG,SAAU,MAAM,EAAE,IAAI;IACxC,OAAO,IAAI,CAAC,QAAQ,OAAO,CAAC,SAAU,GAAG;QACvC,IACE,QAAQ,aACR,QAAQ,gBACR,OAAO,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,MAE3C;QAGF,OAAO,cAAc,CAAC,MAAM,KAAK;YAC/B,YAAY;YACZ,KAAK;gBACH,OAAO,MAAM,CAAC,IAAI;YACpB;QACF;IACF;IAEA,OAAO;AACT;AAEA,QAAQ,MAAM,GAAG,SAAU,IAAI,EAAE,QAAQ,EAAE,GAAG;IAC5C,OAAO,cAAc,CAAC,MAAM,UAAU;QACpC,YAAY;QACZ,KAAK;IACP;AACF","sources":["packages/artplayer-plugin-document-pip/src/index.js","node_modules/@parcel/transformer-js/src/esmodule-helpers.js"],"sourcesContent":["export default function artplayerPluginDocumentPip(userOptions = {}) {\n const options = {\n width: 480,\n height: 270,\n fallbackToVideoPiP: true,\n placeholder: `Playing in Document Picture-in-Picture`,\n ...userOptions,\n }\n\n return (art) => {\n const dpipOK = 'documentPictureInPicture' in window\n && typeof window.documentPictureInPicture?.requestWindow === 'function'\n\n const { proxy, icons, i18n, template: { $container }, constructor: { utils: { append, tooltip } } } = art\n\n const state = {\n win: null,\n originalParent: null,\n originalNext: null,\n currentDoc: null,\n placeholder: null,\n }\n\n function copyStylesTo(targetDoc) {\n const base = targetDoc.createElement('style')\n base.textContent = `\n html, body { margin:0; padding:0; width:100%; height:100%; background:#000; overflow:hidden; }\n #__art_dpip_root { position:absolute; inset:0; display:flex; }\n #__art_dpip_root > * { width:100% !important; height:100% !important; }\n `\n targetDoc.head.appendChild(base)\n if (!targetDoc.querySelector('meta[name=\"viewport\"]')) {\n const meta = targetDoc.createElement('meta')\n meta.name = 'viewport'\n meta.content = 'width=device-width,initial-scale=1'\n targetDoc.head.appendChild(meta)\n }\n\n try {\n document.querySelectorAll('link[rel=\"stylesheet\"]').forEach((link) => {\n const clone = targetDoc.createElement('link')\n clone.rel = 'stylesheet'\n clone.href = link.href\n if (link.media)\n clone.media = link.media\n if (link.crossOrigin)\n clone.crossOrigin = link.crossOrigin\n if (link.referrerPolicy)\n clone.referrerPolicy = link.referrerPolicy\n targetDoc.head.appendChild(clone)\n })\n }\n catch { }\n\n try {\n document.querySelectorAll('style').forEach((style) => {\n const clone = targetDoc.createElement('style')\n clone.textContent = style.textContent\n targetDoc.head.appendChild(clone)\n })\n }\n catch { }\n }\n\n async function open() {\n if (!dpipOK && options.fallbackToVideoPiP) {\n art.pip = true\n console.warn('[artplayer-plugin-document-pip] Document Picture-in-Picture is not supported, falling back to Video Picture-in-Picture')\n return\n }\n\n if (state.win)\n return\n\n try {\n const pipWin = await window.documentPictureInPicture.requestWindow({\n width: options.width,\n height: options.height,\n })\n\n state.win = pipWin\n state.currentDoc = pipWin.document\n\n state.placeholder = document.createElement('div')\n state.placeholder.className = 'artplayer-pip-placeholder'\n state.placeholder.style.cssText = `display:flex;justify-content:center;align-items:center;width:100%;height:100%;`\n state.placeholder.textContent = options.placeholder\n state.originalParent = $container.parentNode\n state.originalNext = $container.nextSibling\n state.originalParent.insertBefore(state.placeholder, state.originalNext)\n\n const root = pipWin.document.createElement('div')\n root.id = '__art_dpip_root'\n pipWin.document.body.appendChild(root)\n\n copyStylesTo(pipWin.document)\n\n const adopted = pipWin.document.adoptNode($container)\n root.appendChild(adopted)\n state.currentDoc = pipWin.document\n\n const onResize = () => art.resize?.()\n const onClose = () => close()\n\n pipWin.addEventListener('resize', onResize)\n pipWin.addEventListener('pagehide', onClose)\n pipWin.addEventListener('unload', onClose)\n\n state.cleanup = () => {\n pipWin.removeEventListener('resize', onResize)\n pipWin.removeEventListener('pagehide', onClose)\n pipWin.removeEventListener('unload', onClose)\n }\n\n art.emit('document-pip', true)\n }\n catch (err) {\n art.notice.show = 'Document Picture-in-Picture open failed'\n console.warn('[artplayer-plugin-document-pip] open failed:', err)\n }\n }\n\n function restoreToOriginalDocument() {\n if (!state.placeholder)\n return\n const backDoc = state.placeholder.ownerDocument || document\n const adoptedBack = backDoc.adoptNode($container)\n state.originalParent.insertBefore(adoptedBack, state.placeholder)\n state.placeholder.remove()\n state.placeholder = null\n state.currentDoc = backDoc\n }\n\n function close() {\n if (!dpipOK && options.fallbackToVideoPiP) {\n art.pip = false\n return\n }\n\n if (!state.win)\n return\n try {\n state.cleanup?.()\n restoreToOriginalDocument()\n state.win.close()\n state.win = null\n art.emit('document-pip', false)\n }\n catch (err) {\n art.notice.show = 'Document Picture-in-Picture close failed'\n console.warn('[artplayer-plugin-document-pip] close failed:', err)\n }\n }\n\n function toggle() {\n if (state.win) {\n close()\n }\n else {\n open()\n }\n }\n\n art.controls.add({\n name: 'document-pip',\n position: 'right',\n index: 40,\n tooltip: art.i18n.get('PIP Mode'),\n mounted: ($control) => {\n append($control, icons.pip)\n proxy($control, 'click', toggle)\n art.on('document-pip', (value) => {\n tooltip($control, i18n.get(value ? 'Exit PIP Mode' : 'PIP Mode'))\n })\n },\n })\n\n art.on('destroy', close)\n\n return {\n name: 'artplayerPluginDocumentPip',\n open,\n close,\n toggle,\n }\n }\n}\n\nif (typeof window !== 'undefined') {\n window.artplayerPluginDocumentPip = artplayerPluginDocumentPip\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 (\n key === 'default' ||\n key === '__esModule' ||\n Object.prototype.hasOwnProperty.call(dest, key)\n ) {\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"],"names":[],"version":3,"file":"index.js.map","sourceRoot":"../../../"} \ No newline at end of file