MCPcopy Index your code
hub / github.com/Bistutu/FluentRead / createSvgIcon

Function createSvgIcon

userscripts.js:1581–1603  ·  view source on GitHub ↗
(d)

Source from the content-addressed store, hash-verified

1579
1580// 根据 d 创建 svg 元素
1581function createSvgIcon(d) {
1582 // 创建SVG元素
1583 const svgNS = "http://www.w3.org/2000/svg";
1584 const svg = document.createElementNS(svgNS, "svg");
1585 svg.setAttribute("fill", "none");
1586 svg.setAttribute("viewBox", "0 0 40 40");
1587 svg.setAttribute("height", "40");
1588 svg.setAttribute("width", "40");
1589 svg.style.alignItems = 'center';
1590 svg.style.justifyContent = 'center'; // 可选,如果也需要水平居中
1591 svg.style.display = "inline";
1592 svg.style.width = "1em";
1593 svg.style.height = "1em";
1594 svg.style.marginLeft = '1em';
1595 svg.style.pointerEvents = "none";
1596
1597 // 创建path元素并设置属性
1598 const path = document.createElementNS(svgNS, "path");
1599 path.setAttribute("fill", "#428ADF");
1600 path.setAttribute("d", d);
1601 svg.appendChild(path);
1602 return svg;
1603}
1604
1605// 创建转圈动画并插入
1606function createLoadingSpinner(node, isCache) {

Callers 2

createRetrySvgIconFunction · 0.85
createWarnSvgIconFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected