Skip to content

Commit ad930a9

Browse files
committed
Change favicon
1 parent 78fd3d9 commit ad930a9

File tree

4 files changed

+18
-13
lines changed

4 files changed

+18
-13
lines changed

src/components/Favicon.vue

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
2-
<img v-if="favIconValid" class="favicon no-favicon" height="22" :src="NO_FAVICON_URL" />
3-
<img v-else class="favicon" height="30" :src="favicon" />
2+
<img v-if="faviconValid" class="favicon no-favicon" height="22" :src="NO_FAVICON" />
3+
<img v-else class="favicon" height="30" :src="faviconUrl" />
44
</template>
55

66
<script lang="ts">
@@ -11,18 +11,23 @@ export default {
1111

1212
<script lang="ts" setup>
1313
import { computed } from 'vue';
14-
import { NO_FAVICON_URL } from '../utils/consts';
14+
import { NO_FAVICON } from '../utils/consts';
15+
import { TypeOfUrl } from '../utils/enums';
1516
1617
const props = defineProps<{
17-
favicon: string | undefined;
18+
url: string | undefined;
19+
type: TypeOfUrl;
1820
}>();
1921
20-
const favIconValid = computed(
22+
const faviconValid = computed(
2123
() =>
22-
props.favicon == undefined ||
23-
props.favicon == '' ||
24-
props.favicon.startsWith('chrome://favicon/'),
24+
props.url == undefined ||
25+
props.url == '' ||
26+
props.url.startsWith('chrome://favicon/') ||
27+
props.type == TypeOfUrl.Document,
2528
);
29+
30+
const faviconUrl = computed(() => `https://www.google.com/s2/favicons?domain=${props.url}&sz=64`);
2631
</script>
2732

2833
<style scoped>

src/components/TabItem.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<div class="tab-item">
3-
<Favicon :favicon="item.favicon" />
3+
<Favicon :url="item.url" :type="typeOfUrl" />
44
<div class="ml-10 flex-grow-2">
55
<div class="first-block">
66
<div class="w-80">

src/compositions/block-page.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Browser from 'webextension-polyfill';
22
import { buildBlockQuery } from '../utils/block-page';
3-
import { NO_FAVICON_URL } from '../utils/consts';
3+
import { NO_FAVICON } from '../utils/consts';
44

55
export async function useBlockPage(
66
domain: string,
@@ -11,7 +11,7 @@ export async function useBlockPage(
1111
): Promise<void> {
1212
const favicon =
1313
favIconUrl == undefined || favIconUrl == '' || favIconUrl.startsWith('chrome://favicon/')
14-
? NO_FAVICON_URL
14+
? NO_FAVICON
1515
: favIconUrl;
1616
const blockUrl =
1717
Browser.runtime.getURL('src/block.html') +

src/utils/consts.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
export const NO_FAVICON_URL =
2-
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABJUlEQVR42mKgOogpKJBMTM08kJCS+RXAJ1UbVBRDUWQIRmACWmwEpHxuN8GpkRIdAOuRfehwnQDXe7696C+eJkdvoox+ceEd/7DWFZyUcinO6JNBf3FOP/z+HGXirkX0hzXs8YJbG78ZvHp2dtaP/3E+Owqwcv1aJLDGSl8Ap6kY7JDmcjfK6UklaDvR4iBfy/Zq+19cyCETqF7AdAiilF6RGbYV0hFWOm9dbyYBiu0QIBcK85XLm090guoDGI3AUPiOM3HJrtbhKs8XBvh7k4mO+DkNMWC0CL6saS5D1Q0IERcRrBKdVy729Ti0apaojlEFHvI1k+Q03t6HESOeMUbjILUJCpo0bK8C7DxI9ezFMtibDuiLQY8oDJn/h5yUKctM1AYAkF4mBkXjJukAAAAASUVORK5CYII=';
1+
export const NO_FAVICON =
2+
'data:image/svg+xml,%3Csvg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill="%23000000"%3E%3Cg id="SVGRepo_bgCarrier" stroke-width="0"%3E%3C/g%3E%3Cg id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"%3E%3C/g%3E%3Cg id="SVGRepo_iconCarrier"%3E%3Crect x="0" fill="none" width="20" height="20"%3E%3C/rect%3E%3Cg%3E%3Cpath d="M9 0C4.03 0 0 4.03 0 9s4.03 9 9 9 9-4.03 9-9-4.03-9-9-9zm7.5 6.48c-.274.896-.908 1.64-1.75 2.05-.45-1.69-1.658-3.074-3.27-3.75.13-.444.41-.83.79-1.09-.43-.28-1-.42-1.34.07-.53.69 0 1.61.21 2v.14c-.555-.337-.99-.84-1.24-1.44-.966-.03-1.922.208-2.76.69-.087-.565-.032-1.142.16-1.68.733.07 1.453-.23 1.92-.8.46-.52-.13-1.18-.59-1.58h.36c1.36-.01 2.702.335 3.89 1 1.36 1.005 2.194 2.57 2.27 4.26.24 0 .7-.55.91-.92.172.34.32.69.44 1.05zM9 16.84c-2.05-2.08.25-3.75-1-5.24-.92-.85-2.29-.26-3.11-1.23-.282-1.473.267-2.982 1.43-3.93.52-.44 4-1 5.42.22.83.715 1.415 1.674 1.67 2.74.46.035.918-.066 1.32-.29.41 2.98-3.15 6.74-5.73 7.73zM5.15 2.09c.786-.3 1.676-.028 2.16.66-.42.38-.94.63-1.5.72.02-.294.085-.584.19-.86l-.85-.52z"%3E%3C/path%3E%3C/g%3E%3C/g%3E%3C/svg%3E';

0 commit comments

Comments
 (0)