aboutsummaryrefslogtreecommitdiff
path: root/phttps___www.phoronix.com____.json
blob: 453b5012324bf275e5405db08f25bba58b047f33 (plain)
1
[{"sphoronix benchmarks":{"url":"","hash":"","text":"/**\n * Copyright 2021 Wojtek Kosior\n *\n * Available under the terms of Creative Commons Zero.\n */\n\n/* Use with https://www.phoronix.com/*** */\n\n/*\n * Phoronix normally includes scripts that call document.write() to inject\n * <img> tags. The most obvious way o code a fix would then be do download and\n * parse the contents of those scripts. CORS, however, doesn't allow this.\n * Instead, we notice that the openbenchmarking embed script url is related to\n * the actual image url we need, so we can create <img>'s from it straight away.\n */\nfor (const script of document.scripts) {\n    const match = /openbenchmarking.org\\/+(embed.php\\?.*)p=0$/.exec(script.src);\n    if (!match) continue;\n\n    const img = document.createElement(\"img\");\n    img.src = `https://openbenchmarking.org/${match[1]}p=2`;\n    img.setAttribute(\"type\", \"image/svg+xml\");\n    img.setAttribute(\"width\", \"100%\");\n    img.setAttribute(\"height\", \"auto\");\n\n    script.parentElement.insertBefore(img, script);\n}\n"}},{"phttps://www.phoronix.com/***":{"components":["s","phoronix benchmarks"],"allow":false}}]