Skip to content

Commit

Permalink
Smokey's Utilities 1.2.0
Browse files Browse the repository at this point in the history
* 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...
  • Loading branch information
smokey019 authored Jan 23, 2024
1 parent fb5be05 commit 180ca13
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 15 deletions.
32 changes: 20 additions & 12 deletions src/smokemotes/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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,

Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -389,7 +401,7 @@ class SmokeysUtils extends Addon {
try {
document.addEventListener(
'visibilitychange',
(e) => {
e => {
e.stopImmediatePropagation();
},
true,
Expand All @@ -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) {
Expand Down Expand Up @@ -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 ||
Expand All @@ -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(
Expand Down
6 changes: 3 additions & 3 deletions src/smokemotes/manifest.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"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",
"description": "Stuff to make a better Twitch.",
"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"
}

0 comments on commit 180ca13

Please sign in to comment.