Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion controllers/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ const autoScroll = async (page) => {
await new Promise((resolve, reject) => {
let totalHeight = 0;
const distance = 200;
const maxDistance = 10 * distance;
const timer = setInterval(() => {
const { scrollHeight } = document.body;
window.scrollBy(0, distance);
totalHeight += distance;

if (totalHeight >= scrollHeight) {
if (totalHeight >= scrollHeight || totalHeight >= maxDistance) {
clearInterval(timer);
resolve();
}
Expand Down
4 changes: 4 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@ const path = require("path");
const cors = require("cors");
const cookieModel = require("./models/cookie");
const cookieData = require("./data/cookies");
const bodyParser = require("body-parser");

const app = express();
require("dotenv").config();

// Bodyparser middleware
app.use(express.json());
app.use(cors());
app.use(bodyParser.urlencoded({
extended: true
}));

// DB config
const db = process.env.MONGODB_URL || "mongodb://localhost/webevaluator";
Expand Down