11// GSAP for animations.
2- import { gsap } from "../modules/[email protected] " 3- import { ScrollTrigger } from "../modules/[email protected] _ScrollTrigger.min.mjs" 4- import detectPlatform from "../modules/detect-browser.mjs"
2+ import { gsap } from "../modules/[email protected] " ; 3+ import { ScrollTrigger } from "../modules/[email protected] _ScrollTrigger.min.mjs" ; 4+ import detectPlatform from "../modules/detect-browser.mjs" ;
55
66gsap . registerPlugin ( ScrollTrigger ) ;
77
@@ -16,25 +16,30 @@ const numberFormat = new Intl.NumberFormat("en-US");
1616
1717for ( const el of [ "commits" , "contributors" ] ) {
1818 const timeline = gsap . timeline ( ) ;
19- const lines = gsap . utils . toArray ( `.release-header .header-numbers-${ el } .header-numbers-line` ) . reverse ( ) ;
19+ const lines = gsap . utils
20+ . toArray ( `.release-header .header-numbers-${ el } .header-numbers-line` )
21+ . reverse ( ) ;
2022 for ( let i = 0 ; i < lines . length ; i ++ ) {
2123 const line = lines [ i ] ;
2224 const localTimeline = gsap . timeline ( ) ;
2325 localTimeline . to ( line . querySelector ( ".bar" ) , {
24- delay : i == 0
25- ? RELEASE_NUMBERS_INITIAL_DELAY_S
26- : 0 ,
26+ delay : i == 0 ? RELEASE_NUMBERS_INITIAL_DELAY_S : 0 ,
2727 duration : RELEASE_NUMBERS_DURATION_S ,
2828 ease : RELEASE_NUMBERS_EASE_NAME ,
2929 width : `${ ( Number ( line . dataset . value ) / Number ( line . dataset . max ) ) * RELEASE_NUMBERS_MAX_BAR_WIDTH_PX } px` ,
3030 onUpdate : ( ) => {
3131 line . querySelector ( ".number" ) . innerText = numberFormat . format (
32- Math . round ( releaseNumbersEase ( localTimeline . progress ( ) ) * Number ( line . dataset . value ) )
32+ Math . round (
33+ releaseNumbersEase ( localTimeline . progress ( ) ) *
34+ Number ( line . dataset . value ) ,
35+ ) ,
3336 ) ;
3437 } ,
3538 onComplete : ( ) => {
36- line . querySelector ( ".number" ) . innerText = numberFormat . format ( Number ( line . dataset . value ) ) ;
37- }
39+ line . querySelector ( ".number" ) . innerText = numberFormat . format (
40+ Number ( line . dataset . value ) ,
41+ ) ;
42+ } ,
3843 } ) ;
3944 timeline . add ( localTimeline ) ;
4045
@@ -46,7 +51,11 @@ for (const el of ["commits", "contributors"]) {
4651// Add a scrolling effect to each card and title.
4752const windowHeight = window . innerHeight ;
4853/** @type {HTMLDivElement[] } */
49- const elements = Array . from ( gsap . utils . toArray ( ".release-content .section .release-cards .release-card, .release-content .section .section-title" ) ) ;
54+ const elements = Array . from (
55+ gsap . utils . toArray (
56+ ".release-content .section .release-cards .release-card, .release-content .section .section-title" ,
57+ ) ,
58+ ) ;
5059for ( const element of elements ) {
5160 if ( element . getBoundingClientRect ( ) . top < windowHeight ) {
5261 continue ;
@@ -56,40 +65,53 @@ for (const element of elements) {
5665 scrollTrigger : {
5766 trigger : element ,
5867 start : "top bottom" ,
59- }
68+ } ,
6069 } ) ;
6170 timeline . from ( element , {
6271 y : "+=50" ,
6372 duration : 0.5 ,
64- opacity : 0
73+ opacity : 0 ,
6574 } ) ;
6675}
6776
6877// Hide downloads that aren't for the user's platform.
69- const platformData = detectPlatform ( navigator . userAgent , navigator . userAgentData ) ;
78+ const platformData = detectPlatform (
79+ navigator . userAgent ,
80+ navigator . userAgentData ,
81+ ) ;
7082let platformName = "windows" ;
7183switch ( platformData . os ) {
7284 case "mac" :
7385 case "iphone" :
74- case "ipad" : {
75- platformName = "macos" ;
76- } break ;
86+ case "ipad" :
87+ {
88+ platformName = "macos" ;
89+ }
90+ break ;
7791
78- case "linux" : {
79- platformName = "linux" ;
80- } break ;
92+ case "linux" :
93+ {
94+ platformName = "linux" ;
95+ }
96+ break ;
8197
82- case "android" : {
83- platformName = "android" ;
84- } break ;
98+ case "android" :
99+ {
100+ platformName = "android" ;
101+ }
102+ break ;
85103
86104 case "windows" :
87105 default :
88106 break ;
89107}
90- const releasePlatformContainer = document . querySelector ( ".release-platform-container" ) ;
108+ const releasePlatformContainer = document . querySelector (
109+ ".release-platform-container" ,
110+ ) ;
91111if ( releasePlatformContainer != null ) {
92- const releasePlatform = releasePlatformContainer . querySelector ( `.release-platform-${ platformName } ` ) ;
112+ const releasePlatform = releasePlatformContainer . querySelector (
113+ `.release-platform-${ platformName } ` ,
114+ ) ;
93115 if ( releasePlatform != null ) {
94116 releasePlatform . classList . add ( "active" ) ;
95117 }
@@ -102,7 +124,11 @@ if (downloadOther != null) {
102124}
103125
104126// Add relative weight based on author data
105- const authors = Array . from ( document . querySelectorAll ( "#special-thanks-release-authors .release-card-authors .release-card-author" ) ) ;
127+ const authors = Array . from (
128+ document . querySelectorAll (
129+ "#special-thanks-release-authors .release-card-authors .release-card-author" ,
130+ ) ,
131+ ) ;
106132let max_prs = 0 ;
107133for ( const author of authors ) {
108134 max_prs = Math . max ( max_prs , Number ( author . dataset . prs ) ) ;
@@ -168,7 +194,12 @@ for (const cLink of cLinks) {
168194 * @param {number } currentIndex
169195 * @param {Contributor[] } array
170196 */
171- const contributorsReducer = ( previousValue , currentValue , currentIndex , array ) => {
197+ const contributorsReducer = (
198+ previousValue ,
199+ currentValue ,
200+ currentIndex ,
201+ array ,
202+ ) => {
172203 if ( currentIndex === 0 ) {
173204 return `${ previousValue } ${ currentValue } ` ;
174205 } else if ( currentIndex < array . length - 1 ) {
@@ -184,7 +215,9 @@ for (const cLink of cLinks) {
184215 try {
185216 contributors = JSON . parse ( cLink . dataset . contributors ) ;
186217 } catch ( err ) {
187- const newErr = new Error ( `Could not parse c-link contributors JSON. ${ cLink . dataset . contributors } ` ) ;
218+ const newErr = new Error (
219+ `Could not parse c-link contributors JSON. ${ cLink . dataset . contributors } ` ,
220+ ) ;
188221 newErr . cause = err ;
189222 throw newErr ;
190223 }
@@ -199,14 +232,19 @@ for (const cLink of cLinks) {
199232 return `${ contributor . name } (${ contributor . github } )` ;
200233 } ;
201234 const contributorsToString = contributors . map ( getContributorDisplayName ) ;
202- const contributorsText = contributorsToString . reduce ( contributorsReducer , "Contributed by" ) ;
203- const contributorsHtml = contributors . map ( ( contributor ) => {
204- const link = document . createElement ( "a" ) ;
205- link . href = `https://github.com/${ contributor . github } ` ;
206- link . target = "_blank" ;
207- link . textContent = getContributorDisplayName ( contributor ) ;
208- return link . outerHTML ;
209- } ) . reduce ( contributorsReducer , "Contributed by" ) ;
235+ const contributorsText = contributorsToString . reduce (
236+ contributorsReducer ,
237+ "Contributed by" ,
238+ ) ;
239+ const contributorsHtml = contributors
240+ . map ( ( contributor ) => {
241+ const link = document . createElement ( "a" ) ;
242+ link . href = `https://github.com/${ contributor . github } ` ;
243+ link . target = "_blank" ;
244+ link . textContent = getContributorDisplayName ( contributor ) ;
245+ return link . outerHTML ;
246+ } )
247+ . reduce ( contributorsReducer , "Contributed by" ) ;
210248
211249 const button = cLink . appendChild ( document . createElement ( "button" ) ) ;
212250 button . classList . add ( "c-link-popover-button" ) ;
@@ -240,15 +278,18 @@ function computePosition(invoker, popover) {
240278 const popoverRect = popover . getBoundingClientRect ( ) ;
241279 const windowSize = {
242280 width : window . innerWidth ,
243- height : window . innerHeight
281+ height : window . innerHeight ,
244282 } ;
245283 const padding = 10 ;
246284 const popoverPosition = {
247- x : invokerRect . x - ( popoverRect . width / 2 ) ,
285+ x : invokerRect . x - popoverRect . width / 2 ,
248286 y : invokerRect . y - popoverRect . height - padding ,
249287 } ;
250288
251- popoverPosition . x = Math . min ( Math . max ( popoverPosition . x , 0 ) , windowSize . width - popoverRect . width ) ;
289+ popoverPosition . x = Math . min (
290+ Math . max ( popoverPosition . x , 0 ) ,
291+ windowSize . width - popoverRect . width ,
292+ ) ;
252293 if ( popoverPosition . y < 0 ) {
253294 popoverPosition . y = invokerRect . y + invokerRect . height + padding ;
254295 }
@@ -264,7 +305,9 @@ function positionPopover(event) {
264305 return ;
265306 }
266307 const popover = event . target ;
267- const invoker = document . querySelector ( `[popovertarget="${ popover . getAttribute ( "id" ) } "` ) ;
308+ const invoker = document . querySelector (
309+ `[popovertarget="${ popover . getAttribute ( "id" ) } "` ,
310+ ) ;
268311 const { x, y } = computePosition ( invoker , popover ) ;
269312 Object . assign ( popover . style , {
270313 left : `${ x } px` ,
@@ -300,7 +343,10 @@ const lazyVideoObserver = new IntersectionObserver((entries, observer) => {
300343 }
301344
302345 for ( var entryChildElement of entry . target . children ) {
303- if ( typeof entryChildElement . tagName === "string" && entryChildElement . tagName === "SOURCE" ) {
346+ if (
347+ typeof entryChildElement . tagName === "string" &&
348+ entryChildElement . tagName === "SOURCE"
349+ ) {
304350 entryChildElement . src = entryChildElement . dataset . src ;
305351 }
306352 }
@@ -346,7 +392,7 @@ const hideScrollToTop = () => {
346392 duration : 0.5 ,
347393 onComplete : ( ) => {
348394 scrollToTopElement . style . display = "none" ;
349- }
395+ } ,
350396 } ) ;
351397} ;
352398const scrollToTopObserver = new IntersectionObserver ( ( entries , observer ) => {
0 commit comments