Skip to content

Commit

Permalink
Add additional header controls for 4Chan XT
Browse files Browse the repository at this point in the history
In theory, this should be all it needs to work, though I am unable to confirm as sounds player appears to be having conflicts on my end with XT
  • Loading branch information
SystemPatch committed Sep 8, 2024
1 parent ad587bc commit 418fe85
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/components/display/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ module.exports = {
br.parentNode.insertBefore(document.createTextNode('['), br);
_.element('<a href="#" @click.prevent="display.toggle">Sounds</a>', br, 'beforebegin');
br.parentNode.insertBefore(document.createTextNode(']'), br);
} else if (isChanXT) {
// Add a button in the header for 4chan XT.
_.element(`<span id="shortcut-sounds" class="shortcut brackets-wrap" data-index="0">
<a href="#" @click.prevent="display.toggle" class="settings-link" title="Sounds"><span class="icon--alt-text">Sounds</span><svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 512 512"><path d="M0 256a256 256 0 1 1 512 0 256 256 0 1 1-512 0m188.3-108.9c-7.6 4.2-12.3 12.3-12.3 20.9v176c0 8.7 4.7 16.7 12.3 20.9s16.8 4.1 24.3-.5l144-88c7.1-4.4 11.5-12.1 11.5-20.5s-4.4-16.1-11.5-20.5l-144-88c-7.4-4.5-16.7-4.7-24.3-.5z" fill="currentColor"></path></svg></a>
</span>`, document.getElementById('shortcut-settings'), 'beforebegin');
} else if (isChanX) {
// Add a button in the header for 4chan X.
_.element(`<span id="shortcut-sounds" class="shortcut brackets-wrap" data-index="0">
Expand Down
1 change: 1 addition & 0 deletions src/globals.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ window.ns = 'fcsp';

window.is4chan = location.hostname.includes('4chan.org') || location.hostname.includes('4channel.org');
window.isChanX = document.documentElement && document.documentElement.classList.contains('fourchan-x');
window.isChanXT = document.documentElement && document.documentElement.classList.contains('fourchan-xt');
window.isOneeChan = document.documentElement && document.documentElement.classList.contains('oneechan');
window.Board = location.pathname.split('/')[1];
window.Thread = (location.href.match(/\/thread\/(\d+)/) || [])[1];
Expand Down

0 comments on commit 418fe85

Please sign in to comment.