Version Description
- Fix: Upgrade jquery-fileupload to v9.32.0
- Fix: Set frame origin on pages where shortcodes are embedded
Download this release
Release Info
Developer | automattic |
Plugin | WP Job Manager |
Version | 1.33.3 |
Comparing to | |
See all releases |
Code changes from version 1.33.2 to 1.33.3
- assets/js/jquery-fileupload/jquery.fileupload.js +1518 -1485
- assets/js/jquery-fileupload/jquery.iframe-transport.js +204 -204
- changelog.txt +4 -0
- includes/class-wp-job-manager.php +22 -4
- languages/wp-job-manager.pot +5 -5
- readme.txt +4 -1
- wp-job-manager.php +2 -2
assets/js/jquery-fileupload/jquery.fileupload.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
/*
|
2 |
-
* jQuery File Upload Plugin v9.
|
3 |
* https://github.com/blueimp/jQuery-File-Upload
|
4 |
*
|
5 |
* Copyright 2010, Sebastian Tschan
|
@@ -13,1490 +13,1523 @@
|
|
13 |
/* global define, require, window, document, location, Blob, FormData */
|
14 |
|
15 |
;(function (factory) {
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
}(function ($) {
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
-
|
799 |
-
|
800 |
-
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
-
|
805 |
-
|
806 |
-
|
807 |
-
|
808 |
-
|
809 |
-
|
810 |
-
|
811 |
-
|
812 |
-
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
|
820 |
-
|
821 |
-
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
|
826 |
-
|
827 |
-
|
828 |
-
|
829 |
-
|
830 |
-
|
831 |
-
|
832 |
-
|
833 |
-
|
834 |
-
|
835 |
-
|
836 |
-
|
837 |
-
|
838 |
-
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
|
843 |
-
|
844 |
-
|
845 |
-
|
846 |
-
|
847 |
-
|
848 |
-
|
849 |
-
|
850 |
-
|
851 |
-
|
852 |
-
|
853 |
-
|
854 |
-
|
855 |
-
|
856 |
-
|
857 |
-
|
858 |
-
|
859 |
-
|
860 |
-
|
861 |
-
|
862 |
-
|
863 |
-
|
864 |
-
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
|
869 |
-
|
870 |
-
|
871 |
-
|
872 |
-
|
873 |
-
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
-
|
893 |
-
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
-
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
-
|
916 |
-
|
917 |
-
|
918 |
-
|
919 |
-
|
920 |
-
|
921 |
-
|
922 |
-
|
923 |
-
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
|
928 |
-
|
929 |
-
|
930 |
-
|
931 |
-
|
932 |
-
|
933 |
-
|
934 |
-
|
935 |
-
|
936 |
-
|
937 |
-
|
938 |
-
|
939 |
-
|
940 |
-
|
941 |
-
|
942 |
-
|
943 |
-
|
944 |
-
|
945 |
-
|
946 |
-
|
947 |
-
|
948 |
-
|
949 |
-
|
950 |
-
|
951 |
-
|
952 |
-
|
953 |
-
|
954 |
-
|
955 |
-
|
956 |
-
|
957 |
-
|
958 |
-
|
959 |
-
|
960 |
-
|
961 |
-
|
962 |
-
|
963 |
-
|
964 |
-
|
965 |
-
|
966 |
-
|
967 |
-
|
968 |
-
|
969 |
-
|
970 |
-
|
971 |
-
|
972 |
-
|
973 |
-
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
|
978 |
-
|
979 |
-
|
980 |
-
|
981 |
-
|
982 |
-
|
983 |
-
|
984 |
-
|
985 |
-
|
986 |
-
|
987 |
-
|
988 |
-
|
989 |
-
|
990 |
-
|
991 |
-
|
992 |
-
|
993 |
-
|
994 |
-
|
995 |
-
|
996 |
-
|
997 |
-
|
998 |
-
|
999 |
-
|
1000 |
-
|
1001 |
-
|
1002 |
-
|
1003 |
-
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
1008 |
-
|
1009 |
-
|
1010 |
-
|
1011 |
-
|
1012 |
-
|
1013 |
-
|
1014 |
-
|
1015 |
-
|
1016 |
-
|
1017 |
-
|
1018 |
-
|
1019 |
-
|
1020 |
-
|
1021 |
-
|
1022 |
-
|
1023 |
-
|
1024 |
-
|
1025 |
-
|
1026 |
-
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
1031 |
-
|
1032 |
-
|
1033 |
-
|
1034 |
-
|
1035 |
-
|
1036 |
-
|
1037 |
-
|
1038 |
-
|
1039 |
-
|
1040 |
-
|
1041 |
-
|
1042 |
-
|
1043 |
-
|
1044 |
-
|
1045 |
-
|
1046 |
-
|
1047 |
-
|
1048 |
-
|
1049 |
-
|
1050 |
-
|
1051 |
-
|
1052 |
-
|
1053 |
-
|
1054 |
-
|
1055 |
-
|
1056 |
-
|
1057 |
-
|
1058 |
-
|
1059 |
-
|
1060 |
-
|
1061 |
-
|
1062 |
-
|
1063 |
-
|
1064 |
-
|
1065 |
-
|
1066 |
-
|
1067 |
-
|
1068 |
-
|
1069 |
-
|
1070 |
-
|
1071 |
-
|
1072 |
-
|
1073 |
-
|
1074 |
-
|
1075 |
-
|
1076 |
-
|
1077 |
-
|
1078 |
-
|
1079 |
-
|
1080 |
-
|
1081 |
-
|
1082 |
-
|
1083 |
-
|
1084 |
-
|
1085 |
-
|
1086 |
-
|
1087 |
-
|
1088 |
-
|
1089 |
-
|
1090 |
-
|
1091 |
-
|
1092 |
-
|
1093 |
-
|
1094 |
-
|
1095 |
-
|
1096 |
-
|
1097 |
-
|
1098 |
-
|
1099 |
-
|
1100 |
-
|
1101 |
-
|
1102 |
-
|
1103 |
-
|
1104 |
-
|
1105 |
-
|
1106 |
-
|
1107 |
-
|
1108 |
-
|
1109 |
-
|
1110 |
-
|
1111 |
-
|
1112 |
-
|
1113 |
-
|
1114 |
-
|
1115 |
-
|
1116 |
-
|
1117 |
-
|
1118 |
-
|
1119 |
-
|
1120 |
-
|
1121 |
-
|
1122 |
-
|
1123 |
-
|
1124 |
-
|
1125 |
-
|
1126 |
-
|
1127 |
-
|
1128 |
-
|
1129 |
-
|
1130 |
-
|
1131 |
-
|
1132 |
-
|
1133 |
-
|
1134 |
-
|
1135 |
-
|
1136 |
-
|
1137 |
-
|
1138 |
-
|
1139 |
-
|
1140 |
-
|
1141 |
-
|
1142 |
-
|
1143 |
-
|
1144 |
-
|
1145 |
-
|
1146 |
-
|
1147 |
-
|
1148 |
-
|
1149 |
-
|
1150 |
-
|
1151 |
-
|
1152 |
-
|
1153 |
-
|
1154 |
-
|
1155 |
-
|
1156 |
-
|
1157 |
-
|
1158 |
-
|
1159 |
-
|
1160 |
-
|
1161 |
-
|
1162 |
-
|
1163 |
-
|
1164 |
-
|
1165 |
-
|
1166 |
-
|
1167 |
-
|
1168 |
-
|
1169 |
-
|
1170 |
-
|
1171 |
-
|
1172 |
-
|
1173 |
-
|
1174 |
-
|
1175 |
-
|
1176 |
-
|
1177 |
-
|
1178 |
-
|
1179 |
-
|
1180 |
-
|
1181 |
-
|
1182 |
-
|
1183 |
-
|
1184 |
-
|
1185 |
-
|
1186 |
-
|
1187 |
-
|
1188 |
-
|
1189 |
-
|
1190 |
-
|
1191 |
-
|
1192 |
-
|
1193 |
-
|
1194 |
-
|
1195 |
-
|
1196 |
-
|
1197 |
-
|
1198 |
-
|
1199 |
-
|
1200 |
-
|
1201 |
-
|
1202 |
-
|
1203 |
-
|
1204 |
-
|
1205 |
-
|
1206 |
-
|
1207 |
-
|
1208 |
-
|
1209 |
-
|
1210 |
-
|
1211 |
-
|
1212 |
-
|
1213 |
-
|
1214 |
-
|
1215 |
-
|
1216 |
-
|
1217 |
-
|
1218 |
-
|
1219 |
-
|
1220 |
-
|
1221 |
-
|
1222 |
-
|
1223 |
-
|
1224 |
-
|
1225 |
-
|
1226 |
-
|
1227 |
-
|
1228 |
-
|
1229 |
-
|
1230 |
-
|
1231 |
-
|
1232 |
-
|
1233 |
-
|
1234 |
-
|
1235 |
-
|
1236 |
-
|
1237 |
-
|
1238 |
-
|
1239 |
-
|
1240 |
-
|
1241 |
-
|
1242 |
-
|
1243 |
-
|
1244 |
-
|
1245 |
-
|
1246 |
-
|
1247 |
-
|
1248 |
-
|
1249 |
-
|
1250 |
-
|
1251 |
-
|
1252 |
-
|
1253 |
-
|
1254 |
-
|
1255 |
-
|
1256 |
-
|
1257 |
-
|
1258 |
-
|
1259 |
-
|
1260 |
-
|
1261 |
-
|
1262 |
-
|
1263 |
-
|
1264 |
-
|
1265 |
-
|
1266 |
-
|
1267 |
-
|
1268 |
-
|
1269 |
-
|
1270 |
-
|
1271 |
-
|
1272 |
-
|
1273 |
-
|
1274 |
-
|
1275 |
-
|
1276 |
-
|
1277 |
-
|
1278 |
-
|
1279 |
-
|
1280 |
-
|
1281 |
-
|
1282 |
-
|
1283 |
-
|
1284 |
-
|
1285 |
-
|
1286 |
-
|
1287 |
-
|
1288 |
-
|
1289 |
-
|
1290 |
-
|
1291 |
-
|
1292 |
-
|
1293 |
-
|
1294 |
-
|
1295 |
-
|
1296 |
-
|
1297 |
-
|
1298 |
-
|
1299 |
-
|
1300 |
-
|
1301 |
-
|
1302 |
-
|
1303 |
-
|
1304 |
-
|
1305 |
-
|
1306 |
-
|
1307 |
-
|
1308 |
-
|
1309 |
-
|
1310 |
-
|
1311 |
-
|
1312 |
-
|
1313 |
-
|
1314 |
-
|
1315 |
-
|
1316 |
-
|
1317 |
-
|
1318 |
-
|
1319 |
-
|
1320 |
-
|
1321 |
-
|
1322 |
-
|
1323 |
-
|
1324 |
-
|
1325 |
-
|
1326 |
-
|
1327 |
-
|
1328 |
-
|
1329 |
-
|
1330 |
-
|
1331 |
-
|
1332 |
-
|
1333 |
-
|
1334 |
-
|
1335 |
-
|
1336 |
-
|
1337 |
-
|
1338 |
-
|
1339 |
-
|
1340 |
-
|
1341 |
-
|
1342 |
-
|
1343 |
-
|
1344 |
-
|
1345 |
-
|
1346 |
-
|
1347 |
-
|
1348 |
-
|
1349 |
-
|
1350 |
-
|
1351 |
-
|
1352 |
-
|
1353 |
-
|
1354 |
-
|
1355 |
-
|
1356 |
-
|
1357 |
-
|
1358 |
-
|
1359 |
-
|
1360 |
-
|
1361 |
-
|
1362 |
-
|
1363 |
-
|
1364 |
-
|
1365 |
-
|
1366 |
-
|
1367 |
-
|
1368 |
-
|
1369 |
-
|
1370 |
-
|
1371 |
-
|
1372 |
-
|
1373 |
-
|
1374 |
-
|
1375 |
-
|
1376 |
-
|
1377 |
-
|
1378 |
-
|
1379 |
-
|
1380 |
-
|
1381 |
-
|
1382 |
-
|
1383 |
-
|
1384 |
-
|
1385 |
-
|
1386 |
-
|
1387 |
-
|
1388 |
-
|
1389 |
-
|
1390 |
-
|
1391 |
-
|
1392 |
-
|
1393 |
-
|
1394 |
-
|
1395 |
-
|
1396 |
-
|
1397 |
-
|
1398 |
-
|
1399 |
-
|
1400 |
-
|
1401 |
-
|
1402 |
-
|
1403 |
-
|
1404 |
-
|
1405 |
-
|
1406 |
-
|
1407 |
-
|
1408 |
-
|
1409 |
-
|
1410 |
-
|
1411 |
-
|
1412 |
-
|
1413 |
-
|
1414 |
-
|
1415 |
-
|
1416 |
-
|
1417 |
-
|
1418 |
-
|
1419 |
-
|
1420 |
-
|
1421 |
-
|
1422 |
-
|
1423 |
-
|
1424 |
-
|
1425 |
-
|
1426 |
-
|
1427 |
-
|
1428 |
-
|
1429 |
-
|
1430 |
-
|
1431 |
-
|
1432 |
-
|
1433 |
-
|
1434 |
-
|
1435 |
-
|
1436 |
-
|
1437 |
-
|
1438 |
-
|
1439 |
-
|
1440 |
-
|
1441 |
-
|
1442 |
-
|
1443 |
-
|
1444 |
-
|
1445 |
-
|
1446 |
-
|
1447 |
-
|
1448 |
-
|
1449 |
-
|
1450 |
-
|
1451 |
-
|
1452 |
-
|
1453 |
-
|
1454 |
-
|
1455 |
-
|
1456 |
-
|
1457 |
-
|
1458 |
-
|
1459 |
-
|
1460 |
-
|
1461 |
-
|
1462 |
-
|
1463 |
-
|
1464 |
-
|
1465 |
-
|
1466 |
-
|
1467 |
-
|
1468 |
-
|
1469 |
-
|
1470 |
-
|
1471 |
-
|
1472 |
-
|
1473 |
-
|
1474 |
-
|
1475 |
-
|
1476 |
-
|
1477 |
-
|
1478 |
-
|
1479 |
-
|
1480 |
-
|
1481 |
-
|
1482 |
-
|
1483 |
-
|
1484 |
-
|
1485 |
-
|
1486 |
-
|
1487 |
-
|
1488 |
-
|
1489 |
-
|
1490 |
-
|
1491 |
-
|
1492 |
-
|
1493 |
-
|
1494 |
-
|
1495 |
-
|
1496 |
-
|
1497 |
-
|
1498 |
-
|
1499 |
-
|
1500 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1501 |
|
1502 |
}));
|
1 |
/*
|
2 |
+
* jQuery File Upload Plugin v9.32.0
|
3 |
* https://github.com/blueimp/jQuery-File-Upload
|
4 |
*
|
5 |
* Copyright 2010, Sebastian Tschan
|
13 |
/* global define, require, window, document, location, Blob, FormData */
|
14 |
|
15 |
;(function (factory) {
|
16 |
+
'use strict';
|
17 |
+
if (typeof define === 'function' && define.amd) {
|
18 |
+
// Register as an anonymous AMD module:
|
19 |
+
define([
|
20 |
+
'jquery',
|
21 |
+
'jquery-ui/ui/widget'
|
22 |
+
], factory);
|
23 |
+
} else if (typeof exports === 'object') {
|
24 |
+
// Node/CommonJS:
|
25 |
+
factory(
|
26 |
+
require('jquery'),
|
27 |
+
require('./vendor/jquery.ui.widget')
|
28 |
+
);
|
29 |
+
} else {
|
30 |
+
// Browser globals:
|
31 |
+
factory(window.jQuery);
|
32 |
+
}
|
33 |
}(function ($) {
|
34 |
+
'use strict';
|
35 |
+
|
36 |
+
// Detect file input support, based on
|
37 |
+
// http://viljamis.com/blog/2012/file-upload-support-on-mobile/
|
38 |
+
$.support.fileInput = !(new RegExp(
|
39 |
+
// Handle devices which give false positives for the feature detection:
|
40 |
+
'(Android (1\\.[0156]|2\\.[01]))' +
|
41 |
+
'|(Windows Phone (OS 7|8\\.0))|(XBLWP)|(ZuneWP)|(WPDesktop)' +
|
42 |
+
'|(w(eb)?OSBrowser)|(webOS)' +
|
43 |
+
'|(Kindle/(1\\.0|2\\.[05]|3\\.0))'
|
44 |
+
).test(window.navigator.userAgent) ||
|
45 |
+
// Feature detection for all other devices:
|
46 |
+
$('<input type="file"/>').prop('disabled'));
|
47 |
+
|
48 |
+
// The FileReader API is not actually used, but works as feature detection,
|
49 |
+
// as some Safari versions (5?) support XHR file uploads via the FormData API,
|
50 |
+
// but not non-multipart XHR file uploads.
|
51 |
+
// window.XMLHttpRequestUpload is not available on IE10, so we check for
|
52 |
+
// window.ProgressEvent instead to detect XHR2 file upload capability:
|
53 |
+
$.support.xhrFileUpload = !!(window.ProgressEvent && window.FileReader);
|
54 |
+
$.support.xhrFormDataFileUpload = !!window.FormData;
|
55 |
+
|
56 |
+
// Detect support for Blob slicing (required for chunked uploads):
|
57 |
+
$.support.blobSlice = window.Blob && (Blob.prototype.slice ||
|
58 |
+
Blob.prototype.webkitSlice || Blob.prototype.mozSlice);
|
59 |
+
|
60 |
+
// Helper function to create drag handlers for dragover/dragenter/dragleave:
|
61 |
+
function getDragHandler(type) {
|
62 |
+
var isDragOver = type === 'dragover';
|
63 |
+
return function (e) {
|
64 |
+
e.dataTransfer = e.originalEvent && e.originalEvent.dataTransfer;
|
65 |
+
var dataTransfer = e.dataTransfer;
|
66 |
+
if (dataTransfer && $.inArray('Files', dataTransfer.types) !== -1 &&
|
67 |
+
this._trigger(
|
68 |
+
type,
|
69 |
+
$.Event(type, {delegatedEvent: e})
|
70 |
+
) !== false) {
|
71 |
+
e.preventDefault();
|
72 |
+
if (isDragOver) {
|
73 |
+
dataTransfer.dropEffect = 'copy';
|
74 |
+
}
|
75 |
+
}
|
76 |
+
};
|
77 |
+
}
|
78 |
+
|
79 |
+
// The fileupload widget listens for change events on file input fields defined
|
80 |
+
// via fileInput setting and paste or drop events of the given dropZone.
|
81 |
+
// In addition to the default jQuery Widget methods, the fileupload widget
|
82 |
+
// exposes the "add" and "send" methods, to add or directly send files using
|
83 |
+
// the fileupload API.
|
84 |
+
// By default, files added via file input selection, paste, drag & drop or
|
85 |
+
// "add" method are uploaded immediately, but it is possible to override
|
86 |
+
// the "add" callback option to queue file uploads.
|
87 |
+
$.widget('blueimp.fileupload', {
|
88 |
+
|
89 |
+
options: {
|
90 |
+
// The drop target element(s), by the default the complete document.
|
91 |
+
// Set to null to disable drag & drop support:
|
92 |
+
dropZone: $(document),
|
93 |
+
// The paste target element(s), by the default undefined.
|
94 |
+
// Set to a DOM node or jQuery object to enable file pasting:
|
95 |
+
pasteZone: undefined,
|
96 |
+
// The file input field(s), that are listened to for change events.
|
97 |
+
// If undefined, it is set to the file input fields inside
|
98 |
+
// of the widget element on plugin initialization.
|
99 |
+
// Set to null to disable the change listener.
|
100 |
+
fileInput: undefined,
|
101 |
+
// By default, the file input field is replaced with a clone after
|
102 |
+
// each input field change event. This is required for iframe transport
|
103 |
+
// queues and allows change events to be fired for the same file
|
104 |
+
// selection, but can be disabled by setting the following option to false:
|
105 |
+
replaceFileInput: true,
|
106 |
+
// The parameter name for the file form data (the request argument name).
|
107 |
+
// If undefined or empty, the name property of the file input field is
|
108 |
+
// used, or "files[]" if the file input name property is also empty,
|
109 |
+
// can be a string or an array of strings:
|
110 |
+
paramName: undefined,
|
111 |
+
// By default, each file of a selection is uploaded using an individual
|
112 |
+
// request for XHR type uploads. Set to false to upload file
|
113 |
+
// selections in one request each:
|
114 |
+
singleFileUploads: true,
|
115 |
+
// To limit the number of files uploaded with one XHR request,
|
116 |
+
// set the following option to an integer greater than 0:
|
117 |
+
limitMultiFileUploads: undefined,
|
118 |
+
// The following option limits the number of files uploaded with one
|
119 |
+
// XHR request to keep the request size under or equal to the defined
|
120 |
+
// limit in bytes:
|
121 |
+
limitMultiFileUploadSize: undefined,
|
122 |
+
// Multipart file uploads add a number of bytes to each uploaded file,
|
123 |
+
// therefore the following option adds an overhead for each file used
|
124 |
+
// in the limitMultiFileUploadSize configuration:
|
125 |
+
limitMultiFileUploadSizeOverhead: 512,
|
126 |
+
// Set the following option to true to issue all file upload requests
|
127 |
+
// in a sequential order:
|
128 |
+
sequentialUploads: false,
|
129 |
+
// To limit the number of concurrent uploads,
|
130 |
+
// set the following option to an integer greater than 0:
|
131 |
+
limitConcurrentUploads: undefined,
|
132 |
+
// Set the following option to true to force iframe transport uploads:
|
133 |
+
forceIframeTransport: false,
|
134 |
+
// Set the following option to the location of a redirect url on the
|
135 |
+
// origin server, for cross-domain iframe transport uploads:
|
136 |
+
redirect: undefined,
|
137 |
+
// The parameter name for the redirect url, sent as part of the form
|
138 |
+
// data and set to 'redirect' if this option is empty:
|
139 |
+
redirectParamName: undefined,
|
140 |
+
// Set the following option to the location of a postMessage window,
|
141 |
+
// to enable postMessage transport uploads:
|
142 |
+
postMessage: undefined,
|
143 |
+
// By default, XHR file uploads are sent as multipart/form-data.
|
144 |
+
// The iframe transport is always using multipart/form-data.
|
145 |
+
// Set to false to enable non-multipart XHR uploads:
|
146 |
+
multipart: true,
|
147 |
+
// To upload large files in smaller chunks, set the following option
|
148 |
+
// to a preferred maximum chunk size. If set to 0, null or undefined,
|
149 |
+
// or the browser does not support the required Blob API, files will
|
150 |
+
// be uploaded as a whole.
|
151 |
+
maxChunkSize: undefined,
|
152 |
+
// When a non-multipart upload or a chunked multipart upload has been
|
153 |
+
// aborted, this option can be used to resume the upload by setting
|
154 |
+
// it to the size of the already uploaded bytes. This option is most
|
155 |
+
// useful when modifying the options object inside of the "add" or
|
156 |
+
// "send" callbacks, as the options are cloned for each file upload.
|
157 |
+
uploadedBytes: undefined,
|
158 |
+
// By default, failed (abort or error) file uploads are removed from the
|
159 |
+
// global progress calculation. Set the following option to false to
|
160 |
+
// prevent recalculating the global progress data:
|
161 |
+
recalculateProgress: true,
|
162 |
+
// Interval in milliseconds to calculate and trigger progress events:
|
163 |
+
progressInterval: 100,
|
164 |
+
// Interval in milliseconds to calculate progress bitrate:
|
165 |
+
bitrateInterval: 500,
|
166 |
+
// By default, uploads are started automatically when adding files:
|
167 |
+
autoUpload: true,
|
168 |
+
// By default, duplicate file names are expected to be handled on
|
169 |
+
// the server-side. If this is not possible (e.g. when uploading
|
170 |
+
// files directly to Amazon S3), the following option can be set to
|
171 |
+
// an empty object or an object mapping existing filenames, e.g.:
|
172 |
+
// { "image.jpg": true, "image (1).jpg": true }
|
173 |
+
// If it is set, all files will be uploaded with unique filenames,
|
174 |
+
// adding increasing number suffixes if necessary, e.g.:
|
175 |
+
// "image (2).jpg"
|
176 |
+
uniqueFilenames: undefined,
|
177 |
+
|
178 |
+
// Error and info messages:
|
179 |
+
messages: {
|
180 |
+
uploadedBytes: 'Uploaded bytes exceed file size'
|
181 |
+
},
|
182 |
+
|
183 |
+
// Translation function, gets the message key to be translated
|
184 |
+
// and an object with context specific data as arguments:
|
185 |
+
i18n: function (message, context) {
|
186 |
+
message = this.messages[message] || message.toString();
|
187 |
+
if (context) {
|
188 |
+
$.each(context, function (key, value) {
|
189 |
+
message = message.replace('{' + key + '}', value);
|
190 |
+
});
|
191 |
+
}
|
192 |
+
return message;
|
193 |
+
},
|
194 |
+
|
195 |
+
// Additional form data to be sent along with the file uploads can be set
|
196 |
+
// using this option, which accepts an array of objects with name and
|
197 |
+
// value properties, a function returning such an array, a FormData
|
198 |
+
// object (for XHR file uploads), or a simple object.
|
199 |
+
// The form of the first fileInput is given as parameter to the function:
|
200 |
+
formData: function (form) {
|
201 |
+
return form.serializeArray();
|
202 |
+
},
|
203 |
+
|
204 |
+
// The add callback is invoked as soon as files are added to the fileupload
|
205 |
+
// widget (via file input selection, drag & drop, paste or add API call).
|
206 |
+
// If the singleFileUploads option is enabled, this callback will be
|
207 |
+
// called once for each file in the selection for XHR file uploads, else
|
208 |
+
// once for each file selection.
|
209 |
+
//
|
210 |
+
// The upload starts when the submit method is invoked on the data parameter.
|
211 |
+
// The data object contains a files property holding the added files
|
212 |
+
// and allows you to override plugin options as well as define ajax settings.
|
213 |
+
//
|
214 |
+
// Listeners for this callback can also be bound the following way:
|
215 |
+
// .bind('fileuploadadd', func);
|
216 |
+
//
|
217 |
+
// data.submit() returns a Promise object and allows to attach additional
|
218 |
+
// handlers using jQuery's Deferred callbacks:
|
219 |
+
// data.submit().done(func).fail(func).always(func);
|
220 |
+
add: function (e, data) {
|
221 |
+
if (e.isDefaultPrevented()) {
|
222 |
+
return false;
|
223 |
+
}
|
224 |
+
if (data.autoUpload || (data.autoUpload !== false &&
|
225 |
+
$(this).fileupload('option', 'autoUpload'))) {
|
226 |
+
data.process().done(function () {
|
227 |
+
data.submit();
|
228 |
+
});
|
229 |
+
}
|
230 |
+
},
|
231 |
+
|
232 |
+
// Other callbacks:
|
233 |
+
|
234 |
+
// Callback for the submit event of each file upload:
|
235 |
+
// submit: function (e, data) {}, // .bind('fileuploadsubmit', func);
|
236 |
+
|
237 |
+
// Callback for the start of each file upload request:
|
238 |
+
// send: function (e, data) {}, // .bind('fileuploadsend', func);
|
239 |
+
|
240 |
+
// Callback for successful uploads:
|
241 |
+
// done: function (e, data) {}, // .bind('fileuploaddone', func);
|
242 |
+
|
243 |
+
// Callback for failed (abort or error) uploads:
|
244 |
+
// fail: function (e, data) {}, // .bind('fileuploadfail', func);
|
245 |
+
|
246 |
+
// Callback for completed (success, abort or error) requests:
|
247 |
+
// always: function (e, data) {}, // .bind('fileuploadalways', func);
|
248 |
+
|
249 |
+
// Callback for upload progress events:
|
250 |
+
// progress: function (e, data) {}, // .bind('fileuploadprogress', func);
|
251 |
+
|
252 |
+
// Callback for global upload progress events:
|
253 |
+
// progressall: function (e, data) {}, // .bind('fileuploadprogressall', func);
|
254 |
+
|
255 |
+
// Callback for uploads start, equivalent to the global ajaxStart event:
|
256 |
+
// start: function (e) {}, // .bind('fileuploadstart', func);
|
257 |
+
|
258 |
+
// Callback for uploads stop, equivalent to the global ajaxStop event:
|
259 |
+
// stop: function (e) {}, // .bind('fileuploadstop', func);
|
260 |
+
|
261 |
+
// Callback for change events of the fileInput(s):
|
262 |
+
// change: function (e, data) {}, // .bind('fileuploadchange', func);
|
263 |
+
|
264 |
+
// Callback for paste events to the pasteZone(s):
|
265 |
+
// paste: function (e, data) {}, // .bind('fileuploadpaste', func);
|
266 |
+
|
267 |
+
// Callback for drop events of the dropZone(s):
|
268 |
+
// drop: function (e, data) {}, // .bind('fileuploaddrop', func);
|
269 |
+
|
270 |
+
// Callback for dragover events of the dropZone(s):
|
271 |
+
// dragover: function (e) {}, // .bind('fileuploaddragover', func);
|
272 |
+
|
273 |
+
// Callback before the start of each chunk upload request (before form data initialization):
|
274 |
+
// chunkbeforesend: function (e, data) {}, // .bind('fileuploadchunkbeforesend', func);
|
275 |
+
|
276 |
+
// Callback for the start of each chunk upload request:
|
277 |
+
// chunksend: function (e, data) {}, // .bind('fileuploadchunksend', func);
|
278 |
+
|
279 |
+
// Callback for successful chunk uploads:
|
280 |
+
// chunkdone: function (e, data) {}, // .bind('fileuploadchunkdone', func);
|
281 |
+
|
282 |
+
// Callback for failed (abort or error) chunk uploads:
|
283 |
+
// chunkfail: function (e, data) {}, // .bind('fileuploadchunkfail', func);
|
284 |
+
|
285 |
+
// Callback for completed (success, abort or error) chunk upload requests:
|
286 |
+
// chunkalways: function (e, data) {}, // .bind('fileuploadchunkalways', func);
|
287 |
+
|
288 |
+
// The plugin options are used as settings object for the ajax calls.
|
289 |
+
// The following are jQuery ajax settings required for the file uploads:
|
290 |
+
processData: false,
|
291 |
+
contentType: false,
|
292 |
+
cache: false,
|
293 |
+
timeout: 0
|
294 |
+
},
|
295 |
+
|
296 |
+
// A list of options that require reinitializing event listeners and/or
|
297 |
+
// special initialization code:
|
298 |
+
_specialOptions: [
|
299 |
+
'fileInput',
|
300 |
+
'dropZone',
|
301 |
+
'pasteZone',
|
302 |
+
'multipart',
|
303 |
+
'forceIframeTransport'
|
304 |
+
],
|
305 |
+
|
306 |
+
_blobSlice: $.support.blobSlice && function () {
|
307 |
+
var slice = this.slice || this.webkitSlice || this.mozSlice;
|
308 |
+
return slice.apply(this, arguments);
|
309 |
+
},
|
310 |
+
|
311 |
+
_BitrateTimer: function () {
|
312 |
+
this.timestamp = ((Date.now) ? Date.now() : (new Date()).getTime());
|
313 |
+
this.loaded = 0;
|
314 |
+
this.bitrate = 0;
|
315 |
+
this.getBitrate = function (now, loaded, interval) {
|
316 |
+
var timeDiff = now - this.timestamp;
|
317 |
+
if (!this.bitrate || !interval || timeDiff > interval) {
|
318 |
+
this.bitrate = (loaded - this.loaded) * (1000 / timeDiff) * 8;
|
319 |
+
this.loaded = loaded;
|
320 |
+
this.timestamp = now;
|
321 |
+
}
|
322 |
+
return this.bitrate;
|
323 |
+
};
|
324 |
+
},
|
325 |
+
|
326 |
+
_isXHRUpload: function (options) {
|
327 |
+
return !options.forceIframeTransport &&
|
328 |
+
((!options.multipart && $.support.xhrFileUpload) ||
|
329 |
+
$.support.xhrFormDataFileUpload);
|
330 |
+
},
|
331 |
+
|
332 |
+
_getFormData: function (options) {
|
333 |
+
var formData;
|
334 |
+
if ($.type(options.formData) === 'function') {
|
335 |
+
return options.formData(options.form);
|
336 |
+
}
|
337 |
+
if ($.isArray(options.formData)) {
|
338 |
+
return options.formData;
|
339 |
+
}
|
340 |
+
if ($.type(options.formData) === 'object') {
|
341 |
+
formData = [];
|
342 |
+
$.each(options.formData, function (name, value) {
|
343 |
+
formData.push({name: name, value: value});
|
344 |
+
});
|
345 |
+
return formData;
|
346 |
+
}
|
347 |
+
return [];
|
348 |
+
},
|
349 |
+
|
350 |
+
_getTotal: function (files) {
|
351 |
+
var total = 0;
|
352 |
+
$.each(files, function (index, file) {
|
353 |
+
total += file.size || 1;
|
354 |
+
});
|
355 |
+
return total;
|
356 |
+
},
|
357 |
+
|
358 |
+
_initProgressObject: function (obj) {
|
359 |
+
var progress = {
|
360 |
+
loaded: 0,
|
361 |
+
total: 0,
|
362 |
+
bitrate: 0
|
363 |
+
};
|
364 |
+
if (obj._progress) {
|
365 |
+
$.extend(obj._progress, progress);
|
366 |
+
} else {
|
367 |
+
obj._progress = progress;
|
368 |
+
}
|
369 |
+
},
|
370 |
+
|
371 |
+
_initResponseObject: function (obj) {
|
372 |
+
var prop;
|
373 |
+
if (obj._response) {
|
374 |
+
for (prop in obj._response) {
|
375 |
+
if (obj._response.hasOwnProperty(prop)) {
|
376 |
+
delete obj._response[prop];
|
377 |
+
}
|
378 |
+
}
|
379 |
+
} else {
|
380 |
+
obj._response = {};
|
381 |
+
}
|
382 |
+
},
|
383 |
+
|
384 |
+
_onProgress: function (e, data) {
|
385 |
+
if (e.lengthComputable) {
|
386 |
+
var now = ((Date.now) ? Date.now() : (new Date()).getTime()),
|
387 |
+
loaded;
|
388 |
+
if (data._time && data.progressInterval &&
|
389 |
+
(now - data._time < data.progressInterval) &&
|
390 |
+
e.loaded !== e.total) {
|
391 |
+
return;
|
392 |
+
}
|
393 |
+
data._time = now;
|
394 |
+
loaded = Math.floor(
|
395 |
+
e.loaded / e.total * (data.chunkSize || data._progress.total)
|
396 |
+
) + (data.uploadedBytes || 0);
|
397 |
+
// Add the difference from the previously loaded state
|
398 |
+
// to the global loaded counter:
|
399 |
+
this._progress.loaded += (loaded - data._progress.loaded);
|
400 |
+
this._progress.bitrate = this._bitrateTimer.getBitrate(
|
401 |
+
now,
|
402 |
+
this._progress.loaded,
|
403 |
+
data.bitrateInterval
|
404 |
+
);
|
405 |
+
data._progress.loaded = data.loaded = loaded;
|
406 |
+
data._progress.bitrate = data.bitrate = data._bitrateTimer.getBitrate(
|
407 |
+
now,
|
408 |
+
loaded,
|
409 |
+
data.bitrateInterval
|
410 |
+
);
|
411 |
+
// Trigger a custom progress event with a total data property set
|
412 |
+
// to the file size(s) of the current upload and a loaded data
|
413 |
+
// property calculated accordingly:
|
414 |
+
this._trigger(
|
415 |
+
'progress',
|
416 |
+
$.Event('progress', {delegatedEvent: e}),
|
417 |
+
data
|
418 |
+
);
|
419 |
+
// Trigger a global progress event for all current file uploads,
|
420 |
+
// including ajax calls queued for sequential file uploads:
|
421 |
+
this._trigger(
|
422 |
+
'progressall',
|
423 |
+
$.Event('progressall', {delegatedEvent: e}),
|
424 |
+
this._progress
|
425 |
+
);
|
426 |
+
}
|
427 |
+
},
|
428 |
+
|
429 |
+
_initProgressListener: function (options) {
|
430 |
+
var that = this,
|
431 |
+
xhr = options.xhr ? options.xhr() : $.ajaxSettings.xhr();
|
432 |
+
// Accesss to the native XHR object is required to add event listeners
|
433 |
+
// for the upload progress event:
|
434 |
+
if (xhr.upload) {
|
435 |
+
$(xhr.upload).bind('progress', function (e) {
|
436 |
+
var oe = e.originalEvent;
|
437 |
+
// Make sure the progress event properties get copied over:
|
438 |
+
e.lengthComputable = oe.lengthComputable;
|
439 |
+
e.loaded = oe.loaded;
|
440 |
+
e.total = oe.total;
|
441 |
+
that._onProgress(e, options);
|
442 |
+
});
|
443 |
+
options.xhr = function () {
|
444 |
+
return xhr;
|
445 |
+
};
|
446 |
+
}
|
447 |
+
},
|
448 |
+
|
449 |
+
_deinitProgressListener: function (options) {
|
450 |
+
var xhr = options.xhr ? options.xhr() : $.ajaxSettings.xhr();
|
451 |
+
if (xhr.upload) {
|
452 |
+
$(xhr.upload).unbind('progress');
|
453 |
+
}
|
454 |
+
},
|
455 |
+
|
456 |
+
_isInstanceOf: function (type, obj) {
|
457 |
+
// Cross-frame instanceof check
|
458 |
+
return Object.prototype.toString.call(obj) === '[object ' + type + ']';
|
459 |
+
},
|
460 |
+
|
461 |
+
_getUniqueFilename: function (name, map) {
|
462 |
+
name = String(name);
|
463 |
+
if (map[name]) {
|
464 |
+
name = name.replace(
|
465 |
+
/(?: \(([\d]+)\))?(\.[^.]+)?$/,
|
466 |
+
function (_, p1, p2) {
|
467 |
+
var index = p1 ? Number(p1) + 1 : 1;
|
468 |
+
var ext = p2 || '';
|
469 |
+
return ' (' + index + ')' + ext;
|
470 |
+
}
|
471 |
+
);
|
472 |
+
return this._getUniqueFilename(name, map);
|
473 |
+
}
|
474 |
+
map[name] = true;
|
475 |
+
return name;
|
476 |
+
},
|
477 |
+
|
478 |
+
_initXHRData: function (options) {
|
479 |
+
var that = this,
|
480 |
+
formData,
|
481 |
+
file = options.files[0],
|
482 |
+
// Ignore non-multipart setting if not supported:
|
483 |
+
multipart = options.multipart || !$.support.xhrFileUpload,
|
484 |
+
paramName = $.type(options.paramName) === 'array' ?
|
485 |
+
options.paramName[0] : options.paramName;
|
486 |
+
options.headers = $.extend({}, options.headers);
|
487 |
+
if (options.contentRange) {
|
488 |
+
options.headers['Content-Range'] = options.contentRange;
|
489 |
+
}
|
490 |
+
if (!multipart || options.blob || !this._isInstanceOf('File', file)) {
|
491 |
+
options.headers['Content-Disposition'] = 'attachment; filename="' +
|
492 |
+
encodeURI(file.uploadName || file.name) + '"';
|
493 |
+
}
|
494 |
+
if (!multipart) {
|
495 |
+
options.contentType = file.type || 'application/octet-stream';
|
496 |
+
options.data = options.blob || file;
|
497 |
+
} else if ($.support.xhrFormDataFileUpload) {
|
498 |
+
if (options.postMessage) {
|
499 |
+
// window.postMessage does not allow sending FormData
|
500 |
+
// objects, so we just add the File/Blob objects to
|
501 |
+
// the formData array and let the postMessage window
|
502 |
+
// create the FormData object out of this array:
|
503 |
+
formData = this._getFormData(options);
|
504 |
+
if (options.blob) {
|
505 |
+
formData.push({
|
506 |
+
name: paramName,
|
507 |
+
value: options.blob
|
508 |
+
});
|
509 |
+
} else {
|
510 |
+
$.each(options.files, function (index, file) {
|
511 |
+
formData.push({
|
512 |
+
name: ($.type(options.paramName) === 'array' &&
|
513 |
+
options.paramName[index]) || paramName,
|
514 |
+
value: file
|
515 |
+
});
|
516 |
+
});
|
517 |
+
}
|
518 |
+
} else {
|
519 |
+
if (that._isInstanceOf('FormData', options.formData)) {
|
520 |
+
formData = options.formData;
|
521 |
+
} else {
|
522 |
+
formData = new FormData();
|
523 |
+
$.each(this._getFormData(options), function (index, field) {
|
524 |
+
formData.append(field.name, field.value);
|
525 |
+
});
|
526 |
+
}
|
527 |
+
if (options.blob) {
|
528 |
+
formData.append(
|
529 |
+
paramName,
|
530 |
+
options.blob,
|
531 |
+
file.uploadName || file.name
|
532 |
+
);
|
533 |
+
} else {
|
534 |
+
$.each(options.files, function (index, file) {
|
535 |
+
// This check allows the tests to run with
|
536 |
+
// dummy objects:
|
537 |
+
if (that._isInstanceOf('File', file) ||
|
538 |
+
that._isInstanceOf('Blob', file)) {
|
539 |
+
var fileName = file.uploadName || file.name;
|
540 |
+
if (options.uniqueFilenames) {
|
541 |
+
fileName = that._getUniqueFilename(
|
542 |
+
fileName,
|
543 |
+
options.uniqueFilenames
|
544 |
+
);
|
545 |
+
}
|
546 |
+
formData.append(
|
547 |
+
($.type(options.paramName) === 'array' &&
|
548 |
+
options.paramName[index]) || paramName,
|
549 |
+
file,
|
550 |
+
fileName
|
551 |
+
);
|
552 |
+
}
|
553 |
+
});
|
554 |
+
}
|
555 |
+
}
|
556 |
+
options.data = formData;
|
557 |
+
}
|
558 |
+
// Blob reference is not needed anymore, free memory:
|
559 |
+
options.blob = null;
|
560 |
+
},
|
561 |
+
|
562 |
+
_initIframeSettings: function (options) {
|
563 |
+
var targetHost = $('<a></a>').prop('href', options.url).prop('host');
|
564 |
+
// Setting the dataType to iframe enables the iframe transport:
|
565 |
+
options.dataType = 'iframe ' + (options.dataType || '');
|
566 |
+
// The iframe transport accepts a serialized array as form data:
|
567 |
+
options.formData = this._getFormData(options);
|
568 |
+
// Add redirect url to form data on cross-domain uploads:
|
569 |
+
if (options.redirect && targetHost && targetHost !== location.host) {
|
570 |
+
options.formData.push({
|
571 |
+
name: options.redirectParamName || 'redirect',
|
572 |
+
value: options.redirect
|
573 |
+
});
|
574 |
+
}
|
575 |
+
},
|
576 |
+
|
577 |
+
_initDataSettings: function (options) {
|
578 |
+
if (this._isXHRUpload(options)) {
|
579 |
+
if (!this._chunkedUpload(options, true)) {
|
580 |
+
if (!options.data) {
|
581 |
+
this._initXHRData(options);
|
582 |
+
}
|
583 |
+
this._initProgressListener(options);
|
584 |
+
}
|
585 |
+
if (options.postMessage) {
|
586 |
+
// Setting the dataType to postmessage enables the
|
587 |
+
// postMessage transport:
|
588 |
+
options.dataType = 'postmessage ' + (options.dataType || '');
|
589 |
+
}
|
590 |
+
} else {
|
591 |
+
this._initIframeSettings(options);
|
592 |
+
}
|
593 |
+
},
|
594 |
+
|
595 |
+
_getParamName: function (options) {
|
596 |
+
var fileInput = $(options.fileInput),
|
597 |
+
paramName = options.paramName;
|
598 |
+
if (!paramName) {
|
599 |
+
paramName = [];
|
600 |
+
fileInput.each(function () {
|
601 |
+
var input = $(this),
|
602 |
+
name = input.prop('name') || 'files[]',
|
603 |
+
i = (input.prop('files') || [1]).length;
|
604 |
+
while (i) {
|
605 |
+
paramName.push(name);
|
606 |
+
i -= 1;
|
607 |
+
}
|
608 |
+
});
|
609 |
+
if (!paramName.length) {
|
610 |
+
paramName = [fileInput.prop('name') || 'files[]'];
|
611 |
+
}
|
612 |
+
} else if (!$.isArray(paramName)) {
|
613 |
+
paramName = [paramName];
|
614 |
+
}
|
615 |
+
return paramName;
|
616 |
+
},
|
617 |
+
|
618 |
+
_initFormSettings: function (options) {
|
619 |
+
// Retrieve missing options from the input field and the
|
620 |
+
// associated form, if available:
|
621 |
+
if (!options.form || !options.form.length) {
|
622 |
+
options.form = $(options.fileInput.prop('form'));
|
623 |
+
// If the given file input doesn't have an associated form,
|
624 |
+
// use the default widget file input's form:
|
625 |
+
if (!options.form.length) {
|
626 |
+
options.form = $(this.options.fileInput.prop('form'));
|
627 |
+
}
|
628 |
+
}
|
629 |
+
options.paramName = this._getParamName(options);
|
630 |
+
if (!options.url) {
|
631 |
+
options.url = options.form.prop('action') || location.href;
|
632 |
+
}
|
633 |
+
// The HTTP request method must be "POST" or "PUT":
|
634 |
+
options.type = (options.type ||
|
635 |
+
($.type(options.form.prop('method')) === 'string' &&
|
636 |
+
options.form.prop('method')) || ''
|
637 |
+
).toUpperCase();
|
638 |
+
if (options.type !== 'POST' && options.type !== 'PUT' &&
|
639 |
+
options.type !== 'PATCH') {
|
640 |
+
options.type = 'POST';
|
641 |
+
}
|
642 |
+
if (!options.formAcceptCharset) {
|
643 |
+
options.formAcceptCharset = options.form.attr('accept-charset');
|
644 |
+
}
|
645 |
+
},
|
646 |
+
|
647 |
+
_getAJAXSettings: function (data) {
|
648 |
+
var options = $.extend({}, this.options, data);
|
649 |
+
this._initFormSettings(options);
|
650 |
+
this._initDataSettings(options);
|
651 |
+
return options;
|
652 |
+
},
|
653 |
+
|
654 |
+
// jQuery 1.6 doesn't provide .state(),
|
655 |
+
// while jQuery 1.8+ removed .isRejected() and .isResolved():
|
656 |
+
_getDeferredState: function (deferred) {
|
657 |
+
if (deferred.state) {
|
658 |
+
return deferred.state();
|
659 |
+
}
|
660 |
+
if (deferred.isResolved()) {
|
661 |
+
return 'resolved';
|
662 |
+
}
|
663 |
+
if (deferred.isRejected()) {
|
664 |
+
return 'rejected';
|
665 |
+
}
|
666 |
+
return 'pending';
|
667 |
+
},
|
668 |
+
|
669 |
+
// Maps jqXHR callbacks to the equivalent
|
670 |
+
// methods of the given Promise object:
|
671 |
+
_enhancePromise: function (promise) {
|
672 |
+
promise.success = promise.done;
|
673 |
+
promise.error = promise.fail;
|
674 |
+
promise.complete = promise.always;
|
675 |
+
return promise;
|
676 |
+
},
|
677 |
+
|
678 |
+
// Creates and returns a Promise object enhanced with
|
679 |
+
// the jqXHR methods abort, success, error and complete:
|
680 |
+
_getXHRPromise: function (resolveOrReject, context, args) {
|
681 |
+
var dfd = $.Deferred(),
|
682 |
+
promise = dfd.promise();
|
683 |
+
context = context || this.options.context || promise;
|
684 |
+
if (resolveOrReject === true) {
|
685 |
+
dfd.resolveWith(context, args);
|
686 |
+
} else if (resolveOrReject === false) {
|
687 |
+
dfd.rejectWith(context, args);
|
688 |
+
}
|
689 |
+
promise.abort = dfd.promise;
|
690 |
+
return this._enhancePromise(promise);
|
691 |
+
},
|
692 |
+
|
693 |
+
// Adds convenience methods to the data callback argument:
|
694 |
+
_addConvenienceMethods: function (e, data) {
|
695 |
+
var that = this,
|
696 |
+
getPromise = function (args) {
|
697 |
+
return $.Deferred().resolveWith(that, args).promise();
|
698 |
+
};
|
699 |
+
data.process = function (resolveFunc, rejectFunc) {
|
700 |
+
if (resolveFunc || rejectFunc) {
|
701 |
+
data._processQueue = this._processQueue =
|
702 |
+
(this._processQueue || getPromise([this])).then(
|
703 |
+
function () {
|
704 |
+
if (data.errorThrown) {
|
705 |
+
return $.Deferred()
|
706 |
+
.rejectWith(that, [data]).promise();
|
707 |
+
}
|
708 |
+
return getPromise(arguments);
|
709 |
+
}
|
710 |
+
).then(resolveFunc, rejectFunc);
|
711 |
+
}
|
712 |
+
return this._processQueue || getPromise([this]);
|
713 |
+
};
|
714 |
+
data.submit = function () {
|
715 |
+
if (this.state() !== 'pending') {
|
716 |
+
data.jqXHR = this.jqXHR =
|
717 |
+
(that._trigger(
|
718 |
+
'submit',
|
719 |
+
$.Event('submit', {delegatedEvent: e}),
|
720 |
+
this
|
721 |
+
) !== false) && that._onSend(e, this);
|
722 |
+
}
|
723 |
+
return this.jqXHR || that._getXHRPromise();
|
724 |
+
};
|
725 |
+
data.abort = function () {
|
726 |
+
if (this.jqXHR) {
|
727 |
+
return this.jqXHR.abort();
|
728 |
+
}
|
729 |
+
this.errorThrown = 'abort';
|
730 |
+
that._trigger('fail', null, this);
|
731 |
+
return that._getXHRPromise(false);
|
732 |
+
};
|
733 |
+
data.state = function () {
|
734 |
+
if (this.jqXHR) {
|
735 |
+
return that._getDeferredState(this.jqXHR);
|
736 |
+
}
|
737 |
+
if (this._processQueue) {
|
738 |
+
return that._getDeferredState(this._processQueue);
|
739 |
+
}
|
740 |
+
};
|
741 |
+
data.processing = function () {
|
742 |
+
return !this.jqXHR && this._processQueue && that
|
743 |
+
._getDeferredState(this._processQueue) === 'pending';
|
744 |
+
};
|
745 |
+
data.progress = function () {
|
746 |
+
return this._progress;
|
747 |
+
};
|
748 |
+
data.response = function () {
|
749 |
+
return this._response;
|
750 |
+
};
|
751 |
+
},
|
752 |
+
|
753 |
+
// Parses the Range header from the server response
|
754 |
+
// and returns the uploaded bytes:
|
755 |
+
_getUploadedBytes: function (jqXHR) {
|
756 |
+
var range = jqXHR.getResponseHeader('Range'),
|
757 |
+
parts = range && range.split('-'),
|
758 |
+
upperBytesPos = parts && parts.length > 1 &&
|
759 |
+
parseInt(parts[1], 10);
|
760 |
+
return upperBytesPos && upperBytesPos + 1;
|
761 |
+
},
|
762 |
+
|
763 |
+
// Uploads a file in multiple, sequential requests
|
764 |
+
// by splitting the file up in multiple blob chunks.
|
765 |
+
// If the second parameter is true, only tests if the file
|
766 |
+
// should be uploaded in chunks, but does not invoke any
|
767 |
+
// upload requests:
|
768 |
+
_chunkedUpload: function (options, testOnly) {
|
769 |
+
options.uploadedBytes = options.uploadedBytes || 0;
|
770 |
+
var that = this,
|
771 |
+
file = options.files[0],
|
772 |
+
fs = file.size,
|
773 |
+
ub = options.uploadedBytes,
|
774 |
+
mcs = options.maxChunkSize || fs,
|
775 |
+
slice = this._blobSlice,
|
776 |
+
dfd = $.Deferred(),
|
777 |
+
promise = dfd.promise(),
|
778 |
+
jqXHR,
|
779 |
+
upload;
|
780 |
+
if (!(this._isXHRUpload(options) && slice && (ub || ($.type(mcs) === 'function' ? mcs(options) : mcs) < fs)) ||
|
781 |
+
options.data) {
|
782 |
+
return false;
|
783 |
+
}
|
784 |
+
if (testOnly) {
|
785 |
+
return true;
|
786 |
+
}
|
787 |
+
if (ub >= fs) {
|
788 |
+
file.error = options.i18n('uploadedBytes');
|
789 |
+
return this._getXHRPromise(
|
790 |
+
false,
|
791 |
+
options.context,
|
792 |
+
[null, 'error', file.error]
|
793 |
+
);
|
794 |
+
}
|
795 |
+
// The chunk upload method:
|
796 |
+
upload = function () {
|
797 |
+
// Clone the options object for each chunk upload:
|
798 |
+
var o = $.extend({}, options),
|
799 |
+
currentLoaded = o._progress.loaded;
|
800 |
+
o.blob = slice.call(
|
801 |
+
file,
|
802 |
+
ub,
|
803 |
+
ub + ($.type(mcs) === 'function' ? mcs(o) : mcs),
|
804 |
+
file.type
|
805 |
+
);
|
806 |
+
// Store the current chunk size, as the blob itself
|
807 |
+
// will be dereferenced after data processing:
|
808 |
+
o.chunkSize = o.blob.size;
|
809 |
+
// Expose the chunk bytes position range:
|
810 |
+
o.contentRange = 'bytes ' + ub + '-' +
|
811 |
+
(ub + o.chunkSize - 1) + '/' + fs;
|
812 |
+
// Trigger chunkbeforesend to allow form data to be updated for this chunk
|
813 |
+
that._trigger('chunkbeforesend', null, o);
|
814 |
+
// Process the upload data (the blob and potential form data):
|
815 |
+
that._initXHRData(o);
|
816 |
+
// Add progress listeners for this chunk upload:
|
817 |
+
that._initProgressListener(o);
|
818 |
+
jqXHR = ((that._trigger('chunksend', null, o) !== false && $.ajax(o)) ||
|
819 |
+
that._getXHRPromise(false, o.context))
|
820 |
+
.done(function (result, textStatus, jqXHR) {
|
821 |
+
ub = that._getUploadedBytes(jqXHR) ||
|
822 |
+
(ub + o.chunkSize);
|
823 |
+
// Create a progress event if no final progress event
|
824 |
+
// with loaded equaling total has been triggered
|
825 |
+
// for this chunk:
|
826 |
+
if (currentLoaded + o.chunkSize - o._progress.loaded) {
|
827 |
+
that._onProgress($.Event('progress', {
|
828 |
+
lengthComputable: true,
|
829 |
+
loaded: ub - o.uploadedBytes,
|
830 |
+
total: ub - o.uploadedBytes
|
831 |
+
}), o);
|
832 |
+
}
|
833 |
+
options.uploadedBytes = o.uploadedBytes = ub;
|
834 |
+
o.result = result;
|
835 |
+
o.textStatus = textStatus;
|
836 |
+
o.jqXHR = jqXHR;
|
837 |
+
that._trigger('chunkdone', null, o);
|
838 |
+
that._trigger('chunkalways', null, o);
|
839 |
+
if (ub < fs) {
|
840 |
+
// File upload not yet complete,
|
841 |
+
// continue with the next chunk:
|
842 |
+
upload();
|
843 |
+
} else {
|
844 |
+
dfd.resolveWith(
|
845 |
+
o.context,
|
846 |
+
[result, textStatus, jqXHR]
|
847 |
+
);
|
848 |
+
}
|
849 |
+
})
|
850 |
+
.fail(function (jqXHR, textStatus, errorThrown) {
|
851 |
+
o.jqXHR = jqXHR;
|
852 |
+
o.textStatus = textStatus;
|
853 |
+
o.errorThrown = errorThrown;
|
854 |
+
that._trigger('chunkfail', null, o);
|
855 |
+
that._trigger('chunkalways', null, o);
|
856 |
+
dfd.rejectWith(
|
857 |
+
o.context,
|
858 |
+
[jqXHR, textStatus, errorThrown]
|
859 |
+
);
|
860 |
+
})
|
861 |
+
.always(function () {
|
862 |
+
that._deinitProgressListener(o);
|
863 |
+
});
|
864 |
+
};
|
865 |
+
this._enhancePromise(promise);
|
866 |
+
promise.abort = function () {
|
867 |
+
return jqXHR.abort();
|
868 |
+
};
|
869 |
+
upload();
|
870 |
+
return promise;
|
871 |
+
},
|
872 |
+
|
873 |
+
_beforeSend: function (e, data) {
|
874 |
+
if (this._active === 0) {
|
875 |
+
// the start callback is triggered when an upload starts
|
876 |
+
// and no other uploads are currently running,
|
877 |
+
// equivalent to the global ajaxStart event:
|
878 |
+
this._trigger('start');
|
879 |
+
// Set timer for global bitrate progress calculation:
|
880 |
+
this._bitrateTimer = new this._BitrateTimer();
|
881 |
+
// Reset the global progress values:
|
882 |
+
this._progress.loaded = this._progress.total = 0;
|
883 |
+
this._progress.bitrate = 0;
|
884 |
+
}
|
885 |
+
// Make sure the container objects for the .response() and
|
886 |
+
// .progress() methods on the data object are available
|
887 |
+
// and reset to their initial state:
|
888 |
+
this._initResponseObject(data);
|
889 |
+
this._initProgressObject(data);
|
890 |
+
data._progress.loaded = data.loaded = data.uploadedBytes || 0;
|
891 |
+
data._progress.total = data.total = this._getTotal(data.files) || 1;
|
892 |
+
data._progress.bitrate = data.bitrate = 0;
|
893 |
+
this._active += 1;
|
894 |
+
// Initialize the global progress values:
|
895 |
+
this._progress.loaded += data.loaded;
|
896 |
+
this._progress.total += data.total;
|
897 |
+
},
|
898 |
+
|
899 |
+
_onDone: function (result, textStatus, jqXHR, options) {
|
900 |
+
var total = options._progress.total,
|
901 |
+
response = options._response;
|
902 |
+
if (options._progress.loaded < total) {
|
903 |
+
// Create a progress event if no final progress event
|
904 |
+
// with loaded equaling total has been triggered:
|
905 |
+
this._onProgress($.Event('progress', {
|
906 |
+
lengthComputable: true,
|
907 |
+
loaded: total,
|
908 |
+
total: total
|
909 |
+
}), options);
|
910 |
+
}
|
911 |
+
response.result = options.result = result;
|
912 |
+
response.textStatus = options.textStatus = textStatus;
|
913 |
+
response.jqXHR = options.jqXHR = jqXHR;
|
914 |
+
this._trigger('done', null, options);
|
915 |
+
},
|
916 |
+
|
917 |
+
_onFail: function (jqXHR, textStatus, errorThrown, options) {
|
918 |
+
var response = options._response;
|
919 |
+
if (options.recalculateProgress) {
|
920 |
+
// Remove the failed (error or abort) file upload from
|
921 |
+
// the global progress calculation:
|
922 |
+
this._progress.loaded -= options._progress.loaded;
|
923 |
+
this._progress.total -= options._progress.total;
|
924 |
+
}
|
925 |
+
response.jqXHR = options.jqXHR = jqXHR;
|
926 |
+
response.textStatus = options.textStatus = textStatus;
|
927 |
+
response.errorThrown = options.errorThrown = errorThrown;
|
928 |
+
this._trigger('fail', null, options);
|
929 |
+
},
|
930 |
+
|
931 |
+
_onAlways: function (jqXHRorResult, textStatus, jqXHRorError, options) {
|
932 |
+
// jqXHRorResult, textStatus and jqXHRorError are added to the
|
933 |
+
// options object via done and fail callbacks
|
934 |
+
this._trigger('always', null, options);
|
935 |
+
},
|
936 |
+
|
937 |
+
_onSend: function (e, data) {
|
938 |
+
if (!data.submit) {
|
939 |
+
this._addConvenienceMethods(e, data);
|
940 |
+
}
|
941 |
+
var that = this,
|
942 |
+
jqXHR,
|
943 |
+
aborted,
|
944 |
+
slot,
|
945 |
+
pipe,
|
946 |
+
options = that._getAJAXSettings(data),
|
947 |
+
send = function () {
|
948 |
+
that._sending += 1;
|
949 |
+
// Set timer for bitrate progress calculation:
|
950 |
+
options._bitrateTimer = new that._BitrateTimer();
|
951 |
+
jqXHR = jqXHR || (
|
952 |
+
((aborted || that._trigger(
|
953 |
+
'send',
|
954 |
+
$.Event('send', {delegatedEvent: e}),
|
955 |
+
options
|
956 |
+
) === false) &&
|
957 |
+
that._getXHRPromise(false, options.context, aborted)) ||
|
958 |
+
that._chunkedUpload(options) || $.ajax(options)
|
959 |
+
).done(function (result, textStatus, jqXHR) {
|
960 |
+
that._onDone(result, textStatus, jqXHR, options);
|
961 |
+
}).fail(function (jqXHR, textStatus, errorThrown) {
|
962 |
+
that._onFail(jqXHR, textStatus, errorThrown, options);
|
963 |
+
}).always(function (jqXHRorResult, textStatus, jqXHRorError) {
|
964 |
+
that._deinitProgressListener(options);
|
965 |
+
that._onAlways(
|
966 |
+
jqXHRorResult,
|
967 |
+
textStatus,
|
968 |
+
jqXHRorError,
|
969 |
+
options
|
970 |
+
);
|
971 |
+
that._sending -= 1;
|
972 |
+
that._active -= 1;
|
973 |
+
if (options.limitConcurrentUploads &&
|
974 |
+
options.limitConcurrentUploads > that._sending) {
|
975 |
+
// Start the next queued upload,
|
976 |
+
// that has not been aborted:
|
977 |
+
var nextSlot = that._slots.shift();
|
978 |
+
while (nextSlot) {
|
979 |
+
if (that._getDeferredState(nextSlot) === 'pending') {
|
980 |
+
nextSlot.resolve();
|
981 |
+
break;
|
982 |
+
}
|
983 |
+
nextSlot = that._slots.shift();
|
984 |
+
}
|
985 |
+
}
|
986 |
+
if (that._active === 0) {
|
987 |
+
// The stop callback is triggered when all uploads have
|
988 |
+
// been completed, equivalent to the global ajaxStop event:
|
989 |
+
that._trigger('stop');
|
990 |
+
}
|
991 |
+
});
|
992 |
+
return jqXHR;
|
993 |
+
};
|
994 |
+
this._beforeSend(e, options);
|
995 |
+
if (this.options.sequentialUploads ||
|
996 |
+
(this.options.limitConcurrentUploads &&
|
997 |
+
this.options.limitConcurrentUploads <= this._sending)) {
|
998 |
+
if (this.options.limitConcurrentUploads > 1) {
|
999 |
+
slot = $.Deferred();
|
1000 |
+
this._slots.push(slot);
|
1001 |
+
pipe = slot.then(send);
|
1002 |
+
} else {
|
1003 |
+
this._sequence = this._sequence.then(send, send);
|
1004 |
+
pipe = this._sequence;
|
1005 |
+
}
|
1006 |
+
// Return the piped Promise object, enhanced with an abort method,
|
1007 |
+
// which is delegated to the jqXHR object of the current upload,
|
1008 |
+
// and jqXHR callbacks mapped to the equivalent Promise methods:
|
1009 |
+
pipe.abort = function () {
|
1010 |
+
aborted = [undefined, 'abort', 'abort'];
|
1011 |
+
if (!jqXHR) {
|
1012 |
+
if (slot) {
|
1013 |
+
slot.rejectWith(options.context, aborted);
|
1014 |
+
}
|
1015 |
+
return send();
|
1016 |
+
}
|
1017 |
+
return jqXHR.abort();
|
1018 |
+
};
|
1019 |
+
return this._enhancePromise(pipe);
|
1020 |
+
}
|
1021 |
+
return send();
|
1022 |
+
},
|
1023 |
+
|
1024 |
+
_onAdd: function (e, data) {
|
1025 |
+
var that = this,
|
1026 |
+
result = true,
|
1027 |
+
options = $.extend({}, this.options, data),
|
1028 |
+
files = data.files,
|
1029 |
+
filesLength = files.length,
|
1030 |
+
limit = options.limitMultiFileUploads,
|
1031 |
+
limitSize = options.limitMultiFileUploadSize,
|
1032 |
+
overhead = options.limitMultiFileUploadSizeOverhead,
|
1033 |
+
batchSize = 0,
|
1034 |
+
paramName = this._getParamName(options),
|
1035 |
+
paramNameSet,
|
1036 |
+
paramNameSlice,
|
1037 |
+
fileSet,
|
1038 |
+
i,
|
1039 |
+
j = 0;
|
1040 |
+
if (!filesLength) {
|
1041 |
+
return false;
|
1042 |
+
}
|
1043 |
+
if (limitSize && files[0].size === undefined) {
|
1044 |
+
limitSize = undefined;
|
1045 |
+
}
|
1046 |
+
if (!(options.singleFileUploads || limit || limitSize) ||
|
1047 |
+
!this._isXHRUpload(options)) {
|
1048 |
+
fileSet = [files];
|
1049 |
+
paramNameSet = [paramName];
|
1050 |
+
} else if (!(options.singleFileUploads || limitSize) && limit) {
|
1051 |
+
fileSet = [];
|
1052 |
+
paramNameSet = [];
|
1053 |
+
for (i = 0; i < filesLength; i += limit) {
|
1054 |
+
fileSet.push(files.slice(i, i + limit));
|
1055 |
+
paramNameSlice = paramName.slice(i, i + limit);
|
1056 |
+
if (!paramNameSlice.length) {
|
1057 |
+
paramNameSlice = paramName;
|
1058 |
+
}
|
1059 |
+
paramNameSet.push(paramNameSlice);
|
1060 |
+
}
|
1061 |
+
} else if (!options.singleFileUploads && limitSize) {
|
1062 |
+
fileSet = [];
|
1063 |
+
paramNameSet = [];
|
1064 |
+
for (i = 0; i < filesLength; i = i + 1) {
|
1065 |
+
batchSize += files[i].size + overhead;
|
1066 |
+
if (i + 1 === filesLength ||
|
1067 |
+
((batchSize + files[i + 1].size + overhead) > limitSize) ||
|
1068 |
+
(limit && i + 1 - j >= limit)) {
|
1069 |
+
fileSet.push(files.slice(j, i + 1));
|
1070 |
+
paramNameSlice = paramName.slice(j, i + 1);
|
1071 |
+
if (!paramNameSlice.length) {
|
1072 |
+
paramNameSlice = paramName;
|
1073 |
+
}
|
1074 |
+
paramNameSet.push(paramNameSlice);
|
1075 |
+
j = i + 1;
|
1076 |
+
batchSize = 0;
|
1077 |
+
}
|
1078 |
+
}
|
1079 |
+
} else {
|
1080 |
+
paramNameSet = paramName;
|
1081 |
+
}
|
1082 |
+
data.originalFiles = files;
|
1083 |
+
$.each(fileSet || files, function (index, element) {
|
1084 |
+
var newData = $.extend({}, data);
|
1085 |
+
newData.files = fileSet ? element : [element];
|
1086 |
+
newData.paramName = paramNameSet[index];
|
1087 |
+
that._initResponseObject(newData);
|
1088 |
+
that._initProgressObject(newData);
|
1089 |
+
that._addConvenienceMethods(e, newData);
|
1090 |
+
result = that._trigger(
|
1091 |
+
'add',
|
1092 |
+
$.Event('add', {delegatedEvent: e}),
|
1093 |
+
newData
|
1094 |
+
);
|
1095 |
+
return result;
|
1096 |
+
});
|
1097 |
+
return result;
|
1098 |
+
},
|
1099 |
+
|
1100 |
+
_replaceFileInput: function (data) {
|
1101 |
+
var input = data.fileInput,
|
1102 |
+
inputClone = input.clone(true),
|
1103 |
+
restoreFocus = input.is(document.activeElement);
|
1104 |
+
// Add a reference for the new cloned file input to the data argument:
|
1105 |
+
data.fileInputClone = inputClone;
|
1106 |
+
$('<form></form>').append(inputClone)[0].reset();
|
1107 |
+
// Detaching allows to insert the fileInput on another form
|
1108 |
+
// without loosing the file input value:
|
1109 |
+
input.after(inputClone).detach();
|
1110 |
+
// If the fileInput had focus before it was detached,
|
1111 |
+
// restore focus to the inputClone.
|
1112 |
+
if (restoreFocus) {
|
1113 |
+
inputClone.focus();
|
1114 |
+
}
|
1115 |
+
// Avoid memory leaks with the detached file input:
|
1116 |
+
$.cleanData(input.unbind('remove'));
|
1117 |
+
// Replace the original file input element in the fileInput
|
1118 |
+
// elements set with the clone, which has been copied including
|
1119 |
+
// event handlers:
|
1120 |
+
this.options.fileInput = this.options.fileInput.map(function (i, el) {
|
1121 |
+
if (el === input[0]) {
|
1122 |
+
return inputClone[0];
|
1123 |
+
}
|
1124 |
+
return el;
|
1125 |
+
});
|
1126 |
+
// If the widget has been initialized on the file input itself,
|
1127 |
+
// override this.element with the file input clone:
|
1128 |
+
if (input[0] === this.element[0]) {
|
1129 |
+
this.element = inputClone;
|
1130 |
+
}
|
1131 |
+
},
|
1132 |
+
|
1133 |
+
_handleFileTreeEntry: function (entry, path) {
|
1134 |
+
var that = this,
|
1135 |
+
dfd = $.Deferred(),
|
1136 |
+
entries = [],
|
1137 |
+
dirReader,
|
1138 |
+
errorHandler = function (e) {
|
1139 |
+
if (e && !e.entry) {
|
1140 |
+
e.entry = entry;
|
1141 |
+
}
|
1142 |
+
// Since $.when returns immediately if one
|
1143 |
+
// Deferred is rejected, we use resolve instead.
|
1144 |
+
// This allows valid files and invalid items
|
1145 |
+
// to be returned together in one set:
|
1146 |
+
dfd.resolve([e]);
|
1147 |
+
},
|
1148 |
+
successHandler = function (entries) {
|
1149 |
+
that._handleFileTreeEntries(
|
1150 |
+
entries,
|
1151 |
+
path + entry.name + '/'
|
1152 |
+
).done(function (files) {
|
1153 |
+
dfd.resolve(files);
|
1154 |
+
}).fail(errorHandler);
|
1155 |
+
},
|
1156 |
+
readEntries = function () {
|
1157 |
+
dirReader.readEntries(function (results) {
|
1158 |
+
if (!results.length) {
|
1159 |
+
successHandler(entries);
|
1160 |
+
} else {
|
1161 |
+
entries = entries.concat(results);
|
1162 |
+
readEntries();
|
1163 |
+
}
|
1164 |
+
}, errorHandler);
|
1165 |
+
};
|
1166 |
+
path = path || '';
|
1167 |
+
if (entry.isFile) {
|
1168 |
+
if (entry._file) {
|
1169 |
+
// Workaround for Chrome bug #149735
|
1170 |
+
entry._file.relativePath = path;
|
1171 |
+
dfd.resolve(entry._file);
|
1172 |
+
} else {
|
1173 |
+
entry.file(function (file) {
|
1174 |
+
file.relativePath = path;
|
1175 |
+
dfd.resolve(file);
|
1176 |
+
}, errorHandler);
|
1177 |
+
}
|
1178 |
+
} else if (entry.isDirectory) {
|
1179 |
+
dirReader = entry.createReader();
|
1180 |
+
readEntries();
|
1181 |
+
} else {
|
1182 |
+
// Return an empty list for file system items
|
1183 |
+
// other than files or directories:
|
1184 |
+
dfd.resolve([]);
|
1185 |
+
}
|
1186 |
+
return dfd.promise();
|
1187 |
+
},
|
1188 |
+
|
1189 |
+
_handleFileTreeEntries: function (entries, path) {
|
1190 |
+
var that = this;
|
1191 |
+
return $.when.apply(
|
1192 |
+
$,
|
1193 |
+
$.map(entries, function (entry) {
|
1194 |
+
return that._handleFileTreeEntry(entry, path);
|
1195 |
+
})
|
1196 |
+
).then(function () {
|
1197 |
+
return Array.prototype.concat.apply(
|
1198 |
+
[],
|
1199 |
+
arguments
|
1200 |
+
);
|
1201 |
+
});
|
1202 |
+
},
|
1203 |
+
|
1204 |
+
_getDroppedFiles: function (dataTransfer) {
|
1205 |
+
dataTransfer = dataTransfer || {};
|
1206 |
+
var items = dataTransfer.items;
|
1207 |
+
if (items && items.length && (items[0].webkitGetAsEntry ||
|
1208 |
+
items[0].getAsEntry)) {
|
1209 |
+
return this._handleFileTreeEntries(
|
1210 |
+
$.map(items, function (item) {
|
1211 |
+
var entry;
|
1212 |
+
if (item.webkitGetAsEntry) {
|
1213 |
+
entry = item.webkitGetAsEntry();
|
1214 |
+
if (entry) {
|
1215 |
+
// Workaround for Chrome bug #149735:
|
1216 |
+
entry._file = item.getAsFile();
|
1217 |
+
}
|
1218 |
+
return entry;
|
1219 |
+
}
|
1220 |
+
return item.getAsEntry();
|
1221 |
+
})
|
1222 |
+
);
|
1223 |
+
}
|
1224 |
+
return $.Deferred().resolve(
|
1225 |
+
$.makeArray(dataTransfer.files)
|
1226 |
+
).promise();
|
1227 |
+
},
|
1228 |
+
|
1229 |
+
_getSingleFileInputFiles: function (fileInput) {
|
1230 |
+
fileInput = $(fileInput);
|
1231 |
+
var entries = fileInput.prop('webkitEntries') ||
|
1232 |
+
fileInput.prop('entries'),
|
1233 |
+
files,
|
1234 |
+
value;
|
1235 |
+
if (entries && entries.length) {
|
1236 |
+
return this._handleFileTreeEntries(entries);
|
1237 |
+
}
|
1238 |
+
files = $.makeArray(fileInput.prop('files'));
|
1239 |
+
if (!files.length) {
|
1240 |
+
value = fileInput.prop('value');
|
1241 |
+
if (!value) {
|
1242 |
+
return $.Deferred().resolve([]).promise();
|
1243 |
+
}
|
1244 |
+
// If the files property is not available, the browser does not
|
1245 |
+
// support the File API and we add a pseudo File object with
|
1246 |
+
// the input value as name with path information removed:
|
1247 |
+
files = [{name: value.replace(/^.*\\/, '')}];
|
1248 |
+
} else if (files[0].name === undefined && files[0].fileName) {
|
1249 |
+
// File normalization for Safari 4 and Firefox 3:
|
1250 |
+
$.each(files, function (index, file) {
|
1251 |
+
file.name = file.fileName;
|
1252 |
+
file.size = file.fileSize;
|
1253 |
+
});
|
1254 |
+
}
|
1255 |
+
return $.Deferred().resolve(files).promise();
|
1256 |
+
},
|
1257 |
+
|
1258 |
+
_getFileInputFiles: function (fileInput) {
|
1259 |
+
if (!(fileInput instanceof $) || fileInput.length === 1) {
|
1260 |
+
return this._getSingleFileInputFiles(fileInput);
|
1261 |
+
}
|
1262 |
+
return $.when.apply(
|
1263 |
+
$,
|
1264 |
+
$.map(fileInput, this._getSingleFileInputFiles)
|
1265 |
+
).then(function () {
|
1266 |
+
return Array.prototype.concat.apply(
|
1267 |
+
[],
|
1268 |
+
arguments
|
1269 |
+
);
|
1270 |
+
});
|
1271 |
+
},
|
1272 |
+
|
1273 |
+
_onChange: function (e) {
|
1274 |
+
var that = this,
|
1275 |
+
data = {
|
1276 |
+
fileInput: $(e.target),
|
1277 |
+
form: $(e.target.form)
|
1278 |
+
};
|
1279 |
+
this._getFileInputFiles(data.fileInput).always(function (files) {
|
1280 |
+
data.files = files;
|
1281 |
+
if (that.options.replaceFileInput) {
|
1282 |
+
that._replaceFileInput(data);
|
1283 |
+
}
|
1284 |
+
if (that._trigger(
|
1285 |
+
'change',
|
1286 |
+
$.Event('change', {delegatedEvent: e}),
|
1287 |
+
data
|
1288 |
+
) !== false) {
|
1289 |
+
that._onAdd(e, data);
|
1290 |
+
}
|
1291 |
+
});
|
1292 |
+
},
|
1293 |
+
|
1294 |
+
_onPaste: function (e) {
|
1295 |
+
var items = e.originalEvent && e.originalEvent.clipboardData &&
|
1296 |
+
e.originalEvent.clipboardData.items,
|
1297 |
+
data = {files: []};
|
1298 |
+
if (items && items.length) {
|
1299 |
+
$.each(items, function (index, item) {
|
1300 |
+
var file = item.getAsFile && item.getAsFile();
|
1301 |
+
if (file) {
|
1302 |
+
data.files.push(file);
|
1303 |
+
}
|
1304 |
+
});
|
1305 |
+
if (this._trigger(
|
1306 |
+
'paste',
|
1307 |
+
$.Event('paste', {delegatedEvent: e}),
|
1308 |
+
data
|
1309 |
+
) !== false) {
|
1310 |
+
this._onAdd(e, data);
|
1311 |
+
}
|
1312 |
+
}
|
1313 |
+
},
|
1314 |
+
|
1315 |
+
_onDrop: function (e) {
|
1316 |
+
e.dataTransfer = e.originalEvent && e.originalEvent.dataTransfer;
|
1317 |
+
var that = this,
|
1318 |
+
dataTransfer = e.dataTransfer,
|
1319 |
+
data = {};
|
1320 |
+
if (dataTransfer && dataTransfer.files && dataTransfer.files.length) {
|
1321 |
+
e.preventDefault();
|
1322 |
+
this._getDroppedFiles(dataTransfer).always(function (files) {
|
1323 |
+
data.files = files;
|
1324 |
+
if (that._trigger(
|
1325 |
+
'drop',
|
1326 |
+
$.Event('drop', {delegatedEvent: e}),
|
1327 |
+
data
|
1328 |
+
) !== false) {
|
1329 |
+
that._onAdd(e, data);
|
1330 |
+
}
|
1331 |
+
});
|
1332 |
+
}
|
1333 |
+
},
|
1334 |
+
|
1335 |
+
_onDragOver: getDragHandler('dragover'),
|
1336 |
+
|
1337 |
+
_onDragEnter: getDragHandler('dragenter'),
|
1338 |
+
|
1339 |
+
_onDragLeave: getDragHandler('dragleave'),
|
1340 |
+
|
1341 |
+
_initEventHandlers: function () {
|
1342 |
+
if (this._isXHRUpload(this.options)) {
|
1343 |
+
this._on(this.options.dropZone, {
|
1344 |
+
dragover: this._onDragOver,
|
1345 |
+
drop: this._onDrop,
|
1346 |
+
// event.preventDefault() on dragenter is required for IE10+:
|
1347 |
+
dragenter: this._onDragEnter,
|
1348 |
+
// dragleave is not required, but added for completeness:
|
1349 |
+
dragleave: this._onDragLeave
|
1350 |
+
});
|
1351 |
+
this._on(this.options.pasteZone, {
|
1352 |
+
paste: this._onPaste
|
1353 |
+
});
|
1354 |
+
}
|
1355 |
+
if ($.support.fileInput) {
|
1356 |
+
this._on(this.options.fileInput, {
|
1357 |
+
change: this._onChange
|
1358 |
+
});
|
1359 |
+
}
|
1360 |
+
},
|
1361 |
+
|
1362 |
+
_destroyEventHandlers: function () {
|
1363 |
+
this._off(this.options.dropZone, 'dragenter dragleave dragover drop');
|
1364 |
+
this._off(this.options.pasteZone, 'paste');
|
1365 |
+
this._off(this.options.fileInput, 'change');
|
1366 |
+
},
|
1367 |
+
|
1368 |
+
_destroy: function () {
|
1369 |
+
this._destroyEventHandlers();
|
1370 |
+
},
|
1371 |
+
|
1372 |
+
_setOption: function (key, value) {
|
1373 |
+
var reinit = $.inArray(key, this._specialOptions) !== -1;
|
1374 |
+
if (reinit) {
|
1375 |
+
this._destroyEventHandlers();
|
1376 |
+
}
|
1377 |
+
this._super(key, value);
|
1378 |
+
if (reinit) {
|
1379 |
+
this._initSpecialOptions();
|
1380 |
+
this._initEventHandlers();
|
1381 |
+
}
|
1382 |
+
},
|
1383 |
+
|
1384 |
+
_initSpecialOptions: function () {
|
1385 |
+
var options = this.options;
|
1386 |
+
if (options.fileInput === undefined) {
|
1387 |
+
options.fileInput = this.element.is('input[type="file"]') ?
|
1388 |
+
this.element : this.element.find('input[type="file"]');
|
1389 |
+
} else if (!(options.fileInput instanceof $)) {
|
1390 |
+
options.fileInput = $(options.fileInput);
|
1391 |
+
}
|
1392 |
+
if (!(options.dropZone instanceof $)) {
|
1393 |
+
options.dropZone = $(options.dropZone);
|
1394 |
+
}
|
1395 |
+
if (!(options.pasteZone instanceof $)) {
|
1396 |
+
options.pasteZone = $(options.pasteZone);
|
1397 |
+
}
|
1398 |
+
},
|
1399 |
+
|
1400 |
+
_getRegExp: function (str) {
|
1401 |
+
var parts = str.split('/'),
|
1402 |
+
modifiers = parts.pop();
|
1403 |
+
parts.shift();
|
1404 |
+
return new RegExp(parts.join('/'), modifiers);
|
1405 |
+
},
|
1406 |
+
|
1407 |
+
_isRegExpOption: function (key, value) {
|
1408 |
+
return key !== 'url' && $.type(value) === 'string' &&
|
1409 |
+
/^\/.*\/[igm]{0,3}$/.test(value);
|
1410 |
+
},
|
1411 |
+
|
1412 |
+
_initDataAttributes: function () {
|
1413 |
+
var that = this,
|
1414 |
+
options = this.options,
|
1415 |
+
data = this.element.data();
|
1416 |
+
// Initialize options set via HTML5 data-attributes:
|
1417 |
+
$.each(
|
1418 |
+
this.element[0].attributes,
|
1419 |
+
function (index, attr) {
|
1420 |
+
var key = attr.name.toLowerCase(),
|
1421 |
+
value;
|
1422 |
+
if (/^data-/.test(key)) {
|
1423 |
+
// Convert hyphen-ated key to camelCase:
|
1424 |
+
key = key.slice(5).replace(/-[a-z]/g, function (str) {
|
1425 |
+
return str.charAt(1).toUpperCase();
|
1426 |
+
});
|
1427 |
+
value = data[key];
|
1428 |
+
if (that._isRegExpOption(key, value)) {
|
1429 |
+
value = that._getRegExp(value);
|
1430 |
+
}
|
1431 |
+
options[key] = value;
|
1432 |
+
}
|
1433 |
+
}
|
1434 |
+
);
|
1435 |
+
},
|
1436 |
+
|
1437 |
+
_create: function () {
|
1438 |
+
this._initDataAttributes();
|
1439 |
+
this._initSpecialOptions();
|
1440 |
+
this._slots = [];
|
1441 |
+
this._sequence = this._getXHRPromise(true);
|
1442 |
+
this._sending = this._active = 0;
|
1443 |
+
this._initProgressObject(this);
|
1444 |
+
this._initEventHandlers();
|
1445 |
+
},
|
1446 |
+
|
1447 |
+
// This method is exposed to the widget API and allows to query
|
1448 |
+
// the number of active uploads:
|
1449 |
+
active: function () {
|
1450 |
+
return this._active;
|
1451 |
+
},
|
1452 |
+
|
1453 |
+
// This method is exposed to the widget API and allows to query
|
1454 |
+
// the widget upload progress.
|
1455 |
+
// It returns an object with loaded, total and bitrate properties
|
1456 |
+
// for the running uploads:
|
1457 |
+
progress: function () {
|
1458 |
+
return this._progress;
|
1459 |
+
},
|
1460 |
+
|
1461 |
+
// This method is exposed to the widget API and allows adding files
|
1462 |
+
// using the fileupload API. The data parameter accepts an object which
|
1463 |
+
// must have a files property and can contain additional options:
|
1464 |
+
// .fileupload('add', {files: filesList});
|
1465 |
+
add: function (data) {
|
1466 |
+
var that = this;
|
1467 |
+
if (!data || this.options.disabled) {
|
1468 |
+
return;
|
1469 |
+
}
|
1470 |
+
if (data.fileInput && !data.files) {
|
1471 |
+
this._getFileInputFiles(data.fileInput).always(function (files) {
|
1472 |
+
data.files = files;
|
1473 |
+
that._onAdd(null, data);
|
1474 |
+
});
|
1475 |
+
} else {
|
1476 |
+
data.files = $.makeArray(data.files);
|
1477 |
+
this._onAdd(null, data);
|
1478 |
+
}
|
1479 |
+
},
|
1480 |
+
|
1481 |
+
// This method is exposed to the widget API and allows sending files
|
1482 |
+
// using the fileupload API. The data parameter accepts an object which
|
1483 |
+
// must have a files or fileInput property and can contain additional options:
|
1484 |
+
// .fileupload('send', {files: filesList});
|
1485 |
+
// The method returns a Promise object for the file upload call.
|
1486 |
+
send: function (data) {
|
1487 |
+
if (data && !this.options.disabled) {
|
1488 |
+
if (data.fileInput && !data.files) {
|
1489 |
+
var that = this,
|
1490 |
+
dfd = $.Deferred(),
|
1491 |
+
promise = dfd.promise(),
|
1492 |
+
jqXHR,
|
1493 |
+
aborted;
|
1494 |
+
promise.abort = function () {
|
1495 |
+
aborted = true;
|
1496 |
+
if (jqXHR) {
|
1497 |
+
return jqXHR.abort();
|
1498 |
+
}
|
1499 |
+
dfd.reject(null, 'abort', 'abort');
|
1500 |
+
return promise;
|
1501 |
+
};
|
1502 |
+
this._getFileInputFiles(data.fileInput).always(
|
1503 |
+
function (files) {
|
1504 |
+
if (aborted) {
|
1505 |
+
return;
|
1506 |
+
}
|
1507 |
+
if (!files.length) {
|
1508 |
+
dfd.reject();
|
1509 |
+
return;
|
1510 |
+
}
|
1511 |
+
data.files = files;
|
1512 |
+
jqXHR = that._onSend(null, data);
|
1513 |
+
jqXHR.then(
|
1514 |
+
function (result, textStatus, jqXHR) {
|
1515 |
+
dfd.resolve(result, textStatus, jqXHR);
|
1516 |
+
},
|
1517 |
+
function (jqXHR, textStatus, errorThrown) {
|
1518 |
+
dfd.reject(jqXHR, textStatus, errorThrown);
|
1519 |
+
}
|
1520 |
+
);
|
1521 |
+
}
|
1522 |
+
);
|
1523 |
+
return this._enhancePromise(promise);
|
1524 |
+
}
|
1525 |
+
data.files = $.makeArray(data.files);
|
1526 |
+
if (data.files.length) {
|
1527 |
+
return this._onSend(null, data);
|
1528 |
+
}
|
1529 |
+
}
|
1530 |
+
return this._getXHRPromise(false, data && data.context);
|
1531 |
+
}
|
1532 |
+
|
1533 |
+
});
|
1534 |
|
1535 |
}));
|
assets/js/jquery-fileupload/jquery.iframe-transport.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
/*
|
2 |
-
* jQuery Iframe Transport Plugin v9.
|
3 |
* https://github.com/blueimp/jQuery-File-Upload
|
4 |
*
|
5 |
* Copyright 2011, Sebastian Tschan
|
@@ -12,213 +12,213 @@
|
|
12 |
/* global define, require, window, document, JSON */
|
13 |
|
14 |
;(function (factory) {
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
}(function ($) {
|
27 |
-
|
28 |
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
|
224 |
}));
|
1 |
/*
|
2 |
+
* jQuery Iframe Transport Plugin v9.32.0
|
3 |
* https://github.com/blueimp/jQuery-File-Upload
|
4 |
*
|
5 |
* Copyright 2011, Sebastian Tschan
|
12 |
/* global define, require, window, document, JSON */
|
13 |
|
14 |
;(function (factory) {
|
15 |
+
'use strict';
|
16 |
+
if (typeof define === 'function' && define.amd) {
|
17 |
+
// Register as an anonymous AMD module:
|
18 |
+
define(['jquery'], factory);
|
19 |
+
} else if (typeof exports === 'object') {
|
20 |
+
// Node/CommonJS:
|
21 |
+
factory(require('jquery'));
|
22 |
+
} else {
|
23 |
+
// Browser globals:
|
24 |
+
factory(window.jQuery);
|
25 |
+
}
|
26 |
}(function ($) {
|
27 |
+
'use strict';
|
28 |
|
29 |
+
// Helper variable to create unique names for the transport iframes:
|
30 |
+
var counter = 0,
|
31 |
+
jsonAPI = $,
|
32 |
+
jsonParse = 'parseJSON';
|
33 |
|
34 |
+
if ('JSON' in window && 'parse' in JSON) {
|
35 |
+
jsonAPI = JSON;
|
36 |
+
jsonParse = 'parse';
|
37 |
+
}
|
38 |
|
39 |
+
// The iframe transport accepts four additional options:
|
40 |
+
// options.fileInput: a jQuery collection of file input fields
|
41 |
+
// options.paramName: the parameter name for the file form data,
|
42 |
+
// overrides the name property of the file input field(s),
|
43 |
+
// can be a string or an array of strings.
|
44 |
+
// options.formData: an array of objects with name and value properties,
|
45 |
+
// equivalent to the return data of .serializeArray(), e.g.:
|
46 |
+
// [{name: 'a', value: 1}, {name: 'b', value: 2}]
|
47 |
+
// options.initialIframeSrc: the URL of the initial iframe src,
|
48 |
+
// by default set to "javascript:false;"
|
49 |
+
$.ajaxTransport('iframe', function (options) {
|
50 |
+
if (options.async) {
|
51 |
+
// javascript:false as initial iframe src
|
52 |
+
// prevents warning popups on HTTPS in IE6:
|
53 |
+
/*jshint scripturl: true */
|
54 |
+
var initialIframeSrc = options.initialIframeSrc || 'javascript:false;',
|
55 |
+
/*jshint scripturl: false */
|
56 |
+
form,
|
57 |
+
iframe,
|
58 |
+
addParamChar;
|
59 |
+
return {
|
60 |
+
send: function (_, completeCallback) {
|
61 |
+
form = $('<form style="display:none;"></form>');
|
62 |
+
form.attr('accept-charset', options.formAcceptCharset);
|
63 |
+
addParamChar = /\?/.test(options.url) ? '&' : '?';
|
64 |
+
// XDomainRequest only supports GET and POST:
|
65 |
+
if (options.type === 'DELETE') {
|
66 |
+
options.url = options.url + addParamChar + '_method=DELETE';
|
67 |
+
options.type = 'POST';
|
68 |
+
} else if (options.type === 'PUT') {
|
69 |
+
options.url = options.url + addParamChar + '_method=PUT';
|
70 |
+
options.type = 'POST';
|
71 |
+
} else if (options.type === 'PATCH') {
|
72 |
+
options.url = options.url + addParamChar + '_method=PATCH';
|
73 |
+
options.type = 'POST';
|
74 |
+
}
|
75 |
+
// IE versions below IE8 cannot set the name property of
|
76 |
+
// elements that have already been added to the DOM,
|
77 |
+
// so we set the name along with the iframe HTML markup:
|
78 |
+
counter += 1;
|
79 |
+
iframe = $(
|
80 |
+
'<iframe src="' + initialIframeSrc +
|
81 |
+
'" name="iframe-transport-' + counter + '"></iframe>'
|
82 |
+
).bind('load', function () {
|
83 |
+
var fileInputClones,
|
84 |
+
paramNames = $.isArray(options.paramName) ?
|
85 |
+
options.paramName : [options.paramName];
|
86 |
+
iframe
|
87 |
+
.unbind('load')
|
88 |
+
.bind('load', function () {
|
89 |
+
var response;
|
90 |
+
// Wrap in a try/catch block to catch exceptions thrown
|
91 |
+
// when trying to access cross-domain iframe contents:
|
92 |
+
try {
|
93 |
+
response = iframe.contents();
|
94 |
+
// Google Chrome and Firefox do not throw an
|
95 |
+
// exception when calling iframe.contents() on
|
96 |
+
// cross-domain requests, so we unify the response:
|
97 |
+
if (!response.length || !response[0].firstChild) {
|
98 |
+
throw new Error();
|
99 |
+
}
|
100 |
+
} catch (e) {
|
101 |
+
response = undefined;
|
102 |
+
}
|
103 |
+
// The complete callback returns the
|
104 |
+
// iframe content document as response object:
|
105 |
+
completeCallback(
|
106 |
+
200,
|
107 |
+
'success',
|
108 |
+
{'iframe': response}
|
109 |
+
);
|
110 |
+
// Fix for IE endless progress bar activity bug
|
111 |
+
// (happens on form submits to iframe targets):
|
112 |
+
$('<iframe src="' + initialIframeSrc + '"></iframe>')
|
113 |
+
.appendTo(form);
|
114 |
+
window.setTimeout(function () {
|
115 |
+
// Removing the form in a setTimeout call
|
116 |
+
// allows Chrome's developer tools to display
|
117 |
+
// the response result
|
118 |
+
form.remove();
|
119 |
+
}, 0);
|
120 |
+
});
|
121 |
+
form
|
122 |
+
.prop('target', iframe.prop('name'))
|
123 |
+
.prop('action', options.url)
|
124 |
+
.prop('method', options.type);
|
125 |
+
if (options.formData) {
|
126 |
+
$.each(options.formData, function (index, field) {
|
127 |
+
$('<input type="hidden"/>')
|
128 |
+
.prop('name', field.name)
|
129 |
+
.val(field.value)
|
130 |
+
.appendTo(form);
|
131 |
+
});
|
132 |
+
}
|
133 |
+
if (options.fileInput && options.fileInput.length &&
|
134 |
+
options.type === 'POST') {
|
135 |
+
fileInputClones = options.fileInput.clone();
|
136 |
+
// Insert a clone for each file input field:
|
137 |
+
options.fileInput.after(function (index) {
|
138 |
+
return fileInputClones[index];
|
139 |
+
});
|
140 |
+
if (options.paramName) {
|
141 |
+
options.fileInput.each(function (index) {
|
142 |
+
$(this).prop(
|
143 |
+
'name',
|
144 |
+
paramNames[index] || options.paramName
|
145 |
+
);
|
146 |
+
});
|
147 |
+
}
|
148 |
+
// Appending the file input fields to the hidden form
|
149 |
+
// removes them from their original location:
|
150 |
+
form
|
151 |
+
.append(options.fileInput)
|
152 |
+
.prop('enctype', 'multipart/form-data')
|
153 |
+
// enctype must be set as encoding for IE:
|
154 |
+
.prop('encoding', 'multipart/form-data');
|
155 |
+
// Remove the HTML5 form attribute from the input(s):
|
156 |
+
options.fileInput.removeAttr('form');
|
157 |
+
}
|
158 |
+
form.submit();
|
159 |
+
// Insert the file input fields at their original location
|
160 |
+
// by replacing the clones with the originals:
|
161 |
+
if (fileInputClones && fileInputClones.length) {
|
162 |
+
options.fileInput.each(function (index, input) {
|
163 |
+
var clone = $(fileInputClones[index]);
|
164 |
+
// Restore the original name and form properties:
|
165 |
+
$(input)
|
166 |
+
.prop('name', clone.prop('name'))
|
167 |
+
.attr('form', clone.attr('form'));
|
168 |
+
clone.replaceWith(input);
|
169 |
+
});
|
170 |
+
}
|
171 |
+
});
|
172 |
+
form.append(iframe).appendTo(document.body);
|
173 |
+
},
|
174 |
+
abort: function () {
|
175 |
+
if (iframe) {
|
176 |
+
// javascript:false as iframe src aborts the request
|
177 |
+
// and prevents warning popups on HTTPS in IE6.
|
178 |
+
// concat is used to avoid the "Script URL" JSLint error:
|
179 |
+
iframe
|
180 |
+
.unbind('load')
|
181 |
+
.prop('src', initialIframeSrc);
|
182 |
+
}
|
183 |
+
if (form) {
|
184 |
+
form.remove();
|
185 |
+
}
|
186 |
+
}
|
187 |
+
};
|
188 |
+
}
|
189 |
+
});
|
190 |
|
191 |
+
// The iframe transport returns the iframe content document as response.
|
192 |
+
// The following adds converters from iframe to text, json, html, xml
|
193 |
+
// and script.
|
194 |
+
// Please note that the Content-Type for JSON responses has to be text/plain
|
195 |
+
// or text/html, if the browser doesn't include application/json in the
|
196 |
+
// Accept header, else IE will show a download dialog.
|
197 |
+
// The Content-Type for XML responses on the other hand has to be always
|
198 |
+
// application/xml or text/xml, so IE properly parses the XML response.
|
199 |
+
// See also
|
200 |
+
// https://github.com/blueimp/jQuery-File-Upload/wiki/Setup#content-type-negotiation
|
201 |
+
$.ajaxSetup({
|
202 |
+
converters: {
|
203 |
+
'iframe text': function (iframe) {
|
204 |
+
return iframe && $(iframe[0].body).text();
|
205 |
+
},
|
206 |
+
'iframe json': function (iframe) {
|
207 |
+
return iframe && jsonAPI[jsonParse]($(iframe[0].body).text());
|
208 |
+
},
|
209 |
+
'iframe html': function (iframe) {
|
210 |
+
return iframe && $(iframe[0].body).html();
|
211 |
+
},
|
212 |
+
'iframe xml': function (iframe) {
|
213 |
+
var xmlDoc = iframe && iframe[0];
|
214 |
+
return xmlDoc && $.isXMLDoc(xmlDoc) ? xmlDoc :
|
215 |
+
$.parseXML((xmlDoc.XMLDocument && xmlDoc.XMLDocument.xml) ||
|
216 |
+
$(xmlDoc.body).html());
|
217 |
+
},
|
218 |
+
'iframe script': function (iframe) {
|
219 |
+
return iframe && $.globalEval($(iframe[0].body).text());
|
220 |
+
}
|
221 |
+
}
|
222 |
+
});
|
223 |
|
224 |
}));
|
changelog.txt
CHANGED
@@ -1,3 +1,7 @@
|
|
|
|
|
|
|
|
|
|
1 |
= 1.33.2 =
|
2 |
* Fix: Issue with `[jobs]` filter form on some themes and plugins.
|
3 |
|
1 |
+
= 1.33.3 =
|
2 |
+
* Fix: Upgrade jquery-fileupload to v9.32.0
|
3 |
+
* Fix: Set frame origin on pages where shortcodes are embedded
|
4 |
+
|
5 |
= 1.33.2 =
|
6 |
* Fix: Issue with `[jobs]` filter form on some themes and plugins.
|
7 |
|
includes/class-wp-job-manager.php
CHANGED
@@ -94,6 +94,7 @@ class WP_Job_Manager {
|
|
94 |
add_action( 'wp_logout', array( $this, 'cleanup_job_posting_cookies' ) );
|
95 |
add_action( 'init', array( 'WP_Job_Manager_Email_Notifications', 'init' ) );
|
96 |
add_action( 'rest_api_init', array( $this, 'rest_init' ) );
|
|
|
97 |
|
98 |
// Filters.
|
99 |
add_filter( 'wp_privacy_personal_data_exporters', array( 'WP_Job_Manager_Data_Exporter', 'register_wpjm_user_data_exporter' ) );
|
@@ -142,7 +143,7 @@ class WP_Job_Manager {
|
|
142 |
$content = sprintf(
|
143 |
// translators: Placeholders %1$s and %2$s are the names of the two cookies used in WP Job Manager.
|
144 |
__(
|
145 |
-
'This site adds the following cookies to help users resume job submissions that they
|
146 |
have started but have not completed: %1$s and %2$s', 'wp-job-manager'
|
147 |
),
|
148 |
'<code>wp-job-manager-submitting-job-id</code>', '<code>wp-job-manager-submitting-job-key</code>'
|
@@ -295,7 +296,6 @@ class WP_Job_Manager {
|
|
295 |
|
296 |
$enhanced_select_shortcodes = array( 'submit_job_form', 'job_dashboard', 'jobs' );
|
297 |
$enhanced_select_used_on_page = has_wpjm_shortcode( null, $enhanced_select_shortcodes );
|
298 |
-
|
299 |
/**
|
300 |
* Set the constant `JOB_MANAGER_DISABLE_CHOSEN_LEGACY_COMPAT` to true to test for future behavior once
|
301 |
* this legacy code is removed and `chosen` is no longer packaged with the plugin.
|
@@ -372,8 +372,8 @@ class WP_Job_Manager {
|
|
372 |
}
|
373 |
|
374 |
if ( job_manager_user_can_upload_file_via_ajax() ) {
|
375 |
-
wp_register_script( 'jquery-iframe-transport', JOB_MANAGER_PLUGIN_URL . '/assets/js/jquery-fileupload/jquery.iframe-transport.js', array( 'jquery' ), '9.
|
376 |
-
wp_register_script( 'jquery-fileupload', JOB_MANAGER_PLUGIN_URL . '/assets/js/jquery-fileupload/jquery.fileupload.js', array( 'jquery', 'jquery-iframe-transport', 'jquery-ui-widget' ), '9.
|
377 |
wp_register_script( 'wp-job-manager-ajax-file-upload', JOB_MANAGER_PLUGIN_URL . '/assets/js/ajax-file-upload.min.js', array( 'jquery', 'jquery-fileupload' ), JOB_MANAGER_VERSION, true );
|
378 |
|
379 |
ob_start();
|
@@ -472,4 +472,22 @@ class WP_Job_Manager {
|
|
472 |
wp_register_style( 'wp-job-manager-job-listings', JOB_MANAGER_PLUGIN_URL . '/assets/css/job-listings.css', array(), JOB_MANAGER_VERSION );
|
473 |
}
|
474 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
475 |
}
|
94 |
add_action( 'wp_logout', array( $this, 'cleanup_job_posting_cookies' ) );
|
95 |
add_action( 'init', array( 'WP_Job_Manager_Email_Notifications', 'init' ) );
|
96 |
add_action( 'rest_api_init', array( $this, 'rest_init' ) );
|
97 |
+
add_action( 'template_redirect', array( $this, 'send_frame_options_header' ) );
|
98 |
|
99 |
// Filters.
|
100 |
add_filter( 'wp_privacy_personal_data_exporters', array( 'WP_Job_Manager_Data_Exporter', 'register_wpjm_user_data_exporter' ) );
|
143 |
$content = sprintf(
|
144 |
// translators: Placeholders %1$s and %2$s are the names of the two cookies used in WP Job Manager.
|
145 |
__(
|
146 |
+
'This site adds the following cookies to help users resume job submissions that they
|
147 |
have started but have not completed: %1$s and %2$s', 'wp-job-manager'
|
148 |
),
|
149 |
'<code>wp-job-manager-submitting-job-id</code>', '<code>wp-job-manager-submitting-job-key</code>'
|
296 |
|
297 |
$enhanced_select_shortcodes = array( 'submit_job_form', 'job_dashboard', 'jobs' );
|
298 |
$enhanced_select_used_on_page = has_wpjm_shortcode( null, $enhanced_select_shortcodes );
|
|
|
299 |
/**
|
300 |
* Set the constant `JOB_MANAGER_DISABLE_CHOSEN_LEGACY_COMPAT` to true to test for future behavior once
|
301 |
* this legacy code is removed and `chosen` is no longer packaged with the plugin.
|
372 |
}
|
373 |
|
374 |
if ( job_manager_user_can_upload_file_via_ajax() ) {
|
375 |
+
wp_register_script( 'jquery-iframe-transport', JOB_MANAGER_PLUGIN_URL . '/assets/js/jquery-fileupload/jquery.iframe-transport.js', array( 'jquery' ), '9.32.0', true );
|
376 |
+
wp_register_script( 'jquery-fileupload', JOB_MANAGER_PLUGIN_URL . '/assets/js/jquery-fileupload/jquery.fileupload.js', array( 'jquery', 'jquery-iframe-transport', 'jquery-ui-widget' ), '9.32.0', true );
|
377 |
wp_register_script( 'wp-job-manager-ajax-file-upload', JOB_MANAGER_PLUGIN_URL . '/assets/js/ajax-file-upload.min.js', array( 'jquery', 'jquery-fileupload' ), JOB_MANAGER_VERSION, true );
|
378 |
|
379 |
ob_start();
|
472 |
wp_register_style( 'wp-job-manager-job-listings', JOB_MANAGER_PLUGIN_URL . '/assets/css/job-listings.css', array(), JOB_MANAGER_VERSION );
|
473 |
}
|
474 |
}
|
475 |
+
|
476 |
+
/**
|
477 |
+
*
|
478 |
+
* Ensure all user wpjm pages or pages containing wpjm shortcodes
|
479 |
+
* get an X-Frame-Options header.
|
480 |
+
*
|
481 |
+
* Disabling is not recommended, but if you must you can
|
482 |
+
*
|
483 |
+
* remove_action( 'template_redirect', array( WPJM(), 'send_frame_options_header' ) )
|
484 |
+
*
|
485 |
+
* @since 1.33.3
|
486 |
+
*
|
487 |
+
**/
|
488 |
+
public function send_frame_options_header() {
|
489 |
+
if ( is_wpjm() ) {
|
490 |
+
send_frame_options_header();
|
491 |
+
}
|
492 |
+
}
|
493 |
}
|
languages/wp-job-manager.pot
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
# This file is distributed under the GPL2+.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: WP Job Manager 1.33.
|
6 |
"Report-Msgid-Bugs-To: https://github.com/Automattic/WP-Job-Manager/issues\n"
|
7 |
-
"POT-Creation-Date: 2019-
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=utf-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
@@ -1453,16 +1453,16 @@ msgstr ""
|
|
1453 |
msgid "Enable Usage Tracking"
|
1454 |
msgstr ""
|
1455 |
|
1456 |
-
#: includes/class-wp-job-manager.php:
|
1457 |
#. translators: Placeholders %1$s and %2$s are the names of the two cookies
|
1458 |
#. used in WP Job Manager.
|
1459 |
msgid ""
|
1460 |
"This site adds the following cookies to help users resume job submissions "
|
1461 |
-
"that they
|
1462 |
"\t\t\t\thave started but have not completed: %1$s and %2$s"
|
1463 |
msgstr ""
|
1464 |
|
1465 |
-
#: includes/class-wp-job-manager.php:
|
1466 |
msgid "Load previous listings"
|
1467 |
msgstr ""
|
1468 |
|
2 |
# This file is distributed under the GPL2+.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: WP Job Manager 1.33.3\n"
|
6 |
"Report-Msgid-Bugs-To: https://github.com/Automattic/WP-Job-Manager/issues\n"
|
7 |
+
"POT-Creation-Date: 2019-07-08 16:37:22+00:00\n"
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=utf-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
1453 |
msgid "Enable Usage Tracking"
|
1454 |
msgstr ""
|
1455 |
|
1456 |
+
#: includes/class-wp-job-manager.php:145
|
1457 |
#. translators: Placeholders %1$s and %2$s are the names of the two cookies
|
1458 |
#. used in WP Job Manager.
|
1459 |
msgid ""
|
1460 |
"This site adds the following cookies to help users resume job submissions "
|
1461 |
+
"that they\n"
|
1462 |
"\t\t\t\thave started but have not completed: %1$s and %2$s"
|
1463 |
msgstr ""
|
1464 |
|
1465 |
+
#: includes/class-wp-job-manager.php:285
|
1466 |
msgid "Load previous listings"
|
1467 |
msgstr ""
|
1468 |
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: mikejolley, automattic, adamkheckler, alexsanford1, annezazu, cena
|
|
3 |
Tags: job manager, job listing, job board, job management, job lists, job list, job, jobs, company, hiring, employment, employer, employees, candidate, freelance, internship, job listings, positions, board, application, hiring, listing, manager, recruiting, recruitment, talent
|
4 |
Requires at least: 4.7.0
|
5 |
Tested up to: 5.2
|
6 |
-
Stable tag: 1.33.
|
7 |
License: GPLv3
|
8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
|
@@ -151,6 +151,9 @@ It then creates a database based on the parameters passed to it.
|
|
151 |
6. Job listings in admin.
|
152 |
|
153 |
== Changelog ==
|
|
|
|
|
|
|
154 |
|
155 |
= 1.33.2 =
|
156 |
* Fix: Issue with `[jobs]` filter form on some themes and plugins.
|
3 |
Tags: job manager, job listing, job board, job management, job lists, job list, job, jobs, company, hiring, employment, employer, employees, candidate, freelance, internship, job listings, positions, board, application, hiring, listing, manager, recruiting, recruitment, talent
|
4 |
Requires at least: 4.7.0
|
5 |
Tested up to: 5.2
|
6 |
+
Stable tag: 1.33.3
|
7 |
License: GPLv3
|
8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
|
151 |
6. Job listings in admin.
|
152 |
|
153 |
== Changelog ==
|
154 |
+
= 1.33.3 =
|
155 |
+
* Fix: Upgrade jquery-fileupload to v9.32.0
|
156 |
+
* Fix: Set frame origin on pages where shortcodes are embedded
|
157 |
|
158 |
= 1.33.2 =
|
159 |
* Fix: Issue with `[jobs]` filter form on some themes and plugins.
|
wp-job-manager.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: WP Job Manager
|
4 |
* Plugin URI: https://wpjobmanager.com/
|
5 |
* Description: Manage job listings from the WordPress admin panel, and allow users to post jobs directly to your site.
|
6 |
-
* Version: 1.33.
|
7 |
* Author: Automattic
|
8 |
* Author URI: https://wpjobmanager.com/
|
9 |
* Requires at least: 4.7.0
|
@@ -20,7 +20,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
20 |
}
|
21 |
|
22 |
// Define constants.
|
23 |
-
define( 'JOB_MANAGER_VERSION', '1.33.
|
24 |
define( 'JOB_MANAGER_PLUGIN_DIR', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
|
25 |
define( 'JOB_MANAGER_PLUGIN_URL', untrailingslashit( plugins_url( basename( plugin_dir_path( __FILE__ ) ), basename( __FILE__ ) ) ) );
|
26 |
define( 'JOB_MANAGER_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
|
3 |
* Plugin Name: WP Job Manager
|
4 |
* Plugin URI: https://wpjobmanager.com/
|
5 |
* Description: Manage job listings from the WordPress admin panel, and allow users to post jobs directly to your site.
|
6 |
+
* Version: 1.33.3
|
7 |
* Author: Automattic
|
8 |
* Author URI: https://wpjobmanager.com/
|
9 |
* Requires at least: 4.7.0
|
20 |
}
|
21 |
|
22 |
// Define constants.
|
23 |
+
define( 'JOB_MANAGER_VERSION', '1.33.3' );
|
24 |
define( 'JOB_MANAGER_PLUGIN_DIR', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
|
25 |
define( 'JOB_MANAGER_PLUGIN_URL', untrailingslashit( plugins_url( basename( plugin_dir_path( __FILE__ ) ), basename( __FILE__ ) ) ) );
|
26 |
define( 'JOB_MANAGER_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
|