Greasy Fork

Greasy Fork is available in English.

手机浏览器console控制台加载

能让手机浏览器的像电脑脑F12一样调试代码,查看console控制台信息,查看网页源码,js调试等。

当前为 2023-10-31 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         手机浏览器console控制台加载
// @namespace    http://tampermonkey.net/
// @version      0.8
// @description  能让手机浏览器的像电脑脑F12一样调试代码,查看console控制台信息,查看网页源码,js调试等。
// @description:en  load the web page console to debug or get some information etc.
// @author       夜雨
// @match        http://*/*
// @match        https://*/*
// @grant      GM_registerMenuCommand
// @license        MIT
// @run-at       document-end
// ==/UserScript==

(function () {
    'use strict';
    function loadScript(url, callback) {
        if(document.querySelector("#eruda")){
            callback();
            return
        }
        const script = document.createElement('script');
        script.setAttribute("id","eruda")
        script.type = 'text/javascript';

        script.onload = function() {
            callback();
        };

        script.src = url;
        document.head.appendChild(script);
    }

    let show = false;

    try {
        GM_registerMenuCommand("打开/关闭", function (event) {
            if(!show){
                loadScript('https://cdn.staticfile.org/eruda/3.0.1/eruda.min.js', () =>{
                    eruda.init({
                        useShadowDom:true,
                        autoScale:true,
                        defaults:{
                            displaySize: 40,
                            transparency: 0.9
                        }
                    });
                });
            }else {
                eruda && eruda.destroy();
            }
            show = !show;
        }, "openEruda");
    }catch (ex){
        loadScript('https://cdn.staticfile.org/eruda/3.0.1/eruda.min.js', () =>{
            eruda.init({
                useShadowDom:true,
                autoScale:true,
                defaults:{
                    displaySize: 40,
                    transparency: 0.9
                }
            });
        });
    }

})();