-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathbootstrap.html
More file actions
290 lines (222 loc) · 9.09 KB
/
bootstrap.html
File metadata and controls
290 lines (222 loc) · 9.09 KB
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
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8"utf-8">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="bootstrap.min.css" tppabs="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
<!-- Optional theme -->
<link rel="stylesheet" href="bootstrap-theme.min.css" tppabs="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap-theme.min.css">
<script src="build.js-v=6" tppabs="http://www.dropzonejs.com/js/build/build.js?v=6"></script>
<script>
var Dropzone = require("enyo-dropzone");
Dropzone.autoDiscover = false;
</script>
<style>
html, body {
height: 100%;
}
#actions {
margin: 2em 0;
}
/* Mimic table appearance */
div.table {
display: table;
}
div.table .file-row {
display: table-row;
}
div.table .file-row > div {
display: table-cell;
vertical-align: top;
border-top: 1px solid #ddd;
padding: 8px;
}
div.table .file-row:nth-child(odd) {
background: #f9f9f9;
}
/* The total progress gets shown by event listeners */
#total-progress {
opacity: 0;
transition: opacity 0.3s linear;
}
/* Hide the progress bar when finished */
#previews .file-row.dz-success .progress {
opacity: 0;
transition: opacity 0.3s linear;
}
/* Hide the delete button initially */
#previews .file-row .delete {
display: none;
}
/* Hide the start and cancel buttons and show the delete button */
#previews .file-row.dz-success .start,
#previews .file-row.dz-success .cancel {
display: none;
}
#previews .file-row.dz-success .delete {
display: block;
}
</style>
</head>
<body>
<div class="container" id="container">
<h1>Dropzone.js</h1>
<h2 class="lead">Configuration Demo</h2>
<ul class="nav nav-tabs">
<li><a href="index.htm" tppabs="http://www.dropzonejs.com/">Back to www.dropzonejs.com</a></li>
<li class="active"><a href="#">Bootstrap theme</a></li>
</ul>
<br>
<blockquote>
<p>
This is a bootstrap theme of Dropzone.js with a completely different user experience.<br />
It is a demonstration of the powerful configuration possibilities of <a href="index.htm" tppabs="http://www.dropzonejs.com/">Dropzone.js</a>.
You can make Dropzone.js look exactly how you want it to look and it's very easy to do so.
</p>
</blockquote>
<br>
<div id="actions" class="row">
<div class="col-lg-7">
<!-- The fileinput-button span is used to style the file input field as button -->
<span class="btn btn-success fileinput-button">
<i class="glyphicon glyphicon-plus"></i>
<span>Add files...</span>
</span>
<button type="submit" class="btn btn-primary start">
<i class="glyphicon glyphicon-upload"></i>
<span>Start upload</span>
</button>
<button type="reset" class="btn btn-warning cancel">
<i class="glyphicon glyphicon-ban-circle"></i>
<span>Cancel upload</span>
</button>
</div>
<div class="col-lg-5">
<!-- The global file processing state -->
<span class="fileupload-process">
<div id="total-progress" class="progress progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0">
<div class="progress-bar progress-bar-success" style="width:0%;" data-dz-uploadprogress></div>
</div>
</span>
</div>
</div>
<div class="table table-striped" class="files" id="previews">
<div id="template" class="file-row">
<!-- This is used as the file preview template -->
<div>
<span class="preview"><img data-dz-thumbnail /></span>
</div>
<div>
<p class="name" data-dz-name></p>
<strong class="error text-danger" data-dz-errormessage></strong>
</div>
<div>
<p class="size" data-dz-size></p>
<div class="progress progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0">
<div class="progress-bar progress-bar-success" style="width:0%;" data-dz-uploadprogress></div>
</div>
</div>
<div>
<button class="btn btn-primary start">
<i class="glyphicon glyphicon-upload"></i>
<span>Start</span>
</button>
<button data-dz-remove class="btn btn-warning cancel">
<i class="glyphicon glyphicon-ban-circle"></i>
<span>Cancel</span>
</button>
<button data-dz-remove class="btn btn-danger delete">
<i class="glyphicon glyphicon-trash"></i>
<span>Delete</span>
</button>
</div>
</div>
</div>
<script>
// Get the template HTML and remove it from the doument
var previewNode = document.querySelector("#template");
previewNode.id = "";
var previewTemplate = previewNode.parentNode.innerHTML;
previewNode.parentNode.removeChild(previewNode);
var myDropzone = new Dropzone(document.body, { // Make the whole body a dropzone
url: "http://www.torrentplease.com/dropzone.php", // Set the url
thumbnailWidth: 80,
thumbnailHeight: 80,
parallelUploads: 20,
previewTemplate: previewTemplate,
autoQueue: false, // Make sure the files aren't queued until manually added
previewsContainer: "#previews", // Define the container to display the previews
clickable: ".fileinput-button" // Define the element that should be used as click trigger to select files.
});
myDropzone.on("addedfile", function(file) {
// Hookup the start button
file.previewElement.querySelector(".start").onclick = function() { myDropzone.enqueueFile(file); };
});
// Update the total progress bar
myDropzone.on("totaluploadprogress", function(progress) {
document.querySelector("#total-progress .progress-bar").style.width = progress + "%";
});
myDropzone.on("sending", function(file) {
// Show the total progress bar when upload starts
document.querySelector("#total-progress").style.opacity = "1";
// And disable the start button
file.previewElement.querySelector(".start").setAttribute("disabled", "disabled");
});
// Hide the total progress bar when nothing's uploading anymore
myDropzone.on("queuecomplete", function(progress) {
document.querySelector("#total-progress").style.opacity = "0";
});
// Setup the buttons for all transfers
// The "add files" button doesn't need to be setup because the config
// `clickable` has already been specified.
document.querySelector("#actions .start").onclick = function() {
myDropzone.enqueueFiles(myDropzone.getFilesWithStatus(Dropzone.ADDED));
};
document.querySelector("#actions .cancel").onclick = function() {
myDropzone.removeAllFiles(true);
};
</script>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Advantages</h3>
</div>
<div class="panel-body">
<ul>
<li>No jQuery dependency</li>
<li>Extremely easy configuration so it looks exactly how you want it to look</li>
<li>Fast fast fast.</li>
</ul>
</div>
</div>
<br><br><br>
<h1>How it's done</h1>
<p>
For a complete understanding of how Dropzone.js works please see the
<a href="javascript:if(confirm('https://github.com/enyo/dropzone/wiki/How-to-theme-Dropzone \n\n该文件无法用 Teleport Ultra 下载, 因为 它是一个域或路径外部被设置为它的启始地址的地址。 \n\n你想在服务器上打开它?'))window.location='https://github.com/enyo/dropzone/wiki/How-to-theme-Dropzone'" tppabs="https://github.com/enyo/dropzone/wiki/How-to-theme-Dropzone">tutorial for Dropzone theming</a>
and visit the website
<a href="index.htm" tppabs="http://www.dropzonejs.com/">www.dropzonejs.com</a> to see the full
documentation.
</p>
<p>
Basically Dropzone just does all the heavy lifting for you, and exposes a
very high level API that you can use to build your user interface.<br />
The main feature of Dropzone is its events that you can listen to, so you
can react to every change.
</p>
<p>
This is the HTML that is used as template for every file dropped:
</p>
<script src="6ba8ce090590421bf134.js" tppabs="https://gist.github.com/enyo/6ba8ce090590421bf134.js"></script>
<p>
As you can see, it's just basic bootstrap HTML that defines how a file
should look like. The most important aspect, is that there are
<code>data-dz-*</code> markers in the markup, so that Dropzone can update the
elements automatically.
</p>
<p>
The JavaScript should be self explanatory:
</p>
<script src="0def0ce04d744fffcee4.js" tppabs="https://gist.github.com/enyo/0def0ce04d744fffcee4.js"></script>
</div>
</body>
</html>