古古漫画插件

去白条,右键下一话

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         古古漫画插件
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  去白条,右键下一话
// @author       xiantong.zou
// @include      *://www.gugu5.com*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    console.log("GuGu_Comic run!");

    //隐藏“白带”
    var pic = document.getElementById('mypic_k0');
    if(pic != null){
        //console.log("GuGu_Comic hide mypic_k0!");
        pic.style.visibility="hidden";
    }


    var nextHref = null;
    document.body.addEventListener('DOMSubtreeModified', function () {
        //console.log("body changed!")
        var nextDlg = document.getElementById('msgTxt');
        if(nextDlg != null && nextHref == null){
            console.log("msgTxt open");
            for(var el of nextDlg.childNodes){
                //console.log("find ele",el);
                if(el.href != null){
                    nextHref = el.href;
                    var timerId = null;
                    timerId = setInterval(function(){
                        el.innerHTML = el.innerHTML + "(→:下一话)";
                        clearInterval(timerId);
                    },10);
                    break;
                }
            }
        }else if(nextDlg == null && nextHref != null){
            console.log("msgTxt close");
            nextHref = null;
        }
    }, false);

    //按键监听
    var oldOnKeyDown = document.onkeydown;
    document.onkeydown=function(event){
        var e = event || window.event || arguments.callee.caller.arguments[0];
        if(e && e.keyCode==39){ // //keyCode 39 = Right
            //支持右键下一话
            if(nextHref != null){
                window.location.href = nextHref;
            }
            //alert("enter!");
        }
        if(oldOnKeyDown != null){
            oldOnKeyDown(event);
        }
    };

    // Your code here...
})();