astroport/doc/Turning the database inside.../fU9hR3kiOK0_data/endscreen.js

65 lines
14 KiB
JavaScript

(function(g){var window=this;var S4=function(a,b,c){var d=b.ya();g.K(a.element,"ytp-suggestion-set",!!d.videoId);var e=b.getPlaylistId();c=b.tc(c?c:"mqdefault.jpg");var f=b instanceof g.aB&&b.lengthSeconds?g.hM(b.lengthSeconds):null,k=!!e;e=k&&"RD"===(new g.mC(e.substr(0,2),e.substr(2))).type;var l=b instanceof g.aB?b.va:null;d={title:b.title,author:b.author,author_and_views:d.shortViewCount?b.author+" \u2022 "+d.shortViewCount:b.author,aria_label:b.Tk||g.gM("Regarder $TITLE",{TITLE:b.title}),duration:f,url:b.kh(),is_live:l,
is_list:k,is_mix:e,background:c?"background-image: url("+c+")":""};b instanceof g.nC&&(d.playlist_length=b.getLength());a.update(d)},T4=function(a){g.R.call(this,{D:"div",
Y:["ytp-upnext","ytp-player-content"],O:{"aria-label":"{{aria_label}}"},J:[{D:"div",H:"ytp-cued-thumbnail-overlay-image",O:{style:"{{background}}"}},{D:"span",H:"ytp-upnext-top",J:[{D:"span",H:"ytp-upnext-header",W:"\u00c0 suivre"},{D:"span",H:"ytp-upnext-title",W:"{{title}}"},{D:"span",H:"ytp-upnext-author",W:"{{author}}"}]},{D:"a",H:"ytp-upnext-autoplay-icon",O:{role:"button",href:"{{url}}","aria-label":"Lire la vid\u00e9o suivante"},J:[{D:"svg",O:{height:"100%",version:"1.1",viewBox:"0 0 72 72",
width:"100%"},J:[{D:"circle",H:"ytp-svg-autoplay-circle",O:{cx:"36",cy:"36",fill:"#fff","fill-opacity":"0.3",r:"31.5"}},{D:"circle",H:"ytp-svg-autoplay-ring",O:{cx:"-36",cy:"36","fill-opacity":"0",r:"33.5",stroke:"#FFFFFF","stroke-dasharray":"211","stroke-dashoffset":"-211","stroke-width":"4",transform:"rotate(-90)"}},{D:"path",H:"ytp-svg-fill",O:{d:"M 24,48 41,36 24,24 V 48 z M 44,24 v 24 h 4 V 24 h -4 z"}}]}]},{D:"span",H:"ytp-upnext-bottom",J:[{D:"span",H:"ytp-upnext-cancel"},{D:"span",H:"ytp-upnext-paused",
W:"La lecture automatique est d\u00e9sactiv\u00e9e"}]}]});this.B=null;var b=this.o["ytp-upnext-cancel"];this.B=new g.R({D:"button",Y:["ytp-upnext-cancel-button","ytp-button"],O:{tabindex:"0","aria-label":"Annuler la lecture automatique"},W:"Annuler"});g.B(this,this.B);this.B.ka("click",this.tK,this);this.B.ca(b);this.u=a;this.M=this.o["ytp-svg-autoplay-ring"];this.F=this.C=this.w=this.A=null;this.G=new g.I(this.En,5E3,this);g.B(this,this.G);this.I=0;g.kL(this.u,this.element,this,18788);this.L(this.o["ytp-upnext-autoplay-icon"],
"click",this.gM);this.mA();this.L(a,"autonavvisibility",this.mA);this.L(a,"mdxnowautoplaying",this.wL);this.L(a,"mdxautoplaycanceled",this.xL);this.L(a,"mdxautoplayupnext",this.LC);3==this.u.getPresentingPlayerType()&&(a=(a=g.RK(g.KK(this.u)))?a.fF():null)&&this.LC(a);g.K(this.element,"ytp-upnext-mobile",this.u.N().o)},U4=function(a,b){if(!a.w){g.Qo("a11y-announce","\u00c0 suivre "+a.A.title);
a.I=(0,g.N)();a.w=new g.I((0,g.x)(a.Rq,a,b),25);a.Rq(b);var c=b||g.Q(a.u.N().experiments,"autoplay_time")||1E4;a.u.na("onAutonavCoundownStarted",c)}g.Dn(a.element,"ytp-upnext-autoplay-paused")},W4=function(a){V4(a);
a.I=(0,g.N)();a.Rq();g.J(a.element,"ytp-upnext-autoplay-paused")},V4=function(a){a.w&&(a.w.dispose(),a.w=null)},X4=function(a,b){g.R.call(this,{D:"div",
Y:["html5-endscreen","ytp-player-content",b||"base-endscreen"]});this.created=!1;this.player=a},Zua=function(a){X4.call(this,a,"subscribecard-endscreen");
var b=a.getVideoData();this.u=new g.R({D:"div",H:"ytp-subscribe-card",J:[{D:"img",H:"ytp-author-image",O:{src:b.Id}},{D:"div",H:"ytp-subscribe-card-right",J:[{D:"div",H:"ytp-author-name",W:b.author},{D:"div",H:"html5-subscribe-button-container"}]}]});g.B(this,this.u);this.u.ca(this.element);this.subscribeButton=new g.yQ("S'abonner",null,"Se d\u00e9sabonner",null,!0,!1,b.Ng,b.subscribed,"trailer-endscreen",null,null,a);g.B(this,this.subscribeButton);this.subscribeButton.ca(this.u.o["html5-subscribe-button-container"]);
this.hide()},Y4=function(a){var b=a.N(),c=g.Dt||g.vh?{style:"will-change: opacity"}:void 0,d=b.u,e=["ytp-videowall-still"];
b.o&&e.push("ytp-videowall-show-text");g.R.call(this,{D:"a",Y:e,O:{href:"{{url}}",target:d?b.C:"","aria-label":"{{aria_label}}","data-is-live":"{{is_live}}","data-is-list":"{{is_list}}","data-is-mix":"{{is_mix}}"},J:[{D:"div",H:"ytp-videowall-still-image",O:{style:"{{background}}"}},{D:"span",H:"ytp-videowall-still-info",J:[{D:"span",H:"ytp-videowall-still-info-bg",J:[{D:"span",H:"ytp-videowall-still-info-content",O:c,J:[{D:"span",H:"ytp-videowall-still-info-title",W:"{{title}}"},{D:"span",H:"ytp-videowall-still-info-author",
W:"{{author_and_views}}"},{D:"span",H:"ytp-videowall-still-info-live",W:"En direct"},{D:"span",H:"ytp-videowall-still-info-duration",W:"{{duration}}"}]}]}]},{D:"span",Y:["ytp-videowall-still-listlabel-regular","ytp-videowall-still-listlabel"],J:[{D:"span",H:"ytp-videowall-still-listlabel-icon"},"Playlist",{D:"span",H:"ytp-videowall-still-listlabel-length",J:[" (",{D:"span",W:"{{playlist_length}}"},")"]}]},{D:"span",Y:["ytp-videowall-still-listlabel-mix","ytp-videowall-still-listlabel"],J:[{D:"span",
H:"ytp-videowall-still-listlabel-mix-icon"},"Mix",{D:"span",H:"ytp-videowall-still-listlabel-length",W:" (50+)"}]}]});this.suggestion=null;this.u=d;this.api=a;this.w=new g.Gr(this);g.B(this,this.w);this.ka("click",this.onClick);this.ka("keypress",this.B);this.w.L(a,"videodatachange",this.A);g.lL(a,this.element,this);this.A()},Z4=function(a){X4.call(this,a,"videowall-endscreen");
var b=this;this.K=a;this.A=0;this.stills=[];this.B=this.videoData=this.suggestions=null;this.C=this.I=!1;this.G=null;this.w=new g.RQ(this);g.B(this,this.w);this.F=new g.I(function(){g.J(b.element,"ytp-show-tiles")},0);
g.B(this,this.F);var c=new g.R({D:"button",Y:["ytp-button","ytp-endscreen-previous"],O:{"aria-label":"Pr\u00e9c\u00e9dente"},J:[g.BM()]});g.B(this,c);c.ca(this.element);c.ka("click",this.uH,this);this.table=new g.Mu({D:"div",H:"ytp-endscreen-content"});g.B(this,this.table);this.table.ca(this.element);c=new g.R({D:"button",Y:["ytp-button","ytp-endscreen-next"],O:{"aria-label":"Suivante"},J:[g.CM()]});g.B(this,c);c.ca(this.element);c.ka("click",this.tH,this);this.u=new T4(a);g.B(this,this.u);g.iL(this.player,
this.u.element,4);this.hide()},$4=function(a){return g.jL(a.player)&&a.iw()&&!a.B},$ua=function(a,b){return(0,g.Cc)(b.suggestions,function(c){c=g.jM(a.K.N(),c);
g.B(a,c);return c})},a5=function(a){var b=a.gt();
b!==a.I&&(a.I=b,a.player.S("autonavvisibility"))},b5=function(a){g.vL.call(this,a);
this.endScreen=null;this.listeners=new g.Gr(this);g.B(this,this.listeners);this.o=a.N();ava(a)?this.endScreen=new Z4(this.player):this.o.Ta?this.endScreen=new Zua(this.player):this.endScreen=new X4(this.player);g.B(this,this.endScreen);g.iL(this.player,this.endScreen.element,4);this.UB();this.listeners.L(a,"videodatachange",this.UB,this);this.listeners.L(a,g.lC("endscreen"),this.qH,this);this.listeners.L(a,"crx_endscreen",this.rH,this)},ava=function(a){a=a.N();
return a.Aa&&!a.Ta};
g.r(T4,g.R);g.h=T4.prototype;g.h.En=function(){this.C&&(this.G.stop(),this.bb(this.F),this.F=null,this.C.close(),this.C=null)};
g.h.mA=function(){g.Qu(this,g.LK(this.u));g.oL(this.u,this.element,g.LK(this.u))};
g.h.VL=function(){window.focus();this.En()};
g.h.hide=function(){g.R.prototype.hide.call(this)};
g.h.Rq=function(a){a=a||g.Q(this.u.N().experiments,"autoplay_time")||1E4;var b=Math.min((0,g.N)()-this.I,a);a=Math.min(b/a,1);this.M.setAttribute("stroke-dashoffset",-211*(a+1));1<=a&&3!=this.u.getPresentingPlayerType()?this.select(!0):this.w&&this.w.start()};
g.h.select=function(a){a=void 0===a?!1:a;if(g.P(this.u.N().experiments,"autonav_notifications")&&a&&window.Notification&&document.hasFocus){var b=Notification.permission;"default"==b?Notification.requestPermission():"granted"!=b||document.hasFocus()||(b=this.A.ya(),this.En(),this.C=new Notification("\u00c0 suivre",{body:b.title,icon:b.tc()}),this.F=this.L(this.C,"click",this.VL),this.G.start())}V4(this);this.u.nextVideo(!1,a)};
g.h.gM=function(a){!g.xe(this.B.element,g.Gp(a))&&g.IN(a,this.u)&&this.select()};
g.h.tK=function(){g.NK(this.u,!0)};
g.h.wL=function(a){this.u.getPresentingPlayerType();this.show();U4(this,a)};
g.h.LC=function(a){this.u.getPresentingPlayerType();this.A&&this.A.ya().videoId==a.ya().videoId||(this.A=a,S4(this,a,"hqdefault.jpg"))};
g.h.xL=function(){this.u.getPresentingPlayerType();V4(this);this.hide()};
g.h.X=function(){V4(this);this.En();g.R.prototype.X.call(this)};g.r(X4,g.R);g.h=X4.prototype;g.h.create=function(){this.created=!0};
g.h.destroy=function(){this.created=!1};
g.h.iw=function(){return!1};
g.h.gt=function(){return!1};
g.h.py=function(){return!1};g.r(Zua,X4);g.r(Y4,g.R);Y4.prototype.select=function(){var a=this.suggestion.ya().videoId,b=this.suggestion.getPlaylistId();(g.rT(this.api.app,a,this.suggestion.Ob,b,void 0,void 0)||this.api.fa("web_player_endscreen_double_log_fix_killswitch"))&&g.nL(this.api,this.element)};
Y4.prototype.onClick=function(a){g.IN(a,this.api,this.u,this.suggestion.Ob||void 0)&&this.select()};
Y4.prototype.B=function(a){switch(a.keyCode){case 13:case 32:g.Lp(a)||(this.select(),g.Kp(a))}};
Y4.prototype.A=function(){var a=this.api.getVideoData(),b=this.api.N();this.u=a.lc?!1:b.u};g.r(Z4,X4);g.h=Z4.prototype;g.h.create=function(){X4.prototype.create.call(this);var a=this.player.getVideoData();a&&(this.suggestions=$ua(this,a),this.videoData=a);this.Hg();this.w.L(this.player,"appresize",this.Hg);this.w.L(this.player,"onVideoAreaChange",this.Hg);this.w.L(this.player,"videodatachange",this.vH);this.w.L(this.player,"autonavchange",this.ht);this.w.L(this.player,"autonavcancel",this.sH);a=this.videoData.autonavState;a!==this.G&&this.ht(a);this.w.L(this.element,"transitionend",this.tN)};
g.h.destroy=function(){g.Ir(this.w);g.Ie(this.stills);this.stills=[];this.suggestions=null;X4.prototype.destroy.call(this);g.Dn(this.element,"ytp-show-tiles");this.F.stop();this.G=this.videoData.autonavState};
g.h.iw=function(){return 1!==this.videoData.autonavState};
g.h.show=function(){X4.prototype.show.call(this);g.Dn(this.element,"ytp-show-tiles");this.player.N().o?g.un(this.F):this.F.start();(this.C||this.B&&this.B!==this.videoData.clientPlaybackNonce)&&g.NK(this.player,!1);$4(this)?(a5(this),2===this.videoData.autonavState?this.player.N().fa("fast_autonav_in_background")&&3===this.player.getVisibilityState()?this.u.select(!0):U4(this.u):3===this.videoData.autonavState&&W4(this.u)):(g.NK(this.player,!0),a5(this))};
g.h.hide=function(){X4.prototype.hide.call(this);W4(this.u);a5(this)};
g.h.tN=function(a){g.Gp(a)===this.element&&this.Hg()};
g.h.Hg=function(){if(this.suggestions&&this.suggestions.length){g.J(this.element,"ytp-endscreen-paginate");var a=g.$K(this.K,!0,this.K.isFullscreen()),b=g.dC(this.K);b&&(b=b.kc()?48:32,a.width-=2*b);var c=a.width/a.height,d=96/54,e=b=2,f=Math.max(a.width/96,2),k=Math.max(a.height/54,2),l=this.suggestions.length,m=Math.pow(2,2);var n=l*m+(Math.pow(2,2)-m);n+=Math.pow(2,2)-m;for(n-=m;0<n&&(b<f||e<k);){var p=b/2,t=e/2,u=b<=f-2&&n>=t*m,z=e<=k-2&&n>=p*m;if((p+1)/t*d/c>c/(p/(t+1)*d)&&z)n-=p*m,e+=2;else if(u)n-=
t*m,b+=2;else if(z)n-=p*m,e+=2;else break}d=!1;n>=3*m&&6>=l*m-n&&(4<=e||4<=b)&&(d=!0);m=96*b;n=54*e;c=m/n<c?a.height/n:a.width/m;c=Math.min(c,2);m*=c;n*=c;c=this.player.N().fa("web_player_no_endscreen_crop")?1:1.21;m*=g.Md(a.width/m||1,1,c);n*=g.Md(a.height/n||1,1,c);m=Math.floor(Math.min(a.width,m));n=Math.floor(Math.min(a.height,n));a=this.table.element;g.Mh(a,m,n);g.sh(a,{marginLeft:m/-2+"px",marginTop:n/-2+"px"});c=this.u;f=this.suggestions[0];c.A=f;S4(c,f,"hqdefault.jpg");g.K(this.element,"ytp-endscreen-takeover",
$4(this));a5(this);m+=4;n+=4;for(f=c=0;f<b;f++)for(k=0;k<e;k++)if(p=c,t=0,d&&f>=b-2&&k>=e-2?t=1:0===k%2&&0===f%2&&(2>k&&2>f?0===k&&0===f&&(t=2):t=2),p=g.Nd(p+this.A,l),0!==t){u=this.stills[c];u||(u=new Y4(this.player),this.stills[c]=u,a.appendChild(u.element));z=Math.floor(n*k/e);var C=Math.floor(m*f/b),D=Math.floor(n*(k+t)/e)-z-4,E=Math.floor(m*(f+t)/b)-C-4;g.Ah(u.element,C,z);g.Mh(u.element,E,D);g.sh(u.element,"transitionDelay",(k+f)/20+"s");g.K(u.element,"ytp-videowall-still-mini",1===t);g.K(u.element,
"ytp-videowall-still-large",2<t);t=u;p=this.suggestions[p];t.suggestion!==p&&(t.suggestion=p,u=t.api.N(),z=g.Bn(t.element,"ytp-videowall-still-large")?"hqdefault.jpg":"mqdefault.jpg",S4(t,p,z),g.Ly(u)&&(u=p.kh(),u=g.yd(u,g.DH({},"emb_rel_end")),t.la("url",u)),(p=(p=p.Ob)&&p.itct)&&g.mL(t.api,t.element,p));c++}g.K(this.element,"ytp-endscreen-paginate",c<l);for(b=this.stills.length-1;b>=c;b--)e=this.stills[b],g.te(e.element),g.He(e);this.stills.length=c}};
g.h.vH=function(){var a=this.player.getVideoData();this.videoData!==a&&(this.A=0,this.suggestions=$ua(this,a),this.videoData=a,this.Hg())};
g.h.tH=function(){this.A+=this.stills.length;this.Hg()};
g.h.uH=function(){this.A-=this.stills.length;this.Hg()};
g.h.py=function(){return!!this.u.w};
g.h.ht=function(a){1===a?(this.C=!1,this.B=this.videoData.clientPlaybackNonce,V4(this.u),this.Ha()&&this.Hg()):(this.C=!0,this.Ha()&&$4(this)&&(2===a?U4(this.u):3===a&&W4(this.u)))};
g.h.sH=function(a){if(a){for(a=0;a<this.stills.length;a++)g.oL(this.K,this.stills[a].element,!0);this.ht(1)}else this.B=null,this.C=!1;this.Hg()};
g.h.gt=function(){return this.Ha()&&$4(this)};g.r(b5,g.vL);g.h=b5.prototype;g.h.Py=function(){var a=this.player.getVideoData(),b=!!(a&&a.suggestions&&a.suggestions.length);b=!ava(this.player)||b;var c=a.oj||g.Uy(a.Pa),d=g.LS(this.player.app);a=a.mutedAutoplay;return b&&!c&&!d&&!a};
g.h.Oy=function(){return this.endScreen.gt()};
g.h.aG=function(){return this.Oy()?this.endScreen.py():!1};
g.h.X=function(){g.fR(this.player.app,"endscreen",void 0);g.vL.prototype.X.call(this)};
g.h.load=function(){g.vL.prototype.load.call(this);this.endScreen.show()};
g.h.unload=function(){g.vL.prototype.unload.call(this);this.endScreen.hide();this.endScreen.destroy()};
g.h.qH=function(a){this.Py()&&(this.endScreen.created||this.endScreen.create(),"load"===a.getId()&&this.load())};
g.h.rH=function(a){"load"===a.getId()&&this.loaded&&this.unload()};
g.h.UB=function(){g.fR(this.player.app,"endscreen",void 0);var a=this.player.getVideoData();a=new g.iC(Math.max(1E3*(a.lengthSeconds-10),0),0x8000000000000,{id:"preload",namespace:"endscreen"});var b=new g.iC(0x8000000000000,0x8000000000000,{id:"load",priority:6,namespace:"endscreen"});g.eL(this.player,[a,b])};g.KL.endscreen=b5;})(_yt_player);