From 8ec9791b803964fa0887860bf774886a64800b48 Mon Sep 17 00:00:00 2001 From: Ame Date: Tue, 25 Sep 2018 02:34:34 +0200 Subject: [PATCH] kinda infinite-scrolling --- package-lock.json | 2 +- src/index.html | 195 +++++++++++++++++++++++++++------------------- src/renderer.js | 18 ++++- 3 files changed, 134 insertions(+), 81 deletions(-) diff --git a/package-lock.json b/package-lock.json index 507e941..5068dd3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "gelbooru-client", - "version": "0.7.5", + "version": "0.8.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/src/index.html b/src/index.html index 9e0d8ed..51893d9 100644 --- a/src/index.html +++ b/src/index.html @@ -1,94 +1,110 @@ + + Gelbooru Client - +
- - - - - + + + + +
- +
-
+
@@ -102,12 +118,15 @@
+ + + \ No newline at end of file diff --git a/src/renderer.js b/src/renderer.js index e811549..b255bc9 100644 --- a/src/renderer.js +++ b/src/renderer.js @@ -1,3 +1,4 @@ +var currentURL=''; // Modules const shell = require('electron').shell, remote = require('electron').remote, @@ -469,6 +470,7 @@ function getResults(url) return; } }) + currentURL = url; } /** @@ -511,6 +513,7 @@ function emptyContainer() while (container.firstChild) { container.removeChild(container.firstChild); + pid = 1; } } @@ -553,4 +556,17 @@ function isTagInSearchBar(tag) { return false; } -} \ No newline at end of file +} + +$(document).ready(function(){ + $(window).scroll(function () { + if ($(window).scrollTop() >= $(document).height() - $(window).height() - 0.1) { + showLoading(); + hideLoading(); + let url = getUrl(tags, imgLimit, rating); + getResults(url + `&pid=${pid}`); + pid++; + displayPid.innerHTML = `Page ${pid}`; + } +}) +}) \ No newline at end of file