diff --git a/CHANGELOG-nightly.md b/CHANGELOG-nightly.md index a2cf3a6ab..8ea3c5476 100644 --- a/CHANGELOG-nightly.md +++ b/CHANGELOG-nightly.md @@ -1,7 +1,11 @@ ### 3.1.2.1000 -- Implement support for the new Kick site - +- **Implement support for the new Kick site:** + - Chat emotes + - Emote menu + - Emote auto-completion + - Cosmetics + - 7TV settings - Added option to settings to hide Stories from the sidebar - Fixed settings to hide recommended channels and viewers also watch channels - Fixed an issue where history navigation is accidentally triggered during IME composition @@ -9,6 +13,7 @@ - Added option to highlight messages based on badges - Added button to user card to toggle highlighting for a users messages - Added mod icon for warning users to chat mod icons and user card +- Added an option to limit the drop shadows on paints ### 3.1.1.3000 diff --git a/src/app/chat/UserTag.vue b/src/app/chat/UserTag.vue index 1aafdbbe6..d4c30eaeb 100644 --- a/src/app/chat/UserTag.vue +++ b/src/app/chat/UserTag.vue @@ -22,7 +22,15 @@ type="twitch" @click="handleClick($event)" /> - + @@ -31,7 +39,7 @@ class="seventv-chat-user-username" @click="handleClick($event)" > - + @ {{ user.displayName }} ({{ user.username }}) @@ -146,8 +154,8 @@ const stop = watch( return; } - paint.value = shouldRenderPaint.value && paints && paints.size ? paints.values().next().value : null; - activeBadges.value = shouldRender7tvBadges.value && badges && badges.size ? [...badges.values()] : []; + paint.value = paints && paints.size ? paints.values().next().value : null; + activeBadges.value = badges && badges.size ? [...badges.values()] : []; }, { immediate: true }, ); diff --git a/src/assets/style/global.scss b/src/assets/style/global.scss index 0dd9b6d51..114e3439f 100644 --- a/src/assets/style/global.scss +++ b/src/assets/style/global.scss @@ -89,3 +89,13 @@ body[theme="light"] { -webkit-background-clip: text !important; font-weight: 700; } + +:root.seventv-alternating-chat-lines { + .seventv-chat-observer > div:nth-child(even) { + background-color: var(--seventv-chat-alternate-background-color); + } + + .seventv-chat-list .seventv-message:nth-child(even) { + background-color: var(--seventv-chat-alternate-background-color); + } +} diff --git a/src/composable/useCosmetics.ts b/src/composable/useCosmetics.ts index 6bfc7fa0b..af0d249a4 100644 --- a/src/composable/useCosmetics.ts +++ b/src/composable/useCosmetics.ts @@ -1,4 +1,4 @@ -import { Ref, reactive, ref, toRef } from "vue"; +import { Ref, reactive, ref, toRef, watch } from "vue"; import { until, useTimeout } from "@vueuse/core"; import { DecimalToStringRGBA } from "@/common/Color"; import { log } from "@/common/Logger"; @@ -24,7 +24,13 @@ const data = reactive({ staticallyAssigned: {} as Record | undefined>, }); -const dropShadowRender = useConfig("vanity.paints_drop_shadows"); +const dropShadowRender = useConfig<0 | 1 | 2>("vanity.paints_drop_shadows"); + +watch(dropShadowRender, () => + Object.values(data.cosmetics) + .filter((c) => c.kind === "PAINT") + .forEach((c) => updatePaintStyle(c as SevenTV.Cosmetic<"PAINT">)), +); class CosmeticMap extends Map> { private providers = new Set(); @@ -63,16 +69,18 @@ db.ready().then(async () => { useLiveQuery( () => db.cosmetics.toArray(), (result) => { - data.cosmetics = {}; + const temp = {} as typeof data.cosmetics; for (const cos of result) { - if (data.cosmetics[cos.id]) continue; - data.cosmetics[cos.id] = reactive(cos); + if (temp[cos.id]) continue; + temp[cos.id] = reactive(cos); if (cos.kind === "PAINT") { updatePaintStyle(cos as SevenTV.Cosmetic<"PAINT">); } } + + data.cosmetics = temp; }, ); @@ -386,11 +394,14 @@ export function updatePaintStyle(paint: SevenTV.Cosmetic<"PAINT">, remove = fals const gradients = paint.data.gradients.map((g) => createGradientFromPaint(g)); const filter = (() => { - if (!paint.data.shadows || dropShadowRender.value === false) { + if (!paint.data.shadows || dropShadowRender.value == 0) { return ""; } - return paint.data.shadows.map((v) => createFilterDropshadow(v)).join(" "); + return paint.data.shadows + .slice(0, dropShadowRender.value == 2 ? 1 : undefined) + .map((v) => createFilterDropshadow(v)) + .join(" "); })(); const selector = `.seventv-paint[data-seventv-paint-id="${paint.id}"]`; diff --git a/src/directive/TextPaintDirective.ts b/src/directive/TextPaintDirective.ts index c08d9524f..0c8da8ba3 100644 --- a/src/directive/TextPaintDirective.ts +++ b/src/directive/TextPaintDirective.ts @@ -16,11 +16,26 @@ export const TextPaintDirective = { }, } as Directive; -export function updateElementStyles(el: HTMLElement, paintID: string | null): void { - if (!paintID || (el.hasAttribute(ATTR_SEVENTV_PAINT_ID) && el.getAttribute(ATTR_SEVENTV_PAINT_ID) !== paintID)) { - el.style.backgroundImage = ""; - el.style.filter = ""; - el.style.color = ""; +type PaintedElement = HTMLElement & { + __seventv_backup_style?: { backgroundImage: string; filter: string; color: string }; +}; +export function updateElementStyles(el: PaintedElement, paintID: string | null): void { + const hasPaint = el.hasAttribute(ATTR_SEVENTV_PAINT_ID); + const newPaint = hasPaint && paintID !== el.getAttribute(ATTR_SEVENTV_PAINT_ID); + + if (!hasPaint) { + el.__seventv_backup_style = { + backgroundImage: el.style.backgroundImage, + filter: el.style.filter, + color: el.style.color, + }; + } + + if (hasPaint && newPaint) { + const backup = el.__seventv_backup_style; + el.style.backgroundImage = backup?.backgroundImage ?? ""; + el.style.filter = backup?.filter ?? ""; + el.style.color = backup?.color ?? ""; el.classList.remove("seventv-painted-content"); el.removeAttribute(ATTR_SEVENTV_TEXT); diff --git a/src/site/global/Changelog.vue b/src/site/global/Changelog.vue index e1dd498cf..6b03c9cdb 100644 --- a/src/site/global/Changelog.vue +++ b/src/site/global/Changelog.vue @@ -128,7 +128,7 @@ function updateMediaHref(value: string): string { display: grid; row-gap: 0.5rem; list-style: square; - margin: 0.25rem 0.5rem; + margin: 0.5rem 1rem; } :deep(li) { diff --git a/src/site/global/Global.vue b/src/site/global/Global.vue index 5ab1aea92..d0c2a39d5 100644 --- a/src/site/global/Global.vue +++ b/src/site/global/Global.vue @@ -1,6 +1,9 @@ - - diff --git a/src/site/kick.com/modules/chat/ChatObserver.vue b/src/site/kick.com/modules/chat/ChatObserver.vue index f6ed18997..f0a846863 100644 --- a/src/site/kick.com/modules/chat/ChatObserver.vue +++ b/src/site/kick.com/modules/chat/ChatObserver.vue @@ -267,14 +267,6 @@ onUnmounted(() => { diff --git a/src/site/twitch.tv/modules/chat/ChatModule.vue b/src/site/twitch.tv/modules/chat/ChatModule.vue index d55f606e6..c856416c9 100644 --- a/src/site/twitch.tv/modules/chat/ChatModule.vue +++ b/src/site/twitch.tv/modules/chat/ChatModule.vue @@ -137,43 +137,6 @@ const timestampKeyValues: Record = { const timestampFormatOptions = Object.entries(timestampKeyValues).map(([k, v]) => [v, k]); export const config = [ - declareConfig("general.blur_unlisted_emotes", "TOGGLE", { - path: ["General", ""], - label: "Hide Unlisted Emotes", - hint: "If checked, emotes which have not yet been approved for listing on 7tv.app will be blurred", - defaultValue: false, - }), - declareConfig("chat.emote_margin", "SLIDER", { - path: ["Chat", "Style"], - label: "Emote Spacing", - hint: "Choose the margin around emotes in chat. Negative values lets them overlap and keep the chatlines inline. 0 Makes the emotes not overlap at all", - options: { - min: -1, - max: 1, - step: 0.1, - unit: "rem", - }, - defaultValue: -0.5, - effect(v) { - document.documentElement.style.setProperty("--seventv-emote-margin", `${v}rem`); - }, - }), - declareConfig("chat.emote_scale", "SLIDER", { - path: ["Chat", "Style"], - label: "Emote Scale", - ffz_key: "chat.emotes.2x", - ffz_transform(v: unknown) { - return typeof v === "number" && v > 0 ? 2 : 1; - }, - hint: "Change how large emotes should be in chat, as a multiple of their original size.", - options: { - min: 0.25, - max: 3, - step: 0.25, - unit: "x", - }, - defaultValue: 1, - }), declareConfig("chat.show_emote_modifiers", "TOGGLE", { path: ["Chat", "Style"], label: "Show Emote Modifiers", @@ -263,23 +226,6 @@ export const config = [ hint: "Make the tooltips compact instead of showing the full emote", defaultValue: false, }), - declareConfig("chat.alternating_background", "TOGGLE", { - path: ["Chat", "Style"], - ffz_key: "chat.lines.alternate", - label: "settings.chat_alternating_background.label", - hint: "settings.chat_alternating_background.hint", - defaultValue: false, - }), - declareConfig("chat.alternating_background_color", "COLOR", { - path: ["Chat", "Style"], - label: "Alternating Background Color", - hint: "Configure the color of alternating background (~6% opacity)", - disabledIf: () => !useConfig("chat.alternating_background").value, - effect(v) { - document.body.style.setProperty("--seventv-chat-alternate-background-color", `${v}0f`); - }, - defaultValue: "#808080", - }), declareConfig("chat.padding", "DROPDOWN", { path: ["Chat", "Style"], label: "Padding Style", @@ -494,30 +440,11 @@ export const config = [ }, defaultValue: 10, }), - declareConfig("vanity.nametag_paints", "TOGGLE", { - path: ["Appearance", "Vanity"], - label: "Nametag Paints", - hint: "Whether or not to display nametag paints", - defaultValue: true, - }), - declareConfig("vanity.7tv_Badges", "TOGGLE", { - path: ["Appearance", "Vanity"], - label: "7TV Badges", - hint: "Whether or not to display 7TV Badges", - defaultValue: true, - }), declareConfig("chat.hide_bits_balance", "TOGGLE", { label: "Hide Bits From Community Points Button", hint: "Hide the bits balance from the community points button under the chatbox", path: ["Chat", "Style"], defaultValue: false, }), - declareConfig("vanity.paints_drop_shadows", "TOGGLE", { - path: ["Appearance", "Vanity"], - label: "Drop shadows on paints", - hint: "Wheather or not to display drop shadows on paints (Requires a refresh)", - disabledIf: () => !useConfig("vanity.nametag_paints").value, - defaultValue: true, - }), ]; diff --git a/src/site/twitch.tv/modules/emote-menu/EmoteMenuModule.vue b/src/site/twitch.tv/modules/emote-menu/EmoteMenuModule.vue index 43224484e..5ec504ade 100644 --- a/src/site/twitch.tv/modules/emote-menu/EmoteMenuModule.vue +++ b/src/site/twitch.tv/modules/emote-menu/EmoteMenuModule.vue @@ -71,7 +71,7 @@ const doButtonUpdate = debounceFn((nodes: Element[]) => { watch( placement, - (v) => { + () => { for (const n of Object.values(chatInputController.instances).map((i) => i.domNodes)) { doButtonUpdate(Object.values(n)); } @@ -84,20 +84,6 @@ markAsReady(); diff --git a/src/site/twitch.tv/modules/settings/SettingsModule.vue b/src/site/twitch.tv/modules/settings/SettingsModule.vue index 5278c5ce0..54dd5cbcf 100644 --- a/src/site/twitch.tv/modules/settings/SettingsModule.vue +++ b/src/site/twitch.tv/modules/settings/SettingsModule.vue @@ -1,17 +1,11 @@ - -