clumsyman / 69shu_chapter

// ==UserScript==
// @name         69shu_chapter
// @namespace    http://tampermonkey.net/
// @version      0.0.1
// @description  load multiple chapters
// @author       clumsyman
// @updateURL https://openuserjs.org/meta/clumsyman/69shu_chapter.meta.js
// @downloadURL https://openuserjs.org/install/clumsyman/69shu_chapter.user.js
// @copyright 2018, clumsyman (https://openuserjs.org//users/clumsyman)
// @license MIT
// @match        https://www.69shuba.com/txt/*/*
// @match        https://www.69shuba.me/rrrr/*/*
// @match        https://www.69shu.com/txt/*/*
// @match        https://www.69xinshu.com/txt/*/*
// @match        https://www.69shu.pro/txt/*/*
// @match        https://www.69shuba.pro/txt/*/*
// @match        https://www.69shu.top/txt/*/*
// @match        https://69shuba.cx/txt/*/*
// @match        https://69shu.me/txt/*/*
// @match        https://69shu.biz/*/*/*.html
// @grant        none
// ==/UserScript==

javascript:try {
    function init() {
        try {
            $(window).off('scroll');
            document.querySelector('header').classList.remove('active');
            document.body.appendChild(document.getElementById('pageheadermenu'));
            var txtnav = document.querySelector('.txtnav');
            var tools = document.querySelector('.tools');
            txtnav.parentElement.insertBefore(txtnav, tools);
            
            var leftmenu = document.querySelector('.leftmenu');
            var window_showmenu = window.showmenu;
            var window_hidemenu = window.hidemenu;
            window.showmenu = function() {
                window_showmenu();
                leftmenu.classList.add('show');
            }
            window.hidemenu = function() {
                window_hidemenu();
                leftmenu.classList.remove('show');
            }
            
            MobileToolbar.onDocumentTouch = function(e) {}
            MobileToolbar.show();
        } catch(e) {
            alert(e + '\n' + e.stack);
        }
    }
    function afterLoading() {
        document.head
            .appendChild(document.createElement('style'))
            .append(document.createTextNode(`
                #pageheadermenu {
                    display: none;
                    position: fixed;
                    top: 0;
                    width: 100%;
                }
                #pageheadermenu:has(~.container .tools.show), .container:has(.tools.show)~#pageheadermenu {
                    display: block;
                }
                header {
                    position: static;
                }
                header.active {
                    opacity: 1;
                    background: #007ead;
                }
                @media (max-width: 720px) {
                    .mybox {
                        margin: 0;
                        padding: 0 16px;
                    }
                    .tools {
                        display: none;
                        transform: none;
                        -webkit-transform: none;
                        transition: ease;
                        -webkit-transition: ease;
                    }
                    .tools.show {
                        display: block;
                    }
                    .page1 {
                        margin-bottom: 0 !important;
                    }
                }
                @media (max-width: 990px) {
                    .txtnav h1.hide720 {
                        position: static;
                        padding: 0;
                    }
                    .tools.show + .txtnav h1.hide720, .txtnav:has(+.tools.show) h1.hide720 {
                        position: sticky;
                        top: 50px;
                    }
                }
                @media (max-width: 1200px) {
                    .container {
                        margin: 50px 0 0 0;
                    }
                }
                .tools.show ~ .page1 {
                    position: sticky;
                    bottom: 60px;
                }
                .leftmenu, .yueduad1, .yuedutuijian, #pagefootermenu, #tuijian {
                    display: none;
                }
                .leftmenu.show {
                    display: block;
                }
                `));
        if (MobileToolbar.$toolbar) {
            init();
        } else {
            var UIController_init = UIController.init;
            UIController.init = function(...args) {
                UIController_init.apply(this, args);
                init();
            }
        }
    }
    if (document.readyState === 'loading') {
        document.addEventListener('DOMContentLoaded', afterLoading);
    } else {
        afterLoading();
    }
} catch(e) {
    alert(e + '\n' + e.stack);
}