Fix SVGs on HackerRank.com

If you have a hard time reading some of the text on HackerRank.com this may help. Some of the text in the problems are SVG and the stoke creates a messy, jagged edge unless you zoom in on them. This removes the stoke of all svgs on challenge screens and allows you to change the SVG fill color to whatever you want (by editing the commented line in the script).

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        Fix SVGs on HackerRank.com
// @description If you have a hard time reading some of the text on HackerRank.com this may help. Some of the text in the problems are SVG and the stoke creates a messy, jagged edge unless you zoom in on them. This removes the stoke of all svgs on challenge screens and allows you to change the SVG fill color to whatever you want (by editing the commented line in the script).
// @namespace   z3r0cool
// @include     https://www.hackerrank.com/*
// @version     1.1
// @license     Apache 2.0
// @grant       none
// ==/UserScript==
var url = document.location.toString();
function scriptBody() {
    if (document.location.toString().includes('/challenges/')) {
        let svgs = document.querySelectorAll('svg');
        if (svgs) {
            svgs.forEach(svg => {
                let path = svg.querySelector('g');
                if (path) {
                    path.setAttribute("stroke", "transparent");
                    // change svg color here
                    path.setAttribute("fill", "#00aaEE");
                }
            });
        }
    }
}
setTimeout(scriptBody(), 1000);
document.querySelector('html') .addEventListener('DOMNodeInserted', function (ev) {
    var new_url = document.location.toString();
    if (url == new_url) return ;
    url = new_url;
    setTimeout(scriptBody(), 1000);
});