Console for mobile browsers

Overview

中文

Eruda

NPM version Build status Test coverage Downloads License Join the chat at https://gitter.im/liriliri/eruda Donate

Console for Mobile Browsers.

Eruda

Demo

Demo

Browse it on your phone: https://eruda.liriliri.io/

In order to try it for different sites, execute the script below on browser address bar.

javascript:(function () { var script = document.createElement('script'); script.src="//cdn.jsdelivr.net/npm/eruda"; document.body.appendChild(script); script.onload = function () { eruda.init() } })();

Features

  • Console: Display JavaScript logs.
  • Elements: Check dom state.
  • Network: Show requests status.
  • Resource: Show localStorage, cookie information.
  • Info: Show url, user agent info.
  • Snippets: Include snippets used most often.
  • Sources: Html, js, css source viewer.

Install

You can get it on npm.

npm install eruda --save

Add this script to your page.

<script src="node_modules/eruda/eruda.js"></script>
<script>eruda.init();</script>

It's also available on jsDelivr and cdnjs.

<script src="//cdn.jsdelivr.net/npm/eruda"></script>
<script>eruda.init();</script>

The JavaScript file size is quite huge(about 100kb gzipped) and therefore not suitable to include in mobile pages. It's recommended to make sure eruda is loaded only when eruda is set to true on url(http://example.com/?eruda=true), for example:

;(function () {
    var src = '//cdn.jsdelivr.net/npm/eruda';
    if (!/eruda=true/.test(window.location) && localStorage.getItem('active-eruda') != 'true') return;
    document.write('<scr' + 'ipt src="' + src + '"></scr' + 'ipt>');
    document.write('<scr' + 'ipt>eruda.init();</scr' + 'ipt>');
})();

Configuration

When initialization, a configuration object can be passed in.

  • container: Container element. If not set, it will append an element directly under html root element.
  • tool: Choose which default tools you want, by default all will be added.

For more information, please check the documentation.

let el = document.createElement('div');
document.body.appendChild(el);

eruda.init({
    container: el,
    tool: ['console', 'elements']
});

Plugins

If you want to create a plugin yourself, follow the guides here.

Related Projects

Contribution

Read Contributing Guide for development setup instructions.

Comments
  • 问题:移动端使用rem的情况下,面板太小的解决方案

    问题:移动端使用rem的情况下,面板太小的解决方案

    现在移动端,为了适配大小问题,使用rem的解决方案。 具体见 https://github.com/amfe/lib-flexible

    三倍屏下,会先把页面的 scale 设成 1/3, 这种情况下,调试面板就太小了。

    我们自己写css时,会通过postcss 把px 转成rem。

    这个虽然不是库需要考虑的,但是移动端rem还是挺常用,这种情况的确太影响使用了。

    enhancement 
    opened by jzlxiaohei 12
  • 微信浏览器默认初始化面板数量有问题

    微信浏览器默认初始化面板数量有问题

      try {
        require('eruda').init()
      } catch (e) {
        alert(e)
      }
    

    alert 出来信息是 TypeError: str.slice is not a function. (In 'str.slice(0, len'), 'str.slice' is undefined)

    系统:iOS 9.3.5 微信:6.5.5(UIwebview)

    qq20170303-182546 2x qq20170303-183410 2x qq20170303-183451 2x
    opened by DeepenLau 9
  • Error: Refused to get unsafe header

    Error: Refused to get unsafe header "Content-Length"

    What a great tool this is! For the most part, it works flawlessly. However, I'm getting a lot of errors from eruda Refused to get unsafe header "Content Length". My code uses Angular and makes frequent XHR requests. My guess is that eruda is having trouble inspecting the headers returned by the XHR requests. Thanks for looking into this.

    opened by hanthomas 7
  • Please read

    Please read

    In order to try it for different sites, execute the script below on browser address bar.

    I am not sure what you said here. Please show how to use this tool.

    opened by open-codebranch 6
  • 打印具备 deprecated 方法的对象时会报错

    打印具备 deprecated 方法的对象时会报错

    API 升级后,经常会保留一些旧版本的 API 接口作为过渡,例如

    Object.defineProperty(Sprite.prototype, 'cascade', {
      get: function () {
        console.error('Sprite.cascade is deprecated, use Node.cascade please.');
        return this._realCascade;
      },
      enumerable: false
    })
    

    然后如果用户尝试输出 console.log(sprite),就会看到多了上面的报错:'Sprite.cascade is deprecated, use Node.cascade please.'

    请问该怎么解决这类问题?

    opened by jareguo 6
  • 统一/整理 eruda 内使用的 CSS 选择器,同时提供一些标准组件

    统一/整理 eruda 内使用的 CSS 选择器,同时提供一些标准组件

    对 eruda 进行开发时,可以通过更改例如 variable.scss 等 scss 源文件来高效地修改。但是,如果选择使用官方版本并自行附加 CSS,那么,由于最终的 CSS 选择器是各个组件独立生成的,修改效率会非常低:

    选择器

    如果在生成选择器的基础上,将常用常见的组件,如卡片、按钮,整理成拥有固定类名的标准组件,就可以基本解决问题。除却方便撰写额外样式,这么做还可以减少生成的 CSS 的长度,也能为插件预置一些常用组件的类名与样式,方便插件的开发。

    另外,建议将一些元素的字体设为等宽字体。 目前,我收集到这些:

    .eruda-console-container .eruda-logs-container,
    .eruda-elements .eruda-parents,
    .eruda-elements .eruda-breadcrumb,
    .eruda-elements .eruda-children,
    .eruda-elements .eruda-section > h2 ~ div,
    .eruda-network .eruda-requests,
    .eruda-info.eruda-tool li .eruda-content {
    	font-family: Fira Code, Menlo, Monaco, Consolas, Liberation Mono, Courier New, Courier, monospace;
    }
    
    opened by Crystal-RainSlide 5
  • 宿主页面的 MutationObserver 回调中使用 console.log 引起死循环

    宿主页面的 MutationObserver 回调中使用 console.log 引起死循环

    console.logeruda 重写,调用会更新 eruda-console 节点,触发宿主的 MutationObserver,引起 console.log,进入死循环。

    var observer = new MutationObserver(mutaions => {
      // trigger `eruda-console` DOM Mutation
      console.log('change');
    });
    

    https://github.com/liriliri/eruda/blob/master/src/Resources/Resources.js#L411-L419

    如果用 iframe 来隔离应该可以解决: https://github.com/liriliri/eruda/issues/64

    或者是否有方法可以拦截宿主页面的 MutationObserver,进而绕过 eruda UI 的 DOM Mutation

    enhancement 
    opened by UncleBill 5
  • vuejs使用eruda延迟问题

    vuejs使用eruda延迟问题

    在vue-cli脚手架创建的项目模板中使用eruda代码如下: 在webpack入口文件引入eruda

    import eruda from 'eruda';
    eruda.init();
    

    eruda看起来挺漂亮的,页面看起来也一切正常,但是当我操作页面的时候(点击、前进或者后退导航),发现操作相应延迟很大,大概2s,会不会是在操作过程中eruda有计算或者执行了什么导致阻塞?或者怎么解决呢?

    opened by Jv-Juven 5
  • 动态插入的script报错

    动态插入的script报错

    最近在用一个国产hybrid框架的时候发现,用静态的script标签没问题,但是用动态插入的script,用该框架的模拟器点击右下角的eruda会报错:Cannot set property type of #<Event> which has only a getter,chrome上的报错为:Cannot assign to read only property 'type' of object '#<Event>'。

    (function() {
        var consoleScript = document.createElement("script");
        consoleScript.src = "js/eruda.min.js";
        document.head.appendChild(consoleScript);
        consoleScript.onload = function() {
            eruda.init();
        };
    })();
    
    opened by donniean 5
  • bad classes in eruda.

    bad classes in eruda.

    Please, if possible, delete classes that do not begin with "eruda-". I met a problem with the class "filter". My code uses this class to define a component in DOM. I'm getting errors in the console. Thank you in advance.

    opened by dartess 5
  • Can we use this on any page from a mobile device?

    Can we use this on any page from a mobile device?

    I wanted to inspect a certain web page for a certain authorisation token, on my phone. Is this possible with Eruda or is it just for web pages you are an author of yourself so you can put the JavaScript lines in?

    opened by julkhami 5
Releases(v2.10.0)
Owner
LiriLiri
HTML5 Visual Novel Game Engine
LiriLiri
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
Javascript client for Sanity. Works in node.js and modern browsers (older browsers needs a Promise polyfill).

@sanity/client Javascript client for Sanity. Works in node.js and modern browsers (older browsers needs a Promise polyfill). Requirements Sanity Clien

Sanity 23 Nov 29, 2022
This package generates a unique ID/String for different browsers. Like chrome, Firefox and any other browsers which supports canvas and audio Fingerprinting.

Broprint.js The world's easiest, smallest and powerful visitor identifier for browsers. This package generates a unique ID/String for different browse

Rajesh Royal 68 Dec 25, 2022
Phaser is a fun, free and fast 2D game framework for making HTML5 games for desktop and mobile web browsers, supporting Canvas and WebGL rendering.

Phaser - HTML5 Game Framework Phaser is a fast, free, and fun open source HTML5 game framework that offers WebGL and Canvas rendering across desktop a

Richard Davey 33.4k Jan 7, 2023
This is an application that entered the market with a mobile application in real life. We wrote the backend side with node.js and the mobile side with flutter.

HAUSE TAXI API Get Started Must be installed on your computer Git Node Firebase Database Config You should read this easy documentation Firebase-Fires

Muhammet Çokyaman 4 Nov 4, 2021
Smooth mobile touch slider for Mobile WebApp, HTML5 App, Hybrid App

iSlider iSlider is a lightweight, high-performant, no library dependencies cross-platform slide controller. It can help handling most sliding effects,

Baidu BEFE 1.7k Nov 25, 2022
A NodeJS Console Logger with superpowers

LogFlake LogFlake is a NodeJS console logger with superpowers. It has the same API as the usual Console but with beautified output, a message header w

Felippe Regazio 57 Oct 9, 2022
Console log to terminal

Termlog Console log to terminal What it does termlog send the browser console log to your terminal It also comes with a nodejs REPL so you can do some

Quang Ngoc 16 Jan 21, 2022
NpxCard - Write 'npx hariom' in your console.

npx Card This is my NPX card for connecting with me in console or terminal. ❣️ Just Hit npx hariom Will see you in console in just a minute ?? Importa

Hariom gola 2 Jul 26, 2022
Another logger in JS. This one offers a console.log-like API and formatting, colored lines and timestamps (or not if desired), all that with 0 dependencies.

hellog Your new logger ! hellog is a general-purpose logging library. It offers a console.log-like API and formatting, extensible type-safety colored

Maxence Lecanu 4 Jan 5, 2022
print faceit elo into the console/chat via telnet

Print MM Ranks and FaceIT elo ingame This tool uses telnet to interact with the console in CS:GO Description Gets faceit elo via the official faceit a

Dominik Wolf 5 Sep 20, 2022
A simple library to draw option menu or other popup inputs and layout on Node.js console.

console-gui-tools A simple library to draw option menu or other popup inputs and layout on Node.js console. console-gui-tools A simple Node.js library

Elia Lazzari 12 Dec 24, 2022
Beautiful errors for Remix, both in browser and console

Rekindled Beautiful errors for Remix, both in browser and console. This project is inspired by php's ignition. I am personally in love with the idea o

FYN Software 22 Nov 22, 2022
A tool to install ubuntu mainline kernels from the console.

Ubuntu Kernel Tool A tool to list, download, and install mainline kernels from the Ubuntu mainline repository. ULTIMATE DISCLAIMER: DO NOT USE THIS TO

Abdullah A. Hassan 9 Jan 21, 2022
Qovery Web Console 🌎

Qovery console Quick start yarn // start project yarn start // start storybook yarn run storybook Generate an application Run nx g @nrwl/react:app my-

Qovery 160 Dec 27, 2022
The best desktop console calculator yet!

TBCalc - Console Calculator The best desktop console calculator yet! ?? Try TBCalc Online: https://tbcalc.tcb13.com ?? TBCalc Windows App: https://tbc

Tadeu Bento 4 Sep 7, 2022
Quickly create console debugging information for multiple languages.

Debugger for Console Quickly create console debugging information for multiple languages. This plugin uses antfu/starter-vscode as the initial templat

Chestnut 5 Oct 21, 2022
Colorconsole provides an interesting way to display colored info, success, warning and error messages on the developer console in your browser

ColorConsole NPM Package Colorconsole provides an interesting way to display colored info, success, warning and error messages on the developer consol

Hasin Hayder 17 Sep 19, 2022