From fb5be056d1059335f97ee8a7073086f01ff7ceda Mon Sep 17 00:00:00 2001 From: Lordmau5 Date: Mon, 22 Jan 2024 21:30:34 +0100 Subject: [PATCH 1/2] First Message Highlight 1.1.3 * Changed: Remove `Remember Historical Messages` as it was mostly superseded by `Forget User After` setting (and the implementation was not working correctly anymore with the new code changes) --- src/first-message-highlighter/index.js | 16 +++------------- src/first-message-highlighter/manifest.json | 4 ++-- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/src/first-message-highlighter/index.js b/src/first-message-highlighter/index.js index f69fad16..01e8caa9 100644 --- a/src/first-message-highlighter/index.js +++ b/src/first-message-highlighter/index.js @@ -81,16 +81,6 @@ class FirstMessageHighlight extends Addon { } }); - this.settings.add('first_message_highlight.remember_historical', { - default: true, - ui: { - path: 'Add-Ons > First Message Highlight >> Current Session >> Historical Messages', - title: 'Remember historical messages', - description: 'Remember logged user messages from before you joined the chat.', - component: 'setting-check-box' - } - }); - // First Time Chatter this.settings.add('first_message_highlight.first_time_chatter', { default: false, @@ -277,11 +267,11 @@ class FirstMessageHighlight extends Addon { const shouldHighlight = this.shouldHighlight(msg); if (msg.isHistorical) { - if (this.settings.get('first_message_highlight.remember_historical') - && !shouldHighlight) return; + if (!this.settings.get('first_message_highlight.highlight_historical')) { + this.known_users.delete(msg.user.userID); - if (!this.settings.get('first_message_highlight.highlight_historical')) return; + } } if (!shouldHighlight) return; diff --git a/src/first-message-highlighter/manifest.json b/src/first-message-highlighter/manifest.json index ddf34d87..24821082 100644 --- a/src/first-message-highlighter/manifest.json +++ b/src/first-message-highlighter/manifest.json @@ -1,7 +1,7 @@ { "enabled": true, "requires": [], - "version": "1.1.2", + "version": "1.1.3", "icon": "https://i.imgur.com/Db2zP1l.png", "short_name": "first_msg_highlight", "name": "First Message Highlight", @@ -9,5 +9,5 @@ "description": "Addon to highlight the first message of a user during the current session. Useful for community-driven chats and welcoming.", "settings": "add_ons.first_message_highlight", "created": "2021-12-01T14:32:46.254Z", - "updated": "2024-01-17T20:33:51.465Z" + "updated": "2024-01-22T20:30:35.390Z" } \ No newline at end of file From 180ca13661e17581ac031b89140eda006a4b2a0e Mon Sep 17 00:00:00 2001 From: Smokey <9442271+smokey019@users.noreply.github.com> Date: Mon, 22 Jan 2024 19:13:56 -0700 Subject: [PATCH 2/2] Smokey's Utilities 1.2.0 * Fixed: Mod keybinds should properly detect if you're using the chat input now. The keybinds will only fire if you are not typing in the chat input window. * Changed: Auto go to Live Following Directory uses a route detection for more reliability now. This will also only force going over to the Live tab once in case you want to go to Overview tab to look at videos etc... --- src/smokemotes/index.jsx | 32 ++++++++++++++++++++------------ src/smokemotes/manifest.json | 6 +++--- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/src/smokemotes/index.jsx b/src/smokemotes/index.jsx index 1440f6e8..1b0ba8ea 100644 --- a/src/smokemotes/index.jsx +++ b/src/smokemotes/index.jsx @@ -14,6 +14,7 @@ class SmokeysUtils extends Addon { this.inject('site'); this.injectAs('site_chat', 'site.chat'); this.inject('site.fine'); + this.inject('site.router'); this.user = this.site.getUser(); this.onKeyDown = this.onKeyDown.bind(this); @@ -22,6 +23,16 @@ class SmokeysUtils extends Addon { message_id: undefined, }; + this.firstLoad = 0; + + this.site.router.on(':route', (route, match) => { + if (match && match[0] == '/directory/following' && this.firstLoad === 0){ + this.liveFollowing(); + // do this just in case the user wants to go to Overview later for videos etc.. + this.firstLoad = 1; + } + }); + this.settings.add('smokemotes.pinned_mentions', { default: true, @@ -215,9 +226,9 @@ class SmokeysUtils extends Addon { onEnable() { this.log.debug("Smokey's Utilities module was enabled successfully."); - this.keep_hd_video(); - - this.liveFollowing(); + window.addEventListener('load', () => { + this.keep_hd_video(); + }); this.mod_keybind_handler(); @@ -270,7 +281,8 @@ class SmokeysUtils extends Addon { pinned_log = createElement('div', { id: 'smokey_pinned_log', - class: 'pinned-highlight-log tw-absolute tw-top-0 tw-full-width tw-z-above tw-c-background-base' + class: 'pinned-highlight-log tw-absolute tw-top-0 tw-full-width tw-z-above tw-c-background-base', + style: 'z-order:11 !important;' }); el.parentNode.prepend(pinned_log); @@ -389,7 +401,7 @@ class SmokeysUtils extends Addon { try { document.addEventListener( 'visibilitychange', - (e) => { + e => { e.stopImmediatePropagation(); }, true, @@ -402,10 +414,7 @@ class SmokeysUtils extends Addon { } liveFollowing() { - if ( - window.location.href == 'https://www.twitch.tv/directory/following' && - this.chat.context.get('smokemotes.auto_live_follow_page') - ) { + if (this.chat.context.get('smokemotes.auto_live_follow_page')) { try { document.querySelector('a[data-a-target="following-live-tab"]').click(); } catch (error) { @@ -434,8 +443,7 @@ class SmokeysUtils extends Addon { onKeyDown(e) { if ( - document.activeElement.matches('input') || - document.activeElement.matches('textarea') || + document.activeElement == document.querySelector('div[data-a-target="chat-input"]') || e.ctrlKey || e.metaKey || e.shiftKey || @@ -448,7 +456,7 @@ class SmokeysUtils extends Addon { const keyCode = e.keyCode || e.which; switch (keyCode) { - // timeout + // timeout case 84: this.resolve('site.chat').ChatService.first.sendMessage( diff --git a/src/smokemotes/manifest.json b/src/smokemotes/manifest.json index ee8e1e26..d9457526 100644 --- a/src/smokemotes/manifest.json +++ b/src/smokemotes/manifest.json @@ -1,8 +1,8 @@ { "enabled": true, "requires": [], - "icon": "https://i.imgur.com/WVFY4R5.png", - "version": "1.1.7", + "icon": "https://i.imgur.com/a98FccA.png", + "version": "1.2.0", "short_name": "smokeys_utils", "name": "Smokey's Utilities", "author": "Smokey", @@ -10,5 +10,5 @@ "website": "https://smokey.gg/", "settings": "add_ons.smokemotes", "created": "2019-12-08T01:03:54.000Z", - "updated": "2023-01-21T15:24:50.357Z" + "updated": "2023-04-28T21:44:47.582Z" } \ No newline at end of file