Skip to content

Commit

Permalink
New: Preliminary support for gamepads
Browse files Browse the repository at this point in the history
  • Loading branch information
ollm committed Jul 21, 2023
1 parent 7233ede commit 759ee60
Show file tree
Hide file tree
Showing 9 changed files with 783 additions and 56 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
* Bookmarks and continue reading
* Floating magnifying glass
* Reading in scroll or slide
<!--- * 🎮 Gamepad navigation --->

## Installation and Starting for development
__Requirements__: Git, Node and NPM
Expand Down
21 changes: 19 additions & 2 deletions scripts/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,8 @@ function loadIndexPage(animation = true, path = false, content = false, keepScro

justifyViewModule();

gamepad.updateBrowsableItems();

$(window).off('resize').on('resize', function(){
justifyViewModule();
});
Expand Down Expand Up @@ -697,7 +699,7 @@ function getFolderThumbnailsAsync(path)
if(file.containsCompressed(error.compressedPath) && fs.existsSync(realPath) && fs.statSync(realPath).size < 52428800)
{
(function(folderSha){

addFolderImagesQueue(path, 4, function(images){

for(var i = 0; i < images.length; i++)
Expand Down Expand Up @@ -1596,10 +1598,12 @@ function openComic(animation = true, path = true, mainPath = true, end = false,

generateAppMenu();

gamepad.updateBrowsableItems();

}
else if(file.containsCompressed(path))
{
fileCompressed.decompressRecursive(path, function(){
fileCompressed.decompressRecursive(path, function() {

openComic(animation, path, mainPath, end);

Expand All @@ -1617,6 +1621,19 @@ function skipPreviousComicF()
return skipPreviousComic;
}

// Gamepad events
gamepad.setButtonEvent('reading', 1, function(key, button) {

if(key == 1)
{
let barBack = document.querySelector('.bar-back.active, .bar-back.show');

if(barBack)
eval(barBack.getAttribute('onclick'));
}

});

module.exports = {
loadIndexPage: loadIndexPage,
loadLanguagesPage: loadLanguagesPage,
Expand Down

0 comments on commit 759ee60

Please sign in to comment.