1
0
mirror of synced 2025-11-06 04:21:11 +08:00

docs: simplify readme

This commit is contained in:
redhoodsu
2024-10-08 15:23:08 +08:00
parent 1b8929b9a5
commit f8315c2971

View File

@@ -35,23 +35,7 @@ Console for Mobile Browsers.
![Demo](https://eruda.liriliri.io/qrcode.png)
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