Skip to content

Commit

Permalink
Add group achievements option link
Browse files Browse the repository at this point in the history
  • Loading branch information
xPaw committed Sep 27, 2024
1 parent 82bb94c commit 3ca4a42
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
8 changes: 8 additions & 0 deletions options/options.css
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,14 @@ footer p {
margin-top: 0.4rem;
}

:focus,
.checkbox:focus {
outline: solid;
outline-color: #00aff4;
outline-offset: 4px;
outline-width: 2px;
}

.checkbox > input {
width: 1rem;
height: 1rem;
Expand Down
4 changes: 4 additions & 0 deletions options/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,10 @@ <h3 data-msg="options_header_achievements"></h3>
<input type="checkbox" class="option-check" data-option="achievements-global-unlock" checked>
<div data-msg="options_achievements_global_unlock"></div>
</label>
<label class="checkbox">
<input type="checkbox" class="option-check" checked disabled>
<div><a href="#" class="js-scroll-to-option" data-option="achievements-group-updates" data-msg="options_achievement_groups"></a> 🠉</div>
</label>
<div class="checkbox">
<input type="checkbox" class="option-check" checked disabled>
<div data-msg="options_modernized_achievements"></div>
Expand Down
17 changes: 17 additions & 0 deletions options/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
let element;
let starDismissed = false;
const checkboxes = document.querySelectorAll( '.option-check:not(:disabled)' );

/** @type {Object.<string, HTMLElement>} */
const options =
{
'clicked-star': null,
Expand Down Expand Up @@ -106,6 +108,21 @@
}
} );

document.querySelectorAll( '.js-scroll-to-option' ).forEach( ( el ) =>
{
el.addEventListener( 'click', ( e )=>
{
e.preventDefault();

const option = options[ el.dataset.option ];
option.scrollIntoView( {
behavior: 'smooth',
block: 'center',
} );
option.closest( 'label' ).focus( { preventScroll: true } );
} );
} );

// Must be synced with host_permissions in manifest.json
const permissions = {
origins: [
Expand Down

0 comments on commit 3ca4a42

Please sign in to comment.