biome format --write
This commit is contained in:
parent
8372348148
commit
9262e803ec
415 changed files with 54076 additions and 17419 deletions
|
|
@ -1,18 +1,18 @@
|
|||
const checkCanvasExtractPermission = () => {
|
||||
const canvas = document.createElement('canvas');
|
||||
canvas.width = 1;
|
||||
canvas.height = 1;
|
||||
const canvas = document.createElement('canvas')
|
||||
canvas.width = 1
|
||||
canvas.height = 1
|
||||
|
||||
const ctx = canvas.getContext('2d');
|
||||
if (!ctx) return false;
|
||||
const ctx = canvas.getContext('2d')
|
||||
if (!ctx) return false
|
||||
|
||||
ctx.fillStyle = '#0f161e';
|
||||
ctx.fillRect(0, 0, 1, 1);
|
||||
ctx.fillStyle = '#0f161e'
|
||||
ctx.fillRect(0, 0, 1, 1)
|
||||
|
||||
const { data } = ctx.getImageData(0, 0, 1, 1);
|
||||
const { data } = ctx.getImageData(0, 0, 1, 1)
|
||||
|
||||
return data.join(',') === '15,22,30,255';
|
||||
};
|
||||
return data.join(',') === '15,22,30,255'
|
||||
}
|
||||
|
||||
const createFaviconService = () => {
|
||||
const favicons = []
|
||||
|
|
@ -21,10 +21,10 @@ const createFaviconService = () => {
|
|||
const badgeRadius = 32
|
||||
|
||||
const initFaviconService = () => {
|
||||
if (!checkCanvasExtractPermission()) return;
|
||||
if (!checkCanvasExtractPermission()) return
|
||||
|
||||
const nodes = document.querySelectorAll('link[rel="icon"]')
|
||||
nodes.forEach(favicon => {
|
||||
nodes.forEach((favicon) => {
|
||||
if (favicon) {
|
||||
const favcanvas = document.createElement('canvas')
|
||||
favcanvas.width = faviconWidth
|
||||
|
|
@ -47,7 +47,17 @@ const createFaviconService = () => {
|
|||
|
||||
favcontext.clearRect(0, 0, faviconWidth, faviconHeight)
|
||||
if (isImageLoaded(favimg)) {
|
||||
favcontext.drawImage(favimg, 0, 0, favimg.width, favimg.height, 0, 0, faviconWidth, faviconHeight)
|
||||
favcontext.drawImage(
|
||||
favimg,
|
||||
0,
|
||||
0,
|
||||
favimg.width,
|
||||
favimg.height,
|
||||
0,
|
||||
0,
|
||||
faviconWidth,
|
||||
faviconHeight,
|
||||
)
|
||||
}
|
||||
favicon.href = favcanvas.toDataURL('image/png')
|
||||
})
|
||||
|
|
@ -63,11 +73,28 @@ const createFaviconService = () => {
|
|||
const badgeColor = `${style.getPropertyValue('--badgeNotification') || 'rgb(240, 100, 100)'}`
|
||||
|
||||
if (isImageLoaded(favimg)) {
|
||||
favcontext.drawImage(favimg, 0, 0, favimg.width, favimg.height, 0, 0, faviconWidth, faviconHeight)
|
||||
favcontext.drawImage(
|
||||
favimg,
|
||||
0,
|
||||
0,
|
||||
favimg.width,
|
||||
favimg.height,
|
||||
0,
|
||||
0,
|
||||
faviconWidth,
|
||||
faviconHeight,
|
||||
)
|
||||
}
|
||||
favcontext.fillStyle = badgeColor
|
||||
favcontext.beginPath()
|
||||
favcontext.arc(faviconWidth - badgeRadius, badgeRadius, badgeRadius, 0, 2 * Math.PI, false)
|
||||
favcontext.arc(
|
||||
faviconWidth - badgeRadius,
|
||||
badgeRadius,
|
||||
badgeRadius,
|
||||
0,
|
||||
2 * Math.PI,
|
||||
false,
|
||||
)
|
||||
favcontext.fill()
|
||||
favicon.href = favcanvas.toDataURL('image/png')
|
||||
})
|
||||
|
|
@ -79,7 +106,7 @@ const createFaviconService = () => {
|
|||
initFaviconService,
|
||||
clearFaviconBadge,
|
||||
drawFaviconBadge,
|
||||
getOriginalFavicons
|
||||
getOriginalFavicons,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue