Compare commits
5 Commits
v3.4.0
...
786c515bfe
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
786c515bfe | ||
|
|
d92cbe2c58 | ||
|
|
1d4764dd4c | ||
|
|
c6b3e4ff62 | ||
|
|
f8315c2971 |
32
.github/CONTRIBUTING.md
vendored
32
.github/CONTRIBUTING.md
vendored
@@ -1,32 +0,0 @@
|
||||
# Contributing Guide
|
||||
|
||||
## Development Setup
|
||||
|
||||
[Node.js](https://nodejs.org/en/) is needed for the development of eruda.
|
||||
|
||||
After cloning the repo, run:
|
||||
|
||||
```bash
|
||||
# install npm dependencies.
|
||||
npm install
|
||||
# copy jasmine lib from node_modules to test folder.
|
||||
npm run setup
|
||||
```
|
||||
|
||||
## Commonly used NPM scripts
|
||||
|
||||
```bash
|
||||
# watch and auto re-build.
|
||||
npm run dev
|
||||
# build eruda.js
|
||||
npm run build
|
||||
# lint, build and test.
|
||||
npm run ci
|
||||
```
|
||||
|
||||
## Project Structure
|
||||
|
||||
- **doc**: documents.
|
||||
- **build**: webpack configuration, and some other useful scripts.
|
||||
- **src**: source code, written in es2015.
|
||||
- **test**: contain pages for testing.
|
||||
73
README.md
73
README.md
@@ -35,23 +35,7 @@ Console for Mobile Browsers.
|
||||
|
||||

|
||||
|
||||
Browse it on your phone: [https://eruda.liriliri.io/](https://eruda.liriliri.io/)
|
||||
|
||||
In order to try it for different sites, execute the script below on browser address bar.
|
||||
|
||||
```javascript
|
||||
javascript:(function () { var script = document.createElement('script'); script.src="https://cdn.jsdelivr.net/npm/eruda"; document.body.append(script); script.onload = function () { eruda.init(); } })();
|
||||
```
|
||||
|
||||
## Features
|
||||
|
||||
* [Console](https://eruda.liriliri.io/docs/api.html#console): Display JavaScript logs.
|
||||
* [Elements](https://eruda.liriliri.io/docs/api.html#elements): Check dom state.
|
||||
* [Network](https://eruda.liriliri.io/docs/api.html#network): Show requests status.
|
||||
* [Resources](https://eruda.liriliri.io/docs/api.html#resources): Show localStorage, cookie information.
|
||||
* [Info](https://eruda.liriliri.io/docs/api.html#info): Show url, user agent info.
|
||||
* [Snippets](https://eruda.liriliri.io/docs/api.html#snippets): Include snippets used most often.
|
||||
* [Sources](https://eruda.liriliri.io/docs/api.html#sources): Html, js, css source viewer.
|
||||
Browse it on your phone: [eruda.liriliri.io](https://eruda.liriliri.io/)
|
||||
|
||||
## Install
|
||||
|
||||
@@ -75,58 +59,7 @@ It's also available on [jsDelivr](http://www.jsdelivr.com/projects/eruda) and [c
|
||||
<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:
|
||||
|
||||
```javascript
|
||||
;(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>');
|
||||
})();
|
||||
```
|
||||
|
||||
If you are using modern JavaScript tooling, you can dynamically import it.
|
||||
|
||||
```javascript
|
||||
if (import.meta.env.MODE === 'development') {
|
||||
import('eruda').then(eruda => eruda.default.init());
|
||||
}
|
||||
```
|
||||
|
||||
## 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](https://eruda.liriliri.io/docs/api.html).
|
||||
|
||||
```javascript
|
||||
let el = document.createElement('div');
|
||||
document.body.appendChild(el);
|
||||
|
||||
eruda.init({
|
||||
container: el,
|
||||
tool: ['console', 'elements']
|
||||
});
|
||||
```
|
||||
|
||||
## Plugins
|
||||
|
||||
* [eruda-monitor](https://github.com/liriliri/eruda-monitor): Display page fps and memory.
|
||||
* [eruda-features](https://github.com/liriliri/eruda-features): Browser feature detections.
|
||||
* [eruda-timing](https://github.com/liriliri/eruda-timing): Show performance and resource timing.
|
||||
* [eruda-code](https://github.com/liriliri/eruda-code): Run JavaScript code.
|
||||
* [eruda-benchmark](https://github.com/liriliri/eruda-benchmark): Run JavaScript benchmarks.
|
||||
* [eruda-geolocation](https://github.com/liriliri/eruda-geolocation): Test geolocation.
|
||||
* [eruda-orientation](https://github.com/liriliri/eruda-orientation): Test orientation api.
|
||||
* [eruda-touches](https://github.com/liriliri/eruda-touches): Visualize screen touches.
|
||||
* [eruda-vue](https://github.com/liriliri/eruda-vue): Vue devtools.
|
||||
|
||||
If you want to create a plugin yourself, follow the guides [here](https://eruda.liriliri.io/docs/plugin.html).
|
||||
For more detailed usage instructions, please read the documentation at [eruda.liriliri.io](https://eruda.liriliri.io/docs/)!
|
||||
|
||||
## Related Projects
|
||||
|
||||
@@ -149,4 +82,4 @@ If you want to create a plugin yourself, follow the guides [here](https://eruda.
|
||||
|
||||
## Contribution
|
||||
|
||||
Read [Contributing Guide](.github/CONTRIBUTING.md) for development setup instructions.
|
||||
Read [Contributing Guide](https://eruda.liriliri.io/docs/contributing.html) for development setup instructions.
|
||||
|
||||
@@ -61,10 +61,10 @@
|
||||
"karma-jquery": "^0.2.4",
|
||||
"karma-sourcemap-loader": "^0.3.7",
|
||||
"karma-webpack": "^5.0.0",
|
||||
"licia": "^1.42.0",
|
||||
"licia": "^1.43.0",
|
||||
"luna-box-model": "^1.0.0",
|
||||
"luna-console": "^1.3.4",
|
||||
"luna-data-grid": "^0.6.0",
|
||||
"luna-console": "^1.3.5",
|
||||
"luna-data-grid": "^1.0.0",
|
||||
"luna-dom-viewer": "^1.4.0",
|
||||
"luna-modal": "^1.2.3",
|
||||
"luna-notification": "^0.3.2",
|
||||
|
||||
@@ -9,13 +9,14 @@ import isEmpty from 'licia/isEmpty'
|
||||
import toNum from 'licia/toNum'
|
||||
import copy from 'licia/copy'
|
||||
import isMobile from 'licia/isMobile'
|
||||
import isShadowRoot from 'licia/isShadowRoot'
|
||||
import LunaDomViewer from 'luna-dom-viewer'
|
||||
import { isErudaEl, classPrefix as c, isChobitsuEl } from '../lib/util'
|
||||
import evalCss from '../lib/evalCss'
|
||||
import Detail from './Detail'
|
||||
import chobitsu from '../lib/chobitsu'
|
||||
import emitter from '../lib/emitter'
|
||||
import { formatNodeName, isShadowRoot } from './util'
|
||||
import { formatNodeName } from './util'
|
||||
|
||||
export default class Elements extends Tool {
|
||||
constructor() {
|
||||
@@ -98,7 +99,7 @@ export default class Elements extends Tool {
|
||||
|
||||
const node = this._curNode
|
||||
|
||||
if (!node) {
|
||||
if (!node || isShadowRoot(node)) {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import each from 'licia/each'
|
||||
import isStr from 'licia/isStr'
|
||||
import isShadowRoot from 'licia/isShadowRoot'
|
||||
import { classPrefix as c } from '../lib/util'
|
||||
|
||||
export function formatNodeName(node, { noAttr = false } = {}) {
|
||||
@@ -36,11 +37,3 @@ export function formatNodeName(node, { noAttr = false } = {}) {
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
export function isShadowRoot(node) {
|
||||
if (window.ShadowRoot) {
|
||||
return node instanceof ShadowRoot
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ export default [
|
||||
fn() {
|
||||
loadPlugin('monitor')
|
||||
},
|
||||
desc: 'Display page fps and memory',
|
||||
desc: 'Display page fps, memory and dom nodes',
|
||||
},
|
||||
{
|
||||
name: 'Load Features Plugin',
|
||||
@@ -224,7 +224,7 @@ function loadPlugin(name) {
|
||||
}
|
||||
|
||||
const pluginVersion = {
|
||||
monitor: '1.0.2',
|
||||
monitor: '1.1.1',
|
||||
features: '2.1.0',
|
||||
timing: '2.0.1',
|
||||
code: '2.2.0',
|
||||
|
||||
Reference in New Issue
Block a user