// ==UserScript==
// @name         WORM
// @namespace    https://github.com/Ixalion/tampermonkey-scripts
// @version      0.1
// @description  try to take over the world!
// @author       Christopher Britt (Sukkubix)
// @match        https://parahumans.wordpress.com/*/*/*/*/
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js
// @grant GM_addStyle
// ==/UserScript==

(function() {
    'use strict';
    let $ = window.jQuery;

    // Page load
    $(document).ready(function(){
        console.log("Load");


        $("body").on("click", function(){
            let percentThreshold = 0.25;
            let nextThreshold = (1-percentThreshold)*$(document).width();
            let prevThreshold = percentThreshold*$(document).width();
            if(event.pageX > nextThreshold) {
                let href = $("a[title='Next Chapter']").attr("href");
                if(href) {
                    window.location = href;
                }
            } else if(event.pageX < prevThreshold) {
                let href = $("a[title='Last Chapter']").attr("href");
                if(href) {
                    window.location = href;
                }
            }
        });
    });
})();
