mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
12 lines
12 KiB
JavaScript
12 lines
12 KiB
JavaScript
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["utils/bigger-video-preview"]=t():e["utils/bigger-video-preview"]=t()}(globalThis,(()=>(()=>{var e,t,n={472:(e,t,n)=>{var o=n(955)((function(e){return e[1]}));o.push([e.id,".bigger-video-preview-button, .bigger-video-preview-button-video, .bigger-video-preview-button-index {\n opacity: 0;\n transition: opacity 0.3s ease;\n position: absolute;\n top: 6px;\n left: 6px;\n background-color: aqua;\n height: 28px;\n width: 28px;\n z-index: 9;\n}\n.bili-video-card__image--wrap:hover .bigger-video-preview-button-index {\n opacity: 1;\n}\n.pic-box:hover .bigger-video-preview-button-video {\n opacity: 1;\n}",""]),e.exports=o},357:(e,t,n)=>{var o=n(955)((function(e){return e[1]}));o.push([e.id,".bigger-video-preview-video-container {\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n z-index: 99999;\n}",""]),e.exports=o},955:e=>{"use strict";
|
||
// eslint-disable-next-line func-names
|
||
e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=e(t);return t[2]?"@media ".concat(t[2]," {").concat(n,"}"):n})).join("")},
|
||
// eslint-disable-next-line func-names
|
||
t.i=function(e,n,o){"string"==typeof e&&(
|
||
// eslint-disable-next-line no-param-reassign
|
||
e=[[null,e,""]]);var i={};if(o)for(var r=0;r<this.length;r++){
|
||
// eslint-disable-next-line prefer-destructuring
|
||
var s=this[r][0];null!=s&&(i[s]=!0)}for(var a=0;a<e.length;a++){var l=[].concat(e[a]);o&&i[l[0]]||(n&&(l[2]?l[2]="".concat(n," and ").concat(l[2]):l[2]=n),t.push(l))}},t}},991:(e,t,n)=>{"use strict";var o,i=function(){return void 0===o&&(
|
||
// @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805
|
||
// @see https://github.com/webpack-contrib/style-loader/issues/177
|
||
o=Boolean(window&&document&&document.all&&!window.atob)),o},r=function(){var e={};return function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}e[t]=n}return e[t]}}(),s=[];function a(e){for(var t=-1,n=0;n<s.length;n++)if(s[n].identifier===e){t=n;break}return t}function l(e,t){for(var n={},o=[],i=0;i<e.length;i++){var r=e[i],l=t.base?r[0]+t.base:r[0],p=n[l]||0,c="".concat(l," ").concat(p);n[l]=p+1;var u=a(c),d={css:r[1],media:r[2],sourceMap:r[3]};-1!==u?(s[u].references++,s[u].updater(d)):s.push({identifier:c,updater:h(d,t),references:1}),o.push(c)}return o}function p(e){var t=document.createElement("style"),o=e.attributes||{};if(void 0===o.nonce){var i=n.nc;i&&(o.nonce=i)}if(Object.keys(o).forEach((function(e){t.setAttribute(e,o[e])})),"function"==typeof e.insert)e.insert(t);else{var s=r(e.insert||"head");if(!s)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");s.appendChild(t)}return t}var c,u=(c=[],function(e,t){return c[e]=t,c.filter(Boolean).join("\n")});function d(e,t,n,o){var i=n?"":o.media?"@media ".concat(o.media," {").concat(o.css,"}"):o.css;if(e.styleSheet)e.styleSheet.cssText=u(t,i);else{var r=document.createTextNode(i),s=e.childNodes;s[t]&&e.removeChild(s[t]),s.length?e.insertBefore(r,s[t]):e.appendChild(r)}}function f(e,t,n){var o=n.css,i=n.media,r=n.sourceMap;if(i?e.setAttribute("media",i):e.removeAttribute("media"),r&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(r))))," */")),e.styleSheet)e.styleSheet.cssText=o;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(o))}}var v=null,m=0;function h(e,t){var n,o,i;if(t.singleton){var r=m++;n=v||(v=p(t)),o=d.bind(null,n,r,!1),i=d.bind(null,n,r,!0)}else n=p(t),o=f.bind(null,n,t),i=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(n)};return o(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;o(e=t)}else i()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=i());var n=l(e=e||[],t);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var o=0;o<n.length;o++){var i=a(n[o]);s[i].references--}for(var r=l(e,t),p=0;p<n.length;p++){var c=a(n[p]);0===s[c].references&&(s[c].updater(),s.splice(c,1))}n=r}}}},263:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>d});var o=function(){var e=this,t=e._self._c;e._self._setupProxy;return t("VPopup",{ref:"popup",staticClass:"bigger-video-preview-video-container",on:{"popup-change":e.onPopupChange},model:{value:e.showPopup,callback:function(t){e.showPopup=t},expression:"showPopup"}})};o._withStripped=!0;var i=n(259),r=n(164);const s=(0,i.defineComponent)({name:"VideoContainer",components:{VPopup:r.VPopup},model:{prop:"showPopup",event:"popup-change"},data:()=>({showPopup:!1,movedDom:null,originalParent:null,originalNextSibling:null}),methods:{openPopup(e){this.restoreDom(),e&&(this.originalParent=e.parentNode,this.originalNextSibling=e.nextSibling,this.togglePopup(),this.$nextTick((()=>{const t=this.$refs.popup;t&&e.parentNode!==t&&(t.$el.appendChild(e),this.movedDom=e)})))},closePopup(){this.restoreDom(),this.togglePopup()},restoreDom(){this.movedDom&&this.originalParent&&(this.originalNextSibling?this.originalParent.insertBefore(this.movedDom,this.originalNextSibling):this.originalParent.appendChild(this.movedDom),this.movedDom=null,this.originalParent=null,this.originalNextSibling=null)},onPopupChange(e){e||this.restoreDom(),this.$emit("popup-change",e)},togglePopup(){const e=this.$refs.popup;e&&"function"==typeof e.toggle&&e.toggle()}}});var a=n(991),l=n.n(a),p=n(357),c=n.n(p),u={insert:"head",singleton:!1};l()(c(),u);c().locals;const d=(0,n(678).A)(s,o,[],!1,null,null,null).exports},678:(e,t,n)=>{"use strict";function o(e,t,n,o,i,r,s,a){var l,p="function"==typeof e?e.options:e;if(t&&(p.render=t,p.staticRenderFns=n,p._compiled=!0),o&&(p.functional=!0),r&&(p._scopeId="data-v-"+r),s?(l=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),i&&i.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(s)},p._ssrRegister=l):i&&(l=a?function(){i.call(this,(p.functional?this.parent:this).$root.$options.shadowRoot)}:i),l)if(p.functional){p._injectStyles=l;var c=p.render;p.render=function(e,t){return l.call(t),c(e,t)}}else{var u=p.beforeCreate;p.beforeCreate=u?[].concat(u,l):[l]}return{exports:e,options:p}}n.d(t,{A:()=>o})},153:e=>{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=153,e.exports=t},314:e=>{"use strict";e.exports="放大鼠标悬停于视频卡片时播放的5分钟预览\n\n- 点击放大镜图标放大预览\n- 点击缩小图标或者预览框外空白处关闭预览\n"},259:e=>{"use strict";e.exports=globalThis.Vue},164:e=>{"use strict";e.exports=coreApis.ui}},o={};function i(e){var t=o[e];if(void 0!==t)return t.exports;var r=o[e]={id:e,exports:{}};return n[e](r,r.exports,i),r.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,i.t=function(n,o){if(1&o&&(n=this(n)),8&o)return n;if("object"==typeof n&&n){if(4&o&&n.__esModule)return n;if(16&o&&"function"==typeof n.then)return n}var r=Object.create(null);i.r(r);var s={};e=e||[null,t({}),t([]),t(t)];for(var a=2&o&&n;"object"==typeof a&&!~e.indexOf(a);a=t(a))Object.getOwnPropertyNames(a).forEach((e=>s[e]=()=>n[e]));return s.default=()=>n,i.d(r,s),r},i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.nc=void 0;var r={};return(()=>{"use strict";i.d(r,{component:()=>b});var e=i(259),t=i.n(e);const n=coreApis.componentApis.define,o=coreApis.observer,s=coreApis.spinQuery,a=coreApis.utils.log;var l=function(){var e=this,t=e._self._c;e._self._setupProxy;return t("VButton",{class:["bigger-video-preview-button",e.btnClass],staticStyle:{padding:"0"},on:{click:e.onClick}},[t("VIcon",{attrs:{icon:e.enlarged?"mdi-magnify-minus":"mdi-magnify-plus",size:16}})],1)};l._withStripped=!0;var p=i(164);const c=(0,e.defineComponent)({name:"PreviewButton",components:{VIcon:p.VIcon,VButton:p.VButton},props:{btnClass:{type:String,required:!0},btnOnClickCallback:{type:Function,required:!0},enlarged:{type:Boolean,default:!1}},methods:{onClick(e){this.btnOnClickCallback(e)}}});var u=i(991),d=i.n(u),f=i(472),v=i.n(f),m={insert:"head",singleton:!1};d()(v(),m);v().locals;const h=(0,i(678).A)(c,l,[],!1,null,null,null).exports,g=(0,a.useScopedConsole)("biggerVideoPreview"),b=(0,n.defineComponentMetadata)({name:"biggerVideoPreview",displayName:"视频预览放大",entry:async e=>{let{settings:n}=e,r=null;function a(e){const o=e=>{e.stopPropagation()},i=e=>{e.stopImmediatePropagation()};let s;const a=new(t().extend(h))({propsData:{btnClass:e,btnOnClickCallback:e=>{if(e.preventDefault(),!r)return;const t=a.$el.parentElement.closest(".bili-video-card__image--wrap,.pic-box");s||(s=e=>{((e,t)=>{t.enlarged=e})(e,a),((e,t)=>{if(n.options.blockMouseExitHandler&&e)t.addEventListener("mouseleave",o,!0);else{t.removeEventListener("mouseleave",o,!0);const e=new MouseEvent("mouseleave");t.dispatchEvent(e)}})(e,t),((e,t)=>{const o=e.querySelector("video"),i=e.querySelector(".bpx-player-control-wrap");o&&(n.options.showVideoControls&&t?(o.controls=!0,o.style.pointerEvents="visible",i&&(i.style.display="none")):(o.controls=!1,o.style.pointerEvents="none",i&&(i.style.display="unset")))})(t,e),(e=>{if(n.options.removePreviewTimeLimit){const t=e.querySelector("video");t&&(t.removeEventListener("timeupdate",i,!0),t.addEventListener("timeupdate",i,!0))}else{const t=e.querySelector("video");t&&t.removeEventListener("timeupdate",i,!0)}})(t),e||r.$off("popup-change",s)}),a.enlarged?r.closePopup():(r.$el.style.width=`${n.options.popupWidth}%`,r.$off("popup-change",s),r.$on("popup-change",s),r.openPopup(t))}}});return a.$mount(),a.$el}function l(e,t){e.querySelectorAll(".v-inline-player,.v-recommend-inline-player").forEach((e=>{if(e.parentElement.querySelector(`.${t}`))return;const n=a(t);e.parentElement.appendChild(n)}))}async function p(e,t,n,i){const r=await(0,s.select)(n);if(!r)return void g.warn("未找到容器节点:",n);const a=r.querySelectorAll(`.${t}`);g.debug("初始化已有卡片: ",a.length),l(r,e),(0,o.childListSubtree)(r,(n=>{n.forEach((n=>{n.addedNodes.forEach((n=>{if(n.nodeType!==Node.ELEMENT_NODE)return;const o=n;(o.classList.contains(t)||null!==o.querySelector(`.${t}`))&&(g.debug("初始化卡片"),l(i(o),e))}))}))}))}g.debug("初始化预览容器"),await async function(){const e=(await Promise.resolve().then(i.bind(i,263))).default,n=t().extend(e);r=new n,r.$mount(),document.body.appendChild(r.$el)}(),"https://www.bilibili.com/"===document.URL.replace(window.location.search,"")?(g.debug("初始化首页预览放大按钮"),p("bigger-video-preview-button-index","v-inline-player",".container",(e=>e))):document.URL.startsWith("https://www.bilibili.com/video/")&&(g.debug("初始化视频页预览放大按钮"),p("bigger-video-preview-button-video","v-recommend-inline-player",".recommend-list-v1",(e=>e.parentElement)))},tags:[componentsTags.utils,componentsTags.video],options:{popupWidth:{displayName:"弹窗宽度(%)",defaultValue:90,slider:{min:10,max:100,step:1}},blockMouseExitHandler:{displayName:"鼠标移出弹窗不停止预览",defaultValue:!0},showVideoControls:{displayName:"显示视频控件",defaultValue:!0},removePreviewTimeLimit:{displayName:"解除5分钟预览限制(弹幕会停止)",defaultValue:!1}},commitHash:"af2906e6411c4a1b26e4ef2d5cf981620e6e3ac2",coreVersion:"2.10.2",description:(()=>{const e=i(153);return{...Object.fromEntries(e.keys().map((t=>[t.match(/index\.(.+)\.md$/)[1],e(t)]))),"zh-CN":()=>Promise.resolve().then(i.t.bind(i,314,17)).then((e=>e.default))}})()})})(),r=r.component})())); |