Skip to content

Commit 544c44f

Browse files
committed
add screenshot
1 parent 94db2a3 commit 544c44f

File tree

144 files changed

+45215
-12433
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

144 files changed

+45215
-12433
lines changed

.browserslistrc

Lines changed: 0 additions & 3 deletions
This file was deleted.

.eslintrc.js

Lines changed: 0 additions & 22 deletions
This file was deleted.

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2018 leechaojiang
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 70 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,76 @@
1-
# Vue-jigsawPuzzle
1+
# JavaScript-screenshot
22

3-
Jigsaw puzzle based on Vue
4-
基于Vue的拼图小游戏
5-
6-
带有打乱时很炫酷的动画
7-
![example](https://github.com/usecodelee/Vue-jigsawPuzzle/blob/master/img/20190327.gif)
3+
[![star this repo](http://githubbadges.com/star.svg?user=usecodelee&repo=JavaScript-screenshot&style=default)](https://github.com/usecodelee/JavaScript-screenshot)[![fork this repo](http://githubbadges.com/fork.svg?user=usecodelee&repo=JavaScript-screenshot&style=default)](https://github.com/usecodelee/JavaScript-screenshot/fork) [![npm](https://img.shields.io/npm/v/js_screen_shots.svg)](https://www.npmjs.com/package/js_screen_shots) [![languages](https://img.shields.io/badge/javascript-81.4%25-green.svg)](https://github.com/usecodelee/JavaScript-screenshot) [![node](https://img.shields.io/badge/node-%3E1.0.0-green.svg)](https://github.com/usecodelee/JavaScript-screenshot) [![MIT Licence](https://badges.frapsoft.com/os/mit/mit.svg?v=103)](https://opensource.org/licenses/mit-license.php)
84

9-
## 增加自动拼图功能
5+
[中文](https://github.com/usecodelee/JavaScript-screenshot/blob/master/README_zh.md)
106

11-
## 增加自动重新打乱开始功能
7+
## Introduction
128

13-
## 使用:
9+
JavaScript implementation screenshot,There are two libraries used:
1410

15-
1. npm install
11+
> [Html2Canvas.js](https://github.com/niklasvh/html2canvas)
12+
> [Canvas2Image.js](https://github.com/SuperAL/canvas2image)
1613
17-
2. npm run serve
14+
I mainly made two demos and one NPM package:
15+
16+
1. [Simple Version](https://github.com/usecodelee/JavaScript-screenshot/tree/master/simple)
17+
2. [Webpack+Vue+Element Version](https://github.com/usecodelee/JavaScript-screenshot/tree/master/simple)
18+
3. [js-screenshot-for-npm](https://github.com/usecodelee/JavaScript-screenshot/tree/master/js-screenshot-for-npm)
19+
20+
## Simple Version Of Use
21+
22+
> Open `index.html` directly in your browser.
23+
24+
## Webpack+Vue+Element Version Of Use
25+
26+
``` bash
27+
# install dependencies
28+
npm install
29+
30+
# serve with hot reload at localhost:8080
31+
npm run dev
32+
33+
# build for production with minification
34+
npm run build
35+
36+
# build for production and view the bundle analyzer report
37+
npm run build --report
38+
```
39+
40+
### Example
41+
42+
> **The original html is like this:**
43+
44+
<img src="https://github.com/usecodelee/JavaScript-screenshot/blob/master/img/1%E4%B8%8A.png" width="400" hegiht="500" align=center style="border:2px #ccc dashed;"/>
45+
46+
> **This is the element node:**
47+
48+
<img src="https://github.com/usecodelee/JavaScript-screenshot/blob/master/img/1%E4%B8%8B.jpg" width="400" hegiht="500" align=center />
49+
50+
> **This is after converting to canvas:**
51+
52+
<img src="https://github.com/usecodelee/JavaScript-screenshot/blob/master/img/2%E4%B8%8A.jpg" width="400" hegiht="500" align=center />
53+
54+
> **This is the element node:**
55+
56+
<img src="https://github.com/usecodelee/JavaScript-screenshot/blob/master/img/2%E4%B8%8B.jpg" width="400" hegiht="500" align=center />
57+
58+
> **This is after converting to img:**
59+
60+
<img src="https://github.com/usecodelee/JavaScript-screenshot/blob/master/img/3%E4%B8%8A.jpg" width="400" hegiht="500" align=center />
61+
62+
> **This is the element node:**
63+
64+
<img src="https://github.com/usecodelee/JavaScript-screenshot/blob/master/img/3%E4%B8%8B.jpg" width="400" hegiht="500" align=center />
65+
66+
> **This is the final result:**
67+
68+
<img src="https://github.com/usecodelee/JavaScript-screenshot/blob/master/img/4.jpg" width="400" hegiht="500" align=center />
69+
70+
## js-screenshot-for-npm
71+
72+
```bash
73+
npm install --save js_screen_shots
74+
```
75+
76+
For details, see the document [README.md](https://github.com/usecodelee/JavaScript-screenshot/tree/master/js-screenshot-for-npm).

README_zh.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# JavaScript实现截图
2+
3+
[![star this repo](http://githubbadges.com/star.svg?user=usecodelee&repo=JavaScript-screenshot&style=default)](https://github.com/usecodelee/JavaScript-screenshot)[![fork this repo](http://githubbadges.com/fork.svg?user=usecodelee&repo=JavaScript-screenshot&style=default)](https://github.com/usecodelee/JavaScript-screenshot/fork) [![npm](https://img.shields.io/npm/v/js_screen_shots.svg)](https://www.npmjs.com/package/js_screen_shots) [![languages](https://img.shields.io/badge/javascript-81.4%25-green.svg)](https://github.com/usecodelee/JavaScript-screenshot) [![node](https://img.shields.io/badge/node-%3E1.0.0-green.svg)](https://github.com/usecodelee/JavaScript-screenshot) [![MIT Licence](https://badges.frapsoft.com/os/mit/mit.svg?v=103)](https://opensource.org/licenses/mit-license.php)
4+
5+
## 简介
6+
7+
JavaScript实现网页截图,使用的库有两个:
8+
9+
> [Html2Canvas.js](https://github.com/niklasvh/html2canvas)
10+
> [Canvas2Image.js](https://github.com/SuperAL/canvas2image)
11+
12+
我主要是做了两个demo和一个npm包:
13+
14+
1. [简单版的实现](https://github.com/usecodelee/JavaScript-screenshot/tree/master/simple)
15+
2. [Webpack+Vue+Element版的实现](https://github.com/usecodelee/JavaScript-screenshot/tree/master/simple)
16+
3. [js-screenshot-for-npm](https://github.com/usecodelee/JavaScript-screenshot/tree/master/js-screenshot-for-npm)
17+
18+
## 如何使用简单版
19+
20+
> 直接打开`index.html`即可
21+
22+
## 如何使用Webpack+Vue+Element版
23+
24+
``` bash
25+
# 安装依赖
26+
npm install
27+
28+
# 在localhost:8080进行热重新加载
29+
npm run dev
30+
31+
# 压缩构建为生产环境代码
32+
npm run build
33+
34+
# 构建为生产环境代码并查看捆绑分析器报告
35+
npm run build --report
36+
```
37+
38+
### 使用示例
39+
40+
> 原始html是这样的:
41+
42+
<img src="https://github.com/usecodelee/JavaScript-screenshot/blob/master/img/1%E4%B8%8A.png" width="500" hegiht="313" align=center />
43+
44+
> 这是元素节点:
45+
46+
<img src="https://github.com/usecodelee/JavaScript-screenshot/blob/master/img/1%E4%B8%8B.jpg" width="500" hegiht="313" align=center />
47+
48+
> 这是转成canvas之后:
49+
50+
<img src="https://github.com/usecodelee/JavaScript-screenshot/blob/master/img/2%E4%B8%8A.jpg" width="500" hegiht="313" align=center />
51+
52+
> 这是元素节点:
53+
54+
<img src="https://github.com/usecodelee/JavaScript-screenshot/blob/master/img/2%E4%B8%8B.jpg" width="500" hegiht="313" align=center />
55+
56+
> 这是转成img之后:
57+
58+
<img src="https://github.com/usecodelee/JavaScript-screenshot/blob/master/img/3%E4%B8%8A.jpg" width="500" hegiht="313" align=center />
59+
60+
> 这是元素节点:
61+
62+
<img src="https://github.com/usecodelee/JavaScript-screenshot/blob/master/img/3%E4%B8%8B.jpg" width="500" hegiht="313" align=center />
63+
64+
> 这是最终截图结果:
65+
66+
<img src="https://github.com/usecodelee/JavaScript-screenshot/blob/master/img/4.jpg" width="500" hegiht="313" align=center />
67+
68+
## 使用npm安装js_screen_shots
69+
70+
```bash
71+
npm install --save js_screen_shots
72+
```
73+
74+
详情见[README.md](https://github.com/usecodelee/JavaScript-screenshot/tree/master/js-screenshot-for-npm)

babel.config.js

Lines changed: 0 additions & 5 deletions
This file was deleted.

img/1上.png

9.33 KB
Loading

img/1下.jpg

42.7 KB
Loading

img/2.jpg

-10.3 KB
Binary file not shown.

img/20190325.gif

-1.13 MB
Binary file not shown.

img/20190327.gif

-802 KB
Binary file not shown.

img/20190328.gif

-391 KB
Binary file not shown.

img/2上.jpg

49.5 KB
Loading

img/2下.jpg

24.6 KB
Loading

img/3.gif

-389 KB
Binary file not shown.

img/3上.jpg

63.8 KB
Loading

img/3下.jpg

34 KB
Loading

img/4.gif

-169 KB
Binary file not shown.

img/4.jpg

74 KB
Loading

img/5.gif

-83.2 KB
Binary file not shown.

js-screenshot-for-npm/README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# js_screen_shots
2+
3+
> 一个基于 JavaScript 的 DOM 截图工具。
4+
5+
[![star this repo](http://githubbadges.com/star.svg?user=usecodelee&repo=JavaScript-screenshot&style=default)](https://github.com/usecodelee/JavaScript-screenshot)[![fork this repo](http://githubbadges.com/fork.svg?user=usecodelee&repo=JavaScript-screenshot&style=default)](https://github.com/usecodelee/JavaScript-screenshot/fork) [![npm](https://img.shields.io/npm/v/js_screen_shots.svg)](https://www.npmjs.com/package/js_screen_shots) [![MIT Licence](https://badges.frapsoft.com/os/mit/mit.svg?v=103)](https://opensource.org/licenses/mit-license.php)
6+
7+
## 如何使用
8+
9+
1.安装
10+
11+
```bash
12+
# 使用npm安装
13+
npm install --save js_screen_shots
14+
```
15+
16+
2.导入
17+
18+
```javascript
19+
import all from '../node_modules/js_screen_shots'
20+
console.log(all);
21+
// {html2canvas: ƒ, Canvas2Image: {…}}
22+
// Canvas2Image: {saveAsImage: ƒ, saveAsPNG: ƒ, saveAsJPEG: ƒ, saveAsGIF: ƒ, saveAsBMP: ƒ, …}
23+
// html2canvas: ƒ html2canvas(element, conf)
24+
```
25+
26+
3.使用
27+
28+
可以看见all对象里面有两个方法:html2canvas和Canvas2Image。
29+
html2canvas的作用是把html标签转化为canvas元素。
30+
Canvas2Image的作用是把canvas元素转化为img元素。
31+
32+
## 参考文档
33+
34+
[html2canvas文档](http://html2canvas.hertzen.com/documentation)
35+
[Canvas2Image文档](https://github.com/hongru/canvas2image)

0 commit comments

Comments
 (0)