Last active
September 20, 2023 20:55
-
-
Save bgrins/243b783921a30da94ad8deccceeb74c6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- https://github.com/HTTPArchive/almanac.httparchive.org/blob/a54cc07fc61461e1366112ba81cf6e8fed7236fa/sql/2022/css/multicol.sql#L9 | |
-- https://github.com/HTTPArchive/almanac.httparchive.org/blob/a54cc07fc61461e1366112ba81cf6e8fed7236fa/sql/2021/css/grid_named_lines.sql#L9 | |
CREATE TEMPORARY FUNCTION countMozImageRect(css STRING) | |
RETURNS NUMERIC | |
LANGUAGE js | |
OPTIONS (library = "gs://httparchive/lib/css-utils.js") | |
AS ''' | |
try { | |
const ast = JSON.parse(css); | |
return countDeclarations(ast.stylesheet.rules, {values: /^-moz-image-rect/}); | |
} catch (e) { | |
return false; | |
} | |
'''; | |
SELECT | |
SUM(count_declarations) total_declarations, | |
COUNT(DISTINCT page) AS num_pages, | |
STRING_AGG(DISTINCT page, ', ') AS aggregated_urls | |
FROM ( | |
SELECT | |
page, | |
SUM(countMozImageRect(css)) AS count_declarations | |
FROM | |
`httparchive.almanac.parsed_css` | |
WHERE | |
date = '2022-07-01' | |
AND client = "desktop" | |
AND countMozImageRect(css) > 0 | |
GROUP BY | |
page | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
total_declarations num_pages aggregated_urls | |
7 4 "https://deshuniversal.com/, https://www.globaledulink.co.uk/, https://codebit.com.br/, https://manger.sortir-en-bretagne.fr/" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment