From 1eb1b5c04cb5b268eaea57b9b8f196b9ee0b2a6c Mon Sep 17 00:00:00 2001 From: symant233 Date: Sat, 4 May 2019 11:04:43 +0800 Subject: [PATCH] Add viewer arrow support & Readme license badage --- .gitignore | 1 + README.md | 7 +++---- nhentai/viewer/scripts.js | 20 ++++++++++++++++++-- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 5dec9ff..0905537 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ dist/ *.egg-info .python-version .DS_Store +output/ diff --git a/README.md b/README.md index 6342a16..f5747a2 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ nhentai |_| |_|_| |_|\___|_| |_|\__\__,_|_| あなたも変態。 いいね? -[![Build Status](https://travis-ci.org/RicterZ/nhentai.svg?branch=master)](https://travis-ci.org/RicterZ/nhentai) ![nhentai PyPI Downloads](https://img.shields.io/pypi/dm/nhentai.svg) +[![Build Status](https://travis-ci.org/RicterZ/nhentai.svg?branch=master)](https://travis-ci.org/RicterZ/nhentai) ![nhentai PyPI Downloads](https://img.shields.io/pypi/dm/nhentai.svg) ![![license](https://opensource.org/licenses/MIT)](https://img.shields.io/cocoapods/l/AFNetworking.svg) nHentai is a CLI tool for downloading doujinshi from [nhentai.net](http://nhentai.net). @@ -26,6 +26,8 @@ nHentai is a CLI tool for downloading doujinshi from [nhentai.net](http://nhenta ### Usage **IMPORTANT**: To bypass the nhentai frequency limit, you should use `--login` option to log into nhentai.net. +*The default download folder will be the path where you run the command (CLI path).* + Download specified doujinshi: ```bash nhentai --id=123855,123866 @@ -78,8 +80,5 @@ NHENTAI=http://h.loli.club nhentai --id 123456 ![](./images/download.png) ![](./images/viewer.png) -### License -MIT - ### あなたも変態 ![](./images/image.jpg) diff --git a/nhentai/viewer/scripts.js b/nhentai/viewer/scripts.js index 09f976e..9dc516c 100644 --- a/nhentai/viewer/scripts.js +++ b/nhentai/viewer/scripts.js @@ -46,17 +46,33 @@ document.getElementById('image-container').onclick = event => { document.onkeypress = event => { switch (event.key.toLowerCase()) { // Previous Image - case 'arrowleft': case 'a': changePage(currentPage - 1); break; // Next Image case ' ': + case 'esc': // future close page function case 'enter': - case 'arrowright': case 'd': changePage(currentPage + 1); break; + }// remove arrow cause it won't work +}; + +document.onkeydown = event =>{ + switch (event.keyCode) { + case 37: //left + changePage(currentPage - 1); + break; + case 38: //up + changePage(currentPage - 1); + break; + case 39: //right + changePage(currentPage + 1); + break; + case 40: //down + changePage(currentPage + 1); + break; } }; \ No newline at end of file