aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/blueimp/jquery-file-upload/js/app.js
diff options
context:
space:
mode:
authorMike Macgirvin <mike@macgirvin.com>2018-10-31 15:56:08 +1100
committerMike Macgirvin <mike@macgirvin.com>2018-10-31 15:56:08 +1100
commit7e1f431eca7a8aa68fc0badfaa88e88de3ba094c (patch)
tree16beba352cd4ace4aa6eb13c7f9c1c82c92013b4 /vendor/blueimp/jquery-file-upload/js/app.js
parent70c55da1df69d90dcbeb5a78c994b23a8456bfc9 (diff)
downloadvolse-hubzilla-7e1f431eca7a8aa68fc0badfaa88e88de3ba094c.tar.gz
volse-hubzilla-7e1f431eca7a8aa68fc0badfaa88e88de3ba094c.tar.bz2
volse-hubzilla-7e1f431eca7a8aa68fc0badfaa88e88de3ba094c.zip
yet another blueimp vulnerability. Move to composer.
Diffstat (limited to 'vendor/blueimp/jquery-file-upload/js/app.js')
-rw-r--r--vendor/blueimp/jquery-file-upload/js/app.js101
1 files changed, 101 insertions, 0 deletions
diff --git a/vendor/blueimp/jquery-file-upload/js/app.js b/vendor/blueimp/jquery-file-upload/js/app.js
new file mode 100644
index 000000000..e6b7bce3e
--- /dev/null
+++ b/vendor/blueimp/jquery-file-upload/js/app.js
@@ -0,0 +1,101 @@
+/*
+ * jQuery File Upload Plugin Angular JS Example
+ * https://github.com/blueimp/jQuery-File-Upload
+ *
+ * Copyright 2013, Sebastian Tschan
+ * https://blueimp.net
+ *
+ * Licensed under the MIT license:
+ * https://opensource.org/licenses/MIT
+ */
+
+/* jshint nomen:false */
+/* global window, angular */
+
+;(function () {
+ 'use strict';
+
+ var isOnGitHub = window.location.hostname === 'blueimp.github.io',
+ url = isOnGitHub ? '//jquery-file-upload.appspot.com/' : 'server/php/';
+
+ angular.module('demo', [
+ 'blueimp.fileupload'
+ ])
+ .config([
+ '$httpProvider', 'fileUploadProvider',
+ function ($httpProvider, fileUploadProvider) {
+ delete $httpProvider.defaults.headers.common['X-Requested-With'];
+ fileUploadProvider.defaults.redirect = window.location.href.replace(
+ /\/[^\/]*$/,
+ '/cors/result.html?%s'
+ );
+ if (isOnGitHub) {
+ // Demo settings:
+ angular.extend(fileUploadProvider.defaults, {
+ // Enable image resizing, except for Android and Opera,
+ // which actually support image resizing, but fail to
+ // send Blob objects via XHR requests:
+ disableImageResize: /Android(?!.*Chrome)|Opera/
+ .test(window.navigator.userAgent),
+ maxFileSize: 999000,
+ acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i
+ });
+ }
+ }
+ ])
+
+ .controller('DemoFileUploadController', [
+ '$scope', '$http', '$filter', '$window',
+ function ($scope, $http) {
+ $scope.options = {
+ url: url
+ };
+ if (!isOnGitHub) {
+ $scope.loadingFiles = true;
+ $http.get(url)
+ .then(
+ function (response) {
+ $scope.loadingFiles = false;
+ $scope.queue = response.data.files || [];
+ },
+ function () {
+ $scope.loadingFiles = false;
+ }
+ );
+ }
+ }
+ ])
+
+ .controller('FileDestroyController', [
+ '$scope', '$http',
+ function ($scope, $http) {
+ var file = $scope.file,
+ state;
+ if (file.url) {
+ file.$state = function () {
+ return state;
+ };
+ file.$destroy = function () {
+ state = 'pending';
+ return $http({
+ url: file.deleteUrl,
+ method: file.deleteType
+ }).then(
+ function () {
+ state = 'resolved';
+ $scope.clear(file);
+ },
+ function () {
+ state = 'rejected';
+ }
+ );
+ };
+ } else if (!file.$cancel && !file._index) {
+ file.$cancel = function () {
+ $scope.clear(file);
+ };
+ }
+ }
+ ]);
+
+}());