mashibing next episode control

key listener ESC

目前为 2024-08-26 提交的版本。查看 最新版本

// ==UserScript==
// @name         mashibing next episode control
// @namespace    http://tampermonkey.net/
// @version      2024年8月26日12点22分
// @description  key listener ESC
// @license MIT
// @author       onionycs
// @match        https://www.mashibing.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=mashibing.com
// @require      http://code.jquery.com/jquery-3.x-git.min.js
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    /* globals jQuery, $, waitForKeyElements */
    // Your code here...
    setTimeout(function() {
            $(document).ready(function() {
                $('.text-ellipsis').css('overflow', 'visible');
            });
    }, 5000);

    document.addEventListener('keydown', function(event) {

        if (event.key === 'Escape') {
            document.getElementsByClassName('next-btn')[1].click();
        }

        if (event.key === ']') {
            document.getElementsByClassName('next-btn')[0].click();
        }

        if (event.key === '[') {
            if($('.el-icon-arrow-right').length==3){
                $('.el-icon-arrow-right')[0].click();
            }else{
                $('.el-icon-arrow-left')[1].click();
            }
            setTimeout(function() {
                $(document).ready(function() {
                    $('.text-ellipsis').css('overflow', 'visible');
                });
            }, 500);
        }
    });


})();