-
Notifications
You must be signed in to change notification settings - Fork 143
Expand file tree
/
Copy pathset-up.php
More file actions
60 lines (60 loc) · 2.22 KB
/
set-up.php
File metadata and controls
60 lines (60 loc) · 2.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
return static function ( Test_Image_Prioritizer_Helper $test_case ): void {
$slug = od_get_url_metrics_slug( od_get_normalized_query_vars() );
$sample_size = od_get_url_metrics_breakpoint_sample_size();
foreach ( array_merge( od_get_breakpoint_max_widths(), array( 1000 ) ) as $viewport_width ) {
for ( $i = 0; $i < $sample_size; $i++ ) {
OD_URL_Metrics_Post_Type::store_url_metric(
$slug,
$test_case->get_sample_url_metric(
array(
'viewport_width' => $viewport_width,
'elements' => array(
array(
'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[1][self::DIV]/*[1][self::IMG]',
'isLCP' => true,
),
array(
'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[1][self::DIV]/*[2][self::IMG]',
'isLCP' => false,
'intersectionRatio' => 0.0, // Subsequent carousel slide.
),
array(
'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[1][self::DIV]/*[3][self::IMG]',
'isLCP' => false,
'intersectionRatio' => 0.0, // Subsequent carousel slide.
),
array(
'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[3][self::IMG]',
'isLCP' => false,
'intersectionRatio' => 0 === $i ? 0.5 : 0.0, // Make sure that the _max_ intersection ratio is considered.
'boundingClientRect' => array(
'width' => $viewport_width - 10,
),
),
// All are outside all initial viewports.
array(
'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[5][self::IMG]',
'isLCP' => false,
'intersectionRatio' => 0.0,
'boundingClientRect' => array( 'top' => 100000 ),
),
array(
'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[6][self::IMG]',
'isLCP' => false,
'intersectionRatio' => 0.0,
'boundingClientRect' => array( 'top' => 100000 ),
),
array(
'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[7][self::IMG]',
'isLCP' => false,
'intersectionRatio' => 0.0,
'boundingClientRect' => array( 'top' => 100000 ),
),
),
)
)
);
}
}
};