Skip to content

Commit

Permalink
- Changed some event timings on Settings Page to help with CPU usage
Browse files Browse the repository at this point in the history
- Changed `Recover Video` timer to `10s` as per #31
- Modified channel point ranking logic to include scaling
- Updated Pinned Streamer styling
- Modified time zone logic
- Modified `ClipName`
- Modified ranking logic
- Fixed **New Feature** logic
- Added `Block Banners` setting
- Modified `Recover Frames` logic
  • Loading branch information
Ephellon committed Sep 17, 2024
1 parent e2e596c commit 29431de
Show file tree
Hide file tree
Showing 10 changed files with 410 additions and 108 deletions.
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,24 @@
- [ ] Inherit away-mode volume from parent page (failed video iframe)
- [ ] Properly handle `obit` & `redo` clashes
- [ ] First in Line will sometimes be stuck at 0s
- Jobs added may have the wrong href?!
- [ ] Add "Smart Sort" for First in Line
- Sort by context and/or normal runtimes
- [x] Add hover previews to all Twitch pages (#19)

----

# DONE — Notable Changes
> [`5.33.4.8`](https://github.com/Ephellon/Twitch-Tools/releases/tag/5.33.4.8)
- Changed some event timings on Settings Page to help with CPU usage
- Changed `Recover Video` timer to `10s` as per #31
- Modified channel point ranking logic to include scaling
- Updated Pinned Streamer styling
- Modified time zone logic
- Modified `ClipName`
- Modified ranking logic
- Fixed **New Feature** logic
- Added `Block Banners` setting
- Modified `Recover Frames` logic

> [`5.33.4.7`](https://github.com/Ephellon/Twitch-Tools/releases/tag/5.33.4.7)
- Modified `GetQuality` logic
Expand Down
Binary file modified ttv-tools.zip
Binary file not shown.
17 changes: 17 additions & 0 deletions ttv-tools/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,23 @@ Runtime.onMessage.addListener((request, sender, respond) => {
for(let key in request.data)
SHARED_DATA.set(key, request.data[key]);
} break;

default: {
if(request.action?.length)
Container.tabs.query({
url: ["*://*.twitch.tv/*"],
}, (tabs = []) => {
let action = request.action.toLowerCase().replace(/_+/g, '-');

console.warn(`Sending "${ action }" to all (non-origin) tabs...`, request);

for(let tab of tabs)
if(tab.id != sender.tab.id)
Container.tabs.sendMessage(tab.id, { ...request, action });

respond(request);
});
} break;
}

reloadTabs(reloadAll);
Expand Down
2 changes: 1 addition & 1 deletion ttv-tools/chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -2030,7 +2030,7 @@ let Chat__Initialize = async(START_OVER = false) => {
}

let aliasContainer = $(`[data-blerp="${ parseURL(url).pathname }"i]`),
audioContainer = f(`audio[controls]`, { style: 'margin:1rem 0; min-width:-webkit-fill-available; min-width:-moz-available;' }, f.source({ src: audio }));
audioContainer = f(`audio[controls]`, { style: 'margin:1rem 0; min-width:50%;' }, f.source({ src: audio }));

if(nullish(aliasContainer))
return;
Expand Down
18 changes: 18 additions & 0 deletions ttv-tools/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -2874,6 +2874,24 @@ __STATIC__: {
}
Handlers.__reasons__.set('RegisterJob', UUID.from(RegisterJob).value);

/**
* Delays a job to be run
* @simply DelayJob(JobName:string, JobReason:string?) → Number<IntervalID>
*
* @param {function} JobName The job (function) to register and run
* @param {string} [JobReason = "default"] The reason for the job's creation; used for debugging
* @return {number}
*/
function DelayJob(JobName, JobReason = 'default') {
DelayJob.__reason__ = JobReason;

if(JobReason?.unlike('default'))
console.log(`Delaying job: ${ JobReason }`);

return Jobs[JobName] ??= delay(Handlers[JobName], Timers[JobName]);
}
Handlers.__reasons__.set('DelayJob', UUID.from(DelayJob).value);

/**
* Unregisters (stops) a job
* @simply UnregisterJob(JobName:string, JobReason:string?) → undefined
Expand Down
2 changes: 2 additions & 0 deletions ttv-tools/ext/glyphs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ttv-tools/ext/polyfill.js
Original file line number Diff line number Diff line change
Expand Up @@ -4545,7 +4545,7 @@ class ClipName extends String {
},
};

let data = [[_.a, _.a, _.n, _.e].join(''), (new UUID).toStamp(), (new UUID).toStamp()];
let data = [[_.a, _.a, _.n, _.e].join(''), new nanoid(8, nanoid.LOWERCASE_SAFE), new nanoid(8, nanoid.LOWERCASE_SAFE)];

return super(data.slice(0, version.clamp(1, data.length)).join('-'));
}
Expand Down
15 changes: 15 additions & 0 deletions ttv-tools/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -1405,6 +1405,21 @@ <h2 tr-id>
</div>
</section>

<!-- Block Banners → ads,advertisement,banners,block,hide,remove -->
<section new='5.33.4.8'>
<div class=title tr-id=block-banners><span small glyph=hide></span> Block Banners</div>
<div class=summary>
<div class=toggle>
<input id=block_banners type=checkbox>
<label for=block_banners></label>
</div>

<p tr-id>
Remove (ad) banners for: <em>Bits</em>, <em>SUBtember</em>, <em>Turbo</em>, etc.
</p>
</div>
</section>

<!-- Easy Lurk Placement → button,knob -->
<section>
<div class=title tr-id='placement:away-mode'><span small glyph=latest></span> Easy Lurk</div>
Expand Down
7 changes: 3 additions & 4 deletions ttv-tools/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,8 @@ let // These are option names. Anything else will be removed
/* Customization */
// Away Mode Button Placement
'away_mode_placement',
// Block Banners
'block_banners',
// Hide Blank Ads
'hide_blank_ads',
// Watch Time Text Placement
Expand Down Expand Up @@ -2033,14 +2035,11 @@ Cache.load(['ignoreNew'], ({ ignoreNew }) => {
let { version } = Manifest;
let brandNewFragments = [];

if(compareVersions(`${ version }${ ignoreNew ?? 0 }`))
return;

$.all('[new]').map(element => {
let conception = element.getAttribute('new');
let title = $('.title', element)?.textContent?.trim();

if(compareVersions(`${ version } > ${ conception }`))
if(compareVersions(`${ ignoreNew } ${ conception }`))
element.removeAttribute('new');
else if(defined(title))
brandNewFragments.push(
Expand Down
Loading

0 comments on commit 29431de

Please sign in to comment.