favicon 加载失败时使用默认占位图标
This commit is contained in:
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" width="200px" height="200.00px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path fill="#e6e6e6" d="M531 732.213c109.663-9.128 197.085-96.55 206.213-206.213H699c-9.389 0-17-7.611-17-17s7.611-17 17-17h38.51C730.203 380.467 641.995 291.025 531 281.787V316c0 9.389-7.611 17-17 17s-17-7.611-17-17v-34.51C384.134 288.885 293.885 379.132 286.49 492H325c9.389 0 17 7.611 17 17s-7.611 17-17 17h-38.212c3.376 40.555 17.521 78.913 40.845 111.74 5.438 7.653 3.642 18.266-4.012 23.704-7.653 5.438-18.266 3.642-23.704-4.012C268.924 613.812 252 561.651 252 507c0-143.597 116.405-260 260-260 0.531 0 1.062 0.002 1.593 0.005a17.327 17.327 0 0 1 1.093 0.009C657.048 248.454 772 364.297 772 507c0 142.699-114.954 258.546-257.314 259.986a17.298 17.298 0 0 1-1.093 0.01c-0.53 0.002-1.062 0.004-1.593 0.004-35.196 0-69.447-7.01-101.207-20.439-8.648-3.656-12.694-13.63-9.038-22.278 3.656-8.648 13.63-12.694 22.278-9.038 23.063 9.752 47.636 15.606 72.967 17.265V698c0-9.389 7.611-17 17-17s17 7.611 17 17v34.213z m16.86-189.408a16.988 16.988 0 0 1-4.05 3.412l-121 73.322c-15.204 9.213-32.562-8.145-23.349-23.35l73.322-121a16.99 16.99 0 0 1 3.353-3.997 17.034 17.034 0 0 1 4.054-3.41l121-73.321c15.204-9.213 32.562 8.146 23.349 23.35l-50.267 82.946c-4.866 8.03-15.32 10.594-23.35 5.728-8.029-4.866-10.593-15.32-5.727-23.349l14.354-23.687-43.202 26.179 32.35 32.351c6.639 6.64 6.639 17.403 0 24.042-0.273 0.272-0.552 0.534-0.838 0.784z m-38.118-15.699l-17.848-17.848-27.448 45.296 45.296-27.448z" /></svg>
|
||||
|
After Width: | Height: | Size: 1.6 KiB |
@@ -137,18 +137,20 @@ export function initConfigList(ctx: PopupCtx) {
|
||||
<div class="config-domain">${displayName} ${enabledTag} ${authTag}</div>
|
||||
`;
|
||||
|
||||
// favicon
|
||||
// favicon:优先存储值,再兜底 /favicon.ico,加载失败用默认占位图
|
||||
const faviconSrc = cfg.favicon || faviconFallbackUrl(cfg.domain);
|
||||
const favicon = document.createElement("img");
|
||||
favicon.className = "config-favicon";
|
||||
favicon.alt = "";
|
||||
if (faviconSrc) {
|
||||
const favicon = document.createElement("img");
|
||||
favicon.className = "config-favicon";
|
||||
favicon.src = faviconSrc;
|
||||
favicon.alt = "";
|
||||
favicon.addEventListener("error", () => {
|
||||
favicon.style.display = "none";
|
||||
});
|
||||
item.appendChild(favicon);
|
||||
} else {
|
||||
favicon.src = chrome.runtime.getURL("icons/faviconDefault.svg");
|
||||
}
|
||||
favicon.addEventListener("error", () => {
|
||||
favicon.src = chrome.runtime.getURL("icons/faviconDefault.svg");
|
||||
});
|
||||
item.appendChild(favicon);
|
||||
|
||||
if (needsAuth) {
|
||||
const tag = info.querySelector(".tag-unauthorized");
|
||||
|
||||
Reference in New Issue
Block a user