diff options
author | jahoti <jahoti@tilde.team> | 2021-08-15 00:00:00 +0000 |
---|---|---|
committer | jahoti <jahoti@tilde.team> | 2021-08-15 00:00:00 +0000 |
commit | d104aaf3ebcddfbda495bdfe3ba3a905f75b936f (patch) | |
tree | f617204baeb4919cd1bad2cf3e302acf3ef7116f /content/sphoronix_benchmarks | |
parent | 428c474c4c71ef4c7961070d4246017d15aa0c0c (diff) | |
download | hydrilla-fixes-bundle-d104aaf3ebcddfbda495bdfe3ba3a905f75b936f.tar.gz hydrilla-fixes-bundle-d104aaf3ebcddfbda495bdfe3ba3a905f75b936f.zip |
Port existing fixes from hachette_fixes_tmp to Hydrilla format
Diffstat (limited to 'content/sphoronix_benchmarks')
-rw-r--r-- | content/sphoronix_benchmarks/index.json | 6 | ||||
-rw-r--r-- | content/sphoronix_benchmarks/phoronix_benchmarks.js | 27 |
2 files changed, 33 insertions, 0 deletions
diff --git a/content/sphoronix_benchmarks/index.json b/content/sphoronix_benchmarks/index.json new file mode 100644 index 0000000..61bb5ce --- /dev/null +++ b/content/sphoronix_benchmarks/index.json @@ -0,0 +1,6 @@ +{ +"type" : "script", +"name" : "phoronix benchmarks", +"sha256" : "575ec9b3c356337c1f8d1670f3ba459cd9b39b15d51999df1dee35e34da427e1", +"location" : "phoronix_benchmarks.js" +}
\ No newline at end of file diff --git a/content/sphoronix_benchmarks/phoronix_benchmarks.js b/content/sphoronix_benchmarks/phoronix_benchmarks.js new file mode 100644 index 0000000..264545f --- /dev/null +++ b/content/sphoronix_benchmarks/phoronix_benchmarks.js @@ -0,0 +1,27 @@ +/** + * Copyright 2021 Wojtek Kosior + * + * Available under the terms of Creative Commons Zero. + */ + +/* Use with https://www.phoronix.com/*** */ + +/* + * Phoronix normally includes scripts that call document.write() to inject + * <img> tags. The most obvious way o code a fix would then be do download and + * parse the contents of those scripts. CORS, however, doesn't allow this. + * Instead, we notice that the openbenchmarking embed script url is related to + * the actual image url we need, so we can create <img>'s from it straight away. + */ +for (const script of document.scripts) { + const match = /openbenchmarking.org\/+(embed.php\?.*)p=0$/.exec(script.src); + if (!match) continue; + + const img = document.createElement("img"); + img.src = `https://openbenchmarking.org/${match[1]}p=2`; + img.setAttribute("type", "image/svg+xml"); + img.setAttribute("width", "100%"); + img.setAttribute("height", "auto"); + + script.parentElement.insertBefore(img, script); +} |