card-mod-script 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/lib/javascript/decko/autosave.js.coffee +30 -0
- data/lib/javascript/decko/bridge.js.coffee +31 -0
- data/lib/javascript/decko/card_menu.js.coffee +26 -0
- data/lib/javascript/decko/components.js.coffee +51 -0
- data/lib/javascript/decko/decko.js.coffee +100 -0
- data/lib/javascript/decko/doubleclick.js.coffee +30 -0
- data/lib/javascript/decko/editor.js.coffee +55 -0
- data/lib/javascript/decko/filter.js.coffee +176 -0
- data/lib/javascript/decko/filter_items.js.coffee +128 -0
- data/lib/javascript/decko/filter_links.js.coffee +81 -0
- data/lib/javascript/decko/follow.js.coffee +22 -0
- data/lib/javascript/decko/layout.js.coffee +76 -0
- data/lib/javascript/decko/link_editor.js.coffee +61 -0
- data/lib/javascript/decko/mod.js.coffee +85 -0
- data/lib/javascript/decko/modal.js.coffee +110 -0
- data/lib/javascript/decko/name_editor.js.coffee +51 -0
- data/lib/javascript/decko/navbox.js.coffee +74 -0
- data/lib/javascript/decko/nest_editor.js.coffee +166 -0
- data/lib/javascript/decko/nest_editor_name.js.coffee +102 -0
- data/lib/javascript/decko/nest_editor_options.js.coffee +93 -0
- data/lib/javascript/decko/nest_editor_rules.js.coffee +3 -0
- data/lib/javascript/decko/overlay.js.coffee +57 -0
- data/lib/javascript/decko/recaptcha.js.coffee +19 -0
- data/lib/javascript/decko/selectable_filtered_content.js.coffee +12 -0
- data/lib/javascript/decko/slot.js.coffee +172 -0
- data/lib/javascript/decko/slot_ready.js.coffee +11 -0
- data/lib/javascript/decko/slotter.js.coffee +269 -0
- data/lib/javascript/decko/upload.js.coffee +57 -0
- data/lib/javascript/jquery-ui.js +10 -0
- data/lib/javascript/jquery.autosize.js +274 -0
- data/lib/javascript/jquery.iframe-transport.js +185 -0
- data/lib/javascript/script_html5shiv_printshiv.js +1 -0
- data/lib/javascript/script_pointer_config.js.coffee +80 -0
- data/lib/javascript/script_pointer_list_editor.js.coffee +67 -0
- data/lib/javascript/theme-textmate.js +130 -0
- data/set/abstract/script.rb +85 -0
- data/set/right/script.rb +19 -0
- data/set/self/01_script_libraries.rb +1 -0
- data/set/self/script.rb +1 -0
- data/set/self/script_decko.rb +12 -0
- data/set/self/script_editors.rb +1 -0
- data/set/self/script_html5shiv_printshiv.rb +11 -0
- data/set/self/script_jquery.rb +10 -0
- data/set/self/script_jquery_helper.rb +14 -0
- data/set/self/script_mods.rb +1 -0
- data/set/self/script_pointer_config.rb +9 -0
- data/set/type/coffee_script.rb +25 -0
- data/set/type/java_script.rb +9 -0
- data/vendor/jquery_file_upload/CONTRIBUTING.md +15 -0
- data/vendor/jquery_file_upload/LICENSE.txt +21 -0
- data/vendor/jquery_file_upload/README.md +107 -0
- data/vendor/jquery_file_upload/angularjs.html +211 -0
- data/vendor/jquery_file_upload/basic-plus.html +226 -0
- data/vendor/jquery_file_upload/basic.html +136 -0
- data/vendor/jquery_file_upload/bower-version-update.js +16 -0
- data/vendor/jquery_file_upload/bower.json +64 -0
- data/vendor/jquery_file_upload/cors/postmessage.html +75 -0
- data/vendor/jquery_file_upload/cors/result.html +24 -0
- data/vendor/jquery_file_upload/css/jquery-ui-demo-ie8.css +21 -0
- data/vendor/jquery_file_upload/css/jquery-ui-demo.css +67 -0
- data/vendor/jquery_file_upload/css/jquery.fileupload-noscript.css +22 -0
- data/vendor/jquery_file_upload/css/jquery.fileupload-ui-noscript.css +17 -0
- data/vendor/jquery_file_upload/css/jquery.fileupload-ui.css +57 -0
- data/vendor/jquery_file_upload/css/jquery.fileupload.css +37 -0
- data/vendor/jquery_file_upload/css/style.css +15 -0
- data/vendor/jquery_file_upload/img/loading.gif +0 -0
- data/vendor/jquery_file_upload/img/progressbar.gif +0 -0
- data/vendor/jquery_file_upload/index.html +255 -0
- data/vendor/jquery_file_upload/jquery-ui.html +252 -0
- data/vendor/jquery_file_upload/js/app.js +101 -0
- data/vendor/jquery_file_upload/js/cors/jquery.postmessage-transport.js +126 -0
- data/vendor/jquery_file_upload/js/cors/jquery.xdr-transport.js +89 -0
- data/vendor/jquery_file_upload/js/jquery.fileupload-angular.js +437 -0
- data/vendor/jquery_file_upload/js/jquery.fileupload-audio.js +113 -0
- data/vendor/jquery_file_upload/js/jquery.fileupload-image.js +326 -0
- data/vendor/jquery_file_upload/js/jquery.fileupload-jquery-ui.js +161 -0
- data/vendor/jquery_file_upload/js/jquery.fileupload-process.js +178 -0
- data/vendor/jquery_file_upload/js/jquery.fileupload-ui.js +714 -0
- data/vendor/jquery_file_upload/js/jquery.fileupload-validate.js +125 -0
- data/vendor/jquery_file_upload/js/jquery.fileupload-video.js +113 -0
- data/vendor/jquery_file_upload/js/jquery.fileupload.js +1486 -0
- data/vendor/jquery_file_upload/js/jquery.iframe-transport.js +224 -0
- data/vendor/jquery_file_upload/js/main.js +75 -0
- data/vendor/jquery_file_upload/js/vendor/jquery.ui.widget.js +748 -0
- data/vendor/jquery_file_upload/package.json +55 -0
- data/vendor/jquery_file_upload/server/gae-go/app.yaml +12 -0
- data/vendor/jquery_file_upload/server/gae-go/app/main.go +361 -0
- data/vendor/jquery_file_upload/server/gae-go/static/favicon.ico +0 -0
- data/vendor/jquery_file_upload/server/gae-go/static/robots.txt +2 -0
- data/vendor/jquery_file_upload/server/gae-python/app.yaml +17 -0
- data/vendor/jquery_file_upload/server/gae-python/main.py +204 -0
- data/vendor/jquery_file_upload/server/gae-python/static/favicon.ico +0 -0
- data/vendor/jquery_file_upload/server/gae-python/static/robots.txt +2 -0
- data/vendor/jquery_file_upload/server/php/Dockerfile +38 -0
- data/vendor/jquery_file_upload/server/php/UploadHandler.php +1411 -0
- data/vendor/jquery_file_upload/server/php/docker-compose.yml +9 -0
- data/vendor/jquery_file_upload/server/php/index.php +15 -0
- data/vendor/jquery_file_upload/test/index.html +172 -0
- data/vendor/jquery_file_upload/test/test.js +1292 -0
- data/vendor/jquery_rails/CHANGELOG.md +359 -0
- data/vendor/jquery_rails/CONTRIBUTING.md +132 -0
- data/vendor/jquery_rails/Gemfile +22 -0
- data/vendor/jquery_rails/MIT-LICENSE +21 -0
- data/vendor/jquery_rails/README.md +75 -0
- data/vendor/jquery_rails/Rakefile +59 -0
- data/vendor/jquery_rails/VERSIONS.md +62 -0
- data/vendor/jquery_rails/jquery-rails.gemspec +26 -0
- data/vendor/jquery_rails/lib/jquery-rails.rb +1 -0
- data/vendor/jquery_rails/lib/jquery/assert_select.rb +149 -0
- data/vendor/jquery_rails/lib/jquery/rails.rb +8 -0
- data/vendor/jquery_rails/lib/jquery/rails/engine.rb +6 -0
- data/vendor/jquery_rails/lib/jquery/rails/version.rb +9 -0
- data/vendor/jquery_rails/test/assert_select_jquery_test.rb +85 -0
- data/vendor/jquery_rails/test/test_helper.rb +6 -0
- data/vendor/jquery_rails/vendor/assets/javascripts/jquery.js +11008 -0
- data/vendor/jquery_rails/vendor/assets/javascripts/jquery.min.js +5 -0
- data/vendor/jquery_rails/vendor/assets/javascripts/jquery.min.map +1 -0
- data/vendor/jquery_rails/vendor/assets/javascripts/jquery2.js +9814 -0
- data/vendor/jquery_rails/vendor/assets/javascripts/jquery2.min.js +4 -0
- data/vendor/jquery_rails/vendor/assets/javascripts/jquery2.min.map +1 -0
- data/vendor/jquery_rails/vendor/assets/javascripts/jquery3.js +10364 -0
- data/vendor/jquery_rails/vendor/assets/javascripts/jquery3.min.js +2 -0
- data/vendor/jquery_rails/vendor/assets/javascripts/jquery3.min.map +1 -0
- data/vendor/jquery_rails/vendor/assets/javascripts/jquery_ujs.js +555 -0
- metadata +212 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
include_set Abstract::CodePointer
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
|
2
|
+
|
|
3
|
+
require "coffee-script"
|
|
4
|
+
|
|
5
|
+
include_set Abstract::Script
|
|
6
|
+
|
|
7
|
+
format :html do
|
|
8
|
+
def ace_mode
|
|
9
|
+
:coffee
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
format do
|
|
14
|
+
view :core do
|
|
15
|
+
compile_coffee _render_raw
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def compile_coffee script
|
|
19
|
+
::CoffeeScript.compile script
|
|
20
|
+
rescue => e
|
|
21
|
+
line_nr = e.to_s.match(/\[stdin\]:(\d*)/)&.capture(0)&.to_i
|
|
22
|
+
line = script.lines[line_nr - 1] if line_nr
|
|
23
|
+
raise Card::Error, "CoffeeScript::Error (#{card.name}): #{e.message}: #{line}"
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
Please follow these pull request guidelines:
|
|
2
|
+
|
|
3
|
+
1. Update your fork to the latest upstream version.
|
|
4
|
+
|
|
5
|
+
2. Follow the coding conventions of the original source files (indentation, spaces, brackets layout).
|
|
6
|
+
|
|
7
|
+
3. Code changes must pass JSHint validation with the `.jshintrc` settings of this project.
|
|
8
|
+
|
|
9
|
+
4. Code changes must pass the QUnit tests defined in the `test` folder.
|
|
10
|
+
|
|
11
|
+
5. New features should be covered by accompanying QUnit tests.
|
|
12
|
+
|
|
13
|
+
6. Keep your commits as atomic as possible, i.e. create a new commit for every single bug fix or feature added.
|
|
14
|
+
|
|
15
|
+
7. Always add meaningful commit messages.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright © 2010 Sebastian Tschan, https://blueimp.net
|
|
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.
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# jQuery File Upload Plugin
|
|
2
|
+
|
|
3
|
+
## Demo
|
|
4
|
+
[Demo File Upload](https://blueimp.github.io/jQuery-File-Upload/)
|
|
5
|
+
|
|
6
|
+
## Description
|
|
7
|
+
File Upload widget with multiple file selection, drag&drop support, progress bars, validation and preview images, audio and video for jQuery.
|
|
8
|
+
Supports cross-domain, chunked and resumable file uploads and client-side image resizing. Works with any server-side platform (PHP, Python, Ruby on Rails, Java, Node.js, Go etc.) that supports standard HTML form file uploads.
|
|
9
|
+
|
|
10
|
+
## Setup
|
|
11
|
+
* [How to setup the plugin on your website](https://github.com/blueimp/jQuery-File-Upload/wiki/Setup)
|
|
12
|
+
* [How to use only the basic plugin (minimal setup guide).](https://github.com/blueimp/jQuery-File-Upload/wiki/Basic-plugin)
|
|
13
|
+
|
|
14
|
+
## Features
|
|
15
|
+
* **Multiple file upload:**
|
|
16
|
+
Allows to select multiple files at once and upload them simultaneously.
|
|
17
|
+
* **Drag & Drop support:**
|
|
18
|
+
Allows to upload files by dragging them from your desktop or filemanager and dropping them on your browser window.
|
|
19
|
+
* **Upload progress bar:**
|
|
20
|
+
Shows a progress bar indicating the upload progress for individual files and for all uploads combined.
|
|
21
|
+
* **Cancelable uploads:**
|
|
22
|
+
Individual file uploads can be canceled to stop the upload progress.
|
|
23
|
+
* **Resumable uploads:**
|
|
24
|
+
Aborted uploads can be resumed with browsers supporting the Blob API.
|
|
25
|
+
* **Chunked uploads:**
|
|
26
|
+
Large files can be uploaded in smaller chunks with browsers supporting the Blob API.
|
|
27
|
+
* **Client-side image resizing:**
|
|
28
|
+
Images can be automatically resized on client-side with browsers supporting the required JS APIs.
|
|
29
|
+
* **Preview images, audio and video:**
|
|
30
|
+
A preview of image, audio and video files can be displayed before uploading with browsers supporting the required APIs.
|
|
31
|
+
* **No browser plugins (e.g. Adobe Flash) required:**
|
|
32
|
+
The implementation is based on open standards like HTML5 and JavaScript and requires no additional browser plugins.
|
|
33
|
+
* **Graceful fallback for legacy browsers:**
|
|
34
|
+
Uploads files via XMLHttpRequests if supported and uses iframes as fallback for legacy browsers.
|
|
35
|
+
* **HTML file upload form fallback:**
|
|
36
|
+
Allows progressive enhancement by using a standard HTML file upload form as widget element.
|
|
37
|
+
* **Cross-site file uploads:**
|
|
38
|
+
Supports uploading files to a different domain with cross-site XMLHttpRequests or iframe redirects.
|
|
39
|
+
* **Multiple plugin instances:**
|
|
40
|
+
Allows to use multiple plugin instances on the same webpage.
|
|
41
|
+
* **Customizable and extensible:**
|
|
42
|
+
Provides an API to set individual options and define callback methods for various upload events.
|
|
43
|
+
* **Multipart and file contents stream uploads:**
|
|
44
|
+
Files can be uploaded as standard "multipart/form-data" or file contents stream (HTTP PUT file upload).
|
|
45
|
+
* **Compatible with any server-side application platform:**
|
|
46
|
+
Works with any server-side platform (PHP, Python, Ruby on Rails, Java, Node.js, Go etc.) that supports standard HTML form file uploads.
|
|
47
|
+
|
|
48
|
+
## Requirements
|
|
49
|
+
|
|
50
|
+
### Mandatory requirements
|
|
51
|
+
* [jQuery](https://jquery.com/) v. 1.6+
|
|
52
|
+
* [jQuery UI widget factory](https://api.jqueryui.com/jQuery.widget/) v. 1.9+ (included): Required for the basic File Upload plugin, but very lightweight without any other dependencies from the jQuery UI suite.
|
|
53
|
+
* [jQuery Iframe Transport plugin](https://github.com/blueimp/jQuery-File-Upload/blob/master/js/jquery.iframe-transport.js) (included): Required for [browsers without XHR file upload support](https://github.com/blueimp/jQuery-File-Upload/wiki/Browser-support).
|
|
54
|
+
|
|
55
|
+
### Optional requirements
|
|
56
|
+
* [JavaScript Templates engine](https://github.com/blueimp/JavaScript-Templates) v. 2.5.4+: Used to render the selected and uploaded files for the Basic Plus UI and jQuery UI versions.
|
|
57
|
+
* [JavaScript Load Image library](https://github.com/blueimp/JavaScript-Load-Image) v. 1.13.0+: Required for the image previews and resizing functionality.
|
|
58
|
+
* [JavaScript Canvas to Blob polyfill](https://github.com/blueimp/JavaScript-Canvas-to-Blob) v. 2.1.1+:Required for the image previews and resizing functionality.
|
|
59
|
+
* [blueimp Gallery](https://github.com/blueimp/Gallery) v. 2.15.1+: Used to display the uploaded images in a lightbox.
|
|
60
|
+
* [Bootstrap](http://getbootstrap.com/) v. 3.2.0+
|
|
61
|
+
* [Glyphicons](http://glyphicons.com/)
|
|
62
|
+
|
|
63
|
+
The user interface of all versions, except the jQuery UI version, is built with [Bootstrap](http://getbootstrap.com/) and icons from [Glyphicons](http://glyphicons.com/).
|
|
64
|
+
|
|
65
|
+
### Cross-domain requirements
|
|
66
|
+
[Cross-domain File Uploads](https://github.com/blueimp/jQuery-File-Upload/wiki/Cross-domain-uploads) using the [Iframe Transport plugin](https://github.com/blueimp/jQuery-File-Upload/blob/master/js/jquery.iframe-transport.js) require a redirect back to the origin server to retrieve the upload results. The [example implementation](https://github.com/blueimp/jQuery-File-Upload/blob/master/js/main.js) makes use of [result.html](https://github.com/blueimp/jQuery-File-Upload/blob/master/cors/result.html) as a static redirect page for the origin server.
|
|
67
|
+
|
|
68
|
+
The repository also includes the [jQuery XDomainRequest Transport plugin](https://github.com/blueimp/jQuery-File-Upload/blob/master/js/cors/jquery.xdr-transport.js), which enables limited cross-domain AJAX requests in Microsoft Internet Explorer 8 and 9 (IE 10 supports cross-domain XHR requests).
|
|
69
|
+
The XDomainRequest object allows GET and POST requests only and doesn't support file uploads. It is used on the [Demo](https://blueimp.github.io/jQuery-File-Upload/) to delete uploaded files from the cross-domain demo file upload service.
|
|
70
|
+
|
|
71
|
+
### Custom Backends
|
|
72
|
+
|
|
73
|
+
You can add support for various backends by adhering to the specification [outlined here](https://github.com/blueimp/jQuery-File-Upload/wiki/JSON-Response).
|
|
74
|
+
|
|
75
|
+
## Browsers
|
|
76
|
+
|
|
77
|
+
### Desktop browsers
|
|
78
|
+
The File Upload plugin is regularly tested with the latest browser versions and supports the following minimal versions:
|
|
79
|
+
|
|
80
|
+
* Google Chrome
|
|
81
|
+
* Apple Safari 4.0+
|
|
82
|
+
* Mozilla Firefox 3.0+
|
|
83
|
+
* Opera 11.0+
|
|
84
|
+
* Microsoft Internet Explorer 6.0+
|
|
85
|
+
|
|
86
|
+
### Mobile browsers
|
|
87
|
+
The File Upload plugin has been tested with and supports the following mobile browsers:
|
|
88
|
+
|
|
89
|
+
* Apple Safari on iOS 6.0+
|
|
90
|
+
* Google Chrome on iOS 6.0+
|
|
91
|
+
* Google Chrome on Android 4.0+
|
|
92
|
+
* Default Browser on Android 2.3+
|
|
93
|
+
* Opera Mobile 12.0+
|
|
94
|
+
|
|
95
|
+
### Supported features
|
|
96
|
+
For a detailed overview of the features supported by each browser version, please have a look at the [Extended browser support information](https://github.com/blueimp/jQuery-File-Upload/wiki/Browser-support).
|
|
97
|
+
|
|
98
|
+
## Contributing
|
|
99
|
+
**Bug fixes** and **new features** can be proposed using [pull requests](https://github.com/blueimp/jQuery-File-Upload/pulls).
|
|
100
|
+
Please read the [contribution guidelines](https://github.com/blueimp/jQuery-File-Upload/blob/master/CONTRIBUTING.md) before submitting a pull request.
|
|
101
|
+
|
|
102
|
+
## Support
|
|
103
|
+
This project is actively maintained, but there is no official support channel.
|
|
104
|
+
If you have a question that another developer might help you with, please post to [Stack Overflow](http://stackoverflow.com/questions/tagged/blueimp+jquery+file-upload) and tag your question with `blueimp jquery file upload`.
|
|
105
|
+
|
|
106
|
+
## License
|
|
107
|
+
Released under the [MIT license](https://opensource.org/licenses/MIT).
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
<!DOCTYPE HTML>
|
|
2
|
+
<!--
|
|
3
|
+
/*
|
|
4
|
+
* jQuery File Upload Plugin AngularJS Demo
|
|
5
|
+
* https://github.com/blueimp/jQuery-File-Upload
|
|
6
|
+
*
|
|
7
|
+
* Copyright 2013, Sebastian Tschan
|
|
8
|
+
* https://blueimp.net
|
|
9
|
+
*
|
|
10
|
+
* Licensed under the MIT license:
|
|
11
|
+
* https://opensource.org/licenses/MIT
|
|
12
|
+
*/
|
|
13
|
+
-->
|
|
14
|
+
<html lang="en">
|
|
15
|
+
<head>
|
|
16
|
+
<!-- Force latest IE rendering engine or ChromeFrame if installed -->
|
|
17
|
+
<!--[if IE]>
|
|
18
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
19
|
+
<![endif]-->
|
|
20
|
+
<meta charset="utf-8">
|
|
21
|
+
<title>jQuery File Upload Demo - AngularJS version</title>
|
|
22
|
+
<meta name="description" content="File Upload widget with multiple file selection, drag&drop support, progress bars, validation and preview images, audio and video for AngularJS. Supports cross-domain, chunked and resumable file uploads and client-side image resizing. Works with any server-side platform (PHP, Python, Ruby on Rails, Java, Node.js, Go etc.) that supports standard HTML form file uploads.">
|
|
23
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
24
|
+
<!-- Bootstrap styles -->
|
|
25
|
+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
|
|
26
|
+
<!-- Generic page styles -->
|
|
27
|
+
<link rel="stylesheet" href="css/style.css">
|
|
28
|
+
<!-- blueimp Gallery styles -->
|
|
29
|
+
<link rel="stylesheet" href="https://blueimp.github.io/Gallery/css/blueimp-gallery.min.css">
|
|
30
|
+
<!-- CSS to style the file input field as button and adjust the Bootstrap progress bars -->
|
|
31
|
+
<link rel="stylesheet" href="css/jquery.fileupload.css">
|
|
32
|
+
<link rel="stylesheet" href="css/jquery.fileupload-ui.css">
|
|
33
|
+
<!-- CSS adjustments for browsers with JavaScript disabled -->
|
|
34
|
+
<noscript><link rel="stylesheet" href="css/jquery.fileupload-noscript.css"></noscript>
|
|
35
|
+
<noscript><link rel="stylesheet" href="css/jquery.fileupload-ui-noscript.css"></noscript>
|
|
36
|
+
<style>
|
|
37
|
+
/* Hide Angular JS elements before initializing */
|
|
38
|
+
.ng-cloak {
|
|
39
|
+
display: none;
|
|
40
|
+
}
|
|
41
|
+
</style>
|
|
42
|
+
</head>
|
|
43
|
+
<body>
|
|
44
|
+
<div class="navbar navbar-default navbar-fixed-top">
|
|
45
|
+
<div class="container">
|
|
46
|
+
<div class="navbar-header">
|
|
47
|
+
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-fixed-top .navbar-collapse">
|
|
48
|
+
<span class="icon-bar"></span>
|
|
49
|
+
<span class="icon-bar"></span>
|
|
50
|
+
<span class="icon-bar"></span>
|
|
51
|
+
</button>
|
|
52
|
+
<a class="navbar-brand" href="https://github.com/blueimp/jQuery-File-Upload">jQuery File Upload</a>
|
|
53
|
+
</div>
|
|
54
|
+
<div class="navbar-collapse collapse">
|
|
55
|
+
<ul class="nav navbar-nav">
|
|
56
|
+
<li><a href="https://github.com/blueimp/jQuery-File-Upload/tags">Download</a></li>
|
|
57
|
+
<li><a href="https://github.com/blueimp/jQuery-File-Upload">Source Code</a></li>
|
|
58
|
+
<li><a href="https://github.com/blueimp/jQuery-File-Upload/wiki">Documentation</a></li>
|
|
59
|
+
<li><a href="https://blueimp.net">© Sebastian Tschan</a></li>
|
|
60
|
+
</ul>
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
<div class="container">
|
|
65
|
+
<h1>jQuery File Upload Demo</h1>
|
|
66
|
+
<h2 class="lead">AngularJS version</h2>
|
|
67
|
+
<ul class="nav nav-tabs">
|
|
68
|
+
<li><a href="basic.html">Basic</a></li>
|
|
69
|
+
<li><a href="basic-plus.html">Basic Plus</a></li>
|
|
70
|
+
<li><a href="index.html">Basic Plus UI</a></li>
|
|
71
|
+
<li class="active"><a href="angularjs.html">AngularJS</a></li>
|
|
72
|
+
<li><a href="jquery-ui.html">jQuery UI</a></li>
|
|
73
|
+
</ul>
|
|
74
|
+
<br>
|
|
75
|
+
<blockquote>
|
|
76
|
+
<p>File Upload widget with multiple file selection, drag&drop support, progress bars, validation and preview images, audio and video for AngularJS.<br>
|
|
77
|
+
Supports cross-domain, chunked and resumable file uploads and client-side image resizing.<br>
|
|
78
|
+
Works with any server-side platform (PHP, Python, Ruby on Rails, Java, Node.js, Go etc.) that supports standard HTML form file uploads.</p>
|
|
79
|
+
</blockquote>
|
|
80
|
+
<br>
|
|
81
|
+
<!-- The file upload form used as target for the file upload widget -->
|
|
82
|
+
<form id="fileupload" action="https://jquery-file-upload.appspot.com/" method="POST" enctype="multipart/form-data" data-ng-app="demo" data-ng-controller="DemoFileUploadController" data-file-upload="options" data-ng-class="{'fileupload-processing': processing() || loadingFiles}">
|
|
83
|
+
<!-- Redirect browsers with JavaScript disabled to the origin page -->
|
|
84
|
+
<noscript><input type="hidden" name="redirect" value="https://blueimp.github.io/jQuery-File-Upload/"></noscript>
|
|
85
|
+
<!-- The fileupload-buttonbar contains buttons to add/delete files and start/cancel the upload -->
|
|
86
|
+
<div class="row fileupload-buttonbar">
|
|
87
|
+
<div class="col-lg-7">
|
|
88
|
+
<!-- The fileinput-button span is used to style the file input field as button -->
|
|
89
|
+
<span class="btn btn-success fileinput-button" ng-class="{disabled: disabled}">
|
|
90
|
+
<i class="glyphicon glyphicon-plus"></i>
|
|
91
|
+
<span>Add files...</span>
|
|
92
|
+
<input type="file" name="files[]" multiple ng-disabled="disabled">
|
|
93
|
+
</span>
|
|
94
|
+
<button type="button" class="btn btn-primary start" data-ng-click="submit()">
|
|
95
|
+
<i class="glyphicon glyphicon-upload"></i>
|
|
96
|
+
<span>Start upload</span>
|
|
97
|
+
</button>
|
|
98
|
+
<button type="button" class="btn btn-warning cancel" data-ng-click="cancel()">
|
|
99
|
+
<i class="glyphicon glyphicon-ban-circle"></i>
|
|
100
|
+
<span>Cancel upload</span>
|
|
101
|
+
</button>
|
|
102
|
+
<!-- The global file processing state -->
|
|
103
|
+
<span class="fileupload-process"></span>
|
|
104
|
+
</div>
|
|
105
|
+
<!-- The global progress state -->
|
|
106
|
+
<div class="col-lg-5 fade" data-ng-class="{in: active()}">
|
|
107
|
+
<!-- The global progress bar -->
|
|
108
|
+
<div class="progress progress-striped active" data-file-upload-progress="progress()"><div class="progress-bar progress-bar-success" data-ng-style="{width: num + '%'}"></div></div>
|
|
109
|
+
<!-- The extended global progress state -->
|
|
110
|
+
<div class="progress-extended"> </div>
|
|
111
|
+
</div>
|
|
112
|
+
</div>
|
|
113
|
+
<!-- The table listing the files available for upload/download -->
|
|
114
|
+
<table class="table table-striped files ng-cloak">
|
|
115
|
+
<tr data-ng-repeat="file in queue" data-ng-class="{'processing': file.$processing()}">
|
|
116
|
+
<td data-ng-switch data-on="!!file.thumbnailUrl">
|
|
117
|
+
<div class="preview" data-ng-switch-when="true">
|
|
118
|
+
<a data-ng-href="{{file.url}}" title="{{file.name}}" download="{{file.name}}" data-gallery><img data-ng-src="{{file.thumbnailUrl}}" alt=""></a>
|
|
119
|
+
</div>
|
|
120
|
+
<div class="preview" data-ng-switch-default data-file-upload-preview="file"></div>
|
|
121
|
+
</td>
|
|
122
|
+
<td>
|
|
123
|
+
<p class="name" data-ng-switch data-on="!!file.url">
|
|
124
|
+
<span data-ng-switch-when="true" data-ng-switch data-on="!!file.thumbnailUrl">
|
|
125
|
+
<a data-ng-switch-when="true" data-ng-href="{{file.url}}" title="{{file.name}}" download="{{file.name}}" data-gallery>{{file.name}}</a>
|
|
126
|
+
<a data-ng-switch-default data-ng-href="{{file.url}}" title="{{file.name}}" download="{{file.name}}">{{file.name}}</a>
|
|
127
|
+
</span>
|
|
128
|
+
<span data-ng-switch-default>{{file.name}}</span>
|
|
129
|
+
</p>
|
|
130
|
+
<strong data-ng-show="file.error" class="error text-danger">{{file.error}}</strong>
|
|
131
|
+
</td>
|
|
132
|
+
<td>
|
|
133
|
+
<p class="size">{{file.size | formatFileSize}}</p>
|
|
134
|
+
<div class="progress progress-striped active fade" data-ng-class="{pending: 'in'}[file.$state()]" data-file-upload-progress="file.$progress()"><div class="progress-bar progress-bar-success" data-ng-style="{width: num + '%'}"></div></div>
|
|
135
|
+
</td>
|
|
136
|
+
<td>
|
|
137
|
+
<button type="button" class="btn btn-primary start" data-ng-click="file.$submit()" data-ng-hide="!file.$submit || options.autoUpload" data-ng-disabled="file.$state() == 'pending' || file.$state() == 'rejected'">
|
|
138
|
+
<i class="glyphicon glyphicon-upload"></i>
|
|
139
|
+
<span>Start</span>
|
|
140
|
+
</button>
|
|
141
|
+
<button type="button" class="btn btn-warning cancel" data-ng-click="file.$cancel()" data-ng-hide="!file.$cancel">
|
|
142
|
+
<i class="glyphicon glyphicon-ban-circle"></i>
|
|
143
|
+
<span>Cancel</span>
|
|
144
|
+
</button>
|
|
145
|
+
<button data-ng-controller="FileDestroyController" type="button" class="btn btn-danger destroy" data-ng-click="file.$destroy()" data-ng-hide="!file.$destroy">
|
|
146
|
+
<i class="glyphicon glyphicon-trash"></i>
|
|
147
|
+
<span>Delete</span>
|
|
148
|
+
</button>
|
|
149
|
+
</td>
|
|
150
|
+
</tr>
|
|
151
|
+
</table>
|
|
152
|
+
</form>
|
|
153
|
+
<br>
|
|
154
|
+
<div class="panel panel-default">
|
|
155
|
+
<div class="panel-heading">
|
|
156
|
+
<h3 class="panel-title">Demo Notes</h3>
|
|
157
|
+
</div>
|
|
158
|
+
<div class="panel-body">
|
|
159
|
+
<ul>
|
|
160
|
+
<li>The maximum file size for uploads in this demo is <strong>999 KB</strong> (default file size is unlimited).</li>
|
|
161
|
+
<li>Only image files (<strong>JPG, GIF, PNG</strong>) are allowed in this demo (by default there is no file type restriction).</li>
|
|
162
|
+
<li>Uploaded files will be deleted automatically after <strong>5 minutes or less</strong> (demo files are stored in memory).</li>
|
|
163
|
+
<li>You can <strong>drag & drop</strong> files from your desktop on this webpage (see <a href="https://github.com/blueimp/jQuery-File-Upload/wiki/Browser-support">Browser support</a>).</li>
|
|
164
|
+
<li>Please refer to the <a href="https://github.com/blueimp/jQuery-File-Upload">project website</a> and <a href="https://github.com/blueimp/jQuery-File-Upload/wiki">documentation</a> for more information.</li>
|
|
165
|
+
<li>Built with the <a href="http://getbootstrap.com/">Bootstrap</a> CSS framework and Icons from <a href="http://glyphicons.com/">Glyphicons</a>.</li>
|
|
166
|
+
</ul>
|
|
167
|
+
</div>
|
|
168
|
+
</div>
|
|
169
|
+
</div>
|
|
170
|
+
<!-- The blueimp Gallery widget -->
|
|
171
|
+
<div id="blueimp-gallery" class="blueimp-gallery blueimp-gallery-controls" data-filter=":even">
|
|
172
|
+
<div class="slides"></div>
|
|
173
|
+
<h3 class="title"></h3>
|
|
174
|
+
<a class="prev">‹</a>
|
|
175
|
+
<a class="next">›</a>
|
|
176
|
+
<a class="close">×</a>
|
|
177
|
+
<a class="play-pause"></a>
|
|
178
|
+
<ol class="indicator"></ol>
|
|
179
|
+
</div>
|
|
180
|
+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
|
|
181
|
+
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js"></script>
|
|
182
|
+
<!-- The jQuery UI widget factory, can be omitted if jQuery UI is already included -->
|
|
183
|
+
<script src="js/vendor/jquery.ui.widget.js"></script>
|
|
184
|
+
<!-- The Load Image plugin is included for the preview images and image resizing functionality -->
|
|
185
|
+
<script src="https://blueimp.github.io/JavaScript-Load-Image/js/load-image.all.min.js"></script>
|
|
186
|
+
<!-- The Canvas to Blob plugin is included for image resizing functionality -->
|
|
187
|
+
<script src="https://blueimp.github.io/JavaScript-Canvas-to-Blob/js/canvas-to-blob.min.js"></script>
|
|
188
|
+
<!-- Bootstrap JS is not required, but included for the responsive demo navigation -->
|
|
189
|
+
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
|
|
190
|
+
<!-- blueimp Gallery script -->
|
|
191
|
+
<script src="https://blueimp.github.io/Gallery/js/jquery.blueimp-gallery.min.js"></script>
|
|
192
|
+
<!-- The Iframe Transport is required for browsers without support for XHR file uploads -->
|
|
193
|
+
<script src="js/jquery.iframe-transport.js"></script>
|
|
194
|
+
<!-- The basic File Upload plugin -->
|
|
195
|
+
<script src="js/jquery.fileupload.js"></script>
|
|
196
|
+
<!-- The File Upload processing plugin -->
|
|
197
|
+
<script src="js/jquery.fileupload-process.js"></script>
|
|
198
|
+
<!-- The File Upload image preview & resize plugin -->
|
|
199
|
+
<script src="js/jquery.fileupload-image.js"></script>
|
|
200
|
+
<!-- The File Upload audio preview plugin -->
|
|
201
|
+
<script src="js/jquery.fileupload-audio.js"></script>
|
|
202
|
+
<!-- The File Upload video preview plugin -->
|
|
203
|
+
<script src="js/jquery.fileupload-video.js"></script>
|
|
204
|
+
<!-- The File Upload validation plugin -->
|
|
205
|
+
<script src="js/jquery.fileupload-validate.js"></script>
|
|
206
|
+
<!-- The File Upload Angular JS module -->
|
|
207
|
+
<script src="js/jquery.fileupload-angular.js"></script>
|
|
208
|
+
<!-- The main application script -->
|
|
209
|
+
<script src="js/app.js"></script>
|
|
210
|
+
</body>
|
|
211
|
+
</html>
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
<!DOCTYPE HTML>
|
|
2
|
+
<!--
|
|
3
|
+
/*
|
|
4
|
+
* jQuery File Upload Plugin Basic Plus Demo
|
|
5
|
+
* https://github.com/blueimp/jQuery-File-Upload
|
|
6
|
+
*
|
|
7
|
+
* Copyright 2013, Sebastian Tschan
|
|
8
|
+
* https://blueimp.net
|
|
9
|
+
*
|
|
10
|
+
* Licensed under the MIT license:
|
|
11
|
+
* https://opensource.org/licenses/MIT
|
|
12
|
+
*/
|
|
13
|
+
-->
|
|
14
|
+
<html lang="en">
|
|
15
|
+
<head>
|
|
16
|
+
<!-- Force latest IE rendering engine or ChromeFrame if installed -->
|
|
17
|
+
<!--[if IE]><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"><![endif]-->
|
|
18
|
+
<meta charset="utf-8">
|
|
19
|
+
<title>jQuery File Upload Demo - Basic Plus version</title>
|
|
20
|
+
<meta name="description" content="File Upload widget with multiple file selection, drag&drop support, progress bar, validation and preview images, audio and video for jQuery. Supports cross-domain, chunked and resumable file uploads. Works with any server-side platform (Google App Engine, PHP, Python, Ruby on Rails, Java, etc.) that supports standard HTML form file uploads.">
|
|
21
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
22
|
+
<!-- Bootstrap styles -->
|
|
23
|
+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
|
|
24
|
+
<!-- Generic page styles -->
|
|
25
|
+
<link rel="stylesheet" href="css/style.css">
|
|
26
|
+
<!-- CSS to style the file input field as button and adjust the Bootstrap progress bars -->
|
|
27
|
+
<link rel="stylesheet" href="css/jquery.fileupload.css">
|
|
28
|
+
</head>
|
|
29
|
+
<body>
|
|
30
|
+
<div class="navbar navbar-default navbar-fixed-top">
|
|
31
|
+
<div class="container">
|
|
32
|
+
<div class="navbar-header">
|
|
33
|
+
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-fixed-top .navbar-collapse">
|
|
34
|
+
<span class="icon-bar"></span>
|
|
35
|
+
<span class="icon-bar"></span>
|
|
36
|
+
<span class="icon-bar"></span>
|
|
37
|
+
</button>
|
|
38
|
+
<a class="navbar-brand" href="https://github.com/blueimp/jQuery-File-Upload">jQuery File Upload</a>
|
|
39
|
+
</div>
|
|
40
|
+
<div class="navbar-collapse collapse">
|
|
41
|
+
<ul class="nav navbar-nav">
|
|
42
|
+
<li><a href="https://github.com/blueimp/jQuery-File-Upload/tags">Download</a></li>
|
|
43
|
+
<li><a href="https://github.com/blueimp/jQuery-File-Upload">Source Code</a></li>
|
|
44
|
+
<li><a href="https://github.com/blueimp/jQuery-File-Upload/wiki">Documentation</a></li>
|
|
45
|
+
<li><a href="https://blueimp.net">© Sebastian Tschan</a></li>
|
|
46
|
+
</ul>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
<div class="container">
|
|
51
|
+
<h1>jQuery File Upload Demo</h1>
|
|
52
|
+
<h2 class="lead">Basic Plus version</h2>
|
|
53
|
+
<ul class="nav nav-tabs">
|
|
54
|
+
<li><a href="basic.html">Basic</a></li>
|
|
55
|
+
<li class="active"><a href="basic-plus.html">Basic Plus</a></li>
|
|
56
|
+
<li><a href="index.html">Basic Plus UI</a></li>
|
|
57
|
+
<li><a href="angularjs.html">AngularJS</a></li>
|
|
58
|
+
<li><a href="jquery-ui.html">jQuery UI</a></li>
|
|
59
|
+
</ul>
|
|
60
|
+
<br>
|
|
61
|
+
<blockquote>
|
|
62
|
+
<p>File Upload widget with multiple file selection, drag&drop support, progress bar, validation and preview images, audio and video for jQuery.<br>
|
|
63
|
+
Supports cross-domain, chunked and resumable file uploads and client-side image resizing.<br>
|
|
64
|
+
Works with any server-side platform (PHP, Python, Ruby on Rails, Java, Node.js, Go etc.) that supports standard HTML form file uploads.</p>
|
|
65
|
+
</blockquote>
|
|
66
|
+
<br>
|
|
67
|
+
<!-- The fileinput-button span is used to style the file input field as button -->
|
|
68
|
+
<span class="btn btn-success fileinput-button">
|
|
69
|
+
<i class="glyphicon glyphicon-plus"></i>
|
|
70
|
+
<span>Add files...</span>
|
|
71
|
+
<!-- The file input field used as target for the file upload widget -->
|
|
72
|
+
<input id="fileupload" type="file" name="files[]" multiple>
|
|
73
|
+
</span>
|
|
74
|
+
<br>
|
|
75
|
+
<br>
|
|
76
|
+
<!-- The global progress bar -->
|
|
77
|
+
<div id="progress" class="progress">
|
|
78
|
+
<div class="progress-bar progress-bar-success"></div>
|
|
79
|
+
</div>
|
|
80
|
+
<!-- The container for the uploaded files -->
|
|
81
|
+
<div id="files" class="files"></div>
|
|
82
|
+
<br>
|
|
83
|
+
<div class="panel panel-default">
|
|
84
|
+
<div class="panel-heading">
|
|
85
|
+
<h3 class="panel-title">Demo Notes</h3>
|
|
86
|
+
</div>
|
|
87
|
+
<div class="panel-body">
|
|
88
|
+
<ul>
|
|
89
|
+
<li>The maximum file size for uploads in this demo is <strong>999 KB</strong> (default file size is unlimited).</li>
|
|
90
|
+
<li>Only image files (<strong>JPG, GIF, PNG</strong>) are allowed in this demo (by default there is no file type restriction).</li>
|
|
91
|
+
<li>Uploaded files will be deleted automatically after <strong>5 minutes or less</strong> (demo files are stored in memory).</li>
|
|
92
|
+
<li>You can <strong>drag & drop</strong> files from your desktop on this webpage (see <a href="https://github.com/blueimp/jQuery-File-Upload/wiki/Browser-support">Browser support</a>).</li>
|
|
93
|
+
<li>Please refer to the <a href="https://github.com/blueimp/jQuery-File-Upload">project website</a> and <a href="https://github.com/blueimp/jQuery-File-Upload/wiki">documentation</a> for more information.</li>
|
|
94
|
+
<li>Built with the <a href="http://getbootstrap.com/">Bootstrap</a> CSS framework and Icons from <a href="http://glyphicons.com/">Glyphicons</a>.</li>
|
|
95
|
+
</ul>
|
|
96
|
+
</div>
|
|
97
|
+
</div>
|
|
98
|
+
</div>
|
|
99
|
+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
|
|
100
|
+
<!-- The jQuery UI widget factory, can be omitted if jQuery UI is already included -->
|
|
101
|
+
<script src="js/vendor/jquery.ui.widget.js"></script>
|
|
102
|
+
<!-- The Load Image plugin is included for the preview images and image resizing functionality -->
|
|
103
|
+
<script src="https://blueimp.github.io/JavaScript-Load-Image/js/load-image.all.min.js"></script>
|
|
104
|
+
<!-- The Canvas to Blob plugin is included for image resizing functionality -->
|
|
105
|
+
<script src="https://blueimp.github.io/JavaScript-Canvas-to-Blob/js/canvas-to-blob.min.js"></script>
|
|
106
|
+
<!-- Bootstrap JS is not required, but included for the responsive demo navigation -->
|
|
107
|
+
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
|
|
108
|
+
<!-- The Iframe Transport is required for browsers without support for XHR file uploads -->
|
|
109
|
+
<script src="js/jquery.iframe-transport.js"></script>
|
|
110
|
+
<!-- The basic File Upload plugin -->
|
|
111
|
+
<script src="js/jquery.fileupload.js"></script>
|
|
112
|
+
<!-- The File Upload processing plugin -->
|
|
113
|
+
<script src="js/jquery.fileupload-process.js"></script>
|
|
114
|
+
<!-- The File Upload image preview & resize plugin -->
|
|
115
|
+
<script src="js/jquery.fileupload-image.js"></script>
|
|
116
|
+
<!-- The File Upload audio preview plugin -->
|
|
117
|
+
<script src="js/jquery.fileupload-audio.js"></script>
|
|
118
|
+
<!-- The File Upload video preview plugin -->
|
|
119
|
+
<script src="js/jquery.fileupload-video.js"></script>
|
|
120
|
+
<!-- The File Upload validation plugin -->
|
|
121
|
+
<script src="js/jquery.fileupload-validate.js"></script>
|
|
122
|
+
<script>
|
|
123
|
+
/*jslint unparam: true, regexp: true */
|
|
124
|
+
/*global window, $ */
|
|
125
|
+
$(function () {
|
|
126
|
+
'use strict';
|
|
127
|
+
// Change this to the location of your server-side upload handler:
|
|
128
|
+
var url = window.location.hostname === 'blueimp.github.io' ?
|
|
129
|
+
'//jquery-file-upload.appspot.com/' : 'server/php/',
|
|
130
|
+
uploadButton = $('<button/>')
|
|
131
|
+
.addClass('btn btn-primary')
|
|
132
|
+
.prop('disabled', true)
|
|
133
|
+
.text('Processing...')
|
|
134
|
+
.on('click', function () {
|
|
135
|
+
var $this = $(this),
|
|
136
|
+
data = $this.data();
|
|
137
|
+
$this
|
|
138
|
+
.off('click')
|
|
139
|
+
.text('Abort')
|
|
140
|
+
.on('click', function () {
|
|
141
|
+
$this.remove();
|
|
142
|
+
data.abort();
|
|
143
|
+
});
|
|
144
|
+
data.submit().always(function () {
|
|
145
|
+
$this.remove();
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
$('#fileupload').fileupload({
|
|
149
|
+
url: url,
|
|
150
|
+
dataType: 'json',
|
|
151
|
+
autoUpload: false,
|
|
152
|
+
acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i,
|
|
153
|
+
maxFileSize: 999000,
|
|
154
|
+
// Enable image resizing, except for Android and Opera,
|
|
155
|
+
// which actually support image resizing, but fail to
|
|
156
|
+
// send Blob objects via XHR requests:
|
|
157
|
+
disableImageResize: /Android(?!.*Chrome)|Opera/
|
|
158
|
+
.test(window.navigator.userAgent),
|
|
159
|
+
previewMaxWidth: 100,
|
|
160
|
+
previewMaxHeight: 100,
|
|
161
|
+
previewCrop: true
|
|
162
|
+
}).on('fileuploadadd', function (e, data) {
|
|
163
|
+
data.context = $('<div/>').appendTo('#files');
|
|
164
|
+
$.each(data.files, function (index, file) {
|
|
165
|
+
var node = $('<p/>')
|
|
166
|
+
.append($('<span/>').text(file.name));
|
|
167
|
+
if (!index) {
|
|
168
|
+
node
|
|
169
|
+
.append('<br>')
|
|
170
|
+
.append(uploadButton.clone(true).data(data));
|
|
171
|
+
}
|
|
172
|
+
node.appendTo(data.context);
|
|
173
|
+
});
|
|
174
|
+
}).on('fileuploadprocessalways', function (e, data) {
|
|
175
|
+
var index = data.index,
|
|
176
|
+
file = data.files[index],
|
|
177
|
+
node = $(data.context.children()[index]);
|
|
178
|
+
if (file.preview) {
|
|
179
|
+
node
|
|
180
|
+
.prepend('<br>')
|
|
181
|
+
.prepend(file.preview);
|
|
182
|
+
}
|
|
183
|
+
if (file.error) {
|
|
184
|
+
node
|
|
185
|
+
.append('<br>')
|
|
186
|
+
.append($('<span class="text-danger"/>').text(file.error));
|
|
187
|
+
}
|
|
188
|
+
if (index + 1 === data.files.length) {
|
|
189
|
+
data.context.find('button')
|
|
190
|
+
.text('Upload')
|
|
191
|
+
.prop('disabled', !!data.files.error);
|
|
192
|
+
}
|
|
193
|
+
}).on('fileuploadprogressall', function (e, data) {
|
|
194
|
+
var progress = parseInt(data.loaded / data.total * 100, 10);
|
|
195
|
+
$('#progress .progress-bar').css(
|
|
196
|
+
'width',
|
|
197
|
+
progress + '%'
|
|
198
|
+
);
|
|
199
|
+
}).on('fileuploaddone', function (e, data) {
|
|
200
|
+
$.each(data.result.files, function (index, file) {
|
|
201
|
+
if (file.url) {
|
|
202
|
+
var link = $('<a>')
|
|
203
|
+
.attr('target', '_blank')
|
|
204
|
+
.prop('href', file.url);
|
|
205
|
+
$(data.context.children()[index])
|
|
206
|
+
.wrap(link);
|
|
207
|
+
} else if (file.error) {
|
|
208
|
+
var error = $('<span class="text-danger"/>').text(file.error);
|
|
209
|
+
$(data.context.children()[index])
|
|
210
|
+
.append('<br>')
|
|
211
|
+
.append(error);
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
}).on('fileuploadfail', function (e, data) {
|
|
215
|
+
$.each(data.files, function (index) {
|
|
216
|
+
var error = $('<span class="text-danger"/>').text('File upload failed.');
|
|
217
|
+
$(data.context.children()[index])
|
|
218
|
+
.append('<br>')
|
|
219
|
+
.append(error);
|
|
220
|
+
});
|
|
221
|
+
}).prop('disabled', !$.support.fileInput)
|
|
222
|
+
.parent().addClass($.support.fileInput ? undefined : 'disabled');
|
|
223
|
+
});
|
|
224
|
+
</script>
|
|
225
|
+
</body>
|
|
226
|
+
</html>
|