LocalCDN-Firefox-Chrome-Brave/resources/asciinema-player/2.6.1/asciinema-player.min.jsm

1 line
538 KiB
JavaScript
Raw Normal View History

2022-02-24 06:04:17 +01:00
function registerAsciinemaPlayerElement(){var n=Object.create(HTMLElement.prototype);function e(n,t,e,r,l){var i={},t=n.getAttribute(t);return null!==t&&(""===t&&void 0!==r?t=r:l&&(t=l(t)),i[e]=t),i}function r(n){if(n){function t(n,t,e,r){return String.fromCodePoint(parseInt(t,16))}return n.replace(/\\u([a-z0-9]{4})/gi,t).replace(/\\x([a-z0-9]{2})/gi,t).replace(/\\e/g,"")}return n}n.createdCallback=function(){var n=this,t=function(){for(var n={},t=0;t<arguments.length;t++){var e,r=arguments[t];for(e in r)n[e]=r[e]}return n}(e(this,"cols","width",0,parseInt),e(this,"rows","height",0,parseInt),e(this,"autoplay","autoPlay",!0,Boolean),e(this,"preload","preload",!0,Boolean),e(this,"loop","loop",!0,Boolean),e(this,"start-at","startAt",0,parseInt),e(this,"speed","speed",1,parseFloat),e(this,"idle-time-limit","idleTimeLimit",null,parseFloat),e(this,"poster","poster",null,r),e(this,"font-size","fontSize"),e(this,"theme","theme"),e(this,"title","title"),e(this,"author","author"),e(this,"author-url","authorURL"),e(this,"author-img-url","authorImgURL"),{onCanPlay:function(){n.dispatchEvent(new CustomEvent("loadedmetadata")),n.dispatchEvent(new CustomEvent("loadeddata")),n.dispatchEvent(new CustomEvent("canplay")),n.dispatchEvent(new CustomEvent("canplaythrough"))},onPlay:function(){n.dispatchEvent(new CustomEvent("play"))},onPause:function(){n.dispatchEvent(new CustomEvent("pause"))}});this.player=asciinema.player.js.CreatePlayer(this,this.getAttribute("src"),t)},n.attachedCallback=function(){var n=this;setTimeout(function(){n.dispatchEvent(new CustomEvent("attached"))},0)},n.detachedCallback=function(){asciinema.player.js.UnmountPlayer(this),this.player=void 0},n.play=function(){this.player.play()},n.pause=function(){this.player.pause()},Object.defineProperty(n,"duration",{get:function(){return this.player.getDuration()||0},set:function(n){}}),Object.defineProperty(n,"currentTime",{get:function(){return this.player.getCurrentTime()},set:function(n){this.player.setCurrentTime(n)}}),document.registerElement("asciinema-player",{prototype:n})}!function(){function n(n,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var e=document.createEvent("CustomEvent");return e.initCustomEvent(n,t.bubbles,t.cancelable,t.detail),e}"function"!=typeof window.CustomEvent&&(n.prototype=window.Event.prototype,window.CustomEvent=n)}(),"undefined"==typeof WeakMap&&function(){function n(){this.name="__st"+(1e9*Math.random()>>>0)+t+++"__"}var r=Object.defineProperty,t=Date.now()%1e9;n.prototype={set:function(n,t){var e=n[this.name];return e&&e[0]===n?e[1]=t:r(n,this.name,{value:[n,t],writable:!0}),this},get:function(n){var t;return(t=n[this.name])&&t[0]===n?t[1]:void 0},delete:function(n){var t=n[this.name];return!(!t||t[0]!==n)&&!(t[0]=t[1]=void 0)},has:function(n){var t=n[this.name];return!!t&&t[0]===n}},window.WeakMap=n}(),function(n){function l(){p=!1;var n=d;d=[],n.sort(function(n,t){return n.uid_-t.uid_});var r=!1;n.forEach(function(n){var t,e=n.takeRecords();(t=n).nodes_.forEach(function(n){n=o.get(n);n&&n.forEach(function(n){n.observer===t&&n.removeTransientObservers()})}),e.length&&(n.callback_(e,n),r=!0)}),r&&l()}function a(n,t){for(var e=n;e;e=e.parentNode){var r=o.get(e);if(r)for(var l=0;l<r.length;l++){var i=r[l],u=i.options;e!==n&&!u.subtree||(u=t(u))&&i.enqueue(u)}}}function t(n){this.callback_=n,this.nodes_=[],this.records_=[],this.uid_=++v}function r(n,t){this.type=n,this.target=t,this.addedNodes=[],this.removedNodes=[],this.previousSibling=null,this.nextSibling=null,this.attributeName=null,this.attributeNamespace=null,this.oldValue=null}function c(n,t){return w=new r(n,t)}function h(n){return m||((e=new r((t=w).type,t.target)).addedNodes=t.addedNodes.slice(),e.removedNodes=t.removedNodes.slice(),e.previousSibling=t.previousSibling,e.nextSibling=t.nextSibling,e.attributeName=t.attributeName,e.attributeNamespace=t.attributeNamespace,e.oldValue=t.oldValue,(m=e).oldValue=n,m);var t,e}function i(n,t){return n===t?n:m&&((n=n)===m||n===w)?m:null}function u(n,t,e){this.observer=n,this.target=t,this.options=e,this.transientObservedNodes=[]}var o,