Skip to content

Commit

Permalink
3 way merge from mv3
Browse files Browse the repository at this point in the history
  • Loading branch information
KentoNishi committed May 29, 2023
1 parent 55ff56e commit 3049c12
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 13 deletions.
10 changes: 5 additions & 5 deletions src/components/Hyperchat.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
enableStickySuperchatBar,
lastOpenedVersion,
selfChannelName,
enableHighlightedMentions
enableHighlightedMentions,
ytDark
} from '../ts/storage';
import { version } from '../manifest.json';
Expand All @@ -56,7 +57,6 @@
let isAtBottom = true;
let truncateInterval: number;
const isReplay = paramsIsReplay;
let ytDark = false;
const smelteDark = dark();
type MessageBlocker = (a: Chat.MessageAction) => boolean;
Expand Down Expand Up @@ -226,7 +226,7 @@
$selfChannel = response.selfChannel;
break;
case 'themeUpdate':
ytDark = response.dark;
$ytDark = response.dark;
break;
case 'chatUserActionResponse':
$alertDialog = {
Expand Down Expand Up @@ -305,13 +305,13 @@
if (truncateInterval) window.clearInterval(truncateInterval);
});
$: updateTheme($theme, ytDark);
$: updateTheme($theme, $ytDark);
// Scroll to bottom when any of these settings change
$: ((..._a: any[]) => scrollToBottom())(
$showProfileIcons, $showUsernames, $showTimestamps, $showUserBadges
);
const containerClass = 'h-screen w-screen text-black dark:text-white bg-ytbg-light dark:bg-ytbg-dark flex flex-col justify-between';
const containerClass = 'h-screen w-screen text-black dark:text-white bg-white bg-ytbg-light dark:bg-ytbg-dark flex flex-col justify-between';
const isSuperchat = (action: Chat.MessageAction) => (action.message.superChat || action.message.superSticker);
const isMembership = (action: Chat.MessageAction) => (action.message.membership || action.message.membershipGiftPurchase);
Expand Down
2 changes: 1 addition & 1 deletion src/components/StickyBar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
{#if open}
<div
class="w-full overflow-y-hidden overflow-x-scroll scroll-on-hover items-start flex-none"
style="--scrollbar-bg-color: #{$isDark ? '202020' : 'ffffff'};"
style="--scrollbar-bg-color: #{$isDark ? '0f0f0f' : 'ffffff'};"
bind:this={scrollableElem}
>
<div
Expand Down
4 changes: 2 additions & 2 deletions src/manifest.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"manifest_version": 2,
"name": "HyperChat by LiveTL",
"name": "HyperChat [Improved YouTube Chat]",
"homepage_url": "https://livetl.app/en/hyperchat/",
"description": "Improved YouTube chat with CPU/RAM optimizations, customization options, and cutting-edge features!",
"version": "2.6.9",
"version": "2.6.10",
"permissions": [
"storage"
],
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/chat-injector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const chatLoaded = async (): Promise<void> => {
const params = new URLSearchParams();
params.set('tabid', frameInfo.tabId.toString());
params.set('frameid', frameInfo.frameId.toString());
if (frameIsReplay) params.set('isReplay', 'true');
if (frameIsReplay()) params.set('isReplay', 'true');
const source = chrome.runtime.getURL(
(isLiveTL ? 'hyperchat/index.html' : 'hyperchat.html') +
`?${params.toString()}`
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/chat-interceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const chatLoaded = async (): Promise<void> => {

// Register interceptor
const port: Chat.Port = chrome.runtime.connect();
port.postMessage({ type: 'registerInterceptor', source: 'ytc', isReplay });
port.postMessage({ type: 'registerInterceptor', source: 'ytc', isReplay: isReplay() });

// Send JSON response to clients
window.addEventListener('messageReceive', (d) => {
Expand Down
12 changes: 9 additions & 3 deletions src/ts/chat-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,15 @@ export const createPopup = (url: string): void => {
chrome.runtime.sendMessage({ type: 'createPopup', url });
};

export const frameIsReplay = window.location.href.startsWith(
`${(location.protocol + '//' + location.host)}/live_chat_replay`
);
export const frameIsReplay = (): boolean => {
try {
return window.location.href.startsWith(
`${(location.protocol + '//' + location.host)}/live_chat_replay`
);
} catch (e) {
return false;
}
};

/*
* Type predicates
Expand Down
1 change: 1 addition & 0 deletions src/ts/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export const isDark = derived(theme, ($theme) => {
$theme === Theme.YOUTUBE && window.location.search.includes('dark')
);
});
export const ytDark = writable(false);
export const currentProgress = writable(null as null | number);
export const enableStickySuperchatBar = stores.addSyncStore('hc.enableStickySuperchatBar', true);
export const enableHighlightedMentions = stores.addSyncStore('hc.enableHighlightedMentions', true);
Expand Down

0 comments on commit 3049c12

Please sign in to comment.