From 6156cf59145e30aef4399e216fa04e57215080a5 Mon Sep 17 00:00:00 2001
From: Alocks <alocksmasao@gmail.com>
Date: Sat, 7 Dec 2019 14:36:19 -0300
Subject: [PATCH] added zoom in index.html and some increments in main.html

---
 nhentai/viewer/main.html  |  2 +-
 nhentai/viewer/main.js    | 27 +++++++++++++++++++++++----
 nhentai/viewer/scripts.js | 12 ++++++------
 nhentai/viewer/styles.css |  3 ++-
 4 files changed, 32 insertions(+), 12 deletions(-)

diff --git a/nhentai/viewer/main.html b/nhentai/viewer/main.html
index 020382c..af911cb 100644
--- a/nhentai/viewer/main.html
+++ b/nhentai/viewer/main.html
@@ -32,7 +32,7 @@
 			<button class="nav-btn hidden">Filters</button>
 			<div class="search">
 				<input autocomplete="off" type="search" id="tagfilter" name="q" value="" autocapitalize="none" required="">
-				<svg class="btn" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M505 442.7L405.3 343c-4.5-4.5-10.6-7-17-7H372c27.6-35.3 44-79.7 44-128C416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c48.3 0 92.7-16.4 128-44v16.3c0 6.4 2.5 12.5 7 17l99.7 99.7c9.4 9.4 24.6 9.4 33.9 0l28.3-28.3c9.4-9.4 9.4-24.6.1-34zM208 336c-70.7 0-128-57.2-128-128 0-70.7 57.2-128 128-128 70.7 0 128 57.2 128 128 0 70.7-57.2 128-128 128z"/></svg>
+				<svg class="btn" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="white" d="M505 442.7L405.3 343c-4.5-4.5-10.6-7-17-7H372c27.6-35.3 44-79.7 44-128C416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c48.3 0 92.7-16.4 128-44v16.3c0 6.4 2.5 12.5 7 17l99.7 99.7c9.4 9.4 24.6 9.4 33.9 0l28.3-28.3c9.4-9.4 9.4-24.6.1-34zM208 336c-70.7 0-128-57.2-128-128 0-70.7 57.2-128 128-128 70.7 0 128 57.2 128 128 0 70.7-57.2 128-128 128z"/></svg>
 			<div id="tags">
 			</div>
 		</nav>
diff --git a/nhentai/viewer/main.js b/nhentai/viewer/main.js
index 2ab1fb6..5a314fc 100644
--- a/nhentai/viewer/main.js
+++ b/nhentai/viewer/main.js
@@ -1,4 +1,4 @@
-//------------------------------------navbar script------------------------------------
+    //------------------------------------navbar script------------------------------------
 var menu = document.getElementsByClassName("accordion");
 for (var i = 0; i < menu.length; i++) {
   menu[i].addEventListener("click", function() {
@@ -62,8 +62,29 @@ input.addEventListener("input", function() {
         }
     }
 });
+input.addEventListener('keypress', function (e) {
+	enter_search(e, this.value);
+});
 //-----------------------------------------------------------------------------------
 //------------------------------------Functions--------------------------------------
+function enter_search(e, input){
+	var count = 0;
+	var key = e.which || e.keyCode;
+	if (key === 13 && input.length > 0) {
+	  var all_tags = document.getElementById("tags").children;
+	  for(i = 0; i < all_tags.length; i++){
+		if (!all_tags[i].classList.contains("hidden")){
+			count++;
+			var tag_name = all_tags[i].innerText;
+			var tag_id   = all_tags[i].id;
+			if (count>1){break}
+		}
+	  }
+	  if (count == 1){
+		filter_maker(tag_name, tag_id);
+	  }
+	}
+}
 function filter_maker(text, class_value){
     var check = filter_checker(text);
 	var nav_btn = document.getElementsByClassName("nav-btn")[0];
@@ -74,7 +95,7 @@ function filter_maker(text, class_value){
 		var node = document.createElement("a");
 		var textnode = document.createTextNode(text);
 		node.appendChild(textnode);
-		node.classList.add(class_value);	
+		node.classList.add(class_value);
 		nav_btn.appendChild(node);
 		filter_searcher();
 	}
@@ -130,8 +151,6 @@ function filter_searcher(){
 		gallery[i].classList.add("hidden");
 		}
 	}
-
-	console.log(doujinshi_id)
 }
 
 function filter_checker(text){
diff --git a/nhentai/viewer/scripts.js b/nhentai/viewer/scripts.js
index 8e3f8bf..6fea1c2 100644
--- a/nhentai/viewer/scripts.js
+++ b/nhentai/viewer/scripts.js
@@ -47,6 +47,9 @@ document.onkeypress = event => {
     switch (event.key.toLowerCase()) {
         // Previous Image
         case 'w':
+			document.getElementById("dest").style.height = "200%";
+			document.getElementById("list").style.height = "200%";
+            break;
         case 'a':
             changePage(currentPage - 1);
             break;
@@ -57,6 +60,9 @@ document.onkeypress = event => {
         // Next Image
         case ' ':
         case 's':
+			document.getElementById("dest").style.height = "100%";
+			document.getElementById("list").style.height = "100%";
+            break;
         case 'd':
             changePage(currentPage + 1);
             break;
@@ -68,14 +74,8 @@ document.onkeydown = event =>{
         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
diff --git a/nhentai/viewer/styles.css b/nhentai/viewer/styles.css
index f9830dc..abc219a 100644
--- a/nhentai/viewer/styles.css
+++ b/nhentai/viewer/styles.css
@@ -38,7 +38,7 @@ html, body {
 #image-container {
     flex: auto;
     height: 100vh;
-    background: #222;
+    background: #000;
     color: #fff;
     text-align: center;
     cursor: pointer;
@@ -48,6 +48,7 @@ html, body {
 }
 
 #image-container #dest {
+    background: #000;
     height: 100%;
     width: 100%;
     background-size: contain;