Merge branch 'master' of github.com:liriliri/eruda
This commit is contained in:
11
CHANGELOG.md
11
CHANGELOG.md
@@ -1,6 +1,13 @@
|
|||||||
|
## 2.4.0 (14 Sep 2020)
|
||||||
|
|
||||||
|
* feat: default settings [#141](https://github.com/liriliri/eruda/issues/141)
|
||||||
|
* fix(elements): highlight
|
||||||
|
* fix(console): blinks frequently as it scroll to the border
|
||||||
|
* refactor: use chobitsu
|
||||||
|
|
||||||
## 2.3.3 (3 May 2020)
|
## 2.3.3 (3 May 2020)
|
||||||
|
|
||||||
* fix: unsafe-eval CSP violation #140
|
* fix: unsafe-eval CSP violation [#140](https://github.com/liriliri/eruda/issues/140)
|
||||||
|
|
||||||
## v2.3.2 (29 Apr 2020)
|
## v2.3.2 (29 Apr 2020)
|
||||||
|
|
||||||
@@ -66,7 +73,7 @@
|
|||||||
|
|
||||||
## v1.10.3 (8 Nov 2019)
|
## v1.10.3 (8 Nov 2019)
|
||||||
|
|
||||||
* fix(info): escape location #127
|
* fix(info): escape location [#127](https://github.com/liriliri/eruda/issues/127)
|
||||||
* chore: update refresh icon
|
* chore: update refresh icon
|
||||||
* chore: update timing plugin version
|
* chore: update timing plugin version
|
||||||
|
|
||||||
|
|||||||
@@ -119,6 +119,7 @@ If you want to create a plugin yourself, follow the guides [here](./doc/PLUGIN.m
|
|||||||
## Related Projects
|
## Related Projects
|
||||||
|
|
||||||
* [chii](https://github.com/liriliri/chii): Remote debugging tool.
|
* [chii](https://github.com/liriliri/chii): Remote debugging tool.
|
||||||
|
* [chobitsu](https://github.com/liriliri/chobitsu): Chrome devtools protocol JavaScript implementation.
|
||||||
* [licia](https://github.com/liriliri/licia): Utility library used by eruda.
|
* [licia](https://github.com/liriliri/licia): Utility library used by eruda.
|
||||||
* [eruda-webpack-plugin](https://github.com/huruji/eruda-webpack-plugin): Eruda webpack plugin.
|
* [eruda-webpack-plugin](https://github.com/huruji/eruda-webpack-plugin): Eruda webpack plugin.
|
||||||
|
|
||||||
|
|||||||
@@ -1281,23 +1281,6 @@ const str =
|
|||||||
extractUrls(str); // -> ['http://eustia.liriliri.io']
|
extractUrls(str); // -> ['http://eustia.liriliri.io']
|
||||||
```
|
```
|
||||||
|
|
||||||
## fileSize
|
|
||||||
|
|
||||||
Turn bytes into human readable file size.
|
|
||||||
|
|
||||||
|Name |Desc |
|
|
||||||
|------|------------------|
|
|
||||||
|bytes |File bytes |
|
|
||||||
|return|Readable file size|
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
fileSize(5); // -> '5'
|
|
||||||
fileSize(1500); // -> '1.46K'
|
|
||||||
fileSize(1500000); // -> '1.43M'
|
|
||||||
fileSize(1500000000); // -> '1.4G'
|
|
||||||
fileSize(1500000000000); // -> '1.36T'
|
|
||||||
```
|
|
||||||
|
|
||||||
## filter
|
## filter
|
||||||
|
|
||||||
Iterates over elements of collection, returning an array of all the values that pass a truth test.
|
Iterates over elements of collection, returning an array of all the values that pass a truth test.
|
||||||
@@ -1346,10 +1329,6 @@ a.b = 2;
|
|||||||
console.log(a); // -> {b: 1}
|
console.log(a); // -> {b: 1}
|
||||||
```
|
```
|
||||||
|
|
||||||
## fullUrl
|
|
||||||
|
|
||||||
Add origin to url if needed.
|
|
||||||
|
|
||||||
## getFileName
|
## getFileName
|
||||||
|
|
||||||
Extract file name from url.
|
Extract file name from url.
|
||||||
@@ -1704,20 +1683,6 @@ isNaN(0); // -> false
|
|||||||
isNaN(NaN); // -> true
|
isNaN(NaN); // -> true
|
||||||
```
|
```
|
||||||
|
|
||||||
## isNative
|
|
||||||
|
|
||||||
Check if value is a native function.
|
|
||||||
|
|
||||||
|Name |Desc |
|
|
||||||
|------|----------------------------------|
|
|
||||||
|val |Value to check |
|
|
||||||
|return|True if value is a native function|
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
isNative(function() {}); // -> false
|
|
||||||
isNative(Math.min); // -> true
|
|
||||||
```
|
|
||||||
|
|
||||||
## isNil
|
## isNil
|
||||||
|
|
||||||
Check if value is null or undefined, the same as value == null.
|
Check if value is null or undefined, the same as value == null.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "eruda",
|
"name": "eruda",
|
||||||
"version": "2.3.3",
|
"version": "2.4.0",
|
||||||
"description": "Console for Mobile Browsers",
|
"description": "Console for Mobile Browsers",
|
||||||
"main": "eruda.js",
|
"main": "eruda.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
201
src/lib/util.js
201
src/lib/util.js
@@ -1074,59 +1074,6 @@ export var escapeRegExp = _.escapeRegExp = (function (exports) {
|
|||||||
return exports;
|
return exports;
|
||||||
})({});
|
})({});
|
||||||
|
|
||||||
/* ------------------------------ fileSize ------------------------------ */
|
|
||||||
|
|
||||||
export var fileSize = _.fileSize = (function (exports) {
|
|
||||||
/* Turn bytes into human readable file size.
|
|
||||||
*
|
|
||||||
* |Name |Desc |
|
|
||||||
* |------|------------------|
|
|
||||||
* |bytes |File bytes |
|
|
||||||
* |return|Readable file size|
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* example
|
|
||||||
* fileSize(5); // -> '5'
|
|
||||||
* fileSize(1500); // -> '1.46K'
|
|
||||||
* fileSize(1500000); // -> '1.43M'
|
|
||||||
* fileSize(1500000000); // -> '1.4G'
|
|
||||||
* fileSize(1500000000000); // -> '1.36T'
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* typescript
|
|
||||||
* export declare function fileSize(bytes: number): string;
|
|
||||||
*/
|
|
||||||
exports = function(bytes) {
|
|
||||||
if (bytes <= 0) return '0';
|
|
||||||
var suffixIdx = Math.floor(Math.log(bytes) / Math.log(1024));
|
|
||||||
var val = bytes / Math.pow(2, suffixIdx * 10);
|
|
||||||
return +val.toFixed(2) + suffixList[suffixIdx];
|
|
||||||
};
|
|
||||||
|
|
||||||
var suffixList = ['', 'K', 'M', 'G', 'T'];
|
|
||||||
|
|
||||||
return exports;
|
|
||||||
})({});
|
|
||||||
|
|
||||||
/* ------------------------------ fullUrl ------------------------------ */
|
|
||||||
|
|
||||||
export var fullUrl = _.fullUrl = (function (exports) {
|
|
||||||
/* Add origin to url if needed.
|
|
||||||
*/
|
|
||||||
|
|
||||||
let link = document.createElement('a')
|
|
||||||
|
|
||||||
exports = function (href) {
|
|
||||||
link.href = href
|
|
||||||
|
|
||||||
return (
|
|
||||||
link.protocol + '//' + link.host + link.pathname + link.search + link.hash
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
return exports;
|
|
||||||
})({});
|
|
||||||
|
|
||||||
/* ------------------------------ upperFirst ------------------------------ */
|
/* ------------------------------ upperFirst ------------------------------ */
|
||||||
|
|
||||||
export var upperFirst = _.upperFirst = (function (exports) {
|
export var upperFirst = _.upperFirst = (function (exports) {
|
||||||
@@ -2446,98 +2393,6 @@ export var isNil = _.isNil = (function (exports) {
|
|||||||
return exports;
|
return exports;
|
||||||
})({});
|
})({});
|
||||||
|
|
||||||
/* ------------------------------ toSrc ------------------------------ */
|
|
||||||
|
|
||||||
export var toSrc = _.toSrc = (function (exports) {
|
|
||||||
/* Convert function to its source code.
|
|
||||||
*
|
|
||||||
* |Name |Desc |
|
|
||||||
* |------|-------------------|
|
|
||||||
* |fn |Function to convert|
|
|
||||||
* |return|Source code |
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* example
|
|
||||||
* toSrc(Math.min); // -> 'function min() { [native code] }'
|
|
||||||
* toSrc(function() {}); // -> 'function () { }'
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* typescript
|
|
||||||
* export declare function toSrc(fn: types.AnyFn): string;
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* dependencies
|
|
||||||
* isNil types
|
|
||||||
*/
|
|
||||||
|
|
||||||
exports = function(fn) {
|
|
||||||
if (isNil(fn)) return '';
|
|
||||||
|
|
||||||
try {
|
|
||||||
return fnToStr.call(fn);
|
|
||||||
/* eslint-disable no-empty */
|
|
||||||
} catch (e) {}
|
|
||||||
|
|
||||||
try {
|
|
||||||
return fn + '';
|
|
||||||
/* eslint-disable no-empty */
|
|
||||||
} catch (e) {}
|
|
||||||
|
|
||||||
return '';
|
|
||||||
};
|
|
||||||
|
|
||||||
var fnToStr = Function.prototype.toString;
|
|
||||||
|
|
||||||
return exports;
|
|
||||||
})({});
|
|
||||||
|
|
||||||
/* ------------------------------ isNative ------------------------------ */
|
|
||||||
|
|
||||||
export var isNative = _.isNative = (function (exports) {
|
|
||||||
/* Check if value is a native function.
|
|
||||||
*
|
|
||||||
* |Name |Desc |
|
|
||||||
* |------|----------------------------------|
|
|
||||||
* |val |Value to check |
|
|
||||||
* |return|True if value is a native function|
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* example
|
|
||||||
* isNative(function() {}); // -> false
|
|
||||||
* isNative(Math.min); // -> true
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* typescript
|
|
||||||
* export declare function isNative(val: any): boolean;
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* dependencies
|
|
||||||
* isObj isFn toSrc
|
|
||||||
*/
|
|
||||||
|
|
||||||
exports = function(val) {
|
|
||||||
if (!isObj(val)) return false;
|
|
||||||
if (isFn(val)) return regIsNative.test(toSrc(val)); // Detect host constructors (Safari > 4; really typed array specific)
|
|
||||||
|
|
||||||
return regIsHostCtor.test(toSrc(val));
|
|
||||||
};
|
|
||||||
|
|
||||||
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
||||||
var regIsNative = new RegExp(
|
|
||||||
'^' +
|
|
||||||
toSrc(hasOwnProperty)
|
|
||||||
.replace(/[\\^$.*+?()[\]{}|]/g, '\\$&')
|
|
||||||
.replace(
|
|
||||||
/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,
|
|
||||||
'$1.*?'
|
|
||||||
) +
|
|
||||||
'$'
|
|
||||||
);
|
|
||||||
var regIsHostCtor = /^\[object .+?Constructor\]$/;
|
|
||||||
|
|
||||||
return exports;
|
|
||||||
})({});
|
|
||||||
|
|
||||||
/* ------------------------------ isNull ------------------------------ */
|
/* ------------------------------ isNull ------------------------------ */
|
||||||
|
|
||||||
export var isNull = _.isNull = (function (exports) {
|
export var isNull = _.isNull = (function (exports) {
|
||||||
@@ -6016,12 +5871,13 @@ export var Emitter = _.Emitter = (function (exports) {
|
|||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
off: function(event, listener) {
|
off: function(event, listener) {
|
||||||
if (!has(this._events, event)) return;
|
var events = this._events;
|
||||||
|
if (!has(events, event)) return;
|
||||||
|
var idx = events[event].indexOf(listener);
|
||||||
|
|
||||||
this._events[event].splice(
|
if (idx > -1) {
|
||||||
this._events[event].indexOf(listener),
|
events[event].splice(idx, 1);
|
||||||
1
|
}
|
||||||
);
|
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
@@ -8069,6 +7925,51 @@ export var LocalStore = _.LocalStore = (function (exports) {
|
|||||||
return exports;
|
return exports;
|
||||||
})({});
|
})({});
|
||||||
|
|
||||||
|
/* ------------------------------ toSrc ------------------------------ */
|
||||||
|
|
||||||
|
export var toSrc = _.toSrc = (function (exports) {
|
||||||
|
/* Convert function to its source code.
|
||||||
|
*
|
||||||
|
* |Name |Desc |
|
||||||
|
* |------|-------------------|
|
||||||
|
* |fn |Function to convert|
|
||||||
|
* |return|Source code |
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* example
|
||||||
|
* toSrc(Math.min); // -> 'function min() { [native code] }'
|
||||||
|
* toSrc(function() {}); // -> 'function () { }'
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* typescript
|
||||||
|
* export declare function toSrc(fn: types.AnyFn): string;
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* dependencies
|
||||||
|
* isNil types
|
||||||
|
*/
|
||||||
|
|
||||||
|
exports = function(fn) {
|
||||||
|
if (isNil(fn)) return '';
|
||||||
|
|
||||||
|
try {
|
||||||
|
return fnToStr.call(fn);
|
||||||
|
/* eslint-disable no-empty */
|
||||||
|
} catch (e) {}
|
||||||
|
|
||||||
|
try {
|
||||||
|
return fn + '';
|
||||||
|
/* eslint-disable no-empty */
|
||||||
|
} catch (e) {}
|
||||||
|
|
||||||
|
return '';
|
||||||
|
};
|
||||||
|
|
||||||
|
var fnToStr = Function.prototype.toString;
|
||||||
|
|
||||||
|
return exports;
|
||||||
|
})({});
|
||||||
|
|
||||||
/* ------------------------------ stringifyAll ------------------------------ */
|
/* ------------------------------ stringifyAll ------------------------------ */
|
||||||
|
|
||||||
export var stringifyAll = _.stringifyAll = (function (exports) {
|
export var stringifyAll = _.stringifyAll = (function (exports) {
|
||||||
|
|||||||
Reference in New Issue
Block a user