Skip to content

Commit

Permalink
This resolves issue #344 (#367)
Browse files Browse the repository at this point in the history
* This resolves issue #344

* remove commented out code
  • Loading branch information
finanalyst committed Apr 28, 2024
1 parent 98f36e7 commit b710e01
Showing 1 changed file with 0 additions and 37 deletions.
37 changes: 0 additions & 37 deletions Website/plugins/page-styling/page-styling.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,43 +131,6 @@ document.addEventListener('DOMContentLoaded', function () {
$('#pageSettings').change(function () {
set_settings( pageOptionsState.settings.shortcuts === 'enabled' ? 'disabled' : 'enabled' );
});
// keyboard events to change pageOptions
document.addEventListener('keydown', e => {
if ( e.target == document.body
&& pageOptionsState
&& pageOptionsState.settings.shortcuts !== 'disabled') {
Object.keys( pageOptionsState ).forEach( attr => {
if ( ( e.altKey === pageOptionsState[ attr ].alt )
&&
( e.ctrlKey === pageOptionsState[ attr ].ctrl )
&&
(e.key === pageOptionsState[ attr ].letter
||
e.keyCode === pageOptionsState[ attr ].letter.toUpperCase().charCodeAt(0) )
)
{
e.preventDefault();
switch( attr ) {
case 'toc':
set_ToC_panel( pageOptionsState.toc.panel === 'closed' ? 'open' : 'closed' )
break;
case 'search':
// the action should be carried out by the search plugin
document.dispatchEvent( searchFocus );
break;
case 'theme':
let theme = persisted_theme() === 'light' ? 'dark' : 'light';
change_theme(theme);
persist_theme(theme);
break;
case 'settings':
set_settings( pageOptionsState.settings.shortcuts === 'enabled' ? 'disabled' : 'enabled' );
break;
}
}
})
}
});
// copy code block to clipboard adapted from solution at
// https://stackoverflow.com/questions/34191780/javascript-copy-string-to-clipboard-as-text-html
// if behaviour problems with different browsers add stylesheet code from that solution.
Expand Down

0 comments on commit b710e01

Please sign in to comment.