-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
255 lines (225 loc) · 14.9 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
<!doctype html>
<html>
<head>
<title>阵营⑨宫格生成</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="generate9.css">
<script src="https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/jquery/2.1.1/jquery.min.js" integrity="sha384-V2vzHm/4vwRrnPN0dLbxh4hP4Hngnf/KafRjFODPm1QYGNdFQR3yZB5ueUG/wsKJ" crossorigin="anonymous"></script>
<script src="https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script src="https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/html2canvas/0.4.1/html2canvas.js" integrity="sha384-dSJH6/tmJd+UhySywZV7J4vn436Tfxnsxpza+g32DJkl1wLWUGVHZ8Ujt0D7XPug" crossorigin="anonymous"></script>
<script src="generate9.js"></script>
</head>
<body>
<div class="container-fluid">
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">阵营⑨宫格生成</a>
</div>
<div id="navbar" class="navbar-collapse collapse" aria-expanded="false" style="height: 1px;">
<ul class="nav navbar-nav">
<li class="active"><a href="#">生成图片版<span class="sr-only">(current)</span></a></li>
<li><a href="text.html">生成文字版</a></li>
<li><a href="lipu.html">逐渐离谱</a></li>
<li><a href="https://github.com/jerrylususu/9square">关于</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="https://github.com/jerrylususu">@Nekonull</a></li>
</ul>
</div>
</div>
</nav>
<div class="container">
<div class="alert alert-info alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">
×
</button>
请使用桌面版 Chrome 浏览器以获得最佳体验。
</div>
<table class="table table-bordered">
<input type="text" class="form-control" id="title" placeholder="标题(留空不填)" value="XXX的阵营九宫格">
<input type="text" class="form-control" id="creator" placeholder="作者(留空不填)" value="">
<caption>在此填入阵营九宫格内容</caption>
<tbody id="input_table">
<tr>
<td>
<div class="ins" onpaste="handlePaste(event)">
<input type="text" class="form-control" id="type" placeholder="守序善良" value="守序善良">
<input type="text" class="form-control" id="word" placeholder="文字">
<div class="file-box">
<img class="img-preview" width="100%" height="100%" />
<input type="file" name="file" id="input_file" accept="image/gif,image/jpeg,image/jpg,image/png,image/svg"
onchange="imgPreview(this)">
<button class="clear-img-btn" onclick="clearImage(event)">清除图片</button>
<small class="form-text text-muted">也可以点击上方文本框后,直接粘贴图片</small>
</div>
</div>
<td>
<div class="ins" onpaste="handlePaste(event)">
<input type="text" class="form-control" id="type" placeholder="中立善良" value="中立善良">
<input type="text" class="form-control" id="word" placeholder="文字">
<div class="file-box">
<img class="img-preview" width="100%" height="100%" />
<input type="file" name="file" id="input_file" accept="image/gif,image/jpeg,image/jpg,image/png,image/svg"
onchange="imgPreview(this)">
<button class="clear-img-btn" onclick="clearImage(event)">清除图片</button>
<small class="form-text text-muted">也可以点击上方文本框后,直接粘贴图片</small>
</div>
</div>
</td>
<td>
<div class="ins" onpaste="handlePaste(event)">
<input type="text" class="form-control" id="type" placeholder="混乱善良" value="混乱善良">
<input type="text" class="form-control" id="word" placeholder="文字">
<div class="file-box">
<img class="img-preview" width="100%" height="100%" />
<input type="file" name="file" id="input_file" accept="image/gif,image/jpeg,image/jpg,image/png,image/svg"
onchange="imgPreview(this)">
<button class="clear-img-btn" onclick="clearImage(event)">清除图片</button>
<small class="form-text text-muted">也可以点击上方文本框后,直接粘贴图片</small>
</div>
</div>
</td>
</tr>
<tr>
<td>
<div class="ins" onpaste="handlePaste(event)">
<input type="text" class="form-control" id="type" placeholder="守序中立" value="守序中立">
<input type="text" class="form-control" id="word" placeholder="文字">
<div class="file-box">
<img class="img-preview" width="100%" height="100%" />
<input type="file" name="file" id="input_file" accept="image/gif,image/jpeg,image/jpg,image/png,image/svg"
onchange="imgPreview(this)">
<button class="clear-img-btn" onclick="clearImage(event)">清除图片</button>
<small class="form-text text-muted">也可以点击上方文本框后,直接粘贴图片</small>
</div>
</div>
<td>
<div class="ins" onpaste="handlePaste(event)">
<input type="text" class="form-control" id="type" placeholder="绝对中立" value="绝对中立">
<input type="text" class="form-control" id="word" placeholder="文字">
<div class="file-box">
<img class="img-preview" width="100%" height="100%" />
<input type="file" name="file" id="input_file" accept="image/gif,image/jpeg,image/jpg,image/png,image/svg"
onchange="imgPreview(this)">
<button class="clear-img-btn" onclick="clearImage(event)">清除图片</button>
<small class="form-text text-muted">也可以点击上方文本框后,直接粘贴图片</small>
</div>
</div>
</td>
<td>
<div class="ins" onpaste="handlePaste(event)">
<input type="text" class="form-control" id="type" placeholder="混乱中立" value="混乱中立">
<input type="text" class="form-control" id="word" placeholder="文字">
<div class="file-box">
<img class="img-preview" width="100%" height="100%" />
<input type="file" name="file" id="input_file" accept="image/gif,image/jpeg,image/jpg,image/png,image/svg"
onchange="imgPreview(this)">
<button class="clear-img-btn" onclick="clearImage(event)">清除图片</button>
<small class="form-text text-muted">也可以点击上方文本框后,直接粘贴图片</small>
</div>
</div>
</td>
</tr>
<tr>
<td>
<div class="ins" onpaste="handlePaste(event)">
<input type="text" class="form-control" id="type" placeholder="守序邪恶" value="守序邪恶">
<input type="text" class="form-control" id="word" placeholder="文字">
<div class="file-box">
<img class="img-preview" width="100%" height="100%" />
<input type="file" name="file" id="input_file" accept="image/gif,image/jpeg,image/jpg,image/png,image/svg"
onchange="imgPreview(this)">
<button class="clear-img-btn" onclick="clearImage(event)">清除图片</button>
<small class="form-text text-muted">也可以点击上方文本框后,直接粘贴图片</small>
</div>
</div>
<td>
<div class="ins" onpaste="handlePaste(event)">
<input type="text" class="form-control" id="type" placeholder="中立邪恶" value="中立邪恶">
<input type="text" class="form-control" id="word" placeholder="文字">
<div class="file-box">
<img class="img-preview" width="100%" height="100%" />
<input type="file" name="file" id="input_file" accept="image/gif,image/jpeg,image/jpg,image/png,image/svg"
onchange="imgPreview(this)">
<button class="clear-img-btn" onclick="clearImage(event)">清除图片</button>
<small class="form-text text-muted">也可以点击上方文本框后,直接粘贴图片</small>
</div>
</div>
</td>
<td>
<div class="ins" onpaste="handlePaste(event)">
<input type="text" class="form-control" id="type" placeholder="混乱邪恶" value="混乱邪恶">
<input type="text" class="form-control" id="word" placeholder="文字">
<div class="file-box">
<img class="img-preview" width="100%" height="100%" />
<input type="file" name="file" id="input_file" accept="image/gif,image/jpeg,image/jpg,image/png,image/svg"
onchange="imgPreview(this)">
<button class="clear-img-btn" onclick="clearImage(event)">清除图片</button>
<small class="form-text text-muted">也可以点击上方文本框后,直接粘贴图片</small>
</div>
</div>
</td>
</tr>
</tbody>
</table>
<div class="container-fluid">
<form class="form-inline" role="form">
<div class="row">
<strong>基础属性 </strong><br>
高
<input type="number" class="form-control" id="height" placeholder="高" value="900">
宽
<input type="number" class="form-control" id="width" placeholder="宽" value="900"> <br>
<strong>字号 </strong><br>
标题
<input type="number" class="form-control" id="size0" placeholder="标题字号" value="60">
阵营
<input type="number" class="form-control" id="size1" placeholder="阵营字号" value="30">
说明文字
<input type="number" class="form-control" id="size2" placeholder="文字字号" value="16"> <br>
<strong>生成</strong><br>
<div class="checkbox">
<label>
<input type="checkbox" id="watermark" checked>水印
</label>
</div>
<button type="button" class="btn btn-primary" onclick="final_table();draw()">直接生成</button>
<button type="button" id="pro_mode_btn" class="btn btn-default"
onclick="toggle_pro_mode();console.log('here')">动手模式</button> <br><br>
<div id="pro_mode_div" style="display:none;">
<div class="alert alert-info alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">
×
</button>
<strong>生成原理:</strong>首先根据填入的信息动态生成一个 HTML 表格,通过 CSS 布局确定表格的相关样式,
再利用<code>html2canvas</code>库实现图片的生成。<br>
<strong>为什么叫做动手模式?</strong>在<code>动手模式</code>下,生成 HTML 表格和生成图片这两步被分离了。
因此你可以手动通过 Chrome 的开发者工具或其他你喜欢的工具对生成的 HTML 表格进行更为细致的调整,进而得到符合心意的图片。
</div>
<button type="button" class="btn btn-default" onclick="final_table()">1. 生成 HTML 表格</button>
<button type="button" class="btn btn-default" onclick="draw()">2. 生成图片</button>
</div>
</div>
</form>
</div>
</div>
<div class="container" id="canvas_container">
</div>
<div class="container" id="img_show_container">
<img id="final_img" style="display:block;" />
</div>
<div id="table_show" class="container">
</div>
</div><!-- /.container-fluid -->
</body>
</html>