Skip to content

Commit

Permalink
feat: v3.4.1 released
Browse files Browse the repository at this point in the history
  • Loading branch information
Maizify committed Apr 9, 2021
2 parents 9499599 + a377da7 commit 0cbe3e0
Show file tree
Hide file tree
Showing 16 changed files with 597 additions and 444 deletions.
18 changes: 16 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
# Logs
logs
*.log

# Dependency directory
node_modules

# npm cache directory
.npm

### OSX ###
*.DS_Store
*.log
.idea/

# IDE IDEA
.idea

# Thumbnails
._*
242 changes: 126 additions & 116 deletions CHANGELOG.md

Large diffs are not rendered by default.

240 changes: 125 additions & 115 deletions CHANGELOG_CN.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dev/data/success.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"ret":0,"msg":"suc"}
{"ret":0,"msg":"suc","xss":"<xss0>XSS"}
10 changes: 10 additions & 0 deletions dev/log.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<a onclick="smallArray()" href="javascript:;" class="weui_btn weui_btn_default">smallArray</a>
<a onclick="repeatLog()" href="javascript:;" class="weui_btn weui_btn_default">repeatLog</a>
<a onclick="windowError()" href="javascript:;" class="weui_btn weui_btn_default">window.error</a>
<a onclick="changeTheme()" href="javascript:;" class="weui_btn weui_btn_default">changeTheme</a>
</div>
</body>
</html>
Expand Down Expand Up @@ -123,4 +124,13 @@
console.info('windowError() End');
}

let theme = 'light';
function changeTheme() {
console.info('changeTheme() Start');
theme = theme === 'light' ? 'dark' : 'light';
window.vConsole.setOption('theme', theme);
console.log('Current Theme:', theme);
console.info('changeTheme() End');
}

</script>
30 changes: 23 additions & 7 deletions dev/network.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<a onclick="getAjax()" href="javascript:;" class="weui_btn weui_btn_default">getAjax</a>
<a onclick="postAjax()" href="javascript:;" class="weui_btn weui_btn_default">postAjax</a>
<a onclick="getFetch()" href="javascript:;" class="weui_btn weui_btn_default">getFetch</a>
<a onclick="getFetchSimple()" href="javascript:;" class="weui_btn weui_btn_default">getFetch(simple)</a>
<a onclick="postFetch()" href="javascript:;" class="weui_btn weui_btn_default">postFetch</a>
<a onclick="postFetchByRequest()" href="javascript:;" class="weui_btn weui_btn_default">postFetchByRequest</a>
</div>
Expand All @@ -30,7 +31,8 @@
xhr.send({
foo: 'bar',
id: Math.random(),
type: 'xhr'
type: 'xhr',
'<xss0>': '<xss1> XSS Attack!'
});
xhr.onload = () => {
console.log('postAjax Response:', JSON.parse(xhr.response));
Expand All @@ -43,8 +45,9 @@

function getAjax() {
console.info('getAjax() Start, response should be logged after End');
const url = './data/success.json?type=xhr&id=' + Math.random() + '&<xss0>';
const xhr = new XMLHttpRequest();
xhr.open('GET', './data/success.json?type=xhr&id=' + Math.random());
xhr.open('GET', url);
xhr.setRequestHeader('custom-header', 'foobar');
xhr.send();
xhr.onload = () => {
Expand Down Expand Up @@ -72,6 +75,16 @@
console.info('getFetch() End');
}

function getFetchSimple() {
console.info('getFetchSimple() Start, response should be logged after End');
window.fetch('./data/success.json?type=fetch&id=' + Math.random()).then((data) => {
return data.json();
}).then((data) => {
console.log('getFetchSimple Response:', data);
});
console.info('getFetchSimple() End');
}

function postFetch() {
console.info('postFetch() Start, response should be logged after End');
window.fetch('./data/success.json', {
Expand All @@ -80,7 +93,10 @@
// body: new Blob([new ArrayBuffer(233)], { type: 'image/png' }),
headers: {
'custom-header': 'foobar',
'content-type': 'application/json'
// 'content-type': 'application/json'
// 'content-type': 'application/x-www-form-urlencoded'
'content-type': 'multipart/form-data',
'xss': '<xss1> XSS Attack!'
},
}).then((data) => {
return data.json();
Expand All @@ -96,12 +112,12 @@
console.info('postFetchByRequest() Start, response should be logged after End');
const headers = new Headers();
headers.append('custom-header', 'foobar');
headers.append('content-type', 'application/json');
// headers.append('content-type', 'application/x-www-form-urlencoded');
// headers.append('content-type', 'application/json');
headers.append('content-type', 'application/x-www-form-urlencoded');
const req = new Request('./data/success.json?type=fetch&id=' + Math.random(), {
method: 'POST',
// body: { foo: 'bar', id: Math.random() },
body: new Blob([new ArrayBuffer(233)], { type: 'image/png' }),
body: { foo: 'bar', id: Math.random() },
// body: new Blob([new ArrayBuffer(233)], { type: 'image/png' }),
headers: headers,
});
window.fetch(req).then((data) => {
Expand Down
4 changes: 2 additions & 2 deletions dist/vconsole.min.js

Large diffs are not rendered by default.

20 changes: 19 additions & 1 deletion doc/public_properties_methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ The current version of vConsole.
Example:

```javascript
vConsole.version // => "3.4.0"
vConsole.version // => "3.4.1"
```


Expand Down Expand Up @@ -108,6 +108,24 @@ vConsole.setOption({maxLogNumber: 5000});
```


### vConsole.setSwitchPosition(x, y)

Update the position of switch button.

##### Parameters:
- (required) x: X coordinate, the origin of the coordinate is at the bottom right corner of the screen.
- (required) y: Y coordinate, the origin of the coordinate is at the bottom right corner of the screen.

##### Return:
- None

##### Example:

```javascript
vConsole.setSwitchPosition(20, 20);
```


### vConsole.destroy()

Destroy an vConsole instance object and remove vConsole panel from document.
Expand Down
18 changes: 18 additions & 0 deletions doc/public_properties_methods_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,24 @@ vConsole.setOption({maxLogNumber: 5000});
```


### vConsole.setSwitchPosition(x, y)

设置开关按钮的位置。

##### 参数:
- (required) x: X 坐标,坐标原点位于屏幕右下角。
- (required) y: Y 坐标,坐标原点位于屏幕右下角。

##### 返回:
-

##### 例子:

```javascript
vConsole.setSwitchPosition(20, 20);
```


### vConsole.destroy()

析构一个 vConsole 对象实例,并将 vConsole 面板从页面中移除。
Expand Down
Loading

0 comments on commit 0cbe3e0

Please sign in to comment.